⬆️ update prettier

This commit is contained in:
platane
2025-02-20 19:58:59 +07:00
parent 79c252356c
commit ace186c41f
41 changed files with 94 additions and 94 deletions

View File

@@ -38,7 +38,7 @@ for (const [key, grid] of Object.entries(grids))
null,
chain,
drawOptions,
animationOptions
animationOptions,
);
expect(svg).toBeDefined();

View File

@@ -8,7 +8,7 @@ it("should minify css", () => {
color : red ;
}
`)
`),
).toBe(".c{color:red}");
expect(
@@ -22,6 +22,6 @@ it("should minify css", () => {
animation: linear 10;
}
`)
`),
).toBe(".c{top:0;color:red}#{animation:linear 10}");
});

View File

@@ -16,7 +16,7 @@ const mergeKeyFrames = (keyframes: { t: number; style: string }[]) => {
*/
export const createAnimation = (
name: string,
keyframes: { t: number; style: string }[]
keyframes: { t: number; style: string }[],
) =>
`@keyframes ${name}{` +
mergeKeyFrames(keyframes)

View File

@@ -15,7 +15,7 @@ export type Options = {
export const createGrid = (
cells: (Point & { t: number | null; color: Color | Empty })[],
{ sizeDotBorderRadius, sizeDot, sizeCell }: Options,
duration: number
duration: number,
) => {
const svgElements: string[] = [];
const styles = [
@@ -48,7 +48,7 @@ export const createGrid = (
`.c.${id}{
fill: var(--c${color});
animation-name: ${animationName}
}`
}`,
);
}
@@ -59,7 +59,7 @@ export const createGrid = (
y: y * sizeCell + m,
rx: sizeDotBorderRadius,
ry: sizeDotBorderRadius,
})
}),
);
}

View File

@@ -34,13 +34,13 @@ export type DrawOptions = {
const getCellsFromGrid = ({ width, height }: Grid) =>
Array.from({ length: width }, (_, x) =>
Array.from({ length: height }, (_, y) => ({ x, y }))
Array.from({ length: height }, (_, y) => ({ x, y })),
).flat();
const createLivingCells = (
grid0: Grid,
chain: Snake[],
cells: Point[] | null
cells: Point[] | null,
) => {
const livingCells: (Point & {
t: number | null;
@@ -73,7 +73,7 @@ export const createSvg = (
cells: Point[] | null,
chain: Snake[],
drawOptions: DrawOptions,
animationOptions: Pick<AnimationOptions, "frameDuration">
animationOptions: Pick<AnimationOptions, "frameDuration">,
) => {
const width = (grid.width + 2) * drawOptions.sizeCell;
const height = (grid.height + 5) * drawOptions.sizeCell;
@@ -89,7 +89,7 @@ export const createSvg = (
drawOptions,
grid.width * drawOptions.sizeCell,
(grid.height + 2) * drawOptions.sizeCell,
duration
duration,
),
createSnake(chain, drawOptions, duration),
];

View File

@@ -15,7 +15,7 @@ const lerp = (k: number, a: number, b: number) => (1 - k) * a + k * b;
export const createSnake = (
chain: Snake[],
{ sizeCell, sizeDot }: Options,
duration: number
duration: number,
) => {
const snakeN = chain[0] ? getSnakeLength(chain[0]) : 0;
@@ -64,7 +64,7 @@ export const createSnake = (
const animationName = id;
const keyframes = removeInterpolatedPositions(
positions.map((tr, i, { length }) => ({ ...tr, t: i / length }))
positions.map((tr, i, { length }) => ({ ...tr, t: i / length })),
).map(({ t, ...p }) => ({ t, style: transform(p) }));
return [

View File

@@ -11,7 +11,7 @@ export const createStack = (
{ sizeDot }: Options,
width: number,
y: number,
duration: number
duration: number,
) => {
const svgElements: string[] = [];
const styles = [
@@ -51,7 +51,7 @@ export const createStack = (
width: (ts.length * m + 0.6).toFixed(1),
x,
y,
})
}),
);
styles.push(
@@ -68,7 +68,7 @@ export const createStack = (
].map(({ scale, t }) => ({
t,
style: `transform:scale(${scale.toFixed(3)},1)`,
}))
})),
),
`.u.${id} {
@@ -76,7 +76,7 @@ export const createStack = (
animation-name: ${animationName};
transform-origin: ${x}px 0
}
`
`,
);
}