@dxos/plugin-chess 0.8.4-main.5ea62a8 → 0.8.4-main.72ec0f3
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/{ChessboardContainer-HBHUXBG3.mjs → ChessboardContainer-5YXEM4VR.mjs} +20 -20
- package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-FD4TL5EE.mjs +11 -0
- package/dist/lib/browser/{chunk-UDWRTBWA.mjs → chunk-5DOZV3PW.mjs} +113 -143
- package/dist/lib/browser/chunk-5DOZV3PW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PE3IWOFR.mjs → chunk-DUO4WTAM.mjs} +5 -5
- package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-T275KG4U.mjs → chunk-FBLAVAMY.mjs} +12 -12
- package/dist/lib/browser/chunk-FBLAVAMY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-H65TQTPW.mjs → chunk-Q5TZCIH7.mjs} +2 -2
- package/dist/lib/browser/{chunk-VTIITHYS.mjs → chunk-TIIGNOGK.mjs} +30 -14
- package/dist/lib/browser/chunk-TIIGNOGK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +22 -21
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-DA5H5633.mjs → intent-resolver-GXZN2EBT.mjs} +5 -5
- package/dist/lib/browser/{intent-resolver-DA5H5633.mjs.map → intent-resolver-GXZN2EBT.mjs.map} +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-FSDNVKZN.mjs → react-surface-KTTAUHAA.mjs} +7 -7
- package/dist/lib/browser/{react-surface-FSDNVKZN.mjs.map → react-surface-KTTAUHAA.mjs.map} +1 -1
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{ChessboardContainer-PF75AEMW.mjs → ChessboardContainer-7OQ6TOKB.mjs} +20 -20
- package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-O7ZM3HUF.mjs +12 -0
- package/dist/lib/node-esm/{chunk-PIRITYWV.mjs → chunk-F4C2HVZL.mjs} +113 -143
- package/dist/lib/node-esm/chunk-F4C2HVZL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6OWCPDUA.mjs → chunk-KNOOJFIR.mjs} +5 -5
- package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5DYLCQBR.mjs → chunk-MP3A3AGA.mjs} +12 -12
- package/dist/lib/node-esm/chunk-MP3A3AGA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3NZRGOSV.mjs → chunk-RTCAAOLF.mjs} +30 -14
- package/dist/lib/node-esm/chunk-RTCAAOLF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IFDV434X.mjs → chunk-VVXTAVIS.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +22 -21
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-PODONUD3.mjs → intent-resolver-HK5L6P6Z.mjs} +5 -5
- package/dist/lib/node-esm/{intent-resolver-PODONUD3.mjs.map → intent-resolver-HK5L6P6Z.mjs.map} +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-2TW3PIGQ.mjs → react-surface-VO4PSY6O.mjs} +7 -7
- package/dist/lib/node-esm/{react-surface-2TW3PIGQ.mjs.map → react-surface-VO4PSY6O.mjs.map} +1 -1
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/ChessPlugin.d.ts +1 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +2 -2
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/components/Card.stories.d.ts +11 -3
- package/dist/types/src/components/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard.d.ts +11 -12
- package/dist/types/src/components/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard.stories.d.ts +11 -8
- package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +2 -1
- package/dist/types/src/components/ChessboardArticle.d.ts.map +1 -1
- package/dist/types/src/components/{ChessboardInfo.d.ts → Info.d.ts} +5 -5
- package/dist/types/src/components/Info.d.ts.map +1 -0
- package/dist/types/src/functions/create.d.ts +2 -2
- package/dist/types/src/functions/create.d.ts.map +1 -1
- package/dist/types/src/functions/move.d.ts +1 -1
- package/dist/types/src/functions/move.d.ts.map +1 -1
- package/dist/types/src/functions/play.d.ts +2 -1
- package/dist/types/src/functions/play.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +8 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +2 -2
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/ChessAction.d.ts +1 -1
- package/dist/types/src/types/ChessAction.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -36
- package/src/ChessPlugin.tsx +47 -47
- package/src/capabilities/artifact-definition.ts +3 -2
- package/src/capabilities/blueprint-definition.ts +3 -3
- package/src/components/Card.stories.tsx +3 -5
- package/src/components/Chessboard.stories.tsx +3 -4
- package/src/components/Chessboard.tsx +79 -55
- package/src/components/ChessboardArticle.tsx +22 -18
- package/src/components/ChessboardContainer.tsx +1 -1
- package/src/components/{ChessboardInfo.tsx → Info.tsx} +103 -40
- package/src/functions/create.ts +4 -2
- package/src/functions/move.ts +4 -2
- package/src/functions/play.ts +13 -3
- package/src/meta.ts +4 -4
- package/src/translations.ts +8 -6
- package/src/types/Chess.ts +20 -26
- package/src/types/ChessAction.ts +1 -1
- package/dist/lib/browser/ChessboardContainer-HBHUXBG3.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-W5PLLXPP.mjs +0 -11
- package/dist/lib/browser/chunk-PE3IWOFR.mjs.map +0 -7
- package/dist/lib/browser/chunk-T275KG4U.mjs.map +0 -7
- package/dist/lib/browser/chunk-UDWRTBWA.mjs.map +0 -7
- package/dist/lib/browser/chunk-VTIITHYS.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-PF75AEMW.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-PR5YZC6M.mjs +0 -12
- package/dist/lib/node-esm/chunk-3NZRGOSV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5DYLCQBR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6OWCPDUA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PIRITYWV.mjs.map +0 -7
- package/dist/types/src/components/ChessboardInfo.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardPlayers.d.ts +0 -8
- package/dist/types/src/components/ChessboardPlayers.d.ts.map +0 -1
- package/src/components/ChessboardPlayers.tsx +0 -98
- /package/dist/lib/browser/{blueprint-definition-W5PLLXPP.mjs.map → blueprint-definition-FD4TL5EE.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-H65TQTPW.mjs.map → chunk-Q5TZCIH7.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-PR5YZC6M.mjs.map → blueprint-definition-O7ZM3HUF.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-IFDV434X.mjs.map → chunk-VVXTAVIS.mjs.map} +0 -0
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { ChessboardContainer } from '../components';\nimport { meta } from '../meta';\nimport { Chess } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: meta.id,\n role: ['article', 'section', 'card--intrinsic', 'card--extrinsic', 'card--popover', 'card--transclusion'],\n // TODO(burdon): Could this be standardized so that we don't require a subject property.\n filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),\n component: ({ data, role }) => <ChessboardContainer game={data.subject} role={role} />,\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AAMpB,IAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AAMpB,IAAA,yBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAIC,KAAKD;IACTE,MAAM;MAAC;MAAW;MAAW;MAAmB;MAAmB;MAAiB;;;IAEpFC,QAAQ,CAACC,SAA0CC,IAAIC,WAAWC,cAAMC,MAAMJ,KAAKK,OAAO;IAC1FC,WAAW,CAAC,EAAEN,MAAMF,KAAI,MAAO,sBAAA,cAACS,qBAAAA;MAAoBC,MAAMR,KAAKK;MAASP;;EAC1E,CAAA;CACD;",
|
|
6
6
|
"names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Chess", "Game", "subject", "component", "ChessboardContainer", "game"]
|
|
7
7
|
}
|
package/dist/lib/node-esm/{ChessboardContainer-PF75AEMW.mjs → ChessboardContainer-7OQ6TOKB.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
Chessboard
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F4C2HVZL.mjs";
|
|
5
5
|
import {
|
|
6
6
|
meta
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KNOOJFIR.mjs";
|
|
8
8
|
|
|
9
9
|
// src/components/ChessboardContainer.tsx
|
|
10
10
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
@@ -14,10 +14,10 @@ import { getSpace } from "@dxos/react-client/echo";
|
|
|
14
14
|
// src/components/ChessboardArticle.tsx
|
|
15
15
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
16
16
|
import React, { useCallback, useRef, useState } from "react";
|
|
17
|
-
import {
|
|
17
|
+
import { Toolbar, useTranslation } from "@dxos/react-ui";
|
|
18
18
|
import { StackItem } from "@dxos/react-ui-stack";
|
|
19
19
|
import { mx } from "@dxos/react-ui-theme";
|
|
20
|
-
var ChessboardArticle = ({ game }) => {
|
|
20
|
+
var ChessboardArticle = ({ game, role }) => {
|
|
21
21
|
var _effect = _useSignals();
|
|
22
22
|
try {
|
|
23
23
|
const { t } = useTranslation(meta.id);
|
|
@@ -28,13 +28,22 @@ var ChessboardArticle = ({ game }) => {
|
|
|
28
28
|
controller.current?.setMoveNumber(index);
|
|
29
29
|
}, []);
|
|
30
30
|
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
31
|
-
|
|
31
|
+
toolbar: true,
|
|
32
|
+
classNames: "@container"
|
|
32
33
|
}, /* @__PURE__ */ React.createElement(Chessboard.Root, {
|
|
33
34
|
game,
|
|
34
35
|
ref: controller
|
|
35
|
-
}, /* @__PURE__ */ React.createElement(
|
|
36
|
-
|
|
36
|
+
}, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
|
|
37
|
+
icon: "ph--info--regular",
|
|
38
|
+
iconOnly: true,
|
|
39
|
+
label: t("toggle info button"),
|
|
40
|
+
disabled: open,
|
|
41
|
+
classNames: mx("invisible @3xl:visible"),
|
|
42
|
+
onClick: () => setOpen((open2) => !open2)
|
|
43
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
44
|
+
className: mx("grid bs-full is-full gap-2", open && "@3xl:grid-cols-[1fr_320px]", role === "section" && "aspect-square", role === "section" && open && "@3xl:aspect-auto")
|
|
37
45
|
}, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, {
|
|
46
|
+
classNames: "m-4 rounded-sm overflow-hidden",
|
|
38
47
|
orientation
|
|
39
48
|
})), open && /* @__PURE__ */ React.createElement("div", {
|
|
40
49
|
className: "hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden"
|
|
@@ -45,17 +54,7 @@ var ChessboardArticle = ({ game }) => {
|
|
|
45
54
|
onOrientationChange: setOrientation,
|
|
46
55
|
onClose: () => setOpen(false),
|
|
47
56
|
onSelect: handleSelect
|
|
48
|
-
}))
|
|
49
|
-
className: "flex justify-center items-center"
|
|
50
|
-
}, /* @__PURE__ */ React.createElement(Chessboard.Players, null, /* @__PURE__ */ React.createElement(IconButton, {
|
|
51
|
-
variant: "ghost",
|
|
52
|
-
icon: "ph--info--regular",
|
|
53
|
-
iconOnly: true,
|
|
54
|
-
label: t("button toggle info"),
|
|
55
|
-
size: 6,
|
|
56
|
-
classNames: mx("invisible", !open && "@3xl:visible"),
|
|
57
|
-
onClick: () => setOpen((open2) => !open2)
|
|
58
|
-
}))))));
|
|
57
|
+
})))));
|
|
59
58
|
} finally {
|
|
60
59
|
_effect.f();
|
|
61
60
|
}
|
|
@@ -81,7 +80,8 @@ var ChessboardContainer = ({ game, role }) => {
|
|
|
81
80
|
}
|
|
82
81
|
default: {
|
|
83
82
|
return /* @__PURE__ */ React2.createElement(ChessboardArticle, {
|
|
84
|
-
game
|
|
83
|
+
game,
|
|
84
|
+
role
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -94,4 +94,4 @@ export {
|
|
|
94
94
|
ChessboardContainer,
|
|
95
95
|
ChessboardContainer_default as default
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=ChessboardContainer-
|
|
97
|
+
//# sourceMappingURL=ChessboardContainer-7OQ6TOKB.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ChessboardContainer.tsx", "../../../src/components/ChessboardArticle.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { type Chess } from '../types';\n\nimport { Chessboard } from './Chessboard';\nimport { ChessboardArticle } from './ChessboardArticle';\n\nexport type ChessboardContainerProps = {\n game: Chess.Game;\n role?: string;\n};\n\nexport const ChessboardContainer = ({ game, role }: ChessboardContainerProps) => {\n const space = getSpace(game);\n if (!space) {\n return null;\n }\n\n switch (role) {\n case 'card--popover':\n case 'card--intrinsic':\n case 'card--extrinsic': {\n return (\n <Chessboard.Root game={game}>\n <Chessboard.Content role={role}>\n <Chessboard.Board />\n </Chessboard.Content>\n </Chessboard.Root>\n );\n }\n\n default: {\n return <ChessboardArticle game={game} role={role} />;\n }\n }\n};\n\nexport default ChessboardContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type Player } from '@dxos/react-ui-gameboard';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../meta';\nimport { type Chess } from '../types';\n\nimport { Chessboard, type ChessboardController, type ChessboardInfoProps } from './Chessboard';\n\nexport const ChessboardArticle = ({ game, role }: { game: Chess.Game; role?: string }) => {\n const { t } = useTranslation(meta.id);\n const [orientation, setOrientation] = useState<Player>('white');\n const [open, setOpen] = useState(true);\n const controller = useRef<ChessboardController>(null);\n\n // TODO(burdon): Keyboard handler.\n const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {\n controller.current?.setMoveNumber(index);\n }, []);\n\n return (\n <StackItem.Content toolbar classNames='@container'>\n <Chessboard.Root game={game} ref={controller}>\n <Toolbar.Root>\n <Toolbar.IconButton\n icon='ph--info--regular'\n iconOnly\n label={t('toggle info button')}\n disabled={open}\n classNames={mx('invisible @3xl:visible')}\n onClick={() => setOpen((open) => !open)}\n />\n </Toolbar.Root>\n <div\n className={mx(\n 'grid bs-full is-full gap-2',\n open && '@3xl:grid-cols-[1fr_320px]',\n role === 'section' && 'aspect-square',\n role === 'section' && open && '@3xl:aspect-auto',\n )}\n >\n <Chessboard.Content>\n <Chessboard.Board classNames='m-4 rounded-sm overflow-hidden' orientation={orientation} />\n </Chessboard.Content>\n {open && (\n <div className='hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden'>\n <Chessboard.Info\n orientation={orientation}\n min={8}\n max={8}\n onOrientationChange={setOrientation}\n onClose={() => setOpen(false)}\n onSelect={handleSelect}\n />\n </div>\n )}\n </div>\n </Chessboard.Root>\n </StackItem.Content>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,gBAAgB;;;;ACFzB,OAAOC,SAASC,aAAaC,QAAQC,gBAAgB;AAErD,SAASC,SAASC,sBAAsB;AAExC,SAASC,iBAAiB;AAC1B,SAASC,UAAU;AAOZ,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,KAAI,MAAuC;;;AACnF,UAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,UAAM,CAACC,aAAaC,cAAAA,IAAkBC,SAAiB,OAAA;AACvD,UAAM,CAACC,MAAMC,OAAAA,IAAWF,SAAS,IAAA;AACjC,UAAMG,aAAaC,OAA6B,IAAA;AAGhD,UAAMC,eAA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UAAkBT;UAAYC;;MACxC;IACF;;;;AACF;AAEA,IAAA,8BAAeF;",
|
|
6
|
+
"names": ["React", "getSpace", "React", "useCallback", "useRef", "useState", "Toolbar", "useTranslation", "StackItem", "mx", "ChessboardArticle", "game", "role", "t", "useTranslation", "meta", "id", "orientation", "setOrientation", "useState", "open", "setOpen", "controller", "useRef", "handleSelect", "useCallback", "index", "current", "setMoveNumber", "StackItem", "Content", "toolbar", "classNames", "Chessboard", "Root", "ref", "Toolbar", "IconButton", "icon", "iconOnly", "label", "disabled", "mx", "onClick", "div", "className", "Board", "Info", "min", "max", "onOrientationChange", "onClose", "onSelect", "ChessboardContainer", "game", "role", "space", "getSpace", "React", "Chessboard", "Root", "Content", "Board", "ChessboardArticle"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CHESS_BLUEPRINT_KEY,
|
|
4
|
+
blueprint_definition_default
|
|
5
|
+
} from "./chunk-RTCAAOLF.mjs";
|
|
6
|
+
import "./chunk-MP3A3AGA.mjs";
|
|
7
|
+
import "./chunk-KNOOJFIR.mjs";
|
|
8
|
+
export {
|
|
9
|
+
CHESS_BLUEPRINT_KEY,
|
|
10
|
+
blueprint_definition_default as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=blueprint-definition-O7ZM3HUF.mjs.map
|
|
@@ -1,63 +1,79 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KNOOJFIR.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/Chessboard.tsx
|
|
7
|
-
import { useSignals as
|
|
8
|
-
import
|
|
7
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
8
|
+
import React2, { forwardRef, useCallback, useEffect as useEffect2, useImperativeHandle, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
9
9
|
import { addEventListener } from "@dxos/async";
|
|
10
|
-
import { ChessModel, Gameboard, Chessboard as
|
|
11
|
-
import {
|
|
10
|
+
import { ChessModel, Gameboard, Chessboard as NaturalChessboard, getRawPgn, useGameboardContext as useGameboardContext2 } from "@dxos/react-ui-gameboard";
|
|
11
|
+
import { useSoundEffect } from "@dxos/react-ui-sfx";
|
|
12
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
12
13
|
|
|
13
|
-
// src/components/
|
|
14
|
+
// src/components/Info.tsx
|
|
14
15
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
15
16
|
import React, { useEffect, useMemo, useRef } from "react";
|
|
16
|
-
import {
|
|
17
|
+
import { generateName } from "@dxos/display-name";
|
|
18
|
+
import { getSpace, useMembers } from "@dxos/react-client/echo";
|
|
19
|
+
import { Icon, IconButton, Select, useTranslation } from "@dxos/react-ui";
|
|
17
20
|
import { useGameboardContext } from "@dxos/react-ui-gameboard";
|
|
18
21
|
import { mx } from "@dxos/react-ui-theme";
|
|
19
|
-
var
|
|
22
|
+
var Info = ({ classNames, orientation = "white", onOrientationChange, onClose, ...props }) => {
|
|
20
23
|
var _effect = _useSignals();
|
|
21
24
|
try {
|
|
22
25
|
const { t } = useTranslation(meta.id);
|
|
23
|
-
const { model } = useGameboardContext(
|
|
26
|
+
const { model } = useGameboardContext(Info.displayName);
|
|
27
|
+
const members = useMembers(getSpace(model.object)?.key);
|
|
24
28
|
return /* @__PURE__ */ React.createElement("div", {
|
|
25
|
-
className: mx("grid grid-rows-[min-content_1fr_min-content] is-full min-is-[
|
|
29
|
+
className: mx("grid grid-rows-[min-content_1fr_min-content] is-full min-is-[18rem] p-2 overflow-hidden bg-groupSurface rounded-sm", classNames)
|
|
26
30
|
}, /* @__PURE__ */ React.createElement(PlayerIndicator, {
|
|
27
31
|
model,
|
|
28
32
|
player: orientation === "white" ? "black" : "white",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
icon: onClose && /* @__PURE__ */ React.createElement(IconButton, {
|
|
34
|
+
icon: "ph--x--regular",
|
|
35
|
+
iconOnly: true,
|
|
36
|
+
label: t("close info button"),
|
|
37
|
+
size: 4,
|
|
38
|
+
onClick: onClose
|
|
39
|
+
})
|
|
40
|
+
}, /* @__PURE__ */ React.createElement(PlayerSelector, {
|
|
41
|
+
value: model.object.players?.[orientation === "white" ? "black" : "white"],
|
|
42
|
+
onValueChange: (value) => {
|
|
43
|
+
model.object.players[orientation === "white" ? "black" : "white"] = value;
|
|
44
|
+
},
|
|
45
|
+
members
|
|
36
46
|
})), /* @__PURE__ */ React.createElement(History, {
|
|
37
47
|
model,
|
|
38
48
|
...props
|
|
39
49
|
}), /* @__PURE__ */ React.createElement(PlayerIndicator, {
|
|
40
50
|
model,
|
|
41
51
|
player: orientation,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
icon: onOrientationChange && /* @__PURE__ */ React.createElement(IconButton, {
|
|
53
|
+
classNames: mx("transition duration-200 ease-linear", orientation === "white" && "rotate-180"),
|
|
54
|
+
icon: "ph--arrows-clockwise--regular",
|
|
55
|
+
iconOnly: true,
|
|
56
|
+
label: t("flip board button"),
|
|
57
|
+
size: 4,
|
|
58
|
+
onClick: () => onOrientationChange(orientation === "white" ? "black" : "white")
|
|
59
|
+
})
|
|
60
|
+
}, /* @__PURE__ */ React.createElement(PlayerSelector, {
|
|
61
|
+
value: model.object.players?.[orientation],
|
|
62
|
+
onValueChange: (value) => {
|
|
63
|
+
model.object.players[orientation] = value;
|
|
64
|
+
},
|
|
65
|
+
members
|
|
50
66
|
})));
|
|
51
67
|
} finally {
|
|
52
68
|
_effect.f();
|
|
53
69
|
}
|
|
54
70
|
};
|
|
55
|
-
|
|
71
|
+
Info.displayName = "Chessboard.Info";
|
|
56
72
|
var History = ({ classNames, model, min, max, onSelect }) => {
|
|
57
73
|
var _effect = _useSignals();
|
|
58
74
|
try {
|
|
59
75
|
const { t } = useTranslation(meta.id);
|
|
60
|
-
const label = model.game.isGameOver() ? model.game.isCheckmate() ? t("game.checkmate") : model.game.isStalemate() ? t("game.stalemate") : t("game.draw") : model.game.isCheck() ? t("game.check") : void 0;
|
|
76
|
+
const label = model.game.isGameOver() ? model.game.isCheckmate() ? t("game.checkmate label") : model.game.isStalemate() ? t("game.stalemate label") : t("game.draw label") : model.game.isCheck() ? t("game.check label") : void 0;
|
|
61
77
|
const history = model.game.history();
|
|
62
78
|
const moves = useMemo(() => history.reduce((acc, move, index) => {
|
|
63
79
|
if (index % 2 === 0) {
|
|
@@ -97,7 +113,7 @@ var History = ({ classNames, model, min, max, onSelect }) => {
|
|
|
97
113
|
]);
|
|
98
114
|
return /* @__PURE__ */ React.createElement("div", {
|
|
99
115
|
ref: scrollerRef,
|
|
100
|
-
className: mx("overflow-y-
|
|
116
|
+
className: mx("overflow-y-auto", classNames),
|
|
101
117
|
style: {
|
|
102
118
|
minHeight: min === void 0 ? "auto" : `${min * 24}px`,
|
|
103
119
|
maxHeight: max === void 0 ? "auto" : `${max * 24}px`
|
|
@@ -122,12 +138,12 @@ var History = ({ classNames, model, min, max, onSelect }) => {
|
|
|
122
138
|
_effect.f();
|
|
123
139
|
}
|
|
124
140
|
};
|
|
125
|
-
var PlayerIndicator = ({ children, model, player,
|
|
141
|
+
var PlayerIndicator = ({ children, model, player, icon }) => {
|
|
126
142
|
var _effect = _useSignals();
|
|
127
143
|
try {
|
|
128
144
|
const turn = player === (model.game.turn() === "w" ? "white" : "black");
|
|
129
145
|
return /* @__PURE__ */ React.createElement("div", {
|
|
130
|
-
className: "grid grid-cols-[2rem_1fr_2rem] gap-
|
|
146
|
+
className: "grid grid-cols-[2rem_1fr_2rem] gap-2 bs-[--rail-size] pli-1 flex items-center overflow-hidden"
|
|
131
147
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
132
148
|
className: "place-items-center"
|
|
133
149
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
@@ -135,107 +151,46 @@ var PlayerIndicator = ({ children, model, player, title }) => {
|
|
|
135
151
|
size: 6,
|
|
136
152
|
classNames: mx(turn && (model.game.isCheckmate() ? "text-red-500" : "text-green-500"))
|
|
137
153
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
138
|
-
className: "truncate"
|
|
139
|
-
},
|
|
140
|
-
} finally {
|
|
141
|
-
_effect.f();
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// src/components/ChessboardPlayers.tsx
|
|
146
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
147
|
-
import React2 from "react";
|
|
148
|
-
import { generateName } from "@dxos/display-name";
|
|
149
|
-
import { getSpace, useMembers } from "@dxos/react-client/echo";
|
|
150
|
-
import { Icon as Icon2, Input, Select, useThemeContext } from "@dxos/react-ui";
|
|
151
|
-
import { useGameboardContext as useGameboardContext2 } from "@dxos/react-ui-gameboard";
|
|
152
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
153
|
-
var ChessboardPlayers = ({ classNames, children }) => {
|
|
154
|
-
var _effect = _useSignals2();
|
|
155
|
-
try {
|
|
156
|
-
const { model } = useGameboardContext2(ChessboardPlayers.displayName);
|
|
157
|
-
const members = useMembers(getSpace(model.object)?.key);
|
|
158
|
-
const players = model.object.players;
|
|
159
|
-
if (!players) {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
163
|
-
role: "none",
|
|
164
|
-
className: mx2("grid grid-cols-[1fr_min-content_1fr] pis-2 pie-2 overflow-hidden", classNames)
|
|
165
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
166
|
-
role: "none",
|
|
167
|
-
className: "flex flex-row-reverse items-center gap-2"
|
|
168
|
-
}, /* @__PURE__ */ React2.createElement(PlayerSelect, {
|
|
169
|
-
side: "white",
|
|
170
|
-
value: players.white,
|
|
171
|
-
onValueChange: (player) => players.white = player,
|
|
172
|
-
members
|
|
173
|
-
})), /* @__PURE__ */ React2.createElement("div", {
|
|
174
|
-
className: "flex flex-row justify-center items-center"
|
|
175
|
-
}, children), /* @__PURE__ */ React2.createElement("div", {
|
|
176
|
-
role: "none",
|
|
177
|
-
className: "flex flex-row items-center gap-2"
|
|
178
|
-
}, /* @__PURE__ */ React2.createElement(PlayerSelect, {
|
|
179
|
-
side: "black",
|
|
180
|
-
value: players.black,
|
|
181
|
-
onValueChange: (player) => players.black = player,
|
|
182
|
-
members
|
|
183
|
-
})));
|
|
154
|
+
className: "truncate overflow-hidden items-center"
|
|
155
|
+
}, children), icon);
|
|
184
156
|
} finally {
|
|
185
157
|
_effect.f();
|
|
186
158
|
}
|
|
187
159
|
};
|
|
188
|
-
|
|
189
|
-
var
|
|
190
|
-
var _effect = _useSignals2();
|
|
160
|
+
var PlayerSelector = ({ value, onValueChange, members }) => {
|
|
161
|
+
var _effect = _useSignals();
|
|
191
162
|
try {
|
|
192
|
-
const {
|
|
193
|
-
|
|
194
|
-
return /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, null, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
195
|
-
"aria-label": `Chess icon for side ${side}`,
|
|
196
|
-
icon: `ph--crown-cross--${iconFillMode || "regular"}`,
|
|
197
|
-
size: 6
|
|
198
|
-
})), /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
163
|
+
const { t } = useTranslation(meta.id);
|
|
164
|
+
return /* @__PURE__ */ React.createElement(Select.Root, {
|
|
199
165
|
value,
|
|
200
166
|
onValueChange
|
|
201
|
-
}, /* @__PURE__ */
|
|
202
|
-
placeholder: "
|
|
203
|
-
}), /* @__PURE__ */
|
|
167
|
+
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
168
|
+
placeholder: t("select player button")
|
|
169
|
+
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, members.map((member) => {
|
|
204
170
|
const memberKey = member.identity.identityKey.toHex();
|
|
205
171
|
const displayName = member.identity?.profile?.displayName || generateName(memberKey);
|
|
206
|
-
return /* @__PURE__ */
|
|
172
|
+
return /* @__PURE__ */ React.createElement(Select.Option, {
|
|
207
173
|
key: memberKey,
|
|
208
174
|
value: memberKey
|
|
209
175
|
}, displayName);
|
|
210
|
-
})), /* @__PURE__ */
|
|
176
|
+
})), /* @__PURE__ */ React.createElement(Select.Arrow, null))));
|
|
211
177
|
} finally {
|
|
212
178
|
_effect.f();
|
|
213
179
|
}
|
|
214
180
|
};
|
|
215
181
|
|
|
216
182
|
// src/components/Chessboard.tsx
|
|
217
|
-
function _define_property(obj, key, value) {
|
|
218
|
-
if (key in obj) {
|
|
219
|
-
Object.defineProperty(obj, key, {
|
|
220
|
-
value,
|
|
221
|
-
enumerable: true,
|
|
222
|
-
configurable: true,
|
|
223
|
-
writable: true
|
|
224
|
-
});
|
|
225
|
-
} else {
|
|
226
|
-
obj[key] = value;
|
|
227
|
-
}
|
|
228
|
-
return obj;
|
|
229
|
-
}
|
|
230
183
|
var ExtendedChessModel = class extends ChessModel {
|
|
184
|
+
object;
|
|
231
185
|
constructor(object) {
|
|
232
|
-
super(),
|
|
186
|
+
super(), this.object = object;
|
|
233
187
|
}
|
|
234
188
|
};
|
|
235
|
-
var
|
|
236
|
-
var _effect =
|
|
189
|
+
var Root = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRef) => {
|
|
190
|
+
var _effect = _useSignals2();
|
|
237
191
|
try {
|
|
238
192
|
const model = useMemo2(() => new ExtendedChessModel(game), []);
|
|
193
|
+
const click = useSoundEffect("Click");
|
|
239
194
|
useImperativeHandle(forwardedRef, () => {
|
|
240
195
|
return {
|
|
241
196
|
setMoveNumber: (index) => model.setMoveIndex(index)
|
|
@@ -244,15 +199,56 @@ var ChessboardRoot = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRe
|
|
|
244
199
|
model
|
|
245
200
|
]);
|
|
246
201
|
useEffect2(() => {
|
|
247
|
-
model.
|
|
202
|
+
if (model.pgn !== getRawPgn(game.pgn ?? "")) {
|
|
203
|
+
const silent = model.pgn === "*";
|
|
204
|
+
model.update(game.pgn);
|
|
205
|
+
if (!silent) {
|
|
206
|
+
void click.play();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
248
209
|
}, [
|
|
249
210
|
game.pgn
|
|
250
211
|
]);
|
|
212
|
+
const handleDrop = useCallback((move) => {
|
|
213
|
+
if (!model.makeMove(move)) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
void click.play();
|
|
217
|
+
game.pgn = model.pgn;
|
|
218
|
+
return true;
|
|
219
|
+
}, [
|
|
220
|
+
model
|
|
221
|
+
]);
|
|
222
|
+
return /* @__PURE__ */ React2.createElement(Gameboard.Root, {
|
|
223
|
+
model,
|
|
224
|
+
onDrop: handleDrop
|
|
225
|
+
}, children);
|
|
226
|
+
} finally {
|
|
227
|
+
_effect.f();
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
var Content = ({ classNames, children, role }) => {
|
|
231
|
+
var _effect = _useSignals2();
|
|
232
|
+
try {
|
|
233
|
+
return /* @__PURE__ */ React2.createElement(Gameboard.Content, {
|
|
234
|
+
classNames: mx2(classNames, role === "card--popover" && "size-container popover-square"),
|
|
235
|
+
grow: !role || role === "card--extrinsic",
|
|
236
|
+
contain: !role || role === "card--extrinsic" || role === "card--popover"
|
|
237
|
+
}, children);
|
|
238
|
+
} finally {
|
|
239
|
+
_effect.f();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
var Board = (props) => {
|
|
243
|
+
var _effect = _useSignals2();
|
|
244
|
+
try {
|
|
245
|
+
const { model } = useGameboardContext2(Board.displayName);
|
|
251
246
|
const ref = useRef2(null);
|
|
252
247
|
useEffect2(() => {
|
|
253
248
|
if (!ref.current) {
|
|
254
249
|
return;
|
|
255
250
|
}
|
|
251
|
+
ref.current.setAttribute("data-arrow-keys", "all");
|
|
256
252
|
return addEventListener(ref.current, "keydown", (ev) => {
|
|
257
253
|
switch (ev.key) {
|
|
258
254
|
case "ArrowUp":
|
|
@@ -276,50 +272,24 @@ var ChessboardRoot = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRe
|
|
|
276
272
|
}, [
|
|
277
273
|
model
|
|
278
274
|
]);
|
|
279
|
-
|
|
280
|
-
if (model.makeMove(move)) {
|
|
281
|
-
game.pgn = model.pgn;
|
|
282
|
-
return true;
|
|
283
|
-
}
|
|
284
|
-
return false;
|
|
285
|
-
}, [
|
|
286
|
-
model
|
|
287
|
-
]);
|
|
288
|
-
return /* @__PURE__ */ React3.createElement(Gameboard.Root, {
|
|
289
|
-
model,
|
|
290
|
-
onDrop: handleDrop
|
|
291
|
-
}, /* @__PURE__ */ React3.createElement("div", {
|
|
275
|
+
return /* @__PURE__ */ React2.createElement(NaturalChessboard, {
|
|
292
276
|
ref,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
className: "grid grow outline-none"
|
|
296
|
-
}, children));
|
|
297
|
-
} finally {
|
|
298
|
-
_effect.f();
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
var ChessboardContent = ({ classNames, children, role }) => {
|
|
302
|
-
var _effect = _useSignals3();
|
|
303
|
-
try {
|
|
304
|
-
return /* @__PURE__ */ React3.createElement(Gameboard.Content, {
|
|
305
|
-
classNames: mx3(classNames, role === "card--popover" && "size-container popover-square"),
|
|
306
|
-
grow: !role || role === "card--extrinsic",
|
|
307
|
-
contain: !role || role === "card--extrinsic" || role === "card--popover"
|
|
308
|
-
}, children);
|
|
277
|
+
...props
|
|
278
|
+
});
|
|
309
279
|
} finally {
|
|
310
280
|
_effect.f();
|
|
311
281
|
}
|
|
312
282
|
};
|
|
283
|
+
Board.displayName = "Chessboard.Board";
|
|
313
284
|
var Chessboard = {
|
|
314
|
-
Root
|
|
315
|
-
Content
|
|
316
|
-
Board
|
|
317
|
-
Info
|
|
318
|
-
Players: ChessboardPlayers
|
|
285
|
+
Root,
|
|
286
|
+
Content,
|
|
287
|
+
Board,
|
|
288
|
+
Info
|
|
319
289
|
};
|
|
320
290
|
|
|
321
291
|
export {
|
|
322
292
|
ExtendedChessModel,
|
|
323
293
|
Chessboard
|
|
324
294
|
};
|
|
325
|
-
//# sourceMappingURL=chunk-
|
|
295
|
+
//# sourceMappingURL=chunk-F4C2HVZL.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Chessboard.tsx", "../../../src/components/Info.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, {\n type PropsWithChildren,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\n\nimport { addEventListener } from '@dxos/async';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n ChessModel,\n Gameboard,\n type GameboardRootProps,\n Chessboard as NaturalChessboard,\n type ChessboardProps as NaturalChessboardProps,\n getRawPgn,\n useGameboardContext,\n} from '@dxos/react-ui-gameboard';\nimport { useSoundEffect } from '@dxos/react-ui-sfx';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { type Chess } from '../types';\n\nimport { Info, type InfoProps } from './Info';\n\nexport interface ChessboardController {\n setMoveNumber(index: number): void;\n}\n\nexport class ExtendedChessModel extends ChessModel {\n constructor(readonly object: Chess.Game) {\n super();\n }\n}\n\n//\n// Root\n//\n\ntype RootProps = PropsWithChildren<{\n game: Chess.Game;\n}>;\n\nconst Root = forwardRef<ChessboardController, RootProps>(({ game, children }, forwardedRef) => {\n const model = useMemo(() => new ExtendedChessModel(game), []);\n const click = useSoundEffect('Click');\n\n // Controller.\n useImperativeHandle(forwardedRef, () => {\n return {\n setMoveNumber: (index) => model.setMoveIndex(index),\n };\n }, [model]);\n\n // External change.\n // NOTE: Warning if user has not interacted with the board.\n useEffect(() => {\n if (model.pgn !== getRawPgn(game.pgn ?? '')) {\n const silent = model.pgn === '*';\n model.update(game.pgn);\n if (!silent) {\n void click.play();\n }\n }\n }, [game.pgn]);\n\n // Move.\n const handleDrop = useCallback<NonNullable<GameboardRootProps<ChessModel>['onDrop']>>(\n (move) => {\n if (!model.makeMove(move)) {\n return false;\n }\n\n void click.play();\n game.pgn = model.pgn;\n return true;\n },\n [model],\n );\n\n return (\n <Gameboard.Root model={model} onDrop={handleDrop}>\n {children}\n </Gameboard.Root>\n );\n});\n\n//\n// Content\n//\n\ntype Role = 'card--popover' | 'card--intrinsic' | 'card--extrinsic';\n\ntype ContentProps = ThemedClassName<PropsWithChildren<{ role?: Role }>>;\n\nconst Content = ({ classNames, children, role }: ContentProps) => {\n return (\n <Gameboard.Content\n classNames={mx(classNames, role === 'card--popover' && 'size-container popover-square')}\n grow={!role || role === 'card--extrinsic'}\n contain={!role || role === 'card--extrinsic' || role === 'card--popover'}\n >\n {children}\n </Gameboard.Content>\n );\n};\n\n//\n// Board\n//\n\ntype BoardProps = NaturalChessboardProps;\n\nconst Board = (props: BoardProps) => {\n const { model } = useGameboardContext<ChessModel>(Board.displayName);\n\n // Keyboard navigation.\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n // Participate in keyboard navigation (set tabIndex={0})\n ref.current.setAttribute('data-arrow-keys', 'all');\n\n return addEventListener(ref.current, 'keydown', (ev) => {\n switch (ev.key) {\n case 'ArrowUp':\n model.setMoveIndex(0);\n break;\n case 'ArrowDown':\n model.setMoveIndex(model.game.history().length);\n break;\n case 'ArrowLeft':\n if (model.moveIndex.value > 0) {\n model.setMoveIndex(model.moveIndex.value - 1);\n }\n break;\n case 'ArrowRight':\n if (model.moveIndex.value < model.game.history().length) {\n model.setMoveIndex(model.moveIndex.value + 1);\n }\n break;\n }\n });\n }, [model]);\n\n return <NaturalChessboard ref={ref} {...props} />;\n};\n\nBoard.displayName = 'Chessboard.Board';\n\n//\n// Chessboard\n//\n\nexport const Chessboard = {\n Root: Root,\n Content: Content,\n Board: Board,\n Info: Info,\n};\n\nexport type {\n RootProps as ChessboardRootProps,\n ContentProps as ChessboardContentProps,\n BoardProps as ChessboardBoardProps,\n InfoProps as ChessboardInfoProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type JSX, type PropsWithChildren, useEffect, useMemo, useRef } from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { type SpaceMember, getSpace, useMembers } from '@dxos/react-client/echo';\nimport { Icon, IconButton, Select, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { type Player, useGameboardContext } from '@dxos/react-ui-gameboard';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../meta';\n\nimport { type ExtendedChessModel } from './Chessboard';\n\nexport type InfoProps = ThemedClassName<\n {\n orientation?: Player;\n onOrientationChange?: (orientation: Player) => void;\n onClose?: () => void;\n } & Pick<HistoryProps, 'min' | 'max' | 'onSelect'>\n>;\n\nexport const Info = ({ classNames, orientation = 'white', onOrientationChange, onClose, ...props }: InfoProps) => {\n const { t } = useTranslation(meta.id);\n const { model } = useGameboardContext<ExtendedChessModel>(Info.displayName);\n const members = useMembers(getSpace(model.object)?.key);\n\n return (\n <div\n className={mx(\n 'grid grid-rows-[min-content_1fr_min-content] is-full min-is-[18rem] p-2 overflow-hidden bg-groupSurface rounded-sm',\n classNames,\n )}\n >\n <PlayerIndicator\n model={model}\n player={orientation === 'white' ? 'black' : 'white'}\n icon={\n onClose && (\n <IconButton icon='ph--x--regular' iconOnly label={t('close info button')} size={4} onClick={onClose} />\n )\n }\n >\n <PlayerSelector\n value={model.object.players?.[orientation === 'white' ? 'black' : 'white']}\n onValueChange={(value) => {\n model.object.players![orientation === 'white' ? 'black' : 'white'] = value;\n }}\n members={members}\n />\n </PlayerIndicator>\n\n <History model={model} {...props} />\n\n <PlayerIndicator\n model={model}\n player={orientation}\n icon={\n onOrientationChange && (\n <IconButton\n classNames={mx('transition duration-200 ease-linear', orientation === 'white' && 'rotate-180')}\n icon='ph--arrows-clockwise--regular'\n iconOnly\n label={t('flip board button')}\n size={4}\n onClick={() => onOrientationChange(orientation === 'white' ? 'black' : 'white')}\n />\n )\n }\n >\n <PlayerSelector\n value={model.object.players?.[orientation]}\n onValueChange={(value) => {\n model.object.players![orientation] = value;\n }}\n members={members}\n />\n </PlayerIndicator>\n </div>\n );\n};\n\nInfo.displayName = 'Chessboard.Info';\n\n//\n// History\n//\n\ntype HistoryProps = ThemedClassName<{\n model: ExtendedChessModel;\n min?: number;\n max?: number;\n onSelect?: (index: number) => void;\n}>;\n\nconst History = ({ classNames, model, min, max, onSelect }: HistoryProps) => {\n const { t } = useTranslation(meta.id);\n const label = model.game.isGameOver()\n ? model.game.isCheckmate()\n ? t('game.checkmate label')\n : model.game.isStalemate()\n ? t('game.stalemate label')\n : t('game.draw label')\n : model.game.isCheck()\n ? t('game.check label')\n : undefined;\n\n const history = model.game.history();\n const moves = useMemo(\n () =>\n history.reduce(\n (acc, move, index) => {\n if (index % 2 === 0) {\n acc.push([{ index, move }]);\n } else {\n acc[acc.length - 1].push({ index, move });\n }\n return acc;\n },\n [] as { index: number; move: string }[][],\n ),\n [history.length],\n );\n\n const scrollerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n scrollerRef.current?.scrollTo({ top: scrollerRef.current.scrollHeight });\n }, [history.length]);\n\n useEffect(() => {\n const div = scrollerRef.current?.querySelector(`[data-index=\"${model.moveIndex.value - 1}\"]`);\n scrollerRef.current?.classList.add('scrollbar-none');\n div?.scrollIntoView({ behavior: 'smooth' });\n scrollerRef.current?.classList.remove('scrollbar-none');\n }, [model.moveIndex.value]);\n\n return (\n <div\n ref={scrollerRef}\n className={mx('overflow-y-auto', classNames)}\n style={{\n minHeight: min === undefined ? 'auto' : `${min * 24}px`,\n maxHeight: max === undefined ? 'auto' : `${max * 24}px`,\n }}\n >\n {moves.map(([a, b], index) => (\n <div key={index} className='grid grid-cols-[3rem_1fr_1fr_1rem] gap-2 pis-4 leading-1'>\n <div className='content-center text-xs text-subdued'>{index + 1}</div>\n {a && (\n <div\n data-index={a.index}\n className={mx('pis-2 cursor-pointer', a.index === model.moveIndex.value - 1 && 'bg-primary-500')}\n onClick={() => onSelect?.(a.index + 1)}\n >\n {a.move}\n </div>\n )}\n {b && (\n <div\n data-index={b.index}\n className={mx('pis-2 cursor-pointer', b.index === model.moveIndex.value - 1 && 'bg-primary-500')}\n onClick={() => onSelect?.(b.index + 1)}\n >\n {b.move}\n </div>\n )}\n </div>\n ))}\n {label && <div className='text-center'>{label}</div>}\n </div>\n );\n};\n\n//\n// PlayerIndicator\n//\n\ntype PlayerIndicatorProps = PropsWithChildren<{\n model: ExtendedChessModel;\n player: Player;\n icon?: JSX.Element;\n}>;\n\nconst PlayerIndicator = ({ children, model, player, icon }: PlayerIndicatorProps) => {\n const turn = player === (model.game.turn() === 'w' ? 'white' : 'black');\n return (\n <div className='grid grid-cols-[2rem_1fr_2rem] gap-2 bs-[--rail-size] pli-1 flex items-center overflow-hidden'>\n <div className='place-items-center'>\n <Icon\n icon={turn ? 'ph--circle--fill' : 'ph--circle--thin'}\n size={6}\n classNames={mx(turn && (model.game.isCheckmate() ? 'text-red-500' : 'text-green-500'))}\n />\n </div>\n <div className='truncate overflow-hidden items-center'>{children}</div>\n {icon}\n </div>\n );\n};\n\n//\n// PlayerSelector\n//\n\ntype PlayerSelectorProps = {\n value?: string;\n onValueChange: (player: string) => void;\n members: SpaceMember[];\n};\n\nconst PlayerSelector = ({ value, onValueChange, members }: PlayerSelectorProps) => {\n const { t } = useTranslation(meta.id);\n return (\n <Select.Root value={value} onValueChange={onValueChange}>\n <Select.TriggerButton placeholder={t('select player button')} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {members.map((member) => {\n const memberKey = member.identity.identityKey.toHex();\n const displayName = member.identity?.profile?.displayName || generateName(memberKey);\n return (\n <Select.Option key={memberKey} value={memberKey}>\n {displayName}\n </Select.Option>\n );\n })}\n </Select.Viewport>\n <Select.Arrow />\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,OAAOA,UAELC,YACAC,aACAC,aAAAA,YACAC,qBACAC,WAAAA,UACAC,UAAAA,eACK;AAEP,SAASC,wBAAwB;AAEjC,SACEC,YACAC,WAEAC,cAAcC,mBAEdC,WACAC,uBAAAA,4BACK;AACP,SAASC,sBAAsB;AAC/B,SAASC,MAAAA,WAAU;;;;ACtBnB,OAAOC,SAA2CC,WAAWC,SAASC,cAAc;AAEpF,SAASC,oBAAoB;AAC7B,SAA2BC,UAAUC,kBAAkB;AACvD,SAASC,MAAMC,YAAYC,QAA8BC,sBAAsB;AAC/E,SAAsBC,2BAA2B;AACjD,SAASC,UAAU;AAcZ,IAAMC,OAAO,CAAC,EAAEC,YAAYC,cAAc,SAASC,qBAAqBC,SAAS,GAAGC,MAAAA,MAAkB;;;AAC3G,UAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,UAAM,EAAEC,MAAK,IAAKC,oBAAwCX,KAAKY,WAAW;AAC1E,UAAMC,UAAUC,WAAWC,SAASL,MAAMM,MAAM,GAAGC,GAAAA;AAEnD,WACE,sBAAA,cAACC,OAAAA;MACCC,WAAWC,GACT,sHACAnB,UAAAA;OAGF,sBAAA,cAACoB,iBAAAA;MACCX;MACAY,QAAQpB,gBAAgB,UAAU,UAAU;MAC5CqB,MACEnB,WACE,sBAAA,cAACoB,YAAAA;QAAWD,MAAK;QAAiBE,UAAAA;QAASC,OAAOpB,EAAE,mBAAA;QAAsBqB,MAAM;QAAGC,SAASxB;;OAIhG,sBAAA,cAACyB,gBAAAA;MACCC,OAAOpB,MAAMM,OAAOe,UAAU7B,gBAAgB,UAAU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AmB,+BAAA;MACvDE,MAAM,CAACF,QAAQA,SAAS;MACxBG,SAAS,CAACH,QAAQA,SAAS,qBAAqBA,SAAS;OAExDzB,QAAAA;;;;AAGP;AAQA,IAAM6B,QAAQ,CAACC,UAAAA;;;AACb,UAAM,EAAE5B,MAAK,IAAK6B,qBAAgCF,MAAMG,WAAW;AAGnE,UAAMC,MAAMC,QAAuB,IAAA;AACnCxB,IAAAA,WAAU,MAAA;AACR,UAAI,CAACuB,IAAIE,SAAS;AAChB;MACF;AAGAF,UAAIE,QAAQC,aAAa,mBAAmB,KAAA;AAE5C,aAAOC,iBAAiBJ,IAAIE,SAAS,WAAW,CAACG,OAAAA;AAC/C,gBAAQA,GAAGC,KAAG;UACZ,KAAK;AACHrC,kBAAMO,aAAa,CAAA;AACnB;UACF,KAAK;AACHP,kBAAMO,aAAaP,MAAMH,KAAKyC,QAAO,EAAGC,MAAM;AAC9C;UACF,KAAK;AACH,gBAAIvC,MAAMwC,UAAUC,QAAQ,GAAG;AAC7BzC,oBAAMO,aAAaP,MAAMwC,UAAUC,QAAQ,CAAA;YAC7C;AACA;UACF,KAAK;AACH,gBAAIzC,MAAMwC,UAAUC,QAAQzC,MAAMH,KAAKyC,QAAO,EAAGC,QAAQ;AACvDvC,oBAAMO,aAAaP,MAAMwC,UAAUC,QAAQ,CAAA;YAC7C;AACA;QACJ;MACF,CAAA;IACF,GAAG;MAACzC;KAAM;AAEV,WAAO,gBAAAkB,OAAA,cAACwB,mBAAAA;MAAkBX;MAAW,GAAGH;;;;;AAC1C;AAEAD,MAAMG,cAAc;AAMb,IAAMa,aAAa;EACxBhD;EACA0B;EACAM;EACAiB;AACF;",
|
|
6
|
+
"names": ["React", "forwardRef", "useCallback", "useEffect", "useImperativeHandle", "useMemo", "useRef", "addEventListener", "ChessModel", "Gameboard", "Chessboard", "NaturalChessboard", "getRawPgn", "useGameboardContext", "useSoundEffect", "mx", "React", "useEffect", "useMemo", "useRef", "generateName", "getSpace", "useMembers", "Icon", "IconButton", "Select", "useTranslation", "useGameboardContext", "mx", "Info", "classNames", "orientation", "onOrientationChange", "onClose", "props", "t", "useTranslation", "meta", "id", "model", "useGameboardContext", "displayName", "members", "useMembers", "getSpace", "object", "key", "div", "className", "mx", "PlayerIndicator", "player", "icon", "IconButton", "iconOnly", "label", "size", "onClick", "PlayerSelector", "value", "players", "onValueChange", "History", "min", "max", "onSelect", "game", "isGameOver", "isCheckmate", "isStalemate", "isCheck", "undefined", "history", "moves", "useMemo", "reduce", "acc", "move", "index", "push", "length", "scrollerRef", "useRef", "useEffect", "current", "scrollTo", "top", "scrollHeight", "querySelector", "moveIndex", "classList", "add", "scrollIntoView", "behavior", "remove", "ref", "style", "minHeight", "maxHeight", "map", "a", "b", "data-index", "children", "turn", "Icon", "Select", "Root", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "member", "memberKey", "identity", "identityKey", "toHex", "profile", "generateName", "Option", "Arrow", "ExtendedChessModel", "ChessModel", "object", "Root", "forwardRef", "game", "children", "forwardedRef", "model", "useMemo", "click", "useSoundEffect", "useImperativeHandle", "setMoveNumber", "index", "setMoveIndex", "useEffect", "pgn", "getRawPgn", "silent", "update", "play", "handleDrop", "useCallback", "move", "makeMove", "React", "Gameboard", "onDrop", "Content", "classNames", "role", "mx", "grow", "contain", "Board", "props", "useGameboardContext", "displayName", "ref", "useRef", "current", "setAttribute", "addEventListener", "ev", "key", "history", "length", "moveIndex", "value", "NaturalChessboard", "Chessboard", "Info"]
|
|
7
|
+
}
|
|
@@ -7,14 +7,15 @@ var __export = (target, all) => {
|
|
|
7
7
|
|
|
8
8
|
// src/meta.ts
|
|
9
9
|
import { trim } from "@dxos/util";
|
|
10
|
-
var CHESS_PLUGIN = "dxos.org/plugin/chess";
|
|
11
10
|
var meta = {
|
|
12
|
-
id:
|
|
11
|
+
id: "dxos.org/plugin/chess",
|
|
13
12
|
name: "Chess",
|
|
14
13
|
description: trim`
|
|
15
|
-
|
|
14
|
+
Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.
|
|
15
|
+
Track game history and analyze moves in real-time.
|
|
16
16
|
`,
|
|
17
17
|
icon: "ph--shield-chevron--regular",
|
|
18
|
+
iconHue: "amber",
|
|
18
19
|
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess",
|
|
19
20
|
screenshots: [
|
|
20
21
|
"https://dxos.network/plugin-details-chess-dark.png"
|
|
@@ -23,7 +24,6 @@ var meta = {
|
|
|
23
24
|
|
|
24
25
|
export {
|
|
25
26
|
__export,
|
|
26
|
-
CHESS_PLUGIN,
|
|
27
27
|
meta
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-KNOOJFIR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/chess',\n name: 'Chess',\n description: trim`\n Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.\n Track game history and analyze moves in real-time.\n `,\n icon: 'ph--shield-chevron--regular',\n iconHue: 'amber',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',\n screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAKA,SAASA,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa;IAAC;;AAChB;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "screenshots"]
|
|
7
|
+
}
|