diff --git a/Gulpfile.js b/Gulpfile.js index 00ab867..f1fa0c2 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -1,12 +1,11 @@ -import { writeFile, rm, mkdir } from 'node:fs/promises'; +import { writeFile, readFile, rm, mkdir } from 'node:fs/promises'; + import gulp from 'gulp'; +import sass from 'sass'; import { rollup } from 'rollup'; import { terser } from 'rollup-plugin-terser'; -import sass from 'sass'; - -import packageJson from './package.json' assert { type: 'json' }; -const { version } = packageJson; +const { version } = JSON.parse(await readFile('./package.json', 'utf-8')); const banner = `/** @preserve * chessboard.js v${version} * https://github.com/oakmac/chessboardjs/ diff --git a/lib/chessboard.js b/lib/chessboard.js index e66528a..95125fb 100644 --- a/lib/chessboard.js +++ b/lib/chessboard.js @@ -1,19 +1,21 @@ +/* eslint-env browser */ + // --------------------------------------------------------------------------- // Constants // --------------------------------------------------------------------------- -const COLUMNS = 'abcdefgh'.split('') -const DEFAULT_DRAG_THROTTLE_RATE = 20 -const ELLIPSIS = '…' -const START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR' -const START_POSITION = fenToObj(START_FEN) +const COLUMNS = 'abcdefgh'.split(''); +const DEFAULT_DRAG_THROTTLE_RATE = 20; +const ELLIPSIS = '…'; +const START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR'; +const START_POSITION = fenToObj(START_FEN); // default animation speeds -const DEFAULT_APPEAR_SPEED = 200 -const DEFAULT_MOVE_SPEED = 200 -const DEFAULT_SNAPBACK_SPEED = 60 -const DEFAULT_SNAP_SPEED = 30 -const DEFAULT_TRASH_SPEED = 100 +const DEFAULT_APPEAR_SPEED = 200; +const DEFAULT_MOVE_SPEED = 200; +const DEFAULT_SNAPBACK_SPEED = 60; +const DEFAULT_SNAP_SPEED = 30; +const DEFAULT_TRASH_SPEED = 100; // use unique class names to prevent clashing with anything else on the page // and simplify selectors @@ -35,38 +37,38 @@ const ClassNameLookup = { sparePiecesTop: 'spare-pieces-top-4028b', square: 'square-55d63', white: 'white-1e1d7' -} +}; // --------------------------------------------------------------------------- // Misc Util Functions // --------------------------------------------------------------------------- -function throttle (f, interval) { - let timeout = 0 - let shouldFire = false - let args = [] +function throttle(f, interval) { + let timeout = 0; + let shouldFire = false; + let args = []; const handleTimeout = function () { - timeout = 0 + timeout = 0; if (shouldFire) { - shouldFire = false - fire() + shouldFire = false; + fire(); } - } + }; const fire = function () { - timeout = window.setTimeout(handleTimeout, interval) - f(args) - } + timeout = window.setTimeout(handleTimeout, interval); + f(args); + }; return function (..._args) { - args = _args + args = _args; if (!timeout) { - fire() + fire(); } else { - shouldFire = true + shouldFire = true; } - } + }; } // function debounce (f, interval, scope) { @@ -80,15 +82,15 @@ function throttle (f, interval) { // } // } -function uuid () { - return 'xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx'.replace(/x/g, function (c) { - const r = (Math.random() * 16) | 0 - return r.toString(16) - }) +function uuid() { + return 'xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx'.replace(/x/g, function () { + const r = (Math.random() * 16) | 0; + return r.toString(16); + }); } -function deepCopy (thing) { - return JSON.parse(JSON.stringify(thing)) +function deepCopy(thing) { + return JSON.parse(JSON.stringify(thing)); } /** @@ -96,120 +98,120 @@ function deepCopy (thing) { * @param {HTMLElement} element * @returns {{ top: number, left: number }} */ -function getJqueryStyleOffset (element) { - const { documentElement } = document - const { top, left } = element.getBoundingClientRect() +function getJqueryStyleOffset(element) { + const { documentElement } = document; + const { top, left } = element.getBoundingClientRect(); return { top: top + window.pageYOffset - documentElement.clientTop, left: left + window.pageXOffset - documentElement.clientLeft - } + }; } -function interpolateTemplate (str, obj) { +function interpolateTemplate(str, obj) { for (const key in obj) { - if (!Object.prototype.hasOwnProperty.call(obj, key)) continue - const keyTemplateStr = '{' + key + '}' - const value = obj[key] + if (!Object.prototype.hasOwnProperty.call(obj, key)) continue; + const keyTemplateStr = '{' + key + '}'; + const value = obj[key]; while (str.indexOf(keyTemplateStr) !== -1) { - str = str.replace(keyTemplateStr, value) + str = str.replace(keyTemplateStr, value); } } - return str + return str; } // --------------------------------------------------------------------------- // Predicates // --------------------------------------------------------------------------- -function isString (s) { - return typeof s === 'string' +function isString(s) { + return typeof s === 'string'; } -function isFunction (f) { - return typeof f === 'function' +function isFunction(f) { + return typeof f === 'function'; } -function isInteger (n) { +function isInteger(n) { return typeof n === 'number' && isFinite(n) && - Math.floor(n) === n + Math.floor(n) === n; } -function isPlainObject (o) { - return Object.prototype.toString.call(o) === '[object Object]' +function isPlainObject(o) { + return Object.prototype.toString.call(o) === '[object Object]'; } -function validAnimationSpeed (speed) { - if (speed === 'fast' || speed === 'slow') return true - if (!isInteger(speed)) return false - return speed >= 0 +function validAnimationSpeed(speed) { + if (speed === 'fast' || speed === 'slow') return true; + if (!isInteger(speed)) return false; + return speed >= 0; } -function validThrottleRate (rate) { +function validThrottleRate(rate) { return isInteger(rate) && - rate >= 1 + rate >= 1; } -function validMove (move) { +function validMove(move) { // move should be a string - if (!isString(move)) return false + if (!isString(move)) return false; // move should be in the form of "e2-e4", "f6-d5" - const squares = move.split('-') - if (squares.length !== 2) return false + const squares = move.split('-'); + if (squares.length !== 2) return false; - return validSquare(squares[0]) && validSquare(squares[1]) + return validSquare(squares[0]) && validSquare(squares[1]); } -function validSquare (square) { - return isString(square) && square.search(/^[a-h][1-8]$/) !== -1 +function validSquare(square) { + return isString(square) && square.search(/^[a-h][1-8]$/) !== -1; } -function validPieceCode (code) { - return isString(code) && code.search(/^[bw][KQRNBP]$/) !== -1 +function validPieceCode(code) { + return isString(code) && code.search(/^[bw][KQRNBP]$/) !== -1; } -function validFen (fen) { - if (!isString(fen)) return false +function validFen(fen) { + if (!isString(fen)) return false; // cut off any move, castling, etc info from the end // we're only interested in position information - fen = fen.replace(/ .+$/, '') + fen = fen.replace(/ .+$/, ''); // expand the empty square numbers to just 1s - fen = expandFenEmptySquares(fen) + fen = expandFenEmptySquares(fen); // FEN should be 8 sections separated by slashes - const chunks = fen.split('/') - if (chunks.length !== 8) return false + const chunks = fen.split('/'); + if (chunks.length !== 8) return false; // check each section for (let i = 0; i < 8; i++) { if (chunks[i].length !== 8 || chunks[i].search(/[^kqrnbpKQRNBP1]/) !== -1) { - return false + return false; } } - return true + return true; } -function validPositionObject (pos) { - if (!isPlainObject(pos)) return false +function validPositionObject(pos) { + if (!isPlainObject(pos)) return false; for (const i in pos) { - if (!Object.prototype.hasOwnProperty.call(pos, i)) continue + if (!Object.prototype.hasOwnProperty.call(pos, i)) continue; if (!validSquare(i) || !validPieceCode(pos[i])) { - return false + return false; } } - return true + return true; } -function isTouchDevice () { - return 'ontouchstart' in document.documentElement +function isTouchDevice() { + return 'ontouchstart' in document.documentElement; } // --------------------------------------------------------------------------- @@ -217,285 +219,285 @@ function isTouchDevice () { // --------------------------------------------------------------------------- // convert FEN piece code to bP, wK, etc -function fenToPieceCode (piece) { +function fenToPieceCode(piece) { // black piece if (piece.toLowerCase() === piece) { - return 'b' + piece.toUpperCase() + return 'b' + piece.toUpperCase(); } // white piece - return 'w' + piece.toUpperCase() + return 'w' + piece.toUpperCase(); } // convert bP, wK, etc code to FEN structure -function pieceCodeToFen (piece) { - const pieceCodeLetters = piece.split('') +function pieceCodeToFen(piece) { + const pieceCodeLetters = piece.split(''); // white piece if (pieceCodeLetters[0] === 'w') { - return pieceCodeLetters[1].toUpperCase() + return pieceCodeLetters[1].toUpperCase(); } // black piece - return pieceCodeLetters[1].toLowerCase() + return pieceCodeLetters[1].toLowerCase(); } // convert FEN string to position object // returns false if the FEN string is invalid -function fenToObj (fen) { - if (!validFen(fen)) return false +function fenToObj(fen) { + if (!validFen(fen)) return false; // cut off any move, castling, etc info from the end // we're only interested in position information - fen = fen.replace(/ .+$/, '') + fen = fen.replace(/ .+$/, ''); - const rows = fen.split('/') - const position = {} + const rows = fen.split('/'); + const position = {}; - let currentRow = 8 + let currentRow = 8; for (let i = 0; i < 8; i++) { - const row = rows[i].split('') - let colIdx = 0 + const row = rows[i].split(''); + let colIdx = 0; // loop through each character in the FEN section for (let j = 0; j < row.length; j++) { // number / empty squares if (row[j].search(/[1-8]/) !== -1) { - const numEmptySquares = parseInt(row[j], 10) - colIdx = colIdx + numEmptySquares + const numEmptySquares = parseInt(row[j], 10); + colIdx = colIdx + numEmptySquares; } else { // piece - const square = COLUMNS[colIdx] + currentRow - position[square] = fenToPieceCode(row[j]) - colIdx = colIdx + 1 + const square = COLUMNS[colIdx] + currentRow; + position[square] = fenToPieceCode(row[j]); + colIdx = colIdx + 1; } } - currentRow = currentRow - 1 + currentRow = currentRow - 1; } - return position + return position; } // position object to FEN string // returns false if the obj is not a valid position object -function objToFen (obj) { - if (!validPositionObject(obj)) return false +function objToFen(obj) { + if (!validPositionObject(obj)) return false; - let fen = '' + let fen = ''; - let currentRow = 8 + let currentRow = 8; for (let i = 0; i < 8; i++) { for (let j = 0; j < 8; j++) { - const square = COLUMNS[j] + currentRow + const square = COLUMNS[j] + currentRow; // piece exists if (Object.prototype.hasOwnProperty.call(obj, square)) { - fen = fen + pieceCodeToFen(obj[square]) + fen = fen + pieceCodeToFen(obj[square]); } else { // empty space - fen = fen + '1' + fen = fen + '1'; } } if (i !== 7) { - fen = fen + '/' + fen = fen + '/'; } - currentRow = currentRow - 1 + currentRow = currentRow - 1; } // squeeze the empty numbers together - fen = squeezeFenEmptySquares(fen) + fen = squeezeFenEmptySquares(fen); - return fen + return fen; } -function squeezeFenEmptySquares (fen) { +function squeezeFenEmptySquares(fen) { return fen.replace(/11111111/g, '8') .replace(/1111111/g, '7') .replace(/111111/g, '6') .replace(/11111/g, '5') .replace(/1111/g, '4') .replace(/111/g, '3') - .replace(/11/g, '2') + .replace(/11/g, '2'); } -function expandFenEmptySquares (fen) { +function expandFenEmptySquares(fen) { return fen.replace(/8/g, '11111111') .replace(/7/g, '1111111') .replace(/6/g, '111111') .replace(/5/g, '11111') .replace(/4/g, '1111') .replace(/3/g, '111') - .replace(/2/g, '11') + .replace(/2/g, '11'); } // returns the distance between two squares -function squareDistance (squareA, squareB) { - const squareAArray = squareA.split('') - const squareAx = COLUMNS.indexOf(squareAArray[0]) + 1 - const squareAy = parseInt(squareAArray[1], 10) +function squareDistance(squareA, squareB) { + const squareAArray = squareA.split(''); + const squareAx = COLUMNS.indexOf(squareAArray[0]) + 1; + const squareAy = parseInt(squareAArray[1], 10); - const squareBArray = squareB.split('') - const squareBx = COLUMNS.indexOf(squareBArray[0]) + 1 - const squareBy = parseInt(squareBArray[1], 10) + const squareBArray = squareB.split(''); + const squareBx = COLUMNS.indexOf(squareBArray[0]) + 1; + const squareBy = parseInt(squareBArray[1], 10); - const xDelta = Math.abs(squareAx - squareBx) - const yDelta = Math.abs(squareAy - squareBy) + const xDelta = Math.abs(squareAx - squareBx); + const yDelta = Math.abs(squareAy - squareBy); - if (xDelta >= yDelta) return xDelta - return yDelta + if (xDelta >= yDelta) return xDelta; + return yDelta; } // returns the square of the closest instance of piece // returns false if no instance of piece is found in position -function findClosestPiece (position, piece, square) { +function findClosestPiece(position, piece, square) { // create array of closest squares from square - const closestSquares = createRadius(square) + const closestSquares = createRadius(square); // search through the position in order of distance for the piece for (let i = 0; i < closestSquares.length; i++) { - const s = closestSquares[i] + const s = closestSquares[i]; if (Object.prototype.hasOwnProperty.call(position, s) && position[s] === piece) { - return s + return s; } } - return false + return false; } // returns an array of closest squares from square -function createRadius (square) { - const squares = [] +function createRadius(square) { + const squares = []; // calculate distance of all squares for (let i = 0; i < 8; i++) { for (let j = 0; j < 8; j++) { - const s = COLUMNS[i] + (j + 1) + const s = COLUMNS[i] + (j + 1); // skip the square we're starting from - if (square === s) continue + if (square === s) continue; squares.push({ square: s, distance: squareDistance(square, s) - }) + }); } } // sort by distance squares.sort(function (a, b) { - return a.distance - b.distance - }) + return a.distance - b.distance; + }); // just return the square code - const surroundingSquares = [] + const surroundingSquares = []; for (let i = 0; i < squares.length; i++) { - surroundingSquares.push(squares[i].square) + surroundingSquares.push(squares[i].square); } - return surroundingSquares + return surroundingSquares; } // given a position and a set of moves, return a new position // with the moves executed -function calculatePositionFromMoves (position, moves) { - const newPosition = deepCopy(position) +function calculatePositionFromMoves(position, moves) { + const newPosition = deepCopy(position); for (const i in moves) { - if (!Object.prototype.hasOwnProperty.call(moves, i)) continue + if (!Object.prototype.hasOwnProperty.call(moves, i)) continue; // skip the move if the position doesn't have a piece on the source square - if (!Object.prototype.hasOwnProperty.call(newPosition, i)) continue + if (!Object.prototype.hasOwnProperty.call(newPosition, i)) continue; - const piece = newPosition[i] - delete newPosition[i] - newPosition[moves[i]] = piece + const piece = newPosition[i]; + delete newPosition[i]; + newPosition[moves[i]] = piece; } - return newPosition + return newPosition; } // --------------------------------------------------------------------------- // HTML // --------------------------------------------------------------------------- -function buildContainerHTML (hasSparePieces) { - let html = '
' +function buildContainerHTML(hasSparePieces) { + let html = '
'; if (hasSparePieces) { - html += '
' + html += '
'; } - html += '
' + html += '
'; if (hasSparePieces) { - html += '
' + html += '
'; } - html += '
' + html += '
'; - return interpolateTemplate(html, ClassNameLookup) + return interpolateTemplate(html, ClassNameLookup); } // --------------------------------------------------------------------------- // Config // --------------------------------------------------------------------------- -function expandConfigArgumentShorthand (config) { +function expandConfigArgumentShorthand(config) { if (config === 'start') { - config = { position: deepCopy(START_POSITION) } + config = { position: deepCopy(START_POSITION) }; } else if (validFen(config)) { - config = { position: fenToObj(config) } + config = { position: fenToObj(config) }; } else if (validPositionObject(config)) { - config = { position: deepCopy(config) } + config = { position: deepCopy(config) }; } // config must be an object - if (!isPlainObject(config)) config = {} + if (!isPlainObject(config)) config = {}; - return config + return config; } // validate config / set default options -function expandConfig (config) { +function expandConfig(config) { // default for orientation is white - if (config.orientation !== 'black') config.orientation = 'white' + if (config.orientation !== 'black') config.orientation = 'white'; // default for showNotation is true - if (config.showNotation !== false) config.showNotation = true + if (config.showNotation !== false) config.showNotation = true; // default for draggable is false - if (config.draggable !== true) config.draggable = false + if (config.draggable !== true) config.draggable = false; // default for dropOffBoard is 'snapback' - if (config.dropOffBoard !== 'trash') config.dropOffBoard = 'snapback' + if (config.dropOffBoard !== 'trash') config.dropOffBoard = 'snapback'; // default for sparePieces is false - if (config.sparePieces !== true) config.sparePieces = false + if (config.sparePieces !== true) config.sparePieces = false; // draggable must be true if sparePieces is enabled - if (config.sparePieces) config.draggable = true + if (config.sparePieces) config.draggable = true; // default piece theme is wikipedia if (!Object.prototype.hasOwnProperty.call(config, 'pieceTheme') || (!isString(config.pieceTheme) && !isFunction(config.pieceTheme))) { - config.pieceTheme = 'img/chesspieces/wikipedia/{piece}.png' + config.pieceTheme = 'img/chesspieces/wikipedia/{piece}.png'; } // animation speeds - if (!validAnimationSpeed(config.appearSpeed)) config.appearSpeed = DEFAULT_APPEAR_SPEED - if (!validAnimationSpeed(config.moveSpeed)) config.moveSpeed = DEFAULT_MOVE_SPEED - if (!validAnimationSpeed(config.snapbackSpeed)) config.snapbackSpeed = DEFAULT_SNAPBACK_SPEED - if (!validAnimationSpeed(config.snapSpeed)) config.snapSpeed = DEFAULT_SNAP_SPEED - if (!validAnimationSpeed(config.trashSpeed)) config.trashSpeed = DEFAULT_TRASH_SPEED + if (!validAnimationSpeed(config.appearSpeed)) config.appearSpeed = DEFAULT_APPEAR_SPEED; + if (!validAnimationSpeed(config.moveSpeed)) config.moveSpeed = DEFAULT_MOVE_SPEED; + if (!validAnimationSpeed(config.snapbackSpeed)) config.snapbackSpeed = DEFAULT_SNAPBACK_SPEED; + if (!validAnimationSpeed(config.snapSpeed)) config.snapSpeed = DEFAULT_SNAP_SPEED; + if (!validAnimationSpeed(config.trashSpeed)) config.trashSpeed = DEFAULT_TRASH_SPEED; // throttle rate - if (!validThrottleRate(config.dragThrottleRate)) config.dragThrottleRate = DEFAULT_DRAG_THROTTLE_RATE + if (!validThrottleRate(config.dragThrottleRate)) config.dragThrottleRate = DEFAULT_DRAG_THROTTLE_RATE; - return config + return config; } // --------------------------------------------------------------------------- @@ -503,35 +505,35 @@ function expandConfig (config) { // --------------------------------------------------------------------------- // return either boolean false or the $container element -function checkContainerArg (containerElOrString) { +function checkContainerArg(containerElOrString) { if (containerElOrString === '') { const errorMsg1 = 'Chessboard Error 1001: ' + 'The first argument to Chessboard() cannot be an empty string.' + '\n\n' + - 'Exiting' + ELLIPSIS - window.alert(errorMsg1) - return false + 'Exiting' + ELLIPSIS; + window.alert(errorMsg1); + return false; } // convert containerEl to query selector if it is a string if (isString(containerElOrString) && containerElOrString.charAt(0) !== '#') { - containerElOrString = '#' + containerElOrString + containerElOrString = '#' + containerElOrString; } // containerEl must be something that becomes a NodeList of size 1 - const $container = /** @type {NodeListOf} */(document.querySelectorAll(containerElOrString)) + const $container = /** @type {NodeListOf} */(document.querySelectorAll(containerElOrString)); if ($container.length !== 1) { const errorMsg2 = 'Chessboard Error 1003: ' + 'The first argument to Chessboard() must be the ID of a DOM node, ' + 'an ID query selector, or a single DOM node.' + '\n\n' + - 'Exiting' + ELLIPSIS - window.alert(errorMsg2) - return false + 'Exiting' + ELLIPSIS; + window.alert(errorMsg2); + return false; } - return $container.item(0) + return $container.item(0); } // --------------------------------------------------------------------------- @@ -539,66 +541,66 @@ function checkContainerArg (containerElOrString) { // --------------------------------------------------------------------------- class Chessboard { - #config = {} + #config = {}; /** * @type {HTMLElement} */ - #board + #board; /** * @type {HTMLElement} */ - #container + #container; /** * @type {HTMLElement} */ - #draggedPiece + #draggedPiece; /** * @type {HTMLElement | null} */ - #sparePiecesTop = null + #sparePiecesTop = null; /** * @type {HTMLElement | null} */ - #sparePiecesBottom = null + #sparePiecesBottom = null; /** * @type {number} */ - #boardBorderSize = 2 + #boardBorderSize = 2; /** * @type {'white' | 'black'} */ - #currentOrientation = 'white' - #currentPosition = {} + #currentOrientation = 'white'; + #currentPosition = {}; /** * @type {string} */ - #draggedPieceLocation = '' + #draggedPieceLocation = ''; /** * @type {string} */ - #draggedPieceSource = '' + #draggedPieceSource = ''; /** * @type {boolean} */ - #isDragging = false - #sparePiecesElsIds = {} - #squareElsIds = {} - #squareElsOffsets = {} - #squareSize = 16 + #isDragging = false; + #sparePiecesElsIds = {}; + #squareElsIds = {}; + #squareElsOffsets = {}; + #squareSize = 16; - constructor (containerElOrString, config) { + constructor(containerElOrString, config) { // first things first: check basic dependencies - const container = checkContainerArg(containerElOrString) - if (!container) throw new TypeError(`Container ${containerElOrString ?? ''} not found`) + const container = checkContainerArg(containerElOrString); + if (!container) throw new TypeError(`Container ${containerElOrString ?? ''} not found`); - this.#container = container + this.#container = container; // ensure the config object is what we expect - config = expandConfigArgumentShorthand(config) - config = expandConfig(config) - this.#config = config + config = expandConfigArgumentShorthand(config); + config = expandConfig(config); + this.#config = config; - this.#setInitialState() + this.#setInitialState(); /** * Create unique IDs for all our elements @@ -607,179 +609,179 @@ class Chessboard { // squares on the board for (let i = 0; i < COLUMNS.length; i++) { for (let j = 1; j <= 8; j++) { - const square = COLUMNS[i] + j - this.#squareElsIds[square] = square + '-' + uuid() + const square = COLUMNS[i] + j; + this.#squareElsIds[square] = square + '-' + uuid(); } } // spare pieces - const pieces = 'KQRNBP'.split('') + const pieces = 'KQRNBP'.split(''); for (let i = 0; i < pieces.length; i++) { - const whitePiece = 'w' + pieces[i] - const blackPiece = 'b' + pieces[i] - this.#sparePiecesElsIds[whitePiece] = whitePiece + '-' + uuid() - this.#sparePiecesElsIds[blackPiece] = blackPiece + '-' + uuid() + const whitePiece = 'w' + pieces[i]; + const blackPiece = 'b' + pieces[i]; + this.#sparePiecesElsIds[whitePiece] = whitePiece + '-' + uuid(); + this.#sparePiecesElsIds[blackPiece] = blackPiece + '-' + uuid(); } // build board and save it in memory - this.#container.innerHTML = buildContainerHTML(this.#config.sparePieces) - this.#board = /** @type {HTMLElement} */(this.#container.querySelector('.' + ClassNameLookup.board)) + this.#container.innerHTML = buildContainerHTML(this.#config.sparePieces); + this.#board = /** @type {HTMLElement} */(this.#container.querySelector('.' + ClassNameLookup.board)); if (this.#config.sparePieces) { - this.#sparePiecesTop = this.#container.querySelector('.' + ClassNameLookup.sparePiecesTop) - this.#sparePiecesBottom = this.#container.querySelector('.' + ClassNameLookup.sparePiecesBottom) + this.#sparePiecesTop = this.#container.querySelector('.' + ClassNameLookup.sparePiecesTop); + this.#sparePiecesBottom = this.#container.querySelector('.' + ClassNameLookup.sparePiecesBottom); } // create the drag piece this.#draggedPiece = document.body.appendChild( this.#buildPieceElement('wP', true, uuid()) - ) + ); // TODO: need to remove this dragged piece element if the board is no // longer in the DOM // get the border size - this.#boardBorderSize = parseInt(this.#board.style.getPropertyValue('borderLeftWidth'), 10) + this.#boardBorderSize = parseInt(this.#board.style.getPropertyValue('borderLeftWidth'), 10); // set the size and draw the board - this.resize() + this.resize(); - this.#addEvents() + this.#addEvents(); } // clear the board - clear (useAnimation) { - this.position({}, useAnimation) + clear(useAnimation) { + this.position({}, useAnimation); } // remove the widget from the page - destroy () { + destroy() { // remove markup - this.#container.innerHTML = '' - this.#draggedPiece.remove() + this.#container.innerHTML = ''; + this.#draggedPiece.remove(); // remove event handlers - this.#container.onmousedown = null + this.#container.onmousedown = null; } // shorthand method to get the current FEN - fen () { - return this.position('fen') + fen() { + return this.position('fen'); } // flip orientation - flip () { - return this.orientation('flip') + flip() { + return this.orientation('flip'); } // move pieces // TODO: this method should be variadic as well as accept an array of moves - move (...args) { + move(...args) { // no need to throw an error here; just do nothing // TODO: this should return the current position - if (args.length === 0) return + if (args.length === 0) return; - let useAnimation = true + let useAnimation = true; // collect the moves into an object - const moves = {} + const moves = {}; for (let i = 0; i < args.length; i++) { // any "false" to this function means no animations if (args[i] === false) { - useAnimation = false - continue + useAnimation = false; + continue; } // skip invalid arguments if (!validMove(args[i])) { - this.#error(2826, 'Invalid move passed to the move method.', args[i]) - continue + this.#error(2826, 'Invalid move passed to the move method.', args[i]); + continue; } - const tmp = args[i].split('-') - moves[tmp[0]] = tmp[1] + const tmp = args[i].split('-'); + moves[tmp[0]] = tmp[1]; } // calculate position from moves - const newPos = calculatePositionFromMoves(this.#currentPosition, moves) + const newPos = calculatePositionFromMoves(this.#currentPosition, moves); // update the board - this.position(newPos, useAnimation) + this.position(newPos, useAnimation); // return the new position object - return newPos + return newPos; } /** * @param {string} [orientation] * @returns */ - orientation (orientation) { + orientation(orientation) { if (!orientation) { - return this.#currentOrientation + return this.#currentOrientation; } else if (orientation === 'white' || orientation === 'black') { - this.#currentOrientation = orientation + this.#currentOrientation = orientation; } else if (orientation === 'flip') { - this.#currentOrientation = this.#currentOrientation === 'white' ? 'black' : 'white' + this.#currentOrientation = this.#currentOrientation === 'white' ? 'black' : 'white'; } else { - this.#error(5482, 'Invalid value passed to the orientation method.', orientation) + this.#error(5482, 'Invalid value passed to the orientation method.', orientation); } - this.#drawBoard() - return this.#currentOrientation + this.#drawBoard(); + return this.#currentOrientation; } - position (position, useAnimation) { + position(position, useAnimation) { if (!position) { - return deepCopy(this.#currentPosition) + return deepCopy(this.#currentPosition); } else if (isString(position) && position.toLowerCase() === 'fen') { // get position as FEN - return objToFen(this.#currentPosition) + return objToFen(this.#currentPosition); } if (isString(position) && position.toLowerCase() === 'start') { // start position - position = deepCopy(START_POSITION) + position = deepCopy(START_POSITION); } // convert FEN to position object if (validFen(position)) { - position = fenToObj(position) + position = fenToObj(position); } // validate position object if (!validPositionObject(position)) { - this.#error(6482, 'Invalid value passed to the position method.', position) - return + this.#error(6482, 'Invalid value passed to the position method.', position); + return; } // default for useAnimations is true - if (useAnimation !== false) useAnimation = true + if (useAnimation !== false) useAnimation = true; if (useAnimation) { // start the animations - const animations = this.#calculateAnimations(this.#currentPosition, position) - this.#doAnimations(animations, this.#currentPosition, position) + const animations = this.#calculateAnimations(this.#currentPosition, position); + this.#doAnimations(animations, this.#currentPosition, position); // set the new position - this.#setCurrentPosition(position) + this.#setCurrentPosition(position); } else { // instant update - this.#setCurrentPosition(position) - this.#drawPositionInstant() + this.#setCurrentPosition(position); + this.#drawPositionInstant(); } } - resize () { + resize() { // calulate the new square size - this.#squareSize = this.#calculateSquareSize() + this.#squareSize = this.#calculateSquareSize(); // set board width - this.#board.style.setProperty('width', `${this.#squareSize * 8}px`) + this.#board.style.setProperty('width', `${this.#squareSize * 8}px`); // set drag piece size - this.#draggedPiece?.style.setProperty('height', `${this.#squareSize}px`) - this.#draggedPiece?.style.setProperty('width', `${this.#squareSize}px`) + this.#draggedPiece?.style.setProperty('height', `${this.#squareSize}px`); + this.#draggedPiece?.style.setProperty('width', `${this.#squareSize}px`); // spare pieces if (this.#config.sparePieces) { @@ -787,69 +789,69 @@ class Chessboard { this.#container.querySelectorAll('.' + ClassNameLookup.sparePieces) ) .forEach(x => { - const paddingLeft = this.#squareSize + this.#boardBorderSize - x.style.setProperty('paddingLeft', `${paddingLeft}px`) - }) + const paddingLeft = this.#squareSize + this.#boardBorderSize; + x.style.setProperty('paddingLeft', `${paddingLeft}px`); + }); } // redraw the board - this.#drawBoard() + this.#drawBoard(); } /** * Set the starting position * @param {*} useAnimation */ - start (useAnimation) { - this.position('start', useAnimation) + start(useAnimation) { + this.position('start', useAnimation); } - #dropDraggedPieceOnSquare (square) { - this.#removeSquareHighlights() + #dropDraggedPieceOnSquare(square) { + this.#removeSquareHighlights(); // update position - const newPosition = deepCopy(this.#currentPosition) - delete newPosition[this.#draggedPieceSource] - newPosition[square] = this.#draggedPiece - this.#setCurrentPosition(newPosition) + const newPosition = deepCopy(this.#currentPosition); + delete newPosition[this.#draggedPieceSource]; + newPosition[square] = this.#draggedPiece; + this.#setCurrentPosition(newPosition); // get target square information - const targetSquareId = this.#squareElsIds[square] - const targetSquare = document.getElementById(targetSquareId) + const targetSquareId = this.#squareElsIds[square]; + const targetSquare = document.getElementById(targetSquareId); if (!targetSquare) { - throw new Error(`Unable to locate target square with id ${targetSquareId}`) + throw new Error(`Unable to locate target square with id ${targetSquareId}`); } - const targetSquarePosition = getJqueryStyleOffset(targetSquare) + const targetSquarePosition = getJqueryStyleOffset(targetSquare); // snap the piece to the target square const opts = { duration: this.#config.snapSpeed, complete: () => { - this.#drawPositionInstant() - this.#draggedPiece.style.setProperty('display', 'none') + this.#drawPositionInstant(); + this.#draggedPiece.style.setProperty('display', 'none'); // execute their onSnapEnd function if (isFunction(this.#config.onSnapEnd)) { - this.#config.onSnapEnd(this.#draggedPieceSource, square, this.#draggedPiece) + this.#config.onSnapEnd(this.#draggedPieceSource, square, this.#draggedPiece); } } - } - this.#draggedPiece.animate(targetSquarePosition, opts) + }; + this.#draggedPiece.animate(targetSquarePosition, opts); // set state - this.#isDragging = false + this.#isDragging = false; } - #error (code, msg, obj) { + #error(code, msg, obj) { // do nothing if showErrors is not set if ( Object.prototype.hasOwnProperty.call(this.#config, 'showErrors') !== true || this.#config.showErrors === false ) { - return + return; } - let errorText = 'Chessboard Error ' + code + ': ' + msg + let errorText = 'Chessboard Error ' + code + ': ' + msg; // print to console if ( @@ -857,459 +859,459 @@ class Chessboard { typeof console === 'object' && typeof console.log === 'function' ) { - console.log(errorText) + console.log(errorText); if (obj) { - console.log(obj) + console.log(obj); } - return + return; } // alert errors if (this.#config.showErrors === 'alert') { if (obj) { - errorText += '\n\n' + JSON.stringify(obj) + errorText += '\n\n' + JSON.stringify(obj); } - window.alert(errorText) - return + window.alert(errorText); + return; } // custom function if (isFunction(this.#config.showErrors)) { - this.#config.showErrors(code, msg, obj) + this.#config.showErrors(code, msg, obj); } } - #setInitialState () { - this.#currentOrientation = this.#config.orientation + #setInitialState() { + this.#currentOrientation = this.#config.orientation; // make sure position is valid if (Object.prototype.hasOwnProperty.call(this.#config, 'position')) { if (this.#config.position === 'start') { - this.#currentPosition = deepCopy(START_POSITION) + this.#currentPosition = deepCopy(START_POSITION); } else if (validFen(this.#config.position)) { - this.#currentPosition = fenToObj(this.#config.position) + this.#currentPosition = fenToObj(this.#config.position); } else if (validPositionObject(this.#config.position)) { - this.#currentPosition = deepCopy(this.#config.position) + this.#currentPosition = deepCopy(this.#config.position); } else { this.#error( 7263, 'Invalid value passed to config.position.', this.#config.position - ) + ); } } } - #buildBoardHTML (orientation) { + #buildBoardHTML(orientation) { if (orientation !== 'black') { - orientation = 'white' + orientation = 'white'; } - let html = '' + let html = ''; // algebraic notation / orientation - const alpha = deepCopy(COLUMNS) - let row = 8 + const alpha = deepCopy(COLUMNS); + let row = 8; if (orientation === 'black') { - alpha.reverse() - row = 1 + alpha.reverse(); + row = 1; } - let squareColor = 'white' + let squareColor = 'white'; for (let i = 0; i < 8; i++) { - html += '
' + html += '
'; for (let j = 0; j < 8; j++) { - const square = alpha[j] + row + const square = alpha[j] + row; html += '
' + 'data-square="' + square + '">'; if (this.#config.showNotation) { // alpha notation if ((orientation === 'white' && row === 1) || (orientation === 'black' && row === 8)) { - html += '
' + alpha[j] + '
' + html += '
' + alpha[j] + '
'; } // numeric notation if (j === 0) { - html += '
' + row + '
' + html += '
' + row + '
'; } } - html += '
' // end .square + html += '
'; // end .square - squareColor = (squareColor === 'white') ? 'black' : 'white' + squareColor = (squareColor === 'white') ? 'black' : 'white'; } - html += '
' + html += '
'; - squareColor = (squareColor === 'white') ? 'black' : 'white' + squareColor = (squareColor === 'white') ? 'black' : 'white'; if (orientation === 'white') { - row = row - 1 + row = row - 1; } else { - row = row + 1 + row = row + 1; } } - return interpolateTemplate(html, ClassNameLookup) + return interpolateTemplate(html, ClassNameLookup); } - #buildPieceImgSrc (piece) { + #buildPieceImgSrc(piece) { if (isFunction(this.#config.pieceTheme)) { - return this.#config.pieceTheme(piece) + return this.#config.pieceTheme(piece); } if (isString(this.#config.pieceTheme)) { - return interpolateTemplate(this.#config.pieceTheme, { piece }) + return interpolateTemplate(this.#config.pieceTheme, { piece }); } // NOTE: this should never happen - this.#error(8272, 'Unable to build image source for config.pieceTheme.') - return '' + this.#error(8272, 'Unable to build image source for config.pieceTheme.'); + return ''; } - #buildPieceElement (piece, hidden, id) { - const tpl = document.createElement('template') - tpl.innerHTML = this.#buildPieceHTML(piece, hidden, id) - return /** @type {HTMLElement} */(tpl.content.firstElementChild) + #buildPieceElement(piece, hidden, id) { + const tpl = document.createElement('template'); + tpl.innerHTML = this.#buildPieceHTML(piece, hidden, id); + return /** @type {HTMLElement} */(tpl.content.firstElementChild); } - #buildPieceHTML (piece, hidden, id) { - let html = ' { // add the "real" piece to the destination square - $destSquare.append(this.#buildPieceElement(piece)) + $destSquare.append(this.#buildPieceElement(piece)); // remove the animated piece - $animatedPiece.remove() + $animatedPiece.remove(); // run complete function if (isFunction(completeFn)) { - completeFn() + completeFn(); } - } + }; } - #animateSparePieceToSquare (piece, dest, completeFn) { - const $srcSquare = document.getElementById(this.#sparePiecesElsIds[piece]) - const $destSquare = document.getElementById(this.#squareElsIds[dest]) + #animateSparePieceToSquare(piece, dest, completeFn) { + const $srcSquare = document.getElementById(this.#sparePiecesElsIds[piece]); + const $destSquare = document.getElementById(this.#squareElsIds[dest]); if (!$srcSquare) { - throw new Error(`Unable to locate source square with id ${this.#squareElsIds[piece]}`) + throw new Error(`Unable to locate source square with id ${this.#squareElsIds[piece]}`); } if (!$destSquare) { - throw new Error(`Unable to locate destination square with id ${this.#squareElsIds[dest]}`) + throw new Error(`Unable to locate destination square with id ${this.#squareElsIds[dest]}`); } // create the animate piece - const $animatedPiece = document.body.appendChild(this.#buildPieceElement(piece, true, uuid())) - $animatedPiece.style.setProperty('display', '') - $animatedPiece.style.setProperty('position', 'absolute') + const $animatedPiece = document.body.appendChild(this.#buildPieceElement(piece, true, uuid())); + $animatedPiece.style.setProperty('display', ''); + $animatedPiece.style.setProperty('position', 'absolute'); // animate the piece to the destination square - const animation = $animatedPiece.animate([getJqueryStyleOffset($srcSquare), getJqueryStyleOffset($destSquare)], this.#config.moveSpeed) + const animation = $animatedPiece.animate([getJqueryStyleOffset($srcSquare), getJqueryStyleOffset($destSquare)], this.#config.moveSpeed); animation.onfinish = () => { - $destSquare.querySelector(`.${ClassNameLookup.piece}`)?.remove() + $destSquare.querySelector(`.${ClassNameLookup.piece}`)?.remove(); // add the "real" piece to the destination square - $destSquare.append(this.#buildPieceElement(piece)) + $destSquare.append(this.#buildPieceElement(piece)); // remove the animated piece - $animatedPiece.remove() + $animatedPiece.remove(); // run complete function if (isFunction(completeFn)) { - completeFn() + completeFn(); } - } + }; } // execute an array of animations - #doAnimations (animations, oldPos, newPos) { - if (animations.length === 0) return + #doAnimations(animations, oldPos, newPos) { + if (animations.length === 0) return; - let numFinished = 0 + let numFinished = 0; const onFinishAnimation3 = () => { // exit if all the animations aren't finished - numFinished = numFinished + 1 - if (numFinished !== animations.length) return + numFinished = numFinished + 1; + if (numFinished !== animations.length) return; - this.#drawPositionInstant() + this.#drawPositionInstant(); // run their onMoveEnd function if (isFunction(this.#config.onMoveEnd)) { - this.#config.onMoveEnd(deepCopy(oldPos), deepCopy(newPos)) + this.#config.onMoveEnd(deepCopy(oldPos), deepCopy(newPos)); } - } + }; for (let i = 0; i < animations.length; i++) { - const animation = animations[i] + const animation = animations[i]; // clear a piece if (animation.type === 'clear') { document.querySelectorAll(`#${this.#squareElsIds[animation.square]} .${ClassNameLookup.piece}`) .forEach(x => { - const animation = x.animate([{ opacity: 1 }, { opacity: 0 }], this.#config.trashSpeed) - animation.onfinish = onFinishAnimation3 - }) + const animation = x.animate([{ opacity: 1 }, { opacity: 0 }], this.#config.trashSpeed); + animation.onfinish = onFinishAnimation3; + }); // add a piece with no spare pieces - fade the piece onto the square } else if (animation.type === 'add' && !this.#config.sparePieces) { - const element = document.getElementById(this.#squareElsIds[animation.square]) + const element = document.getElementById(this.#squareElsIds[animation.square]); if (element) { - element.append(this.#buildPieceElement(animation.piece, true)) + element.append(this.#buildPieceElement(animation.piece, true)); element.querySelectorAll(`.${ClassNameLookup.piece}`) .forEach(x => { - const animation = x.animate([{ opacity: 0 }, { opacity: 1 }], this.#config.appearSpeed) - animation.onfinish = onFinishAnimation3 - }) + const animation = x.animate([{ opacity: 0 }, { opacity: 1 }], this.#config.appearSpeed); + animation.onfinish = onFinishAnimation3; + }); } // add a piece with spare pieces - animate from the spares } else if (animation.type === 'add' && this.#config.sparePieces) { - this.#animateSparePieceToSquare(animation.piece, animation.square, onFinishAnimation3) + this.#animateSparePieceToSquare(animation.piece, animation.square, onFinishAnimation3); // move a piece from squareA to squareB } else if (animation.type === 'move') { - this.#animateSquareToSquare(animation.source, animation.destination, animation.piece, onFinishAnimation3) + this.#animateSquareToSquare(animation.source, animation.destination, animation.piece, onFinishAnimation3); } } } // calculate an array of animations that need to happen in order to get // from pos1 to pos2 - #calculateAnimations (pos1, pos2) { + #calculateAnimations(pos1, pos2) { // make copies of both - pos1 = deepCopy(pos1) - pos2 = deepCopy(pos2) + pos1 = deepCopy(pos1); + pos2 = deepCopy(pos2); - const animations = [] - const squaresMovedTo = {} + const animations = []; + const squaresMovedTo = {}; // remove pieces that are the same in both positions for (const i in pos2) { - if (!Object.prototype.hasOwnProperty.call(pos2, i)) continue + if (!Object.prototype.hasOwnProperty.call(pos2, i)) continue; if (Object.prototype.hasOwnProperty.call(pos1, i) && pos1[i] === pos2[i]) { - delete pos1[i] - delete pos2[i] + delete pos1[i]; + delete pos2[i]; } } // find all the "move" animations for (const i in pos2) { - if (!Object.prototype.hasOwnProperty.call(pos2, i)) continue + if (!Object.prototype.hasOwnProperty.call(pos2, i)) continue; - const closestPiece = findClosestPiece(pos1, pos2[i], i) + const closestPiece = findClosestPiece(pos1, pos2[i], i); if (closestPiece) { animations.push({ type: 'move', source: closestPiece, destination: i, piece: pos2[i] - }) + }); - delete pos1[closestPiece] - delete pos2[i] - squaresMovedTo[i] = true + delete pos1[closestPiece]; + delete pos2[i]; + squaresMovedTo[i] = true; } } // "add" animations for (const i in pos2) { - if (!Object.prototype.hasOwnProperty.call(pos2, i)) continue + if (!Object.prototype.hasOwnProperty.call(pos2, i)) continue; animations.push({ type: 'add', square: i, piece: pos2[i] - }) + }); - delete pos2[i] + delete pos2[i]; } // "clear" animations for (const i in pos1) { - if (!Object.prototype.hasOwnProperty.call(pos1, i)) continue + if (!Object.prototype.hasOwnProperty.call(pos1, i)) continue; // do not clear a piece if it is on a square that is the result // of a "move", ie: a piece capture - if (Object.prototype.hasOwnProperty.call(squaresMovedTo, i)) continue + if (Object.prototype.hasOwnProperty.call(squaresMovedTo, i)) continue; animations.push({ type: 'clear', square: i, piece: pos1[i] - }) + }); - delete pos1[i] + delete pos1[i]; } - return animations + return animations; } // ------------------------------------------------------------------------- // Control Flow // ------------------------------------------------------------------------- - #drawPositionInstant () { + #drawPositionInstant() { // clear the board - this.#board.querySelectorAll(`.${ClassNameLookup.piece}`).forEach(x => x.remove()) + this.#board.querySelectorAll(`.${ClassNameLookup.piece}`).forEach(x => x.remove()); // add the pieces for (const i in this.#currentPosition) { - if (!Object.prototype.hasOwnProperty.call(this.#currentPosition, i)) continue + if (!Object.prototype.hasOwnProperty.call(this.#currentPosition, i)) continue; - document.getElementById(this.#squareElsIds[i])?.append(this.#buildPieceElement(this.#currentPosition[i])) + document.getElementById(this.#squareElsIds[i])?.append(this.#buildPieceElement(this.#currentPosition[i])); } } - #drawBoard () { - this.#board.innerHTML = this.#buildBoardHTML(this.#currentOrientation) - this.#drawPositionInstant() + #drawBoard() { + this.#board.innerHTML = this.#buildBoardHTML(this.#currentOrientation); + this.#drawPositionInstant(); if (this.#config.sparePieces) { if (this.#currentOrientation === 'white') { /** @type {HTMLElement} */(this.#sparePiecesTop).innerHTML = this.#buildSparePiecesHTML('black'); - /** @type {HTMLElement} */(this.#sparePiecesBottom).innerHTML = this.#buildSparePiecesHTML('white') + /** @type {HTMLElement} */(this.#sparePiecesBottom).innerHTML = this.#buildSparePiecesHTML('white'); } else { /** @type {HTMLElement} */(this.#sparePiecesTop).innerHTML = this.#buildSparePiecesHTML('white'); - /** @type {HTMLElement} */(this.#sparePiecesBottom).innerHTML = this.#buildSparePiecesHTML('black') + /** @type {HTMLElement} */(this.#sparePiecesBottom).innerHTML = this.#buildSparePiecesHTML('black'); } } } - #setCurrentPosition (position) { - const oldPos = deepCopy(this.#currentPosition) - const newPos = deepCopy(position) - const oldFen = objToFen(oldPos) - const newFen = objToFen(newPos) + #setCurrentPosition(position) { + const oldPos = deepCopy(this.#currentPosition); + const newPos = deepCopy(position); + const oldFen = objToFen(oldPos); + const newFen = objToFen(newPos); // do nothing if no change in position - if (oldFen === newFen) return + if (oldFen === newFen) return; // run their onChange function if (isFunction(this.#config.onChange)) { - this.#config.onChange(oldPos, newPos) + this.#config.onChange(oldPos, newPos); } // update state - this.#currentPosition = position + this.#currentPosition = position; } - #isXYOnSquare (x, y) { + #isXYOnSquare(x, y) { for (const i in this.#squareElsOffsets) { - if (!Object.prototype.hasOwnProperty.call(this.#squareElsOffsets, i)) continue + if (!Object.prototype.hasOwnProperty.call(this.#squareElsOffsets, i)) continue; - const s = this.#squareElsOffsets[i] + const s = this.#squareElsOffsets[i]; if (x >= s.left && x < s.left + this.#squareSize && y >= s.top && y < s.top + this.#squareSize) { - return i + return i; } } - return 'offboard' + return 'offboard'; } // records the XY coords of every square into memory - #captureSquareOffsets () { - this.#squareElsOffsets = {} + #captureSquareOffsets() { + this.#squareElsOffsets = {}; for (const i in this.#squareElsIds) { - if (!Object.prototype.hasOwnProperty.call(this.#squareElsIds, i)) continue + if (!Object.prototype.hasOwnProperty.call(this.#squareElsIds, i)) continue; - const element = document.getElementById(this.#squareElsIds[i]) + const element = document.getElementById(this.#squareElsIds[i]); - if (!element) continue + if (!element) continue; - this.#squareElsOffsets[i] = getJqueryStyleOffset(element) + this.#squareElsOffsets[i] = getJqueryStyleOffset(element); } } - #removeSquareHighlights () { + #removeSquareHighlights() { this.#board.querySelectorAll('.' + ClassNameLookup.square).forEach(x => { - x.classList.remove(ClassNameLookup.highlight1) - x.classList.remove(ClassNameLookup.highlight2) - }) + x.classList.remove(ClassNameLookup.highlight1); + x.classList.remove(ClassNameLookup.highlight2); + }); } - #snapbackDraggedPiece () { + #snapbackDraggedPiece() { // there is no "snapback" for spare pieces if (this.#draggedPieceSource === 'spare') { - this.#trashDraggedPiece() - return + this.#trashDraggedPiece(); + return; } - this.#removeSquareHighlights() + this.#removeSquareHighlights(); // get source square position - const sourceSquare = document.getElementById(this.#squareElsIds[this.#draggedPieceSource]) - if (!sourceSquare) throw new Error('') - const sourceSquarePosition = getJqueryStyleOffset(sourceSquare) + const sourceSquare = document.getElementById(this.#squareElsIds[this.#draggedPieceSource]); + if (!sourceSquare) throw new Error(''); + const sourceSquarePosition = getJqueryStyleOffset(sourceSquare); // animate the piece to the target square const opts = { duration: this.#config.snapbackSpeed, complete: () => { - this.#drawPositionInstant() - this.#draggedPiece.style.setProperty('display', 'none') + this.#drawPositionInstant(); + this.#draggedPiece.style.setProperty('display', 'none'); // run their onSnapbackEnd function if (isFunction(this.#config.onSnapbackEnd)) { @@ -1318,94 +1320,94 @@ class Chessboard { this.#draggedPieceSource, deepCopy(this.#currentPosition), this.#currentOrientation - ) + ); } } - } - this.#draggedPiece.animate(sourceSquarePosition, opts) + }; + this.#draggedPiece.animate(sourceSquarePosition, opts); // set state - this.#isDragging = false + this.#isDragging = false; } - #trashDraggedPiece () { - this.#removeSquareHighlights() + #trashDraggedPiece() { + this.#removeSquareHighlights(); // remove the source piece - const newPosition = deepCopy(this.#currentPosition) - delete newPosition[this.#draggedPieceSource] - this.#setCurrentPosition(newPosition) + const newPosition = deepCopy(this.#currentPosition); + delete newPosition[this.#draggedPieceSource]; + this.#setCurrentPosition(newPosition); // redraw the position - this.#drawPositionInstant() + this.#drawPositionInstant(); // hide the dragged piece - this.#draggedPiece.animate([{ opacity: 1 }, { opacity: 0 }], this.#config.trashSpeed) + this.#draggedPiece.animate([{ opacity: 1 }, { opacity: 0 }], this.#config.trashSpeed); // set state - this.#isDragging = false + this.#isDragging = false; } - #beginDraggingPiece (source, piece, x, y) { + #beginDraggingPiece(source, piece, x, y) { // run their custom onDragStart function // their custom onDragStart function can cancel drag start if (isFunction(this.#config.onDragStart) && this.#config.onDragStart(source, piece, deepCopy(this.#currentPosition), this.#currentOrientation) === false) { - return + return; } // set state - this.#isDragging = true - this.#draggedPiece = piece - this.#draggedPieceSource = source + this.#isDragging = true; + this.#draggedPiece = piece; + this.#draggedPieceSource = source; // if the piece came from spare pieces, location is offboard if (source === 'spare') { - this.#draggedPieceLocation = 'offboard' + this.#draggedPieceLocation = 'offboard'; } else { - this.#draggedPieceLocation = source + this.#draggedPieceLocation = source; } // capture the x, y coords of all squares in memory - this.#captureSquareOffsets() + this.#captureSquareOffsets(); // create the dragged piece - this.#draggedPiece.setAttribute('src', this.#buildPieceImgSrc(piece)) - this.#draggedPiece.style.setProperty('display', '') - this.#draggedPiece.style.setProperty('position', 'absolute') - this.#draggedPiece.style.setProperty('left', `${x - this.#squareSize / 2}px`) - this.#draggedPiece.style.setProperty('top', `${y - this.#squareSize / 2}px`) + this.#draggedPiece.setAttribute('src', this.#buildPieceImgSrc(piece)); + this.#draggedPiece.style.setProperty('display', ''); + this.#draggedPiece.style.setProperty('position', 'absolute'); + this.#draggedPiece.style.setProperty('left', `${x - this.#squareSize / 2}px`); + this.#draggedPiece.style.setProperty('top', `${y - this.#squareSize / 2}px`); if (source !== 'spare') { // highlight the source square and hide the piece - const sourceSquare = document.getElementById(this.#squareElsIds[source]) + const sourceSquare = document.getElementById(this.#squareElsIds[source]); if (sourceSquare) { sourceSquare.classList.add(ClassNameLookup.highlight1); /** @type {NodeListOf} */(sourceSquare.querySelectorAll(`.${ClassNameLookup.piece}`)) - .forEach(x => x.style.setProperty('display', 'none')) + .forEach(x => x.style.setProperty('display', 'none')); } } } - #updateDraggedPiece (x, y) { + #updateDraggedPiece(x, y) { // put the dragged piece over the mouse cursor - this.#draggedPiece.style.setProperty('left', `${x - this.#squareSize / 2}px`) - this.#draggedPiece.style.setProperty('top', `${y - this.#squareSize / 2}px`) + this.#draggedPiece.style.setProperty('left', `${x - this.#squareSize / 2}px`); + this.#draggedPiece.style.setProperty('top', `${y - this.#squareSize / 2}px`); // get location - const location = this.#isXYOnSquare(x, y) + const location = this.#isXYOnSquare(x, y); // do nothing if the location has not changed - if (location === this.#draggedPieceLocation) return + if (location === this.#draggedPieceLocation) return; // remove highlight from previous square if (validSquare(this.#draggedPieceLocation)) { - document.getElementById(this.#squareElsIds[this.#draggedPieceLocation])?.classList.remove(ClassNameLookup.highlight2) + document.getElementById(this.#squareElsIds[this.#draggedPieceLocation])?.classList.remove(ClassNameLookup.highlight2); } // add highlight to new square if (validSquare(location)) { - document.getElementById(this.#squareElsIds[location])?.classList.add(ClassNameLookup.highlight2) + document.getElementById(this.#squareElsIds[location])?.classList.add(ClassNameLookup.highlight2); } // run onDragMove @@ -1417,26 +1419,26 @@ class Chessboard { this.#draggedPiece, deepCopy(this.#currentPosition), this.#currentOrientation - ) + ); } // update state - this.#draggedPieceLocation = location + this.#draggedPieceLocation = location; } - #stopDraggedPiece (location) { + #stopDraggedPiece(location) { // determine what the action should be - let action = 'drop' + let action = 'drop'; if (location === 'offboard' && this.#config.dropOffBoard === 'snapback') { - action = 'snapback' + action = 'snapback'; } if (location === 'offboard' && this.#config.dropOffBoard === 'trash') { - action = 'trash' + action = 'trash'; } // run their onDrop function, which can potentially change the drop action if (isFunction(this.#config.onDrop)) { - const newPosition = deepCopy(this.#currentPosition) + const newPosition = deepCopy(this.#currentPosition); // source piece is a spare piece and position is off the board // if (draggedPieceSource === 'spare' && location === 'offboard') {...} @@ -1445,23 +1447,23 @@ class Chessboard { // source piece is a spare piece and position is on the board if (this.#draggedPieceSource === 'spare' && validSquare(location)) { // add the piece to the board - newPosition[location] = this.#draggedPiece + newPosition[location] = this.#draggedPiece; } // source piece was on the board and position is off the board if (validSquare(this.#draggedPieceSource) && location === 'offboard') { // remove the piece from the board - delete newPosition[this.#draggedPieceSource] + delete newPosition[this.#draggedPieceSource]; } // source piece was on the board and position is on the board if (validSquare(this.#draggedPieceSource) && validSquare(location)) { // move the piece - delete newPosition[this.#draggedPieceSource] - newPosition[location] = this.#draggedPiece + delete newPosition[this.#draggedPieceSource]; + newPosition[location] = this.#draggedPiece; } - const oldPosition = deepCopy(this.#currentPosition) + const oldPosition = deepCopy(this.#currentPosition); const result = this.#config.onDrop( this.#draggedPieceSource, @@ -1470,19 +1472,19 @@ class Chessboard { newPosition, oldPosition, this.#currentOrientation - ) + ); if (result === 'snapback' || result === 'trash') { - action = result + action = result; } } // do it! if (action === 'snapback') { - this.#snapbackDraggedPiece() + this.#snapbackDraggedPiece(); } else if (action === 'trash') { - this.#trashDraggedPiece() + this.#trashDraggedPiece(); } else if (action === 'drop') { - this.#dropDraggedPieceOnSquare(location) + this.#dropDraggedPieceOnSquare(location); } } @@ -1490,210 +1492,210 @@ class Chessboard { // Browser Events // ------------------------------------------------------------------------- - #stopDefault (evt) { - evt.preventDefault() + #stopDefault(evt) { + evt.preventDefault(); } - #mousedownSquare (evt) { + #mousedownSquare(evt) { // do nothing if we're not draggable - if (!this.#config.draggable) return + if (!this.#config.draggable) return; // do nothing if there is no piece on this square - const square = evt.currentTarget.getAttribute('data-square') - if (!validSquare(square)) return - if (!Object.prototype.hasOwnProperty.call(this.#currentPosition, square)) return + const square = evt.currentTarget.getAttribute('data-square'); + if (!validSquare(square)) return; + if (!Object.prototype.hasOwnProperty.call(this.#currentPosition, square)) return; - this.#beginDraggingPiece(square, this.#currentPosition[square], evt.pageX, evt.pageY) + this.#beginDraggingPiece(square, this.#currentPosition[square], evt.pageX, evt.pageY); } - #touchstartSquare (e) { + #touchstartSquare(e) { // do nothing if we're not draggable - if (!this.#config.draggable) return + if (!this.#config.draggable) return; // do nothing if there is no piece on this square - const square = e.currentTarget.getAttribute('data-square') - if (!validSquare(square)) return - if (!Object.prototype.hasOwnProperty.call(this.#currentPosition, square)) return + const square = e.currentTarget.getAttribute('data-square'); + if (!validSquare(square)) return; + if (!Object.prototype.hasOwnProperty.call(this.#currentPosition, square)) return; - e = e.originalEvent + e = e.originalEvent; this.#beginDraggingPiece( square, this.#currentPosition[square], e.changedTouches[0].pageX, e.changedTouches[0].pageY - ) + ); } - #mousedownSparePiece (evt) { + #mousedownSparePiece(evt) { // do nothing if sparePieces is not enabled - if (!this.#config.sparePieces) return + if (!this.#config.sparePieces) return; - const piece = evt.currentTarget.getAttribute('data-piece') + const piece = evt.currentTarget.getAttribute('data-piece'); - this.#beginDraggingPiece('spare', piece, evt.pageX, evt.pageY) + this.#beginDraggingPiece('spare', piece, evt.pageX, evt.pageY); } - #touchstartSparePiece (e) { + #touchstartSparePiece(e) { // do nothing if sparePieces is not enabled - if (!this.#config.sparePieces) return + if (!this.#config.sparePieces) return; - const piece = e.currentTarget.getAttribute('data-piece') + const piece = e.currentTarget.getAttribute('data-piece'); - e = e.originalEvent + e = e.originalEvent; this.#beginDraggingPiece( 'spare', piece, e.changedTouches[0].pageX, e.changedTouches[0].pageY - ) + ); } - #mousemoveWindow (evt) { + #mousemoveWindow(evt) { if (this.#isDragging) { - this.#updateDraggedPiece(evt.pageX, evt.pageY) + this.#updateDraggedPiece(evt.pageX, evt.pageY); } } - #touchmoveWindow (evt) { + #touchmoveWindow(evt) { // do nothing if we are not dragging a piece - if (!this.#isDragging) return + if (!this.#isDragging) return; // prevent screen from scrolling - evt.preventDefault() + evt.preventDefault(); this.#updateDraggedPiece(evt.originalEvent.changedTouches[0].pageX, - evt.originalEvent.changedTouches[0].pageY) + evt.originalEvent.changedTouches[0].pageY); } - #mouseupWindow (evt) { + #mouseupWindow(evt) { // do nothing if we are not dragging a piece - if (!this.#isDragging) return + if (!this.#isDragging) return; // get the location - const location = this.#isXYOnSquare(evt.pageX, evt.pageY) + const location = this.#isXYOnSquare(evt.pageX, evt.pageY); - this.#stopDraggedPiece(location) + this.#stopDraggedPiece(location); } - #touchendWindow (evt) { + #touchendWindow(evt) { // do nothing if we are not dragging a piece - if (!this.#isDragging) return + if (!this.#isDragging) return; // get the location const location = this.#isXYOnSquare(evt.originalEvent.changedTouches[0].pageX, - evt.originalEvent.changedTouches[0].pageY) + evt.originalEvent.changedTouches[0].pageY); - this.#stopDraggedPiece(location) + this.#stopDraggedPiece(location); } /** * @param {MouseEvent} evt * @returns {void} */ - #mouseenterSquare (evt) { + #mouseenterSquare(evt) { // do not fire this event if we are dragging a piece // NOTE: this should never happen, but it's a safeguard - if (this.#isDragging) return + if (this.#isDragging) return; // exit if they did not provide a onMouseoverSquare function - if (!isFunction(this.#config.onMouseoverSquare)) return + if (!isFunction(this.#config.onMouseoverSquare)) return; // get the square - const square = /** @type {HTMLElement | null} */(evt.currentTarget)?.getAttribute('data-square') + const square = /** @type {HTMLElement | null} */(evt.currentTarget)?.getAttribute('data-square'); // NOTE: this should never happen; defensive - if (!validSquare(square)) return + if (!validSquare(square)) return; // get the piece on this square - let piece = false + let piece = false; if (square != null && Object.prototype.hasOwnProperty.call(this.#currentPosition, square)) { - piece = this.#currentPosition[square] + piece = this.#currentPosition[square]; } // execute their function - this.#config.onMouseoverSquare(square, piece, deepCopy(this.#currentPosition), this.#currentOrientation) + this.#config.onMouseoverSquare(square, piece, deepCopy(this.#currentPosition), this.#currentOrientation); } - #mouseleaveSquare (evt) { + #mouseleaveSquare(evt) { // do not fire this event if we are dragging a piece // NOTE: this should never happen, but it's a safeguard - if (this.#isDragging) return + if (this.#isDragging) return; // exit if they did not provide an onMouseoutSquare function - if (!isFunction(this.#config.onMouseoutSquare)) return + if (!isFunction(this.#config.onMouseoutSquare)) return; // get the square - const square = document.getElementById(evt.currentTarget)?.getAttribute('data-square') + const square = document.getElementById(evt.currentTarget)?.getAttribute('data-square'); // NOTE: this should never happen; defensive - if (!validSquare(square)) return + if (!validSquare(square)) return; // get the piece on this square - let piece = false + let piece = false; if (square != null && Object.prototype.hasOwnProperty.call(this.#currentPosition, square)) { - piece = this.#currentPosition[square] + piece = this.#currentPosition[square]; } // execute their function - this.#config.onMouseoutSquare(square, piece, deepCopy(this.#currentPosition), this.#currentOrientation) + this.#config.onMouseoutSquare(square, piece, deepCopy(this.#currentPosition), this.#currentOrientation); } // ------------------------------------------------------------------------- // Initialization // ------------------------------------------------------------------------- - #addEvents () { + #addEvents() { // prevent "image drag" - document.body.onmousedown = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.piece}`) && this.#stopDefault(e) - document.body.onmousemove = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.piece}`) && this.#stopDefault(e) + document.body.onmousedown = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.piece}`) && this.#stopDefault(e); + document.body.onmousemove = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.piece}`) && this.#stopDefault(e); // mouse drag pieces - this.#board.onmousedown = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#mousedownSquare(e) - this.#container.onmousedown = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.sparePieces} .${ClassNameLookup.piece}`) && this.#mousedownSparePiece(e) + this.#board.onmousedown = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#mousedownSquare(e); + this.#container.onmousedown = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.sparePieces} .${ClassNameLookup.piece}`) && this.#mousedownSparePiece(e); // mouse enter / leave square - this.#board.onmouseenter = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#mouseenterSquare(e) - this.#board.onmouseleave = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#mouseleaveSquare(e) + this.#board.onmouseenter = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#mouseenterSquare(e); + this.#board.onmouseleave = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#mouseleaveSquare(e); // piece drag - const throttledMousemoveWindow = throttle((e) => this.#mousemoveWindow(e), this.#config.dragThrottleRate) - const throttledTouchmoveWindow = throttle((e) => this.#touchmoveWindow(e), this.#config.dragThrottleRate) - window.onmousemove = (e) => throttledMousemoveWindow(e) - window.onmouseup = (e) => this.#mouseupWindow(e) + const throttledMousemoveWindow = throttle((e) => this.#mousemoveWindow(e), this.#config.dragThrottleRate); + const throttledTouchmoveWindow = throttle((e) => this.#touchmoveWindow(e), this.#config.dragThrottleRate); + window.onmousemove = (e) => throttledMousemoveWindow(e); + window.onmouseup = (e) => this.#mouseupWindow(e); // touch drag pieces if (isTouchDevice()) { - this.#board.ontouchstart = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#touchstartSquare(e) - this.#board.ontouchstart = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.sparePieces} .${ClassNameLookup.piece}`) && this.#touchstartSparePiece(e) - window.ontouchmove = (e) => throttledTouchmoveWindow(e) - window.ontouchend = (e) => this.#touchendWindow(e) + this.#board.ontouchstart = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.square}`) && this.#touchstartSquare(e); + this.#board.ontouchstart = (e) => e.target && /** @type {Element} */(e.target).matches(`.${ClassNameLookup.sparePieces} .${ClassNameLookup.piece}`) && this.#touchstartSparePiece(e); + window.ontouchmove = (e) => throttledTouchmoveWindow(e); + window.ontouchend = (e) => this.#touchendWindow(e); } } /** * Calculates square size based on the width of the container */ - #calculateSquareSize () { + #calculateSquareSize() { // got a little CSS black magic here, so let me explain: // get the width of the container element (could be anything), reduce by 1 for // fudge factor, and then keep reducing until we find an exact mod 8 for // our square size - const containerWidth = this.#container.getBoundingClientRect().width + const containerWidth = this.#container.getBoundingClientRect().width; // defensive, prevent infinite loop if (!containerWidth || containerWidth <= 0) { - return 0 + return 0; } // pad one pixel - let boardWidth = containerWidth - 1 + let boardWidth = containerWidth - 1; while (boardWidth % 8 !== 0 && boardWidth > 0) { - boardWidth = boardWidth - 1 + boardWidth = boardWidth - 1; } - return boardWidth / 8 + return boardWidth / 8; } } -export { Chessboard, fenToObj, objToFen, interpolateTemplate, validSquare, validPieceCode, validFen, validPositionObject, START_FEN, START_POSITION } +export { Chessboard, fenToObj, objToFen, interpolateTemplate, validSquare, validPieceCode, validFen, validPositionObject, START_FEN, START_POSITION }; diff --git a/lib/chessboard.test.js b/lib/chessboard.test.js index c7aeeb9..c51e204 100644 --- a/lib/chessboard.test.js +++ b/lib/chessboard.test.js @@ -1,69 +1,70 @@ -import assert from 'node:assert' -import test from 'node:test' +/* eslint-env node */ +import assert from 'node:assert'; +import test from 'node:test'; -import { interpolateTemplate, objToFen, START_FEN, START_POSITION, validFen, validPieceCode, validPositionObject, validSquare } from './chessboard.js' +import { interpolateTemplate, objToFen, START_FEN, START_POSITION, validFen, validPieceCode, validPositionObject, validSquare } from './chessboard.js'; test('interpolateTemplate', () => { - assert.equal(interpolateTemplate('abc', { a: 'x' }), 'abc') - assert.equal(interpolateTemplate('{a}bc', {}), '{a}bc') - assert.equal(interpolateTemplate('{a}bc', { p: 'q' }), '{a}bc') - assert.equal(interpolateTemplate('{a}bc', { a: 'x' }), 'xbc') - assert.equal(interpolateTemplate('{a}bc{a}bc', { a: 'x' }), 'xbcxbc') - assert.equal(interpolateTemplate('{a}{a}{b}', { a: 'x', b: 'y' }), 'xxy') -}) + assert.equal(interpolateTemplate('abc', { a: 'x' }), 'abc'); + assert.equal(interpolateTemplate('{a}bc', {}), '{a}bc'); + assert.equal(interpolateTemplate('{a}bc', { p: 'q' }), '{a}bc'); + assert.equal(interpolateTemplate('{a}bc', { a: 'x' }), 'xbc'); + assert.equal(interpolateTemplate('{a}bc{a}bc', { a: 'x' }), 'xbcxbc'); + assert.equal(interpolateTemplate('{a}{a}{b}', { a: 'x', b: 'y' }), 'xxy'); +}); test('objToFen', () => { - assert.equal(objToFen(START_POSITION), START_FEN) - assert.equal(objToFen({}), '8/8/8/8/8/8/8/8') - assert.equal(objToFen({ a2: 'wP', b2: 'bP' }), '8/8/8/8/8/8/Pp6/8') -}) + assert.equal(objToFen(START_POSITION), START_FEN); + assert.equal(objToFen({}), '8/8/8/8/8/8/8/8'); + assert.equal(objToFen({ a2: 'wP', b2: 'bP' }), '8/8/8/8/8/8/Pp6/8'); +}); test('validSquare', () => { - assert.ok(validSquare('a1')) - assert.ok(validSquare('e2')) - assert.ok(!validSquare('D2')) - assert.ok(!validSquare('g9')) - assert.ok(!validSquare('a')) - assert.ok(!validSquare(true)) - assert.ok(!validSquare(null)) - assert.ok(!validSquare({})) -}) + assert.ok(validSquare('a1')); + assert.ok(validSquare('e2')); + assert.ok(!validSquare('D2')); + assert.ok(!validSquare('g9')); + assert.ok(!validSquare('a')); + assert.ok(!validSquare(true)); + assert.ok(!validSquare(null)); + assert.ok(!validSquare({})); +}); test('validPieceCode', () => { - assert.ok(validPieceCode('bP')) - assert.ok(validPieceCode('bK')) - assert.ok(validPieceCode('wK')) - assert.ok(validPieceCode('wR')) - assert.ok(!validPieceCode('WR')) - assert.ok(!validPieceCode('Wr')) - assert.ok(!validPieceCode('a')) - assert.ok(!validPieceCode(true)) - assert.ok(!validPieceCode(null)) - assert.ok(!validPieceCode({})) -}) + assert.ok(validPieceCode('bP')); + assert.ok(validPieceCode('bK')); + assert.ok(validPieceCode('wK')); + assert.ok(validPieceCode('wR')); + assert.ok(!validPieceCode('WR')); + assert.ok(!validPieceCode('Wr')); + assert.ok(!validPieceCode('a')); + assert.ok(!validPieceCode(true)); + assert.ok(!validPieceCode(null)); + assert.ok(!validPieceCode({})); +}); test('validFen', () => { - assert.ok(validFen(START_FEN)) - assert.ok(validFen('8/8/8/8/8/8/8/8')) - assert.ok(validFen('r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R')) - assert.ok(validFen('3r3r/1p4pp/2nb1k2/pP3p2/8/PB2PN2/p4PPP/R4RK1 b - - 0 1')) - assert.ok(!validFen('3r3z/1p4pp/2nb1k2/pP3p2/8/PB2PN2/p4PPP/R4RK1 b - - 0 1')) - assert.ok(!validFen('anbqkbnr/8/8/8/8/8/PPPPPPPP/8')) - assert.ok(!validFen('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/')) - assert.ok(!validFen('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBN')) - assert.ok(!validFen('888888/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR')) - assert.ok(!validFen('888888/pppppppp/74/8/8/8/PPPPPPPP/RNBQKBNR')) - assert.ok(!validFen({})) -}) + assert.ok(validFen(START_FEN)); + assert.ok(validFen('8/8/8/8/8/8/8/8')); + assert.ok(validFen('r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R')); + assert.ok(validFen('3r3r/1p4pp/2nb1k2/pP3p2/8/PB2PN2/p4PPP/R4RK1 b - - 0 1')); + assert.ok(!validFen('3r3z/1p4pp/2nb1k2/pP3p2/8/PB2PN2/p4PPP/R4RK1 b - - 0 1')); + assert.ok(!validFen('anbqkbnr/8/8/8/8/8/PPPPPPPP/8')); + assert.ok(!validFen('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/')); + assert.ok(!validFen('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBN')); + assert.ok(!validFen('888888/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR')); + assert.ok(!validFen('888888/pppppppp/74/8/8/8/PPPPPPPP/RNBQKBNR')); + assert.ok(!validFen({})); +}); test('validPositionObject', () => { - assert.ok(validPositionObject(START_POSITION)) - assert.ok(validPositionObject({})) - assert.ok(validPositionObject({ e2: 'wP' })) - assert.ok(validPositionObject({ e2: 'wP', d2: 'wP' })) - assert.ok(!validPositionObject({ e2: 'BP' })) - assert.ok(!validPositionObject({ y2: 'wP' })) - assert.ok(!validPositionObject(null)) - assert.ok(!validPositionObject('start')) - assert.ok(!validPositionObject(START_FEN)) -}) + assert.ok(validPositionObject(START_POSITION)); + assert.ok(validPositionObject({})); + assert.ok(validPositionObject({ e2: 'wP' })); + assert.ok(validPositionObject({ e2: 'wP', d2: 'wP' })); + assert.ok(!validPositionObject({ e2: 'BP' })); + assert.ok(!validPositionObject({ y2: 'wP' })); + assert.ok(!validPositionObject(null)); + assert.ok(!validPositionObject('start')); + assert.ok(!validPositionObject(START_FEN)); +}); diff --git a/package.json b/package.json index b2a31ca..424c5d7 100644 --- a/package.json +++ b/package.json @@ -15,20 +15,29 @@ ], "devDependencies": { "@types/node": "18.7.23", + "eslint": "8.24.0", "gulp": "4.0.2", "kidif": "1.1.0", "mustache": "2.3.0", "rollup": "2.79.1", "rollup-plugin-terser": "7.0.2", - "sass": "1.55.0", - "standard": "17.0.0" + "sass": "1.55.0" }, "resolutions": { "chokidar": "3.5.3" }, "scripts": { - "build": "standard lib/chessboard.js && gulp", - "standard": "standard --fix lib/*.js website/js/*.js", + "lint": "eslint Gulpfile.js lib website/js/examples.js", + "build": "npm run lint -- --fix && gulp", "test": "node --test lib" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "es2022": true + }, + "parserOptions": { + "sourceType": "module" + } } } diff --git a/website/js/examples.js b/website/js/examples.js index 1f09ab8..93b371a 100644 --- a/website/js/examples.js +++ b/website/js/examples.js @@ -1,8 +1,9 @@ -; (function () { - const EXAMPLES = window.CHESSBOARD_EXAMPLES - const prettyPrint = window.prettyPrint +/* eslint-env browser */ +(function () { + const EXAMPLES = window.CHESSBOARD_EXAMPLES; + const prettyPrint = window.prettyPrint; - function htmlEscape (str) { + function htmlEscape(str) { return (str + '') .replace(/&/g, '&') .replace(/ x.classList.remove('active')) - document.getElementById('groupHeader-' + groupIdx)?.classList.add('active') + function highlightGroupHeader(groupIdx) { + document.querySelectorAll('#examplesNav h4').forEach(x => x.classList.remove('active')); + document.getElementById('groupHeader-' + groupIdx)?.classList.add('active'); } - function highlightExampleLink (exampleId) { - document.querySelectorAll('#examplesNav li').forEach(x => x.classList.remove('active')) - document.getElementById('exampleLink-' + exampleId)?.classList.add('active') + function highlightExampleLink(exampleId) { + document.querySelectorAll('#examplesNav li').forEach(x => x.classList.remove('active')); + document.getElementById('exampleLink-' + exampleId)?.classList.add('active'); } - function buildExampleBodyHTML (example, id) { + function buildExampleBodyHTML(example, id) { const html = '

' + '' + htmlEscape(example.name) + @@ -34,60 +35,60 @@ '
' + htmlEscape(example.jsStr) + '
' + '

HTML

' + '
' + htmlEscape(example.html) + '
' + - '

View this example in new window.

' + '

View this example in new window.

'; - return html + return html; } - function showExample (exampleId) { - const groupIdx = document.getElementById('#exampleLink-' + exampleId)?.closest('ul')?.getAttribute('id')?.replace('groupContainer-', '') + function showExample(exampleId) { + const groupIdx = document.getElementById('#exampleLink-' + exampleId)?.closest('ul')?.getAttribute('id')?.replace('groupContainer-', ''); - document.getElementById('groupContainer-' + groupIdx)?.style.setProperty('display', '') - highlightGroupHeader(groupIdx) - highlightExampleLink(exampleId) + document.getElementById('groupContainer-' + groupIdx)?.style.setProperty('display', ''); + highlightGroupHeader(groupIdx); + highlightExampleLink(exampleId); - document.getElementById('exampleBodyContainer').innerHTML = buildExampleBodyHTML(EXAMPLES[exampleId], exampleId) - EXAMPLES[exampleId].jsFn() + document.getElementById('exampleBodyContainer').innerHTML = buildExampleBodyHTML(EXAMPLES[exampleId], exampleId); + EXAMPLES[exampleId].jsFn(); - prettyPrint() + prettyPrint(); } - function clickExampleNavLink (evt) { - const exampleId = evt.target.getAttribute('id').replace('exampleLink-', '') - if (!Object.prototype.hasOwnProperty.call(EXAMPLES, exampleId)) return + function clickExampleNavLink(evt) { + const exampleId = evt.target.getAttribute('id').replace('exampleLink-', ''); + if (!Object.prototype.hasOwnProperty.call(EXAMPLES, exampleId)) return; - window.location.hash = exampleId - loadExampleFromHash() + window.location.hash = exampleId; + loadExampleFromHash(); } - function loadExampleFromHash () { - let exampleId = parseInt(window.location.hash.replace('#', ''), 10) + function loadExampleFromHash() { + let exampleId = parseInt(window.location.hash.replace('#', ''), 10); if (!Object.prototype.hasOwnProperty.call(EXAMPLES, exampleId)) { - exampleId = 1000 - window.location.hash = exampleId + exampleId = 1000; + window.location.hash = exampleId; } - showExample(exampleId) + showExample(exampleId); } - function clickGroupHeader (evt) { - const groupIdx = evt.target.getAttribute('id').replace('groupHeader-', '') - const examplesList = document.getElementById('#groupContainer-' + groupIdx) + function clickGroupHeader(evt) { + const groupIdx = evt.target.getAttribute('id').replace('groupHeader-', ''); + const examplesList = document.getElementById('#groupContainer-' + groupIdx); if (examplesList?.style.getPropertyValue('display') === 'none') { - examplesList.slideDown('fast') + examplesList.slideDown('fast'); } else { - examplesList.slideUp('fast') + examplesList.slideUp('fast'); } } - const examplesNav = document.getElementById('examplesNav') + const examplesNav = document.getElementById('examplesNav'); examplesNav.onclick = (evt) => { if (evt.target) { if (evt.target.matches('li')) { - clickExampleNavLink(evt) + clickExampleNavLink(evt); } else if (evt.target.matches('h4')) { - clickGroupHeader(evt) + clickGroupHeader(evt); } } - } - loadExampleFromHash() -})() + }; + loadExampleFromHash(); +})(); diff --git a/yarn.lock b/yarn.lock index e6942b8..d204dbd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -123,11 +123,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@types/json5@^0.0.29": - version "0.0.29" - resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" - integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== - "@types/node@*", "@types/node@18.7.23": version "18.7.23" resolved "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz" @@ -263,17 +258,6 @@ array-each@^1.0.0, array-each@^1.0.1: resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" integrity sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA== -array-includes@^3.1.4, array-includes@^3.1.5: - version "3.1.5" - resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz" - integrity sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.19.5" - get-intrinsic "^1.1.1" - is-string "^1.0.7" - array-initial@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/array-initial/-/array-initial-1.1.0.tgz#2fa74b26739371c3947bd7a7adc73be334b3d795" @@ -313,26 +297,6 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ== -array.prototype.flat@^1.2.5: - version "1.3.0" - resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz" - integrity sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.2" - es-shim-unscopables "^1.0.0" - -array.prototype.flatmap@^1.3.0: - version "1.3.0" - resolved "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz" - integrity sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.2" - es-shim-unscopables "^1.0.0" - assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" @@ -439,13 +403,6 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -builtins@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz" - integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ== - dependencies: - semver "^7.0.0" - cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -461,7 +418,7 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -call-bind@^1.0.0, call-bind@^1.0.2: +call-bind@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz" integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== @@ -672,20 +629,13 @@ d@1, d@^1.0.1: es5-ext "^0.10.50" type "^1.0.1" -debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: +debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@^3.2.7: - version "3.2.7" - resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz" - integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== - dependencies: - ms "^2.1.1" - debug@^4.1.1, debug@^4.3.2: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" @@ -720,7 +670,7 @@ default-resolution@^2.0.0: resolved "https://registry.yarnpkg.com/default-resolution/-/default-resolution-2.0.0.tgz#bcb82baa72ad79b426a76732f1a81ad6df26d684" integrity sha512-2xaP6GiwVwOEbXCGoJ4ufgC76m8cj805jrghScewJC2ZDsb9U0b4BIrba+xt/Uytyd0HvQ6+WymSRTfnYj59GQ== -define-properties@^1.1.3, define-properties@^1.1.4: +define-properties@^1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz" integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== @@ -762,13 +712,6 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -doctrine@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz" - integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== - dependencies: - esutils "^2.0.2" - doctrine@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" @@ -801,59 +744,13 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -error-ex@^1.2.0, error-ex@^1.3.1: +error-ex@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" -es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5: - version "1.20.3" - resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.3.tgz" - integrity sha512-AyrnaKVpMzljIdwjzrj+LxGmj8ik2LckwXacHqrJJ/jxz6dDDBcZ7I7nlHM0FvEW8MfbWJwOd+yT2XzYW49Frw== - dependencies: - call-bind "^1.0.2" - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - function.prototype.name "^1.1.5" - get-intrinsic "^1.1.3" - get-symbol-description "^1.0.0" - has "^1.0.3" - has-property-descriptors "^1.0.0" - has-symbols "^1.0.3" - internal-slot "^1.0.3" - is-callable "^1.2.6" - is-negative-zero "^2.0.2" - is-regex "^1.1.4" - is-shared-array-buffer "^1.0.2" - is-string "^1.0.7" - is-weakref "^1.0.2" - object-inspect "^1.12.2" - object-keys "^1.1.1" - object.assign "^4.1.4" - regexp.prototype.flags "^1.4.3" - safe-regex-test "^1.0.0" - string.prototype.trimend "^1.0.5" - string.prototype.trimstart "^1.0.5" - unbox-primitive "^1.0.2" - -es-shim-unscopables@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz" - integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== - dependencies: - has "^1.0.3" - -es-to-primitive@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz" - integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== - dependencies: - is-callable "^1.1.4" - is-date-object "^1.0.1" - is-symbol "^1.0.2" - es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50: version "0.10.62" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" @@ -900,97 +797,6 @@ escape-string-regexp@^4.0.0: resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-config-standard-jsx@^11.0.0: - version "11.0.0" - resolved "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-11.0.0.tgz" - integrity sha512-+1EV/R0JxEK1L0NGolAr8Iktm3Rgotx3BKwgaX+eAuSX8D952LULKtjgZD3F+e6SvibONnhLwoTi9DPxN5LvvQ== - -eslint-config-standard@17.0.0: - version "17.0.0" - resolved "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz" - integrity sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg== - -eslint-import-resolver-node@^0.3.6: - version "0.3.6" - resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz" - integrity sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw== - dependencies: - debug "^3.2.7" - resolve "^1.20.0" - -eslint-module-utils@^2.7.3: - version "2.7.4" - resolved "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz" - integrity sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA== - dependencies: - debug "^3.2.7" - -eslint-plugin-es@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz" - integrity sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ== - dependencies: - eslint-utils "^2.0.0" - regexpp "^3.0.0" - -eslint-plugin-import@^2.26.0: - version "2.26.0" - resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz" - integrity sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA== - dependencies: - array-includes "^3.1.4" - array.prototype.flat "^1.2.5" - debug "^2.6.9" - doctrine "^2.1.0" - eslint-import-resolver-node "^0.3.6" - eslint-module-utils "^2.7.3" - has "^1.0.3" - is-core-module "^2.8.1" - is-glob "^4.0.3" - minimatch "^3.1.2" - object.values "^1.1.5" - resolve "^1.22.0" - tsconfig-paths "^3.14.1" - -eslint-plugin-n@^15.1.0: - version "15.3.0" - resolved "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.3.0.tgz" - integrity sha512-IyzPnEWHypCWasDpxeJnim60jhlumbmq0pubL6IOcnk8u2y53s5QfT8JnXy7skjHJ44yWHRb11PLtDHuu1kg/Q== - dependencies: - builtins "^5.0.1" - eslint-plugin-es "^4.1.0" - eslint-utils "^3.0.0" - ignore "^5.1.1" - is-core-module "^2.10.0" - minimatch "^3.1.2" - resolve "^1.22.1" - semver "^7.3.7" - -eslint-plugin-promise@^6.0.0: - version "6.0.1" - resolved "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.1.tgz" - integrity sha512-uM4Tgo5u3UWQiroOyDEsYcVMOo7re3zmno0IZmB5auxoaQNIceAbXEkSt8RNrKtaYehARHG06pYK6K1JhtP0Zw== - -eslint-plugin-react@^7.28.0: - version "7.31.8" - resolved "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.8.tgz" - integrity sha512-5lBTZmgQmARLLSYiwI71tiGVTLUuqXantZM6vlSY39OaDSV0M7+32K5DnLkmFrwTe+Ksz0ffuLUC91RUviVZfw== - dependencies: - array-includes "^3.1.5" - array.prototype.flatmap "^1.3.0" - doctrine "^2.1.0" - estraverse "^5.3.0" - jsx-ast-utils "^2.4.1 || ^3.0.0" - minimatch "^3.1.2" - object.entries "^1.1.5" - object.fromentries "^2.0.5" - object.hasown "^1.1.1" - object.values "^1.1.5" - prop-types "^15.8.1" - resolve "^2.0.0-next.3" - semver "^6.3.0" - string.prototype.matchall "^4.0.7" - eslint-scope@^7.1.1: version "7.1.1" resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz" @@ -999,13 +805,6 @@ eslint-scope@^7.1.1: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-utils@^2.0.0: - version "2.1.0" - resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz" - integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== - dependencies: - eslint-visitor-keys "^1.1.0" - eslint-utils@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz" @@ -1013,11 +812,6 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -eslint-visitor-keys@^1.1.0: - version "1.3.0" - resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz" - integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== - eslint-visitor-keys@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz" @@ -1028,9 +822,9 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^8.13.0: +eslint@8.24.0: version "8.24.0" - resolved "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.24.0.tgz#489516c927a5da11b3979dbfb2679394523383c8" integrity sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ== dependencies: "@eslint/eslintrc" "^1.3.2" @@ -1096,7 +890,7 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" -estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: +estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -1247,13 +1041,6 @@ find-up@^1.0.0: path-exists "^2.0.0" pinkie-promise "^2.0.0" -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz" - integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== - dependencies: - locate-path "^3.0.0" - find-up@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" @@ -1361,27 +1148,12 @@ function-bind@^1.1.1: resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -function.prototype.name@^1.1.5: - version "1.1.5" - resolved "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz" - integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.0" - functions-have-names "^1.2.2" - -functions-have-names@^1.2.2: - version "1.2.3" - resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz" - integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== - get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== -get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3: +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1: version "1.1.3" resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz" integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A== @@ -1390,19 +1162,6 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1, get-intrinsic@ has "^1.0.3" has-symbols "^1.0.3" -get-stdin@^8.0.0: - version "8.0.0" - resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz" - integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== - -get-symbol-description@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz" - integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.1" - get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -1528,7 +1287,7 @@ glogg@^1.0.0: dependencies: sparkles "^1.0.0" -graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6: +graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== @@ -1579,11 +1338,6 @@ gulplog@^1.0.0: dependencies: glogg "^1.0.0" -has-bigints@^1.0.1, has-bigints@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz" - integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -1601,18 +1355,11 @@ has-property-descriptors@^1.0.0: dependencies: get-intrinsic "^1.1.1" -has-symbols@^1.0.2, has-symbols@^1.0.3: +has-symbols@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== -has-tostringtag@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz" - integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== - dependencies: - has-symbols "^1.0.2" - has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" @@ -1663,7 +1410,7 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== -ignore@^5.1.1, ignore@^5.2.0: +ignore@^5.2.0: version "5.2.0" resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== @@ -1704,15 +1451,6 @@ ini@^1.3.4: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -internal-slot@^1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz" - integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== - dependencies: - get-intrinsic "^1.1.0" - has "^1.0.3" - side-channel "^1.0.4" - interpret@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" @@ -1750,13 +1488,6 @@ is-arrayish@^0.2.1: resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== -is-bigint@^1.0.1: - version "1.0.4" - resolved "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz" - integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== - dependencies: - has-bigints "^1.0.1" - is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" @@ -1764,25 +1495,12 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" -is-boolean-object@^1.1.0: - version "1.1.2" - resolved "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz" - integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-callable@^1.1.4, is-callable@^1.2.6: - version "1.2.7" - resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz" - integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== - -is-core-module@^2.10.0, is-core-module@^2.8.1, is-core-module@^2.9.0: +is-core-module@^2.9.0: version "2.10.0" resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz" integrity sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg== @@ -1803,11 +1521,6 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" -is-date-object@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz" - integrity sha512-P5rExV1phPi42ppoMWy7V63N3i173RY921l4JJ7zonMSxK+OWGPj76GD+cUKUb68l4vQXcJp2SsG+r/A4ABVzg== - is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" @@ -1869,18 +1582,6 @@ is-negated-glob@^1.0.0: resolved "https://registry.yarnpkg.com/is-negated-glob/-/is-negated-glob-1.0.0.tgz#6910bca5da8c95e784b5751b976cf5a10fee36d2" integrity sha512-czXVVn/QEmgvej1f50BZ648vUI+em0xqMq2Sn+QncCLN4zj1UAxlT+kw/6ggQTOaZPd1HqKQGEqbpQVtJucWug== -is-negative-zero@^2.0.2: - version "2.0.2" - resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz" - integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== - -is-number-object@^1.0.4: - version "1.0.7" - resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz" - integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== - dependencies: - has-tostringtag "^1.0.0" - is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -1910,14 +1611,6 @@ is-plain-object@^5.0.0: resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-regex@^1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz" - integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - is-relative@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d" @@ -1925,27 +1618,6 @@ is-relative@^1.0.0: dependencies: is-unc-path "^1.0.0" -is-shared-array-buffer@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz" - integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== - dependencies: - call-bind "^1.0.2" - -is-string@^1.0.5, is-string@^1.0.7: - version "1.0.7" - resolved "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz" - integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== - dependencies: - has-tostringtag "^1.0.0" - -is-symbol@^1.0.2, is-symbol@^1.0.3: - version "1.0.4" - resolved "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz" - integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== - dependencies: - has-symbols "^1.0.2" - is-unc-path@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-1.0.0.tgz#d731e8898ed090a12c352ad2eaed5095ad322c9d" @@ -1963,13 +1635,6 @@ is-valid-glob@^1.0.0: resolved "https://registry.yarnpkg.com/is-valid-glob/-/is-valid-glob-1.0.0.tgz#29bf3eff701be2d4d315dbacc39bc39fe8f601aa" integrity sha512-AhiROmoEFDSsjx8hW+5sGwgKVIORcXnrlAx/R0ZSeaPw70Vw0CqkGBBhHGL58Uox2eXnU1AnvXJl1XlyedO5bA== -is-weakref@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz" - integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== - dependencies: - call-bind "^1.0.2" - is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -2011,7 +1676,7 @@ js-sdsl@^4.1.4: resolved "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.4.tgz" integrity sha512-Y2/yD55y5jteOAmY50JbUZYwk3CP3wnLPEZnlR1w9oKhITrBEtAxwuWKebFf8hMrPMgbYwFoWK/lH2sBkErELw== -"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: +js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== @@ -2023,11 +1688,6 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" -json-parse-better-errors@^1.0.1: - version "1.0.2" - resolved "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz" - integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== - json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" @@ -2038,21 +1698,6 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json5@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz" - integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== - dependencies: - minimist "^1.2.0" - -"jsx-ast-utils@^2.4.1 || ^3.0.0": - version "3.3.3" - resolved "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.3.tgz" - integrity sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw== - dependencies: - array-includes "^3.1.5" - object.assign "^4.1.3" - just-debounce@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.1.0.tgz#2f81a3ad4121a76bc7cb45dbf704c0d76a8e5ddf" @@ -2151,25 +1796,6 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -load-json-file@^5.2.0: - version "5.3.0" - resolved "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz" - integrity sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw== - dependencies: - graceful-fs "^4.1.15" - parse-json "^4.0.0" - pify "^4.0.1" - strip-bom "^3.0.0" - type-fest "^0.3.0" - -locate-path@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz" - integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.0" - locate-path@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" @@ -2182,20 +1808,6 @@ lodash.merge@^4.6.2: resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -loose-envify@^1.4.0: - version "1.4.0" - resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -2269,11 +1881,6 @@ micromatch@^4.0.4: dependencies: brace-expansion "^1.1.7" -minimist@^1.2.0, minimist@^1.2.6: - version "1.2.6" - resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz" - integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== - mixin-deep@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" @@ -2287,7 +1894,7 @@ ms@2.0.0: resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== -ms@2.1.2, ms@^2.1.1: +ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== @@ -2363,11 +1970,6 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== -object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" @@ -2377,11 +1979,6 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-inspect@^1.12.2, object-inspect@^1.9.0: - version "1.12.2" - resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz" - integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== - object-keys@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz" @@ -2394,7 +1991,7 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" -object.assign@^4.0.4, object.assign@^4.1.0, object.assign@^4.1.3, object.assign@^4.1.4: +object.assign@^4.0.4, object.assign@^4.1.0: version "4.1.4" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== @@ -2414,32 +2011,6 @@ object.defaults@^1.0.0, object.defaults@^1.1.0: for-own "^1.0.0" isobject "^3.0.0" -object.entries@^1.1.5: - version "1.1.5" - resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz" - integrity sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" - -object.fromentries@^2.0.5: - version "2.0.5" - resolved "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz" - integrity sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" - -object.hasown@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.1.tgz" - integrity sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A== - dependencies: - define-properties "^1.1.4" - es-abstract "^1.19.5" - object.map@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object.map/-/object.map-1.0.1.tgz#cf83e59dc8fcc0ad5f4250e1f78b3b81bd801d37" @@ -2463,15 +2034,6 @@ object.reduce@^1.0.0: for-own "^1.0.0" make-iterator "^1.0.0" -object.values@^1.1.5: - version "1.1.5" - resolved "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz" - integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" - once@^1.3.0, once@^1.3.1, once@^1.3.2, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -2505,13 +2067,6 @@ os-locale@^1.4.0: dependencies: lcid "^1.0.0" -p-limit@^2.0.0: - version "2.3.0" - resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - p-limit@^3.0.2: version "3.1.0" resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" @@ -2519,13 +2074,6 @@ p-limit@^3.0.2: dependencies: yocto-queue "^0.1.0" -p-locate@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz" - integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== - dependencies: - p-limit "^2.0.0" - p-locate@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" @@ -2533,11 +2081,6 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - parent-module@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" @@ -2561,14 +2104,6 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" -parse-json@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz" - integrity sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw== - dependencies: - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - parse-node-version@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" @@ -2596,11 +2131,6 @@ path-exists@^2.0.0: dependencies: pinkie-promise "^2.0.0" -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" - integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== - path-exists@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" @@ -2657,11 +2187,6 @@ pify@^2.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== -pify@^4.0.1: - version "4.0.1" - resolved "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz" - integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== - pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -2674,14 +2199,6 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== -pkg-conf@^3.1.0: - version "3.1.0" - resolved "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz" - integrity sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ== - dependencies: - find-up "^3.0.0" - load-json-file "^5.2.0" - posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -2702,15 +2219,6 @@ process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -prop-types@^15.8.1: - version "15.8.1" - resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" - integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== - dependencies: - loose-envify "^1.4.0" - object-assign "^4.1.1" - react-is "^16.13.1" - pump@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" @@ -2745,11 +2253,6 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -react-is@^16.13.1: - version "16.13.1" - resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" - integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== - read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -2802,16 +2305,7 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp.prototype.flags@^1.4.1, regexp.prototype.flags@^1.4.3: - version "1.4.3" - resolved "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz" - integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - functions-have-names "^1.2.2" - -regexpp@^3.0.0, regexpp@^3.2.0: +regexpp@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz" integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== @@ -2897,7 +2391,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg== -resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.20.0, resolve@^1.22.0, resolve@^1.22.1, resolve@^1.4.0: +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.4.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== @@ -2906,15 +2400,6 @@ resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.20.0, resolve@^1.22. path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -resolve@^2.0.0-next.3: - version "2.0.0-next.4" - resolved "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz" - integrity sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ== - dependencies: - is-core-module "^2.9.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -2961,15 +2446,6 @@ safe-buffer@^5.1.0, safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-regex-test@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz" - integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.3" - is-regex "^1.1.4" - safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -2998,18 +2474,6 @@ semver-greatest-satisfied-range@^1.1.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.3.0: - version "6.3.0" - resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== - -semver@^7.0.0, semver@^7.3.7: - version "7.3.7" - resolved "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz" - integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== - dependencies: - lru-cache "^6.0.0" - serialize-javascript@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" @@ -3044,15 +2508,6 @@ shebang-regex@^3.0.0: resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -side-channel@^1.0.4: - version "1.0.4" - resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" - integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== - dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.2" - object-inspect "^1.9.0" - slash@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" @@ -3170,30 +2625,6 @@ stack-trace@0.0.10: resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg== -standard-engine@^15.0.0: - version "15.0.0" - resolved "https://registry.npmjs.org/standard-engine/-/standard-engine-15.0.0.tgz" - integrity sha512-4xwUhJNo1g/L2cleysUqUv7/btn7GEbYJvmgKrQ2vd/8pkTmN8cpqAZg+BT8Z1hNeEH787iWUdOpL8fmApLtxA== - dependencies: - get-stdin "^8.0.0" - minimist "^1.2.6" - pkg-conf "^3.1.0" - xdg-basedir "^4.0.0" - -standard@17.0.0: - version "17.0.0" - resolved "https://registry.npmjs.org/standard/-/standard-17.0.0.tgz" - integrity sha512-GlCM9nzbLUkr+TYR5I2WQoIah4wHA2lMauqbyPLV/oI5gJxqhHzhjl9EG2N0lr/nRqI3KCbCvm/W3smxvLaChA== - dependencies: - eslint "^8.13.0" - eslint-config-standard "17.0.0" - eslint-config-standard-jsx "^11.0.0" - eslint-plugin-import "^2.26.0" - eslint-plugin-n "^15.1.0" - eslint-plugin-promise "^6.0.0" - eslint-plugin-react "^7.28.0" - standard-engine "^15.0.0" - static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -3221,38 +2652,6 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string.prototype.matchall@^4.0.7: - version "4.0.7" - resolved "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz" - integrity sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" - get-intrinsic "^1.1.1" - has-symbols "^1.0.3" - internal-slot "^1.0.3" - regexp.prototype.flags "^1.4.1" - side-channel "^1.0.4" - -string.prototype.trimend@^1.0.5: - version "1.0.5" - resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz" - integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.19.5" - -string.prototype.trimstart@^1.0.5: - version "1.0.5" - resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz" - integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.19.5" - string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -3281,11 +2680,6 @@ strip-bom@^2.0.0: dependencies: is-utf8 "^0.2.0" -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" - integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== - strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" @@ -3401,16 +2795,6 @@ to-through@^2.0.0: dependencies: through2 "^2.0.3" -tsconfig-paths@^3.14.1: - version "3.14.1" - resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz" - integrity sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ== - dependencies: - "@types/json5" "^0.0.29" - json5 "^1.0.1" - minimist "^1.2.6" - strip-bom "^3.0.0" - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" @@ -3423,11 +2807,6 @@ type-fest@^0.20.2: resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -type-fest@^0.3.0: - version "0.3.1" - resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz" - integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== - type@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" @@ -3443,16 +2822,6 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -unbox-primitive@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz" - integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== - dependencies: - call-bind "^1.0.2" - has-bigints "^1.0.2" - has-symbols "^1.0.3" - which-boxed-primitive "^1.0.2" - unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" @@ -3595,17 +2964,6 @@ vinyl@^2.0.0: remove-trailing-separator "^1.0.1" replace-ext "^1.0.0" -which-boxed-primitive@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz" - integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== - dependencies: - is-bigint "^1.0.1" - is-boolean-object "^1.1.0" - is-number-object "^1.0.4" - is-string "^1.0.5" - is-symbol "^1.0.3" - which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" @@ -3643,11 +3001,6 @@ wrappy@1: resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -xdg-basedir@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz" - integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q== - xtend@~4.0.0, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" @@ -3658,11 +3011,6 @@ y18n@^3.2.1: resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696" integrity sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - yargs-parser@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.1.tgz#7ede329c1d8cdbbe209bd25cdb990e9b1ebbb394"