forked from justinfagnani/chessboard-element
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.json
392 lines (392 loc) · 18.1 KB
/
docs.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
{
"version": "experimental",
"modules": [
{
"path": "chessboard-element.ts",
"exports": [
{
"kind": "class",
"name": "ChessBoardElement",
"description": "A custom element that renders an interactive chess board.",
"tagName": "chess-board",
"members": [
{
"kind": "field",
"name": "position",
"description": "The current position of the board, as a `PositionObject`. This property may\nbe set externally, but only to valid `PositionObject`s. The value is copied\nbefore being applied to the board. Changes to the position object are not\nreflected in th rendering.\n\nTo set the position using FEN, or a keyword like `'start'`, or to use\nanimations, use the `setPosition` method.",
"privacy": "public",
"type": "PositionObject"
},
{
"kind": "field",
"name": "hideNotation",
"description": "Whether to show the board notation.",
"default": false,
"privacy": "public",
"type": "boolean"
},
{
"kind": "field",
"name": "showNotation",
"description": "Whether to show the board notation. This is always the inverse of\n`hideNotation`, which reflects the `hide-notation` attribute.",
"default": "true",
"privacy": "public",
"type": "boolean"
},
{
"kind": "field",
"name": "orientation",
"description": "The orientation of the board. `'white'` for the white player at the bottom,\n`'black'` for the black player at the bottom.",
"default": "white",
"privacy": "public",
"type": "SquareColor"
},
{
"kind": "field",
"name": "draggablePieces",
"description": "If `true`, pieces on the board are draggable to other squares.",
"default": false,
"privacy": "public",
"type": "boolean"
},
{
"kind": "field",
"name": "dropOffBoard",
"description": "If `'snapback'`, pieces dropped off the board will return to their original\nsquare. If `'trash'`, pieces dropped off the board will be removed from the\nboard.\n\nThis property has no effect when `draggable` is `false`.",
"default": "snapback",
"privacy": "public",
"type": "OffBoardAction"
},
{
"kind": "field",
"name": "pieceTheme",
"description": "A template string used to determine the source of piece images. If\n`pieceTheme` is a function the first argument is the piece code. The\nfunction should return an `<img>` source.",
"default": "wikipediaPiece",
"privacy": "public",
"type": "string | ((piece: string) => string)"
},
{
"kind": "field",
"name": "moveSpeed",
"description": "Animation speed for when pieces move between squares or from spare pieces\nto the board.",
"default": 200,
"privacy": "public",
"type": "AnimationSpeed"
},
{
"kind": "field",
"name": "snapbackSpeed",
"description": "Animation speed for when pieces that were dropped outside the board return\nto their original square.",
"default": 60,
"privacy": "public",
"type": "AnimationSpeed"
},
{
"kind": "field",
"name": "snapSpeed",
"description": "Animation speed for when pieces \\\"snap\\\" to a square when dropped.",
"default": 30,
"privacy": "public",
"type": "AnimationSpeed"
},
{
"kind": "field",
"name": "trashSpeed",
"description": "Animation speed for when pieces are removed.",
"default": 100,
"privacy": "public",
"type": "AnimationSpeed"
},
{
"kind": "field",
"name": "appearSpeed",
"description": "Animation speed for when pieces appear on a square.\n\nNote that the \"appear\" animation only occurs when `sparePieces` is `false`.",
"default": 200,
"privacy": "public",
"type": "AnimationSpeed"
},
{
"kind": "field",
"name": "sparePieces",
"description": "If `true`, the board will have spare pieces that can be dropped onto the\nboard. If `sparePieces` is set to `true`, `draggablePieces` gets set to\n`true` as well.",
"default": false,
"privacy": "public",
"type": "boolean"
},
{
"kind": "method",
"name": "setPosition",
"description": "Sets the position of the board.",
"privacy": "public",
"parameters": [
{
"name": "position",
"type": "Position"
},
{
"name": "useAnimation",
"description": "If `true`, animate to the new position. If `false`,\nshow the new position instantly."
}
]
},
{
"kind": "method",
"name": "fen",
"description": "Returns the current position as a FEN string.",
"privacy": "public",
"parameters": []
},
{
"kind": "method",
"name": "start",
"description": "Sets the board to the start position.",
"privacy": "public",
"parameters": [
{
"name": "useAnimation",
"type": "boolean",
"description": "If `true`, animate to the new position. If `false`,\nshow the new position instantly."
}
]
},
{
"kind": "method",
"name": "clear",
"description": "Removes all the pieces on the board. If `useAnimation` is `false`, removes\npieces instantly.\n\nThis is shorthand for `setPosition({})`.",
"privacy": "public",
"parameters": [
{
"name": "useAnimation",
"type": "boolean",
"description": "If `true`, animate to the new position. If `false`,\nshow the new position instantly."
}
]
},
{
"kind": "method",
"name": "move",
"description": "Executes one or more moves on the board.\n\nMoves are strings the form of \"e2-e4\", \"f6-d5\", etc., Pass `false` as an\nargument to disable animation.",
"privacy": "public",
"parameters": [
{
"name": "args",
"type": "(string | false)[]"
}
]
},
{
"kind": "method",
"name": "flip",
"description": "Flip the orientation.",
"privacy": "public",
"parameters": []
},
{
"kind": "method",
"name": "resize",
"description": "Recalculates board and square sizes based on the parent element and redraws\nthe board accordingly.",
"privacy": "public",
"parameters": []
}
],
"attributes": [
{
"name": "position",
"fieldName": "position",
"description": "The current position of the board, as a `PositionObject`. This property may\nbe set externally, but only to valid `PositionObject`s. The value is copied\nbefore being applied to the board. Changes to the position object are not\nreflected in th rendering.\n\nTo set the position using FEN, or a keyword like `'start'`, or to use\nanimations, use the `setPosition` method.",
"type": "{ [square: string]: string | undefined; }"
},
{
"name": "hide-notation",
"fieldName": "hideNotation",
"description": "Whether to show the board notation.",
"type": "boolean",
"default": "false"
},
{
"fieldName": "showNotation",
"description": "Whether to show the board notation. This is always the inverse of\n`hideNotation`, which reflects the `hide-notation` attribute.",
"type": "boolean",
"default": "\"true\""
},
{
"name": "orientation",
"fieldName": "orientation",
"description": "The orientation of the board. `'white'` for the white player at the bottom,\n`'black'` for the black player at the bottom.",
"type": "\"black\" | \"white\"",
"default": "\"white\""
},
{
"name": "draggable-pieces",
"fieldName": "draggablePieces",
"description": "If `true`, pieces on the board are draggable to other squares.",
"type": "boolean",
"default": "false"
},
{
"name": "drop-off-board",
"fieldName": "dropOffBoard",
"description": "If `'snapback'`, pieces dropped off the board will return to their original\nsquare. If `'trash'`, pieces dropped off the board will be removed from the\nboard.\n\nThis property has no effect when `draggable` is `false`.",
"type": "\"trash\" | \"snapback\"",
"default": "\"snapback\""
},
{
"name": "piece-theme",
"fieldName": "pieceTheme",
"description": "A template string used to determine the source of piece images. If\n`pieceTheme` is a function the first argument is the piece code. The\nfunction should return an `<img>` source.",
"type": "string | ((piece: string) => string)",
"default": "\"wikipediaPiece\""
},
{
"name": "move-speed",
"fieldName": "moveSpeed",
"description": "Animation speed for when pieces move between squares or from spare pieces\nto the board.",
"type": "number | \"fast\" | \"slow\"",
"default": "200"
},
{
"name": "snapback-speed",
"fieldName": "snapbackSpeed",
"description": "Animation speed for when pieces that were dropped outside the board return\nto their original square.",
"type": "number | \"fast\" | \"slow\"",
"default": "60"
},
{
"name": "snap-speed",
"fieldName": "snapSpeed",
"description": "Animation speed for when pieces \\\"snap\\\" to a square when dropped.",
"type": "number | \"fast\" | \"slow\"",
"default": "30"
},
{
"name": "trash-speed",
"fieldName": "trashSpeed",
"description": "Animation speed for when pieces are removed.",
"type": "number | \"fast\" | \"slow\"",
"default": "100"
},
{
"name": "appear-speed",
"fieldName": "appearSpeed",
"description": "Animation speed for when pieces appear on a square.\n\nNote that the \"appear\" animation only occurs when `sparePieces` is `false`.",
"type": "number | \"fast\" | \"slow\"",
"default": "200"
},
{
"name": "spare-pieces",
"fieldName": "sparePieces",
"description": "If `true`, the board will have spare pieces that can be dropped onto the\nboard. If `sparePieces` is set to `true`, `draggablePieces` gets set to\n`true` as well.",
"type": "boolean",
"default": "false"
}
],
"events": [
{
"name": "mouseover-square",
"description": "Fired when the cursor is over a square\nThe event's `detail` object has the following properties:\n* `square`: the square that was entered\n* `piece`: the piece on that square (or `false` if there is no piece)\n* `position`: the current position\n* `orientation`: the current orientation.\n\nNote that `mouseover-square` will *not* fire during piece drag and drop.\nUse `drag-move` instead."
},
{
"name": "mouseout-square",
"description": "Fired when the cursor exits a square\nThe event's `detail` object has the following properties:\n`square`: the square that was left\n`piece`: the piece on that square (or `false` if there is no piece)\n`position`: the current position\n`orientation`: the current orientation.\n\nNote that `mouseout-square` will *not* fire during piece drag and drop.\nUse `drag-move` instead."
},
{
"name": "snapback-end",
"description": "Fired when the snapback animation is complete when\npieces are dropped off the board.\nThe event's `detail` object has the following properties:\n* `piece`: the dragged piece\n* `square`: the square the piece returned to\n* `position`: the current position\n* `orientation`: the current orientation."
},
{
"name": "snap-end",
"description": "Fired when a piece completes a snap animation\nThe event's `detail` object has the following properties:\n* `source`: the source of the dragged piece\n* `square`: the target of the dragged piece\n* `piece`: the dragged piece"
},
{
"name": "drag-start",
"description": "Fired when a piece is picked up\nThe event's `detail` object has the following properties:\n* `source`: the source of the piece\n* `piece`: the piece\n* `position`: the current position on the board\n* `orientation`: the current orientation.\n\nThe drag action is prevented if the listener calls `event.preventDefault()`."
},
{
"name": "drag-move",
"description": "Fired when a user-initiated drag moves\nThe event's `detail` object has the following properties:\n* `newLocation`: the new location of the piece\n* `oldLocation`: the old location of the piece\n* `source`: the source of the dragged piece\n* `piece`: the piece\n* `position`: the current position on the board\n* `orientation`: the current orientation."
},
{
"name": "drop",
"description": "Fired when a user-initiated drag ends\nThe event's `detail` object has the following properties:\n* `source`: the source of the dragged piece\n* `target`: the target of the dragged piece\n* `piece`: the piece\n* `newPosition`: the new position once the piece drops\n* `oldPosition`: the old position before the piece was picked up\n* `orientation`: the current orientation.\n* `setAction(action)`: a function to call to change the default action.\n If `'snapback'` is passed to `setAction`, the piece will return to it's source square.\n If `'trash'` is passed to `setAction`, the piece will be removed."
},
{
"name": "move-end",
"description": "Fired when a piece move completes\nThe event's `detail` object has the following properties:\n* `oldPosition`: the old position\n* `newPosition`: the new position"
},
{
"name": "change",
"description": "Fired when the board position changes\nThe event's `detail` property has two properties:\n* `value`: the new position\n* `oldValue`: the old position\n\n**Warning**: do *not* call any position-changing methods in your event\nlistener or you may cause an infinite loop. Position-changing methods\nare: `clear()`, `move()`, `position()`, and `start()`."
},
{
"name": "error",
"description": "Fired in the case of invalid attributes."
}
],
"cssProperties": [
{
"name": "--light-color",
"description": "The background for white squares and text color for black squares",
"default": "#f0d9b5"
},
{
"name": "--dark-color",
"description": "The background for black squares and text color for white squares",
"default": "#b58863"
},
{
"name": "--highlight-color",
"description": "The highlight color",
"default": "yellow"
}
],
"cssParts": [
{
"name": "board",
"description": "The chess board"
},
{
"name": "square",
"description": "A square on the board"
},
{
"name": "piece",
"description": "A chess piece"
},
{
"name": "spare-pieces",
"description": "The spare piece container"
},
{
"name": "dragged-piece",
"description": "The currently dragged piece"
},
{
"name": "white",
"description": "A white square"
},
{
"name": "black",
"description": "A black square"
},
{
"name": "highlight",
"description": "A highlighted square"
},
{
"name": "notation",
"description": "The square location labels"
},
{
"name": "alpha",
"description": "The alpha (column) labels"
},
{
"name": "numeric",
"description": "The numeric (row) labels"
}
]
}
]
}
]
}