@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.133.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5c2225f: Entity card: asked stats with coverage notes, muted defaults, a period footer and a header chip; the stat strip is three columns and scrolls after two full rows (taller when a tile has a coverage note) and fades at the bottom edge when more than six tiles follow.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5c2225f]
|
|
12
|
+
- @sensiblestats/widget-sdk@0.95.0
|
|
13
|
+
|
|
3
14
|
## 0.132.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1324,7 +1324,7 @@ function parseOddsFormat(value) {
|
|
|
1324
1324
|
}
|
|
1325
1325
|
|
|
1326
1326
|
// src/version.generated.ts
|
|
1327
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1327
|
+
var WIDGET_REACT_VERSION = "0.133.0";
|
|
1328
1328
|
|
|
1329
1329
|
// src/config.ts
|
|
1330
1330
|
function hostTag(cfg) {
|
|
@@ -1887,7 +1887,9 @@ function readStatCells(raw) {
|
|
|
1887
1887
|
for (const entry of raw) {
|
|
1888
1888
|
const label = str(entry.label);
|
|
1889
1889
|
const value = num(entry.value) ?? str(entry.value);
|
|
1890
|
-
if (label
|
|
1890
|
+
if (label === void 0 || value === void 0) continue;
|
|
1891
|
+
const note = str(entry.note);
|
|
1892
|
+
cells.push({ label, value, ...note !== void 0 ? { note } : {}, ...entry.muted === true ? { muted: true } : {} });
|
|
1891
1893
|
}
|
|
1892
1894
|
return cells;
|
|
1893
1895
|
}
|
|
@@ -1901,6 +1903,7 @@ function toCardVM(card) {
|
|
|
1901
1903
|
competitionId: typeof s.competitionId === "number" ? s.competitionId : null,
|
|
1902
1904
|
label,
|
|
1903
1905
|
image: str(s.imagePath),
|
|
1906
|
+
period: str(s.period),
|
|
1904
1907
|
stats: readStatCells(s.stats)
|
|
1905
1908
|
};
|
|
1906
1909
|
}).filter((s) => s !== null) : [];
|
|
@@ -1911,6 +1914,7 @@ function toCardVM(card) {
|
|
|
1911
1914
|
image: str(card.imagePath) ?? str(card.imageUrl) ?? str(card.image_url) ?? str(card.logoUrl) ?? str(card.logo),
|
|
1912
1915
|
sub: str(card.subtitle) ?? str(card.teamName) ?? str(card.leagueName) ?? str(card.position),
|
|
1913
1916
|
season: str(card.seasonName),
|
|
1917
|
+
chip: str(card.chip),
|
|
1914
1918
|
scopes
|
|
1915
1919
|
};
|
|
1916
1920
|
}
|
|
@@ -7767,23 +7771,34 @@ function FormBar({ w, d, l }) {
|
|
|
7767
7771
|
l > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-form-l", style: { flexGrow: l } }) : null
|
|
7768
7772
|
] });
|
|
7769
7773
|
}
|
|
7774
|
+
function cellClass(s) {
|
|
7775
|
+
return s.muted ? "ss-w-ecard-cell ss-w-ecard-cell--muted" : "ss-w-ecard-cell";
|
|
7776
|
+
}
|
|
7770
7777
|
function StatCellView({ s }) {
|
|
7771
7778
|
const m = RECORD_RE.exec(s.value);
|
|
7772
7779
|
if (m) {
|
|
7773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className:
|
|
7780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cellClass(s), children: [
|
|
7774
7781
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-cval", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FormBar, { w: Number(m[1]), d: Number(m[2]), l: Number(m[3]) }) }),
|
|
7775
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.value })
|
|
7782
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.value }),
|
|
7783
|
+
s.note ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-note", children: s.note }) : null
|
|
7776
7784
|
] });
|
|
7777
7785
|
}
|
|
7778
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className:
|
|
7786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cellClass(s), children: [
|
|
7779
7787
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-cval", children: s.value }),
|
|
7780
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.label })
|
|
7788
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-clabel", children: s.label }),
|
|
7789
|
+
s.note ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-note", children: s.note }) : null
|
|
7781
7790
|
] });
|
|
7782
7791
|
}
|
|
7792
|
+
function stripClass(stats) {
|
|
7793
|
+
const noted = stats.some((s) => s.note);
|
|
7794
|
+
return ["ss-w-ecard-strip", noted ? "ss-w-ecard-strip--noted" : "", stats.length > 6 ? "ss-w-ecard-strip--more" : ""].filter(Boolean).join(" ");
|
|
7795
|
+
}
|
|
7783
7796
|
function StatStrip({ stats }) {
|
|
7784
7797
|
if (stats.length === 0) return null;
|
|
7785
|
-
|
|
7786
|
-
|
|
7798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: stripClass(stats), style: { gridTemplateColumns: "repeat(3, minmax(0, 1fr))" }, children: [
|
|
7799
|
+
stats.map((s) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StatCellView, { s }, s.label + s.value)),
|
|
7800
|
+
Array.from({ length: (3 - stats.length % 3) % 3 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ss-w-ecard-cell", "aria-hidden": "true" }, `pad${i}`))
|
|
7801
|
+
] });
|
|
7787
7802
|
}
|
|
7788
7803
|
function CardHeader({ c, showScopeCrest }) {
|
|
7789
7804
|
const onlyScope = c.scopes.length === 1 ? c.scopes[0] : null;
|
|
@@ -7802,6 +7817,7 @@ function CardHeader({ c, showScopeCrest }) {
|
|
|
7802
7817
|
] }),
|
|
7803
7818
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "ss-w-ecard-meta", children: [
|
|
7804
7819
|
showScopeCrest && onlyScope?.image ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Crest2, { image: onlyScope.image, label: onlyScope.label }) : null,
|
|
7820
|
+
c.chip ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-chip", children: c.chip }) : null,
|
|
7805
7821
|
c.season ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ss-w-ecard-season", children: shortSeason(c.season) }) : null
|
|
7806
7822
|
] })
|
|
7807
7823
|
] });
|
|
@@ -7833,7 +7849,8 @@ function EntityCardItem({ c }) {
|
|
|
7833
7849
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ss-w-ecard", "data-kind": c.kind, children: [
|
|
7834
7850
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CardHeader, { c, showScopeCrest: !multi }),
|
|
7835
7851
|
multi ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ScopeTabs, { scopes: c.scopes, active, onSelect: setActive }) : null,
|
|
7836
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StatStrip, { stats: scope.stats })
|
|
7852
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StatStrip, { stats: scope.stats }),
|
|
7853
|
+
scope.period ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ss-w-ecard-period", children: scope.period }) : null
|
|
7837
7854
|
] });
|
|
7838
7855
|
}
|
|
7839
7856
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
@@ -18360,7 +18377,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18360
18377
|
/* Entity card: identity header row over a horizontal stat strip */
|
|
18361
18378
|
.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; }
|
|
18362
18379
|
|
|
18363
|
-
.ss-w-ecard-idtext { display: flex; flex-direction: column; gap: 1px; min-width:
|
|
18380
|
+
.ss-w-ecard-idtext { display: flex; flex-direction: column; gap: 1px; min-width: 45%; max-width: 100%; flex: 1 1 0; }
|
|
18364
18381
|
.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); }
|
|
18365
18382
|
.ss-w-thumb.ss-w-team { border-radius: 12px; }
|
|
18366
18383
|
.ss-w-ecard[data-kind="player"] .ss-w-thumb { background-color: var(--ss-w-accent); }
|
|
@@ -18371,10 +18388,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18371
18388
|
.ss-w-ecard-bare { display: flex; align-items: center; }
|
|
18372
18389
|
.ss-w-ecard-bare .ss-w-ecard-hd { padding: 10px 12px; }
|
|
18373
18390
|
|
|
18374
|
-
.ss-w-ecard-hd { display: flex; align-items: center; gap: 11px; padding: 11px 13px; }
|
|
18391
|
+
.ss-w-ecard-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 11px; padding: 11px 13px; }
|
|
18375
18392
|
.ss-w-ecard-hd .ss-w-thumb { width: 40px; height: 40px; font-size: 13px; box-shadow: none; }
|
|
18376
18393
|
.ss-w-ecard-hd .ss-w-thumb.ss-w-team { border-radius: 10px; }
|
|
18377
|
-
.ss-w-ecard-meta { display: inline-flex; align-items: center; gap: 7px; flex:
|
|
18394
|
+
.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; }
|
|
18378
18395
|
.ss-w-ecard-meta .ss-w-ecard-season { margin: 0; }
|
|
18379
18396
|
|
|
18380
18397
|
/* scope tabs: reuse the underline pattern, relocated above the strip */
|
|
@@ -18388,11 +18405,17 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18388
18405
|
.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; }
|
|
18389
18406
|
|
|
18390
18407
|
/* stat strip: 1px gap over a line-colored ground paints hairlines between cells, wrap-safe */
|
|
18391
|
-
.ss-w-ecard-strip { display: grid; gap: 1px; background: var(--ss-w-line); border-top: 1px solid var(--ss-w-line); }
|
|
18408
|
+
.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; }
|
|
18409
|
+
.ss-w-ecard-strip--noted { max-height: calc(2 * 86px + 1px); }
|
|
18410
|
+
.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); }
|
|
18392
18411
|
.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); }
|
|
18393
18412
|
.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; }
|
|
18394
18413
|
.ss-w-ecard-cval .ss-w-form { width: 42px; }
|
|
18395
|
-
.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; }
|
|
18414
|
+
.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; }
|
|
18415
|
+
.ss-w-ecard-cell--muted > * { opacity: .55; }
|
|
18416
|
+
.ss-w-ecard-note { font-size: 9.5px; color: var(--ss-w-faint); font-style: italic; }
|
|
18417
|
+
.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); }
|
|
18418
|
+
.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; }
|
|
18396
18419
|
|
|
18397
18420
|
.ss-w-form { justify-self: end; display: flex; height: 6px; width: 48px; border-radius: 4px; overflow: hidden; gap: 2px; }
|
|
18398
18421
|
.ss-w-form span { display: block; border-radius: 2px; }
|