@johnmorrisdotca/kyogijo-stadiums 0.4.0 → 0.6.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 +133 -0
- package/NOTICE.md +182 -2
- package/README.md +106 -19
- package/dist/annotate.js +1 -1
- package/dist/arenas-entry.d.ts +4 -0
- package/dist/arenas-entry.js +3 -0
- package/dist/arenas.d.ts +125 -0
- package/dist/arenas.data.d.ts +2 -0
- package/dist/arenas.data.js +3763 -0
- package/dist/arenas.js +72 -0
- 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 +6 -2
- package/dist/atlas-entry.js +4 -2
- package/dist/atlas.d.ts +117 -23
- package/dist/atlas.js +197 -12
- package/dist/background.js +2 -1
- package/dist/budo/describe.d.ts +13 -0
- package/dist/budo/describe.js +120 -0
- package/dist/budo/dojo.api.d.ts +64 -0
- package/dist/budo/dojo.api.js +46 -0
- package/dist/budo/dojo.d.ts +72 -0
- package/dist/budo/dojo.js +300 -0
- package/dist/budo/judo.d.ts +61 -0
- package/dist/budo/judo.js +109 -0
- package/dist/budo/karate.d.ts +29 -0
- package/dist/budo/karate.js +80 -0
- package/dist/budo/kendo.d.ts +18 -0
- package/dist/budo/kendo.js +44 -0
- package/dist/budo/kimarite.d.ts +19 -0
- package/dist/budo/kimarite.js +33 -0
- package/dist/budo/kit.d.ts +16 -0
- package/dist/budo/kit.js +24 -0
- package/dist/budo/kyudo.d.ts +28 -0
- package/dist/budo/kyudo.js +66 -0
- package/dist/budo/looks.d.ts +28 -0
- package/dist/budo/looks.js +58 -0
- package/dist/budo/parts.d.ts +32 -0
- package/dist/budo/parts.js +10 -0
- package/dist/budo/plan.d.ts +64 -0
- package/dist/budo/plan.js +139 -0
- package/dist/budo/room.d.ts +133 -0
- package/dist/budo/room.js +111 -0
- package/dist/budo/sumo.d.ts +31 -0
- package/dist/budo/sumo.js +71 -0
- package/dist/budo/tatami.d.ts +55 -0
- package/dist/budo/tatami.js +156 -0
- package/dist/budo/types.d.ts +192 -0
- package/dist/budo/types.js +2 -0
- package/dist/budo-entry.d.ts +22 -0
- package/dist/budo-entry.js +13 -0
- package/dist/budo.board.d.ts +28 -0
- package/dist/budo.board.js +81 -0
- package/dist/budo.score.d.ts +18 -0
- package/dist/budo.score.js +52 -0
- package/dist/budo.style.d.ts +6 -0
- package/dist/budo.style.js +67 -0
- 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.baseball.js +1 -1
- 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.js +4 -4
- 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.soccer.js +3 -3
- package/dist/charts.types.d.ts +63 -1
- package/dist/colour.d.ts +4 -4
- package/dist/colour.js +4 -4
- 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 +164 -0
- package/dist/crowd.draw.d.ts +17 -0
- package/dist/crowd.draw.js +204 -0
- package/dist/crowd.js +480 -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 +462 -54
- package/dist/element-entry.d.ts +3 -1
- package/dist/element-entry.js +2 -1
- package/dist/element.d.ts +13 -2
- package/dist/element.js +79 -4
- package/dist/emblems-source.d.ts +50 -0
- package/dist/emblems-source.js +56 -0
- package/dist/eras.d.ts +3 -1
- package/dist/eras.js +8 -3
- package/dist/features.js +204 -0
- package/dist/field.data.d.ts +16 -0
- package/dist/field.data.js +50 -0
- package/dist/fields.kit.d.ts +2 -2
- package/dist/fields.types.d.ts +24 -4
- package/dist/formations.js +18 -7
- package/dist/formations.sports.d.ts +8 -0
- package/dist/formations.sports.js +251 -0
- package/dist/frames.providers.js +71 -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/halls.d.ts +65 -0
- package/dist/halls.js +122 -0
- package/dist/hardwood.d.ts +31 -0
- package/dist/hardwood.js +157 -0
- package/dist/heat.js +21 -13
- package/dist/heat.types.d.ts +5 -0
- package/dist/heat.zones.d.ts +4 -2
- package/dist/heat.zones.js +207 -7
- package/dist/homeside.js +24 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.js +18 -2
- package/dist/layers-entry.d.ts +2 -1
- package/dist/layers-entry.js +1 -0
- package/dist/layers.d.ts +2 -1
- package/dist/layers.env.d.ts +12 -1
- package/dist/layers.env.js +36 -4
- package/dist/layers.js +32 -13
- package/dist/layers.types.d.ts +9 -2
- package/dist/leagues/athletics.d.ts +63 -0
- package/dist/leagues/athletics.js +87 -0
- package/dist/leagues/budo.d.ts +196 -0
- package/dist/leagues/budo.js +105 -0
- package/dist/leagues/courts.d.ts +269 -4
- package/dist/leagues/courts.js +155 -1
- package/dist/leagues/hockey.js +41 -19
- package/dist/leagues/skating.d.ts +145 -0
- package/dist/leagues/skating.js +73 -0
- package/dist/leagues/sources.js +41 -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 +17 -4
- package/dist/leagues.js +246 -5
- package/dist/lineup.codes.d.ts +23 -0
- package/dist/lineup.codes.js +122 -0
- package/dist/logo.d.ts +25 -0
- package/dist/logo.js +47 -0
- package/dist/look.d.ts +3 -3
- package/dist/look.js +39 -6
- package/dist/outline.d.ts +1 -1
- package/dist/outline.js +46 -4
- 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 +211 -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/pointer-entry.d.ts +2 -0
- package/dist/pointer-entry.js +2 -0
- package/dist/pointer.d.ts +113 -0
- package/dist/pointer.js +151 -0
- package/dist/pool.d.ts +176 -0
- package/dist/pool.figures.d.ts +306 -0
- package/dist/pool.figures.js +148 -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 +258 -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 +53 -3
- package/dist/replay-entry.d.ts +3 -0
- package/dist/replay-entry.js +2 -0
- package/dist/restyle.js +1 -1
- package/dist/road.draw.js +3 -2
- package/dist/road.js +2 -1
- package/dist/road.types.d.ts +3 -0
- package/dist/rules.d.ts +138 -0
- package/dist/rules.js +511 -0
- package/dist/rules.types.d.ts +4 -0
- package/dist/rules.types.js +64 -0
- package/dist/score.d.ts +3 -0
- package/dist/score.js +93 -6
- package/dist/sheet.d.ts +3 -0
- package/dist/sheet.js +7 -3
- package/dist/situation.d.ts +135 -0
- package/dist/situation.draw.d.ts +34 -0
- package/dist/situation.draw.js +202 -0
- package/dist/situation.js +337 -0
- package/dist/situation.style.d.ts +2 -0
- package/dist/situation.style.js +45 -0
- package/dist/situation.types.d.ts +77 -0
- package/dist/situation.types.js +3 -0
- package/dist/situation.widgets.d.ts +39 -0
- package/dist/situation.widgets.js +129 -0
- 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 +470 -0
- package/dist/strings.js +674 -13
- package/dist/style.d.ts +2 -0
- package/dist/style.js +19 -2
- 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 +17 -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 +44 -22
- package/dist/surfaces/budo.d.ts +6 -0
- package/dist/surfaces/budo.js +104 -0
- 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/football.js +7 -0
- package/dist/surfaces/hockey.js +4 -2
- 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 +76 -0
- package/dist/surfaces/venue.d.ts +15 -0
- package/dist/surfaces/venue.js +95 -0
- package/dist/target-entry.d.ts +2 -0
- package/dist/target-entry.js +2 -0
- package/dist/target.d.ts +200 -0
- package/dist/target.js +525 -0
- package/dist/team.common.d.ts +1 -1
- package/dist/team.common.js +3 -3
- package/dist/team.formation.d.ts +3 -1
- package/dist/team.formation.js +3 -3
- package/dist/team.layers.d.ts +2 -2
- package/dist/team.layers.js +4 -1
- package/dist/team.lineup.d.ts +27 -0
- package/dist/team.lineup.js +207 -0
- package/dist/team.network.js +6 -5
- package/dist/team.shape.js +5 -5
- package/dist/team.types.d.ts +40 -1
- package/dist/tenants.d.ts +77 -0
- package/dist/tenants.data.d.ts +8 -0
- package/dist/tenants.data.js +1793 -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 +116 -0
- package/dist/turn.camera.js +184 -0
- package/dist/turn.dom.d.ts +40 -0
- package/dist/turn.dom.js +353 -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 +56 -0
- package/dist/types.d.ts +221 -20
- package/dist/units.d.ts +1 -1
- package/dist/units.js +22 -1
- package/dist/uprights.board.d.ts +17 -0
- package/dist/uprights.board.js +59 -0
- package/dist/uprights.budo.d.ts +17 -0
- package/dist/uprights.budo.js +87 -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 +169 -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/dist/zones-entry.d.ts +2 -0
- package/dist/zones-entry.js +2 -0
- package/package.json +56 -3
package/dist/atlas.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { type Hall, type HallSurface } from "./halls.ts";
|
|
1
2
|
import type { PlaceAlias } from "./names.ts";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
export type
|
|
3
|
+
import type { BudoSport, BudoStyle, DojoSpec } from "./types.ts";
|
|
4
|
+
import type { Tenant, TenantSport } from "./tenants.ts";
|
|
5
|
+
/** 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`). */
|
|
6
|
+
export type PlaceKind = "park" | "ground" | "hall" | "arena";
|
|
7
|
+
/** 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`). */
|
|
8
|
+
export type PlaceSport = "baseball" | "soccer" | "budo" | "hockey" | "basketball";
|
|
6
9
|
/** `current` is a ground a club or a competition uses today, `past` one it has left, closed or pulled down. */
|
|
7
10
|
export type PlaceStatus = "current" | "past";
|
|
8
11
|
/** One place on the atlas: a ballpark or a soccer ground, with where it is and when it was in use. */
|
|
@@ -27,13 +30,18 @@ export interface Place {
|
|
|
27
30
|
from: number;
|
|
28
31
|
to: number;
|
|
29
32
|
}[];
|
|
33
|
+
/** 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. */
|
|
30
34
|
sport: PlaceSport;
|
|
31
|
-
/**
|
|
35
|
+
/** 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. */
|
|
36
|
+
sports: readonly PlaceSport[];
|
|
37
|
+
/** 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
38
|
leagues: readonly string[];
|
|
39
|
+
/** 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. */
|
|
40
|
+
tenants: readonly Tenant[];
|
|
33
41
|
/** ISO 3166-1 alpha-2: `US`. */
|
|
34
42
|
country: string;
|
|
35
43
|
city: string;
|
|
36
|
-
/** The club that plays in a park (`Boston Red Sox`); soccer grounds have none. */
|
|
44
|
+
/** The club that plays in a park (`Boston Red Sox`); soccer grounds and arenas have none (see `tenants`). */
|
|
37
45
|
team?: string;
|
|
38
46
|
/** Wikidata's coordinates (P625, CC0), in degrees. */
|
|
39
47
|
lat: number;
|
|
@@ -45,32 +53,26 @@ export interface Place {
|
|
|
45
53
|
to?: number;
|
|
46
54
|
/** The Wikidata item (`Q49136`): the key to join a place to other data. */
|
|
47
55
|
wikidata: string;
|
|
56
|
+
/** A hall of the budō (`kind: "hall"`): what it holds, how it came to be and the surfaces it offers (see `HALLS`). */
|
|
57
|
+
hall?: Hall;
|
|
58
|
+
/** 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. */
|
|
59
|
+
track?: boolean;
|
|
48
60
|
}
|
|
49
61
|
/** What `placesBy` keeps: every field given must match. A list matches any of its members. */
|
|
50
62
|
export interface PlaceFilter {
|
|
63
|
+
/** A sport a place is drawn for: an arena is found by `hockey` and by `basketball` if clubs of both played there. */
|
|
51
64
|
sport?: PlaceSport | readonly PlaceSport[];
|
|
52
65
|
kind?: PlaceKind | readonly PlaceKind[];
|
|
53
|
-
/** A league or competition from `Place.leagues
|
|
66
|
+
/** A league or competition from `Place.leagues`: a tenant's league (`CFL`) or a tournament. */
|
|
54
67
|
league?: string | readonly string[];
|
|
55
68
|
/** ISO 3166-1 alpha-2. */
|
|
56
69
|
country?: string | readonly string[];
|
|
57
70
|
status?: PlaceStatus | readonly PlaceStatus[];
|
|
58
71
|
/** 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
72
|
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. */
|
|
73
|
+
/** 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
74
|
text?: string;
|
|
62
75
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Every place the package draws, parks first and then grounds, each in the order of its own list: the ballparks of
|
|
65
|
-
* `PARKS` and the soccer grounds of `GROUNDS`, with where each stands.
|
|
66
|
-
* @example
|
|
67
|
-
* ```ts
|
|
68
|
-
* import { PLACES } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
69
|
-
* const fenway = PLACES.find((place) => place.id === "fenway-park");
|
|
70
|
-
* console.log(fenway?.name, fenway?.lat, fenway?.lon, fenway?.country);
|
|
71
|
-
* // Fenway Park 42.34639 -71.0975 US
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
76
|
export declare const PLACES: readonly Place[];
|
|
75
77
|
/** The place with a key, or `undefined`. */
|
|
76
78
|
export declare const placeById: (id: string | undefined) => Place | undefined;
|
|
@@ -116,16 +118,108 @@ export interface AtlasFacets {
|
|
|
116
118
|
* ```ts
|
|
117
119
|
* import { atlasFacets } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
118
120
|
* const { sports, leagues, countries, years } = atlasFacets();
|
|
119
|
-
* console.log(sports.join(), leagues.
|
|
120
|
-
* // baseball,soccer
|
|
121
|
+
* console.log(sports.join(), leagues.length, leagues.includes("CFL"), countries.length, years.min);
|
|
122
|
+
* // baseball,basketball,budo,hockey,soccer 90 true 23 1877
|
|
121
123
|
* ```
|
|
122
124
|
*/
|
|
123
125
|
export declare function atlasFacets(): AtlasFacets;
|
|
124
|
-
/** The options `drawKyogijo` takes to draw a
|
|
126
|
+
/** The options `drawKyogijo` takes to draw a surface a place offers. */
|
|
127
|
+
export type PlaceSurface = {
|
|
128
|
+
sport: BudoSport;
|
|
129
|
+
league?: string;
|
|
130
|
+
budo?: BudoStyle;
|
|
131
|
+
dojo?: DojoSpec;
|
|
132
|
+
} | {
|
|
133
|
+
sport: "mlb";
|
|
134
|
+
park: string;
|
|
135
|
+
} | {
|
|
136
|
+
sport: "soccer";
|
|
137
|
+
ground?: string;
|
|
138
|
+
} | {
|
|
139
|
+
sport: "nhl" | "nba";
|
|
140
|
+
arena?: string;
|
|
141
|
+
} | {
|
|
142
|
+
sport: "nfl" | "cfl" | "afl" | "cricket";
|
|
143
|
+
} | {
|
|
144
|
+
sport: "rugby";
|
|
145
|
+
league?: "nrl";
|
|
146
|
+
};
|
|
147
|
+
/** The sports `surfaceOf` can be asked for. */
|
|
148
|
+
export type SurfaceSport = PlaceSurface["sport"];
|
|
149
|
+
/**
|
|
150
|
+
* 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.
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* import { hallSurfaces, placeById } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
154
|
+
* console.log(hallSurfaces(placeById("kodokan")!).map((surface) => `${surface.id} ${surface.mats}`).join());
|
|
155
|
+
* // main-dojo 420,main-dojo-earlier 420,school-dojo 240,international-dojo 192,womens-dojo 240,boys-dojo 114
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export declare const hallSurfaces: (place: Place) => readonly HallSurface[];
|
|
159
|
+
/**
|
|
160
|
+
* 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
|
|
161
|
+
* 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
|
|
162
|
+
* 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.
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* import { placeById, surfacesOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
166
|
+
* console.log(surfacesOf(placeById("bc-place")!).map((surface) => surface.sport).join());
|
|
167
|
+
* // soccer,cfl
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export declare function surfacesOf(place: Place): PlaceSurface[];
|
|
171
|
+
/**
|
|
172
|
+
* 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
|
|
173
|
+
* `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
|
|
174
|
+
* that sport has played there: `surfaceOf(bcPlace, "cfl")` is `{ sport: "cfl" }` and `surfaceOf(fenwayPark, "cfl")` is `undefined`.
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* import { placeById, surfaceOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
178
|
+
* const bcPlace = placeById("bc-place")!;
|
|
179
|
+
* console.log(surfaceOf(bcPlace), surfaceOf(bcPlace, "cfl"), surfaceOf(bcPlace, "mlb"));
|
|
180
|
+
* // { sport: 'soccer', ground: 'bc-place' } { sport: 'cfl' } undefined
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
125
183
|
export declare function surfaceOf(place: Place): {
|
|
126
184
|
sport: "mlb";
|
|
127
185
|
park: string;
|
|
128
186
|
} | {
|
|
129
187
|
sport: "soccer";
|
|
130
188
|
ground: string;
|
|
131
|
-
}
|
|
189
|
+
} | {
|
|
190
|
+
sport: "nhl" | "nba";
|
|
191
|
+
arena: string;
|
|
192
|
+
} | PlaceSurface;
|
|
193
|
+
export declare function surfaceOf(place: Place, sport: SurfaceSport): PlaceSurface | undefined;
|
|
194
|
+
/** What `tenantsOf` keeps: every field given must match. */
|
|
195
|
+
export interface TenantFilter {
|
|
196
|
+
/** Keep the clubs that played there in this year. A bound the data does not give does not shut a club out. */
|
|
197
|
+
year?: number;
|
|
198
|
+
league?: string | readonly string[];
|
|
199
|
+
sport?: TenantSport | readonly TenantSport[];
|
|
200
|
+
/** `true` keeps the clubs that play there still (no last year), `false` those that have left. */
|
|
201
|
+
current?: boolean;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 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).
|
|
205
|
+
* Give a place, or its key.
|
|
206
|
+
* @example
|
|
207
|
+
* ```ts
|
|
208
|
+
* import { placeById, tenantsOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
209
|
+
* const expos = tenantsOf("olympic-stadium-montreal").map((t) => `${t.club} (${t.league}) ${t.from}-${t.to ?? ""}`);
|
|
210
|
+
* console.log(expos[0], tenantsOf(placeById("bc-place")!, { current: true }).map((t) => t.club).join(", "));
|
|
211
|
+
* // Montreal Expos (MLB) 1977-2004 BC Lions, Vancouver Whitecaps FC
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
export declare function tenantsOf(place: Place | string | undefined, filter?: TenantFilter): Tenant[];
|
|
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 declare function placesByClub(name: string | undefined): Place[];
|
package/dist/atlas.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { ARENAS, ARENA_IDS } from "./arenas.js";
|
|
1
2
|
import { GROUNDS, GROUND_IDS } from "./grounds.js";
|
|
3
|
+
import { HALLS } from "./halls.js";
|
|
2
4
|
import { nameContainsAll, placesNamed, plainName } from "./names.js";
|
|
3
5
|
import { PARKS, PARK_IDS } from "./parks.js";
|
|
6
|
+
import { SURFACE_OF_SPORT, TENANTS, hasSurface, leaguesOf, playedIn } from "./tenants.js";
|
|
4
7
|
const leaguesOfGround = (ground) => {
|
|
5
8
|
const leagues = [];
|
|
6
9
|
if (ground.tournaments.some((t) => t.competition === "world-cup"))
|
|
@@ -9,7 +12,9 @@ const leaguesOfGround = (ground) => {
|
|
|
9
12
|
leagues.push("FIFA Women's World Cup");
|
|
10
13
|
return leagues;
|
|
11
14
|
};
|
|
15
|
+
const withoutRepeats = (...lists) => [...new Set(lists.flat())];
|
|
12
16
|
const fromPark = (park) => {
|
|
17
|
+
const tenants = TENANTS[park.id] ?? [];
|
|
13
18
|
const from = park.from ?? park.opened;
|
|
14
19
|
const to = park.to ?? park.closed;
|
|
15
20
|
return {
|
|
@@ -21,7 +26,9 @@ const fromPark = (park) => {
|
|
|
21
26
|
...(park.localName === undefined ? {} : { localName: park.localName, localLanguage: park.localLanguage }),
|
|
22
27
|
aliases: park.aliases ?? [],
|
|
23
28
|
sport: "baseball",
|
|
24
|
-
|
|
29
|
+
sports: ["baseball"],
|
|
30
|
+
leagues: withoutRepeats([park.league], leaguesOf(tenants)),
|
|
31
|
+
tenants,
|
|
25
32
|
country: park.country,
|
|
26
33
|
city: park.city,
|
|
27
34
|
team: park.team,
|
|
@@ -44,7 +51,9 @@ const fromGround = (ground) => ({
|
|
|
44
51
|
aliases: ground.aliases ?? [],
|
|
45
52
|
...(ground.names === undefined ? {} : { names: ground.names }),
|
|
46
53
|
sport: "soccer",
|
|
47
|
-
|
|
54
|
+
sports: ["soccer"],
|
|
55
|
+
leagues: withoutRepeats(leaguesOf(TENANTS[ground.id] ?? []), leaguesOfGround(ground)),
|
|
56
|
+
tenants: TENANTS[ground.id] ?? [],
|
|
48
57
|
country: ground.country,
|
|
49
58
|
city: ground.city,
|
|
50
59
|
lat: ground.lat,
|
|
@@ -53,10 +62,46 @@ const fromGround = (ground) => ({
|
|
|
53
62
|
...(ground.from === undefined ? {} : { from: ground.from }),
|
|
54
63
|
...(ground.status === "past" && ground.to !== undefined ? { to: ground.to } : {}),
|
|
55
64
|
wikidata: ground.wikidata,
|
|
65
|
+
...(ground.track === true ? { track: true } : {}),
|
|
56
66
|
});
|
|
67
|
+
/** The sports an arena is drawn for, by the clubs that played there: hockey first when any ice hockey club did. */
|
|
68
|
+
const sportsOfArena = (tenants) => {
|
|
69
|
+
const out = [];
|
|
70
|
+
if (tenants.some((tenant) => tenant.sport === "ice-hockey" && hasSurface(tenant)))
|
|
71
|
+
out.push("hockey");
|
|
72
|
+
if (tenants.some((tenant) => tenant.sport === "basketball" && hasSurface(tenant)))
|
|
73
|
+
out.push("basketball");
|
|
74
|
+
return out;
|
|
75
|
+
};
|
|
76
|
+
const fromArena = (arena) => {
|
|
77
|
+
const tenants = TENANTS[arena.id] ?? [];
|
|
78
|
+
const sports = sportsOfArena(tenants);
|
|
79
|
+
return {
|
|
80
|
+
id: arena.id,
|
|
81
|
+
kind: "arena",
|
|
82
|
+
name: arena.name,
|
|
83
|
+
nameJa: arena.nameJa,
|
|
84
|
+
...(arena.readingJa === undefined ? {} : { readingJa: arena.readingJa }),
|
|
85
|
+
...(arena.localName === undefined ? {} : { localName: arena.localName, localLanguage: arena.localLanguage }),
|
|
86
|
+
aliases: arena.aliases ?? [],
|
|
87
|
+
...(arena.names === undefined ? {} : { names: arena.names }),
|
|
88
|
+
sport: sports[0] ?? "hockey",
|
|
89
|
+
sports: sports.length === 0 ? ["hockey"] : sports,
|
|
90
|
+
leagues: leaguesOf(tenants),
|
|
91
|
+
tenants,
|
|
92
|
+
country: arena.country,
|
|
93
|
+
city: arena.city,
|
|
94
|
+
lat: arena.lat,
|
|
95
|
+
lon: arena.lon,
|
|
96
|
+
status: arena.status,
|
|
97
|
+
...(arena.from === undefined ? {} : { from: arena.from }),
|
|
98
|
+
...(arena.status === "past" && arena.to !== undefined ? { to: arena.to } : {}),
|
|
99
|
+
wikidata: arena.wikidata,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
57
102
|
/**
|
|
58
|
-
* Every place the package draws, parks first
|
|
59
|
-
* `PARKS` and the
|
|
103
|
+
* Every place the package draws, parks first, then grounds, then arenas, each in the order of its own list: the ballparks of
|
|
104
|
+
* `PARKS`, the soccer grounds of `GROUNDS` and the hockey and basketball arenas of `ARENAS`, with where each stands.
|
|
60
105
|
* @example
|
|
61
106
|
* ```ts
|
|
62
107
|
* import { PLACES } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
@@ -65,7 +110,27 @@ const fromGround = (ground) => ({
|
|
|
65
110
|
* // Fenway Park 42.34639 -71.0975 US
|
|
66
111
|
* ```
|
|
67
112
|
*/
|
|
68
|
-
|
|
113
|
+
const fromHall = (hall) => ({
|
|
114
|
+
id: hall.id,
|
|
115
|
+
kind: "hall",
|
|
116
|
+
name: hall.name,
|
|
117
|
+
nameJa: hall.nameJa,
|
|
118
|
+
...(hall.readingJa === undefined ? {} : { readingJa: hall.readingJa }),
|
|
119
|
+
aliases: hall.aliases,
|
|
120
|
+
sport: "budo",
|
|
121
|
+
sports: ["budo"],
|
|
122
|
+
leagues: hall.leagues,
|
|
123
|
+
tenants: [],
|
|
124
|
+
country: hall.country,
|
|
125
|
+
city: hall.city,
|
|
126
|
+
lat: hall.lat,
|
|
127
|
+
lon: hall.lon,
|
|
128
|
+
status: "current",
|
|
129
|
+
from: hall.from,
|
|
130
|
+
wikidata: hall.wikidata,
|
|
131
|
+
hall,
|
|
132
|
+
});
|
|
133
|
+
export const PLACES = Object.freeze([...PARK_IDS.map((id) => fromPark(PARKS[id])), ...GROUND_IDS.map((id) => fromGround(GROUNDS[id])), ...HALLS.map(fromHall), ...ARENA_IDS.map((id) => fromArena(ARENAS[id]))]);
|
|
69
134
|
const BY_ID = new Map(PLACES.map((place) => [place.id, place]));
|
|
70
135
|
/** The place with a key, or `undefined`. */
|
|
71
136
|
export const placeById = (id) => (id === undefined ? undefined : BY_ID.get(id));
|
|
@@ -104,7 +169,7 @@ export function placesBy(filter = {}) {
|
|
|
104
169
|
const year = filter.year !== undefined && Number.isFinite(filter.year) ? filter.year : undefined;
|
|
105
170
|
const words = filter.text === undefined ? [] : filter.text.split(/\s+/).map(plain).filter(Boolean);
|
|
106
171
|
return PLACES.filter((place) => {
|
|
107
|
-
if (sports !== undefined && !sports.includes(
|
|
172
|
+
if (sports !== undefined && !place.sports.some((sport) => sports.includes(sport)))
|
|
108
173
|
return false;
|
|
109
174
|
if (kinds !== undefined && !kinds.includes(place.kind))
|
|
110
175
|
return false;
|
|
@@ -118,7 +183,9 @@ export function placesBy(filter = {}) {
|
|
|
118
183
|
return false;
|
|
119
184
|
if (words.length > 0) {
|
|
120
185
|
const haystack = plain([place.city, place.team, place.country].filter(Boolean).join(" "));
|
|
121
|
-
|
|
186
|
+
// A word may be in the name of any one club that played there.
|
|
187
|
+
const clubs = place.tenants.map((tenant) => plain([tenant.club, tenant.clubJa, ...(tenant.aliasesJa ?? [])].filter(Boolean).join(" ")));
|
|
188
|
+
if (!words.every((word) => haystack.includes(word) || nameContainsAll(place, [word]) || clubs.some((club) => club.includes(word))))
|
|
122
189
|
return false;
|
|
123
190
|
}
|
|
124
191
|
return true;
|
|
@@ -130,8 +197,8 @@ export function placesBy(filter = {}) {
|
|
|
130
197
|
* ```ts
|
|
131
198
|
* import { atlasFacets } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
132
199
|
* const { sports, leagues, countries, years } = atlasFacets();
|
|
133
|
-
* console.log(sports.join(), leagues.
|
|
134
|
-
* // baseball,soccer
|
|
200
|
+
* console.log(sports.join(), leagues.length, leagues.includes("CFL"), countries.length, years.min);
|
|
201
|
+
* // baseball,basketball,budo,hockey,soccer 90 true 23 1877
|
|
135
202
|
* ```
|
|
136
203
|
*/
|
|
137
204
|
export function atlasFacets() {
|
|
@@ -143,7 +210,125 @@ export function atlasFacets() {
|
|
|
143
210
|
years: { min: Math.min(...years), max: Math.max(...years) },
|
|
144
211
|
};
|
|
145
212
|
}
|
|
146
|
-
/** The
|
|
147
|
-
|
|
148
|
-
|
|
213
|
+
/** The rink (`hockey`) or the court (`basketball`) of an arena, drawn at the arena's own size where the data has one. */
|
|
214
|
+
const arenaSurface = (place, sport) => ({ sport: sport === "basketball" ? "nba" : "nhl", arena: place.id });
|
|
215
|
+
/** The options that draw a surface of a hall. */
|
|
216
|
+
const hallOptions = (surface) => ({ sport: surface.sport, ...surface.options });
|
|
217
|
+
/**
|
|
218
|
+
* 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.
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* import { hallSurfaces, placeById } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
222
|
+
* console.log(hallSurfaces(placeById("kodokan")!).map((surface) => `${surface.id} ${surface.mats}`).join());
|
|
223
|
+
* // main-dojo 420,main-dojo-earlier 420,school-dojo 240,international-dojo 192,womens-dojo 240,boys-dojo 114
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
export const hallSurfaces = (place) => (place.kind === "hall" ? (place.hall?.surfaces ?? []) : []);
|
|
227
|
+
/**
|
|
228
|
+
* 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
|
|
229
|
+
* 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
|
|
230
|
+
* 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.
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* import { placeById, surfacesOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
234
|
+
* console.log(surfacesOf(placeById("bc-place")!).map((surface) => surface.sport).join());
|
|
235
|
+
* // soccer,cfl
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export function surfacesOf(place) {
|
|
239
|
+
if (place.kind === "hall")
|
|
240
|
+
return (place.hall?.surfaces ?? []).map(hallOptions);
|
|
241
|
+
// An arena's surfaces are its rink and its court, each at the arena's own size where the sources publish one.
|
|
242
|
+
const own = place.kind === "park" ? { sport: "mlb", park: place.id } : place.kind === "arena" ? arenaSurface(place, place.sport) : { sport: "soccer", ground: place.id };
|
|
243
|
+
const out = [own];
|
|
244
|
+
if (place.kind === "arena")
|
|
245
|
+
for (const sport of place.sports)
|
|
246
|
+
if (sport !== place.sport)
|
|
247
|
+
out.push(arenaSurface(place, sport));
|
|
248
|
+
for (const tenant of place.tenants) {
|
|
249
|
+
const drawn = SURFACE_OF_SPORT[tenant.sport];
|
|
250
|
+
if (drawn === undefined || !hasSurface(tenant))
|
|
251
|
+
continue;
|
|
252
|
+
// A baseball club's fence is a park's: a ground has none to draw.
|
|
253
|
+
if (drawn.sport === "mlb")
|
|
254
|
+
continue;
|
|
255
|
+
// An arena's rink and court are already offered, at its size.
|
|
256
|
+
if (place.kind === "arena" && (drawn.sport === "nhl" || drawn.sport === "nba"))
|
|
257
|
+
continue;
|
|
258
|
+
const surface = drawn.sport === "soccer" ? { sport: "soccer" } : drawn.sport === "rugby" ? { sport: "rugby", ...(drawn.league === undefined ? {} : { league: drawn.league }) } : { sport: drawn.sport };
|
|
259
|
+
if (out.some((have) => have.sport === surface.sport && (have.sport !== "rugby" || have.league === surface.league)))
|
|
260
|
+
continue;
|
|
261
|
+
out.push(surface);
|
|
262
|
+
}
|
|
263
|
+
return out;
|
|
264
|
+
}
|
|
265
|
+
export function surfaceOf(place, sport) {
|
|
266
|
+
if (place.kind === "hall")
|
|
267
|
+
return sport === undefined ? surfacesOf(place)[0] : surfacesOf(place).find((surface) => surface.sport === sport);
|
|
268
|
+
if (sport === undefined)
|
|
269
|
+
return place.kind === "park" ? { sport: "mlb", park: place.id } : place.kind === "arena" ? arenaSurface(place, place.sport) : { sport: "soccer", ground: place.id };
|
|
270
|
+
return surfacesOf(place).find((surface) => surface.sport === sport);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* 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).
|
|
274
|
+
* Give a place, or its key.
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* import { placeById, tenantsOf } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
278
|
+
* const expos = tenantsOf("olympic-stadium-montreal").map((t) => `${t.club} (${t.league}) ${t.from}-${t.to ?? ""}`);
|
|
279
|
+
* console.log(expos[0], tenantsOf(placeById("bc-place")!, { current: true }).map((t) => t.club).join(", "));
|
|
280
|
+
* // Montreal Expos (MLB) 1977-2004 BC Lions, Vancouver Whitecaps FC
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export function tenantsOf(place, filter = {}) {
|
|
284
|
+
const found = typeof place === "string" ? BY_ID.get(place) : place;
|
|
285
|
+
if (found === undefined)
|
|
286
|
+
return [];
|
|
287
|
+
const leagues = many(filter.league);
|
|
288
|
+
const sports = many(filter.sport);
|
|
289
|
+
const year = filter.year !== undefined && Number.isFinite(filter.year) ? filter.year : undefined;
|
|
290
|
+
return found.tenants.filter((tenant) => {
|
|
291
|
+
if (leagues !== undefined && !leagues.includes(tenant.league))
|
|
292
|
+
return false;
|
|
293
|
+
if (sports !== undefined && !sports.includes(tenant.sport))
|
|
294
|
+
return false;
|
|
295
|
+
if (filter.current !== undefined && (tenant.to === undefined) !== filter.current)
|
|
296
|
+
return false;
|
|
297
|
+
return year === undefined || playedIn(tenant, year);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* 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
|
|
302
|
+
* 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.
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* import { placesByClub } from "@johnmorrisdotca/kyogijo-stadiums/atlas";
|
|
306
|
+
* console.log(placesByClub("BC Lions").map((place) => place.id).join(), placesByClub("Montreal Expos").map((place) => place.id).join());
|
|
307
|
+
* // bc-place jarry-park-stadium,olympic-stadium-montreal
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
export function placesByClub(name) {
|
|
311
|
+
if (name === undefined)
|
|
312
|
+
return [];
|
|
313
|
+
const wanted = plain(name);
|
|
314
|
+
const words = name.split(/\s+/).map(plain).filter(Boolean);
|
|
315
|
+
if (wanted === "")
|
|
316
|
+
return [];
|
|
317
|
+
const ranked = [];
|
|
318
|
+
PLACES.forEach((place, index) => {
|
|
319
|
+
let best;
|
|
320
|
+
for (const tenant of place.tenants) {
|
|
321
|
+
for (const club of [tenant.club, tenant.clubJa, ...(tenant.aliasesJa ?? [])]) {
|
|
322
|
+
if (club === undefined)
|
|
323
|
+
continue;
|
|
324
|
+
const own = plain(club);
|
|
325
|
+
const rank = own === wanted ? 0 : words.every((word) => own.includes(word)) ? 1 : undefined;
|
|
326
|
+
if (rank !== undefined && (best === undefined || rank < best))
|
|
327
|
+
best = rank;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (best !== undefined)
|
|
331
|
+
ranked.push([best, index, place]);
|
|
332
|
+
});
|
|
333
|
+
return ranked.sort((a, b) => a[0] - b[0] || a[1] - b[1]).map((row) => row[2]);
|
|
149
334
|
}
|
package/dist/background.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The ground behind a drawing: a subtle pattern drawn in SVG (felt, grass, wood, ice, paper, a grid, dots) and, when the caller has one, a photograph at an opacity. It is
|
|
2
2
|
// written once here for the drawing (`background` in the options, laid on the apron under the surface) and for a grid of drawings (`drawGrid`, laid under all of them).
|
|
3
3
|
// Every pattern is a few shapes in a tile, with no random number, in the ink or the line colour of the drawing at a low opacity, so that it follows light and dark.
|
|
4
|
-
import { safeColour
|
|
4
|
+
import { safeColour } from "./colour.js";
|
|
5
|
+
import { safeLogo } from "./logo.js";
|
|
5
6
|
import { el, num } from "./format.js";
|
|
6
7
|
/** The patterns, in the order a menu lists them. */
|
|
7
8
|
export const BACKGROUND_PATTERNS = ["felt", "grass", "wood", "ice", "paper", "grid", "dots"];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Language, SurfaceOptions, Team } from "../types.ts";
|
|
2
|
+
import type { DojoFigures } from "../leagues/budo.ts";
|
|
3
|
+
import { type BudoPlan } from "./plan.ts";
|
|
4
|
+
type Opt = Pick<SurfaceOptions, "sport" | "league" | "budo" | "dojo" | "range" | "detail">;
|
|
5
|
+
/** The sentence about the surface, as a fragment: "a judo contest area of 10 by 10 metres in a safety area 4 metres wide...". */
|
|
6
|
+
export declare function budoAbout(o: Opt, language: Language, plan?: BudoPlan): string;
|
|
7
|
+
/** The sentences that follow it: what the options mark. Each starts after a gap. */
|
|
8
|
+
export declare function budoSentences(o: Opt, language: Language, plan?: BudoPlan): string;
|
|
9
|
+
/** The mat of a dojo league, for a caller that wants its size in words. */
|
|
10
|
+
export declare const dojoMat: (f: DojoFigures) => string;
|
|
11
|
+
/** What each side scored, in sentences, for a judo, karate, kendo or sumo score: the counts the board shows. Each starts after a gap. */
|
|
12
|
+
export declare function budoScoreSentences(sport: string, order: readonly Pick<Team, "name" | "budo">[], language: Language): string;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// What a budō drawing says of itself: its sentence about the surface, and what the options mark on it. Built from the plan, so that the words and the drawing agree.
|
|
2
|
+
import { fill, KYOGIJO_STRINGS } from "../strings.js";
|
|
3
|
+
import { budoView } from "../budo.score.js";
|
|
4
|
+
import { kimariteName } from "./kimarite.js";
|
|
5
|
+
import { budoPlan } from "./plan.js";
|
|
6
|
+
const trim = (n) => String(Math.round(n * 100) / 100);
|
|
7
|
+
const cm = (n) => String(Math.round(n * 1000) / 10);
|
|
8
|
+
/** The sentence about the surface, as a fragment: "a judo contest area of 10 by 10 metres in a safety area 4 metres wide...". */
|
|
9
|
+
export function budoAbout(o, language, plan = budoPlan(o)) {
|
|
10
|
+
const words = KYOGIJO_STRINGS[language].budo;
|
|
11
|
+
const mat = (m) => fill(words.tatami, { length: trim(m.length), width: trim(m.width) });
|
|
12
|
+
if (plan.judo !== undefined) {
|
|
13
|
+
const L = plan.judo;
|
|
14
|
+
const c = L.contests[0];
|
|
15
|
+
const contest = trim(c.x1 - c.x0);
|
|
16
|
+
const safety = trim(c.x0);
|
|
17
|
+
const tatami = mat(L.mat);
|
|
18
|
+
if (plan.league === "ijf-kata")
|
|
19
|
+
return fill(words.judoKata, { contest, safety, tatami });
|
|
20
|
+
return L.contests.length > 1 ? fill(words.judoMany, { areas: L.contests.length, contest, safety, gap: trim(L.gap), tatami }) : fill(words.judo, { contest, safety, tatami });
|
|
21
|
+
}
|
|
22
|
+
if (plan.karate !== undefined) {
|
|
23
|
+
const L = plan.karate;
|
|
24
|
+
const area = trim(L.areas[0].x1 - L.areas[0].x0);
|
|
25
|
+
const safety = trim(L.areas[0].x0);
|
|
26
|
+
if (plan.league === "wkf-kata")
|
|
27
|
+
return fill(words.karateKata, { area, safety });
|
|
28
|
+
return L.areas.length > 1 ? fill(words.karateMany, { areas: L.areas.length, area, gap: trim(L.gap), safety }) : fill(words.karate, { area, safety });
|
|
29
|
+
}
|
|
30
|
+
if (plan.kendo !== undefined)
|
|
31
|
+
return fill(words.kendo, { side: trim(plan.kendo.side) });
|
|
32
|
+
if (plan.sumo !== undefined) {
|
|
33
|
+
const L = plan.sumo;
|
|
34
|
+
const fig = plan.figures;
|
|
35
|
+
const bare = !L.parts.areas.some((a) => a.id === "tawara");
|
|
36
|
+
return fill(bare ? words.sumoBare : words.sumo, { platform: trim(fig.platform), height: cm(L.height), circle: trim(fig.circle), count: fig.tawara.count });
|
|
37
|
+
}
|
|
38
|
+
if (plan.kyudo !== undefined) {
|
|
39
|
+
const L = plan.kyudo;
|
|
40
|
+
const fig = plan.figures;
|
|
41
|
+
return fill(plan.league === "enteki" ? words.kyudoEnteki : words.kyudo, { n: L.shooters, distance: trim(fig.distance) });
|
|
42
|
+
}
|
|
43
|
+
const L = plan.dojo;
|
|
44
|
+
if (L === undefined)
|
|
45
|
+
return "";
|
|
46
|
+
const template = L.pattern === "competition" ? words.dojoCompetition : L.pattern === "checker" ? words.dojoChecker : L.pattern === "border" ? words.dojoBorder : words.dojoTraditional;
|
|
47
|
+
return fill(template, { jo: trim(L.jo), width: trim(L.width), length: trim(L.length), mat: fill(words.tatami, { length: trim(L.mat.length), width: trim(L.mat.width) }) });
|
|
48
|
+
}
|
|
49
|
+
/** The sentences that follow it: what the options mark. Each starts after a gap. */
|
|
50
|
+
export function budoSentences(o, language, plan = budoPlan(o)) {
|
|
51
|
+
const words = KYOGIJO_STRINGS[language].budo;
|
|
52
|
+
const { gap } = KYOGIJO_STRINGS[language].said;
|
|
53
|
+
const out = [];
|
|
54
|
+
if (plan.judo !== undefined) {
|
|
55
|
+
const L = plan.judo;
|
|
56
|
+
const fig = plan.figures;
|
|
57
|
+
if (L.danger > 0)
|
|
58
|
+
out.push(words.danger);
|
|
59
|
+
if (o.budo?.platform === true)
|
|
60
|
+
out.push(words.platform);
|
|
61
|
+
if (plan.shapes.some((s) => s.kind === "bar" && s.feature.startsWith("start")) && fig.marks !== null)
|
|
62
|
+
out.push(fill(words.start, { apart: trim(2 * fig.marks.fromCentre) }));
|
|
63
|
+
if (o.budo?.officials === true)
|
|
64
|
+
out.push(words.officials);
|
|
65
|
+
}
|
|
66
|
+
if (plan.karate !== undefined && plan.areas.some((a) => a.feature === "judges" || a.feature === "referee"))
|
|
67
|
+
out.push(words.karateOfficials);
|
|
68
|
+
if (plan.sumo !== undefined && plan.areas.some((a) => a.feature === "tassels"))
|
|
69
|
+
out.push(words.tassels);
|
|
70
|
+
if (plan.dojo !== undefined) {
|
|
71
|
+
const L = plan.dojo;
|
|
72
|
+
out.push(fill(words.dojoKamiza, { side: words.sides[L.kamiza] }));
|
|
73
|
+
if (L.dais !== undefined)
|
|
74
|
+
out.push(words.dojoDais);
|
|
75
|
+
if (L.banner !== undefined)
|
|
76
|
+
out.push(words.dojoBanner);
|
|
77
|
+
if (L.shrine !== undefined)
|
|
78
|
+
out.push(words.dojoShinzen);
|
|
79
|
+
if (L.contests.length > 0)
|
|
80
|
+
out.push(fill(words.dojoAreas, { n: L.contests.length }));
|
|
81
|
+
}
|
|
82
|
+
return out.map((t) => `${gap}${t}`).join("");
|
|
83
|
+
}
|
|
84
|
+
/** The mat of a dojo league, for a caller that wants its size in words. */
|
|
85
|
+
export const dojoMat = (f) => `${trim(f.mat.length)} × ${trim(f.mat.width)} m`;
|
|
86
|
+
/** What each side scored, in sentences, for a judo, karate, kendo or sumo score: the counts the board shows. Each starts after a gap. */
|
|
87
|
+
export function budoScoreSentences(sport, order, language) {
|
|
88
|
+
const words = KYOGIJO_STRINGS[language].budo;
|
|
89
|
+
const { gap } = KYOGIJO_STRINGS[language].said;
|
|
90
|
+
const sep = KYOGIJO_STRINGS[language].layers.listSep;
|
|
91
|
+
const out = [];
|
|
92
|
+
for (const team of order) {
|
|
93
|
+
const v = budoView(team.budo);
|
|
94
|
+
if (v === undefined)
|
|
95
|
+
continue;
|
|
96
|
+
const list = [];
|
|
97
|
+
const count = (n, label) => {
|
|
98
|
+
if (n !== undefined && n > 0)
|
|
99
|
+
list.push(language === "ja" ? `${label}${n}` : `${n} ${label.toLowerCase()}`);
|
|
100
|
+
};
|
|
101
|
+
if (sport === "judo" || sport === "karate") {
|
|
102
|
+
count(v.ippon, words.board.ippon);
|
|
103
|
+
count(v.wazaari, words.board.wazaari);
|
|
104
|
+
count(v.yuko, words.board.yuko);
|
|
105
|
+
count(v.shido, sport === "judo" ? words.board.shido : words.board.chui);
|
|
106
|
+
if (v.senshu === true)
|
|
107
|
+
list.push(words.board.senshu);
|
|
108
|
+
if (list.length > 0)
|
|
109
|
+
out.push(fill(sport === "judo" ? words.board.judoScore : words.board.karateScore, { name: team.name, list: list.join(sep) }));
|
|
110
|
+
}
|
|
111
|
+
else if (sport === "kendo" && v.techniques !== undefined) {
|
|
112
|
+
const named = v.techniques.map((t) => words.board.techniques[t] ?? t);
|
|
113
|
+
out.push(fill(words.board.kendoScore, { name: team.name, list: named.join(sep) }));
|
|
114
|
+
}
|
|
115
|
+
else if (sport === "sumo" && v.kimarite !== undefined) {
|
|
116
|
+
out.push(fill(words.board.sumoScore, { name: team.name, kimarite: kimariteName(v.kimarite, language) }));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return out.map((t) => `${gap}${t}`).join("");
|
|
120
|
+
}
|