🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

chessboard-element

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chessboard-element - npm Package Compare versions

Comparing version

to
1.3.0-pre.2

289

custom-elements.json

@@ -1,288 +0,1 @@

{
"version": "experimental",
"tags": [
{
"name": "chess-board",
"path": "./src/lib/chessboard-element.ts",
"description": "A custom element that renders an interactive chess board.",
"attributes": [
{
"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.",
"type": "PositionObject"
},
{
"name": "hide-notation",
"description": "Whether to show the board notation.",
"type": "boolean",
"default": "false"
},
{
"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.",
"type": "SquareColor",
"default": "\"white\""
},
{
"name": "draggable-pieces",
"description": "If `true`, pieces on the board are draggable to other squares.",
"type": "boolean",
"default": "false"
},
{
"name": "drop-off-board",
"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": "OffBoardAction",
"default": "\"snapback\""
},
{
"name": "piece-theme",
"description": "A template string or function used to determine the source of piece images,\nused by the default `renderPiece` function, which renders an `<img>`\nelement.\n\nIf `pieceTheme` is a string, the pattern {piece} will be replaced by the\npiece code. The result should be an an `<img>` source.\n\nIf `pieceTheme` is a function the first argument is the piece code. The\nfunction should return an `<img>` source.",
"type": "string | ((piece: string) => string) | undefined"
},
{
"name": "move-speed",
"description": "Animation speed for when pieces move between squares or from spare pieces\nto the board.",
"type": "AnimationSpeed",
"default": "200"
},
{
"name": "snapback-speed",
"description": "Animation speed for when pieces that were dropped outside the board return\nto their original square.",
"type": "AnimationSpeed",
"default": "60"
},
{
"name": "snap-speed",
"description": "Animation speed for when pieces \\\"snap\\\" to a square when dropped.",
"type": "AnimationSpeed",
"default": "30"
},
{
"name": "trash-speed",
"description": "Animation speed for when pieces are removed.",
"type": "AnimationSpeed",
"default": "100"
},
{
"name": "appear-speed",
"description": "Animation speed for when pieces appear on a square.\n\nNote that the \"appear\" animation only occurs when `sparePieces` is `false`.",
"type": "AnimationSpeed",
"default": "200"
},
{
"name": "spare-pieces",
"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"
}
],
"properties": [
{
"name": "styles",
"type": "CSSResult",
"default": "\"styles\""
},
{
"name": "position",
"attribute": "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": "PositionObject"
},
{
"name": "hideNotation",
"attribute": "hide-notation",
"description": "Whether to show the board notation.",
"type": "boolean",
"default": "false"
},
{
"name": "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",
"attribute": "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": "SquareColor",
"default": "\"white\""
},
{
"name": "draggablePieces",
"attribute": "draggable-pieces",
"description": "If `true`, pieces on the board are draggable to other squares.",
"type": "boolean",
"default": "false"
},
{
"name": "dropOffBoard",
"attribute": "drop-off-board",
"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": "OffBoardAction",
"default": "\"snapback\""
},
{
"name": "pieceTheme",
"attribute": "piece-theme",
"description": "A template string or function used to determine the source of piece images,\nused by the default `renderPiece` function, which renders an `<img>`\nelement.\n\nIf `pieceTheme` is a string, the pattern {piece} will be replaced by the\npiece code. The result should be an an `<img>` source.\n\nIf `pieceTheme` is a function the first argument is the piece code. The\nfunction should return an `<img>` source.",
"type": "string | ((piece: string) => string) | undefined"
},
{
"name": "renderPiece",
"description": "A function that renders DOM for a piece to a container element. This\nfunction can render any elements and text, including SVG.\n\nThe default value renders an SVG image of the piece, unless the\n`pieceTheme` property is set, then it uses `pieceTheme` to get the URL for\nan `<img>` element.",
"type": "RenderPieceFunction | undefined",
"default": "\"Function\""
},
{
"name": "moveSpeed",
"attribute": "move-speed",
"description": "Animation speed for when pieces move between squares or from spare pieces\nto the board.",
"type": "AnimationSpeed",
"default": "200"
},
{
"name": "snapbackSpeed",
"attribute": "snapback-speed",
"description": "Animation speed for when pieces that were dropped outside the board return\nto their original square.",
"type": "AnimationSpeed",
"default": "60"
},
{
"name": "snapSpeed",
"attribute": "snap-speed",
"description": "Animation speed for when pieces \\\"snap\\\" to a square when dropped.",
"type": "AnimationSpeed",
"default": "30"
},
{
"name": "trashSpeed",
"attribute": "trash-speed",
"description": "Animation speed for when pieces are removed.",
"type": "AnimationSpeed",
"default": "100"
},
{
"name": "appearSpeed",
"attribute": "appear-speed",
"description": "Animation speed for when pieces appear on a square.\n\nNote that the \"appear\" animation only occurs when `sparePieces` is `false`.",
"type": "AnimationSpeed",
"default": "200"
},
{
"name": "sparePieces",
"attribute": "spare-pieces",
"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"
}
]
}
]
}
{"schemaVersion":"1.0.0","modules":[{"kind":"javascript-module","path":"index.js","exports":[{"kind":"js","name":"fenToObj","declaration":{"name":"fenToObj","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"objToFen","declaration":{"name":"objToFen","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"renderWikipediaSVGPiece","declaration":{"name":"renderWikipediaSVGPiece","package":"chessboard-element","module":"lib/chessboard-element.js"}},{"kind":"js","name":"ChessBoardElement","declaration":{"name":"ChessBoardElement","package":"chessboard-element","module":"lib/chessboard-element.js"}},{"kind":"js","name":"START_FEN","declaration":{"name":"START_FEN","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"COLUMNS","declaration":{"name":"COLUMNS","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"whitePieces","declaration":{"name":"whitePieces","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"blackPieces","declaration":{"name":"blackPieces","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"getSquareColor","declaration":{"name":"getSquareColor","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"validSquare","declaration":{"name":"validSquare","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"validMove","declaration":{"name":"validMove","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"validPieceCode","declaration":{"name":"validPieceCode","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"validFen","declaration":{"name":"validFen","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"validPositionObject","declaration":{"name":"validPositionObject","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"START_POSITION","declaration":{"name":"START_POSITION","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"normalizePozition","declaration":{"name":"normalizePozition","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"findClosestPiece","declaration":{"name":"findClosestPiece","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"calculatePositionFromMoves","declaration":{"name":"calculatePositionFromMoves","package":"chessboard-element","module":"lib/chess-utils.js"}}]},{"kind":"javascript-module","path":"lib/chess-utils.js","declarations":[{"kind":"variable","name":"RUN_ASSERTS","type":{"text":"boolean"}},{"kind":"variable","name":"START_FEN","type":{"text":"string"}},{"kind":"variable","name":"COLUMNS","type":{"text":"string[]"}},{"kind":"variable","name":"whitePieces","type":{"text":"string[]"}},{"kind":"variable","name":"blackPieces","type":{"text":"string[]"}},{"kind":"function","name":"getSquareColor","parameters":[{"name":"square","type":{"text":"string"}}],"return":{"type":{"text":"string"}}},{"kind":"function","name":"validSquare","parameters":[{"name":"square","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"validMove","parameters":[{"name":"move","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"validPieceCode","parameters":[{"name":"code","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"squeezeFenEmptySquares","parameters":[{"name":"fen","type":{"text":"string"}}],"return":{"type":{"text":"string"}}},{"kind":"function","name":"expandFenEmptySquares","parameters":[{"name":"fen","type":{"text":"string"}}],"return":{"type":{"text":"string"}}},{"kind":"function","name":"validFen","parameters":[{"name":"fen","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"validPositionObject","parameters":[{"name":"pos","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"fenToPieceCode","parameters":[{"name":"piece","type":{"text":"string"}}],"return":{"type":{"text":"string"}}},{"kind":"function","name":"pieceCodeToFen","parameters":[{"name":"piece","type":{"text":"string"}}],"return":{"type":{"text":"string"}}},{"kind":"function","name":"fenToObj","parameters":[{"name":"fen","type":{"text":"string"}}],"return":{"type":{"text":"boolean | PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":10,"end":24}]}}},{"kind":"variable","name":"START_POSITION","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}},{"kind":"function","name":"objToFen","parameters":[{"name":"obj","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}}],"return":{"type":{"text":"string | boolean"}}},{"kind":"function","name":"normalizePozition","parameters":[{"name":"position","type":{"text":"Position | null","references":[{"name":"Position","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":8}]}}],"return":{"type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}}},{"kind":"function","name":"squareDistance","parameters":[{"name":"squareA","type":{"text":"string"}},{"name":"squareB","type":{"text":"string"}}],"return":{"type":{"text":"number"}}},{"kind":"function","name":"createRadius","parameters":[{"name":"square","type":{"text":"string"}}],"return":{"type":{"text":"string[]"}}},{"kind":"function","name":"findClosestPiece","parameters":[{"name":"position","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}},{"name":"piece","type":{"text":"string"}},{"name":"square","type":{"text":"string"}}],"return":{"type":{"text":"string | boolean"}}},{"kind":"function","name":"calculatePositionFromMoves","parameters":[{"name":"position","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}},{"name":"moves","type":{"text":"{ [from: string]: string; }"}}],"return":{"type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}}}],"exports":[{"kind":"js","name":"START_FEN","declaration":{"name":"START_FEN"}},{"kind":"js","name":"COLUMNS","declaration":{"name":"COLUMNS"}},{"kind":"js","name":"whitePieces","declaration":{"name":"whitePieces"}},{"kind":"js","name":"blackPieces","declaration":{"name":"blackPieces"}},{"kind":"js","name":"getSquareColor","declaration":{"name":"getSquareColor"}},{"kind":"js","name":"validSquare","declaration":{"name":"validSquare"}},{"kind":"js","name":"validMove","declaration":{"name":"validMove"}},{"kind":"js","name":"validPieceCode","declaration":{"name":"validPieceCode"}},{"kind":"js","name":"validFen","declaration":{"name":"validFen"}},{"kind":"js","name":"validPositionObject","declaration":{"name":"validPositionObject"}},{"kind":"js","name":"fenToObj","declaration":{"name":"fenToObj"}},{"kind":"js","name":"START_POSITION","declaration":{"name":"START_POSITION"}},{"kind":"js","name":"objToFen","declaration":{"name":"objToFen"}},{"kind":"js","name":"normalizePozition","declaration":{"name":"normalizePozition"}},{"kind":"js","name":"findClosestPiece","declaration":{"name":"findClosestPiece"}},{"kind":"js","name":"calculatePositionFromMoves","declaration":{"name":"calculatePositionFromMoves"}}]},{"kind":"javascript-module","path":"lib/chessboard-element.js","declarations":[{"kind":"variable","name":"DEFAULT_APPEAR_SPEED","type":{"text":"number"}},{"kind":"variable","name":"DEFAULT_MOVE_SPEED","type":{"text":"number"}},{"kind":"variable","name":"DEFAULT_SNAPBACK_SPEED","type":{"text":"number"}},{"kind":"variable","name":"DEFAULT_SNAP_SPEED","type":{"text":"number"}},{"kind":"variable","name":"DEFAULT_TRASH_SPEED","type":{"text":"number"}},{"kind":"function","name":"assertIsDragging","parameters":[{"name":"dragState","type":{"text":"DragState | undefined","references":[{"name":"DragState","package":"chessboard-element","module":"lib/chessboard-element.js","start":0,"end":9}]}}],"return":{"type":{"text":"void"}}},{"kind":"function","name":"speedToMS","parameters":[{"name":"speed","type":{"text":"string | number"}}],"return":{"type":{"text":"number"}}},{"kind":"function","name":"squareId","parameters":[{"name":"square","type":{"text":"string"}}],"return":{"type":{"text":"string"}}},{"kind":"function","name":"sparePieceId","parameters":[{"name":"piece","type":{"text":"string"}}],"return":{"type":{"text":"string"}}},{"kind":"class","name":"RenderPieceDirective","superclass":{"name":"Directive","package":"lit","module":"directive.js"},"members":[{"kind":"method","name":"render","privacy":"public","parameters":[{"name":"_piece","type":{"text":"string"}},{"name":"_renderPiece","type":{"text":"RenderPieceFunction | undefined","references":[{"name":"RenderPieceFunction","package":"chessboard-element","module":"lib/chessboard-element.js","start":0,"end":19}]},"optional":true}],"return":{"type":{"text":"symbol"}}},{"kind":"method","name":"update","privacy":"public","parameters":[{"name":"part","type":{"text":"AttributePart","references":[{"name":"AttributePart","package":"lit","start":0,"end":13}]}},{"name":"[piece, renderPiece]","type":{"text":"DirectiveParameters<this>","references":[{"name":"DirectiveParameters","package":"lit","module":"directive.js","start":0,"end":19}]}}],"return":{"type":{"text":"symbol"}}}]},{"kind":"variable","name":"renderPieceDirective","type":{"text":"(_piece: string, _renderPiece?: RenderPieceFunction | undefined) => DirectiveResult<typeof RenderPieceDirective>","references":[{"name":"RenderPieceFunction","package":"chessboard-element","module":"lib/chessboard-element.js","start":32,"end":51},{"name":"DirectiveResult","package":"lit-html","module":"directive.js","start":68,"end":83}]}},{"kind":"class","name":"ChessBoardElement","description":"A custom element that renders an interactive chess board.","superclass":{"name":"LitElement","package":"lit"},"members":[{"kind":"field","name":"hideNotation","description":"Whether to show the board notation.","privacy":"public","type":{"text":"boolean"},"default":"false"},{"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.","privacy":"public","type":{"text":"string"},"default":"'white'"},{"kind":"field","name":"draggablePieces","description":"If `true`, pieces on the board are draggable to other squares.","privacy":"public","type":{"text":"boolean"},"default":"false"},{"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`.","privacy":"public","type":{"text":"string"},"default":"'snapback'"},{"kind":"field","name":"pieceTheme","description":"A template string or function used to determine the source of piece images,\nused by the default `renderPiece` function, which renders an `<img>`\nelement.\n\nIf `pieceTheme` is a string, the pattern {piece} will be replaced by the\npiece code. The result should be an an `<img>` source.\n\nIf `pieceTheme` is a function the first argument is the piece code. The\nfunction should return an `<img>` source.","privacy":"public","type":{"text":"string | ((piece: string) => string) | undefined"}},{"kind":"field","name":"renderPiece","description":"A function that renders DOM for a piece to a container element. This\nfunction can render any elements and text, including SVG.\n\nThe default value renders an SVG image of the piece, unless the\n`pieceTheme` property is set, then it uses `pieceTheme` to get the URL for\nan `<img>` element.","privacy":"public","type":{"text":"RenderPieceFunction | undefined","references":[{"name":"RenderPieceFunction","package":"chessboard-element","module":"lib/chessboard-element.js","start":0,"end":19}]},"default":"(\n piece: string,\n container: HTMLElement\n ) => {\n let pieceImage: string | undefined = undefined;\n if (isString(this.pieceTheme)) {\n pieceImage = interpolateTemplate(this.pieceTheme, {piece: piece});\n } else if (isFunction(this.pieceTheme)) {\n pieceImage = this.pieceTheme(piece);\n }\n if (pieceImage === undefined) {\n renderWikipediaSVGPiece(piece, container);\n } else {\n render(html`<img class=\"piece-image\" src=${pieceImage} />`, container);\n }\n }"},{"kind":"field","name":"moveSpeed","description":"Animation speed for when pieces move between squares or from spare pieces\nto the board.","privacy":"public","type":{"text":"string | number"},"default":"DEFAULT_MOVE_SPEED"},{"kind":"field","name":"snapbackSpeed","description":"Animation speed for when pieces that were dropped outside the board return\nto their original square.","privacy":"public","type":{"text":"string | number"},"default":"DEFAULT_SNAPBACK_SPEED"},{"kind":"field","name":"snapSpeed","description":"Animation speed for when pieces \\\"snap\\\" to a square when dropped.","privacy":"public","type":{"text":"string | number"},"default":"DEFAULT_SNAP_SPEED"},{"kind":"field","name":"trashSpeed","description":"Animation speed for when pieces are removed.","privacy":"public","type":{"text":"string | number"},"default":"DEFAULT_TRASH_SPEED"},{"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`.","privacy":"public","type":{"text":"string | number"},"default":"DEFAULT_APPEAR_SPEED"},{"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.","privacy":"public","type":{"text":"boolean"},"default":"false"},{"kind":"field","name":"_draggedPieceElement","privacy":"private","type":{"text":"HTMLElement","references":[{"name":"HTMLElement","package":"global:","start":0,"end":11}]}},{"kind":"field","name":"_highlightedSquares","privacy":"private","type":{"text":"Set<unknown>","references":[{"name":"Set","package":"global:","start":0,"end":3}]},"default":"new Set()"},{"kind":"field","name":"_animations","privacy":"private","type":{"text":"Map<string, Animation>","references":[{"name":"Map","package":"global:","start":0,"end":3},{"name":"Animation","package":"chessboard-element","module":"lib/chessboard-element.js","start":12,"end":21}]},"default":"new Map<Location, Animation>()"},{"kind":"field","name":"_currentPosition","privacy":"private","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]},"default":"{}"},{"kind":"field","name":"_dragState","privacy":"private","type":{"text":"DragState | undefined","references":[{"name":"DragState","package":"chessboard-element","module":"lib/chessboard-element.js","start":0,"end":9}]}},{"kind":"field","name":"_mousemoveWindow","privacy":"private","type":{"text":"(e: MouseEvent | TouchEvent) => void","references":[{"name":"MouseEvent","package":"global:","start":4,"end":14},{"name":"TouchEvent","package":"global:","start":17,"end":27}]},"default":"(e: MouseEvent | TouchEvent) => {\n // Do nothing if we are not dragging a piece\n if (!(this._dragState?.state === 'dragging')) {\n return;\n }\n // Prevent screen from scrolling\n e.preventDefault();\n const pos = e instanceof MouseEvent ? e : e.changedTouches[0];\n this._updateDraggedPiece(pos.clientX, pos.clientY);\n }"},{"kind":"field","name":"_mouseupWindow","privacy":"private","type":{"text":"(e: MouseEvent | TouchEvent) => void","references":[{"name":"MouseEvent","package":"global:","start":4,"end":14},{"name":"TouchEvent","package":"global:","start":17,"end":27}]},"default":"(e: MouseEvent | TouchEvent) => {\n // Do nothing if we are not dragging a piece\n if (!(this._dragState?.state === 'dragging')) {\n return;\n }\n const pos = e instanceof MouseEvent ? e : e.changedTouches[0];\n const location = this._isXYOnSquare(pos.clientX, pos.clientY);\n this._stopDraggedPiece(location);\n }"},{"kind":"field","name":"position","privacy":"public","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}},{"kind":"field","name":"showNotation","privacy":"public","type":{"text":"boolean"}},{"kind":"field","name":"_squareSize","privacy":"private","type":{"text":"number"}},{"kind":"field","name":"styles","static":true,"privacy":"public","type":{"text":"CSSResult","references":[{"name":"CSSResult","package":"lit","start":0,"end":9}]},"default":"styles"},{"kind":"method","name":"_getSquareElement","privacy":"private","parameters":[{"name":"square","type":{"text":"string"}}],"return":{"type":{"text":"HTMLElement","references":[{"name":"HTMLElement","package":"global:","start":0,"end":11}]}}},{"kind":"method","name":"_getSparePieceElement","privacy":"private","parameters":[{"name":"piece","type":{"text":"string"}}],"return":{"type":{"text":"HTMLElement","references":[{"name":"HTMLElement","package":"global:","start":0,"end":11}]}}},{"kind":"method","name":"render","privacy":"public","return":{"type":{"text":"TemplateResult<1>","references":[{"name":"TemplateResult","package":"lit-html","start":0,"end":14}]}}},{"kind":"method","name":"_renderSparePieces","privacy":"private","parameters":[{"name":"color","type":{"text":"string"}}],"return":{"type":{"text":"unique symbol | TemplateResult<1>","references":[{"name":"TemplateResult","package":"lit-html","start":16,"end":30}]}}},{"kind":"method","name":"_renderDraggedPiece","privacy":"private","return":{"type":{"text":"unique symbol | TemplateResult<1>","references":[{"name":"TemplateResult","package":"lit-html","start":16,"end":30}]}}},{"kind":"method","name":"_renderBoard","privacy":"private","return":{"type":{"text":"TemplateResult<1>","references":[{"name":"TemplateResult","package":"lit-html","start":0,"end":14}]}}},{"kind":"method","name":"_renderPiece","privacy":"public","parameters":[{"name":"piece","type":{"text":"string | undefined"}},{"name":"styles","type":{"text":"Partial<CSSStyleDeclaration>","references":[{"name":"Partial","package":"global:","start":0,"end":7},{"name":"CSSStyleDeclaration","package":"global:","start":8,"end":27}]}},{"name":"isDragSource","type":{"text":"boolean | undefined"},"optional":true},{"name":"id","type":{"text":"string | undefined"},"optional":true},{"name":"part","type":{"text":"string | undefined"},"optional":true}],"return":{"type":{"text":"unique symbol | TemplateResult<1>","references":[{"name":"TemplateResult","package":"lit-html","start":16,"end":30}]}}},{"kind":"method","name":"_getAnimationStyles","privacy":"private","parameters":[{"name":"piece","type":{"text":"string | undefined"}},{"name":"animation","type":{"text":"Animation | undefined","references":[{"name":"Animation","package":"chessboard-element","module":"lib/chessboard-element.js","start":0,"end":9}]},"optional":true}],"return":{"type":{"text":"Partial<CSSStyleDeclaration>","references":[{"name":"Partial","package":"global:","start":0,"end":7},{"name":"CSSStyleDeclaration","package":"global:","start":8,"end":27}]}}},{"kind":"method","name":"_mousedownSquare","privacy":"private","parameters":[{"name":"e","type":{"text":"MouseEvent | TouchEvent","references":[{"name":"MouseEvent","package":"global:","start":0,"end":10},{"name":"TouchEvent","package":"global:","start":13,"end":23}]}}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"_mousedownSparePiece","privacy":"private","parameters":[{"name":"e","type":{"text":"MouseEvent | TouchEvent","references":[{"name":"MouseEvent","package":"global:","start":0,"end":10},{"name":"TouchEvent","package":"global:","start":13,"end":23}]}}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"_mouseenterSquare","privacy":"private","parameters":[{"name":"e","type":{"text":"Event","references":[{"name":"Event","package":"global:","start":0,"end":5}]}}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"_mouseleaveSquare","privacy":"private","parameters":[{"name":"e","type":{"text":"Event","references":[{"name":"Event","package":"global:","start":0,"end":5}]}}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"setPosition","description":"Sets the position of the board.","privacy":"public","parameters":[{"name":"position","type":{"text":"Position","references":[{"name":"Position","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":8}]}},{"name":"useAnimation","description":"If `true`, animate to the new position. If `false`,\nshow the new position instantly.","type":{"text":"boolean"},"default":"true","optional":true}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"fen","description":"Returns the current position as a FEN string.","privacy":"public","return":{"type":{"text":"string | boolean"}}},{"kind":"method","name":"start","description":"Sets the board to the start position.","privacy":"public","parameters":[{"name":"useAnimation","description":"If `true`, animate to the new position. If `false`,\nshow the new position instantly.","type":{"text":"boolean | undefined"},"optional":true}],"return":{"type":{"text":"void"}}},{"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","description":"If `true`, animate to the new position. If `false`,\nshow the new position instantly.","type":{"text":"boolean | undefined"},"optional":true}],"return":{"type":{"text":"void"}}},{"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":{"text":"(string | false)[]"},"rest":true}],"return":{"type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}}},{"kind":"method","name":"flip","description":"Flip the orientation.","privacy":"public","return":{"type":{"text":"void"}}},{"kind":"method","name":"resize","description":"Recalculates board and square sizes based on the parent element and redraws\nthe board accordingly.","privacy":"public","return":{"type":{"text":"void"}}},{"kind":"method","name":"firstUpdated","privacy":"public","return":{"type":{"text":"void"}}},{"kind":"method","name":"connectedCallback","privacy":"public","return":{"type":{"text":"void"}}},{"kind":"method","name":"disconnectedCallback","privacy":"public","return":{"type":{"text":"void"}}},{"kind":"method","name":"_setCurrentPosition","privacy":"private","parameters":[{"name":"position","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"_isXYOnSquare","privacy":"private","parameters":[{"name":"x","type":{"text":"number"}},{"name":"y","type":{"text":"number"}}],"return":{"type":{"text":"string"}}},{"kind":"method","name":"_highlightSquare","privacy":"private","parameters":[{"name":"square","type":{"text":"string"}},{"name":"value","type":{"text":"boolean"},"default":"true","optional":true}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"_snapbackDraggedPiece","privacy":"private","return":{"type":{"text":"Promise<void>","references":[{"name":"Promise","package":"global:","start":0,"end":7}]}}},{"kind":"method","name":"_trashDraggedPiece","privacy":"private","return":{"type":{"text":"Promise<void>","references":[{"name":"Promise","package":"global:","start":0,"end":7}]}}},{"kind":"method","name":"_dropDraggedPieceOnSquare","privacy":"private","parameters":[{"name":"square","type":{"text":"string"}}],"return":{"type":{"text":"Promise<void>","references":[{"name":"Promise","package":"global:","start":0,"end":7}]}}},{"kind":"method","name":"_beginDraggingPiece","privacy":"private","parameters":[{"name":"source","type":{"text":"string"}},{"name":"piece","type":{"text":"string"}},{"name":"x","type":{"text":"number"}},{"name":"y","type":{"text":"number"}}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"_updateDraggedPiece","privacy":"private","parameters":[{"name":"x","type":{"text":"number"}},{"name":"y","type":{"text":"number"}}],"return":{"type":{"text":"void"}}},{"kind":"method","name":"_stopDraggedPiece","privacy":"private","parameters":[{"name":"location","type":{"text":"string"}}],"return":{"type":{"text":"Promise<void>","references":[{"name":"Promise","package":"global:","start":0,"end":7}]}}},{"kind":"method","name":"_calculateAnimations","privacy":"private","parameters":[{"name":"pos1","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}},{"name":"pos2","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}}],"return":{"type":{"text":"Animation[]","references":[{"name":"Animation","package":"chessboard-element","module":"lib/chessboard-element.js","start":0,"end":9}]}}},{"kind":"method","name":"_doAnimations","privacy":"private","parameters":[{"name":"animations","type":{"text":"Animation[]","references":[{"name":"Animation","package":"chessboard-element","module":"lib/chessboard-element.js","start":0,"end":9}]}},{"name":"oldPos","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}},{"name":"newPos","type":{"text":"PositionObject","references":[{"name":"PositionObject","package":"chessboard-element","module":"lib/chess-utils.js","start":0,"end":14}]}}],"return":{"type":{"text":"Promise<void>","references":[{"name":"Promise","package":"global:","start":0,"end":7}]}}},{"kind":"method","name":"_error","privacy":"private","parameters":[{"name":"code","type":{"text":"number"}},{"name":"msg","type":{"text":"string"}},{"name":"_obj","type":{"text":"unknown"},"optional":true}],"return":{"type":{"text":"Error","references":[{"name":"Error","package":"global:","start":0,"end":5}]}}}],"tagName":"chess-board","customElement":true,"events":[{"name":"mouseover-square","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"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","type":{"text":"Event"},"description":"Fired in the case of invalid attributes."}],"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"}],"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"}]}],"exports":[{"kind":"js","name":"fenToObj","declaration":{"name":"fenToObj","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"objToFen","declaration":{"name":"objToFen","package":"chessboard-element","module":"lib/chess-utils.js"}},{"kind":"js","name":"renderWikipediaSVGPiece","declaration":{"name":"renderPiece","package":"chessboard-element","module":"lib/wikipedia-pieces-svg.js"}},{"kind":"js","name":"ChessBoardElement","declaration":{"name":"ChessBoardElement"}},{"kind":"custom-element-definition","name":"chess-board","declaration":{"name":"ChessBoardElement"}}]},{"kind":"javascript-module","path":"lib/chessboard-styles.js","declarations":[{"kind":"variable","name":"styles","type":{"text":"CSSResult","references":[{"name":"CSSResult","package":"lit","start":0,"end":9}]}}],"exports":[{"kind":"js","name":"styles","declaration":{"name":"styles"}}]},{"kind":"javascript-module","path":"lib/utils.js","declarations":[{"kind":"variable","name":"RUN_ASSERTS","description":"Copyright (c) 2019, Chris Oakman\nCopyright (c) 2019, Justin Fagnani\nReleased under the MIT license\nhttps://github.com/justinfagnani/chessboard-element/blob/master/LICENSE.md","type":{"text":"boolean"}},{"kind":"function","name":"isString","parameters":[{"name":"s","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"isFunction","parameters":[{"name":"f","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"isInteger","parameters":[{"name":"n","type":{"text":"unknown"}}],"return":{"type":{"text":"boolean"}}},{"kind":"function","name":"deepCopy","parameters":[{"name":"thing","type":{"text":"T","references":[{"name":"T","package":"chessboard-element","module":"lib/utils.js","start":0,"end":1}]}}],"return":{"type":{"text":"T","references":[{"name":"T","package":"chessboard-element","module":"lib/utils.js","start":0,"end":1}]}}},{"kind":"function","name":"interpolateTemplate","parameters":[{"name":"str","type":{"text":"string"}},{"name":"obj","type":{"text":"object"}}],"return":{"type":{"text":"string"}}}],"exports":[{"kind":"js","name":"isString","declaration":{"name":"isString"}},{"kind":"js","name":"isFunction","declaration":{"name":"isFunction"}},{"kind":"js","name":"isInteger","declaration":{"name":"isInteger"}},{"kind":"js","name":"deepCopy","declaration":{"name":"deepCopy"}},{"kind":"js","name":"interpolateTemplate","declaration":{"name":"interpolateTemplate"}}]},{"kind":"javascript-module","path":"lib/wikipedia-pieces-svg.js","declarations":[{"kind":"function","name":"renderPiece","parameters":[{"name":"piece","type":{"text":"string"}},{"name":"container","type":{"text":"HTMLElement","references":[{"name":"HTMLElement","package":"global:","start":0,"end":11}]}}],"return":{"type":{"text":"void"}}},{"kind":"variable","name":"pieces","type":{"text":"{ [p: string]: TemplateResult; }","references":[{"name":"TemplateResult","package":"lit","start":15,"end":29}]}}],"exports":[{"kind":"js","name":"renderPiece","declaration":{"name":"renderPiece"}},{"kind":"js","name":"pieces","declaration":{"name":"pieces"}}]}]}

4

package.json

@@ -7,3 +7,3 @@ {

"license": "MIT",
"version": "1.3.0-pre.1",
"version": "1.3.0-pre.2",
"repository": {

@@ -37,3 +37,3 @@ "type": "git",

"build:ts": "tsc",
"analyze": "lit gen labs gen --manifest",
"analyze": "lit labs gen --manifest --out .",
"api": "wca src/lib/chessboard-element.ts -f json2 --outFile docs-src/_data/docs.json --inlineTypes",

@@ -40,0 +40,0 @@ "format": "prettier src/lib/* --write",