@dxos/plugin-chess 0.6.12-main.5cc132e → 0.6.12-main.89e9959

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.
@@ -1,18 +1,15 @@
1
1
  // packages/plugins/plugin-chess/src/meta.tsx
2
- import { ShieldChevron } from "@phosphor-icons/react";
3
- import React from "react";
4
2
  import { pluginMeta } from "@dxos/app-framework";
5
3
  var CHESS_PLUGIN = "dxos.org/plugin/chess";
6
4
  var meta_default = pluginMeta({
7
5
  id: CHESS_PLUGIN,
8
6
  name: "Chess",
9
7
  description: "Play chess.",
10
- iconComponent: (props) => /* @__PURE__ */ React.createElement(ShieldChevron, props),
11
- iconSymbol: "ph--shield-chevron--regular"
8
+ icon: "ph--shield-chevron--regular"
12
9
  });
13
10
 
14
11
  export {
15
12
  CHESS_PLUGIN,
16
13
  meta_default
17
14
  };
18
- //# sourceMappingURL=chunk-HLCMCUXF.mjs.map
15
+ //# sourceMappingURL=chunk-EQ3YGMF3.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\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 icon: 'ph--shield-chevron--regular',\n});\n"],
5
+ "mappings": ";AAIA,SAASA,kBAAkB;AAEpB,IAAMC,eAAe;AAE5B,IAAA,eAAeC,WAAW;EACxBC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;AACR,CAAA;",
6
+ "names": ["pluginMeta", "CHESS_PLUGIN", "pluginMeta", "id", "name", "description", "icon"]
7
+ }
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  CHESS_PLUGIN,
3
3
  meta_default
4
- } from "./chunk-HLCMCUXF.mjs";
4
+ } from "./chunk-EQ3YGMF3.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: (props) => /* @__PURE__ */ React3.createElement(ShieldChevron, props),
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: (props) => /* @__PURE__ */ React3.createElement(ShieldChevron, props),
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 { type IconProps, ShieldChevron } from '@phosphor-icons/react';\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: (props: IconProps) => <ShieldChevron {...props} />,\n iconSymbol: 'ph--shield-chevron--regular',\n },\n },\n },\n echo: {\n schema: [GameType],\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: (props: IconProps) => <ShieldChevron {...props} />,\n iconSymbol: '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';\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\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,SAAyBA,qBAAqB;AAC9C,OAAOC,YAAW;AAElB,SAAgCC,eAAeC,mBAAmBC,wBAAwB;AAC1F,SAASC,YAAAA,iBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,yBAAyB;AAClC,SAA2BC,iBAAiBC,qBAAqB;AACjE,SAASC,mBAAmB;;;ACR5B,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;A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AA;AACT,kBAAQA,OAAO0B,QAAM;YACnB,KAAKvB,YAAYC,QAAQ;AACvB,qBAAO;gBAAEoB,MAAMgB,OAAO5D,WAAU,CAAC,CAAA;cAAG;YACtC;UACF;QACF;MACF;IACF;EACF;AACF;;;AK/FA,IAAA,cAAe6D;",
6
- "names": ["ShieldChevron", "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", "props", "React", "ShieldChevron", "iconSymbol", "echo", "schema", "graph", "builder", "plugins", "client", "resolvePlugin", "parseClientPlugin", "dispatch", "parseIntentPlugin", "intent", "createExtension", "id", "ChessAction", "CREATE", "filter", "node", "isActionGroup", "startsWith", "SpaceAction", "ADD_OBJECT", "actions", "split", "at", "spaceId", "objectId", "space", "spaces", "get", "find", "object", "db", "getObjectById", "target", "data", "plugin", "action", "NavigationAction", "OPEN", "properties", "label", "testId", "translations", "surface", "component", "role", "isObject", "ChessContainer", "game", "resolver", "create", "ChessPlugin"]
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;A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Ae,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.tsx":{"bytes":1870,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/translations.ts":{"bytes":1400,"imports":[{"path":"packages/plugins/plugin-chess/src/meta.tsx","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/types.ts":{"bytes":2481,"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.tsx","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytes":14687,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"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.tsx","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":16715},"packages/plugins/plugin-chess/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-HLCMCUXF.mjs","kind":"import-statement"},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"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":3813},"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":9595},"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-HLCMCUXF.mjs","kind":"import-statement"}],"exports":["CHESS_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-chess/src/meta.tsx","inputs":{},"bytes":159},"packages/plugins/plugin-chess/dist/lib/browser/chunk-HLCMCUXF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":940},"packages/plugins/plugin-chess/dist/lib/browser/chunk-HLCMCUXF.mjs":{"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["CHESS_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-chess/src/meta.tsx":{"bytesInOutput":410}},"bytes":544}}}
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.tsx":{"bytes":1261,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/translations.ts":{"bytes":1400,"imports":[{"path":"packages/plugins/plugin-chess/src/meta.tsx","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.tsx","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.tsx","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-EQ3YGMF3.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-EQ3YGMF3.mjs","kind":"import-statement"}],"exports":["CHESS_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-chess/src/meta.tsx","inputs":{},"bytes":159},"packages/plugins/plugin-chess/dist/lib/browser/chunk-EQ3YGMF3.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":602},"packages/plugins/plugin-chess/dist/lib/browser/chunk-EQ3YGMF3.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["CHESS_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-chess/src/meta.tsx":{"bytesInOutput":235}},"bytes":369}}}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CHESS_PLUGIN,
3
3
  meta_default
4
- } from "./chunk-HLCMCUXF.mjs";
4
+ } from "./chunk-EQ3YGMF3.mjs";
5
5
  export {
6
6
  CHESS_PLUGIN,
7
7
  meta_default as default
@@ -1 +1 @@
1
- {"version":3,"file":"ChessPlugin.d.ts","sourceRoot":"","sources":["../../../src/ChessPlugin.tsx"],"names":[],"mappings":"AAOA,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,CAkFlE,CAAC"}
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,3 @@
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;
@@ -8,8 +6,7 @@ declare const _default: {
8
6
  description?: string;
9
7
  homePage?: string;
10
8
  tags?: string[];
11
- iconComponent?: React.FC<IconProps>;
12
- iconSymbol?: string;
9
+ icon?: string;
13
10
  };
14
11
  export default _default;
15
12
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,YAAY,0BAA0B,CAAC;;;;;;;;;;;AAEpD,wBAMG"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,0BAA0B,CAAC;;;;;;;;;;AAEpD,wBAKG"}
@@ -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;AAM1D,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,CAAC;AAEjB,eAAO,MAAM,QAAQ,WAAY,OAAO,KAAG,MAAM,IAAI,QAEpD,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.12-main.5cc132e",
3
+ "version": "0.6.12-main.89e9959",
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/async": "0.6.12-main.5cc132e",
35
- "@dxos/app-framework": "0.6.12-main.5cc132e",
36
- "@dxos/chess-app": "0.6.12-main.5cc132e",
37
- "@dxos/display-name": "0.6.12-main.5cc132e",
38
- "@dxos/invariant": "0.6.12-main.5cc132e",
39
- "@dxos/plugin-client": "0.6.12-main.5cc132e",
40
- "@dxos/plugin-graph": "0.6.12-main.5cc132e",
41
- "@dxos/echo-schema": "0.6.12-main.5cc132e",
42
- "@dxos/plugin-space": "0.6.12-main.5cc132e",
43
- "@dxos/react-client": "0.6.12-main.5cc132e"
34
+ "@dxos/async": "0.6.12-main.89e9959",
35
+ "@dxos/app-framework": "0.6.12-main.89e9959",
36
+ "@dxos/chess-app": "0.6.12-main.89e9959",
37
+ "@dxos/echo-schema": "0.6.12-main.89e9959",
38
+ "@dxos/display-name": "0.6.12-main.89e9959",
39
+ "@dxos/invariant": "0.6.12-main.89e9959",
40
+ "@dxos/plugin-client": "0.6.12-main.89e9959",
41
+ "@dxos/plugin-graph": "0.6.12-main.89e9959",
42
+ "@dxos/plugin-space": "0.6.12-main.89e9959",
43
+ "@dxos/react-client": "0.6.12-main.89e9959"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@phosphor-icons/react": "^2.1.5",
@@ -49,16 +49,16 @@
49
49
  "react": "~18.2.0",
50
50
  "react-dom": "~18.2.0",
51
51
  "vite": "5.4.7",
52
- "@dxos/react-ui-theme": "0.6.12-main.5cc132e",
53
- "@dxos/storybook-utils": "0.6.12-main.5cc132e",
54
- "@dxos/react-ui": "0.6.12-main.5cc132e"
52
+ "@dxos/react-ui": "0.6.12-main.89e9959",
53
+ "@dxos/react-ui-theme": "0.6.12-main.89e9959",
54
+ "@dxos/storybook-utils": "0.6.12-main.89e9959"
55
55
  },
56
- "optionalDependencies": {
56
+ "peerDependencies": {
57
57
  "@phosphor-icons/react": "^2.1.5",
58
- "react": "^18.0.0",
59
- "react-dom": "^18.0.0",
60
- "@dxos/react-ui": "0.6.12-main.5cc132e",
61
- "@dxos/react-ui-theme": "0.6.12-main.5cc132e"
58
+ "react": "~18.2.0",
59
+ "react-dom": "~18.2.0",
60
+ "@dxos/react-ui-theme": "0.6.12-main.89e9959",
61
+ "@dxos/react-ui": "0.6.12-main.89e9959"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"
@@ -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: (props: IconProps) => <ShieldChevron {...props} />,
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: (props: IconProps) => <ShieldChevron {...props} />,
70
- iconSymbol: 'ph--shield-chevron--regular',
73
+ icon: 'ph--shield-chevron--regular',
71
74
  testId: 'chessPlugin.createObject',
72
75
  },
73
76
  },
package/src/meta.tsx CHANGED
@@ -2,9 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { ShieldChevron, type IconProps } from '@phosphor-icons/react';
6
- import React from 'react';
7
-
8
5
  import { pluginMeta } from '@dxos/app-framework';
9
6
 
10
7
  export const CHESS_PLUGIN = 'dxos.org/plugin/chess';
@@ -13,6 +10,5 @@ export default pluginMeta({
13
10
  id: CHESS_PLUGIN,
14
11
  name: 'Chess',
15
12
  description: 'Play chess.',
16
- iconComponent: (props: IconProps) => <ShieldChevron {...props} />,
17
- iconSymbol: 'ph--shield-chevron--regular',
13
+ icon: 'ph--shield-chevron--regular',
18
14
  });
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,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
- }