@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
|
@@ -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
|
+
}
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
Chess_exports
|
|
4
|
-
} from "../chunk-OUNGNJFP.mjs";
|
|
5
|
-
import {
|
|
6
|
-
meta
|
|
7
|
-
} from "../chunk-F5OMIM4F.mjs";
|
|
8
2
|
import "../chunk-HSLMI22Q.mjs";
|
|
9
3
|
|
|
10
4
|
// src/cli/plugin.ts
|
|
11
5
|
import * as Effect from "effect/Effect";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
6
|
+
import { Plugin } from "@dxos/app-framework";
|
|
7
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
8
|
+
import { Operation } from "@dxos/operation";
|
|
9
|
+
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
10
|
+
import { meta } from "#meta";
|
|
11
|
+
import { Chess } from "#types";
|
|
12
|
+
var ChessPlugin = Plugin.define(meta).pipe(AppPlugin.addMetadataModule({
|
|
18
13
|
metadata: {
|
|
19
|
-
id:
|
|
14
|
+
id: Chess.Game.typename,
|
|
20
15
|
metadata: {
|
|
21
|
-
createObject: (props) => Effect.
|
|
22
|
-
|
|
16
|
+
createObject: (props, options) => Effect.gen(function* () {
|
|
17
|
+
const object = Chess.make(props);
|
|
18
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
19
|
+
object,
|
|
20
|
+
target: options.target,
|
|
21
|
+
hidden: true,
|
|
22
|
+
targetNodeId: options.targetNodeId
|
|
23
|
+
});
|
|
24
|
+
})
|
|
23
25
|
}
|
|
24
26
|
}
|
|
27
|
+
}), AppPlugin.addSchemaModule({
|
|
28
|
+
schema: [
|
|
29
|
+
Chess.Game
|
|
30
|
+
]
|
|
25
31
|
}), Plugin.make);
|
|
26
32
|
export {
|
|
27
33
|
ChessPlugin
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/plugin.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Effect", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/operation';\nimport { type CreateObject } from '@dxos/plugin-space/types';\nimport { SpaceOperation } from '@dxos/plugin-space/operations';\n\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\n// TODO(wittjosiah): Factor out shared modules.\nexport const ChessPlugin = Plugin.define(meta).pipe(\n AppPlugin.addMetadataModule({\n metadata: {\n id: Chess.Game.typename,\n metadata: {\n createObject: ((props, options) =>\n Effect.gen(function* () {\n const object = Chess.make(props);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n })) satisfies CreateObject,\n },\n },\n }),\n AppPlugin.addSchemaModule({ schema: [Chess.Game] }),\n Plugin.make,\n);\n"],
|
|
5
|
+
"mappings": ";;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAE1B,SAASC,sBAAsB;AAE/B,SAASC,YAAY;AACrB,SAASC,aAAa;AAGf,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CC,UAAUC,kBAAkB;EAC1BC,UAAU;IACRC,IAAIC,MAAMC,KAAKC;IACfJ,UAAU;MACRK,cAAe,CAACC,OAAOC,YACdC,WAAI,aAAA;AACT,cAAMC,SAASP,MAAMQ,KAAKJ,KAAAA;AAC1B,eAAO,OAAOK,UAAUC,OAAOC,eAAeC,WAAW;UACvDL;UACAM,QAAQR,QAAQQ;UAChBC,QAAQ;UACRC,cAAcV,QAAQU;QACxB,CAAA;MACF,CAAA;IACJ;EACF;AACF,CAAA,GACAnB,UAAUoB,gBAAgB;EAAEC,QAAQ;IAACjB,MAAMC;;AAAM,CAAA,GACjDT,OAAOgB,IAAI;",
|
|
6
|
+
"names": ["Effect", "Plugin", "AppPlugin", "Operation", "SpaceOperation", "meta", "Chess", "ChessPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addMetadataModule", "metadata", "id", "Chess", "Game", "typename", "createObject", "props", "options", "gen", "object", "make", "Operation", "invoke", "SpaceOperation", "AddObject", "target", "hidden", "targetNodeId", "addSchemaModule", "schema"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Create
|
|
4
|
+
} from "./chunk-LPVPGURE.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Chess_exports
|
|
7
|
+
} from "./chunk-OIRJVY2R.mjs";
|
|
8
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
9
|
+
|
|
10
|
+
// src/operations/create.ts
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import { Database } from "@dxos/echo";
|
|
13
|
+
import { Operation } from "@dxos/operation";
|
|
14
|
+
var handler = Create.pipe(Operation.withHandler(Effect.fn(function* ({ name, pgn, fen }) {
|
|
15
|
+
return yield* Database.add(Chess_exports.make({
|
|
16
|
+
name,
|
|
17
|
+
pgn,
|
|
18
|
+
fen
|
|
19
|
+
}));
|
|
20
|
+
})));
|
|
21
|
+
var create_default = handler;
|
|
22
|
+
export {
|
|
23
|
+
create_default as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=create-KINGWZOM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/create.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Database } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\n\nimport { Chess } from '../types';\n\nimport { Create } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Create> = Create.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ name, pgn, fen }) {\n return yield* Database.add(Chess.make({ name, pgn, fen }));\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAM1B,IAAMC,UAAgDC,OAAOC,KAC3DC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,KAAKC,IAAG,GAAE;AACrC,SAAO,OAAOC,SAASC,IAAIC,cAAMC,KAAK;IAAEN;IAAMC;IAAKC;EAAI,CAAA,CAAA;AACzD,CAAA,CAAA,CAAA;AAIJ,IAAA,iBAAeR;",
|
|
6
|
+
"names": ["Effect", "Database", "Operation", "handler", "Create", "pipe", "Operation", "withHandler", "fn", "name", "pgn", "fen", "Database", "add", "Chess", "make"]
|
|
7
|
+
}
|
|
@@ -1,100 +1,390 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-C7IWIXCJ.mjs";
|
|
3
|
+
chess_blueprint_default
|
|
4
|
+
} from "./chunk-4HZWCKMR.mjs";
|
|
6
5
|
import {
|
|
7
|
-
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
operations_exports
|
|
7
|
+
} from "./chunk-D72ZBXX6.mjs";
|
|
8
|
+
import "./chunk-LPVPGURE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
Chess_exports
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
Chessboard,
|
|
14
|
-
ExtendedChessModel
|
|
15
|
-
} from "./chunk-WXEPWOHT.mjs";
|
|
16
|
-
import {
|
|
17
|
-
meta
|
|
18
|
-
} from "./chunk-F5OMIM4F.mjs";
|
|
11
|
+
} from "./chunk-OIRJVY2R.mjs";
|
|
19
12
|
import "./chunk-HSLMI22Q.mjs";
|
|
20
13
|
|
|
21
|
-
// src/
|
|
22
|
-
import {
|
|
23
|
-
|
|
14
|
+
// src/components/Chessboard/Chessboard.tsx
|
|
15
|
+
import { RegistryContext } from "@effect-atom/atom-react";
|
|
16
|
+
import React2, { forwardRef, useCallback, useContext, useEffect as useEffect2, useImperativeHandle, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
17
|
+
import { addEventListener } from "@dxos/async";
|
|
18
|
+
import { useObject } from "@dxos/echo-react";
|
|
19
|
+
import { Gameboard, Chessboard as NaturalChessboard, getRawPgn, useGameboardContext as useGameboardContext2 } from "@dxos/react-ui-gameboard";
|
|
20
|
+
import { useSoundEffect } from "@dxos/react-ui-sfx";
|
|
21
|
+
|
|
22
|
+
// src/components/Chessboard/Info.tsx
|
|
23
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
24
|
+
import React, { useEffect, useMemo, useRef } from "react";
|
|
25
|
+
import { generateName } from "@dxos/display-name";
|
|
26
|
+
import { Obj } from "@dxos/echo";
|
|
27
|
+
import { useMembers } from "@dxos/react-client/echo";
|
|
28
|
+
import { Icon, IconButton, Select, useTranslation } from "@dxos/react-ui";
|
|
29
|
+
import { useGameboardContext } from "@dxos/react-ui-gameboard";
|
|
30
|
+
import { mx } from "@dxos/ui-theme";
|
|
31
|
+
import { meta } from "#meta";
|
|
32
|
+
var INFO_NAME = "Chessboard.Info";
|
|
33
|
+
var Info = ({ classNames, orientation = "white", onOrientationChange, onClose, ...props }) => {
|
|
34
|
+
const { t } = useTranslation(meta.id);
|
|
35
|
+
const { model } = useGameboardContext(INFO_NAME);
|
|
36
|
+
const db = Obj.getDatabase(model.object);
|
|
37
|
+
const members = useMembers(db?.spaceId);
|
|
38
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
39
|
+
className: mx("grid grid-rows-[min-content_1fr_min-content] w-full min-w-[18rem] p-2 overflow-hidden bg-group-surface rounded-xs", classNames)
|
|
40
|
+
}, /* @__PURE__ */ React.createElement(PlayerIndicator, {
|
|
41
|
+
model,
|
|
42
|
+
player: orientation === "white" ? "black" : "white",
|
|
43
|
+
icon: onClose && /* @__PURE__ */ React.createElement(IconButton, {
|
|
44
|
+
variant: "ghost",
|
|
45
|
+
icon: "ph--x--regular",
|
|
46
|
+
iconOnly: true,
|
|
47
|
+
label: t("close-info.button"),
|
|
48
|
+
size: 4,
|
|
49
|
+
onClick: onClose
|
|
50
|
+
})
|
|
51
|
+
}, /* @__PURE__ */ React.createElement(PlayerSelector, {
|
|
52
|
+
value: model.object.players?.[orientation === "white" ? "black" : "white"],
|
|
53
|
+
onValueChange: (value) => {
|
|
54
|
+
Obj.change(model.object, (obj) => {
|
|
55
|
+
obj.players[orientation === "white" ? "black" : "white"] = value;
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
members
|
|
59
|
+
})), /* @__PURE__ */ React.createElement(History, {
|
|
60
|
+
model,
|
|
61
|
+
...props
|
|
62
|
+
}), /* @__PURE__ */ React.createElement(PlayerIndicator, {
|
|
63
|
+
model,
|
|
64
|
+
player: orientation,
|
|
65
|
+
icon: onOrientationChange && /* @__PURE__ */ React.createElement(IconButton, {
|
|
66
|
+
classNames: mx("transition duration-200 ease-linear", orientation === "white" && "rotate-180"),
|
|
67
|
+
icon: "ph--arrows-clockwise--regular",
|
|
68
|
+
iconOnly: true,
|
|
69
|
+
label: t("flip-board.button"),
|
|
70
|
+
size: 4,
|
|
71
|
+
onClick: () => onOrientationChange(orientation === "white" ? "black" : "white")
|
|
72
|
+
})
|
|
73
|
+
}, /* @__PURE__ */ React.createElement(PlayerSelector, {
|
|
74
|
+
value: model.object.players?.[orientation],
|
|
75
|
+
onValueChange: (value) => {
|
|
76
|
+
Obj.change(model.object, (obj) => {
|
|
77
|
+
obj.players[orientation] = value;
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
members
|
|
81
|
+
})));
|
|
82
|
+
};
|
|
83
|
+
Info.displayName = INFO_NAME;
|
|
84
|
+
var History = ({ classNames, model, min, max, onSelect }) => {
|
|
85
|
+
const { t } = useTranslation(meta.id);
|
|
86
|
+
const moveIndex = useAtomValue(model.moveIndex);
|
|
87
|
+
const label = model.game.isGameOver() ? model.game.isCheckmate() ? t("game.checkmate.label") : model.game.isStalemate() ? t("game.stalemate.label") : t("game.draw.label") : model.game.isCheck() ? t("game.check.label") : void 0;
|
|
88
|
+
const history = model.game.history();
|
|
89
|
+
const moves = useMemo(() => history.reduce((acc, move, index) => {
|
|
90
|
+
if (index % 2 === 0) {
|
|
91
|
+
acc.push([
|
|
92
|
+
{
|
|
93
|
+
index,
|
|
94
|
+
move
|
|
95
|
+
}
|
|
96
|
+
]);
|
|
97
|
+
} else {
|
|
98
|
+
acc[acc.length - 1].push({
|
|
99
|
+
index,
|
|
100
|
+
move
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return acc;
|
|
104
|
+
}, []), [
|
|
105
|
+
history.length
|
|
106
|
+
]);
|
|
107
|
+
const scrollerRef = useRef(null);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
scrollerRef.current?.scrollTo({
|
|
110
|
+
top: scrollerRef.current.scrollHeight
|
|
111
|
+
});
|
|
112
|
+
}, [
|
|
113
|
+
history.length
|
|
114
|
+
]);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const div = scrollerRef.current?.querySelector(`[data-index="${moveIndex - 1}"]`);
|
|
117
|
+
scrollerRef.current?.classList.add("scrollbar-none");
|
|
118
|
+
div?.scrollIntoView({
|
|
119
|
+
behavior: "smooth"
|
|
120
|
+
});
|
|
121
|
+
scrollerRef.current?.classList.remove("scrollbar-none");
|
|
122
|
+
}, [
|
|
123
|
+
moveIndex
|
|
124
|
+
]);
|
|
125
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
126
|
+
ref: scrollerRef,
|
|
127
|
+
className: mx("overflow-y-auto", classNames),
|
|
128
|
+
style: {
|
|
129
|
+
minHeight: min === void 0 ? "auto" : `${min * 24}px`,
|
|
130
|
+
maxHeight: max === void 0 ? "auto" : `${max * 24}px`
|
|
131
|
+
}
|
|
132
|
+
}, moves.map(([a, b], index) => /* @__PURE__ */ React.createElement("div", {
|
|
133
|
+
key: index,
|
|
134
|
+
className: "grid grid-cols-[3rem_1fr_1fr_1rem] gap-2 ps-4"
|
|
135
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
136
|
+
className: "content-center text-xs text-subdued"
|
|
137
|
+
}, index + 1), a && /* @__PURE__ */ React.createElement("div", {
|
|
138
|
+
"data-index": a.index,
|
|
139
|
+
className: mx("ps-2 text-sm cursor-pointer", a.index === moveIndex - 1 && "bg-primary-500"),
|
|
140
|
+
onClick: () => onSelect?.(a.index + 1)
|
|
141
|
+
}, a.move), b && /* @__PURE__ */ React.createElement("div", {
|
|
142
|
+
"data-index": b.index,
|
|
143
|
+
className: mx("ps-2 text-sm cursor-pointer", b.index === moveIndex - 1 && "bg-primary-500"),
|
|
144
|
+
onClick: () => onSelect?.(b.index + 1)
|
|
145
|
+
}, b.move))), label && /* @__PURE__ */ React.createElement("div", {
|
|
146
|
+
className: "text-center"
|
|
147
|
+
}, label));
|
|
148
|
+
};
|
|
149
|
+
var PlayerIndicator = ({ children, model, player, icon }) => {
|
|
150
|
+
const turn = player === (model.game.turn() === "w" ? "white" : "black");
|
|
151
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
152
|
+
className: "grid grid-cols-[2rem_1fr_2rem] gap-2 h-(--dx-rail-size) px-1 flex items-center overflow-hidden"
|
|
153
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
154
|
+
className: "place-items-center"
|
|
155
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
156
|
+
icon: turn ? "ph--circle--fill" : "ph--circle--thin",
|
|
157
|
+
size: 6,
|
|
158
|
+
classNames: mx(turn && (model.game.isCheckmate() ? "text-error-500" : "text-success-text"))
|
|
159
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
160
|
+
className: "truncate overflow-hidden items-center"
|
|
161
|
+
}, children), icon);
|
|
162
|
+
};
|
|
163
|
+
var PlayerSelector = ({ value, onValueChange, members }) => {
|
|
164
|
+
const { t } = useTranslation(meta.id);
|
|
165
|
+
return /* @__PURE__ */ React.createElement(Select.Root, {
|
|
166
|
+
value,
|
|
167
|
+
onValueChange
|
|
168
|
+
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
169
|
+
placeholder: t("select-player.button")
|
|
170
|
+
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, members.map((member) => {
|
|
171
|
+
const memberKey = member.identity.identityKey.toHex();
|
|
172
|
+
const displayName = member.identity?.profile?.displayName || generateName(memberKey);
|
|
173
|
+
return /* @__PURE__ */ React.createElement(Select.Option, {
|
|
174
|
+
key: memberKey,
|
|
175
|
+
value: memberKey
|
|
176
|
+
}, displayName);
|
|
177
|
+
})), /* @__PURE__ */ React.createElement(Select.Arrow, null))));
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/components/Chessboard/types.ts
|
|
181
|
+
import { ChessModel } from "@dxos/react-ui-gameboard";
|
|
182
|
+
var ExtendedChessModel = class extends ChessModel {
|
|
183
|
+
object;
|
|
184
|
+
constructor(registry, object) {
|
|
185
|
+
super(registry), this.object = object;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// src/components/Chessboard/Chessboard.tsx
|
|
190
|
+
var Root = /* @__PURE__ */ forwardRef(({ game, children }, forwardedRef) => {
|
|
191
|
+
const registry = useContext(RegistryContext);
|
|
192
|
+
const model = useMemo2(() => new ExtendedChessModel(registry, game), [
|
|
193
|
+
registry
|
|
194
|
+
]);
|
|
195
|
+
const click = useSoundEffect("Click");
|
|
196
|
+
const [pgn, updatePgn] = useObject(game, "pgn");
|
|
197
|
+
useImperativeHandle(forwardedRef, () => {
|
|
198
|
+
return {
|
|
199
|
+
setMoveNumber: (index) => model.setMoveIndex(index)
|
|
200
|
+
};
|
|
201
|
+
}, [
|
|
202
|
+
model
|
|
203
|
+
]);
|
|
204
|
+
useEffect2(() => {
|
|
205
|
+
if (model.pgn !== getRawPgn(pgn ?? "")) {
|
|
206
|
+
const silent = model.pgn === "*";
|
|
207
|
+
model.update(pgn);
|
|
208
|
+
if (!silent) {
|
|
209
|
+
void click.play();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}, [
|
|
213
|
+
pgn
|
|
214
|
+
]);
|
|
215
|
+
const handleDrop = useCallback((move) => {
|
|
216
|
+
if (!model.makeMove(move)) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
void click.play();
|
|
220
|
+
updatePgn(() => model.pgn);
|
|
221
|
+
return true;
|
|
222
|
+
}, [
|
|
223
|
+
model
|
|
224
|
+
]);
|
|
225
|
+
return /* @__PURE__ */ React2.createElement(Gameboard.Root, {
|
|
226
|
+
model,
|
|
227
|
+
onDrop: handleDrop
|
|
228
|
+
}, children);
|
|
229
|
+
});
|
|
230
|
+
var Content = ({ classNames, children }) => {
|
|
231
|
+
return /* @__PURE__ */ React2.createElement(Gameboard.Content, {
|
|
232
|
+
grow: true,
|
|
233
|
+
contain: true,
|
|
234
|
+
classNames
|
|
235
|
+
}, children);
|
|
236
|
+
};
|
|
237
|
+
var BOARD_NAME = "Chessboard.Board";
|
|
238
|
+
var Board = (props) => {
|
|
239
|
+
const registry = useContext(RegistryContext);
|
|
240
|
+
const { model } = useGameboardContext2(BOARD_NAME);
|
|
241
|
+
const ref = useRef2(null);
|
|
242
|
+
useEffect2(() => {
|
|
243
|
+
if (!ref.current) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
ref.current.setAttribute("data-arrow-keys", "all");
|
|
247
|
+
return addEventListener(ref.current, "keydown", (ev) => {
|
|
248
|
+
const moveIndex = registry.get(model.moveIndex);
|
|
249
|
+
switch (ev.key) {
|
|
250
|
+
case "ArrowUp":
|
|
251
|
+
model.setMoveIndex(0);
|
|
252
|
+
break;
|
|
253
|
+
case "ArrowDown":
|
|
254
|
+
model.setMoveIndex(model.game.history().length);
|
|
255
|
+
break;
|
|
256
|
+
case "ArrowLeft":
|
|
257
|
+
if (moveIndex > 0) {
|
|
258
|
+
model.setMoveIndex(moveIndex - 1);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
case "ArrowRight":
|
|
262
|
+
if (moveIndex < model.game.history().length) {
|
|
263
|
+
model.setMoveIndex(moveIndex + 1);
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}, [
|
|
269
|
+
registry,
|
|
270
|
+
model
|
|
271
|
+
]);
|
|
272
|
+
return /* @__PURE__ */ React2.createElement(NaturalChessboard, {
|
|
273
|
+
...props,
|
|
274
|
+
ref
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
Board.displayName = BOARD_NAME;
|
|
278
|
+
var Chessboard = {
|
|
279
|
+
Root,
|
|
280
|
+
Content,
|
|
281
|
+
Board,
|
|
282
|
+
Info
|
|
283
|
+
};
|
|
24
284
|
|
|
25
|
-
// src/
|
|
26
|
-
import {
|
|
27
|
-
var
|
|
285
|
+
// src/meta.ts
|
|
286
|
+
import { trim } from "@dxos/util";
|
|
287
|
+
var meta2 = {
|
|
288
|
+
id: "org.dxos.plugin.chess",
|
|
289
|
+
name: "Chess",
|
|
290
|
+
description: trim`
|
|
291
|
+
Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.
|
|
292
|
+
Track game history and analyze moves in real-time.
|
|
293
|
+
`,
|
|
294
|
+
icon: "ph--shield-chevron--regular",
|
|
295
|
+
iconHue: "amber",
|
|
296
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess",
|
|
297
|
+
screenshots: [
|
|
298
|
+
"https://dxos.network/plugin-details-chess-dark.png"
|
|
299
|
+
]
|
|
300
|
+
};
|
|
28
301
|
|
|
29
302
|
// src/ChessPlugin.tsx
|
|
30
303
|
import * as Effect from "effect/Effect";
|
|
31
|
-
import
|
|
304
|
+
import * as Option from "effect/Option";
|
|
305
|
+
import { Plugin } from "@dxos/app-framework";
|
|
306
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
307
|
+
import { Annotation } from "@dxos/echo";
|
|
308
|
+
import { Operation } from "@dxos/operation";
|
|
309
|
+
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
310
|
+
import { ChessBlueprint } from "#blueprints";
|
|
311
|
+
import { meta as meta4 } from "#meta";
|
|
32
312
|
|
|
33
313
|
// src/translations.ts
|
|
314
|
+
import { meta as meta3 } from "#meta";
|
|
315
|
+
import { Chess } from "#types";
|
|
34
316
|
var translations = [
|
|
35
317
|
{
|
|
36
318
|
"en-US": {
|
|
37
|
-
[
|
|
38
|
-
"typename
|
|
39
|
-
"typename
|
|
40
|
-
"typename
|
|
41
|
-
"typename
|
|
42
|
-
"object
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"object
|
|
319
|
+
[Chess.Game.typename]: {
|
|
320
|
+
"typename.label": "Game",
|
|
321
|
+
"typename.label_zero": "Games",
|
|
322
|
+
"typename.label_one": "Game",
|
|
323
|
+
"typename.label_other": "Games",
|
|
324
|
+
"object-name.placeholder": "New game",
|
|
325
|
+
"add-object.label": "Add game",
|
|
326
|
+
"rename-object.label": "Rename game",
|
|
327
|
+
"delete-object.label": "Delete game",
|
|
328
|
+
"object-deleted.label": "Game deleted"
|
|
46
329
|
},
|
|
47
|
-
[
|
|
48
|
-
"plugin
|
|
49
|
-
"delete
|
|
50
|
-
"game.checkmate
|
|
51
|
-
"game.stalemate
|
|
52
|
-
"game.draw
|
|
53
|
-
"game.check
|
|
54
|
-
"select
|
|
55
|
-
"toggle
|
|
56
|
-
"close
|
|
57
|
-
"flip
|
|
330
|
+
[meta3.id]: {
|
|
331
|
+
"plugin.name": "Chess",
|
|
332
|
+
"delete-game.label": "Delete",
|
|
333
|
+
"game.checkmate.label": "Checkmate",
|
|
334
|
+
"game.stalemate.label": "Stalemate",
|
|
335
|
+
"game.draw.label": "Draw",
|
|
336
|
+
"game.check.label": "Check",
|
|
337
|
+
"select-player.button": "Select player",
|
|
338
|
+
"toggle-info.button": "Toggle info",
|
|
339
|
+
"close-info.button": "Close info",
|
|
340
|
+
"flip-board.button": "Flip board"
|
|
58
341
|
}
|
|
59
342
|
}
|
|
60
343
|
}
|
|
61
344
|
];
|
|
62
345
|
|
|
63
346
|
// src/ChessPlugin.tsx
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
347
|
+
import { Chess as Chess2 } from "#types";
|
|
348
|
+
import { BlueprintDefinition, OperationHandler, ReactSurface } from "#capabilities";
|
|
349
|
+
var ChessPlugin = Plugin.define(meta4).pipe(AppPlugin.addBlueprintDefinitionModule({
|
|
350
|
+
activate: BlueprintDefinition
|
|
351
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
352
|
+
activate: OperationHandler
|
|
353
|
+
}), AppPlugin.addMetadataModule({
|
|
67
354
|
metadata: {
|
|
68
|
-
id:
|
|
355
|
+
id: Chess2.Game.typename,
|
|
69
356
|
metadata: {
|
|
70
|
-
icon:
|
|
71
|
-
iconHue: "
|
|
357
|
+
icon: Annotation.IconAnnotation.get(Chess2.Game).pipe(Option.getOrThrow).icon,
|
|
358
|
+
iconHue: Annotation.IconAnnotation.get(Chess2.Game).pipe(Option.getOrThrow).hue ?? "white",
|
|
72
359
|
blueprints: [
|
|
73
|
-
|
|
360
|
+
ChessBlueprint.key
|
|
74
361
|
],
|
|
75
|
-
createObject: (props) => Effect.
|
|
76
|
-
|
|
362
|
+
createObject: (props, options) => Effect.gen(function* () {
|
|
363
|
+
const object = Chess2.make(props);
|
|
364
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
365
|
+
object,
|
|
366
|
+
target: options.target,
|
|
367
|
+
hidden: true,
|
|
368
|
+
targetNodeId: options.targetNodeId
|
|
369
|
+
});
|
|
370
|
+
})
|
|
77
371
|
}
|
|
78
372
|
}
|
|
79
|
-
}),
|
|
373
|
+
}), AppPlugin.addSchemaModule({
|
|
80
374
|
schema: [
|
|
81
|
-
|
|
375
|
+
Chess2.Game
|
|
82
376
|
]
|
|
83
|
-
}),
|
|
377
|
+
}), AppPlugin.addSurfaceModule({
|
|
84
378
|
activate: ReactSurface
|
|
85
|
-
}),
|
|
86
|
-
|
|
379
|
+
}), AppPlugin.addTranslationsModule({
|
|
380
|
+
translations
|
|
87
381
|
}), Plugin.make);
|
|
88
382
|
export {
|
|
89
|
-
BlueprintDefinition,
|
|
90
383
|
Chess_exports as Chess,
|
|
91
|
-
|
|
92
|
-
|
|
384
|
+
chess_blueprint_default as ChessBlueprint,
|
|
385
|
+
operations_exports as ChessFunctions,
|
|
93
386
|
ChessPlugin,
|
|
94
387
|
Chessboard,
|
|
95
|
-
|
|
96
|
-
ExtendedChessModel,
|
|
97
|
-
ReactSurface,
|
|
98
|
-
meta
|
|
388
|
+
meta2 as meta
|
|
99
389
|
};
|
|
100
390
|
//# sourceMappingURL=index.mjs.map
|