@sensiblestats/widget-react 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/index.cjs +61 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +61 -72
- package/dist/index.js.map +1 -1
- package/dist/styles.css +22 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4349,6 +4349,13 @@ function MysteryTigerGame({
|
|
|
4349
4349
|
" left"
|
|
4350
4350
|
] })
|
|
4351
4351
|
] }),
|
|
4352
|
+
guessResults.length === 0 && !isOver && /* @__PURE__ */ jsxs49("div", { className: "ss-w-gt-legend", children: [
|
|
4353
|
+
/* @__PURE__ */ jsx55("div", { className: "ss-w-gt-legend-lead", children: "Guess any squad player \u2014 each guess reveals how close you are:" }),
|
|
4354
|
+
/* @__PURE__ */ jsx55("div", { className: "ss-w-gtrow", children: ATTR_KEYS.map((key) => /* @__PURE__ */ jsxs49("div", { className: "ss-w-gtile ss-w-gtile--legend", children: [
|
|
4355
|
+
/* @__PURE__ */ jsx55("span", { className: "ss-w-gtile-lab", children: ATTR_LABELS[key] }),
|
|
4356
|
+
/* @__PURE__ */ jsx55("span", { className: "ss-w-gtile-v", "aria-hidden": "true", children: "\xB7" })
|
|
4357
|
+
] }, key)) })
|
|
4358
|
+
] }),
|
|
4352
4359
|
guessResults.length > 0 && /* @__PURE__ */ jsx55("div", { className: "ss-w-gtrows", children: guessResults.map((gr, i) => {
|
|
4353
4360
|
const player = config.squadPlayers.find((p) => p.id === gr.playerId);
|
|
4354
4361
|
return /* @__PURE__ */ jsxs49("div", { className: "ss-w-gtguess", children: [
|
|
@@ -4433,6 +4440,7 @@ function MysteryTigerGame({
|
|
|
4433
4440
|
|
|
4434
4441
|
// src/components/games/HigherOrLowerGame.tsx
|
|
4435
4442
|
import { Fragment as Fragment10, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
4443
|
+
var POINTS_PER_CORRECT = 10;
|
|
4436
4444
|
function parseClientState2(json) {
|
|
4437
4445
|
if (!json) return null;
|
|
4438
4446
|
try {
|
|
@@ -4524,39 +4532,25 @@ function HigherOrLowerGame({
|
|
|
4524
4532
|
] })
|
|
4525
4533
|
] })
|
|
4526
4534
|
] }),
|
|
4535
|
+
!isOver && /* @__PURE__ */ jsxs50("div", { className: "ss-w-hl-foot", children: [
|
|
4536
|
+
/* @__PURE__ */ jsxs50("span", { className: "ss-w-hl-chip", children: [
|
|
4537
|
+
score,
|
|
4538
|
+
" pts"
|
|
4539
|
+
] }),
|
|
4540
|
+
/* @__PURE__ */ jsxs50("span", { className: "ss-w-hl-chip ss-w-hl-chip--green", children: [
|
|
4541
|
+
"+",
|
|
4542
|
+
POINTS_PER_CORRECT,
|
|
4543
|
+
" / correct"
|
|
4544
|
+
] })
|
|
4545
|
+
] }),
|
|
4527
4546
|
isOver && /* @__PURE__ */ jsxs50("div", { className: "ss-w-hl-over", children: [
|
|
4528
4547
|
/* @__PURE__ */ jsx56("div", { className: "ss-w-hl-over-title", children: runEndedWrong ? "Run over" : "Nice run!" }),
|
|
4529
4548
|
/* @__PURE__ */ jsx56("div", { className: "ss-w-hl-over-score", children: score }),
|
|
4530
4549
|
/* @__PURE__ */ jsxs50("div", { className: "ss-w-hl-over-sub", children: [
|
|
4531
4550
|
correctCount,
|
|
4532
|
-
" correct"
|
|
4533
|
-
correctCount === 1 ? "" : "",
|
|
4534
|
-
" \xB7 come back tomorrow for a new run"
|
|
4551
|
+
" correct \xB7 come back tomorrow for a new run"
|
|
4535
4552
|
] })
|
|
4536
|
-
] })
|
|
4537
|
-
answeredPairs.length > 0 && /* @__PURE__ */ jsx56("div", { className: "ss-w-hlresults", children: answeredPairs.map((answered) => {
|
|
4538
|
-
const pair = config.pairs.find((p) => p.pairIndex === answered.pairIndex);
|
|
4539
|
-
return /* @__PURE__ */ jsxs50(
|
|
4540
|
-
"div",
|
|
4541
|
-
{
|
|
4542
|
-
className: `ss-w-hlrrow ss-w-hlrrow--${answered.wasCorrect ? "correct" : "wrong"}`,
|
|
4543
|
-
children: [
|
|
4544
|
-
/* @__PURE__ */ jsxs50("span", { className: "ss-w-hlrrow-names", children: [
|
|
4545
|
-
pair?.playerAName ?? "?",
|
|
4546
|
-
" ",
|
|
4547
|
-
/* @__PURE__ */ jsx56("b", { className: "ss-w-hlrrow-val", children: pair?.playerAValue }),
|
|
4548
|
-
" vs ",
|
|
4549
|
-
pair?.playerBName ?? "?",
|
|
4550
|
-
" ",
|
|
4551
|
-
/* @__PURE__ */ jsx56("b", { className: "ss-w-hlrrow-val", children: answered.playerBValue })
|
|
4552
|
-
] }),
|
|
4553
|
-
/* @__PURE__ */ jsx56("span", { className: "ss-w-hlrrow-pick", children: answered.pick }),
|
|
4554
|
-
/* @__PURE__ */ jsx56("span", { className: "ss-w-hlrrow-icon", children: answered.wasCorrect ? "\u2713" : "\u2717" })
|
|
4555
|
-
]
|
|
4556
|
-
},
|
|
4557
|
-
answered.pairIndex
|
|
4558
|
-
);
|
|
4559
|
-
}) })
|
|
4553
|
+
] })
|
|
4560
4554
|
] })
|
|
4561
4555
|
] });
|
|
4562
4556
|
}
|
|
@@ -4573,18 +4567,22 @@ function parseClientState3(json) {
|
|
|
4573
4567
|
}
|
|
4574
4568
|
}
|
|
4575
4569
|
function spellYears(spell) {
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
if (spell.endYear
|
|
4579
|
-
|
|
4570
|
+
if (!spell.startYear) return "";
|
|
4571
|
+
const yy = (y) => `'${String(y % 100).padStart(2, "0")}`;
|
|
4572
|
+
if (spell.endYear && spell.endYear !== spell.startYear) {
|
|
4573
|
+
return `${yy(spell.startYear)}\u2013${String(spell.endYear % 100).padStart(2, "0")}`;
|
|
4574
|
+
}
|
|
4575
|
+
return yy(spell.startYear);
|
|
4580
4576
|
}
|
|
4581
4577
|
function ClubSpellCard({ spell }) {
|
|
4582
4578
|
const years = spellYears(spell);
|
|
4583
4579
|
return /* @__PURE__ */ jsxs51("div", { className: `ss-w-cpath-club${spell.isLoan ? " ss-w-cpath-club--loan" : ""}`, children: [
|
|
4584
4580
|
spell.crestUrl ? /* @__PURE__ */ jsx57("img", { src: spell.crestUrl, alt: "", className: "ss-w-cpath-crest", loading: "lazy" }) : /* @__PURE__ */ jsx57("div", { className: "ss-w-cpath-crest ss-w-cpath-crest--fallback", "aria-hidden": "true", children: spell.clubName.slice(0, 3).toUpperCase() }),
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
|
|
4587
|
-
|
|
4581
|
+
/* @__PURE__ */ jsxs51("span", { className: "ss-w-cpath-club-name", children: [
|
|
4582
|
+
spell.clubName,
|
|
4583
|
+
spell.isLoan && /* @__PURE__ */ jsx57("span", { className: "ss-w-cpath-loan-note", children: " (loan)" })
|
|
4584
|
+
] }),
|
|
4585
|
+
years && /* @__PURE__ */ jsx57("span", { className: "ss-w-cpath-spell-yr", children: years })
|
|
4588
4586
|
] });
|
|
4589
4587
|
}
|
|
4590
4588
|
function CareerPathGame({
|
|
@@ -4599,8 +4597,6 @@ function CareerPathGame({
|
|
|
4599
4597
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
4600
4598
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
4601
4599
|
const visiblePath = clientState?.visiblePath ?? config?.initialPath ?? [];
|
|
4602
|
-
const totalClubs = clientState?.totalClubs ?? config?.totalClubs ?? visiblePath.length;
|
|
4603
|
-
const hiddenCount = Math.max(0, totalClubs - visiblePath.length);
|
|
4604
4600
|
const filtered = config && !isOver ? config.typeaheadPool.filter(
|
|
4605
4601
|
(p) => !alreadyGuessedIds.has(p.id) && p.name.toLowerCase().includes(query.toLowerCase())
|
|
4606
4602
|
) : [];
|
|
@@ -4624,20 +4620,10 @@ function CareerPathGame({
|
|
|
4624
4620
|
" left"
|
|
4625
4621
|
] })
|
|
4626
4622
|
] }),
|
|
4627
|
-
/* @__PURE__ */
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
] }, `${spell.clubName}-${i}`)),
|
|
4632
|
-
hiddenCount > 0 && /* @__PURE__ */ jsxs51(Fragment12, { children: [
|
|
4633
|
-
/* @__PURE__ */ jsx57("span", { className: "ss-w-cpath-arrow", "aria-hidden": "true", children: "\u2192" }),
|
|
4634
|
-
/* @__PURE__ */ jsxs51("div", { className: "ss-w-cpath-hidden", children: [
|
|
4635
|
-
"+",
|
|
4636
|
-
hiddenCount,
|
|
4637
|
-
" more"
|
|
4638
|
-
] })
|
|
4639
|
-
] })
|
|
4640
|
-
] }),
|
|
4623
|
+
/* @__PURE__ */ jsx57("div", { className: "ss-w-cpath-seq", children: visiblePath.map((spell, i) => /* @__PURE__ */ jsxs51(Fragment11, { children: [
|
|
4624
|
+
i > 0 && /* @__PURE__ */ jsx57("span", { className: "ss-w-cpath-arrow", "aria-hidden": "true", children: "\u203A" }),
|
|
4625
|
+
/* @__PURE__ */ jsx57(ClubSpellCard, { spell })
|
|
4626
|
+
] }, `${spell.clubName}-${i}`)) }),
|
|
4641
4627
|
clientState?.hintLine && !isOver && /* @__PURE__ */ jsxs51("div", { className: "ss-w-cpath-hint", children: [
|
|
4642
4628
|
"\u{1F4A1} ",
|
|
4643
4629
|
clientState.hintLine
|
|
@@ -4888,6 +4874,7 @@ function BeatTheGridGame({
|
|
|
4888
4874
|
// src/components/games/GuessTheXiGame.tsx
|
|
4889
4875
|
import { useState as useState26, useId as useId5 } from "react";
|
|
4890
4876
|
import { Fragment as Fragment14, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
4877
|
+
var MAX_GUESSES = 3;
|
|
4891
4878
|
function parseClientState5(json) {
|
|
4892
4879
|
if (!json) return null;
|
|
4893
4880
|
try {
|
|
@@ -4943,12 +4930,12 @@ function GuessTheXiGame({
|
|
|
4943
4930
|
/* @__PURE__ */ jsxs53("div", { children: [
|
|
4944
4931
|
/* @__PURE__ */ jsx59("div", { className: "ss-w-gxi-title", children: "Guess the XI" }),
|
|
4945
4932
|
/* @__PURE__ */ jsxs53("div", { className: "ss-w-gxi-sub", children: [
|
|
4946
|
-
"Which team? \xB7 ",
|
|
4933
|
+
"Which team? \xB7 flags only \xB7 ",
|
|
4947
4934
|
config.poolLabel
|
|
4948
4935
|
] })
|
|
4949
4936
|
] }),
|
|
4950
4937
|
clientState && !isOver && /* @__PURE__ */ jsxs53("span", { className: "ss-w-gxi-left", children: [
|
|
4951
|
-
Math.max(0,
|
|
4938
|
+
Math.max(0, MAX_GUESSES - clientState.guessesUsed),
|
|
4952
4939
|
" left"
|
|
4953
4940
|
] })
|
|
4954
4941
|
] }),
|
|
@@ -6956,6 +6943,11 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6956
6943
|
.ss-w-gt-left { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 11%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 22%, var(--ss-w-line)); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
|
|
6957
6944
|
/* Guess rows \u2014 one labelled block per guess */
|
|
6958
6945
|
.ss-w-gtrows { display: flex; flex-direction: column; gap: 8px; }
|
|
6946
|
+
/* First-load legend (empty state) */
|
|
6947
|
+
.ss-w-gt-legend { display: flex; flex-direction: column; gap: 8px; }
|
|
6948
|
+
.ss-w-gt-legend-lead { font-size: 11.5px; color: var(--ss-w-faint); line-height: 1.35; }
|
|
6949
|
+
.ss-w-gtile--legend { background: var(--ss-w-bubble); border: 1px dashed var(--ss-w-line); color: var(--ss-w-faint); }
|
|
6950
|
+
.ss-w-gtile--legend .ss-w-gtile-lab { opacity: .9; }
|
|
6959
6951
|
.ss-w-gtguess { display: flex; flex-direction: column; gap: 4px; }
|
|
6960
6952
|
.ss-w-gtguess-nm { font-size: 11px; font-weight: 600; color: var(--ss-w-faint); }
|
|
6961
6953
|
.ss-w-gtrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
|
|
@@ -7008,16 +7000,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
7008
7000
|
.ss-w-hl-over-score { font-size: 34px; font-weight: 800; color: var(--ss-w-accent); line-height: 1; font-variant-numeric: tabular-nums; }
|
|
7009
7001
|
.ss-w-hl-over-sub { font-size: 11px; color: var(--ss-w-faint); }
|
|
7010
7002
|
/* Answered history \u2014 clean single-line rows with the revealed value */
|
|
7011
|
-
|
|
7012
|
-
.ss-w-
|
|
7013
|
-
.ss-w-
|
|
7014
|
-
.ss-w-
|
|
7015
|
-
.ss-w-hlrrow-names { flex: 1; min-width: 0; font-weight: 600; color: var(--ss-w-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
7016
|
-
.ss-w-hlrrow-val { font-weight: 800; color: var(--ss-w-accent); font-variant-numeric: tabular-nums; }
|
|
7017
|
-
.ss-w-hlrrow-pick { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--ss-w-faint); flex: none; }
|
|
7018
|
-
.ss-w-hlrrow-icon { font-size: 14px; flex: none; }
|
|
7019
|
-
.ss-w-hlrrow--correct .ss-w-hlrrow-icon { color: var(--ss-w-correct); }
|
|
7020
|
-
.ss-w-hlrrow--wrong .ss-w-hlrrow-icon { color: var(--ss-w-cta); }
|
|
7003
|
+
/* In-progress footer chips (artifact) */
|
|
7004
|
+
.ss-w-hl-foot { display: flex; align-items: center; gap: 8px; }
|
|
7005
|
+
.ss-w-hl-chip { font-size: 11px; font-weight: 600; color: var(--ss-w-faint); background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); border-radius: 999px; padding: 4px 10px; }
|
|
7006
|
+
.ss-w-hl-chip--green { margin-left: auto; color: var(--ss-w-correct); background: color-mix(in srgb, var(--ss-w-correct) 10%, var(--ss-w-panel)); border-color: color-mix(in srgb, var(--ss-w-correct) 26%, var(--ss-w-line)); }
|
|
7021
7007
|
|
|
7022
7008
|
/* ---- Career Path game screen (D3) \u2014 artifact cpath/club/cto layout ---- */
|
|
7023
7009
|
.ss-w-cpath { display: flex; flex-direction: column; gap: 12px; }
|
|
@@ -7027,18 +7013,16 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
7027
7013
|
.ss-w-cpath-sub { font-size: 11px; color: var(--ss-w-faint); margin-top: 4px; }
|
|
7028
7014
|
.ss-w-cpath-left { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 11%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 22%, var(--ss-w-line)); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
|
|
7029
7015
|
/* Career sequence \u2014 horizontal crests with arrows */
|
|
7030
|
-
.ss-w-cpath-seq { display: flex; flex-wrap:
|
|
7031
|
-
.ss-w-cpath-arrow { align-self:
|
|
7016
|
+
.ss-w-cpath-seq { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 4px; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 14px; padding: 13px 11px; }
|
|
7017
|
+
.ss-w-cpath-arrow { align-self: flex-start; flex: none; color: var(--ss-w-faint); font-size: 13px; padding-top: 9px; }
|
|
7032
7018
|
/* Single club \u2014 small vertical card */
|
|
7033
7019
|
.ss-w-cpath-club { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; flex: none; }
|
|
7034
7020
|
.ss-w-cpath-crest { width: 34px; height: 34px; object-fit: contain; flex: none; border-radius: 8px; }
|
|
7035
7021
|
.ss-w-cpath-crest--fallback { background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); display: grid; place-items: center; font-size: 9px; font-weight: 800; letter-spacing: .02em; color: var(--ss-w-faint); }
|
|
7036
|
-
.ss-w-cpath-club-name { font-size: 9px; font-weight: 600; color: var(--ss-w-ink); text-align: center; line-height: 1.15; max-width: 56px;
|
|
7022
|
+
.ss-w-cpath-club-name { font-size: 9px; font-weight: 600; color: var(--ss-w-ink); text-align: center; line-height: 1.15; max-width: 56px; overflow-wrap: anywhere; }
|
|
7037
7023
|
.ss-w-cpath-spell-yr { font-size: 8px; color: var(--ss-w-faint); font-weight: 500; white-space: nowrap; }
|
|
7038
|
-
.ss-w-cpath-loan-
|
|
7024
|
+
.ss-w-cpath-loan-note { display: block; color: var(--ss-w-faint); font-weight: 500; }
|
|
7039
7025
|
.ss-w-cpath-club--loan .ss-w-cpath-crest { border: 1px dashed color-mix(in srgb, var(--ss-w-accent) 40%, var(--ss-w-line)); }
|
|
7040
|
-
/* Hidden clubs chip */
|
|
7041
|
-
.ss-w-cpath-hidden { align-self: center; flex: none; white-space: nowrap; font-size: 9px; font-weight: 700; color: var(--ss-w-faint); background: var(--ss-w-bubble); border: 1px dashed var(--ss-w-line); border-radius: 8px; padding: 6px 8px; }
|
|
7042
7026
|
/* Hint line */
|
|
7043
7027
|
.ss-w-cpath-hint { font-size: 11.5px; color: var(--ss-w-faint); text-align: center; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ss-w-accent) 8%, var(--ss-w-panel)); border: 1px dashed color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); }
|
|
7044
7028
|
/* Terminal outcome */
|
|
@@ -7102,10 +7086,15 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
7102
7086
|
.ss-w-gxi-title { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; color: var(--ss-w-ink); line-height: 1; }
|
|
7103
7087
|
.ss-w-gxi-sub { font-size: 11px; color: var(--ss-w-faint); margin-top: 4px; }
|
|
7104
7088
|
.ss-w-gxi-left { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 11%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 22%, var(--ss-w-line)); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
|
|
7105
|
-
/* Pitch: a flag per slot laid out in formation rows on a green field
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
.ss-w-gxi-
|
|
7089
|
+
/* Pitch: a flag per slot laid out in formation rows on a green field. A real min-height plus
|
|
7090
|
+
space-between distributes the formation lines top\u2192bottom like a pitch (GK at the back, forwards
|
|
7091
|
+
forward); yard-line stripes reinforce the read. Without a height the lines collapse together. */
|
|
7092
|
+
.ss-w-gxi-pitch { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-height: 300px; padding: 18px 10px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--ss-w-correct) 22%, var(--ss-w-line));
|
|
7093
|
+
background:
|
|
7094
|
+
linear-gradient(180deg, color-mix(in srgb, var(--ss-w-correct) 12%, var(--ss-w-panel)), color-mix(in srgb, var(--ss-w-correct) 4%, var(--ss-w-panel))),
|
|
7095
|
+
repeating-linear-gradient(180deg, transparent 0 40px, color-mix(in srgb, var(--ss-w-ink) 4%, transparent) 40px 80px); }
|
|
7096
|
+
.ss-w-gxi-prow { display: flex; justify-content: center; align-items: center; gap: 14px; }
|
|
7097
|
+
.ss-w-gxi-flag { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 20px; line-height: 1; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); box-shadow: 0 1px 3px rgba(0,0,0,.14); overflow: hidden; }
|
|
7109
7098
|
/* Wrong-guess trail */
|
|
7110
7099
|
.ss-w-gxi-wrong { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
7111
7100
|
.ss-w-gxi-wrong-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--ss-w-wrong) 10%, var(--ss-w-panel)); border: 1px solid var(--ss-w-line); color: var(--ss-w-faint); text-decoration: line-through; }
|