Skip to content

Commit

Permalink
Run format
Browse files Browse the repository at this point in the history
  • Loading branch information
unicolored committed May 1, 2024
1 parent 27c7d76 commit e6b0d8d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion assets/chessground.base.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ piece.fading {
}

.cg-wrap coords.squares.rank3 coord,
.cg-wrap coords.squares.black.rank6 coord{
.cg-wrap coords.squares.black.rank6 coord {
transform: translateX(200%);
}

Expand Down
8 changes: 4 additions & 4 deletions assets/chessground.brown.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ cg-board square.current-premove {
.cg-wrap.orientation-white coords.files coord:nth-child(2n),
.cg-wrap.orientation-black coords.ranks coord:nth-child(2n + 1),
.cg-wrap.orientation-black coords.files coord:nth-child(2n + 1),
.cg-wrap coords.squares:nth-child(2n+2) coord:nth-child(2n + 1),
.cg-wrap coords.squares:nth-child(2n+1) coord:nth-child(2n) {
.cg-wrap coords.squares:nth-child(2n + 2) coord:nth-child(2n + 1),
.cg-wrap coords.squares:nth-child(2n + 1) coord:nth-child(2n) {
color: rgba(72, 72, 72, 0.8);
}

.cg-wrap.orientation-black coords.ranks coord:nth-child(2n),
.cg-wrap.orientation-black coords.files coord:nth-child(2n),
.cg-wrap.orientation-white coords.ranks coord:nth-child(2n + 1),
.cg-wrap.orientation-white coords.files coord:nth-child(2n + 1),
.cg-wrap coords.squares:nth-child(2n+1) coord:nth-child(2n + 1),
.cg-wrap coords.squares:nth-child(2n+2) coord:nth-child(2n) {
.cg-wrap coords.squares:nth-child(2n + 1) coord:nth-child(2n + 1),
.cg-wrap coords.squares:nth-child(2n + 2) coord:nth-child(2n) {
color: rgba(255, 255, 255, 0.8);
}
4 changes: 2 additions & 2 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@
Chessground(document.getElementById('board-4'), {
orientation: 'black',
coordinatesOnSquares: true,
ranksPosition: 'left'
ranksPosition: 'left',
});
Chessground(document.getElementById('board-5'), {
orientation: 'white',
coordinatesOnSquares: true
coordinatesOnSquares: true,
});
</script>
</head>
Expand Down
16 changes: 8 additions & 8 deletions src/premove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ export function premove(pieces: cg.Pieces, key: cg.Key, canCastle: boolean): cg.
r === 'pawn'
? pawn(piece.color)
: r === 'knight'
? knight
: r === 'bishop'
? bishop
: r === 'rook'
? rook
: r === 'queen'
? queen
: king(piece.color, rookFilesOf(pieces, piece.color), canCastle);
? knight
: r === 'bishop'
? bishop
: r === 'rook'
? rook
: r === 'queen'
? queen
: king(piece.color, rookFilesOf(pieces, piece.color), canCastle);
return util.allPos
.filter(pos2 => (pos[0] !== pos2[0] || pos[1] !== pos2[1]) && mobility(pos[0], pos[1], pos2[0], pos2[1]))
.map(util.pos2key);
Expand Down
18 changes: 9 additions & 9 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ export const colors = ['white', 'black'] as const;
export const files = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] as const;
export const ranks = ['1', '2', '3', '4', '5', '6', '7', '8'] as const;
export const squares = {
'a': ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8'],
'b': ['b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8'],
'c': ['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8'],
'd': ['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8'],
'e': ['e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8'],
'f': ['f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8'],
'g': ['g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7', 'g8'],
'h': ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'h8']
} as {[key: string]: string[]};
a: ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8'],
b: ['b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8'],
c: ['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8'],
d: ['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8'],
e: ['e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8'],
f: ['f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8'],
g: ['g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7', 'g8'],
h: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'h8'],
} as { [key: string]: string[] };

export type RanksPosition = 'left' | 'right';

Expand Down
6 changes: 4 additions & 2 deletions src/wrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ export function renderWrap(element: HTMLElement, s: HeadlessState): Elements {

if (s.coordinatesOnSquares) {
let rank = 1;
Object.keys(squares).forEach((file) => {
Object.keys(squares).forEach(file => {
const rankClass = ' rank' + rank;
container.appendChild(renderCoords(squares[file], 'squares' + rankClass + orientClass + ranksPositionClass));
container.appendChild(
renderCoords(squares[file], 'squares' + rankClass + orientClass + ranksPositionClass),
);
rank++;
});
} else {
Expand Down

0 comments on commit e6b0d8d

Please sign in to comment.