@sensiblestats/widget-react 0.86.0 → 0.86.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.86.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 85b742d: Fix the live-score scorers line always rendering under the away team; it now renders under whichever team actually scored, matching the match-events timeline below it.
8
+
3
9
  ## 0.86.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -5663,11 +5663,14 @@ function LiveCrest({ url, name, side }) {
5663
5663
  }
5664
5664
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: `${cls} ss-w-fandash-live-crest--fallback`, "aria-hidden": "true", children: initials5(name) });
5665
5665
  }
5666
- function scorersLine(goalEvents) {
5667
- if (!goalEvents || goalEvents.length === 0) return null;
5666
+ function scorersBySide(goalEvents) {
5667
+ if (!goalEvents || goalEvents.length === 0) return { home: null, away: null };
5668
5668
  const named = goalEvents.filter((e) => e.type === "goal" && e.player);
5669
- if (named.length === 0) return null;
5670
- return named.slice().sort((a, b) => a.minute - b.minute).map((e) => `${e.player} ${e.minuteLabel}`).join(", ");
5669
+ const line = (side) => {
5670
+ const scorers = named.filter((e) => e.side === side).slice().sort((a, b) => a.minute - b.minute).map((e) => `${e.player} ${e.minuteLabel}`);
5671
+ return scorers.length === 0 ? null : scorers.join(", ");
5672
+ };
5673
+ return { home: line("home"), away: line("away") };
5671
5674
  }
5672
5675
  function LiveScoreCard({
5673
5676
  card,
@@ -5681,7 +5684,7 @@ function LiveScoreCard({
5681
5684
  }
5682
5685
  const displayMinute = useLiveClock(data.minute, data.clockRunning, seedRef.current.receivedAtMs);
5683
5686
  const minuteSuffix = data.minuteLabel.replace(/^\d+/, "");
5684
- const scorers = scorersLine(goalEvents);
5687
+ const { home: homeScorers, away: awayScorers } = scorersBySide(goalEvents);
5685
5688
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ss-w-fandash-card ss-w-fandash-live-score", children: [
5686
5689
  card.title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
5687
5690
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ss-w-fandash-live-top", children: [
@@ -5707,9 +5710,15 @@ function LiveScoreCard({
5707
5710
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ss-w-fandash-live-team-name", children: data.awayName })
5708
5711
  ] })
5709
5712
  ] }),
5710
- scorers ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ss-w-fandash-live-scorers", children: [
5711
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ss-w-fandash-live-scorers-icon", "aria-hidden": "true", children: "\u26BD" }),
5712
- scorers
5713
+ homeScorers || awayScorers ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ss-w-fandash-live-scorers-row", children: [
5714
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "ss-w-fandash-live-scorers ss-w-fandash-live-scorers--home", children: homeScorers ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
5715
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ss-w-fandash-live-scorers-icon", "aria-hidden": "true", children: "\u26BD" }),
5716
+ homeScorers
5717
+ ] }) : null }),
5718
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "ss-w-fandash-live-scorers ss-w-fandash-live-scorers--away", children: awayScorers ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
5719
+ awayScorers,
5720
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ss-w-fandash-live-scorers-icon", "aria-hidden": "true", children: "\u26BD" })
5721
+ ] }) : null })
5713
5722
  ] }) : null
5714
5723
  ] });
5715
5724
  }
@@ -12210,8 +12219,13 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
12210
12219
  .ss-w-fandash-live-team-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 700; line-height: 1.15; color: var(--ss-w-ink); }
12211
12220
  .ss-w-fandash-live-score-main { display: flex; align-items: baseline; justify-content: center; font-size: 36px; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; color: var(--ss-w-ink); }
12212
12221
  .ss-w-fandash-live-score-sep { color: var(--ss-w-faint); font-weight: 500; margin: 0 5px; }
12213
- .ss-w-fandash-live-scorers { margin-top: 12px; display: flex; justify-content: flex-end; gap: 7px; align-items: center; font-size: 12.5px; color: var(--ss-w-faint); overflow-wrap: anywhere; }
12214
- .ss-w-fandash-live-scorers-icon { flex: none; color: var(--ss-w-away); }
12222
+ .ss-w-fandash-live-scorers-row { margin-top: 12px; display: flex; justify-content: space-between; gap: 10px; }
12223
+ .ss-w-fandash-live-scorers { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.5px; color: var(--ss-w-faint); overflow-wrap: anywhere; }
12224
+ .ss-w-fandash-live-scorers--home { justify-content: flex-start; }
12225
+ .ss-w-fandash-live-scorers--away { justify-content: flex-end; }
12226
+ .ss-w-fandash-live-scorers--home .ss-w-fandash-live-scorers-icon { color: var(--ss-w-home); }
12227
+ .ss-w-fandash-live-scorers--away .ss-w-fandash-live-scorers-icon { color: var(--ss-w-away); }
12228
+ .ss-w-fandash-live-scorers-icon { flex: none; }
12215
12229
 
12216
12230
  /* live timeline: a compact two-sided event list down a centre spine -- each club's events sit on
12217
12231
  its own side (home left, away right), most-recent 3 shown with a "See more" toggle for the