@dxos/plugin-chess 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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/ChessArticle-UDSL3OJ4.mjs +59 -0
- package/dist/lib/browser/ChessArticle-UDSL3OJ4.mjs.map +7 -0
- package/dist/lib/browser/ChessCard-OIRFQMOJ.mjs +21 -0
- package/dist/lib/browser/ChessCard-OIRFQMOJ.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-OSNXLHYU.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-OSNXLHYU.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +4 -4
- package/dist/lib/browser/{chunk-66H3V2YV.mjs → chunk-2TJN26DN.mjs} +9 -6
- package/dist/lib/browser/chunk-2TJN26DN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FO4ZNFN6.mjs → chunk-6JG4KLVU.mjs} +44 -42
- package/dist/lib/browser/chunk-6JG4KLVU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-73BDP7UV.mjs → chunk-JP6G6VR6.mjs} +30 -29
- package/dist/lib/browser/chunk-JP6G6VR6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-H3NUMCQ6.mjs → chunk-RGHZ5CDO.mjs} +2 -2
- package/dist/lib/browser/{chunk-H3NUMCQ6.mjs.map → chunk-RGHZ5CDO.mjs.map} +1 -1
- package/dist/lib/browser/chunk-WYUTI2K4.mjs +1 -0
- package/dist/lib/browser/chunk-WYUTI2K4.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +10 -10
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/index.mjs +25 -28
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-WD7BYDFB.mjs +50 -0
- package/dist/lib/browser/react-surface-WD7BYDFB.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/ChessArticle-76MOXLJM.mjs +60 -0
- package/dist/lib/node-esm/ChessArticle-76MOXLJM.mjs.map +7 -0
- package/dist/lib/node-esm/ChessCard-TKNQP6IO.mjs +22 -0
- package/dist/lib/node-esm/ChessCard-TKNQP6IO.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-SL4LBVV5.mjs → blueprint-definition-PFZMTCXY.mjs} +7 -7
- package/dist/lib/node-esm/blueprint-definition-PFZMTCXY.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +4 -4
- package/dist/lib/node-esm/{chunk-C7IWIXCJ.mjs → chunk-46DC6W7W.mjs} +44 -42
- package/dist/lib/node-esm/chunk-46DC6W7W.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7XDEO6IJ.mjs +2 -0
- package/dist/lib/node-esm/chunk-7XDEO6IJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WXEPWOHT.mjs → chunk-FK7NVSOG.mjs} +30 -29
- package/dist/lib/node-esm/chunk-FK7NVSOG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-F5OMIM4F.mjs → chunk-FYPVCMP4.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-F5OMIM4F.mjs.map → chunk-FYPVCMP4.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-OUNGNJFP.mjs → chunk-OIRJVY2R.mjs} +9 -6
- package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +10 -10
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +25 -28
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-TIYEREGW.mjs +51 -0
- package/dist/lib/node-esm/react-surface-TIYEREGW.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/chess-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/create.d.ts +1 -1
- package/dist/types/src/blueprints/functions/index.d.ts +55 -4
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/move.d.ts +9 -1
- package/dist/types/src/blueprints/functions/move.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/play.d.ts +9 -1
- package/dist/types/src/blueprints/functions/play.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +3 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +3 -8
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
- package/dist/types/src/components/{Info.d.ts → Chessboard/Info.d.ts} +1 -1
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/index.d.ts +2 -0
- package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/types.d.ts +8 -0
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +6 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
- package/dist/types/src/{components/Chessboard.stories.d.ts → containers/ChessArticle/ChessArticle.stories.d.ts} +3 -2
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts +3 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts +6 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
- package/dist/types/src/{components/Card.stories.d.ts → containers/ChessCard/ChessCard.stories.d.ts} +1 -1
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/index.d.ts +3 -0
- package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.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/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +1 -1
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -35
- package/src/ChessPlugin.tsx +13 -10
- package/src/blueprints/chess-blueprint.ts +14 -6
- package/src/blueprints/functions/create.ts +2 -2
- package/src/blueprints/functions/index.ts +13 -4
- package/src/blueprints/functions/move.ts +11 -12
- package/src/blueprints/functions/play.ts +5 -6
- package/src/blueprints/functions/print.ts +1 -1
- package/src/blueprints/index.ts +1 -1
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +6 -12
- package/src/capabilities/react-surface/react-surface.tsx +13 -7
- package/src/cli/plugin.ts +4 -4
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +24 -26
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +12 -10
- package/src/components/Chessboard/index.ts +5 -0
- package/src/components/Chessboard/types.ts +18 -0
- package/src/components/index.ts +1 -5
- package/src/{components/Chessboard.stories.tsx → containers/ChessArticle/ChessArticle.stories.tsx} +7 -7
- package/src/containers/ChessArticle/ChessArticle.tsx +72 -0
- package/src/containers/ChessArticle/index.ts +7 -0
- package/src/{components/Card.stories.tsx → containers/ChessCard/ChessCard.stories.tsx} +9 -14
- package/src/containers/ChessCard/ChessCard.tsx +22 -0
- package/src/containers/ChessCard/index.ts +7 -0
- package/src/containers/index.ts +8 -0
- package/src/index.ts +1 -1
- package/src/meta.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/types/Chess.ts +7 -3
- package/dist/lib/browser/ChessboardContainer-JZ4ANG4O.mjs +0 -81
- package/dist/lib/browser/ChessboardContainer-JZ4ANG4O.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs +0 -18
- package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs.map +0 -7
- package/dist/lib/browser/chunk-66H3V2YV.mjs.map +0 -7
- package/dist/lib/browser/chunk-73BDP7UV.mjs.map +0 -7
- package/dist/lib/browser/chunk-FO4ZNFN6.mjs.map +0 -7
- package/dist/lib/browser/chunk-OW6S2SRG.mjs +0 -8
- package/dist/lib/browser/chunk-OW6S2SRG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VNOWFKC6.mjs +0 -37
- package/dist/lib/browser/react-surface-VNOWFKC6.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs +0 -82
- package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-SL4LBVV5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-24GJHLHM.mjs +0 -10
- package/dist/lib/node-esm/chunk-24GJHLHM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C7IWIXCJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OUNGNJFP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WXEPWOHT.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-HSHCIOAS.mjs +0 -38
- package/dist/lib/node-esm/react-surface-HSHCIOAS.mjs.map +0 -7
- package/dist/types/src/components/Card.stories.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +0 -6
- package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +0 -7
- package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
- package/dist/types/src/components/Info.d.ts.map +0 -1
- package/src/components/ChessboardArticle.tsx +0 -71
- package/src/components/ChessboardContainer.tsx +0 -40
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import "./chunk-7XDEO6IJ.mjs";
|
|
3
|
+
import {
|
|
4
|
+
Chessboard
|
|
5
|
+
} from "./chunk-FK7NVSOG.mjs";
|
|
6
|
+
import {
|
|
7
|
+
meta
|
|
8
|
+
} from "./chunk-FYPVCMP4.mjs";
|
|
9
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
10
|
+
|
|
11
|
+
// src/containers/ChessArticle/ChessArticle.tsx
|
|
12
|
+
import React, { useCallback, useRef, useState } from "react";
|
|
13
|
+
import { Panel, Toolbar, useTranslation } from "@dxos/react-ui";
|
|
14
|
+
import { mx } from "@dxos/ui-theme";
|
|
15
|
+
var ChessArticle = ({ role, subject: game }) => {
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
const [orientation, setOrientation] = useState("white");
|
|
18
|
+
const [open, setOpen] = useState(true);
|
|
19
|
+
const controller = useRef(null);
|
|
20
|
+
const handleSelect = useCallback((index) => {
|
|
21
|
+
controller.current?.setMoveNumber(index);
|
|
22
|
+
}, []);
|
|
23
|
+
return /* @__PURE__ */ React.createElement(Chessboard.Root, {
|
|
24
|
+
game,
|
|
25
|
+
ref: controller
|
|
26
|
+
}, /* @__PURE__ */ React.createElement(Panel.Root, {
|
|
27
|
+
role,
|
|
28
|
+
classNames: "@container"
|
|
29
|
+
}, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
|
|
30
|
+
asChild: true
|
|
31
|
+
}, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
|
|
32
|
+
icon: "ph--info--regular",
|
|
33
|
+
iconOnly: true,
|
|
34
|
+
label: t("toggle info button"),
|
|
35
|
+
disabled: open,
|
|
36
|
+
classNames: mx("invisible @3xl:visible"),
|
|
37
|
+
onClick: () => setOpen((open2) => !open2)
|
|
38
|
+
}))), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement("div", {
|
|
39
|
+
className: mx("grid h-full w-full gap-2", open && "@3xl:grid-cols-[1fr_320px]", role === "section" && "aspect-square", role === "section" && open && "@3xl:aspect-auto")
|
|
40
|
+
}, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, {
|
|
41
|
+
classNames: "m-4 rounded-xs overflow-hidden",
|
|
42
|
+
orientation
|
|
43
|
+
})), open && /* @__PURE__ */ React.createElement("div", {
|
|
44
|
+
className: "hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden"
|
|
45
|
+
}, /* @__PURE__ */ React.createElement(Chessboard.Info, {
|
|
46
|
+
orientation,
|
|
47
|
+
min: 8,
|
|
48
|
+
max: 8,
|
|
49
|
+
onOrientationChange: setOrientation,
|
|
50
|
+
onClose: () => setOpen(false),
|
|
51
|
+
onSelect: handleSelect
|
|
52
|
+
}))))));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/containers/ChessArticle/index.ts
|
|
56
|
+
var ChessArticle_default = ChessArticle;
|
|
57
|
+
export {
|
|
58
|
+
ChessArticle_default as default
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=ChessArticle-76MOXLJM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ChessArticle/ChessArticle.tsx", "../../../src/containers/ChessArticle/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';\nimport { Panel, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type Player } from '@dxos/react-ui-gameboard';\nimport { mx } from '@dxos/ui-theme';\n\nimport { Chessboard, type ChessboardController, type ChessboardInfoProps } from '../../components';\nimport { meta } from '../../meta';\nimport { type Chess } from '../../types';\n\nexport type ChessArticleProps = SurfaceComponentProps<Chess.Game>;\n\nexport const ChessArticle = ({ role, subject: game }: ChessArticleProps) => {\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 const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {\n controller.current?.setMoveNumber(index);\n }, []);\n\n return (\n <Chessboard.Root game={game} ref={controller}>\n <Panel.Root role={role} classNames='@container'>\n <Panel.Toolbar asChild>\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 </Panel.Toolbar>\n <Panel.Content>\n <div\n className={mx(\n 'grid h-full w-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-xs 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 </Panel.Content>\n </Panel.Root>\n </Chessboard.Root>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { ChessArticle } from './ChessArticle';\n\nexport default ChessArticle;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAIA,OAAOA,SAASC,aAAaC,QAAQC,gBAAgB;AAGrD,SAASC,OAAOC,SAASC,sBAAsB;AAE/C,SAASC,UAAU;AAQZ,IAAMC,eAAe,CAAC,EAAEC,MAAMC,SAASC,KAAI,MAAqB;AACrE,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAM,CAACC,aAAaC,cAAAA,IAAkBC,SAAiB,OAAA;AACvD,QAAM,CAACC,MAAMC,OAAAA,IAAWF,SAAS,IAAA;AACjC,QAAMG,aAAaC,OAA6B,IAAA;AAEhD,QAAMC,eAAeC,YAA0D,CAACC,UAAAA;AAC9EJ,eAAWK,SAASC,cAAcF,KAAAA;EACpC,GAAG,CAAA,CAAE;AAEL,SACE,sBAAA,cAACG,WAAWC,MAAI;IAAClB;IAAYmB,KAAKT;KAChC,sBAAA,cAACU,MAAMF,MAAI;IAACpB;IAAYuB,YAAW;KACjC,sBAAA,cAACD,MAAME,SAAO;IAACC,SAAAA;KACb,sBAAA,cAACD,QAAQJ,MAAI,MACX,sBAAA,cAACI,QAAQE,YAAU;IACjBC,MAAK;IACLC,UAAAA;IACAC,OAAO1B,EAAE,oBAAA;IACT2B,UAAUpB;IACVa,YAAYQ,GAAG,wBAAA;IACfC,SAAS,MAAMrB,QAAQ,CAACD,UAAS,CAACA,KAAAA;QAIxC,sBAAA,cAACY,MAAMW,SAAO,MACZ,sBAAA,cAACC,OAAAA;IACCC,WAAWJ,GACT,4BACArB,QAAQ,8BACRV,SAAS,aAAa,iBACtBA,SAAS,aAAaU,QAAQ,kBAAA;KAGhC,sBAAA,cAACS,WAAWc,SAAO,MACjB,sBAAA,cAACd,WAAWiB,OAAK;IAACb,YAAW;IAAiChB;OAE/DG,QACC,sBAAA,cAACwB,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAAChB,WAAWkB,MAAI;IACd9B;IACA+B,KAAK;IACLC,KAAK;IACLC,qBAAqBhC;IACrBiC,SAAS,MAAM9B,QAAQ,KAAA;IACvB+B,UAAU5B;;AAS5B;;;ACjEA,IAAA,uBAAe6B;",
|
|
6
|
+
"names": ["React", "useCallback", "useRef", "useState", "Panel", "Toolbar", "useTranslation", "mx", "ChessArticle", "role", "subject", "game", "t", "useTranslation", "meta", "id", "orientation", "setOrientation", "useState", "open", "setOpen", "controller", "useRef", "handleSelect", "useCallback", "index", "current", "setMoveNumber", "Chessboard", "Root", "ref", "Panel", "classNames", "Toolbar", "asChild", "IconButton", "icon", "iconOnly", "label", "disabled", "mx", "onClick", "Content", "div", "className", "Board", "Info", "min", "max", "onOrientationChange", "onClose", "onSelect", "ChessArticle"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import "./chunk-7XDEO6IJ.mjs";
|
|
3
|
+
import {
|
|
4
|
+
Chessboard
|
|
5
|
+
} from "./chunk-FK7NVSOG.mjs";
|
|
6
|
+
import "./chunk-FYPVCMP4.mjs";
|
|
7
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
8
|
+
|
|
9
|
+
// src/containers/ChessCard/ChessCard.tsx
|
|
10
|
+
import React from "react";
|
|
11
|
+
var ChessCard = ({ subject: game }) => {
|
|
12
|
+
return /* @__PURE__ */ React.createElement(Chessboard.Root, {
|
|
13
|
+
game
|
|
14
|
+
}, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, null)));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/containers/ChessCard/index.ts
|
|
18
|
+
var ChessCard_default = ChessCard;
|
|
19
|
+
export {
|
|
20
|
+
ChessCard_default as default
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=ChessCard-TKNQP6IO.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ChessCard/ChessCard.tsx", "../../../src/containers/ChessCard/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';\n\nimport { Chessboard } from '../../components';\nimport { type Chess } from '../../types';\n\nexport type ChessCardProps = SurfaceComponentProps<Chess.Game>;\n\nexport const ChessCard = ({ subject: game }: ChessCardProps) => {\n return (\n <Chessboard.Root game={game}>\n <Chessboard.Content>\n <Chessboard.Board />\n </Chessboard.Content>\n </Chessboard.Root>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { ChessCard } from './ChessCard';\n\nexport default ChessCard;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AASX,IAAMC,YAAY,CAAC,EAAEC,SAASC,KAAI,MAAkB;AACzD,SACE,sBAAA,cAACC,WAAWC,MAAI;IAACF;KACf,sBAAA,cAACC,WAAWE,SAAO,MACjB,sBAAA,cAACF,WAAWG,OAAK,IAAA,CAAA,CAAA;AAIzB;;;ACfA,IAAA,oBAAeC;",
|
|
6
|
+
"names": ["React", "ChessCard", "subject", "game", "Chessboard", "Root", "Content", "Board", "ChessCard"]
|
|
7
|
+
}
|
package/dist/lib/node-esm/{blueprint-definition-SL4LBVV5.mjs → blueprint-definition-PFZMTCXY.mjs}
RENAMED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
chess_blueprint_default
|
|
4
|
+
} from "./chunk-46DC6W7W.mjs";
|
|
5
|
+
import "./chunk-OIRJVY2R.mjs";
|
|
6
6
|
import "./chunk-HSLMI22Q.mjs";
|
|
7
7
|
|
|
8
8
|
// src/capabilities/blueprint-definition/blueprint-definition.ts
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
-
import { Capability
|
|
10
|
+
import { Capability } from "@dxos/app-framework";
|
|
11
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
11
12
|
var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
|
|
12
|
-
Capability.contributes(
|
|
13
|
-
Capability.contributes(Common.Capability.BlueprintDefinition, chess_blueprint_exports.make())
|
|
13
|
+
Capability.contributes(AppCapabilities.BlueprintDefinition, chess_blueprint_default)
|
|
14
14
|
]));
|
|
15
15
|
var blueprint_definition_default = blueprintDefinition;
|
|
16
16
|
export {
|
|
17
17
|
blueprint_definition_default as default
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=blueprint-definition-
|
|
19
|
+
//# sourceMappingURL=blueprint-definition-PFZMTCXY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/blueprint-definition/blueprint-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\nimport { ChessBlueprint } from '../../blueprints';\n\nconst blueprintDefinition = Capability.makeModule<\n [],\n Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]\n>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, ChessBlueprint)]));\n\nexport default blueprintDefinition;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAIhC,IAAMC,sBAAsBC,WAAWC,WAGrC,MAAaC,eAAQ;EAACF,WAAWG,YAAYC,gBAAgBC,qBAAqBC,uBAAAA;CAAgB,CAAA;AAEpG,IAAA,+BAAeP;",
|
|
6
|
+
"names": ["Effect", "Capability", "AppCapabilities", "blueprintDefinition", "Capability", "makeModule", "succeed", "contributes", "AppCapabilities", "BlueprintDefinition", "ChessBlueprint"]
|
|
7
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
chess_blueprint_default,
|
|
4
4
|
functions_exports
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-46DC6W7W.mjs";
|
|
6
|
+
import "../chunk-OIRJVY2R.mjs";
|
|
7
7
|
import "../chunk-HSLMI22Q.mjs";
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
chess_blueprint_default as ChessBlueprint,
|
|
10
10
|
functions_exports as ChessFunctions
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
Chess_exports
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OIRJVY2R.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__export
|
|
7
7
|
} from "./chunk-HSLMI22Q.mjs";
|
|
8
8
|
|
|
9
9
|
// src/blueprints/chess-blueprint.ts
|
|
10
|
-
var chess_blueprint_exports = {};
|
|
11
|
-
__export(chess_blueprint_exports, {
|
|
12
|
-
Key: () => Key,
|
|
13
|
-
functions: () => functions,
|
|
14
|
-
make: () => make
|
|
15
|
-
});
|
|
16
10
|
import { Blueprint, Template } from "@dxos/blueprints";
|
|
17
11
|
import { trim } from "@dxos/util";
|
|
18
12
|
|
|
19
13
|
// src/blueprints/functions/index.ts
|
|
20
14
|
var functions_exports = {};
|
|
21
15
|
__export(functions_exports, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
ChessFunctions: () => ChessFunctions,
|
|
17
|
+
Create: () => create_default,
|
|
18
|
+
Move: () => move_default,
|
|
19
|
+
Play: () => play_default,
|
|
20
|
+
Print: () => print_default
|
|
26
21
|
});
|
|
27
22
|
|
|
28
23
|
// src/blueprints/functions/create.ts
|
|
@@ -31,7 +26,7 @@ import * as Schema from "effect/Schema";
|
|
|
31
26
|
import { Database } from "@dxos/echo";
|
|
32
27
|
import { defineFunction } from "@dxos/functions";
|
|
33
28
|
var create_default = defineFunction({
|
|
34
|
-
key: "dxos.
|
|
29
|
+
key: "org.dxos.function.chess.create",
|
|
35
30
|
name: "Create Chess",
|
|
36
31
|
description: "Creates a new chess game.",
|
|
37
32
|
inputSchema: Schema.Struct({
|
|
@@ -47,7 +42,7 @@ var create_default = defineFunction({
|
|
|
47
42
|
}),
|
|
48
43
|
outputSchema: Chess_exports.Game,
|
|
49
44
|
handler: Effect.fn(function* ({ data: { name, pgn, fen } }) {
|
|
50
|
-
return yield* Database.
|
|
45
|
+
return yield* Database.add(Chess_exports.make({
|
|
51
46
|
name,
|
|
52
47
|
pgn,
|
|
53
48
|
fen
|
|
@@ -59,15 +54,14 @@ var create_default = defineFunction({
|
|
|
59
54
|
import { Chess as ChessJS } from "chess.js";
|
|
60
55
|
import * as Effect2 from "effect/Effect";
|
|
61
56
|
import * as Schema2 from "effect/Schema";
|
|
62
|
-
import {
|
|
63
|
-
import { Database as Database2, Obj } from "@dxos/echo";
|
|
57
|
+
import { Database as Database2, Obj, Ref } from "@dxos/echo";
|
|
64
58
|
import { defineFunction as defineFunction2 } from "@dxos/functions";
|
|
65
59
|
var move_default = defineFunction2({
|
|
66
|
-
key: "dxos.
|
|
60
|
+
key: "org.dxos.function.chess.move",
|
|
67
61
|
name: "Move",
|
|
68
62
|
description: "Makes a move in the given chess game.",
|
|
69
63
|
inputSchema: Schema2.Struct({
|
|
70
|
-
|
|
64
|
+
game: Ref.Ref(Chess_exports.Game).annotations({
|
|
71
65
|
description: "The ID of the chess object."
|
|
72
66
|
}),
|
|
73
67
|
move: Schema2.String.annotations({
|
|
@@ -83,20 +77,20 @@ var move_default = defineFunction2({
|
|
|
83
77
|
description: "The PGN of the game after the move was played."
|
|
84
78
|
})
|
|
85
79
|
}),
|
|
86
|
-
handler: Effect2.fn(function* ({ data: {
|
|
87
|
-
const
|
|
80
|
+
handler: Effect2.fn(function* ({ data: { game, move } }) {
|
|
81
|
+
const obj = yield* Database2.load(game);
|
|
88
82
|
const chess = new ChessJS();
|
|
89
|
-
if (
|
|
90
|
-
chess.loadPgn(
|
|
91
|
-
} else if (
|
|
92
|
-
chess.load(
|
|
83
|
+
if (obj.pgn) {
|
|
84
|
+
chess.loadPgn(obj.pgn);
|
|
85
|
+
} else if (obj.fen) {
|
|
86
|
+
chess.load(obj.fen);
|
|
93
87
|
}
|
|
94
88
|
chess.move(move, {
|
|
95
89
|
strict: false
|
|
96
90
|
});
|
|
97
91
|
const pgn = chess.pgn();
|
|
98
|
-
Obj.change(
|
|
99
|
-
|
|
92
|
+
Obj.change(obj, (obj2) => {
|
|
93
|
+
obj2.pgn = pgn;
|
|
100
94
|
});
|
|
101
95
|
return {
|
|
102
96
|
pgn
|
|
@@ -108,15 +102,14 @@ var move_default = defineFunction2({
|
|
|
108
102
|
import { Chess as ChessJS2 } from "chess.js";
|
|
109
103
|
import * as Effect3 from "effect/Effect";
|
|
110
104
|
import * as Schema3 from "effect/Schema";
|
|
111
|
-
import {
|
|
112
|
-
import { Database as Database3, Obj as Obj2 } from "@dxos/echo";
|
|
105
|
+
import { Database as Database3, Obj as Obj2, Ref as Ref2 } from "@dxos/echo";
|
|
113
106
|
import { defineFunction as defineFunction3 } from "@dxos/functions";
|
|
114
107
|
var play_default = defineFunction3({
|
|
115
|
-
key: "dxos.
|
|
108
|
+
key: "org.dxos.function.chess.play",
|
|
116
109
|
name: "Play",
|
|
117
110
|
description: "Uses the chess engine to play the next move.",
|
|
118
111
|
inputSchema: Schema3.Struct({
|
|
119
|
-
|
|
112
|
+
game: Ref2.Ref(Chess_exports.Game).annotations({
|
|
120
113
|
description: "The ID of the chess object."
|
|
121
114
|
}),
|
|
122
115
|
side: Schema3.optional(Schema3.Literal("white", "black", "any")).annotations({
|
|
@@ -132,8 +125,8 @@ var play_default = defineFunction3({
|
|
|
132
125
|
description: "The move that was played."
|
|
133
126
|
})
|
|
134
127
|
}),
|
|
135
|
-
handler: Effect3.fn(function* ({ data: {
|
|
136
|
-
const object = yield* Database3.
|
|
128
|
+
handler: Effect3.fn(function* ({ data: { game, side = "any" } }) {
|
|
129
|
+
const object = yield* Database3.load(game);
|
|
137
130
|
const chess = new ChessJS2();
|
|
138
131
|
if (object.pgn) {
|
|
139
132
|
chess.loadPgn(object.pgn);
|
|
@@ -168,7 +161,7 @@ import * as Effect4 from "effect/Effect";
|
|
|
168
161
|
import * as Schema4 from "effect/Schema";
|
|
169
162
|
import { defineFunction as defineFunction4 } from "@dxos/functions";
|
|
170
163
|
var print_default = defineFunction4({
|
|
171
|
-
key: "dxos.
|
|
164
|
+
key: "org.dxos.function.chess.print",
|
|
172
165
|
name: "Print game",
|
|
173
166
|
description: "Prints the chess game to ASCII.",
|
|
174
167
|
inputSchema: Schema4.Struct({
|
|
@@ -199,16 +192,19 @@ var print_default = defineFunction4({
|
|
|
199
192
|
})
|
|
200
193
|
});
|
|
201
194
|
|
|
195
|
+
// src/blueprints/functions/index.ts
|
|
196
|
+
var ChessFunctions = {
|
|
197
|
+
Create: create_default,
|
|
198
|
+
Move: move_default,
|
|
199
|
+
Play: play_default,
|
|
200
|
+
Print: print_default
|
|
201
|
+
};
|
|
202
|
+
|
|
202
203
|
// src/blueprints/chess-blueprint.ts
|
|
203
|
-
var
|
|
204
|
-
var functions =
|
|
205
|
-
create_default,
|
|
206
|
-
move_default,
|
|
207
|
-
play_default,
|
|
208
|
-
print_default
|
|
209
|
-
];
|
|
204
|
+
var BLUEPRINT_KEY = "org.dxos.blueprint.chess";
|
|
205
|
+
var functions = Object.values(ChessFunctions);
|
|
210
206
|
var make = () => Blueprint.make({
|
|
211
|
-
key:
|
|
207
|
+
key: BLUEPRINT_KEY,
|
|
212
208
|
name: "Chess",
|
|
213
209
|
tools: Blueprint.toolDefinitions({
|
|
214
210
|
functions
|
|
@@ -222,9 +218,15 @@ var make = () => Blueprint.make({
|
|
|
222
218
|
`
|
|
223
219
|
})
|
|
224
220
|
});
|
|
221
|
+
var blueprint = {
|
|
222
|
+
key: BLUEPRINT_KEY,
|
|
223
|
+
functions,
|
|
224
|
+
make
|
|
225
|
+
};
|
|
226
|
+
var chess_blueprint_default = blueprint;
|
|
225
227
|
|
|
226
228
|
export {
|
|
227
229
|
functions_exports,
|
|
228
|
-
|
|
230
|
+
chess_blueprint_default
|
|
229
231
|
};
|
|
230
|
-
//# sourceMappingURL=chunk-
|
|
232
|
+
//# sourceMappingURL=chunk-46DC6W7W.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blueprints/chess-blueprint.ts", "../../../src/blueprints/functions/index.ts", "../../../src/blueprints/functions/create.ts", "../../../src/blueprints/functions/move.ts", "../../../src/blueprints/functions/play.ts", "../../../src/blueprints/functions/print.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport { Blueprint, Template } from '@dxos/blueprints';\nimport { trim } from '@dxos/util';\n\nimport { ChessFunctions } from './functions';\n\nconst BLUEPRINT_KEY = 'org.dxos.blueprint.chess';\n\nconst functions = Object.values(ChessFunctions);\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Chess',\n tools: Blueprint.toolDefinitions({ functions }),\n instructions: Template.make({\n source: trim`\n You are an expert chess player.\n To analyze a game you can access the \"pgn\" property by loading the context object that represents the current game.\n You could suggest a good next move or offer to play a move.\n Don't actually make a move unless you are asked to.\n `,\n }),\n });\n\nconst blueprint: AppCapabilities.BlueprintDefinition = {\n key: BLUEPRINT_KEY,\n functions,\n make,\n};\n\nexport default blueprint;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport Create from './create';\nimport Move from './move';\nimport Play from './play';\nimport Print from './print';\n\nexport { Create, Move, Play, Print };\n\nexport const ChessFunctions = {\n Create,\n Move,\n Play,\n Print,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { Database } from '@dxos/echo';\nimport { defineFunction } from '@dxos/functions';\n\nimport { Chess } from '../../types';\n\nexport default defineFunction({\n key: 'org.dxos.function.chess.create',\n name: 'Create Chess',\n description: 'Creates a new chess game.',\n inputSchema: Schema.Struct({\n name: Schema.optional(\n Schema.String.annotations({\n description: 'Name of the game.',\n }),\n ),\n pgn: Schema.optional(\n Schema.String.annotations({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n outputSchema: Chess.Game,\n handler: Effect.fn(function* ({ data: { name, pgn, fen } }) {\n return yield* Database.add(Chess.make({ name, pgn, fen }));\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { Database, Obj, Ref } from '@dxos/echo';\nimport { defineFunction } from '@dxos/functions';\n\nimport { Chess } from '../../types';\n\nexport default defineFunction({\n key: 'org.dxos.function.chess.move',\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n inputSchema: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The ID of the chess object.',\n }),\n move: Schema.String.annotations({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n outputSchema: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n }),\n handler: Effect.fn(function* ({ data: { game, move } }) {\n const obj = yield* Database.load(game);\n const chess = new ChessJS();\n if (obj.pgn) {\n chess.loadPgn(obj.pgn);\n } else if (obj.fen) {\n chess.load(obj.fen);\n }\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.change(obj, (obj) => {\n obj.pgn = pgn;\n });\n return { pgn };\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { Database, Obj, Ref } from '@dxos/echo';\nimport { defineFunction } from '@dxos/functions';\n\nimport { Chess } from '../../types';\n\nexport default defineFunction({\n key: 'org.dxos.function.chess.play',\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n inputSchema: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The ID of the chess object.',\n }),\n side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({\n description: 'The side to play.',\n defaultValue: 'any',\n }),\n }),\n outputSchema: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n move: Schema.optional(Schema.String).annotations({\n description: 'The move that was played.',\n }),\n }),\n handler: Effect.fn(function* ({ data: { game, side = 'any' } }) {\n const object = yield* Database.load(game);\n const chess = new ChessJS();\n if (object.pgn) {\n chess.loadPgn(object.pgn);\n } else if (object.fen) {\n chess.load(object.fen);\n }\n\n if (!(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))) {\n return { move: undefined, pgn: object.pgn! };\n }\n\n const moves = chess.moves();\n const move = moves[Math.floor(Math.random() * moves.length)];\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.change(object, (o) => {\n o.pgn = pgn;\n });\n return { move, pgn };\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { defineFunction } from '@dxos/functions';\n\nexport default defineFunction({\n key: 'org.dxos.function.chess.print',\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\n inputSchema: Schema.Struct({\n pgn: Schema.optional(\n Schema.String.annotations({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n outputSchema: Schema.Struct({\n ascii: Schema.String,\n }),\n handler: Effect.fn(function* ({ data: { pgn, fen } }) {\n try {\n const chess = new ChessJS(fen);\n if (pgn) {\n chess.loadPgn(pgn);\n }\n return { ascii: chess.ascii() };\n } catch {\n // TODO(burdon): Error handling?\n return { ascii: '' };\n }\n }),\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["Blueprint", "Template", "trim", "Effect", "Schema", "Database", "defineFunction", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "optional", "String", "annotations", "pgn", "fen", "outputSchema", "Chess", "Game", "handler", "fn", "data", "Database", "add", "make", "Chess", "ChessJS", "Effect", "Schema", "Database", "Obj", "Ref", "defineFunction", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "game", "Ref", "Chess", "Game", "annotations", "move", "String", "examples", "outputSchema", "pgn", "handler", "fn", "data", "obj", "Database", "load", "chess", "ChessJS", "loadPgn", "fen", "strict", "Obj", "change", "Chess", "ChessJS", "Effect", "Schema", "Database", "Obj", "Ref", "defineFunction", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "game", "Ref", "Chess", "Game", "annotations", "side", "optional", "Literal", "defaultValue", "outputSchema", "pgn", "String", "move", "handler", "fn", "data", "object", "Database", "load", "chess", "ChessJS", "loadPgn", "fen", "turn", "undefined", "moves", "Math", "floor", "random", "length", "strict", "Obj", "change", "o", "Chess", "ChessJS", "Effect", "Schema", "defineFunction", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "pgn", "optional", "String", "annotations", "fen", "outputSchema", "ascii", "handler", "fn", "data", "chess", "ChessJS", "loadPgn", "ChessFunctions", "Create", "Move", "Play", "Print", "BLUEPRINT_KEY", "functions", "Object", "values", "ChessFunctions", "make", "Blueprint", "key", "name", "tools", "toolDefinitions", "instructions", "Template", "source", "trim", "blueprint"]
|
|
7
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
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-FYPVCMP4.mjs";
|
|
5
5
|
|
|
6
|
-
// src/components/Chessboard.tsx
|
|
6
|
+
// src/components/Chessboard/Chessboard.tsx
|
|
7
7
|
import { RegistryContext } from "@effect-atom/atom-react";
|
|
8
8
|
import React2, { forwardRef, useCallback, useContext, useEffect as useEffect2, useImperativeHandle, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
9
9
|
import { addEventListener } from "@dxos/async";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useObject } from "@dxos/echo-react";
|
|
11
|
+
import { Gameboard, Chessboard as NaturalChessboard, getRawPgn, useGameboardContext as useGameboardContext2 } from "@dxos/react-ui-gameboard";
|
|
12
12
|
import { useSoundEffect } from "@dxos/react-ui-sfx";
|
|
13
13
|
import { mx as mx2 } from "@dxos/ui-theme";
|
|
14
14
|
|
|
15
|
-
// src/components/Info.tsx
|
|
15
|
+
// src/components/Chessboard/Info.tsx
|
|
16
16
|
import { useAtomValue } from "@effect-atom/atom-react";
|
|
17
17
|
import React, { useEffect, useMemo, useRef } from "react";
|
|
18
18
|
import { generateName } from "@dxos/display-name";
|
|
@@ -21,13 +21,14 @@ import { useMembers } from "@dxos/react-client/echo";
|
|
|
21
21
|
import { Icon, IconButton, Select, useTranslation } from "@dxos/react-ui";
|
|
22
22
|
import { useGameboardContext } from "@dxos/react-ui-gameboard";
|
|
23
23
|
import { mx } from "@dxos/ui-theme";
|
|
24
|
+
var INFO_NAME = "Chessboard.Info";
|
|
24
25
|
var Info = ({ classNames, orientation = "white", onOrientationChange, onClose, ...props }) => {
|
|
25
26
|
const { t } = useTranslation(meta.id);
|
|
26
|
-
const { model } = useGameboardContext(
|
|
27
|
+
const { model } = useGameboardContext(INFO_NAME);
|
|
27
28
|
const db = Obj.getDatabase(model.object);
|
|
28
29
|
const members = useMembers(db?.spaceId);
|
|
29
30
|
return /* @__PURE__ */ React.createElement("div", {
|
|
30
|
-
className: mx("grid grid-rows-[min-content_1fr_min-content]
|
|
31
|
+
className: mx("grid grid-rows-[min-content_1fr_min-content] w-full min-w-[18rem] p-2 overflow-hidden bg-group-surface rounded-xs", classNames)
|
|
31
32
|
}, /* @__PURE__ */ React.createElement(PlayerIndicator, {
|
|
32
33
|
model,
|
|
33
34
|
player: orientation === "white" ? "black" : "white",
|
|
@@ -70,7 +71,7 @@ var Info = ({ classNames, orientation = "white", onOrientationChange, onClose, .
|
|
|
70
71
|
members
|
|
71
72
|
})));
|
|
72
73
|
};
|
|
73
|
-
Info.displayName =
|
|
74
|
+
Info.displayName = INFO_NAME;
|
|
74
75
|
var History = ({ classNames, model, min, max, onSelect }) => {
|
|
75
76
|
const { t } = useTranslation(meta.id);
|
|
76
77
|
const moveIndex = useAtomValue(model.moveIndex);
|
|
@@ -121,16 +122,16 @@ var History = ({ classNames, model, min, max, onSelect }) => {
|
|
|
121
122
|
}
|
|
122
123
|
}, moves.map(([a, b], index) => /* @__PURE__ */ React.createElement("div", {
|
|
123
124
|
key: index,
|
|
124
|
-
className: "grid grid-cols-[3rem_1fr_1fr_1rem] gap-2
|
|
125
|
+
className: "grid grid-cols-[3rem_1fr_1fr_1rem] gap-2 ps-4 leading-1"
|
|
125
126
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
126
127
|
className: "content-center text-xs text-subdued"
|
|
127
128
|
}, index + 1), a && /* @__PURE__ */ React.createElement("div", {
|
|
128
129
|
"data-index": a.index,
|
|
129
|
-
className: mx("
|
|
130
|
+
className: mx("ps-2 cursor-pointer", a.index === moveIndex - 1 && "bg-primary-500"),
|
|
130
131
|
onClick: () => onSelect?.(a.index + 1)
|
|
131
132
|
}, a.move), b && /* @__PURE__ */ React.createElement("div", {
|
|
132
133
|
"data-index": b.index,
|
|
133
|
-
className: mx("
|
|
134
|
+
className: mx("ps-2 cursor-pointer", b.index === moveIndex - 1 && "bg-primary-500"),
|
|
134
135
|
onClick: () => onSelect?.(b.index + 1)
|
|
135
136
|
}, b.move))), label && /* @__PURE__ */ React.createElement("div", {
|
|
136
137
|
className: "text-center"
|
|
@@ -139,13 +140,13 @@ var History = ({ classNames, model, min, max, onSelect }) => {
|
|
|
139
140
|
var PlayerIndicator = ({ children, model, player, icon }) => {
|
|
140
141
|
const turn = player === (model.game.turn() === "w" ? "white" : "black");
|
|
141
142
|
return /* @__PURE__ */ React.createElement("div", {
|
|
142
|
-
className: "grid grid-cols-[2rem_1fr_2rem] gap-2
|
|
143
|
+
className: "grid grid-cols-[2rem_1fr_2rem] gap-2 h-(--dx-rail-size) px-1 flex items-center overflow-hidden"
|
|
143
144
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
144
145
|
className: "place-items-center"
|
|
145
146
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
146
147
|
icon: turn ? "ph--circle--fill" : "ph--circle--thin",
|
|
147
148
|
size: 6,
|
|
148
|
-
classNames: mx(turn && (model.game.isCheckmate() ? "text-
|
|
149
|
+
classNames: mx(turn && (model.game.isCheckmate() ? "text-error-500" : "text-success-text"))
|
|
149
150
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
150
151
|
className: "truncate overflow-hidden items-center"
|
|
151
152
|
}, children), icon);
|
|
@@ -167,19 +168,23 @@ var PlayerSelector = ({ value, onValueChange, members }) => {
|
|
|
167
168
|
})), /* @__PURE__ */ React.createElement(Select.Arrow, null))));
|
|
168
169
|
};
|
|
169
170
|
|
|
170
|
-
// src/components/Chessboard.
|
|
171
|
+
// src/components/Chessboard/types.ts
|
|
172
|
+
import { ChessModel } from "@dxos/react-ui-gameboard";
|
|
171
173
|
var ExtendedChessModel = class extends ChessModel {
|
|
172
174
|
object;
|
|
173
175
|
constructor(registry, object) {
|
|
174
176
|
super(registry), this.object = object;
|
|
175
177
|
}
|
|
176
178
|
};
|
|
179
|
+
|
|
180
|
+
// src/components/Chessboard/Chessboard.tsx
|
|
177
181
|
var Root = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRef) => {
|
|
178
182
|
const registry = useContext(RegistryContext);
|
|
179
183
|
const model = useMemo2(() => new ExtendedChessModel(registry, game), [
|
|
180
184
|
registry
|
|
181
185
|
]);
|
|
182
186
|
const click = useSoundEffect("Click");
|
|
187
|
+
const [pgn, updatePgn] = useObject(game, "pgn");
|
|
183
188
|
useImperativeHandle(forwardedRef, () => {
|
|
184
189
|
return {
|
|
185
190
|
setMoveNumber: (index) => model.setMoveIndex(index)
|
|
@@ -188,24 +193,22 @@ var Root = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRef) => {
|
|
|
188
193
|
model
|
|
189
194
|
]);
|
|
190
195
|
useEffect2(() => {
|
|
191
|
-
if (model.pgn !== getRawPgn(
|
|
196
|
+
if (model.pgn !== getRawPgn(pgn ?? "")) {
|
|
192
197
|
const silent = model.pgn === "*";
|
|
193
|
-
model.update(
|
|
198
|
+
model.update(pgn);
|
|
194
199
|
if (!silent) {
|
|
195
200
|
void click.play();
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
203
|
}, [
|
|
199
|
-
|
|
204
|
+
pgn
|
|
200
205
|
]);
|
|
201
206
|
const handleDrop = useCallback((move) => {
|
|
202
207
|
if (!model.makeMove(move)) {
|
|
203
208
|
return false;
|
|
204
209
|
}
|
|
205
210
|
void click.play();
|
|
206
|
-
|
|
207
|
-
g.pgn = model.pgn;
|
|
208
|
-
});
|
|
211
|
+
updatePgn(() => model.pgn);
|
|
209
212
|
return true;
|
|
210
213
|
}, [
|
|
211
214
|
model
|
|
@@ -217,14 +220,13 @@ var Root = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRef) => {
|
|
|
217
220
|
});
|
|
218
221
|
var Content = ({ classNames, children, role }) => {
|
|
219
222
|
return /* @__PURE__ */ React2.createElement(Gameboard.Content, {
|
|
220
|
-
classNames: mx2(classNames, role === "card--
|
|
221
|
-
grow: !role || role === "card--extrinsic",
|
|
222
|
-
contain: !role || role === "card--extrinsic" || role === "card--popover"
|
|
223
|
+
classNames: mx2(classNames, role === "card--content" ? "dx-size-container dx-card-square" : "flex flex-col justify-center")
|
|
223
224
|
}, children);
|
|
224
225
|
};
|
|
226
|
+
var BOARD_NAME = "Chessboard.Board";
|
|
225
227
|
var Board = (props) => {
|
|
226
228
|
const registry = useContext(RegistryContext);
|
|
227
|
-
const { model } = useGameboardContext2(
|
|
229
|
+
const { model } = useGameboardContext2(BOARD_NAME);
|
|
228
230
|
const ref = useRef2(null);
|
|
229
231
|
useEffect2(() => {
|
|
230
232
|
if (!ref.current) {
|
|
@@ -257,11 +259,11 @@ var Board = (props) => {
|
|
|
257
259
|
model
|
|
258
260
|
]);
|
|
259
261
|
return /* @__PURE__ */ React2.createElement(NaturalChessboard, {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
...props,
|
|
263
|
+
ref
|
|
262
264
|
});
|
|
263
265
|
};
|
|
264
|
-
Board.displayName =
|
|
266
|
+
Board.displayName = BOARD_NAME;
|
|
265
267
|
var Chessboard = {
|
|
266
268
|
Root,
|
|
267
269
|
Content,
|
|
@@ -270,7 +272,6 @@ var Chessboard = {
|
|
|
270
272
|
};
|
|
271
273
|
|
|
272
274
|
export {
|
|
273
|
-
ExtendedChessModel,
|
|
274
275
|
Chessboard
|
|
275
276
|
};
|
|
276
|
-
//# sourceMappingURL=chunk-
|
|
277
|
+
//# sourceMappingURL=chunk-FK7NVSOG.mjs.map
|