cm-chessboard 8.5.6 → 8.5.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "8.5.6",
3
+ "version": "8.5.8",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
package/src/Chessboard.js CHANGED
@@ -8,39 +8,19 @@ import {ChessboardState} from "./model/ChessboardState.js"
8
8
  import {FEN, Position} from "./model/Position.js"
9
9
  import {PositionAnimationsQueue} from "./view/PositionAnimationsQueue.js"
10
10
  import {EXTENSION_POINT} from "./model/Extension.js"
11
- import {ChessboardView} from "./view/ChessboardView.js"
11
+ import {ChessboardView, COLOR, INPUT_EVENT_TYPE, BORDER_TYPE} from "./view/ChessboardView.js"
12
12
  import {Utils} from "./lib/Utils.js"
13
13
 
14
- export const COLOR = {
15
- white: "w",
16
- black: "b"
17
- }
18
- export const INPUT_EVENT_TYPE = {
19
- moveInputStarted: "moveInputStarted",
20
- movingOverSquare: "movingOverSquare", // while dragging or hover after click
21
- validateMoveInput: "validateMoveInput",
22
- moveInputCanceled: "moveInputCanceled",
23
- moveInputFinished: "moveInputFinished"
24
- }
25
- /** @deprecated */
26
- export const SQUARE_SELECT_TYPE = {
27
- primary: "primary",
28
- secondary: "secondary"
29
- }
30
- export const BORDER_TYPE = {
31
- none: "none", // no border
32
- thin: "thin", // thin border
33
- frame: "frame" // wide border with coordinates in it
34
- }
35
14
  export const PIECE = {
36
15
  wp: "wp", wb: "wb", wn: "wn", wr: "wr", wq: "wq", wk: "wk",
37
16
  bp: "bp", bb: "bb", bn: "bn", br: "br", bq: "bq", bk: "bk"
38
17
  }
39
-
40
18
  export const PIECES_FILE_TYPE = {
41
19
  svgSprite: "svgSprite"
42
20
  }
43
-
21
+ export {COLOR}
22
+ export {INPUT_EVENT_TYPE}
23
+ export {BORDER_TYPE}
44
24
  export {FEN}
45
25
 
46
26
  export class Chessboard {
@@ -5,12 +5,28 @@
5
5
  */
6
6
 
7
7
  import {VisualMoveInput} from "./VisualMoveInput.js"
8
- import {BORDER_TYPE, COLOR, INPUT_EVENT_TYPE} from "../Chessboard.js"
9
8
  import {Position} from "../model/Position.js"
10
9
  import {EXTENSION_POINT} from "../model/Extension.js"
11
10
  import {Svg} from "../lib/Svg.js"
12
11
  import {Utils} from "../lib/Utils.js"
13
12
 
13
+ export const COLOR = {
14
+ white: "w",
15
+ black: "b"
16
+ }
17
+ export const INPUT_EVENT_TYPE = {
18
+ moveInputStarted: "moveInputStarted",
19
+ movingOverSquare: "movingOverSquare", // while dragging or hover after click
20
+ validateMoveInput: "validateMoveInput",
21
+ moveInputCanceled: "moveInputCanceled",
22
+ moveInputFinished: "moveInputFinished"
23
+ }
24
+ export const BORDER_TYPE = {
25
+ none: "none", // no border
26
+ thin: "thin", // thin border
27
+ frame: "frame" // wide border with coordinates in it
28
+ }
29
+
14
30
  export class ChessboardView {
15
31
  constructor(chessboard) {
16
32
  this.chessboard = chessboard
@@ -35,7 +51,6 @@ export class ChessboardView {
35
51
  }
36
52
  this.positionsAnimationTask = Promise.resolve()
37
53
  this.pointerDownListener = this.pointerDownHandler.bind(this)
38
- this.pointerDownListener = this.pointerDownHandler.bind(this)
39
54
  this.container.addEventListener("mousedown", this.pointerDownListener)
40
55
  this.container.addEventListener("touchstart", this.pointerDownListener, {passive: false})
41
56
  this.createSvgAndGroups()