This commit is contained in:
Maciej Caderek
2022-04-23 03:58:31 +02:00
parent 8462bb949a
commit 4e67a55a15
83 changed files with 692 additions and 167 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -45,6 +45,7 @@ class Board {
private _anonymous: boolean = false; private _anonymous: boolean = false;
private scale: number = 1; private scale: number = 1;
private borderScale: number = 1;
private size: number = 0; private size: number = 0;
private squareSize: number = 0; private squareSize: number = 0;
@@ -131,7 +132,9 @@ class Board {
this.tempCanvas.height = height; this.tempCanvas.height = height;
} }
const tempBorderWidth = this.cfg.showBorder ? this.size / 32 : 0; const tempBorderWidth = this.cfg.showBorder
? (this.size / 32) * this.borderScale
: 0;
const tempInnerSize = this.size - tempBorderWidth * 2; const tempInnerSize = this.size - tempBorderWidth * 2;
this.squareSize = Math.floor(tempInnerSize / this.cfg.tiles); this.squareSize = Math.floor(tempInnerSize / this.cfg.tiles);
this.innerSize = this.squareSize * this.cfg.tiles; this.innerSize = this.squareSize * this.cfg.tiles;
@@ -144,6 +147,10 @@ class Board {
return this.size; return this.size;
} }
setBorderScale(scale: number) {
this.borderScale = scale;
}
setStyle(style: BoardStyle) { setStyle(style: BoardStyle) {
this.style = boards[style]; this.style = boards[style];
this.cfg.boardStyle = style; this.cfg.boardStyle = style;

View File

@@ -1,44 +0,0 @@
import { Style } from "../../types";
const style: Style = {
name: "Temp",
category: "custom",
background: {
type: "gradient",
data: {
dir: "radial",
colors: ["#ff00ff", "#00ffff"],
},
},
dark: {
type: "image",
data: {
src: "https://placekitten.com/1024/1024",
},
},
light: {
type: "gradient",
data: {
dir: "radial",
colors: ["#ffffff11", "#ffff0099", "#ffff0099"],
},
},
moveIndicator: {
type: "hueShift",
data: 70,
},
border: {
type: "gradient",
data: {
dir: "radial",
colors: ["#009999", "#000099", "#990000"],
},
},
coords: {
onLight: "#4d7a26",
onDark: "#ffffc4",
onBorder: "#ececa4",
},
};
export default style;

View File

@@ -4,13 +4,13 @@ import azure from "./solid/azure";
import clay from "./solid/clay"; import clay from "./solid/clay";
import rock from "./solid/rock"; import rock from "./solid/rock";
import danny from "./solid/danny"; import danny from "./solid/danny";
import dannyGreen from "./solid/danny-green"; import danny_green from "./solid/danny_green";
import dannyCyan from "./solid/danny-cyan"; import danny_cyan from "./solid/danny_cyan";
import dannyBlue from "./solid/danny-blue"; import danny_blue from "./solid/danny_blue";
import dannyPurple from "./solid/danny-purple"; import danny_purple from "./solid/danny_purple";
import dannyPink from "./solid/danny-pink"; import danny_pink from "./solid/danny_pink";
import dannyRed from "./solid/danny-red"; import danny_red from "./solid/danny_red";
import dannyYellow from "./solid/danny-yellow"; import danny_yellow from "./solid/danny_yellow";
import lichess from "./solid/lichess"; import lichess from "./solid/lichess";
import leko from "./solid/leko"; import leko from "./solid/leko";
import patina from "./solid/patina"; import patina from "./solid/patina";
@@ -22,27 +22,40 @@ import botez from "./solid/botez";
import mud from "./solid/mud"; import mud from "./solid/mud";
import rose from "./solid/rose"; import rose from "./solid/rose";
import avocado from "./solid/avocado"; import avocado from "./solid/avocado";
import monoTeal from "./solid/mono-teal";
import monoChico from "./solid/mono-chico";
import monoGoblin from "./solid/mono-goblin";
import monoMahogany from "./solid/mono-mahogany";
import monoMojo from "./solid/mono-mojo";
import monoMulberry from "./solid/mono-mulberry";
import monoSycamore from "./solid/mono-sycamore";
import monoBlue from "./solid/mono-blue";
import smoothSunset from "./gradient/smooth-sunset"; import mono_teal from "./solid/mono_teal";
import smoothSummer from "./gradient/smooth-summer"; import mono_chico from "./solid/mono_chico";
import smoothSpring from "./gradient/smooth-spring"; import mono_goblin from "./solid/mono_goblin";
import smoothForest from "./gradient/smooth-forest"; import mono_mahogany from "./solid/mono_mahogany";
import smoothLaguna from "./gradient/smooth-laguna"; import mono_mojo from "./solid/mono_mojo";
import smoothSea from "./gradient/smooth-sea"; import mono_mulberry from "./solid/mono_mulberry";
import smoothViolet from "./gradient/smooth-violet"; import mono_sycamore from "./solid/mono_sycamore";
import smoothMono from "./gradient/smooth-mono"; import mono_blue from "./solid/mono_blue";
import contrastA from "./gradient/contrast-a"; import mono_coral from "./solid/mono_coral";
import contrastB from "./gradient/contrast-b"; import mono_flamingo from "./solid/mono_flamingo";
import contrastC from "./gradient/contrast-c"; import mono_rose from "./solid/mono_rose";
import contrastD from "./gradient/contrast-d"; import mono_heliotrope from "./solid/mono_heliotrope";
import mono_cornflower from "./solid/mono_cornflower";
import mono_dodger from "./solid/mono_dodger";
import mono_meadow from "./solid/mono_meadow";
import mono_mantis from "./solid/mono_mantis";
import mono_coper from "./solid/mono_coper";
import mono_contessa from "./solid/mono_contessa";
import mono_terracotta from "./solid/mono_terracotta";
import mono_harvest from "./solid/mono_harvest";
import smooth_sunset from "./gradient/smooth_sunset";
import smooth_summer from "./gradient/smooth_summer";
import smooth_spring from "./gradient/smooth_spring";
import smooth_forest from "./gradient/smooth_forest";
import smooth_laguna from "./gradient/smooth_laguna";
import smooth_sea from "./gradient/smooth_sea";
import smooth_violet from "./gradient/smooth_violet";
import smooth_mono from "./gradient/smooth_mono";
import contrast_a from "./gradient/contrast_a";
import contrast_b from "./gradient/contrast_b";
import contrast_c from "./gradient/contrast_c";
import contrast_d from "./gradient/contrast_d";
import wood1 from "./pic/wood1"; import wood1 from "./pic/wood1";
import wood2 from "./pic/wood2"; import wood2 from "./pic/wood2";
@@ -53,7 +66,7 @@ import wood6 from "./pic/wood6";
import wood7 from "./pic/wood7"; import wood7 from "./pic/wood7";
import wood8 from "./pic/wood8"; import wood8 from "./pic/wood8";
const styles = { const boardStyles = {
standard, standard,
spring, spring,
azure, azure,
@@ -67,38 +80,51 @@ const styles = {
patina, patina,
mud, mud,
danny, danny,
dannyGreen, danny_green,
dannyCyan, danny_cyan,
dannyBlue, danny_blue,
dannyPurple, danny_purple,
dannyPink, danny_pink,
dannyRed, danny_red,
dannyYellow, danny_yellow,
lichess, lichess,
danya, danya,
botez, botez,
avocado, avocado,
monoChico,
monoMojo,
monoMahogany,
monoMulberry,
monoBlue,
monoTeal,
monoGoblin,
monoSycamore,
smoothSunset, mono_chico,
smoothSummer, mono_mojo,
smoothSpring, mono_mahogany,
smoothForest, mono_mulberry,
smoothLaguna, mono_blue,
smoothSea, mono_teal,
smoothViolet, mono_goblin,
smoothMono, mono_sycamore,
contrastA, mono_coral,
contrastB, mono_flamingo,
contrastC, mono_rose,
contrastD, mono_heliotrope,
mono_cornflower,
mono_dodger,
mono_meadow,
mono_mantis,
mono_coper,
mono_contessa,
mono_terracotta,
mono_harvest,
smooth_sunset,
smooth_summer,
smooth_spring,
smooth_forest,
smooth_laguna,
smooth_sea,
smooth_violet,
smooth_mono,
contrast_a,
contrast_b,
contrast_c,
contrast_d,
wood1, wood1,
wood2, wood2,
wood3, wood3,
@@ -109,4 +135,7 @@ const styles = {
wood8, wood8,
}; };
export default styles; const boardNames = Object.keys(boardStyles);
export { boardNames };
export default boardStyles;

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Contrast A",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Contrast B",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Contrast C",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Contrast D",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Forest",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Laguna",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Mono",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Sea",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Spring",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Summer",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Sunset",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Smooth Violet",
category: "gradient", category: "gradient",
background: { background: {
type: "gradient", type: "gradient",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 1",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 2",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 3",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 4",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 5",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 6",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 7",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Wood 8",
category: "pic", category: "pic",
background: { background: {
type: "image", type: "image",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Avocado",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Azure",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Botez",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Clay",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny Blue",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny Cyan",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny Green",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny Pink",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny Purple",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny Red",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danny Yellow",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Danya",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Leko",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Lichess",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Lila",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Blue",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Chico",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#D47669";
const fgColor = "#E9BAB4";
const darkFontColor = "#95493F";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#00ff0033",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#AC746D";
const fgColor = "#D5B9B6";
const darkFontColor = "#704944";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#00ff0033",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#FF7C44";
const fgColor = "#FFBDA1";
const darkFontColor = "#DC4200";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#00ffaa55",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#7673FF";
const fgColor = "#BAB9FF";
const darkFontColor = "#3734B0";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#ff770055",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#3C85F4";
const fgColor = "#9DC2F9";
const darkFontColor = "#1451AE";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#55ff0055",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#F65656";
const fgColor = "#FAAAAA";
const darkFontColor = "#BC2D2D";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#ffff0033",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Goblin",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#EAA464";
const fgColor = "#F4D1B1";
const darkFontColor = "#BD8551";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#00ff0033",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#C84CF3";
const fgColor = "#E3A5F9";
const darkFontColor = "#881EAC";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "hueShift",
data: 30,
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Mahogany",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#69C549";
const fgColor = "#B4E2A4";
const darkFontColor = "#4C9433";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#ffff0055",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#07C575";
const fgColor = "#83E2BA";
const darkFontColor = "#07834F";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#ffff0055",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Blue",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Mulberry",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#FB6299";
const fgColor = "#FDB0CC";
const darkFontColor = "#C8215D";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#ffff0033",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Sycamore",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Mono Teal",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -0,0 +1,46 @@
import { Style } from "../../../types";
const bgColor = "#DF8F6C";
const fgColor = "#EFC7B5";
const darkFontColor = "#A56A51";
const lightFontColor = "#ffffff";
const borderFontColor = "#00000099";
const style: Style = {
category: "solid",
background: {
type: "solid",
data: {
color: "transparent",
},
},
dark: {
type: "solid",
data: {
color: bgColor,
},
},
light: {
type: "solid",
data: {
color: fgColor,
},
},
moveIndicator: {
type: "color",
data: "#00ff0033",
},
border: {
type: "solid",
data: {
color: bgColor,
},
},
coords: {
onLight: darkFontColor,
onDark: lightFontColor,
onBorder: borderFontColor,
},
};
export default style;

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Beige",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Beige",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Peach",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Rock",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Rose",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Spring",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Standard",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -1,7 +1,6 @@
import { Style } from "../../../types"; import { Style } from "../../../types";
const style: Style = { const style: Style = {
name: "Violet",
category: "solid", category: "solid",
background: { background: {
type: "solid", type: "solid",

View File

@@ -2,8 +2,9 @@ import { Handlers } from "./../types";
import { state, setState } from "../state"; import { state, setState } from "../state";
import loadFromUrl from "./loadFromUrl"; import loadFromUrl from "./loadFromUrl";
import readFile from "../utils/readFile"; import readFile from "../utils/readFile";
import Board from "../board/Board";
const registerEvents = (handlers: Handlers) => { const registerEvents = (handlers: Handlers, board: Board) => {
document.addEventListener("dblclick", function (el) { document.addEventListener("dblclick", function (el) {
el.preventDefault(); el.preventDefault();
}); });
@@ -25,7 +26,7 @@ const registerEvents = (handlers: Handlers) => {
return; return;
} }
loadFromUrl(true, handlers); loadFromUrl(true, handlers, board);
}); });
if (!state.mobile) { if (!state.mobile) {

View File

@@ -41,7 +41,7 @@ const main = async () => {
/* Register events */ /* Register events */
registerEvents(handlers); registerEvents(handlers, board);
}; };
/* Initialize */ /* Initialize */

View File

@@ -1,12 +1,31 @@
import { PiecesStyle } from "./../board/styles-pieces/piecesStyles";
import { boardNames } from "../board/styles-board/boardStyles";
import piecesStyles from "../board/styles-pieces/piecesStyles";
const fixBoardConfig = (boardConfig: { [key: string]: string }) => {
if (!boardNames.includes(boardConfig.boardStyle)) {
delete boardConfig.boardStyle;
}
if (!piecesStyles.includes(boardConfig.piecesStyle as PiecesStyle)) {
delete boardConfig.piecesStyle;
}
return boardConfig;
};
const loadConfig = () => { const loadConfig = () => {
const boardConfig = localStorage.getItem("boardConfig"); const boardConfig = localStorage.getItem("boardConfig");
const gameConfig = localStorage.getItem("gameConfig"); const gameConfig = localStorage.getItem("gameConfig");
const siteConfig = localStorage.getItem("siteConfig"); const siteConfig = localStorage.getItem("siteConfig");
const recent = localStorage.getItem("recent");
return { return {
boardConfig: boardConfig === null ? {} : JSON.parse(boardConfig), boardConfig:
boardConfig === null ? {} : fixBoardConfig(JSON.parse(boardConfig)),
gameConfig: gameConfig === null ? {} : JSON.parse(gameConfig), gameConfig: gameConfig === null ? {} : JSON.parse(gameConfig),
siteConfig: siteConfig === null ? {} : JSON.parse(siteConfig), siteConfig: siteConfig === null ? {} : JSON.parse(siteConfig),
recent: recent === null ? [] : JSON.parse(recent),
}; };
}; };

View File

@@ -1,6 +1,6 @@
import { state } from "../state"; import { state } from "../state";
const saveConfig = (type: "board" | "game" | "site") => { const saveConfig = (type: "board" | "game" | "site" | "recent") => {
switch (type) { switch (type) {
case "board": case "board":
localStorage.setItem("boardConfig", JSON.stringify(state.boardConfig)); localStorage.setItem("boardConfig", JSON.stringify(state.boardConfig));
@@ -11,6 +11,9 @@ const saveConfig = (type: "board" | "game" | "site") => {
case "site": case "site":
localStorage.setItem("siteConfig", JSON.stringify(state.siteConfig)); localStorage.setItem("siteConfig", JSON.stringify(state.siteConfig));
break; break;
case "recent":
localStorage.setItem("recent", JSON.stringify(state.recent));
break;
} }
}; };

View File

@@ -2,7 +2,7 @@ import isMobile from "is-mobile";
import { createStore } from "solid-js/store"; import { createStore } from "solid-js/store";
import Game from "./game/Game"; import Game from "./game/Game";
import loadConfig from "./persistance/loadConfig"; import loadConfig from "./persistance/loadConfig";
import { BoardConfig, GameConfig, SiteConfig } from "./types"; import { BoardConfig, GameConfig, SiteConfig, Recent } from "./types";
import UAParser from "ua-parser-js"; import UAParser from "ua-parser-js";
const userAgent = UAParser(); const userAgent = UAParser();
@@ -60,6 +60,7 @@ export type State = {
browser?: string; browser?: string;
os?: string; os?: string;
about: boolean; about: boolean;
recent: Recent;
}; };
const initialState: State = { const initialState: State = {
@@ -88,8 +89,11 @@ const initialState: State = {
browser: userAgent.browser.name, browser: userAgent.browser.name,
os: userAgent.os.name, os: userAgent.os.name,
about: false, about: false,
recent: saved.recent,
}; };
const [state, setState] = createStore(initialState); const [state, setState] = createStore(initialState);
console.log(state);
export { state, setState }; export { state, setState };

View File

@@ -55,7 +55,6 @@ export type MoveIndicator =
export type StyleCategory = "solid" | "gradient" | "pic" | "custom"; export type StyleCategory = "solid" | "gradient" | "pic" | "custom";
export type Style = { export type Style = {
name: string;
category: StyleCategory; category: StyleCategory;
background: SquareStyle; background: SquareStyle;
light: SquareStyle; light: SquareStyle;
@@ -110,6 +109,11 @@ export type SiteConfig = {
iOSAppPopup: boolean; iOSAppPopup: boolean;
}; };
export type Recent = {
title: string;
hash: string;
}[];
export type MaterialCount = { export type MaterialCount = {
w: { w: {
p: number; p: number;

View File

@@ -2,12 +2,12 @@ import { Component, For, createSignal } from "solid-js";
import { Handlers, StyleCategory, BoardStyle, Style } from "../../types"; import { Handlers, StyleCategory, BoardStyle, Style } from "../../types";
import Scrollable from "./reusable/Scrollable"; import Scrollable from "./reusable/Scrollable";
import "./Boards.css"; import "./Boards.css";
import styles from "../../board/styles-board/boardStyles"; import boardStyles from "../../board/styles-board/boardStyles";
import Board from "../../board/Board"; import Board from "../../board/Board";
import { state, setState } from "../../state"; import { state, setState } from "../../state";
type BoardPreview = { type BoardPreview = {
key: keyof typeof styles; key: keyof typeof boardStyles;
name: string; name: string;
category: StyleCategory; category: StyleCategory;
img: string; img: string;
@@ -23,7 +23,12 @@ const prepareBoards = async () => {
showExtraInfo: false, showExtraInfo: false,
}); });
for (const [key, style] of Object.entries(styles) as [BoardStyle, Style][]) { board.setBorderScale(3);
for (const [key, style] of Object.entries(boardStyles) as [
BoardStyle,
Style
][]) {
let img: string; let img: string;
if (style.ico) { if (style.ico) {
@@ -37,8 +42,6 @@ const prepareBoards = async () => {
boards.push({ boards.push({
key, key,
name: style.name,
category: style.category,
img, img,
} as BoardPreview); } as BoardPreview);
} }
@@ -68,7 +71,7 @@ const Boards: Component<{ handlers: Handlers; class?: string }> = (props) => {
props.handlers.changeBoardStyle(board.key); props.handlers.changeBoardStyle(board.key);
}} }}
style={{ "background-image": `url(${board.img})` }} style={{ "background-image": `url(${board.img})` }}
title={board.name} title={board.key}
draggable={false} draggable={false}
/> />
); );