@johnmorrisdotca/kyogijo-stadiums 0.5.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 +58 -0
- package/NOTICE.md +179 -3
- package/README.md +43 -11
- 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/atlas-entry.d.ts +3 -1
- package/dist/atlas-entry.js +3 -2
- package/dist/atlas.d.ts +37 -19
- package/dist/atlas.js +92 -7
- 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.baseball.js +1 -1
- package/dist/charts.js +4 -4
- package/dist/charts.soccer.js +3 -3
- package/dist/charts.types.d.ts +10 -0
- package/dist/colour.d.ts +4 -4
- package/dist/colour.js +4 -4
- package/dist/crowd.d.ts +11 -1
- package/dist/crowd.draw.js +15 -9
- package/dist/crowd.js +17 -2
- package/dist/draw.js +156 -31
- package/dist/element-entry.d.ts +2 -0
- package/dist/element-entry.js +1 -0
- package/dist/element.d.ts +2 -2
- package/dist/element.js +2 -1
- 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 +73 -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 +9 -3
- 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 +9 -1
- package/dist/halls.d.ts +65 -0
- package/dist/halls.js +122 -0
- package/dist/heat.js +17 -10
- package/dist/heat.zones.d.ts +4 -2
- package/dist/heat.zones.js +55 -3
- package/dist/homeside.js +7 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.js +8 -1
- 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 +10 -1
- package/dist/layers.env.js +33 -3
- package/dist/layers.js +30 -11
- package/dist/layers.types.d.ts +9 -2
- package/dist/leagues/budo.d.ts +196 -0
- package/dist/leagues/budo.js +105 -0
- package/dist/leagues/hockey.js +41 -19
- package/dist/leagues/sources.js +21 -0
- package/dist/leagues/types.d.ts +1 -1
- package/dist/leagues.d.ts +4 -1
- package/dist/leagues.js +102 -2
- 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/outline.d.ts +1 -1
- package/dist/outline.js +17 -3
- package/dist/pageant.js +7 -3
- 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 +7 -7
- package/dist/pool.figures.d.ts +57 -55
- package/dist/pool.figures.js +59 -55
- package/dist/pool.js +7 -7
- package/dist/pool.labels.js +2 -1
- package/dist/ranges.names.js +6 -0
- 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 +23 -1
- 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/strings.d.ts +175 -1
- package/dist/strings.js +364 -20
- package/dist/style.js +9 -2
- package/dist/surfaces/artistic.d.ts +3 -3
- package/dist/surfaces/artistic.js +3 -3
- package/dist/surfaces/baseball.js +2 -0
- package/dist/surfaces/basketball.js +1 -1
- package/dist/surfaces/budo.d.ts +6 -0
- package/dist/surfaces/budo.js +104 -0
- package/dist/surfaces/dive.d.ts +3 -3
- package/dist/surfaces/dive.js +3 -3
- package/dist/surfaces/football.js +7 -0
- package/dist/surfaces/hockey.js +3 -2
- package/dist/surfaces/polo.d.ts +4 -4
- package/dist/surfaces/polo.js +5 -5
- package/dist/surfaces/pool.d.ts +1 -1
- package/dist/surfaces/pool.js +3 -3
- package/dist/surfaces/surface.d.ts +32 -0
- package/dist/surfaces/venue.d.ts +1 -1
- package/dist/surfaces/venue.js +1 -1
- 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.data.js +848 -0
- package/dist/turn-entry.d.ts +2 -2
- package/dist/turn-entry.js +1 -1
- package/dist/turn.camera.d.ts +12 -1
- package/dist/turn.camera.js +18 -2
- package/dist/turn.dom.js +11 -9
- package/dist/turn.kit.d.ts +2 -2
- package/dist/turn.style.js +4 -3
- package/dist/types.d.ts +43 -7
- package/dist/units.js +7 -0
- package/dist/uprights.budo.d.ts +17 -0
- package/dist/uprights.budo.js +87 -0
- package/dist/uprights.js +10 -1
- package/dist/uprights.pools.js +4 -4
- 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 +39 -3
package/dist/pool.js
CHANGED
|
@@ -30,7 +30,7 @@ export function commonOf(style) {
|
|
|
30
30
|
const seed = style.seed === undefined ? 1 : Math.trunc(num(style.seed, "The pool's seed", -1e9, 1e9));
|
|
31
31
|
return { look, deck, seed };
|
|
32
32
|
}
|
|
33
|
-
/** The colour of rope `i` of `n + 1`: green outside, yellow round the middle, blue between (
|
|
33
|
+
/** The colour of rope `i` of `n + 1`: green outside, yellow round the middle, blue between (Part Two 15.7.6.1 and 15.7.6.3 for eight lanes; 15.7.6.2 for ten). */
|
|
34
34
|
export function ropeColour(i, lanes) {
|
|
35
35
|
if (i === 0 || i === lanes)
|
|
36
36
|
return "green";
|
|
@@ -49,7 +49,7 @@ export function laneWidths(course, lanes, temporary) {
|
|
|
49
49
|
/** The lanes and the ropes of a pool of this width, from the top. */
|
|
50
50
|
export function lanesOf(width, lanes, space) {
|
|
51
51
|
const lane = SWIMMING.lane;
|
|
52
|
-
// From the bottom wall: the ropes at the edges of the lanes. Ten lanes in the permanent pool: the end ropes 0.1 m from the walls, the others 2.5 m apart from 2.5 m, so that the markings stay 2.5 m apart (
|
|
52
|
+
// From the bottom wall: the ropes at the edges of the lanes. Ten lanes in the permanent pool: the end ropes 0.1 m from the walls, the others 2.5 m apart from 2.5 m, so that the markings stay 2.5 m apart (Part Two 15.13.2).
|
|
53
53
|
const fromBottom = [];
|
|
54
54
|
for (let k = 0; k <= lanes; k += 1)
|
|
55
55
|
fromBottom.push(lanes === 10 && width === SWIMMING_WIDTHS.permanent ? (k === 0 ? space : k === 10 ? width - space : k * lane) : space + k * lane);
|
|
@@ -64,7 +64,7 @@ export function lanesOf(width, lanes, space) {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* The swimming pool the options ask for: `pool.course` (`long`, 50 m, or `short`, 25 m) and `pool.lanes` (8 by default). The width is the rules' for that many lanes: 25 m for eight in a 50 m
|
|
67
|
-
* pool (
|
|
67
|
+
* pool (Part Two 15.6.1), 25 m for ten with lanes 0 and 9 of 2.4 m (Part Two 15.6.2.1), or 26 m for a temporary pool (Part Two 15.6.2.2), and lanes of 2.5 m with spaces of 0.5 m for the other pools.
|
|
68
68
|
* @throws RangeError for a lane count that is not 1 to 10, @throws Error for an unknown look.
|
|
69
69
|
*/
|
|
70
70
|
export function swimPlan(o, defaults = {}) {
|
|
@@ -101,7 +101,7 @@ export function swimPlan(o, defaults = {}) {
|
|
|
101
101
|
plan.race = racePlan(style.race, lanes.map((l) => l.number), { splitEvery: course === "long" ? 50 : 25, length });
|
|
102
102
|
return plan;
|
|
103
103
|
}
|
|
104
|
-
/** The water polo field the options ask for: 25 by 20 m (
|
|
104
|
+
/** The water polo field the options ask for: 25 by 20 m (Part Six 20.2.2). */
|
|
105
105
|
export function poloPlan(o) {
|
|
106
106
|
const style = o.pool ?? {};
|
|
107
107
|
const table = style.table === "top" ? "top" : "bottom";
|
|
@@ -118,7 +118,7 @@ const BOARDS = {
|
|
|
118
118
|
};
|
|
119
119
|
/**
|
|
120
120
|
* The diving well the options ask for. The springboards (1 m and 3 m, `pool.boards` of each, 2 by default so that a synchronised pair stands side by side) stand along the left wall, 3 m boards outside, each the preferred
|
|
121
|
-
* distance (Appendix 2, B and C) from the wall and from the next; the platforms (5, 7.5 and 10 m by default) stand towards the right wall, the tallest the distance B from it and each lower one the distance C of the
|
|
121
|
+
* distance (Part Four, Appendix 2, B and C) from the wall and from the next; the platforms (5, 7.5 and 10 m by default) stand towards the right wall, the tallest the distance B from it and each lower one the distance C of the
|
|
122
122
|
* platform above it from that one. The well is 25 m across, wider if the boards need more room than that.
|
|
123
123
|
* @throws RangeError for a platform the rules do not have or a count of boards that is not 1 to 4.
|
|
124
124
|
*/
|
|
@@ -179,7 +179,7 @@ export function divePlan(o) {
|
|
|
179
179
|
const behind = Math.max(0, ...all.map((b) => b.length - b.x));
|
|
180
180
|
return { sport: "diving", ...commonOf(style), length: DIVING.well.length, width, boards: all, behind };
|
|
181
181
|
}
|
|
182
|
-
/** The artistic swimming area the options ask for: 30 by 20 m for the Olympic Games and the World Championships, or the least, 25 by 15 m with a 12 by 12 m deep part (
|
|
182
|
+
/** The artistic swimming area the options ask for: 30 by 20 m for the Olympic Games and the World Championships, or the least, 25 by 15 m with a 12 by 12 m deep part (Part Seven 12.2.2, 12.1.1). */
|
|
183
183
|
export function artisticPlan(o) {
|
|
184
184
|
const style = o.pool ?? {};
|
|
185
185
|
const area = style.area === "minimum" ? "minimum" : "olympic";
|
|
@@ -237,7 +237,7 @@ export function reachOf(plan) {
|
|
|
237
237
|
const ROW = 125;
|
|
238
238
|
/**
|
|
239
239
|
* The pools of a hall (`pool.venue`) laid out to scale. A pool with an `x` and a `y` stands there; the others are set in rows, left to right, each `apart` metres (10, the distance the rules prefer between
|
|
240
|
-
* a swimming pool and a diving well,
|
|
240
|
+
* a swimming pool and a diving well, Part Two 15.15.1; never less than the 8 they require) from the one before, and a new row when a row would be longer than 125 m.
|
|
241
241
|
* @throws RangeError when two pools are nearer each other than `apart`, for the pools given places.
|
|
242
242
|
*/
|
|
243
243
|
export function venueLayout(style) {
|
package/dist/pool.labels.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The data of a race on a pool: who is in each lane (the lane number, the flag, the name, the country's letters), what each swam (the place as a medal, the time, the reaction time, the splits) and the
|
|
2
2
|
// split pace bars in the lanes. Drawn in feet in the frame of a pool lying wide; a pool lying tall turns it with the pool, so that the labels lie along the lanes, and only the numbers in the discs are
|
|
3
3
|
// turned back upright. Nothing here is a rule of the sport: the sizes are ours.
|
|
4
|
-
import { safeColour
|
|
4
|
+
import { safeColour } from "./colour.js";
|
|
5
|
+
import { safeLogo } from "./logo.js";
|
|
5
6
|
import { el, esc, num } from "./format.js";
|
|
6
7
|
import { feet } from "./pool.js";
|
|
7
8
|
import { STATUS_TEXT, formatTime, pacePer100, splitMetres } from "./pool.race.js";
|
package/dist/ranges.names.js
CHANGED
|
@@ -72,6 +72,12 @@ export const RANGES = Object.freeze({
|
|
|
72
72
|
range("javelin-throw", "left"),
|
|
73
73
|
range("water-jump", "left"),
|
|
74
74
|
]),
|
|
75
|
+
judo: Object.freeze([range("contest-area", "left"), range("start"), range("half", "left")]),
|
|
76
|
+
karate: Object.freeze([range("contest-area", "left"), range("start"), range("half", "left")]),
|
|
77
|
+
kendo: Object.freeze([range("start"), range("half", "left")]),
|
|
78
|
+
sumo: Object.freeze([range("ring"), range("start"), range("half", "left")]),
|
|
79
|
+
kyudo: Object.freeze([range("shajo"), range("yamichi"), range("azuchi")]),
|
|
80
|
+
dojo: Object.freeze([range("kamiza"), range("half", "left")]),
|
|
75
81
|
});
|
|
76
82
|
const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
77
83
|
/**
|
package/dist/road.draw.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The road chart, drawn: the two finalists' big round marks with their names, the round names down the middle on a dotted road, each finalist's matches on its side as
|
|
2
2
|
// the round marks of both teams with the score between them, and the group stage as a compact row at the foot. Each size has its own arrangement: `card`, `square` and
|
|
3
3
|
// `phone` stack the finalists over the rounds; `wide` puts them at the two ends. Nothing is measured in a browser: type is set by estimates (`textWidth`).
|
|
4
|
-
import { safeColour
|
|
4
|
+
import { safeColour } from "./colour.js";
|
|
5
|
+
import { safeLogo } from "./logo.js";
|
|
5
6
|
import { safeClass } from "./common.js";
|
|
6
7
|
import { el, esc, num } from "./format.js";
|
|
7
8
|
import { KYOGIJO_MARK_STYLE, roundMarkup } from "./mark.js";
|
|
@@ -45,7 +46,7 @@ export function drawRoad(model, o, gid) {
|
|
|
45
46
|
cx,
|
|
46
47
|
cy,
|
|
47
48
|
r,
|
|
48
|
-
href: safeLogo(team.logo),
|
|
49
|
+
href: safeLogo(team.logo, { color: team.color, accent: team.textColor, initials: codeOf(team).slice(0, 3), theme }),
|
|
49
50
|
fit: team.markFit === "contain" ? "contain" : undefined,
|
|
50
51
|
initials: codeOf(team).slice(0, 3),
|
|
51
52
|
color: safeColour(team.color),
|
package/dist/road.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// them, the rounds named down the middle, and the group stage as a compact row at the foot. The idea is that of the "road to the final" graphics that sports sites post
|
|
3
3
|
// for a World Cup or a Stanley Cup; the arrangement, the type and the code are this package's own, and no one's artwork is used: the marks are the caller's flags and
|
|
4
4
|
// logos, or the team's initials on its colour.
|
|
5
|
+
import { withEmblems } from "./emblems-source.js";
|
|
5
6
|
import { hash } from "./format.js";
|
|
6
7
|
import { safeClass } from "./common.js";
|
|
7
8
|
import { drawRoad } from "./road.draw.js";
|
|
@@ -46,7 +47,7 @@ export function roadToFinal(finalists, options = {}) {
|
|
|
46
47
|
check(merged);
|
|
47
48
|
const m = readModel(finalists, merged);
|
|
48
49
|
const gid = safeClass(merged.id).replace(/ /g, "-") || `kr-${hash(JSON.stringify([finalists, merged, VERSION]))}`;
|
|
49
|
-
return drawRoad(m, merged, gid);
|
|
50
|
+
return withEmblems(merged.emblems, () => drawRoad(m, merged, gid));
|
|
50
51
|
};
|
|
51
52
|
return {
|
|
52
53
|
options: { ...options },
|
package/dist/road.types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EmblemRenderer } from "./emblems-source.ts";
|
|
1
2
|
import type { Language, Team } from "./types.ts";
|
|
2
3
|
/** A match's score from the finalist's side: `[for, against]` (numbers, or text such as a series' `4`), or one text, `"4-2"`, that is split at its dash. */
|
|
3
4
|
export type RoadScore = readonly [number | string, number | string] | string;
|
|
@@ -48,6 +49,8 @@ export interface RoadOptions {
|
|
|
48
49
|
language?: Language;
|
|
49
50
|
/** A prefix for the ids inside the drawing. Made from the chart when missing, so that two charts on a page do not share ids. */
|
|
50
51
|
id?: string;
|
|
52
|
+
/** A renderer of ready-made emblems for this chart alone, so that a finalist's `logo` may be an emblem's id. Over the one the page plugged in with `useEmblems`. */
|
|
53
|
+
emblems?: EmblemRenderer;
|
|
51
54
|
/** The tournament, set large at the top. "Road to the final" when missing. */
|
|
52
55
|
title?: string;
|
|
53
56
|
/** The line under it. "Road to the final" when a `title` is given. */
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type Attacking, type Frame, type SurfaceSize } from "./frames.ts";
|
|
2
|
+
import "./frames.providers.ts";
|
|
3
|
+
import "./surfaces/soccer-providers.ts";
|
|
4
|
+
import { type Park } from "./parks.ts";
|
|
5
|
+
import type { Language, Sport, SurfaceOptions } from "./types.ts";
|
|
6
|
+
export { RULE_IDS } from "./rules.types.ts";
|
|
7
|
+
export type { RuleId } from "./rules.types.ts";
|
|
8
|
+
/** A place: `[x, y]` or `{ x, y }`. */
|
|
9
|
+
export type PlaceLike = readonly [number, number] | {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
};
|
|
13
|
+
/** What `zoneAt` and the predicates take besides the point: the surface's own options (the league, the season, the park, the pitch) and the frame the point is in. */
|
|
14
|
+
export interface ZoneOptions extends Partial<Pick<SurfaceOptions, "league" | "year" | "pitch" | "park" | "fence" | "units" | "sheet" | "net" | "field" | "pool" | "athletics" | "skating" | "language">> {
|
|
15
|
+
/** The frame the point is in: the name of a frame (`nhl-api`, `opta`), a frame, or nothing for the drawing's own (feet, or `units`). */
|
|
16
|
+
frame?: Frame | string;
|
|
17
|
+
/** The size of the surface when the frame is a variable one, in place of the drawing's own. */
|
|
18
|
+
size?: SurfaceSize;
|
|
19
|
+
/** The end the point's team attacks, as the surface is drawn wide; `left` turns the numbers a half turn so that the team attacks right. */
|
|
20
|
+
attacking?: Attacking;
|
|
21
|
+
}
|
|
22
|
+
/** What the rules say of a point. */
|
|
23
|
+
export interface ZoneAnswer {
|
|
24
|
+
sport: Sport;
|
|
25
|
+
/** The point on the surface, in feet in the drawing's wide frame, the team attacking the right. */
|
|
26
|
+
at: [number, number];
|
|
27
|
+
/** True when the point is on the surface, or on its edge. Off it, `zone`, `subzone` and `zones` are empty (a ballpark is the exception: its foul ground and the stands beyond the fence are zones). */
|
|
28
|
+
inBounds: boolean;
|
|
29
|
+
/** The zone the point is in: one of a partition of the surface, such as `offensive-zone`. */
|
|
30
|
+
zone: string | undefined;
|
|
31
|
+
/** The finer area in the zone, when there is one: `crease`, `paint`, `six-yard-box`, `warning-track`. */
|
|
32
|
+
subzone: string | undefined;
|
|
33
|
+
/** Every id that holds, the zone and the subzone first. */
|
|
34
|
+
zones: string[];
|
|
35
|
+
/** The zone of each of the package's zone sets for the sport (`ZONE_SETS`) that the point is in. */
|
|
36
|
+
sets: Record<string, string>;
|
|
37
|
+
/** The name of each id in `zones`, in the language asked for. */
|
|
38
|
+
names: Record<string, string>;
|
|
39
|
+
}
|
|
40
|
+
/** The wall height at a bearing: the stretch of the park's fence that covers it in the season, in feet, or `null` where the park's data holds none. */
|
|
41
|
+
export declare function wallHeightAt(park: Park, angle: number, year?: number): number | null;
|
|
42
|
+
/**
|
|
43
|
+
* Where a point lies by the rules of a sport: the zone, the area in it and every other area that holds, each by id and name. Hockey answers in the
|
|
44
|
+
* offensive, neutral and defensive zones with the crease, the trapezoid, the slot, the face-off circles and behind the goal line; basketball in the
|
|
45
|
+
* frontcourt and backcourt with the restricted area, the paint, the mid-range, the corner threes and the arc; soccer in thirds with the six-yard box,
|
|
46
|
+
* the penalty area, the D, the half-spaces and the wings; baseball in the infield, the outfield, foul territory, the warning track and over the
|
|
47
|
+
* wall by the park's own fence; football in the end zones, the halves, the red zone and between the hashes. Every other sport answers in its zone sets.
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { zoneAt } from "@johnmorrisdotca/kyogijo-stadiums/zones";
|
|
51
|
+
* // The NHL API's (69, 22) is the face-off dot in the right end zone: the offensive zone, inside a face-off circle.
|
|
52
|
+
* const dot = zoneAt("nhl", [69, 22], { frame: "nhl-api" });
|
|
53
|
+
* console.log(dot.zone, dot.subzone, dot.zones.includes("faceoff-circle"));
|
|
54
|
+
* // offensive-zone faceoff-circle true
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function zoneAt(sport: Sport, point: PlaceLike, options?: ZoneOptions): ZoneAnswer;
|
|
58
|
+
/** `zoneAt` for a place already on the surface: feet in the drawing's wide frame, the team attacking the right. What a drawing's click is asked with (pointer.ts). */
|
|
59
|
+
export declare function zoneAtSurface(sport: Sport, at: readonly [number, number], options?: ZoneOptions): ZoneAnswer;
|
|
60
|
+
/**
|
|
61
|
+
* A function from a place on the surface (feet, the drawing's wide frame, the team attacking the right) to the id of the finest zone it lies in: what a data
|
|
62
|
+
* layer's marks carry as `data-zone`. Built once for the options of a drawing; `undefined` where the sport has no zone there.
|
|
63
|
+
*/
|
|
64
|
+
export declare function zoneResolver(sport: Sport, options?: ZoneOptions): (x: number, y: number) => string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The name of a zone id in a language: the rules engine's own ids have words in both; any other id (a zone set's) comes back as it is. A court of `league: "fiba"` has the words of FIBA's rule book, which the
|
|
67
|
+
* Japan Basketball Association follows: the restricted area is the no-charge semicircle (ノーチャージセミサークル); in the NBA and the leagues that follow its words it is the restricted area (リストリクテッドエリア).
|
|
68
|
+
*/
|
|
69
|
+
export declare const zoneName: (id: string, language?: Language, league?: string) => string;
|
|
70
|
+
/** True when a shot from the place would count three: beyond the three-point line (the arc, or past the straight lines at the sidelines), at the basket the team attacks. */
|
|
71
|
+
export declare const isThreePointer: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
72
|
+
/** True when the place is in the paint (the free-throw lane, the key), outside the restricted area. */
|
|
73
|
+
export declare const inPaint: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
74
|
+
/** True when the place is in the restricted area under the basket. */
|
|
75
|
+
export declare const inRestrictedArea: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
76
|
+
/** True when the place is in the slot (the package's definition: the inner and outer slot in front of the net, between the face-off circles), at either end. */
|
|
77
|
+
export declare const inSlot: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
78
|
+
/** True when the place is in a goal crease. */
|
|
79
|
+
export declare const inCrease: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
80
|
+
/** True when the place is in a penalty area, at the end the team attacks or the one it defends. */
|
|
81
|
+
export declare const inPenaltyArea: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
82
|
+
/** True when the place is in a goal area (the six-yard box), at either end. */
|
|
83
|
+
export declare const inSixYardBox: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
84
|
+
/** True when the place is in the red zone: inside the opponent's 20-yard line. */
|
|
85
|
+
export declare const inRedZone: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
86
|
+
/** True when the place is between the hash marks. */
|
|
87
|
+
export declare const betweenHashes: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
88
|
+
/** True when the place is in fair territory: between the foul lines, which are fair themselves. */
|
|
89
|
+
export declare const isFair: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
90
|
+
/** True when the place, in fair territory, lies beyond the park's fence: where a ball came down over the wall. `park` is a key of `PARKS`. */
|
|
91
|
+
export declare const overWall: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
92
|
+
/** True when the place is on the warning track. */
|
|
93
|
+
export declare const onWarningTrack: (point: PlaceLike, options?: ZoneOptions) => boolean;
|
|
94
|
+
/** What a home-run decision rests on. */
|
|
95
|
+
export interface HomeRunVerdict {
|
|
96
|
+
/** True: a home run. False: in play or foul. `undefined`: it cannot be told, because the ball was over the fence and its height was given but the park holds no wall height there. */
|
|
97
|
+
homeRun: boolean | undefined;
|
|
98
|
+
/** The place is in fair territory. */
|
|
99
|
+
fair: boolean;
|
|
100
|
+
/** How far from home plate, and the fence's distance in that direction (at the bearing), in feet. */
|
|
101
|
+
distance: number;
|
|
102
|
+
fence: number;
|
|
103
|
+
/** The bearing from dead centre, in degrees (negative to left field). */
|
|
104
|
+
angle: number;
|
|
105
|
+
/** The wall's height at the bearing in feet, or `null` where the park's data holds none. */
|
|
106
|
+
wall: number | null;
|
|
107
|
+
/** True when the park has wall heights at all; `isHomeRun` reports it so that a caller can say the data is missing. */
|
|
108
|
+
wallData: boolean;
|
|
109
|
+
/** Why, in a word: `foul`, `short` (the ball came down inside the fence), `over` (beyond the fence), `cleared` or `struck-wall` (the given height did not clear the wall), `unknown-wall`. */
|
|
110
|
+
reason: "foul" | "short" | "over" | "cleared" | "struck-wall" | "unknown-wall";
|
|
111
|
+
}
|
|
112
|
+
/** What a caller can give about the ball. */
|
|
113
|
+
export interface HomeRunOptions extends ZoneOptions {
|
|
114
|
+
/** The height of the ball in feet as it crossed the fence's line. Without it, a ball that came down beyond the fence in fair territory is a home run. */
|
|
115
|
+
height?: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The ballparks whose wall heights the package holds nowhere in their fence: of the 94 parks, the 35 whose article gives heights have them for some stretch,
|
|
119
|
+
* and for the rest the height is not known here, so a decision that needs it is undecided (`homeRun: undefined`), never guessed.
|
|
120
|
+
*/
|
|
121
|
+
export declare const PARKS_WITHOUT_WALL_HEIGHTS: readonly string[];
|
|
122
|
+
/**
|
|
123
|
+
* Whether a ball is a home run, from the park's own fence: the fence's distance at the bearing and, when the height of the ball is given, the wall's height there
|
|
124
|
+
* (`wall` data of the park: the stretches of fence with their heights). A ball in fair territory that came down beyond the fence is a home run; one that was
|
|
125
|
+
* lower than the wall where it crossed struck the wall and is in play. Where the park holds no height for the bearing the answer to a question that needs it
|
|
126
|
+
* is `homeRun: undefined`, and `wallData` says whether the park has any heights at all. `park` is a key of `PARKS` (or a park); the place is in the frame of `options.frame`
|
|
127
|
+
* (`retrosheet` and `mlbam` are the usual) or the drawing's own.
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* import { homeRun } from "@johnmorrisdotca/kyogijo-stadiums/zones";
|
|
131
|
+
* // Fenway Park's Green Monster is 37 feet 2 inches high, 310 feet down the line in left.
|
|
132
|
+
* console.log(homeRun("fenway-park", [-250, 250], { frame: "retrosheet", height: 30 }).reason, homeRun("fenway-park", [-250, 250], { frame: "retrosheet", height: 40 }).reason);
|
|
133
|
+
* // struck-wall cleared
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare function homeRun(park: string | Park, point: PlaceLike, options?: HomeRunOptions): HomeRunVerdict;
|
|
137
|
+
/** `homeRun` as a yes or no: `true` for a home run, `false` for foul, in play or the wall struck, `undefined` where the park's wall height is missing and the decision needs it. */
|
|
138
|
+
export declare const isHomeRun: (park: string | Park, point: PlaceLike, options?: HomeRunOptions) => boolean | undefined;
|