@dxos/plugin-chess 0.8.4-main.70d3990 → 0.8.4-main.7996785055
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-JTNMZK6P.mjs +59 -0
- package/dist/lib/browser/ChessArticle-JTNMZK6P.mjs.map +7 -0
- package/dist/lib/browser/ChessCard-HVD4LK2C.mjs +21 -0
- package/dist/lib/browser/ChessCard-HVD4LK2C.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-SH2HLKBU.mjs +20 -0
- package/dist/lib/browser/blueprint-definition-SH2HLKBU.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +14 -0
- package/dist/lib/browser/{chunk-CCF24VRU.mjs → chunk-2TJN26DN.mjs} +18 -34
- package/dist/lib/browser/chunk-2TJN26DN.mjs.map +7 -0
- package/dist/lib/browser/chunk-GPFHUDFY.mjs +110 -0
- package/dist/lib/browser/chunk-GPFHUDFY.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JKW2ZYHP.mjs +28 -0
- package/dist/lib/browser/chunk-JKW2ZYHP.mjs.map +7 -0
- package/dist/lib/browser/chunk-OT2LMRRV.mjs +42 -0
- package/dist/lib/browser/chunk-OT2LMRRV.mjs.map +7 -0
- package/dist/lib/browser/chunk-OUFKVTXQ.mjs +278 -0
- package/dist/lib/browser/chunk-OUFKVTXQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DUO4WTAM.mjs → chunk-RGHZ5CDO.mjs} +2 -9
- package/dist/lib/browser/chunk-RGHZ5CDO.mjs.map +7 -0
- 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 +38 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/create-UJ656WLM.mjs +24 -0
- package/dist/lib/browser/create-UJ656WLM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +68 -76
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/move-QCJSXFHW.mjs +36 -0
- package/dist/lib/browser/move-QCJSXFHW.mjs.map +7 -0
- package/dist/lib/browser/operation-handler-NKF7GNU2.mjs +17 -0
- package/dist/lib/browser/operation-handler-NKF7GNU2.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +19 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/play-YEOTE6KO.mjs +45 -0
- package/dist/lib/browser/play-YEOTE6KO.mjs.map +7 -0
- package/dist/lib/browser/print-LUCG4CIR.mjs +30 -0
- package/dist/lib/browser/print-LUCG4CIR.mjs.map +7 -0
- package/dist/lib/browser/react-surface-2VBZOUX2.mjs +50 -0
- package/dist/lib/browser/react-surface-2VBZOUX2.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/ChessArticle-677BPBLL.mjs +60 -0
- package/dist/lib/node-esm/ChessArticle-677BPBLL.mjs.map +7 -0
- package/dist/lib/node-esm/ChessCard-4WOJ225W.mjs +22 -0
- package/dist/lib/node-esm/ChessCard-4WOJ225W.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-5UIG6VEF.mjs +21 -0
- package/dist/lib/node-esm/blueprint-definition-5UIG6VEF.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +15 -0
- package/dist/lib/node-esm/blueprints/index.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-D72ZBXX6.mjs +29 -0
- package/dist/lib/node-esm/chunk-D72ZBXX6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KNOOJFIR.mjs → chunk-FYPVCMP4.mjs} +2 -8
- package/dist/lib/node-esm/chunk-FYPVCMP4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSVQ3553.mjs +43 -0
- package/dist/lib/node-esm/chunk-HSVQ3553.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LPVPGURE.mjs +111 -0
- package/dist/lib/node-esm/chunk-LPVPGURE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QKXLEJNZ.mjs → chunk-OIRJVY2R.mjs} +18 -34
- package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-S22QSSUJ.mjs +279 -0
- package/dist/lib/node-esm/chunk-S22QSSUJ.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +39 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-KINGWZOM.mjs +25 -0
- package/dist/lib/node-esm/create-KINGWZOM.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +68 -76
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/move-JDR3KQ5G.mjs +37 -0
- package/dist/lib/node-esm/move-JDR3KQ5G.mjs.map +7 -0
- package/dist/lib/node-esm/operation-handler-U7XD2D3B.mjs +18 -0
- package/dist/lib/node-esm/operation-handler-U7XD2D3B.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +20 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/play-KIWAE5LA.mjs +46 -0
- package/dist/lib/node-esm/play-KIWAE5LA.mjs.map +7 -0
- package/dist/lib/node-esm/print-QHFZDMWC.mjs +31 -0
- package/dist/lib/node-esm/print-QHFZDMWC.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-2HD5V4SH.mjs +51 -0
- package/dist/lib/node-esm/react-surface-2HD5V4SH.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/ChessPlugin.d.ts +2 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/chess-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +3 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +2 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +4 -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} +9 -8
- 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} +2 -9
- 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 +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +51 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/move.d.ts +5 -0
- package/dist/types/src/operations/move.d.ts.map +1 -0
- package/dist/types/src/operations/play.d.ts +5 -0
- package/dist/types/src/operations/play.d.ts.map +1 -0
- package/dist/types/src/operations/print.d.ts +5 -0
- package/dist/types/src/operations/print.d.ts.map +1 -0
- 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 +17 -17
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +65 -43
- package/src/ChessPlugin.tsx +39 -46
- package/src/blueprints/chess-blueprint.ts +35 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +135 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +2 -6
- package/src/capabilities/operation-handler/index.ts +9 -0
- package/src/capabilities/operation-handler/operation-handler.ts +14 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +33 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +37 -0
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +32 -29
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +35 -18
- 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/containers/ChessArticle/ChessArticle.stories.tsx +53 -0
- package/src/containers/ChessArticle/ChessArticle.tsx +73 -0
- package/src/containers/ChessArticle/index.ts +7 -0
- package/src/containers/ChessCard/ChessCard.stories.tsx +42 -0
- 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 +2 -2
- package/src/meta.ts +3 -3
- package/src/operations/create.ts +22 -0
- package/src/operations/definitions.ts +109 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/move.ts +37 -0
- package/src/operations/play.ts +46 -0
- package/src/operations/print.ts +28 -0
- package/src/translations.ts +1 -0
- package/src/types/Chess.ts +11 -7
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs +0 -96
- package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-Y5Y4YGNL.mjs +0 -11
- package/dist/lib/browser/chunk-3LPE2B5J.mjs +0 -169
- package/dist/lib/browser/chunk-3LPE2B5J.mjs.map +0 -7
- package/dist/lib/browser/chunk-5DOZV3PW.mjs +0 -294
- package/dist/lib/browser/chunk-5DOZV3PW.mjs.map +0 -7
- package/dist/lib/browser/chunk-CCF24VRU.mjs.map +0 -7
- package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q5TZCIH7.mjs +0 -8
- package/dist/lib/browser/chunk-Q5TZCIH7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-KPGHK5JU.mjs +0 -25
- package/dist/lib/browser/intent-resolver-KPGHK5JU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3YST34QI.mjs +0 -38
- package/dist/lib/browser/react-surface-3YST34QI.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs +0 -97
- package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-GR6OLMB6.mjs +0 -12
- package/dist/lib/node-esm/chunk-F3HFLDV5.mjs +0 -170
- package/dist/lib/node-esm/chunk-F3HFLDV5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F4C2HVZL.mjs +0 -295
- package/dist/lib/node-esm/chunk-F4C2HVZL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QKXLEJNZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VVXTAVIS.mjs +0 -10
- package/dist/lib/node-esm/chunk-VVXTAVIS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-ZAELGF7I.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-ZAELGF7I.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-KV2KBSIU.mjs +0 -39
- package/dist/lib/node-esm/react-surface-KV2KBSIU.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- 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 -7
- package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +0 -9
- package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
- package/dist/types/src/components/Info.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts +0 -14
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/move.d.ts +0 -8
- package/dist/types/src/functions/move.d.ts.map +0 -1
- package/dist/types/src/functions/play.d.ts +0 -9
- package/dist/types/src/functions/play.d.ts.map +0 -1
- package/dist/types/src/types/ChessAction.d.ts +0 -24
- package/dist/types/src/types/ChessAction.d.ts.map +0 -1
- package/src/capabilities/artifact-definition.ts +0 -129
- package/src/capabilities/blueprint-definition.ts +0 -36
- package/src/capabilities/intent-resolver.ts +0 -22
- package/src/capabilities/react-surface.tsx +0 -23
- package/src/components/Card.stories.tsx +0 -66
- package/src/components/Chessboard.stories.tsx +0 -49
- package/src/components/ChessboardArticle.tsx +0 -68
- package/src/components/ChessboardContainer.tsx +0 -44
- package/src/functions/create.ts +0 -32
- package/src/functions/index.ts +0 -7
- package/src/functions/move.ts +0 -45
- package/src/functions/play.ts +0 -55
- package/src/types/ChessAction.ts +0 -19
- /package/dist/lib/browser/{blueprint-definition-Y5Y4YGNL.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-GR6OLMB6.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "./chunk-WYUTI2K4.mjs";
|
|
2
|
+
import {
|
|
3
|
+
Chessboard
|
|
4
|
+
} from "./chunk-OUFKVTXQ.mjs";
|
|
5
|
+
import {
|
|
6
|
+
meta
|
|
7
|
+
} from "./chunk-RGHZ5CDO.mjs";
|
|
8
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
9
|
+
|
|
10
|
+
// src/containers/ChessArticle/ChessArticle.tsx
|
|
11
|
+
import React, { useCallback, useRef, useState } from "react";
|
|
12
|
+
import { Panel, Toolbar, useTranslation } from "@dxos/react-ui";
|
|
13
|
+
import { mx } from "@dxos/ui-theme";
|
|
14
|
+
var ChessArticle = ({ role, subject: game }) => {
|
|
15
|
+
const { t } = useTranslation(meta.id);
|
|
16
|
+
const [orientation, setOrientation] = useState("white");
|
|
17
|
+
const [showInfo, setShowInfo] = useState(true);
|
|
18
|
+
const controller = useRef(null);
|
|
19
|
+
const handleSelect = useCallback((index) => {
|
|
20
|
+
controller.current?.setMoveNumber(index);
|
|
21
|
+
}, []);
|
|
22
|
+
return /* @__PURE__ */ React.createElement(Chessboard.Root, {
|
|
23
|
+
game,
|
|
24
|
+
ref: controller
|
|
25
|
+
}, /* @__PURE__ */ React.createElement(Panel.Root, {
|
|
26
|
+
role,
|
|
27
|
+
classNames: "@container"
|
|
28
|
+
}, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
|
|
29
|
+
asChild: true
|
|
30
|
+
}, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
|
|
31
|
+
icon: "ph--info--regular",
|
|
32
|
+
iconOnly: true,
|
|
33
|
+
label: t("toggle info button"),
|
|
34
|
+
disabled: showInfo,
|
|
35
|
+
classNames: mx("invisible @3xl:visible"),
|
|
36
|
+
onClick: () => setShowInfo((open) => !open)
|
|
37
|
+
}))), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement("div", {
|
|
38
|
+
className: mx("grid h-full w-full", showInfo && "@3xl:grid-cols-[1fr_320px] gap-8", role === "article" && "p-4", role === "section" && "aspect-square", role === "section" && showInfo && "@3xl:aspect-auto")
|
|
39
|
+
}, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, {
|
|
40
|
+
classNames: "border rounded-xs",
|
|
41
|
+
orientation
|
|
42
|
+
})), showInfo && /* @__PURE__ */ React.createElement("div", {
|
|
43
|
+
className: "hidden @3xl:flex flex-col justify-center items-center overflow-hidden"
|
|
44
|
+
}, /* @__PURE__ */ React.createElement(Chessboard.Info, {
|
|
45
|
+
orientation,
|
|
46
|
+
min: 8,
|
|
47
|
+
max: 8,
|
|
48
|
+
onOrientationChange: setOrientation,
|
|
49
|
+
onClose: () => setShowInfo(false),
|
|
50
|
+
onSelect: handleSelect
|
|
51
|
+
}))))));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/containers/ChessArticle/index.ts
|
|
55
|
+
var ChessArticle_default = ChessArticle;
|
|
56
|
+
export {
|
|
57
|
+
ChessArticle_default as default
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=ChessArticle-JTNMZK6P.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 [showInfo, setShowInfo] = 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={showInfo}\n classNames={mx('invisible @3xl:visible')}\n onClick={() => setShowInfo((open) => !open)}\n />\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content>\n <div\n className={mx(\n 'grid h-full w-full',\n showInfo && '@3xl:grid-cols-[1fr_320px] gap-8',\n role === 'article' && 'p-4',\n role === 'section' && 'aspect-square',\n role === 'section' && showInfo && '@3xl:aspect-auto',\n )}\n >\n <Chessboard.Content>\n <Chessboard.Board classNames='border rounded-xs' orientation={orientation} />\n </Chessboard.Content>\n {showInfo && (\n <div className='hidden @3xl:flex flex-col justify-center items-center overflow-hidden'>\n <Chessboard.Info\n orientation={orientation}\n min={8}\n max={8}\n onOrientationChange={setOrientation}\n onClose={() => setShowInfo(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,UAAUC,WAAAA,IAAeF,SAAS,IAAA;AACzC,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,YAAY,CAACsB,SAAS,CAACA,IAAAA;QAI5C,sBAAA,cAACX,MAAMY,SAAO,MACZ,sBAAA,cAACC,OAAAA;IACCC,WAAWL,GACT,sBACArB,YAAY,oCACZV,SAAS,aAAa,OACtBA,SAAS,aAAa,iBACtBA,SAAS,aAAaU,YAAY,kBAAA;KAGpC,sBAAA,cAACS,WAAWe,SAAO,MACjB,sBAAA,cAACf,WAAWkB,OAAK;IAACd,YAAW;IAAoBhB;OAElDG,YACC,sBAAA,cAACyB,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACjB,WAAWmB,MAAI;IACd/B;IACAgC,KAAK;IACLC,KAAK;IACLC,qBAAqBjC;IACrBkC,SAAS,MAAM/B,YAAY,KAAA;IAC3BgC,UAAU7B;;AAS5B;;;AClEA,IAAA,uBAAe8B;",
|
|
6
|
+
"names": ["React", "useCallback", "useRef", "useState", "Panel", "Toolbar", "useTranslation", "mx", "ChessArticle", "role", "subject", "game", "t", "useTranslation", "meta", "id", "orientation", "setOrientation", "useState", "showInfo", "setShowInfo", "controller", "useRef", "handleSelect", "useCallback", "index", "current", "setMoveNumber", "Chessboard", "Root", "ref", "Panel", "classNames", "Toolbar", "asChild", "IconButton", "icon", "iconOnly", "label", "disabled", "mx", "onClick", "open", "Content", "div", "className", "Board", "Info", "min", "max", "onOrientationChange", "onClose", "onSelect", "ChessArticle"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "./chunk-WYUTI2K4.mjs";
|
|
2
|
+
import {
|
|
3
|
+
Chessboard
|
|
4
|
+
} from "./chunk-OUFKVTXQ.mjs";
|
|
5
|
+
import "./chunk-RGHZ5CDO.mjs";
|
|
6
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
7
|
+
|
|
8
|
+
// src/containers/ChessCard/ChessCard.tsx
|
|
9
|
+
import React from "react";
|
|
10
|
+
var ChessCard = ({ subject: game }) => {
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Chessboard.Root, {
|
|
12
|
+
game
|
|
13
|
+
}, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, null)));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/containers/ChessCard/index.ts
|
|
17
|
+
var ChessCard_default = ChessCard;
|
|
18
|
+
export {
|
|
19
|
+
ChessCard_default as default
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=ChessCard-HVD4LK2C.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
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
chess_blueprint_default
|
|
3
|
+
} from "./chunk-OT2LMRRV.mjs";
|
|
4
|
+
import "./chunk-JKW2ZYHP.mjs";
|
|
5
|
+
import "./chunk-GPFHUDFY.mjs";
|
|
6
|
+
import "./chunk-2TJN26DN.mjs";
|
|
7
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
8
|
+
|
|
9
|
+
// src/capabilities/blueprint-definition/blueprint-definition.ts
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { Capability } from "@dxos/app-framework";
|
|
12
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
13
|
+
var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
|
|
14
|
+
Capability.contributes(AppCapabilities.BlueprintDefinition, chess_blueprint_default)
|
|
15
|
+
]));
|
|
16
|
+
var blueprint_definition_default = blueprintDefinition;
|
|
17
|
+
export {
|
|
18
|
+
blueprint_definition_default as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=blueprint-definition-SH2HLKBU.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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
chess_blueprint_default
|
|
3
|
+
} from "../chunk-OT2LMRRV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
operations_exports
|
|
6
|
+
} from "../chunk-JKW2ZYHP.mjs";
|
|
7
|
+
import "../chunk-GPFHUDFY.mjs";
|
|
8
|
+
import "../chunk-2TJN26DN.mjs";
|
|
9
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
10
|
+
export {
|
|
11
|
+
chess_blueprint_default as ChessBlueprint,
|
|
12
|
+
operations_exports as ChessFunctions
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__export
|
|
3
|
-
|
|
4
|
-
} from "./chunk-DUO4WTAM.mjs";
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
5
4
|
|
|
6
5
|
// src/types/Chess.ts
|
|
7
6
|
var Chess_exports = {};
|
|
8
7
|
__export(Chess_exports, {
|
|
9
8
|
Game: () => Game,
|
|
10
|
-
|
|
9
|
+
make: () => make
|
|
11
10
|
});
|
|
12
11
|
import { Chess as ChessJS } from "chess.js";
|
|
13
12
|
import * as Schema from "effect/Schema";
|
|
14
|
-
import { Obj, Type } from "@dxos/echo";
|
|
13
|
+
import { Annotation, Obj, Type } from "@dxos/echo";
|
|
15
14
|
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
16
15
|
import { log } from "@dxos/log";
|
|
17
16
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-chess/src/types/Chess.ts";
|
|
@@ -24,20 +23,23 @@ var Game = Schema.Struct({
|
|
|
24
23
|
black: Schema.optional(Schema.String.annotations({
|
|
25
24
|
description: "DID of black player"
|
|
26
25
|
}))
|
|
27
|
-
}).pipe(
|
|
26
|
+
}).pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
28
27
|
pgn: Schema.String.annotations({
|
|
29
28
|
description: "Portable Game Notation."
|
|
30
29
|
}).pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
31
30
|
fen: Schema.String.annotations({
|
|
32
31
|
description: "Forsyth-Edwards Notation."
|
|
33
32
|
}).pipe(FormInputAnnotation.set(false), Schema.optional)
|
|
34
|
-
}).pipe(Type.
|
|
35
|
-
typename: "dxos.
|
|
36
|
-
version: "0.
|
|
33
|
+
}).pipe(Type.object({
|
|
34
|
+
typename: "org.dxos.type.chess",
|
|
35
|
+
version: "0.1.0"
|
|
37
36
|
}), LabelAnnotation.set([
|
|
38
37
|
"name"
|
|
39
|
-
])
|
|
40
|
-
|
|
38
|
+
]), Annotation.IconAnnotation.set({
|
|
39
|
+
icon: "ph--shield-chevron--regular",
|
|
40
|
+
hue: "amber"
|
|
41
|
+
}));
|
|
42
|
+
var make = ({ name, pgn, fen } = {}) => {
|
|
41
43
|
const chess = new ChessJS();
|
|
42
44
|
if (pgn) {
|
|
43
45
|
try {
|
|
@@ -45,7 +47,7 @@ var makeGame = ({ name, pgn, fen } = {}) => {
|
|
|
45
47
|
} catch {
|
|
46
48
|
log.warn(pgn, void 0, {
|
|
47
49
|
F: __dxlog_file,
|
|
48
|
-
L:
|
|
50
|
+
L: 52,
|
|
49
51
|
S: void 0,
|
|
50
52
|
C: (f, a) => f(...a)
|
|
51
53
|
});
|
|
@@ -53,31 +55,13 @@ var makeGame = ({ name, pgn, fen } = {}) => {
|
|
|
53
55
|
}
|
|
54
56
|
return Obj.make(Game, {
|
|
55
57
|
name,
|
|
56
|
-
players: {},
|
|
57
58
|
pgn,
|
|
58
|
-
fen
|
|
59
|
+
fen,
|
|
60
|
+
players: {}
|
|
59
61
|
});
|
|
60
62
|
};
|
|
61
63
|
|
|
62
|
-
// src/types/ChessAction.ts
|
|
63
|
-
var ChessAction_exports = {};
|
|
64
|
-
__export(ChessAction_exports, {
|
|
65
|
-
Create: () => Create
|
|
66
|
-
});
|
|
67
|
-
import * as Schema2 from "effect/Schema";
|
|
68
|
-
var Create = class extends Schema2.TaggedClass()(`${meta.id}/action/create`, {
|
|
69
|
-
input: Schema2.Struct({
|
|
70
|
-
name: Schema2.optional(Schema2.String),
|
|
71
|
-
pgn: Schema2.optional(Schema2.String)
|
|
72
|
-
}),
|
|
73
|
-
output: Schema2.Struct({
|
|
74
|
-
object: Game
|
|
75
|
-
})
|
|
76
|
-
}) {
|
|
77
|
-
};
|
|
78
|
-
|
|
79
64
|
export {
|
|
80
|
-
Chess_exports
|
|
81
|
-
ChessAction_exports
|
|
65
|
+
Chess_exports
|
|
82
66
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-2TJN26DN.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/Chess.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { log } from '@dxos/log';\n\nexport const Game = Schema.Struct({\n name: Schema.optional(Schema.String),\n players: Schema.Struct({\n white: Schema.optional(\n Schema.String.annotations({\n description: 'DID of white player',\n }),\n ),\n black: Schema.optional(\n Schema.String.annotations({\n description: 'DID of black player',\n }),\n ),\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n pgn: Schema.String.annotations({\n description: 'Portable Game Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n fen: Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.chess',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--shield-chevron--regular',\n hue: 'amber',\n }),\n);\n\nexport interface Game extends Schema.Schema.Type<typeof Game> {}\n\nexport const make = ({ name, pgn, fen }: { name?: string; pgn?: string; fen?: string } = {}) => {\n const chess = new ChessJS();\n if (pgn) {\n try {\n chess.loadPgn(pgn);\n } catch {\n log.warn(pgn);\n }\n }\n\n return Obj.make(Game, {\n name,\n pgn,\n fen,\n players: {},\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,YAAYC,KAAKC,YAAY;AACtC,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,WAAW;;AAEb,IAAMC,OAAcC,cAAO;EAChCC,MAAaC,gBAAgBC,aAAM;EACnCC,SAAgBJ,cAAO;IACrBK,OAAcH,gBACLC,cAAOG,YAAY;MACxBC,aAAa;IACf,CAAA,CAAA;IAEFC,OAAcN,gBACLC,cAAOG,YAAY;MACxBC,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA,EAAGE,KAAKb,oBAAoBc,IAAI,KAAA,GAAeR,eAAQ;EACvDS,KAAYR,cAAOG,YAAY;IAC7BC,aAAa;EACf,CAAA,EAAGE,KAAKb,oBAAoBc,IAAI,KAAA,GAAeR,eAAQ;EACvDU,KAAYT,cAAOG,YAAY;IAC7BC,aAAa;EACf,CAAA,EAAGE,KAAKb,oBAAoBc,IAAI,KAAA,GAAeR,eAAQ;AACzD,CAAA,EAAGO,KACDd,KAAKkB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAlB,gBAAgBa,IAAI;EAAC;CAAO,GAC5BjB,WAAWuB,eAAeN,IAAI;EAC5BO,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAKK,IAAMC,OAAO,CAAC,EAAElB,MAAMU,KAAKC,IAAG,IAAoD,CAAC,MAAC;AACzF,QAAMQ,QAAQ,IAAI7B,QAAAA;AAClB,MAAIoB,KAAK;AACP,QAAI;AACFS,YAAMC,QAAQV,GAAAA;IAChB,QAAQ;AACNb,UAAIwB,KAAKX,KAAAA,QAAAA;;;;;;IACX;EACF;AAEA,SAAOjB,IAAIyB,KAAKpB,MAAM;IACpBE;IACAU;IACAC;IACAR,SAAS,CAAC;EACZ,CAAA;AACF;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Schema", "Annotation", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "log", "Game", "Struct", "name", "optional", "String", "players", "white", "annotations", "description", "black", "pipe", "set", "pgn", "fen", "object", "typename", "version", "IconAnnotation", "icon", "hue", "make", "chess", "loadPgn", "warn"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Chess_exports
|
|
3
|
+
} from "./chunk-2TJN26DN.mjs";
|
|
4
|
+
|
|
5
|
+
// src/operations/definitions.ts
|
|
6
|
+
import { Operation } from "@dxos/operation";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
import { Database, Ref } from "@dxos/echo";
|
|
9
|
+
var Create = Operation.make({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "org.dxos.function.chess.create",
|
|
12
|
+
name: "Create Chess",
|
|
13
|
+
description: "Creates a new chess game."
|
|
14
|
+
},
|
|
15
|
+
input: Schema.Struct({
|
|
16
|
+
name: Schema.optional(Schema.String.annotations({
|
|
17
|
+
description: "Name of the game."
|
|
18
|
+
})),
|
|
19
|
+
pgn: Schema.optional(Schema.String.annotations({
|
|
20
|
+
description: "Portable Game Notation."
|
|
21
|
+
})),
|
|
22
|
+
fen: Schema.optional(Schema.String.annotations({
|
|
23
|
+
description: "Forsyth-Edwards Notation."
|
|
24
|
+
}))
|
|
25
|
+
}),
|
|
26
|
+
output: Chess_exports.Game,
|
|
27
|
+
services: [
|
|
28
|
+
Database.Service
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
var Move = Operation.make({
|
|
32
|
+
meta: {
|
|
33
|
+
key: "org.dxos.function.chess.move",
|
|
34
|
+
name: "Move",
|
|
35
|
+
description: "Makes a move in the given chess game."
|
|
36
|
+
},
|
|
37
|
+
input: Schema.Struct({
|
|
38
|
+
game: Ref.Ref(Chess_exports.Game).annotations({
|
|
39
|
+
description: "The ID of the chess object."
|
|
40
|
+
}),
|
|
41
|
+
move: Schema.String.annotations({
|
|
42
|
+
description: "The move to make in the chess game.",
|
|
43
|
+
examples: [
|
|
44
|
+
"e4",
|
|
45
|
+
"Bf3"
|
|
46
|
+
]
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
output: Schema.Struct({
|
|
50
|
+
pgn: Schema.String.annotations({
|
|
51
|
+
description: "The PGN of the game after the move was played."
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
services: [
|
|
55
|
+
Database.Service
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
var Play = Operation.make({
|
|
59
|
+
meta: {
|
|
60
|
+
key: "org.dxos.function.chess.play",
|
|
61
|
+
name: "Play",
|
|
62
|
+
description: "Uses the chess engine to play the next move."
|
|
63
|
+
},
|
|
64
|
+
input: Schema.Struct({
|
|
65
|
+
game: Ref.Ref(Chess_exports.Game).annotations({
|
|
66
|
+
description: "The ID of the chess object."
|
|
67
|
+
}),
|
|
68
|
+
side: Schema.optional(Schema.Literal("white", "black", "any")).annotations({
|
|
69
|
+
description: "The side to play.",
|
|
70
|
+
defaultValue: "any"
|
|
71
|
+
})
|
|
72
|
+
}),
|
|
73
|
+
output: Schema.Struct({
|
|
74
|
+
pgn: Schema.String.annotations({
|
|
75
|
+
description: "The PGN of the game after the move was played."
|
|
76
|
+
}),
|
|
77
|
+
move: Schema.optional(Schema.String).annotations({
|
|
78
|
+
description: "The move that was played."
|
|
79
|
+
})
|
|
80
|
+
}),
|
|
81
|
+
services: [
|
|
82
|
+
Database.Service
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
var Print = Operation.make({
|
|
86
|
+
meta: {
|
|
87
|
+
key: "org.dxos.function.chess.print",
|
|
88
|
+
name: "Print game",
|
|
89
|
+
description: "Prints the chess game to ASCII."
|
|
90
|
+
},
|
|
91
|
+
input: Schema.Struct({
|
|
92
|
+
pgn: Schema.optional(Schema.String.annotations({
|
|
93
|
+
description: "Portable Game Notation."
|
|
94
|
+
})),
|
|
95
|
+
fen: Schema.optional(Schema.String.annotations({
|
|
96
|
+
description: "Forsyth-Edwards Notation."
|
|
97
|
+
}))
|
|
98
|
+
}),
|
|
99
|
+
output: Schema.Struct({
|
|
100
|
+
ascii: Schema.String
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export {
|
|
105
|
+
Create,
|
|
106
|
+
Move,
|
|
107
|
+
Play,
|
|
108
|
+
Print
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=chunk-GPFHUDFY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/definitions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Operation } from '@dxos/operation';\nimport * as Schema from 'effect/Schema';\n\nimport { Database, Ref } from '@dxos/echo';\n\nimport { Chess } from '../types';\n\nexport const Create = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.create',\n name: 'Create Chess',\n description: 'Creates a new chess game.',\n },\n input: 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 output: Chess.Game,\n services: [Database.Service],\n});\n\nexport const Move = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.move',\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n },\n input: 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 output: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Play = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.play',\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n },\n input: 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 output: 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 services: [Database.Service],\n});\n\nexport const Print = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.print',\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\n },\n input: 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 output: Schema.Struct({\n ascii: Schema.String,\n }),\n});\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,iBAAiB;AAC1B,YAAYC,YAAY;AAExB,SAASC,UAAUC,WAAW;AAIvB,IAAMC,SAASC,UAAUC,KAAK;EACnCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBH,MAAaI,gBACJC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFM,KAAYH,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFO,KAAYJ,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAQ,QAAQC,cAAMC;EACdC,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMC,OAAOnB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBa,MAAMC,IAAIA,IAAIP,cAAMC,IAAI,EAAEL,YAAY;MACpCL,aAAa;IACf,CAAA;IACAiB,MAAab,cAAOC,YAAY;MAC9BL,aAAa;MACbkB,UAAU;QAAC;QAAM;;IACnB,CAAA;EACF,CAAA;EACAV,QAAeN,cAAO;IACpBI,KAAYF,cAAOC,YAAY;MAC7BL,aAAa;IACf,CAAA;EACF,CAAA;EACAW,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMM,OAAOxB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBa,MAAMC,IAAIA,IAAIP,cAAMC,IAAI,EAAEL,YAAY;MACpCL,aAAa;IACf,CAAA;IACAoB,MAAajB,gBAAgBkB,eAAQ,SAAS,SAAS,KAAA,CAAA,EAAQhB,YAAY;MACzEL,aAAa;MACbsB,cAAc;IAChB,CAAA;EACF,CAAA;EACAd,QAAeN,cAAO;IACpBI,KAAYF,cAAOC,YAAY;MAC7BL,aAAa;IACf,CAAA;IACAiB,MAAad,gBAAgBC,aAAM,EAAEC,YAAY;MAC/CL,aAAa;IACf,CAAA;EACF,CAAA;EACAW,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMU,QAAQ5B,UAAUC,KAAK;EAClCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBI,KAAYH,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFO,KAAYJ,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAQ,QAAeN,cAAO;IACpBsB,OAAcpB;EAChB,CAAA;AACF,CAAA;",
|
|
6
|
+
"names": ["Operation", "Schema", "Database", "Ref", "Create", "Operation", "make", "meta", "key", "name", "description", "input", "Struct", "optional", "String", "annotations", "pgn", "fen", "output", "Chess", "Game", "services", "Database", "Service", "Move", "game", "Ref", "move", "examples", "Play", "side", "Literal", "defaultValue", "Print", "ascii"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Create,
|
|
3
|
+
Move,
|
|
4
|
+
Play,
|
|
5
|
+
Print
|
|
6
|
+
} from "./chunk-GPFHUDFY.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__export
|
|
9
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
10
|
+
|
|
11
|
+
// src/operations/index.ts
|
|
12
|
+
var operations_exports = {};
|
|
13
|
+
__export(operations_exports, {
|
|
14
|
+
ChessHandlers: () => ChessHandlers,
|
|
15
|
+
Create: () => Create,
|
|
16
|
+
Move: () => Move,
|
|
17
|
+
Play: () => Play,
|
|
18
|
+
Print: () => Print
|
|
19
|
+
});
|
|
20
|
+
import { OperationHandlerSet } from "@dxos/operation";
|
|
21
|
+
var Handlers = OperationHandlerSet.lazy(() => import("./create-UJ656WLM.mjs"), () => import("./move-QCJSXFHW.mjs"), () => import("./play-YEOTE6KO.mjs"), () => import("./print-LUCG4CIR.mjs"));
|
|
22
|
+
var ChessHandlers = Handlers;
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
ChessHandlers,
|
|
26
|
+
operations_exports
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-JKW2ZYHP.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/operation';\n\nconst Handlers = OperationHandlerSet.lazy(\n () => import('./create'),\n () => import('./move'),\n () => import('./play'),\n () => import('./print'),\n);\n\nexport { Create, Move, Play, Print } from './definitions';\n\nexport const ChessHandlers = Handlers;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAAA;;;;;;;;AAIA,SAASA,2BAA2B;AAEpC,IAAMC,WAAWC,oBAAoBC,KACnC,MAAM,OAAO,uBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,sBAAA,CAAA;AAKR,IAAMC,gBAAgBH;",
|
|
6
|
+
"names": ["OperationHandlerSet", "Handlers", "OperationHandlerSet", "lazy", "ChessHandlers"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Create,
|
|
3
|
+
Move,
|
|
4
|
+
Play,
|
|
5
|
+
Print
|
|
6
|
+
} from "./chunk-GPFHUDFY.mjs";
|
|
7
|
+
|
|
8
|
+
// src/blueprints/chess-blueprint.ts
|
|
9
|
+
import { Blueprint, Template } from "@dxos/blueprints";
|
|
10
|
+
import { trim } from "@dxos/util";
|
|
11
|
+
var BLUEPRINT_KEY = "org.dxos.blueprint.chess";
|
|
12
|
+
var operations = [
|
|
13
|
+
Create,
|
|
14
|
+
Move,
|
|
15
|
+
Play,
|
|
16
|
+
Print
|
|
17
|
+
];
|
|
18
|
+
var make = () => Blueprint.make({
|
|
19
|
+
key: BLUEPRINT_KEY,
|
|
20
|
+
name: "Chess",
|
|
21
|
+
tools: Blueprint.toolDefinitions({
|
|
22
|
+
operations
|
|
23
|
+
}),
|
|
24
|
+
instructions: Template.make({
|
|
25
|
+
source: trim`
|
|
26
|
+
You are an expert chess player.
|
|
27
|
+
To analyze a game you can access the "pgn" property by loading the context object that represents the current game.
|
|
28
|
+
You could suggest a good next move or offer to play a move.
|
|
29
|
+
Don't actually make a move unless you are asked to.
|
|
30
|
+
`
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
var blueprint = {
|
|
34
|
+
key: BLUEPRINT_KEY,
|
|
35
|
+
make
|
|
36
|
+
};
|
|
37
|
+
var chess_blueprint_default = blueprint;
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
chess_blueprint_default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=chunk-OT2LMRRV.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blueprints/chess-blueprint.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 { Create, Move, Play, Print } from '../operations';\n\nconst BLUEPRINT_KEY = 'org.dxos.blueprint.chess';\n\nconst operations = [Create, Move, Play, Print];\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Chess',\n tools: Blueprint.toolDefinitions({ operations }),\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 make,\n};\n\nexport default blueprint;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAKA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAIrB,IAAMC,gBAAgB;AAEtB,IAAMC,aAAa;EAACC;EAAQC;EAAMC;EAAMC;;AAExC,IAAMC,OAAO,MACXC,UAAUD,KAAK;EACbE,KAAKR;EACLS,MAAM;EACNC,OAAOH,UAAUI,gBAAgB;IAAEV;EAAW,CAAA;EAC9CW,cAAcC,SAASP,KAAK;IAC1BQ,QAAQC;;;;;;EAMV,CAAA;AACF,CAAA;AAEF,IAAMC,YAAiD;EACrDR,KAAKR;EACLM;AACF;AAEA,IAAA,0BAAeU;",
|
|
6
|
+
"names": ["Blueprint", "Template", "trim", "BLUEPRINT_KEY", "operations", "Create", "Move", "Play", "Print", "make", "Blueprint", "key", "name", "tools", "toolDefinitions", "instructions", "Template", "source", "trim", "blueprint"]
|
|
7
|
+
}
|