@dxos/plugin-chess 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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-H6SON7WG.mjs +28 -0
- package/dist/lib/browser/chunk-H6SON7WG.mjs.map +7 -0
- package/dist/lib/browser/chunk-IN3LZ2OO.mjs +62 -0
- package/dist/lib/browser/chunk-IN3LZ2OO.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JYP24G6K.mjs +36 -0
- package/dist/lib/browser/chunk-JYP24G6K.mjs.map +7 -0
- package/dist/lib/browser/chunk-OBKYFOJA.mjs +110 -0
- package/dist/lib/browser/chunk-OBKYFOJA.mjs.map +7 -0
- package/dist/lib/browser/create-2ME3FNBX.mjs +24 -0
- package/dist/lib/browser/create-2ME3FNBX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +30 -111
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/move-TTMIPD5J.mjs +36 -0
- package/dist/lib/browser/move-TTMIPD5J.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-GHXPV2T2.mjs +45 -0
- package/dist/lib/browser/play-GHXPV2T2.mjs.map +7 -0
- package/dist/lib/browser/print-RNAGAOM7.mjs +30 -0
- package/dist/lib/browser/print-RNAGAOM7.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +38 -0
- package/dist/lib/browser/translations.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-4C4GPZTA.mjs +29 -0
- package/dist/lib/node-esm/chunk-4C4GPZTA.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G2EHRXHX.mjs +111 -0
- package/dist/lib/node-esm/chunk-G2EHRXHX.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-NSFPC4IO.mjs +38 -0
- package/dist/lib/node-esm/chunk-NSFPC4IO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OHBKSL2Q.mjs +63 -0
- package/dist/lib/node-esm/chunk-OHBKSL2Q.mjs.map +7 -0
- package/dist/lib/node-esm/create-CC2P7GPT.mjs +25 -0
- package/dist/lib/node-esm/create-CC2P7GPT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +30 -111
- 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-CYHXWHHM.mjs +37 -0
- package/dist/lib/node-esm/move-CYHXWHHM.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-KTNK2PBL.mjs +46 -0
- package/dist/lib/node-esm/play-KTNK2PBL.mjs.map +7 -0
- package/dist/lib/node-esm/print-P23VKVNU.mjs +31 -0
- package/dist/lib/node-esm/print-P23VKVNU.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +39 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/ChessPlugin.d.ts +3 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/ChessPlugin.node.d.ts +4 -0
- package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ChessPlugin.test.d.ts +2 -0
- package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
- 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/node.d.ts +5 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- 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/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +8 -8
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +65 -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} +5 -6
- 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 +64 -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/containers/ChessCard/ChessCard.stories.d.ts +15 -0
- 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 +3 -4
- 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 +40 -22
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +19 -19
- 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 +83 -51
- package/src/ChessPlugin.node.ts +45 -0
- package/src/ChessPlugin.test.ts +49 -0
- package/src/ChessPlugin.tsx +43 -53
- package/src/blueprints/chess-blueprint.ts +34 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition.ts +100 -93
- package/src/capabilities/blueprint-definition.ts +11 -28
- package/src/capabilities/index.ts +9 -6
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/react-surface.tsx +27 -15
- 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} +42 -25
- 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 +6 -4
- package/src/meta.ts +6 -4
- 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 +30 -34
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-JOCAWL5W.mjs +0 -97
- package/dist/lib/browser/ChessboardContainer-JOCAWL5W.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-LC4GNYMG.mjs +0 -11
- package/dist/lib/browser/chunk-2EN3CBLB.mjs +0 -8
- package/dist/lib/browser/chunk-2EN3CBLB.mjs.map +0 -7
- package/dist/lib/browser/chunk-3WEALY7P.mjs +0 -84
- package/dist/lib/browser/chunk-3WEALY7P.mjs.map +0 -7
- package/dist/lib/browser/chunk-4ULSTPL6.mjs +0 -166
- package/dist/lib/browser/chunk-4ULSTPL6.mjs.map +0 -7
- package/dist/lib/browser/chunk-NR4YFUK7.mjs +0 -306
- package/dist/lib/browser/chunk-NR4YFUK7.mjs.map +0 -7
- package/dist/lib/browser/chunk-WSUUPPDK.mjs +0 -26
- package/dist/lib/browser/chunk-WSUUPPDK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-PMP36Y5B.mjs +0 -25
- package/dist/lib/browser/intent-resolver-PMP36Y5B.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TSLFLTXN.mjs +0 -38
- package/dist/lib/browser/react-surface-TSLFLTXN.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs +0 -98
- package/dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-FBGRWYEW.mjs +0 -12
- package/dist/lib/node-esm/chunk-5C2OYL2B.mjs +0 -27
- package/dist/lib/node-esm/chunk-5C2OYL2B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7PHZFXU5.mjs +0 -10
- package/dist/lib/node-esm/chunk-7PHZFXU5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AR3TI5LX.mjs +0 -167
- package/dist/lib/node-esm/chunk-AR3TI5LX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LMXETYDF.mjs +0 -85
- package/dist/lib/node-esm/chunk-LMXETYDF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VVTQFCUK.mjs +0 -307
- package/dist/lib/node-esm/chunk-VVTQFCUK.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-AN4SMEDU.mjs +0 -39
- package/dist/lib/node-esm/react-surface-AN4SMEDU.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 +0 -13
- 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 -69
- package/src/components/ChessboardContainer.tsx +0 -44
- package/src/functions/create.ts +0 -31
- package/src/functions/index.ts +0 -7
- package/src/functions/move.ts +0 -44
- package/src/functions/play.ts +0 -54
- package/src/types/ChessAction.ts +0 -19
- /package/dist/lib/browser/{blueprint-definition-LC4GNYMG.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-FBGRWYEW.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
__export
|
|
4
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
5
|
+
|
|
6
|
+
// src/types/Chess.ts
|
|
7
|
+
var Chess_exports = {};
|
|
8
|
+
__export(Chess_exports, {
|
|
9
|
+
Game: () => Game,
|
|
10
|
+
make: () => make
|
|
11
|
+
});
|
|
12
|
+
import { Chess as ChessJS } from "chess.js";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import { Annotation, Obj, Type } from "@dxos/echo";
|
|
15
|
+
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
16
|
+
import { log } from "@dxos/log";
|
|
17
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-chess/src/types/Chess.ts";
|
|
18
|
+
var Game = Schema.Struct({
|
|
19
|
+
name: Schema.optional(Schema.String),
|
|
20
|
+
players: Schema.Struct({
|
|
21
|
+
white: Schema.optional(Schema.String.annotations({
|
|
22
|
+
description: "DID of white player"
|
|
23
|
+
})),
|
|
24
|
+
black: Schema.optional(Schema.String.annotations({
|
|
25
|
+
description: "DID of black player"
|
|
26
|
+
}))
|
|
27
|
+
}).pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
28
|
+
pgn: Schema.String.annotations({
|
|
29
|
+
description: "Portable Game Notation."
|
|
30
|
+
}).pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
31
|
+
fen: Schema.String.annotations({
|
|
32
|
+
description: "Forsyth-Edwards Notation."
|
|
33
|
+
}).pipe(FormInputAnnotation.set(false), Schema.optional)
|
|
34
|
+
}).pipe(Type.object({
|
|
35
|
+
typename: "org.dxos.type.chess",
|
|
36
|
+
version: "0.1.0"
|
|
37
|
+
}), LabelAnnotation.set([
|
|
38
|
+
"name"
|
|
39
|
+
]), Annotation.IconAnnotation.set({
|
|
40
|
+
icon: "ph--shield-chevron--regular",
|
|
41
|
+
hue: "amber"
|
|
42
|
+
}));
|
|
43
|
+
var make = ({ name, pgn, fen } = {}) => {
|
|
44
|
+
const chess = new ChessJS();
|
|
45
|
+
if (pgn) {
|
|
46
|
+
try {
|
|
47
|
+
chess.loadPgn(pgn);
|
|
48
|
+
} catch {
|
|
49
|
+
log.warn(pgn, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return Obj.make(Game, {
|
|
53
|
+
name,
|
|
54
|
+
pgn,
|
|
55
|
+
fen,
|
|
56
|
+
players: {}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
Chess_exports
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=chunk-OHBKSL2Q.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/Chess.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { log } from '@dxos/log';\n\nexport const Game = Schema.Struct({\n name: Schema.optional(Schema.String),\n players: Schema.Struct({\n white: Schema.optional(\n Schema.String.annotations({\n description: 'DID of white player',\n }),\n ),\n black: Schema.optional(\n Schema.String.annotations({\n description: 'DID of black player',\n }),\n ),\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n pgn: Schema.String.annotations({\n description: 'Portable Game Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n fen: Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.chess',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--shield-chevron--regular',\n hue: 'amber',\n }),\n);\n\nexport interface Game extends Schema.Schema.Type<typeof Game> {}\n\nexport const make = ({ name, pgn, fen }: { name?: string; pgn?: string; fen?: string } = {}) => {\n const chess = new ChessJS();\n if (pgn) {\n try {\n chess.loadPgn(pgn);\n } catch {\n log.warn(pgn);\n }\n }\n\n return Obj.make(Game, {\n name,\n pgn,\n fen,\n players: {},\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;AAAA;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,YAAYC,KAAKC,YAAY;AACtC,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,WAAW;AAEpB,IAAA,eAAaC;AAEXC,IAASR,OAAc,cAAA;QACdA,gBACLA,aAAOS;WACLC,cAAa;IACf,OAAA,gBAAA,cAAA,YAAA;MAEFC,aAAcC;;IAGZ,OAAA,gBAAA,cAAA,YAAA;MAEIR,aAAAA;IACRS,CAAKb,CAAAA;UACHU,oBAAa,IAAA,KAAA,GAAA,eAAA;EACf,KAAQN,cAAAA,YAAuB;IAC/BU,aAAYL;UACVC,oBAAa,IAAA,KAAA,GAAA,eAAA;EACf,KAAQN,cAAAA,YAAuB;IAE/BD,aAAY;EACVY,CAAAA,EAAAA,KAAAA,oBAAU,IAAA,KAAA,GAAA,eAAA;QACVC,KAAS,OAAA;EAEXX,UAAAA;EAAqB,SAAA;CAAO,GAC5BJ,gBAAWgB,IAAAA;EACTC;IACAC,WAAK,eAAA,IAAA;EAEP,MAAA;EAIF,KAAO;;AAEL,IAAS,OAAA,CAAA,EAAA,MAAA,KAAA,IAAA,IAAA,CAAA,MAAA;QACP,QAAI,IAAA,QAAA;WACFC;AACF,QAAE;AACAd,YAAIe,QAAKR,GAAAA;IACX,QAAA;AACF,UAAA,KAAA,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;IAEA;;SAEEA,IAAAA,KAAAA,MAAAA;IACAC;IACAN;IACF;IACA,SAAA,CAAA;;;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Schema", "Annotation", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "log", "Game", "players", "String", "description", "black", "optional", "pgn", "fen", "typename", "version", "IconAnnotation", "icon", "hue", "chess", "warn"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Create
|
|
4
|
+
} from "./chunk-G2EHRXHX.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Chess_exports
|
|
7
|
+
} from "./chunk-OHBKSL2Q.mjs";
|
|
8
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
9
|
+
|
|
10
|
+
// src/operations/create.ts
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import { Operation } from "@dxos/compute";
|
|
13
|
+
import { Database } from "@dxos/echo";
|
|
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-CC2P7GPT.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 { Operation } from '@dxos/compute';\nimport { Database } from '@dxos/echo';\n\nimport { Chess } from '../types';\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,iBAAiB;AAC1B,SAASC,gBAAgB;AAKzB,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", "Operation", "Database", "handler", "Create", "pipe", "Operation", "withHandler", "fn", "name", "pgn", "fen", "Database", "add", "Chess", "make"]
|
|
7
|
+
}
|
|
@@ -1,124 +1,43 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
move_default,
|
|
6
|
-
play_default
|
|
7
|
-
} from "./chunk-AR3TI5LX.mjs";
|
|
3
|
+
chess_blueprint_default
|
|
4
|
+
} from "./chunk-NSFPC4IO.mjs";
|
|
8
5
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
operations_exports
|
|
7
|
+
} from "./chunk-4C4GPZTA.mjs";
|
|
8
|
+
import "./chunk-G2EHRXHX.mjs";
|
|
11
9
|
import {
|
|
12
|
-
ChessAction_exports,
|
|
13
10
|
Chess_exports
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import
|
|
16
|
-
Chessboard,
|
|
17
|
-
ExtendedChessModel
|
|
18
|
-
} from "./chunk-VVTQFCUK.mjs";
|
|
19
|
-
import {
|
|
20
|
-
meta
|
|
21
|
-
} from "./chunk-5C2OYL2B.mjs";
|
|
11
|
+
} from "./chunk-OHBKSL2Q.mjs";
|
|
12
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
22
13
|
|
|
23
|
-
// src/
|
|
24
|
-
import {
|
|
25
|
-
var BlueprintDefinition = lazy(() => import("./blueprint-definition-FBGRWYEW.mjs"));
|
|
26
|
-
var IntentResolver = lazy(() => import("./intent-resolver-5P7Y2ZKB.mjs"));
|
|
27
|
-
var ReactSurface = lazy(() => import("./react-surface-AN4SMEDU.mjs"));
|
|
14
|
+
// src/index.ts
|
|
15
|
+
import { Plugin } from "@dxos/app-framework";
|
|
28
16
|
|
|
29
|
-
// src/
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"rename object label": "Rename game",
|
|
46
|
-
"delete object label": "Delete game",
|
|
47
|
-
"toggle info button": "Toggle info",
|
|
48
|
-
"close info button": "Close info",
|
|
49
|
-
"flip board button": "Flip board",
|
|
50
|
-
"select player button": "Select player"
|
|
51
|
-
},
|
|
52
|
-
[meta.id]: {
|
|
53
|
-
"plugin name": "Chess",
|
|
54
|
-
"delete game label": "Delete",
|
|
55
|
-
"game.checkmate": "Checkmate",
|
|
56
|
-
"game.stalemate": "Stalemate",
|
|
57
|
-
"game.draw": "Draw",
|
|
58
|
-
"game.check": "Check"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
];
|
|
17
|
+
// src/meta.ts
|
|
18
|
+
import { trim } from "@dxos/util";
|
|
19
|
+
var meta = {
|
|
20
|
+
id: "org.dxos.plugin.chess",
|
|
21
|
+
name: "Chess",
|
|
22
|
+
description: trim`
|
|
23
|
+
Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.
|
|
24
|
+
Track game history and analyze moves in real-time.
|
|
25
|
+
`,
|
|
26
|
+
icon: "ph--shield-chevron--regular",
|
|
27
|
+
iconHue: "amber",
|
|
28
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess",
|
|
29
|
+
screenshots: [
|
|
30
|
+
"https://dxos.network/plugin-details-chess-dark.png"
|
|
31
|
+
]
|
|
32
|
+
};
|
|
63
33
|
|
|
64
|
-
// src/
|
|
65
|
-
var ChessPlugin =
|
|
66
|
-
defineModule({
|
|
67
|
-
id: `${meta.id}/module/translations`,
|
|
68
|
-
activatesOn: Events.SetupTranslations,
|
|
69
|
-
activate: () => contributes(Capabilities.Translations, translations)
|
|
70
|
-
}),
|
|
71
|
-
defineModule({
|
|
72
|
-
id: `${meta.id}/module/metadata`,
|
|
73
|
-
activatesOn: Events.SetupMetadata,
|
|
74
|
-
activate: () => contributes(Capabilities.Metadata, {
|
|
75
|
-
id: Chess_exports.Game.typename,
|
|
76
|
-
metadata: {
|
|
77
|
-
icon: "ph--shield-chevron--regular",
|
|
78
|
-
blueprints: [
|
|
79
|
-
BLUEPRINT_KEY
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
}),
|
|
84
|
-
defineModule({
|
|
85
|
-
id: `${meta.id}/module/object-form`,
|
|
86
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
87
|
-
activate: () => contributes(SpaceCapabilities.ObjectForm, defineObjectForm({
|
|
88
|
-
objectSchema: Chess_exports.Game,
|
|
89
|
-
getIntent: () => createIntent(ChessAction_exports.Create)
|
|
90
|
-
}))
|
|
91
|
-
}),
|
|
92
|
-
defineModule({
|
|
93
|
-
id: `${meta.id}/module/react-surface`,
|
|
94
|
-
activatesOn: Events.SetupReactSurface,
|
|
95
|
-
activate: ReactSurface
|
|
96
|
-
}),
|
|
97
|
-
defineModule({
|
|
98
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
99
|
-
activatesOn: Events.SetupIntentResolver,
|
|
100
|
-
activate: IntentResolver
|
|
101
|
-
}),
|
|
102
|
-
defineModule({
|
|
103
|
-
id: `${meta.id}/module/blueprint`,
|
|
104
|
-
activatesOn: Events.SetupArtifactDefinition,
|
|
105
|
-
activate: BlueprintDefinition
|
|
106
|
-
})
|
|
107
|
-
]);
|
|
34
|
+
// src/index.ts
|
|
35
|
+
var ChessPlugin = Plugin.lazy(meta, () => import("#plugin"));
|
|
108
36
|
export {
|
|
109
|
-
BLUEPRINT_KEY,
|
|
110
|
-
BlueprintDefinition,
|
|
111
37
|
Chess_exports as Chess,
|
|
112
|
-
|
|
38
|
+
chess_blueprint_default as ChessBlueprint,
|
|
39
|
+
operations_exports as ChessFunctions,
|
|
113
40
|
ChessPlugin,
|
|
114
|
-
|
|
115
|
-
ChessboardContainer,
|
|
116
|
-
ExtendedChessModel,
|
|
117
|
-
IntentResolver,
|
|
118
|
-
ReactSurface,
|
|
119
|
-
create_default as create,
|
|
120
|
-
meta,
|
|
121
|
-
move_default as move,
|
|
122
|
-
play_default as play
|
|
41
|
+
meta
|
|
123
42
|
};
|
|
124
43
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/index.ts", "../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport * from './blueprints';\nexport * from './meta';\nexport * from './types';\n\nexport const ChessPlugin = Plugin.lazy(meta, () => import('#plugin'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.chess',\n name: 'Chess',\n description: trim`\n Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.\n Track game history and analyze moves in real-time.\n `,\n icon: 'ph--shield-chevron--regular',\n iconHue: 'amber',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',\n screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAIA,SAASA,cAAc;;;ACCvB,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;EAIbK,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa;IAAC;;AAChB;;;ADNO,IAAMC,cAAcC,OAAOC,KAAKC,MAAM,MAAM,OAAO,SAAA,CAAA;",
|
|
6
|
+
"names": ["Plugin", "trim", "meta", "id", "name", "description", "icon", "iconHue", "source", "screenshots", "ChessPlugin", "Plugin", "lazy", "meta"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/types/Chess.ts":{"bytes":5620,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":1691,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/types/ChessAction.ts":{"bytes":1848,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"src/types/Chess.ts","kind":"import-statement","original":"./Chess"}],"format":"esm"},"src/types/index.ts":{"bytes":682,"imports":[{"path":"src/types/Chess.ts","kind":"import-statement","original":"./Chess"},{"path":"src/types/ChessAction.ts","kind":"import-statement","original":"./ChessAction"}],"format":"esm"},"src/functions/create.ts":{"bytes":3177,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/functions/move.ts":{"bytes":5054,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/functions/play.ts":{"bytes":6741,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/functions/index.ts":{"bytes":860,"imports":[{"path":"src/functions/create.ts","kind":"import-statement","original":"./create"},{"path":"src/functions/move.ts","kind":"import-statement","original":"./move"},{"path":"src/functions/play.ts","kind":"import-statement","original":"./play"}],"format":"esm"},"src/capabilities/blueprint-definition.ts":{"bytes":3906,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/functions/index.ts","kind":"import-statement","original":"../functions"}],"format":"esm"},"src/capabilities/intent-resolver.ts":{"bytes":2113,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/components/Info.tsx":{"bytes":24809,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"src/components/Chessboard.tsx":{"bytes":14217,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-sfx","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"src/components/Info.tsx","kind":"import-statement","original":"./Info"}],"format":"esm"},"src/components/ChessboardArticle.tsx":{"bytes":8322,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"src/components/Chessboard.tsx","kind":"import-statement","original":"./Chessboard"}],"format":"esm"},"src/components/ChessboardContainer.tsx":{"bytes":3725,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"src/components/Chessboard.tsx","kind":"import-statement","original":"./Chessboard"},{"path":"src/components/ChessboardArticle.tsx","kind":"import-statement","original":"./ChessboardArticle"}],"format":"esm"},"src/components/index.ts":{"bytes":877,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/components/Chessboard.tsx","kind":"import-statement","original":"./Chessboard"},{"path":"src/components/ChessboardContainer.tsx","kind":"dynamic-import","original":"./ChessboardContainer"}],"format":"esm"},"src/capabilities/react-surface.tsx":{"bytes":3392,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":1442,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/blueprint-definition.ts","kind":"import-statement","original":"./blueprint-definition"},{"path":"src/capabilities/blueprint-definition.ts","kind":"dynamic-import","original":"./blueprint-definition"},{"path":"src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"src/translations.ts":{"bytes":3391,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/ChessPlugin.tsx":{"bytes":7439,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/index.ts":{"bytes":911,"imports":[{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/functions/index.ts","kind":"import-statement","original":"./functions"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5735},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-AR3TI5LX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-7PHZFXU5.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-LMXETYDF.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-VVTQFCUK.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/blueprint-definition-FBGRWYEW.mjs","kind":"dynamic-import"},{"path":"dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs","kind":"dynamic-import"},{"path":"dist/lib/node-esm/react-surface-AN4SMEDU.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true}],"exports":["BLUEPRINT_KEY","BlueprintDefinition","Chess","ChessAction","ChessPlugin","Chessboard","ChessboardContainer","ExtendedChessModel","IntentResolver","ReactSurface","create","meta","move","play"],"entryPoint":"src/index.ts","inputs":{"src/capabilities/index.ts":{"bytesInOutput":275},"src/index.ts":{"bytesInOutput":0},"src/ChessPlugin.tsx":{"bytesInOutput":1566},"src/translations.ts":{"bytesInOutput":807}},"bytes":3553},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-LMXETYDF.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"}],"exports":["Chess","ChessAction"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":314},"dist/lib/node-esm/blueprint-definition-FBGRWYEW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/blueprint-definition-FBGRWYEW.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-AR3TI5LX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-LMXETYDF.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"}],"exports":["BLUEPRINT_KEY","default"],"entryPoint":"src/capabilities/blueprint-definition.ts","inputs":{},"bytes":372},"dist/lib/node-esm/chunk-AR3TI5LX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9599},"dist/lib/node-esm/chunk-AR3TI5LX.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-LMXETYDF.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true}],"exports":["BLUEPRINT_KEY","blueprint_definition_default","create_default","move_default","play_default"],"inputs":{"src/capabilities/blueprint-definition.ts":{"bytesInOutput":968},"src/functions/create.ts":{"bytesInOutput":703},"src/functions/index.ts":{"bytesInOutput":0},"src/functions/move.ts":{"bytesInOutput":1284},"src/functions/play.ts":{"bytesInOutput":1732}},"bytes":5160},"dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1074},"dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-LMXETYDF.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/intent-resolver.ts","inputs":{"src/capabilities/intent-resolver.ts":{"bytesInOutput":380}},"bytes":725},"dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5953},"dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-VVTQFCUK.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["ChessboardContainer","default"],"entryPoint":"src/components/ChessboardContainer.tsx","inputs":{"src/components/ChessboardContainer.tsx":{"bytesInOutput":931},"src/components/ChessboardArticle.tsx":{"bytesInOutput":2158}},"bytes":3542},"dist/lib/node-esm/react-surface-AN4SMEDU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1590},"dist/lib/node-esm/react-surface-AN4SMEDU.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-7PHZFXU5.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-LMXETYDF.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-VVTQFCUK.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/react-surface.tsx","inputs":{"src/capabilities/react-surface.tsx":{"bytesInOutput":718}},"bytes":1144},"dist/lib/node-esm/chunk-7PHZFXU5.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":415},"dist/lib/node-esm/chunk-7PHZFXU5.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs","kind":"dynamic-import"}],"exports":["ChessboardContainer"],"inputs":{"src/components/index.ts":{"bytesInOutput":114}},"bytes":313},"dist/lib/node-esm/chunk-LMXETYDF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3785},"dist/lib/node-esm/chunk-LMXETYDF.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["ChessAction_exports","Chess_exports"],"inputs":{"src/types/Chess.ts":{"bytesInOutput":1484},"src/types/index.ts":{"bytesInOutput":0},"src/types/ChessAction.ts":{"bytesInOutput":387}},"bytes":2170},"dist/lib/node-esm/chunk-VVTQFCUK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":19948},"dist/lib/node-esm/chunk-VVTQFCUK.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-5C2OYL2B.mjs","kind":"import-statement"},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-sfx","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["Chessboard","ExtendedChessModel"],"inputs":{"src/components/Chessboard.tsx":{"bytesInOutput":3610},"src/components/Info.tsx":{"bytesInOutput":6785}},"bytes":10722},"dist/lib/node-esm/chunk-5C2OYL2B.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":822},"dist/lib/node-esm/chunk-5C2OYL2B.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["__export","meta"],"inputs":{"src/meta.ts":{"bytesInOutput":377}},"bytes":728}}}
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":1964,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/blueprints/chess-blueprint.ts":{"bytes":3169,"imports":[{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true}],"format":"esm"},"src/types/Chess.ts":{"bytes":6005,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":422,"imports":[{"path":"src/types/Chess.ts","kind":"import-statement","original":"./Chess"}],"format":"esm"},"src/operations/definitions.ts":{"bytes":9761,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/operations/create.ts":{"bytes":1931,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/move.ts":{"bytes":3339,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/play.ts":{"bytes":4640,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/print.ts":{"bytes":2286,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/index.ts":{"bytes":1425,"imports":[{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"src/operations/create.ts","kind":"dynamic-import","original":"./create"},{"path":"src/operations/move.ts","kind":"dynamic-import","original":"./move"},{"path":"src/operations/play.ts","kind":"dynamic-import","original":"./play"},{"path":"src/operations/print.ts","kind":"dynamic-import","original":"./print"}],"format":"esm"},"src/blueprints/index.ts":{"bytes":700,"imports":[{"path":"src/blueprints/chess-blueprint.ts","kind":"import-statement","original":"./chess-blueprint"},{"path":"src/operations/index.ts","kind":"import-statement","original":"../operations"}],"format":"esm"},"src/index.ts":{"bytes":1105,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/blueprints/index.ts","kind":"import-statement","original":"./blueprints"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"#plugin","kind":"dynamic-import","external":true}],"format":"esm"},"src/translations.ts":{"bytes":3622,"imports":[{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/node-esm/print-P23VKVNU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1249},"dist/lib/node-esm/print-P23VKVNU.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/print.ts","inputs":{"src/operations/print.ts":{"bytesInOutput":438}},"bytes":751},"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1412},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-NSFPC4IO.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-4C4GPZTA.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#plugin","kind":"dynamic-import","external":true}],"exports":["Chess","ChessBlueprint","ChessFunctions","ChessPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":108},"src/meta.ts":{"bytesInOutput":515}},"bytes":1190},"dist/lib/node-esm/blueprints/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/blueprints/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-NSFPC4IO.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-4C4GPZTA.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"}],"exports":["ChessBlueprint","ChessFunctions"],"entryPoint":"src/blueprints/index.ts","inputs":{},"bytes":448},"dist/lib/node-esm/chunk-NSFPC4IO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1608},"dist/lib/node-esm/chunk-NSFPC4IO.mjs":{"imports":[{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true}],"exports":["chess_blueprint_default"],"inputs":{"src/blueprints/chess-blueprint.ts":{"bytesInOutput":830},"src/blueprints/index.ts":{"bytesInOutput":0}},"bytes":1043},"dist/lib/node-esm/operations/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/operations/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-4C4GPZTA.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"}],"exports":["ChessHandlers","Create","Move","Play","Print"],"entryPoint":"src/operations/index.ts","inputs":{},"bytes":386},"dist/lib/node-esm/chunk-4C4GPZTA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":721},"dist/lib/node-esm/chunk-4C4GPZTA.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/create-CC2P7GPT.mjs","kind":"dynamic-import"},{"path":"dist/lib/node-esm/move-CYHXWHHM.mjs","kind":"dynamic-import"},{"path":"dist/lib/node-esm/play-KTNK2PBL.mjs","kind":"dynamic-import"},{"path":"dist/lib/node-esm/print-P23VKVNU.mjs","kind":"dynamic-import"}],"exports":["ChessHandlers","operations_exports"],"inputs":{"src/operations/index.ts":{"bytesInOutput":462}},"bytes":802},"dist/lib/node-esm/translations.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1716},"dist/lib/node-esm/translations.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"exports":["translations"],"entryPoint":"src/translations.ts","inputs":{"src/translations.ts":{"bytesInOutput":973}},"bytes":1189},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"}],"exports":["Chess"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":253},"dist/lib/node-esm/create-CC2P7GPT.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1042},"dist/lib/node-esm/create-CC2P7GPT.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/create.ts","inputs":{"src/operations/create.ts":{"bytesInOutput":334}},"bytes":676},"dist/lib/node-esm/move-CYHXWHHM.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1880},"dist/lib/node-esm/move-CYHXWHHM.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/move.ts","inputs":{"src/operations/move.ts":{"bytesInOutput":652}},"bytes":961},"dist/lib/node-esm/play-KTNK2PBL.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2573},"dist/lib/node-esm/play-KTNK2PBL.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-G2EHRXHX.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/play.ts","inputs":{"src/operations/play.ts":{"bytesInOutput":970}},"bytes":1279},"dist/lib/node-esm/chunk-G2EHRXHX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4773},"dist/lib/node-esm/chunk-G2EHRXHX.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-OHBKSL2Q.mjs","kind":"import-statement"},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["Create","Move","Play","Print"],"inputs":{"src/operations/definitions.ts":{"bytesInOutput":2575}},"bytes":2848},"dist/lib/node-esm/chunk-OHBKSL2Q.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2865},"dist/lib/node-esm/chunk-OHBKSL2Q.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Chess_exports"],"inputs":{"src/types/Chess.ts":{"bytesInOutput":1589},"src/types/index.ts":{"bytesInOutput":0}},"bytes":1828},"dist/lib/node-esm/chunk-HSLMI22Q.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/chunk-HSLMI22Q.mjs":{"imports":[],"exports":["__export"],"inputs":{},"bytes":327}}}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Move
|
|
4
|
+
} from "./chunk-G2EHRXHX.mjs";
|
|
5
|
+
import "./chunk-OHBKSL2Q.mjs";
|
|
6
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
7
|
+
|
|
8
|
+
// src/operations/move.ts
|
|
9
|
+
import { Chess as ChessJS } from "chess.js";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { Operation } from "@dxos/compute";
|
|
12
|
+
import { Database, Obj } from "@dxos/echo";
|
|
13
|
+
var handler = Move.pipe(Operation.withHandler(Effect.fn(function* ({ game, move }) {
|
|
14
|
+
const obj = yield* Database.load(game);
|
|
15
|
+
const chess = new ChessJS();
|
|
16
|
+
if (obj.pgn) {
|
|
17
|
+
chess.loadPgn(obj.pgn);
|
|
18
|
+
} else if (obj.fen) {
|
|
19
|
+
chess.load(obj.fen);
|
|
20
|
+
}
|
|
21
|
+
chess.move(move, {
|
|
22
|
+
strict: false
|
|
23
|
+
});
|
|
24
|
+
const pgn = chess.pgn();
|
|
25
|
+
Obj.update(obj, (obj2) => {
|
|
26
|
+
const mutableGame = obj2;
|
|
27
|
+
mutableGame.pgn = pgn;
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
pgn
|
|
31
|
+
};
|
|
32
|
+
})));
|
|
33
|
+
var move_default = handler;
|
|
34
|
+
export {
|
|
35
|
+
move_default as default
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=move-CYHXWHHM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/move.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, Obj } from '@dxos/echo';\n\nimport { type Chess } from '../types';\nimport { Move } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Move> = Move.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ game, move }) {\n const obj = (yield* Database.load(game)) as Chess.Game;\n const chess = new ChessJS();\n if (obj.pgn) {\n chess.loadPgn(obj.pgn);\n } else if (obj.fen) {\n chess.load(obj.fen);\n }\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.update(obj, (obj) => {\n const mutableGame = obj as Obj.Mutable<typeof obj>;\n mutableGame.pgn = pgn;\n });\n return { pgn };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,WAAW;AAK9B,IAAMC,UAA8CC,KAAKC,KACvDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,KAAI,GAAE;AACjC,QAAMC,MAAO,OAAOC,SAASC,KAAKJ,IAAAA;AAClC,QAAMK,QAAQ,IAAIC,QAAAA;AAClB,MAAIJ,IAAIK,KAAK;AACXF,UAAMG,QAAQN,IAAIK,GAAG;EACvB,WAAWL,IAAIO,KAAK;AAClBJ,UAAMD,KAAKF,IAAIO,GAAG;EACpB;AAEAJ,QAAMJ,KAAKA,MAAM;IAAES,QAAQ;EAAM,CAAA;AACjC,QAAMH,MAAMF,MAAME,IAAG;AACrBI,MAAIC,OAAOV,KAAK,CAACA,SAAAA;AACf,UAAMW,cAAcX;AACpBW,gBAAYN,MAAMA;EACpB,CAAA;AACA,SAAO;IAAEA;EAAI;AACf,CAAA,CAAA,CAAA;AAIJ,IAAA,eAAeb;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Effect", "Operation", "Database", "Obj", "handler", "Move", "pipe", "Operation", "withHandler", "fn", "game", "move", "obj", "Database", "load", "chess", "ChessJS", "pgn", "loadPgn", "fen", "strict", "Obj", "update", "mutableGame"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ChessHandlers
|
|
4
|
+
} from "../chunk-4C4GPZTA.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Create,
|
|
7
|
+
Move,
|
|
8
|
+
Play,
|
|
9
|
+
Print
|
|
10
|
+
} from "../chunk-G2EHRXHX.mjs";
|
|
11
|
+
import "../chunk-OHBKSL2Q.mjs";
|
|
12
|
+
import "../chunk-HSLMI22Q.mjs";
|
|
13
|
+
export {
|
|
14
|
+
ChessHandlers,
|
|
15
|
+
Create,
|
|
16
|
+
Move,
|
|
17
|
+
Play,
|
|
18
|
+
Print
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Play
|
|
4
|
+
} from "./chunk-G2EHRXHX.mjs";
|
|
5
|
+
import "./chunk-OHBKSL2Q.mjs";
|
|
6
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
7
|
+
|
|
8
|
+
// src/operations/play.ts
|
|
9
|
+
import { Chess as ChessJS } from "chess.js";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { Operation } from "@dxos/compute";
|
|
12
|
+
import { Database, Obj } from "@dxos/echo";
|
|
13
|
+
var handler = Play.pipe(Operation.withHandler(Effect.fn(function* ({ game, side = "any" }) {
|
|
14
|
+
const object = yield* Database.load(game);
|
|
15
|
+
const chess = new ChessJS();
|
|
16
|
+
if (object.pgn) {
|
|
17
|
+
chess.loadPgn(object.pgn);
|
|
18
|
+
} else if (object.fen) {
|
|
19
|
+
chess.load(object.fen);
|
|
20
|
+
}
|
|
21
|
+
if (!(side === "any" || chess.turn() === "w" && side === "white" || chess.turn() === "b" && side === "black")) {
|
|
22
|
+
return {
|
|
23
|
+
move: void 0,
|
|
24
|
+
pgn: object.pgn
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const moves = chess.moves();
|
|
28
|
+
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
29
|
+
chess.move(move, {
|
|
30
|
+
strict: false
|
|
31
|
+
});
|
|
32
|
+
const pgn = chess.pgn();
|
|
33
|
+
Obj.update(object, (object2) => {
|
|
34
|
+
const mutableGame = object2;
|
|
35
|
+
mutableGame.pgn = pgn;
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
move,
|
|
39
|
+
pgn
|
|
40
|
+
};
|
|
41
|
+
})));
|
|
42
|
+
var play_default = handler;
|
|
43
|
+
export {
|
|
44
|
+
play_default as default
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=play-KTNK2PBL.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/play.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, Obj } from '@dxos/echo';\n\nimport { type Chess } from '../types';\nimport { Play } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Play> = Play.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ game, side = 'any' }) {\n const object = (yield* Database.load(game)) as Chess.Game;\n const chess = new ChessJS();\n if (object.pgn) {\n chess.loadPgn(object.pgn);\n } else if (object.fen) {\n chess.load(object.fen);\n }\n\n if (\n !(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))\n ) {\n return { move: undefined, pgn: object.pgn! };\n }\n\n const moves = chess.moves();\n const move = moves[Math.floor(Math.random() * moves.length)];\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.update(object, (object) => {\n const mutableGame = object as Obj.Mutable<typeof object>;\n mutableGame.pgn = pgn;\n });\n return { move, pgn };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,WAAW;AAK9B,IAAMC,UAA8CC,KAAKC,KACvDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,OAAO,MAAK,GAAE;AACzC,QAAMC,SAAU,OAAOC,SAASC,KAAKJ,IAAAA;AACrC,QAAMK,QAAQ,IAAIC,QAAAA;AAClB,MAAIJ,OAAOK,KAAK;AACdF,UAAMG,QAAQN,OAAOK,GAAG;EAC1B,WAAWL,OAAOO,KAAK;AACrBJ,UAAMD,KAAKF,OAAOO,GAAG;EACvB;AAEA,MACE,EAAER,SAAS,SAAUI,MAAMK,KAAI,MAAO,OAAOT,SAAS,WAAaI,MAAMK,KAAI,MAAO,OAAOT,SAAS,UACpG;AACA,WAAO;MAAEU,MAAMC;MAAWL,KAAKL,OAAOK;IAAK;EAC7C;AAEA,QAAMM,QAAQR,MAAMQ,MAAK;AACzB,QAAMF,OAAOE,MAAMC,KAAKC,MAAMD,KAAKE,OAAM,IAAKH,MAAMI,MAAM,CAAA;AAE1DZ,QAAMM,KAAKA,MAAM;IAAEO,QAAQ;EAAM,CAAA;AACjC,QAAMX,MAAMF,MAAME,IAAG;AACrBY,MAAIC,OAAOlB,QAAQ,CAACA,YAAAA;AAClB,UAAMmB,cAAcnB;AACpBmB,gBAAYd,MAAMA;EACpB,CAAA;AACA,SAAO;IAAEI;IAAMJ;EAAI;AACrB,CAAA,CAAA,CAAA;AAIJ,IAAA,eAAeb;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Effect", "Operation", "Database", "Obj", "handler", "Play", "pipe", "Operation", "withHandler", "fn", "game", "side", "object", "Database", "load", "chess", "ChessJS", "pgn", "loadPgn", "fen", "turn", "move", "undefined", "moves", "Math", "floor", "random", "length", "strict", "Obj", "update", "mutableGame"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Print
|
|
4
|
+
} from "./chunk-G2EHRXHX.mjs";
|
|
5
|
+
import "./chunk-OHBKSL2Q.mjs";
|
|
6
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
7
|
+
|
|
8
|
+
// src/operations/print.ts
|
|
9
|
+
import { Chess as ChessJS } from "chess.js";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { Operation } from "@dxos/compute";
|
|
12
|
+
var handler = Print.pipe(Operation.withHandler(Effect.fn(function* ({ pgn, fen }) {
|
|
13
|
+
try {
|
|
14
|
+
const chess = new ChessJS(fen);
|
|
15
|
+
if (pgn) {
|
|
16
|
+
chess.loadPgn(pgn);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
ascii: chess.ascii()
|
|
20
|
+
};
|
|
21
|
+
} catch {
|
|
22
|
+
return {
|
|
23
|
+
ascii: ""
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
})));
|
|
27
|
+
var print_default = handler;
|
|
28
|
+
export {
|
|
29
|
+
print_default as default
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=print-P23VKVNU.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/print.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\n\nimport { Print } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Print> = Print.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ pgn, fen }) {\n try {\n const chess = new ChessJS(fen);\n if (pgn) {\n chess.loadPgn(pgn);\n }\n return { ascii: chess.ascii() };\n } catch {\n return { ascii: '' };\n }\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAI1B,IAAMC,UAA+CC,MAAMC,KACzDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,KAAKC,IAAG,GAAE;AAC/B,MAAI;AACF,UAAMC,QAAQ,IAAIC,QAAQF,GAAAA;AAC1B,QAAID,KAAK;AACPE,YAAME,QAAQJ,GAAAA;IAChB;AACA,WAAO;MAAEK,OAAOH,MAAMG,MAAK;IAAG;EAChC,QAAQ;AACN,WAAO;MAAEA,OAAO;IAAG;EACrB;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,gBAAeX;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Effect", "Operation", "handler", "Print", "pipe", "Operation", "withHandler", "fn", "pgn", "fen", "chess", "ChessJS", "loadPgn", "ascii"]
|
|
7
|
+
}
|