import { type ContextPlan, type ContextArea } from "./context.ts"; import { type StadiumConfigId } from "./stadiums.ts"; import type { OutsideOptions } from "./outside.ts"; import type { Pt } from "./crowd.ts"; import type { Language, SurfaceOptions } from "./types.ts"; import type { CircuitPlan } from "./circuits.ts"; import type { CircuitOptions } from "./circuits.types.ts"; /** How a district is fitted: `neighbours` tight round venues that stand close together, `city` at the real distances between venues that are kilometres apart. */ export type DistrictMode = "neighbours" | "city"; export declare const DISTRICT_MODES: readonly DistrictMode[]; /** A venue of a district: its key, and for a stadium the configuration it is drawn in (`cfl` or `soccer`; the first it has where none is given; a ballpark's is `mlb` and a hall's `boxing`). `"bc-place:soccer"` is the same as `{ id: "bc-place", config: "soccer" }`. */ export type DistrictVenueInput = string | { id: string; config?: StadiumConfigId; }; /** What can be asked of a district. */ export interface DistrictOptions { /** The venues, by key: any key of `VENUES` (the arenas) and `STADIUMS` (the stadiums); at least one, unless the district has a `circuit`. */ venues: readonly DistrictVenueInput[]; /** * A race circuit laid on the same ground (a key of `CIRCUIT_IDS`: `las-vegas`): its lap, pit lane, ground and pit building where OpenStreetMap maps them, under the venues, turned as it lies; in 3D its pit building and its turns' * numbers stand up and a lap that crosses itself stands its pass over on a bridge, as in the circuit's own view. Missing: no circuit. */ circuit?: string; /** `neighbours` (the default) or `city`. */ mode?: DistrictMode; /** How far the plan is turned, in degrees clockwise: 0 (the default) has north at the top; `"auto"` turns it so that the district's long way lies across the page. */ turn?: number | "auto"; /** Write each venue's name beside it. On for `city`, off for `neighbours`. */ labels?: boolean; language?: Language; theme?: "light" | "dark"; /** The prefix of the ids in the drawing, for a page with more than one. A hash of the options when missing. */ id?: string; /** `"none"` leaves the stylesheet out, as for every drawing. */ style?: "none"; /** Draw every venue's stands in 2D (true, the default) or its building only. */ stands?: boolean; /** Mark each venue's gates on the plan (`venueGates`: a door's bar on the building's outline and a dashed stub the way a queue runs). Off when left out. */ gates?: boolean; /** * The crowd outside the venues (`outside.ts`): `{ level: 25 }` puts a quarter of the seats' worth of people on the sidewalks, plazas and grounds round them, in the mounted views (`mountDistrict`, `mountDistrictTurn`). Off when left out. Asking * for it at all, even at level 0, makes room round the buildings for the crowd (`OUTSIDE_ROOM`), so that the plan does not move when the level does; only a district with a venue that has a walkable mask (`OUTSIDE_VENUES`) is changed. */ outside?: OutsideOptions; /** * The buildings round the venues, as areas of data a page passes in (`TOKYO_DOME_CITY` of `@johnmorrisdotca/kyogijo-stadiums/plateau`): low in detail, flat on the floor shaded by height and, for the biggest and the tallest, standing * in the 3D view. The frame is widened to take in the streets round the venues. None (the default) draws the district as it always was, and carries no data. The credit of each area goes into the description. */ context?: readonly ContextArea[]; /** * The building a raised venue stands in (the Kodokan's main dojo, on the 7th floor): `xray` (the default) draws it with its walls giving way to the eye as it looks in, `solid` draws it whole, `none` leaves it out, and the dojo floats on its floor * alone. Only a venue that stands in a building (`DistrictMember.shell`) is changed. */ building?: "xray" | "solid" | "none"; /** * The floor of the Kodokan's building to show, 0 (the basement) to 8: the 7th is the great dojo, the 8th its gallery, the 5th and 6th their dojos as the Kodokan's floor guide counts them, the others a plain floor plate; the chosen floor's plate is picked out * and what is drawn on the other floors is left out. Missing: the great dojo as it stands, on its floor, with nothing picked out. Only a venue that is a building of floors (`kodokan`) is changed. */ floor?: number; } /** A venue of a district as the district needs it: what it is called, where it stands, how it lies, and how it is drawn. */ export interface DistrictMember { /** The key of the venue and the configuration, unique in a district: `rogers-arena`, `bc-place:soccer`. */ key: string; id: string; kind: "arena" | "stadium" | "park" | "hall"; config?: StadiumConfigId; /** The name in both languages. */ name: { en: string; ja: string; }; /** The building's outline, `[longitude, latitude]`. */ ring: readonly (readonly [number, number])[]; /** The middle of the surface (the rink, the field): the point the venue's drawing is turned about. */ centre: readonly [number, number]; /** The heading of the surface's long side, degrees clockwise from north, 0 to under 180, and how it is known (`none` stands in 90). */ heading: number; basis: string; /** The seats of the drawing. */ seats: number; /** The options the venue is drawn from. */ options: SurfaceOptions; /** How high the venue's floor stands above the ground, in feet: the Kodokan's main dojo is on the 7th floor of its building, drawn in the air on its real floor. Missing: on the ground. */ elevation?: number; /** The building the venue stands in, when the district draws it (`building`): its outline is `ring`, and its height in feet and storeys are these. */ shell?: { height: number; storeys: number; }; /** The credit of data this venue is made from that is not OpenStreetMap's (the Kodokan's building: Project PLATEAU). */ attribution?: { en: string; ja: string; }; /** * What is drawn inside the venue, when it is not one surface: the rooms of a floor of a building (the Kodokan's 5th and 6th floors have two or three dojos), each its own surface with its own place. Missing: the venue's one surface, `options` * at `centre` turned `heading`. An empty list draws no surface at all (a floor of plain rooms). */ parts?: DistrictPart[]; /** The floor of the building the venue is drawn at, and the height of its level above the ground in feet: the building's plate at that level is drawn in 3D, picked out from the see-through walls. */ plate?: { floor: number; level: number; }; /** Every floor of the building with the height of its level in feet, and how thick a floor is in metres: each is drawn as a slab with an edge, the chosen one (`plate`) picked out and the rest faint. */ slabs?: { floor: number; level: number; }[]; slabThickness?: number; } /** One surface of a venue that has several (`DistrictMember.parts`): what it is drawn from, where it stands, how it lies and how high its floor is. */ export interface DistrictPart { key: string; options: SurfaceOptions; /** The middle of the surface, \`[longitude, latitude]\`. */ centre: readonly [number, number]; /** The compass heading of the surface's x axis, 0 to under 180. */ heading: number; /** How high its floor stands above the ground, in feet. */ elevation?: number; /** Which part of the surface's room is drawn: `room` (the floor, the walls and what stands on it, not the gallery over it) or `gallery` (what stands above the room's walls: the seats, the rail, the roof). Everything when missing. */ show?: "room" | "gallery"; } /** Every key a district can be asked for: the arenas of `VENUES` and the stadiums of `STADIUMS`. */ export declare const DISTRICT_IDS: readonly string[]; /** Whether a key is a venue a district can place. */ export declare const isDistrictId: (id: string) => boolean; /** * A venue of a district, from its key: `rogers-arena` (an arena), `bc-place` or `bc-place:soccer` (a stadium in its first configuration or the one named). Throws for a key no venue has, and says which keys there are. * @example * ```ts * import { districtMember } from "@johnmorrisdotca/kyogijo-stadiums/district"; * const member = districtMember("bc-place:soccer"); * console.log(member.key, member.kind, member.seats); * // bc-place:soccer stadium 52497 * ``` */ export declare function districtMember(input: DistrictVenueInput, language?: Language, floor?: number): DistrictMember; /** * The outline of a venue's building, as `districtMember(input).ring` has it, read without the venue's records: a crowd outside keeps out of every building the ground has, and the buildings of venues that are not shown need no names. * Throws as `districtMember` does for a key no venue has. */ export declare function districtRing(input: DistrictVenueInput): DistrictMember["ring"]; /** Turn a point of the map (east, down the page) by `degrees` clockwise on the page. */ export declare const turnBy: ([x, y]: Pt, degrees: number) => Pt; /** A venue placed in the district: where its surface's middle is, how far its drawing is turned, and where its building stands, all in feet in the district's frame (x to the right, y down the page). */ export interface PlacedPart { part: DistrictPart; /** The middle of the surface, and the degrees its drawing is turned clockwise, as for the venue's own. */ at: Pt; angle: number; } export interface DistrictPlaced { member: DistrictMember; /** The middle of the surface. */ at: Pt; /** The degrees the venue's own drawing (its field along x) is turned clockwise to lie as it does in the world. */ angle: number; /** The surfaces of the venue as the plan places them (one, unless the venue has `parts`). */ parts: PlacedPart[]; /** The building's outline. */ footprint: Pt[]; /** Its convex hull, which the depth order of the 3D view separates buildings by. */ hull: Pt[]; } /** A gate placed in a district: where it is on its venue's outline in the plan's frame, in feet, and the way it faces on the page, in degrees clockwise from the top. */ export interface DistrictGate { key: string; venue: string; name: { en: string; ja: string; }; at: Pt; angle: number; basis: "documented" | "plausible"; } /** A circuit placed in a district: its own plan (feet round its own middle, its long side along x), and where that middle is put and how far the plan is turned to lie as it does in the world. */ export interface DistrictCircuit { plan: CircuitPlan; /** Where the circuit's own origin (the middle of its plan) is in the district's frame, in feet. */ at: Pt; /** The degrees the circuit's plan is turned clockwise to lie in the district (its heading less a quarter turn, and the map's turn). */ angle: number; /** The outline of everything it draws on the ground (its plan's box), and of its pit building, in the district's frame. */ footprint: Pt[]; building?: Pt[]; } /** A point of a circuit's own plan (feet, `circuitPlan`) where the district puts it: for a page that draws something on the lap (a race's cars) in a district's frame. */ export declare function circuitPointIn(placed: Pick, p: Pt): Pt; /** What a district is: its venues placed, the box that fits them, and how the map lies. */ export interface DistrictPlan { options: DistrictOptions; mode: DistrictMode; /** The degrees the map is turned clockwise (0 has north at the top). */ turn: number; /** The way north points on the page, degrees clockwise from the top. */ north: number; members: DistrictPlaced[]; /** The buildings round the venues that the options' `context` brings, placed in the frame; `undefined` without it. */ context: ContextPlan | undefined; /** The gates of the venues, where the options ask for them: each on its building's outline in the plan's frame (feet), and the way it faces on the page. Empty otherwise. */ gates: DistrictGate[]; /** The frame the plan is drawn in, in feet: the venues' buildings with the margin the mode gives them. */ view: { x: number; y: number; w: number; h: number; }; /** The distance between each pair of surfaces' middles, in metres, as the ground gives it. */ between: { a: string; b: string; metres: number; }[]; /** The `[longitude, latitude]` the plan's metres are measured from: the middle of the venues' surfaces (and of the circuit's plan, where there is one). */ origin: readonly [number, number]; /** The circuit on the ground, where the options name one. */ circuit?: DistrictCircuit; } /** The margin round the buildings, as a share of the longer side of the district: tight for neighbours, wide for a city's grid and names. */ export declare const DISTRICT_MARGIN: Readonly>; /** The ground kept round the buildings for the crowd outside, in metres, when a district asks for one. */ export declare const OUTSIDE_ROOM = 160; /** * The plan of a district: each venue's surface placed where it is on the ground (the distance and the direction between middles come from the coordinates of OpenStreetMap's outlines, to a metre or so) and turned so * that its long side points where it does in the world, and the frame that fits them. A venue whose orientation is not known (an arena the building gives no axis for) is placed with its rink east-west, as it is drawn alone. * @example * ```ts * import { planDistrict } from "@johnmorrisdotca/kyogijo-stadiums/district"; * const plan = planDistrict({ venues: ["bc-place", "rogers-arena"] }); * console.log(plan.mode, plan.members.length, Math.round(plan.between[0].metres)); * // neighbours 2 264 * ``` */ export declare function planDistrict(options: DistrictOptions): DistrictPlan; /** The colours and the type of a district's drawing, light and dark. Defaults sit in `:where()`, so a page's own rule wins. */ export declare const KYOGIJO_DISTRICT_STYLE = "\n:where(.ky-district){--ky-dist-ground:#e1e4da;--ky-dist-grid:rgba(40,46,42,.16);--ky-dist-ink:#1f2320;--ky-dist-halo:rgba(255,255,255,.9);--ky-dist-people:#c2410c;--ky-dist-b0:#d1d4cb;--ky-dist-b1:#c3c7be;--ky-dist-b2:#b2b7ae;--ky-dist-b3:#9ea49b;--ky-dist-bline:rgba(40,46,42,.28);--ky-dist-road:#cbcfc4;--ky-dist-deck:#bdc2b7;--ky-dist-walk:#eef0e8;--ky-dist-rail:#8b9288;--ky-dist-gate:#1f5fa8;--ky-dist-water:#c7d5dc;--ky-dist-green:#d2dcc4;--ky-dist-wood:#c3d0b6;--ky-dist-tree:#b3c2a3;--ky-dist-floor:#2f6db0}\n@media (prefers-color-scheme:dark){:where(html:not([data-theme=light]) .ky-district:not([data-theme=light])){--ky-dist-ground:#1b2025;--ky-dist-grid:rgba(220,226,220,.16);--ky-dist-ink:#e8ece8;--ky-dist-halo:rgba(14,18,16,.85);--ky-dist-people:#fbbf24;--ky-dist-b0:#262c31;--ky-dist-b1:#2e353b;--ky-dist-b2:#394148;--ky-dist-b3:#474f57;--ky-dist-bline:rgba(220,226,220,.22);--ky-dist-road:#2b3239;--ky-dist-deck:#353d45;--ky-dist-walk:#242b31;--ky-dist-rail:#5b646c;--ky-dist-gate:#7fb2ee;--ky-dist-water:#1c2d3b;--ky-dist-green:#202d26;--ky-dist-wood:#1c2b23;--ky-dist-tree:#2e4337;--ky-dist-floor:#7fb0e8}}\n:where(html[data-theme=dark] .ky-district,.ky-district[data-theme=dark]){--ky-dist-ground:#1b2025;--ky-dist-grid:rgba(220,226,220,.16);--ky-dist-ink:#e8ece8;--ky-dist-halo:rgba(14,18,16,.85);--ky-dist-people:#fbbf24;--ky-dist-b0:#262c31;--ky-dist-b1:#2e353b;--ky-dist-b2:#394148;--ky-dist-b3:#474f57;--ky-dist-bline:rgba(220,226,220,.22);--ky-dist-road:#2b3239;--ky-dist-deck:#353d45;--ky-dist-walk:#242b31;--ky-dist-rail:#5b646c;--ky-dist-gate:#7fb2ee;--ky-dist-water:#1c2d3b;--ky-dist-green:#202d26;--ky-dist-wood:#1c2b23;--ky-dist-tree:#2e4337;--ky-dist-floor:#7fb0e8}\n.ky-district .ky-dist-ground{fill:var(--ky-dist-ground)}\n.ky-district .ky-dist-grid{fill:none;stroke:var(--ky-dist-grid);stroke-width:1}\n.ky-district .ky-dist-block{stroke:var(--ky-dist-bline);stroke-width:.5;stroke-linejoin:round}\n.ky-district .ky-dist-b0{fill:var(--ky-dist-b0)}\n.ky-district .ky-dist-b1{fill:var(--ky-dist-b1)}\n.ky-district .ky-dist-b2{fill:var(--ky-dist-b2)}\n.ky-district .ky-dist-b3{fill:var(--ky-dist-b3)}\n.ky-district .ky-dist-street{stroke-linejoin:round;stroke-linecap:butt}\n.ky-district .ky-dist-street-0{stroke:var(--ky-dist-road)}\n.ky-district .ky-dist-street-1{stroke:var(--ky-dist-deck)}\n.ky-district .ky-dist-street-2{stroke:var(--ky-dist-rail);stroke-dasharray:6 3}\n.ky-district .ky-dist-street-3{stroke:var(--ky-dist-walk)}\n.ky-district .ky-dist-land{stroke:none}\n.ky-district .ky-dist-water{fill:var(--ky-dist-water)}\n.ky-district .ky-dist-green{fill:var(--ky-dist-green)}\n.ky-district .ky-dist-wood{fill:var(--ky-dist-wood)}\n.ky-district .ky-dist-tree{fill:none;stroke:var(--ky-dist-tree);stroke-linecap:round}\n.ky-district .ky-dist-jet{fill:none;stroke:var(--ky-dist-halo);stroke-linecap:round}\n.ky-district .ky-dist-gate rect{fill:var(--ky-dist-gate);stroke:var(--ky-dist-gate);stroke-width:2.4}\n.ky-district .ky-dist-gate-plausible rect{fill:var(--ky-dist-ground);fill-opacity:.85}\n.ky-district .ky-dist-gate-queue{fill:none;stroke:var(--ky-dist-gate);stroke-width:3;stroke-dasharray:9 7}\n.ky-district .ky-dist-ghost{fill:var(--ky-dist-b1);fill-opacity:.35}\n.ky-district .ky-dist-floor{stroke:var(--ky-dist-floor);stroke-width:2}\n.ky-district .ky-dist-ink{fill:none;stroke:var(--ky-dist-ink);stroke-linecap:round;stroke-linejoin:round}\n.ky-district .ky-dist-text{fill:var(--ky-dist-ink);font-family:var(--ky-font,system-ui,-apple-system,\"Segoe UI\",\"Hiragino Sans\",\"Noto Sans JP\",sans-serif);font-weight:600;paint-order:stroke;stroke:var(--ky-dist-halo);stroke-linejoin:round}"; /** * A venue's drawing as a part of the district's: its root made a nested `svg` that keeps the class, the sport and the colours the drawing's stylesheet reads, its box laid in its own frame (so that the group's turn * and shift put it in place), and its title, description, apron, arrow and stylesheet taken out (the stylesheet is given back in `styles`). */ export declare function nestedDrawing(svg: string): { markup: string; box: { x: number; y: number; w: number; h: number; }; styles: string[]; }; /** The point of a venue's own drawing the district puts at the venue's place on the ground and turns it about: the middle of its surface (the box the stands are laid round), or home plate, the origin of a ballpark's frame. */ export declare function surfaceCentre(options: SurfaceOptions): Pt; /** A length in metres worth drawing as a scale: the largest of 50, 100, 200, 500, 1000, 2000, 5000 that is not more than a fifth of the plan's width. */ export declare function scaleOf(view: { w: number; }): number; /** The distance a scale says, as it is read: metres under a kilometre, else kilometres. */ export declare const metresText: (metres: number) => string; /** The id of a district's drawing: the option's, or a hash of the options. */ export declare const districtId: (options: DistrictOptions) => string; /** The title and the description of a district, in its language: what is drawn, where each venue stands from the first, how far apart they are, and the credit. */ export declare function describeDistrict(options: DistrictOptions, plan?: DistrictPlan): { title: string; description: string; }; /** How a venue is drawn for a district: its own options with the district's language, theme and ids, in 2D with its stands or as the floor of the 3D view (its building only). */ export declare function drawMember(member: DistrictMember, options: DistrictOptions, index: number, id: string, how?: { floor?: boolean; }, partIndex?: number): string; /** * The plan of a district as one SVG: the ground, a grid and a scale, a north arrow, and each venue's own drawing (its stands, or its building only for `stands: false`) put where it stands and turned as it lies, with a name beside each * where `labels` says. `drawing` is how each venue is drawn; the 3D view gives it the building-only floor. * @example * ```ts * import { drawDistrict } from "@johnmorrisdotca/kyogijo-stadiums/district"; * const svg = drawDistrict({ venues: ["bc-place", "rogers-arena"] }); * console.log(svg.includes("ky-district"), svg.includes("ky-cr-shell")); * // true true * ``` */ export declare function drawDistrict(options: DistrictOptions, plan?: DistrictPlan, drawing?: (member: DistrictMember, index: number, part: number) => string): string; /** The options a district's circuit is drawn from: the circuit's own drawing in the district's language and theme, without its frame, and for the floor of the 3D view without its turns' numbers (they stand up). */ export declare function circuitInDistrict(options: DistrictOptions, id: string, floor: boolean): CircuitOptions; /** The venues a district was asked for that the package has no key for: none when it can be drawn. */ export declare const unknownVenues: (venues: readonly DistrictVenueInput[]) => string[];