Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit 8bc7cfd

Browse files
committed
style: no more default exports!
1 parent 1249006 commit 8bc7cfd

File tree

6 files changed

+4665
-4672
lines changed

6 files changed

+4665
-4672
lines changed

src/data/level0.ts

Lines changed: 0 additions & 1545 deletions
This file was deleted.

src/data/level1.ts

Lines changed: 0 additions & 1544 deletions
This file was deleted.

src/data/level2.ts

Lines changed: 0 additions & 1545 deletions
This file was deleted.

src/data/levels.ts

Lines changed: 4629 additions & 0 deletions
Large diffs are not rendered by default.

src/script.ts

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import localStorageDriver from "unstorage/drivers/localstorage";
2020
import { registerSW } from "virtual:pwa-register";
2121
import { fromZodError } from "zod-validation-error";
2222
import type { Level, Lvl } from "./data/data-types.ts";
23+
import { level0, level1, level2 } from "./data/levels.ts";
24+
import { rooms } from "./data/rooms.ts";
2325
import {
2426
btmStairsSchema,
2527
profilesListSchema,
@@ -28,10 +30,6 @@ import {
2830
type ProfilesList,
2931
type Room,
3032
} from "./data/schemas.ts";
31-
import gridLvl0 from "./data/level0.ts";
32-
import gridLvl1 from "./data/level1.ts";
33-
import gridLvl2 from "./data/level2.ts";
34-
import { rooms } from "./data/rooms.ts";
3533
import { btmStairs, stairs } from "./data/stairs.ts";
3634

3735
const updateSW = registerSW({
@@ -299,17 +297,17 @@ function printGrid(level: Lvl): void {
299297

300298
switch (level) {
301299
case 1: {
302-
currentGrid = gridLvl1;
300+
currentGrid = level1;
303301

304302
break;
305303
}
306304
case 2: {
307-
currentGrid = gridLvl2;
305+
currentGrid = level2;
308306

309307
break;
310308
}
311309
case 0: {
312-
currentGrid = gridLvl0;
310+
currentGrid = level0;
313311

314312
break;
315313
}
@@ -475,11 +473,11 @@ function stairPath(x1: number, y1: number, x2: number, y2: number, fl: number) {
475473
[sx1, sy1] = stairs[stairsSchema.parse(indexmin.toString())];
476474

477475
if (fl === 2) {
478-
path(gridLvl2, x1, y1, sx1, sy1);
479-
path(gridLvl1, sx1, sy1, x2, y2);
476+
path(level2, x1, y1, sx1, sy1);
477+
path(level1, sx1, sy1, x2, y2);
480478
} else {
481-
path(gridLvl1, x1, y1, sx1, sy1);
482-
path(gridLvl2, sx1, sy1, x2, y2);
479+
path(level1, x1, y1, sx1, sy1);
480+
path(level2, sx1, sy1, x2, y2);
483481
}
484482
}
485483

@@ -520,9 +518,9 @@ function btmPath(
520518
[sx1, sy1] = btmStairs[btmStairsSchema.parse(indexmin.toString())];
521519

522520
if (flr1 === 2) {
523-
path(gridLvl2, x1, y1, sx1, sy1);
521+
path(level2, x1, y1, sx1, sy1);
524522
} else {
525-
path(gridLvl1, x1, y1, sx1, sy1);
523+
path(level1, x1, y1, sx1, sy1);
526524
}
527525
} else if (flr2 !== 0) {
528526
tempdist1 = Object.values(btmStairs)
@@ -536,16 +534,16 @@ function btmPath(
536534
indexmin = tempdist.indexOf(min);
537535
[sx1, sy1] = btmStairs[btmStairsSchema.parse(indexmin.toString())];
538536
if (flr2 === 2) {
539-
path(gridLvl2, x2, y2, sx1, sy1);
537+
path(level2, x2, y2, sx1, sy1);
540538
} else {
541-
path(gridLvl1, x2, y2, sx1, sy1);
539+
path(level1, x2, y2, sx1, sy1);
542540
}
543541
}
544542

545543
if (flr1 === 0) {
546-
path(gridLvl0, x1, y1, sx1, sy1 - 8);
544+
path(level0, x1, y1, sx1, sy1 - 8);
547545
} else if (flr2 === 0) {
548-
path(gridLvl0, x2, y2, sx1, sy1 - 8);
546+
path(level0, x2, y2, sx1, sy1 - 8);
549547
}
550548
if (flr1 === 1 || flr2 === 1) {
551549
mainToBtm(x1, y1, sx1, sy1, flr1, flr2);
@@ -556,24 +554,24 @@ function clearGrid(): void {
556554
const img = source;
557555

558556
ctx.drawImage(img, 0, 0, size, size);
559-
for (let y = 0; y < gridLvl0.length; y++) {
560-
for (let x = 0; x < (gridLvl0[y]?.length ?? 0); x++) {
561-
if (gridLvl0[x]?.[y] === -4) {
562-
gridLvl0[x]![y] = 0;
557+
for (let y = 0; y < level0.length; y++) {
558+
for (let x = 0; x < (level0[y]?.length ?? 0); x++) {
559+
if (level0[x]?.[y] === -4) {
560+
level0[x]![y] = 0;
563561
}
564562
}
565563
}
566-
for (let y = 0; y < gridLvl1.length; y++) {
567-
for (let x = 0; x < (gridLvl1[y]?.length ?? 0); x++) {
568-
if (gridLvl1[x]?.[y] === -4) {
569-
gridLvl1[x]![y] = 0;
564+
for (let y = 0; y < level1.length; y++) {
565+
for (let x = 0; x < (level1[y]?.length ?? 0); x++) {
566+
if (level1[x]?.[y] === -4) {
567+
level1[x]![y] = 0;
570568
}
571569
}
572570
}
573-
for (let y = 0; y < gridLvl2.length; y++) {
574-
for (let x = 0; x < (gridLvl2[y]?.length ?? 0); x++) {
575-
if (gridLvl2[x]?.[y] === -4) {
576-
gridLvl2[x]![y] = 0;
571+
for (let y = 0; y < level2.length; y++) {
572+
for (let x = 0; x < (level2[y]?.length ?? 0); x++) {
573+
if (level2[x]?.[y] === -4) {
574+
level2[x]![y] = 0;
577575
}
578576
}
579577
}
@@ -612,10 +610,10 @@ function passingTime(num: number, profNum: number) {
612610
flr2 = rooms[end][2];
613611

614612
if (flr1 === 1 && flr2 === 1) {
615-
grid = gridLvl1;
613+
grid = level1;
616614
path(grid, x1, y1, x2, y2);
617615
} else if (flr1 === 2 && flr2 === 2) {
618-
grid = gridLvl2;
616+
grid = level2;
619617
path(grid, x1, y1, x2, y2);
620618
} else if (flr1 !== 0 && flr2 !== 0) {
621619
stairPath(x1, y1, x2, y2, flr1);
@@ -696,17 +694,17 @@ let old: number;
696694
function onKeyDown(event: KeyboardEvent) {
697695
switch (viewLvl) {
698696
case 1: {
699-
grid = gridLvl1;
697+
grid = level1;
700698

701699
break;
702700
}
703701
case 2: {
704-
grid = gridLvl2;
702+
grid = level2;
705703

706704
break;
707705
}
708706
case 0: {
709-
grid = gridLvl0;
707+
grid = level0;
710708

711709
break;
712710
}

vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { resolve } from "path";
1+
import { resolve } from "node:path";
2+
import browserslist from "browserslist";
3+
import browserslistToEsbuild from "browserslist-to-esbuild";
4+
import { browserslistToTargets } from "lightningcss";
25
import { defineConfig } from "vite";
36
import { VitePWA } from "vite-plugin-pwa";
47
import webfontDownload from "vite-plugin-webfont-dl";
5-
import { browserslistToTargets } from "lightningcss";
6-
import browserslist from "browserslist";
7-
import browserslistToEsbuild from "browserslist-to-esbuild";
88

99
const browsersList = browserslist();
1010

0 commit comments

Comments
 (0)