@johnmorrisdotca/kyogijo-stadiums 0.50.0 → 0.52.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 +22 -0
- package/NOTICE.md +11 -0
- package/README.md +31 -2
- 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/element.d.ts +1 -0
- package/dist/element.js +16 -5
- package/dist/judging.mount.js +1 -0
- package/dist/replay.d.ts +4 -0
- package/dist/replay.dom.d.ts +67 -2
- package/dist/replay.dom.js +187 -114
- package/dist/replay.js +10 -1
- package/dist/strings.core.d.ts +3 -0
- package/dist/strings.en.js +2 -0
- package/dist/strings.ja.js +2 -0
- package/dist/turn-entry.d.ts +4 -0
- package/dist/turn-entry.js +2 -0
- package/dist/turn.dom.d.ts +22 -1
- package/dist/turn.dom.js +121 -8
- package/dist/turn.kit.d.ts +1 -1
- package/dist/turn.replay.d.ts +56 -0
- package/dist/turn.replay.dom.d.ts +23 -0
- package/dist/turn.replay.dom.js +139 -0
- package/dist/turn.replay.js +82 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The catalogue: every venue the package draws today (supported), the ones being built (working on) and the ones wanted, with their facts, in one list. The same data is published as a static
|
|
2
|
+
// file, `catalogue.json`, in the npm package and on the demo's site (`CATALOGUE_ADDRESS`). There is no server: a reader fetches the file or imports this entry.
|
|
3
|
+
import { CATALOGUE_DATA } from "./catalogue.data.js";
|
|
4
|
+
/** Every venue: the supported ones first, then those being built, then the wanted ones, each group in its order. */
|
|
5
|
+
export const CATALOGUE = CATALOGUE_DATA.venues;
|
|
6
|
+
/** The leagues (every venue of the season, NBA, MLB, NFL, CFL and NHL) and the collections of the Working on and Wanted sections, each with its venues in order and its name in both languages. */
|
|
7
|
+
export const CATALOGUE_GROUPS = CATALOGUE_DATA.groups;
|
|
8
|
+
/** The sports, with their names in both languages and the `sport` of `drawKyogijo` that draws each (`null`: not drawn yet). */
|
|
9
|
+
export const CATALOGUE_SPORTS = CATALOGUE_DATA.sports;
|
|
10
|
+
/** The countries of the catalogue by ISO code, with their names in English and Japanese (Wikidata's labels). */
|
|
11
|
+
export const CATALOGUE_COUNTRIES = CATALOGUE_DATA.countries;
|
|
12
|
+
/** Where `catalogue.json` is published: the same data as this entry, for a page or a program that does not install the package. */
|
|
13
|
+
export const CATALOGUE_ADDRESS = CATALOGUE_DATA.address;
|
|
14
|
+
/** The demo's address: a supported venue's `demo` is relative to it. */
|
|
15
|
+
export const CATALOGUE_SITE = CATALOGUE_DATA.site;
|
|
16
|
+
/** The counts, the day the sources were read and where they are kept, and the licence of the facts. */
|
|
17
|
+
export const CATALOGUE_ABOUT = {
|
|
18
|
+
schemaVersion: CATALOGUE_DATA.schemaVersion,
|
|
19
|
+
generatedAt: CATALOGUE_DATA.generatedAt,
|
|
20
|
+
package: CATALOGUE_DATA.package,
|
|
21
|
+
licence: CATALOGUE_DATA.licence,
|
|
22
|
+
source: CATALOGUE_DATA.source,
|
|
23
|
+
counts: CATALOGUE_DATA.counts,
|
|
24
|
+
};
|
|
25
|
+
const BY_ID = new Map(CATALOGUE.map((entry) => [entry.id, entry]));
|
|
26
|
+
/**
|
|
27
|
+
* A venue by its id, or `undefined`.
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { catalogueById } from "@johnmorrisdotca/kyogijo-stadiums/catalogue";
|
|
31
|
+
* const ashe = catalogueById("arthur-ashe-stadium")!;
|
|
32
|
+
* console.log(ashe.status, ashe.ticket, ashe.wikidata);
|
|
33
|
+
* // working-on KYOGIJO-STADIUMS-22 Q609551
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function catalogueById(id) {
|
|
37
|
+
return BY_ID.get(id);
|
|
38
|
+
}
|
|
39
|
+
/** The venues of a status, in the catalogue's order. */
|
|
40
|
+
export function catalogueByStatus(status) {
|
|
41
|
+
return CATALOGUE.filter((entry) => entry.status === status);
|
|
42
|
+
}
|
|
43
|
+
/** The venues of a sport (any of a venue's sports), in the catalogue's order. */
|
|
44
|
+
export function catalogueBySport(sport) {
|
|
45
|
+
return CATALOGUE.filter((entry) => entry.sports.includes(sport));
|
|
46
|
+
}
|
|
47
|
+
/** The venues of a group (a league or a collection), in the group's order; empty for a group that does not exist. */
|
|
48
|
+
export function catalogueByGroup(group) {
|
|
49
|
+
return (CATALOGUE_GROUPS.find((one) => one.id === group)?.ids ?? []).map((id) => BY_ID.get(id)).filter((entry) => entry !== undefined);
|
|
50
|
+
}
|
|
51
|
+
/** Every venue whose building or whole venue is wanted: the venues of the Wanted section and the supported venues of a league or a collection that are drawn as a surface only. */
|
|
52
|
+
export function catalogueWanted() {
|
|
53
|
+
return CATALOGUE.filter((entry) => entry.want !== undefined && entry.status !== "working-on");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* How much of a league the package draws: its venues this season, how many in their buildings, how many as a field only, how many not yet.
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { catalogueCoverage } from "@johnmorrisdotca/kyogijo-stadiums/catalogue";
|
|
60
|
+
* const nhl = catalogueCoverage("nhl");
|
|
61
|
+
* console.log(nhl.venues, nhl.outline, nhl.notYet);
|
|
62
|
+
* // 32 32 0
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export function catalogueCoverage(league) {
|
|
66
|
+
const venues = catalogueByGroup(league);
|
|
67
|
+
return {
|
|
68
|
+
league,
|
|
69
|
+
venues: venues.length,
|
|
70
|
+
outline: venues.filter((entry) => entry.drawn === "outline").length,
|
|
71
|
+
surface: venues.filter((entry) => entry.drawn === "surface").length,
|
|
72
|
+
notYet: venues.filter((entry) => entry.status !== "supported").length,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { PlaceSurface } from "./atlas.ts";
|
|
2
|
+
/** Where a venue stands with the package: drawn today, being built (an open ticket), or wanted. */
|
|
3
|
+
export type CatalogueStatus = "supported" | "working-on" | "wanted";
|
|
4
|
+
/**
|
|
5
|
+
* How a supported venue is drawn: `outline`, inside the outline of its real building with a bowl of its seats (`STADIUMS` and the NHL's `VENUES`), or `surface`, its field, court, rink, park or
|
|
6
|
+
* floor only, at the venue's own size where the data gives one (a key of `PARKS`, `GROUNDS`, `ARENAS` or `HALLS`), or `circuit`, the lap as OpenStreetMap maps it with its pit lane and no stands
|
|
7
|
+
* (a key of `CIRCUITS`, drawn by `drawCircuit` of the `circuits` entry).
|
|
8
|
+
*/
|
|
9
|
+
export type CatalogueDrawn = "outline" | "surface" | "circuit";
|
|
10
|
+
/** What is wanted of a venue: its building's `outline` (a venue drawn today as a surface only), or the `venue` itself (one the package does not draw at all). */
|
|
11
|
+
export type CatalogueWant = "outline" | "venue";
|
|
12
|
+
/** What has to exist before a wanted venue can be drawn: a `circuit-surface` for motor racing, which the package does not draw yet. */
|
|
13
|
+
export type CatalogueNeed = "circuit-surface";
|
|
14
|
+
/** The sports of the catalogue, in kebab case. Every one but `motor-racing` names a surface the package draws (`CATALOGUE_SPORTS[sport].surface`). */
|
|
15
|
+
export type CatalogueSport = "baseball" | "basketball" | "hockey" | "american-football" | "canadian-football" | "soccer" | "cricket" | "rugby" | "australian-football" | "gaelic-games" | "tennis" | "budo" | "athletics" | "swimming" | "skating" | "curling" | "volleyball" | "badminton" | "handball" | "boxing" | "motor-racing";
|
|
16
|
+
/** The leagues whose every venue of the season is in the catalogue. */
|
|
17
|
+
export type CatalogueLeague = "nba" | "mlb" | "nfl" | "cfl" | "nhl";
|
|
18
|
+
/** A club that plays its home games at a venue this season. */
|
|
19
|
+
export interface CatalogueTeam {
|
|
20
|
+
name: string;
|
|
21
|
+
nameJa?: string;
|
|
22
|
+
league: CatalogueLeague;
|
|
23
|
+
}
|
|
24
|
+
/** The options that draw a supported venue with `drawKyogijo`: its surface (a park, a ground, an arena or a hall), or its real building (`stadium` or `arena` with `crowd: { real: true }`). */
|
|
25
|
+
export type CatalogueDraw = PlaceSurface | {
|
|
26
|
+
sport: "nfl" | "cfl" | "soccer" | "mlb" | "boxing" | "nba" | "nhl";
|
|
27
|
+
stadium?: string;
|
|
28
|
+
park?: string;
|
|
29
|
+
arena?: string;
|
|
30
|
+
crowd: {
|
|
31
|
+
real: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** One venue of the catalogue. */
|
|
35
|
+
export interface CatalogueEntry {
|
|
36
|
+
/** Kebab case, unique: the package's own key for a venue it draws (`fenway-park`, `bc-place`), else one made from the venue's English name. */
|
|
37
|
+
id: string;
|
|
38
|
+
status: CatalogueStatus;
|
|
39
|
+
/** How a supported venue is drawn. */
|
|
40
|
+
drawn?: CatalogueDrawn;
|
|
41
|
+
/** What is wanted: the building's outline of a venue drawn as a surface that a league or a group lists, or the venue itself. */
|
|
42
|
+
want?: CatalogueWant;
|
|
43
|
+
/** What must be built first. */
|
|
44
|
+
needs?: CatalogueNeed;
|
|
45
|
+
/** Which of the package's lists a supported venue comes from: a real stadium or NHL venue (`stadium`, `venue`), or a `park`, `ground`, `arena` or `hall`. */
|
|
46
|
+
kind?: "stadium" | "venue" | "park" | "ground" | "arena" | "hall" | "circuit";
|
|
47
|
+
/** The everyday name in English. */
|
|
48
|
+
name: string;
|
|
49
|
+
/** The name in Japanese; absent where no source gives one (`missing.nameJa` says so). */
|
|
50
|
+
nameJa?: string;
|
|
51
|
+
/** Where the Japanese name was read: the package's own data, Wikidata's label, the title of the Japanese Wikipedia's article, or a name a reviewer checked. */
|
|
52
|
+
nameJaFrom?: "package" | "wikidata" | "jawiki" | "reviewed";
|
|
53
|
+
city?: string;
|
|
54
|
+
cityJa?: string;
|
|
55
|
+
/** ISO 3166-1 alpha-2. */
|
|
56
|
+
country?: string;
|
|
57
|
+
/** Wikidata's coordinates (P625), in degrees. */
|
|
58
|
+
lat?: number;
|
|
59
|
+
lon?: number;
|
|
60
|
+
sports: CatalogueSport[];
|
|
61
|
+
/** The Wikidata item. */
|
|
62
|
+
wikidata: string;
|
|
63
|
+
/** The seats, where Wikidata gives one figure (P1083), for a venue that is not drawn yet. */
|
|
64
|
+
capacity?: number;
|
|
65
|
+
/** `current` or `past`, for a supported venue. */
|
|
66
|
+
era?: "current" | "past";
|
|
67
|
+
/** The leagues that play there this season, and their clubs. */
|
|
68
|
+
leagues?: CatalogueLeague[];
|
|
69
|
+
teams?: CatalogueTeam[];
|
|
70
|
+
/** The groups the venue is listed in (a league, a collection of the Wanted section). */
|
|
71
|
+
groups: string[];
|
|
72
|
+
/** The ticket of a venue being built. */
|
|
73
|
+
ticket?: string;
|
|
74
|
+
/** The options that draw a supported venue with `drawKyogijo` (a circuit has none: `drawCircuit({ circuit: id })` of the `circuits` entry draws it). */
|
|
75
|
+
draw?: CatalogueDraw;
|
|
76
|
+
/** The demo page that shows a supported venue, relative to the demo's address (`CATALOGUE_SITE`). */
|
|
77
|
+
demo?: string;
|
|
78
|
+
/** The facts left out, each with why. */
|
|
79
|
+
missing?: Partial<Record<"nameJa" | "city" | "country" | "coordinates", string>>;
|
|
80
|
+
}
|
|
81
|
+
/** A group: a league (every venue of its season) or a collection of the Wanted or Working on section, in its order. */
|
|
82
|
+
export interface CatalogueGroup {
|
|
83
|
+
id: string;
|
|
84
|
+
kind: "league" | "collection";
|
|
85
|
+
en: string;
|
|
86
|
+
ja: string;
|
|
87
|
+
/** For a league: its sport and its season. */
|
|
88
|
+
sport?: CatalogueSport;
|
|
89
|
+
season?: string;
|
|
90
|
+
/** For a collection that is being built. */
|
|
91
|
+
status?: "working-on";
|
|
92
|
+
needs?: CatalogueNeed;
|
|
93
|
+
ids: string[];
|
|
94
|
+
}
|
|
95
|
+
/** The whole catalogue, as `catalogue.json` holds it. */
|
|
96
|
+
export interface CatalogueData {
|
|
97
|
+
/** The shape's version: a change that breaks a reader raises it. */
|
|
98
|
+
schemaVersion: 1;
|
|
99
|
+
/** The day the sources were read (not the day the file was written). */
|
|
100
|
+
generatedAt: string;
|
|
101
|
+
package: {
|
|
102
|
+
name: string;
|
|
103
|
+
version: string;
|
|
104
|
+
};
|
|
105
|
+
/** Where the JSON is published. */
|
|
106
|
+
address: string;
|
|
107
|
+
/** The demo's address, which `demo` is relative to. */
|
|
108
|
+
site: string;
|
|
109
|
+
licence: string;
|
|
110
|
+
source: {
|
|
111
|
+
read: string;
|
|
112
|
+
rawAnswers: string;
|
|
113
|
+
articles: Record<string, number>;
|
|
114
|
+
};
|
|
115
|
+
counts: {
|
|
116
|
+
supported: number;
|
|
117
|
+
outline: number;
|
|
118
|
+
surface: number;
|
|
119
|
+
circuit: number;
|
|
120
|
+
workingOn: number;
|
|
121
|
+
wanted: number;
|
|
122
|
+
outlineWanted: number;
|
|
123
|
+
};
|
|
124
|
+
sports: Record<CatalogueSport, {
|
|
125
|
+
en: string;
|
|
126
|
+
ja: string;
|
|
127
|
+
surface: string | null;
|
|
128
|
+
}>;
|
|
129
|
+
groups: CatalogueGroup[];
|
|
130
|
+
countries: Record<string, {
|
|
131
|
+
en: string;
|
|
132
|
+
ja?: string;
|
|
133
|
+
}>;
|
|
134
|
+
venues: CatalogueEntry[];
|
|
135
|
+
}
|
|
136
|
+
/** How many venues of a league the package draws in their buildings, as a surface only, or not at all. */
|
|
137
|
+
export interface CatalogueCoverage {
|
|
138
|
+
league: CatalogueLeague;
|
|
139
|
+
venues: number;
|
|
140
|
+
outline: number;
|
|
141
|
+
surface: number;
|
|
142
|
+
notYet: number;
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/element.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type KyogijoReplay } from "./mount.ts";
|
|
2
2
|
import { type KyogijoTurn } from "./turn.dom.ts";
|
|
3
|
+
import "./turn.replay.dom.ts";
|
|
3
4
|
import type { TurnSettings } from "./turn.model.ts";
|
|
4
5
|
import type { ReplaySettings, ReplayTimeline } from "./replay.types.ts";
|
|
5
6
|
import type { ScoreOptions, SurfaceOptions } from "./types.ts";
|
package/dist/element.js
CHANGED
|
@@ -9,13 +9,15 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _KyogijoField_instances, _KyogijoField_mount, _KyogijoField_host, _KyogijoField_options, _KyogijoField_theme, _KyogijoField_timeline, _KyogijoField_replaySettings, _KyogijoField_replay, _KyogijoField_replayOf, _KyogijoField_turn, _KyogijoField_turnSettings, _KyogijoField_attach, _KyogijoField_draw;
|
|
12
|
+
var _KyogijoField_instances, _KyogijoField_mount, _KyogijoField_host, _KyogijoField_options, _KyogijoField_theme, _KyogijoField_timeline, _KyogijoField_replaySettings, _KyogijoField_replay, _KyogijoField_replayOf, _KyogijoField_turn, _KyogijoField_turnSettings, _KyogijoField_attach, _KyogijoField_draw, _KyogijoField_follow;
|
|
13
13
|
import { SPORTS } from "./draw.js";
|
|
14
14
|
import { leagueIds } from "./leagues.js";
|
|
15
15
|
import { parseRange } from "./ranges.names.js";
|
|
16
16
|
import { mountKyogijo } from "./mount.js";
|
|
17
17
|
import { TURN_PRESET_NAMES } from "./turn.camera.js";
|
|
18
18
|
import { mountKyogijoTurn } from "./turn.dom.js";
|
|
19
|
+
// A timeline on the element's 3D view plays with the replay's code for the view.
|
|
20
|
+
import "./turn.replay.dom.js";
|
|
19
21
|
/** The tag of the element. */
|
|
20
22
|
export const KYOGIJO_TAG = "kyogijo-field";
|
|
21
23
|
/** The attributes the element reads. */
|
|
@@ -355,7 +357,8 @@ export class KyogijoField extends Base {
|
|
|
355
357
|
}
|
|
356
358
|
}
|
|
357
359
|
_KyogijoField_mount = new WeakMap(), _KyogijoField_host = new WeakMap(), _KyogijoField_options = new WeakMap(), _KyogijoField_theme = new WeakMap(), _KyogijoField_timeline = new WeakMap(), _KyogijoField_replaySettings = new WeakMap(), _KyogijoField_replay = new WeakMap(), _KyogijoField_replayOf = new WeakMap(), _KyogijoField_turn = new WeakMap(), _KyogijoField_turnSettings = new WeakMap(), _KyogijoField_instances = new WeakSet(), _KyogijoField_attach = function _KyogijoField_attach(again) {
|
|
358
|
-
|
|
360
|
+
const on = __classPrivateFieldGet(this, _KyogijoField_turn, "f") ?? __classPrivateFieldGet(this, _KyogijoField_mount, "f");
|
|
361
|
+
if (on === undefined || __classPrivateFieldGet(this, _KyogijoField_timeline, "f") === undefined)
|
|
359
362
|
return;
|
|
360
363
|
const settings = replaySettingsFromAttributes((name) => this.getAttribute(name), __classPrivateFieldGet(this, _KyogijoField_replaySettings, "f"));
|
|
361
364
|
if (__classPrivateFieldGet(this, _KyogijoField_replay, "f") !== undefined && __classPrivateFieldGet(this, _KyogijoField_replayOf, "f") === __classPrivateFieldGet(this, _KyogijoField_timeline, "f") && !again) {
|
|
@@ -368,7 +371,7 @@ _KyogijoField_mount = new WeakMap(), _KyogijoField_host = new WeakMap(), _Kyogij
|
|
|
368
371
|
const from = __classPrivateFieldGet(this, _KyogijoField_replay, "f") === undefined || __classPrivateFieldGet(this, _KyogijoField_replayOf, "f") !== __classPrivateFieldGet(this, _KyogijoField_timeline, "f") ? undefined : __classPrivateFieldGet(this, _KyogijoField_replay, "f").state();
|
|
369
372
|
__classPrivateFieldGet(this, _KyogijoField_replay, "f")?.destroy();
|
|
370
373
|
__classPrivateFieldSet(this, _KyogijoField_replayOf, __classPrivateFieldGet(this, _KyogijoField_timeline, "f"), "f");
|
|
371
|
-
__classPrivateFieldSet(this, _KyogijoField_replay,
|
|
374
|
+
__classPrivateFieldSet(this, _KyogijoField_replay, on.replay(__classPrivateFieldGet(this, _KyogijoField_timeline, "f"), from === undefined ? settings : { ...settings, start: from.t - from.start }), "f");
|
|
372
375
|
}, _KyogijoField_draw = function _KyogijoField_draw() {
|
|
373
376
|
if (__classPrivateFieldGet(this, _KyogijoField_host, "f") === undefined || !this.isConnected)
|
|
374
377
|
return;
|
|
@@ -377,7 +380,7 @@ _KyogijoField_mount = new WeakMap(), _KyogijoField_host = new WeakMap(), _Kyogij
|
|
|
377
380
|
if (options.theme === undefined && (page === "light" || page === "dark"))
|
|
378
381
|
options.theme = page;
|
|
379
382
|
if (turnWanted((name) => this.getAttribute(name))) {
|
|
380
|
-
// The 3D view takes the container over from the flat drawing; a replay
|
|
383
|
+
// The 3D view takes the container over from the flat drawing; a replay plays on it, the players standing up.
|
|
381
384
|
if (__classPrivateFieldGet(this, _KyogijoField_mount, "f") !== undefined) {
|
|
382
385
|
__classPrivateFieldGet(this, _KyogijoField_mount, "f").destroy();
|
|
383
386
|
__classPrivateFieldSet(this, _KyogijoField_mount, undefined, "f");
|
|
@@ -385,20 +388,28 @@ _KyogijoField_mount = new WeakMap(), _KyogijoField_host = new WeakMap(), _Kyogij
|
|
|
385
388
|
__classPrivateFieldSet(this, _KyogijoField_replayOf, undefined, "f");
|
|
386
389
|
}
|
|
387
390
|
const settings = turnSettingsFromAttributes((name) => this.getAttribute(name), __classPrivateFieldGet(this, _KyogijoField_turnSettings, "f"));
|
|
388
|
-
if (__classPrivateFieldGet(this, _KyogijoField_turn, "f") === undefined)
|
|
391
|
+
if (__classPrivateFieldGet(this, _KyogijoField_turn, "f") === undefined) {
|
|
389
392
|
__classPrivateFieldSet(this, _KyogijoField_turn, mountKyogijoTurn(__classPrivateFieldGet(this, _KyogijoField_host, "f"), options, settings), "f");
|
|
393
|
+
__classPrivateFieldSet(this, _KyogijoField_replay, undefined, "f");
|
|
394
|
+
__classPrivateFieldSet(this, _KyogijoField_replayOf, undefined, "f");
|
|
395
|
+
}
|
|
390
396
|
else
|
|
391
397
|
__classPrivateFieldGet(this, _KyogijoField_turn, "f").update(options);
|
|
398
|
+
__classPrivateFieldGet(this, _KyogijoField_instances, "m", _KyogijoField_follow).call(this);
|
|
392
399
|
return;
|
|
393
400
|
}
|
|
394
401
|
if (__classPrivateFieldGet(this, _KyogijoField_turn, "f") !== undefined) {
|
|
395
402
|
__classPrivateFieldGet(this, _KyogijoField_turn, "f").destroy();
|
|
396
403
|
__classPrivateFieldSet(this, _KyogijoField_turn, undefined, "f");
|
|
404
|
+
__classPrivateFieldSet(this, _KyogijoField_replay, undefined, "f");
|
|
405
|
+
__classPrivateFieldSet(this, _KyogijoField_replayOf, undefined, "f");
|
|
397
406
|
}
|
|
398
407
|
if (__classPrivateFieldGet(this, _KyogijoField_mount, "f") === undefined)
|
|
399
408
|
__classPrivateFieldSet(this, _KyogijoField_mount, mountKyogijo(__classPrivateFieldGet(this, _KyogijoField_host, "f"), options), "f");
|
|
400
409
|
else
|
|
401
410
|
__classPrivateFieldGet(this, _KyogijoField_mount, "f").update(options);
|
|
411
|
+
__classPrivateFieldGet(this, _KyogijoField_instances, "m", _KyogijoField_follow).call(this);
|
|
412
|
+
}, _KyogijoField_follow = function _KyogijoField_follow() {
|
|
402
413
|
if (__classPrivateFieldGet(this, _KyogijoField_timeline, "f") === undefined) {
|
|
403
414
|
__classPrivateFieldGet(this, _KyogijoField_replay, "f")?.destroy();
|
|
404
415
|
__classPrivateFieldSet(this, _KyogijoField_replay, undefined, "f");
|
package/dist/judging.mount.js
CHANGED
|
@@ -62,6 +62,7 @@ export function mountJudgingBroadcast(host, options, settings = {}) {
|
|
|
62
62
|
direction: () => turn.direction(),
|
|
63
63
|
setDirection: (direction) => turn.setDirection(direction),
|
|
64
64
|
togglePlay: () => turn.togglePlay(),
|
|
65
|
+
replay: (timeline, replaySettings) => turn.replay(timeline, replaySettings),
|
|
65
66
|
get quality() {
|
|
66
67
|
return turn.quality;
|
|
67
68
|
},
|
package/dist/replay.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare function replayInfo(timeline: ReplayTimeline): {
|
|
|
17
17
|
events: number;
|
|
18
18
|
step: number;
|
|
19
19
|
};
|
|
20
|
+
/** Everything a timeline tracks, each as it first appears (its id, team, number and label), in that order. */
|
|
21
|
+
export declare function replayCast(timeline: ReplayTimeline): readonly ReplayObject[];
|
|
20
22
|
/** The times of the frames, and of the events, in order: the moments a step can land on. */
|
|
21
23
|
export declare function replayTimes(timeline: ReplayTimeline): readonly number[];
|
|
22
24
|
/** The events of a timeline, in time order. */
|
|
@@ -151,6 +153,8 @@ export declare function replayPlacer(options: SurfaceOptions | ScoreOptions, tim
|
|
|
151
153
|
* ```
|
|
152
154
|
*/
|
|
153
155
|
export declare function drawFrame(options: SurfaceOptions | ScoreOptions, timeline: ReplayTimeline, t: number, look?: ReplayLook): string;
|
|
156
|
+
/** `drawFrame` with only the groups `keep` says yes to: a 3D view keeps the players off its floor, where they stand up instead. */
|
|
157
|
+
export declare function drawFrameOf(options: SurfaceOptions | ScoreOptions, timeline: ReplayTimeline, t: number, look?: ReplayLook, keep?: (group: ReplayGroup) => boolean): string;
|
|
154
158
|
/** The prefix of the ids in a replay's drawing when the options give none: a hash of the options and of the timeline's size, not of the time. */
|
|
155
159
|
export declare const replayId: (options: SurfaceOptions | ScoreOptions, timeline: ReplayTimeline) => string;
|
|
156
160
|
/**
|
package/dist/replay.dom.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReplayController } from "./replay.control.ts";
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
2
|
+
import { type ReplayGroup } from "./replay.ts";
|
|
3
|
+
import type { ReplayLook, ReplaySettings, ReplayTimeline } from "./replay.types.ts";
|
|
4
|
+
import type { Language, ScoreOptions, SurfaceOptions } from "./types.ts";
|
|
4
5
|
/** The controls' stylesheet: written once beside the controls, scoped to them, in the page's own colours. */
|
|
5
6
|
export declare const REPLAY_STYLE: string;
|
|
6
7
|
/** A replay attached to a container: the controller, the stage the drawing goes in, and how to draw it again. */
|
|
@@ -13,6 +14,70 @@ export interface ReplayView {
|
|
|
13
14
|
/** Stop the clock and the listeners, and empty the container. */
|
|
14
15
|
destroy(): void;
|
|
15
16
|
}
|
|
17
|
+
/** What a painter is given: where the drawing is, what it was drawn from, and how to draw it whole again. */
|
|
18
|
+
export interface PainterSource {
|
|
19
|
+
doc: Document;
|
|
20
|
+
timeline: ReplayTimeline;
|
|
21
|
+
look: ReplayLook;
|
|
22
|
+
/** The drawing the replay's groups are in (`svg.kyogijo`), or `null` before it is written. */
|
|
23
|
+
svg(): SVGSVGElement | null;
|
|
24
|
+
/** The options it was drawn with, its `id` among them. */
|
|
25
|
+
options(): SurfaceOptions | ScoreOptions;
|
|
26
|
+
language(): Language;
|
|
27
|
+
/** Which groups of the replay are in this drawing: all when missing (a 3D view stands the players up and leaves the rest on the floor). */
|
|
28
|
+
keep?: (group: ReplayGroup) => boolean;
|
|
29
|
+
/** Write the drawing whole again at a time; the painter binds itself to it afterwards. */
|
|
30
|
+
redraw(t: number): void;
|
|
31
|
+
}
|
|
32
|
+
/** The painter of a replay's drawing: `paint` moves the marks to a time; `bind` matches the elements of a drawing just written at `t`. */
|
|
33
|
+
export interface ReplayPainter {
|
|
34
|
+
paint(t: number): void;
|
|
35
|
+
bind(t: number): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The painter of a replay: it moves the marks that move and nothing else. A mark that comes or goes (an object that enters, an event that begins) draws the replay's own group
|
|
39
|
+
* again, never the surface; a group whose marks cannot be matched to elements one for one is drawn again each time.
|
|
40
|
+
*/
|
|
41
|
+
export declare function replayPainter(source: PainterSource): ReplayPainter;
|
|
42
|
+
/** What a driver is given: how to paint a time, where its keys are heard, and what it labels. */
|
|
43
|
+
export interface DriverSource {
|
|
44
|
+
/** Move the drawing to a time. Called on every change of the clock. */
|
|
45
|
+
paint(t: number): void;
|
|
46
|
+
language: Language;
|
|
47
|
+
/** The element whose keys play, step and seek (its descendants too): the stage and the bar in a flat replay, the bar alone over a 3D view. */
|
|
48
|
+
keysOn: HTMLElement;
|
|
49
|
+
/** The element that says what the replay is doing (`data-state`, `data-motion`). */
|
|
50
|
+
holder: HTMLElement;
|
|
51
|
+
/** The element that names the replay and points at its key help (the flat drawing's stage), if any. */
|
|
52
|
+
labelled?: HTMLElement;
|
|
53
|
+
/** The element whose being in sight lets the clock run: no frame is asked for while it is scrolled out of sight. */
|
|
54
|
+
seen?: Element;
|
|
55
|
+
/** The key help: `keys` and `keysStep` by default, `keysTurn` and `keysTurnStep` over a 3D view. */
|
|
56
|
+
help?: "flat" | "turn";
|
|
57
|
+
/** Where frames are asked for: the page's `requestAnimationFrame` by default; a 3D view lends its own, so that a turning view and its replay share one frame. */
|
|
58
|
+
frames?: {
|
|
59
|
+
request(callback: FrameRequestCallback): number;
|
|
60
|
+
cancel(id: number): void;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** The page's side of a replay without its drawing: the clock on animation frames, the controls, the keys, the live region, a hidden page and reduced motion. */
|
|
64
|
+
export interface ReplayDriver {
|
|
65
|
+
controller: ReplayController;
|
|
66
|
+
/** The style, the key help, the bar and the live region, in that order, for the caller to put in the page. */
|
|
67
|
+
parts: {
|
|
68
|
+
style: HTMLStyleElement;
|
|
69
|
+
hint: HTMLElement;
|
|
70
|
+
bar: HTMLElement;
|
|
71
|
+
live: HTMLElement;
|
|
72
|
+
};
|
|
73
|
+
/** The words changed: the controls are made again. */
|
|
74
|
+
setLanguage(language: Language): void;
|
|
75
|
+
/** The play, pause or step the keys of a 3D view's stage ask for, by the names of the keys: the same moves as the bar's keys. */
|
|
76
|
+
key(event: KeyboardEvent, scope: "stage" | "bar"): boolean;
|
|
77
|
+
destroy(): void;
|
|
78
|
+
}
|
|
79
|
+
/** Make the clock, the controls and the keys of a replay. Nothing runs until the reader (or `autoplay`) plays it, and nothing runs while it is paused, hidden or out of sight. */
|
|
80
|
+
export declare function replayDriver(doc: Document, timeline: ReplayTimeline, settings: ReplaySettings, source: DriverSource): ReplayDriver;
|
|
16
81
|
/**
|
|
17
82
|
* Attach a replay to a container: the stage with the drawing, the controls under it, the keyboard and the live region. The drawing is written once
|
|
18
83
|
* and then only the marks that move are moved, on `requestAnimationFrame`; a mark that comes or goes (an object that enters, an event that
|