diff --git a/src/app/components/OptionsForm.tsx b/src/app/components/OptionsForm.tsx index 143610e..8c10e6a 100644 --- a/src/app/components/OptionsForm.tsx +++ b/src/app/components/OptionsForm.tsx @@ -1,3 +1,4 @@ +import { type FormActionType } from "@/app/page"; import { MazeController, type MazeSettings } from "@/lib/MazeController"; import { getFloatFromForm, getIntFromForm } from "@/lib/utils"; import { useCallback, useRef, type ReactElement } from "react"; @@ -11,7 +12,6 @@ import { TextField, } from "react-aria-components"; import { twMerge } from "tailwind-merge"; -import { FormActionType } from "../page"; export interface OptionsFormProps { onAction: (action: FormActionType, settings: MazeSettings) => void; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 80f00fa..b5c463b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,8 +1,8 @@ import type { Metadata } from "next"; import { Lato } from "next/font/google"; import { type ReactElement, type ReactNode } from "react"; -import "./globals.scss"; import { twMerge } from "tailwind-merge"; +import "./globals.scss"; const latoFont = Lato({ weight: ["300", "400", "700"], diff --git a/src/app/page.tsx b/src/app/page.tsx index bb8ce09..94117d7 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,6 @@ "use client"; -import { MazeSettings, MazeController } from "@/lib/MazeController"; +import { MazeController, type MazeSettings } from "@/lib/MazeController"; +import { type RectSize } from "@/lib/twoDimens"; import { useCallback, useEffect, @@ -7,10 +8,9 @@ import { useState, type ReactElement, } from "react"; -import OptionsForm from "./components/OptionsForm"; -import { match } from "ts-pattern"; import { Label, Radio, RadioGroup } from "react-aria-components"; -import { RectSize } from "@/lib/twoDimens"; +import { match } from "ts-pattern"; +import OptionsForm from "./components/OptionsForm"; export type FormActionType = "generate" | "solve" | "clear"; diff --git a/src/lib/MazeCell.ts b/src/lib/MazeCell.ts index 1baa07f..5c05dbb 100644 --- a/src/lib/MazeCell.ts +++ b/src/lib/MazeCell.ts @@ -1,4 +1,4 @@ -import { Idx2d } from "./twoDimens"; +import { type Idx2d } from "./twoDimens"; export type CellState = "empty" | "partial" | "solid"; diff --git a/src/lib/MazeController.ts b/src/lib/MazeController.ts index 165ed40..0ba6e75 100644 --- a/src/lib/MazeController.ts +++ b/src/lib/MazeController.ts @@ -1,18 +1,18 @@ import { Mutex } from "async-mutex"; +import { match } from "ts-pattern"; import { type GenerationAlgorithm, type SolveAlgorithm, } from "./algorithms/algorithmTypes"; +import { MazeGenerator } from "./algorithms/generating/MazeGenerator"; +import { Wilsons } from "./algorithms/generating/Wilsons"; +import { BFS } from "./algorithms/solving/BFS"; +import { MazeSolver } from "./algorithms/solving/MazeSolver"; import { AnimationPromise } from "./AnimationPromise"; -import { MazeCell } from "./MazeCell"; +import { type MazeCell } from "./MazeCell"; import MazeDrawer from "./MazeDrawer"; -import { RectSize } from "./twoDimens"; +import { type RectSize } from "./twoDimens"; import { clamp, deepEqual } from "./utils"; -import { BFS } from "./algorithms/solving/BFS"; -import { match } from "ts-pattern"; -import { MazeGenerator } from "./algorithms/generating/MazeGenerator"; -import { MazeSolver } from "./algorithms/solving/MazeSolver"; -import { Wilsons } from "./algorithms/generating/Wilsons"; export type MazeEvent = "generate" | "solve"; diff --git a/src/lib/MazeDrawer.ts b/src/lib/MazeDrawer.ts index 6799ad3..00f552a 100644 --- a/src/lib/MazeDrawer.ts +++ b/src/lib/MazeDrawer.ts @@ -1,10 +1,15 @@ import colors from "tailwindcss/colors"; import { match } from "ts-pattern"; +import { AnimationPromise } from "./AnimationPromise"; import { type MazeCell } from "./MazeCell"; -import { RectSize, type Coord, type GridSize, type Idx2d } from "./twoDimens"; +import { type MazeDimensions, type MazeEvent } from "./MazeController"; +import { + type RectSize, + type Coord, + type GridSize, + type Idx2d, +} from "./twoDimens"; import { clamp, easeOutQuad, type Direction } from "./utils"; -import { AnimationPromise } from "./AnimationPromise"; -import { MazeDimensions, MazeEvent } from "./MazeController"; /** Colors used by the renderer. */ const COLOR = { diff --git a/src/lib/algorithms/Algorithm.ts b/src/lib/algorithms/Algorithm.ts index d8acb3c..8a392f8 100644 --- a/src/lib/algorithms/Algorithm.ts +++ b/src/lib/algorithms/Algorithm.ts @@ -1,4 +1,4 @@ -import { MazeCell } from "@/lib/MazeCell"; +import { type MazeCell } from "@/lib/MazeCell"; export abstract class Algorithm { private _finished: boolean = false; diff --git a/src/lib/algorithms/generating/MazeGenerator.ts b/src/lib/algorithms/generating/MazeGenerator.ts index bc802ef..6aaaddf 100644 --- a/src/lib/algorithms/generating/MazeGenerator.ts +++ b/src/lib/algorithms/generating/MazeGenerator.ts @@ -1,5 +1,5 @@ import { MazeCell } from "@/lib/MazeCell"; -import { GridSize } from "@/lib/twoDimens"; +import { type GridSize } from "@/lib/twoDimens"; import { Algorithm } from "../Algorithm"; export abstract class MazeGenerator extends Algorithm { diff --git a/src/lib/algorithms/generating/Wilsons.ts b/src/lib/algorithms/generating/Wilsons.ts index ef99842..59a81d5 100644 --- a/src/lib/algorithms/generating/Wilsons.ts +++ b/src/lib/algorithms/generating/Wilsons.ts @@ -1,4 +1,4 @@ -import { MazeCell } from "@/lib/MazeCell"; +import { type MazeCell } from "@/lib/MazeCell"; import { MazeGenerator } from "./MazeGenerator"; import { randomFromArray, randomFromSet } from "@/lib/utils"; import { match } from "ts-pattern"; diff --git a/src/lib/algorithms/solving/BFS.ts b/src/lib/algorithms/solving/BFS.ts index b00d4ba..29c12cf 100644 --- a/src/lib/algorithms/solving/BFS.ts +++ b/src/lib/algorithms/solving/BFS.ts @@ -1,4 +1,4 @@ -import { MazeCell } from "@/lib/MazeCell"; +import { type MazeCell } from "@/lib/MazeCell"; import { MazeSolver } from "./MazeSolver"; import { Deque } from "@datastructures-js/deque"; import { buildPath } from "./pathUtils"; diff --git a/src/lib/algorithms/solving/MazeSolver.ts b/src/lib/algorithms/solving/MazeSolver.ts index 0aa72c2..b11dec8 100644 --- a/src/lib/algorithms/solving/MazeSolver.ts +++ b/src/lib/algorithms/solving/MazeSolver.ts @@ -1,4 +1,4 @@ -import { MazeCell } from "@/lib/MazeCell"; +import { type MazeCell } from "@/lib/MazeCell"; import { Algorithm } from "../Algorithm"; export abstract class MazeSolver extends Algorithm { diff --git a/src/lib/algorithms/solving/Tremaux.ts b/src/lib/algorithms/solving/Tremaux.ts index 54e5fa4..72c616c 100644 --- a/src/lib/algorithms/solving/Tremaux.ts +++ b/src/lib/algorithms/solving/Tremaux.ts @@ -1,6 +1,6 @@ -import { MazeCell } from "@/lib/MazeCell"; -import { MazeSolver } from "./MazeSolver"; +import { type MazeCell } from "@/lib/MazeCell"; import { randomFromArray } from "@/lib/utils"; +import { MazeSolver } from "./MazeSolver"; export class Tremaux extends MazeSolver { protected _step(): [boolean, Readonly[]] { diff --git a/src/lib/algorithms/solving/pathUtils.ts b/src/lib/algorithms/solving/pathUtils.ts index e69b671..709cdd5 100644 --- a/src/lib/algorithms/solving/pathUtils.ts +++ b/src/lib/algorithms/solving/pathUtils.ts @@ -1,4 +1,4 @@ -import { MazeCell } from "@/lib/MazeCell"; +import { type MazeCell } from "@/lib/MazeCell"; export function buildPath( cameFrom: Map,