@sensiblestats/widget-react 0.32.1 → 0.33.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @sensiblestats/widget-sdk@0.29.0
13
+
3
14
  ## 0.32.1
4
15
 
5
16
  ### 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) {
@@ -2511,7 +2514,8 @@ function buildPaths(points) {
2511
2514
  const area = `M0,${BASELINE} L${linePts.join(" L")} L${WIDTH},${BASELINE} Z`;
2512
2515
  const line = `M${linePts.join(" L")}`;
2513
2516
  const lastValue = points[lastIndex]?.value ?? 0;
2514
- return { area, line, lastX: px(lastIndex).toFixed(1), lastY: py(lastValue).toFixed(1) };
2517
+ const lastLeftPct = lastIndex === 0 ? 0 : 100;
2518
+ return { area, line, lastLeftPct, lastTopPx: py(lastValue) };
2515
2519
  }
2516
2520
  function MomentumWave({
2517
2521
  points,
@@ -2519,7 +2523,7 @@ function MomentumWave({
2519
2523
  clubIsHome
2520
2524
  }) {
2521
2525
  if (points.length === 0) return null;
2522
- const { area, line, lastX, lastY } = buildPaths(points);
2526
+ const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
2523
2527
  const clipId = (0, import_react17.useId)();
2524
2528
  const topClipId = `${clipId}-top`;
2525
2529
  const bottomClipId = `${clipId}-bottom`;
@@ -2527,27 +2531,36 @@ function MomentumWave({
2527
2531
  const bottomClass = clubIsHome ? "ss-w-fandash-live-mom-away" : "ss-w-fandash-live-mom-home";
2528
2532
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-fandash-live-mom", children: [
2529
2533
  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
- "svg",
2532
- {
2533
- className: "ss-w-fandash-live-mom-svg",
2534
- viewBox: `0 0 ${WIDTH} ${HEIGHT}`,
2535
- preserveAspectRatio: "none",
2536
- role: "img",
2537
- "aria-label": caption ?? "Momentum",
2538
- children: [
2539
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("defs", { children: [
2540
- /* @__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 }) }),
2541
- /* @__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 }) })
2542
- ] }),
2543
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: area, className: topClass, clipPath: `url(#${topClipId})` }),
2544
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: area, className: bottomClass, clipPath: `url(#${bottomClipId})` }),
2545
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: 0, y1: BASELINE, x2: WIDTH, y2: BASELINE, className: "ss-w-fandash-live-mom-base" }),
2546
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: line, className: "ss-w-fandash-live-mom-line", vectorEffect: "non-scaling-stroke" }),
2547
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("circle", { cx: lastX, cy: lastY, r: 3.2, className: "ss-w-fandash-live-mom-now", vectorEffect: "non-scaling-stroke" })
2548
- ]
2549
- }
2550
- )
2534
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-fandash-live-mom-plot", children: [
2535
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
2536
+ "svg",
2537
+ {
2538
+ className: "ss-w-fandash-live-mom-svg",
2539
+ viewBox: `0 0 ${WIDTH} ${HEIGHT}`,
2540
+ preserveAspectRatio: "none",
2541
+ role: "img",
2542
+ "aria-label": caption ?? "Momentum",
2543
+ children: [
2544
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("defs", { children: [
2545
+ /* @__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 }) }),
2546
+ /* @__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 }) })
2547
+ ] }),
2548
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: area, className: topClass, clipPath: `url(#${topClipId})` }),
2549
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: area, className: bottomClass, clipPath: `url(#${bottomClipId})` }),
2550
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: 0, y1: BASELINE, x2: WIDTH, y2: BASELINE, className: "ss-w-fandash-live-mom-base" }),
2551
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: line, className: "ss-w-fandash-live-mom-line", vectorEffect: "non-scaling-stroke" })
2552
+ ]
2553
+ }
2554
+ ),
2555
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2556
+ "span",
2557
+ {
2558
+ className: "ss-w-fandash-live-mom-now",
2559
+ style: { left: `clamp(4px, ${lastLeftPct}%, calc(100% - 4px))`, top: `${lastTopPx}px` },
2560
+ "aria-hidden": "true"
2561
+ }
2562
+ )
2563
+ ] })
2551
2564
  ] });
2552
2565
  }
2553
2566
 
@@ -2917,7 +2930,14 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip }) {
2917
2930
  ] }, row.label);
2918
2931
  }) }),
2919
2932
  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.jsx)(MomentumWave, { points: match.momentum, clubIsHome: true }),
2933
+ match.momentum.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ss-w-mon-mom", children: [
2934
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ss-w-mon-stat-row", children: [
2935
+ /* @__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}%` : "" }),
2936
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-mon-stat-l", children: ui.momentumLabel }),
2937
+ /* @__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}%` : "" })
2938
+ ] }),
2939
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(MomentumWave, { points: match.momentum, clubIsHome: true })
2940
+ ] }),
2921
2941
  match.mainMarket && match.phase !== "fullTime" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(MarketOddsCardList, { cards: [toMarketOddsVM(match.mainMarket)], ui, slip }),
2922
2942
  match.phase === "fullTime" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ss-w-mon-grace", children: ui.graceNote })
2923
2943
  ] });
@@ -3722,7 +3742,15 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
3722
3742
  .ss-w-fandash-live-mom-away { fill: var(--ss-w-away); fill-opacity: .85; }
3723
3743
  .ss-w-fandash-live-mom-line { fill: none; stroke: color-mix(in srgb, var(--ss-w-ink) 55%, transparent); stroke-width: 1.5; }
3724
3744
  .ss-w-fandash-live-mom-base { stroke: var(--ss-w-line); stroke-width: 1; stroke-dasharray: 3 3; }
3725
- .ss-w-fandash-live-mom-now { fill: var(--ss-w-panel); stroke: var(--ss-w-ink); stroke-width: 1.5; }
3745
+ .ss-w-fandash-live-mom-plot { position: relative; }
3746
+ .ss-w-fandash-live-mom-now {
3747
+ position: absolute; width: 7px; height: 7px; border-radius: 50%;
3748
+ transform: translate(-50%, -50%);
3749
+ background: var(--ss-w-panel); border: 1.5px solid var(--ss-w-ink);
3750
+ pointer-events: none;
3751
+ }
3752
+ .ss-w-mon-mom { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--ss-w-line); }
3753
+ .ss-w-mon-mom .ss-w-fandash-live-mom { margin-top: 6px; padding-top: 0; border-top: none; }
3726
3754
 
3727
3755
  .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
3756
  .ss-w-fandash-live-legend-item { display: inline-flex; align-items: center; gap: 6px; }