@johnmorrisdotca/kyogijo-stadiums 0.49.0 → 0.50.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.
@@ -0,0 +1,121 @@
1
+ import type { LonLat } from "./venues.geo.ts";
2
+ import type { Language } from "./types.ts";
3
+ /** Whether a source says a fact (`documented`) or it is ours (`plausible`). */
4
+ export type CircuitBasis = "documented" | "plausible";
5
+ /** One fact, the source it was read from and in what words. */
6
+ export interface CircuitFact<T> {
7
+ value: T;
8
+ basis: CircuitBasis;
9
+ /** Where it was read: `wikidata` (CC0), `wikipedia` (the article and revision of the record, CC BY-SA 4.0, in our own words) or `openstreetmap` (ODbL); missing for one of ours. */
10
+ source?: "wikidata" | "wikipedia" | "openstreetmap";
11
+ /** What was read, in our own words. */
12
+ read: string;
13
+ }
14
+ /** A circuit's facts: `scripts/circuits.data.json`, checked against the raw answers by `pnpm circuits`. */
15
+ export interface CircuitData {
16
+ /** The key: kebab case. */
17
+ id: string;
18
+ /** The Wikidata item. */
19
+ wikidata: string;
20
+ /** The articles and the revisions read. */
21
+ en: {
22
+ title: string;
23
+ revision: number;
24
+ };
25
+ ja: {
26
+ title: string;
27
+ revision: number;
28
+ };
29
+ /** The circuit's name: Wikidata's labels. */
30
+ names: {
31
+ en: string;
32
+ ja: string;
33
+ };
34
+ /** The country, as its two-letter code (Wikidata's P17). */
35
+ country: string;
36
+ /** The day it opened, `yyyy-mm-dd`. */
37
+ opened: CircuitFact<string>;
38
+ /** The length of a lap, in metres, as published. */
39
+ length: CircuitFact<number>;
40
+ /** How many corners (turns) the lap has, as published. */
41
+ corners: CircuitFact<number>;
42
+ /** Which way the cars go round, seen from above. */
43
+ direction: CircuitFact<"clockwise" | "counterclockwise">;
44
+ /** The width of the track the ribbon is drawn at, in metres. */
45
+ width: CircuitFact<number>;
46
+ /** The width of the pit lane, in metres. */
47
+ pitLaneWidth: CircuitFact<number>;
48
+ /** Where the turns' numbers come from. */
49
+ turnNumbers: Omit<CircuitFact<never>, "value">;
50
+ /** Where the pit building comes from. */
51
+ pitBuilding: Omit<CircuitFact<never>, "value">;
52
+ }
53
+ /** A point of OpenStreetMap's that the drawing places: a turn, the start, the finish. */
54
+ export interface CircuitOsmPoint {
55
+ /** The node, `node/<id>`. */
56
+ source: string;
57
+ at: LonLat;
58
+ }
59
+ /** What OpenStreetMap maps of a circuit (ODbL 1.0): `src/circuits.osm.data.ts`, apart from every other file. */
60
+ export interface CircuitOsm {
61
+ /** The relation of the circuit, `relation/<id>`. */
62
+ source: string;
63
+ /** The day the answer was read, and the base of the data it was read from. */
64
+ read: string;
65
+ base: string;
66
+ licence: "ODbL-1.0";
67
+ attribution: string;
68
+ /** The lap: the relation's ways in the order and the direction it runs, joined into one ring, from the start, simplified to `tolerance` metres; longitude and latitude to six decimals. The first point is not repeated. */
69
+ lap: LonLat[];
70
+ /** How many points the lap had before it was simplified, and the tolerance it was simplified to, in metres. */
71
+ points: number;
72
+ tolerance: number;
73
+ /** The pit lane, as a line in the way it is driven. */
74
+ pitLane: {
75
+ source: string;
76
+ line: LonLat[];
77
+ };
78
+ /** The ground of the circuit (the area its owner holds: the paddock), as a ring. */
79
+ area: {
80
+ source: string;
81
+ ring: LonLat[];
82
+ };
83
+ /** The turns, in the order of the lap, each where OpenStreetMap puts its number. */
84
+ turns: (CircuitOsmPoint & {
85
+ n: number;
86
+ })[];
87
+ start: CircuitOsmPoint;
88
+ finish: CircuitOsmPoint;
89
+ /** The pit building beside the pit lane: its outline, its height in metres and its levels, as mapped. */
90
+ pitBuilding?: {
91
+ source: string;
92
+ ring: LonLat[];
93
+ height: number;
94
+ levels?: number;
95
+ };
96
+ }
97
+ /** A circuit: its facts and what OpenStreetMap maps of it. */
98
+ export interface Circuit extends CircuitData {
99
+ osm: CircuitOsm;
100
+ }
101
+ /** The options of a circuit's drawing. */
102
+ export interface CircuitOptions {
103
+ /** The circuit's key: `las-vegas`. */
104
+ circuit: string;
105
+ /** `en` (the default) or `ja`. */
106
+ language?: Language;
107
+ /** `light` or `dark` forces a theme; left out, the drawing follows the page and the device. */
108
+ theme?: "light" | "dark";
109
+ /** The name and the line of facts in the top corner: `true` (the default) or `false`. */
110
+ label?: boolean;
111
+ /** The turns' numbers: `true` (the default) or `false`. */
112
+ turns?: boolean;
113
+ /** The arrows that show which way the lap runs: `true` (the default) or `false`. */
114
+ arrows?: boolean;
115
+ /** The prefix of the ids inside the drawing, for a page with more than one; a hash of the options when missing. */
116
+ id?: string;
117
+ /** More classes on the root. */
118
+ className?: string;
119
+ /** `none` leaves the stylesheet out, for a page that puts `KYOGIJO_CIRCUIT_STYLE` in once. */
120
+ css?: "none";
121
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ import type { Language } from "./types.ts";
2
+ /** What a circuit's pictures say. */
3
+ export interface CircuitWords {
4
+ /** The title: the circuit's name. */
5
+ title: string;
6
+ /** The line under the name: the length and the number of turns. */
7
+ facts: string;
8
+ /** The description, sentence by sentence. */
9
+ lap: string;
10
+ counterclockwise: string;
11
+ clockwise: string;
12
+ turns: string;
13
+ pit: string;
14
+ building: string;
15
+ width: string;
16
+ /** What stands up in the 3D view. */
17
+ standing: string;
18
+ standingNoBuilding: string;
19
+ /** The credit of the data. */
20
+ credit: string;
21
+ /** A turn's number, for a screen reader. */
22
+ turn: string;
23
+ /** The scale bar's unit. */
24
+ metres: string;
25
+ /** The north arrow's name, for a screen reader. */
26
+ northArrow: string;
27
+ /** The table: its caption and its heads. */
28
+ table: {
29
+ caption: string;
30
+ fact: string;
31
+ value: string;
32
+ basis: string;
33
+ documented: string;
34
+ plausible: string;
35
+ length: string;
36
+ measured: string;
37
+ corners: string;
38
+ direction: string;
39
+ opened: string;
40
+ width: string;
41
+ pitLaneWidth: string;
42
+ wikidata: string;
43
+ counterclockwise: string;
44
+ clockwise: string;
45
+ };
46
+ }
47
+ export declare const CIRCUIT_WORDS: Readonly<Record<Language, CircuitWords>>;
@@ -0,0 +1,38 @@
1
+ export const CIRCUIT_WORDS = Object.freeze({
2
+ en: {
3
+ title: "{name}",
4
+ facts: "{km} km · {turns} turns",
5
+ lap: "A plan of {name}: a lap of {km} km, drawn on the ways OpenStreetMap maps for it (the line measures {measured} km).",
6
+ counterclockwise: "The lap runs counterclockwise, as the arrows show.",
7
+ clockwise: "The lap runs clockwise, as the arrows show.",
8
+ turns: "Its {turns} turns are numbered where OpenStreetMap numbers them, and the start and finish lines are drawn across the track.",
9
+ pit: "The pit lane runs beside the start.",
10
+ building: "The pit building stands beside the pit lane.",
11
+ width: "The track is drawn {width} m wide, which is ours: no source gives it.",
12
+ standing: "In 3D the pit building stands {height} m high, and each turn's number stands on a post.",
13
+ standingNoBuilding: "In 3D each turn's number stands on a post.",
14
+ credit: "Map data: {credit}.",
15
+ turn: "Turn {n}",
16
+ metres: "m",
17
+ northArrow: "North",
18
+ table: { caption: "{name}: the facts and where they come from", fact: "Fact", value: "Value", basis: "Basis", documented: "documented", plausible: "ours (plausible)", length: "Length of a lap", measured: "Length of the drawn line", corners: "Turns", direction: "Direction", opened: "Opened", width: "Track width drawn", pitLaneWidth: "Pit lane width drawn", wikidata: "Wikidata", counterclockwise: "counterclockwise", clockwise: "clockwise" },
19
+ },
20
+ ja: {
21
+ title: "{name}",
22
+ facts: "全長{km} km・{turns}コーナー",
23
+ lap: "{name}の平面図。1周{km} kmのコースを、OpenStreetMapに登録された道路に沿って描いています(描いた線の長さは{measured} km)。",
24
+ counterclockwise: "矢印のとおり、コースは反時計回りです。",
25
+ clockwise: "矢印のとおり、コースは時計回りです。",
26
+ turns: "{turns}か所のコーナーには、OpenStreetMapと同じ番号を同じ位置に記し、スタートラインとフィニッシュラインはコースを横切る線で描いています。",
27
+ pit: "ピットレーンはスタート地点の脇を通ります。",
28
+ building: "ピットビルはピットレーンの脇に建っています。",
29
+ width: "コース幅は{width} mで描いています。この値は独自のもので、出典はありません。",
30
+ standing: "3D表示では、ピットビルは高さ{height} mで建ち、各コーナーの番号はポールの上に掲げられます。",
31
+ standingNoBuilding: "3D表示では、各コーナーの番号はポールの上に掲げられます。",
32
+ credit: "地図データ:{credit}。",
33
+ turn: "ターン{n}",
34
+ metres: "m",
35
+ northArrow: "北",
36
+ table: { caption: "{name}:データとその出典", fact: "項目", value: "値", basis: "根拠", documented: "出典あり", plausible: "独自の値(妥当な推定)", length: "1周の長さ", measured: "描いた線の長さ", corners: "コーナー数", direction: "走行方向", opened: "開業", width: "描いたコース幅", pitLaneWidth: "描いたピットレーン幅", wikidata: "Wikidata", counterclockwise: "反時計回り", clockwise: "時計回り" },
37
+ },
38
+ });
package/dist/multi.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // A tournament layout laid out: several of the package's own surfaces on one floor, to scale, where each stands and what it leaves free; the floor the layout needs; and whether it fits a hall's floor. The
2
2
  // figures are in multi.data.ts (a rulebook's, with its source); this file only adds them up. Nothing here draws SVG (multi.draw.ts does), and every function returns new values.
3
- import { inOctagon } from "./budo/plan.js";
3
+ import { budoLeague, budoPlan, inOctagon } from "./budo/plan.js";
4
4
  import { fill } from "./strings.core.js";
5
5
  import { FEET_PER_METRE } from "./geometry.js";
6
6
  import { IJF_CONTEST, WKF_KUMITE } from "./leagues/budo.js";
@@ -136,13 +136,23 @@ export function multiLayout(options = {}) {
136
136
  let floor;
137
137
  let tatami;
138
138
  if (spec.kind === "budo") {
139
- // The contest area, the safety area, the common safe zone between areas and the free zone, in metres: judo's from the IJF's figures (or the options'), karate's from the WKF's kumite area.
139
+ // The contest area, the safety area, the common safe zone between areas and the free zone, in metres. Judo's are the drawing's own (`budoPlan`), so that the floor is laid where the surface is
140
+ // drawn for every league: the IJF's contest area, its kata area (2 m of safety and common area, not 4) and the AJJF's (sizes made whole numbers of its 91 cm mats). Karate's are its league's.
140
141
  const karate = spec.sport === "karate";
141
- const opts = spec.surface.budo ?? {};
142
- const c = karate ? WKF_KUMITE.area : opts.size ?? IJF_CONTEST.contest.drawn;
143
- const s = karate ? WKF_KUMITE.safety : opts.safety ?? IJF_CONTEST.safety.drawn;
144
- const gap = karate ? WKF_KUMITE.between : Math.max(IJF_CONTEST.common, s);
145
- const free = karate ? 0 : IJF_CONTEST.freeZone;
142
+ let c, s, gap, free;
143
+ if (karate) {
144
+ const dims = budoLeague(spec.surface).dimensions;
145
+ const k = dims.kind === "karate" ? dims : WKF_KUMITE;
146
+ [c, s, gap, free] = [k.area, k.safety, k.between, 0];
147
+ }
148
+ else {
149
+ const plan = budoPlan(spec.surface);
150
+ const first = plan.judo?.contests[0];
151
+ const fig = plan.figures.kind === "judo" ? plan.figures : IJF_CONTEST;
152
+ if (plan.judo === undefined || first === undefined)
153
+ throw new Error(`The layout "${spec.id}" is not a judo floor of contest areas`);
154
+ [c, s, gap, free] = [first.x1 - first.x0, first.x0, plan.judo.gap, fig.freeZone];
155
+ }
146
156
  const across = spec.columns;
147
157
  const down = spec.rows;
148
158
  const tw = across * c + (across - 1) * gap + 2 * s;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** The package's version: the same as package.json's, and a test holds them to each other. */
2
- export declare const VERSION = "0.49.0";
2
+ export declare const VERSION = "0.50.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** The package's version: the same as package.json's, and a test holds them to each other. */
2
- export const VERSION = "0.49.0";
2
+ export const VERSION = "0.50.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/kyogijo-stadiums",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Kyogijo Stadiums 競技場, 40 sports' surfaces as SVG, drawn to scale from the rulebooks: NFL, CFL and IFAF football fields, an NHL rink, an NBA court, MLB ballparks, soccer pitches, curling sheets, athletics stadiums, speed skating, short track and figure skating rinks, swimming pools, water polo fields, diving wells, artistic swimming areas, and the courts and fields of tennis, volleyball (indoor, beach and sitting), badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet, netball, lacrosse, rugby, Australian football, Gaelic games, cricket, field hockey and handball, and the budo of judo, karate, kendo, sumo and kyudo with a dojo of tatami laid as real units, the MMA cage, with each team's name and logo on its side and the score in the middle, stands and a crowd, a pageant of flags, and a 3D view. Light and dark, accessible, a compact badge for lists, a helper for React and a custom element. Zero dependencies.",
5
5
  "keywords": [
6
6
  "sports",
@@ -287,6 +287,11 @@
287
287
  "import": "./dist/turn-entry.js",
288
288
  "default": "./dist/turn-entry.js"
289
289
  },
290
+ "./circuits": {
291
+ "types": "./dist/circuits-entry.d.ts",
292
+ "import": "./dist/circuits-entry.js",
293
+ "default": "./dist/circuits-entry.js"
294
+ },
290
295
  "./flythrough": {
291
296
  "types": "./dist/flythrough-entry.d.ts",
292
297
  "import": "./dist/flythrough-entry.js",
@@ -346,6 +351,8 @@
346
351
  "stadiums": "node scripts/build-stadiums.mjs",
347
352
  "stadiums:fetch": "node scripts/fetch-stadiums.mjs",
348
353
  "walk": "node scripts/build-walk.mjs",
354
+ "circuits": "node scripts/build-circuits.mjs",
355
+ "circuits:fetch": "node scripts/fetch-circuits.mjs",
349
356
  "osm-context": "node scripts/build-osm-context.mjs",
350
357
  "cityctx": "node scripts/build-cityctx.mjs",
351
358
  "cityctx:fetch": "node scripts/fetch-cityctx.mjs",