@dxos/plugin-chess 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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 +9 -6
- 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-GPFHUDFY.mjs +110 -0
- package/dist/lib/browser/chunk-GPFHUDFY.mjs.map +7 -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-MC7L6JNC.mjs +36 -0
- package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +21 -15
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- 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 +351 -61
- 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/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/types/index.mjs +1 -1
- package/dist/lib/node-esm/blueprints/index.mjs +9 -6
- 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-D72ZBXX6.mjs +29 -0
- package/dist/lib/node-esm/chunk-D72ZBXX6.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-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 +21 -15
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- 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 +351 -61
- 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/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/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/index.d.ts +2 -2
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -2
- 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 +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +4 -9
- 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 +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 -2
- package/dist/types/src/index.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 -20
- 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 +51 -35
- package/src/ChessPlugin.tsx +30 -15
- package/src/blueprints/chess-blueprint.ts +14 -7
- package/src/blueprints/index.ts +2 -2
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +5 -5
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/index.ts +9 -2
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/react-surface.tsx +33 -0
- package/src/cli/plugin.ts +18 -7
- package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +22 -30
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +26 -17
- 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} +9 -9
- package/src/containers/ChessArticle/ChessArticle.tsx +73 -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 -2
- package/src/meta.ts +1 -1
- 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 +21 -20
- 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 +0 -275
- package/dist/lib/browser/chunk-73BDP7UV.mjs.map +0 -7
- package/dist/lib/browser/chunk-FO4ZNFN6.mjs +0 -229
- package/dist/lib/browser/chunk-FO4ZNFN6.mjs.map +0 -7
- package/dist/lib/browser/chunk-H3NUMCQ6.mjs +0 -21
- package/dist/lib/browser/chunk-H3NUMCQ6.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 +0 -19
- 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 +0 -230
- package/dist/lib/node-esm/chunk-C7IWIXCJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F5OMIM4F.mjs +0 -23
- package/dist/lib/node-esm/chunk-F5OMIM4F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OUNGNJFP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WXEPWOHT.mjs +0 -276
- 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/blueprints/functions/create.d.ts +0 -15
- package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/index.d.ts +0 -5
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/move.d.ts +0 -8
- package/dist/types/src/blueprints/functions/move.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/play.d.ts +0 -9
- package/dist/types/src/blueprints/functions/play.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/print.d.ts +0 -8
- package/dist/types/src/blueprints/functions/print.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -9
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/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 +0 -46
- 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/blueprints/functions/create.ts +0 -38
- package/src/blueprints/functions/index.ts +0 -8
- package/src/blueprints/functions/move.ts +0 -49
- package/src/blueprints/functions/play.ts +0 -59
- package/src/blueprints/functions/print.ts +0 -42
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -23
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -27
- package/src/components/ChessboardArticle.tsx +0 -71
- package/src/components/ChessboardContainer.tsx +0 -40
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
ChessboardContainer
|
|
4
|
-
} from "./chunk-24GJHLHM.mjs";
|
|
5
|
-
import {
|
|
6
|
-
Chess_exports
|
|
7
|
-
} from "./chunk-OUNGNJFP.mjs";
|
|
8
|
-
import "./chunk-WXEPWOHT.mjs";
|
|
9
|
-
import {
|
|
10
|
-
meta
|
|
11
|
-
} from "./chunk-F5OMIM4F.mjs";
|
|
12
|
-
import "./chunk-HSLMI22Q.mjs";
|
|
13
|
-
|
|
14
|
-
// src/capabilities/react-surface/react-surface.tsx
|
|
15
|
-
import * as Effect from "effect/Effect";
|
|
16
|
-
import React from "react";
|
|
17
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
18
|
-
import { Obj } from "@dxos/echo";
|
|
19
|
-
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Common.Capability.ReactSurface, [
|
|
20
|
-
Common.createSurface({
|
|
21
|
-
id: meta.id,
|
|
22
|
-
role: [
|
|
23
|
-
"article",
|
|
24
|
-
"section",
|
|
25
|
-
"card--content"
|
|
26
|
-
],
|
|
27
|
-
// TODO(burdon): Could this be standardized so that we don't require a subject property.
|
|
28
|
-
filter: (data) => Obj.instanceOf(Chess_exports.Game, data.subject),
|
|
29
|
-
component: ({ data, role }) => /* @__PURE__ */ React.createElement(ChessboardContainer, {
|
|
30
|
-
role,
|
|
31
|
-
subject: data.subject
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
])));
|
|
35
|
-
export {
|
|
36
|
-
react_surface_default as default
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=react-surface-HSHCIOAS.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capability, Common } 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 Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: meta.id,\n role: ['article', 'section', 'card--content'],\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 role={role} subject={data.subject} />,\n }),\n ]),\n ),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAW;AAElB,SAASC,YAAYC,cAAc;AACnC,SAASC,WAAW;AAMpB,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,OAAOJ,WAAWK,cAAc;EACrDD,OAAOE,cAAc;IACnBC,IAAIC,KAAKD;IACTE,MAAM;MAAC;MAAW;MAAW;;;IAE7BC,QAAQ,CAACC,SAA0CC,IAAIC,WAAWC,cAAMC,MAAMJ,KAAKK,OAAO;IAC1FC,WAAW,CAAC,EAAEN,MAAMF,KAAI,MAAO,sBAAA,cAACS,qBAAAA;MAAoBT;MAAYO,SAASL,KAAKK;;EAChF,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "Capability", "Common", "Obj", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Chess", "Game", "subject", "component", "ChessboardContainer"]
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@dxos/functions").FunctionDefinition<{
|
|
2
|
-
readonly name?: string | undefined;
|
|
3
|
-
readonly pgn?: string | undefined;
|
|
4
|
-
readonly fen?: string | undefined;
|
|
5
|
-
}, import("@dxos/echo/Obj").Obj<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
6
|
-
readonly name?: string | undefined;
|
|
7
|
-
readonly players?: {
|
|
8
|
-
readonly white?: string | undefined;
|
|
9
|
-
readonly black?: string | undefined;
|
|
10
|
-
} | undefined;
|
|
11
|
-
readonly pgn?: string | undefined;
|
|
12
|
-
readonly fen?: string | undefined;
|
|
13
|
-
}>, import("@dxos/functions").FunctionServices>;
|
|
14
|
-
export default _default;
|
|
15
|
-
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../../src/blueprints/functions/create.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAYA,wBAyBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/blueprints/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;AACzC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../../../src/blueprints/functions/move.ts"],"names":[],"mappings":";;;;;;AAcA,wBAkCG"}
|
|
@@ -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/blueprints/functions/play.ts"],"names":[],"mappings":";;;;;;;AAcA,wBA4CG"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@dxos/functions").FunctionDefinition<{
|
|
2
|
-
readonly pgn?: string | undefined;
|
|
3
|
-
readonly fen?: string | undefined;
|
|
4
|
-
}, {
|
|
5
|
-
readonly ascii: string;
|
|
6
|
-
}, import("@dxos/functions").FunctionServices>;
|
|
7
|
-
export default _default;
|
|
8
|
-
//# sourceMappingURL=print.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../../../../src/blueprints/functions/print.ts"],"names":[],"mappings":";;;;;;AAUA,wBA+BG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-definition.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/artifact-definition/artifact-definition.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAgB,UAAU,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAM7F,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAO7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,CAAC,EAAE,uBAAuB,CAAC;KACpC;CACF;;AAED,wBAsGE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/artifact-definition/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,kBAAkB,oEAA+E,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
export type BlueprintCapabilities = [
|
|
4
|
-
Capability.Capability<typeof Common.Capability.Functions>,
|
|
5
|
-
Capability.Capability<typeof Common.Capability.BlueprintDefinition>
|
|
6
|
-
];
|
|
7
|
-
declare const blueprintDefinition: (props?: [] | undefined) => Effect.Effect<BlueprintCapabilities, Error, Capability.Service>;
|
|
8
|
-
export default blueprintDefinition;
|
|
9
|
-
//# sourceMappingURL=blueprint-definition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint-definition.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/blueprint-definition/blueprint-definition.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIzD,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;IACzD,UAAU,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC;CACpE,CAAC;AAEF,QAAA,MAAM,mBAAmB,6FAKxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/blueprint-definition/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,mBAAmB,8FAAiF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,sJAAmE,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Common.Capability.ReactSurface>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=react-surface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;;AAOzD,wBAYE"}
|
|
@@ -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,KAAkB,MAAM,OAAO,CAAC;AA2BvC,QAAA,MAAM,IAAI;;;;;;;;CAQM,CAAC;AAEjB,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Chessboard.d.ts","sourceRoot":"","sources":["../../../../src/components/Chessboard.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAmB,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAQvB,MAAM,OAAO,CAAC;AAIf,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;IAG9C,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI;gBAD3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAClB,MAAM,EAAE,KAAK,CAAC,IAAI;CAI9B;AAMD,KAAK,SAAS,GAAG,iBAAiB,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;CAClB,CAAC,CAAC;AAqDH,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;AAgDzC,eAAO,MAAM,UAAU;;cA1Hf,KAAK,CAAC,IAAI;;;;8CA0D+B,YAAY;;gBAkBvC,UAAU;;;;;;;CAmD/B,CAAC;AAEF,YAAY,EACV,SAAS,IAAI,mBAAmB,EAChC,YAAY,IAAI,sBAAsB,EACtC,UAAU,IAAI,oBAAoB,EAClC,SAAS,IAAI,mBAAmB,GACjC,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Chess } from '../types';
|
|
4
|
-
type StoryProps = {
|
|
5
|
-
pgn?: string;
|
|
6
|
-
};
|
|
7
|
-
declare const meta: {
|
|
8
|
-
title: string;
|
|
9
|
-
component: ({ pgn }: StoryProps) => React.JSX.Element;
|
|
10
|
-
decorators: import("@storybook/react").Decorator[];
|
|
11
|
-
parameters: {
|
|
12
|
-
layout: string;
|
|
13
|
-
translations: [{
|
|
14
|
-
readonly 'en-US': {
|
|
15
|
-
readonly [Chess.Game.typename]: {
|
|
16
|
-
readonly 'typename label': "Game";
|
|
17
|
-
readonly 'typename label_zero': "Games";
|
|
18
|
-
readonly 'typename label_one': "Game";
|
|
19
|
-
readonly 'typename label_other': "Games";
|
|
20
|
-
readonly 'object name placeholder': "New game";
|
|
21
|
-
readonly 'rename object label': "Rename game";
|
|
22
|
-
readonly 'delete object label': "Delete game";
|
|
23
|
-
readonly 'object deleted label': "Game deleted";
|
|
24
|
-
};
|
|
25
|
-
readonly [meta.id]: {
|
|
26
|
-
readonly 'plugin name': "Chess";
|
|
27
|
-
readonly 'delete game label': "Delete";
|
|
28
|
-
readonly 'game.checkmate label': "Checkmate";
|
|
29
|
-
readonly 'game.stalemate label': "Stalemate";
|
|
30
|
-
readonly 'game.draw label': "Draw";
|
|
31
|
-
readonly 'game.check label': "Check";
|
|
32
|
-
readonly 'select player button': "Select player";
|
|
33
|
-
readonly 'toggle info button': "Toggle info";
|
|
34
|
-
readonly 'close info button': "Close info";
|
|
35
|
-
readonly 'flip board button': "Flip board";
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
}];
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export default meta;
|
|
42
|
-
type Story = StoryObj<typeof meta>;
|
|
43
|
-
export declare const Default: Story;
|
|
44
|
-
export declare const EndGame: Story;
|
|
45
|
-
export declare const Promption: Story;
|
|
46
|
-
//# 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;AACjE,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,KAAK,UAAU,GAAG;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAOF,QAAA,MAAM,IAAI;;yBALqB,UAAU;;;;;;yBAZc,CAAQ,KAC5D,CAAC,IAAI,CAAC,QAAQ,CAAC;;;;;;;;;;yBAaN,CAAQ,IAAI,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;CAWS,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAIvB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
3
|
-
import { type Chess } from '../types';
|
|
4
|
-
export type ChessboardArticleProps = SurfaceComponentProps<Chess.Game>;
|
|
5
|
-
export declare const ChessboardArticle: ({ role, subject: game }: ChessboardArticleProps) => React.JSX.Element;
|
|
6
|
-
//# sourceMappingURL=ChessboardArticle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChessboardArticle.d.ts","sourceRoot":"","sources":["../../../../src/components/ChessboardArticle.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAOvE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAItC,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAEvE,eAAO,MAAM,iBAAiB,GAAI,yBAAyB,sBAAsB,sBAmDhF,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
3
|
-
import { type Chess } from '../types';
|
|
4
|
-
export type ChessboardContainerProps = SurfaceComponentProps<Chess.Game>;
|
|
5
|
-
export declare const ChessboardContainer: ({ role, subject: game }: ChessboardContainerProps) => React.JSX.Element | null;
|
|
6
|
-
export default ChessboardContainer;
|
|
7
|
-
//# 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;AAE1B,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAKtC,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAEzE,eAAO,MAAM,mBAAmB,GAAI,yBAAyB,wBAAwB,6BAqBpF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Info.d.ts","sourceRoot":"","sources":["../../../../src/components/Info.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,GAAG,EAAsD,MAAM,OAAO,CAAC;AAK5F,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;;CA+D5G,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,38 +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 { Database } from '@dxos/echo';
|
|
9
|
-
import { defineFunction } from '@dxos/functions';
|
|
10
|
-
|
|
11
|
-
import { Chess } from '../../types';
|
|
12
|
-
|
|
13
|
-
export default defineFunction({
|
|
14
|
-
key: 'dxos.org/function/chess/create',
|
|
15
|
-
name: 'Create Chess',
|
|
16
|
-
description: 'Creates a new chess game.',
|
|
17
|
-
inputSchema: Schema.Struct({
|
|
18
|
-
name: Schema.optional(
|
|
19
|
-
Schema.String.annotations({
|
|
20
|
-
description: 'Name of the game.',
|
|
21
|
-
}),
|
|
22
|
-
),
|
|
23
|
-
pgn: Schema.optional(
|
|
24
|
-
Schema.String.annotations({
|
|
25
|
-
description: 'Portable Game Notation.',
|
|
26
|
-
}),
|
|
27
|
-
),
|
|
28
|
-
fen: Schema.optional(
|
|
29
|
-
Schema.String.annotations({
|
|
30
|
-
description: 'Forsyth-Edwards Notation.',
|
|
31
|
-
}),
|
|
32
|
-
),
|
|
33
|
-
}),
|
|
34
|
-
outputSchema: Chess.Game,
|
|
35
|
-
handler: Effect.fn(function* ({ data: { name, pgn, fen } }) {
|
|
36
|
-
return yield* Database.Service.add(Chess.make({ name, pgn, fen }));
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
@@ -1,49 +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 { Database, Obj } from '@dxos/echo';
|
|
11
|
-
import { defineFunction } from '@dxos/functions';
|
|
12
|
-
|
|
13
|
-
import { Chess } from '../../types';
|
|
14
|
-
|
|
15
|
-
export default defineFunction({
|
|
16
|
-
key: 'dxos.org/function/chess/move',
|
|
17
|
-
name: 'Move',
|
|
18
|
-
description: 'Makes a move in the given chess game.',
|
|
19
|
-
inputSchema: Schema.Struct({
|
|
20
|
-
id: ArtifactId.annotations({
|
|
21
|
-
description: 'The ID of the chess object.',
|
|
22
|
-
}),
|
|
23
|
-
move: Schema.String.annotations({
|
|
24
|
-
description: 'The move to make in the chess game.',
|
|
25
|
-
examples: ['e4', 'Bf3'],
|
|
26
|
-
}),
|
|
27
|
-
}),
|
|
28
|
-
outputSchema: Schema.Struct({
|
|
29
|
-
pgn: Schema.String.annotations({
|
|
30
|
-
description: 'The PGN of the game after the move was played.',
|
|
31
|
-
}),
|
|
32
|
-
}),
|
|
33
|
-
handler: Effect.fn(function* ({ data: { id, move } }) {
|
|
34
|
-
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
35
|
-
const chess = new ChessJS();
|
|
36
|
-
if (object.pgn) {
|
|
37
|
-
chess.loadPgn(object.pgn);
|
|
38
|
-
} else if (object.fen) {
|
|
39
|
-
chess.load(object.fen);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
chess.move(move, { strict: false });
|
|
43
|
-
const pgn = chess.pgn();
|
|
44
|
-
Obj.change(object, (o) => {
|
|
45
|
-
o.pgn = pgn;
|
|
46
|
-
});
|
|
47
|
-
return { pgn };
|
|
48
|
-
}),
|
|
49
|
-
});
|
|
@@ -1,59 +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 { Database, Obj } from '@dxos/echo';
|
|
11
|
-
import { defineFunction } from '@dxos/functions';
|
|
12
|
-
|
|
13
|
-
import { Chess } from '../../types';
|
|
14
|
-
|
|
15
|
-
export default defineFunction({
|
|
16
|
-
key: 'dxos.org/function/chess/play',
|
|
17
|
-
name: 'Play',
|
|
18
|
-
description: 'Uses the chess engine to play the next move.',
|
|
19
|
-
inputSchema: Schema.Struct({
|
|
20
|
-
id: ArtifactId.annotations({
|
|
21
|
-
description: 'The ID of the chess object.',
|
|
22
|
-
}),
|
|
23
|
-
side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({
|
|
24
|
-
description: 'The side to play.',
|
|
25
|
-
defaultValue: 'any',
|
|
26
|
-
}),
|
|
27
|
-
}),
|
|
28
|
-
outputSchema: Schema.Struct({
|
|
29
|
-
pgn: Schema.String.annotations({
|
|
30
|
-
description: 'The PGN of the game after the move was played.',
|
|
31
|
-
}),
|
|
32
|
-
move: Schema.optional(Schema.String).annotations({
|
|
33
|
-
description: 'The move that was played.',
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
handler: Effect.fn(function* ({ data: { id, side = 'any' } }) {
|
|
37
|
-
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
38
|
-
const chess = new ChessJS();
|
|
39
|
-
if (object.pgn) {
|
|
40
|
-
chess.loadPgn(object.pgn);
|
|
41
|
-
} else if (object.fen) {
|
|
42
|
-
chess.load(object.fen);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))) {
|
|
46
|
-
return { move: undefined, pgn: object.pgn! };
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const moves = chess.moves();
|
|
50
|
-
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
51
|
-
|
|
52
|
-
chess.move(move, { strict: false });
|
|
53
|
-
const pgn = chess.pgn();
|
|
54
|
-
Obj.change(object, (o) => {
|
|
55
|
-
o.pgn = pgn;
|
|
56
|
-
});
|
|
57
|
-
return { move, pgn };
|
|
58
|
-
}),
|
|
59
|
-
});
|
|
@@ -1,42 +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 { defineFunction } from '@dxos/functions';
|
|
10
|
-
|
|
11
|
-
export default defineFunction({
|
|
12
|
-
key: 'dxos.org/function/chess/print',
|
|
13
|
-
name: 'Print game',
|
|
14
|
-
description: 'Prints the chess game to ASCII.',
|
|
15
|
-
inputSchema: Schema.Struct({
|
|
16
|
-
pgn: Schema.optional(
|
|
17
|
-
Schema.String.annotations({
|
|
18
|
-
description: 'Portable Game Notation.',
|
|
19
|
-
}),
|
|
20
|
-
),
|
|
21
|
-
fen: Schema.optional(
|
|
22
|
-
Schema.String.annotations({
|
|
23
|
-
description: 'Forsyth-Edwards Notation.',
|
|
24
|
-
}),
|
|
25
|
-
),
|
|
26
|
-
}),
|
|
27
|
-
outputSchema: Schema.Struct({
|
|
28
|
-
ascii: Schema.String,
|
|
29
|
-
}),
|
|
30
|
-
handler: Effect.fn(function* ({ data: { pgn, fen } }) {
|
|
31
|
-
try {
|
|
32
|
-
const chess = new ChessJS(fen);
|
|
33
|
-
if (pgn) {
|
|
34
|
-
chess.loadPgn(pgn);
|
|
35
|
-
}
|
|
36
|
-
return { ascii: chess.ascii() };
|
|
37
|
-
} catch {
|
|
38
|
-
// TODO(burdon): Error handling?
|
|
39
|
-
return { ascii: '' };
|
|
40
|
-
}
|
|
41
|
-
}),
|
|
42
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
|
|
9
|
-
import { ChessBlueprint } from '../../blueprints';
|
|
10
|
-
|
|
11
|
-
export type BlueprintCapabilities = [
|
|
12
|
-
Capability.Capability<typeof Common.Capability.Functions>,
|
|
13
|
-
Capability.Capability<typeof Common.Capability.BlueprintDefinition>,
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
17
|
-
Effect.succeed([
|
|
18
|
-
Capability.contributes(Common.Capability.Functions, ChessBlueprint.functions),
|
|
19
|
-
Capability.contributes(Common.Capability.BlueprintDefinition, ChessBlueprint.make()),
|
|
20
|
-
]),
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export default blueprintDefinition;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
-
import { Obj } from '@dxos/echo';
|
|
10
|
-
|
|
11
|
-
import { ChessboardContainer } from '../../components';
|
|
12
|
-
import { meta } from '../../meta';
|
|
13
|
-
import { Chess } from '../../types';
|
|
14
|
-
|
|
15
|
-
export default Capability.makeModule(() =>
|
|
16
|
-
Effect.succeed(
|
|
17
|
-
Capability.contributes(Common.Capability.ReactSurface, [
|
|
18
|
-
Common.createSurface({
|
|
19
|
-
id: meta.id,
|
|
20
|
-
role: ['article', 'section', 'card--content'],
|
|
21
|
-
// TODO(burdon): Could this be standardized so that we don't require a subject property.
|
|
22
|
-
filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),
|
|
23
|
-
component: ({ data, role }) => <ChessboardContainer role={role} subject={data.subject} />,
|
|
24
|
-
}),
|
|
25
|
-
]),
|
|
26
|
-
),
|
|
27
|
-
);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { type Player } from '@dxos/react-ui-gameboard';
|
|
10
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
11
|
-
import { mx } from '@dxos/ui-theme';
|
|
12
|
-
|
|
13
|
-
import { meta } from '../meta';
|
|
14
|
-
import { type Chess } from '../types';
|
|
15
|
-
|
|
16
|
-
import { Chessboard, type ChessboardController, type ChessboardInfoProps } from './Chessboard';
|
|
17
|
-
|
|
18
|
-
export type ChessboardArticleProps = SurfaceComponentProps<Chess.Game>;
|
|
19
|
-
|
|
20
|
-
export const ChessboardArticle = ({ role, subject: game }: ChessboardArticleProps) => {
|
|
21
|
-
const { t } = useTranslation(meta.id);
|
|
22
|
-
const [orientation, setOrientation] = useState<Player>('white');
|
|
23
|
-
const [open, setOpen] = useState(true);
|
|
24
|
-
const controller = useRef<ChessboardController>(null);
|
|
25
|
-
|
|
26
|
-
// TODO(burdon): Keyboard handler.
|
|
27
|
-
const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {
|
|
28
|
-
controller.current?.setMoveNumber(index);
|
|
29
|
-
}, []);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Layout.Main toolbar classNames='@container'>
|
|
33
|
-
<Chessboard.Root game={game} ref={controller}>
|
|
34
|
-
<Toolbar.Root>
|
|
35
|
-
<Toolbar.IconButton
|
|
36
|
-
icon='ph--info--regular'
|
|
37
|
-
iconOnly
|
|
38
|
-
label={t('toggle info button')}
|
|
39
|
-
disabled={open}
|
|
40
|
-
classNames={mx('invisible @3xl:visible')}
|
|
41
|
-
onClick={() => setOpen((open) => !open)}
|
|
42
|
-
/>
|
|
43
|
-
</Toolbar.Root>
|
|
44
|
-
<div
|
|
45
|
-
className={mx(
|
|
46
|
-
'grid bs-full is-full gap-2',
|
|
47
|
-
open && '@3xl:grid-cols-[1fr_320px]',
|
|
48
|
-
role === 'section' && 'aspect-square',
|
|
49
|
-
role === 'section' && open && '@3xl:aspect-auto',
|
|
50
|
-
)}
|
|
51
|
-
>
|
|
52
|
-
<Chessboard.Content>
|
|
53
|
-
<Chessboard.Board classNames='m-4 rounded-sm overflow-hidden' orientation={orientation} />
|
|
54
|
-
</Chessboard.Content>
|
|
55
|
-
{open && (
|
|
56
|
-
<div className='hidden @3xl:flex flex-col p-8 justify-center items-center overflow-hidden'>
|
|
57
|
-
<Chessboard.Info
|
|
58
|
-
orientation={orientation}
|
|
59
|
-
min={8}
|
|
60
|
-
max={8}
|
|
61
|
-
onOrientationChange={setOrientation}
|
|
62
|
-
onClose={() => setOpen(false)}
|
|
63
|
-
onSelect={handleSelect}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
)}
|
|
67
|
-
</div>
|
|
68
|
-
</Chessboard.Root>
|
|
69
|
-
</Layout.Main>
|
|
70
|
-
);
|
|
71
|
-
};
|