@courthive/scoring-visualizations 0.2.18 → 0.2.20
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/README.md +2 -2
- package/dist/__conformance__/factoryEpisodeTypes.d.ts +20 -0
- package/dist/__conformance__/factoryEpisodeTypes.d.ts.map +1 -0
- package/dist/engine/feedMatchUp.d.ts +6 -1
- package/dist/engine/feedMatchUp.d.ts.map +1 -1
- package/dist/episodes/buildEpisodes.d.ts +0 -7
- package/dist/episodes/buildEpisodes.d.ts.map +1 -1
- package/dist/episodes/types.d.ts +14 -5
- package/dist/episodes/types.d.ts.map +1 -1
- package/dist/scoring-visualizations.es.js +340 -340
- package/dist/scoring-visualizations.umd.js +2 -2
- package/dist/visualizations/types/index.d.ts +13 -6
- package/dist/visualizations/types/index.d.ts.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ import { gameTree, buildEpisodes } from '@courthive/scoring-visualizations';
|
|
|
24
24
|
|
|
25
25
|
const chart = gameTree();
|
|
26
26
|
chart.options({ display: { sizeToFit: true } });
|
|
27
|
-
chart.players(['
|
|
27
|
+
chart.players(['Lindqvist', 'Okafor']);
|
|
28
28
|
chart.data(buildEpisodes(matchUp)); // or chart.matchUp(matchUp)
|
|
29
29
|
|
|
30
30
|
select(container).call(chart);
|
|
@@ -109,7 +109,7 @@ import { coronaChartFromMatchUp, momentumChart, buildEpisodes } from '@courthive
|
|
|
109
109
|
|
|
110
110
|
// Direct one-call render
|
|
111
111
|
coronaChartFromMatchUp(document.getElementById('corona'), matchUp, {
|
|
112
|
-
players: ['
|
|
112
|
+
players: ['Lindqvist', 'Okafor'],
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
// Reusable-chart pattern
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EpisodeNeeded, PointsToDecoration } from 'tods-competition-factory';
|
|
2
|
+
import { Episode } from '../visualizations/types';
|
|
3
|
+
/** Compile error if `T` is not assignable to `U`. */
|
|
4
|
+
type AssertAssignable<T extends U, U> = T;
|
|
5
|
+
/** Our `needed` IS the factory's type — not a structural look-alike. */
|
|
6
|
+
export type NeededIsTheFactoryType = AssertAssignable<Episode['needed'], EpisodeNeeded>;
|
|
7
|
+
/**
|
|
8
|
+
* The fields `calculatePointsTo` produces are the fields an episode can carry.
|
|
9
|
+
*
|
|
10
|
+
* Fails if the factory adds a points-to field that `EpisodeNeeded` does not surface — the gap that
|
|
11
|
+
* would otherwise strand new data one layer below the renderers.
|
|
12
|
+
*/
|
|
13
|
+
export type EveryPointsToFieldIsSurfaced = AssertAssignable<Exclude<keyof PointsToDecoration, keyof EpisodeNeeded>, never>;
|
|
14
|
+
/**
|
|
15
|
+
* Fields we do not yet render. `pointsToMatch` now reaches `buildEpisodes`; no chart plots it.
|
|
16
|
+
* Recorded rather than hidden, so the next person sees the gap without re-deriving it.
|
|
17
|
+
*/
|
|
18
|
+
export type SurfacedButUnrendered = Exclude<keyof EpisodeNeeded, 'pointsToGame' | 'pointsToSet' | 'gamesToSet'>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=factoryEpisodeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factoryEpisodeTypes.d.ts","sourceRoot":"","sources":["../../src/__conformance__/factoryEpisodeTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qDAAqD;AACrD,KAAK,gBAAgB,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAE1C,wEAAwE;AACxE,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC;AAExF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,CACzD,OAAO,CAAC,MAAM,kBAAkB,EAAE,MAAM,aAAa,CAAC,EACtD,KAAK,CACN,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,MAAM,aAAa,EAAE,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Feed
|
|
2
|
+
* Feed the bundled demo matches into the factory ScoringEngine
|
|
3
3
|
*
|
|
4
4
|
* Thin wrapper: iterates points, calls addPoint(), returns getState().
|
|
5
5
|
* No scoring logic lives here — the ScoringEngine is the single source of truth.
|
|
6
|
+
*
|
|
7
|
+
* The demo matches are SYNTHETIC: `scripts/generateSyntheticMatches.mjs` plays them through the
|
|
8
|
+
* ScoringEngine from fixed seeds, with fictional players. They replaced real Match Charting Project
|
|
9
|
+
* matches (CC BY-NC-SA 4.0), whose non-commercial and share-alike terms cannot ride inside this MIT
|
|
10
|
+
* package. The shape — and the `Mcp*` names below, kept so the API is unchanged — is the MCP one.
|
|
6
11
|
*/
|
|
7
12
|
interface McpPoint {
|
|
8
13
|
index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedMatchUp.d.ts","sourceRoot":"","sources":["../../src/engine/feedMatchUp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"feedMatchUp.d.ts","sourceRoot":"","sources":["../../src/engine/feedMatchUp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,E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MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAU7C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,UAAU,SAAI,GAAG,GAAG,CA4B/C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,GAAG,EAAE,CAEvC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,SAAI,GAAG,UAAU,CAExD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,EAAE,EAAE,CAW5D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAI,EAAE,OAAO,SAAI,GAAG,GAAG,EAAE,CA4B9E"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
import { Episode } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Transforms a ScoringEngine MatchUp into an Episode array
|
|
4
|
-
* suitable for visualization components (GameTree, Momentum, PTS, GameFish, Corona).
|
|
5
|
-
*
|
|
6
|
-
* @param matchUp - A MatchUp object from ScoringEngine.getState()
|
|
7
|
-
* @returns Episode[] - Array of episodes, one per point played
|
|
8
|
-
*/
|
|
9
2
|
export declare function buildEpisodes(matchUp: any): Episode[];
|
|
10
3
|
//# sourceMappingURL=buildEpisodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildEpisodes.d.ts","sourceRoot":"","sources":["../../src/episodes/buildEpisodes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildEpisodes.d.ts","sourceRoot":"","sources":["../../src/episodes/buildEpisodes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA0BvC,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,EAAE,CA4BrD"}
|
package/dist/episodes/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EpisodeNeeded } from 'tods-competition-factory';
|
|
1
2
|
export interface EpisodePoint {
|
|
2
3
|
winner: number;
|
|
3
4
|
server: number;
|
|
@@ -27,11 +28,19 @@ export interface EpisodeSet {
|
|
|
27
28
|
sets: number[][];
|
|
28
29
|
index: number;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Re-exported from the factory rather than redeclared.
|
|
33
|
+
*
|
|
34
|
+
* The local copy required `pointsToGame` / `pointsToSet` / `gamesToSet` as `number[]`, while the
|
|
35
|
+
* factory declares each as an OPTIONAL `[number, number]` and carries two more members
|
|
36
|
+
* (`pointsToMatch`, `isBreakpoint`). A required field cannot represent "no points-to applies here",
|
|
37
|
+
* which is what forced the `[0, 0]` default this branch removes — a rendered zero that means
|
|
38
|
+
* "absent" is indistinguishable from one that means zero.
|
|
39
|
+
*
|
|
40
|
+
* Same remedy courthive-components #581 applied to `SideExitProvenanceEntry`: re-export the
|
|
41
|
+
* authority instead of keeping a copy free to drift from it.
|
|
42
|
+
*/
|
|
43
|
+
export type { EpisodeNeeded } from 'tods-competition-factory';
|
|
35
44
|
export interface Episode {
|
|
36
45
|
action: 'addPoint';
|
|
37
46
|
point: EpisodePoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/episodes/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IAEb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAA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