diff --git a/.eslintignore b/.eslintignore index 7801c2a..dacb580 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,2 @@ dist -docs -src/tests/** \ No newline at end of file +src/tests/** diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml deleted file mode 100644 index d3baf5b..0000000 --- a/.github/workflows/deploy-docs.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Docs - -on: - release: - types: created - - push: - branches: main - - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -concurrency: - group: pages - cancel-in-progress: true - -jobs: - docs: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js 18 - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: install npm dependencies - run: npm ci - - name: build docs files - run: npm run docs:build - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 - with: - source: ./docs/.vitepress/dist - destination: ./_site - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: docs - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index f9de658..3d4fa72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -142,9 +142,9 @@ ### v1.0.0. includes some breaking changes. Only breaking changes will be listed here. Refer to the new documentation to update your app to v1.0.0 -- callback functions as props have been removed. Take a look at the [documentation](https://qwerty084.github.io/vue3-chessboard/callbacks.html) to see how to register callbacks in v1.0.0. -- board and game from the boardAPI have been made private. You need to use the corresponding method to achieve the same result. Visit the [docs](https://qwerty084.github.io/vue3-chessboard/board-api.html) to get an overview of all available methods. -- If you encounter any issues visit the [docs](https://qwerty084.github.io/vue3-chessboard/) or open an [issue](https://github.com/qwerty084/vue3-chessboard/issues/new/choose). +- callback functions as props have been removed. Take a look at the [documentation](https://qwerty084.github.io/vue3-chessboard-docs/callbacks.html) to see how to register callbacks in v1.0.0. +- board and game from the boardAPI have been made private. You need to use the corresponding method to achieve the same result. Visit the [docs](https://qwerty084.github.io/vue3-chessboard-docs/board-api.html) to get an overview of all available methods. +- If you encounter any issues visit the [docs](https://qwerty084.github.io/vue3-chessboard-docs) or open an [issue](https://github.com/qwerty084/vue3-chessboard/issues/new/choose). ## 0.0.9 (2022-11-13) diff --git a/docs/.vitepress/.gitignore b/docs/.vitepress/.gitignore deleted file mode 100644 index 6e25fa8..0000000 --- a/docs/.vitepress/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cache/ \ No newline at end of file diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts deleted file mode 100644 index b6fa7d1..0000000 --- a/docs/.vitepress/config.ts +++ /dev/null @@ -1,47 +0,0 @@ -export default { - title: 'vue3-chessboard', - appearance: 'dark', - description: 'A Vue 3 Chessboard component library.', - themeConfig: { - sidebar: [ - { - text: 'Getting started', - items: [{ text: 'Quick Start', link: '/getting-started' }], - }, - { - text: 'Configuration', - items: [ - { text: 'Props', link: '/props' }, - { text: 'Callbacks', link: '/callbacks' }, - ], - }, - { - text: 'Events', - items: [ - { text: 'Available Events', link: '/events' }, - { text: 'Board Created', link: '/events/board-created' }, - { text: 'Checkmate', link: '/events/checkmate' }, - { text: 'Stalemate', link: '/events/stalemate' }, - { text: 'Draw', link: '/events/draw' }, - { text: 'Check', link: '/events/check' }, - { text: 'Move', link: '/events/move' }, - { text: 'Promotion', link: '/events/promotion' }, - ], - }, - { - text: 'Board API', - items: [{ text: 'API', link: '/board-api' }], - }, - { - text: 'Contribute', - items: [ - { text: 'Issues', link: '/issues' }, - { text: 'Contribute', link: '/contribute.md' }, - ], - }, - ], - socialLinks: [ - { icon: 'github', link: 'https://github.com/qwerty084/vue3-chessboard' }, - ], - }, -}; diff --git a/docs/.vitepress/index.css b/docs/.vitepress/index.css deleted file mode 100644 index f511fbc..0000000 --- a/docs/.vitepress/index.css +++ /dev/null @@ -1,91 +0,0 @@ -html { - overflow-y: scroll; -} - -.flex { - display: flex; - align-items: center; - gap: 2%; - margin-bottom: 0.5rem; - margin-left: 1rem; -} - -.w-6 { - width: 24px; -} - -.h-6 { - width: 24px; -} - -.chessboard .main-wrap { - width: 99%; - max-width: 600px; -} - -.chessboard .buttons { - margin-bottom: 10px; -} - -coords.files { - bottom: 5px !important; -} - -.move-container { - min-height: 250px; -} - -h1 { - font-size: 48px !important; - background: -webkit-linear-gradient(315deg, #42d392 25%, #647eff); - background-clip: text; - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; -} - -.chessboard { - margin-top: 2rem; -} - -.svg-container { - margin-top: 3rem; - display: flex; - justify-content: center; - align-items: center; - gap: 10%; -} - -.svg-container img { - max-width: 36px; - height: auto; -} - -.svg-container .npm-svg { - max-width: 60px; -} - -.version-number { - text-align: center; - margin-top: 2rem; -} - -.promotion-container { - background-position: center; - background-repeat: no-repeat; -} - -.buttons { - padding: 5px; - text-align: center; -} - -.buttons .activated { - background-color: #888; -} - -.buttons button { - background-color: #555; - border-radius: 5px; - margin: 5px; - padding: 5px; -} diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts deleted file mode 100644 index 94152b7..0000000 --- a/docs/.vitepress/theme/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import DefaultTheme from 'vitepress/theme'; -import '../index.css'; -import '../../../dist/style.css'; - -export default DefaultTheme; diff --git a/docs/ChessboardExample.vue b/docs/ChessboardExample.vue deleted file mode 100644 index 30a51ce..0000000 --- a/docs/ChessboardExample.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - - diff --git a/docs/HistoryViewerExample.vue b/docs/HistoryViewerExample.vue deleted file mode 100644 index a76bc08..0000000 --- a/docs/HistoryViewerExample.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - - - diff --git a/docs/board-api.md b/docs/board-api.md deleted file mode 100644 index 514c836..0000000 --- a/docs/board-api.md +++ /dev/null @@ -1,330 +0,0 @@ - - -# Board API - -The `boardApi` can be used to modify and retrieve information from the board. -You can access the api when listening for the @board-created event. - -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: -
- -
-
-Here is a list of all the available methods: - -```ts -/** - * Resets the board to the initial starting configuration. - */ -resetBoard(): void; - -/** - * undo last move, if possible - */ -undoLastMove(): void; - -/** - * returns the current material count for white, black and the diff. - * If diff > 0 white is leading, else black. - */ -getMaterialCount(): MaterialDifference; - -/** - * Finds all the captured pieces from the game history. - * - * Note: results may be innaccurate if game history has been lost, eg. if - * setPosition has been called. - * - * @returns an object with white and black properties whose values are arrays - * of all the pieces captured by that player this game. - */ -getCapturedPieces(): CapturedPieces; - -/** - * toggles the board orientation. - */ -toggleOrientation(): void; - -/** - * draws arrows and circles on the board for possible moves/captures - */ -drawMoves(): void; - -/** - * removes arrows and circles from the board for possible moves/captures - */ -hideMoves(): void; - -/** - * draws an arrow on the board - */ -drawMove(orig: Square, dest: Square, brushColor: BrushColor): void; - -/** - * toggle drawing of arrows and circles on the board for possible moves/captures - */ -toggleMoves(): void; - -/** - * returns the opening name for the current position from lichess api - */ -getOpeningName(): Promise; - -/** - * make a move programmatically on the board - * @param move either a string in Standard Algebraic Notation (SAN), eg. 'e4', 'exd5', 'O-O', 'Nf3' or 'e8=Q' - * or an object of shape { from: string; to: string; promotion?: string; }, eg. { from: 'g8', to: 'f6' } or - * { from: 'e7', to: 'e8', promotion: 'q'} - * @returns true if the move was made, false if the move was illegal - */ -move(move: string | { from: Key; to: Key; promotion?: Promotion; }): boolean; - -/** - * returns the current turn color - * @returns 'white' or 'black' - */ -getTurnColor(): Color; - -/** - * returns all possible moves for the current position - * - */ -getPossibleMoves(): Map | undefined; - -/** - * - * @returns the current turn number - * @example e4 e5 -> turn number is 2 now - */ -getCurrentTurnNumber(): number; - -/** - * - * @returns the current ply number - * @example e4 e5 Nf3 -> ply number is 3 - */ -getCurrentPlyNumber(): number; - -/** - * returns the latest move made on the board - */ -getLastMove(): MoveEvent | undefined; - -/** - * Retrieves the move history. - * - * @param verbose - passing true will add more info - * @example Verbose: [{"color": "w", "from": "e2", "to": "e4", "flags": "b", "piece": "p", "san": "e4"}], without verbose flag: [ "e7", "e5" ] - */ -getHistory(verbose?: boolean): MoveEvent[] | string[]; - -/** - * Returns the FEN string for the current position. - */ -getFen(): string; - -/** - * Returns the board position as a 2D array. - */ -getBoardPosition(): ({ - type: PieceType; - color: PieceColor; - square: Square; -} | null)[][]; - -/** - * returns the PGN string for the current position. - */ -getPgn(): string; - -/** - * returns true of false depending on if the game is over - */ -getIsGameOver(): boolean; - -/** - * returns true or false depending on if a player is checkmated - */ -getIsCheckmate(): boolean; - -/** - * returns true or false depending on if a player is in check - */ -getIsCheck(): boolean; - -/** - * returns true or false depending on if a player is in stalemate - */ -getIsStalemate(): boolean; - -/** - * returns true or false depending on if a game is drawn - */ -getIsDraw(): boolean; - -/** - * returns true or false depending on if a game is drawn by threefold repetition - */ -getIsThreefoldRepetition(): boolean; - -/** - * returns true or false depending on if a game is drawn by insufficient material - */ -getIsInsufficientMaterial(): boolean; - -/** - * returns the color of a given square - */ -getSquareColor(square: Square): SquareColor; - -/** - * Returns the piece on the square or null if there is no piece - */ -getSquare(square: Square): Piece | null; - -/** - * loads a fen into the board - * Caution: this will erase the game history. To set position with history call loadPgn with a pgn instead - */ -setPosition(fen: string): void; - -/** - * puts a piece on a given square on the board - * returns true on success, else false - */ -putPiece(piece: Piece, square: Square): boolean; - -/** - * removes all pieces from the board - */ -clearBoard(): void; - -/** - * draw multiple arrows on the board - */ -setShapes(shapes: DrawShape[]): void; - -/** - * loads a pgn into the board - * - * @param pgn - the pgn to load - */ -loadPgn(pgn: string): void; - -/** - * returns the header information of the current pgn, if no pgn is loaded, returns an empty object - * @example { - * "Event": "IBM Kasparov vs. Deep Blue Rematch", - * "Site": "New York, NY USA", - * "Date": "1997.05.11", - * "Round": "6", - * "White": "Deep Blue", - * "Black": "Kasparov, Garry", - * "Opening": "Caro-Kann: 4...Nd7", - * "ECO": "B17", - * "Result": "1-0" - * } - */ -getPgnInfo(): { - [key: string]: string | undefined; -}; - -/** - * Sets the config of the board. - * Caution: providing a config with a fen will erase the game history and change the starting position - * for resetBoard. To keep history and starting position: omit fen from the given config and call - * loadPgn with a pgn instead. - * - * @param config - a subset of config options, eg. `{ viewOnly: true, animation: { enabled: false } }` - * or `{ movable: { events: { after: afterFunc }, showDests: false }, drawable: { enabled: false } }` - * @param fillDefaults - if true unprovided config options will be substituted with default values, if - * false the unprovided options will remain unchanged. - */ -setConfig(config: BoardConfig, fillDefaults = false): void; - -/** - * Views the position at the given ply number in the game's history. - * - * @param ply - the ply number of the position to be viewed, where 0 is the initial position, 1 is - * after white's first move, 2 is after black's first move and so on. - */ -viewHistory(ply: number): void; - -/** - * Stops viewing history and returns the board to the present position, ie. after the latest move. - */ -stopViewingHistory(): void; - -/** - * Views the starting position of this game. - */ -viewStart(): void; - -/** - * If viewing history, views the move after the one currently being viewed. - * If that move is the latest move, stops viewing history. - */ -viewNext(): void; - -/** - * If viewing history, views the previous move to the one currently being viewed. - * Else, starts viewing history and views the move previous to the latest move. - */ -viewPrevious(): void; - -``` - -## Example Board API Usage - - - -## Example Game History Viewer Usage - - - -When viewing game history, the `viewingHistory` class is applied to the `main-wrap` element. This allows custom styles to be applied to the board only when viewing the history (by default, the board is desaturated). diff --git a/docs/callbacks.md b/docs/callbacks.md deleted file mode 100644 index b3be603..0000000 --- a/docs/callbacks.md +++ /dev/null @@ -1,130 +0,0 @@ - - -# Callbacks - -## Registering - -You can register custom callback functions on the board through the config object. -Like other config property, this is optional. - -::: warning -The move callback is being executed before the internal board state is updated. Accessing the boardApi can lead to unexpected results. -Use the `move` event provided by the board component to access the API. -::: - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -## Example - -

Change Counter: {{ changeCounter }}

-

Latest Move: {{lastMove }}

-

Square {{ square }} has been selected

-

No square has been selected yet

- -
- -
- -
- -There are two more methods, which aren't listed above: - -- insert -- dropNewPiece - -The insert method is fired when a new chessboard is mounted. -You probably will not need this. - -dropNewPiece is fired when a new piece is inserted. This feature isnt used currently. diff --git a/docs/contribute.md b/docs/contribute.md deleted file mode 100644 index 516d015..0000000 --- a/docs/contribute.md +++ /dev/null @@ -1,71 +0,0 @@ -# Contributing - -Contributions are very welcome. Thanks for your interest! - -## Setup the project - -::: code-group - -```sh[HTTPS] -git clone https://github.com/qwerty084/vue3-chessboard.git -``` - -```sh[SSH] -git clone git@github.com:qwerty084/vue3-chessboard.git -``` - -```sh[GitHub CLI] -gh repo clone qwerty084/vue3-chessboard -``` - -::: - -Install the required dependencies: - -```sh -npm install -``` - -Start the dev server: - -```sh -npm run dev -``` - -Now you can start developing 🚀 - -## Creating a Pull Request - -After adding your feature/bugfix please run the following scripts. - -Format your changes - -```sh -npm run format -``` - -Type check your chages - -```sh -npm run type-check -``` - -Lint your changes - -```sh -npm run lint -``` - -Test your changes - -```sh -npm run test -``` - -Then create a branch with a fitting name, commit and push your changes. - - diff --git a/docs/events.md b/docs/events.md deleted file mode 100644 index 3100ed4..0000000 --- a/docs/events.md +++ /dev/null @@ -1,449 +0,0 @@ - - -# Available Events - -## Events - -- `boardCreated` - emitted when the board is created and the boardAPI is available -- `checkmate` - emitted when one player is mated -- `stalemate` - emitted when the game ends in stalemate -- `draw` - emitted when the game ends in a draw -- `check` - emitted when one player is in check -- `promotion` - emitted when a pawn is promoted -- `move` - emitted when a move is made - -Here you can see the vue.js defineEmits: - -```ts -const emit = defineEmits<{ - (e: 'boardCreated', boardApi: BoardApi): void; // emits boardAPI - (e: 'checkmate', isMated: PieceColor): void; // emits the color of the mated player - (e: 'stalemate'): void; // just emits stalemate, the value is not interesting - (e: 'draw'): void; // same for draw - (e: 'check', isInCheck: PieceColor): void; // emits color who is in check - (e: 'promotion', promotion: PromotionEvent): void; // emits information about the promotion - (e: 'move', move: MoveEvent): void; // emits information about the move -}>(); -``` - -## Listening for Events - -In the following examples you will see an alert when an event was emitted.
-Hit the play button, to see the events in action. - -## Check - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -
- - - - - - - - -
- -
- -
- -## Move - -You can listen of moves on the board and get information about the move - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -
- -
-
-

Emitted values:

-
{{ move }}
-
- -## Checkmate - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -
- - - - - - - - -
- -
- -
- -## Promotion - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -
- - - - - - - - -
- -

Promotion: {{ promotionData ?? '' }}

- -
- -
- -## Stalemate - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -
- - - - - - - - -
- -

Alfonso Romero Holmes vs Boris Kantsler (2002)

- -
- -
- -## Draw - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -
- - - - - - - - -
- -

Magnus Carlsen vs Viswanathan Anand (World Championship Match 2014)

- -
- -
diff --git a/docs/events/board-created.md b/docs/events/board-created.md deleted file mode 100644 index ce6111b..0000000 --- a/docs/events/board-created.md +++ /dev/null @@ -1,60 +0,0 @@ -# Board Created - -
- -When the board component is mounted the board-created event is being emitted. -In this event the `boardAPI` is included, which you can use to modify and extract data from the board through it's methods. - -## Definition - -```ts -defineEmits<{ - (e: 'board-created', boardApi: BoardApi): void; -}>(); -``` - -

Full reference of all methods: Board API Docs | Source Code

- -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/events/board-events.md b/docs/events/board-events.md deleted file mode 100644 index 76b43e4..0000000 --- a/docs/events/board-events.md +++ /dev/null @@ -1,62 +0,0 @@ -# Available Events - -
- -- boardCreated (emitted when the board is created) -- checkmate (Emitted when one player is mated) -- stalemate (emitted when the game ends in stalemate) -- draw (emitted when the game is drawn) -- check (emitted when one player is in check) -- promotion (emitted when a promotion occured) -- move (emitted after each move) - -
-Here you can see the vue.js defineEmits: - -```ts -const emit = defineEmits<{ - (e: 'board-created', boardApi: BoardApi): void; // emits boardAPI - (e: 'checkmate', isMated: PieceColor): void; // emits the color of the mated player - (e: 'stalemate', isStalemate: boolean): void; // just emits stalemate, the value is not interesting - (e: 'draw', isDraw: boolean): void; // same for draw - (e: 'check', isInCheck: PieceColor): void; // emits color who is in check - (e: 'promotion', promotion: PromotionEvent): void; // emits information about the promotion - (e: 'move', move: MoveEvent): void; // emits information about the move -}>(); -``` - -## Draw - -::: code-group - -```vue [TypeScript] - - - -``` - -```vue [JavaScript] - - - -``` - -::: diff --git a/docs/events/check.md b/docs/events/check.md deleted file mode 100644 index b53b995..0000000 --- a/docs/events/check.md +++ /dev/null @@ -1,51 +0,0 @@ -# Check - -
- -Emitted when a player is in check. In the event the color of the player who is in check is included. - -## Definition - -```ts -defineEmits<{ - (e: 'check', isInCheck: PieceColor): void; -}>(); - -export type PieceColor = 'white' | 'black'; -``` - -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/events/checkmate.md b/docs/events/checkmate.md deleted file mode 100644 index 3a5ec45..0000000 --- a/docs/events/checkmate.md +++ /dev/null @@ -1,51 +0,0 @@ -# Checkmate - -
- -Emitted when a player is checkmated. In the event the color of the player who got checkmated is included. - -## Definition - -```ts -defineEmits<{ - (e: 'checkmate', isMated: PieceColor): void; -}>(); - -export type PieceColor = 'white' | 'black'; -``` - -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/events/draw.md b/docs/events/draw.md deleted file mode 100644 index ee94b6e..0000000 --- a/docs/events/draw.md +++ /dev/null @@ -1,49 +0,0 @@ -# Draw - -
- -Emitted when the game ends in a draw. - -## Definition - -```ts -defineEmits<{ - (e: 'draw'): void; -}>(); -``` - -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/events/move.md b/docs/events/move.md deleted file mode 100644 index 8c0337b..0000000 --- a/docs/events/move.md +++ /dev/null @@ -1,63 +0,0 @@ -# Move - -
- -This event is emitted after every move on the board. - -## Definition - -```ts -defineEmits<{ - (e: 'move', move: MoveEvent): void; -}>(); - -type MoveEvent = { - color: Color; - from: Square; - to: Square; - piece: PieceSymbol; - captured?: PieceSymbol; - promotion?: PieceSymbol; - flags: string; - san: string; - lan: string; - before: string; - after: string; -}; -``` - -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/events/promotion.md b/docs/events/promotion.md deleted file mode 100644 index f9beb23..0000000 --- a/docs/events/promotion.md +++ /dev/null @@ -1,55 +0,0 @@ -# Promotion - -
- -Emitted when a promotion occurs. - -## Definition - -```ts -defineEmits<{ - (e: 'promotion', promotion: PromotionEvent): void; -}>(); - -export interface PromotionEvent { - color: 'white' | 'black'; - sanMove: string; - promotedTo: 'Q' | 'B' | 'R' | 'N'; -} -``` - -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/events/stalemate.md b/docs/events/stalemate.md deleted file mode 100644 index c1da771..0000000 --- a/docs/events/stalemate.md +++ /dev/null @@ -1,49 +0,0 @@ -# Stalemate - -
- -Emitted when the game ends in stalemate. - -## Definition - -```ts -defineEmits<{ - (e: 'stalemate'): void; -}>(); -``` - -## Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/getting-started.md b/docs/getting-started.md deleted file mode 100644 index f16bb5e..0000000 --- a/docs/getting-started.md +++ /dev/null @@ -1,52 +0,0 @@ -# Quick start - -## About - -vue3-chessboard is a component library for vue 3 written in TypeScript, using the lichess chessground and chess.js for the board logic. -
- -## Installation - -::: code-group - -```bash [npm] -npm install vue3-chessboard -``` - -```bash [yarn] -yarn add vue3-chessboard -``` - -```bash [pnpm] -pnpm install vue3-chessboard -``` - -::: - -## Basic Example - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 3a168c2..0000000 --- a/docs/index.md +++ /dev/null @@ -1,88 +0,0 @@ - - -# vue3-chessboard - -## A vue.js component library - -
-
- - - - -
- -
- - - -

{{ versionNumber }}

diff --git a/docs/issues.md b/docs/issues.md deleted file mode 100644 index 5a4031e..0000000 --- a/docs/issues.md +++ /dev/null @@ -1,9 +0,0 @@ -# Issues - -## Report an issue - -I you have found a bug please open an issue on [GitHub](https://github.com/qwerty084/vue3-chessboard/issues) - -Or contact my via email: [github@lucahelms.dev](mailto:github@lucahelms.dev) - -If you want to fix the bug yourself, contributions are very welcome! diff --git a/docs/props.md b/docs/props.md deleted file mode 100644 index e40557c..0000000 --- a/docs/props.md +++ /dev/null @@ -1,349 +0,0 @@ - - -# Props - -Available props: - -- `board-config` - an object to configure the board -- `player-color` - the color of the player who is allowed to move -- `reactive-config` - boolean value, whether the board config should be reactive or not - -## `board-config`: Configure the chessboard - -To edit the chessboard you can pass a configuration object to the component. -Here are all the available options with their default values. -Just update the values the values you want to overwrite. - -```js -{ - fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', // the position to start from as a string - orientation: 'white', // the orientation of the board - turnColor: 'white', // the color which starts the game - coordinates: true, // enable or disable board coordinates - autoCastle: true, // simplify castling move - viewOnly: false, // allow or disallow moves on the board - disableContextMenu: false, // enable/ disable the context menu - addPieceZIndex: false, - blockTouchScroll: false, - highlight: { - lastMove: true, // highlight the last move on the board - check: true, // highlight king in check - }, - animation: { // modify piece animations - enabled: true, - duration: 200, - }, - lastMove: undefined, // this should not be modified - movable: { - free: false, // set to true any move is allowed, if false only legal moves - color: 'white', - showDests: true, - dests: possibleMovesWhite, - events: {}, - rookCastle: true, - }, - premovable: { - enabled: true, - showDests: true, - castle: true, - events: {}, - }, - predroppable: { - enabled: false, - events: {}, - }, - draggable: { - enabled: true, - distance: 3, - autoDistance: true, - showGhost: true, - deleteOnDropOff: false, - }, - selectable: { - enabled: true, - }, - events: {}, - drawable: { - enabled: true, - visible: true, - defaultSnapToValidMove: true, - eraseOnClick: true, - shapes: [], - autoShapes: [], - brushes: { - green: { key: 'g', color: '#15781B', opacity: 1, lineWidth: 10 }, - red: { key: 'r', color: '#882020', opacity: 1, lineWidth: 10 }, - blue: { key: 'b', color: '#003088', opacity: 1, lineWidth: 10 }, - yellow: { key: 'y', color: '#e68f00', opacity: 1, lineWidth: 10 }, - paleBlue: { key: 'pb', color: '#003088', opacity: 0.4, lineWidth: 15 }, - paleGreen: { key: 'pg', color: '#15781B', opacity: 0.4, lineWidth: 15 }, - paleRed: { key: 'pr', color: '#882020', opacity: 0.4, lineWidth: 15 }, - paleGrey: { - key: 'pgr', - color: '#4a4a4a', - opacity: 0.35, - lineWidth: 15, - }, - }, - }, -}; -``` - -## Passing the config object to the board - -If you dont pass a config object, the default config shown above will be used. -It's not required to set all properties. Your object will be merged with the default config. - -### Example setting the config object - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -The board should then look like this: - -
- -
- - - -## `player-color`: Configure the board for multiplayer - -The board can accept a _player-color_ prop to denote the color that the corresponding client should be allowed to play. Moves from a players opponent can be applied to the board with the `BoardApi`'s `move` method - the turns will switch once the `move` method is called with a valid fen string. If no value is provided, turns will switch locally. - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -## `reactive-config`: Using a reactive config object - -The `TheChessboard` component can accept a `reactive-config` prop to allow the `board-config` prop to be reactive to changes. Any mutations of the `board-config` prop will propagate to changes of the board config. This works with nested properties in a non-destructive way, i.e. setting `boardConfig.draggable = { distance: 10, showGhost: false }` won't affect the other properties of `draggable` on the actual board config, such as `draggable.enabled`. However, it will change the "default state" of the board so that if `boardAPI.resetBoard()` is called the current state of the `board-config` prop is considered to be the provided config, as if it was passed at the time of instantiation of the `TheChessboard` component. - -Note that prop mutation is a _one-way flow of data_, so the state of the `board-config` prop won't necessarily reflect the state of the actual board config. For example, as the game progresses the `fen` property of the `board-config` prop **will not** update. -Use the `boardAPI` to retrieve values. - -See the following example for how one might make use of this feature: - -::: code-group - -```vue [JavaScript] - - - -``` - -```vue [TypeScript] - - - -``` - -::: - -The board should then look like this: - -
- -
- - - - -
-
diff --git a/docs/public/github-mark-white.svg b/docs/public/github-mark-white.svg deleted file mode 100644 index d5e6491..0000000 --- a/docs/public/github-mark-white.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/public/github-mark.svg b/docs/public/github-mark.svg deleted file mode 100644 index 37fa923..0000000 --- a/docs/public/github-mark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/public/npm.svg b/docs/public/npm.svg deleted file mode 100644 index b0f6397..0000000 --- a/docs/public/npm.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/index.html b/index.html index 11603f8..f5f4aa3 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite App + vue3-chessboard
diff --git a/package-lock.json b/package-lock.json index 52b2ee2..b1469d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-typescript": "^11.0.0", "@vue/test-utils": "^2.1.0", - "@vue/theme": "^2.2.1", "@vue/tsconfig": "^0.1.3", "eslint": "^8.34.0", "eslint-plugin-vue": "^9.9.0", @@ -30,7 +29,6 @@ "prettier": "^2.8.3", "typescript": "^5.0.2", "vite": "^4.0.4", - "vitepress": "^1.0.0-alpha.40", "vitest": "^0.29.1", "vue-tsc": "^1.1.3" }, @@ -38,163 +36,6 @@ "vue": "^3.2.47" } }, - "node_modules/@algolia/autocomplete-core": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.8.2.tgz", - "integrity": "sha512-mTeshsyFhAqw/ebqNsQpMtbnjr+qVOSKXArEj4K0d7sqc8It1XD0gkASwecm9mF/jlOQ4Z9RNg1HbdA8JPdRwQ==", - "dev": true, - "dependencies": { - "@algolia/autocomplete-shared": "1.8.2" - } - }, - "node_modules/@algolia/autocomplete-preset-algolia": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.8.2.tgz", - "integrity": "sha512-J0oTx4me6ZM9kIKPuL3lyU3aB8DEvpVvR6xWmHVROx5rOYJGQcZsdG4ozxwcOyiiu3qxMkIbzntnV1S1VWD8yA==", - "dev": true, - "dependencies": { - "@algolia/autocomplete-shared": "1.8.2" - }, - "peerDependencies": { - "@algolia/client-search": ">= 4.9.1 < 6", - "algoliasearch": ">= 4.9.1 < 6" - } - }, - "node_modules/@algolia/autocomplete-shared": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.8.2.tgz", - "integrity": "sha512-b6Z/X4MczChMcfhk6kfRmBzPgjoPzuS9KGR4AFsiLulLNRAAqhP+xZTKtMnZGhLuc61I20d5WqlId02AZvcO6g==", - "dev": true - }, - "node_modules/@algolia/cache-browser-local-storage": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.17.0.tgz", - "integrity": "sha512-myRSRZDIMYB8uCkO+lb40YKiYHi0fjpWRtJpR/dgkaiBlSD0plRyB6lLOh1XIfmMcSeBOqDE7y9m8xZMrXYfyQ==", - "dev": true, - "dependencies": { - "@algolia/cache-common": "4.17.0" - } - }, - "node_modules/@algolia/cache-common": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.17.0.tgz", - "integrity": "sha512-g8mXzkrcUBIPZaulAuqE7xyHhLAYAcF2xSch7d9dABheybaU3U91LjBX6eJTEB7XVhEsgK4Smi27vWtAJRhIKQ==", - "dev": true - }, - "node_modules/@algolia/cache-in-memory": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.17.0.tgz", - "integrity": "sha512-PT32ciC/xI8z919d0oknWVu3kMfTlhQn3MKxDln3pkn+yA7F7xrxSALysxquv+MhFfNAcrtQ/oVvQVBAQSHtdw==", - "dev": true, - "dependencies": { - "@algolia/cache-common": "4.17.0" - } - }, - "node_modules/@algolia/client-account": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.17.0.tgz", - "integrity": "sha512-sSEHx9GA6m7wrlsSMNBGfyzlIfDT2fkz2u7jqfCCd6JEEwmxt8emGmxAU/0qBfbhRSuGvzojoLJlr83BSZAKjA==", - "dev": true, - "dependencies": { - "@algolia/client-common": "4.17.0", - "@algolia/client-search": "4.17.0", - "@algolia/transporter": "4.17.0" - } - }, - "node_modules/@algolia/client-analytics": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.17.0.tgz", - "integrity": "sha512-84ooP8QA3mQ958hQ9wozk7hFUbAO+81CX1CjAuerxBqjKIInh1fOhXKTaku05O/GHBvcfExpPLIQuSuLYziBXQ==", - "dev": true, - "dependencies": { - "@algolia/client-common": "4.17.0", - "@algolia/client-search": "4.17.0", - "@algolia/requester-common": "4.17.0", - "@algolia/transporter": "4.17.0" - } - }, - "node_modules/@algolia/client-common": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.17.0.tgz", - "integrity": "sha512-jHMks0ZFicf8nRDn6ma8DNNsdwGgP/NKiAAL9z6rS7CymJ7L0+QqTJl3rYxRW7TmBhsUH40wqzmrG6aMIN/DrQ==", - "dev": true, - "dependencies": { - "@algolia/requester-common": "4.17.0", - "@algolia/transporter": "4.17.0" - } - }, - "node_modules/@algolia/client-personalization": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-4.17.0.tgz", - "integrity": "sha512-RMzN4dZLIta1YuwT7QC9o+OeGz2cU6eTOlGNE/6RcUBLOU3l9tkCOdln5dPE2jp8GZXPl2yk54b2nSs1+pAjqw==", - "dev": true, - "dependencies": { - "@algolia/client-common": "4.17.0", - "@algolia/requester-common": "4.17.0", - "@algolia/transporter": "4.17.0" - } - }, - "node_modules/@algolia/client-search": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.17.0.tgz", - "integrity": "sha512-x4P2wKrrRIXszT8gb7eWsMHNNHAJs0wE7/uqbufm4tZenAp+hwU/hq5KVsY50v+PfwM0LcDwwn/1DroujsTFoA==", - "dev": true, - "dependencies": { - "@algolia/client-common": "4.17.0", - "@algolia/requester-common": "4.17.0", - "@algolia/transporter": "4.17.0" - } - }, - "node_modules/@algolia/logger-common": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.17.0.tgz", - "integrity": "sha512-DGuoZqpTmIKJFDeyAJ7M8E/LOenIjWiOsg1XJ1OqAU/eofp49JfqXxbfgctlVZVmDABIyOz8LqEoJ6ZP4DTyvw==", - "dev": true - }, - "node_modules/@algolia/logger-console": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.17.0.tgz", - "integrity": "sha512-zMPvugQV/gbXUvWBCzihw6m7oxIKp48w37QBIUu/XqQQfxhjoOE9xyfJr1KldUt5FrYOKZJVsJaEjTsu+bIgQg==", - "dev": true, - "dependencies": { - "@algolia/logger-common": "4.17.0" - } - }, - "node_modules/@algolia/requester-browser-xhr": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.17.0.tgz", - "integrity": "sha512-aSOX/smauyTkP21Pf52pJ1O2LmNFJ5iHRIzEeTh0mwBeADO4GdG94cAWDILFA9rNblq/nK3EDh3+UyHHjplZ1A==", - "dev": true, - "dependencies": { - "@algolia/requester-common": "4.17.0" - } - }, - "node_modules/@algolia/requester-common": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.17.0.tgz", - "integrity": "sha512-XJjmWFEUlHu0ijvcHBoixuXfEoiRUdyzQM6YwTuB8usJNIgShua8ouFlRWF8iCeag0vZZiUm4S2WCVBPkdxFgg==", - "dev": true - }, - "node_modules/@algolia/requester-node-http": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.17.0.tgz", - "integrity": "sha512-bpb/wDA1aC6WxxM8v7TsFspB7yBN3nqCGs2H1OADolQR/hiAIjAxusbuMxVbRFOdaUvAIqioIIkWvZdpYNIn8w==", - "dev": true, - "dependencies": { - "@algolia/requester-common": "4.17.0" - } - }, - "node_modules/@algolia/transporter": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.17.0.tgz", - "integrity": "sha512-6xL6H6fe+Fi0AEP3ziSgC+G04RK37iRb4uUUqVAH9WPYFI8g+LYFq6iv5HS8Cbuc5TTut+Bwj6G+dh/asdb9uA==", - "dev": true, - "dependencies": { - "@algolia/cache-common": "4.17.0", - "@algolia/logger-common": "4.17.0", - "@algolia/requester-common": "4.17.0" - } - }, "node_modules/@babel/parser": { "version": "7.21.8", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.8.tgz", @@ -206,50 +47,6 @@ "node": ">=6.0.0" } }, - "node_modules/@docsearch/css": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.3.4.tgz", - "integrity": "sha512-vDwCDoVXDgopw/hvr0zEADew2wWaGP8Qq0Bxhgii1Ewz2t4fQeyJwIRN/mWADeLFYPVkpz8TpEbxya/i6Tm0WA==", - "dev": true - }, - "node_modules/@docsearch/js": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.3.4.tgz", - "integrity": "sha512-Xd2saBziXJ1UuVpcDz94zAFEFAM6ap993agh0za2e3LDZLhaW993b1f9gyUL4e1CZLsR076tztG2un2gVncvpA==", - "dev": true, - "dependencies": { - "@docsearch/react": "3.3.4", - "preact": "^10.0.0" - } - }, - "node_modules/@docsearch/react": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.3.4.tgz", - "integrity": "sha512-aeOf1WC5zMzBEi2SI6WWznOmIo9rnpN4p7a3zHXxowVciqlI4HsZGtOR9nFOufLeolv7HibwLlaM0oyUqJxasw==", - "dev": true, - "dependencies": { - "@algolia/autocomplete-core": "1.8.2", - "@algolia/autocomplete-preset-algolia": "1.8.2", - "@docsearch/css": "3.3.4", - "algoliasearch": "^4.0.0" - }, - "peerDependencies": { - "@types/react": ">= 16.8.0 < 19.0.0", - "react": ">= 16.8.0 < 19.0.0", - "react-dom": ">= 16.8.0 < 19.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, "node_modules/@esbuild/linux-x64": { "version": "0.17.19", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", @@ -466,12 +263,6 @@ "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", "dev": true }, - "node_modules/@types/web-bluetooth": { - "version": "0.0.16", - "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz", - "integrity": "sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==", - "dev": true - }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "5.59.5", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz", @@ -873,12 +664,6 @@ "@vue/shared": "3.3.2" } }, - "node_modules/@vue/devtools-api": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz", - "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==", - "dev": true - }, "node_modules/@vue/eslint-config-prettier": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-7.1.0.tgz", @@ -941,6 +726,7 @@ "version": "3.3.2", "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.3.2.tgz", "integrity": "sha512-qSl95qj0BvKfcsO+hICqFEoLhJn6++HtsPxmTkkadFbuhe3uQfJ8HmQwvEr7xbxBd2rcJB6XOJg7nWAn/ymC5A==", + "peer": true, "dependencies": { "@vue/reactivity": "3.3.2", "@vue/shared": "3.3.2" @@ -950,6 +736,7 @@ "version": "3.3.2", "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.3.2.tgz", "integrity": "sha512-+drStsJT+0mtgHdarT7cXZReCcTFfm6ptxMrz0kAW5hms6UNBd8Q1pi4JKlncAhu+Ld/TevsSp7pqAZxBBoGng==", + "peer": true, "dependencies": { "@vue/runtime-core": "3.3.2", "@vue/shared": "3.3.2", @@ -991,22 +778,6 @@ "vue": "^3.0.1" } }, - "node_modules/@vue/theme": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@vue/theme/-/theme-2.2.1.tgz", - "integrity": "sha512-/7xL/lRmVTUo1DywzhKgAsXuqzkTgBHcXfVvr6SWSVTDlZoEPrlV1owzj4DI7eBUs+vEcZSY1yv3GIennRfYYA==", - "dev": true, - "dependencies": { - "@docsearch/css": "^3.2.1", - "@docsearch/js": "^3.2.1", - "@vueuse/core": "^9.1.1", - "body-scroll-lock": "^3.1.5", - "normalize.css": "^8.0.1" - }, - "peerDependencies": { - "vitepress": "^1.0.0-alpha.60" - } - }, "node_modules/@vue/tsconfig": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@vue/tsconfig/-/tsconfig-0.1.3.tgz", @@ -1021,94 +792,6 @@ } } }, - "node_modules/@vueuse/core": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-9.13.0.tgz", - "integrity": "sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==", - "dev": true, - "dependencies": { - "@types/web-bluetooth": "^0.0.16", - "@vueuse/metadata": "9.13.0", - "@vueuse/shared": "9.13.0", - "vue-demi": "*" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/@vueuse/core/node_modules/vue-demi": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.1.tgz", - "integrity": "sha512-rt+yuCtXvscYot9SQQj3WKZJVSriPNqVkpVBNEHPzSgBv7QIYzsS410VqVgvx8f9AAPgjg+XPKvmV3vOqqkJQQ==", - "dev": true, - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, - "node_modules/@vueuse/metadata": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-9.13.0.tgz", - "integrity": "sha512-gdU7TKNAUVlXXLbaF+ZCfte8BjRJQWPCa2J55+7/h+yDtzw3vOoGQDRXzI6pyKyo6bXFT5/QoPE4hAknExjRLQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/@vueuse/shared": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-9.13.0.tgz", - "integrity": "sha512-UrnhU+Cnufu4S6JLCPZnkWh0WwZGUp72ktOF2DFptMlOs3TOdVv8xJN53zhHGARmVOsz5KqOls09+J1NR6sBKw==", - "dev": true, - "dependencies": { - "vue-demi": "*" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/@vueuse/shared/node_modules/vue-demi": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.1.tgz", - "integrity": "sha512-rt+yuCtXvscYot9SQQj3WKZJVSriPNqVkpVBNEHPzSgBv7QIYzsS410VqVgvx8f9AAPgjg+XPKvmV3vOqqkJQQ==", - "dev": true, - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -1189,28 +872,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/algoliasearch": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.17.0.tgz", - "integrity": "sha512-JMRh2Mw6sEnVMiz6+APsi7lx9a2jiDFF+WUtANaUVCv6uSU9UOLdo5h9K3pdP6frRRybaM2fX8b1u0nqICS9aA==", - "dev": true, - "dependencies": { - "@algolia/cache-browser-local-storage": "4.17.0", - "@algolia/cache-common": "4.17.0", - "@algolia/cache-in-memory": "4.17.0", - "@algolia/client-account": "4.17.0", - "@algolia/client-analytics": "4.17.0", - "@algolia/client-common": "4.17.0", - "@algolia/client-personalization": "4.17.0", - "@algolia/client-search": "4.17.0", - "@algolia/logger-common": "4.17.0", - "@algolia/logger-console": "4.17.0", - "@algolia/requester-browser-xhr": "4.17.0", - "@algolia/requester-common": "4.17.0", - "@algolia/requester-node-http": "4.17.0", - "@algolia/transporter": "4.17.0" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -1220,12 +881,6 @@ "node": ">=8" } }, - "node_modules/ansi-sequence-parser": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz", - "integrity": "sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==", - "dev": true - }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -1302,12 +957,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "node_modules/body-scroll-lock": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/body-scroll-lock/-/body-scroll-lock-3.1.5.tgz", - "integrity": "sha512-Yi1Xaml0EvNA0OYWxXiYNqY24AfWkbA6w5vxE7GWxtKfzIbZM+Qw+aSmkgsbWzbHiy/RCSkUZBplVxTA+E4jJg==", - "dev": true - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -1532,7 +1181,8 @@ "node_modules/csstype": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", - "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", + "peer": true }, "node_modules/data-urls": { "version": "4.0.0", @@ -3240,12 +2890,6 @@ "node": ">=12" } }, - "node_modules/mark.js": { - "version": "8.11.1", - "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", - "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==", - "dev": true - }, "node_modules/memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", @@ -3310,12 +2954,6 @@ "node": "*" } }, - "node_modules/minisearch": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-6.0.1.tgz", - "integrity": "sha512-Ly1w0nHKnlhAAh6/BF/+9NgzXfoJxaJ8nhopFhQ3NcvFJrFIL+iCg9gw9e9UMBD+XIsp/RyznJ/o5UIe5Kw+kg==", - "dev": true - }, "node_modules/mlly": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.2.1.tgz", @@ -3411,12 +3049,6 @@ "semver": "bin/semver" } }, - "node_modules/normalize.css": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.1.tgz", - "integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==", - "dev": true - }, "node_modules/npm-run-all": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", @@ -3873,16 +3505,6 @@ "node": ">=4" } }, - "node_modules/preact": { - "version": "10.13.2", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.13.2.tgz", - "integrity": "sha512-q44QFLhOhty2Bd0Y46fnYW0gD/cbVM9dUVtNTDKPcdXSMA7jfY+Jpd6rk3GB0lcQss0z5s/6CmVP0Z/hV+g6pw==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/preact" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -4264,18 +3886,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/shiki": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.2.tgz", - "integrity": "sha512-ltSZlSLOuSY0M0Y75KA+ieRaZ0Trf5Wl3gutE7jzLuIcWxLp5i/uEnLoQWNvgKXQ5OMpGkJnVMRLAuzjc0LJ2A==", - "dev": true, - "dependencies": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" - } - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -4867,128 +4477,6 @@ "url": "https://github.com/sponsors/antfu" } }, - "node_modules/vitepress": { - "version": "1.0.0-alpha.75", - "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-alpha.75.tgz", - "integrity": "sha512-twpPZ/6UnDR8X0Nmj767KwKhXlTQQM9V/J1i2BP9ryO29/w4hpxBfEum6nvfpNhJ4H3h+cIhwzAK/e9crZ6HEQ==", - "dev": true, - "dependencies": { - "@docsearch/css": "^3.3.4", - "@docsearch/js": "^3.3.4", - "@vitejs/plugin-vue": "^4.2.1", - "@vue/devtools-api": "^6.5.0", - "@vueuse/core": "^10.1.0", - "body-scroll-lock": "4.0.0-beta.0", - "mark.js": "8.11.1", - "minisearch": "^6.0.1", - "shiki": "^0.14.2", - "vite": "^4.3.3", - "vue": "^3.2.47" - }, - "bin": { - "vitepress": "bin/vitepress.js" - } - }, - "node_modules/vitepress/node_modules/@types/web-bluetooth": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz", - "integrity": "sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==", - "dev": true - }, - "node_modules/vitepress/node_modules/@vueuse/core": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.1.2.tgz", - "integrity": "sha512-roNn8WuerI56A5uiTyF/TEYX0Y+VKlhZAF94unUfdhbDUI+NfwQMn4FUnUscIRUhv3344qvAghopU4bzLPNFlA==", - "dev": true, - "dependencies": { - "@types/web-bluetooth": "^0.0.17", - "@vueuse/metadata": "10.1.2", - "@vueuse/shared": "10.1.2", - "vue-demi": ">=0.14.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/vitepress/node_modules/@vueuse/core/node_modules/vue-demi": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.1.tgz", - "integrity": "sha512-rt+yuCtXvscYot9SQQj3WKZJVSriPNqVkpVBNEHPzSgBv7QIYzsS410VqVgvx8f9AAPgjg+XPKvmV3vOqqkJQQ==", - "dev": true, - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, - "node_modules/vitepress/node_modules/@vueuse/metadata": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.1.2.tgz", - "integrity": "sha512-3mc5BqN9aU2SqBeBuWE7ne4OtXHoHKggNgxZR2K+zIW4YLsy6xoZ4/9vErQs6tvoKDX6QAqm3lvsrv0mczAwIQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/vitepress/node_modules/@vueuse/shared": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.1.2.tgz", - "integrity": "sha512-1uoUTPBlgyscK9v6ScGeVYDDzlPSFXBlxuK7SfrDGyUTBiznb3mNceqhwvZHjtDRELZEN79V5uWPTF1VDV8svA==", - "dev": true, - "dependencies": { - "vue-demi": ">=0.14.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/vitepress/node_modules/@vueuse/shared/node_modules/vue-demi": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.1.tgz", - "integrity": "sha512-rt+yuCtXvscYot9SQQj3WKZJVSriPNqVkpVBNEHPzSgBv7QIYzsS410VqVgvx8f9AAPgjg+XPKvmV3vOqqkJQQ==", - "dev": true, - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, - "node_modules/vitepress/node_modules/body-scroll-lock": { - "version": "4.0.0-beta.0", - "resolved": "https://registry.npmjs.org/body-scroll-lock/-/body-scroll-lock-4.0.0-beta.0.tgz", - "integrity": "sha512-a7tP5+0Mw3YlUJcGAKUqIBkYYGlYxk2fnCasq/FUph1hadxlTRjF+gAcZksxANnaMnALjxEddmSi/H3OR8ugcQ==", - "dev": true - }, "node_modules/vitest": { "version": "0.29.8", "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.29.8.tgz", @@ -5066,22 +4554,11 @@ } } }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dev": true - }, - "node_modules/vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dev": true - }, "node_modules/vue": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/vue/-/vue-3.3.2.tgz", "integrity": "sha512-98hJcAhyDwZoOo2flAQBSPVYG/o0HA9ivIy2ktHshjE+6/q8IMQ+kvDKQzOZTFPxvnNMcGM+zS2A00xeZMA7tA==", + "peer": true, "dependencies": { "@vue/compiler-dom": "3.3.2", "@vue/compiler-sfc": "3.3.2", diff --git a/package.json b/package.json index b66245c..5bcbac7 100644 --- a/package.json +++ b/package.json @@ -45,13 +45,9 @@ "preview": "vite preview", "test": "vitest --environment jsdom --root src/", "build-only": "vite build", - "build-pages": "vite build --config pages.config.ts", "format": "prettier --write src/", "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", - "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --ignore-path .eslintignore", - "docs:dev": "npm run build && vitepress dev docs", - "docs:build": "npm run build && vitepress build docs --base=/vue3-chessboard/", - "docs:preview": "npm run build && vitepress preview docs" + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --ignore-path .eslintignore" }, "dependencies": { "chess.js": "^1.0.0-beta.6", @@ -69,7 +65,6 @@ "@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-typescript": "^11.0.0", "@vue/test-utils": "^2.1.0", - "@vue/theme": "^2.2.1", "@vue/tsconfig": "^0.1.3", "eslint": "^8.34.0", "eslint-plugin-vue": "^9.9.0", @@ -78,7 +73,6 @@ "prettier": "^2.8.3", "typescript": "^5.0.2", "vite": "^4.0.4", - "vitepress": "^1.0.0-alpha.40", "vitest": "^0.29.1", "vue-tsc": "^1.1.3" }, diff --git a/pages.config.ts b/pages.config.ts deleted file mode 100644 index 6db4fe5..0000000 --- a/pages.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { fileURLToPath, URL } from 'node:url'; - -import { defineConfig } from 'vite'; -import vue from '@vitejs/plugin-vue'; - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [vue()], - base: '/vue3-chessboard/', - build: { - target: 'esnext', - }, - resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - }, - }, -});