@wral/hsot-data 0.1.2 → 0.1.3
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/dist/define.mjs +1 -1
- package/dist/define.standalone.js +322 -282
- package/dist/{hsot-boxscore-DiJN2Ik6.js → hsot-boxscore-CY8jCxLh.js} +209 -169
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement as Z, html as l, css as
|
|
1
|
+
import { LitElement as Z, html as l, css as $, nothing as p, svg as q } from "lit";
|
|
2
2
|
const ee = 50;
|
|
3
3
|
function te(a = {}) {
|
|
4
4
|
const e = Object.entries(a).filter(([, s]) => s != null && s !== "");
|
|
@@ -12,21 +12,21 @@ function se({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
|
12
12
|
async function o(i) {
|
|
13
13
|
const m = { Accept: "application/json" };
|
|
14
14
|
e && (m.Authorization = `Bearer ${e}`);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const c = new Error(`api-hsot ${
|
|
18
|
-
throw c.status =
|
|
15
|
+
const d = await r(`${s}${i}`, { headers: m });
|
|
16
|
+
if (!d.ok) {
|
|
17
|
+
const c = new Error(`api-hsot ${d.status} on ${i}`);
|
|
18
|
+
throw c.status = d.status, c;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return d.json();
|
|
21
21
|
}
|
|
22
22
|
async function n(i, m = {}) {
|
|
23
|
-
const
|
|
23
|
+
const d = [];
|
|
24
24
|
let c = null;
|
|
25
|
-
for (let
|
|
25
|
+
for (let h = 0; h < ee; h += 1) {
|
|
26
26
|
const f = te(c ? { ...m, cursor: c } : m), u = await o(`${i}${f}`);
|
|
27
|
-
if (
|
|
27
|
+
if (d.push(...u.items || []), c = u.nextCursor || null, !c) break;
|
|
28
28
|
}
|
|
29
|
-
return { items:
|
|
29
|
+
return { items: d, total: d.length, nextCursor: null };
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
listSchools: (i) => n("/schools", i),
|
|
@@ -44,7 +44,7 @@ function se({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
|
44
44
|
listSports: () => o("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
class
|
|
47
|
+
class y extends Z {
|
|
48
48
|
static properties = {
|
|
49
49
|
api: { type: String },
|
|
50
50
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -107,7 +107,7 @@ class b extends Z {
|
|
|
107
107
|
return l``;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae =
|
|
110
|
+
const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = $`
|
|
111
111
|
:host {
|
|
112
112
|
--hsot-red: var(--color-red, #D1232A);
|
|
113
113
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -141,7 +141,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
|
|
|
141
141
|
outline-offset: 1px;
|
|
142
142
|
}
|
|
143
143
|
.mut { color: var(--hsot-gray-5); }
|
|
144
|
-
`, re =
|
|
144
|
+
`, re = $`
|
|
145
145
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
146
146
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
147
147
|
.band h1, .band h2.bandtitle {
|
|
@@ -161,7 +161,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
|
|
|
161
161
|
.band nav.tabs a.on { border-bottom-color: var(--hsot-red); }
|
|
162
162
|
.band nav.tabs span.off { color: var(--hsot-gray-4); cursor: not-allowed; }
|
|
163
163
|
@media (max-width: 720px) { .band h1, .band h2.bandtitle { font-size: 1.8rem; } }
|
|
164
|
-
`, oe =
|
|
164
|
+
`, oe = $`
|
|
165
165
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
166
166
|
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0 0 1.1rem; }
|
|
167
167
|
.toolbar .spacer { flex: 1; }
|
|
@@ -204,7 +204,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
|
|
|
204
204
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
205
205
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
206
206
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
207
|
-
`,
|
|
207
|
+
`, ie = $`
|
|
208
208
|
.pill {
|
|
209
209
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
210
210
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -219,7 +219,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
|
|
|
219
219
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
220
220
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
221
221
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
222
|
-
`,
|
|
222
|
+
`, ne = $`
|
|
223
223
|
.tablewrap { overflow-x: auto; }
|
|
224
224
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
225
225
|
table.data th {
|
|
@@ -237,7 +237,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
|
|
|
237
237
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
238
238
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
239
239
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
240
|
-
`, le =
|
|
240
|
+
`, le = $`
|
|
241
241
|
.swatch {
|
|
242
242
|
display: inline-flex; align-items: center; justify-content: center;
|
|
243
243
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -261,7 +261,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
|
|
|
261
261
|
.dot.W { background: var(--hsot-win); }
|
|
262
262
|
.dot.L { background: var(--hsot-loss); }
|
|
263
263
|
.dot.T { background: var(--hsot-tie); }
|
|
264
|
-
`, ce =
|
|
264
|
+
`, ce = $`
|
|
265
265
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
266
266
|
.gamelist li {
|
|
267
267
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -278,7 +278,7 @@ const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ae = y`
|
|
|
278
278
|
.gamelist .opp a:hover { text-decoration: underline; }
|
|
279
279
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
280
280
|
.gamelist a.box { font-size: 0.78rem; }
|
|
281
|
-
`, S = [ae, re, oe,
|
|
281
|
+
`, S = [ae, re, oe, ie, ne, le, ce];
|
|
282
282
|
function H(a) {
|
|
283
283
|
return a.state !== "final" ? null : a.forfeit && a.forfeit !== "none" ? a.forfeit : a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
|
|
284
284
|
}
|
|
@@ -287,12 +287,12 @@ function D(a, e) {
|
|
|
287
287
|
for (const o of r) {
|
|
288
288
|
const n = H(o), i = o.gameType === "conference";
|
|
289
289
|
for (const m of ["home", "away"]) {
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
292
|
-
const c = s(
|
|
293
|
-
c.pf +=
|
|
290
|
+
const d = m === "home" ? o.homeTeamId : o.awayTeamId;
|
|
291
|
+
if (!d) continue;
|
|
292
|
+
const c = s(d), h = m === "home" ? o.homeScore : o.awayScore, f = m === "home" ? o.awayScore : o.homeScore;
|
|
293
|
+
c.pf += h, c.pa += f;
|
|
294
294
|
let u = "T";
|
|
295
|
-
n === "tie" ? (c.t += 1, i && (c.ct += 1)) : n === m ? (c.w += 1, i && (c.cw += 1), u = "W") : (c.l += 1, i && (c.cl += 1), u = "L"), c.results.push({ gameId: o.id, date: o.date, mark: u, my:
|
|
295
|
+
n === "tie" ? (c.t += 1, i && (c.ct += 1)) : n === m ? (c.w += 1, i && (c.cw += 1), u = "W") : (c.l += 1, i && (c.cl += 1), u = "L"), c.results.push({ gameId: o.id, date: o.date, mark: u, my: h, their: f, opp: m === "home" ? o.awayTeamId : o.homeTeamId, conf: i });
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
return t;
|
|
@@ -304,7 +304,7 @@ function _(a) {
|
|
|
304
304
|
for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
|
|
305
305
|
return e + t;
|
|
306
306
|
}
|
|
307
|
-
const
|
|
307
|
+
const V = (a, e, t) => {
|
|
308
308
|
const s = a + e + t;
|
|
309
309
|
return s ? (a + t / 2) / s : 0;
|
|
310
310
|
}, Y = (a) => a.toFixed(3).replace("0.", ".");
|
|
@@ -313,16 +313,16 @@ function w(a, e = !1) {
|
|
|
313
313
|
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
314
314
|
return `${t}-${s}${r ? `-${r}` : ""}`;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function K(a, e) {
|
|
317
317
|
return a.map((t) => {
|
|
318
318
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
319
|
-
return { team: t, rec: s, confPct:
|
|
319
|
+
return { team: t, rec: s, confPct: V(s.cw, s.cl, s.ct), overallPct: V(s.w, s.l, s.t) };
|
|
320
320
|
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
321
321
|
}
|
|
322
322
|
function M(a, e) {
|
|
323
323
|
return a.filter((t) => (t.homeTeamId === e || t.awayTeamId === e) && (t.state === "scheduled" || t.state === "live") && t.gameType !== "scrimmage").sort((t, s) => String(t.date).localeCompare(String(s.date)))[0] || null;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function Q(a, e) {
|
|
326
326
|
const t = a[e];
|
|
327
327
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
328
328
|
}
|
|
@@ -342,12 +342,12 @@ function C(a) {
|
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
344
|
const R = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
345
|
-
function
|
|
345
|
+
function b(a, e) {
|
|
346
346
|
if (!a) return "TBD";
|
|
347
347
|
const [t, s, r] = String(a).split("-").map(Number);
|
|
348
348
|
return !t || !s || !r ? "TBD" : new Date(t, s - 1, r).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function E(a) {
|
|
351
351
|
if (!a) return "";
|
|
352
352
|
const [e, t] = String(a).split(":").map(Number);
|
|
353
353
|
if (Number.isNaN(e)) return "";
|
|
@@ -357,7 +357,7 @@ function A(a) {
|
|
|
357
357
|
function de(a) {
|
|
358
358
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function A(a = /* @__PURE__ */ new Date()) {
|
|
361
361
|
const e = a.getFullYear();
|
|
362
362
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
363
363
|
}
|
|
@@ -365,7 +365,7 @@ function O(a = /* @__PURE__ */ new Date()) {
|
|
|
365
365
|
const e = (t) => String(t).padStart(2, "0");
|
|
366
366
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function j(a) {
|
|
369
369
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
370
370
|
}
|
|
371
371
|
function F(a) {
|
|
@@ -383,9 +383,9 @@ function me(a) {
|
|
|
383
383
|
const e = [];
|
|
384
384
|
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(" · ")}` : ""}` };
|
|
385
385
|
}
|
|
386
|
-
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${
|
|
386
|
+
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${b(a.date, { month: "short", day: "numeric" })} · ${E(a.time)}`.replace(/ · $/, "") };
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Ce(a, e, t, s = "") {
|
|
389
389
|
let r = null;
|
|
390
390
|
for (const o of a || [])
|
|
391
391
|
o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
|
|
@@ -397,13 +397,13 @@ function X(a, e, t, s, r) {
|
|
|
397
397
|
const n = /* @__PURE__ */ new Map();
|
|
398
398
|
for (const m of a || []) {
|
|
399
399
|
if (m.sport !== s || r && m.effectiveDate > r || m.gender && o.gender !== m.gender && o.gender !== "coed") continue;
|
|
400
|
-
const
|
|
401
|
-
(!c || m.effectiveDate > c.effectiveDate) && n.set(
|
|
400
|
+
const d = m.gender || "", c = n.get(d);
|
|
401
|
+
(!c || m.effectiveDate > c.effectiveDate) && n.set(d, m);
|
|
402
402
|
}
|
|
403
403
|
let i = null;
|
|
404
404
|
for (const m of n.values()) {
|
|
405
|
-
const
|
|
406
|
-
|
|
405
|
+
const d = (m.teamIds || []).indexOf(t);
|
|
406
|
+
d !== -1 && (!i || m.effectiveDate > i.effectiveDate) && (i = { poll: m, rank: d + 1 });
|
|
407
407
|
}
|
|
408
408
|
return i ? i.rank : null;
|
|
409
409
|
}
|
|
@@ -420,7 +420,7 @@ function pe(a, e, t) {
|
|
|
420
420
|
function fe(a) {
|
|
421
421
|
return /^https?:\/\//i.test(String(a || ""));
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function P(a, e) {
|
|
424
424
|
const t = a?.logoAssetId;
|
|
425
425
|
if (!fe(t)) return "";
|
|
426
426
|
const s = Math.max(1, Math.round(e * 2)), r = t.includes("?") ? "&" : "?";
|
|
@@ -429,25 +429,25 @@ function B(a, e) {
|
|
|
429
429
|
const T = (a, e) => {
|
|
430
430
|
const t = a.teamsById[e];
|
|
431
431
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
432
|
-
}, k = (a, e) => T(a, e)?.name || "TBD",
|
|
432
|
+
}, k = (a, e) => T(a, e)?.name || "TBD", z = (a, e) => T(a, e)?.abbr || "TBD";
|
|
433
433
|
function I(a, e = 26) {
|
|
434
434
|
if (!a) return p;
|
|
435
|
-
const t =
|
|
435
|
+
const t = P(a, e);
|
|
436
436
|
if (t)
|
|
437
437
|
return l`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
438
438
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
439
439
|
const s = a.colorPrimary || "#030711", r = F(s);
|
|
440
440
|
return l`<span class="swatch" aria-hidden="true"
|
|
441
441
|
style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
|
|
442
|
-
>${
|
|
442
|
+
>${j(a)}</span>`;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function G(a, e, t) {
|
|
445
445
|
const s = X(a.rankings, a.teamsById, e, a.sport, t);
|
|
446
446
|
return s ? l`<span class="rankbadge">#${s}</span>` : p;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function U(a, e, t) {
|
|
449
449
|
const s = T(a, e);
|
|
450
|
-
return s ? l`${
|
|
450
|
+
return s ? l`${G(a, e, t)}<a href=${v(a.hrefs.school, { id: s.id })}>${s.name}</a>` : l`<span class="mut">TBD</span>`;
|
|
451
451
|
}
|
|
452
452
|
function W(a, e, t = 5) {
|
|
453
453
|
const s = a.records[e];
|
|
@@ -459,19 +459,19 @@ function W(a, e, t = 5) {
|
|
|
459
459
|
href=${v(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
460
460
|
</span>`;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function B(a) {
|
|
463
463
|
const e = me(a);
|
|
464
464
|
return l`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
465
465
|
}
|
|
466
466
|
function J(a, e, t) {
|
|
467
467
|
if (!e) return l`<span class="mut">·</span>`;
|
|
468
468
|
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
469
|
-
return l`${e.state === "live" ? l`<span class="pill live">Live</span> ` : l`${
|
|
469
|
+
return l`${e.state === "live" ? l`<span class="pill live">Live</span> ` : l`${b(e.date, { month: "numeric", day: "numeric" })} `}${r} ${z(a, s)}`;
|
|
470
470
|
}
|
|
471
|
-
class ue extends
|
|
471
|
+
class ue extends y {
|
|
472
472
|
static styles = S;
|
|
473
473
|
static properties = {
|
|
474
|
-
...
|
|
474
|
+
...y.properties,
|
|
475
475
|
sport: { type: String },
|
|
476
476
|
season: { type: String },
|
|
477
477
|
date: { type: String }
|
|
@@ -486,7 +486,7 @@ class ue extends b {
|
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
async fetchData(e) {
|
|
489
|
-
const t = this.season ||
|
|
489
|
+
const t = this.season || A(), [s, r, o, n, i] = await Promise.all([
|
|
490
490
|
e.listSchools(),
|
|
491
491
|
e.listTeams({ sport: this.sport }),
|
|
492
492
|
e.listConferences(),
|
|
@@ -521,7 +521,7 @@ class ue extends b {
|
|
|
521
521
|
<div class="band">
|
|
522
522
|
<div class="inner">
|
|
523
523
|
<h1>${R(this.sport)} scores & schedules</h1>
|
|
524
|
-
<p class="sub">${
|
|
524
|
+
<p class="sub">${b(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${r.length} games</p>
|
|
525
525
|
</div>
|
|
526
526
|
</div>
|
|
527
527
|
<div class="view">
|
|
@@ -531,7 +531,7 @@ class ue extends b {
|
|
|
531
531
|
this.date = n.target.value;
|
|
532
532
|
}}>
|
|
533
533
|
${s.map((n) => l`<option value=${n} ?selected=${n === this.date}>
|
|
534
|
-
${
|
|
534
|
+
${b(n, { weekday: "short", month: "short", day: "numeric" })}${n === O() ? " · today" : ""}
|
|
535
535
|
</option>`)}
|
|
536
536
|
</select>
|
|
537
537
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -556,11 +556,11 @@ class ue extends b {
|
|
|
556
556
|
`;
|
|
557
557
|
}
|
|
558
558
|
renderGame(e, t) {
|
|
559
|
-
const s = t.state === "final" || t.state === "live" ? `${t.awayScore}-${t.homeScore}` :
|
|
559
|
+
const s = t.state === "final" || t.state === "live" ? `${t.awayScore}-${t.homeScore}` : E(t.time);
|
|
560
560
|
return l`
|
|
561
561
|
<li>
|
|
562
|
-
${
|
|
563
|
-
<span class="opp">${
|
|
562
|
+
${B(t)}
|
|
563
|
+
<span class="opp">${U(e, t.awayTeamId, t.date)} at ${U(e, t.homeTeamId, t.date)}</span>
|
|
564
564
|
<span class="res" style="width:auto">${s}</span>
|
|
565
565
|
<span class="where">${t.venue || ""}</span>
|
|
566
566
|
${t.broadcast ? l`<span class="pill class">${t.broadcast}</span>` : p}
|
|
@@ -570,10 +570,10 @@ class ue extends b {
|
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", ue);
|
|
573
|
-
class ge extends
|
|
573
|
+
class ge extends y {
|
|
574
574
|
static styles = S;
|
|
575
575
|
static properties = {
|
|
576
|
-
...
|
|
576
|
+
...y.properties,
|
|
577
577
|
sport: { type: String },
|
|
578
578
|
season: { type: String },
|
|
579
579
|
classFilter: { state: !0 },
|
|
@@ -583,7 +583,7 @@ class ge extends b {
|
|
|
583
583
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
584
584
|
}
|
|
585
585
|
async fetchData(e) {
|
|
586
|
-
const t = this.season ||
|
|
586
|
+
const t = this.season || A(), [s, r, o, n, i] = await Promise.all([
|
|
587
587
|
e.listConferences({ active: !0 }),
|
|
588
588
|
e.listSchools(),
|
|
589
589
|
e.listTeams({ sport: this.sport }),
|
|
@@ -631,7 +631,7 @@ class ge extends b {
|
|
|
631
631
|
this.query = r.target.value;
|
|
632
632
|
}}>
|
|
633
633
|
<span class="spacer"></span>
|
|
634
|
-
<span class="asof">Records through ${
|
|
634
|
+
<span class="asof">Records through ${b(O(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
635
635
|
</div>
|
|
636
636
|
${s.map((r) => this.renderConference(e, r))}
|
|
637
637
|
</div>
|
|
@@ -640,7 +640,7 @@ class ge extends b {
|
|
|
640
640
|
renderConference(e, t) {
|
|
641
641
|
const s = this.data.teams.filter((n) => n.conferenceId === t.id);
|
|
642
642
|
if (!s.length) return p;
|
|
643
|
-
const r = this.query.trim().toLowerCase(), o =
|
|
643
|
+
const r = this.query.trim().toLowerCase(), o = K(s, e.records);
|
|
644
644
|
return l`
|
|
645
645
|
<div class="card">
|
|
646
646
|
<div class="card-head">
|
|
@@ -664,18 +664,18 @@ class ge extends b {
|
|
|
664
664
|
renderRow(e, t, s, r) {
|
|
665
665
|
const o = e.schoolsById[t.team.schoolId], n = o?.name || t.team.name || "TBD";
|
|
666
666
|
if (r && !n.toLowerCase().includes(r)) return p;
|
|
667
|
-
const i = t.rec.pf - t.rec.pa, m = M(this.data.games, t.team.id),
|
|
668
|
-
<span class="pill champ" title="${
|
|
667
|
+
const i = t.rec.pf - t.rec.pa, m = M(this.data.games, t.team.id), d = (t.team.championships || []).map((h) => l`
|
|
668
|
+
<span class="pill champ" title="${h.season} ${h.title} champion">★ ${h.season} ${h.title}</span>`), c = () => {
|
|
669
669
|
location.href = v(e.hrefs.school, { id: t.team.schoolId });
|
|
670
670
|
};
|
|
671
671
|
return l`
|
|
672
|
-
<tr class="rowlink" @click=${(
|
|
673
|
-
|
|
672
|
+
<tr class="rowlink" @click=${(h) => {
|
|
673
|
+
h.target.closest("a") || c();
|
|
674
674
|
}}>
|
|
675
675
|
<td class="mut">${s + 1}</td>
|
|
676
676
|
<td class="teamcell">
|
|
677
|
-
${I(o)}${
|
|
678
|
-
<a href=${v(e.hrefs.school, { id: t.team.schoolId })}>${n}</a> ${
|
|
677
|
+
${I(o)}${G(e, t.team.id, null)}
|
|
678
|
+
<a href=${v(e.hrefs.school, { id: t.team.schoolId })}>${n}</a> ${d}
|
|
679
679
|
</td>
|
|
680
680
|
<td class="num">${w(t.rec, !0)}</td>
|
|
681
681
|
<td class="num">${Y(t.confPct)}</td>
|
|
@@ -692,7 +692,7 @@ class ge extends b {
|
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
694
|
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ge);
|
|
695
|
-
const ve =
|
|
695
|
+
const ve = $`
|
|
696
696
|
.hero1 {
|
|
697
697
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
698
698
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -709,10 +709,10 @@ const ve = y`
|
|
|
709
709
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
710
710
|
.sparkline { vertical-align: middle; }
|
|
711
711
|
`;
|
|
712
|
-
class
|
|
712
|
+
class be extends y {
|
|
713
713
|
static styles = [...S, ve];
|
|
714
714
|
static properties = {
|
|
715
|
-
...
|
|
715
|
+
...y.properties,
|
|
716
716
|
sport: { type: String },
|
|
717
717
|
gender: { type: String },
|
|
718
718
|
season: { type: String },
|
|
@@ -727,13 +727,13 @@ class $e extends b {
|
|
|
727
727
|
e && (this.pollDate = e);
|
|
728
728
|
}
|
|
729
729
|
async fetchData(e) {
|
|
730
|
-
const t = this.season ||
|
|
730
|
+
const t = this.season || A(), [s, r, o, n, i] = await Promise.all([
|
|
731
731
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
732
732
|
e.listSchools(),
|
|
733
733
|
e.listTeams({ sport: this.sport }),
|
|
734
734
|
e.listConferences(),
|
|
735
735
|
e.listGames({ sport: this.sport, season: t })
|
|
736
|
-
]), m = s.items.filter((
|
|
736
|
+
]), m = s.items.filter((d) => !this.gender || !d.gender || d.gender === this.gender).sort((d, c) => c.effectiveDate.localeCompare(d.effectiveDate));
|
|
737
737
|
return {
|
|
738
738
|
season: t,
|
|
739
739
|
polls: m,
|
|
@@ -754,21 +754,21 @@ class $e extends b {
|
|
|
754
754
|
}, this._ctxData = this.data), this._ctx;
|
|
755
755
|
}
|
|
756
756
|
sparkline(e, t, s) {
|
|
757
|
-
const i = t.map((
|
|
758
|
-
const u = (
|
|
757
|
+
const i = t.map((h, f) => {
|
|
758
|
+
const u = (h.teamIds || []).indexOf(e);
|
|
759
759
|
if (u === -1) return null;
|
|
760
760
|
const x = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, L = 3 + u / 24 * 20;
|
|
761
761
|
return { x, y: L };
|
|
762
762
|
}), m = [];
|
|
763
|
-
let
|
|
764
|
-
if (i.forEach((
|
|
765
|
-
|
|
766
|
-
}),
|
|
763
|
+
let d = [];
|
|
764
|
+
if (i.forEach((h) => {
|
|
765
|
+
h ? d.push(h) : d.length && (m.push(d), d = []);
|
|
766
|
+
}), d.length && m.push(d), !m.length) return p;
|
|
767
767
|
const c = i[s];
|
|
768
768
|
return l`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
769
|
-
${m.map((
|
|
770
|
-
points=${
|
|
771
|
-
${c ?
|
|
769
|
+
${m.map((h) => q`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
770
|
+
points=${h.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
771
|
+
${c ? q`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
772
772
|
</svg>`;
|
|
773
773
|
}
|
|
774
774
|
movement(e, t, s) {
|
|
@@ -778,7 +778,7 @@ class $e extends b {
|
|
|
778
778
|
renderView() {
|
|
779
779
|
const e = this.ctx, t = this.data.polls;
|
|
780
780
|
if (!t.length) return l`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
781
|
-
const s = Math.max(0, t.findIndex((
|
|
781
|
+
const s = Math.max(0, t.findIndex((h) => h.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, n = t.slice().reverse(), i = n.indexOf(r), m = g(this.data.conferences), d = (r.teamIds || [])[0], c = d ? T(e, d) : null;
|
|
782
782
|
return l`
|
|
783
783
|
<div class="band">
|
|
784
784
|
<div class="inner">
|
|
@@ -789,11 +789,11 @@ class $e extends b {
|
|
|
789
789
|
<div class="view">
|
|
790
790
|
<div class="toolbar">
|
|
791
791
|
<label class="asof" for="pollsel">Poll of</label>
|
|
792
|
-
<select id="pollsel" @change=${(
|
|
793
|
-
this.pollDate =
|
|
792
|
+
<select id="pollsel" @change=${(h) => {
|
|
793
|
+
this.pollDate = h.target.value;
|
|
794
794
|
}}>
|
|
795
|
-
${t.map((
|
|
796
|
-
${
|
|
795
|
+
${t.map((h, f) => l`<option value=${h.effectiveDate} ?selected=${h === r}>
|
|
796
|
+
${b(h.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
797
797
|
</option>`)}
|
|
798
798
|
</select>
|
|
799
799
|
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
@@ -807,14 +807,14 @@ class $e extends b {
|
|
|
807
807
|
<span class="spacer"></span>
|
|
808
808
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
809
809
|
</div>
|
|
810
|
-
${c ? this.renderHero(e, r, o,
|
|
810
|
+
${c ? this.renderHero(e, r, o, d, c, m) : p}
|
|
811
811
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
812
812
|
<thead><tr>
|
|
813
813
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
814
814
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
815
815
|
</tr></thead>
|
|
816
816
|
<tbody>
|
|
817
|
-
${(r.teamIds || []).map((
|
|
817
|
+
${(r.teamIds || []).map((h, f) => f === 0 || !h ? p : this.renderRow(e, r, o, n, i, m, h, f + 1))}
|
|
818
818
|
</tbody>
|
|
819
819
|
</table></div></div>
|
|
820
820
|
<p class="note">Ranks elsewhere on the site resolve the poll in effect on the game date, so past box scores keep the ranks they were played under.</p>
|
|
@@ -822,7 +822,7 @@ class $e extends b {
|
|
|
822
822
|
`;
|
|
823
823
|
}
|
|
824
824
|
renderHero(e, t, s, r, o, n) {
|
|
825
|
-
const i = e.records[r], m =
|
|
825
|
+
const i = e.records[r], m = Q(e.records, r), d = n[e.teamsById[r]?.conferenceId], c = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
826
826
|
return l`
|
|
827
827
|
<div class="hero1" style="background:${c}">
|
|
828
828
|
<div class="bigrank">#1</div>
|
|
@@ -830,9 +830,9 @@ class $e extends b {
|
|
|
830
830
|
<div>
|
|
831
831
|
<h2><a href=${v(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
832
832
|
<div class="facts">
|
|
833
|
-
${w(i)} overall${
|
|
833
|
+
${w(i)} overall${d ? l` · ${w(i, !0)} ${d.name}` : p}
|
|
834
834
|
· streak ${_(i?.results) || "·"}
|
|
835
|
-
${m ? l` · last: ${m.mark} ${m.my}-${m.their} vs ${
|
|
835
|
+
${m ? l` · last: ${m.mark} ${m.my}-${m.their} vs ${z(e, m.opp)}` : p}
|
|
836
836
|
${this.movement(t, s, r)}
|
|
837
837
|
</div>
|
|
838
838
|
</div>
|
|
@@ -840,10 +840,10 @@ class $e extends b {
|
|
|
840
840
|
`;
|
|
841
841
|
}
|
|
842
842
|
renderRow(e, t, s, r, o, n, i, m) {
|
|
843
|
-
const
|
|
844
|
-
if (!
|
|
845
|
-
const c = e.records[i],
|
|
846
|
-
location.href = v(e.hrefs.school, { id:
|
|
843
|
+
const d = T(e, i);
|
|
844
|
+
if (!d) return p;
|
|
845
|
+
const c = e.records[i], h = Q(e.records, i), f = M(this.data.games, i), u = n[e.teamsById[i]?.conferenceId], x = () => {
|
|
846
|
+
location.href = v(e.hrefs.school, { id: d.id });
|
|
847
847
|
};
|
|
848
848
|
return l`
|
|
849
849
|
<tr class="rowlink" @click=${(L) => {
|
|
@@ -851,21 +851,21 @@ class $e extends b {
|
|
|
851
851
|
}}>
|
|
852
852
|
<td class="num" style="font-weight:700">${m}</td>
|
|
853
853
|
<td>${this.movement(t, s, i)}</td>
|
|
854
|
-
<td class="teamcell">${I(
|
|
855
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
854
|
+
<td class="teamcell">${I(d)}<a href=${v(e.hrefs.school, { id: d.id })}>${d.name}</a>
|
|
855
|
+
<span class="mut" style="font-size:0.78rem">${d.mascot || ""}</span></td>
|
|
856
856
|
<td class="num">${w(c)}</td>
|
|
857
857
|
<td class="mut">${u?.name || "Independent"}</td>
|
|
858
|
-
<td>${
|
|
859
|
-
<b style="color:${
|
|
860
|
-
${
|
|
858
|
+
<td>${h ? l`<a class="box" style="text-decoration:none" href=${v(e.hrefs.game, { sport: this.sport, id: h.gameId })}>
|
|
859
|
+
<b style="color:${h.mark === "W" ? "var(--hsot-win)" : h.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${h.mark}</b>
|
|
860
|
+
${h.my}-${h.their} vs ${z(e, h.opp)}</a>` : l`<span class="mut">·</span>`}</td>
|
|
861
861
|
<td>${J(e, f, i)}</td>
|
|
862
862
|
<td>${this.sparkline(i, r, o)}</td>
|
|
863
863
|
</tr>
|
|
864
864
|
`;
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
868
|
-
const
|
|
867
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", be);
|
|
868
|
+
const ye = $`
|
|
869
869
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
870
870
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
871
871
|
.schoolhero .crest {
|
|
@@ -890,10 +890,10 @@ const be = y`
|
|
|
890
890
|
.cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
|
|
891
891
|
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .schoolhero h1 { font-size: 1.9rem; } }
|
|
892
892
|
`;
|
|
893
|
-
class
|
|
894
|
-
static styles = [...S,
|
|
893
|
+
class $e extends y {
|
|
894
|
+
static styles = [...S, ye];
|
|
895
895
|
static properties = {
|
|
896
|
-
...
|
|
896
|
+
...y.properties,
|
|
897
897
|
schoolId: { type: String, attribute: "school-id" },
|
|
898
898
|
sport: { type: String },
|
|
899
899
|
season: { type: String },
|
|
@@ -908,7 +908,7 @@ class ye extends b {
|
|
|
908
908
|
e && !this.sport && (this.sport = e);
|
|
909
909
|
}
|
|
910
910
|
async fetchData(e) {
|
|
911
|
-
const t = this.season ||
|
|
911
|
+
const t = this.season || A(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, n = o.find((x) => x.sport === (this.sport || "football")) || o[0] || null, [i, m, d, c, h, f, u] = await Promise.all([
|
|
912
912
|
n ? e.listGames({ sport: n.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
913
913
|
n ? e.listTeams({ sport: n.sport }) : Promise.resolve({ items: [] }),
|
|
914
914
|
e.listSchools(),
|
|
@@ -926,9 +926,9 @@ class ye extends b {
|
|
|
926
926
|
active: n,
|
|
927
927
|
games: i.items,
|
|
928
928
|
allTeams: m.items,
|
|
929
|
-
schools:
|
|
929
|
+
schools: d.items,
|
|
930
930
|
conferences: c.items,
|
|
931
|
-
rankings:
|
|
931
|
+
rankings: h.items,
|
|
932
932
|
roster: f.items.find((x) => x.season === t) || null,
|
|
933
933
|
players: u.items
|
|
934
934
|
};
|
|
@@ -949,17 +949,17 @@ class ye extends b {
|
|
|
949
949
|
renderView() {
|
|
950
950
|
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
951
951
|
if (!e) return l`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
952
|
-
const o = this.ctx, n = F(e.colorPrimary || "#030711"), i = (e.adm || [])[0], m = g(this.data.conferences),
|
|
952
|
+
const o = this.ctx, n = F(e.colorPrimary || "#030711"), i = (e.adm || [])[0], m = g(this.data.conferences), d = s ? m[s.conferenceId] : null;
|
|
953
953
|
return l`
|
|
954
954
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${n}">
|
|
955
955
|
<div class="inner">
|
|
956
|
-
${
|
|
956
|
+
${P(e, 84) ? l`<img class="crest logo" alt="" loading="lazy" src=${P(e, 84)} />` : l`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${F(e.colorSecondary || "#7C7C7C")}">${j(e)}</div>`}
|
|
957
957
|
<div style="min-width:260px">
|
|
958
958
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
959
959
|
<div class="facts">
|
|
960
960
|
${e.location ? l`<span><b>Location</b>${e.location}${e.county ? l` · ${e.county} County` : p}</span>` : p}
|
|
961
961
|
${e.association ? l`<span><b>League</b>${e.association}${e.classification ? l` · ${e.classification}` : p}</span>` : p}
|
|
962
|
-
${
|
|
962
|
+
${d ? l`<span><b>Conference</b>${d.name}</span>` : p}
|
|
963
963
|
${i ? l`<span><b>Enrollment</b>${i.value.toLocaleString()} (${i.season} ADM)</span>` : p}
|
|
964
964
|
${e.openingYear ? l`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
965
965
|
${e.areaCode ? l`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
@@ -970,18 +970,18 @@ class ye extends b {
|
|
|
970
970
|
</div>
|
|
971
971
|
<div class="band">
|
|
972
972
|
<nav class="tabs" aria-label="Teams">
|
|
973
|
-
${t.map((c) => c.id === s?.id ? l`<a class="on" href="#" @click=${(
|
|
974
|
-
|
|
973
|
+
${t.map((c) => c.id === s?.id ? l`<a class="on" href="#" @click=${(h) => h.preventDefault()}>${c.name}</a>` : l`<a href="#" @click=${(h) => {
|
|
974
|
+
h.preventDefault(), this.switchSport(c.sport);
|
|
975
975
|
}}>${c.name}</a>`)}
|
|
976
976
|
</nav>
|
|
977
977
|
</div>
|
|
978
978
|
<div class="view">
|
|
979
|
-
${s ? this.renderTeam(o, s,
|
|
979
|
+
${s ? this.renderTeam(o, s, d, r) : l`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
980
980
|
</div>
|
|
981
981
|
`;
|
|
982
982
|
}
|
|
983
983
|
renderTeam(e, t, s, r) {
|
|
984
|
-
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, n = o.w + o.l + o.t, i = s ? this.data.allTeams.filter((
|
|
984
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, n = o.w + o.l + o.t, i = s ? this.data.allTeams.filter((h) => h.conferenceId === s.id) : [], m = s ? K(i, e.records).findIndex((h) => h.team.id === t.id) + 1 : 0, d = X(e.rankings, e.teamsById, t.id, t.sport, null), c = this.data.games.filter((h) => h.homeTeamId === t.id || h.awayTeamId === t.id).sort((h, f) => String(h.date).localeCompare(String(f.date)));
|
|
985
985
|
return l`
|
|
986
986
|
<div class="tiles">
|
|
987
987
|
<div class="tile"><div class="k">Overall</div><div class="v">${w(o)}</div><div class="s">${n} games played</div></div>
|
|
@@ -991,18 +991,18 @@ class ye extends b {
|
|
|
991
991
|
<div class="s">scored per game · ${n ? (o.pa / n).toFixed(1) : "0.0"} allowed</div></div>
|
|
992
992
|
<div class="tile"><div class="k">Streak</div><div class="v">${_(o.results) || "·"}</div>
|
|
993
993
|
<div class="s">last 5: ${W(e, t.id)}</div></div>
|
|
994
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
994
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${d ? `#${d}` : "NR"}</div>
|
|
995
995
|
<div class="s"><a href=${v(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
996
996
|
</div>
|
|
997
997
|
${(t.championships || []).length ? l`
|
|
998
998
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
999
|
-
${t.championships.map((
|
|
999
|
+
${t.championships.map((h) => l`<span class="pill champ">★ ${h.season} ${h.title} champion${h.classification ? ` · ${h.classification}` : ""}${h.region ? ` · ${h.region}` : ""}</span>`)}
|
|
1000
1000
|
</div>` : p}
|
|
1001
1001
|
<div class="cols">
|
|
1002
1002
|
<div>
|
|
1003
1003
|
<div class="section-title">Schedule & results</div>
|
|
1004
1004
|
<div class="card">
|
|
1005
|
-
${c.length ? l`<ul class="gamelist">${c.map((
|
|
1005
|
+
${c.length ? l`<ul class="gamelist">${c.map((h) => this.renderGameRow(e, t, h))}</ul>` : l`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
|
|
1006
1006
|
</div>
|
|
1007
1007
|
</div>
|
|
1008
1008
|
<div>
|
|
@@ -1014,19 +1014,19 @@ class ye extends b {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
renderGameRow(e, t, s) {
|
|
1016
1016
|
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, n = r ? s.homeScore : s.awayScore, i = r ? s.awayScore : s.homeScore;
|
|
1017
|
-
let m = l`<span class="mut">${
|
|
1017
|
+
let m = l`<span class="mut">${E(s.time)}</span>`;
|
|
1018
1018
|
if (s.state === "final") {
|
|
1019
|
-
const c = H(s),
|
|
1020
|
-
m = l`<span class=${
|
|
1019
|
+
const c = H(s), h = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
|
|
1020
|
+
m = l`<span class=${h}>${h}</span> ${n}-${i}${s.finish === "overtime" ? l` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? l` <span class="mut">FF</span>` : p}`;
|
|
1021
1021
|
} else s.state === "live" && (m = l`<span style="color:var(--hsot-red)">${n}-${i}</span>`);
|
|
1022
|
-
const
|
|
1022
|
+
const d = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1023
1023
|
return l`
|
|
1024
1024
|
<li>
|
|
1025
|
-
<span class="d">${
|
|
1026
|
-
${
|
|
1025
|
+
<span class="d">${b(s.date)}</span>
|
|
1026
|
+
${B(s)}
|
|
1027
1027
|
<span class="res">${m}</span>
|
|
1028
|
-
<span class="opp">${r ? "vs" : "at"} ${
|
|
1029
|
-
<span class="pill type">${
|
|
1028
|
+
<span class="opp">${r ? "vs" : "at"} ${U(e, o, s.date)}
|
|
1029
|
+
<span class="pill type">${d}</span>
|
|
1030
1030
|
${s.broadcast ? l`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1031
1031
|
</span>
|
|
1032
1032
|
<span class="where">${s.venue || ""}</span>
|
|
@@ -1059,8 +1059,22 @@ class ye extends b {
|
|
|
1059
1059
|
`;
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
1062
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1063
|
-
const we =
|
|
1062
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", $e);
|
|
1063
|
+
const we = "https://api.wral.com/search";
|
|
1064
|
+
function xe(a) {
|
|
1065
|
+
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1066
|
+
}
|
|
1067
|
+
function ke(a, e) {
|
|
1068
|
+
const t = String(a || we).replace(/\/+$/, ""), s = new URLSearchParams({ query: xe(e), sort: "score", lang: "en" });
|
|
1069
|
+
return `${t}/v1/query?${s}`;
|
|
1070
|
+
}
|
|
1071
|
+
async function Te(a, e, t) {
|
|
1072
|
+
const r = await ((...i) => fetch(...i))(ke(a, e));
|
|
1073
|
+
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1074
|
+
const o = await r.json(), n = new Map((o.items || []).map((i) => [i.uri, i]));
|
|
1075
|
+
return e.map((i) => n.get(i) || { uri: i, title: i });
|
|
1076
|
+
}
|
|
1077
|
+
const Ie = $`
|
|
1064
1078
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1065
1079
|
.breadcrumbs a { text-decoration: none; }
|
|
1066
1080
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1081,6 +1095,14 @@ const we = y`
|
|
|
1081
1095
|
.scorehead .mid { text-align: center; }
|
|
1082
1096
|
.scorehead .bigscore { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 3rem; line-height: 1; color: var(--hsot-black); white-space: nowrap; }
|
|
1083
1097
|
.scorehead .status { margin-top: 0.3rem; font-size: 0.8rem; color: var(--hsot-gray-5); }
|
|
1098
|
+
.covgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
|
|
1099
|
+
.covcard { display: flex; flex-direction: column; text-decoration: none; color: inherit; margin-bottom: 0; }
|
|
1100
|
+
.covcard:hover .covtitle { color: var(--hsot-red-deep); }
|
|
1101
|
+
.covimg { width: 100%; aspect-ratio: 1.91; object-fit: cover; display: block; background: var(--hsot-gray-1); }
|
|
1102
|
+
.covbody { padding: 0.75rem 0.9rem 0.85rem; }
|
|
1103
|
+
.covtitle { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
|
|
1104
|
+
.covdesc { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--hsot-gray-5); line-height: 1.4; }
|
|
1105
|
+
.covmeta { margin-top: 0.45rem; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1084
1106
|
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
|
1085
1107
|
.ctxcard { padding: 0.85rem 1rem; }
|
|
1086
1108
|
.ctxcard .who { font-family: var(--hsot-heading-font); font-weight: 700; margin-bottom: 0.4rem; }
|
|
@@ -1091,30 +1113,39 @@ const we = y`
|
|
|
1091
1113
|
.cols { grid-template-columns: 1fr; }
|
|
1092
1114
|
}
|
|
1093
1115
|
`;
|
|
1094
|
-
class
|
|
1095
|
-
static styles = [...S,
|
|
1116
|
+
class Se extends y {
|
|
1117
|
+
static styles = [...S, Ie];
|
|
1096
1118
|
static properties = {
|
|
1097
|
-
...
|
|
1098
|
-
gameId: { type: String, attribute: "game-id" }
|
|
1119
|
+
...y.properties,
|
|
1120
|
+
gameId: { type: String, attribute: "game-id" },
|
|
1121
|
+
// The public site search that resolves Game.coverageUrls into cards
|
|
1122
|
+
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
1123
|
+
// registry — so the prod default is right everywhere; the attribute
|
|
1124
|
+
// exists for the same reason the href templates do.
|
|
1125
|
+
searchApi: { type: String, attribute: "search-api" }
|
|
1099
1126
|
};
|
|
1100
1127
|
constructor() {
|
|
1101
|
-
super(), this.gameId = "";
|
|
1128
|
+
super(), this.gameId = "", this.searchApi = "";
|
|
1102
1129
|
}
|
|
1103
1130
|
async fetchData(e) {
|
|
1104
|
-
const t = await e.getGame(this.gameId), [
|
|
1131
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, n, i, m, d] = await Promise.all([
|
|
1105
1132
|
e.listSchools(),
|
|
1106
1133
|
e.listTeams({ sport: t.sport }),
|
|
1107
1134
|
e.listConferences(),
|
|
1108
1135
|
e.listRankings({ sport: t.sport }),
|
|
1109
|
-
e.listGames({ sport: t.sport, season: t.season })
|
|
1136
|
+
e.listGames({ sport: t.sport, season: t.season }),
|
|
1137
|
+
// A search outage must not blank the box score — degrade to bare
|
|
1138
|
+
// links (fetchCoverage already degrades per-URL index misses).
|
|
1139
|
+
s.length ? Te(this.searchApi, s).catch(() => s.map((c) => ({ uri: c, title: c }))) : Promise.resolve([])
|
|
1110
1140
|
]);
|
|
1111
1141
|
return {
|
|
1112
1142
|
game: t,
|
|
1113
|
-
schools:
|
|
1114
|
-
teams:
|
|
1115
|
-
conferences:
|
|
1116
|
-
rankings:
|
|
1117
|
-
games:
|
|
1143
|
+
schools: r.items,
|
|
1144
|
+
teams: o.items,
|
|
1145
|
+
conferences: n.items,
|
|
1146
|
+
rankings: i.items,
|
|
1147
|
+
games: m.items,
|
|
1148
|
+
coverage: d
|
|
1118
1149
|
};
|
|
1119
1150
|
}
|
|
1120
1151
|
get ctx() {
|
|
@@ -1130,7 +1161,7 @@ class xe extends b {
|
|
|
1130
1161
|
renderView() {
|
|
1131
1162
|
const e = this.data.game;
|
|
1132
1163
|
if (!e) return l`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1133
|
-
const t = this.ctx, s = g(this.data.conferences), r = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, o = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, n = H(e), i = (c) => e.state === "final" && n !== c && n !== "tie" ? "opacity:0.45" : "", m = e.conferenceId ? s[e.conferenceId] : null,
|
|
1164
|
+
const t = this.ctx, s = g(this.data.conferences), r = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, o = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, n = H(e), i = (c) => e.state === "final" && n !== c && n !== "tie" ? "opacity:0.45" : "", m = e.conferenceId ? s[e.conferenceId] : null, d = this.data.games.filter((c) => c.id !== e.id && c.state === "final" && c.gameType !== "scrimmage" && (c.homeTeamId === e.homeTeamId && c.awayTeamId === e.awayTeamId || c.homeTeamId === e.awayTeamId && c.awayTeamId === e.homeTeamId));
|
|
1134
1165
|
return l`
|
|
1135
1166
|
<div class="view">
|
|
1136
1167
|
<p class="breadcrumbs">
|
|
@@ -1147,8 +1178,8 @@ class xe extends b {
|
|
|
1147
1178
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1148
1179
|
<span style=${i("home")}>${e.homeScore}</span>
|
|
1149
1180
|
</div>
|
|
1150
|
-
<div class="status">${
|
|
1151
|
-
<div class="status">${
|
|
1181
|
+
<div class="status">${B(e)}</div>
|
|
1182
|
+
<div class="status">${b(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? l` · ${E(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1152
1183
|
${e.broadcast ? l` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1153
1184
|
<div class="status">
|
|
1154
1185
|
<span class="pill type">${e.gameType === "conference" ? `${m?.name || "Conference"} game` : e.gameType}</span>
|
|
@@ -1161,22 +1192,31 @@ class xe extends b {
|
|
|
1161
1192
|
${this.renderLineScore(e, r, o)}
|
|
1162
1193
|
${e.notes ? l`<p class="note" style="padding:0 1rem 0.9rem;text-align:center">${e.notes}</p>` : p}
|
|
1163
1194
|
</div>
|
|
1164
|
-
${
|
|
1195
|
+
${(this.data.coverage || []).length ? l`
|
|
1165
1196
|
<div class="section-title">Coverage</div>
|
|
1166
|
-
<div class="
|
|
1167
|
-
${
|
|
1168
|
-
|
|
1169
|
-
|
|
1197
|
+
<div class="covgrid">
|
|
1198
|
+
${this.data.coverage.map((c) => l`
|
|
1199
|
+
<a class="card covcard" href=${c.uri}>
|
|
1200
|
+
${c.image ? l`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
|
|
1201
|
+
<div class="covbody">
|
|
1202
|
+
<div class="covtitle">${c.videoDuration ? l`<span class="pill live" style="animation:none">Video</span> ` : p}${c.title || c.uri}</div>
|
|
1203
|
+
${c.description ? l`<p class="covdesc">${c.description}</p>` : p}
|
|
1204
|
+
${c.author || c.publishedTime ? l`
|
|
1205
|
+
<div class="covmeta">${[c.author, c.publishedTime ? new Date(c.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1206
|
+
` : p}
|
|
1207
|
+
</div>
|
|
1208
|
+
</a>
|
|
1209
|
+
`)}
|
|
1170
1210
|
</div>` : p}
|
|
1171
1211
|
<div class="section-title">Season context</div>
|
|
1172
1212
|
<div class="cols">
|
|
1173
|
-
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([c,
|
|
1213
|
+
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([c, h]) => this.renderContext(t, c, h))}
|
|
1174
1214
|
</div>
|
|
1175
|
-
${
|
|
1215
|
+
${d.length ? l`
|
|
1176
1216
|
<div class="section-title">Head to head this season</div>
|
|
1177
1217
|
<div class="card"><ul class="gamelist">
|
|
1178
|
-
${
|
|
1179
|
-
<span class="d">${
|
|
1218
|
+
${d.map((c) => l`<li>
|
|
1219
|
+
<span class="d">${b(c.date)}</span>${B(c)}
|
|
1180
1220
|
<span class="opp">${k(t, c.awayTeamId)} ${c.awayScore}, ${k(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1181
1221
|
<a class="box" href=${v(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1182
1222
|
</li>`)}
|
|
@@ -1186,12 +1226,12 @@ class xe extends b {
|
|
|
1186
1226
|
}
|
|
1187
1227
|
teamBlock(e, t, s, r, o) {
|
|
1188
1228
|
if (!r) return l`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1189
|
-
const n = e.teamsById[s], i = e.records[s], m =
|
|
1229
|
+
const n = e.teamsById[s], i = e.records[s], m = P(r, 58);
|
|
1190
1230
|
return l`
|
|
1191
1231
|
<div class="teamblock ${o ? "right" : ""}">
|
|
1192
|
-
${m ? l`<img class="crest logo" alt="" loading="lazy" src=${m} />` : l`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${F(r.colorPrimary || "#030711")}">${
|
|
1232
|
+
${m ? l`<img class="crest logo" alt="" loading="lazy" src=${m} />` : l`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${F(r.colorPrimary || "#030711")}">${j(r)}</span>`}
|
|
1193
1233
|
<div>
|
|
1194
|
-
<div class="tname">${
|
|
1234
|
+
<div class="tname">${G(e, s, t.date)}<a href=${v(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1195
1235
|
<div class="trec">${r.mascot || ""} · ${w(i)}${n?.conferenceId ? l` · ${w(i, !0)} conf` : p}</div>
|
|
1196
1236
|
</div>
|
|
1197
1237
|
</div>
|
|
@@ -1201,19 +1241,19 @@ class xe extends b {
|
|
|
1201
1241
|
const r = e.periodScores || [];
|
|
1202
1242
|
if (!r.length)
|
|
1203
1243
|
return l`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
|
|
1204
|
-
const o = Math.max(4, ...r.map((
|
|
1205
|
-
const
|
|
1206
|
-
return
|
|
1207
|
-
}, m = (
|
|
1244
|
+
const o = Math.max(4, ...r.map((d) => d.period)), n = (d) => d <= 4 ? String(d) : `OT${d > 5 ? d - 4 : ""}`, i = (d, c) => {
|
|
1245
|
+
const h = r.find((f) => f.period === c);
|
|
1246
|
+
return h ? h[d] : e.state === "final" ? 0 : "·";
|
|
1247
|
+
}, m = (d, c, h) => l`
|
|
1208
1248
|
<tr>
|
|
1209
|
-
<td class="teamcell">${I(
|
|
1249
|
+
<td class="teamcell">${I(d, 20)}${d?.abbr || "TBD"}</td>
|
|
1210
1250
|
${Array.from({ length: o }, (f, u) => l`<td class="num">${i(c, u + 1)}</td>`)}
|
|
1211
|
-
<td class="num" style="font-weight:700">${
|
|
1251
|
+
<td class="num" style="font-weight:700">${h}</td>
|
|
1212
1252
|
</tr>`;
|
|
1213
1253
|
return l`
|
|
1214
1254
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1215
1255
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1216
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (
|
|
1256
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (d, c) => l`<th class="num">${n(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1217
1257
|
<tbody>
|
|
1218
1258
|
${m(t, "away", e.awayScore)}
|
|
1219
1259
|
${m(s, "home", e.homeScore)}
|
|
@@ -1232,29 +1272,29 @@ class xe extends b {
|
|
|
1232
1272
|
<span>Last 5: ${W(e, t)}</span>
|
|
1233
1273
|
<span>Streak: <b>${r ? _(r.results) : "·"}</b></span>
|
|
1234
1274
|
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1235
|
-
<span>Next: ${o ? l`${
|
|
1236
|
-
${o.homeTeamId === t ? "vs" : "at"} ${
|
|
1275
|
+
<span>Next: ${o ? l`${b(o.date, { month: "numeric", day: "numeric" })}
|
|
1276
|
+
${o.homeTeamId === t ? "vs" : "at"} ${z(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
1237
1277
|
</div>
|
|
1238
1278
|
</div>
|
|
1239
1279
|
`;
|
|
1240
1280
|
}
|
|
1241
1281
|
}
|
|
1242
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1282
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", Se);
|
|
1243
1283
|
export {
|
|
1244
1284
|
N as D,
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1285
|
+
Se as H,
|
|
1286
|
+
be as a,
|
|
1287
|
+
$e as b,
|
|
1248
1288
|
ue as c,
|
|
1249
1289
|
ge as d,
|
|
1250
1290
|
D as e,
|
|
1251
1291
|
se as f,
|
|
1252
1292
|
v as g,
|
|
1253
1293
|
H as h,
|
|
1254
|
-
|
|
1294
|
+
Ce as i,
|
|
1255
1295
|
_ as j,
|
|
1256
1296
|
pe as p,
|
|
1257
1297
|
w as r,
|
|
1258
|
-
|
|
1298
|
+
K as s,
|
|
1259
1299
|
X as t
|
|
1260
1300
|
};
|