@wral/hsot-data 0.1.6 → 0.1.7
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { LitElement as te, html as i, css as b, nothing as p, svg as X } from "lit";
|
|
2
|
-
const
|
|
3
|
-
function
|
|
2
|
+
const ne = 50;
|
|
3
|
+
function le(a = {}) {
|
|
4
4
|
const e = Object.entries(a).filter(([, s]) => s != null && s !== "");
|
|
5
5
|
if (!e.length) return "";
|
|
6
6
|
const t = new URLSearchParams();
|
|
7
7
|
return e.forEach(([s, r]) => t.set(s, String(r))), `?${t.toString()}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function ce({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
10
10
|
if (!a) throw new Error("createClient requires a baseUrl");
|
|
11
11
|
const s = a.replace(/\/+$/, ""), r = t || ((...n) => fetch(...n));
|
|
12
12
|
async function o(n) {
|
|
@@ -22,8 +22,8 @@ function le({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
|
22
22
|
async function c(n, h = {}) {
|
|
23
23
|
const l = [];
|
|
24
24
|
let d = null;
|
|
25
|
-
for (let m = 0; m <
|
|
26
|
-
const f =
|
|
25
|
+
for (let m = 0; m < ne; m += 1) {
|
|
26
|
+
const f = le(d ? { ...h, cursor: d } : h), g = await o(`${n}${f}`);
|
|
27
27
|
if (l.push(...g.items || []), d = g.nextCursor || null, !d) break;
|
|
28
28
|
}
|
|
29
29
|
return { items: l, total: l.length, nextCursor: null };
|
|
@@ -44,7 +44,7 @@ function le({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
|
44
44
|
listSports: () => o("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const H = {
|
|
48
48
|
game: "/{sport}/game/{id}/",
|
|
49
49
|
school: "/school/{id}/",
|
|
50
50
|
section: "/{sport}/{view}/"
|
|
@@ -54,9 +54,9 @@ function u(a, e) {
|
|
|
54
54
|
}
|
|
55
55
|
function D(a) {
|
|
56
56
|
return {
|
|
57
|
-
game: a.getAttribute("game-href") ||
|
|
58
|
-
school: a.getAttribute("school-href") ||
|
|
59
|
-
section: a.getAttribute("section-href") ||
|
|
57
|
+
game: a.getAttribute("game-href") || H.game,
|
|
58
|
+
school: a.getAttribute("school-href") || H.school,
|
|
59
|
+
section: a.getAttribute("section-href") || H.section
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
const T = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
@@ -65,17 +65,17 @@ function $(a, e) {
|
|
|
65
65
|
const [t, s, r] = String(a).split("-").map(Number);
|
|
66
66
|
return !t || !s || !r ? "TBD" : new Date(t, s - 1, r).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function M(a) {
|
|
69
69
|
if (!a) return "";
|
|
70
70
|
const [e, t] = String(a).split(":").map(Number);
|
|
71
71
|
if (Number.isNaN(e)) return "";
|
|
72
72
|
const s = e >= 12 ? "PM" : "AM";
|
|
73
73
|
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function de(a) {
|
|
76
76
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function L(a = /* @__PURE__ */ new Date()) {
|
|
79
79
|
const e = a.getFullYear();
|
|
80
80
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
81
81
|
}
|
|
@@ -83,7 +83,7 @@ function j(a = /* @__PURE__ */ new Date()) {
|
|
|
83
83
|
const e = (t) => String(t).padStart(2, "0");
|
|
84
84
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function he(a, e = j()) {
|
|
87
87
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
88
88
|
if (!t.length || t.includes(e)) return e;
|
|
89
89
|
const s = t.filter((r) => r < e);
|
|
@@ -97,17 +97,17 @@ function E(a) {
|
|
|
97
97
|
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, r = e & 255;
|
|
98
98
|
return 0.299 * t + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const me = (a) => {
|
|
101
101
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
102
102
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
103
103
|
};
|
|
104
|
-
function
|
|
104
|
+
function se(a) {
|
|
105
105
|
if (a.state === "live") return { kind: "live", label: `Live · ${a.period || ""}`.replace(/ · $/, "") };
|
|
106
106
|
if (a.state === "final") {
|
|
107
107
|
const e = [];
|
|
108
108
|
return a.finish === "overtime" && e.push("OT"), a.finish === "shootout" && e.push("PK-SO"), a.forfeit && a.forfeit !== "none" && e.push("Forfeit"), { kind: "final", label: `Final${e.length ? ` · ${e.join(" · ")}` : ""}` };
|
|
109
109
|
}
|
|
110
|
-
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${$(a.date, { month: "short", day: "numeric" })} · ${
|
|
110
|
+
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${$(a.date, { month: "short", day: "numeric" })} · ${M(a.time)}`.replace(/ · $/, "") };
|
|
111
111
|
}
|
|
112
112
|
const pe = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
113
113
|
function x(a) {
|
|
@@ -118,7 +118,7 @@ function x(a) {
|
|
|
118
118
|
let r = e.split("?")[0] + s;
|
|
119
119
|
return r = r.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), r = r.replace(/^\/(?=#)/, ""), r.length > 1 && (r = r.replace(/\/+$/, "")), r.toLowerCase();
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ae() {
|
|
122
122
|
const a = globalThis.location;
|
|
123
123
|
if (!a) return "";
|
|
124
124
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
@@ -149,7 +149,7 @@ function ue(a, e, t) {
|
|
|
149
149
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
150
150
|
];
|
|
151
151
|
}
|
|
152
|
-
function ge(a, e =
|
|
152
|
+
function ge(a, e = ae()) {
|
|
153
153
|
const t = x(e);
|
|
154
154
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
155
155
|
t && x(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
@@ -173,7 +173,7 @@ class y extends te {
|
|
|
173
173
|
this._client = e, this.isConnected && this.load();
|
|
174
174
|
}
|
|
175
175
|
get client() {
|
|
176
|
-
return this._client ? this._client : this.api ?
|
|
176
|
+
return this._client ? this._client : this.api ? ce({ baseUrl: this.api }) : null;
|
|
177
177
|
}
|
|
178
178
|
connectedCallback() {
|
|
179
179
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -437,6 +437,14 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
437
437
|
.gamelist li:last-child { border-bottom: none; }
|
|
438
438
|
.gamelist .d { width: 84px; flex: none; color: var(--hsot-gray-5); font-size: 0.8rem; }
|
|
439
439
|
.gamelist .res { width: 86px; flex: none; font-family: var(--hsot-heading-font); font-weight: 700; }
|
|
440
|
+
/* Per-team score block on the scoreboard, in the status pills' bubble shape. */
|
|
441
|
+
.gamelist .score {
|
|
442
|
+
display: inline-block; min-width: 1.15em; text-align: center;
|
|
443
|
+
background: var(--hsot-red); color: var(--hsot-white);
|
|
444
|
+
font-family: var(--hsot-heading-font); font-weight: 700; font-size: 0.8125rem;
|
|
445
|
+
line-height: 1.2; border-radius: var(--hsot-radius-md); padding: 0.14rem 0.4rem;
|
|
446
|
+
margin-left: 0.45rem; vertical-align: middle; font-variant-numeric: tabular-nums;
|
|
447
|
+
}
|
|
440
448
|
.gamelist .res .W { color: var(--hsot-win); }
|
|
441
449
|
.gamelist .res .L { color: var(--hsot-loss); }
|
|
442
450
|
.gamelist .res .T { color: var(--hsot-tie); }
|
|
@@ -464,7 +472,7 @@ function z(a, e) {
|
|
|
464
472
|
}
|
|
465
473
|
return t;
|
|
466
474
|
}
|
|
467
|
-
function
|
|
475
|
+
function N(a) {
|
|
468
476
|
if (!a || !a.length) return "";
|
|
469
477
|
const e = a[a.length - 1].mark;
|
|
470
478
|
let t = 0;
|
|
@@ -480,7 +488,7 @@ function w(a, e = !1) {
|
|
|
480
488
|
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
481
489
|
return `${t}-${s}${r ? `-${r}` : ""}`;
|
|
482
490
|
}
|
|
483
|
-
function
|
|
491
|
+
function re(a, e) {
|
|
484
492
|
return a.map((t) => {
|
|
485
493
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
486
494
|
return { team: t, rec: s, confPct: Z(s.cw, s.cl, s.ct), overallPct: Z(s.w, s.l, s.t) };
|
|
@@ -535,7 +543,7 @@ function _(a, e) {
|
|
|
535
543
|
return `${t}${r}w=${s}&h=${s}&f=webp`;
|
|
536
544
|
}
|
|
537
545
|
function Y(a, e, { title: t, sub: s, teams: r }) {
|
|
538
|
-
const o =
|
|
546
|
+
const o = ae(), n = !!a.querySelector(':scope > a[slot="nav"]') || fe(o, e.hrefs, e.sport) !== null;
|
|
539
547
|
return i`
|
|
540
548
|
<div class="band section">
|
|
541
549
|
<div class="inner">
|
|
@@ -573,7 +581,7 @@ function K(a, e, t) {
|
|
|
573
581
|
const s = V(a.rankings, a.teamsById, e, a.sport, t);
|
|
574
582
|
return s ? i`<span class="rankbadge">#${s}</span>` : p;
|
|
575
583
|
}
|
|
576
|
-
function
|
|
584
|
+
function U(a, e, t) {
|
|
577
585
|
const s = S(a, e);
|
|
578
586
|
return s ? i`${K(a, e, t)}<a href=${u(a.hrefs.school, { id: s.id })}>${s.name}</a>` : i`<span class="mut">TBD</span>`;
|
|
579
587
|
}
|
|
@@ -599,10 +607,10 @@ function P(a) {
|
|
|
599
607
|
return i`<div class="promo">${a.promoHref ? i`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
600
608
|
}
|
|
601
609
|
function R(a) {
|
|
602
|
-
const e =
|
|
610
|
+
const e = se(a);
|
|
603
611
|
return i`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
604
612
|
}
|
|
605
|
-
function
|
|
613
|
+
function oe(a, e, t) {
|
|
606
614
|
if (!e) return i`<span class="mut">·</span>`;
|
|
607
615
|
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
608
616
|
return i`${e.state === "live" ? i`<span class="pill live">Live</span> ` : i`${$(e.date, { month: "numeric", day: "numeric" })} `}${r} ${A(a, s)}`;
|
|
@@ -626,14 +634,14 @@ class Se extends y {
|
|
|
626
634
|
this._datePinned = !!this.date;
|
|
627
635
|
}
|
|
628
636
|
async fetchData(e) {
|
|
629
|
-
const t = this.season ||
|
|
637
|
+
const t = this.season || L(), [s, r, o, c, n] = await Promise.all([
|
|
630
638
|
e.listSchools(),
|
|
631
639
|
e.listTeams({ sport: this.sport }),
|
|
632
640
|
e.listConferences(),
|
|
633
641
|
e.listGames({ sport: this.sport, season: t }),
|
|
634
642
|
e.listRankings({ sport: this.sport })
|
|
635
643
|
]);
|
|
636
|
-
return this._datePinned || (this.date =
|
|
644
|
+
return this._datePinned || (this.date = he(c.items.map((h) => h.date)), this._datePinned = !0), {
|
|
637
645
|
season: t,
|
|
638
646
|
schools: s.items,
|
|
639
647
|
teams: r.items,
|
|
@@ -700,13 +708,16 @@ class Se extends y {
|
|
|
700
708
|
`)}
|
|
701
709
|
`;
|
|
702
710
|
}
|
|
711
|
+
// Each team's score rides in a block beside its name (reader feedback:
|
|
712
|
+
// a lone score column on the far right read as detached from the teams).
|
|
713
|
+
// Scheduled games carry their start time on the status pill alone.
|
|
703
714
|
renderGame(e, t) {
|
|
704
|
-
const s = t.state === "final" || t.state === "live"
|
|
715
|
+
const s = t.state === "final" || t.state === "live";
|
|
705
716
|
return i`
|
|
706
717
|
<li>
|
|
707
718
|
${R(t)}
|
|
708
|
-
<span class="opp">${
|
|
709
|
-
|
|
719
|
+
<span class="opp">${U(e, t.awayTeamId, t.date)}${s ? i`<span class="score">${t.awayScore}</span>` : p}
|
|
720
|
+
at ${U(e, t.homeTeamId, t.date)}${s ? i`<span class="score">${t.homeScore}</span>` : p}</span>
|
|
710
721
|
<span class="where">${t.venue || ""}</span>
|
|
711
722
|
${t.broadcast ? i`<span class="pill class">${t.broadcast}</span>` : p}
|
|
712
723
|
<a class="box" href=${u(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
@@ -728,7 +739,7 @@ class Ce extends y {
|
|
|
728
739
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
729
740
|
}
|
|
730
741
|
async fetchData(e) {
|
|
731
|
-
const t = this.season ||
|
|
742
|
+
const t = this.season || L(), [s, r, o, c, n] = await Promise.all([
|
|
732
743
|
e.listConferences({ active: !0 }),
|
|
733
744
|
e.listSchools(),
|
|
734
745
|
e.listTeams({ sport: this.sport }),
|
|
@@ -785,7 +796,7 @@ class Ce extends y {
|
|
|
785
796
|
renderConference(e, t) {
|
|
786
797
|
const s = this.data.teams.filter((c) => c.conferenceId === t.id);
|
|
787
798
|
if (!s.length) return p;
|
|
788
|
-
const r = this.query.trim().toLowerCase(), o =
|
|
799
|
+
const r = this.query.trim().toLowerCase(), o = re(s, e.records);
|
|
789
800
|
return i`
|
|
790
801
|
<div class="card">
|
|
791
802
|
<div class="card-head">
|
|
@@ -829,9 +840,9 @@ class Ce extends y {
|
|
|
829
840
|
<td class="num">${t.rec.pf}</td>
|
|
830
841
|
<td class="num">${t.rec.pa}</td>
|
|
831
842
|
<td class="num" style="color:${n >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${n > 0 ? "+" : ""}${n}</td>
|
|
832
|
-
<td>${
|
|
843
|
+
<td>${N(t.rec.results) || "·"}</td>
|
|
833
844
|
<td>${Q(e, t.team.id)}</td>
|
|
834
|
-
<td>${
|
|
845
|
+
<td>${oe(e, h, t.team.id)}</td>
|
|
835
846
|
</tr>
|
|
836
847
|
`;
|
|
837
848
|
}
|
|
@@ -872,7 +883,7 @@ class Fe extends y {
|
|
|
872
883
|
e && (this.pollDate = e);
|
|
873
884
|
}
|
|
874
885
|
async fetchData(e) {
|
|
875
|
-
const t = this.season ||
|
|
886
|
+
const t = this.season || L(), [s, r, o, c, n] = await Promise.all([
|
|
876
887
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
877
888
|
e.listSchools(),
|
|
878
889
|
e.listTeams({ sport: this.sport }),
|
|
@@ -902,8 +913,8 @@ class Fe extends y {
|
|
|
902
913
|
const n = t.map((m, f) => {
|
|
903
914
|
const g = (m.teamIds || []).indexOf(e);
|
|
904
915
|
if (g === -1) return null;
|
|
905
|
-
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3,
|
|
906
|
-
return { x: k, y:
|
|
916
|
+
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, O = 3 + g / 24 * 20;
|
|
917
|
+
return { x: k, y: O };
|
|
907
918
|
}), h = [];
|
|
908
919
|
let l = [];
|
|
909
920
|
if (n.forEach((m) => {
|
|
@@ -976,7 +987,7 @@ class Fe extends y {
|
|
|
976
987
|
<h2><a href=${u(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
977
988
|
<div class="facts">
|
|
978
989
|
${w(n)} overall${l ? i` · ${w(n, !0)} ${l.name}` : p}
|
|
979
|
-
· streak ${
|
|
990
|
+
· streak ${N(n?.results) || "·"}
|
|
980
991
|
${h ? i` · last: ${h.mark} ${h.my}-${h.their} vs ${A(e, h.opp)}` : p}
|
|
981
992
|
${this.movement(t, s, r)}
|
|
982
993
|
</div>
|
|
@@ -991,8 +1002,8 @@ class Fe extends y {
|
|
|
991
1002
|
location.href = u(e.hrefs.school, { id: l.id });
|
|
992
1003
|
};
|
|
993
1004
|
return i`
|
|
994
|
-
<tr class="rowlink" @click=${(
|
|
995
|
-
|
|
1005
|
+
<tr class="rowlink" @click=${(O) => {
|
|
1006
|
+
O.target.closest("a") || k();
|
|
996
1007
|
}}>
|
|
997
1008
|
<td class="num" style="font-weight:700">${h}</td>
|
|
998
1009
|
<td>${this.movement(t, s, n)}</td>
|
|
@@ -1003,7 +1014,7 @@ class Fe extends y {
|
|
|
1003
1014
|
<td>${m ? i`<a class="box" style="text-decoration:none" href=${u(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1004
1015
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1005
1016
|
${m.my}-${m.their} vs ${A(e, m.opp)}</a>` : i`<span class="mut">·</span>`}</td>
|
|
1006
|
-
<td>${
|
|
1017
|
+
<td>${oe(e, f, n)}</td>
|
|
1007
1018
|
<td>${this.sparkline(n, r, o)}</td>
|
|
1008
1019
|
</tr>
|
|
1009
1020
|
`;
|
|
@@ -1053,7 +1064,7 @@ class Be extends y {
|
|
|
1053
1064
|
e && !this.sport && (this.sport = e);
|
|
1054
1065
|
}
|
|
1055
1066
|
async fetchData(e) {
|
|
1056
|
-
const t = this.season ||
|
|
1067
|
+
const t = this.season || L(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, c = o.find((k) => k.sport === (this.sport || "football")) || o[0] || null, [n, h, l, d, m, f, g] = await Promise.all([
|
|
1057
1068
|
c ? e.listGames({ sport: c.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1058
1069
|
c ? e.listTeams({ sport: c.sport }) : Promise.resolve({ items: [] }),
|
|
1059
1070
|
e.listSchools(),
|
|
@@ -1108,7 +1119,6 @@ class Be extends y {
|
|
|
1108
1119
|
${n ? i`<span><b>Enrollment</b>${n.value.toLocaleString()} (${n.season} ADM)</span>` : p}
|
|
1109
1120
|
${e.openingYear ? i`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1110
1121
|
${e.areaCode ? i`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1111
|
-
${e.tagSlug ? i`<span><b>Tag</b>#${e.tagSlug}</span>` : p}
|
|
1112
1122
|
</div>
|
|
1113
1123
|
</div>
|
|
1114
1124
|
</div>
|
|
@@ -1127,15 +1137,15 @@ class Be extends y {
|
|
|
1127
1137
|
`;
|
|
1128
1138
|
}
|
|
1129
1139
|
renderTeam(e, t, s, r) {
|
|
1130
|
-
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, c = o.w + o.l + o.t, n = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], h = s ?
|
|
1140
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, c = o.w + o.l + o.t, n = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], h = s ? re(n, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, l = V(e.rankings, e.teamsById, t.id, t.sport, null), d = this.data.games.filter((m) => m.homeTeamId === t.id || m.awayTeamId === t.id).sort((m, f) => String(m.date).localeCompare(String(f.date)));
|
|
1131
1141
|
return i`
|
|
1132
1142
|
<div class="tiles">
|
|
1133
1143
|
<div class="tile"><div class="k">Overall</div><div class="v">${w(o)}</div><div class="s">${c} games played</div></div>
|
|
1134
1144
|
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(o, !0)}</div>
|
|
1135
|
-
<div class="s">${h ? `${
|
|
1145
|
+
<div class="s">${h ? `${me(h)} of ${n.length}` : "·"}</div></div>
|
|
1136
1146
|
<div class="tile"><div class="k">Points</div><div class="v">${c ? (o.pf / c).toFixed(1) : "0.0"}</div>
|
|
1137
1147
|
<div class="s">scored per game · ${c ? (o.pa / c).toFixed(1) : "0.0"} allowed</div></div>
|
|
1138
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${
|
|
1148
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${N(o.results) || "·"}</div>
|
|
1139
1149
|
<div class="s">last 5: ${Q(e, t.id)}</div></div>
|
|
1140
1150
|
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${l ? `#${l}` : "NR"}</div>
|
|
1141
1151
|
<div class="s"><a href=${u(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
@@ -1160,7 +1170,7 @@ class Be extends y {
|
|
|
1160
1170
|
}
|
|
1161
1171
|
renderGameRow(e, t, s) {
|
|
1162
1172
|
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, c = r ? s.homeScore : s.awayScore, n = r ? s.awayScore : s.homeScore;
|
|
1163
|
-
let h = i`<span class="mut">${
|
|
1173
|
+
let h = i`<span class="mut">${M(s.time)}</span>`;
|
|
1164
1174
|
if (s.state === "final") {
|
|
1165
1175
|
const d = q(s), m = d === "tie" ? "T" : d === (r ? "home" : "away") ? "W" : "L";
|
|
1166
1176
|
h = i`<span class=${m}>${m}</span> ${c}-${n}${s.finish === "overtime" ? i` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? i` <span class="mut">FF</span>` : p}`;
|
|
@@ -1169,9 +1179,9 @@ class Be extends y {
|
|
|
1169
1179
|
return i`
|
|
1170
1180
|
<li>
|
|
1171
1181
|
<span class="d">${$(s.date)}</span>
|
|
1172
|
-
${R(s)}
|
|
1182
|
+
${se(s).kind === "sched" ? p : R(s)}
|
|
1173
1183
|
<span class="res">${h}</span>
|
|
1174
|
-
<span class="opp">${r ? "vs" : "at"} ${
|
|
1184
|
+
<span class="opp">${r ? "vs" : "at"} ${U(e, o, s.date)}
|
|
1175
1185
|
<span class="pill type">${l}</span>
|
|
1176
1186
|
${s.broadcast ? i`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1177
1187
|
</span>
|
|
@@ -1196,7 +1206,7 @@ class Be extends y {
|
|
|
1196
1206
|
<td style="font-weight:500">${c.firstName} ${c.lastName}</td>
|
|
1197
1207
|
<td>${o.position || "·"}</td>
|
|
1198
1208
|
<td class="mut">${c.classOf || "·"}</td>
|
|
1199
|
-
<td class="num">${
|
|
1209
|
+
<td class="num">${de(c.heightIn)}</td>
|
|
1200
1210
|
<td class="num">${c.weightLb || "·"}</td>
|
|
1201
1211
|
</tr>` : p;
|
|
1202
1212
|
})}
|
|
@@ -1214,7 +1224,7 @@ function _e(a, e) {
|
|
|
1214
1224
|
const t = String(a || Pe).replace(/\/+$/, ""), s = new URLSearchParams({ query: Ee(e), sort: "score", lang: "en" });
|
|
1215
1225
|
return `${t}/v1/query?${s}`;
|
|
1216
1226
|
}
|
|
1217
|
-
function
|
|
1227
|
+
function ie(a) {
|
|
1218
1228
|
try {
|
|
1219
1229
|
const e = new URL(a);
|
|
1220
1230
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1233,7 +1243,7 @@ async function Ae(a, e, t) {
|
|
|
1233
1243
|
const r = await ((...n) => fetch(...n))(_e(a, e));
|
|
1234
1244
|
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1235
1245
|
const o = await r.json(), c = new Map((o.items || []).map((n) => [n.uri, n]));
|
|
1236
|
-
return e.map((n) => c.get(n) ||
|
|
1246
|
+
return e.map((n) => c.get(n) || ie(n));
|
|
1237
1247
|
}
|
|
1238
1248
|
const Re = b`
|
|
1239
1249
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
@@ -1297,7 +1307,7 @@ class Le extends y {
|
|
|
1297
1307
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1298
1308
|
// A search outage must not blank the box score — degrade to bare
|
|
1299
1309
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1300
|
-
s.length ? Ae(this.searchApi, s).catch(() => s.map(
|
|
1310
|
+
s.length ? Ae(this.searchApi, s).catch(() => s.map(ie)) : Promise.resolve([])
|
|
1301
1311
|
]);
|
|
1302
1312
|
return {
|
|
1303
1313
|
game: t,
|
|
@@ -1341,7 +1351,7 @@ class Le extends y {
|
|
|
1341
1351
|
<span style=${n("home")}>${e.homeScore}</span>
|
|
1342
1352
|
</div>
|
|
1343
1353
|
<div class="status">${R(e)}</div>
|
|
1344
|
-
<div class="status">${$(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? i` · ${
|
|
1354
|
+
<div class="status">${$(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? i` · ${M(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1345
1355
|
${e.broadcast ? i` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1346
1356
|
<div class="status">
|
|
1347
1357
|
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
@@ -1432,7 +1442,7 @@ class Le extends y {
|
|
|
1432
1442
|
<div class="who">${C(s)}${s.name}</div>
|
|
1433
1443
|
<div class="row">
|
|
1434
1444
|
<span>Last 5: ${Q(e, t)}</span>
|
|
1435
|
-
<span>Streak: <b>${r ?
|
|
1445
|
+
<span>Streak: <b>${r ? N(r.results) : "·"}</b></span>
|
|
1436
1446
|
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1437
1447
|
<span>Next: ${o ? i`${$(o.date, { month: "numeric", day: "numeric" })}
|
|
1438
1448
|
${o.homeTeamId === t ? "vs" : "at"} ${A(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
@@ -1622,7 +1632,7 @@ class He extends te {
|
|
|
1622
1632
|
}
|
|
1623
1633
|
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", He);
|
|
1624
1634
|
export {
|
|
1625
|
-
|
|
1635
|
+
H as D,
|
|
1626
1636
|
Le as H,
|
|
1627
1637
|
Fe as a,
|
|
1628
1638
|
Be as b,
|
|
@@ -1630,13 +1640,13 @@ export {
|
|
|
1630
1640
|
Se as d,
|
|
1631
1641
|
Ce as e,
|
|
1632
1642
|
z as f,
|
|
1633
|
-
|
|
1643
|
+
ce as g,
|
|
1634
1644
|
u as h,
|
|
1635
1645
|
q as i,
|
|
1636
1646
|
Me as j,
|
|
1637
|
-
|
|
1647
|
+
N as k,
|
|
1638
1648
|
Te as p,
|
|
1639
1649
|
w as r,
|
|
1640
|
-
|
|
1650
|
+
re as s,
|
|
1641
1651
|
V as t
|
|
1642
1652
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as o, H as e, a as t, b as r, c as n, d as c, e as l, f as i, g as H, h as S, i as g, p as d, r as m, j as R, s as f, k as h, t as k } from "./hsot-school-search-
|
|
1
|
+
import { D as o, H as e, a as t, b as r, c as n, d as c, e as l, f as i, g as H, h as S, i as g, p as d, r as m, j as R, s as f, k as h, t as k } from "./hsot-school-search-31NEMjUb.js";
|
|
2
2
|
export {
|
|
3
3
|
o as DEFAULT_HREFS,
|
|
4
4
|
e as HsotBoxscore,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wral/hsot-data",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Lit web components for the HighSchoolOT public data pages: scores/schedules, standings, rankings, school pages, and box scores, rendered from api-hsot v1 read payloads.",
|
|
6
6
|
"author": "WRAL Digital",
|