@dxos/plugin-chess 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b

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.
Files changed (110) hide show
  1. package/dist/lib/browser/ChessContainer-LPMACR6Y.mjs +106 -0
  2. package/dist/lib/browser/ChessContainer-LPMACR6Y.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-3UQBTNX5.mjs → chunk-SINRYD72.mjs} +18 -5
  4. package/dist/lib/browser/chunk-SINRYD72.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +49 -561
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/intent-resolver-F36MGVEQ.mjs +22 -0
  8. package/dist/lib/browser/intent-resolver-F36MGVEQ.mjs.map +7 -0
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/react-surface-ADVIWGEE.mjs +30 -0
  11. package/dist/lib/browser/react-surface-ADVIWGEE.mjs.map +7 -0
  12. package/dist/lib/browser/types/index.mjs +1 -2
  13. package/dist/lib/node/ChessContainer-ZFOCAXZL.cjs +131 -0
  14. package/dist/lib/node/ChessContainer-ZFOCAXZL.cjs.map +7 -0
  15. package/dist/lib/node/{chunk-URYVXDF3.cjs → chunk-NALFH4J4.cjs} +22 -8
  16. package/dist/lib/node/chunk-NALFH4J4.cjs.map +7 -0
  17. package/dist/lib/node/index.cjs +50 -540
  18. package/dist/lib/node/index.cjs.map +4 -4
  19. package/dist/lib/node/{meta.cjs → intent-resolver-QLRGQQ2C.cjs} +18 -11
  20. package/dist/lib/node/intent-resolver-QLRGQQ2C.cjs.map +7 -0
  21. package/dist/lib/node/meta.json +1 -1
  22. package/dist/lib/node/react-surface-FRGCWHDU.cjs +51 -0
  23. package/dist/lib/node/react-surface-FRGCWHDU.cjs.map +7 -0
  24. package/dist/lib/node/types/index.cjs +5 -6
  25. package/dist/lib/node/types/index.cjs.map +2 -2
  26. package/dist/lib/node-esm/ChessContainer-DF6IFM2R.mjs +108 -0
  27. package/dist/lib/node-esm/ChessContainer-DF6IFM2R.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-IE2S5YZ2.mjs → chunk-R2ZZTB5A.mjs} +18 -4
  29. package/dist/lib/node-esm/chunk-R2ZZTB5A.mjs.map +7 -0
  30. package/dist/lib/node-esm/index.mjs +49 -561
  31. package/dist/lib/node-esm/index.mjs.map +4 -4
  32. package/dist/lib/node-esm/intent-resolver-OGWCQJZ2.mjs +23 -0
  33. package/dist/lib/node-esm/intent-resolver-OGWCQJZ2.mjs.map +7 -0
  34. package/dist/lib/node-esm/meta.json +1 -1
  35. package/dist/lib/node-esm/react-surface-SFBGDWJD.mjs +31 -0
  36. package/dist/lib/node-esm/react-surface-SFBGDWJD.mjs.map +7 -0
  37. package/dist/lib/node-esm/types/index.mjs +1 -2
  38. package/dist/types/src/ChessPlugin.d.ts +1 -3
  39. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  40. package/dist/types/src/capabilities/index.d.ts +3 -0
  41. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  43. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  44. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  45. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  46. package/dist/types/src/components/ChessContainer.d.ts +4 -3
  47. package/dist/types/src/components/ChessContainer.d.ts.map +1 -1
  48. package/dist/types/src/components/ChessPanel.d.ts +11 -0
  49. package/dist/types/src/components/ChessPanel.d.ts.map +1 -0
  50. package/dist/types/src/components/Chessboard.stories.d.ts +8 -0
  51. package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -0
  52. package/dist/types/src/components/{Chess.d.ts → PlayerSelector.d.ts} +4 -5
  53. package/dist/types/src/components/PlayerSelector.d.ts.map +1 -0
  54. package/dist/types/src/components/index.d.ts +2 -1
  55. package/dist/types/src/components/index.d.ts.map +1 -1
  56. package/dist/types/src/index.d.ts +1 -2
  57. package/dist/types/src/index.d.ts.map +1 -1
  58. package/dist/types/src/meta.d.ts +2 -2
  59. package/dist/types/src/meta.d.ts.map +1 -1
  60. package/dist/types/src/types/types.d.ts +0 -4
  61. package/dist/types/src/types/types.d.ts.map +1 -1
  62. package/dist/types/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +19 -27
  64. package/src/ChessPlugin.tsx +37 -40
  65. package/src/capabilities/index.ts +8 -0
  66. package/src/capabilities/intent-resolver.ts +21 -0
  67. package/src/capabilities/react-surface.tsx +22 -0
  68. package/src/components/ChessContainer.tsx +44 -6
  69. package/src/components/ChessPanel.tsx +67 -0
  70. package/src/components/Chessboard.stories.tsx +39 -0
  71. package/src/components/{Chess.tsx → PlayerSelector.tsx} +2 -49
  72. package/src/index.ts +1 -4
  73. package/src/meta.ts +3 -2
  74. package/src/types/types.ts +0 -15
  75. package/dist/lib/browser/chunk-2H2BTWYT.mjs +0 -15
  76. package/dist/lib/browser/chunk-2H2BTWYT.mjs.map +0 -7
  77. package/dist/lib/browser/chunk-3UQBTNX5.mjs.map +0 -7
  78. package/dist/lib/browser/meta.mjs +0 -9
  79. package/dist/lib/browser/meta.mjs.map +0 -7
  80. package/dist/lib/node/chunk-Q4NVPVPX.cjs +0 -38
  81. package/dist/lib/node/chunk-Q4NVPVPX.cjs.map +0 -7
  82. package/dist/lib/node/chunk-URYVXDF3.cjs.map +0 -7
  83. package/dist/lib/node/meta.cjs.map +0 -7
  84. package/dist/lib/node-esm/chunk-IE2S5YZ2.mjs.map +0 -7
  85. package/dist/lib/node-esm/chunk-WNE2FPQW.mjs +0 -17
  86. package/dist/lib/node-esm/chunk-WNE2FPQW.mjs.map +0 -7
  87. package/dist/lib/node-esm/meta.mjs +0 -10
  88. package/dist/lib/node-esm/meta.mjs.map +0 -7
  89. package/dist/types/src/components/Chess.d.ts.map +0 -1
  90. package/dist/types/src/components/Chessboard/Chessboard.d.ts +0 -37
  91. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +0 -1
  92. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +0 -13
  93. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +0 -1
  94. package/dist/types/src/components/Chessboard/index.d.ts +0 -2
  95. package/dist/types/src/components/Chessboard/index.d.ts.map +0 -1
  96. package/dist/types/src/components/Chessboard/pieces/custom.d.ts +0 -3
  97. package/dist/types/src/components/Chessboard/pieces/custom.d.ts.map +0 -1
  98. package/dist/types/src/components/Chessboard/pieces/index.d.ts +0 -4
  99. package/dist/types/src/components/Chessboard/pieces/index.d.ts.map +0 -1
  100. package/dist/types/src/components/Chessboard/pieces/phosphor.d.ts +0 -3
  101. package/dist/types/src/components/Chessboard/pieces/phosphor.d.ts.map +0 -1
  102. package/dist/types/src/components/Chessboard/pieces/riohacha.d.ts +0 -3
  103. package/dist/types/src/components/Chessboard/pieces/riohacha.d.ts.map +0 -1
  104. package/src/components/Chessboard/Chessboard.stories.tsx +0 -43
  105. package/src/components/Chessboard/Chessboard.tsx +0 -170
  106. package/src/components/Chessboard/index.ts +0 -5
  107. package/src/components/Chessboard/pieces/custom.tsx +0 -82
  108. package/src/components/Chessboard/pieces/index.ts +0 -7
  109. package/src/components/Chessboard/pieces/phosphor.tsx +0 -71
  110. package/src/components/Chessboard/pieces/riohacha.tsx +0 -166
@@ -1,37 +0,0 @@
1
- import { Chess, type Color } from 'chess.js';
2
- import React, { type FC } from 'react';
3
- export declare enum ChessPieces {
4
- STANDARD = 0,
5
- CUSTOM = 1,
6
- FUTURE = 2,
7
- RIOHACHA = 3
8
- }
9
- export type BoardStyle = 'default' | 'blue' | 'dark';
10
- export declare const boardStyles: Record<BoardStyle, any>;
11
- export type ChessModel = {
12
- chess: Chess;
13
- };
14
- export type ChessMove = {
15
- from: string;
16
- to: string;
17
- promotion?: string;
18
- };
19
- export type ChessboardProps = {
20
- model: ChessModel;
21
- orientation?: Color;
22
- readonly?: boolean;
23
- boardStyle?: BoardStyle;
24
- pieces?: ChessPieces;
25
- onUpdate?: (move: ChessMove) => void;
26
- };
27
- /**
28
- * https://www.npmjs.com/package/chess.js
29
- * https://www.npmjs.com/package/react-chessboard
30
- */
31
- export declare const Chessboard: ({ model: { chess }, orientation, readonly, boardStyle, pieces, onUpdate, }: ChessboardProps) => React.JSX.Element;
32
- export declare const ChessPanel: FC<{
33
- model: ChessModel;
34
- orientation?: Color;
35
- onFlip?: () => void;
36
- }>;
37
- //# sourceMappingURL=Chessboard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Chessboard.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chessboard/Chessboard.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQvC,oBAAY,WAAW;IACrB,QAAQ,IAAI;IACZ,MAAM,IAAI;IACV,MAAM,IAAI;IACV,QAAQ,IAAI;CACb;AAcD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,CAa/C,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,+EAOpB,eAAe,sBAoCjB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CA+CA,CAAC"}
@@ -1,13 +0,0 @@
1
- import '@dxos-theme';
2
- import React from 'react';
3
- declare const _default: {
4
- title: string;
5
- component: ({ model: { chess }, orientation, readonly, boardStyle, pieces, onUpdate, }: import("./Chessboard").ChessboardProps) => React.JSX.Element;
6
- render: () => React.JSX.Element;
7
- decorators: import("@storybook/react/*").Decorator[];
8
- };
9
- export default _default;
10
- export declare const Default: {
11
- component: ({ model: { chess }, orientation, readonly, boardStyle, pieces, onUpdate, }: import("./Chessboard").ChessboardProps) => React.JSX.Element;
12
- };
13
- //# sourceMappingURL=Chessboard.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Chessboard.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chessboard/Chessboard.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;AA0BxC,wBAKE;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Chessboard';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chessboard/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- export declare const customPieces: Record<string, ReactNode>;
3
- //# sourceMappingURL=custom.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Chessboard/pieces/custom.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA+D9C,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAclD,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from './custom';
2
- export * from './phosphor';
3
- export * from './riohacha';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Chessboard/pieces/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- export declare const phosphorPieces: Record<string, ReactNode>;
3
- //# sourceMappingURL=phosphor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"phosphor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Chessboard/pieces/phosphor.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAmD9C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAcpD,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- export declare const riohachaPieces: Record<string, ReactNode>;
3
- //# sourceMappingURL=riohacha.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"riohacha.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Chessboard/pieces/riohacha.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAmJ9C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAcpD,CAAC"}
@@ -1,43 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { Chess } from 'chess.js';
8
- import React, { useState } from 'react';
9
-
10
- import { withTheme } from '@dxos/storybook-utils';
11
-
12
- import { Chessboard, type ChessModel, type ChessMove, ChessPanel } from './Chessboard';
13
-
14
- const Story = () => {
15
- const [model, setModel] = useState<ChessModel>({ chess: new Chess() });
16
- const handleUpdate = (move: ChessMove) => {
17
- if (model.chess.move(move)) {
18
- setModel({ ...model });
19
- }
20
- };
21
-
22
- return (
23
- <div className='flex flex-row'>
24
- <div className='w-[600px]'>
25
- <Chessboard model={model} boardStyle='default' onUpdate={handleUpdate} />
26
- </div>
27
- <div className='w-[160px] ml-8'>
28
- <ChessPanel model={model} />
29
- </div>
30
- </div>
31
- );
32
- };
33
-
34
- export default {
35
- title: 'plugins/plugin-chess/Chessboard',
36
- component: Chessboard,
37
- render: Story,
38
- decorators: [withTheme],
39
- };
40
-
41
- export const Default = {
42
- component: Chessboard,
43
- };
@@ -1,170 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { ArrowURightDown, Circle } from '@phosphor-icons/react';
6
- import { Chess, type Color } from 'chess.js';
7
- import React, { type FC } from 'react';
8
- import { Chessboard as ReactChessboard } from 'react-chessboard';
9
- import { useResizeDetector } from 'react-resize-detector';
10
-
11
- import { getSize, mx } from '@dxos/react-ui-theme';
12
-
13
- import { customPieces, phosphorPieces, riohachaPieces } from './pieces';
14
-
15
- export enum ChessPieces {
16
- STANDARD = 0,
17
- CUSTOM = 1,
18
- FUTURE = 2,
19
- RIOHACHA = 3,
20
- }
21
-
22
- const chessPieces = {
23
- [ChessPieces.STANDARD]: undefined,
24
- [ChessPieces.CUSTOM]: customPieces,
25
- [ChessPieces.FUTURE]: phosphorPieces,
26
- [ChessPieces.RIOHACHA]: riohachaPieces,
27
- };
28
-
29
- // TODO(burdon): Replace with classes.
30
- const props = {
31
- customDropSquareStyle: { boxShadow: 'inset 0 0 1px 2px black' },
32
- };
33
-
34
- export type BoardStyle = 'default' | 'blue' | 'dark';
35
-
36
- export const boardStyles: Record<BoardStyle, any> = {
37
- default: {
38
- customDarkSquareStyle: { backgroundColor: '#AE8A68' },
39
- customLightSquareStyle: { backgroundColor: '#f0d9b5' },
40
- },
41
- blue: {
42
- customDarkSquareStyle: { backgroundColor: '#CCD3DB' },
43
- customLightSquareStyle: { backgroundColor: '#6C95B9' },
44
- },
45
- dark: {
46
- customDarkSquareStyle: { backgroundColor: '#555' },
47
- customLightSquareStyle: { backgroundColor: '#888' },
48
- },
49
- };
50
-
51
- export type ChessModel = {
52
- chess: Chess;
53
- };
54
-
55
- export type ChessMove = {
56
- from: string;
57
- to: string;
58
- promotion?: string;
59
- };
60
-
61
- export type ChessboardProps = {
62
- model: ChessModel;
63
- orientation?: Color;
64
- readonly?: boolean;
65
- boardStyle?: BoardStyle;
66
- pieces?: ChessPieces;
67
- onUpdate?: (move: ChessMove) => void;
68
- };
69
-
70
- /**
71
- * https://www.npmjs.com/package/chess.js
72
- * https://www.npmjs.com/package/react-chessboard
73
- */
74
- export const Chessboard = ({
75
- model: { chess },
76
- orientation = 'w',
77
- readonly = false,
78
- boardStyle = 'blue',
79
- pieces = ChessPieces.STANDARD,
80
- onUpdate,
81
- }: ChessboardProps) => {
82
- const { ref, width } = useResizeDetector();
83
- const style = boardStyles[boardStyle];
84
-
85
- const handleDrop = (source: any, target: any, piece: any) => {
86
- try {
87
- // Promotion piece will be selected by popup.
88
- const move = { from: source, to: target, promotion: piece.toLowerCase()[1] };
89
- const state = new Chess(chess.fen());
90
- const result = state.move(move);
91
- if (result) {
92
- onUpdate?.(move);
93
- return true;
94
- } else {
95
- return false;
96
- }
97
- } catch (err) {
98
- return false;
99
- }
100
- };
101
-
102
- // https://react-chessboard.com/?path=/story/example-chessboard--configurable-board
103
- return (
104
- <div ref={ref} className='flex grow aspect-square overflow-hidden'>
105
- <ReactChessboard
106
- boardWidth={width}
107
- position={chess.fen()}
108
- boardOrientation={orientation === 'w' ? 'white' : 'black'}
109
- arePiecesDraggable={!readonly}
110
- onPieceDrop={handleDrop}
111
- customPieces={chessPieces[pieces]}
112
- {...style}
113
- {...props}
114
- />
115
- </div>
116
- );
117
- };
118
-
119
- export const ChessPanel: FC<{
120
- model: ChessModel;
121
- orientation?: Color;
122
- onFlip?: () => void;
123
- }> = ({ model: { chess }, orientation = 'w', onFlip }) => {
124
- const history = chess.history();
125
- const label = chess.isGameOver()
126
- ? chess.isCheckmate()
127
- ? 'CHECKMATE'
128
- : chess.isStalemate()
129
- ? 'STALEMATE'
130
- : 'DRAW'
131
- : chess.isCheck()
132
- ? 'CHECK'
133
- : history.length
134
- ? `Move ${history.length}`
135
- : '';
136
-
137
- const Player = ({ color }: { color: Color }) => {
138
- const turn = color === chess.turn();
139
-
140
- return (
141
- <div className='flex items-center'>
142
- <Circle
143
- className={mx(getSize(4), turn && (chess.isCheckmate() ? 'text-red-500' : 'text-green-500'))}
144
- weight={turn ? 'fill' : 'thin'}
145
- />
146
- </div>
147
- );
148
- };
149
-
150
- return (
151
- <div className='flex flex-col'>
152
- <div className='flex items-center justify-between pl-2 pr-2 border-b' style={{ height: 32 }}>
153
- <Player color={orientation === 'w' ? 'b' : 'w'} />
154
- {onFlip && (
155
- <button onClick={onFlip}>
156
- <ArrowURightDown weight='thin' className={getSize(6)} />
157
- </button>
158
- )}
159
- </div>
160
-
161
- <div className='flex flex-col justify-center pl-2 font-thin' style={{ height: 40 }}>
162
- {label}
163
- </div>
164
-
165
- <div className='flex items-center justify-between pl-2 pr-2 border-t' style={{ height: 32 }}>
166
- <Player color={orientation} />
167
- </div>
168
- </div>
169
- );
170
- };
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- export * from './Chessboard';
@@ -1,82 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { type ReactNode } from 'react';
6
-
7
- const style = {
8
- white: { fill: '#999' },
9
- black: { fill: '#000' },
10
- };
11
-
12
- /**
13
- * https://www.svgrepo.com/collection/line-awesome/
14
- * https://commons.wikimedia.org/wiki/Category:SVG_chess_pieces
15
- * By Cburnett
16
- */
17
- const pieces: Record<string, (style: any) => ReactNode> = {
18
- p: (style) => (
19
- <svg fill='#000000' width='45px' height='45px' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'>
20
- <path
21
- style={style}
22
- d='M 16 9 C 13.800781 9 12 10.800781 12 13 C 12 14.199219 12.558594 15.265625 13.40625 16 L 12 16 C 11.96875 16 11.9375 16 11.90625 16 C 11.355469 16.027344 10.925781 16.496094 10.953125 17.046875 C 10.980469 17.597656 11.449219 18.027344 12 18 L 12.5 18 L 11.09375 21.5625 L 10.375 23 L 9 23 C 8.96875 23 8.9375 23 8.90625 23 C 8.433594 23.03125 8.050781 23.386719 7.980469 23.855469 C 7.914063 24.320313 8.183594 24.773438 8.625 24.9375 L 7.28125 26.28125 L 7 26.59375 L 7 29 L 25 29 L 25 26.59375 L 24.71875 26.28125 L 23.375 24.9375 C 23.832031 24.765625 24.101563 24.289063 24.007813 23.808594 C 23.917969 23.328125 23.488281 22.988281 23 23 L 21.625 23 L 20.90625 21.5625 L 19.5 18 L 20 18 C 20.359375 18.003906 20.695313 17.816406 20.878906 17.503906 C 21.058594 17.191406 21.058594 16.808594 20.878906 16.496094 C 20.695313 16.183594 20.359375 15.996094 20 16 L 18.59375 16 C 19.441406 15.265625 20 14.199219 20 13 C 20 10.800781 18.199219 9 16 9 Z M 16 11 C 17.117188 11 18 11.882813 18 13 C 18 14.117188 17.117188 15 16 15 C 14.882813 15 14 14.117188 14 13 C 14 11.882813 14.882813 11 16 11 Z M 14.6875 18 L 17.3125 18 L 19.0625 22.375 L 19.09375 22.40625 L 19.09375 22.4375 L 19.375 23 L 12.625 23 L 12.90625 22.4375 L 12.90625 22.40625 L 12.9375 22.375 Z M 11.4375 25 L 20.5625 25 L 22.5625 27 L 9.4375 27 Z'
23
- />
24
- </svg>
25
- ),
26
- r: (style) => (
27
- <svg fill='#000000' width='45px' height='45px' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'>
28
- <path
29
- style={style}
30
- d='M 9 4 L 9 13 L 12.75 13 L 12.53125 14 L 12 14 C 11.96875 14 11.9375 14 11.90625 14 C 11.355469 14.027344 10.925781 14.496094 10.953125 15.046875 C 10.980469 15.597656 11.449219 16.027344 12 16 L 12.09375 16 L 11.09375 20.5625 L 10.375 22 L 9 22 C 8.96875 22 8.9375 22 8.90625 22 C 8.355469 22.027344 7.925781 22.496094 7.953125 23.046875 C 7.980469 23.597656 8.449219 24.027344 9 24 L 7.1875 26.40625 L 7 26.65625 L 7 29 L 25 29 L 25 26.65625 L 24.8125 26.40625 L 23 24 C 23.359375 24.003906 23.695313 23.816406 23.878906 23.503906 C 24.058594 23.191406 24.058594 22.808594 23.878906 22.496094 C 23.695313 22.183594 23.359375 21.996094 23 22 L 21.625 22 L 20.90625 20.5625 L 19.90625 16 L 20 16 C 20.359375 16.003906 20.695313 15.816406 20.878906 15.503906 C 21.058594 15.191406 21.058594 14.808594 20.878906 14.496094 C 20.695313 14.183594 20.359375 13.996094 20 14 L 19.46875 14 L 19.25 13 L 23 13 L 23 4 Z M 11 6 L 13 6 L 13 9 L 15 9 L 15 6 L 17 6 L 17 9 L 19 9 L 19 6 L 21 6 L 21 11 L 11 11 Z M 14.78125 13 L 17.21875 13 L 17.4375 14 L 14.5625 14 Z M 14.125 16 L 17.875 16 L 19.03125 21.21875 L 19.0625 21.34375 L 19.09375 21.4375 L 19.375 22 L 12.625 22 L 12.90625 21.4375 L 12.9375 21.34375 L 12.96875 21.21875 Z M 11.5 24 L 20.5 24 L 22.75 27 L 9.25 27 Z'
31
- />
32
- </svg>
33
- ),
34
- n: (style) => (
35
- <svg fill='#000000' width='45px' height='45px' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'>
36
- <path
37
- style={style}
38
- d='M 16 3 C 14.230469 3 13.058594 3.984375 12.59375 5 C 12.242188 5.769531 12.285156 6.304688 12.28125 6.75 C 11.535156 7.257813 10.75 7.90625 10.125 8.53125 C 8.726563 9.929688 7.960938 11.921875 8 14.03125 C 8.019531 15.003906 8.21875 15.980469 8.59375 16.96875 C 8.78125 17.464844 9.125 18.324219 9.4375 19.28125 C 9.75 20.238281 10 21.292969 10 22 L 9 22 C 8.96875 22 8.9375 22 8.90625 22 C 8.367188 22.035156 7.953125 22.492188 7.972656 23.03125 C 7.988281 23.570313 8.429688 23.996094 8.96875 24 L 7.1875 26.40625 L 7 26.65625 L 7 29 L 25 29 L 25 26.65625 L 24.8125 26.40625 L 23 24 C 23.359375 24.003906 23.695313 23.816406 23.878906 23.503906 C 24.058594 23.191406 24.058594 22.808594 23.878906 22.496094 C 23.695313 22.183594 23.359375 21.996094 23 22 L 22 22 C 22 19.738281 20.59375 17.664063 19.28125 16.0625 C 18.53125 15.144531 18.285156 14.984375 17.78125 14.5 C 17.960938 14.394531 18.183594 14.269531 18.3125 14.1875 C 18.472656 14.085938 18.558594 14.023438 18.59375 14 C 18.875 14 18.894531 14.046875 19.1875 14.28125 C 19.480469 14.515625 20.078125 15 20.90625 15 C 21.632813 15 22.164063 14.53125 22.4375 14.1875 C 22.6875 13.871094 22.824219 13.632813 22.84375 13.59375 C 22.933594 13.550781 23.128906 13.488281 23.375 13.3125 C 23.621094 13.136719 23.941406 12.746094 24 12.3125 C 24.058594 11.878906 23.921875 11.5 23.75 11.125 C 23.496094 10.570313 23.023438 9.933594 22.28125 9.15625 C 21.539063 8.378906 20.566406 7.554688 19.375 7.0625 C 19.285156 7.023438 19.359375 7.082031 19.3125 7.03125 C 19.265625 6.980469 19.125 6.769531 18.84375 6.5625 C 18.476563 6.292969 17.679688 6.261719 17 6.1875 L 17 3 Z M 15 5.21875 L 15 8 L 16 8 C 17.363281 8 17.664063 8.164063 17.65625 8.15625 C 17.652344 8.152344 17.660156 8.171875 17.8125 8.34375 C 17.964844 8.515625 18.261719 8.785156 18.625 8.9375 C 19.425781 9.269531 20.226563 9.917969 20.84375 10.5625 C 21.421875 11.164063 21.808594 11.761719 21.875 11.875 C 21.714844 11.953125 21.546875 12.007813 21.34375 12.25 C 21.070313 12.582031 20.972656 12.8125 20.875 12.9375 C 20.84375 12.976563 20.847656 12.988281 20.84375 13 C 20.757813 12.988281 20.699219 12.933594 20.4375 12.71875 C 20.109375 12.453125 19.457031 12 18.59375 12 C 17.9375 12 17.566406 12.300781 17.25 12.5 C 16.933594 12.699219 16.679688 12.84375 16.59375 12.875 L 16.5625 12.90625 L 16.53125 12.90625 C 16.347656 12.984375 16.03125 13 16.03125 13 L 15 12.96875 L 15 14.5625 L 15.34375 14.84375 C 15.34375 14.84375 16.53125 15.890625 17.71875 17.34375 C 18.90625 18.796875 20 20.667969 20 22 L 12 22 C 12 20.878906 11.6875 19.703125 11.34375 18.65625 C 11 17.609375 10.59375 16.695313 10.4375 16.28125 C 10.144531 15.507813 10.015625 14.707031 10 13.96875 C 9.96875 12.363281 10.542969 10.925781 11.53125 9.9375 C 12.183594 9.285156 13.15625 8.46875 13.6875 8.15625 L 14.1875 7.875 L 14.1875 7.3125 C 14.1875 6.941406 14.1875 6.320313 14.40625 5.84375 C 14.53125 5.574219 14.703125 5.367188 15 5.21875 Z M 11.5 24 L 20.5 24 L 22.75 27 L 9.25 27 Z'
39
- />
40
- </svg>
41
- ),
42
- b: (style) => (
43
- <svg fill='#000000' width='45px' height='45px' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'>
44
- <path
45
- style={style}
46
- d='M 16 3 C 14.90625 3 14 3.90625 14 5 C 14 5.441406 14.15625 5.855469 14.40625 6.1875 C 14.050781 6.5625 13.644531 7.011719 13.21875 7.53125 C 12.171875 8.8125 11 10.292969 11 12 C 11 13.136719 11.414063 14.160156 12.0625 15 L 12 15 C 11.96875 15 11.9375 15 11.90625 15 C 11.355469 15.027344 10.925781 15.496094 10.953125 16.046875 C 10.980469 16.597656 11.449219 17.027344 12 17 L 12.5 17 L 11.09375 20.5625 L 10.375 22 L 9 22 C 8.96875 22 8.9375 22 8.90625 22 C 8.355469 22.027344 7.925781 22.496094 7.953125 23.046875 C 7.980469 23.597656 8.449219 24.027344 9 24 L 7.1875 26.40625 L 7 26.65625 L 7 29 L 25 29 L 25 26.65625 L 24.8125 26.40625 L 23 24 C 23.359375 24.003906 23.695313 23.816406 23.878906 23.503906 C 24.058594 23.191406 24.058594 22.808594 23.878906 22.496094 C 23.695313 22.183594 23.359375 21.996094 23 22 L 21.625 22 L 20.90625 20.5625 L 19.5 17 L 20 17 C 20.359375 17.003906 20.695313 16.816406 20.878906 16.503906 C 21.058594 16.191406 21.058594 15.808594 20.878906 15.496094 C 20.695313 15.183594 20.359375 14.996094 20 15 C 20.628906 14.160156 21 13.121094 21 12 C 21 10.292969 19.828125 8.8125 18.78125 7.53125 C 18.355469 7.011719 17.949219 6.5625 17.59375 6.1875 C 17.84375 5.855469 18 5.441406 18 5 C 18 3.90625 17.09375 3 16 3 Z M 16 7.46875 C 16.363281 7.835938 16.609375 8.066406 17.21875 8.8125 C 18.171875 9.980469 19 11.5 19 12 C 19 13.679688 17.699219 15 16.03125 15 C 14.363281 15 13 13.660156 13 12 C 13 11.5 13.828125 9.980469 14.78125 8.8125 C 15.390625 8.066406 15.636719 7.835938 16 7.46875 Z M 14.6875 17 L 17.3125 17 L 19.0625 21.375 L 19.09375 21.40625 L 19.09375 21.4375 L 19.375 22 L 12.625 22 L 12.90625 21.4375 L 12.90625 21.40625 L 12.9375 21.375 Z M 11.5 24 L 20.5 24 L 22.75 27 L 9.25 27 Z'
47
- />
48
- </svg>
49
- ),
50
- q: (style) => (
51
- <svg fill='#000000' width='45px' height='45px' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'>
52
- <path
53
- style={style}
54
- d='M 16 3 C 14.90625 3 14 3.90625 14 5 C 14 5.730469 14.402344 6.371094 15 6.71875 L 15 8.25 C 15 8.675781 14.675781 9 14.25 9 L 11.90625 9 C 11.59375 9 11.316406 8.851563 11.15625 8.625 C 11.667969 8.261719 12 7.667969 12 7 C 12 5.90625 11.09375 5 10 5 C 8.90625 5 8 5.90625 8 7 C 8 7.730469 8.402344 8.371094 9 8.71875 L 9 10.40625 L 9.28125 10.71875 L 11.625 13.0625 C 11.167969 13.234375 10.902344 13.710938 10.996094 14.1875 C 11.089844 14.667969 11.511719 15.011719 12 15 L 12.65625 15 L 11.09375 20.5625 L 11.03125 20.71875 L 10.375 22 L 9 22 C 8.96875 22 8.9375 22 8.90625 22 C 8.355469 22.027344 7.925781 22.496094 7.953125 23.046875 C 7.980469 23.597656 8.449219 24.027344 9 24 L 7.1875 26.40625 L 7 26.65625 L 7 29 L 25 29 L 25 26.65625 L 24.8125 26.40625 L 23 24 C 23.359375 24.003906 23.695313 23.816406 23.878906 23.503906 C 24.058594 23.191406 24.058594 22.808594 23.878906 22.496094 C 23.695313 22.183594 23.359375 21.996094 23 22 L 21.625 22 L 20.96875 20.71875 L 20.9375 20.65625 L 20.90625 20.5625 L 19.34375 15 L 20 15 C 20.488281 15.011719 20.917969 14.671875 21.007813 14.191406 C 21.101563 13.710938 20.832031 13.234375 20.375 13.0625 L 22.71875 10.71875 L 23 10.40625 L 23 8.71875 C 23.597656 8.371094 24 7.730469 24 7 C 24 5.90625 23.09375 5 22 5 C 20.90625 5 20 5.90625 20 7 C 20 7.667969 20.332031 8.261719 20.84375 8.625 C 20.683594 8.851563 20.40625 9 20.09375 9 L 17.75 9 C 17.324219 9 17 8.675781 17 8.25 L 17 6.71875 C 17.597656 6.371094 18 5.730469 18 5 C 18 3.90625 17.09375 3 16 3 Z M 16 10.34375 C 16.480469 10.746094 17.082031 11 17.75 11 L 19.5625 11 L 17.5625 13 L 14.4375 13 L 12.4375 11 L 14.25 11 C 14.917969 11 15.519531 10.746094 16 10.34375 Z M 14.75 15 L 17.25 15 L 19.03125 21.28125 L 19.0625 21.375 L 19.375 22 L 12.625 22 L 12.9375 21.375 L 12.96875 21.28125 Z M 11.5 24 L 20.5 24 L 22.75 27 L 9.25 27 Z'
55
- />
56
- </svg>
57
- ),
58
- k: (style) => (
59
- <svg fill='#000000' width='45px' height='45px' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'>
60
- <path
61
- style={style}
62
- d='M 16 3 C 14.90625 3 14 3.90625 14 5 C 14 5.359375 14.109375 5.707031 14.28125 6 L 8 6 L 8 8.375 L 8.21875 8.625 L 11.875 13 C 11.324219 13.035156 10.902344 13.511719 10.9375 14.0625 C 10.972656 14.613281 11.449219 15.035156 12 15 L 12.65625 15 L 11.09375 20.5625 L 11.03125 20.71875 L 10.375 22 L 9 22 C 8.96875 22 8.9375 22 8.90625 22 C 8.355469 22.027344 7.925781 22.496094 7.953125 23.046875 C 7.980469 23.597656 8.449219 24.027344 9 24 L 7.1875 26.40625 L 7 26.65625 L 7 29 L 25 29 L 25 26.65625 L 24.8125 26.40625 L 23 24 C 23.359375 24.003906 23.695313 23.816406 23.878906 23.503906 C 24.058594 23.191406 24.058594 22.808594 23.878906 22.496094 C 23.695313 22.183594 23.359375 21.996094 23 22 L 21.625 22 L 20.96875 20.71875 L 20.9375 20.65625 L 20.90625 20.5625 L 19.34375 15 L 20 15 C 20.550781 15.042969 21.035156 14.628906 21.078125 14.078125 C 21.121094 13.527344 20.707031 13.042969 20.15625 13 L 23.78125 8.625 L 24 8.375 L 24 6 L 17.71875 6 C 17.890625 5.707031 18 5.359375 18 5 C 18 3.90625 17.09375 3 16 3 Z M 10.3125 8 L 21.6875 8 L 17.53125 13 L 14.46875 13 Z M 14.75 15 L 17.25 15 L 19.03125 21.28125 L 19.0625 21.375 L 19.375 22 L 12.625 22 L 12.9375 21.375 L 12.96875 21.28125 Z M 11.5 24 L 20.5 24 L 22.75 27 L 9.25 27 Z'
63
- />
64
- </svg>
65
- ),
66
- };
67
-
68
- export const customPieces: Record<string, ReactNode> = {
69
- wP: pieces.p(style.white),
70
- wR: pieces.r(style.white),
71
- wN: pieces.n(style.white),
72
- wB: pieces.b(style.white),
73
- wQ: pieces.q(style.white),
74
- wK: pieces.k(style.white),
75
-
76
- bP: pieces.p(style.black),
77
- bR: pieces.r(style.black),
78
- bN: pieces.n(style.black),
79
- bB: pieces.b(style.black),
80
- bQ: pieces.q(style.black),
81
- bK: pieces.k(style.black),
82
- };
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- export * from './custom';
6
- export * from './phosphor';
7
- export * from './riohacha';
@@ -1,71 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { Flame, Crown, ShieldStar, Plus, Asterisk, User } from '@phosphor-icons/react';
6
- import React, { type ReactNode } from 'react';
7
-
8
- const style = {
9
- white: { width: undefined, height: undefined, color: 'darkred' },
10
- black: { width: undefined, height: undefined, color: 'black' },
11
- };
12
-
13
- const Wrapper = ({ children }: { children: ReactNode }) => (
14
- <svg viewBox='-1, -1, 42, 42' className='logo'>
15
- <g transform='translate(5 5) scale(0.75 0.75)'>{children}</g>
16
- </svg>
17
- );
18
-
19
- /**
20
- * From lichess.
21
- * Select pieces from settings.
22
- * Inspect pieces; hover over background-image CSS (data URL); open image in new tab; inspect image and copy SVG HTML.
23
- */
24
- const pieces: Record<string, (style: any) => ReactNode> = {
25
- p: (style) => (
26
- <Wrapper>
27
- <User {...style} />
28
- </Wrapper>
29
- ),
30
- r: (style) => (
31
- <Wrapper>
32
- <Plus {...style} />
33
- </Wrapper>
34
- ),
35
- n: (style) => (
36
- <Wrapper>
37
- <ShieldStar {...style} />
38
- </Wrapper>
39
- ),
40
- b: (style) => (
41
- <Wrapper>
42
- <Flame {...style} />
43
- </Wrapper>
44
- ),
45
- q: (style) => (
46
- <Wrapper>
47
- <Asterisk {...style} />
48
- </Wrapper>
49
- ),
50
- k: (style) => (
51
- <Wrapper>
52
- <Crown {...style} />
53
- </Wrapper>
54
- ),
55
- };
56
-
57
- export const phosphorPieces: Record<string, ReactNode> = {
58
- wP: pieces.p(style.white),
59
- wR: pieces.r(style.white),
60
- wN: pieces.n(style.white),
61
- wB: pieces.b(style.white),
62
- wQ: pieces.q(style.white),
63
- wK: pieces.k(style.white),
64
-
65
- bP: pieces.p(style.black),
66
- bR: pieces.r(style.black),
67
- bN: pieces.n(style.black),
68
- bB: pieces.b(style.black),
69
- bQ: pieces.q(style.black),
70
- bK: pieces.k(style.black),
71
- };