import { type Hall, type HallSurface } from "./halls.ts"; import type { PlaceAlias } from "./names.ts"; import type { BudoSport, BudoStyle, DojoSpec } from "./types.ts"; import type { Tenant, TenantSport } from "./tenants.ts"; /** What a place is: a ballpark (of `PARKS`), a soccer ground (of `GROUNDS`), a hall of the budō (of `HALLS`: a dojo, an arena, a sumo hall) or a hockey and basketball arena (of `ARENAS`). */ export type PlaceKind = "park" | "ground" | "hall" | "arena"; /** The sport a place is drawn for: baseball parks have a fence, soccer grounds a pitch, the halls of the budō (`budo`) the mats, the dohyō or the range of their sports, and arenas an ice rink (`hockey`) and a court (`basketball`). */ export type PlaceSport = "baseball" | "soccer" | "budo" | "hockey" | "basketball"; /** `current` is a ground a club or a competition uses today, `past` one it has left, closed or pulled down. */ export type PlaceStatus = "current" | "past"; /** One place on the atlas: a ballpark or a soccer ground, with where it is and when it was in use. */ export interface Place { /** The key in `PARKS` or in `GROUNDS` (`fenway-park`, `maracana`): unique across both. */ id: string; kind: PlaceKind; /** The everyday name in English. */ name: string; /** The everyday name in Japanese. */ nameJa: string; /** The reading of `nameJa` in kana, where it has kanji. */ readingJa?: string; /** The everyday name in the language of the place, where it is not English. */ localName?: string; localLanguage?: string; /** Every other name: the cited titles of Wikipedia, the official, sponsor and former names with their years, the nicknames; `placeByName` and the `text` of `placesBy` read them. */ aliases: readonly PlaceAlias[]; /** The names the place had for some years (a ground that was given another name for a World Cup), first to last. */ names?: readonly { name: string; from: number; to: number; }[]; /** The sport it is first drawn for: a park's is baseball, a ground's soccer, an arena's hockey where an ice hockey club played there, else basketball. */ sport: PlaceSport; /** Every sport it is drawn for: a park's and a ground's is its `sport` alone, an arena's is `hockey`, `basketball` or both (`TD Garden`), by the clubs that played there. */ sports: readonly PlaceSport[]; /** The leagues and competitions it is known for: the leagues of the park's club and of every club that has played its home matches there (`CFL` and `MLS` for BC Place, `MLB` and `CFL` for Montreal's Olympic Stadium), then the World Cups it staged (`FIFA World Cup`, `FIFA Women's World Cup`). A ground with no tenant that staged none has none. */ leagues: readonly string[]; /** The clubs that play, or played, their home matches there, with the league and the years of each (see `tenantsOf`): the current ones first. A place no club is known to have called home has none. */ tenants: readonly Tenant[]; /** ISO 3166-1 alpha-2: `US`. */ country: string; city: string; /** The club that plays in a park (`Boston Red Sox`); soccer grounds and arenas have none (see `tenants`). */ team?: string; /** Wikidata's coordinates (P625, CC0), in degrees. */ lat: number; lon: number; status: PlaceStatus; /** The first year it was in use: a past MLB park's first MLB season, else the year it opened. Not given where Wikidata and the article do not give it. */ from?: number; /** The last year it was in use: a past MLB park's last MLB season, else the year it closed. A current place has none. */ to?: number; /** The Wikidata item (`Q49136`): the key to join a place to other data. */ wikidata: string; /** A hall of the budō (`kind: "hall"`): what it holds, how it came to be and the surfaces it offers (see `HALLS`). */ hall?: Hall; /** True where Wikidata lists athletics among the sports of a soccer ground: a running track lies round its pitch (`drawKyogijo({ sport: "athletics", ground })`). Absent where Wikidata says nothing of it. */ track?: boolean; } /** What `placesBy` keeps: every field given must match. A list matches any of its members. */ export interface PlaceFilter { /** A sport a place is drawn for: an arena is found by `hockey` and by `basketball` if clubs of both played there. */ sport?: PlaceSport | readonly PlaceSport[]; kind?: PlaceKind | readonly PlaceKind[]; /** A league or competition from `Place.leagues`: a tenant's league (`CFL`) or a tournament. */ league?: string | readonly string[]; /** ISO 3166-1 alpha-2. */ country?: string | readonly string[]; status?: PlaceStatus | readonly PlaceStatus[]; /** Keep the places in use in this year. A year that is not known for a place (no `from`, no `to`) does not shut it out. */ year?: number; /** Words to find in any name (the everyday names, the aliases, the readings), the city or the club, or the name of a club that plays or played there (in English or in Japanese), ignoring case, accents, width and, in Japanese, hiragana or katakana; every word must be found. */ text?: string; } export declare const PLACES: readonly Place[]; /** The place with a key, or `undefined`. */ export declare const placeById: (id: string | undefined) => Place | undefined; /** * The places that answer to a name, best match first: the everyday names, then the official and cited names and the sponsors', then the former names and the nicknames. The comparison * ignores case, accents, spaces and punctuation, width, and in Japanese hiragana or katakana and the long vowel mark. * @example * ```ts * import { placeByName, placesByName } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * console.log(placeByName("Koshien Stadium")?.id, placeByName("サン・シーロ")?.id, placeByName("Estadio Jornalista Mario Filho")?.id, placesByName("wrigley field").map((place) => place.id).join()); * // hanshin-koshien-stadium san-siro maracana wrigley-field,wrigley-field-los-angeles * ``` */ export declare const placesByName: (name: string | undefined) => Place[]; /** The place a name belongs to (see `placesByName`; the best match when several answer to it), or `undefined`. */ export declare const placeByName: (name: string | undefined) => Place | undefined; /** * The places that match every field of the filter, in the order of `PLACES`. * @example * ```ts * import { placesBy } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * const japan = placesBy({ sport: "baseball", country: "JP", status: "current" }); * const in1950 = placesBy({ year: 1950, country: "US" }); * console.log(japan.length, in1950.some((place) => place.id === "ebbets-field")); * // 14 true * ``` */ export declare function placesBy(filter?: PlaceFilter): Place[]; /** What the places hold, for the controls of a page: each list sorted, the years as far as the data gives them. */ export interface AtlasFacets { sports: PlaceSport[]; leagues: string[]; countries: string[]; /** The first and the last year any place gives (`from` or `to`). */ years: { min: number; max: number; }; } /** * The sports, leagues and countries of the places, and the span of years they give. * @example * ```ts * import { atlasFacets } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * const { sports, leagues, countries, years } = atlasFacets(); * console.log(sports.join(), leagues.length, leagues.includes("CFL"), countries.length, years.min); * // baseball,basketball,budo,hockey,soccer 90 true 23 1877 * ``` */ export declare function atlasFacets(): AtlasFacets; /** The options `drawKyogijo` takes to draw a surface a place offers. */ export type PlaceSurface = { sport: BudoSport; league?: string; budo?: BudoStyle; dojo?: DojoSpec; } | { sport: "mlb"; park: string; } | { sport: "soccer"; ground?: string; } | { sport: "nhl" | "nba"; arena?: string; } | { sport: "nfl" | "cfl" | "afl" | "cricket"; } | { sport: "rugby"; league?: "nrl"; }; /** The sports `surfaceOf` can be asked for. */ export type SurfaceSport = PlaceSurface["sport"]; /** * Every surface a hall of the budō offers, each with its name, how much of it is documented (`basis`) and the options that draw it, in the order of the hall's own list. A place that is not a hall has none. * @example * ```ts * import { hallSurfaces, placeById } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * console.log(hallSurfaces(placeById("kodokan")!).map((surface) => `${surface.id} ${surface.mats}`).join()); * // main-dojo 420,main-dojo-earlier 420,school-dojo 240,international-dojo 192,womens-dojo 240,boys-dojo 114 * ``` */ export declare const hallSurfaces: (place: Place) => readonly HallSurface[]; /** * Every surface a place offers, the place's own first: a park's fence (`mlb` with the park) or a ground's pitch at its size (`soccer` with the ground), then one for each * sport a tenant plays that the package draws (a CFL field for BC Place, an NFL field for MetLife Stadium, the rugby league field for Stadium Australia), each once. A ground * offers no ballpark, since its fence is not known; a park that a soccer club has played in offers the pitch at the international size, since its length and width are not known. * @example * ```ts * import { placeById, surfacesOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * console.log(surfacesOf(placeById("bc-place")!).map((surface) => surface.sport).join()); * // soccer,cfl * ``` */ export declare function surfacesOf(place: Place): PlaceSurface[]; /** * The options `drawKyogijo` takes to draw a place's surface. With no sport, the place's own: a park's fence or a ground's pitch at its own size. With a sport (the `sport` of * `drawKyogijo`: `cfl`, `nfl`, `mlb`, `soccer`, `nba`, `nhl`, `rugby`, `afl`, `cricket`), the surface the place offers for it (`surfacesOf`), or `undefined` when no club that plays * that sport has played there: `surfaceOf(bcPlace, "cfl")` is `{ sport: "cfl" }` and `surfaceOf(fenwayPark, "cfl")` is `undefined`. * @example * ```ts * import { placeById, surfaceOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * const bcPlace = placeById("bc-place")!; * console.log(surfaceOf(bcPlace), surfaceOf(bcPlace, "cfl"), surfaceOf(bcPlace, "mlb")); * // { sport: 'soccer', ground: 'bc-place' } { sport: 'cfl' } undefined * ``` */ export declare function surfaceOf(place: Place): { sport: "mlb"; park: string; } | { sport: "soccer"; ground: string; } | { sport: "nhl" | "nba"; arena: string; } | PlaceSurface; export declare function surfaceOf(place: Place, sport: SurfaceSport): PlaceSurface | undefined; /** What `tenantsOf` keeps: every field given must match. */ export interface TenantFilter { /** Keep the clubs that played there in this year. A bound the data does not give does not shut a club out. */ year?: number; league?: string | readonly string[]; sport?: TenantSport | readonly TenantSport[]; /** `true` keeps the clubs that play there still (no last year), `false` those that have left. */ current?: boolean; } /** * The clubs that play, or played, their home matches in a place, the current ones first (by the year they came) and then those that have left (the latest to leave first). * Give a place, or its key. * @example * ```ts * import { placeById, tenantsOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * const expos = tenantsOf("olympic-stadium-montreal").map((t) => `${t.club} (${t.league}) ${t.from}-${t.to ?? ""}`); * console.log(expos[0], tenantsOf(placeById("bc-place")!, { current: true }).map((t) => t.club).join(", ")); * // Montreal Expos (MLB) 1977-2004 BC Lions, Vancouver Whitecaps FC * ``` */ export declare function tenantsOf(place: Place | string | undefined, filter?: TenantFilter): Tenant[]; /** * The places a club plays, or played, its home matches in, best match first: a club whose name is the one given (ignoring case, accents, spaces and punctuation, width, and in * Japanese hiragana or katakana), then a club whose name has every word given in it (`whitecaps`, `lions`, `ライオンズ`); the names are the club's in English and in Japanese. * @example * ```ts * import { placesByClub } from "@johnmorrisdotca/kyogijo-stadiums/atlas"; * console.log(placesByClub("BC Lions").map((place) => place.id).join(), placesByClub("Montreal Expos").map((place) => place.id).join()); * // bc-place jarry-park-stadium,olympic-stadium-montreal * ``` */ export declare function placesByClub(name: string | undefined): Place[];