@dxos/plugin-chess 0.6.13-staging.1e988a3 → 0.6.14-main.7bd9c89
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/chunk-SP4YZROV.mjs +14 -0
- package/dist/lib/browser/chunk-SP4YZROV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +2 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/ChessPlugin.tsx +8 -5
- package/src/components/index.ts +2 -3
- package/src/meta.ts +14 -0
- package/src/types.ts +3 -1
- package/dist/lib/browser/chunk-HLCMCUXF.mjs +0 -18
- package/dist/lib/browser/chunk-HLCMCUXF.mjs.map +0 -7
- package/src/meta.tsx +0 -18
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// packages/plugins/plugin-chess/src/meta.ts
|
|
2
|
+
var CHESS_PLUGIN = "dxos.org/plugin/chess";
|
|
3
|
+
var meta_default = {
|
|
4
|
+
id: CHESS_PLUGIN,
|
|
5
|
+
name: "Chess",
|
|
6
|
+
description: "Play chess.",
|
|
7
|
+
icon: "ph--shield-chevron--regular"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
CHESS_PLUGIN,
|
|
12
|
+
meta_default
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=chunk-SP4YZROV.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const CHESS_PLUGIN = 'dxos.org/plugin/chess';\n\nexport default {\n id: CHESS_PLUGIN,\n name: 'Chess',\n description: 'Play chess.',\n icon: 'ph--shield-chevron--regular',\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,eAAe;AAE5B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;EACNC,aAAa;EACbC,MAAM;AACR;",
|
|
6
|
+
"names": ["CHESS_PLUGIN", "id", "name", "description", "icon"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CHESS_PLUGIN,
|
|
3
3
|
meta_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SP4YZROV.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-chess/src/ChessPlugin.tsx
|
|
7
|
-
import { ShieldChevron } from "@phosphor-icons/react";
|
|
8
7
|
import React3 from "react";
|
|
9
8
|
import { resolvePlugin, parseIntentPlugin, NavigationAction } from "@dxos/app-framework";
|
|
10
9
|
import { GameType as GameType2 } from "@dxos/chess-app";
|
|
@@ -187,8 +186,7 @@ var ChessPlugin = () => {
|
|
|
187
186
|
ns: CHESS_PLUGIN
|
|
188
187
|
}
|
|
189
188
|
],
|
|
190
|
-
icon:
|
|
191
|
-
iconSymbol: "ph--shield-chevron--regular"
|
|
189
|
+
icon: "ph--shield-chevron--regular"
|
|
192
190
|
}
|
|
193
191
|
}
|
|
194
192
|
},
|
|
@@ -197,6 +195,17 @@ var ChessPlugin = () => {
|
|
|
197
195
|
GameType2
|
|
198
196
|
]
|
|
199
197
|
},
|
|
198
|
+
space: {
|
|
199
|
+
onSpaceCreate: {
|
|
200
|
+
label: [
|
|
201
|
+
"create game label",
|
|
202
|
+
{
|
|
203
|
+
ns: CHESS_PLUGIN
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
action: ChessAction.CREATE
|
|
207
|
+
}
|
|
208
|
+
},
|
|
200
209
|
graph: {
|
|
201
210
|
builder: (plugins) => {
|
|
202
211
|
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
@@ -243,8 +252,7 @@ var ChessPlugin = () => {
|
|
|
243
252
|
ns: CHESS_PLUGIN
|
|
244
253
|
}
|
|
245
254
|
],
|
|
246
|
-
icon:
|
|
247
|
-
iconSymbol: "ph--shield-chevron--regular",
|
|
255
|
+
icon: "ph--shield-chevron--regular",
|
|
248
256
|
testId: "chessPlugin.createObject"
|
|
249
257
|
}
|
|
250
258
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ChessPlugin.tsx", "../../../src/components/ChessContainer.tsx", "../../../src/components/Chess.tsx", "../../../src/translations.ts", "../../../src/types.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";;;;;;AAIA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type PluginDefinition, resolvePlugin, parseIntentPlugin, NavigationAction } from '@dxos/app-framework';\nimport { GameType } from '@dxos/chess-app';\nimport { create } from '@dxos/echo-schema';\nimport { parseClientPlugin } from '@dxos/plugin-client';\nimport { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';\nimport { SpaceAction } from '@dxos/plugin-space';\n\nimport ChessContainer from './components/ChessContainer';\nimport meta, { CHESS_PLUGIN } from './meta';\nimport translations from './translations';\nimport { ChessAction, type ChessPluginProvides, isObject } from './types';\n\nexport const ChessPlugin = (): PluginDefinition<ChessPluginProvides> => {\n return {\n meta,\n provides: {\n metadata: {\n records: {\n [GameType.typename]: {\n placeholder: ['game title placeholder', { ns: CHESS_PLUGIN }],\n icon: 'ph--shield-chevron--regular',\n },\n },\n },\n echo: {\n schema: [GameType],\n },\n space: {\n onSpaceCreate: {\n label: ['create game label', { ns: CHESS_PLUGIN }],\n action: ChessAction.CREATE,\n },\n },\n graph: {\n builder: (plugins) => {\n const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;\n const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;\n if (!client || !dispatch) {\n return [];\n }\n\n return createExtension({\n id: ChessAction.CREATE,\n filter: (node): node is ActionGroup => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),\n actions: ({ node }) => {\n const id = node.id.split('/').at(-1);\n const [spaceId, objectId] = id?.split(':') ?? [];\n const space = client.spaces.get().find((space) => space.id === spaceId);\n const object = objectId && space?.db.getObjectById(objectId);\n const target = objectId ? object : space;\n if (!target) {\n return;\n }\n\n return [\n {\n id: `${CHESS_PLUGIN}/create/${node.id}`,\n data: async () => {\n await dispatch([\n { plugin: CHESS_PLUGIN, action: ChessAction.CREATE },\n { action: SpaceAction.ADD_OBJECT, data: { target } },\n { action: NavigationAction.OPEN },\n ]);\n },\n properties: {\n label: ['create game label', { ns: CHESS_PLUGIN }],\n icon: 'ph--shield-chevron--regular',\n testId: 'chessPlugin.createObject',\n },\n },\n ];\n },\n });\n },\n },\n translations,\n surface: {\n component: ({ data, role }) => {\n switch (role) {\n case 'article':\n case 'section':\n return isObject(data.object) ? <ChessContainer game={data.object} role={role} /> : null;\n default:\n return null;\n }\n },\n },\n intent: {\n resolver: (intent) => {\n switch (intent.action) {\n case ChessAction.CREATE: {\n return { data: create(GameType, {}) };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ComponentProps } from 'react';\n\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { Chess } from './Chess';\n\nconst ChessContainer = ({ game, role }: Pick<ComponentProps<typeof Chess>, 'game'> & { role?: string }) => {\n const space = getSpace(game);\n if (!space) {\n return null;\n }\n\n return (\n <div role='none' className='flex flex-col row-span-2 is-full overflow-hidden'>\n <Chess game={game} space={space} playerSelector={role === 'article'} />\n </div>\n );\n};\n\nexport default ChessContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { CrownCross } from '@phosphor-icons/react';\nimport { Chess as ChessJs } from 'chess.js';\nimport React, { useEffect, useState } from 'react';\n\nimport { Chessboard, type ChessModel, type ChessMove, type GameType } from '@dxos/chess-app';\nimport { generateName } from '@dxos/display-name';\nimport { invariant } from '@dxos/invariant';\nimport { type SpaceMember, useMembers, type Space } from '@dxos/react-client/echo';\nimport { Input, Select, useThemeContext } from '@dxos/react-ui';\nimport { getSize, mx } from '@dxos/react-ui-theme';\n\nconst useChessModel = (game: GameType) => {\n const [model, setModel] = useState<ChessModel>();\n\n useEffect(() => {\n if (!model || game.pgn !== model?.chess.pgn()) {\n const chess = new ChessJs();\n if (game.pgn) {\n chess.loadPgn(game.pgn);\n }\n\n setModel({ chess });\n }\n }, [game.pgn]);\n\n const handleUpdate = (move: ChessMove) => {\n invariant(model);\n if (model.chess.move(move)) {\n game!.pgn = model.chess.pgn();\n setModel({ ...model });\n }\n };\n\n return { model, handleUpdate };\n};\n\nexport const Chess = ({ space, game, playerSelector }: { space: Space; game: GameType; playerSelector?: boolean }) => {\n const { model, handleUpdate } = useChessModel(game);\n if (!model) {\n return null;\n }\n\n return (\n <div role='none' className='grid grid-rows-[60px_1fr_60px] grow overflow-hidden'>\n <div />\n <div className='flex grow justify-center overflow-hidden'>\n <div className='flex grow max-w-[600px] items-center overflow-hidden'>\n <Chessboard model={model} onUpdate={handleUpdate} />\n </div>\n </div>\n {playerSelector && <PlayerSelector game={game} space={space} />}\n </div>\n );\n};\n\nconst PlayerSelector = ({ game, space }: { game: GameType; space: Space }) => {\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", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CHESS_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\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", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type {\n GraphBuilderProvides,\n IntentResolverProvides,\n MetadataRecordsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport { GameType } from '@dxos/chess-app';\nimport { isReactiveObject } from '@dxos/echo-schema';\nimport { type SchemaProvides } from '@dxos/plugin-client';\nimport { type SpaceInitProvides } from '@dxos/plugin-space';\n\nimport { CHESS_PLUGIN } from './meta';\n\nconst CHESS_ACTION = `${CHESS_PLUGIN}/action`;\n\nexport enum ChessAction {\n CREATE = `${CHESS_ACTION}/create`,\n}\n\nexport type ChessProvides = {};\n\nexport type ChessPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n MetadataRecordsProvides &\n TranslationsProvides &\n SchemaProvides &\n SpaceInitProvides;\n\nexport const isObject = (object: unknown): object is GameType => {\n return isReactiveObject(object) && object instanceof GameType;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ChessPlugin } from './ChessPlugin';\n\nexport default ChessPlugin;\n\nexport * from './ChessPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAAgCC,eAAeC,mBAAmBC,wBAAwB;AAC1F,SAASC,YAAAA,iBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,yBAAyB;AAClC,SAA2BC,iBAAiBC,qBAAqB;AACjE,SAASC,mBAAmB;;;ACP5B,OAAOC,YAAoC;AAE3C,SAASC,gBAAgB;;;ACFzB,SAASC,kBAAkB;AAC3B,SAASC,SAASC,eAAe;AACjC,OAAOC,SAASC,WAAWC,gBAAgB;AAE3C,SAASC,kBAAkE;AAC3E,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAA2BC,kBAA8B;AACzD,SAASC,OAAOC,QAAQC,uBAAuB;AAC/C,SAASC,SAASC,UAAU;;AAE5B,IAAMC,gBAAgB,CAACC,SAAAA;AACrB,QAAM,CAACC,OAAOC,QAAAA,IAAYb,SAAAA;AAE1BD,YAAU,MAAA;AACR,QAAI,CAACa,SAASD,KAAKG,QAAQF,OAAOG,MAAMD,IAAAA,GAAO;AAC7C,YAAMC,QAAQ,IAAIlB,QAAAA;AAClB,UAAIc,KAAKG,KAAK;AACZC,cAAMC,QAAQL,KAAKG,GAAG;MACxB;AAEAD,eAAS;QAAEE;MAAM,CAAA;IACnB;EACF,GAAG;IAACJ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OAAAA;AAC/D,oBAAMK,SAASJ,YAAY3B,OAAOgC,GAAGC,cAAcN,QAAAA;AACnD,oBAAMO,SAASP,WAAWI,SAAS/B;AACnC,kBAAI,CAACkC,QAAQ;AACX;cACF;AAEA,qBAAO;gBACL;kBACElB,IAAI,GAAGpB,YAAAA,WAAuBsB,KAAKF,EAAE;kBACrCmB,MAAM,YAAA;AACJ,0BAAMvB,SAAS;sBACb;wBAAEwB,QAAQxC;wBAAcO,QAAQC,YAAYC;sBAAO;sBACnD;wBAAEF,QAAQkB,YAAYC;wBAAYa,MAAM;0BAAED;wBAAO;sBAAE;sBACnD;wBAAE/B,QAAQkC,iBAAiBC;sBAAK;qBACjC;kBACH;kBACAC,YAAY;oBACVrC,OAAO;sBAAC;sBAAqB;wBAAEP,IAAIC;sBAAa;;oBAChDC,MAAM;oBACN2C,QAAQ;kBACV;gBACF;;YAEJ;UACF,CAAA;QACF;MACF;MACAC;MACAC,SAAS;QACPC,WAAW,CAAC,EAAER,MAAMS,KAAI,MAAE;AACxB,kBAAQA,MAAAA;YACN,KAAK;YACL,KAAK;AACH,qBAAOC,SAASV,KAAKJ,MAAM,IAAI,gBAAAe,OAAA,cAACC,wBAAAA;gBAAeC,MAAMb,KAAKJ;gBAAQa;mBAAiB;YACrF;AACE,qBAAO;UACX;QACF;MACF;MACA9B,QAAQ;QACNmC,UAAU,CAACnC,WAAAA;AACT,kBAAQA,OAAOX,QAAM;YACnB,KAAKC,YAAYC,QAAQ;AACvB,qBAAO;gBAAE8B,MAAMe,OAAO1D,WAAU,CAAC,CAAA;cAAG;YACtC;UACF;QACF;MACF;IACF;EACF;AACF;;;AKlGA,IAAA,cAAe2D;",
|
|
6
|
+
"names": ["React", "resolvePlugin", "parseIntentPlugin", "NavigationAction", "GameType", "create", "parseClientPlugin", "createExtension", "isActionGroup", "SpaceAction", "React", "getSpace", "CrownCross", "Chess", "ChessJs", "React", "useEffect", "useState", "Chessboard", "generateName", "invariant", "useMembers", "Input", "Select", "useThemeContext", "getSize", "mx", "useChessModel", "game", "model", "setModel", "pgn", "chess", "loadPgn", "handleUpdate", "move", "space", "playerSelector", "div", "role", "className", "onUpdate", "PlayerSelector", "members", "key", "PlayerSelect", "side", "value", "playerWhite", "onValueChange", "player", "playerBlack", "themeMode", "iconFillMode", "undefined", "Root", "Label", "weight", "aria-label", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "map", "member", "memberKey", "identity", "identityKey", "toHex", "displayName", "profile", "Option", "ChessContainer", "game", "role", "space", "getSpace", "React", "div", "className", "Chess", "playerSelector", "CHESS_PLUGIN", "GameType", "isReactiveObject", "CHESS_ACTION", "CHESS_PLUGIN", "ChessAction", "isObject", "object", "isReactiveObject", "GameType", "ChessPlugin", "meta", "provides", "metadata", "records", "GameType", "typename", "placeholder", "ns", "CHESS_PLUGIN", "icon", "echo", "schema", "space", "onSpaceCreate", "label", "action", "ChessAction", "CREATE", "graph", "builder", "plugins", "client", "resolvePlugin", "parseClientPlugin", "dispatch", "parseIntentPlugin", "intent", "createExtension", "id", "filter", "node", "isActionGroup", "startsWith", "SpaceAction", "ADD_OBJECT", "actions", "split", "at", "spaceId", "objectId", "spaces", "get", "find", "object", "db", "getObjectById", "target", "data", "plugin", "NavigationAction", "OPEN", "properties", "testId", "translations", "surface", "component", "role", "isObject", "React", "ChessContainer", "game", "resolver", "create", "ChessPlugin"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-chess/src/components/Chess.tsx":{"bytes":13998,"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/chess-app","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}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytes":2328,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","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/meta.
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-chess/src/components/Chess.tsx":{"bytes":13998,"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/chess-app","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}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytes":2328,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","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/meta.ts":{"bytes":1150,"imports":[],"format":"esm"},"packages/plugins/plugin-chess/src/translations.ts":{"bytes":1400,"imports":[{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/types.ts":{"bytes":2597,"imports":[{"path":"@dxos/chess-app","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytes":14636,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/chess-app","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","kind":"import-statement","original":"./components/ChessContainer"},{"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.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/index.ts":{"bytes":769,"imports":[{"path":"packages/plugins/plugin-chess/src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"},{"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":16654},"packages/plugins/plugin-chess/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-SP4YZROV.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/chess-app","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","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/chess-app","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":"@dxos/chess-app","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["ChessPlugin","default"],"entryPoint":"packages/plugins/plugin-chess/src/index.ts","inputs":{"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytesInOutput":3780},"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytesInOutput":497},"packages/plugins/plugin-chess/src/components/Chess.tsx":{"bytesInOutput":3992},"packages/plugins/plugin-chess/src/translations.ts":{"bytesInOutput":253},"packages/plugins/plugin-chess/src/types.ts":{"bytesInOutput":400},"packages/plugins/plugin-chess/src/index.ts":{"bytesInOutput":31}},"bytes":9562},"packages/plugins/plugin-chess/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-chess/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-SP4YZROV.mjs","kind":"import-statement"}],"exports":["CHESS_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-chess/src/meta.ts","inputs":{},"bytes":159},"packages/plugins/plugin-chess/dist/lib/browser/chunk-SP4YZROV.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":556},"packages/plugins/plugin-chess/dist/lib/browser/chunk-SP4YZROV.mjs":{"imports":[],"exports":["CHESS_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-chess/src/meta.ts":{"bytesInOutput":173}},"bytes":306}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChessPlugin.d.ts","sourceRoot":"","sources":["../../../src/ChessPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChessPlugin.d.ts","sourceRoot":"","sources":["../../../src/ChessPlugin.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,gBAAgB,EAAsD,MAAM,qBAAqB,CAAC;AAUhH,OAAO,EAAe,KAAK,mBAAmB,EAAY,MAAM,SAAS,CAAC;AAE1E,eAAO,MAAM,WAAW,QAAO,gBAAgB,CAAC,mBAAmB,CAsFlE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const ChessContainer: React.LazyExoticComponent<({ game, role }: Pick<React.ComponentProps<typeof import("./Chess").Chess>, "game"> & {
|
|
1
|
+
export declare const ChessContainer: import("react").LazyExoticComponent<({ game, role }: Pick<import("react").ComponentProps<typeof import("./Chess").Chess>, "game"> & {
|
|
3
2
|
role?: string;
|
|
4
|
-
}) =>
|
|
3
|
+
}) => import("react").JSX.Element | null>;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc;QACuG,CAAC;yCAD/D,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { type IconProps } from '@phosphor-icons/react';
|
|
2
|
-
import React from 'react';
|
|
3
1
|
export declare const CHESS_PLUGIN = "dxos.org/plugin/chess";
|
|
4
2
|
declare const _default: {
|
|
5
3
|
id: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
homePage?: string;
|
|
10
|
-
tags?: string[];
|
|
11
|
-
iconComponent?: React.FC<IconProps>;
|
|
12
|
-
iconSymbol?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
icon: string;
|
|
13
7
|
};
|
|
14
8
|
export default _default;
|
|
15
9
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,0BAA0B,CAAC;;;;;;;AAEpD,wBAKuB"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { GraphBuilderProvides, IntentResolverProvides, MetadataRecordsProvides, SurfaceProvides, TranslationsProvides } from '@dxos/app-framework';
|
|
2
2
|
import { GameType } from '@dxos/chess-app';
|
|
3
3
|
import { type SchemaProvides } from '@dxos/plugin-client';
|
|
4
|
+
import { type SpaceInitProvides } from '@dxos/plugin-space';
|
|
4
5
|
export declare enum ChessAction {
|
|
5
6
|
CREATE = "dxos.org/plugin/chess/action/create"
|
|
6
7
|
}
|
|
7
8
|
export type ChessProvides = {};
|
|
8
|
-
export type ChessPluginProvides = SurfaceProvides & IntentResolverProvides & GraphBuilderProvides & MetadataRecordsProvides & TranslationsProvides & SchemaProvides;
|
|
9
|
+
export type ChessPluginProvides = SurfaceProvides & IntentResolverProvides & GraphBuilderProvides & MetadataRecordsProvides & TranslationsProvides & SchemaProvides & SpaceInitProvides;
|
|
9
10
|
export declare const isObject: (object: unknown) => object is GameType;
|
|
10
11
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM5D,oBAAY,WAAW;IACrB,MAAM,wCAA2B;CAClC;AAED,MAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAE/B,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAC/C,sBAAsB,GACtB,oBAAoB,GACpB,uBAAuB,GACvB,oBAAoB,GACpB,cAAc,GACd,iBAAiB,CAAC;AAEpB,eAAO,MAAM,QAAQ,WAAY,OAAO,KAAG,MAAM,IAAI,QAEpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-chess",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14-main.7bd9c89",
|
|
4
4
|
"description": "Chess for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@preact/signals-core": "^1.6.0",
|
|
33
33
|
"chess.js": "^1.0.0-beta.8",
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/app
|
|
36
|
-
"@dxos/display-name": "0.6.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/invariant": "0.6.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/plugin-
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/plugin-space": "0.6.
|
|
43
|
-
"@dxos/react-client": "0.6.
|
|
34
|
+
"@dxos/async": "0.6.14-main.7bd9c89",
|
|
35
|
+
"@dxos/chess-app": "0.6.14-main.7bd9c89",
|
|
36
|
+
"@dxos/display-name": "0.6.14-main.7bd9c89",
|
|
37
|
+
"@dxos/app-framework": "0.6.14-main.7bd9c89",
|
|
38
|
+
"@dxos/invariant": "0.6.14-main.7bd9c89",
|
|
39
|
+
"@dxos/plugin-client": "0.6.14-main.7bd9c89",
|
|
40
|
+
"@dxos/plugin-graph": "0.6.14-main.7bd9c89",
|
|
41
|
+
"@dxos/echo-schema": "0.6.14-main.7bd9c89",
|
|
42
|
+
"@dxos/plugin-space": "0.6.14-main.7bd9c89",
|
|
43
|
+
"@dxos/react-client": "0.6.14-main.7bd9c89"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"@types/react-dom": "~18.2.0",
|
|
49
49
|
"react": "~18.2.0",
|
|
50
50
|
"react-dom": "~18.2.0",
|
|
51
|
-
"vite": "
|
|
52
|
-
"@dxos/react-ui": "0.6.
|
|
53
|
-
"@dxos/react-ui-theme": "0.6.
|
|
54
|
-
"@dxos/storybook-utils": "0.6.
|
|
51
|
+
"vite": "5.4.7",
|
|
52
|
+
"@dxos/react-ui": "0.6.14-main.7bd9c89",
|
|
53
|
+
"@dxos/react-ui-theme": "0.6.14-main.7bd9c89",
|
|
54
|
+
"@dxos/storybook-utils": "0.6.14-main.7bd9c89"
|
|
55
55
|
},
|
|
56
|
-
"
|
|
56
|
+
"peerDependencies": {
|
|
57
57
|
"@phosphor-icons/react": "^2.1.5",
|
|
58
|
-
"react": "
|
|
59
|
-
"react-dom": "
|
|
60
|
-
"@dxos/react-ui
|
|
61
|
-
"@dxos/react-ui": "0.6.
|
|
58
|
+
"react": "~18.2.0",
|
|
59
|
+
"react-dom": "~18.2.0",
|
|
60
|
+
"@dxos/react-ui": "0.6.14-main.7bd9c89",
|
|
61
|
+
"@dxos/react-ui-theme": "0.6.14-main.7bd9c89"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
package/src/ChessPlugin.tsx
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type IconProps, ShieldChevron } from '@phosphor-icons/react';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import { type PluginDefinition, resolvePlugin, parseIntentPlugin, NavigationAction } from '@dxos/app-framework';
|
|
@@ -25,14 +24,19 @@ export const ChessPlugin = (): PluginDefinition<ChessPluginProvides> => {
|
|
|
25
24
|
records: {
|
|
26
25
|
[GameType.typename]: {
|
|
27
26
|
placeholder: ['game title placeholder', { ns: CHESS_PLUGIN }],
|
|
28
|
-
icon:
|
|
29
|
-
iconSymbol: 'ph--shield-chevron--regular',
|
|
27
|
+
icon: 'ph--shield-chevron--regular',
|
|
30
28
|
},
|
|
31
29
|
},
|
|
32
30
|
},
|
|
33
31
|
echo: {
|
|
34
32
|
schema: [GameType],
|
|
35
33
|
},
|
|
34
|
+
space: {
|
|
35
|
+
onSpaceCreate: {
|
|
36
|
+
label: ['create game label', { ns: CHESS_PLUGIN }],
|
|
37
|
+
action: ChessAction.CREATE,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
36
40
|
graph: {
|
|
37
41
|
builder: (plugins) => {
|
|
38
42
|
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
@@ -66,8 +70,7 @@ export const ChessPlugin = (): PluginDefinition<ChessPluginProvides> => {
|
|
|
66
70
|
},
|
|
67
71
|
properties: {
|
|
68
72
|
label: ['create game label', { ns: CHESS_PLUGIN }],
|
|
69
|
-
icon:
|
|
70
|
-
iconSymbol: 'ph--shield-chevron--regular',
|
|
73
|
+
icon: 'ph--shield-chevron--regular',
|
|
71
74
|
testId: 'chessPlugin.createObject',
|
|
72
75
|
},
|
|
73
76
|
},
|
package/src/components/index.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
export const ChessContainer = React.lazy(() => import('./ChessContainer'));
|
|
7
|
+
export const ChessContainer = lazy(() => import('./ChessContainer'));
|
package/src/meta.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
export const CHESS_PLUGIN = 'dxos.org/plugin/chess';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
id: CHESS_PLUGIN,
|
|
11
|
+
name: 'Chess',
|
|
12
|
+
description: 'Play chess.',
|
|
13
|
+
icon: 'ph--shield-chevron--regular',
|
|
14
|
+
} satisfies PluginMeta;
|
package/src/types.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
import { GameType } from '@dxos/chess-app';
|
|
13
13
|
import { isReactiveObject } from '@dxos/echo-schema';
|
|
14
14
|
import { type SchemaProvides } from '@dxos/plugin-client';
|
|
15
|
+
import { type SpaceInitProvides } from '@dxos/plugin-space';
|
|
15
16
|
|
|
16
17
|
import { CHESS_PLUGIN } from './meta';
|
|
17
18
|
|
|
@@ -28,7 +29,8 @@ export type ChessPluginProvides = SurfaceProvides &
|
|
|
28
29
|
GraphBuilderProvides &
|
|
29
30
|
MetadataRecordsProvides &
|
|
30
31
|
TranslationsProvides &
|
|
31
|
-
SchemaProvides
|
|
32
|
+
SchemaProvides &
|
|
33
|
+
SpaceInitProvides;
|
|
32
34
|
|
|
33
35
|
export const isObject = (object: unknown): object is GameType => {
|
|
34
36
|
return isReactiveObject(object) && object instanceof GameType;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-chess/src/meta.tsx
|
|
2
|
-
import { ShieldChevron } from "@phosphor-icons/react";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { pluginMeta } from "@dxos/app-framework";
|
|
5
|
-
var CHESS_PLUGIN = "dxos.org/plugin/chess";
|
|
6
|
-
var meta_default = pluginMeta({
|
|
7
|
-
id: CHESS_PLUGIN,
|
|
8
|
-
name: "Chess",
|
|
9
|
-
description: "Play chess.",
|
|
10
|
-
iconComponent: (props) => /* @__PURE__ */ React.createElement(ShieldChevron, props),
|
|
11
|
-
iconSymbol: "ph--shield-chevron--regular"
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
CHESS_PLUGIN,
|
|
16
|
-
meta_default
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-HLCMCUXF.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ShieldChevron, type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport { pluginMeta } from '@dxos/app-framework';\n\nexport const CHESS_PLUGIN = 'dxos.org/plugin/chess';\n\nexport default pluginMeta({\n id: CHESS_PLUGIN,\n name: 'Chess',\n description: 'Play chess.',\n iconComponent: (props: IconProps) => <ShieldChevron {...props} />,\n iconSymbol: 'ph--shield-chevron--regular',\n});\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,qBAAqC;AAC9C,OAAOC,WAAW;AAElB,SAASC,kBAAkB;AAEpB,IAAMC,eAAe;AAE5B,IAAA,eAAeC,WAAW;EACxBC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,eAAe,CAACC,UAAqB,sBAAA,cAACC,eAAkBD,KAAAA;EACxDE,YAAY;AACd,CAAA;",
|
|
6
|
-
"names": ["ShieldChevron", "React", "pluginMeta", "CHESS_PLUGIN", "pluginMeta", "id", "name", "description", "iconComponent", "props", "ShieldChevron", "iconSymbol"]
|
|
7
|
-
}
|
package/src/meta.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { ShieldChevron, type IconProps } from '@phosphor-icons/react';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { pluginMeta } from '@dxos/app-framework';
|
|
9
|
-
|
|
10
|
-
export const CHESS_PLUGIN = 'dxos.org/plugin/chess';
|
|
11
|
-
|
|
12
|
-
export default pluginMeta({
|
|
13
|
-
id: CHESS_PLUGIN,
|
|
14
|
-
name: 'Chess',
|
|
15
|
-
description: 'Play chess.',
|
|
16
|
-
iconComponent: (props: IconProps) => <ShieldChevron {...props} />,
|
|
17
|
-
iconSymbol: 'ph--shield-chevron--regular',
|
|
18
|
-
});
|