@dxos/plugin-chess 0.7.5-main.9d2a38b → 0.7.5-main.c41020f
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-XERPODLK.mjs +86 -0
- package/dist/lib/browser/ChessContainer-XERPODLK.mjs.map +7 -0
- package/dist/lib/browser/artifact-definition-D2SD45UX.mjs +180 -0
- package/dist/lib/browser/artifact-definition-D2SD45UX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VHSLLEH3.mjs → chunk-NNA3W3LX.mjs} +17 -11
- package/dist/lib/browser/chunk-NNA3W3LX.mjs.map +7 -0
- package/dist/lib/browser/chunk-R26FYVUS.mjs +8 -0
- package/dist/lib/browser/chunk-R26FYVUS.mjs.map +7 -0
- package/dist/lib/browser/chunk-VRWXC5L2.mjs +42 -0
- package/dist/lib/browser/chunk-VRWXC5L2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +38 -19
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-KBIH2KYC.mjs +28 -0
- package/dist/lib/browser/intent-resolver-KBIH2KYC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-2PI2KNSU.mjs +42 -0
- package/dist/lib/browser/react-surface-2PI2KNSU.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -3
- package/dist/lib/node/ChessContainer-LEPLNICP.cjs +108 -0
- package/dist/lib/node/ChessContainer-LEPLNICP.cjs.map +7 -0
- package/dist/lib/node/artifact-definition-YDPYM4NV.cjs +194 -0
- package/dist/lib/node/artifact-definition-YDPYM4NV.cjs.map +7 -0
- package/dist/lib/node/chunk-CSRNUKOH.cjs +74 -0
- package/dist/lib/node/chunk-CSRNUKOH.cjs.map +7 -0
- package/dist/lib/node/{react-surface-PO42G64E.cjs → chunk-ITDMCBQQ.cjs} +11 -22
- package/dist/lib/node/chunk-ITDMCBQQ.cjs.map +7 -0
- package/dist/lib/node/{chunk-3BLH7NRV.cjs → chunk-VXYRI6VA.cjs} +19 -13
- package/dist/lib/node/chunk-VXYRI6VA.cjs.map +7 -0
- package/dist/lib/node/index.cjs +52 -32
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{intent-resolver-VTB6P3IL.cjs → intent-resolver-TZFKPQOV.cjs} +20 -11
- package/dist/lib/node/intent-resolver-TZFKPQOV.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-OHQIPHSN.cjs +62 -0
- package/dist/lib/node/react-surface-OHQIPHSN.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +6 -6
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/ChessContainer-S76WNBWN.mjs +87 -0
- package/dist/lib/node-esm/ChessContainer-S76WNBWN.mjs.map +7 -0
- package/dist/lib/node-esm/artifact-definition-LHQK5BBZ.mjs +181 -0
- package/dist/lib/node-esm/artifact-definition-LHQK5BBZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6SEDGO5G.mjs +44 -0
- package/dist/lib/node-esm/chunk-6SEDGO5G.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-B72CIN6T.mjs +10 -0
- package/dist/lib/node-esm/chunk-B72CIN6T.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-M2CRYWX5.mjs → chunk-IP66EHSW.mjs} +17 -11
- package/dist/lib/node-esm/chunk-IP66EHSW.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +38 -19
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-MKEQFVZO.mjs → intent-resolver-WBUS64KC.mjs} +18 -9
- package/dist/lib/node-esm/intent-resolver-WBUS64KC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-XX4VFNRS.mjs +43 -0
- package/dist/lib/node-esm/react-surface-XX4VFNRS.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -3
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +11 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -2
- 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 +5 -0
- package/dist/types/src/components/ChessComponent.d.ts.map +1 -0
- package/dist/types/src/components/ChessContainer.d.ts +4 -4
- 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/PlayerSelector.d.ts +7 -0
- package/dist/types/src/components/PlayerSelector.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +4 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +4 -2
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +4 -3
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/package.json +23 -20
- package/src/ChessPlugin.tsx +25 -20
- package/src/capabilities/artifact-definition.ts +115 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +13 -5
- package/src/capabilities/react-surface.tsx +12 -5
- package/src/components/ChessComponent.tsx +49 -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} +3 -50
- package/src/components/index.ts +2 -0
- package/src/index.ts +4 -1
- package/src/meta.ts +3 -1
- package/src/translations.ts +2 -2
- package/src/types/schema.ts +3 -1
- package/src/types/types.ts +6 -5
- package/dist/lib/browser/ChessContainer-JYXOZIDK.mjs +0 -505
- package/dist/lib/browser/ChessContainer-JYXOZIDK.mjs.map +0 -7
- package/dist/lib/browser/chunk-VHSLLEH3.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-FUAOSHHX.mjs +0 -19
- package/dist/lib/browser/intent-resolver-FUAOSHHX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-63EO2PZO.mjs +0 -30
- package/dist/lib/browser/react-surface-63EO2PZO.mjs.map +0 -7
- package/dist/lib/node/ChessContainer-XRP7D63X.cjs +0 -518
- package/dist/lib/node/ChessContainer-XRP7D63X.cjs.map +0 -7
- package/dist/lib/node/chunk-3BLH7NRV.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-VTB6P3IL.cjs.map +0 -7
- package/dist/lib/node/react-surface-PO42G64E.cjs.map +0 -7
- package/dist/lib/node-esm/ChessContainer-37QUCUTD.mjs +0 -507
- package/dist/lib/node-esm/ChessContainer-37QUCUTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-M2CRYWX5.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-MKEQFVZO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-CXEBEDLT.mjs +0 -31
- package/dist/lib/node-esm/react-surface-CXEBEDLT.mjs.map +0 -7
- package/dist/types/src/components/Chess.d.ts +0 -9
- 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 -13
- 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 -43
- package/src/components/Chessboard/Chessboard.tsx +0 -170
- 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,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,SAASA,aAAa;AAEtB,SAASC,cAAcC,aAAaC,sBAAsB;AAC1D,SAASC,cAAc;AAIvB,IAAA,0BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,YAAYC;EACpBC,SAAS,CAAC,EAAEC,MAAMC,IAAG,MAAE;AACrB,UAAMC,MAAMD,MAAM,IAAIE,MAAMF,GAAAA,EAAKC,IAAG,IAAKE;AACzC,WAAO;MACLC,MAAM;QACJC,QAAQC,OAAOC,WAAW;UAAER;UAAMC;UAAKC;QAAI,CAAA;MAC7C;IACF;EACF;AACF,CAAA,CAAA;",
|
|
6
|
+
"names": ["Chess", "Capabilities", "contributes", "createResolver", "create", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ChessAction", "Create", "resolve", "name", "fen", "pgn", "Chess", "undefined", "data", "object", "create", "ChessType"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytes":2461,"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":2799,"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/intent-resolver.ts":{"bytes":1974,"imports":[{"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":15769,"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-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":14027,"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":798,"imports":[{"path":"react","kind":"import-statement","external":true},{"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":2649,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","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":1080,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"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":1819,"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":6788,"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":592,"imports":[{"path":"packages/plugins/plugin-chess/src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-chess/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4360},"packages/plugins/plugin-chess/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VHSLLEH3.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-FUAOSHHX.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/react-surface-63EO2PZO.mjs","kind":"dynamic-import"}],"exports":["CHESS_PLUGIN","ChessPlugin","meta"],"entryPoint":"packages/plugins/plugin-chess/src/index.ts","inputs":{"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytesInOutput":1355},"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytesInOutput":190},"packages/plugins/plugin-chess/src/translations.ts":{"bytesInOutput":324},"packages/plugins/plugin-chess/src/index.ts":{"bytesInOutput":0}},"bytes":2266},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VHSLLEH3.mjs","kind":"import-statement"}],"exports":["ChessAction","GameType","MoveSchema","isObject"],"entryPoint":"packages/plugins/plugin-chess/src/types/index.ts","inputs":{},"bytes":192},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-FUAOSHHX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":978},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-FUAOSHHX.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VHSLLEH3.mjs","kind":"import-statement"},{"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":323}},"bytes":562},"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-JYXOZIDK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":47068},"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-JYXOZIDK.mjs":{"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":"@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":"@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-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}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","inputs":{"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytesInOutput":495},"packages/plugins/plugin-chess/src/components/Chess.tsx":{"bytesInOutput":3989},"packages/plugins/plugin-chess/src/components/Chessboard/Chessboard.tsx":{"bytesInOutput":2364},"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/Chessboard/index.ts":{"bytesInOutput":0}},"bytes":33320},"packages/plugins/plugin-chess/dist/lib/browser/react-surface-63EO2PZO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1559},"packages/plugins/plugin-chess/dist/lib/browser/react-surface-63EO2PZO.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VHSLLEH3.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-JYXOZIDK.mjs","kind":"dynamic-import"}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytesInOutput":434},"packages/plugins/plugin-chess/src/components/index.ts":{"bytesInOutput":104}},"bytes":900},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VHSLLEH3.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3210},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VHSLLEH3.mjs":{"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","GameType","MoveSchema","isObject","meta"],"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytesInOutput":430},"packages/plugins/plugin-chess/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/types/types.ts":{"bytesInOutput":558},"packages/plugins/plugin-chess/src/meta.ts":{"bytesInOutput":247}},"bytes":1573}}}
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-chess/src/meta.ts":{"bytes":2089,"imports":[],"format":"esm"},"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/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-definition.ts":{"bytes":18402,"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/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/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":4522,"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":1365,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts","kind":"dynamic-import","original":"./artifact-definition"},{"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":7895,"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":"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5064},"packages/plugins/plugin-chess/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-R26FYVUS.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-NNA3W3LX.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-D2SD45UX.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-KBIH2KYC.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/react-surface-2PI2KNSU.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":["ArtifactDefinition","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":273},"packages/plugins/plugin-chess/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytesInOutput":1623},"packages/plugins/plugin-chess/src/translations.ts":{"bytesInOutput":325}},"bytes":2825},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-NNA3W3LX.mjs","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/browser/artifact-definition-D2SD45UX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8015},"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-D2SD45UX.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-NNA3W3LX.mjs","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-definition.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts":{"bytesInOutput":5714}},"bytes":5974},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-KBIH2KYC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1374},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-KBIH2KYC.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-NNA3W3LX.mjs","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/browser/ChessContainer-XERPODLK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6188},"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-XERPODLK.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","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/browser/react-surface-2PI2KNSU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1850},"packages/plugins/plugin-chess/dist/lib/browser/react-surface-2PI2KNSU.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-R26FYVUS.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-NNA3W3LX.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","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/browser/chunk-R26FYVUS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":402},"packages/plugins/plugin-chess/dist/lib/browser/chunk-R26FYVUS.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-XERPODLK.mjs","kind":"dynamic-import"}],"exports":["ChessContainer"],"inputs":{"packages/plugins/plugin-chess/src/components/index.ts":{"bytesInOutput":104}},"bytes":235},"packages/plugins/plugin-chess/dist/lib/browser/chunk-NNA3W3LX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3767},"packages/plugins/plugin-chess/dist/lib/browser/chunk-NNA3W3LX.mjs":{"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":513}},"bytes":1966},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2436},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs":{"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":990}},"bytes":1131}}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChessContainer
|
|
3
|
+
} from "./chunk-R26FYVUS.mjs";
|
|
4
|
+
import {
|
|
5
|
+
CHESS_PLUGIN,
|
|
6
|
+
ChessType,
|
|
7
|
+
isObject
|
|
8
|
+
} from "./chunk-NNA3W3LX.mjs";
|
|
9
|
+
import {
|
|
10
|
+
ChessComponent
|
|
11
|
+
} from "./chunk-VRWXC5L2.mjs";
|
|
12
|
+
|
|
13
|
+
// packages/plugins/plugin-chess/src/capabilities/react-surface.tsx
|
|
14
|
+
import React from "react";
|
|
15
|
+
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
16
|
+
import { isInstanceOf } from "@dxos/echo-schema";
|
|
17
|
+
var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
18
|
+
createSurface({
|
|
19
|
+
id: CHESS_PLUGIN,
|
|
20
|
+
role: [
|
|
21
|
+
"article",
|
|
22
|
+
"section"
|
|
23
|
+
],
|
|
24
|
+
filter: (data) => isObject(data.subject),
|
|
25
|
+
component: ({ data, role }) => /* @__PURE__ */ React.createElement(ChessContainer, {
|
|
26
|
+
game: data.subject,
|
|
27
|
+
role
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
createSurface({
|
|
31
|
+
id: "plugin-chess",
|
|
32
|
+
role: "canvas-node",
|
|
33
|
+
filter: (data) => isInstanceOf(ChessType, data),
|
|
34
|
+
component: ({ data }) => /* @__PURE__ */ React.createElement(ChessComponent, {
|
|
35
|
+
game: data
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
]);
|
|
39
|
+
export {
|
|
40
|
+
react_surface_default as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=react-surface-2PI2KNSU.mjs.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,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,oBAAoB;AAO7B,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAIC;IACJC,MAAM;MAAC;MAAW;;IAClBC,QAAQ,CAACC,SAAyCC,SAASD,KAAKE,OAAO;IACvEC,WAAW,CAAC,EAAEH,MAAMF,KAAI,MAAO,sBAAA,cAACM,gBAAAA;MAAeC,MAAML,KAAKE;MAASJ;;EACrE,CAAA;EACAH,cAAc;IACZC,IAAI;IACJE,MAAM;IACNC,QAAQ,CAACC,SAAsBM,aAAaC,WAAWP,IAAAA;IACvDG,WAAW,CAAC,EAAEH,KAAI,MAAO,sBAAA,cAACQ,gBAAAA;MAAeH,MAAML;;EACjD,CAAA;CACD;",
|
|
6
|
+
"names": ["React", "Capabilities", "contributes", "createSurface", "isInstanceOf", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "CHESS_PLUGIN", "role", "filter", "data", "isObject", "subject", "component", "ChessContainer", "game", "isInstanceOf", "ChessType", "ChessComponent"]
|
|
7
|
+
}
|
|
@@ -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_LEPLNICP_exports = {};
|
|
30
|
+
__export(ChessContainer_LEPLNICP_exports, {
|
|
31
|
+
default: () => ChessContainer_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ChessContainer_LEPLNICP_exports);
|
|
34
|
+
var import_chunk_CSRNUKOH = require("./chunk-CSRNUKOH.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_CSRNUKOH.ChessComponent, {
|
|
101
|
+
game
|
|
102
|
+
})), /* @__PURE__ */ import_react.default.createElement(PlayerSelector, {
|
|
103
|
+
space,
|
|
104
|
+
game
|
|
105
|
+
})));
|
|
106
|
+
};
|
|
107
|
+
var ChessContainer_default = ChessContainer;
|
|
108
|
+
//# sourceMappingURL=ChessContainer-LEPLNICP.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
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var artifact_definition_YDPYM4NV_exports = {};
|
|
20
|
+
__export(artifact_definition_YDPYM4NV_exports, {
|
|
21
|
+
default: () => artifact_definition_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(artifact_definition_YDPYM4NV_exports);
|
|
24
|
+
var import_chunk_VXYRI6VA = require("./chunk-VXYRI6VA.cjs");
|
|
25
|
+
var import_chess = require("chess.js");
|
|
26
|
+
var import_effect = require("effect");
|
|
27
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
28
|
+
var import_artifact = require("@dxos/artifact");
|
|
29
|
+
var import_assistant = require("@dxos/assistant");
|
|
30
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
31
|
+
var import_invariant = require("@dxos/invariant");
|
|
32
|
+
var import_types = require("@dxos/plugin-space/types");
|
|
33
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
34
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts";
|
|
35
|
+
var artifact_definition_default = () => {
|
|
36
|
+
const definition = (0, import_artifact.defineArtifact)({
|
|
37
|
+
id: import_chunk_VXYRI6VA.meta.id,
|
|
38
|
+
name: import_chunk_VXYRI6VA.meta.name,
|
|
39
|
+
description: "Provides a simple chess engine.",
|
|
40
|
+
instructions: `
|
|
41
|
+
- If the user's message relates to a chess game, you must return the chess game inside the artifact tag as a valid FEN string with no additional text.
|
|
42
|
+
`,
|
|
43
|
+
schema: import_chunk_VXYRI6VA.ChessType,
|
|
44
|
+
tools: [
|
|
45
|
+
(0, import_artifact.defineTool)(import_chunk_VXYRI6VA.meta.id, {
|
|
46
|
+
name: "create",
|
|
47
|
+
description: "Create a new chess game. Returns the artifact definition for the game.",
|
|
48
|
+
caption: "Creating chess game...",
|
|
49
|
+
schema: import_echo_schema.S.Struct({
|
|
50
|
+
fen: import_echo_schema.S.String.annotations({
|
|
51
|
+
description: "The state of the chess game in the FEN format."
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
execute: async ({ fen }, { extensions }) => {
|
|
55
|
+
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
56
|
+
F: __dxlog_file,
|
|
57
|
+
L: 45,
|
|
58
|
+
S: void 0,
|
|
59
|
+
A: [
|
|
60
|
+
"extensions?.space",
|
|
61
|
+
"'No space'"
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
(0, import_invariant.invariant)(extensions?.dispatch, "No intent dispatcher", {
|
|
65
|
+
F: __dxlog_file,
|
|
66
|
+
L: 46,
|
|
67
|
+
S: void 0,
|
|
68
|
+
A: [
|
|
69
|
+
"extensions?.dispatch",
|
|
70
|
+
"'No intent dispatcher'"
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
const intent = (0, import_effect.pipe)((0, import_app_framework.createIntent)(import_chunk_VXYRI6VA.ChessAction.Create, {
|
|
74
|
+
fen
|
|
75
|
+
}), (0, import_app_framework.chain)(import_types.SpaceAction.AddObject, {
|
|
76
|
+
target: extensions.space
|
|
77
|
+
}));
|
|
78
|
+
const { data, error } = await extensions.dispatch(intent);
|
|
79
|
+
if (!data || error) {
|
|
80
|
+
return import_artifact.ToolResult.Error(error?.message ?? "Failed to create chess game");
|
|
81
|
+
}
|
|
82
|
+
return import_artifact.ToolResult.Success((0, import_assistant.createArtifactElement)(data.id));
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
(0, import_artifact.defineTool)(import_chunk_VXYRI6VA.meta.id, {
|
|
86
|
+
name: "list",
|
|
87
|
+
description: "Query all active chess games.",
|
|
88
|
+
caption: "Getting games...",
|
|
89
|
+
schema: import_echo_schema.S.Struct({}),
|
|
90
|
+
execute: async (_, { extensions }) => {
|
|
91
|
+
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
92
|
+
F: __dxlog_file,
|
|
93
|
+
L: 65,
|
|
94
|
+
S: void 0,
|
|
95
|
+
A: [
|
|
96
|
+
"extensions?.space",
|
|
97
|
+
"'No space'"
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
const { objects: games } = await extensions.space.db.query(import_echo.Filter.schema(import_chunk_VXYRI6VA.ChessType)).run();
|
|
101
|
+
(0, import_invariant.invariant)(games.length > 0, "No chess games found", {
|
|
102
|
+
F: __dxlog_file,
|
|
103
|
+
L: 67,
|
|
104
|
+
S: void 0,
|
|
105
|
+
A: [
|
|
106
|
+
"games.length > 0",
|
|
107
|
+
"'No chess games found'"
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
return import_artifact.ToolResult.Success(games);
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
(0, import_artifact.defineTool)(import_chunk_VXYRI6VA.meta.id, {
|
|
114
|
+
name: "inspect",
|
|
115
|
+
description: "Get the current state of the chess game.",
|
|
116
|
+
caption: "Inspecting game...",
|
|
117
|
+
schema: import_echo_schema.S.Struct({
|
|
118
|
+
id: import_echo_schema.ObjectId
|
|
119
|
+
}),
|
|
120
|
+
execute: async ({ id }, { extensions }) => {
|
|
121
|
+
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
122
|
+
F: __dxlog_file,
|
|
123
|
+
L: 77,
|
|
124
|
+
S: void 0,
|
|
125
|
+
A: [
|
|
126
|
+
"extensions?.space",
|
|
127
|
+
"'No space'"
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
const { objects: games } = await extensions.space.db.query(import_echo.Filter.schema(import_chunk_VXYRI6VA.ChessType)).run();
|
|
131
|
+
const game = games.find((game2) => game2.id === id);
|
|
132
|
+
(0, import_invariant.invariant)((0, import_echo_schema.isInstanceOf)(import_chunk_VXYRI6VA.ChessType, game), void 0, {
|
|
133
|
+
F: __dxlog_file,
|
|
134
|
+
L: 80,
|
|
135
|
+
S: void 0,
|
|
136
|
+
A: [
|
|
137
|
+
"isInstanceOf(ChessType, game)",
|
|
138
|
+
""
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
return import_artifact.ToolResult.Success(game.fen);
|
|
142
|
+
}
|
|
143
|
+
}),
|
|
144
|
+
(0, import_artifact.defineTool)(import_chunk_VXYRI6VA.meta.id, {
|
|
145
|
+
name: "move",
|
|
146
|
+
description: "Make a move in the chess game.",
|
|
147
|
+
caption: "Making chess move...",
|
|
148
|
+
schema: import_echo_schema.S.Struct({
|
|
149
|
+
id: import_echo_schema.ObjectId,
|
|
150
|
+
move: import_echo_schema.S.String.annotations({
|
|
151
|
+
description: "The move to make in the chess game.",
|
|
152
|
+
examples: [
|
|
153
|
+
"e4",
|
|
154
|
+
"Bf3"
|
|
155
|
+
]
|
|
156
|
+
})
|
|
157
|
+
}),
|
|
158
|
+
execute: async ({ id, move }, { extensions }) => {
|
|
159
|
+
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
160
|
+
F: __dxlog_file,
|
|
161
|
+
L: 96,
|
|
162
|
+
S: void 0,
|
|
163
|
+
A: [
|
|
164
|
+
"extensions?.space",
|
|
165
|
+
"'No space'"
|
|
166
|
+
]
|
|
167
|
+
});
|
|
168
|
+
const { objects: games } = await extensions.space.db.query(import_echo.Filter.schema(import_chunk_VXYRI6VA.ChessType)).run();
|
|
169
|
+
const game = games.find((game2) => game2.id === id);
|
|
170
|
+
(0, import_invariant.invariant)((0, import_echo_schema.isInstanceOf)(import_chunk_VXYRI6VA.ChessType, game), void 0, {
|
|
171
|
+
F: __dxlog_file,
|
|
172
|
+
L: 99,
|
|
173
|
+
S: void 0,
|
|
174
|
+
A: [
|
|
175
|
+
"isInstanceOf(ChessType, game)",
|
|
176
|
+
""
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
const board = new import_chess.Chess(game.fen);
|
|
180
|
+
try {
|
|
181
|
+
board.move(move);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
return import_artifact.ToolResult.Error(error.message);
|
|
184
|
+
}
|
|
185
|
+
game.pgn = board.pgn();
|
|
186
|
+
game.fen = board.fen();
|
|
187
|
+
return import_artifact.ToolResult.Success(game.fen);
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.ArtifactDefinition, definition);
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=artifact-definition-YDPYM4NV.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/artifact-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess } from 'chess.js';\nimport { pipe } from 'effect';\n\nimport { Capabilities, chain, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';\nimport { defineArtifact, defineTool, ToolResult } from '@dxos/artifact';\nimport { createArtifactElement } from '@dxos/assistant';\nimport { isInstanceOf, ObjectId, S } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter, type Space } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\nimport { ChessAction, ChessType } from '../types';\n\n// TODO(burdon): Factor out.\ndeclare global {\n interface ToolContextExtensions {\n space?: Space;\n dispatch?: PromiseIntentDispatcher;\n }\n}\n\nexport default () => {\n const definition = defineArtifact({\n id: meta.id,\n name: meta.name,\n description: 'Provides a simple chess engine.',\n instructions: `\n - If the user's message relates to a chess game, you must return the chess game inside the artifact tag as a valid FEN string with no additional text.\n `,\n schema: ChessType,\n tools: [\n defineTool(meta.id, {\n name: 'create',\n description: 'Create a new chess game. Returns the artifact definition for the game.',\n caption: 'Creating chess game...',\n schema: S.Struct({\n fen: S.String.annotations({ description: 'The state of the chess game in the FEN format.' }),\n }),\n execute: async ({ fen }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n invariant(extensions?.dispatch, 'No intent dispatcher');\n const intent = pipe(\n createIntent(ChessAction.Create, { fen }),\n chain(SpaceAction.AddObject, { target: extensions.space }),\n );\n const { data, error } = await extensions.dispatch(intent);\n if (!data || error) {\n return ToolResult.Error(error?.message ?? 'Failed to create chess game');\n }\n\n return ToolResult.Success(createArtifactElement(data.id));\n },\n }),\n defineTool(meta.id, {\n name: 'list',\n description: 'Query all active chess games.',\n caption: 'Getting games...',\n schema: S.Struct({}),\n execute: async (_, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const { objects: games } = await extensions.space.db.query(Filter.schema(ChessType)).run();\n invariant(games.length > 0, 'No chess games found');\n return ToolResult.Success(games);\n },\n }),\n defineTool(meta.id, {\n name: 'inspect',\n description: 'Get the current state of the chess game.',\n caption: 'Inspecting game...',\n schema: S.Struct({ id: ObjectId }),\n execute: async ({ id }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const { objects: games } = await extensions.space.db.query(Filter.schema(ChessType)).run();\n const game = games.find((game) => game.id === id);\n invariant(isInstanceOf(ChessType, game));\n return ToolResult.Success(game.fen);\n },\n }),\n defineTool(meta.id, {\n name: 'move',\n description: 'Make a move in the chess game.',\n caption: 'Making chess move...',\n schema: S.Struct({\n id: ObjectId,\n move: S.String.annotations({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n execute: async ({ id, move }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const { objects: games } = await extensions.space.db.query(Filter.schema(ChessType)).run();\n const game = games.find((game) => game.id === id);\n invariant(isInstanceOf(ChessType, game));\n const board = new Chess(game.fen);\n try {\n board.move(move);\n } catch (error: any) {\n return ToolResult.Error(error.message);\n }\n game.pgn = board.pgn();\n game.fen = board.fen();\n return ToolResult.Success(game.fen);\n },\n }),\n ],\n });\n\n return contributes(Capabilities.ArtifactDefinition, definition);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAsB;AACtB,oBAAqB;AAErB,2BAA6F;AAC7F,sBAAuD;AACvD,uBAAsC;AACtC,yBAA0C;AAC1C,uBAA0B;AAC1B,mBAA4B;AAC5B,kBAAmC;;AAanC,IAAA,8BAAe,MAAA;AACb,QAAMA,iBAAaC,gCAAe;IAChCC,IAAIC,2BAAKD;IACTE,MAAMD,2BAAKC;IACXC,aAAa;IACbC,cAAc;;;IAGdC,QAAQC;IACRC,OAAO;UACLC,4BAAWP,2BAAKD,IAAI;QAClBE,MAAM;QACNC,aAAa;QACbM,SAAS;QACTJ,QAAQK,qBAAEC,OAAO;UACfC,KAAKF,qBAAEG,OAAOC,YAAY;YAAEX,aAAa;UAAiD,CAAA;QAC5F,CAAA;QACAY,SAAS,OAAO,EAAEH,IAAG,GAAI,EAAEI,WAAU,MAAE;AACrCC,0CAAUD,YAAYE,OAAO,YAAA;;;;;;;;;AAC7BD,0CAAUD,YAAYG,UAAU,wBAAA;;;;;;;;;AAChC,gBAAMC,aAASC,wBACbC,mCAAaC,kCAAYC,QAAQ;YAAEZ;UAAI,CAAA,OACvCa,4BAAMC,yBAAYC,WAAW;YAAEC,QAAQZ,WAAWE;UAAM,CAAA,CAAA;AAE1D,gBAAM,EAAEW,MAAMC,MAAK,IAAK,MAAMd,WAAWG,SAASC,MAAAA;AAClD,cAAI,CAACS,QAAQC,OAAO;AAClB,mBAAOC,2BAAWC,MAAMF,OAAOG,WAAW,6BAAA;UAC5C;AAEA,iBAAOF,2BAAWG,YAAQC,wCAAsBN,KAAK7B,EAAE,CAAA;QACzD;MACF,CAAA;UACAQ,4BAAWP,2BAAKD,IAAI;QAClBE,MAAM;QACNC,aAAa;QACbM,SAAS;QACTJ,QAAQK,qBAAEC,OAAO,CAAC,CAAA;QAClBI,SAAS,OAAOqB,GAAG,EAAEpB,WAAU,MAAE;AAC/BC,0CAAUD,YAAYE,OAAO,YAAA;;;;;;;;;AAC7B,gBAAM,EAAEmB,SAASC,MAAK,IAAK,MAAMtB,WAAWE,MAAMqB,GAAGC,MAAMC,mBAAOpC,OAAOC,+BAAAA,CAAAA,EAAYoC,IAAG;AACxFzB,0CAAUqB,MAAMK,SAAS,GAAG,wBAAA;;;;;;;;;AAC5B,iBAAOZ,2BAAWG,QAAQI,KAAAA;QAC5B;MACF,CAAA;UACA9B,4BAAWP,2BAAKD,IAAI;QAClBE,MAAM;QACNC,aAAa;QACbM,SAAS;QACTJ,QAAQK,qBAAEC,OAAO;UAAEX,IAAI4C;QAAS,CAAA;QAChC7B,SAAS,OAAO,EAAEf,GAAE,GAAI,EAAEgB,WAAU,MAAE;AACpCC,0CAAUD,YAAYE,OAAO,YAAA;;;;;;;;;AAC7B,gBAAM,EAAEmB,SAASC,MAAK,IAAK,MAAMtB,WAAWE,MAAMqB,GAAGC,MAAMC,mBAAOpC,OAAOC,+BAAAA,CAAAA,EAAYoC,IAAG;AACxF,gBAAMG,OAAOP,MAAMQ,KAAK,CAACD,UAASA,MAAK7C,OAAOA,EAAAA;AAC9CiB,8CAAU8B,iCAAazC,iCAAWuC,IAAAA,GAAAA,QAAAA;;;;;;;;;AAClC,iBAAOd,2BAAWG,QAAQW,KAAKjC,GAAG;QACpC;MACF,CAAA;UACAJ,4BAAWP,2BAAKD,IAAI;QAClBE,MAAM;QACNC,aAAa;QACbM,SAAS;QACTJ,QAAQK,qBAAEC,OAAO;UACfX,IAAI4C;UACJI,MAAMtC,qBAAEG,OAAOC,YAAY;YACzBX,aAAa;YACb8C,UAAU;cAAC;cAAM;;UACnB,CAAA;QACF,CAAA;QACAlC,SAAS,OAAO,EAAEf,IAAIgD,KAAI,GAAI,EAAEhC,WAAU,MAAE;AAC1CC,0CAAUD,YAAYE,OAAO,YAAA;;;;;;;;;AAC7B,gBAAM,EAAEmB,SAASC,MAAK,IAAK,MAAMtB,WAAWE,MAAMqB,GAAGC,MAAMC,mBAAOpC,OAAOC,+BAAAA,CAAAA,EAAYoC,IAAG;AACxF,gBAAMG,OAAOP,MAAMQ,KAAK,CAACD,UAASA,MAAK7C,OAAOA,EAAAA;AAC9CiB,8CAAU8B,iCAAazC,iCAAWuC,IAAAA,GAAAA,QAAAA;;;;;;;;;AAClC,gBAAMK,QAAQ,IAAIC,mBAAMN,KAAKjC,GAAG;AAChC,cAAI;AACFsC,kBAAMF,KAAKA,IAAAA;UACb,SAASlB,OAAY;AACnB,mBAAOC,2BAAWC,MAAMF,MAAMG,OAAO;UACvC;AACAY,eAAKO,MAAMF,MAAME,IAAG;AACpBP,eAAKjC,MAAMsC,MAAMtC,IAAG;AACpB,iBAAOmB,2BAAWG,QAAQW,KAAKjC,GAAG;QACpC;MACF,CAAA;;EAEJ,CAAA;AAEA,aAAOyC,kCAAYC,kCAAaC,oBAAoBzD,UAAAA;AACtD;",
|
|
6
|
+
"names": ["definition", "defineArtifact", "id", "meta", "name", "description", "instructions", "schema", "ChessType", "tools", "defineTool", "caption", "S", "Struct", "fen", "String", "annotations", "execute", "extensions", "invariant", "space", "dispatch", "intent", "pipe", "createIntent", "ChessAction", "Create", "chain", "SpaceAction", "AddObject", "target", "data", "error", "ToolResult", "Error", "message", "Success", "createArtifactElement", "_", "objects", "games", "db", "query", "Filter", "run", "length", "ObjectId", "game", "find", "isInstanceOf", "move", "examples", "board", "Chess", "pgn", "contributes", "Capabilities", "ArtifactDefinition"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 chunk_CSRNUKOH_exports = {};
|
|
30
|
+
__export(chunk_CSRNUKOH_exports, {
|
|
31
|
+
ChessComponent: () => ChessComponent
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_CSRNUKOH_exports);
|
|
34
|
+
var import_chess = require("chess.js");
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
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
|
+
]);
|
|
51
|
+
const space = (0, import_echo.getSpace)(game);
|
|
52
|
+
if (!space) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const handleDrop = (0, import_react.useCallback)((move) => {
|
|
56
|
+
if (model.makeMove(move)) {
|
|
57
|
+
game.pgn = model.game.pgn();
|
|
58
|
+
game.fen = model.game.fen();
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}, [
|
|
63
|
+
model
|
|
64
|
+
]);
|
|
65
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_gameboard.Board.Root, {
|
|
66
|
+
model,
|
|
67
|
+
onDrop: handleDrop
|
|
68
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_gameboard.Chessboard, null));
|
|
69
|
+
};
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
ChessComponent
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=chunk-CSRNUKOH.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 game.fen = model.game.fen();\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;AACzBL,WAAKU,MAAMT,MAAMD,KAAKU,IAAG;AACzB,aAAO;IACT;AAEA,WAAO;EACT,GACA;IAACT;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
|
+
}
|