@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/types.d.ts
CHANGED
|
@@ -4,10 +4,14 @@ import type { Unit } from "./units.ts";
|
|
|
4
4
|
import type { SoccerFrame, SoccerProviderId } from "./surfaces/soccer-providers.ts";
|
|
5
5
|
import type { SoccerPitchId, SoccerSize } from "./surfaces/soccer-spec.ts";
|
|
6
6
|
import type { Frame } from "./frames.ts";
|
|
7
|
+
import type { PoolSport, PoolStyle } from "./pool.types.ts";
|
|
8
|
+
import type { AthleticsStyle } from "./athletics/types.ts";
|
|
9
|
+
import type { SkatingStyle } from "./skating/types.ts";
|
|
7
10
|
/** The field sports: lacrosse (the field and the box), rugby (union and league), Australian football, Gaelic football and hurling, cricket, field hockey and team handball. */
|
|
8
11
|
export type FieldSport = "lacrosse" | "rugby" | "afl" | "gaelic" | "cricket" | "fieldhockey" | "handball";
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
export type { PoolSport, PoolStyle };
|
|
13
|
+
/** The surfaces: three football fields, a rink, a court, a ballpark, a soccer pitch, a curling sheet, twelve net, racket and court sports (tennis, volleyball, badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet and netball), four pools (swimming, water polo, diving and artistic swimming), seven field sports (lacrosse, rugby, Australian football, Gaelic football and hurling, cricket, field hockey and handball) and the athletics stadium (the 400 m track with its infield, and the covered 200 m track). */
|
|
14
|
+
export type Sport = "nfl" | "cfl" | "ifaf" | "nhl" | "nba" | "mlb" | "soccer" | "curling" | "tennis" | "volleyball" | "badminton" | "pickleball" | "tabletennis" | "padel" | "squash" | "racquetball" | "sepaktakraw" | "teqball" | "roundnet" | "netball" | PoolSport | FieldSport | "athletics" | "skating";
|
|
11
15
|
/** `auto` follows the device's light or dark setting (and `data-theme` on the page's root), the others force one. */
|
|
12
16
|
export type Theme = "auto" | "light" | "dark";
|
|
13
17
|
/** The language of the words the drawing says itself: its title, its description and its status labels. */
|
|
@@ -91,7 +95,7 @@ export interface GoalInfo {
|
|
|
91
95
|
line: number;
|
|
92
96
|
}
|
|
93
97
|
/** The looks a drawing can have, alongside `court` (a basketball court's own). See `LOOKS`. */
|
|
94
|
-
export type LookName = "grass" | "night" | "chalkboard" | "blueprint" | "print" | "broadcast" | "high-contrast";
|
|
98
|
+
export type LookName = "grass" | "night" | "chalkboard" | "blueprint" | "print" | "broadcast" | "high-contrast" | "line-drawing";
|
|
95
99
|
/** The width of the lines: a multiple of the width they are drawn at (`2`, or `{ scale: 2 }`), or an absolute width in `units` (`{ width: 0.5 }`). */
|
|
96
100
|
export type LineWidth = number | {
|
|
97
101
|
scale: number;
|
|
@@ -220,21 +224,100 @@ export interface CourtStyle {
|
|
|
220
224
|
baselineInk?: string;
|
|
221
225
|
/** Paint the area inside the three-point line in the key's colour. */
|
|
222
226
|
paintThreePoint?: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* A realistic floor: maple boards that run the length of the court with staggered ends, grain and tone, stained keys and centre circle with the wood showing through,
|
|
229
|
+
* a stained border with a baseline in each team's colour, the baskets seen from above with their shadows, and a satin sheen. `true` for the defaults, or the options
|
|
230
|
+
* (`HardwoodOptions`). Off by default, and then the drawing is byte for byte as before. See `docs/hardwood.md`.
|
|
231
|
+
*/
|
|
232
|
+
hardwood?: boolean | HardwoodOptions;
|
|
233
|
+
/** The colour of the border behind each baseline (`[left, right]`, or one for both) on a `hardwood` floor: a team's colour by default, else the border's. */
|
|
234
|
+
baselineColor?: string | [string, string];
|
|
235
|
+
/** Words along the sidelines, in the border of a `hardwood` floor: one text for both, or `[top, bottom]`. */
|
|
236
|
+
sidelineText?: string | [string, string];
|
|
237
|
+
}
|
|
238
|
+
/** The options of a `hardwood` floor. Every part is optional. */
|
|
239
|
+
export interface HardwoodOptions {
|
|
240
|
+
/** The seed of the boards' lengths and tones and of the grain: the same seed always gives the same floor. 1 by default. */
|
|
241
|
+
seed?: number;
|
|
242
|
+
/**
|
|
243
|
+
* How much is drawn. `fine`: the boards' seams and ends, the grain, the baskets' soft shadows, the table and the benches. `plain`: broad boards and one shadow, for a
|
|
244
|
+
* thumbnail. `auto` (the default) is `plain` when the drawing has `detail: "simple"` or a `width` under 480 pixels, else `fine`.
|
|
245
|
+
*/
|
|
246
|
+
detail?: "auto" | "fine" | "plain";
|
|
247
|
+
/** The width of a board in inches, 1.5 to 6. 2.25 by default, as a maple strip floor is laid. */
|
|
248
|
+
board?: number;
|
|
249
|
+
/** How much of the paint is stain, 0.3 to 1: the lower, the more wood shows through the keys, the circle and the border. 0.82 by default. */
|
|
250
|
+
stain?: number;
|
|
251
|
+
/** The satin sheen, 0 (none) to 1.5. 1 by default. */
|
|
252
|
+
sheen?: number;
|
|
253
|
+
/** Draw the baskets from above, with the stanchion and its shadows (the usual `goals` choices still apply). On by default. */
|
|
254
|
+
hoops?: boolean;
|
|
255
|
+
/** The coaching box's lines, the scorers' table and the two benches along the bottom sideline. On by default in the `fine` detail. */
|
|
256
|
+
bench?: boolean;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* How much of a curling sheet is shown: all of it (`sheet`), the half from the hog line to the back line (`half`), just the house (`house`), or `folded`: the whole sheet as a strip in the
|
|
260
|
+
* middle with its two houses enlarged beside it, so that the drawing fills a roughly square frame (see `SheetStyle.panels`).
|
|
261
|
+
*/
|
|
262
|
+
export type SheetShow = "sheet" | "half" | "house" | "folded";
|
|
263
|
+
/** An end of a curling sheet: `left` or `right` as the sheet lies wide, or `top` (the left end) and `bottom` (the right end), as a tall sheet's ends are read. */
|
|
264
|
+
export type SheetEnd = Side | "top" | "bottom";
|
|
265
|
+
/** The shape of a venue's stands round the playing surface. */
|
|
266
|
+
export type CrowdShape = "bowl" | "sides" | "horseshoe" | "grandstand";
|
|
267
|
+
/**
|
|
268
|
+
* The stands and the crowd round a surface (`crowd`). Every part is optional. `true` is the sport's usual venue, 85 percent full, with an away end, drawn in detail.
|
|
269
|
+
* See `docs/crowd.md`.
|
|
270
|
+
*/
|
|
271
|
+
export interface CrowdOptions {
|
|
272
|
+
/**
|
|
273
|
+
* The venue: `bowl` (stands on every side), `sides` (the long sides only), `horseshoe` (three sides, the open end at the right, or at the left with `open: "left"`; a
|
|
274
|
+
* ballpark's outfield with a gap at the batter's eye) or `grandstand` (a ballpark's infield stands only). Each sport has its usual one.
|
|
275
|
+
*/
|
|
276
|
+
shape?: CrowdShape;
|
|
277
|
+
/** The end of a `horseshoe` that is open: `right` (the usual) or `left`. */
|
|
278
|
+
open?: "left" | "right";
|
|
279
|
+
/**
|
|
280
|
+
* What a soccer pitch is inside. `auto` (the default) is a stadium of its own for most grounds and a gridiron stadium for the NFL's and the CFL's, where the stands keep a
|
|
281
|
+
* football field's footprint and the pitch stands inside it; `purpose`, `nfl` and `cfl` choose. The footprint is drawn faintly so that the gap is seen.
|
|
282
|
+
*/
|
|
283
|
+
stadium?: "auto" | "purpose" | "nfl" | "cfl";
|
|
284
|
+
/** How full the stands are, 0 to 1: the share of seats with someone in them. 0.85 by default. Over `attendance`. */
|
|
285
|
+
density?: number;
|
|
286
|
+
/** The people in the stands, with `capacity` the seats: the density is their quotient. A ground's `capacity` is the default for soccer; without one, the seats the drawing's stands have. */
|
|
287
|
+
attendance?: number;
|
|
288
|
+
capacity?: number;
|
|
289
|
+
/** The seed of the crowd: the same seed is always the same crowd. 1 by default. */
|
|
290
|
+
seed?: number;
|
|
291
|
+
/** The home fans' colour and the visitors': the teams' colours of a score, else the sides' colours. */
|
|
292
|
+
home?: string;
|
|
293
|
+
away?: string;
|
|
294
|
+
/** Where the visitors sit: `auto` (the sport's usual place), `left`, `right`, `corner` (a block in a corner), or `none`. */
|
|
295
|
+
awayEnd?: "auto" | "left" | "right" | "corner" | "none";
|
|
296
|
+
/** A tifo or card display in the colours of a team, in a block of the lower stands behind a goal: `home`, `away`, `both` or `false`. Off by default. */
|
|
297
|
+
tifo?: boolean | "home" | "away" | "both";
|
|
298
|
+
/** `stripes` (the usual) or `checks`. */
|
|
299
|
+
tifoDesign?: "stripes" | "checks";
|
|
300
|
+
/** Tunnels, the benches' places and the camera platform of the media side. On by default. */
|
|
301
|
+
gaps?: boolean;
|
|
302
|
+
/** The roof's edge throws a shade on the last rows of the upper tier. On by default. */
|
|
303
|
+
roof?: boolean;
|
|
304
|
+
/** A ballpark's seats on top of a wall: `true` for every wall of the park's data that is 25 feet or more (and has a `walls` entry), `false` for none, and by default the walls the package knows have seats (Fenway Park's Green Monster). */
|
|
305
|
+
wallSeats?: boolean;
|
|
306
|
+
/** How much is drawn: `fine` (the crowd as heads and shoulders, empty seats, aisles), `plain` (blocks of colour), or `auto` (`plain` for `detail: "simple"` or a `width` under 480 pixels). */
|
|
307
|
+
detail?: "auto" | "fine" | "plain";
|
|
223
308
|
}
|
|
224
|
-
/** How much of a curling sheet is shown: all of it, the half from the hog line to the back line, or just the house. */
|
|
225
|
-
export type SheetShow = "sheet" | "half" | "house";
|
|
226
309
|
/**
|
|
227
310
|
* The parts of a surface a drawing can be cropped to (`range`). Football: `red-zone`, `between-the-20s`, `end-zone`, `field-of-play`, `own-half`, `opponent-half`.
|
|
228
311
|
* Hockey: `offensive-zone`, `defensive-zone`, `neutral-zone`, `half`. Basketball: `half-court`, `paint`. Soccer: `half`, `final-third`, `defensive-third`, `middle-third`,
|
|
229
|
-
* `penalty-area`. Baseball: `infield`, `outfield`. The net sports: `half-court`. Curling: `sheet`, `half`, `house`. Rugby: `half`, `twenty-two` (union) or `twenty` (league), `in-goal`. Lacrosse: `half`, `crease`. Australian football: `half`, `forward-fifty`, `centre-square`.
|
|
230
|
-
* Gaelic games: `half`, `large-rectangle`. Cricket: `pitch`, `circle`. Field hockey: `half`, `circle`, `twenty-three`. Handball: `half`, `goal-area`. `RANGES` lists them for each sport.
|
|
312
|
+
* `penalty-area`. Baseball: `infield`, `outfield`. The net sports: `half-court`. Curling: `sheet`, `half`, `house`, `folded`. Rugby: `half`, `twenty-two` (union) or `twenty` (league), `in-goal`. Lacrosse: `half`, `crease`. Australian football: `half`, `forward-fifty`, `centre-square`.
|
|
313
|
+
* Gaelic games: `half`, `large-rectangle`. Cricket: `pitch`, `circle`. Field hockey: `half`, `circle`, `twenty-three`. Handball: `half`, `goal-area`. Swimming: `half`, `pool-end`. Water polo: `half`, `goal-area`. Diving: `springboards`, `platforms`. Artistic swimming: `half`, `centre-stage`. Athletics: `bend`, `home-straight`, `back-straight`, `finish`, `start`, `infield`, a field event (`high-jump`, `pole-vault`, `long-jump`, `triple-jump`, `shot-put`, `discus-throw`, `hammer-throw`, `javelin-throw`) and `water-jump`. `RANGES` lists them for each sport.
|
|
231
314
|
*/
|
|
232
|
-
export type RangeName = "red-zone" | "between-the-20s" | "end-zone" | "field-of-play" | "own-half" | "opponent-half" | "offensive-zone" | "defensive-zone" | "neutral-zone" | "half" | "half-court" | "paint" | "final-third" | "defensive-third" | "middle-third" | "penalty-area" | "infield" | "outfield" | "sheet" | "house" | "in-goal" | "twenty-two" | "twenty" | "crease" | "forward-fifty" | "centre-square" | "large-rectangle" | "pitch" | "circle" | "twenty-three" | "goal-area";
|
|
315
|
+
export type RangeName = "red-zone" | "between-the-20s" | "end-zone" | "field-of-play" | "own-half" | "opponent-half" | "offensive-zone" | "defensive-zone" | "neutral-zone" | "half" | "half-court" | "paint" | "final-third" | "defensive-third" | "middle-third" | "penalty-area" | "infield" | "outfield" | "sheet" | "house" | "folded" | "in-goal" | "twenty-two" | "twenty" | "crease" | "forward-fifty" | "centre-square" | "large-rectangle" | "pitch" | "circle" | "twenty-three" | "goal-area" | "pool-end" | "springboards" | "platforms" | "centre-stage" | "bend" | "home-straight" | "back-straight" | "finish" | "start" | "infield" | "high-jump" | "pole-vault" | "long-jump" | "triple-jump" | "shot-put" | "discus-throw" | "hammer-throw" | "javelin-throw" | "water-jump" | "crossing-straight" | "first-bend" | "second-bend" | "judges" | "kiss-and-cry";
|
|
233
316
|
/** A named range at the end of your choice: `{ name: "offensive-zone", end: "left" }` is the offensive zone of a team that attacks the left. */
|
|
234
317
|
export interface RangeNamed {
|
|
235
318
|
name: RangeName;
|
|
236
|
-
/** The end of the surface the range is at, as the surface is drawn wide: `left` or `right
|
|
237
|
-
end?:
|
|
319
|
+
/** The end of the surface the range is at, as the surface is drawn wide: `left` or `right` (a curling sheet's also `top` and `bottom`: the left end and the right). Each range has its own default (`RANGES`); a range with no end ignores it. */
|
|
320
|
+
end?: SheetEnd;
|
|
238
321
|
}
|
|
239
322
|
/**
|
|
240
323
|
* A box of your own to crop to: the corners `x0, y0` and `x1, y1`, in the drawing's frame (feet, or `units`: x along the surface from the left, y across it from the top;
|
|
@@ -273,10 +356,14 @@ export interface SheetStyle {
|
|
|
273
356
|
pebble?: boolean;
|
|
274
357
|
/** Shade the free guard zone at both ends: the ground between the hog line and the tee line, outside the house. Off by default. */
|
|
275
358
|
guardZone?: boolean;
|
|
276
|
-
/** How much of the sheet to show. A bare sheet only; a score always shows all of it. `sheet` by default. `range` says the same (`range: "house"`) and wins. */
|
|
359
|
+
/** How much of the sheet to show. A bare sheet only; a score always shows all of it. `sheet` by default. `range` says the same (`range: "house"`) and wins. `folded` is the whole sheet with both houses enlarged beside it. */
|
|
277
360
|
show?: SheetShow;
|
|
278
|
-
/** Which end `show: "half"` and `show: "house"` show: the `left` one (the top house of a tall drawing, the default) or the `right
|
|
279
|
-
end?:
|
|
361
|
+
/** Which end `show: "half"` and `show: "house"` show: the `left` one (the top house of a tall drawing, the default) or the `right`; `top` and `bottom` say the same for a tall sheet (`top` is the left end). */
|
|
362
|
+
end?: SheetEnd;
|
|
363
|
+
/** What each enlarged panel of `show: "folded"` holds: the `half` from the hog line to the back line, with the free guard zone (the default), or just the `house`. */
|
|
364
|
+
panels?: "half" | "house";
|
|
365
|
+
/** The shape of the frame `show: "folded"` fills: width over height as the drawing lies, 1 (square) by default; the panels are as large as that allows. */
|
|
366
|
+
fit?: number;
|
|
280
367
|
}
|
|
281
368
|
/** The named looks of a tennis court: the colour of its surface and of the ground round it. */
|
|
282
369
|
export type TennisLook = "hard-blue" | "hard-green" | "clay" | "grass";
|
|
@@ -288,16 +375,31 @@ export type BadmintonLook = "green" | "blue" | "wood";
|
|
|
288
375
|
export type PickleballLook = "blue-green" | "green" | "red";
|
|
289
376
|
/** The named looks of a table tennis table. */
|
|
290
377
|
export type TableTennisLook = "blue" | "green";
|
|
378
|
+
/** The named looks of a padel court: the colours the FIP's rules prefer for the floor. */
|
|
379
|
+
export type PadelLook = "blue" | "green" | "terracotta";
|
|
380
|
+
/** The named looks of a squash court. */
|
|
381
|
+
export type SquashLook = "wood" | "blue";
|
|
382
|
+
/** The named looks of a racquetball court: the lines are the IRF's recommended red, or blue on a convertible court. */
|
|
383
|
+
export type RacquetballLook = "wood" | "convertible";
|
|
384
|
+
/** The named looks of a sepak takraw court. */
|
|
385
|
+
export type SepakTakrawLook = "blue" | "green" | "wood";
|
|
386
|
+
/** The named looks of a teqball court. */
|
|
387
|
+
export type TeqballLook = "grey" | "blue" | "green";
|
|
388
|
+
/** The named looks of a roundnet court. */
|
|
389
|
+
export type RoundnetLook = "grass" | "sand" | "indoor";
|
|
390
|
+
/** The named looks of a netball court. */
|
|
391
|
+
export type NetballLook = "wood" | "blue" | "green";
|
|
291
392
|
/**
|
|
292
|
-
* The look and the variants of a net sport's court (tennis, volleyball, badminton, pickleball, table tennis
|
|
393
|
+
* The look and the variants of a net sport's court (tennis, volleyball, badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet
|
|
394
|
+
* and netball). Every part is optional.
|
|
293
395
|
* The lines and the sizes are the rulebook's whatever the look; a look is the colour of the ground and of the surface.
|
|
294
396
|
*/
|
|
295
397
|
export interface NetStyle {
|
|
296
|
-
/** A named look: for tennis `hard-blue` (the default), `hard-green`, `clay` or `grass`; volleyball `wood` (the default for indoors) or `blue`, and `sand` for the beach; badminton `green` (the default), `blue` or `wood`; pickleball `blue-green` (the default), `green` or `red`; table tennis `blue` (the default) or `green`. An unknown name is an error that lists them. */
|
|
398
|
+
/** A named look: for tennis `hard-blue` (the default), `hard-green`, `clay` or `grass`; volleyball `wood` (the default for indoors) or `blue`, and `sand` for the beach; badminton `green` (the default), `blue` or `wood`; pickleball `blue-green` (the default), `green` or `red`; table tennis `blue` (the default) or `green`; padel `blue` (the default), `green` or `terracotta`; squash `wood` (the default) or `blue`; racquetball `wood` (the default) or `convertible`; sepak takraw `blue` (the default), `green` or `wood`; teqball `grey` (the default), `blue` or `green`; roundnet `grass` (the default), `sand` or `indoor`; netball `wood` (the default), `blue` or `green`. An unknown name is an error that lists them. */
|
|
297
399
|
look?: string;
|
|
298
400
|
/**
|
|
299
401
|
* The free zone drawn round the court: `official` (the default: the figure a rulebook gives for its own competitions, where it gives one), `least` (the least it allows
|
|
300
|
-
* or recommends) or `none`. Tennis (Appendix X), volleyball and
|
|
402
|
+
* or recommends) or `none`. Tennis (Appendix X), volleyball, beach volleyball and sitting volleyball (Rule 1.1), pickleball (Rule 3.A.3), sepak takraw (Law 1.5) and netball (Rule 1, item 8) give figures; badminton, table tennis, padel, squash, racquetball, teqball and roundnet do not.
|
|
301
403
|
*/
|
|
302
404
|
free?: "official" | "least" | "none";
|
|
303
405
|
/** Tennis: draw the two singles sticks that hold a doubles net up for a singles match, 3 feet outside the singles court (Rule 1). Off by default. */
|
|
@@ -325,6 +427,49 @@ export interface FieldStyle {
|
|
|
325
427
|
}
|
|
326
428
|
/** The shape of a team's mark: its logo as it is (`plain`), or clipped to a circle with a ring (`round`). */
|
|
327
429
|
export type TeamMark = "plain" | "round";
|
|
430
|
+
/** How a pageant lays out each team's picture: `carpet` is its flag or logo laid flat over its half, as a rectangle with a border; `stage` is its crest on a large round disc with a ring. */
|
|
431
|
+
export type PageantStyle = "carpet" | "stage";
|
|
432
|
+
/**
|
|
433
|
+
* The pageant: each team's flag or logo laid out large over its own half of the surface, as a stadium lays giant flags and crests on the pitch for a final's
|
|
434
|
+
* ceremony, and an emblem or a trophy in the centre circle. Give `pageant: "carpet"`, `"stage"` or `true` (a carpet), or these options. Off by default, and a drawing without it is
|
|
435
|
+
* the same text as before. It needs a score (`home` and `away`) and the full or compact size.
|
|
436
|
+
*/
|
|
437
|
+
export interface PageantOptions {
|
|
438
|
+
/** `carpet` (the default) or `stage`. */
|
|
439
|
+
style?: PageantStyle;
|
|
440
|
+
/** A carpet's border band: `dark` (the default), `team` (each team's colour), or a colour. */
|
|
441
|
+
border?: "dark" | "team" | (string & {});
|
|
442
|
+
/** A carpet's border band as a share of its shorter side, 0.02 to 0.15. 0.06 by default. */
|
|
443
|
+
borderWidth?: number;
|
|
444
|
+
/** A carpet's fabric: a gentle, fixed wave of light and shade over it. On by default; left out at small sizes. */
|
|
445
|
+
fabric?: boolean;
|
|
446
|
+
/** Where the surface's lines lie: `over` the pictures (the default), `under` them (the pictures cover the lines), or `through` (under the pictures, which are a little see-through, so that the lines show faintly). */
|
|
447
|
+
lines?: "over" | "under" | "through";
|
|
448
|
+
/** A stage's ring: `gold` (the default), `team` (each team's colour), or a colour. */
|
|
449
|
+
ring?: "gold" | "team" | (string & {});
|
|
450
|
+
/** The picture in the centre circle, centre ice, centre court or at the mound: a competition's emblem or a trophy, as a logo is given (an address, an image `data:` address or an SVG document as text). Yours; none is supplied. */
|
|
451
|
+
emblem?: string;
|
|
452
|
+
/** `round` (the default): the emblem on a disc with a ring, as a team's mark. `plain`: the picture as it is, for a trophy with a cut-out outline. */
|
|
453
|
+
emblemShape?: "round" | "plain";
|
|
454
|
+
/** An emblem's fit on its disc: `contain` (the default: shown whole) or `cover` (it fills the disc). */
|
|
455
|
+
emblemFit?: "contain" | "cover";
|
|
456
|
+
/** What the emblem is, for the drawing's description: "World Cup". */
|
|
457
|
+
emblemName?: string;
|
|
458
|
+
/** Where the score goes: `centre` (the plate stays in the middle, a little smaller, and the pictures keep clear of it), `strip` (the compact strip under the drawing) or `auto` (the default: the centre, unless there is an emblem or the sport's board is large, which then go to the strip). */
|
|
459
|
+
score?: "auto" | "centre" | "strip";
|
|
460
|
+
/**
|
|
461
|
+
* How a carpet fills its half: `fill` (the default) takes the room the half gives it with a margin, as a ceremony's flags are made to the size of the half, so its shape may differ from the
|
|
462
|
+
* flag's ratio by up to 2 to 1, and the art is stretched a little and cropped a little (each by the square root of the difference, so stripes stay stripes and a centred emblem stays nearly round);
|
|
463
|
+
* `ratio` keeps the flag's own ratio and leaves the rest of the half bare. A stage is round either way.
|
|
464
|
+
*/
|
|
465
|
+
fit?: "fill" | "ratio";
|
|
466
|
+
/** The size of a carpet or a stage, as a share of the room its half gives it. 0.4 to 1; 1 by default (the room less a margin). */
|
|
467
|
+
scale?: number;
|
|
468
|
+
/** Write each team's name on its picture. By default only a team with no flag or logo has its name (or its initials, when they would not fit). */
|
|
469
|
+
names?: boolean;
|
|
470
|
+
/** An entrance, in CSS only and for people who have not asked for less motion: `unfurl` (a carpet rolls out from its end, a stage grows) or `fade`. `none` by default. */
|
|
471
|
+
animate?: "none" | "unfurl" | "fade";
|
|
472
|
+
}
|
|
328
473
|
/** One team of a score. */
|
|
329
474
|
export interface Team {
|
|
330
475
|
/** The name, as it is to be written: "Harbour City Gulls". */
|
|
@@ -342,13 +487,15 @@ export interface Team {
|
|
|
342
487
|
mark?: TeamMark;
|
|
343
488
|
/** A round mark's fit: `cover` (the default) fills the circle with the picture, as a flag does; `contain` shows a crest whole on a plain disc. */
|
|
344
489
|
markFit?: "cover" | "contain";
|
|
490
|
+
/** The pageant's carpet is as wide as it is tall by this ratio: 1.5 for a flag of 3 to 2. Read from an SVG logo's `viewBox` when missing, else 1.5; held between 1 and 3. */
|
|
491
|
+
logoRatio?: number;
|
|
345
492
|
/** The goals it scored in a penalty shoot-out: shown with the status, and the winner of a level game. */
|
|
346
493
|
penalties?: number | string;
|
|
347
494
|
/** Curling: the points it scored in each end, in order (`null` for an end not played yet; `"X"` for a conceded one). */
|
|
348
495
|
ends?: readonly (number | string | null | undefined)[];
|
|
349
496
|
/** Curling: the team has the hammer, the last stone of the end. A marker is drawn beside its name. */
|
|
350
497
|
hammer?: boolean;
|
|
351
|
-
/**
|
|
498
|
+
/** The net and racket sports (not netball): what it scored in each set (tennis and padel: its games; the others: each game's or set's points), in order; `null` for one not played yet. The set in progress is the last one given. */
|
|
352
499
|
sets?: readonly (number | string | null | undefined)[];
|
|
353
500
|
/** Tennis: the points of a tie-break in each set (the same places as `sets`; `null` where the set had none), written small beside the games. */
|
|
354
501
|
tiebreaks?: readonly (number | string | null | undefined)[];
|
|
@@ -471,12 +618,23 @@ export interface SurfaceOptions {
|
|
|
471
618
|
quirks?: boolean | QuirkOptions;
|
|
472
619
|
/** The look of an NBA court. */
|
|
473
620
|
court?: CourtStyle;
|
|
621
|
+
/**
|
|
622
|
+
* The stands and the crowd round the surface, for a venue that has spectators: a bowl, two sides, a horseshoe or a ballpark's grandstands, with the people as heads and
|
|
623
|
+
* shoulders in the home colours and a visitors' end. `true` for the defaults, or `CrowdOptions`. Off by default, and then the drawing is byte for byte as it was.
|
|
624
|
+
*/
|
|
625
|
+
crowd?: boolean | CrowdOptions;
|
|
474
626
|
/** The size and look of a curling sheet. */
|
|
475
627
|
sheet?: SheetStyle;
|
|
476
|
-
/** The look and the variants of a tennis, volleyball, badminton, pickleball
|
|
628
|
+
/** The look and the variants of a tennis, volleyball, badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet or netball court. */
|
|
477
629
|
net?: NetStyle;
|
|
478
630
|
/** The size and the variants of a lacrosse, rugby, Australian football, Gaelic games, cricket, field hockey or handball surface. */
|
|
479
631
|
field?: FieldStyle;
|
|
632
|
+
/** The pool of a swimming, water polo, diving or artistic swimming drawing: the course and the lanes, the look of the water and the deck, a side section, the lanes of a race with its results and splits, and several pools in one hall. */
|
|
633
|
+
pool?: PoolStyle;
|
|
634
|
+
/** The athletics stadium: the number of lanes, the colour of the track, what is in the infield, the races and the field events marked. See `AthleticsStyle`. */
|
|
635
|
+
athletics?: AthleticsStyle;
|
|
636
|
+
/** The skating rink: the long track's radius and lanes, the short track's tracks, the figure skating rink's size and furniture, the races marked. See `SkatingStyle`; the discipline is the `league`. */
|
|
637
|
+
skating?: SkatingStyle;
|
|
480
638
|
/** The soccer pitch: a preset (`fifa`, `uefa`, `mls`, `nwsl`, `ncaa`, `law-min`, `law-max`, `9-a-side`, `7-a-side`, `5-a-side`, `futsal`) or a size, `{ length, width, unit }`. The international 105 by 68 m by default. */
|
|
481
639
|
pitch?: SoccerPitchId | SoccerSize;
|
|
482
640
|
/** The soccer ground to draw: a key of `GROUNDS`. The pitch has the size its article publishes (the international 105 by 68 m where none is), and the drawing carries the ground's name for `year`. A `pitch` of your own wins over the ground's size. */
|
|
@@ -503,6 +661,11 @@ export interface SurfaceOptions {
|
|
|
503
661
|
* Unset, the drawing is byte for byte as before. See `BackgroundOptions`.
|
|
504
662
|
*/
|
|
505
663
|
background?: Background;
|
|
664
|
+
/**
|
|
665
|
+
* The pageant: each team's flag or logo laid large over its half (a `carpet`) or on a round disc (a `stage`), with an emblem in the centre. `"carpet"`, `"stage"`, `true` (a carpet) or `PageantOptions`.
|
|
666
|
+
* Off by default; a score drawing only. See `PageantOptions`.
|
|
667
|
+
*/
|
|
668
|
+
pageant?: PageantStyle | boolean | PageantOptions;
|
|
506
669
|
/** A named look: the surface, the lines and the ground round it in one palette, light and dark. See `LOOKS`. Over the theme's colours, under `colors`. */
|
|
507
670
|
look?: LookName;
|
|
508
671
|
/** The width of the lines (see `LineWidth`): a multiple of the width they are drawn at, or an absolute width. */
|
|
@@ -562,4 +725,6 @@ export interface ScoreOptions extends SurfaceOptions {
|
|
|
562
725
|
uppercase?: boolean;
|
|
563
726
|
/** The shape of both teams' marks, unless a team's own `mark` says otherwise: `plain` (the default) or `round`, a flag or logo in a circle with a ring. */
|
|
564
727
|
markShape?: TeamMark;
|
|
728
|
+
/** Draw the score's panel (or board) on the surface. On by default; `false` leaves the teams' names and the rest and no panel, as the 3D view does when it hangs the score up as a scoreboard. */
|
|
729
|
+
plate?: boolean;
|
|
565
730
|
}
|
package/dist/units.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const UNITS: readonly Unit[];
|
|
|
7
7
|
export declare const FEET_PER: Readonly<Record<Unit, number>>;
|
|
8
8
|
/**
|
|
9
9
|
* The unit each surface's rulebook states its dimensions in: the NFL's and the CFL's fields in yards (and the IFAF's, which
|
|
10
|
-
* follows them), the NHL's rink, the NBA's court and the baseball field in feet, a soccer pitch in metres (the Laws'), a tennis court and a
|
|
10
|
+
* follows them), the NHL's rink, the NBA's court and the baseball field in feet, a soccer pitch in metres (the Laws'), a tennis court, a pickleball court and a racquetball court in feet (the ITF's, USA Pickleball's and the IRF's), a volleyball court, a badminton court, a table, a padel court, a squash court, a sepak takraw court, a teqball court, a roundnet court and a netball court in metres (FIVB's, BWF's, ITTF's, FIP's, World Squash's, ISTAF's, FITEQ's, the International Roundnet Federation's and World Netball's), a curling sheet in metres (World Curling's rules give metres with feet beside them; Curling Canada's give feet first, and its league `curling-canada` has feet), a rugby field, an Australian football ground, a Gaelic field, a hockey pitch and a handball court in metres (the rulebooks'), a swimming pool, a water polo field, a diving well and an artistic swimming area in metres (World Aquatics') and a cricket ground in yards (the Laws' and the ICC's; the NLL's box floor and the PLL's and the NCAA men's fields are in the leagues' own feet and yards). A Japanese park's fence is measured in
|
|
11
11
|
* metres and converted once: see `parkUnit`.
|
|
12
12
|
*/
|
|
13
13
|
export declare const SURFACE_UNITS: Readonly<Record<Sport, Unit>>;
|
package/dist/units.js
CHANGED
|
@@ -11,7 +11,7 @@ export const FEET_PER = Object.freeze({
|
|
|
11
11
|
});
|
|
12
12
|
/**
|
|
13
13
|
* The unit each surface's rulebook states its dimensions in: the NFL's and the CFL's fields in yards (and the IFAF's, which
|
|
14
|
-
* follows them), the NHL's rink, the NBA's court and the baseball field in feet, a soccer pitch in metres (the Laws'), a tennis court and a
|
|
14
|
+
* follows them), the NHL's rink, the NBA's court and the baseball field in feet, a soccer pitch in metres (the Laws'), a tennis court, a pickleball court and a racquetball court in feet (the ITF's, USA Pickleball's and the IRF's), a volleyball court, a badminton court, a table, a padel court, a squash court, a sepak takraw court, a teqball court, a roundnet court and a netball court in metres (FIVB's, BWF's, ITTF's, FIP's, World Squash's, ISTAF's, FITEQ's, the International Roundnet Federation's and World Netball's), a curling sheet in metres (World Curling's rules give metres with feet beside them; Curling Canada's give feet first, and its league `curling-canada` has feet), a rugby field, an Australian football ground, a Gaelic field, a hockey pitch and a handball court in metres (the rulebooks'), a swimming pool, a water polo field, a diving well and an artistic swimming area in metres (World Aquatics') and a cricket ground in yards (the Laws' and the ICC's; the NLL's box floor and the PLL's and the NCAA men's fields are in the leagues' own feet and yards). A Japanese park's fence is measured in
|
|
15
15
|
* metres and converted once: see `parkUnit`.
|
|
16
16
|
*/
|
|
17
17
|
export const SURFACE_UNITS = Object.freeze({
|
|
@@ -28,6 +28,13 @@ export const SURFACE_UNITS = Object.freeze({
|
|
|
28
28
|
badminton: "m",
|
|
29
29
|
pickleball: "ft",
|
|
30
30
|
tabletennis: "m",
|
|
31
|
+
padel: "m",
|
|
32
|
+
squash: "m",
|
|
33
|
+
racquetball: "ft",
|
|
34
|
+
sepaktakraw: "m",
|
|
35
|
+
teqball: "m",
|
|
36
|
+
roundnet: "m",
|
|
37
|
+
netball: "m",
|
|
31
38
|
lacrosse: "m",
|
|
32
39
|
rugby: "m",
|
|
33
40
|
afl: "m",
|
|
@@ -35,6 +42,13 @@ export const SURFACE_UNITS = Object.freeze({
|
|
|
35
42
|
cricket: "yd",
|
|
36
43
|
fieldhockey: "m",
|
|
37
44
|
handball: "m",
|
|
45
|
+
// The pools: World Aquatics' Competition Regulations print every figure in metres.
|
|
46
|
+
swimming: "m",
|
|
47
|
+
waterpolo: "m",
|
|
48
|
+
diving: "m",
|
|
49
|
+
artisticswimming: "m",
|
|
50
|
+
athletics: "m",
|
|
51
|
+
skating: "m",
|
|
38
52
|
});
|
|
39
53
|
/** True when `unit` is one of the six. */
|
|
40
54
|
export const isUnit = (unit) => typeof unit === "string" && Object.prototype.hasOwnProperty.call(FEET_PER, unit);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Upright } from "./turn.kit.ts";
|
|
2
|
+
/** Where the board goes: `hung` over the middle, or `standing` behind an end (behind centre field in a ballpark). */
|
|
3
|
+
export declare const boardKind: (sport: string) => "hung" | "standing";
|
|
4
|
+
/** What a badge drawing is, taken apart: its size, the attributes of its root (the colours and the look, which its rules read) and what is drawn in it. */
|
|
5
|
+
export declare function badgeParts(svg: string): {
|
|
6
|
+
w: number;
|
|
7
|
+
h: number;
|
|
8
|
+
attrs: string;
|
|
9
|
+
inner: string;
|
|
10
|
+
} | undefined;
|
|
11
|
+
/** The scoreboard of a surface: its badge on a board, hung or standing, as one plane that faces the eye. */
|
|
12
|
+
export declare function scoreboard(badge: string, sport: string, area: {
|
|
13
|
+
x0: number;
|
|
14
|
+
y0: number;
|
|
15
|
+
x1: number;
|
|
16
|
+
y1: number;
|
|
17
|
+
}, thin: number): Upright | undefined;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The score, stood up: in the 3D view the score is not a panel lying on the floor but a scoreboard. A court or a rink has one hung over its middle on cables; a
|
|
2
|
+
// field has one standing behind an end (a ballpark's behind centre field). It is the score's badge (the compact strip `size: "badge"` draws) on a dark board that
|
|
3
|
+
// turns to face the eye, so that it can be read from wherever the view is. Nothing here is a rule: the sizes and the heights are ours.
|
|
4
|
+
import { plane, n } from "./turn.kit.js";
|
|
5
|
+
/** The sports that hang their board over the middle: the indoor ones with a floor in the middle of a hall. */
|
|
6
|
+
const HUNG = ["nba", "nhl", "volleyball", "badminton", "handball", "tennis", "pickleball", "sepaktakraw", "netball"];
|
|
7
|
+
/** Where the board goes: `hung` over the middle, or `standing` behind an end (behind centre field in a ballpark). */
|
|
8
|
+
export const boardKind = (sport) => (HUNG.includes(sport) ? "hung" : "standing");
|
|
9
|
+
/** What a badge drawing is, taken apart: its size, the attributes of its root (the colours and the look, which its rules read) and what is drawn in it. */
|
|
10
|
+
export function badgeParts(svg) {
|
|
11
|
+
const root = /^<svg\s([^>]*)>/.exec(svg);
|
|
12
|
+
if (root === null)
|
|
13
|
+
return undefined;
|
|
14
|
+
const box = /viewBox="0 0 ([\d.]+) ([\d.]+)"/.exec(root[1]);
|
|
15
|
+
if (box === null)
|
|
16
|
+
return undefined;
|
|
17
|
+
const keep = [...root[1].matchAll(/([\w:-]+)="([^"]*)"/g)]
|
|
18
|
+
.filter(([, name]) => !/^(xmlns|viewBox|width|height|role|aria-labelledby|class|part|data-version)$/.test(name))
|
|
19
|
+
.map(([, name, value]) => `${name}="${value}"`)
|
|
20
|
+
.join(" ");
|
|
21
|
+
const inner = svg
|
|
22
|
+
.slice(root[0].length, svg.lastIndexOf("</svg>"))
|
|
23
|
+
.replace(/<title[\s\S]*?<\/title>/, "")
|
|
24
|
+
.replace(/<desc[\s\S]*?<\/desc>/, "")
|
|
25
|
+
.replace(/<style[\s\S]*?<\/style>/, "");
|
|
26
|
+
return { w: Number(box[1]), h: Number(box[2]), attrs: keep, inner };
|
|
27
|
+
}
|
|
28
|
+
/** The scoreboard of a surface: its badge on a board, hung or standing, as one plane that faces the eye. */
|
|
29
|
+
export function scoreboard(badge, sport, area, thin) {
|
|
30
|
+
const parts = badgeParts(badge);
|
|
31
|
+
if (parts === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const L = area.x1 - area.x0;
|
|
34
|
+
const W = area.y1 - area.y0;
|
|
35
|
+
const kind = boardKind(sport);
|
|
36
|
+
// The board: as wide as a third of a court's length or nearly half a field's width, and a third as tall, with the badge inside a margin.
|
|
37
|
+
const wide = kind === "hung" ? Math.min(0.3 * L, 44) : sport === "tabletennis" ? 0.6 * L : sport === "mlb" ? 0.24 * L : Math.min(0.36 * W, 80);
|
|
38
|
+
const tall = wide * 0.32;
|
|
39
|
+
const margin = wide * 0.025;
|
|
40
|
+
const scale = (wide - 2 * margin) / parts.w;
|
|
41
|
+
const lift = kind === "hung" ? Math.min(30, 12 + 0.1 * L) : tall * 0.9;
|
|
42
|
+
// Hung: cables from the board's top corners up; standing: legs from its bottom corners down to the ground.
|
|
43
|
+
const extra = kind === "hung" ? tall * 0.9 : lift;
|
|
44
|
+
const total = tall + extra;
|
|
45
|
+
const line = Math.max(thin * 2.5, wide * 0.008);
|
|
46
|
+
const board = `<rect x="0" y="${n(kind === "hung" ? extra : 0)}" width="${n(wide)}" height="${n(tall)}" rx="${n(wide * 0.02)}" class="u-sbframe"/>`;
|
|
47
|
+
const top = kind === "hung" ? extra : 0;
|
|
48
|
+
const badgeAt = `<g class="kyogijo" ${parts.attrs} transform="translate(${n(margin)} ${n(top + (tall - parts.h * scale) / 2)}) scale(${n(scale)})">${parts.inner}</g>`;
|
|
49
|
+
const holds = kind === "hung"
|
|
50
|
+
? `<path d="M${n(wide * 0.12)} 0V${n(extra)}M${n(wide * 0.88)} 0V${n(extra)}" class="u-sbline" fill="none" stroke-width="${n(line)}"/>`
|
|
51
|
+
: `<path d="M${n(wide * 0.14)} ${n(tall)}V${n(total)}M${n(wide * 0.86)} ${n(tall)}V${n(total)}" class="u-sbline" fill="none" stroke-width="${n(line * 1.6)}"/>`;
|
|
52
|
+
// Where it is: over the middle of the surface, or behind an end (behind the centre-field fence in a ballpark, where the surface's top edge is the far side).
|
|
53
|
+
const cx = sport === "mlb" ? (area.x0 + area.x1) / 2 : kind === "hung" ? (area.x0 + area.x1) / 2 : area.x1 + 10 + 0.04 * L;
|
|
54
|
+
const cy = sport === "mlb" ? area.y0 - 14 : (area.y0 + area.y1) / 2;
|
|
55
|
+
const bottom = kind === "hung" ? lift : 0;
|
|
56
|
+
const high = bottom + total;
|
|
57
|
+
const planes = [{ ...plane("scoreboard", "screen", [cx - wide / 2, cy, high], [wide, 0, 0], [0, 0, -total], `${holds}${board}${badgeAt}`), billboard: true }];
|
|
58
|
+
return { id: "scoreboard", kind: "scoreboard", at: [cx, cy], height: kind === "hung" ? lift : lift, planes };
|
|
59
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Plane, type Upright, type UprightKind } from "./turn.kit.ts";
|
|
2
|
+
import { type Unit } from "./units.ts";
|
|
3
|
+
import type { Language, SurfaceOptions } from "./types.ts";
|
|
4
|
+
/** What can be asked of the uprights. */
|
|
5
|
+
export interface UprightOptions {
|
|
6
|
+
/** Volleyball: the net at the men's height (2.43 m, the default) or the women's (2.24 m). */
|
|
7
|
+
netHeight?: "men" | "women";
|
|
8
|
+
/** Where the score of a score drawing goes: `board` (the default) hangs it up as a scoreboard (over the middle of a court or a rink, behind an end of a field) and takes the panel off the floor; `floor` leaves it on the floor. */
|
|
9
|
+
score?: "board" | "floor";
|
|
10
|
+
/** Leave the boards and the glass off a rink, and the walls and fence off a padel, squash or racquetball court, so that it can be seen into. On by default. */
|
|
11
|
+
boards?: boolean;
|
|
12
|
+
/** Only these kinds of thing; every kind the surface has when missing. */
|
|
13
|
+
only?: readonly UprightKind[];
|
|
14
|
+
}
|
|
15
|
+
/** What stands on a surface. */
|
|
16
|
+
export interface Uprights {
|
|
17
|
+
items: Upright[];
|
|
18
|
+
/** How far the surface itself stands over the ground, in feet: a table tennis table's top, 0 on every other surface. */
|
|
19
|
+
lift: number;
|
|
20
|
+
/** The thinnest line or strip drawn on this surface, in feet. */
|
|
21
|
+
thin: number;
|
|
22
|
+
/** The playing surface itself in feet, the part the view is fitted to (the ground round it may run out of the picture): `undefined` for a surface with no uprights, which is fitted whole. */
|
|
23
|
+
area?: {
|
|
24
|
+
x0: number;
|
|
25
|
+
y0: number;
|
|
26
|
+
x1: number;
|
|
27
|
+
y1: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** All the planes of all the things. */
|
|
31
|
+
export declare const planesOf: (u: Pick<Uprights, "items">) => Plane[];
|
|
32
|
+
/** What stands on the surface the options draw: nothing on a curling sheet, which is flat. */
|
|
33
|
+
export declare function uprightsFor(o: SurfaceOptions, settings?: UprightOptions): Uprights;
|
|
34
|
+
/** The unit the heights are said in: the options' own, else the rulebook's of the sport. */
|
|
35
|
+
export declare function heightUnit(o: Pick<SurfaceOptions, "sport" | "league" | "units">): Unit;
|
|
36
|
+
/** What stands on the surface, in a sentence, with heights: for a reader who cannot see the 3D view. An empty string when nothing stands on it. */
|
|
37
|
+
export declare function describeUprights(o: SurfaceOptions, uprights: Uprights, language?: Language): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FieldPlan } from "./fields.types.ts";
|
|
2
|
+
import { type FencePoint, type FootballSpec } from "./geometry.ts";
|
|
3
|
+
import type { SoccerSpec } from "./surfaces/soccer-spec.ts";
|
|
4
|
+
import type { ParkWall } from "./parks.ts";
|
|
5
|
+
import { type Plane, type Upright } from "./turn.kit.ts";
|
|
6
|
+
/**
|
|
7
|
+
* The crossbar of a football post is 10 ft over the ground (NFL 2026 Rule 1-3-1: "the top face of which is 10 feet above the ground"; CFL 2026 Rule 1-1-1:
|
|
8
|
+
* "a height of 10 feet"; NCAA 2025 Rule 1-2-5-a: "the top of which is 10 feet above the ground"). The uprights reach 35 ft over the bar in the NFL (Rule 1-3-2: 45 ft
|
|
9
|
+
* in all), 40 ft above the ground in the CFL (Rule 1-1-1: "extend 40 feet above ground level"), and at least 30 ft above the ground in the NCAA (Rule 1-2-5-a), the
|
|
10
|
+
* figure drawn for every other league.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FOOTBALL_CROSSBAR = 10;
|
|
13
|
+
/** The pylon is 18 in high: the NFL's Rule 1-2-3 names pylons but not their size; BAFA's Appendix D (14) recommends 4 in by 4 in and 18 in. */
|
|
14
|
+
export declare const PYLON_HEIGHT = 1.5;
|
|
15
|
+
/** A football field's uprights: the post at each end and the eight pylons. `shape` is the post of the season, `top` the height of the uprights above the ground. */
|
|
16
|
+
export declare function footballUprights(spec: FootballSpec, shape: "h" | "slingshot", top: number, thin: number): Upright[];
|
|
17
|
+
/** A soccer pitch's uprights: both goals and, unless the options turn them off, the four corner flags. */
|
|
18
|
+
export declare function soccerUprights(spec: SoccerSpec, flags: boolean, thin: number): Upright[];
|
|
19
|
+
/** The rugby posts, Gaelic goal posts, Australian football posts and cricket stumps; a goal with a net for the sports that have one. */
|
|
20
|
+
export declare function fieldUprights(plan: FieldPlan, thin: number): Upright[];
|
|
21
|
+
/** The fence's height where no wall is listed: 8 feet. */
|
|
22
|
+
export declare const FENCE_HEIGHT = 8;
|
|
23
|
+
/** How high the wall stands at an angle from dead centre, the wall that names it or the usual 8 feet. */
|
|
24
|
+
export declare const wallHeightAt: (walls: readonly ParkWall[], angle: number) => number;
|
|
25
|
+
/** The planes of a fence: one standing wall over each stretch of its line, as high as the wall there. */
|
|
26
|
+
export declare function fencePlanes(points: readonly FencePoint[], walls: readonly ParkWall[], thin: number): Plane[];
|
|
27
|
+
/**
|
|
28
|
+
* A ballpark's uprights: the fence, the two foul poles where the foul lines meet it, and the backstop behind home plate. Official Baseball Rules 2025, 2.01, gives no height
|
|
29
|
+
* for a fence or a foul pole, and only recommends the backstop 60 ft or more from home base: the 8 ft of the fence where no wall is listed, the poles' 30 ft and the
|
|
30
|
+
* screen's 70 ft by 20 ft are ours.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ballparkUprights(points: readonly FencePoint[], walls: readonly ParkWall[], thin: number): Upright[];
|