@dxos/plugin-chess 0.7.5-labs.a279d8c → 0.7.5-labs.ea4b4c2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/ChessContainer-2MMUB5S7.mjs +86 -0
- package/dist/lib/browser/ChessContainer-2MMUB5S7.mjs.map +7 -0
- package/dist/lib/browser/{artifact-YWAB5JJL.mjs → artifact-LGQPNR6M.mjs} +2 -2
- package/dist/lib/browser/chunk-672NU6IC.mjs +8 -0
- package/dist/lib/browser/chunk-672NU6IC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VYBCAEUF.mjs → chunk-GKM6RRDX.mjs} +6 -3
- package/dist/lib/browser/{chunk-VYBCAEUF.mjs.map → chunk-GKM6RRDX.mjs.map} +3 -3
- package/dist/lib/browser/chunk-RGPTBDH7.mjs +41 -0
- package/dist/lib/browser/chunk-RGPTBDH7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -21
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-UZRNSQFI.mjs → intent-resolver-VPK5QRXH.mjs} +16 -13
- package/dist/lib/browser/intent-resolver-VPK5QRXH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-EP4LXPH7.mjs → react-surface-ZILDX6DE.mjs} +7 -15
- package/dist/lib/browser/react-surface-ZILDX6DE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/ChessContainer-CMYJDMSG.cjs +108 -0
- package/dist/lib/node/ChessContainer-CMYJDMSG.cjs.map +7 -0
- package/dist/lib/node/{artifact-YWL3LBIO.cjs → artifact-IKDPRF5X.cjs} +12 -12
- package/dist/lib/node/{chunk-J5YKJRP3.cjs → chunk-3TTH3HKL.cjs} +9 -6
- package/dist/lib/node/{chunk-J5YKJRP3.cjs.map → chunk-3TTH3HKL.cjs.map} +3 -3
- package/dist/lib/node/{chunk-6F6WTM5L.cjs → chunk-TEZPML34.cjs} +5 -5
- package/dist/lib/node/chunk-TEZPML34.cjs.map +7 -0
- package/dist/lib/node/{ChessContainer-P4BZ62FN.cjs → chunk-YTD6SK5V.cjs} +37 -16
- package/dist/lib/node/chunk-YTD6SK5V.cjs.map +7 -0
- package/dist/lib/node/index.cjs +28 -36
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-AENA6D5K.cjs → intent-resolver-PUM2BVGU.cjs} +19 -16
- package/dist/lib/node/intent-resolver-PUM2BVGU.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-JMOSMAIC.cjs → react-surface-KYLF2XNL.cjs} +13 -21
- package/dist/lib/node/react-surface-KYLF2XNL.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +5 -5
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/ChessContainer-WV2CO5WO.mjs +87 -0
- package/dist/lib/node-esm/ChessContainer-WV2CO5WO.mjs.map +7 -0
- package/dist/lib/node-esm/{artifact-B6IEF7U5.mjs → artifact-3KNX2TLP.mjs} +2 -2
- package/dist/lib/node-esm/chunk-GJW6TXCL.mjs +43 -0
- package/dist/lib/node-esm/chunk-GJW6TXCL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-TXUWVQWY.mjs → chunk-GQA2DRUZ.mjs} +6 -3
- package/dist/lib/node-esm/{chunk-TXUWVQWY.mjs.map → chunk-GQA2DRUZ.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-QXDXLFXD.mjs → chunk-YXXJHXSV.mjs} +2 -2
- package/dist/lib/node-esm/chunk-YXXJHXSV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +13 -21
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-T7NNHOYR.mjs → intent-resolver-IR3YUZIG.mjs} +16 -13
- package/dist/lib/node-esm/intent-resolver-IR3YUZIG.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-ENB7VY45.mjs → react-surface-VI6Q4BJT.mjs} +7 -15
- package/dist/lib/node-esm/react-surface-VI6Q4BJT.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/ChessComponent.d.ts +6 -0
- package/dist/types/src/components/ChessComponent.d.ts.map +1 -0
- package/dist/types/src/components/ChessContainer.d.ts +4 -3
- package/dist/types/src/components/ChessContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChessPanel.d.ts +11 -0
- package/dist/types/src/components/ChessPanel.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard.stories.d.ts +8 -0
- package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Chess.d.ts → PlayerSelector.d.ts} +3 -4
- package/dist/types/src/components/PlayerSelector.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -24
- package/src/ChessPlugin.tsx +5 -13
- package/src/capabilities/intent-resolver.ts +10 -8
- package/src/capabilities/react-surface.tsx +3 -12
- package/src/components/ChessComponent.tsx +48 -0
- package/src/components/ChessContainer.tsx +14 -4
- package/src/components/ChessPanel.tsx +67 -0
- package/src/components/Chessboard.stories.tsx +39 -0
- package/src/components/{Chess.tsx → PlayerSelector.tsx} +2 -50
- package/src/components/index.ts +1 -2
- package/src/meta.ts +3 -1
- package/dist/lib/browser/ChessContainer-G736GS2V.mjs +0 -26
- package/dist/lib/browser/ChessContainer-G736GS2V.mjs.map +0 -7
- package/dist/lib/browser/chunk-JUAC2NNR.mjs +0 -548
- package/dist/lib/browser/chunk-JUAC2NNR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LAYER2WV.mjs +0 -8
- package/dist/lib/browser/chunk-LAYER2WV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-UZRNSQFI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EP4LXPH7.mjs.map +0 -7
- package/dist/lib/node/ChessContainer-P4BZ62FN.cjs.map +0 -7
- package/dist/lib/node/chunk-6F6WTM5L.cjs.map +0 -7
- package/dist/lib/node/chunk-HPYER4GF.cjs +0 -574
- package/dist/lib/node/chunk-HPYER4GF.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-AENA6D5K.cjs.map +0 -7
- package/dist/lib/node/react-surface-JMOSMAIC.cjs.map +0 -7
- package/dist/lib/node-esm/ChessContainer-2LFJ6RHB.mjs +0 -27
- package/dist/lib/node-esm/ChessContainer-2LFJ6RHB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OMGVSBVI.mjs +0 -550
- package/dist/lib/node-esm/chunk-OMGVSBVI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QXDXLFXD.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-T7NNHOYR.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ENB7VY45.mjs.map +0 -7
- package/dist/types/src/components/Chess.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/Chessboard.d.ts +0 -37
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +0 -24
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/index.d.ts +0 -2
- package/dist/types/src/components/Chessboard/index.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/custom.d.ts +0 -3
- package/dist/types/src/components/Chessboard/pieces/custom.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/index.d.ts +0 -4
- package/dist/types/src/components/Chessboard/pieces/index.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/phosphor.d.ts +0 -3
- package/dist/types/src/components/Chessboard/pieces/phosphor.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard/pieces/riohacha.d.ts +0 -3
- package/dist/types/src/components/Chessboard/pieces/riohacha.d.ts.map +0 -1
- package/src/components/Chessboard/Chessboard.stories.tsx +0 -56
- package/src/components/Chessboard/Chessboard.tsx +0 -182
- package/src/components/Chessboard/index.ts +0 -5
- package/src/components/Chessboard/pieces/custom.tsx +0 -82
- package/src/components/Chessboard/pieces/index.ts +0 -7
- package/src/components/Chessboard/pieces/phosphor.tsx +0 -71
- package/src/components/Chessboard/pieces/riohacha.tsx +0 -166
- /package/dist/lib/browser/{artifact-YWAB5JJL.mjs.map → artifact-LGQPNR6M.mjs.map} +0 -0
- /package/dist/lib/node/{artifact-YWL3LBIO.cjs.map → artifact-IKDPRF5X.cjs.map} +0 -0
- /package/dist/lib/node-esm/{artifact-B6IEF7U5.mjs.map → artifact-3KNX2TLP.mjs.map} +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Chess } from 'chess.js';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
9
|
+
import { ChessModel, Board, Chessboard, type BoardRootProps } from '@dxos/react-ui-gameboard';
|
|
10
|
+
|
|
11
|
+
import { type ChessType } from '../types';
|
|
12
|
+
|
|
13
|
+
export const ChessComponent = ({ game }: { game: ChessType }) => {
|
|
14
|
+
const model = useMemo(() => new ChessModel(), []);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!model || game.pgn !== model?.game.pgn()) {
|
|
17
|
+
const chess = new Chess();
|
|
18
|
+
if (game.pgn) {
|
|
19
|
+
chess.loadPgn(game.pgn);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
model.initialize(chess.fen());
|
|
23
|
+
}
|
|
24
|
+
}, [game.pgn]);
|
|
25
|
+
|
|
26
|
+
const space = getSpace(game);
|
|
27
|
+
if (!space) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const handleDrop = useCallback<NonNullable<BoardRootProps['onDrop']>>(
|
|
32
|
+
(move) => {
|
|
33
|
+
if (model.makeMove(move)) {
|
|
34
|
+
game.pgn = model.game.pgn();
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return false;
|
|
39
|
+
},
|
|
40
|
+
[model],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Board.Root model={model} onDrop={handleDrop}>
|
|
45
|
+
<Chessboard />
|
|
46
|
+
</Board.Root>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { getSpace } from '@dxos/react-client/echo';
|
|
8
8
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { ChessComponent } from './ChessComponent';
|
|
11
|
+
import { PlayerSelector } from './PlayerSelector';
|
|
12
|
+
import { type ChessType } from '../types';
|
|
11
13
|
|
|
12
|
-
const ChessContainer = ({ game
|
|
14
|
+
const ChessContainer = ({ game }: { game: ChessType; role?: string }) => {
|
|
13
15
|
const space = getSpace(game);
|
|
14
16
|
if (!space) {
|
|
15
17
|
return null;
|
|
@@ -17,7 +19,15 @@ const ChessContainer = ({ game, role }: Pick<ComponentProps<typeof Chess>, 'game
|
|
|
17
19
|
|
|
18
20
|
return (
|
|
19
21
|
<StackItem.Content toolbar={false}>
|
|
20
|
-
<
|
|
22
|
+
<div role='none' className='grid grid-rows-[60px_1fr_60px] grow overflow-hidden'>
|
|
23
|
+
<div />
|
|
24
|
+
|
|
25
|
+
<div className='flex m-4 overflow-hidden'>
|
|
26
|
+
<ChessComponent game={game} />
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<PlayerSelector space={space} game={game} />
|
|
30
|
+
</div>
|
|
21
31
|
</StackItem.Content>
|
|
22
32
|
);
|
|
23
33
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ArrowURightDown, Circle } from '@phosphor-icons/react';
|
|
6
|
+
import { type Color } from 'chess.js';
|
|
7
|
+
import React, { type FC } from 'react';
|
|
8
|
+
|
|
9
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
+
import { type ChessModel } from '@dxos/react-ui-gameboard';
|
|
11
|
+
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
12
|
+
|
|
13
|
+
export type ChessPanelProps = ThemedClassName<{
|
|
14
|
+
model: ChessModel;
|
|
15
|
+
orientation?: Color;
|
|
16
|
+
onFlip?: () => void;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export const ChessPanel: FC<ChessPanelProps> = ({ classNames, model, orientation = 'w', onFlip }) => {
|
|
20
|
+
const game = model.game;
|
|
21
|
+
const history = game.history();
|
|
22
|
+
const label = game.isGameOver()
|
|
23
|
+
? game.isCheckmate()
|
|
24
|
+
? 'CHECKMATE'
|
|
25
|
+
: game.isStalemate()
|
|
26
|
+
? 'STALEMATE'
|
|
27
|
+
: 'DRAW'
|
|
28
|
+
: game.isCheck()
|
|
29
|
+
? 'CHECK'
|
|
30
|
+
: history.length
|
|
31
|
+
? `Move ${history.length}`
|
|
32
|
+
: '';
|
|
33
|
+
|
|
34
|
+
const Player = ({ color }: { color: Color }) => {
|
|
35
|
+
const turn = color === game.turn();
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className='flex items-center'>
|
|
39
|
+
<Circle
|
|
40
|
+
className={mx(getSize(4), turn && (game.isCheckmate() ? 'text-red-500' : 'text-green-500'))}
|
|
41
|
+
weight={turn ? 'fill' : 'thin'}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={mx('flex flex-col', classNames)}>
|
|
49
|
+
<div className='flex items-center justify-between pl-2 pr-2 border-b' style={{ height: 32 }}>
|
|
50
|
+
<Player color={orientation === 'w' ? 'b' : 'w'} />
|
|
51
|
+
{onFlip && (
|
|
52
|
+
<button onClick={onFlip}>
|
|
53
|
+
<ArrowURightDown weight='thin' className={getSize(6)} />
|
|
54
|
+
</button>
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div className='flex flex-col justify-center pl-2 font-thin' style={{ height: 40 }}>
|
|
59
|
+
{label}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div className='flex items-center justify-between pl-2 pr-2 border-t' style={{ height: 32 }}>
|
|
63
|
+
<Player color={orientation} />
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
|
+
import React, { useMemo } from 'react';
|
|
9
|
+
|
|
10
|
+
import { Board, Chessboard, ChessModel } from '@dxos/react-ui-gameboard';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
12
|
+
|
|
13
|
+
import { ChessPanel } from './ChessPanel';
|
|
14
|
+
|
|
15
|
+
const Render = () => {
|
|
16
|
+
const model = useMemo(() => new ChessModel(), []);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className='flex grow mx-8 gap-8 items-center overflow-hidden'>
|
|
20
|
+
<Board.Root model={model} onDrop={(move) => model.makeMove(move)}>
|
|
21
|
+
<Chessboard />
|
|
22
|
+
</Board.Root>
|
|
23
|
+
<ChessPanel model={model} classNames='w-[200px]' />
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const meta: Meta<typeof Chessboard> = {
|
|
29
|
+
title: 'plugins/plugin-chess/Chessboard',
|
|
30
|
+
component: Chessboard,
|
|
31
|
+
render: Render,
|
|
32
|
+
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type Story = StoryObj<typeof Chessboard>;
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {};
|
|
@@ -3,64 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { CrownCross } from '@phosphor-icons/react';
|
|
6
|
-
import
|
|
7
|
-
import React, { useEffect, useState } from 'react';
|
|
6
|
+
import React from 'react';
|
|
8
7
|
|
|
9
8
|
import { generateName } from '@dxos/display-name';
|
|
10
|
-
import { invariant } from '@dxos/invariant';
|
|
11
9
|
import { useMembers, type Space, type SpaceMember } from '@dxos/react-client/echo';
|
|
12
10
|
import { Input, Select, useThemeContext } from '@dxos/react-ui';
|
|
13
11
|
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
14
12
|
|
|
15
|
-
import { Chessboard, type ChessModel, type ChessMove } from './Chessboard';
|
|
16
13
|
import { type ChessType } from '../types';
|
|
17
14
|
|
|
18
|
-
const
|
|
19
|
-
const [model, setModel] = useState<ChessModel>();
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (!model || game.pgn !== model?.chess.pgn()) {
|
|
23
|
-
const chess = new ChessJs(game.pgn ? undefined : game.fen);
|
|
24
|
-
if (game.pgn) {
|
|
25
|
-
chess.loadPgn(game.pgn);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setModel({ chess });
|
|
29
|
-
}
|
|
30
|
-
}, [game.pgn]);
|
|
31
|
-
|
|
32
|
-
const handleUpdate = (move: ChessMove) => {
|
|
33
|
-
invariant(model);
|
|
34
|
-
if (model.chess.move(move)) {
|
|
35
|
-
game.pgn = model.chess.pgn();
|
|
36
|
-
game.fen = model.chess.fen();
|
|
37
|
-
setModel({ ...model });
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return { model, handleUpdate };
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const Chess = ({ space, game, playerSelector }: { space: Space; game: ChessType; playerSelector?: boolean }) => {
|
|
45
|
-
const { model, handleUpdate } = useChessModel(game);
|
|
46
|
-
if (!model) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div role='none' className='grid grid-rows-[60px_1fr_60px] grow overflow-hidden'>
|
|
52
|
-
<div />
|
|
53
|
-
<div className='flex grow justify-center overflow-hidden'>
|
|
54
|
-
<div className='flex grow max-w-[600px] items-center overflow-hidden'>
|
|
55
|
-
<Chessboard model={model} onUpdate={handleUpdate} />
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
{playerSelector && <PlayerSelector game={game} space={space} />}
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const PlayerSelector = ({ game, space }: { game: ChessType; space: Space }) => {
|
|
15
|
+
export const PlayerSelector = ({ space, game }: { space: Space; game: ChessType }) => {
|
|
64
16
|
const members = useMembers(space.key);
|
|
65
17
|
|
|
66
18
|
return (
|
package/src/components/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -9,7 +9,9 @@ export const CHESS_PLUGIN = 'dxos.org/plugin/chess';
|
|
|
9
9
|
export const meta = {
|
|
10
10
|
id: CHESS_PLUGIN,
|
|
11
11
|
name: 'Chess',
|
|
12
|
-
description:
|
|
12
|
+
description:
|
|
13
|
+
'Chess is a simple plugin which allows you to render an interactive chessboard inside of a plank. This chessboard can be used for collaborative chess games, or for practice experiments with the LLM. ',
|
|
13
14
|
icon: 'ph--shield-chevron--regular',
|
|
14
15
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',
|
|
16
|
+
screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],
|
|
15
17
|
} satisfies PluginMeta;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Chess
|
|
3
|
-
} from "./chunk-JUAC2NNR.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/plugin-chess/src/components/ChessContainer.tsx
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
8
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
9
|
-
var ChessContainer = ({ game, role }) => {
|
|
10
|
-
const space = getSpace(game);
|
|
11
|
-
if (!space) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
15
|
-
toolbar: false
|
|
16
|
-
}, /* @__PURE__ */ React.createElement(Chess, {
|
|
17
|
-
game,
|
|
18
|
-
space,
|
|
19
|
-
playerSelector: role === "article"
|
|
20
|
-
}));
|
|
21
|
-
};
|
|
22
|
-
var ChessContainer_default = ChessContainer;
|
|
23
|
-
export {
|
|
24
|
-
ChessContainer_default as default
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=ChessContainer-G736GS2V.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/ChessContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ComponentProps } from 'react';\n\nimport { getSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\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 <StackItem.Content toolbar={false}>\n <Chess game={game} space={space} playerSelector={role === 'article'} />\n </StackItem.Content>\n );\n};\n\nexport default ChessContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,OAAOA,WAAoC;AAE3C,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAI1B,IAAMC,iBAAiB,CAAC,EAAEC,MAAMC,KAAI,MAAkE;AACpG,QAAMC,QAAQC,SAASH,IAAAA;AACvB,MAAI,CAACE,OAAO;AACV,WAAO;EACT;AAEA,SACE,sBAAA,cAACE,UAAUC,SAAO;IAACC,SAAS;KAC1B,sBAAA,cAACC,OAAAA;IAAMP;IAAYE;IAAcM,gBAAgBP,SAAS;;AAGhE;AAEA,IAAA,yBAAeF;",
|
|
6
|
-
"names": ["React", "getSpace", "StackItem", "ChessContainer", "game", "role", "space", "getSpace", "StackItem", "Content", "toolbar", "Chess", "playerSelector"]
|
|
7
|
-
}
|