@sensiblestats/widget-react 0.72.2 → 0.73.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 +6 -0
- package/dist/index.cjs +103 -34
- 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 +103 -34
- package/dist/index.js.map +1 -1
- package/dist/styles.css +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -129,7 +129,10 @@ var STRINGS = {
|
|
|
129
129
|
dialName: "Set the numbers and Build a combo",
|
|
130
130
|
maxPriceRow: "{count} picks, max {price}",
|
|
131
131
|
minPriceRow: "Picks from {price} up",
|
|
132
|
-
comboRow: "
|
|
132
|
+
comboRow: "Combo of {legs} paying {total}",
|
|
133
|
+
bigComboRow: "Total {total} with {legs} matches",
|
|
134
|
+
readyCount: (n) => `${n} ready`,
|
|
135
|
+
readyAt: (total) => `ready at ${total.toFixed(2)}`,
|
|
133
136
|
maxPriceDisplay: (count, price) => `${count} picks, max ${price.toFixed(2)}`,
|
|
134
137
|
maxPriceMessage: (count, price) => `Show me ${count} picks priced at ${price.toFixed(2)} or less.`,
|
|
135
138
|
minPriceDisplay: (count, price) => `${count} picks from ${price.toFixed(2)} up`,
|
|
@@ -461,6 +464,9 @@ var STRINGS = {
|
|
|
461
464
|
maxPriceRow: "{count} se\xE7im, en fazla {price}",
|
|
462
465
|
minPriceRow: "{price} ve \xFCzeri se\xE7imler",
|
|
463
466
|
comboRow: "Yakla\u015F\u0131k {total} oranl\u0131 {legs} ma\xE7l\u0131k kombin",
|
|
467
|
+
bigComboRow: "{legs} ma\xE7la toplam {total}",
|
|
468
|
+
readyCount: (n) => `${n} haz\u0131r`,
|
|
469
|
+
readyAt: (total) => `${total.toFixed(2)} ile haz\u0131r`,
|
|
464
470
|
maxPriceDisplay: (count, price) => `${count} se\xE7im, en fazla ${price.toFixed(2)}`,
|
|
465
471
|
maxPriceMessage: (count, price) => `${price.toFixed(2)} veya alt\u0131 oranl\u0131 ${count} se\xE7im g\xF6ster.`,
|
|
466
472
|
minPriceDisplay: (count, price) => `${count} se\xE7im, ${price.toFixed(2)} ve \xFCzeri`,
|
|
@@ -8715,7 +8721,21 @@ function ComboPreview({ cell, formatKickoff }) {
|
|
|
8715
8721
|
function Unavailable({ text }) {
|
|
8716
8722
|
return /* @__PURE__ */ jsx90("p", { className: "ss-w-tool-unavailable", children: text });
|
|
8717
8723
|
}
|
|
8718
|
-
function
|
|
8724
|
+
function AskRow({ icon, ask, ready, send }) {
|
|
8725
|
+
return /* @__PURE__ */ jsxs75("section", { className: "ss-w-tool-row ss-w-tool-row--ask", children: [
|
|
8726
|
+
/* @__PURE__ */ jsx90("span", { className: "ss-w-tool-icon", "aria-hidden": "true", children: icon }),
|
|
8727
|
+
/* @__PURE__ */ jsxs75("div", { className: "ss-w-tool-main", children: [
|
|
8728
|
+
/* @__PURE__ */ jsx90("p", { className: "ss-w-tool-ask", children: ask }),
|
|
8729
|
+
ready ? /* @__PURE__ */ jsx90("span", { className: "ss-w-tool-ready", children: ready }) : null
|
|
8730
|
+
] }),
|
|
8731
|
+
send
|
|
8732
|
+
] });
|
|
8733
|
+
}
|
|
8734
|
+
function RoundSend({ label, display, disabled, onClick }) {
|
|
8735
|
+
return /* @__PURE__ */ jsx90("button", { type: "button", className: "ss-w-tool-go", "aria-label": `${label}: ${display}`, disabled, onClick, children: /* @__PURE__ */ jsx90(SendIcon, {}) });
|
|
8736
|
+
}
|
|
8737
|
+
var BIG_COMBO = { total: 50, legs: 6 };
|
|
8738
|
+
function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
8719
8739
|
const limits = singlesLimits(grid);
|
|
8720
8740
|
const floors = singlesFloors(grid);
|
|
8721
8741
|
const totals = comboTotals(grid);
|
|
@@ -8726,10 +8746,14 @@ function SetNumbersTool({ grid, strings, streaming, formatKickoff, onSend, onClo
|
|
|
8726
8746
|
const [start] = useState41(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
|
|
8727
8747
|
const [total, setTotal] = useState41(start.total);
|
|
8728
8748
|
const [legs, setLegs] = useState41(start.legs);
|
|
8749
|
+
const [bigStart] = useState41(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
|
|
8750
|
+
const [bigTotal, setBigTotal] = useState41(bigStart.total);
|
|
8751
|
+
const [bigLegs, setBigLegs] = useState41(bigStart.legs);
|
|
8729
8752
|
const [announcement, setAnnouncement] = useState41("");
|
|
8730
8753
|
const maxCell = findSingles(grid.singles, maxPrice, count);
|
|
8731
8754
|
const minCell = findSingles(grid.singlesFrom, minPrice, count);
|
|
8732
8755
|
const comboCell = findCombo(grid, total, legs);
|
|
8756
|
+
const bigCell = findCombo(grid, bigTotal, bigLegs);
|
|
8733
8757
|
const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
|
|
8734
8758
|
const chooseMax = (v) => {
|
|
8735
8759
|
setMaxPrice(v);
|
|
@@ -8749,41 +8773,79 @@ function SetNumbersTool({ grid, strings, streaming, formatKickoff, onSend, onClo
|
|
|
8749
8773
|
setLegs(l);
|
|
8750
8774
|
announce(strings.comboDisplay(l, v), !!findCombo(grid, v, l));
|
|
8751
8775
|
};
|
|
8776
|
+
const chooseBigLegs = (v) => {
|
|
8777
|
+
setBigLegs(v);
|
|
8778
|
+
announce(strings.comboDisplay(v, bigTotal), !!findCombo(grid, bigTotal, v));
|
|
8779
|
+
};
|
|
8780
|
+
const chooseBigTotal = (v) => {
|
|
8781
|
+
const l = legsForTotal(grid, v, bigLegs);
|
|
8782
|
+
setBigTotal(v);
|
|
8783
|
+
setBigLegs(l);
|
|
8784
|
+
announce(strings.comboDisplay(l, v), !!findCombo(grid, v, l));
|
|
8785
|
+
};
|
|
8752
8786
|
const maxChoices = limits.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singles, v, count) }));
|
|
8753
8787
|
const minChoices = floors.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singlesFrom, v, count) }));
|
|
8754
8788
|
const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
|
|
8755
|
-
const
|
|
8789
|
+
const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
|
|
8790
|
+
const singlesReady = (cell) => cell ? strings.readyCount(cell.picks.length) : strings.unavailable;
|
|
8791
|
+
const comboReady = (cell) => cell ? strings.readyAt(cell.combo.total) : strings.unavailable;
|
|
8756
8792
|
return /* @__PURE__ */ jsxs75(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
|
|
8757
|
-
/* @__PURE__ */
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8793
|
+
/* @__PURE__ */ jsx90(
|
|
8794
|
+
AskRow,
|
|
8795
|
+
{
|
|
8796
|
+
icon: "\u{1F3AF}",
|
|
8797
|
+
ask: fillTemplate(strings.maxPriceRow, {
|
|
8798
|
+
count: String(count),
|
|
8799
|
+
price: /* @__PURE__ */ jsx90(NumberSelect, { current: maxPrice.toFixed(2), choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
|
|
8800
|
+
}),
|
|
8801
|
+
ready: singlesReady(maxCell),
|
|
8802
|
+
send: /* @__PURE__ */ jsx90(RoundSend, { label: strings.send, display: strings.maxPriceDisplay(count, maxPrice), disabled: !maxCell || streaming, onClick: () => {
|
|
8803
|
+
if (maxCell) onSend(maxPriceAsk(maxCell, strings));
|
|
8804
|
+
} })
|
|
8805
|
+
}
|
|
8806
|
+
),
|
|
8807
|
+
/* @__PURE__ */ jsx90(
|
|
8808
|
+
AskRow,
|
|
8809
|
+
{
|
|
8810
|
+
icon: "\u{1F4C8}",
|
|
8811
|
+
ask: fillTemplate(strings.minPriceRow, {
|
|
8812
|
+
count: String(count),
|
|
8813
|
+
price: /* @__PURE__ */ jsx90(NumberSelect, { current: minPrice.toFixed(2), choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
|
|
8814
|
+
}),
|
|
8815
|
+
ready: singlesReady(minCell),
|
|
8816
|
+
send: /* @__PURE__ */ jsx90(RoundSend, { label: strings.send, display: strings.minPriceDisplay(count, minPrice), disabled: !minCell || streaming, onClick: () => {
|
|
8817
|
+
if (minCell) onSend(minPriceAsk(minCell, strings));
|
|
8818
|
+
} })
|
|
8819
|
+
}
|
|
8820
|
+
),
|
|
8821
|
+
/* @__PURE__ */ jsx90(
|
|
8822
|
+
AskRow,
|
|
8823
|
+
{
|
|
8824
|
+
icon: "\u2728",
|
|
8825
|
+
ask: fillTemplate(strings.comboRow, {
|
|
8826
|
+
legs: /* @__PURE__ */ jsx90(NumberSelect, { current: String(legs), choices: legChoicesFor(total), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseLegs }),
|
|
8827
|
+
total: /* @__PURE__ */ jsx90(NumberSelect, { current: total.toFixed(1), choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseTotal })
|
|
8828
|
+
}),
|
|
8829
|
+
ready: comboReady(comboCell),
|
|
8830
|
+
send: /* @__PURE__ */ jsx90(RoundSend, { label: strings.send, display: strings.comboDisplay(legs, total), disabled: !comboCell || streaming, onClick: () => {
|
|
8831
|
+
if (comboCell) onSend(comboAsk(comboCell, strings));
|
|
8832
|
+
} })
|
|
8833
|
+
}
|
|
8834
|
+
),
|
|
8835
|
+
/* @__PURE__ */ jsx90(
|
|
8836
|
+
AskRow,
|
|
8837
|
+
{
|
|
8838
|
+
icon: "\u{1F3C6}",
|
|
8839
|
+
ask: fillTemplate(strings.bigComboRow, {
|
|
8840
|
+
legs: /* @__PURE__ */ jsx90(NumberSelect, { current: String(bigLegs), choices: legChoicesFor(bigTotal), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseBigLegs }),
|
|
8841
|
+
total: /* @__PURE__ */ jsx90(NumberSelect, { current: bigTotal.toFixed(1), choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseBigTotal })
|
|
8842
|
+
}),
|
|
8843
|
+
ready: comboReady(bigCell),
|
|
8844
|
+
send: /* @__PURE__ */ jsx90(RoundSend, { label: strings.send, display: strings.comboDisplay(bigLegs, bigTotal), disabled: !bigCell || streaming, onClick: () => {
|
|
8845
|
+
if (bigCell) onSend(comboAsk(bigCell, strings));
|
|
8846
|
+
} })
|
|
8847
|
+
}
|
|
8848
|
+
),
|
|
8787
8849
|
/* @__PURE__ */ jsx90("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
|
|
8788
8850
|
] });
|
|
8789
8851
|
}
|
|
@@ -9058,7 +9120,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
9058
9120
|
buttonRef: dialButtonRef
|
|
9059
9121
|
}
|
|
9060
9122
|
) : null,
|
|
9061
|
-
tool && presetGrid && onChatTab ? tool.kind === "numbers" ? /* @__PURE__ */ jsx91(SetNumbersTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming,
|
|
9123
|
+
tool && presetGrid && onChatTab ? tool.kind === "numbers" ? /* @__PURE__ */ jsx91(SetNumbersTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, onSend: sendAsk, onClose: closeTool }) : /* @__PURE__ */ jsx91(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
|
|
9062
9124
|
] }),
|
|
9063
9125
|
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ jsx91(TodayPanel, { discovery, ui, monitor }),
|
|
9064
9126
|
monitor && monitor.activeTab === "following" && /* @__PURE__ */ jsx91(MatchesPanel, { monitor, ui, slip, onAsk: handleAsk }),
|
|
@@ -9564,6 +9626,13 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
9564
9626
|
.ss-w-tool-pick-price { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 800; color: var(--ss-w-accent); }
|
|
9565
9627
|
.ss-w-tool-math { padding: 6px 8px; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; text-align: right; color: var(--ss-w-ink); background: color-mix(in srgb, var(--ss-w-accent) 9%, var(--ss-w-panel)); border-radius: 8px; overflow-wrap: anywhere; }
|
|
9566
9628
|
.ss-w-tool-unavailable { padding: 6px 8px; font-size: 12px; color: var(--ss-w-faint); border: 1px dashed var(--ss-w-line); border-radius: 8px; }
|
|
9629
|
+
.ss-w-tool-row--ask { flex-direction: row; align-items: center; gap: 10px; border-left-width: 1px; }
|
|
9630
|
+
.ss-w-tool-icon { flex: none; font-size: 20px; line-height: 1; }
|
|
9631
|
+
.ss-w-tool-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
|
|
9632
|
+
.ss-w-tool-ready { padding: 2px 8px; font-size: 11.5px; font-weight: 650; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 12%, transparent); border-radius: 10px; }
|
|
9633
|
+
.ss-w-tool-go { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 17px; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 50%; cursor: pointer; }
|
|
9634
|
+
.ss-w-tool-go:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
|
|
9635
|
+
.ss-w-tool-go:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
9567
9636
|
.ss-w-tool-send { align-self: flex-end; min-height: 40px; padding: 8px 18px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 20px; cursor: pointer; }
|
|
9568
9637
|
.ss-w-tool-send:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
|
|
9569
9638
|
.ss-w-tool-foot .ss-w-tool-send { width: 100%; }
|