@dxos/plugin-chess 0.7.5-labs.5f04cf6 → 0.7.5-labs.e27f9b9
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/ChessContainer-2MMUB5S7.mjs +86 -0
- package/dist/lib/browser/ChessContainer-2MMUB5S7.mjs.map +7 -0
- package/dist/lib/browser/chunk-672NU6IC.mjs +8 -0
- package/dist/lib/browser/chunk-672NU6IC.mjs.map +7 -0
- package/dist/lib/browser/chunk-RGPTBDH7.mjs +41 -0
- package/dist/lib/browser/chunk-RGPTBDH7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +11 -19
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-UZRNSQFI.mjs → intent-resolver-BKKGQ5TJ.mjs} +15 -12
- package/dist/lib/browser/intent-resolver-BKKGQ5TJ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-EP4LXPH7.mjs → react-surface-Y7XMQYOV.mjs} +6 -14
- package/dist/lib/browser/react-surface-Y7XMQYOV.mjs.map +7 -0
- package/dist/lib/node/ChessContainer-CMYJDMSG.cjs +108 -0
- package/dist/lib/node/ChessContainer-CMYJDMSG.cjs.map +7 -0
- package/dist/lib/node/{chunk-6F6WTM5L.cjs → chunk-TEZPML34.cjs} +5 -5
- package/dist/lib/node/chunk-TEZPML34.cjs.map +7 -0
- package/dist/lib/node/{ChessContainer-P4BZ62FN.cjs → chunk-YTD6SK5V.cjs} +37 -16
- package/dist/lib/node/chunk-YTD6SK5V.cjs.map +7 -0
- package/dist/lib/node/index.cjs +11 -19
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-AENA6D5K.cjs → intent-resolver-OIFDW46S.cjs} +18 -15
- package/dist/lib/node/intent-resolver-OIFDW46S.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-JMOSMAIC.cjs → react-surface-35CG6JQF.cjs} +9 -17
- package/dist/lib/node/react-surface-35CG6JQF.cjs.map +7 -0
- package/dist/lib/node-esm/ChessContainer-WV2CO5WO.mjs +87 -0
- package/dist/lib/node-esm/ChessContainer-WV2CO5WO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GJW6TXCL.mjs +43 -0
- package/dist/lib/node-esm/chunk-GJW6TXCL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QXDXLFXD.mjs → chunk-YXXJHXSV.mjs} +2 -2
- package/dist/lib/node-esm/chunk-YXXJHXSV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +11 -19
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-T7NNHOYR.mjs → intent-resolver-35HIBBYC.mjs} +15 -12
- package/dist/lib/node-esm/intent-resolver-35HIBBYC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-ENB7VY45.mjs → react-surface-4FNRAFRL.mjs} +6 -14
- package/dist/lib/node-esm/react-surface-4FNRAFRL.mjs.map +7 -0
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/ChessComponent.d.ts +6 -0
- package/dist/types/src/components/ChessComponent.d.ts.map +1 -0
- package/dist/types/src/components/ChessContainer.d.ts +4 -3
- package/dist/types/src/components/ChessContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChessPanel.d.ts +11 -0
- package/dist/types/src/components/ChessPanel.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard.stories.d.ts +8 -0
- package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Chess.d.ts → PlayerSelector.d.ts} +3 -4
- package/dist/types/src/components/PlayerSelector.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -24
- package/src/ChessPlugin.tsx +5 -13
- package/src/capabilities/intent-resolver.ts +10 -8
- package/src/capabilities/react-surface.tsx +3 -12
- package/src/components/ChessComponent.tsx +48 -0
- package/src/components/ChessContainer.tsx +14 -4
- package/src/components/ChessPanel.tsx +67 -0
- package/src/components/Chessboard.stories.tsx +39 -0
- package/src/components/{Chess.tsx → PlayerSelector.tsx} +2 -50
- package/src/components/index.ts +1 -2
- package/dist/lib/browser/ChessContainer-G736GS2V.mjs +0 -26
- package/dist/lib/browser/ChessContainer-G736GS2V.mjs.map +0 -7
- package/dist/lib/browser/chunk-JUAC2NNR.mjs +0 -548
- package/dist/lib/browser/chunk-JUAC2NNR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LAYER2WV.mjs +0 -8
- package/dist/lib/browser/chunk-LAYER2WV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-UZRNSQFI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EP4LXPH7.mjs.map +0 -7
- package/dist/lib/node/ChessContainer-P4BZ62FN.cjs.map +0 -7
- package/dist/lib/node/chunk-6F6WTM5L.cjs.map +0 -7
- package/dist/lib/node/chunk-HPYER4GF.cjs +0 -574
- package/dist/lib/node/chunk-HPYER4GF.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-AENA6D5K.cjs.map +0 -7
- package/dist/lib/node/react-surface-JMOSMAIC.cjs.map +0 -7
- package/dist/lib/node-esm/ChessContainer-2LFJ6RHB.mjs +0 -27
- package/dist/lib/node-esm/ChessContainer-2LFJ6RHB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OMGVSBVI.mjs +0 -550
- package/dist/lib/node-esm/chunk-OMGVSBVI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QXDXLFXD.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-T7NNHOYR.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ENB7VY45.mjs.map +0 -7
- package/dist/types/src/components/Chess.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/Chessboard.d.ts +0 -37
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +0 -24
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/index.d.ts +0 -2
- package/dist/types/src/components/Chessboard/index.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/custom.d.ts +0 -3
- package/dist/types/src/components/Chessboard/pieces/custom.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/index.d.ts +0 -4
- package/dist/types/src/components/Chessboard/pieces/index.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/phosphor.d.ts +0 -3
- package/dist/types/src/components/Chessboard/pieces/phosphor.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/riohacha.d.ts +0 -3
- package/dist/types/src/components/Chessboard/pieces/riohacha.d.ts.map +0 -1
- package/src/components/Chessboard/Chessboard.stories.tsx +0 -56
- package/src/components/Chessboard/Chessboard.tsx +0 -182
- package/src/components/Chessboard/index.ts +0 -5
- package/src/components/Chessboard/pieces/custom.tsx +0 -82
- package/src/components/Chessboard/pieces/index.ts +0 -7
- package/src/components/Chessboard/pieces/phosphor.tsx +0 -71
- package/src/components/Chessboard/pieces/riohacha.tsx +0 -166
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ChessContainer_CMYJDMSG_exports = {};
|
|
30
|
+
__export(ChessContainer_CMYJDMSG_exports, {
|
|
31
|
+
default: () => ChessContainer_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ChessContainer_CMYJDMSG_exports);
|
|
34
|
+
var import_chunk_YTD6SK5V = require("./chunk-YTD6SK5V.cjs");
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
37
|
+
var import_react_ui_stack = require("@dxos/react-ui-stack");
|
|
38
|
+
var import_react2 = require("@phosphor-icons/react");
|
|
39
|
+
var import_react3 = __toESM(require("react"));
|
|
40
|
+
var import_display_name = require("@dxos/display-name");
|
|
41
|
+
var import_echo2 = require("@dxos/react-client/echo");
|
|
42
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
43
|
+
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
44
|
+
var PlayerSelector = ({ space, game }) => {
|
|
45
|
+
const members = (0, import_echo2.useMembers)(space.key);
|
|
46
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
47
|
+
role: "none",
|
|
48
|
+
className: "grid grid-cols-2 gap-8"
|
|
49
|
+
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
50
|
+
role: "none",
|
|
51
|
+
className: "flex flex-row-reverse items-center gap-2"
|
|
52
|
+
}, /* @__PURE__ */ import_react3.default.createElement(PlayerSelect, {
|
|
53
|
+
side: "white",
|
|
54
|
+
value: game.playerWhite,
|
|
55
|
+
onValueChange: (player) => game.playerWhite = player,
|
|
56
|
+
members
|
|
57
|
+
})), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
58
|
+
role: "none",
|
|
59
|
+
className: "flex flex-row items-center gap-2"
|
|
60
|
+
}, /* @__PURE__ */ import_react3.default.createElement(PlayerSelect, {
|
|
61
|
+
side: "black",
|
|
62
|
+
value: game.playerBlack,
|
|
63
|
+
onValueChange: (player) => game.playerBlack = player,
|
|
64
|
+
members
|
|
65
|
+
})));
|
|
66
|
+
};
|
|
67
|
+
var PlayerSelect = ({ side, value, onValueChange, members }) => {
|
|
68
|
+
const { themeMode } = (0, import_react_ui.useThemeContext)();
|
|
69
|
+
const iconFillMode = side === "black" && themeMode === "light" || side === "white" && themeMode === "dark" ? "fill" : void 0;
|
|
70
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Input.Root, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Input.Label, null, /* @__PURE__ */ import_react3.default.createElement(import_react2.CrownCross, {
|
|
71
|
+
className: (0, import_react_ui_theme.mx)((0, import_react_ui_theme.getSize)(6)),
|
|
72
|
+
weight: iconFillMode,
|
|
73
|
+
"aria-label": `Chess icon for side ${side}`
|
|
74
|
+
})), /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Select.Root, {
|
|
75
|
+
value,
|
|
76
|
+
onValueChange
|
|
77
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Select.TriggerButton, {
|
|
78
|
+
placeholder: "Select player"
|
|
79
|
+
}), /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Select.Portal, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Select.Content, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Select.Viewport, null, members.map((member) => {
|
|
80
|
+
const memberKey = member.identity.identityKey.toHex();
|
|
81
|
+
const displayName = member.identity?.profile?.displayName || (0, import_display_name.generateName)(memberKey);
|
|
82
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Select.Option, {
|
|
83
|
+
key: memberKey,
|
|
84
|
+
value: memberKey
|
|
85
|
+
}, displayName);
|
|
86
|
+
}))))));
|
|
87
|
+
};
|
|
88
|
+
var ChessContainer = ({ game }) => {
|
|
89
|
+
const space = (0, import_echo.getSpace)(game);
|
|
90
|
+
if (!space) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_stack.StackItem.Content, {
|
|
94
|
+
toolbar: false
|
|
95
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
96
|
+
role: "none",
|
|
97
|
+
className: "grid grid-rows-[60px_1fr_60px] grow overflow-hidden"
|
|
98
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", null), /* @__PURE__ */ import_react.default.createElement("div", {
|
|
99
|
+
className: "flex m-4 overflow-hidden"
|
|
100
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_chunk_YTD6SK5V.ChessComponent, {
|
|
101
|
+
game
|
|
102
|
+
})), /* @__PURE__ */ import_react.default.createElement(PlayerSelector, {
|
|
103
|
+
space,
|
|
104
|
+
game
|
|
105
|
+
})));
|
|
106
|
+
};
|
|
107
|
+
var ChessContainer_default = ChessContainer;
|
|
108
|
+
//# sourceMappingURL=ChessContainer-CMYJDMSG.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ChessContainer.tsx", "../../../src/components/PlayerSelector.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { getSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { ChessComponent } from './ChessComponent';\nimport { PlayerSelector } from './PlayerSelector';\nimport { type ChessType } from '../types';\n\nconst ChessContainer = ({ game }: { game: ChessType; role?: string }) => {\n const space = getSpace(game);\n if (!space) {\n return null;\n }\n\n return (\n <StackItem.Content toolbar={false}>\n <div role='none' className='grid grid-rows-[60px_1fr_60px] grow overflow-hidden'>\n <div />\n\n <div className='flex m-4 overflow-hidden'>\n <ChessComponent game={game} />\n </div>\n\n <PlayerSelector space={space} game={game} />\n </div>\n </StackItem.Content>\n );\n};\n\nexport default ChessContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { CrownCross } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { useMembers, type Space, type SpaceMember } from '@dxos/react-client/echo';\nimport { Input, Select, useThemeContext } from '@dxos/react-ui';\nimport { getSize, mx } from '@dxos/react-ui-theme';\n\nimport { type ChessType } from '../types';\n\nexport const PlayerSelector = ({ space, game }: { space: Space; game: ChessType }) => {\n const members = useMembers(space.key);\n\n return (\n <div role='none' className='grid grid-cols-2 gap-8'>\n <div role='none' className='flex flex-row-reverse items-center gap-2'>\n <PlayerSelect\n side='white'\n value={game.playerWhite}\n onValueChange={(player) => (game.playerWhite = player)}\n members={members}\n />\n </div>\n <div role='none' className='flex flex-row items-center gap-2'>\n <PlayerSelect\n side='black'\n value={game.playerBlack}\n onValueChange={(player) => (game.playerBlack = player)}\n members={members}\n />\n </div>\n </div>\n );\n};\n\nconst PlayerSelect = ({\n side,\n value,\n onValueChange,\n members,\n}: {\n side: 'white' | 'black';\n value: string | undefined;\n onValueChange: (player: string) => void;\n members: SpaceMember[];\n}) => {\n const { themeMode } = useThemeContext();\n const iconFillMode =\n (side === 'black' && themeMode === 'light') || (side === 'white' && themeMode === 'dark') ? 'fill' : undefined;\n\n return (\n <Input.Root>\n <Input.Label>\n <CrownCross className={mx(getSize(6))} weight={iconFillMode} aria-label={`Chess icon for side ${side}`} />\n </Input.Label>\n <Select.Root value={value} onValueChange={onValueChange}>\n <Select.TriggerButton placeholder={'Select player'} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {members.map((member) => {\n const memberKey = member.identity.identityKey.toHex();\n const displayName = member.identity?.profile?.displayName || generateName(memberKey);\n return (\n <Select.Option key={memberKey} value={memberKey}>\n {displayName}\n </Select.Option>\n );\n })}\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n </Input.Root>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,kBAAyB;AACzB,4BAA0B;ACH1B,IAAAA,gBAA2B;AAC3B,IAAAA,gBAAkB;AAElB,0BAA6B;AAC7B,IAAAC,eAAyD;AACzD,sBAA+C;AAC/C,4BAA4B;AAIrB,IAAMC,iBAAiB,CAAC,EAAEC,OAAOC,KAAI,MAAqC;AAC/E,QAAMC,cAAUC,yBAAWH,MAAMI,GAAG;AAEpC,SACE,8BAAAC,QAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,8BAAAH,QAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,8BAAAH,QAAA,cAACI,cAAAA;IACCC,MAAK;IACLC,OAAOV,KAAKW;IACZC,eAAe,CAACC,WAAYb,KAAKW,cAAcE;IAC/CZ;OAGJ,8BAAAG,QAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,8BAAAH,QAAA,cAACI,cAAAA;IACCC,MAAK;IACLC,OAAOV,KAAKc;IACZF,eAAe,CAACC,WAAYb,KAAKc,cAAcD;IAC/CZ;;AAKV;AAEA,IAAMO,eAAe,CAAC,EACpBC,MACAC,OACAE,eACAX,QAAO,MAMR;AACC,QAAM,EAAEc,UAAS,QAAKC,iCAAAA;AACtB,QAAMC,eACHR,SAAS,WAAWM,cAAc,WAAaN,SAAS,WAAWM,cAAc,SAAU,SAASG;AAEvG,SACE,8BAAAd,QAAA,cAACe,sBAAMC,MAAI,MACT,8BAAAhB,QAAA,cAACe,sBAAME,OAAK,MACV,8BAAAjB,QAAA,cAACkB,0BAAAA;IAAWf,eAAWgB,8BAAGC,+BAAQ,CAAA,CAAA;IAAKC,QAAQR;IAAcS,cAAY,uBAAuBjB,IAAAA;OAElG,8BAAAL,QAAA,cAACuB,uBAAOP,MAAI;IAACV;IAAcE;KACzB,8BAAAR,QAAA,cAACuB,uBAAOC,eAAa;IAACC,aAAa;MACnC,8BAAAzB,QAAA,cAACuB,uBAAOG,QAAM,MACZ,8BAAA1B,QAAA,cAACuB,uBAAOI,SAAO,MACb,8BAAA3B,QAAA,cAACuB,uBAAOK,UAAQ,MACb/B,QAAQgC,IAAI,CAACC,WAAAA;AACZ,UAAMC,YAAYD,OAAOE,SAASC,YAAYC,MAAK;AACnD,UAAMC,cAAcL,OAAOE,UAAUI,SAASD,mBAAeE,kCAAaN,SAAAA;AAC1E,WACE,8BAAA/B,QAAA,cAACuB,uBAAOe,QAAM;MAACvC,KAAKgC;MAAWzB,OAAOyB;OACnCI,WAAAA;EAGP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAOd;ADlEA,IAAMI,iBAAiB,CAAC,EAAE3C,KAAI,MAAsC;AAClE,QAAMD,YAAQ6C,sBAAS5C,IAAAA;AACvB,MAAI,CAACD,OAAO;AACV,WAAO;EACT;AAEA,SACEK,6BAAAA,QAAA,cAACyC,gCAAUd,SAAO;IAACe,SAAS;KAC1B1C,6BAAAA,QAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzBH,6BAAAA,QAAA,cAACC,OAAAA,IAAAA,GAEDD,6BAAAA,QAAA,cAACC,OAAAA;IAAIE,WAAU;KACbH,6BAAAA,QAAA,cAAC2C,sCAAAA;IAAe/C;OAGlBI,6BAAAA,QAAA,cAACN,gBAAAA;IAAeC;IAAcC;;AAItC;AAEA,IAAA,yBAAe2C;",
|
|
6
|
+
"names": ["import_react", "import_echo", "PlayerSelector", "space", "game", "members", "useMembers", "key", "React", "div", "role", "className", "PlayerSelect", "side", "value", "playerWhite", "onValueChange", "player", "playerBlack", "themeMode", "useThemeContext", "iconFillMode", "undefined", "Input", "Root", "Label", "CrownCross", "mx", "getSize", "weight", "aria-label", "Select", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "map", "member", "memberKey", "identity", "identityKey", "toHex", "displayName", "profile", "generateName", "Option", "ChessContainer", "getSpace", "StackItem", "toolbar", "ChessComponent"]
|
|
7
|
+
}
|
|
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_TEZPML34_exports = {};
|
|
30
|
+
__export(chunk_TEZPML34_exports, {
|
|
31
31
|
ChessContainer: () => ChessContainer
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_TEZPML34_exports);
|
|
34
34
|
var import_react = require("react");
|
|
35
|
-
var ChessContainer = (0, import_react.lazy)(() => import("./ChessContainer-
|
|
35
|
+
var ChessContainer = (0, import_react.lazy)(() => import("./ChessContainer-CMYJDMSG.cjs"));
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
38
38
|
ChessContainer
|
|
39
39
|
});
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-TEZPML34.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './ChessComponent';\n\nexport const ChessContainer = lazy(() => import('./ChessContainer'));\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAqB;AAId,IAAMA,qBAAiBC,mBAAK,MAAM,OAAO,+BAAA,CAAA;",
|
|
6
|
+
"names": ["ChessContainer", "lazy"]
|
|
7
|
+
}
|
|
@@ -26,27 +26,48 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
29
|
+
var chunk_YTD6SK5V_exports = {};
|
|
30
|
+
__export(chunk_YTD6SK5V_exports, {
|
|
31
|
+
ChessComponent: () => ChessComponent
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_YTD6SK5V_exports);
|
|
34
|
+
var import_chess = require("chess.js");
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_echo = require("@dxos/react-client/echo");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var import_react_ui_gameboard = require("@dxos/react-ui-gameboard");
|
|
38
|
+
var ChessComponent = ({ game }) => {
|
|
39
|
+
const model = (0, import_react.useMemo)(() => new import_react_ui_gameboard.ChessModel(), []);
|
|
40
|
+
(0, import_react.useEffect)(() => {
|
|
41
|
+
if (!model || game.pgn !== model?.game.pgn()) {
|
|
42
|
+
const chess = new import_chess.Chess();
|
|
43
|
+
if (game.pgn) {
|
|
44
|
+
chess.loadPgn(game.pgn);
|
|
45
|
+
}
|
|
46
|
+
model.initialize(chess.fen());
|
|
47
|
+
}
|
|
48
|
+
}, [
|
|
49
|
+
game.pgn
|
|
50
|
+
]);
|
|
39
51
|
const space = (0, import_echo.getSpace)(game);
|
|
40
52
|
if (!space) {
|
|
41
53
|
return null;
|
|
42
54
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
55
|
+
const handleDrop = (0, import_react.useCallback)((move) => {
|
|
56
|
+
if (model.makeMove(move)) {
|
|
57
|
+
game.pgn = model.game.pgn();
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}, [
|
|
62
|
+
model
|
|
63
|
+
]);
|
|
64
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_gameboard.Board.Root, {
|
|
65
|
+
model,
|
|
66
|
+
onDrop: handleDrop
|
|
67
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_gameboard.Chessboard, null));
|
|
50
68
|
};
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
ChessComponent
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=chunk-YTD6SK5V.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ChessComponent.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess } from 'chess.js';\nimport React, { useCallback, useEffect, useMemo } from 'react';\n\nimport { getSpace } from '@dxos/react-client/echo';\nimport { ChessModel, Board, Chessboard, type BoardRootProps } from '@dxos/react-ui-gameboard';\n\nimport { type ChessType } from '../types';\n\nexport const ChessComponent = ({ game }: { game: ChessType }) => {\n const model = useMemo(() => new ChessModel(), []);\n useEffect(() => {\n if (!model || game.pgn !== model?.game.pgn()) {\n const chess = new Chess();\n if (game.pgn) {\n chess.loadPgn(game.pgn);\n }\n\n model.initialize(chess.fen());\n }\n }, [game.pgn]);\n\n const space = getSpace(game);\n if (!space) {\n return null;\n }\n\n const handleDrop = useCallback<NonNullable<BoardRootProps['onDrop']>>(\n (move) => {\n if (model.makeMove(move)) {\n game.pgn = model.game.pgn();\n return true;\n }\n\n return false;\n },\n [model],\n );\n\n return (\n <Board.Root model={model} onDrop={handleDrop}>\n <Chessboard />\n </Board.Root>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAsB;AACtB,mBAAuD;AAEvD,kBAAyB;AACzB,gCAAmE;AAI5D,IAAMA,iBAAiB,CAAC,EAAEC,KAAI,MAAuB;AAC1D,QAAMC,YAAQC,sBAAQ,MAAM,IAAIC,qCAAAA,GAAc,CAAA,CAAE;AAChDC,8BAAU,MAAA;AACR,QAAI,CAACH,SAASD,KAAKK,QAAQJ,OAAOD,KAAKK,IAAAA,GAAO;AAC5C,YAAMC,QAAQ,IAAIC,mBAAAA;AAClB,UAAIP,KAAKK,KAAK;AACZC,cAAME,QAAQR,KAAKK,GAAG;MACxB;AAEAJ,YAAMQ,WAAWH,MAAMI,IAAG,CAAA;IAC5B;EACF,GAAG;IAACV,KAAKK;GAAI;AAEb,QAAMM,YAAQC,sBAASZ,IAAAA;AACvB,MAAI,CAACW,OAAO;AACV,WAAO;EACT;AAEA,QAAME,iBAAaC,0BACjB,CAACC,SAAAA;AACC,QAAId,MAAMe,SAASD,IAAAA,GAAO;AACxBf,WAAKK,MAAMJ,MAAMD,KAAKK,IAAG;AACzB,aAAO;IACT;AAEA,WAAO;EACT,GACA;IAACJ;GAAM;AAGT,SACE,6BAAAgB,QAAA,cAACC,gCAAMC,MAAI;IAAClB;IAAcmB,QAAQP;KAChC,6BAAAI,QAAA,cAACI,sCAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["ChessComponent", "game", "model", "useMemo", "ChessModel", "useEffect", "pgn", "chess", "Chess", "loadPgn", "initialize", "fen", "space", "getSpace", "handleDrop", "useCallback", "move", "makeMove", "React", "Board", "Root", "onDrop", "Chessboard"]
|
|
7
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -30,27 +30,23 @@ var node_exports = {};
|
|
|
30
30
|
__export(node_exports, {
|
|
31
31
|
Artifact: () => Artifact,
|
|
32
32
|
CHESS_PLUGIN: () => import_chunk_J5YKJRP3.CHESS_PLUGIN,
|
|
33
|
-
|
|
34
|
-
ChessContainer: () =>
|
|
35
|
-
ChessPanel: () => import_chunk_HPYER4GF.ChessPanel,
|
|
36
|
-
ChessPieces: () => import_chunk_HPYER4GF.ChessPieces,
|
|
33
|
+
ChessComponent: () => import_chunk_YTD6SK5V.ChessComponent,
|
|
34
|
+
ChessContainer: () => import_chunk_TEZPML34.ChessContainer,
|
|
37
35
|
ChessPlugin: () => ChessPlugin,
|
|
38
|
-
Chessboard: () => import_chunk_HPYER4GF.Chessboard,
|
|
39
36
|
IntentResolver: () => IntentResolver,
|
|
40
37
|
ReactSurface: () => ReactSurface,
|
|
41
|
-
boardStyles: () => import_chunk_HPYER4GF.boardStyles,
|
|
42
38
|
meta: () => import_chunk_J5YKJRP3.meta
|
|
43
39
|
});
|
|
44
40
|
module.exports = __toCommonJS(node_exports);
|
|
45
|
-
var
|
|
41
|
+
var import_chunk_TEZPML34 = require("./chunk-TEZPML34.cjs");
|
|
46
42
|
var import_chunk_J5YKJRP3 = require("./chunk-J5YKJRP3.cjs");
|
|
47
|
-
var
|
|
43
|
+
var import_chunk_YTD6SK5V = require("./chunk-YTD6SK5V.cjs");
|
|
48
44
|
var import_app_framework = require("@dxos/app-framework");
|
|
49
45
|
var import_app_framework2 = require("@dxos/app-framework");
|
|
50
46
|
var import_plugin_client = require("@dxos/plugin-client");
|
|
51
47
|
var Artifact = (0, import_app_framework.lazy)(() => import("./artifact-YWL3LBIO.cjs"));
|
|
52
|
-
var IntentResolver = (0, import_app_framework.lazy)(() => import("./intent-resolver-
|
|
53
|
-
var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-
|
|
48
|
+
var IntentResolver = (0, import_app_framework.lazy)(() => import("./intent-resolver-OIFDW46S.cjs"));
|
|
49
|
+
var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-35CG6JQF.cjs"));
|
|
54
50
|
var translations_default = [
|
|
55
51
|
{
|
|
56
52
|
"en-US": {
|
|
@@ -74,7 +70,7 @@ var ChessPlugin = () => (0, import_app_framework2.definePlugin)(import_chunk_J5Y
|
|
|
74
70
|
}),
|
|
75
71
|
(0, import_app_framework2.defineModule)({
|
|
76
72
|
id: `${import_chunk_J5YKJRP3.meta.id}/module/metadata`,
|
|
77
|
-
activatesOn:
|
|
73
|
+
activatesOn: import_app_framework2.Events.SetupMetadata,
|
|
78
74
|
activate: () => (0, import_app_framework2.contributes)(import_app_framework2.Capabilities.Metadata, {
|
|
79
75
|
id: import_chunk_J5YKJRP3.ChessType.typename,
|
|
80
76
|
metadata: {
|
|
@@ -91,19 +87,19 @@ var ChessPlugin = () => (0, import_app_framework2.definePlugin)(import_chunk_J5Y
|
|
|
91
87
|
}),
|
|
92
88
|
(0, import_app_framework2.defineModule)({
|
|
93
89
|
id: `${import_chunk_J5YKJRP3.meta.id}/module/schema`,
|
|
94
|
-
activatesOn: import_plugin_client.ClientEvents.
|
|
90
|
+
activatesOn: import_plugin_client.ClientEvents.SetupSchema,
|
|
95
91
|
activate: () => (0, import_app_framework2.contributes)(import_plugin_client.ClientCapabilities.Schema, [
|
|
96
92
|
import_chunk_J5YKJRP3.ChessType
|
|
97
93
|
])
|
|
98
94
|
}),
|
|
99
95
|
(0, import_app_framework2.defineModule)({
|
|
100
96
|
id: `${import_chunk_J5YKJRP3.meta.id}/module/react-surface`,
|
|
101
|
-
activatesOn: import_app_framework2.Events.
|
|
97
|
+
activatesOn: import_app_framework2.Events.SetupSurfaces,
|
|
102
98
|
activate: ReactSurface
|
|
103
99
|
}),
|
|
104
100
|
(0, import_app_framework2.defineModule)({
|
|
105
101
|
id: `${import_chunk_J5YKJRP3.meta.id}/module/intent-resolver`,
|
|
106
|
-
activatesOn: import_app_framework2.Events.
|
|
102
|
+
activatesOn: import_app_framework2.Events.SetupIntents,
|
|
107
103
|
activate: IntentResolver
|
|
108
104
|
}),
|
|
109
105
|
(0, import_app_framework2.defineModule)({
|
|
@@ -116,15 +112,11 @@ var ChessPlugin = () => (0, import_app_framework2.definePlugin)(import_chunk_J5Y
|
|
|
116
112
|
0 && (module.exports = {
|
|
117
113
|
Artifact,
|
|
118
114
|
CHESS_PLUGIN,
|
|
119
|
-
|
|
115
|
+
ChessComponent,
|
|
120
116
|
ChessContainer,
|
|
121
|
-
ChessPanel,
|
|
122
|
-
ChessPieces,
|
|
123
117
|
ChessPlugin,
|
|
124
|
-
Chessboard,
|
|
125
118
|
IntentResolver,
|
|
126
119
|
ReactSurface,
|
|
127
|
-
boardStyles,
|
|
128
120
|
meta
|
|
129
121
|
});
|
|
130
122
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/capabilities/index.ts", "../../../src/ChessPlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Artifact = lazy(() => import('./artifact'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_app_framework", "Artifact", "lazy", "IntentResolver", "ReactSurface", "ChessType", "typename", "CHESS_PLUGIN", "ChessPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Artifact = lazy(() => import('./artifact'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { Artifact, IntentResolver, ReactSurface } from './capabilities';\nimport { CHESS_PLUGIN, meta } from './meta';\nimport translations from './translations';\nimport { ChessAction, ChessType } from './types';\n\nexport const ChessPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: ChessType.typename,\n metadata: {\n createObject: (props: { name?: string }) => createIntent(ChessAction.Create, props),\n placeholder: ['game title placeholder', { ns: CHESS_PLUGIN }],\n icon: 'ph--shield-chevron--regular',\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => contributes(ClientCapabilities.Schema, [ChessType]),\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupSurfaces,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: IntentResolver,\n }),\n defineModule({\n id: `${meta.id}/module/artifact`,\n activatesOn: Events.Startup,\n activate: Artifact,\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CHESS_PLUGIN } from './meta';\nimport { ChessType } from './types';\n\nexport default [\n {\n 'en-US': {\n [ChessType.typename]: {\n 'typename label': 'Game',\n },\n [CHESS_PLUGIN]: {\n 'plugin name': 'Chess',\n 'game title placeholder': 'New game',\n 'create game label': 'Create game',\n 'delete game label': 'Delete',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAAqB;ACArB,IAAAA,wBAA4F;AAC5F,2BAAiD;ADC1C,IAAMC,eAAWC,2BAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,qBAAiBD,2BAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,mBAAeF,2BAAK,MAAM,OAAO,8BAAA,CAAA;AED9C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACG,gCAAUC,QAAQ,GAAG;QACpB,kBAAkB;MACpB;MACA,CAACC,kCAAAA,GAAe;QACd,eAAe;QACf,0BAA0B;QAC1B,qBAAqB;QACrB,qBAAqB;MACvB;IACF;EACF;;ADRK,IAAMC,cAAc,UACzBC,oCAAaC,4BAAM;MACjBC,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOC;IACpBC,UAAU,UAAMC,mCAAYC,mCAAaC,cAAcC,oBAAAA;EACzD,CAAA;MACAT,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOO;IACpBL,UAAU,UACRC,mCAAYC,mCAAaI,UAAU;MACjCV,IAAIP,gCAAUC;MACdiB,UAAU;QACRC,cAAc,CAACC,cAA6BC,oCAAaC,kCAAYC,QAAQH,KAAAA;QAC7EI,aAAa;UAAC;UAA0B;YAAEC,IAAIvB;UAAa;;QAC3DwB,MAAM;MACR;IACF,CAAA;EACJ,CAAA;MACApB,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAamB,kCAAaC;IAC1BjB,UAAU,UAAMC,mCAAYiB,wCAAmBC,QAAQ;MAAC9B;KAAU;EACpE,CAAA;MACAM,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOsB;IACpBpB,UAAUZ;EACZ,CAAA;MACAO,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOuB;IACpBrB,UAAUb;EACZ,CAAA;MACAQ,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOwB;IACpBtB,UAAUf;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["import_app_framework", "Artifact", "lazy", "IntentResolver", "ReactSurface", "ChessType", "typename", "CHESS_PLUGIN", "ChessPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "metadata", "createObject", "props", "createIntent", "ChessAction", "Create", "placeholder", "ns", "icon", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema", "SetupSurfaces", "SetupIntents", "Startup"]
|
|
7
7
|
}
|
|
@@ -16,25 +16,28 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var intent_resolver_OIFDW46S_exports = {};
|
|
20
|
+
__export(intent_resolver_OIFDW46S_exports, {
|
|
21
21
|
default: () => intent_resolver_default
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(intent_resolver_OIFDW46S_exports);
|
|
24
24
|
var import_chunk_J5YKJRP3 = require("./chunk-J5YKJRP3.cjs");
|
|
25
25
|
var import_chess = require("chess.js");
|
|
26
26
|
var import_app_framework = require("@dxos/app-framework");
|
|
27
27
|
var import_live_object = require("@dxos/live-object");
|
|
28
|
-
var intent_resolver_default = () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.IntentResolver, (0, import_app_framework.createResolver)(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
var intent_resolver_default = () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.IntentResolver, (0, import_app_framework.createResolver)({
|
|
29
|
+
intent: import_chunk_J5YKJRP3.ChessAction.Create,
|
|
30
|
+
resolve: ({ name, fen }) => {
|
|
31
|
+
const pgn = fen ? new import_chess.Chess(fen).pgn() : void 0;
|
|
32
|
+
return {
|
|
33
|
+
data: {
|
|
34
|
+
object: (0, import_live_object.create)(import_chunk_J5YKJRP3.ChessType, {
|
|
35
|
+
name,
|
|
36
|
+
fen,
|
|
37
|
+
pgn
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
39
42
|
}));
|
|
40
|
-
//# sourceMappingURL=intent-resolver-
|
|
43
|
+
//# sourceMappingURL=intent-resolver-OIFDW46S.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess } from 'chess.js';\n\nimport { Capabilities, contributes, createResolver } from '@dxos/app-framework';\nimport { create } from '@dxos/live-object';\n\nimport { ChessAction, ChessType } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ChessAction.Create,\n resolve: ({ name, fen }) => {\n const pgn = fen ? new Chess(fen).pgn() : undefined;\n return {\n data: {\n object: create(ChessType, { name, fen, pgn }),\n },\n };\n },\n }),\n );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAsB;AAEtB,2BAA0D;AAC1D,yBAAuB;AAIvB,IAAA,0BAAe,UACbA,kCACEC,kCAAaC,oBACbC,qCAAe;EACbC,QAAQC,kCAAYC;EACpBC,SAAS,CAAC,EAAEC,MAAMC,IAAG,MAAE;AACrB,UAAMC,MAAMD,MAAM,IAAIE,mBAAMF,GAAAA,EAAKC,IAAG,IAAKE;AACzC,WAAO;MACLC,MAAM;QACJC,YAAQC,2BAAOC,iCAAW;UAAER;UAAMC;UAAKC;QAAI,CAAA;MAC7C;IACF;EACF;AACF,CAAA,CAAA;",
|
|
6
|
+
"names": ["contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ChessAction", "Create", "resolve", "name", "fen", "pgn", "Chess", "undefined", "data", "object", "create", "ChessType"]
|
|
7
|
+
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytes":2700,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/meta.ts":{"bytes":1411,"imports":[],"format":"esm"},"packages/plugins/plugin-chess/src/types/types.ts":{"bytes":3051,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/types/index.ts":{"bytes":586,"imports":[{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/artifact.ts":{"bytes":17413,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytes":2531,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/custom.tsx":{"bytes":32344,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/phosphor.tsx":{"bytes":6674,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/riohacha.tsx":{"bytes":30948,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/index.ts":{"bytes":704,"imports":[{"path":"packages/plugins/plugin-chess/src/components/Chessboard/pieces/custom.tsx","kind":"import-statement","original":"./custom"},{"path":"packages/plugins/plugin-chess/src/components/Chessboard/pieces/phosphor.tsx","kind":"import-statement","original":"./phosphor"},{"path":"packages/plugins/plugin-chess/src/components/Chessboard/pieces/riohacha.tsx","kind":"import-statement","original":"./riohacha"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/Chessboard/Chessboard.tsx":{"bytes":18372,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-chessboard","kind":"import-statement","external":true},{"path":"react-dnd-html5-backend","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/Chessboard/pieces/index.ts","kind":"import-statement","original":"./pieces"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/Chessboard/index.ts":{"bytes":529,"imports":[{"path":"packages/plugins/plugin-chess/src/components/Chessboard/Chessboard.tsx","kind":"import-statement","original":"./Chessboard"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/Chess.tsx":{"bytes":14324,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/invariant","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-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/Chessboard/index.ts","kind":"import-statement","original":"./Chessboard"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytes":2405,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/Chess.tsx","kind":"import-statement","original":"./Chess"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/index.ts":{"bytes":977,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/Chess.tsx","kind":"import-statement","original":"./Chess"},{"path":"packages/plugins/plugin-chess/src/components/Chessboard/index.ts","kind":"import-statement","original":"./Chessboard"},{"path":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","kind":"dynamic-import","original":"./ChessContainer"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytes":4798,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytes":1296,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/artifact.ts","kind":"dynamic-import","original":"./artifact"},{"path":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/plugin-chess/src/translations.ts":{"bytes":1825,"imports":[{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytes":7326,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/index.ts":{"bytes":790,"imports":[{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-chess/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4729},"packages/plugins/plugin-chess/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-6F6WTM5L.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-HPYER4GF.cjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/node/artifact-YWL3LBIO.cjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/node/intent-resolver-AENA6D5K.cjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/node/react-surface-JMOSMAIC.cjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true}],"exports":["Artifact","CHESS_PLUGIN","Chess","ChessContainer","ChessPanel","ChessPieces","ChessPlugin","Chessboard","IntentResolver","ReactSurface","boardStyles","meta"],"entryPoint":"packages/plugins/plugin-chess/src/index.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytesInOutput":252},"packages/plugins/plugin-chess/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytesInOutput":1474},"packages/plugins/plugin-chess/src/translations.ts":{"bytesInOutput":325}},"bytes":2743},"packages/plugins/plugin-chess/dist/lib/node/types/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-chess/dist/lib/node/types/index.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"}],"exports":["ChessAction","ChessType","MoveSchema","isObject"],"entryPoint":"packages/plugins/plugin-chess/src/types/index.ts","inputs":{},"bytes":194},"packages/plugins/plugin-chess/dist/lib/node/artifact-YWL3LBIO.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7574},"packages/plugins/plugin-chess/dist/lib/node/artifact-YWL3LBIO.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/artifact.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/artifact.ts":{"bytesInOutput":5454}},"bytes":5673},"packages/plugins/plugin-chess/dist/lib/node/intent-resolver-AENA6D5K.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1277},"packages/plugins/plugin-chess/dist/lib/node/intent-resolver-AENA6D5K.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytesInOutput":464}},"bytes":704},"packages/plugins/plugin-chess/dist/lib/node/ChessContainer-P4BZ62FN.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1207},"packages/plugins/plugin-chess/dist/lib/node/ChessContainer-P4BZ62FN.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-HPYER4GF.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","inputs":{"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytesInOutput":491}},"bytes":708},"packages/plugins/plugin-chess/dist/lib/node/react-surface-JMOSMAIC.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2316},"packages/plugins/plugin-chess/dist/lib/node/react-surface-JMOSMAIC.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-6F6WTM5L.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-HPYER4GF.cjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytesInOutput":956}},"bytes":1314},"packages/plugins/plugin-chess/dist/lib/node/chunk-6F6WTM5L.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":424},"packages/plugins/plugin-chess/dist/lib/node/chunk-6F6WTM5L.cjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/node/ChessContainer-P4BZ62FN.cjs","kind":"dynamic-import"}],"exports":["ChessContainer"],"inputs":{"packages/plugins/plugin-chess/src/components/index.ts":{"bytesInOutput":104}},"bytes":235},"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3470},"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["CHESS_PLUGIN","ChessAction","ChessType","MoveSchema","isObject","meta"],"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytesInOutput":501},"packages/plugins/plugin-chess/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/types/types.ts":{"bytesInOutput":613},"packages/plugins/plugin-chess/src/meta.ts":{"bytesInOutput":247}},"bytes":1700},"packages/plugins/plugin-chess/dist/lib/node/chunk-HPYER4GF.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":48772},"packages/plugins/plugin-chess/dist/lib/node/chunk-HPYER4GF.cjs":{"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-chessboard","kind":"import-statement","external":true},{"path":"react-dnd-html5-backend","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/invariant","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-theme","kind":"import-statement","external":true}],"exports":["Chess","ChessPanel","ChessPieces","Chessboard","boardStyles"],"inputs":{"packages/plugins/plugin-chess/src/components/Chessboard/Chessboard.tsx":{"bytesInOutput":4712},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/custom.tsx":{"bytesInOutput":12536},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/phosphor.tsx":{"bytesInOutput":1678},"packages/plugins/plugin-chess/src/components/Chessboard/pieces/riohacha.tsx":{"bytesInOutput":11516},"packages/plugins/plugin-chess/src/components/Chess.tsx":{"bytesInOutput":4053},"packages/plugins/plugin-chess/src/components/Chessboard/index.ts":{"bytesInOutput":0}},"bytes":35074}}}
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytes":2700,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/meta.ts":{"bytes":1411,"imports":[],"format":"esm"},"packages/plugins/plugin-chess/src/types/types.ts":{"bytes":3051,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/types/index.ts":{"bytes":586,"imports":[{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/artifact.ts":{"bytes":17413,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytes":2748,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessComponent.tsx":{"bytes":4369,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx":{"bytes":8761,"imports":[{"path":"@phosphor-icons/react","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-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytes":3335,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"./ChessComponent"},{"path":"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx","kind":"import-statement","original":"./PlayerSelector"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/index.ts":{"bytes":908,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"./ChessComponent"},{"path":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","kind":"dynamic-import","original":"./ChessContainer"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytes":3926,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"../components/ChessComponent"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytes":1296,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/artifact.ts","kind":"dynamic-import","original":"./artifact"},{"path":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/plugin-chess/src/translations.ts":{"bytes":1825,"imports":[{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytes":7235,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/index.ts":{"bytes":790,"imports":[{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-chess/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4676},"packages/plugins/plugin-chess/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-TEZPML34.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-YTD6SK5V.cjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/node/artifact-YWL3LBIO.cjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/node/intent-resolver-OIFDW46S.cjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/node/react-surface-35CG6JQF.cjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true}],"exports":["Artifact","CHESS_PLUGIN","ChessComponent","ChessContainer","ChessPlugin","IntentResolver","ReactSurface","meta"],"entryPoint":"packages/plugins/plugin-chess/src/index.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytesInOutput":252},"packages/plugins/plugin-chess/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytesInOutput":1455},"packages/plugins/plugin-chess/src/translations.ts":{"bytesInOutput":325}},"bytes":2626},"packages/plugins/plugin-chess/dist/lib/node/types/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-chess/dist/lib/node/types/index.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"}],"exports":["ChessAction","ChessType","MoveSchema","isObject"],"entryPoint":"packages/plugins/plugin-chess/src/types/index.ts","inputs":{},"bytes":194},"packages/plugins/plugin-chess/dist/lib/node/artifact-YWL3LBIO.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7574},"packages/plugins/plugin-chess/dist/lib/node/artifact-YWL3LBIO.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/artifact.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/artifact.ts":{"bytesInOutput":5454}},"bytes":5673},"packages/plugins/plugin-chess/dist/lib/node/intent-resolver-OIFDW46S.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1374},"packages/plugins/plugin-chess/dist/lib/node/intent-resolver-OIFDW46S.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytesInOutput":511}},"bytes":751},"packages/plugins/plugin-chess/dist/lib/node/ChessContainer-CMYJDMSG.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6188},"packages/plugins/plugin-chess/dist/lib/node/ChessContainer-CMYJDMSG.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-YTD6SK5V.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","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-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","inputs":{"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytesInOutput":811},"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx":{"bytesInOutput":2299}},"bytes":3472},"packages/plugins/plugin-chess/dist/lib/node/react-surface-35CG6JQF.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1850},"packages/plugins/plugin-chess/dist/lib/node/react-surface-35CG6JQF.cjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-TEZPML34.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/node/chunk-YTD6SK5V.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytesInOutput":745}},"bytes":1107},"packages/plugins/plugin-chess/dist/lib/node/chunk-TEZPML34.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":402},"packages/plugins/plugin-chess/dist/lib/node/chunk-TEZPML34.cjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/node/ChessContainer-CMYJDMSG.cjs","kind":"dynamic-import"}],"exports":["ChessContainer"],"inputs":{"packages/plugins/plugin-chess/src/components/index.ts":{"bytesInOutput":104}},"bytes":235},"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3470},"packages/plugins/plugin-chess/dist/lib/node/chunk-J5YKJRP3.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["CHESS_PLUGIN","ChessAction","ChessType","MoveSchema","isObject","meta"],"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytesInOutput":501},"packages/plugins/plugin-chess/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/types/types.ts":{"bytesInOutput":613},"packages/plugins/plugin-chess/src/meta.ts":{"bytesInOutput":247}},"bytes":1700},"packages/plugins/plugin-chess/dist/lib/node/chunk-YTD6SK5V.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2362},"packages/plugins/plugin-chess/dist/lib/node/chunk-YTD6SK5V.cjs":{"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true}],"exports":["ChessComponent"],"inputs":{"packages/plugins/plugin-chess/src/components/ChessComponent.tsx":{"bytesInOutput":955}},"bytes":1096}}}
|
|
@@ -26,15 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var react_surface_35CG6JQF_exports = {};
|
|
30
|
+
__export(react_surface_35CG6JQF_exports, {
|
|
31
31
|
default: () => react_surface_default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(react_surface_35CG6JQF_exports);
|
|
34
|
+
var import_chunk_TEZPML34 = require("./chunk-TEZPML34.cjs");
|
|
35
35
|
var import_chunk_J5YKJRP3 = require("./chunk-J5YKJRP3.cjs");
|
|
36
|
-
var
|
|
37
|
-
var import_chess = require("chess.js");
|
|
36
|
+
var import_chunk_YTD6SK5V = require("./chunk-YTD6SK5V.cjs");
|
|
38
37
|
var import_react = __toESM(require("react"));
|
|
39
38
|
var import_app_framework = require("@dxos/app-framework");
|
|
40
39
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
@@ -46,7 +45,7 @@ var react_surface_default = () => (0, import_app_framework.contributes)(import_a
|
|
|
46
45
|
"section"
|
|
47
46
|
],
|
|
48
47
|
filter: (data) => (0, import_chunk_J5YKJRP3.isObject)(data.subject),
|
|
49
|
-
component: ({ data, role }) => /* @__PURE__ */ import_react.default.createElement(
|
|
48
|
+
component: ({ data, role }) => /* @__PURE__ */ import_react.default.createElement(import_chunk_TEZPML34.ChessContainer, {
|
|
50
49
|
game: data.subject,
|
|
51
50
|
role
|
|
52
51
|
})
|
|
@@ -55,16 +54,9 @@ var react_surface_default = () => (0, import_app_framework.contributes)(import_a
|
|
|
55
54
|
id: "plugin-chess",
|
|
56
55
|
role: "canvas-node",
|
|
57
56
|
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_chunk_J5YKJRP3.ChessType, data),
|
|
58
|
-
component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(
|
|
59
|
-
|
|
60
|
-
chess: new import_chess.Chess(data.fen)
|
|
61
|
-
},
|
|
62
|
-
onUpdate: (move) => {
|
|
63
|
-
const board = new import_chess.Chess(data.fen);
|
|
64
|
-
board.move(move);
|
|
65
|
-
data.value = board.fen();
|
|
66
|
-
}
|
|
57
|
+
component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_chunk_YTD6SK5V.ChessComponent, {
|
|
58
|
+
game: data
|
|
67
59
|
})
|
|
68
60
|
})
|
|
69
61
|
]);
|
|
70
|
-
//# sourceMappingURL=react-surface-
|
|
62
|
+
//# sourceMappingURL=react-surface-35CG6JQF.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\n\nimport { ChessContainer } from '../components';\nimport { ChessComponent } from '../components/ChessComponent';\nimport { CHESS_PLUGIN } from '../meta';\nimport { ChessType, isObject } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: CHESS_PLUGIN,\n role: ['article', 'section'],\n filter: (data): data is { subject: ChessType } => isObject(data.subject),\n component: ({ data, role }) => <ChessContainer game={data.subject} role={role} />,\n }),\n createSurface({\n id: 'plugin-chess',\n role: 'canvas-node',\n filter: (data): data is any => isInstanceOf(ChessType, data),\n component: ({ data }) => <ChessComponent game={data} />,\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,2BAAyD;AACzD,yBAA6B;AAO7B,IAAA,wBAAe,UACbA,kCAAYC,kCAAaC,cAAc;MACrCC,oCAAc;IACZC,IAAIC;IACJC,MAAM;MAAC;MAAW;;IAClBC,QAAQ,CAACC,aAAyCC,gCAASD,KAAKE,OAAO;IACvEC,WAAW,CAAC,EAAEH,MAAMF,KAAI,MAAO,6BAAAM,QAAA,cAACC,sCAAAA;MAAeC,MAAMN,KAAKE;MAASJ;;EACrE,CAAA;MACAH,oCAAc;IACZC,IAAI;IACJE,MAAM;IACNC,QAAQ,CAACC,aAAsBO,iCAAaC,iCAAWR,IAAAA;IACvDG,WAAW,CAAC,EAAEH,KAAI,MAAO,6BAAAI,QAAA,cAACK,sCAAAA;MAAeH,MAAMN;;EACjD,CAAA;CACD;",
|
|
6
|
+
"names": ["contributes", "Capabilities", "ReactSurface", "createSurface", "id", "CHESS_PLUGIN", "role", "filter", "data", "isObject", "subject", "component", "React", "ChessContainer", "game", "isInstanceOf", "ChessType", "ChessComponent"]
|
|
7
|
+
}
|