@wral/hsot-data 0.1.13 → 0.1.14
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.
|
@@ -59,7 +59,7 @@ function D(a) {
|
|
|
59
59
|
section: a.getAttribute("section-href") || H.section
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const T = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
63
63
|
function y(a, e) {
|
|
64
64
|
if (!a) return "TBD";
|
|
65
65
|
const [t, s, o] = String(a).split("-").map(Number);
|
|
@@ -95,7 +95,7 @@ function fe(a, e = M()) {
|
|
|
95
95
|
function j(a) {
|
|
96
96
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function A(a) {
|
|
99
99
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
100
100
|
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, o = e & 255;
|
|
101
101
|
return 0.299 * t + 0.587 * s + 0.114 * o > 150 ? "#0F1B33" : "#FFFFFF";
|
|
@@ -116,7 +116,10 @@ function ge(a, e) {
|
|
|
116
116
|
return t(a).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
117
117
|
}
|
|
118
118
|
function se(a) {
|
|
119
|
-
if (a.state === "live")
|
|
119
|
+
if (a.state === "live") {
|
|
120
|
+
const e = [a.period, a.clock].filter(Boolean).join(" ");
|
|
121
|
+
return { kind: "live", label: e ? `Live · ${e}` : "Live" };
|
|
122
|
+
}
|
|
120
123
|
if (a.state === "final") {
|
|
121
124
|
const e = [];
|
|
122
125
|
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(" · ")}` : ""}` };
|
|
@@ -156,7 +159,7 @@ function ye(a, e, t) {
|
|
|
156
159
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
157
160
|
] : [{ label: "Standings", href: s("standings") }];
|
|
158
161
|
return [
|
|
159
|
-
{ label: `${
|
|
162
|
+
{ label: `${T(a)} Home`, href: s("") },
|
|
160
163
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
161
164
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
162
165
|
...r,
|
|
@@ -385,7 +388,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
385
388
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
386
389
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
387
390
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
388
|
-
`,
|
|
391
|
+
`, Se = b`
|
|
389
392
|
.pill {
|
|
390
393
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
391
394
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -400,7 +403,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
400
403
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
401
404
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
402
405
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
403
|
-
`,
|
|
406
|
+
`, Te = b`
|
|
404
407
|
.tablewrap { overflow-x: auto; }
|
|
405
408
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
406
409
|
table.data th {
|
|
@@ -492,7 +495,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
492
495
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
493
496
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
494
497
|
.gamelist a.box { font-size: 0.78rem; }
|
|
495
|
-
`, F = [we, xe, ke,
|
|
498
|
+
`, F = [we, xe, ke, Se, Te, Ie, Ce];
|
|
496
499
|
function G(a) {
|
|
497
500
|
return a.state !== "final" ? null : a.forfeit === "home" ? "away" : a.forfeit === "away" || a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
|
|
498
501
|
}
|
|
@@ -585,7 +588,7 @@ function re(a, { w: e, h: t } = {}) {
|
|
|
585
588
|
const o = a.includes("?") ? "&" : "?";
|
|
586
589
|
return `${a}${o}${s.join("&")}`;
|
|
587
590
|
}
|
|
588
|
-
function
|
|
591
|
+
function E(a, e) {
|
|
589
592
|
const t = e * 2;
|
|
590
593
|
return re(a?.logoAssetId, { w: t, h: t });
|
|
591
594
|
}
|
|
@@ -601,7 +604,7 @@ function V(a, e, { title: t, sub: s, teams: o }) {
|
|
|
601
604
|
${s ? i`<p class="sub">${s}</p>` : p}
|
|
602
605
|
</div>
|
|
603
606
|
${n ? i`
|
|
604
|
-
<nav class="sectionnav" aria-label="${
|
|
607
|
+
<nav class="sectionnav" aria-label="${T(e.sport)} section">
|
|
605
608
|
<div class="navrow">
|
|
606
609
|
<slot name="nav">
|
|
607
610
|
${ye(e.sport, o, e.hrefs).map((h) => i`<a href=${h.href}
|
|
@@ -615,14 +618,14 @@ function V(a, e, { title: t, sub: s, teams: o }) {
|
|
|
615
618
|
const I = (a, e) => {
|
|
616
619
|
const t = a.teamsById[e];
|
|
617
620
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
618
|
-
},
|
|
621
|
+
}, S = (a, e) => I(a, e)?.name || "TBD", _ = (a, e) => I(a, e)?.abbr || "TBD";
|
|
619
622
|
function C(a, e = 26) {
|
|
620
623
|
if (!a) return p;
|
|
621
|
-
const t =
|
|
624
|
+
const t = E(a, e);
|
|
622
625
|
if (t)
|
|
623
626
|
return i`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
624
627
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
625
|
-
const s = a.colorPrimary || "#030711", o =
|
|
628
|
+
const s = a.colorPrimary || "#030711", o = A(s);
|
|
626
629
|
return i`<span class="swatch" aria-hidden="true"
|
|
627
630
|
style="width:${e}px;height:${e}px;background:${s};color:${o};font-size:${Math.max(8, e * 0.28)}px"
|
|
628
631
|
>${j(a)}</span>`;
|
|
@@ -641,7 +644,7 @@ function K(a, e, t = 5) {
|
|
|
641
644
|
const o = s.results.slice(-1 * t);
|
|
642
645
|
return i`<span class="dots" role="img" aria-label="last ${o.length} results">
|
|
643
646
|
${o.map((r) => i`<a class="dot ${r.mark}"
|
|
644
|
-
title="${r.mark} ${r.my}-${r.their} vs ${
|
|
647
|
+
title="${r.mark} ${r.my}-${r.their} vs ${S(a, r.opp)}"
|
|
645
648
|
href=${u(a.hrefs.game, { sport: a.sport, id: r.gameId })}>${r.mark}</a>`)}
|
|
646
649
|
</span>`;
|
|
647
650
|
}
|
|
@@ -722,7 +725,7 @@ class Pe extends $ {
|
|
|
722
725
|
h.has(c) || h.set(c, []), h.get(c).push(l);
|
|
723
726
|
}), i`
|
|
724
727
|
${V(this, e, {
|
|
725
|
-
title: i`${
|
|
728
|
+
title: i`${T(this.sport)} scores & schedules`,
|
|
726
729
|
sub: i`${y(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${d.length} games`,
|
|
727
730
|
teams: this.data.teams
|
|
728
731
|
})}
|
|
@@ -767,7 +770,7 @@ class Pe extends $ {
|
|
|
767
770
|
<li>
|
|
768
771
|
${R(t)}
|
|
769
772
|
<span class="opp matchup">${o(t.awayTeamId, t.awayScore, i`<span class="at">at</span>`)}${o(t.homeTeamId, t.homeScore)}</span>
|
|
770
|
-
${r ? i`<span class="ff">${
|
|
773
|
+
${r ? i`<span class="ff">${S(e, r === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
771
774
|
<span class="where">${t.venue || ""}</span>
|
|
772
775
|
${t.broadcast ? i`<span class="pill class">${t.broadcast}</span>` : p}
|
|
773
776
|
<a class="box" href=${u(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
@@ -776,7 +779,7 @@ class Pe extends $ {
|
|
|
776
779
|
}
|
|
777
780
|
}
|
|
778
781
|
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Pe);
|
|
779
|
-
class
|
|
782
|
+
class Ae extends $ {
|
|
780
783
|
static styles = F;
|
|
781
784
|
static properties = {
|
|
782
785
|
...$.properties,
|
|
@@ -819,7 +822,7 @@ class Ee extends $ {
|
|
|
819
822
|
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((o) => o.classifications || []))].sort(X)].slice(0, 9), s = this.data.conferences.filter((o) => o.active !== !1).filter((o) => this.classFilter === "All" || (o.classifications || []).includes(this.classFilter)).sort(ge);
|
|
820
823
|
return i`
|
|
821
824
|
${V(this, e, {
|
|
822
|
-
title: i`${
|
|
825
|
+
title: i`${T(this.sport)} standings`,
|
|
823
826
|
sub: i`${this.data.season} season · every conference, computed live from reported results`,
|
|
824
827
|
teams: this.data.teams
|
|
825
828
|
})}
|
|
@@ -896,8 +899,8 @@ class Ee extends $ {
|
|
|
896
899
|
`;
|
|
897
900
|
}
|
|
898
901
|
}
|
|
899
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
900
|
-
const
|
|
902
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", Ae);
|
|
903
|
+
const Ee = b`
|
|
901
904
|
.hero1 {
|
|
902
905
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
903
906
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -915,7 +918,7 @@ const Ae = b`
|
|
|
915
918
|
.sparkline { vertical-align: middle; }
|
|
916
919
|
`;
|
|
917
920
|
class _e extends $ {
|
|
918
|
-
static styles = [...F,
|
|
921
|
+
static styles = [...F, Ee];
|
|
919
922
|
static properties = {
|
|
920
923
|
...$.properties,
|
|
921
924
|
sport: { type: String },
|
|
@@ -986,7 +989,7 @@ class _e extends $ {
|
|
|
986
989
|
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), o = t[s] || t[0], r = t[s + 1] || null, d = t.slice().reverse(), n = d.indexOf(o), h = v(this.data.conferences), l = (o.teamIds || [])[0], c = l ? I(e, l) : null;
|
|
987
990
|
return i`
|
|
988
991
|
${V(this, e, {
|
|
989
|
-
title: i`${
|
|
992
|
+
title: i`${T(this.sport)} Top 25`,
|
|
990
993
|
sub: i`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
991
994
|
teams: this.data.teams
|
|
992
995
|
})}
|
|
@@ -1183,11 +1186,11 @@ class Ne extends $ {
|
|
|
1183
1186
|
renderView() {
|
|
1184
1187
|
const { school: e, teams: t, active: s, season: o } = this.data;
|
|
1185
1188
|
if (!e) return i`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1186
|
-
const r = this.ctx, d =
|
|
1189
|
+
const r = this.ctx, d = A(e.colorPrimary || "#030711"), n = (e.adm || [])[0], h = v(this.data.conferences), l = s ? h[s.conferenceId] : null;
|
|
1187
1190
|
return i`
|
|
1188
1191
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${d}">
|
|
1189
1192
|
<div class="inner">
|
|
1190
|
-
${
|
|
1193
|
+
${E(e, 84) ? i`<img class="crest logo" alt="" loading="lazy" src=${E(e, 84)} />` : i`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${A(e.colorSecondary || "#7C7C7C")}">${j(e)}</div>`}
|
|
1191
1194
|
<div style="min-width:260px">
|
|
1192
1195
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1193
1196
|
<div class="facts">
|
|
@@ -1357,6 +1360,20 @@ const Me = b`
|
|
|
1357
1360
|
.covtitle { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
|
|
1358
1361
|
.covdesc { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--hsot-gray-5); line-height: 1.4; }
|
|
1359
1362
|
.covmeta { margin-top: 0.45rem; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1363
|
+
/* Scoring plays: a compact log under the line score. The play cell is the
|
|
1364
|
+
one table.data cell allowed to wrap — a 60-yard touchdown description
|
|
1365
|
+
must fit a phone. */
|
|
1366
|
+
.plays { border-top: 1px solid var(--hsot-gray-2); padding: 0.7rem 1rem 0.9rem; }
|
|
1367
|
+
.plays-title {
|
|
1368
|
+
font-family: var(--hsot-heading-font); font-weight: 700; font-size: 0.9rem;
|
|
1369
|
+
text-transform: uppercase; letter-spacing: 0.03em; color: var(--hsot-gray-6);
|
|
1370
|
+
text-align: center; margin: 0 0 0.4rem;
|
|
1371
|
+
}
|
|
1372
|
+
table.plays-table { max-width: 720px; margin: 0 auto; }
|
|
1373
|
+
table.plays-table td.when { color: var(--hsot-gray-5); font-variant-numeric: tabular-nums; }
|
|
1374
|
+
table.plays-table td.play { white-space: normal; min-width: 12rem; }
|
|
1375
|
+
/* Game notes are typed with line breaks the desk means to keep. */
|
|
1376
|
+
.gamenote { padding: 0 1rem 0.9rem; text-align: center; white-space: pre-line; }
|
|
1360
1377
|
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
|
1361
1378
|
.ctxcard { padding: 0.85rem 1rem; }
|
|
1362
1379
|
.ctxcard .who { font-family: var(--hsot-heading-font); font-weight: 700; margin-bottom: 0.4rem; }
|
|
@@ -1420,9 +1437,9 @@ class je extends $ {
|
|
|
1420
1437
|
${B(this, i`
|
|
1421
1438
|
${P(this)}
|
|
1422
1439
|
<p class="breadcrumbs">
|
|
1423
|
-
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${
|
|
1440
|
+
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${T(e.sport)}</a> /
|
|
1424
1441
|
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1425
|
-
${
|
|
1442
|
+
${S(t, e.awayTeamId)} at ${S(t, e.homeTeamId)}
|
|
1426
1443
|
</p>
|
|
1427
1444
|
<div class="card">
|
|
1428
1445
|
<div class="scorehead">
|
|
@@ -1445,7 +1462,8 @@ class je extends $ {
|
|
|
1445
1462
|
${this.teamBlock(t, e, e.homeTeamId, r, !0)}
|
|
1446
1463
|
</div>
|
|
1447
1464
|
${this.renderLineScore(e, o, r)}
|
|
1448
|
-
${
|
|
1465
|
+
${this.renderScoringPlays(e, o, r)}
|
|
1466
|
+
${e.notes ? i`<p class="note gamenote">${e.notes}</p>` : p}
|
|
1449
1467
|
</div>
|
|
1450
1468
|
${(this.data.coverage || []).length ? i`
|
|
1451
1469
|
<div class="section-title">Coverage</div>
|
|
@@ -1472,7 +1490,7 @@ class je extends $ {
|
|
|
1472
1490
|
<div class="card"><ul class="gamelist">
|
|
1473
1491
|
${l.map((c) => i`<li>
|
|
1474
1492
|
<span class="d">${y(c.date)}</span>${R(c)}
|
|
1475
|
-
<span class="opp">${
|
|
1493
|
+
<span class="opp">${S(t, c.awayTeamId)} ${c.awayScore}, ${S(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1476
1494
|
<a class="box" href=${u(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1477
1495
|
</li>`)}
|
|
1478
1496
|
</ul></div>` : p}
|
|
@@ -1481,10 +1499,10 @@ class je extends $ {
|
|
|
1481
1499
|
}
|
|
1482
1500
|
teamBlock(e, t, s, o, r) {
|
|
1483
1501
|
if (!o) return i`<div class="teamblock ${r ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1484
|
-
const d = e.teamsById[s], n = e.records[s], h =
|
|
1502
|
+
const d = e.teamsById[s], n = e.records[s], h = E(o, 58);
|
|
1485
1503
|
return i`
|
|
1486
1504
|
<div class="teamblock ${r ? "right" : ""}">
|
|
1487
|
-
${h ? i`<img class="crest logo" alt="" loading="lazy" src=${h} />` : i`<span class="crest" style="background:${o.colorPrimary || "#030711"};color:${
|
|
1505
|
+
${h ? i`<img class="crest logo" alt="" loading="lazy" src=${h} />` : i`<span class="crest" style="background:${o.colorPrimary || "#030711"};color:${A(o.colorPrimary || "#030711")}">${j(o)}</span>`}
|
|
1488
1506
|
<div>
|
|
1489
1507
|
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id: o.id })}>${o.name}</a></div>
|
|
1490
1508
|
<div class="trec">${o.mascot || ""} · ${w(n)}${d?.conferenceId ? i` · ${w(n, !0)} conf` : p}</div>
|
|
@@ -1517,6 +1535,32 @@ class je extends $ {
|
|
|
1517
1535
|
</div>
|
|
1518
1536
|
`;
|
|
1519
1537
|
}
|
|
1538
|
+
renderScoringPlays(e, t, s) {
|
|
1539
|
+
const o = Array.isArray(e.scoringPlays) ? e.scoringPlays : [];
|
|
1540
|
+
if (!o.length) return p;
|
|
1541
|
+
const r = (d) => [d.period, d.clock].filter(Boolean).join(" ");
|
|
1542
|
+
return i`
|
|
1543
|
+
<div class="plays">
|
|
1544
|
+
<div class="plays-title">Scoring plays</div>
|
|
1545
|
+
<div class="tablewrap">
|
|
1546
|
+
<table class="data plays-table">
|
|
1547
|
+
<thead><tr>
|
|
1548
|
+
<th>When</th><th>Play</th>
|
|
1549
|
+
<th class="num">${t?.abbr || "Away"}</th><th class="num">${s?.abbr || "Home"}</th>
|
|
1550
|
+
</tr></thead>
|
|
1551
|
+
<tbody>
|
|
1552
|
+
${o.map((d) => i`<tr>
|
|
1553
|
+
<td class="when">${r(d) || "·"}</td>
|
|
1554
|
+
<td class="play">${d.description || "·"}</td>
|
|
1555
|
+
<td class="num">${d.awayScore}</td>
|
|
1556
|
+
<td class="num">${d.homeScore}</td>
|
|
1557
|
+
</tr>`)}
|
|
1558
|
+
</tbody>
|
|
1559
|
+
</table>
|
|
1560
|
+
</div>
|
|
1561
|
+
</div>
|
|
1562
|
+
`;
|
|
1563
|
+
}
|
|
1520
1564
|
renderContext(e, t, s) {
|
|
1521
1565
|
if (!s) return p;
|
|
1522
1566
|
const o = e.records[t], r = q(this.data.games, t);
|
|
@@ -1721,7 +1765,7 @@ export {
|
|
|
1721
1765
|
Ne as b,
|
|
1722
1766
|
We as c,
|
|
1723
1767
|
Pe as d,
|
|
1724
|
-
|
|
1768
|
+
Ae as e,
|
|
1725
1769
|
z as f,
|
|
1726
1770
|
he as g,
|
|
1727
1771
|
u as h,
|
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-CtMiZfDB.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.14",
|
|
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",
|