@dxos/plugin-chess 0.8.4-main.c1de068 → 0.8.4-main.fd6878d
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/ChessboardContainer-NNIOQIRP.mjs +90 -0
- package/dist/lib/browser/ChessboardContainer-NNIOQIRP.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-OJQYAZGZ.mjs +38 -0
- package/dist/lib/browser/blueprint-definition-OJQYAZGZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-2W3S5N6C.mjs +257 -0
- package/dist/lib/browser/chunk-2W3S5N6C.mjs.map +7 -0
- package/dist/lib/browser/chunk-EJMPHRSR.mjs +94 -0
- package/dist/lib/browser/chunk-EJMPHRSR.mjs.map +7 -0
- package/dist/lib/browser/chunk-OBJAHY6H.mjs +79 -0
- package/dist/lib/browser/chunk-OBJAHY6H.mjs.map +7 -0
- package/dist/lib/browser/chunk-PE3IWOFR.mjs +28 -0
- package/dist/lib/browser/chunk-PE3IWOFR.mjs.map +7 -0
- package/dist/lib/browser/chunk-PPBBLHAC.mjs +8 -0
- package/dist/lib/browser/chunk-PPBBLHAC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +42 -24
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-KQYYX44R.mjs → intent-resolver-JWKKRNGG.mjs} +8 -11
- package/dist/lib/browser/intent-resolver-JWKKRNGG.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-PLUCWIYP.mjs → react-surface-RIXD6RTS.mjs} +11 -9
- package/dist/lib/browser/react-surface-RIXD6RTS.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -7
- package/dist/lib/node-esm/ChessboardContainer-FCPUV2T2.mjs +91 -0
- package/dist/lib/node-esm/ChessboardContainer-FCPUV2T2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-F5SGHCDA.mjs +39 -0
- package/dist/lib/node-esm/blueprint-definition-F5SGHCDA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QFINI7CC.mjs → chunk-42EKKMOO.mjs} +3 -3
- package/dist/lib/node-esm/chunk-42EKKMOO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5APYXPBX.mjs +95 -0
- package/dist/lib/node-esm/chunk-5APYXPBX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6OWCPDUA.mjs +29 -0
- package/dist/lib/node-esm/chunk-6OWCPDUA.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LCCUF5X5.mjs +80 -0
- package/dist/lib/node-esm/chunk-LCCUF5X5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QAGOXJGH.mjs +258 -0
- package/dist/lib/node-esm/chunk-QAGOXJGH.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +42 -24
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-GXK2JROQ.mjs → intent-resolver-G6XJAW6C.mjs} +8 -11
- package/dist/lib/node-esm/intent-resolver-G6XJAW6C.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-NGLNIWN3.mjs → react-surface-GGRDWZJT.mjs} +11 -9
- package/dist/lib/node-esm/react-surface-GGRDWZJT.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +1 -1
- 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/components/Card.stories.d.ts +49 -0
- package/dist/types/src/components/Card.stories.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard.d.ts +32 -0
- package/dist/types/src/components/Chessboard.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard.stories.d.ts +39 -5
- package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +6 -0
- package/dist/types/src/components/ChessboardArticle.d.ts.map +1 -0
- package/dist/types/src/components/ChessboardContainer.d.ts +9 -0
- package/dist/types/src/components/ChessboardContainer.d.ts.map +1 -0
- package/dist/types/src/components/ChessboardInfo.d.ts +20 -0
- package/dist/types/src/components/ChessboardInfo.d.ts.map +1 -0
- package/dist/types/src/components/ChessboardPlayers.d.ts +8 -0
- package/dist/types/src/components/ChessboardPlayers.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +3 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/move.d.ts +6 -0
- package/dist/types/src/functions/move.d.ts.map +1 -0
- package/dist/types/src/functions/play.d.ts +8 -0
- package/dist/types/src/functions/play.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +8 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +24 -0
- package/dist/types/src/types/Chess.d.ts.map +1 -0
- package/dist/types/src/types/ChessAction.d.ts +23 -0
- package/dist/types/src/types/ChessAction.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -25
- package/src/ChessPlugin.tsx +7 -7
- package/src/capabilities/artifact-definition.ts +24 -20
- package/src/capabilities/blueprint-definition.ts +34 -0
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +3 -7
- package/src/capabilities/react-surface.tsx +5 -5
- package/src/components/Card.stories.tsx +68 -0
- package/src/components/Chessboard.stories.tsx +33 -24
- package/src/components/Chessboard.tsx +101 -0
- package/src/components/ChessboardArticle.tsx +57 -0
- package/src/components/ChessboardContainer.tsx +44 -0
- package/src/components/ChessboardInfo.tsx +140 -0
- package/src/components/{PlayerSelector.tsx → ChessboardPlayers.tsx} +25 -10
- package/src/components/index.ts +2 -2
- package/src/functions/index.ts +6 -0
- package/src/functions/move.ts +43 -0
- package/src/functions/play.ts +45 -0
- package/src/index.ts +2 -0
- package/src/meta.ts +4 -2
- package/src/translations.ts +8 -2
- package/src/types/Chess.ts +56 -0
- package/src/types/ChessAction.ts +19 -0
- package/src/types/index.ts +2 -2
- package/dist/lib/browser/ChessContainer-SC4ZV6XZ.mjs +0 -129
- package/dist/lib/browser/ChessContainer-SC4ZV6XZ.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-A2FSM255.mjs +0 -182
- package/dist/lib/browser/artifact-definition-A2FSM255.mjs.map +0 -7
- package/dist/lib/browser/chunk-A3WEUKPK.mjs +0 -61
- package/dist/lib/browser/chunk-A3WEUKPK.mjs.map +0 -7
- package/dist/lib/browser/chunk-KDADGLPC.mjs +0 -8
- package/dist/lib/browser/chunk-KDADGLPC.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZXH3N4NA.mjs +0 -66
- package/dist/lib/browser/chunk-ZXH3N4NA.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-KQYYX44R.mjs.map +0 -7
- package/dist/lib/browser/react-surface-PLUCWIYP.mjs.map +0 -7
- package/dist/lib/node-esm/ChessContainer-7GLY5KLY.mjs +0 -130
- package/dist/lib/node-esm/ChessContainer-7GLY5KLY.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-2H7OUBZO.mjs +0 -183
- package/dist/lib/node-esm/artifact-definition-2H7OUBZO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-27D3JA3K.mjs +0 -68
- package/dist/lib/node-esm/chunk-27D3JA3K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IS3Y25PL.mjs +0 -63
- package/dist/lib/node-esm/chunk-IS3Y25PL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QFINI7CC.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-GXK2JROQ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-NGLNIWN3.mjs.map +0 -7
- package/dist/types/src/components/Chess.d.ts +0 -14
- package/dist/types/src/components/Chess.d.ts.map +0 -1
- package/dist/types/src/components/ChessContainer.d.ts +0 -8
- package/dist/types/src/components/ChessContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChessContainer.stories.d.ts +0 -23
- package/dist/types/src/components/ChessContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChessPanel.d.ts +0 -11
- package/dist/types/src/components/ChessPanel.d.ts.map +0 -1
- package/dist/types/src/components/PlayerSelector.d.ts +0 -8
- package/dist/types/src/components/PlayerSelector.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -29
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -32
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/components/Chess.tsx +0 -60
- package/src/components/ChessContainer.stories.tsx +0 -110
- package/src/components/ChessContainer.tsx +0 -71
- package/src/components/ChessPanel.tsx +0 -67
- package/src/types/schema.ts +0 -34
- package/src/types/types.ts +0 -20
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
8
|
+
|
|
9
|
+
import { type Chess } from '../types';
|
|
10
|
+
|
|
11
|
+
import { Chessboard } from './Chessboard';
|
|
12
|
+
import { ChessboardArticle } from './ChessboardArticle';
|
|
13
|
+
|
|
14
|
+
export type ChessboardContainerProps = {
|
|
15
|
+
game: Chess.Game;
|
|
16
|
+
role?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const ChessboardContainer = ({ game, role }: ChessboardContainerProps) => {
|
|
20
|
+
const space = getSpace(game);
|
|
21
|
+
if (!space) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (role) {
|
|
26
|
+
case 'card--popover':
|
|
27
|
+
case 'card--intrinsic':
|
|
28
|
+
case 'card--extrinsic': {
|
|
29
|
+
return (
|
|
30
|
+
<Chessboard.Root game={game}>
|
|
31
|
+
<Chessboard.Content role={role}>
|
|
32
|
+
<Chessboard.Board />
|
|
33
|
+
</Chessboard.Content>
|
|
34
|
+
</Chessboard.Root>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
default: {
|
|
39
|
+
return <ChessboardArticle game={game} />;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default ChessboardContainer;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type PropsWithChildren, useEffect, useMemo, useRef } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Icon, IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { type Player, useGameboardContext } from '@dxos/react-ui-gameboard';
|
|
9
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
|
|
13
|
+
import { type ExtendedChessModel } from './Chessboard';
|
|
14
|
+
|
|
15
|
+
export type ChessboardInfoProps = ThemedClassName<
|
|
16
|
+
{
|
|
17
|
+
orientation?: Player;
|
|
18
|
+
onOrientationChange?: (orientation: Player) => void;
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
} & Pick<HistoryProps, 'min' | 'max'>
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
export const ChessboardInfo = ({
|
|
24
|
+
classNames,
|
|
25
|
+
orientation = 'white',
|
|
26
|
+
onOrientationChange,
|
|
27
|
+
onClose,
|
|
28
|
+
...props
|
|
29
|
+
}: ChessboardInfoProps) => {
|
|
30
|
+
const { t } = useTranslation(meta.id);
|
|
31
|
+
const { model } = useGameboardContext<ExtendedChessModel>(ChessboardInfo.displayName);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
className={mx(
|
|
36
|
+
'grid grid-rows-[min-content_1fr_min-content] is-full min-is-[16rem] overflow-hidden bg-inputSurface p-2 rounded',
|
|
37
|
+
classNames,
|
|
38
|
+
)}
|
|
39
|
+
>
|
|
40
|
+
<PlayerIndicator
|
|
41
|
+
model={model}
|
|
42
|
+
player={orientation === 'white' ? 'black' : 'white'}
|
|
43
|
+
title={model.object.players?.[orientation === 'white' ? 'black' : 'white']}
|
|
44
|
+
>
|
|
45
|
+
{onClose && <IconButton icon='ph--x--regular' iconOnly label={t('button flip')} size={4} onClick={onClose} />}
|
|
46
|
+
</PlayerIndicator>
|
|
47
|
+
<History model={model} {...props} />
|
|
48
|
+
<PlayerIndicator model={model} player={orientation} title={model.object.players?.[orientation]}>
|
|
49
|
+
{onOrientationChange && (
|
|
50
|
+
<IconButton
|
|
51
|
+
icon='ph--arrows-down-up--regular'
|
|
52
|
+
iconOnly
|
|
53
|
+
label={t('button flip')}
|
|
54
|
+
size={6}
|
|
55
|
+
classNames={mx('transition duration-200 ease-linear', orientation === 'white' && 'rotate-180')}
|
|
56
|
+
onClick={() => onOrientationChange(orientation === 'white' ? 'black' : 'white')}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
</PlayerIndicator>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
ChessboardInfo.displayName = 'Chessboard.Info';
|
|
65
|
+
|
|
66
|
+
type HistoryProps = ThemedClassName<{ model: ExtendedChessModel; min?: number; max?: number }>;
|
|
67
|
+
|
|
68
|
+
const History = ({ classNames, model, min, max }: HistoryProps) => {
|
|
69
|
+
const { t } = useTranslation(meta.id);
|
|
70
|
+
const label = model.game.isGameOver()
|
|
71
|
+
? model.game.isCheckmate()
|
|
72
|
+
? t('game.checkmate')
|
|
73
|
+
: model.game.isStalemate()
|
|
74
|
+
? t('game.stalemate')
|
|
75
|
+
: t('game.draw')
|
|
76
|
+
: model.game.isCheck()
|
|
77
|
+
? t('game.check')
|
|
78
|
+
: undefined;
|
|
79
|
+
|
|
80
|
+
const history = model.game.history();
|
|
81
|
+
const moves = useMemo(
|
|
82
|
+
() =>
|
|
83
|
+
history.reduce((acc, move, index) => {
|
|
84
|
+
if (index % 2 === 0) {
|
|
85
|
+
acc.push([move]);
|
|
86
|
+
} else {
|
|
87
|
+
acc[acc.length - 1].push(move);
|
|
88
|
+
}
|
|
89
|
+
return acc;
|
|
90
|
+
}, [] as string[][]),
|
|
91
|
+
[history.length],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const scrollerRef = useRef<HTMLDivElement>(null);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
scrollerRef.current?.scrollTo({ top: scrollerRef.current.scrollHeight });
|
|
97
|
+
}, [history.length]);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div
|
|
101
|
+
ref={scrollerRef}
|
|
102
|
+
className={mx('overflow-y-scroll', classNames)}
|
|
103
|
+
style={{
|
|
104
|
+
minHeight: min === undefined ? 'auto' : `${min * 24}px`,
|
|
105
|
+
maxHeight: max === undefined ? 'auto' : `${max * 24}px`,
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
{moves.map(([a, b], index) => (
|
|
109
|
+
<div key={index} className='grid grid-cols-[3rem_1fr_1fr] pis-4 leading-1'>
|
|
110
|
+
<div className='content-center text-xs text-subdued'>{index + 1}</div>
|
|
111
|
+
<div>{a}</div>
|
|
112
|
+
<div>{b}</div>
|
|
113
|
+
</div>
|
|
114
|
+
))}
|
|
115
|
+
{label && <div className='text-center'>{label}</div>}
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const PlayerIndicator = ({
|
|
121
|
+
children,
|
|
122
|
+
model,
|
|
123
|
+
player,
|
|
124
|
+
title,
|
|
125
|
+
}: PropsWithChildren<{ model: ExtendedChessModel; player: Player; title?: string }>) => {
|
|
126
|
+
const turn = player === (model.game.turn() === 'w' ? 'white' : 'black');
|
|
127
|
+
return (
|
|
128
|
+
<div className='grid grid-cols-[2rem_1fr_2rem] gap-1 bs-[--rail-size] pis-1 pie-1 flex items-center overflow-hidden'>
|
|
129
|
+
<div className='place-items-center'>
|
|
130
|
+
<Icon
|
|
131
|
+
icon={turn ? 'ph--circle--fill' : 'ph--circle--thin'}
|
|
132
|
+
size={6}
|
|
133
|
+
classNames={mx(turn && (model.game.isCheckmate() ? 'text-red-500' : 'text-green-500'))}
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
<div className='truncate'>{title}</div>
|
|
137
|
+
{children}
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
@@ -2,32 +2,45 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
7
|
import { generateName } from '@dxos/display-name';
|
|
8
|
-
import {
|
|
8
|
+
import { type SpaceMember, getSpace, useMembers } from '@dxos/react-client/echo';
|
|
9
9
|
import { Icon, Input, Select, useThemeContext } from '@dxos/react-ui';
|
|
10
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
+
import { useGameboardContext } from '@dxos/react-ui-gameboard';
|
|
12
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
10
13
|
|
|
11
|
-
import { type
|
|
14
|
+
import { type Chess } from '../types';
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
import { type ExtendedChessModel } from './Chessboard';
|
|
17
|
+
|
|
18
|
+
export type ChessboardPlayersProps = ThemedClassName<PropsWithChildren>;
|
|
19
|
+
|
|
20
|
+
export const ChessboardPlayers = ({ classNames, children }: ChessboardPlayersProps) => {
|
|
21
|
+
const { model } = useGameboardContext<ExtendedChessModel>(ChessboardPlayers.displayName);
|
|
22
|
+
const members = useMembers(getSpace(model.object)?.key);
|
|
23
|
+
const players: Chess.Game['players'] = model.object.players;
|
|
24
|
+
if (!players) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
15
27
|
|
|
16
28
|
return (
|
|
17
|
-
<div role='none' className='grid grid-cols-2
|
|
29
|
+
<div role='none' className={mx('grid grid-cols-[1fr_min-content_1fr] pis-2 pie-2 overflow-hidden', classNames)}>
|
|
18
30
|
<div role='none' className='flex flex-row-reverse items-center gap-2'>
|
|
19
31
|
<PlayerSelect
|
|
20
32
|
side='white'
|
|
21
|
-
value={
|
|
22
|
-
onValueChange={(player) => (
|
|
33
|
+
value={players.white}
|
|
34
|
+
onValueChange={(player) => (players.white = player)}
|
|
23
35
|
members={members}
|
|
24
36
|
/>
|
|
25
37
|
</div>
|
|
38
|
+
<div className='flex flex-row justify-center items-center'>{children}</div>
|
|
26
39
|
<div role='none' className='flex flex-row items-center gap-2'>
|
|
27
40
|
<PlayerSelect
|
|
28
41
|
side='black'
|
|
29
|
-
value={
|
|
30
|
-
onValueChange={(player) => (
|
|
42
|
+
value={players.black}
|
|
43
|
+
onValueChange={(player) => (players.black = player)}
|
|
31
44
|
members={members}
|
|
32
45
|
/>
|
|
33
46
|
</div>
|
|
@@ -35,6 +48,8 @@ export const PlayerSelector = ({ space, game }: { space: Space; game: ChessType
|
|
|
35
48
|
);
|
|
36
49
|
};
|
|
37
50
|
|
|
51
|
+
ChessboardPlayers.displayName = 'Chessboard.Players';
|
|
52
|
+
|
|
38
53
|
const PlayerSelect = ({
|
|
39
54
|
side,
|
|
40
55
|
value,
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
+
import { Effect, Schema } from 'effect';
|
|
7
|
+
|
|
8
|
+
import { ArtifactId } from '@dxos/assistant';
|
|
9
|
+
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
10
|
+
|
|
11
|
+
import { Chess } from '../types';
|
|
12
|
+
|
|
13
|
+
export default defineFunction({
|
|
14
|
+
name: 'dxos.org/function/chess/move',
|
|
15
|
+
description: 'Makes a move in the given chess game.',
|
|
16
|
+
inputSchema: Schema.Struct({
|
|
17
|
+
id: ArtifactId.annotations({
|
|
18
|
+
description: 'The ID of the chess object.',
|
|
19
|
+
}),
|
|
20
|
+
move: Schema.String.annotations({
|
|
21
|
+
description: 'The move to make in the chess game.',
|
|
22
|
+
examples: ['e4', 'Bf3'],
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
outputSchema: Schema.Boolean.annotations({
|
|
26
|
+
description: 'False if the move was invalid.',
|
|
27
|
+
}),
|
|
28
|
+
handler: Effect.fn(function* ({ data: { id, move } }) {
|
|
29
|
+
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
30
|
+
|
|
31
|
+
// TODO(burdon): Avoid using try/catch inside Effect generators.
|
|
32
|
+
// Use Effect's error handling mechanisms instead (e.g., Effect.try, Effect.tryPromise, Effect.catchAll, Effect.catchTag)
|
|
33
|
+
try {
|
|
34
|
+
const chess = new ChessJS();
|
|
35
|
+
chess.loadPgn(object.pgn);
|
|
36
|
+
chess.move(move, { strict: false });
|
|
37
|
+
object.pgn = chess.pgn();
|
|
38
|
+
return true;
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
+
import { Effect, Schema } from 'effect';
|
|
7
|
+
|
|
8
|
+
import { ArtifactId } from '@dxos/assistant';
|
|
9
|
+
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
10
|
+
import { log } from '@dxos/log';
|
|
11
|
+
|
|
12
|
+
import { Chess } from '../types';
|
|
13
|
+
|
|
14
|
+
export default defineFunction({
|
|
15
|
+
name: 'dxos.org/function/chess/play',
|
|
16
|
+
description: 'Uses the chess engine to play the next move in the given game.',
|
|
17
|
+
inputSchema: Schema.Struct({
|
|
18
|
+
id: ArtifactId.annotations({
|
|
19
|
+
description: 'The ID of the chess object.',
|
|
20
|
+
}),
|
|
21
|
+
}),
|
|
22
|
+
outputSchema: Schema.Struct({
|
|
23
|
+
move: Schema.optional(Schema.String).annotations({
|
|
24
|
+
description: 'The move that was played.',
|
|
25
|
+
}),
|
|
26
|
+
pgn: Schema.String.annotations({
|
|
27
|
+
description: 'The PGN of the game after the move was played.',
|
|
28
|
+
}),
|
|
29
|
+
}),
|
|
30
|
+
handler: Effect.fn(function* ({ data: { id } }) {
|
|
31
|
+
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
32
|
+
|
|
33
|
+
// Create game and make move.
|
|
34
|
+
const chess = new ChessJS();
|
|
35
|
+
chess.loadPgn(object.pgn);
|
|
36
|
+
const moves = chess.moves();
|
|
37
|
+
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
38
|
+
log.info('move', { move });
|
|
39
|
+
chess.move(move);
|
|
40
|
+
|
|
41
|
+
// Update the game state.
|
|
42
|
+
object.pgn = chess.pgn();
|
|
43
|
+
return { move, pgn: chess.pgn() };
|
|
44
|
+
}),
|
|
45
|
+
});
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
8
|
export const CHESS_PLUGIN = 'dxos.org/plugin/chess';
|
|
8
9
|
|
|
9
10
|
export const meta: PluginMeta = {
|
|
10
11
|
id: CHESS_PLUGIN,
|
|
11
12
|
name: 'Chess',
|
|
12
|
-
description:
|
|
13
|
-
|
|
13
|
+
description: trim`
|
|
14
|
+
Play chess with friends or practice with the AI.
|
|
15
|
+
`,
|
|
14
16
|
icon: 'ph--shield-chevron--regular',
|
|
15
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',
|
|
16
18
|
screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],
|
package/src/translations.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
7
|
import { meta } from './meta';
|
|
8
|
-
import {
|
|
8
|
+
import { Chess } from './types';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
|
-
[
|
|
13
|
+
[Chess.Game.typename]: {
|
|
14
14
|
'typename label': 'Game',
|
|
15
15
|
'typename label_zero': 'Games',
|
|
16
16
|
'typename label_one': 'Game',
|
|
@@ -18,10 +18,16 @@ export const translations = [
|
|
|
18
18
|
'object name placeholder': 'New game',
|
|
19
19
|
'rename object label': 'Rename game',
|
|
20
20
|
'delete object label': 'Delete game',
|
|
21
|
+
'button toggle info': 'Toggle info',
|
|
22
|
+
'button flip': 'Flip board',
|
|
21
23
|
},
|
|
22
24
|
[meta.id]: {
|
|
23
25
|
'plugin name': 'Chess',
|
|
24
26
|
'delete game label': 'Delete',
|
|
27
|
+
'game.checkmate': 'Checkmate',
|
|
28
|
+
'game.stalemate': 'Stalemate',
|
|
29
|
+
'game.draw': 'Draw',
|
|
30
|
+
'game.check': 'Check',
|
|
25
31
|
},
|
|
26
32
|
},
|
|
27
33
|
},
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
+
import { Schema } from 'effect';
|
|
7
|
+
|
|
8
|
+
import { Obj, Type } from '@dxos/echo';
|
|
9
|
+
import { LabelAnnotation } from '@dxos/echo-schema';
|
|
10
|
+
import { log } from '@dxos/log';
|
|
11
|
+
|
|
12
|
+
export const Game = Schema.Struct({
|
|
13
|
+
name: Schema.optional(Schema.String),
|
|
14
|
+
players: Schema.optional(
|
|
15
|
+
Schema.Struct({
|
|
16
|
+
white: Schema.optional(
|
|
17
|
+
Schema.String.annotations({
|
|
18
|
+
description: 'DID of white player',
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
black: Schema.optional(
|
|
22
|
+
Schema.String.annotations({
|
|
23
|
+
description: 'DID of black player',
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
}).pipe(Schema.mutable),
|
|
27
|
+
),
|
|
28
|
+
pgn: Schema.String.annotations({
|
|
29
|
+
description: 'Portable Game Notation.',
|
|
30
|
+
}),
|
|
31
|
+
}).pipe(
|
|
32
|
+
Type.Obj({
|
|
33
|
+
typename: 'dxos.org/type/Chess',
|
|
34
|
+
version: '0.2.0',
|
|
35
|
+
}),
|
|
36
|
+
LabelAnnotation.set(['name']),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export interface Game extends Schema.Schema.Type<typeof Game> {}
|
|
40
|
+
|
|
41
|
+
export const makeGame = ({ name, pgn }: { name?: string; pgn?: string } = {}) => {
|
|
42
|
+
const chess = new ChessJS();
|
|
43
|
+
if (pgn) {
|
|
44
|
+
try {
|
|
45
|
+
chess.loadPgn(pgn);
|
|
46
|
+
} catch {
|
|
47
|
+
log.warn(pgn);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return Obj.make(Game, {
|
|
52
|
+
name,
|
|
53
|
+
players: {},
|
|
54
|
+
pgn: chess.pgn(),
|
|
55
|
+
});
|
|
56
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { meta } from '../meta';
|
|
8
|
+
|
|
9
|
+
import { Game } from './Chess';
|
|
10
|
+
|
|
11
|
+
export class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {
|
|
12
|
+
input: Schema.Struct({
|
|
13
|
+
name: Schema.optional(Schema.String),
|
|
14
|
+
pgn: Schema.optional(Schema.String),
|
|
15
|
+
}),
|
|
16
|
+
output: Schema.Struct({
|
|
17
|
+
object: Game,
|
|
18
|
+
}),
|
|
19
|
+
}) {}
|
package/src/types/index.ts
CHANGED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Chess
|
|
3
|
-
} from "./chunk-ZXH3N4NA.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/ChessContainer.tsx
|
|
6
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
7
|
-
import React2 from "react";
|
|
8
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
9
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
10
|
-
|
|
11
|
-
// src/components/PlayerSelector.tsx
|
|
12
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
13
|
-
import React from "react";
|
|
14
|
-
import { generateName } from "@dxos/display-name";
|
|
15
|
-
import { useMembers } from "@dxos/react-client/echo";
|
|
16
|
-
import { Icon, Input, Select, useThemeContext } from "@dxos/react-ui";
|
|
17
|
-
var PlayerSelector = ({ space, game }) => {
|
|
18
|
-
var _effect = _useSignals();
|
|
19
|
-
try {
|
|
20
|
-
const members = useMembers(space.key);
|
|
21
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
22
|
-
role: "none",
|
|
23
|
-
className: "grid grid-cols-2 gap-8"
|
|
24
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
25
|
-
role: "none",
|
|
26
|
-
className: "flex flex-row-reverse items-center gap-2"
|
|
27
|
-
}, /* @__PURE__ */ React.createElement(PlayerSelect, {
|
|
28
|
-
side: "white",
|
|
29
|
-
value: game.playerWhite,
|
|
30
|
-
onValueChange: (player) => game.playerWhite = player,
|
|
31
|
-
members
|
|
32
|
-
})), /* @__PURE__ */ React.createElement("div", {
|
|
33
|
-
role: "none",
|
|
34
|
-
className: "flex flex-row items-center gap-2"
|
|
35
|
-
}, /* @__PURE__ */ React.createElement(PlayerSelect, {
|
|
36
|
-
side: "black",
|
|
37
|
-
value: game.playerBlack,
|
|
38
|
-
onValueChange: (player) => game.playerBlack = player,
|
|
39
|
-
members
|
|
40
|
-
})));
|
|
41
|
-
} finally {
|
|
42
|
-
_effect.f();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var PlayerSelect = ({ side, value, onValueChange, members }) => {
|
|
46
|
-
var _effect = _useSignals();
|
|
47
|
-
try {
|
|
48
|
-
const { themeMode } = useThemeContext();
|
|
49
|
-
const iconFillMode = side === "black" && themeMode === "light" || side === "white" && themeMode === "dark" ? "fill" : void 0;
|
|
50
|
-
return /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, /* @__PURE__ */ React.createElement(Icon, {
|
|
51
|
-
"aria-label": `Chess icon for side ${side}`,
|
|
52
|
-
icon: `ph--crown-cross--${iconFillMode || "regular"}`,
|
|
53
|
-
size: 6
|
|
54
|
-
})), /* @__PURE__ */ React.createElement(Select.Root, {
|
|
55
|
-
value,
|
|
56
|
-
onValueChange
|
|
57
|
-
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
58
|
-
placeholder: "Select player"
|
|
59
|
-
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, members.map((member) => {
|
|
60
|
-
const memberKey = member.identity.identityKey.toHex();
|
|
61
|
-
const displayName = member.identity?.profile?.displayName || generateName(memberKey);
|
|
62
|
-
return /* @__PURE__ */ React.createElement(Select.Option, {
|
|
63
|
-
key: memberKey,
|
|
64
|
-
value: memberKey
|
|
65
|
-
}, displayName);
|
|
66
|
-
}))))));
|
|
67
|
-
} finally {
|
|
68
|
-
_effect.f();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// src/components/ChessContainer.tsx
|
|
73
|
-
var containFragment = "is-[min(100cqw,100cqh)] bs-[min(100cqw,100cqh)]";
|
|
74
|
-
var ChessContainer = ({ game, role }) => {
|
|
75
|
-
var _effect = _useSignals2();
|
|
76
|
-
try {
|
|
77
|
-
const space = getSpace(game);
|
|
78
|
-
if (!space) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
switch (role) {
|
|
82
|
-
case "card--popover": {
|
|
83
|
-
return /* @__PURE__ */ React2.createElement(Chess.Root, {
|
|
84
|
-
game
|
|
85
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
86
|
-
role: "none",
|
|
87
|
-
className: "popover-square size-container"
|
|
88
|
-
}, /* @__PURE__ */ React2.createElement(Chess.Board, {
|
|
89
|
-
classNames: containFragment
|
|
90
|
-
})));
|
|
91
|
-
}
|
|
92
|
-
case "card--extrinsic": {
|
|
93
|
-
return /* @__PURE__ */ React2.createElement(Chess.Root, {
|
|
94
|
-
game
|
|
95
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
96
|
-
role: "none",
|
|
97
|
-
className: "grid is-full bs-full size-container place-content-center"
|
|
98
|
-
}, /* @__PURE__ */ React2.createElement(Chess.Board, {
|
|
99
|
-
classNames: containFragment
|
|
100
|
-
})));
|
|
101
|
-
}
|
|
102
|
-
case "card--intrinsic": {
|
|
103
|
-
return /* @__PURE__ */ React2.createElement(Chess.Root, {
|
|
104
|
-
game
|
|
105
|
-
}, /* @__PURE__ */ React2.createElement(Chess.Board, null));
|
|
106
|
-
}
|
|
107
|
-
default: {
|
|
108
|
-
return /* @__PURE__ */ React2.createElement(StackItem.Content, null, /* @__PURE__ */ React2.createElement("div", {
|
|
109
|
-
role: "none",
|
|
110
|
-
className: "grid grid-rows-[60px_1fr_60px] grow overflow-hidden"
|
|
111
|
-
}, /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", {
|
|
112
|
-
className: "flex m-4 overflow-hidden"
|
|
113
|
-
}, /* @__PURE__ */ React2.createElement(Chess.Root, {
|
|
114
|
-
game
|
|
115
|
-
}, /* @__PURE__ */ React2.createElement(Chess.Content, null, /* @__PURE__ */ React2.createElement(Chess.Board, null)))), /* @__PURE__ */ React2.createElement(PlayerSelector, {
|
|
116
|
-
space,
|
|
117
|
-
game
|
|
118
|
-
})));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
} finally {
|
|
122
|
-
_effect.f();
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var ChessContainer_default = ChessContainer;
|
|
126
|
-
export {
|
|
127
|
-
ChessContainer_default as default
|
|
128
|
-
};
|
|
129
|
-
//# sourceMappingURL=ChessContainer-SC4ZV6XZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/ChessContainer.tsx", "../../../src/components/PlayerSelector.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { getSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { Chess } from './Chess';\nimport { PlayerSelector } from './PlayerSelector';\nimport { type ChessType } from '../types';\n\nconst containFragment = 'is-[min(100cqw,100cqh)] bs-[min(100cqw,100cqh)]';\n\nconst ChessContainer = ({ game, role }: { game: ChessType; role?: string }) => {\n const space = getSpace(game);\n\n if (!space) {\n return null;\n }\n\n switch (role) {\n case 'card--popover': {\n return (\n <Chess.Root game={game}>\n <div role='none' className='popover-square size-container'>\n <Chess.Board classNames={containFragment} />\n </div>\n </Chess.Root>\n );\n }\n case 'card--extrinsic': {\n return (\n <Chess.Root game={game}>\n <div role='none' className='grid is-full bs-full size-container place-content-center'>\n <Chess.Board classNames={containFragment} />\n </div>\n </Chess.Root>\n );\n }\n case 'card--intrinsic': {\n return (\n <Chess.Root game={game}>\n <Chess.Board />\n </Chess.Root>\n );\n }\n default: {\n return (\n <StackItem.Content>\n <div role='none' className='grid grid-rows-[60px_1fr_60px] grow overflow-hidden'>\n <div />\n\n <div className='flex m-4 overflow-hidden'>\n <Chess.Root game={game}>\n <Chess.Content>\n <Chess.Board />\n </Chess.Content>\n </Chess.Root>\n </div>\n\n <PlayerSelector space={space} game={game} />\n </div>\n </StackItem.Content>\n );\n }\n }\n};\n\nexport default ChessContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { useMembers, type Space, type SpaceMember } from '@dxos/react-client/echo';\nimport { Icon, Input, Select, useThemeContext } from '@dxos/react-ui';\n\nimport { type ChessType } from '../types';\n\nexport const PlayerSelector = ({ space, game }: { space: Space; game: ChessType }) => {\n const members = useMembers(space.key);\n\n return (\n <div role='none' className='grid grid-cols-2 gap-8'>\n <div role='none' className='flex flex-row-reverse items-center gap-2'>\n <PlayerSelect\n side='white'\n value={game.playerWhite}\n onValueChange={(player) => (game.playerWhite = player)}\n members={members}\n />\n </div>\n <div role='none' className='flex flex-row items-center gap-2'>\n <PlayerSelect\n side='black'\n value={game.playerBlack}\n onValueChange={(player) => (game.playerBlack = player)}\n members={members}\n />\n </div>\n </div>\n );\n};\n\nconst PlayerSelect = ({\n side,\n value,\n onValueChange,\n members,\n}: {\n side: 'white' | 'black';\n value: string | undefined;\n onValueChange: (player: string) => void;\n members: SpaceMember[];\n}) => {\n const { themeMode } = useThemeContext();\n const iconFillMode =\n (side === 'black' && themeMode === 'light') || (side === 'white' && themeMode === 'dark') ? 'fill' : undefined;\n\n return (\n <Input.Root>\n <Input.Label>\n <Icon\n aria-label={`Chess icon for side ${side}`}\n icon={`ph--crown-cross--${iconFillMode || 'regular'}`}\n size={6}\n />\n </Input.Label>\n <Select.Root value={value} onValueChange={onValueChange}>\n <Select.TriggerButton placeholder={'Select player'} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {members.map((member) => {\n const memberKey = member.identity.identityKey.toHex();\n const displayName = member.identity?.profile?.displayName || generateName(memberKey);\n return (\n <Select.Option key={memberKey} value={memberKey}>\n {displayName}\n </Select.Option>\n );\n })}\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n </Input.Root>\n );\n};\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["React", "getSpace", "StackItem", "React", "generateName", "useMembers", "Icon", "Input", "Select", "useThemeContext", "PlayerSelector", "space", "game", "members", "useMembers", "key", "div", "role", "className", "PlayerSelect", "side", "value", "playerWhite", "onValueChange", "player", "playerBlack", "themeMode", "useThemeContext", "iconFillMode", "undefined", "Input", "Root", "Label", "Icon", "aria-label", "icon", "size", "Select", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "map", "member", "memberKey", "identity", "identityKey", "toHex", "displayName", "profile", "generateName", "Option", "containFragment", "ChessContainer", "game", "role", "space", "getSpace", "React", "Chess", "Root", "div", "className", "Board", "classNames", "StackItem", "Content", "PlayerSelector"]
|
|
7
|
-
}
|