@sensiblestats/widget-react 0.140.0 → 0.141.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 +80 -26
- 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 +80 -26
- package/dist/index.js.map +1 -1
- package/dist/styles.css +7 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.141.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3e4fd4c: Write a player-prop leg's recent-games count ("went over in 7 of the last 10 games") under the leg in the combo builder, in every supported language. A leg with no fact renders as before. The tab strip fits narrow panels in every language: a tighter level draws the counts flat, and if the tabs still overflow the strip scrolls with an end fade, keeping a keyboard-focused tab clear of the fade.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [3e4fd4c]
|
|
12
|
+
- @sensiblestats/widget-sdk@0.103.0
|
|
13
|
+
|
|
3
14
|
## 0.140.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -323,6 +323,8 @@ var BUNDLED_EN_GB = {
|
|
|
323
323
|
"widget.presets.moreMatches": "More matches",
|
|
324
324
|
"widget.presets.changeCombo": "Change total or matches",
|
|
325
325
|
"widget.presets.standoutAsk": "Standout matches today",
|
|
326
|
+
"widget.presets.legFactOver": "Went over in {hits} of the last {games} games",
|
|
327
|
+
"widget.presets.legFactUnder": "Went under in {hits} of the last {games} games",
|
|
326
328
|
"widget.nba.with": "With",
|
|
327
329
|
"widget.nba.without": "Without",
|
|
328
330
|
"widget.nba.line": "Line",
|
|
@@ -1160,6 +1162,8 @@ var ROW_LEAVES = {
|
|
|
1160
1162
|
v8Hits: (c) => (hits, window2) => c.t("widget.v8Hits", { hits, window: window2 }),
|
|
1161
1163
|
"presets.comboDisplay": (c) => (legs, total) => c.t("widget.presets.comboDisplay", { legs, total }),
|
|
1162
1164
|
"presets.comboMessage": (c) => (legs, total) => c.t("widget.presets.comboMessage", { legs, total }),
|
|
1165
|
+
"presets.legFactOver": (c) => (hits, games) => c.t("widget.presets.legFactOver", { hits, games }),
|
|
1166
|
+
"presets.legFactUnder": (c) => (hits, games) => c.t("widget.presets.legFactUnder", { hits, games }),
|
|
1163
1167
|
"nba.over": (c) => (line) => c.t("widget.nba.over", { line }),
|
|
1164
1168
|
"nba.under": (c) => (line) => c.t("widget.nba.under", { line }),
|
|
1165
1169
|
"nba.lastN": (c) => (n) => c.t("widget.nba.lastN", { count: n }),
|
|
@@ -1338,7 +1342,7 @@ function parseOddsFormat(value) {
|
|
|
1338
1342
|
}
|
|
1339
1343
|
|
|
1340
1344
|
// src/version.generated.ts
|
|
1341
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1345
|
+
var WIDGET_REACT_VERSION = "0.141.0";
|
|
1342
1346
|
|
|
1343
1347
|
// src/config.ts
|
|
1344
1348
|
function hostTag(cfg) {
|
|
@@ -2181,6 +2185,9 @@ function toComboLegVM(leg) {
|
|
|
2181
2185
|
const hasStat = !!insightId && !!statText;
|
|
2182
2186
|
if (price === void 0 || matchOddsId === void 0 || matchId === void 0 || !home || !away || !selectionLabel) return null;
|
|
2183
2187
|
const line = str(leg.line);
|
|
2188
|
+
const rawFact = leg.fact && typeof leg.fact === "object" ? leg.fact : void 0;
|
|
2189
|
+
const direction2 = leg.direction === "over" || leg.direction === "under" ? leg.direction : void 0;
|
|
2190
|
+
const fact = rawFact && direction2 && Number.isInteger(rawFact.hits) && Number.isInteger(rawFact.games) && Number.isInteger(rawFact.window) && rawFact.games >= 5 && rawFact.hits >= 0 && rawFact.hits <= rawFact.games && rawFact.games <= rawFact.window ? { hits: rawFact.hits, games: rawFact.games, window: rawFact.window, direction: direction2 } : void 0;
|
|
2184
2191
|
return {
|
|
2185
2192
|
key: `${matchOddsId}`,
|
|
2186
2193
|
matchId,
|
|
@@ -2201,6 +2208,7 @@ function toComboLegVM(leg) {
|
|
|
2201
2208
|
matchOddsId,
|
|
2202
2209
|
quotedAtUtc: str(leg.quotedAtUtc),
|
|
2203
2210
|
...hasStat ? { insightId, statText } : {},
|
|
2211
|
+
...fact ? { fact } : {},
|
|
2204
2212
|
pinEnabled: leg.pinEnabled === true
|
|
2205
2213
|
};
|
|
2206
2214
|
}
|
|
@@ -8391,6 +8399,8 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
8391
8399
|
const kickoff = leg.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
8392
8400
|
const selection = addToSlipEnabled ? comboLegToSlipSelection(leg, slip.conversationId) : null;
|
|
8393
8401
|
const showPin = !!monitor && leg.pinEnabled;
|
|
8402
|
+
const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
|
|
8403
|
+
const line = leg.statText ?? factText;
|
|
8394
8404
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("li", { className: "ss-w-combo-leg", children: [
|
|
8395
8405
|
leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
|
|
8396
8406
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
|
|
@@ -8426,7 +8436,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
8426
8436
|
}
|
|
8427
8437
|
)
|
|
8428
8438
|
] }),
|
|
8429
|
-
|
|
8439
|
+
line ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ss-w-combo-leg-stat", children: line }) : null
|
|
8430
8440
|
] });
|
|
8431
8441
|
}
|
|
8432
8442
|
function ComboCardView({ vm, ui, slip, monitor }) {
|
|
@@ -10891,7 +10901,8 @@ var ChatInput = (0, import_react68.forwardRef)(function ChatInput2({ placeholder
|
|
|
10891
10901
|
// src/components/TabBar.tsx
|
|
10892
10902
|
var import_react69 = require("react");
|
|
10893
10903
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10894
|
-
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6];
|
|
10904
|
+
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
10905
|
+
var FOCUS_EDGE = 24;
|
|
10895
10906
|
function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled }) {
|
|
10896
10907
|
const tabs = [
|
|
10897
10908
|
{ tab: "chat", label: ui.tabChat, count: 0, dot: monitor.chatDot },
|
|
@@ -10924,11 +10935,15 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10924
10935
|
const strip = listRef.current;
|
|
10925
10936
|
if (!strip) return;
|
|
10926
10937
|
const measure = () => {
|
|
10938
|
+
strip.removeAttribute("data-scroll");
|
|
10927
10939
|
for (const tight of TIGHT_LEVELS) {
|
|
10928
10940
|
if (tight === 0) strip.removeAttribute("data-tight");
|
|
10929
10941
|
else strip.setAttribute("data-tight", String(tight));
|
|
10930
10942
|
if (strip.scrollWidth <= strip.clientWidth) return;
|
|
10931
10943
|
}
|
|
10944
|
+
strip.setAttribute("data-scroll", "");
|
|
10945
|
+
const on = strip.querySelector("[data-on]");
|
|
10946
|
+
if (on) strip.scrollLeft = Math.max(0, on.offsetLeft - 16);
|
|
10932
10947
|
};
|
|
10933
10948
|
measure();
|
|
10934
10949
|
const fonts = typeof document !== "undefined" ? document.fonts : void 0;
|
|
@@ -10940,31 +10955,63 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10940
10955
|
fonts?.removeEventListener?.("loadingdone", measure);
|
|
10941
10956
|
};
|
|
10942
10957
|
}, [labelSignature]);
|
|
10958
|
+
const pointerDown = (0, import_react69.useRef)(false);
|
|
10959
|
+
const keepFocusedTabInView = (e) => {
|
|
10960
|
+
const strip = e.currentTarget;
|
|
10961
|
+
const tab = e.target;
|
|
10962
|
+
if (pointerDown.current) {
|
|
10963
|
+
pointerDown.current = false;
|
|
10964
|
+
return;
|
|
10965
|
+
}
|
|
10966
|
+
if (!strip.hasAttribute("data-scroll") || !(tab instanceof HTMLElement) || tab === strip) return;
|
|
10967
|
+
const left = tab.offsetLeft - FOCUS_EDGE;
|
|
10968
|
+
const right = tab.offsetLeft + tab.offsetWidth + FOCUS_EDGE - strip.clientWidth;
|
|
10969
|
+
if (strip.scrollLeft > left) strip.scrollLeft = Math.max(0, left);
|
|
10970
|
+
else if (strip.scrollLeft < right) strip.scrollLeft = right;
|
|
10971
|
+
};
|
|
10943
10972
|
if (tabs.length < 2) return null;
|
|
10944
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
"
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
"aria-label": tab === "live" && count2 > 0 ? `${label} \xB7 ${ui.liveCountLabel(count2)}` : void 0,
|
|
10954
|
-
className: "ss-w-tab",
|
|
10955
|
-
onClick: () => {
|
|
10956
|
-
if (tab !== monitor.activeTab) track({ name: "tab_change", from: monitor.activeTab, to: tab });
|
|
10957
|
-
monitor.setActiveTab(tab);
|
|
10958
|
-
},
|
|
10959
|
-
children: [
|
|
10960
|
-
label,
|
|
10961
|
-
count2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-count", "aria-hidden": tab === "live" ? true : void 0, children: count2 }),
|
|
10962
|
-
dot && !active && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-dot", "aria-hidden": "true" })
|
|
10963
|
-
]
|
|
10973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10974
|
+
"div",
|
|
10975
|
+
{
|
|
10976
|
+
className: "ss-w-tabs",
|
|
10977
|
+
role: "tablist",
|
|
10978
|
+
ref: listRef,
|
|
10979
|
+
onFocus: keepFocusedTabInView,
|
|
10980
|
+
onPointerDown: () => {
|
|
10981
|
+
pointerDown.current = true;
|
|
10964
10982
|
},
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10983
|
+
onClick: () => {
|
|
10984
|
+
pointerDown.current = false;
|
|
10985
|
+
},
|
|
10986
|
+
onPointerCancel: () => {
|
|
10987
|
+
pointerDown.current = false;
|
|
10988
|
+
},
|
|
10989
|
+
children: tabs.map(({ tab, label, count: count2, dot }) => {
|
|
10990
|
+
const active = monitor.activeTab === tab;
|
|
10991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
10992
|
+
"button",
|
|
10993
|
+
{
|
|
10994
|
+
type: "button",
|
|
10995
|
+
role: "tab",
|
|
10996
|
+
"aria-selected": active,
|
|
10997
|
+
"data-on": active ? "" : void 0,
|
|
10998
|
+
"aria-label": tab === "live" && count2 > 0 ? `${label} \xB7 ${ui.liveCountLabel(count2)}` : void 0,
|
|
10999
|
+
className: "ss-w-tab",
|
|
11000
|
+
onClick: () => {
|
|
11001
|
+
if (tab !== monitor.activeTab) track({ name: "tab_change", from: monitor.activeTab, to: tab });
|
|
11002
|
+
monitor.setActiveTab(tab);
|
|
11003
|
+
},
|
|
11004
|
+
children: [
|
|
11005
|
+
label,
|
|
11006
|
+
count2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-count", "aria-hidden": tab === "live" ? true : void 0, children: count2 }),
|
|
11007
|
+
dot && !active && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-dot", "aria-hidden": "true" })
|
|
11008
|
+
]
|
|
11009
|
+
},
|
|
11010
|
+
tab
|
|
11011
|
+
);
|
|
11012
|
+
})
|
|
11013
|
+
}
|
|
11014
|
+
);
|
|
10968
11015
|
}
|
|
10969
11016
|
|
|
10970
11017
|
// src/components/MonitorTabs.tsx
|
|
@@ -19710,6 +19757,13 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
19710
19757
|
.ss-w-tabs[data-tight="5"] .ss-w-tab { font-size: 11px; }
|
|
19711
19758
|
.ss-w-tabs[data-tight="6"] .ss-w-tab { font-size: 11px; padding-left: 2px; padding-right: 2px; gap: 3px; letter-spacing: -.01em; }
|
|
19712
19759
|
.ss-w-tabs[data-tight="6"] .ss-w-tab-count { padding-left: 3px; padding-right: 3px; }
|
|
19760
|
+
.ss-w-tabs[data-tight="7"], .ss-w-tabs[data-scroll] { gap: 0; }
|
|
19761
|
+
.ss-w-tabs[data-tight="7"] .ss-w-tab { font-size: 11px; padding-left: 2px; padding-right: 2px; gap: 3px; letter-spacing: -.01em; }
|
|
19762
|
+
.ss-w-tabs[data-tight="7"] .ss-w-tab-count { background: none; padding: 0; min-width: 0; }
|
|
19763
|
+
.ss-w-tabs[data-scroll] { overflow-x: auto; scrollbar-width: none; scroll-padding-inline: 16px 24px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); }
|
|
19764
|
+
.ss-w-tabs[data-scroll]::-webkit-scrollbar { display: none; }
|
|
19765
|
+
/* A flex item, not padding: WebKit leaves a flex scroller's end padding out of the scroll range, so the fade would cover the last tab. */
|
|
19766
|
+
.ss-w-tabs[data-scroll]::after { content: ''; flex: 0 0 24px; }
|
|
19713
19767
|
.ss-w-tab-count { font-size: 10.5px; font-weight: 700; color: var(--ss-w-faint); background: var(--ss-w-bubble); border-radius: 999px; padding: 1px 6px; }
|
|
19714
19768
|
.ss-w-tab[data-on] .ss-w-tab-count { color: var(--ss-w-accent); }
|
|
19715
19769
|
/* The dot sits on the tab's corner and takes no width: a poll landing late must not push the last tab out of a strip that already fits to the pixel */
|