@dxos/plugin-chess 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
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/blueprints/index.mjs +14 -0
- package/dist/lib/browser/chunk-2TJN26DN.mjs +67 -0
- package/dist/lib/browser/chunk-2TJN26DN.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-MC7L6JNC.mjs +36 -0
- package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +7 -0
- package/dist/lib/browser/chunk-SBRUTOHG.mjs +28 -0
- package/dist/lib/browser/chunk-SBRUTOHG.mjs.map +7 -0
- package/dist/lib/browser/chunk-XAJZK6Z2.mjs +110 -0
- package/dist/lib/browser/chunk-XAJZK6Z2.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +34 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/create-AJHN4QT4.mjs +24 -0
- package/dist/lib/browser/create-AJHN4QT4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +364 -99
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/move-CN7BGBOR.mjs +36 -0
- package/dist/lib/browser/move-CN7BGBOR.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-YRKSZF5U.mjs +45 -0
- package/dist/lib/browser/play-YRKSZF5U.mjs.map +7 -0
- package/dist/lib/browser/print-EW7LPW4D.mjs +30 -0
- package/dist/lib/browser/print-EW7LPW4D.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- 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-4HZWCKMR.mjs +38 -0
- package/dist/lib/node-esm/chunk-4HZWCKMR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7W2LXAM5.mjs +29 -0
- package/dist/lib/node-esm/chunk-7W2LXAM5.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-NYU5JVXP.mjs +111 -0
- package/dist/lib/node-esm/chunk-NYU5JVXP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MP3A3AGA.mjs → chunk-OIRJVY2R.mjs} +21 -38
- package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +35 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-QSETDT4N.mjs +25 -0
- package/dist/lib/node-esm/create-QSETDT4N.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +364 -99
- 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-OTEYBHVI.mjs +37 -0
- package/dist/lib/node-esm/move-OTEYBHVI.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-ZLDAXADK.mjs +46 -0
- package/dist/lib/node-esm/play-ZLDAXADK.mjs.map +7 -0
- package/dist/lib/node-esm/print-UJHXAXMS.mjs +31 -0
- package/dist/lib/node-esm/print-UJHXAXMS.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.d.ts +3 -2
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- 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/Chessboard/Chessboard.stories.d.ts +48 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.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/containers/ChessArticle/ChessArticle.stories.d.ts +47 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts +2 -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 +2 -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 -3
- 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 +21 -19
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +18 -18
- 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 +74 -43
- package/src/ChessPlugin.tsx +41 -53
- package/src/blueprints/chess-blueprint.ts +35 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition.ts +98 -92
- package/src/capabilities/blueprint-definition.ts +9 -28
- package/src/capabilities/index.ts +8 -6
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/react-surface.tsx +27 -15
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +37 -0
- package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +32 -29
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +41 -24
- 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 +5 -0
- package/src/containers/ChessCard/ChessCard.stories.tsx +42 -0
- package/src/containers/ChessCard/ChessCard.tsx +22 -0
- package/src/containers/ChessCard/index.ts +5 -0
- package/src/containers/index.ts +8 -0
- package/src/index.ts +2 -3
- package/src/meta.ts +3 -3
- package/src/operations/create.ts +21 -0
- package/src/operations/definitions.ts +109 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/move.ts +36 -0
- package/src/operations/play.ts +45 -0
- package/src/operations/print.ts +28 -0
- package/src/translations.ts +21 -19
- package/src/types/Chess.ts +14 -12
- 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-FD4TL5EE.mjs +0 -11
- package/dist/lib/browser/chunk-5DOZV3PW.mjs +0 -294
- package/dist/lib/browser/chunk-5DOZV3PW.mjs.map +0 -7
- package/dist/lib/browser/chunk-DUO4WTAM.mjs +0 -28
- package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +0 -7
- package/dist/lib/browser/chunk-FBLAVAMY.mjs +0 -84
- package/dist/lib/browser/chunk-FBLAVAMY.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/chunk-TIIGNOGK.mjs +0 -169
- package/dist/lib/browser/chunk-TIIGNOGK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs +0 -25
- package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KTTAUHAA.mjs +0 -38
- package/dist/lib/browser/react-surface-KTTAUHAA.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-O7ZM3HUF.mjs +0 -12
- 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 +0 -29
- package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MP3A3AGA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RTCAAOLF.mjs +0 -170
- package/dist/lib/node-esm/chunk-RTCAAOLF.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-HK5L6P6Z.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-HK5L6P6Z.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-VO4PSY6O.mjs +0 -39
- package/dist/lib/node-esm/react-surface-VO4PSY6O.mjs.map +0 -7
- 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/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 +0 -44
- 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/intent-resolver.ts +0 -22
- 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-FD4TL5EE.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-O7ZM3HUF.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, createResolver } from '@dxos/app-framework';\n\nimport { Chess, ChessAction } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ChessAction.Create,\n resolve: ({ name, pgn }) => {\n return {\n data: {\n object: Chess.makeGame({ name, pgn }),\n },\n };\n },\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,SAASA,cAAcC,aAAaC,sBAAsB;AAI1D,IAAA,2BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,oBAAYC;EACpBC,SAAS,CAAC,EAAEC,MAAMC,IAAG,MAAE;AACrB,WAAO;MACLC,MAAM;QACJC,QAAQC,cAAMC,SAAS;UAAEL;UAAMC;QAAI,CAAA;MACrC;IACF;EACF;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "createResolver", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ChessAction", "Create", "resolve", "name", "pgn", "data", "object", "Chess", "makeGame"]
|
|
7
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
ChessboardContainer
|
|
4
|
-
} from "./chunk-VVXTAVIS.mjs";
|
|
5
|
-
import {
|
|
6
|
-
Chess_exports
|
|
7
|
-
} from "./chunk-MP3A3AGA.mjs";
|
|
8
|
-
import "./chunk-F4C2HVZL.mjs";
|
|
9
|
-
import {
|
|
10
|
-
meta
|
|
11
|
-
} from "./chunk-KNOOJFIR.mjs";
|
|
12
|
-
|
|
13
|
-
// src/capabilities/react-surface.tsx
|
|
14
|
-
import React from "react";
|
|
15
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
16
|
-
import { Obj } from "@dxos/echo";
|
|
17
|
-
var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
18
|
-
createSurface({
|
|
19
|
-
id: meta.id,
|
|
20
|
-
role: [
|
|
21
|
-
"article",
|
|
22
|
-
"section",
|
|
23
|
-
"card--intrinsic",
|
|
24
|
-
"card--extrinsic",
|
|
25
|
-
"card--popover",
|
|
26
|
-
"card--transclusion"
|
|
27
|
-
],
|
|
28
|
-
// TODO(burdon): Could this be standardized so that we don't require a subject property.
|
|
29
|
-
filter: (data) => Obj.instanceOf(Chess_exports.Game, data.subject),
|
|
30
|
-
component: ({ data, role }) => /* @__PURE__ */ React.createElement(ChessboardContainer, {
|
|
31
|
-
game: data.subject,
|
|
32
|
-
role
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
]));
|
|
36
|
-
export {
|
|
37
|
-
react_surface_default as default
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=react-surface-VO4PSY6O.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { ChessboardContainer } from '../components';\nimport { meta } from '../meta';\nimport { Chess } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: meta.id,\n role: ['article', 'section', 'card--intrinsic', 'card--extrinsic', 'card--popover', 'card--transclusion'],\n // TODO(burdon): Could this be standardized so that we don't require a subject property.\n filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),\n component: ({ data, role }) => <ChessboardContainer game={data.subject} role={role} />,\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AAMpB,IAAA,yBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAIC,KAAKD;IACTE,MAAM;MAAC;MAAW;MAAW;MAAmB;MAAmB;MAAiB;;;IAEpFC,QAAQ,CAACC,SAA0CC,IAAIC,WAAWC,cAAMC,MAAMJ,KAAKK,OAAO;IAC1FC,WAAW,CAAC,EAAEN,MAAMF,KAAI,MAAO,sBAAA,cAACS,qBAAAA;MAAoBC,MAAMR,KAAKK;MAASP;;EAC1E,CAAA;CACD;",
|
|
6
|
-
"names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Chess", "Game", "subject", "component", "ChessboardContainer", "game"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;;AAIhF,wBAaI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Card.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Card.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;IAC9D,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,IAAI;;;;;;;;CAgByB,CAAC;AAEpC,eAAe,IAAI,CAAC;AAMpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Chessboard.d.ts","sourceRoot":"","sources":["../../../../src/components/Chessboard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAOvB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,UAAU,EAIV,KAAK,eAAe,IAAI,sBAAsB,EAG/C,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,qBAAa,kBAAmB,SAAQ,UAAU;IACpC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI;gBAAlB,MAAM,EAAE,KAAK,CAAC,IAAI;CAGxC;AAMD,KAAK,SAAS,GAAG,iBAAiB,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;CAClB,CAAC,CAAC;AAkDH,KAAK,IAAI,GAAG,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEpE,KAAK,YAAY,GAAG,eAAe,CAAC,iBAAiB,CAAC;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC,CAAC;AAkBxE,KAAK,UAAU,GAAG,sBAAsB,CAAC;AA8CzC,eAAO,MAAM,UAAU;;cArHf,KAAK,CAAC,IAAI;;;;8CAuD+B,YAAY;;gBAkBvC,UAAU;;;;;;;CAiD/B,CAAC;AAEF,YAAY,EACV,SAAS,IAAI,mBAAmB,EAChC,YAAY,IAAI,sBAAsB,EACtC,UAAU,IAAI,oBAAoB,EAClC,SAAS,IAAI,mBAAmB,GACjC,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Chess } from '../types';
|
|
3
|
-
declare const meta: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: ({ game, role }: {
|
|
6
|
-
game: Chess.Game;
|
|
7
|
-
role?: string;
|
|
8
|
-
}) => import("react").JSX.Element;
|
|
9
|
-
decorators: import("@storybook/react").Decorator[];
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: string;
|
|
12
|
-
translations: [{
|
|
13
|
-
readonly 'en-US': {
|
|
14
|
-
readonly [Chess.Game.typename]: {
|
|
15
|
-
readonly 'typename label': "Game";
|
|
16
|
-
readonly 'typename label_zero': "Games";
|
|
17
|
-
readonly 'typename label_one': "Game";
|
|
18
|
-
readonly 'typename label_other': "Games";
|
|
19
|
-
readonly 'object name placeholder': "New game";
|
|
20
|
-
readonly 'rename object label': "Rename game";
|
|
21
|
-
readonly 'delete object label': "Delete game";
|
|
22
|
-
};
|
|
23
|
-
readonly [meta.id]: {
|
|
24
|
-
readonly 'plugin name': "Chess";
|
|
25
|
-
readonly 'delete game label': "Delete";
|
|
26
|
-
readonly 'game.checkmate label': "Checkmate";
|
|
27
|
-
readonly 'game.stalemate label': "Stalemate";
|
|
28
|
-
readonly 'game.draw label': "Draw";
|
|
29
|
-
readonly 'game.check label': "Check";
|
|
30
|
-
readonly 'select player button': "Select player";
|
|
31
|
-
readonly 'toggle info button': "Toggle info";
|
|
32
|
-
readonly 'close info button': "Close info";
|
|
33
|
-
readonly 'flip board button': "Flip board";
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
}];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export default meta;
|
|
40
|
-
type Story = StoryObj<typeof meta>;
|
|
41
|
-
export declare const Default: Story;
|
|
42
|
-
export declare const EndGame: Story;
|
|
43
|
-
export declare const Promption: Story;
|
|
44
|
-
//# sourceMappingURL=Chessboard.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Chessboard.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Chessboard.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMjE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,QAAA,MAAM,IAAI;;;;YAKF,CAAC;;;;;;;yBAZqB,CAAQ,KAAK,CAAC,IAAI,CAAC,QAE7C,CAAC;;;;;;;;;yBASD,CAAQ,IACZ,CAAI,EAAD,CAAC;;;;;;;;;;;;;;;CAGsC,CAAC;AAE3C,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAMvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChessboardArticle.d.ts","sourceRoot":"","sources":["../../../../src/components/ChessboardArticle.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAQ7D,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAItC,eAAO,MAAM,iBAAiB,GAAI,gBAAgB;IAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,sBAmDpF,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type Chess } from '../types';
|
|
3
|
-
export type ChessboardContainerProps = {
|
|
4
|
-
game: Chess.Game;
|
|
5
|
-
role?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const ChessboardContainer: ({ game, role }: ChessboardContainerProps) => React.JSX.Element | null;
|
|
8
|
-
export default ChessboardContainer;
|
|
9
|
-
//# sourceMappingURL=ChessboardContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChessboardContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/ChessboardContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAKtC,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,wBAAwB,6BAuB3E,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Info.d.ts","sourceRoot":"","sources":["../../../../src/components/Info.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,GAAG,EAAsD,MAAM,OAAO,CAAC;AAI5F,OAAO,EAA4B,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,KAAK,MAAM,EAAuB,MAAM,0BAA0B,CAAC;AAK5E,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG,eAAe,CACrC;IACE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,GAAG,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,CAAC,CACnD,CAAC;AAEF,eAAO,MAAM,IAAI;0EAAmF,SAAS;;CA0D5G,CAAC;AAQF,KAAK,YAAY,GAAG,eAAe,CAAC;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@dxos/functions").FunctionDefinition<{
|
|
2
|
-
readonly pgn?: string | undefined;
|
|
3
|
-
readonly fen?: string | undefined;
|
|
4
|
-
}, import("@dxos/live-object").Live<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
5
|
-
name?: string | undefined;
|
|
6
|
-
players?: {
|
|
7
|
-
white?: string | undefined;
|
|
8
|
-
black?: string | undefined;
|
|
9
|
-
} | undefined;
|
|
10
|
-
pgn?: string | undefined;
|
|
11
|
-
fen?: string | undefined;
|
|
12
|
-
}>, import("@dxos/functions").FunctionServices>;
|
|
13
|
-
export default _default;
|
|
14
|
-
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/functions/create.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,wBAoBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/functions/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../../src/functions/move.ts"],"names":[],"mappings":";;;;;;AAaA,wBA+BG"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@dxos/functions").FunctionDefinition<{
|
|
2
|
-
readonly id: string;
|
|
3
|
-
readonly side?: "white" | "black" | "any" | undefined;
|
|
4
|
-
}, {
|
|
5
|
-
readonly pgn: string;
|
|
6
|
-
readonly move?: string | undefined;
|
|
7
|
-
}, import("@dxos/functions").FunctionServices>;
|
|
8
|
-
export default _default;
|
|
9
|
-
//# sourceMappingURL=play.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"play.d.ts","sourceRoot":"","sources":["../../../../src/functions/play.ts"],"names":[],"mappings":";;;;;;;AAaA,wBAyCG"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
declare const Create_base: Schema.TaggedClass<Create, `${string}/action/create`, {
|
|
3
|
-
readonly _tag: Schema.tag<`${string}/action/create`>;
|
|
4
|
-
} & {
|
|
5
|
-
input: Schema.Struct<{
|
|
6
|
-
name: Schema.optional<typeof Schema.String>;
|
|
7
|
-
pgn: Schema.optional<typeof Schema.String>;
|
|
8
|
-
}>;
|
|
9
|
-
output: Schema.Struct<{
|
|
10
|
-
object: import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
11
|
-
name: Schema.optional<typeof Schema.String>;
|
|
12
|
-
players: Schema.optional<Schema.mutable<Schema.Struct<{
|
|
13
|
-
white: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
14
|
-
black: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
15
|
-
}>>>;
|
|
16
|
-
pgn: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
17
|
-
fen: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
18
|
-
}>>;
|
|
19
|
-
}>;
|
|
20
|
-
}>;
|
|
21
|
-
export declare class Create extends Create_base {
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=ChessAction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChessAction.d.ts","sourceRoot":"","sources":["../../../../src/types/ChessAction.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;AAMxC,qBAAa,MAAO,SAAQ,WAQ1B;CAAG"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createResolver } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
import { Chess, ChessAction } from '../types';
|
|
8
|
-
|
|
9
|
-
export default () =>
|
|
10
|
-
contributes(
|
|
11
|
-
Capabilities.IntentResolver,
|
|
12
|
-
createResolver({
|
|
13
|
-
intent: ChessAction.Create,
|
|
14
|
-
resolve: ({ name, pgn }) => {
|
|
15
|
-
return {
|
|
16
|
-
data: {
|
|
17
|
-
object: Chess.makeGame({ name, pgn }),
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
-
import { CardContainer } from '@dxos/react-ui-stack/testing';
|
|
10
|
-
|
|
11
|
-
import { meta as pluginMeta } from '../meta';
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
import { Chessboard } from './Chessboard';
|
|
15
|
-
|
|
16
|
-
type DefaultStoryProps = {
|
|
17
|
-
role: 'card--popover' | 'card--intrinsic' | 'card--extrinsic';
|
|
18
|
-
game: Chess.Game;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const meta = {
|
|
22
|
-
title: 'plugins/plugin-chess/Card',
|
|
23
|
-
render: ({ role, game }) => (
|
|
24
|
-
<CardContainer icon={pluginMeta.icon} role={role}>
|
|
25
|
-
<Chessboard.Root game={game}>
|
|
26
|
-
<Chessboard.Content role={role}>
|
|
27
|
-
<Chessboard.Board />
|
|
28
|
-
</Chessboard.Content>
|
|
29
|
-
</Chessboard.Root>
|
|
30
|
-
</CardContainer>
|
|
31
|
-
),
|
|
32
|
-
decorators: [withTheme],
|
|
33
|
-
parameters: {
|
|
34
|
-
layout: 'centered',
|
|
35
|
-
},
|
|
36
|
-
tags: ['cards'],
|
|
37
|
-
} satisfies Meta<DefaultStoryProps>;
|
|
38
|
-
|
|
39
|
-
export default meta;
|
|
40
|
-
|
|
41
|
-
const game = Chess.makeGame({
|
|
42
|
-
pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 14. d5 Qg5 15. dxe6 Qg4 16. e7 Kf7 17. bxc3 Kg6 *',
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
export const Popover: Story = {
|
|
48
|
-
args: {
|
|
49
|
-
role: 'card--popover',
|
|
50
|
-
game: game,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Intrinsic: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
role: 'card--intrinsic',
|
|
57
|
-
game: game,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Extrinsic: Story = {
|
|
62
|
-
args: {
|
|
63
|
-
role: 'card--extrinsic',
|
|
64
|
-
game: game,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
|
|
7
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
-
|
|
10
|
-
import { translations } from '../translations';
|
|
11
|
-
import { Chess } from '../types';
|
|
12
|
-
|
|
13
|
-
import { ChessboardArticle } from './ChessboardArticle';
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: 'plugins/plugin-chess/Chessboard',
|
|
17
|
-
component: ChessboardArticle,
|
|
18
|
-
decorators: [withTheme, withClientProvider({ createIdentity: true })],
|
|
19
|
-
parameters: {
|
|
20
|
-
layout: 'fullscreen',
|
|
21
|
-
translations,
|
|
22
|
-
},
|
|
23
|
-
} satisfies Meta<typeof ChessboardArticle>;
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
|
|
27
|
-
type Story = StoryObj<typeof meta>;
|
|
28
|
-
|
|
29
|
-
export const Default: Story = {
|
|
30
|
-
args: {
|
|
31
|
-
game: Chess.makeGame(),
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const EndGame: Story = {
|
|
36
|
-
args: {
|
|
37
|
-
game: Chess.makeGame({
|
|
38
|
-
pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const Promption: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
game: Chess.makeGame({
|
|
46
|
-
pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 14. d5 Qg5 15. dxe6 Qg4 16. e7 Kf7 17. bxc3 Kg6 *',
|
|
47
|
-
}),
|
|
48
|
-
},
|
|
49
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { type Player } from '@dxos/react-ui-gameboard';
|
|
9
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
import { type Chess } from '../types';
|
|
14
|
-
|
|
15
|
-
import { Chessboard, type ChessboardController, type ChessboardInfoProps } from './Chessboard';
|
|
16
|
-
|
|
17
|
-
export const ChessboardArticle = ({ game, role }: { game: Chess.Game; role?: string }) => {
|
|
18
|
-
const { t } = useTranslation(meta.id);
|
|
19
|
-
const [orientation, setOrientation] = useState<Player>('white');
|
|
20
|
-
const [open, setOpen] = useState(true);
|
|
21
|
-
const controller = useRef<ChessboardController>(null);
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Keyboard handler.
|
|
24
|
-
const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {
|
|
25
|
-
controller.current?.setMoveNumber(index);
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<StackItem.Content toolbar classNames='@container'>
|
|
30
|
-
<Chessboard.Root game={game} ref={controller}>
|
|
31
|
-
<Toolbar.Root>
|
|
32
|
-
<Toolbar.IconButton
|
|
33
|
-
icon='ph--info--regular'
|
|
34
|
-
iconOnly
|
|
35
|
-
label={t('toggle info button')}
|
|
36
|
-
disabled={open}
|
|
37
|
-
classNames={mx('invisible @3xl:visible')}
|
|
38
|
-
onClick={() => setOpen((open) => !open)}
|
|
39
|
-
/>
|
|
40
|
-
</Toolbar.Root>
|
|
41
|
-
<div
|
|
42
|
-
className={mx(
|
|
43
|
-
'grid bs-full is-full gap-2',
|
|
44
|
-
open && '@3xl:grid-cols-[1fr_320px]',
|
|
45
|
-
role === 'section' && 'aspect-square',
|
|
46
|
-
role === 'section' && open && '@3xl:aspect-auto',
|
|
47
|
-
)}
|
|
48
|
-
>
|
|
49
|
-
<Chessboard.Content>
|
|
50
|
-
<Chessboard.Board classNames='m-4 rounded-sm overflow-hidden' orientation={orientation} />
|
|
51
|
-
</Chessboard.Content>
|
|
52
|
-
{open && (
|
|
53
|
-
<div className='hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden'>
|
|
54
|
-
<Chessboard.Info
|
|
55
|
-
orientation={orientation}
|
|
56
|
-
min={8}
|
|
57
|
-
max={8}
|
|
58
|
-
onOrientationChange={setOrientation}
|
|
59
|
-
onClose={() => setOpen(false)}
|
|
60
|
-
onSelect={handleSelect}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
)}
|
|
64
|
-
</div>
|
|
65
|
-
</Chessboard.Root>
|
|
66
|
-
</StackItem.Content>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
8
|
-
|
|
9
|
-
import { type Chess } from '../types';
|
|
10
|
-
|
|
11
|
-
import { Chessboard } from './Chessboard';
|
|
12
|
-
import { ChessboardArticle } from './ChessboardArticle';
|
|
13
|
-
|
|
14
|
-
export type ChessboardContainerProps = {
|
|
15
|
-
game: Chess.Game;
|
|
16
|
-
role?: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const ChessboardContainer = ({ game, role }: ChessboardContainerProps) => {
|
|
20
|
-
const space = getSpace(game);
|
|
21
|
-
if (!space) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
switch (role) {
|
|
26
|
-
case 'card--popover':
|
|
27
|
-
case 'card--intrinsic':
|
|
28
|
-
case 'card--extrinsic': {
|
|
29
|
-
return (
|
|
30
|
-
<Chessboard.Root game={game}>
|
|
31
|
-
<Chessboard.Content role={role}>
|
|
32
|
-
<Chessboard.Board />
|
|
33
|
-
</Chessboard.Content>
|
|
34
|
-
</Chessboard.Root>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
default: {
|
|
39
|
-
return <ChessboardArticle game={game} role={role} />;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default ChessboardContainer;
|
package/src/functions/create.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
|
|
8
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
9
|
-
|
|
10
|
-
import { Chess } from '../types';
|
|
11
|
-
|
|
12
|
-
export default defineFunction({
|
|
13
|
-
key: 'dxos.org/function/chess/create',
|
|
14
|
-
name: 'Create Chess',
|
|
15
|
-
description: 'Creates a new chess game.',
|
|
16
|
-
inputSchema: Schema.Struct({
|
|
17
|
-
pgn: Schema.optional(
|
|
18
|
-
Schema.String.annotations({
|
|
19
|
-
description: 'Portable Game Notation.',
|
|
20
|
-
}),
|
|
21
|
-
),
|
|
22
|
-
fen: Schema.optional(
|
|
23
|
-
Schema.String.annotations({
|
|
24
|
-
description: 'Forsyth-Edwards Notation.',
|
|
25
|
-
}),
|
|
26
|
-
),
|
|
27
|
-
}),
|
|
28
|
-
outputSchema: Chess.Game,
|
|
29
|
-
handler: Effect.fn(function* ({ data: { pgn, fen } }) {
|
|
30
|
-
return yield* DatabaseService.add(Chess.makeGame({ pgn, fen }));
|
|
31
|
-
}),
|
|
32
|
-
});
|
package/src/functions/index.ts
DELETED
package/src/functions/move.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
|
|
9
|
-
import { ArtifactId } from '@dxos/assistant';
|
|
10
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
11
|
-
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
export default defineFunction({
|
|
15
|
-
key: 'dxos.org/function/chess/move',
|
|
16
|
-
name: 'Move',
|
|
17
|
-
description: 'Makes a move in the given chess game.',
|
|
18
|
-
inputSchema: Schema.Struct({
|
|
19
|
-
id: ArtifactId.annotations({
|
|
20
|
-
description: 'The ID of the chess object.',
|
|
21
|
-
}),
|
|
22
|
-
move: Schema.String.annotations({
|
|
23
|
-
description: 'The move to make in the chess game.',
|
|
24
|
-
examples: ['e4', 'Bf3'],
|
|
25
|
-
}),
|
|
26
|
-
}),
|
|
27
|
-
outputSchema: Schema.Struct({
|
|
28
|
-
pgn: Schema.String.annotations({
|
|
29
|
-
description: 'The PGN of the game after the move was played.',
|
|
30
|
-
}),
|
|
31
|
-
}),
|
|
32
|
-
handler: Effect.fn(function* ({ data: { id, move } }) {
|
|
33
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
34
|
-
const chess = new ChessJS();
|
|
35
|
-
if (object.pgn) {
|
|
36
|
-
chess.loadPgn(object.pgn);
|
|
37
|
-
} else if (object.fen) {
|
|
38
|
-
chess.load(object.fen);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
chess.move(move, { strict: false });
|
|
42
|
-
object.pgn = chess.pgn();
|
|
43
|
-
return { pgn: object.pgn };
|
|
44
|
-
}),
|
|
45
|
-
});
|
package/src/functions/play.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
|
|
9
|
-
import { ArtifactId } from '@dxos/assistant';
|
|
10
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
11
|
-
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
export default defineFunction({
|
|
15
|
-
key: 'dxos.org/function/chess/play',
|
|
16
|
-
name: 'Play',
|
|
17
|
-
description: 'Uses the chess engine to play the next move.',
|
|
18
|
-
inputSchema: Schema.Struct({
|
|
19
|
-
id: ArtifactId.annotations({
|
|
20
|
-
description: 'The ID of the chess object.',
|
|
21
|
-
}),
|
|
22
|
-
side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({
|
|
23
|
-
description: 'The side to play.',
|
|
24
|
-
defaultValue: 'any',
|
|
25
|
-
}),
|
|
26
|
-
}),
|
|
27
|
-
outputSchema: Schema.Struct({
|
|
28
|
-
pgn: Schema.String.annotations({
|
|
29
|
-
description: 'The PGN of the game after the move was played.',
|
|
30
|
-
}),
|
|
31
|
-
move: Schema.optional(Schema.String).annotations({
|
|
32
|
-
description: 'The move that was played.',
|
|
33
|
-
}),
|
|
34
|
-
}),
|
|
35
|
-
handler: Effect.fn(function* ({ data: { id, side = 'any' } }) {
|
|
36
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
37
|
-
const chess = new ChessJS();
|
|
38
|
-
if (object.pgn) {
|
|
39
|
-
chess.loadPgn(object.pgn);
|
|
40
|
-
} else if (object.fen) {
|
|
41
|
-
chess.load(object.fen);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))) {
|
|
45
|
-
return { move: undefined, pgn: object.pgn! };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const moves = chess.moves();
|
|
49
|
-
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
50
|
-
|
|
51
|
-
chess.move(move, { strict: false });
|
|
52
|
-
object.pgn = chess.pgn();
|
|
53
|
-
return { move, pgn: object.pgn };
|
|
54
|
-
}),
|
|
55
|
-
});
|