@johnmorrisdotca/kyogijo-stadiums 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/NOTICE.md +4 -0
- package/README.md +71 -16
- package/dist/annotate.js +1 -1
- package/dist/athletics/describe.d.ts +8 -0
- package/dist/athletics/describe.js +41 -0
- package/dist/athletics/events.d.ts +17 -0
- package/dist/athletics/events.js +48 -0
- package/dist/athletics/facilities.d.ts +80 -0
- package/dist/athletics/facilities.js +176 -0
- package/dist/athletics/infield.d.ts +79 -0
- package/dist/athletics/infield.js +166 -0
- package/dist/athletics/layout.d.ts +13 -0
- package/dist/athletics/layout.js +98 -0
- package/dist/athletics/oval.d.ts +57 -0
- package/dist/athletics/oval.js +116 -0
- package/dist/athletics/plan.d.ts +97 -0
- package/dist/athletics/plan.js +355 -0
- package/dist/athletics/races.d.ts +102 -0
- package/dist/athletics/races.js +355 -0
- package/dist/athletics/steeplechase.d.ts +72 -0
- package/dist/athletics/steeplechase.js +196 -0
- package/dist/athletics/stencil.d.ts +13 -0
- package/dist/athletics/stencil.js +85 -0
- package/dist/athletics/track.d.ts +54 -0
- package/dist/athletics/track.js +105 -0
- package/dist/athletics/types.d.ts +77 -0
- package/dist/athletics/types.js +1 -0
- package/dist/athletics-entry.d.ts +17 -0
- package/dist/athletics-entry.js +11 -0
- package/dist/athletics.style.d.ts +16 -0
- package/dist/athletics.style.js +51 -0
- package/dist/atlas-entry.d.ts +4 -2
- package/dist/atlas-entry.js +3 -2
- package/dist/atlas.d.ts +83 -7
- package/dist/atlas.js +108 -8
- package/dist/charts-entry.d.ts +6 -1
- package/dist/charts-entry.js +3 -0
- package/dist/charts.athletics.d.ts +183 -0
- package/dist/charts.athletics.js +455 -0
- package/dist/charts.curling.heat.d.ts +24 -0
- package/dist/charts.curling.heat.js +116 -0
- package/dist/charts.curling.js +14 -3
- package/dist/charts.pool.d.ts +67 -0
- package/dist/charts.pool.js +76 -0
- package/dist/charts.skating.d.ts +204 -0
- package/dist/charts.skating.js +426 -0
- package/dist/charts.types.d.ts +53 -1
- package/dist/court.d.ts +85 -2
- package/dist/court.js +102 -7
- package/dist/court.more.d.ts +46 -0
- package/dist/court.more.js +219 -0
- package/dist/courts.style.d.ts +14 -2
- package/dist/courts.style.js +51 -4
- package/dist/crowd.d.ts +154 -0
- package/dist/crowd.draw.d.ts +17 -0
- package/dist/crowd.draw.js +198 -0
- package/dist/crowd.js +465 -0
- package/dist/crowd.park.d.ts +19 -0
- package/dist/crowd.park.js +153 -0
- package/dist/curling.stats.d.ts +271 -0
- package/dist/curling.stats.js +301 -0
- package/dist/draw.d.ts +16 -0
- package/dist/draw.js +318 -35
- package/dist/element-entry.d.ts +1 -1
- package/dist/element-entry.js +1 -1
- package/dist/element.d.ts +13 -2
- package/dist/element.js +77 -3
- package/dist/features.js +131 -0
- package/dist/fields.kit.d.ts +2 -2
- package/dist/fields.types.d.ts +18 -4
- package/dist/frames.providers.js +63 -8
- package/dist/geojson.js +3 -0
- package/dist/geometry-entry.d.ts +2 -1
- package/dist/geometry-entry.js +2 -1
- package/dist/geometry.d.ts +20 -0
- package/dist/geometry.js +78 -1
- package/dist/grounds.d.ts +4 -0
- package/dist/grounds.data.js +12 -0
- package/dist/hardwood.d.ts +31 -0
- package/dist/hardwood.js +157 -0
- package/dist/heat.js +4 -3
- package/dist/heat.types.d.ts +5 -0
- package/dist/heat.zones.d.ts +2 -2
- package/dist/heat.zones.js +154 -6
- package/dist/homeside.js +17 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +10 -1
- package/dist/layers.d.ts +1 -1
- package/dist/layers.env.d.ts +3 -1
- package/dist/layers.env.js +4 -2
- package/dist/layers.js +4 -4
- package/dist/leagues/athletics.d.ts +63 -0
- package/dist/leagues/athletics.js +87 -0
- package/dist/leagues/courts.d.ts +269 -4
- package/dist/leagues/courts.js +155 -1
- package/dist/leagues/skating.d.ts +145 -0
- package/dist/leagues/skating.js +73 -0
- package/dist/leagues/sources.js +20 -0
- package/dist/leagues/types.d.ts +1 -1
- package/dist/leagues-entry.d.ts +4 -2
- package/dist/leagues-entry.js +2 -1
- package/dist/leagues.d.ts +14 -4
- package/dist/leagues.js +146 -5
- package/dist/look.d.ts +3 -3
- package/dist/look.js +39 -6
- package/dist/outline.d.ts +1 -1
- package/dist/outline.js +30 -2
- package/dist/pageant.d.ts +120 -0
- package/dist/pageant.draw.d.ts +21 -0
- package/dist/pageant.draw.js +171 -0
- package/dist/pageant.js +207 -0
- package/dist/pageant.style.d.ts +8 -0
- package/dist/pageant.style.js +42 -0
- package/dist/png.d.ts +8 -1
- package/dist/png.js +21 -1
- package/dist/pool.d.ts +176 -0
- package/dist/pool.figures.d.ts +304 -0
- package/dist/pool.figures.js +144 -0
- package/dist/pool.js +304 -0
- package/dist/pool.kit.d.ts +48 -0
- package/dist/pool.kit.js +141 -0
- package/dist/pool.labels.d.ts +20 -0
- package/dist/pool.labels.js +257 -0
- package/dist/pool.race.d.ts +65 -0
- package/dist/pool.race.js +140 -0
- package/dist/pool.replay.d.ts +46 -0
- package/dist/pool.replay.js +127 -0
- package/dist/pool.section.d.ts +13 -0
- package/dist/pool.section.js +83 -0
- package/dist/pool.style.d.ts +20 -0
- package/dist/pool.style.js +169 -0
- package/dist/pool.types.d.ts +145 -0
- package/dist/pool.types.js +3 -0
- package/dist/pool.words.d.ts +13 -0
- package/dist/pool.words.js +101 -0
- package/dist/ranges.names.js +47 -3
- package/dist/replay-entry.d.ts +3 -0
- package/dist/replay-entry.js +2 -0
- package/dist/restyle.js +1 -1
- package/dist/score.js +70 -5
- package/dist/sheet.d.ts +3 -0
- package/dist/sheet.js +7 -3
- package/dist/skating/describe.d.ts +7 -0
- package/dist/skating/describe.js +44 -0
- package/dist/skating/events.d.ts +24 -0
- package/dist/skating/events.js +47 -0
- package/dist/skating/figure.d.ts +24 -0
- package/dist/skating/figure.js +37 -0
- package/dist/skating/long.d.ts +54 -0
- package/dist/skating/long.js +111 -0
- package/dist/skating/parts.d.ts +43 -0
- package/dist/skating/parts.js +40 -0
- package/dist/skating/plan.d.ts +55 -0
- package/dist/skating/plan.js +197 -0
- package/dist/skating/short.d.ts +47 -0
- package/dist/skating/short.js +89 -0
- package/dist/skating/track.d.ts +66 -0
- package/dist/skating/track.js +94 -0
- package/dist/skating/types.d.ts +57 -0
- package/dist/skating/types.js +3 -0
- package/dist/skating-entry.d.ts +17 -0
- package/dist/skating-entry.js +11 -0
- package/dist/skating.style.d.ts +4 -0
- package/dist/skating.style.js +24 -0
- package/dist/strings.d.ts +296 -0
- package/dist/strings.js +328 -11
- package/dist/style.d.ts +2 -0
- package/dist/style.js +11 -1
- package/dist/surfaces/artistic.d.ts +9 -0
- package/dist/surfaces/artistic.js +94 -0
- package/dist/surfaces/athletics.d.ts +16 -0
- package/dist/surfaces/athletics.js +132 -0
- package/dist/surfaces/baseball.js +15 -0
- package/dist/surfaces/basketball.floor.d.ts +27 -0
- package/dist/surfaces/basketball.floor.js +83 -0
- package/dist/surfaces/basketball.gear.d.ts +27 -0
- package/dist/surfaces/basketball.gear.js +90 -0
- package/dist/surfaces/basketball.js +43 -21
- package/dist/surfaces/curling.d.ts +16 -0
- package/dist/surfaces/curling.fold.d.ts +67 -0
- package/dist/surfaces/curling.fold.js +107 -0
- package/dist/surfaces/curling.js +37 -3
- package/dist/surfaces/dive.d.ts +9 -0
- package/dist/surfaces/dive.js +128 -0
- package/dist/surfaces/field.d.ts +7 -2
- package/dist/surfaces/field.js +15 -9
- package/dist/surfaces/hockey.js +1 -0
- package/dist/surfaces/net.d.ts +2 -1
- package/dist/surfaces/net.js +160 -15
- package/dist/surfaces/polo.d.ts +12 -0
- package/dist/surfaces/polo.js +159 -0
- package/dist/surfaces/pool.d.ts +27 -0
- package/dist/surfaces/pool.js +198 -0
- package/dist/surfaces/skating.d.ts +6 -0
- package/dist/surfaces/skating.js +62 -0
- package/dist/surfaces/soccer.js +2 -1
- package/dist/surfaces/surface.d.ts +44 -0
- package/dist/surfaces/venue.d.ts +15 -0
- package/dist/surfaces/venue.js +95 -0
- package/dist/tenants.d.ts +77 -0
- package/dist/tenants.data.d.ts +8 -0
- package/dist/tenants.data.js +945 -0
- package/dist/tenants.js +46 -0
- package/dist/turn-entry.d.ts +12 -0
- package/dist/turn-entry.js +7 -0
- package/dist/turn.camera.d.ts +105 -0
- package/dist/turn.camera.js +168 -0
- package/dist/turn.dom.d.ts +40 -0
- package/dist/turn.dom.js +351 -0
- package/dist/turn.kit.d.ts +86 -0
- package/dist/turn.kit.js +110 -0
- package/dist/turn.markup.d.ts +48 -0
- package/dist/turn.markup.js +108 -0
- package/dist/turn.model.d.ts +78 -0
- package/dist/turn.model.js +91 -0
- package/dist/turn.style.d.ts +5 -0
- package/dist/turn.style.js +55 -0
- package/dist/types.d.ts +183 -18
- package/dist/units.d.ts +1 -1
- package/dist/units.js +15 -1
- package/dist/uprights.board.d.ts +17 -0
- package/dist/uprights.board.js +59 -0
- package/dist/uprights.d.ts +37 -0
- package/dist/uprights.fields.d.ts +32 -0
- package/dist/uprights.fields.js +172 -0
- package/dist/uprights.goal.d.ts +49 -0
- package/dist/uprights.goal.js +69 -0
- package/dist/uprights.js +160 -0
- package/dist/uprights.more.d.ts +7 -0
- package/dist/uprights.more.js +183 -0
- package/dist/uprights.net.d.ts +12 -0
- package/dist/uprights.net.js +109 -0
- package/dist/uprights.netkit.d.ts +28 -0
- package/dist/uprights.netkit.js +67 -0
- package/dist/uprights.pools.d.ts +8 -0
- package/dist/uprights.pools.js +190 -0
- package/dist/uprights.rinks.d.ts +27 -0
- package/dist/uprights.rinks.js +106 -0
- package/dist/uprights.track.d.ts +50 -0
- package/dist/uprights.track.js +246 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +19 -2
package/dist/atlas-entry.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { PLACES, atlasFacets, placeById, placeByName, placesBy, placesByName, surfaceOf } from "./atlas.ts";
|
|
1
|
+
export { PLACES, atlasFacets, placeById, placeByName, placesBy, placesByClub, placesByName, surfaceOf, surfacesOf, tenantsOf } from "./atlas.ts";
|
|
2
2
|
export { officialName, plainName } from "./names.ts";
|
|
3
|
+
export { TENANTS, TENANT_JAPANESE_NAMES, nameJaOf } from "./tenants.ts";
|
|
3
4
|
export type { PlaceAlias, PlaceNameKind } from "./names.ts";
|
|
4
|
-
export type { AtlasFacets, Place, PlaceFilter, PlaceKind, PlaceSport, PlaceStatus } from "./atlas.ts";
|
|
5
|
+
export type { AtlasFacets, Place, PlaceFilter, PlaceKind, PlaceSport, PlaceStatus, PlaceSurface, SurfaceSport, TenantFilter } from "./atlas.ts";
|
|
6
|
+
export type { Tenant, TenantArticle, TenantNameJa, TenantNameKind, TenantSource, TenantSport } from "./tenants.ts";
|
package/dist/atlas-entry.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
// The atlas: every ballpark and soccer ground with where it stands
|
|
2
|
-
export { PLACES, atlasFacets, placeById, placeByName, placesBy, placesByName, surfaceOf } from "./atlas.js";
|
|
1
|
+
// The atlas: every ballpark and soccer ground with where it stands, when it was in use and the clubs that played there, and the filters over them.
|
|
2
|
+
export { PLACES, atlasFacets, placeById, placeByName, placesBy, placesByClub, placesByName, surfaceOf, surfacesOf, tenantsOf } from "./atlas.js";
|
|
3
3
|
export { officialName, plainName } from "./names.js";
|
|
4
|
+
export { TENANTS, TENANT_JAPANESE_NAMES, nameJaOf } from "./tenants.js";
|
package/dist/atlas.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlaceAlias } from "./names.ts";
|
|
2
|
+
import type { Tenant, TenantSport } from "./tenants.ts";
|
|
2
3
|
/** What a place is: a ballpark (of `PARKS`) or a soccer ground (of `GROUNDS`). */
|
|
3
4
|
export type PlaceKind = "park" | "ground";
|
|
4
5
|
/** The sport a place is drawn for: baseball parks have a fence, soccer grounds a pitch. */
|
|
@@ -28,12 +29,14 @@ export interface Place {
|
|
|
28
29
|
to: number;
|
|
29
30
|
}[];
|
|
30
31
|
sport: PlaceSport;
|
|
31
|
-
/** The leagues and competitions it is known for: `MLB
|
|
32
|
+
/** 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. */
|
|
32
33
|
leagues: readonly string[];
|
|
34
|
+
/** 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. */
|
|
35
|
+
tenants: readonly Tenant[];
|
|
33
36
|
/** ISO 3166-1 alpha-2: `US`. */
|
|
34
37
|
country: string;
|
|
35
38
|
city: string;
|
|
36
|
-
/** The club that plays in a park (`Boston Red Sox`); soccer grounds have none. */
|
|
39
|
+
/** The club that plays in a park (`Boston Red Sox`); soccer grounds have none (see `tenants`). */
|
|
37
40
|
team?: string;
|
|
38
41
|
/** Wikidata's coordinates (P625, CC0), in degrees. */
|
|
39
42
|
lat: number;
|
|
@@ -45,19 +48,21 @@ export interface Place {
|
|
|
45
48
|
to?: number;
|
|
46
49
|
/** The Wikidata item (`Q49136`): the key to join a place to other data. */
|
|
47
50
|
wikidata: string;
|
|
51
|
+
/** 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. */
|
|
52
|
+
track?: boolean;
|
|
48
53
|
}
|
|
49
54
|
/** What `placesBy` keeps: every field given must match. A list matches any of its members. */
|
|
50
55
|
export interface PlaceFilter {
|
|
51
56
|
sport?: PlaceSport | readonly PlaceSport[];
|
|
52
57
|
kind?: PlaceKind | readonly PlaceKind[];
|
|
53
|
-
/** A league or competition from `Place.leagues
|
|
58
|
+
/** A league or competition from `Place.leagues`: a tenant's league (`CFL`) or a tournament. */
|
|
54
59
|
league?: string | readonly string[];
|
|
55
60
|
/** ISO 3166-1 alpha-2. */
|
|
56
61
|
country?: string | readonly string[];
|
|
57
62
|
status?: PlaceStatus | readonly PlaceStatus[];
|
|
58
63
|
/** 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. */
|
|
59
64
|
year?: number;
|
|
60
|
-
/** Words to find in any name (the everyday names, the aliases, the readings), the city or the club, ignoring case, accents, width and, in Japanese, hiragana or katakana; every word must be found. */
|
|
65
|
+
/** 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. */
|
|
61
66
|
text?: string;
|
|
62
67
|
}
|
|
63
68
|
/**
|
|
@@ -116,12 +121,50 @@ export interface AtlasFacets {
|
|
|
116
121
|
* ```ts
|
|
117
122
|
* import { atlasFacets } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
118
123
|
* const { sports, leagues, countries, years } = atlasFacets();
|
|
119
|
-
* console.log(sports.join(), leagues.
|
|
120
|
-
* // baseball,soccer
|
|
124
|
+
* console.log(sports.join(), leagues.length, leagues.includes("CFL"), countries.length, years.min);
|
|
125
|
+
* // baseball,soccer 83 true 23 1877
|
|
121
126
|
* ```
|
|
122
127
|
*/
|
|
123
128
|
export declare function atlasFacets(): AtlasFacets;
|
|
124
|
-
/** The options `drawKyogijo` takes to draw a
|
|
129
|
+
/** The options `drawKyogijo` takes to draw a surface a place offers. */
|
|
130
|
+
export type PlaceSurface = {
|
|
131
|
+
sport: "mlb";
|
|
132
|
+
park: string;
|
|
133
|
+
} | {
|
|
134
|
+
sport: "soccer";
|
|
135
|
+
ground?: string;
|
|
136
|
+
} | {
|
|
137
|
+
sport: "nfl" | "cfl" | "nba" | "nhl" | "afl" | "cricket";
|
|
138
|
+
} | {
|
|
139
|
+
sport: "rugby";
|
|
140
|
+
league?: "nrl";
|
|
141
|
+
};
|
|
142
|
+
/** The sports `surfaceOf` can be asked for. */
|
|
143
|
+
export type SurfaceSport = PlaceSurface["sport"];
|
|
144
|
+
/**
|
|
145
|
+
* 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
|
|
146
|
+
* 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
|
|
147
|
+
* 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.
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { placeById, surfacesOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
151
|
+
* console.log(surfacesOf(placeById("bc-place")!).map((surface) => surface.sport).join());
|
|
152
|
+
* // soccer,cfl
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export declare function surfacesOf(place: Place): PlaceSurface[];
|
|
156
|
+
/**
|
|
157
|
+
* 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
|
|
158
|
+
* `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
|
|
159
|
+
* that sport has played there: `surfaceOf(bcPlace, "cfl")` is `{ sport: "cfl" }` and `surfaceOf(fenwayPark, "cfl")` is `undefined`.
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* import { placeById, surfaceOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
163
|
+
* const bcPlace = placeById("bc-place")!;
|
|
164
|
+
* console.log(surfaceOf(bcPlace), surfaceOf(bcPlace, "cfl"), surfaceOf(bcPlace, "mlb"));
|
|
165
|
+
* // { sport: 'soccer', ground: 'bc-place' } { sport: 'cfl' } undefined
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
125
168
|
export declare function surfaceOf(place: Place): {
|
|
126
169
|
sport: "mlb";
|
|
127
170
|
park: string;
|
|
@@ -129,3 +172,36 @@ export declare function surfaceOf(place: Place): {
|
|
|
129
172
|
sport: "soccer";
|
|
130
173
|
ground: string;
|
|
131
174
|
};
|
|
175
|
+
export declare function surfaceOf(place: Place, sport: SurfaceSport): PlaceSurface | undefined;
|
|
176
|
+
/** What `tenantsOf` keeps: every field given must match. */
|
|
177
|
+
export interface TenantFilter {
|
|
178
|
+
/** Keep the clubs that played there in this year. A bound the data does not give does not shut a club out. */
|
|
179
|
+
year?: number;
|
|
180
|
+
league?: string | readonly string[];
|
|
181
|
+
sport?: TenantSport | readonly TenantSport[];
|
|
182
|
+
/** `true` keeps the clubs that play there still (no last year), `false` those that have left. */
|
|
183
|
+
current?: boolean;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* 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).
|
|
187
|
+
* Give a place, or its key.
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { placeById, tenantsOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
191
|
+
* const expos = tenantsOf("olympic-stadium-montreal").map((t) => `${t.club} (${t.league}) ${t.from}-${t.to ?? ""}`);
|
|
192
|
+
* console.log(expos[0], tenantsOf(placeById("bc-place")!, { current: true }).map((t) => t.club).join(", "));
|
|
193
|
+
* // Montreal Expos (MLB) 1977-2004 BC Lions, Vancouver Whitecaps FC
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
export declare function tenantsOf(place: Place | string | undefined, filter?: TenantFilter): Tenant[];
|
|
197
|
+
/**
|
|
198
|
+
* 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
|
|
199
|
+
* 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.
|
|
200
|
+
* @example
|
|
201
|
+
* ```ts
|
|
202
|
+
* import { placesByClub } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
203
|
+
* console.log(placesByClub("BC Lions").map((place) => place.id).join(), placesByClub("Montreal Expos").map((place) => place.id).join());
|
|
204
|
+
* // bc-place jarry-park-stadium,olympic-stadium-montreal
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare function placesByClub(name: string | undefined): Place[];
|
package/dist/atlas.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GROUNDS, GROUND_IDS } from "./grounds.js";
|
|
2
2
|
import { nameContainsAll, placesNamed, plainName } from "./names.js";
|
|
3
3
|
import { PARKS, PARK_IDS } from "./parks.js";
|
|
4
|
+
import { SURFACE_OF_SPORT, TENANTS, hasSurface, leaguesOf, playedIn } from "./tenants.js";
|
|
4
5
|
const leaguesOfGround = (ground) => {
|
|
5
6
|
const leagues = [];
|
|
6
7
|
if (ground.tournaments.some((t) => t.competition === "world-cup"))
|
|
@@ -9,7 +10,9 @@ const leaguesOfGround = (ground) => {
|
|
|
9
10
|
leagues.push("FIFA Women's World Cup");
|
|
10
11
|
return leagues;
|
|
11
12
|
};
|
|
13
|
+
const withoutRepeats = (...lists) => [...new Set(lists.flat())];
|
|
12
14
|
const fromPark = (park) => {
|
|
15
|
+
const tenants = TENANTS[park.id] ?? [];
|
|
13
16
|
const from = park.from ?? park.opened;
|
|
14
17
|
const to = park.to ?? park.closed;
|
|
15
18
|
return {
|
|
@@ -21,7 +24,8 @@ const fromPark = (park) => {
|
|
|
21
24
|
...(park.localName === undefined ? {} : { localName: park.localName, localLanguage: park.localLanguage }),
|
|
22
25
|
aliases: park.aliases ?? [],
|
|
23
26
|
sport: "baseball",
|
|
24
|
-
leagues: [park.league],
|
|
27
|
+
leagues: withoutRepeats([park.league], leaguesOf(tenants)),
|
|
28
|
+
tenants,
|
|
25
29
|
country: park.country,
|
|
26
30
|
city: park.city,
|
|
27
31
|
team: park.team,
|
|
@@ -44,7 +48,8 @@ const fromGround = (ground) => ({
|
|
|
44
48
|
aliases: ground.aliases ?? [],
|
|
45
49
|
...(ground.names === undefined ? {} : { names: ground.names }),
|
|
46
50
|
sport: "soccer",
|
|
47
|
-
leagues: leaguesOfGround(ground),
|
|
51
|
+
leagues: withoutRepeats(leaguesOf(TENANTS[ground.id] ?? []), leaguesOfGround(ground)),
|
|
52
|
+
tenants: TENANTS[ground.id] ?? [],
|
|
48
53
|
country: ground.country,
|
|
49
54
|
city: ground.city,
|
|
50
55
|
lat: ground.lat,
|
|
@@ -53,6 +58,7 @@ const fromGround = (ground) => ({
|
|
|
53
58
|
...(ground.from === undefined ? {} : { from: ground.from }),
|
|
54
59
|
...(ground.status === "past" && ground.to !== undefined ? { to: ground.to } : {}),
|
|
55
60
|
wikidata: ground.wikidata,
|
|
61
|
+
...(ground.track === true ? { track: true } : {}),
|
|
56
62
|
});
|
|
57
63
|
/**
|
|
58
64
|
* Every place the package draws, parks first and then grounds, each in the order of its own list: the ballparks of
|
|
@@ -118,7 +124,9 @@ export function placesBy(filter = {}) {
|
|
|
118
124
|
return false;
|
|
119
125
|
if (words.length > 0) {
|
|
120
126
|
const haystack = plain([place.city, place.team, place.country].filter(Boolean).join(" "));
|
|
121
|
-
|
|
127
|
+
// A word may be in the name of any one club that played there.
|
|
128
|
+
const clubs = place.tenants.map((tenant) => plain([tenant.club, tenant.clubJa, ...(tenant.aliasesJa ?? [])].filter(Boolean).join(" ")));
|
|
129
|
+
if (!words.every((word) => haystack.includes(word) || nameContainsAll(place, [word]) || clubs.some((club) => club.includes(word))))
|
|
122
130
|
return false;
|
|
123
131
|
}
|
|
124
132
|
return true;
|
|
@@ -130,8 +138,8 @@ export function placesBy(filter = {}) {
|
|
|
130
138
|
* ```ts
|
|
131
139
|
* import { atlasFacets } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
132
140
|
* const { sports, leagues, countries, years } = atlasFacets();
|
|
133
|
-
* console.log(sports.join(), leagues.
|
|
134
|
-
* // baseball,soccer
|
|
141
|
+
* console.log(sports.join(), leagues.length, leagues.includes("CFL"), countries.length, years.min);
|
|
142
|
+
* // baseball,soccer 83 true 23 1877
|
|
135
143
|
* ```
|
|
136
144
|
*/
|
|
137
145
|
export function atlasFacets() {
|
|
@@ -143,7 +151,99 @@ export function atlasFacets() {
|
|
|
143
151
|
years: { min: Math.min(...years), max: Math.max(...years) },
|
|
144
152
|
};
|
|
145
153
|
}
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
/**
|
|
155
|
+
* 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
|
|
156
|
+
* 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
|
|
157
|
+
* 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.
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* import { placeById, surfacesOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
161
|
+
* console.log(surfacesOf(placeById("bc-place")!).map((surface) => surface.sport).join());
|
|
162
|
+
* // soccer,cfl
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export function surfacesOf(place) {
|
|
166
|
+
const own = place.kind === "park" ? { sport: "mlb", park: place.id } : { sport: "soccer", ground: place.id };
|
|
167
|
+
const out = [own];
|
|
168
|
+
for (const tenant of place.tenants) {
|
|
169
|
+
const drawn = SURFACE_OF_SPORT[tenant.sport];
|
|
170
|
+
if (drawn === undefined || !hasSurface(tenant))
|
|
171
|
+
continue;
|
|
172
|
+
// A baseball club's fence is a park's: a ground has none to draw.
|
|
173
|
+
if (drawn.sport === "mlb")
|
|
174
|
+
continue;
|
|
175
|
+
const surface = drawn.sport === "soccer" ? { sport: "soccer" } : drawn.sport === "rugby" ? { sport: "rugby", ...(drawn.league === undefined ? {} : { league: drawn.league }) } : { sport: drawn.sport };
|
|
176
|
+
if (out.some((have) => have.sport === surface.sport && (have.sport !== "rugby" || have.league === surface.league)))
|
|
177
|
+
continue;
|
|
178
|
+
out.push(surface);
|
|
179
|
+
}
|
|
180
|
+
return out;
|
|
181
|
+
}
|
|
182
|
+
export function surfaceOf(place, sport) {
|
|
183
|
+
if (sport === undefined)
|
|
184
|
+
return place.kind === "park" ? { sport: "mlb", park: place.id } : { sport: "soccer", ground: place.id };
|
|
185
|
+
return surfacesOf(place).find((surface) => surface.sport === sport);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 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).
|
|
189
|
+
* Give a place, or its key.
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* import { placeById, tenantsOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
193
|
+
* const expos = tenantsOf("olympic-stadium-montreal").map((t) => `${t.club} (${t.league}) ${t.from}-${t.to ?? ""}`);
|
|
194
|
+
* console.log(expos[0], tenantsOf(placeById("bc-place")!, { current: true }).map((t) => t.club).join(", "));
|
|
195
|
+
* // Montreal Expos (MLB) 1977-2004 BC Lions, Vancouver Whitecaps FC
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
export function tenantsOf(place, filter = {}) {
|
|
199
|
+
const found = typeof place === "string" ? BY_ID.get(place) : place;
|
|
200
|
+
if (found === undefined)
|
|
201
|
+
return [];
|
|
202
|
+
const leagues = many(filter.league);
|
|
203
|
+
const sports = many(filter.sport);
|
|
204
|
+
const year = filter.year !== undefined && Number.isFinite(filter.year) ? filter.year : undefined;
|
|
205
|
+
return found.tenants.filter((tenant) => {
|
|
206
|
+
if (leagues !== undefined && !leagues.includes(tenant.league))
|
|
207
|
+
return false;
|
|
208
|
+
if (sports !== undefined && !sports.includes(tenant.sport))
|
|
209
|
+
return false;
|
|
210
|
+
if (filter.current !== undefined && (tenant.to === undefined) !== filter.current)
|
|
211
|
+
return false;
|
|
212
|
+
return year === undefined || playedIn(tenant, year);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 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
|
|
217
|
+
* 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.
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* import { placesByClub } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
221
|
+
* console.log(placesByClub("BC Lions").map((place) => place.id).join(), placesByClub("Montreal Expos").map((place) => place.id).join());
|
|
222
|
+
* // bc-place jarry-park-stadium,olympic-stadium-montreal
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export function placesByClub(name) {
|
|
226
|
+
if (name === undefined)
|
|
227
|
+
return [];
|
|
228
|
+
const wanted = plain(name);
|
|
229
|
+
const words = name.split(/\s+/).map(plain).filter(Boolean);
|
|
230
|
+
if (wanted === "")
|
|
231
|
+
return [];
|
|
232
|
+
const ranked = [];
|
|
233
|
+
PLACES.forEach((place, index) => {
|
|
234
|
+
let best;
|
|
235
|
+
for (const tenant of place.tenants) {
|
|
236
|
+
for (const club of [tenant.club, tenant.clubJa, ...(tenant.aliasesJa ?? [])]) {
|
|
237
|
+
if (club === undefined)
|
|
238
|
+
continue;
|
|
239
|
+
const own = plain(club);
|
|
240
|
+
const rank = own === wanted ? 0 : words.every((word) => own.includes(word)) ? 1 : undefined;
|
|
241
|
+
if (rank !== undefined && (best === undefined || rank < best))
|
|
242
|
+
best = rank;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (best !== undefined)
|
|
246
|
+
ranked.push([best, index, place]);
|
|
247
|
+
});
|
|
248
|
+
return ranked.sort((a, b) => a[0] - b[0] || a[1] - b[1]).map((row) => row[2]);
|
|
149
249
|
}
|
package/dist/charts-entry.d.ts
CHANGED
|
@@ -2,9 +2,14 @@ export { nbaShotChart, nflPassChart, nhlShotMap } from "./charts.ts";
|
|
|
2
2
|
export { mlbSprayChart } from "./charts.baseball.ts";
|
|
3
3
|
export { soccerGoalMouth, soccerShotMap } from "./charts.soccer.ts";
|
|
4
4
|
export { CURLING_COLORS, curlingScore, curlingStones } from "./charts.curling.ts";
|
|
5
|
+
export { curlingHeat } from "./charts.curling.heat.ts";
|
|
6
|
+
export { CURLING_HIT_TYPES, curlingEndStats, curlingFreeGuards, curlingGuardScores, curlingHammers, curlingInPlay, curlingIsHit, curlingShotStats } from "./curling.stats.ts";
|
|
7
|
+
export type { CurlingEndRecord, CurlingEndScore, CurlingEndStats, CurlingGuardEnd, CurlingGuardScores, CurlingGuards, CurlingHammerStats, CurlingInPlay, CurlingShot, CurlingShotLine, CurlingShotStats, CurlingSide, CurlingStealStats, CurlingTeamEnds } from "./curling.stats.ts";
|
|
8
|
+
export { splitsChart } from "./charts.pool.ts";
|
|
9
|
+
export type { SplitRow, SplitsOptions, SplitsTotals, SwimmerSplits } from "./charts.pool.ts";
|
|
5
10
|
export { passNetwork } from "./charts.network.ts";
|
|
6
11
|
export type { PassNetworkOptions, PassNetworkPass, PassNetworkTotals } from "./charts.network.ts";
|
|
7
|
-
export type { Ball, Chart, ChartOptions, CurlingOptions, CurlingStone, CurlingStoneResult, CurlingTotals, GoalMouth, GoalMouthOptions, KeyItem, MlbSprayOptions, MlbTotals, NbaShot, NbaShotOptions, NbaTotals, NflPass, NflPassOptions, NflTotals, NhlShot, NhlShotOptions, NhlTotals, SoccerChart, SoccerShot, SoccerShotOptions, SoccerTotals, ZoneTotal } from "./charts.types.ts";
|
|
12
|
+
export type { Ball, Chart, ChartOptions, CurlingHeatOptions, CurlingHeatTotals, CurlingOptions, CurlingStone, CurlingStoneResult, CurlingTotals, GoalMouth, GoalMouthOptions, KeyItem, MlbSprayOptions, MlbTotals, NbaShot, NbaShotOptions, NbaTotals, NflPass, NflPassOptions, NflTotals, NhlShot, NhlShotOptions, NhlTotals, SoccerChart, SoccerShot, SoccerShotOptions, SoccerTotals, ZoneTotal } from "./charts.types.ts";
|
|
8
13
|
export { ROAD_SIZES, roadToFinal } from "./road.ts";
|
|
9
14
|
export { KYOGIJO_ROAD_STYLE } from "./road.style.ts";
|
|
10
15
|
export type { RoadChart, RoadDecided, RoadFinal, RoadFinalist, RoadGroupMatch, RoadMatch, RoadOptions, RoadRecord, RoadScore, RoadSize, RoadSizeInfo, RoadTotals } from "./road.types.ts";
|
package/dist/charts-entry.js
CHANGED
|
@@ -3,6 +3,9 @@ export { nbaShotChart, nflPassChart, nhlShotMap } from "./charts.js";
|
|
|
3
3
|
export { mlbSprayChart } from "./charts.baseball.js";
|
|
4
4
|
export { soccerGoalMouth, soccerShotMap } from "./charts.soccer.js";
|
|
5
5
|
export { CURLING_COLORS, curlingScore, curlingStones } from "./charts.curling.js";
|
|
6
|
+
export { curlingHeat } from "./charts.curling.heat.js";
|
|
7
|
+
export { CURLING_HIT_TYPES, curlingEndStats, curlingFreeGuards, curlingGuardScores, curlingHammers, curlingInPlay, curlingIsHit, curlingShotStats } from "./curling.stats.js";
|
|
8
|
+
export { splitsChart } from "./charts.pool.js";
|
|
6
9
|
export { passNetwork } from "./charts.network.js";
|
|
7
10
|
export { ROAD_SIZES, roadToFinal } from "./road.js";
|
|
8
11
|
export { KYOGIJO_ROAD_STYLE } from "./road.style.js";
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { Chart, ChartOptions, KeyItem } from "./charts.types.ts";
|
|
2
|
+
import type { AthleticsFieldEvent, AthleticsRace } from "./athletics/types.ts";
|
|
3
|
+
import type { ReplayLook, ReplayTimeline } from "./replay.types.ts";
|
|
4
|
+
import type { SurfaceOptions } from "./types.ts";
|
|
5
|
+
/** An athlete in a lane. */
|
|
6
|
+
export interface AthleticsEntry {
|
|
7
|
+
/** The lane, from 1. */
|
|
8
|
+
lane: number;
|
|
9
|
+
name: string;
|
|
10
|
+
/** The country's code or name, for the table. */
|
|
11
|
+
country?: string;
|
|
12
|
+
/** The flag: an SVG document as text, or an `https:` or relative address, as a team's `logo`. */
|
|
13
|
+
flag?: string;
|
|
14
|
+
bib?: string | number;
|
|
15
|
+
}
|
|
16
|
+
/** One athlete's result in a race. Times are in seconds from the gun. */
|
|
17
|
+
export interface AthleticsResult extends AthleticsEntry {
|
|
18
|
+
/** The place, from 1. A runner who did not finish has none. */
|
|
19
|
+
place?: number;
|
|
20
|
+
/** The time in seconds from the gun, or `null` for one who did not finish. */
|
|
21
|
+
time?: number | null;
|
|
22
|
+
/** The reaction time in seconds (the time from the gun to the athlete's feet leaving the blocks), for a race with blocks. */
|
|
23
|
+
reaction?: number;
|
|
24
|
+
/** The times, from the gun, at distances along the way: `{ distance: 100, time: 10.4 }` is the time at 100 m. */
|
|
25
|
+
splits?: readonly {
|
|
26
|
+
distance: number;
|
|
27
|
+
time: number;
|
|
28
|
+
}[];
|
|
29
|
+
/** `DQ`, `DNF`, `DNS` or a note of your own, for the table. */
|
|
30
|
+
note?: string;
|
|
31
|
+
}
|
|
32
|
+
/** What `laneDraw`, `raceResults` and `raceReplay` take beyond a chart's options. */
|
|
33
|
+
export interface AthleticsRaceOptions extends ChartOptions {
|
|
34
|
+
/** The race. The 400 m by default. */
|
|
35
|
+
race?: AthleticsRace;
|
|
36
|
+
}
|
|
37
|
+
/** The numbers behind a lane draw. */
|
|
38
|
+
export interface LaneDrawTotals {
|
|
39
|
+
athletes: number;
|
|
40
|
+
/** The first and the last lane drawn. */
|
|
41
|
+
firstLane: number;
|
|
42
|
+
lastLane: number;
|
|
43
|
+
}
|
|
44
|
+
/** The numbers behind results. */
|
|
45
|
+
export interface ResultsTotals {
|
|
46
|
+
athletes: number;
|
|
47
|
+
finished: number;
|
|
48
|
+
/** The winner's name and time, or null when nobody has a place. */
|
|
49
|
+
winner: {
|
|
50
|
+
name: string;
|
|
51
|
+
time: number;
|
|
52
|
+
} | null;
|
|
53
|
+
/** The quickest reaction, in seconds. */
|
|
54
|
+
quickestReaction: number | null;
|
|
55
|
+
}
|
|
56
|
+
/** An attempt in a jump or a throw. */
|
|
57
|
+
export interface FieldAttempt {
|
|
58
|
+
athlete?: string;
|
|
59
|
+
/** The mark in metres: from the inside edge of the circle (or the javelin's arc) for a throw, from the take-off line for a jump. A foul has none. */
|
|
60
|
+
distance?: number | null;
|
|
61
|
+
/** A throw's direction, in degrees from the sector's axis (positive to the right of the throw as the athlete faces it), or a jump's sideways place in metres from the runway's middle line. 0 by default. */
|
|
62
|
+
across?: number;
|
|
63
|
+
/** False for a foul. True by default when there is a distance. */
|
|
64
|
+
valid?: boolean;
|
|
65
|
+
/** The round of the trial, from 1. */
|
|
66
|
+
round?: number;
|
|
67
|
+
/** `home` or `away`, which take the layer's two colours, or any other text. */
|
|
68
|
+
team?: string;
|
|
69
|
+
/** The tooltip, and what a screen reader reads. */
|
|
70
|
+
title?: string;
|
|
71
|
+
}
|
|
72
|
+
/** What `fieldMarks` takes. */
|
|
73
|
+
export interface FieldMarksOptions extends ChartOptions {
|
|
74
|
+
/** The facility of the event that the marks are on, by its id (`javelin-west`, `jump-0-west`): the event's first by default. */
|
|
75
|
+
facility?: string;
|
|
76
|
+
/** Write each mark's distance beside it, not only the best's. Off by default. */
|
|
77
|
+
labels?: boolean;
|
|
78
|
+
/** For the triple jump: the take-off line is the women's (11 m from the pit) and not the men's (13 m). */
|
|
79
|
+
women?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** The numbers behind a field event's marks. */
|
|
82
|
+
export interface FieldTotals {
|
|
83
|
+
attempts: number;
|
|
84
|
+
valid: number;
|
|
85
|
+
fouls: number;
|
|
86
|
+
best: {
|
|
87
|
+
distance: number;
|
|
88
|
+
athlete: string | undefined;
|
|
89
|
+
} | null;
|
|
90
|
+
}
|
|
91
|
+
/** A time in seconds as it is written: `9.58`, `1:40.91`, `2:03:59.40`. */
|
|
92
|
+
export declare function formatTime(seconds: number, places?: number): string;
|
|
93
|
+
/**
|
|
94
|
+
* The lane draw of a race: each athlete's name and flag on the lane of the start, behind the lane's number, for the close-up of the start (`range: "start"`, the drawing's default). The positions are the
|
|
95
|
+
* start lines' as the Manual marks them: the stagger of the 200, 400 and 800 m and the 4 x 400 m, the straight line of the sprints, the curved line of a race run without lanes.
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { laneDraw } from "@johnmorrisdotca/kyogijo-stadiums/athletics";
|
|
99
|
+
* const chart = laneDraw([{ lane: 4, name: "M. Jacobs", country: "ITA" }, { lane: 5, name: "F. Kerley", country: "USA" }], { race: "100m" });
|
|
100
|
+
* console.log(chart.totals.athletes, chart.title);
|
|
101
|
+
* // 2 Lane draw, 100 m
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function laneDraw(entries: readonly AthleticsEntry[], options?: AthleticsRaceOptions): Chart<LaneDrawTotals> & {
|
|
105
|
+
key: KeyItem[];
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The results of a race on the finish line's close-up: after the line, in each lane, a disc with the place (gold, silver and bronze for the first three), the athlete's name and time; the reaction time
|
|
109
|
+
* behind the start line and the splits along the lane as small marks with their times; and a table of all of it. Times are in seconds from the gun.
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { raceResults } from "@johnmorrisdotca/kyogijo-stadiums/athletics";
|
|
113
|
+
* const chart = raceResults([{ lane: 4, name: "M. Jacobs", place: 1, time: 9.8 }, { lane: 5, name: "F. Kerley", place: 2, time: 9.84 }], { race: "100m" });
|
|
114
|
+
* console.log(chart.totals.winner?.name, chart.summary);
|
|
115
|
+
* // M. Jacobs M. Jacobs won the 100 m in 9.80.
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export declare function raceResults(results: readonly AthleticsResult[], options?: AthleticsRaceOptions & {
|
|
119
|
+
splits?: boolean;
|
|
120
|
+
reactions?: boolean;
|
|
121
|
+
}): Chart<ResultsTotals> & {
|
|
122
|
+
key: KeyItem[];
|
|
123
|
+
};
|
|
124
|
+
/** One runner of a replay. */
|
|
125
|
+
export interface AthleticsRunner extends AthleticsEntry {
|
|
126
|
+
/** The time, in seconds from the gun, at which the runner finishes. */
|
|
127
|
+
time: number;
|
|
128
|
+
/** The reaction time, in seconds; the runner stays on the blocks until then. 0.15 by default. */
|
|
129
|
+
reaction?: number;
|
|
130
|
+
/** Times, from the gun, at distances along the way, which the runner's pace follows; without them the pace is even. */
|
|
131
|
+
splits?: readonly {
|
|
132
|
+
distance: number;
|
|
133
|
+
time: number;
|
|
134
|
+
}[];
|
|
135
|
+
}
|
|
136
|
+
/** What `raceReplay` takes. */
|
|
137
|
+
export interface RaceReplayOptions extends AthleticsRaceOptions {
|
|
138
|
+
/** Seconds between two frames. 0.2 by default. */
|
|
139
|
+
step?: number;
|
|
140
|
+
/** How far past the finish line the runners go on, in metres. 8 by default. */
|
|
141
|
+
runOut?: number;
|
|
142
|
+
}
|
|
143
|
+
/** What `raceReplay` gives back: the timeline, the drawing's options to lay it on, a look for it and a sentence. */
|
|
144
|
+
export interface RaceReplay {
|
|
145
|
+
timeline: ReplayTimeline;
|
|
146
|
+
/** The drawing's options: the stadium with the race marked. Pass them with the timeline to `drawFrame`, `createReplay` or `replayElement`. */
|
|
147
|
+
options: SurfaceOptions;
|
|
148
|
+
/** A look for the frames: the runners drawn larger, no trails, the lane numbers on them. */
|
|
149
|
+
look: ReplayLook;
|
|
150
|
+
title: string;
|
|
151
|
+
summary: string;
|
|
152
|
+
/** The time of the last runner to finish, in seconds. */
|
|
153
|
+
duration: number;
|
|
154
|
+
}
|
|
155
|
+
/** The distance a runner has run at a time, by the reaction time, the splits and the finish: straight lines between them, standing until the reaction. */
|
|
156
|
+
export declare function distanceRun(runner: AthleticsRunner, total: number, t: number): number;
|
|
157
|
+
/**
|
|
158
|
+
* A replay of a race: every runner, from the gun, on the curve of the lane (the stagger of the start as the Manual's table has it), in the pace of the reaction time, the splits and the finish time,
|
|
159
|
+
* to the line and on to a stop. A race that leaves its lanes (the 800 m after its breakline, the long races from the start) is drawn with the runners moving in to the inside. The positions are in
|
|
160
|
+
* the athletics frame (metres from the middle of the track), so the timeline is for the stadium drawn whole or close up. The relays are not replayed.
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* import { raceReplay } from "@johnmorrisdotca/kyogijo-stadiums/athletics";
|
|
164
|
+
* const replay = raceReplay([{ lane: 1, name: "A", time: 10.1 }, { lane: 2, name: "B", time: 10.3 }], { race: "100m" });
|
|
165
|
+
* console.log(replay.timeline.frames.length > 40, replay.duration);
|
|
166
|
+
* // true 10.3
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare function raceReplay(runners: readonly AthleticsRunner[], options?: RaceReplayOptions): RaceReplay;
|
|
170
|
+
/**
|
|
171
|
+
* The attempts of a field event as marks: each valid throw in its sector at its distance and direction, each jump in its pit at its distance from the take-off line, the best of them picked out with
|
|
172
|
+
* a ring and its distance written beside it. A foul has no mark and is in the table. Put them on the stadium (`athletics: { events: [event] }`) or on the event alone (`athletics: { layout: event }`).
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* import { fieldMarks } from "@johnmorrisdotca/kyogijo-stadiums/athletics";
|
|
176
|
+
* const chart = fieldMarks("javelin-throw", [{ athlete: "A", distance: 84.2 }, { athlete: "A", distance: 88.1, across: -3 }, { athlete: "A", valid: false }]);
|
|
177
|
+
* console.log(chart.totals.best?.distance, chart.totals.fouls);
|
|
178
|
+
* // 88.1 1
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export declare function fieldMarks(event: AthleticsFieldEvent, attempts: readonly FieldAttempt[], options?: FieldMarksOptions): Chart<FieldTotals> & {
|
|
182
|
+
key: KeyItem[];
|
|
183
|
+
};
|