// F8-10 planets table — module-level filter / sort rune. // // Held outside the component so the user's filter selections survive // the component being unmounted (e.g. row click → map → back to the // table). Held in memory only; an F5 reloads the report and the // defaults take over. export type PlanetSortColumn = | "number" | "name" | "kind" | "owner" | "size" | "resources"; export type PlanetSortDirection = "asc" | "desc"; export interface PlanetsTableState { sortColumn: PlanetSortColumn; sortDirection: PlanetSortDirection; showLocal: boolean; showOther: boolean; showUninhabited: boolean; showUnknown: boolean; ownerFilter: string; } const DEFAULT_STATE: PlanetsTableState = { sortColumn: "number", sortDirection: "asc", showLocal: true, showOther: true, showUninhabited: true, showUnknown: true, ownerFilter: "", }; export const planetsTableState: PlanetsTableState = $state({ ...DEFAULT_STATE }); /** * resetPlanetsTableState restores every field to its default value. * Production code never calls it; the Vitest harness uses it from * `beforeEach` to keep cases independent (the rune is a module-level * singleton that otherwise carries state across test boundaries). */ export function resetPlanetsTableState(): void { Object.assign(planetsTableState, DEFAULT_STATE); }