@johnmorrisdotca/kyogijo-stadiums 0.49.1 → 0.51.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 +16 -0
- package/NOTICE.md +21 -0
- package/README.md +24 -0
- package/catalogue.json +1208 -0
- package/dist/catalogue-entry.d.ts +2 -0
- package/dist/catalogue-entry.js +3 -0
- package/dist/catalogue.d.ts +45 -0
- package/dist/catalogue.data.d.ts +2 -0
- package/dist/catalogue.data.js +1208 -0
- package/dist/catalogue.js +74 -0
- package/dist/catalogue.types.d.ts +143 -0
- package/dist/catalogue.types.js +1 -0
- package/dist/circuits-entry.d.ts +11 -0
- package/dist/circuits-entry.js +9 -0
- package/dist/circuits.d.ts +62 -0
- package/dist/circuits.data.d.ts +2 -0
- package/dist/circuits.data.js +18 -0
- package/dist/circuits.draw.d.ts +56 -0
- package/dist/circuits.draw.js +265 -0
- package/dist/circuits.geo.d.ts +29 -0
- package/dist/circuits.geo.js +105 -0
- package/dist/circuits.js +73 -0
- package/dist/circuits.osm.data.d.ts +2 -0
- package/dist/circuits.osm.data.js +188 -0
- package/dist/circuits.style.d.ts +5 -0
- package/dist/circuits.style.js +34 -0
- package/dist/circuits.turn.d.ts +43 -0
- package/dist/circuits.turn.js +119 -0
- package/dist/circuits.types.d.ts +121 -0
- package/dist/circuits.types.js +1 -0
- package/dist/circuits.words.d.ts +47 -0
- package/dist/circuits.words.js +38 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +18 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The colours in light and in dark. */
|
|
2
|
+
export declare const CIRCUIT_LIGHT = "--ky-ci-ground:#eceae3;--ky-ci-area:#dcd7cb;--ky-ci-area-edge:#bdb6a6;--ky-ci-building:#c2bbad;--ky-ci-building-edge:#7f786b;--ky-ci-track:#3a3f46;--ky-ci-edge:#ffffff;--ky-ci-halo:rgba(58,63,70,.16);--ky-ci-pit:#5d636b;--ky-ci-line:#ffffff;--ky-ci-check:#15181c;--ky-ci-arrow:#f2c230;--ky-ci-arrow-edge:#3a3f46;--ky-ci-badge:#14213d;--ky-ci-badge-ink:#ffffff;--ky-ci-leader:#14213d;--ky-ci-ink:#1f2320;--ky-ci-muted:#4b535c";
|
|
3
|
+
export declare const CIRCUIT_DARK = "--ky-ci-ground:#10151b;--ky-ci-area:#1b232c;--ky-ci-area-edge:#334150;--ky-ci-building:#3a4756;--ky-ci-building-edge:#6f7f90;--ky-ci-track:#5d646e;--ky-ci-edge:#e6e9ed;--ky-ci-halo:rgba(230,233,237,.1);--ky-ci-pit:#7a838e;--ky-ci-line:#ffffff;--ky-ci-check:#0b0d10;--ky-ci-arrow:#f2c230;--ky-ci-arrow-edge:#10151b;--ky-ci-badge:#e9edf2;--ky-ci-badge-ink:#10151b;--ky-ci-leader:#c4ccd5;--ky-ci-ink:#eef1f4;--ky-ci-muted:#aab3bd";
|
|
4
|
+
/** The rules of a circuit's drawing, and of the turn markers and the pit building of its 3D view (`.ky-turn`). */
|
|
5
|
+
export declare const KYOGIJO_CIRCUIT_STYLE: string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// The rules of a circuit's drawing and of what stands up in its 3D view, light and dark. The colours are custom properties (`--ky-ci-*`) a page can set; `:where` keeps their weight at nothing so that a page's own win. The
|
|
2
|
+
// drawing follows the device and the page, and a `data-theme` of light or dark on it or on the page forces one. Nothing here is a team's, a race's or a sponsor's colour: asphalt, paint and paper.
|
|
3
|
+
/** The colours in light and in dark. */
|
|
4
|
+
export const CIRCUIT_LIGHT = "--ky-ci-ground:#eceae3;--ky-ci-area:#dcd7cb;--ky-ci-area-edge:#bdb6a6;--ky-ci-building:#c2bbad;--ky-ci-building-edge:#7f786b;--ky-ci-track:#3a3f46;--ky-ci-edge:#ffffff;--ky-ci-halo:rgba(58,63,70,.16);--ky-ci-pit:#5d636b;--ky-ci-line:#ffffff;--ky-ci-check:#15181c;--ky-ci-arrow:#f2c230;--ky-ci-arrow-edge:#3a3f46;--ky-ci-badge:#14213d;--ky-ci-badge-ink:#ffffff;--ky-ci-leader:#14213d;--ky-ci-ink:#1f2320;--ky-ci-muted:#4b535c";
|
|
5
|
+
export const CIRCUIT_DARK = "--ky-ci-ground:#10151b;--ky-ci-area:#1b232c;--ky-ci-area-edge:#334150;--ky-ci-building:#3a4756;--ky-ci-building-edge:#6f7f90;--ky-ci-track:#5d646e;--ky-ci-edge:#e6e9ed;--ky-ci-halo:rgba(230,233,237,.1);--ky-ci-pit:#7a838e;--ky-ci-line:#ffffff;--ky-ci-check:#0b0d10;--ky-ci-arrow:#f2c230;--ky-ci-arrow-edge:#10151b;--ky-ci-badge:#e9edf2;--ky-ci-badge-ink:#10151b;--ky-ci-leader:#c4ccd5;--ky-ci-ink:#eef1f4;--ky-ci-muted:#aab3bd";
|
|
6
|
+
/** The rules of a circuit's drawing, and of the turn markers and the pit building of its 3D view (`.ky-turn`). */
|
|
7
|
+
export const KYOGIJO_CIRCUIT_STYLE = `
|
|
8
|
+
:where(.ky-circuit,.ky-turn){${CIRCUIT_LIGHT}}
|
|
9
|
+
@media (prefers-color-scheme:dark){:where(html:not([data-theme=light]) .ky-circuit:not([data-theme=light]),html:not([data-theme=light]) .ky-turn:not([data-theme=light])){${CIRCUIT_DARK}}}
|
|
10
|
+
:where(html[data-theme=dark] .ky-circuit,.ky-circuit[data-theme=dark],html[data-theme=dark] .ky-turn,.ky-turn[data-theme=dark]){${CIRCUIT_DARK}}
|
|
11
|
+
:where(.ky-circuit){--ky-font:system-ui,-apple-system,"Segoe UI","Hiragino Sans","Noto Sans JP",sans-serif;display:block;width:100%;height:auto;font-family:var(--ky-font)}
|
|
12
|
+
.ky-circuit .ky-ci-ground{fill:var(--ky-ci-ground)}
|
|
13
|
+
.ky-circuit .ky-ci-area{fill:var(--ky-ci-area);stroke:var(--ky-ci-area-edge);stroke-linejoin:round}
|
|
14
|
+
.ky-circuit .ky-ci-building{fill:var(--ky-ci-building);stroke:var(--ky-ci-building-edge);stroke-linejoin:round}
|
|
15
|
+
.ky-circuit .ky-ci-halo{fill:none;stroke:var(--ky-ci-halo);stroke-linejoin:round;stroke-linecap:round}
|
|
16
|
+
.ky-circuit .ky-ci-edge{fill:none;stroke:var(--ky-ci-edge);stroke-linejoin:round;stroke-linecap:round}
|
|
17
|
+
.ky-circuit .ky-ci-track{fill:none;stroke:var(--ky-ci-track);stroke-linejoin:round;stroke-linecap:round}
|
|
18
|
+
.ky-circuit .ky-ci-pit{fill:none;stroke:var(--ky-ci-pit);stroke-linejoin:round;stroke-linecap:round}
|
|
19
|
+
.ky-circuit .ky-ci-start{stroke:var(--ky-ci-line);stroke-linecap:butt}
|
|
20
|
+
.ky-circuit .ky-ci-check-a{fill:var(--ky-ci-check)}
|
|
21
|
+
.ky-circuit .ky-ci-check-b{fill:var(--ky-ci-line)}
|
|
22
|
+
.ky-circuit .ky-ci-arrow{fill:var(--ky-ci-arrow);stroke:var(--ky-ci-arrow-edge);stroke-linejoin:round}
|
|
23
|
+
.ky-circuit .ky-ci-leader{stroke:var(--ky-ci-leader);fill:none;stroke-linecap:round}
|
|
24
|
+
.ky-circuit .ky-ci-badge,.ky-turn .u-ci-badge{fill:var(--ky-ci-badge);stroke:var(--ky-ci-ground)}
|
|
25
|
+
.ky-circuit .ky-ci-badge-n,.ky-turn .u-ci-badge-n{fill:var(--ky-ci-badge-ink);font-family:var(--ky-font,system-ui,sans-serif);font-weight:800;text-anchor:middle;font-variant-numeric:tabular-nums}
|
|
26
|
+
.ky-circuit .ky-ci-name{fill:var(--ky-ci-ink);font-family:var(--ky-font);font-weight:800}
|
|
27
|
+
.ky-circuit .ky-ci-facts{fill:var(--ky-ci-muted);font-family:var(--ky-font);font-weight:700;font-variant-numeric:tabular-nums}
|
|
28
|
+
.ky-circuit .ky-ci-north{fill:var(--ky-ci-ink);stroke:var(--ky-ci-ink);stroke-linejoin:round;stroke-linecap:round}
|
|
29
|
+
.ky-circuit .ky-ci-north-n{fill:none;stroke:var(--ky-ci-ink);stroke-linejoin:round;stroke-linecap:round}
|
|
30
|
+
.ky-circuit .ky-ci-scale{fill:none;stroke:var(--ky-ci-ink);stroke-linecap:butt}
|
|
31
|
+
.ky-circuit .ky-ci-scale-fill{fill:var(--ky-ci-ink)}
|
|
32
|
+
.ky-circuit .ky-ci-scale-text{fill:var(--ky-ci-ink);font-family:var(--ky-font);font-weight:700;font-variant-numeric:tabular-nums}
|
|
33
|
+
.ky-circuit .ky-ci-credit{fill:var(--ky-ci-muted);font-family:var(--ky-font);font-weight:600}
|
|
34
|
+
`.trim();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CircuitOptions } from "./circuits.types.ts";
|
|
2
|
+
import { type PresetTable } from "./turn.camera.ts";
|
|
3
|
+
import { type KyogijoTurn } from "./turn.dom.ts";
|
|
4
|
+
import { type TurnModel, type TurnSettings } from "./turn.model.ts";
|
|
5
|
+
/**
|
|
6
|
+
* The four viewpoints of a circuit: straight down, the main camera high over the long side of the lap, the end-on view along it and the low corner. A lap is kilometres across and flat, so the eye is kept higher than
|
|
7
|
+
* a single surface's.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CIRCUIT_PRESETS: PresetTable;
|
|
10
|
+
/** The size of a turn's marker and the height of its post, in thousandths of the drawing's longer side (a marker, sized to be read: nothing of this size stands at a corner). */
|
|
11
|
+
export declare const CIRCUIT_MARKER: Readonly<{
|
|
12
|
+
size: 30;
|
|
13
|
+
post: 22;
|
|
14
|
+
}>;
|
|
15
|
+
/** The most planes a circuit's 3D view may have: its markers (three planes each), its pit building and nothing else. A test holds every circuit to it. */
|
|
16
|
+
export declare const CIRCUIT_PLANES_MAX = 120;
|
|
17
|
+
/**
|
|
18
|
+
* A circuit as a 3D model: its drawing as the floor, the pit building standing on it at its mapped height, and a marker with each turn's number on a post over its bend. `settings.uprights: false` is the floor alone.
|
|
19
|
+
* A `TurnModel` like any other: `turnMarkupOf` and `mountCircuitTurn` make a view of it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildCircuitTurn(options: CircuitOptions, settings?: TurnSettings): TurnModel;
|
|
22
|
+
/**
|
|
23
|
+
* Mount a circuit as a 3D view in a container: the same view as `mountKyogijoTurn`'s, with the controls, the pointer, the keys and the auto-turn of every 3D view, over the circuit's drawing with its pit building and
|
|
24
|
+
* the turns' numbers standing up. Where the browser cannot turn it, the flat drawing is shown.
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts no-run
|
|
27
|
+
* import { mountCircuitTurn } from "@johnmorrisdotca/kyogijo-stadiums/circuits";
|
|
28
|
+
* const view = mountCircuitTurn(document.querySelector("#lap")!, { circuit: "las-vegas" }, { preset: "corner" });
|
|
29
|
+
* view.set({ yaw: 40 });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function mountCircuitTurn(host: HTMLElement, options: CircuitOptions, settings?: TurnSettings): KyogijoTurn<CircuitOptions>;
|
|
33
|
+
/**
|
|
34
|
+
* A circuit as the markup of a 3D view, still until a page's script makes it turn: pure, so a server can make it.
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { circuitTurnMarkup } from "@johnmorrisdotca/kyogijo-stadiums/circuits";
|
|
38
|
+
* const html = circuitTurnMarkup({ circuit: "las-vegas" }, { preset: "broadcast" });
|
|
39
|
+
* console.log(html.includes('data-part="turn-17"'), html.includes("preserve-3d"));
|
|
40
|
+
* // true false
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function circuitTurnMarkup(options: CircuitOptions, settings?: TurnSettings): string;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// A circuit in 3D: the 3D view of `turn.ts` over the circuit's own drawing (`circuitDrawing`, its turns' badges left off the floor), with the pit building stood up at the height OpenStreetMap maps for it and each
|
|
2
|
+
// turn's number on a post over its bend, turned to face the eye so that it is read from wherever the view is. Nothing is drawn a second way, and nothing moves by itself: the camera, the controls, the pointer, the
|
|
3
|
+
// auto-turn (which waits for the reader and stops while the page is hidden or the view is out of sight) are every 3D view's. The model is a `TurnModel` of a few dozen planes; the floor is one SVG.
|
|
4
|
+
import { circuitDrawing, circuitText } from "./circuits.draw.js";
|
|
5
|
+
import { circuitOf } from "./circuits.js";
|
|
6
|
+
import { CIRCUIT_WORDS } from "./circuits.words.js";
|
|
7
|
+
import { blockPlanes, shellBlock } from "./context.js";
|
|
8
|
+
import { hash, num } from "./format.js";
|
|
9
|
+
import { FEET_PER_METRE as FT } from "./geometry.js";
|
|
10
|
+
import { fill } from "./strings.core.js";
|
|
11
|
+
import { TURN_PRESETS } from "./turn.camera.js";
|
|
12
|
+
import { mountTurn } from "./turn.dom.js";
|
|
13
|
+
import { plane, pole, thinnest } from "./turn.kit.js";
|
|
14
|
+
import { turnMarkupOf } from "./turn.markup.js";
|
|
15
|
+
import { WORLD_PX, openingView, sceneBox } from "./turn.model.js";
|
|
16
|
+
import { planesOf } from "./uprights.js";
|
|
17
|
+
/**
|
|
18
|
+
* The four viewpoints of a circuit: straight down, the main camera high over the long side of the lap, the end-on view along it and the low corner. A lap is kilometres across and flat, so the eye is kept higher than
|
|
19
|
+
* a single surface's.
|
|
20
|
+
*/
|
|
21
|
+
export const CIRCUIT_PRESETS = { overhead: TURN_PRESETS.overhead, broadcast: { yaw: 0, pitch: 58, zoom: 1 }, end: { yaw: -90, pitch: 62, zoom: 1 }, corner: { yaw: -35, pitch: 64, zoom: 1 } };
|
|
22
|
+
/** The size of a turn's marker and the height of its post, in thousandths of the drawing's longer side (a marker, sized to be read: nothing of this size stands at a corner). */
|
|
23
|
+
export const CIRCUIT_MARKER = Object.freeze({ size: 30, post: 22 });
|
|
24
|
+
/** The most planes a circuit's 3D view may have: its markers (three planes each), its pit building and nothing else. A test holds every circuit to it. */
|
|
25
|
+
export const CIRCUIT_PLANES_MAX = 120;
|
|
26
|
+
/**
|
|
27
|
+
* A circuit as a 3D model: its drawing as the floor, the pit building standing on it at its mapped height, and a marker with each turn's number on a post over its bend. `settings.uprights: false` is the floor alone.
|
|
28
|
+
* A `TurnModel` like any other: `turnMarkupOf` and `mountCircuitTurn` make a view of it.
|
|
29
|
+
*/
|
|
30
|
+
export function buildCircuitTurn(options, settings = {}) {
|
|
31
|
+
const language = options.language === "ja" ? "ja" : "en";
|
|
32
|
+
// An unknown circuit throws here, naming the keys, before anything is drawn.
|
|
33
|
+
circuitOf(options.circuit);
|
|
34
|
+
const id = settings.id ?? (typeof options.id === "string" && options.id !== "" ? `${options.id}-turn` : `ky-turn-${hash(JSON.stringify([options, settings.preset]))}`);
|
|
35
|
+
const standUp = settings.uprights !== false;
|
|
36
|
+
// The floor: the drawing, its name left to the page and its turns' numbers standing up instead (on the floor too when nothing stands).
|
|
37
|
+
const drawn = circuitDrawing({ ...options, id: `${id}-floor`, label: false, turns: !standUp });
|
|
38
|
+
const plan = drawn.plan;
|
|
39
|
+
const { x: vx, y: vy, w: vw, h: vh } = drawn.viewBox;
|
|
40
|
+
const k = drawn.k;
|
|
41
|
+
const items = [];
|
|
42
|
+
if (standUp && plan.building !== undefined) {
|
|
43
|
+
const planes = blockPlanes(shellBlock("pit", plan.building.ring, plan.building.height, undefined), "pit-");
|
|
44
|
+
const [cx, cy] = plan.building.ring.reduce((s, p) => [s[0] + p[0] / plan.building.ring.length, s[1] + p[1] / plan.building.ring.length], [0, 0]);
|
|
45
|
+
items.push({ id: "pit-building", kind: "blocks", at: [cx, cy], height: plan.building.height, planes });
|
|
46
|
+
}
|
|
47
|
+
if (standUp) {
|
|
48
|
+
// Each turn's number on a post, over the badge's place beside the bend; the marker turns to face the eye and leans back to be read square on, and lies flat seen from above.
|
|
49
|
+
const size = CIRCUIT_MARKER.size * k;
|
|
50
|
+
const top = CIRCUIT_MARKER.post * k;
|
|
51
|
+
const marks = [];
|
|
52
|
+
for (const b of drawn.badges) {
|
|
53
|
+
const [x, y] = b.at;
|
|
54
|
+
const r = size / 2;
|
|
55
|
+
const svg = `<circle class="u-ci-badge" cx="${num(r)}" cy="${num(r)}" r="${num(r * 0.94)}" stroke-width="${num(r * 0.1)}"/><text class="u-ci-badge-n" x="${num(r)}" y="${num(r + r * 0.4)}" font-size="${num(r * (b.n >= 10 ? 1.05 : 1.25))}">${b.n}</text>`;
|
|
56
|
+
marks.push({ ...plane(`turn-${b.n}`, "sign", [x - r, y, top + size], [size, 0, 0], [0, 0, -size], svg), billboard: true, lean: true });
|
|
57
|
+
marks.push(...pole(`turn-${b.n}-post`, "pole", x, y, 0, top, thinnest(vw, vh), "u-pole"));
|
|
58
|
+
}
|
|
59
|
+
items.push({ id: "turns", kind: "flags", at: [(plan.box.x0 + plan.box.x1) / 2, (plan.box.y0 + plan.box.y1) / 2], height: top + size, planes: marks });
|
|
60
|
+
}
|
|
61
|
+
const area = plan.box;
|
|
62
|
+
const uprights = { items, lift: 0, thin: thinnest(vw, vh), area };
|
|
63
|
+
const planes = planesOf(uprights);
|
|
64
|
+
const scale = WORLD_PX / Math.max(vw, vh);
|
|
65
|
+
const centre = [(area.x0 + area.x1) / 2, (area.y0 + area.y1) / 2];
|
|
66
|
+
const w = CIRCUIT_WORDS[language];
|
|
67
|
+
const standing = !standUp ? "" : plan.building === undefined ? w.standingNoBuilding : fill(w.standing, { height: num(Math.round((plan.building.height / FT) * 10) / 10) });
|
|
68
|
+
const { title, description } = circuitText(plan, language, standing);
|
|
69
|
+
const surfaceLike = { sport: "circuit", language, ...(options.theme === undefined ? {} : { theme: options.theme }) };
|
|
70
|
+
return {
|
|
71
|
+
id,
|
|
72
|
+
language,
|
|
73
|
+
options: surfaceLike,
|
|
74
|
+
title,
|
|
75
|
+
description,
|
|
76
|
+
standing,
|
|
77
|
+
floor: drawn.svg,
|
|
78
|
+
viewBox: { x: vx, y: vy, w: vw, h: vh },
|
|
79
|
+
scale,
|
|
80
|
+
uprights,
|
|
81
|
+
defs: "",
|
|
82
|
+
crowdStyle: "",
|
|
83
|
+
venue: false,
|
|
84
|
+
look: undefined,
|
|
85
|
+
planes,
|
|
86
|
+
box: sceneBox(planes, area, 0, centre, scale),
|
|
87
|
+
centre,
|
|
88
|
+
view: openingView({ preset: "broadcast", ...settings }, CIRCUIT_PRESETS),
|
|
89
|
+
turnable: true,
|
|
90
|
+
presets: CIRCUIT_PRESETS,
|
|
91
|
+
flat: circuitDrawing(options).svg,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Mount a circuit as a 3D view in a container: the same view as `mountKyogijoTurn`'s, with the controls, the pointer, the keys and the auto-turn of every 3D view, over the circuit's drawing with its pit building and
|
|
96
|
+
* the turns' numbers standing up. Where the browser cannot turn it, the flat drawing is shown.
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts no-run
|
|
99
|
+
* import { mountCircuitTurn } from "@johnmorrisdotca/kyogijo-stadiums/circuits";
|
|
100
|
+
* const view = mountCircuitTurn(document.querySelector("#lap")!, { circuit: "las-vegas" }, { preset: "corner" });
|
|
101
|
+
* view.set({ yaw: 40 });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export function mountCircuitTurn(host, options, settings = {}) {
|
|
105
|
+
return mountTurn(host, options, settings, buildCircuitTurn);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A circuit as the markup of a 3D view, still until a page's script makes it turn: pure, so a server can make it.
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* import { circuitTurnMarkup } from "@johnmorrisdotca/kyogijo-stadiums/circuits";
|
|
112
|
+
* const html = circuitTurnMarkup({ circuit: "las-vegas" }, { preset: "broadcast" });
|
|
113
|
+
* console.log(html.includes('data-part="turn-17"'), html.includes("preserve-3d"));
|
|
114
|
+
* // true false
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function circuitTurnMarkup(options, settings = {}) {
|
|
118
|
+
return turnMarkupOf(buildCircuitTurn(options, settings), settings);
|
|
119
|
+
}
|
|
@@ -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/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.
|
|
2
|
+
export declare const VERSION = "0.51.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.
|
|
2
|
+
export const VERSION = "0.51.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/kyogijo-stadiums",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.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,11 +287,22 @@
|
|
|
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",
|
|
293
298
|
"default": "./dist/flythrough-entry.js"
|
|
294
299
|
},
|
|
300
|
+
"./catalogue": {
|
|
301
|
+
"types": "./dist/catalogue-entry.d.ts",
|
|
302
|
+
"import": "./dist/catalogue-entry.js",
|
|
303
|
+
"default": "./dist/catalogue-entry.js"
|
|
304
|
+
},
|
|
305
|
+
"./catalogue.json": "./catalogue.json",
|
|
295
306
|
"./element/define": {
|
|
296
307
|
"types": "./dist/element-define.d.ts",
|
|
297
308
|
"import": "./dist/element-define.js",
|
|
@@ -303,7 +314,8 @@
|
|
|
303
314
|
"README.md",
|
|
304
315
|
"LICENSE",
|
|
305
316
|
"NOTICE.md",
|
|
306
|
-
"CHANGELOG.md"
|
|
317
|
+
"CHANGELOG.md",
|
|
318
|
+
"catalogue.json"
|
|
307
319
|
],
|
|
308
320
|
"engines": {
|
|
309
321
|
"node": ">=22"
|
|
@@ -345,7 +357,11 @@
|
|
|
345
357
|
"venues:rink": "node scripts/fetch-rink-evidence.mjs",
|
|
346
358
|
"stadiums": "node scripts/build-stadiums.mjs",
|
|
347
359
|
"stadiums:fetch": "node scripts/fetch-stadiums.mjs",
|
|
360
|
+
"catalogue": "node scripts/build-catalogue.mjs",
|
|
361
|
+
"catalogue:fetch": "node scripts/fetch-catalogue.mjs",
|
|
348
362
|
"walk": "node scripts/build-walk.mjs",
|
|
363
|
+
"circuits": "node scripts/build-circuits.mjs",
|
|
364
|
+
"circuits:fetch": "node scripts/fetch-circuits.mjs",
|
|
349
365
|
"osm-context": "node scripts/build-osm-context.mjs",
|
|
350
366
|
"cityctx": "node scripts/build-cityctx.mjs",
|
|
351
367
|
"cityctx:fetch": "node scripts/fetch-cityctx.mjs",
|