@sensiblestats/widget-react 0.73.0 → 0.74.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 +12 -0
- package/dist/index.cjs +74 -11
- 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 +74 -11
- package/dist/index.js.map +1 -1
- package/dist/styles.css +14 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -149,7 +149,11 @@ var STRINGS = {
|
|
|
149
149
|
maxPriceName: "Max price",
|
|
150
150
|
minPriceName: "Lowest price",
|
|
151
151
|
notToday: " \xB7 not today",
|
|
152
|
-
changeCombo: "Change total or matches"
|
|
152
|
+
changeCombo: "Change total or matches",
|
|
153
|
+
marketRow: "{market} picks today",
|
|
154
|
+
marketName: "Market",
|
|
155
|
+
marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "BTTS", DOUBLE_CHANCE: "Double chance", FULLTIME_RESULT: "Match winner" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
|
|
156
|
+
marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`
|
|
153
157
|
},
|
|
154
158
|
games: {
|
|
155
159
|
lang: "en",
|
|
@@ -483,7 +487,11 @@ var STRINGS = {
|
|
|
483
487
|
maxPriceName: "En y\xFCksek oran",
|
|
484
488
|
minPriceName: "En d\xFC\u015F\xFCk oran",
|
|
485
489
|
notToday: " \xB7 bug\xFCn yok",
|
|
486
|
-
changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir"
|
|
490
|
+
changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir",
|
|
491
|
+
marketRow: "Bug\xFCnk\xFC {market} se\xE7imleri",
|
|
492
|
+
marketName: "Bahis t\xFCr\xFC",
|
|
493
|
+
marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "KG Var", DOUBLE_CHANCE: "\xC7ifte \u015Fans", FULLTIME_RESULT: "Ma\xE7 sonucu" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
|
|
494
|
+
marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`
|
|
487
495
|
},
|
|
488
496
|
games: {
|
|
489
497
|
lang: "tr",
|
|
@@ -2939,6 +2947,16 @@ function comboAsk(cell, s) {
|
|
|
2939
2947
|
preset: { kind: "combo", total: cell.total, legs: cell.legs, ...idsOf(cell.combo.legs) }
|
|
2940
2948
|
};
|
|
2941
2949
|
}
|
|
2950
|
+
function marketAsk(cell, s) {
|
|
2951
|
+
return {
|
|
2952
|
+
message: s.marketMessage(cell.marketLabel, cell.selectionLabel ?? null, cell.count),
|
|
2953
|
+
displayText: marketDisplay(cell, s),
|
|
2954
|
+
preset: { kind: "market", marketDeveloperName: cell.marketDeveloperName, ...idsOf(cell.picks) }
|
|
2955
|
+
};
|
|
2956
|
+
}
|
|
2957
|
+
function marketDisplay(cell, s) {
|
|
2958
|
+
return s.marketRow.replace("{market}", s.marketShort(cell.marketDeveloperName, cell.marketLabel, cell.selectionLabel ?? null));
|
|
2959
|
+
}
|
|
2942
2960
|
|
|
2943
2961
|
// src/usePresetGrid.ts
|
|
2944
2962
|
var GRID_MAX_AGE_MS = 6e5;
|
|
@@ -2986,7 +3004,7 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
|
2986
3004
|
return grid;
|
|
2987
3005
|
}
|
|
2988
3006
|
function hasAnyCell(grid) {
|
|
2989
|
-
return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0;
|
|
3007
|
+
return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0 || grid.markets !== void 0 && grid.markets.length > 0;
|
|
2990
3008
|
}
|
|
2991
3009
|
|
|
2992
3010
|
// src/liveClock.ts
|
|
@@ -4162,11 +4180,13 @@ function HeroTile({ tile, onTap, oddsLabel }) {
|
|
|
4162
4180
|
] })
|
|
4163
4181
|
] });
|
|
4164
4182
|
}
|
|
4165
|
-
function DashboardTile({ tile, onTap, oddsLabel = "Odds" }) {
|
|
4183
|
+
function DashboardTile({ tile, onTap, oddsLabel = "Odds", badgePlacement = "meta" }) {
|
|
4166
4184
|
if (tile.emphasis === "hero") return /* @__PURE__ */ jsx20(HeroTile, { tile, onTap, oddsLabel });
|
|
4167
4185
|
const spanClass = tile.span === "full" ? "ss-w-dash-tile--full" : "ss-w-dash-tile--half";
|
|
4168
4186
|
const crests = (tile.imageUrls ?? []).slice(0, MAX_CRESTS);
|
|
4169
|
-
const
|
|
4187
|
+
const endBadge = badgePlacement === "end" && tile.badgeText ? tile.badgeText : null;
|
|
4188
|
+
const metaBadge = endBadge ? null : tile.badgeText;
|
|
4189
|
+
const hasMeta = Boolean(metaBadge) || crests.length > 0;
|
|
4170
4190
|
return /* @__PURE__ */ jsxs16("button", { type: "button", className: `ss-w-dash-tile ${spanClass}`, onClick: onTap, children: [
|
|
4171
4191
|
/* @__PURE__ */ jsx20("span", { className: "ss-w-dash-tile-icon", children: /* @__PURE__ */ jsx20(DashboardIcon, { name: tile.icon }) }),
|
|
4172
4192
|
/* @__PURE__ */ jsxs16("span", { className: "ss-w-dash-tile-body", children: [
|
|
@@ -4177,12 +4197,12 @@ function DashboardTile({ tile, onTap, oddsLabel = "Odds" }) {
|
|
|
4177
4197
|
// icon/chevron row -- at the half-span tile's ~180px width a nowrap badge alone
|
|
4178
4198
|
// (~70px) left the title column at ~22px and forced character-by-character wrapping.
|
|
4179
4199
|
/* @__PURE__ */ jsxs16("span", { className: "ss-w-dash-tile-meta", children: [
|
|
4180
|
-
|
|
4200
|
+
metaBadge ? /* @__PURE__ */ jsx20("span", { className: "ss-w-dash-tile-badge", children: metaBadge }) : null,
|
|
4181
4201
|
crests.length > 0 ? /* @__PURE__ */ jsx20("span", { className: "ss-w-dash-tile-crests", children: crests.map((url, i) => /* @__PURE__ */ jsx20("span", { className: "ss-w-dash-tile-crest", style: { backgroundImage: `url(${url})` }, "aria-hidden": "true" }, `${url}-${i}`)) }) : null
|
|
4182
4202
|
] })
|
|
4183
4203
|
) : null
|
|
4184
4204
|
] }),
|
|
4185
|
-
/* @__PURE__ */ jsx20("span", { className: "ss-w-dash-tile-chevron", children: /* @__PURE__ */ jsx20(ChevronIcon, {}) })
|
|
4205
|
+
endBadge ? /* @__PURE__ */ jsx20("span", { className: "ss-w-dash-tile-value", children: endBadge }) : /* @__PURE__ */ jsx20("span", { className: "ss-w-dash-tile-chevron", children: /* @__PURE__ */ jsx20(ChevronIcon, {}) })
|
|
4186
4206
|
] });
|
|
4187
4207
|
}
|
|
4188
4208
|
|
|
@@ -4197,12 +4217,14 @@ function layoutClass(layout) {
|
|
|
4197
4217
|
return Object.prototype.hasOwnProperty.call(LAYOUT_CLASSES, layout) ? LAYOUT_CLASSES[layout] : LAYOUT_CLASSES.goal;
|
|
4198
4218
|
}
|
|
4199
4219
|
function GreetingDashboard({ dashboard, onTap, oddsLabel }) {
|
|
4200
|
-
|
|
4220
|
+
const layout = layoutClass(dashboard.layout);
|
|
4221
|
+
const badgePlacement = layout === LAYOUT_CLASSES.goal ? "end" : "meta";
|
|
4222
|
+
return /* @__PURE__ */ jsxs17("div", { className: `ss-w-dash ${layout}`, children: [
|
|
4201
4223
|
/* @__PURE__ */ jsxs17("div", { className: "ss-w-dash-head", children: [
|
|
4202
4224
|
/* @__PURE__ */ jsx21("span", { className: "ss-w-dash-title", children: dashboard.title }),
|
|
4203
4225
|
dashboard.subtitle ? /* @__PURE__ */ jsx21("span", { className: "ss-w-dash-subtitle", children: dashboard.subtitle }) : null
|
|
4204
4226
|
] }),
|
|
4205
|
-
/* @__PURE__ */ jsx21("div", { className: "ss-w-dash-grid", children: dashboard.tiles.map((t, i) => /* @__PURE__ */ jsx21(DashboardTile, { tile: t, onTap: () => onTap(t, i), oddsLabel }, `${t.title}-${i}`)) }),
|
|
4227
|
+
/* @__PURE__ */ jsx21("div", { className: "ss-w-dash-grid", children: dashboard.tiles.map((t, i) => /* @__PURE__ */ jsx21(DashboardTile, { tile: t, onTap: () => onTap(t, i), oddsLabel, badgePlacement }, `${t.title}-${i}`)) }),
|
|
4206
4228
|
dashboard.footerTip ? /* @__PURE__ */ jsx21("span", { className: "ss-w-dash-foot", children: dashboard.footerTip }) : null
|
|
4207
4229
|
] });
|
|
4208
4230
|
}
|
|
@@ -8692,6 +8714,13 @@ function NumberSelect({ current, choices: choices2, label, notToday, lockEmpty =
|
|
|
8692
8714
|
}, children: choices2.map((c, i) => /* @__PURE__ */ jsx90("option", { value: String(i), disabled: lockEmpty && !c.available && i !== selected, children: c.available ? c.text : `${c.text}${notToday}` }, i)) })
|
|
8693
8715
|
] });
|
|
8694
8716
|
}
|
|
8717
|
+
function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
|
|
8718
|
+
const sizeText = sizeLabels[currentIdx] ?? "";
|
|
8719
|
+
return /* @__PURE__ */ jsxs75("span", { className: "ss-w-tool-num", children: [
|
|
8720
|
+
/* @__PURE__ */ jsx90("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: sizeText }),
|
|
8721
|
+
/* @__PURE__ */ jsx90("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(currentIdx), onChange: (e) => onChoose(Number(e.target.value)), children: optionLabels.map((opt, i) => /* @__PURE__ */ jsx90("option", { value: String(i), children: opt }, i)) })
|
|
8722
|
+
] });
|
|
8723
|
+
}
|
|
8695
8724
|
function SendButton({ label, display, disabled, onClick }) {
|
|
8696
8725
|
return /* @__PURE__ */ jsx90("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
|
|
8697
8726
|
}
|
|
@@ -8755,6 +8784,11 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
8755
8784
|
const comboCell = findCombo(grid, total, legs);
|
|
8756
8785
|
const bigCell = findCombo(grid, bigTotal, bigLegs);
|
|
8757
8786
|
const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
|
|
8787
|
+
const chooseMarket = (idx) => {
|
|
8788
|
+
setMarketIdx(idx);
|
|
8789
|
+
const cell = markets[idx];
|
|
8790
|
+
if (cell) announce(marketDisplay(cell, strings), cell.count > 0);
|
|
8791
|
+
};
|
|
8758
8792
|
const chooseMax = (v) => {
|
|
8759
8793
|
setMaxPrice(v);
|
|
8760
8794
|
announce(strings.maxPriceDisplay(count, v), !!findSingles(grid.singles, v, count));
|
|
@@ -8787,6 +8821,10 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
8787
8821
|
const minChoices = floors.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singlesFrom, v, count) }));
|
|
8788
8822
|
const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
|
|
8789
8823
|
const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
|
|
8824
|
+
const markets = grid.markets ?? [];
|
|
8825
|
+
const [marketIdx, setMarketIdx] = useState41(0);
|
|
8826
|
+
const marketCell = markets[marketIdx] ?? null;
|
|
8827
|
+
const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
|
|
8790
8828
|
const singlesReady = (cell) => cell ? strings.readyCount(cell.picks.length) : strings.unavailable;
|
|
8791
8829
|
const comboReady = (cell) => cell ? strings.readyAt(cell.combo.total) : strings.unavailable;
|
|
8792
8830
|
return /* @__PURE__ */ jsxs75(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
|
|
@@ -8846,6 +8884,19 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
8846
8884
|
} })
|
|
8847
8885
|
}
|
|
8848
8886
|
),
|
|
8887
|
+
markets.length > 0 && /* @__PURE__ */ jsx90(
|
|
8888
|
+
AskRow,
|
|
8889
|
+
{
|
|
8890
|
+
icon: "\u26BD",
|
|
8891
|
+
ask: fillTemplate(strings.marketRow, {
|
|
8892
|
+
market: /* @__PURE__ */ jsx90(ChoiceSelect, { currentIdx: marketIdx, sizeLabels: marketLabels, optionLabels: marketLabels, label: strings.marketName, onChoose: chooseMarket })
|
|
8893
|
+
}),
|
|
8894
|
+
ready: marketCell ? strings.readyCount(marketCell.count) : null,
|
|
8895
|
+
send: /* @__PURE__ */ jsx90(RoundSend, { label: strings.send, display: marketCell ? marketDisplay(marketCell, strings) : "", disabled: !marketCell || streaming, onClick: () => {
|
|
8896
|
+
if (marketCell) onSend(marketAsk(marketCell, strings));
|
|
8897
|
+
} })
|
|
8898
|
+
}
|
|
8899
|
+
),
|
|
8849
8900
|
/* @__PURE__ */ jsx90("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
|
|
8850
8901
|
] });
|
|
8851
8902
|
}
|
|
@@ -9835,9 +9886,21 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
9835
9886
|
part of that visual language rather than a plain unstyled button. */
|
|
9836
9887
|
.ss-w-dash--market .ss-w-dash-tile { border-left: 3px solid var(--ss-w-accent); }
|
|
9837
9888
|
|
|
9838
|
-
/* Goal: one column of
|
|
9889
|
+
/* Goal: one column of compact cards, 60px tall with the badge as a price column on the right.
|
|
9890
|
+
The value ink is accent mixed toward ink (as on the hero price): plain light accent on the
|
|
9891
|
+
panel is 3.9:1, under the 4.5:1 small text needs. */
|
|
9839
9892
|
.ss-w-dash--goal .ss-w-dash-grid { grid-template-columns: 1fr; }
|
|
9840
|
-
.ss-w-dash--goal .ss-w-dash-tile {
|
|
9893
|
+
.ss-w-dash--goal .ss-w-dash-tile { gap: 12px; min-height: 60px; padding: 8px 12px 8px 14px; border-radius: 8px; }
|
|
9894
|
+
.ss-w-dash--goal .ss-w-dash-tile:hover { background: var(--ss-w-bubble); }
|
|
9895
|
+
.ss-w-dash--goal .ss-w-dash-tile-icon { width: 24px; height: 24px; font-size: 20px; }
|
|
9896
|
+
.ss-w-dash--goal .ss-w-dash-tile-body { gap: 1px; }
|
|
9897
|
+
.ss-w-dash--goal .ss-w-dash-tile-title { font-size: 15px; line-height: 1.25; }
|
|
9898
|
+
.ss-w-dash--goal .ss-w-dash-tile-subtitle { font-size: 13px; line-height: 1.3; overflow-wrap: break-word; }
|
|
9899
|
+
.ss-w-dash-tile-value {
|
|
9900
|
+
flex: none; margin-left: auto; max-width: 40%; text-align: right;
|
|
9901
|
+
font-size: 16px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums;
|
|
9902
|
+
color: color-mix(in srgb, var(--ss-w-accent) 70%, var(--ss-w-ink));
|
|
9903
|
+
}
|
|
9841
9904
|
|
|
9842
9905
|
/* Discovery: tinted bento cards. Stacked (icon over text) so a two- or three-word title gets
|
|
9843
9906
|
the tile's full width instead of the ~100px left of a horizontal icon+chevron -- that narrow
|