@sensiblestats/widget-react 0.132.0 → 0.133.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 +37 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -14
- package/dist/index.js.map +1 -1
- package/dist/styles.css +11 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1285,7 +1285,7 @@ function parseOddsFormat(value) {
|
|
|
1285
1285
|
}
|
|
1286
1286
|
|
|
1287
1287
|
// src/version.generated.ts
|
|
1288
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1288
|
+
var WIDGET_REACT_VERSION = "0.133.0";
|
|
1289
1289
|
|
|
1290
1290
|
// src/config.ts
|
|
1291
1291
|
function hostTag(cfg) {
|
|
@@ -1848,7 +1848,9 @@ function readStatCells(raw) {
|
|
|
1848
1848
|
for (const entry of raw) {
|
|
1849
1849
|
const label = str(entry.label);
|
|
1850
1850
|
const value = num(entry.value) ?? str(entry.value);
|
|
1851
|
-
if (label
|
|
1851
|
+
if (label === void 0 || value === void 0) continue;
|
|
1852
|
+
const note = str(entry.note);
|
|
1853
|
+
cells.push({ label, value, ...note !== void 0 ? { note } : {}, ...entry.muted === true ? { muted: true } : {} });
|
|
1852
1854
|
}
|
|
1853
1855
|
return cells;
|
|
1854
1856
|
}
|
|
@@ -1862,6 +1864,7 @@ function toCardVM(card) {
|
|
|
1862
1864
|
competitionId: typeof s.competitionId === "number" ? s.competitionId : null,
|
|
1863
1865
|
label,
|
|
1864
1866
|
image: str(s.imagePath),
|
|
1867
|
+
period: str(s.period),
|
|
1865
1868
|
stats: readStatCells(s.stats)
|
|
1866
1869
|
};
|
|
1867
1870
|
}).filter((s) => s !== null) : [];
|
|
@@ -1872,6 +1875,7 @@ function toCardVM(card) {
|
|
|
1872
1875
|
image: str(card.imagePath) ?? str(card.imageUrl) ?? str(card.image_url) ?? str(card.logoUrl) ?? str(card.logo),
|
|
1873
1876
|
sub: str(card.subtitle) ?? str(card.teamName) ?? str(card.leagueName) ?? str(card.position),
|
|
1874
1877
|
season: str(card.seasonName),
|
|
1878
|
+
chip: str(card.chip),
|
|
1875
1879
|
scopes
|
|
1876
1880
|
};
|
|
1877
1881
|
}
|
|
@@ -7728,23 +7732,34 @@ function FormBar({ w, d, l }) {
|
|
|
7728
7732
|
l > 0 ? /* @__PURE__ */ jsx32("span", { className: "ss-w-form-l", style: { flexGrow: l } }) : null
|
|
7729
7733
|
] });
|
|
7730
7734
|
}
|
|
7735
|
+
function cellClass(s) {
|
|
7736
|
+
return s.muted ? "ss-w-ecard-cell ss-w-ecard-cell--muted" : "ss-w-ecard-cell";
|
|
7737
|
+
}
|
|
7731
7738
|
function StatCellView({ s }) {
|
|
7732
7739
|
const m = RECORD_RE.exec(s.value);
|
|
7733
7740
|
if (m) {
|
|
7734
|
-
return /* @__PURE__ */ jsxs28("div", { className:
|
|
7741
|
+
return /* @__PURE__ */ jsxs28("div", { className: cellClass(s), children: [
|
|
7735
7742
|
/* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-cval", children: /* @__PURE__ */ jsx32(FormBar, { w: Number(m[1]), d: Number(m[2]), l: Number(m[3]) }) }),
|
|
7736
|
-
/* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-clabel", children: s.value })
|
|
7743
|
+
/* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-clabel", children: s.value }),
|
|
7744
|
+
s.note ? /* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-note", children: s.note }) : null
|
|
7737
7745
|
] });
|
|
7738
7746
|
}
|
|
7739
|
-
return /* @__PURE__ */ jsxs28("div", { className:
|
|
7747
|
+
return /* @__PURE__ */ jsxs28("div", { className: cellClass(s), children: [
|
|
7740
7748
|
/* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-cval", children: s.value }),
|
|
7741
|
-
/* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-clabel", children: s.label })
|
|
7749
|
+
/* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-clabel", children: s.label }),
|
|
7750
|
+
s.note ? /* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-note", children: s.note }) : null
|
|
7742
7751
|
] });
|
|
7743
7752
|
}
|
|
7753
|
+
function stripClass(stats) {
|
|
7754
|
+
const noted = stats.some((s) => s.note);
|
|
7755
|
+
return ["ss-w-ecard-strip", noted ? "ss-w-ecard-strip--noted" : "", stats.length > 6 ? "ss-w-ecard-strip--more" : ""].filter(Boolean).join(" ");
|
|
7756
|
+
}
|
|
7744
7757
|
function StatStrip({ stats }) {
|
|
7745
7758
|
if (stats.length === 0) return null;
|
|
7746
|
-
|
|
7747
|
-
|
|
7759
|
+
return /* @__PURE__ */ jsxs28("div", { className: stripClass(stats), style: { gridTemplateColumns: "repeat(3, minmax(0, 1fr))" }, children: [
|
|
7760
|
+
stats.map((s) => /* @__PURE__ */ jsx32(StatCellView, { s }, s.label + s.value)),
|
|
7761
|
+
Array.from({ length: (3 - stats.length % 3) % 3 }, (_, i) => /* @__PURE__ */ jsx32("div", { className: "ss-w-ecard-cell", "aria-hidden": "true" }, `pad${i}`))
|
|
7762
|
+
] });
|
|
7748
7763
|
}
|
|
7749
7764
|
function CardHeader({ c, showScopeCrest }) {
|
|
7750
7765
|
const onlyScope = c.scopes.length === 1 ? c.scopes[0] : null;
|
|
@@ -7763,6 +7778,7 @@ function CardHeader({ c, showScopeCrest }) {
|
|
|
7763
7778
|
] }),
|
|
7764
7779
|
/* @__PURE__ */ jsxs28("span", { className: "ss-w-ecard-meta", children: [
|
|
7765
7780
|
showScopeCrest && onlyScope?.image ? /* @__PURE__ */ jsx32(Crest2, { image: onlyScope.image, label: onlyScope.label }) : null,
|
|
7781
|
+
c.chip ? /* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-chip", children: c.chip }) : null,
|
|
7766
7782
|
c.season ? /* @__PURE__ */ jsx32("span", { className: "ss-w-ecard-season", children: shortSeason(c.season) }) : null
|
|
7767
7783
|
] })
|
|
7768
7784
|
] });
|
|
@@ -7794,7 +7810,8 @@ function EntityCardItem({ c }) {
|
|
|
7794
7810
|
return /* @__PURE__ */ jsxs28("div", { className: "ss-w-ecard", "data-kind": c.kind, children: [
|
|
7795
7811
|
/* @__PURE__ */ jsx32(CardHeader, { c, showScopeCrest: !multi }),
|
|
7796
7812
|
multi ? /* @__PURE__ */ jsx32(ScopeTabs, { scopes: c.scopes, active, onSelect: setActive }) : null,
|
|
7797
|
-
/* @__PURE__ */ jsx32(StatStrip, { stats: scope.stats })
|
|
7813
|
+
/* @__PURE__ */ jsx32(StatStrip, { stats: scope.stats }),
|
|
7814
|
+
scope.period ? /* @__PURE__ */ jsx32("div", { className: "ss-w-ecard-period", children: scope.period }) : null
|
|
7798
7815
|
] });
|
|
7799
7816
|
}
|
|
7800
7817
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
@@ -18321,7 +18338,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18321
18338
|
/* Entity card: identity header row over a horizontal stat strip */
|
|
18322
18339
|
.ss-w-ecard { display: flex; flex-direction: column; width: 100%; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 12px; overflow: hidden; text-align: left; }
|
|
18323
18340
|
|
|
18324
|
-
.ss-w-ecard-idtext { display: flex; flex-direction: column; gap: 1px; min-width:
|
|
18341
|
+
.ss-w-ecard-idtext { display: flex; flex-direction: column; gap: 1px; min-width: 45%; max-width: 100%; flex: 1 1 0; }
|
|
18325
18342
|
.ss-w-thumb { width: 54px; height: 54px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 700; color: #fff; background-color: var(--ss-w-nav); background-size: cover; background-position: center; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
|
|
18326
18343
|
.ss-w-thumb.ss-w-team { border-radius: 12px; }
|
|
18327
18344
|
.ss-w-ecard[data-kind="player"] .ss-w-thumb { background-color: var(--ss-w-accent); }
|
|
@@ -18332,10 +18349,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18332
18349
|
.ss-w-ecard-bare { display: flex; align-items: center; }
|
|
18333
18350
|
.ss-w-ecard-bare .ss-w-ecard-hd { padding: 10px 12px; }
|
|
18334
18351
|
|
|
18335
|
-
.ss-w-ecard-hd { display: flex; align-items: center; gap: 11px; padding: 11px 13px; }
|
|
18352
|
+
.ss-w-ecard-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 11px; padding: 11px 13px; }
|
|
18336
18353
|
.ss-w-ecard-hd .ss-w-thumb { width: 40px; height: 40px; font-size: 13px; box-shadow: none; }
|
|
18337
18354
|
.ss-w-ecard-hd .ss-w-thumb.ss-w-team { border-radius: 10px; }
|
|
18338
|
-
.ss-w-ecard-meta { display: inline-flex; align-items: center; gap: 7px; flex:
|
|
18355
|
+
.ss-w-ecard-meta { display: inline-flex; align-items: center; gap: 7px; flex: 0 1 auto; min-width: 0; align-self: flex-start; margin-left: auto; }
|
|
18339
18356
|
.ss-w-ecard-meta .ss-w-ecard-season { margin: 0; }
|
|
18340
18357
|
|
|
18341
18358
|
/* scope tabs: reuse the underline pattern, relocated above the strip */
|
|
@@ -18349,11 +18366,17 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18349
18366
|
.ss-w-ecard-season { flex: none; margin-left: auto; align-self: center; margin-bottom: 5px; font-size: 10.5px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 13%, var(--ss-w-panel)); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
|
|
18350
18367
|
|
|
18351
18368
|
/* stat strip: 1px gap over a line-colored ground paints hairlines between cells, wrap-safe */
|
|
18352
|
-
.ss-w-ecard-strip { display: grid; gap: 1px; background: var(--ss-w-line); border-top: 1px solid var(--ss-w-line); }
|
|
18369
|
+
.ss-w-ecard-strip { display: grid; gap: 1px; background: var(--ss-w-line); border-top: 1px solid var(--ss-w-line); max-height: calc(2 * 68px + 1px); overflow-y: auto; overscroll-behavior: contain; }
|
|
18370
|
+
.ss-w-ecard-strip--noted { max-height: calc(2 * 86px + 1px); }
|
|
18371
|
+
.ss-w-ecard-strip--more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent); }
|
|
18353
18372
|
.ss-w-ecard-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding: 10px 4px 11px; background: var(--ss-w-panel); }
|
|
18354
18373
|
.ss-w-ecard-cval { height: 20px; display: flex; align-items: center; font-size: 17px; font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
|
|
18355
18374
|
.ss-w-ecard-cval .ss-w-form { width: 42px; }
|
|
18356
|
-
.ss-w-ecard-clabel { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--ss-w-faint); font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
18375
|
+
.ss-w-ecard-clabel { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--ss-w-faint); font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
18376
|
+
.ss-w-ecard-cell--muted > * { opacity: .55; }
|
|
18377
|
+
.ss-w-ecard-note { font-size: 9.5px; color: var(--ss-w-faint); font-style: italic; }
|
|
18378
|
+
.ss-w-ecard-period { font-size: 10.5px; color: var(--ss-w-faint); padding: 6px 13px 8px; border-top: 1px solid var(--ss-w-line); }
|
|
18379
|
+
.ss-w-ecard-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; font-weight: 650; color: var(--ss-w-ink); border: 1px solid var(--ss-w-line); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
|
|
18357
18380
|
|
|
18358
18381
|
.ss-w-form { justify-self: end; display: flex; height: 6px; width: 48px; border-radius: 4px; overflow: hidden; gap: 2px; }
|
|
18359
18382
|
.ss-w-form span { display: block; border-radius: 2px; }
|