@sensiblestats/widget-react 0.32.1 → 0.33.1
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 +17 -0
- package/dist/index.cjs +59 -28
- 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 +59 -28
- package/dist/index.js.map +1 -1
- package/dist/styles.css +9 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.33.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c60b673: Club widget now swaps the live dashboard for the post-match dashboard when a match ends, instead of leaving the last live card frozen on screen.
|
|
8
|
+
|
|
9
|
+
## 0.33.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Live monitor's momentum block gets a localized "Momentum" title with the home/away pressure split (styled like the card's other stat rows), and its end-of-series marker is now an HTML overlay dot instead of an SVG `<circle>` -- the wave's `preserveAspectRatio="none"` scaling was stretching the circle into a squashed, half-clipped oval. `LiveMonitorMatch` gains an additive `momentumHomePct` field.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @sensiblestats/widget-sdk@0.29.0
|
|
19
|
+
|
|
3
20
|
## 0.32.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -119,7 +119,8 @@ var STRINGS = {
|
|
|
119
119
|
suspendedLabel: "Suspended",
|
|
120
120
|
fullTimeLabel: "Full time",
|
|
121
121
|
inSlipLabel: "In slip",
|
|
122
|
-
oddsUnavailable: "Odds unavailable right now"
|
|
122
|
+
oddsUnavailable: "Odds unavailable right now",
|
|
123
|
+
momentumLabel: "Momentum"
|
|
123
124
|
},
|
|
124
125
|
tr: {
|
|
125
126
|
launcherLabel: "SensibleStats ile sohbet et",
|
|
@@ -187,7 +188,8 @@ var STRINGS = {
|
|
|
187
188
|
suspendedLabel: "Ask\u0131da",
|
|
188
189
|
fullTimeLabel: "Ma\xE7 sonu",
|
|
189
190
|
inSlipLabel: "Kuponda",
|
|
190
|
-
oddsUnavailable: "Oranlar \u015Fu anda kullan\u0131lam\u0131yor"
|
|
191
|
+
oddsUnavailable: "Oranlar \u015Fu anda kullan\u0131lam\u0131yor",
|
|
192
|
+
momentumLabel: "Momentum"
|
|
191
193
|
}
|
|
192
194
|
};
|
|
193
195
|
function resolveLocaleStrings(locale) {
|
|
@@ -268,7 +270,8 @@ function normalizeUi(cfg) {
|
|
|
268
270
|
suspendedLabel: strings.suspendedLabel,
|
|
269
271
|
fullTimeLabel: strings.fullTimeLabel,
|
|
270
272
|
inSlipLabel: strings.inSlipLabel,
|
|
271
|
-
oddsUnavailable: strings.oddsUnavailable
|
|
273
|
+
oddsUnavailable: strings.oddsUnavailable,
|
|
274
|
+
momentumLabel: strings.momentumLabel
|
|
272
275
|
};
|
|
273
276
|
}
|
|
274
277
|
function toClientOptions(cfg) {
|
|
@@ -784,6 +787,9 @@ function useLiveDashboardPoll({ messages, dispatch, getLiveDashboard }) {
|
|
|
784
787
|
} else {
|
|
785
788
|
dispatch({ kind: "LIVE_REFRESH", messageId: current.messageId, cards: payload.cards, greeting: payload.greeting });
|
|
786
789
|
}
|
|
790
|
+
} else if (payload?.phase === "postMatch" && current.kind === "live") {
|
|
791
|
+
dispatch({ kind: "LIVE_TRANSITION", messageId: current.messageId, dashboard: payload });
|
|
792
|
+
window.clearInterval(id);
|
|
787
793
|
} else {
|
|
788
794
|
if (current.kind === "live") {
|
|
789
795
|
window.clearInterval(id);
|
|
@@ -2511,7 +2517,8 @@ function buildPaths(points) {
|
|
|
2511
2517
|
const area = `M0,${BASELINE} L${linePts.join(" L")} L${WIDTH},${BASELINE} Z`;
|
|
2512
2518
|
const line = `M${linePts.join(" L")}`;
|
|
2513
2519
|
const lastValue = points[lastIndex]?.value ?? 0;
|
|
2514
|
-
|
|
2520
|
+
const lastLeftPct = lastIndex === 0 ? 0 : 100;
|
|
2521
|
+
return { area, line, lastLeftPct, lastTopPx: py(lastValue) };
|
|
2515
2522
|
}
|
|
2516
2523
|
function MomentumWave({
|
|
2517
2524
|
points,
|
|
@@ -2519,7 +2526,7 @@ function MomentumWave({
|
|
|
2519
2526
|
clubIsHome
|
|
2520
2527
|
}) {
|
|
2521
2528
|
if (points.length === 0) return null;
|
|
2522
|
-
const { area, line,
|
|
2529
|
+
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
2523
2530
|
const clipId = (0, import_react17.useId)();
|
|
2524
2531
|
const topClipId = `${clipId}-top`;
|
|
2525
2532
|
const bottomClipId = `${clipId}-bottom`;
|
|
@@ -2527,27 +2534,36 @@ function MomentumWave({
|
|
|
2527
2534
|
const bottomClass = clubIsHome ? "ss-w-fandash-live-mom-away" : "ss-w-fandash-live-mom-home";
|
|
2528
2535
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-fandash-live-mom", children: [
|
|
2529
2536
|
caption ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ss-w-fandash-live-mom-caption", children: caption }) : null,
|
|
2530
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-fandash-live-mom-plot", children: [
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2539
|
+
"svg",
|
|
2540
|
+
{
|
|
2541
|
+
className: "ss-w-fandash-live-mom-svg",
|
|
2542
|
+
viewBox: `0 0 ${WIDTH} ${HEIGHT}`,
|
|
2543
|
+
preserveAspectRatio: "none",
|
|
2544
|
+
role: "img",
|
|
2545
|
+
"aria-label": caption ?? "Momentum",
|
|
2546
|
+
children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("defs", { children: [
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("clipPath", { id: topClipId, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("rect", { x: 0, y: 0, width: WIDTH, height: BASELINE }) }),
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("clipPath", { id: bottomClipId, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("rect", { x: 0, y: BASELINE, width: WIDTH, height: HEIGHT - BASELINE }) })
|
|
2550
|
+
] }),
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: area, className: topClass, clipPath: `url(#${topClipId})` }),
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: area, className: bottomClass, clipPath: `url(#${bottomClipId})` }),
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: 0, y1: BASELINE, x2: WIDTH, y2: BASELINE, className: "ss-w-fandash-live-mom-base" }),
|
|
2554
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: line, className: "ss-w-fandash-live-mom-line", vectorEffect: "non-scaling-stroke" })
|
|
2555
|
+
]
|
|
2556
|
+
}
|
|
2557
|
+
),
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2559
|
+
"span",
|
|
2560
|
+
{
|
|
2561
|
+
className: "ss-w-fandash-live-mom-now",
|
|
2562
|
+
style: { left: `clamp(4px, ${lastLeftPct}%, calc(100% - 4px))`, top: `${lastTopPx}px` },
|
|
2563
|
+
"aria-hidden": "true"
|
|
2564
|
+
}
|
|
2565
|
+
)
|
|
2566
|
+
] })
|
|
2551
2567
|
] });
|
|
2552
2568
|
}
|
|
2553
2569
|
|
|
@@ -2917,7 +2933,14 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip }) {
|
|
|
2917
2933
|
] }, row.label);
|
|
2918
2934
|
}) }),
|
|
2919
2935
|
match.status === "stale" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc)) }),
|
|
2920
|
-
match.momentum.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.
|
|
2936
|
+
match.momentum.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ss-w-mon-mom", children: [
|
|
2937
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ss-w-mon-stat-row", children: [
|
|
2938
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-mon-stat-v ss-w-mon-stat-v--home", children: typeof match.momentumHomePct === "number" ? `${match.momentumHomePct}%` : "" }),
|
|
2939
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-mon-stat-l", children: ui.momentumLabel }),
|
|
2940
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-mon-stat-v ss-w-mon-stat-v--away", children: typeof match.momentumHomePct === "number" ? `${100 - match.momentumHomePct}%` : "" })
|
|
2941
|
+
] }),
|
|
2942
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(MomentumWave, { points: match.momentum, clubIsHome: true })
|
|
2943
|
+
] }),
|
|
2921
2944
|
match.mainMarket && match.phase !== "fullTime" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(MarketOddsCardList, { cards: [toMarketOddsVM(match.mainMarket)], ui, slip }),
|
|
2922
2945
|
match.phase === "fullTime" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ss-w-mon-grace", children: ui.graceNote })
|
|
2923
2946
|
] });
|
|
@@ -3722,7 +3745,15 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
3722
3745
|
.ss-w-fandash-live-mom-away { fill: var(--ss-w-away); fill-opacity: .85; }
|
|
3723
3746
|
.ss-w-fandash-live-mom-line { fill: none; stroke: color-mix(in srgb, var(--ss-w-ink) 55%, transparent); stroke-width: 1.5; }
|
|
3724
3747
|
.ss-w-fandash-live-mom-base { stroke: var(--ss-w-line); stroke-width: 1; stroke-dasharray: 3 3; }
|
|
3725
|
-
.ss-w-fandash-live-mom-
|
|
3748
|
+
.ss-w-fandash-live-mom-plot { position: relative; }
|
|
3749
|
+
.ss-w-fandash-live-mom-now {
|
|
3750
|
+
position: absolute; width: 7px; height: 7px; border-radius: 50%;
|
|
3751
|
+
transform: translate(-50%, -50%);
|
|
3752
|
+
background: var(--ss-w-panel); border: 1.5px solid var(--ss-w-ink);
|
|
3753
|
+
pointer-events: none;
|
|
3754
|
+
}
|
|
3755
|
+
.ss-w-mon-mom { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--ss-w-line); }
|
|
3756
|
+
.ss-w-mon-mom .ss-w-fandash-live-mom { margin-top: 6px; padding-top: 0; border-top: none; }
|
|
3726
3757
|
|
|
3727
3758
|
.ss-w-fandash-live-legend { display: flex; gap: 14px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--ss-w-line); font-size: 11px; color: var(--ss-w-faint); }
|
|
3728
3759
|
.ss-w-fandash-live-legend-item { display: inline-flex; align-items: center; gap: 6px; }
|