@digilogiclabs/saas-factory-ui 2.5.0 → 2.7.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/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +54 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -3
- package/dist/index.mjs.map +1 -1
- package/dist/web/index.d.mts +8 -2
- package/dist/web/index.d.ts +8 -2
- package/dist/web/index.js +54 -3
- package/dist/web/index.js.map +1 -1
- package/dist/web/index.mjs +54 -3
- package/dist/web/index.mjs.map +1 -1
- package/package.json +17 -17
package/dist/web/index.mjs
CHANGED
|
@@ -33949,7 +33949,20 @@ function RandomPlayerPicker({
|
|
|
33949
33949
|
}
|
|
33950
33950
|
}
|
|
33951
33951
|
const activeN = activePool.length;
|
|
33952
|
-
if (activeN < 2)
|
|
33952
|
+
if (activeN < 2) {
|
|
33953
|
+
if (removeWinnersRef.current && activePool.length === 1 && history.length > 0) {
|
|
33954
|
+
const survivor = activePool[0];
|
|
33955
|
+
if (survivor) {
|
|
33956
|
+
const promoted = [survivor, ...history].slice(0, 20);
|
|
33957
|
+
setPool([]);
|
|
33958
|
+
setWinner(survivor);
|
|
33959
|
+
setRevealKey((k) => k + 1);
|
|
33960
|
+
setHistory(promoted);
|
|
33961
|
+
onPick?.(survivor, promoted, { lastStanding: true });
|
|
33962
|
+
}
|
|
33963
|
+
}
|
|
33964
|
+
return;
|
|
33965
|
+
}
|
|
33953
33966
|
const activeAnglePerWedge = 2 * Math.PI / activeN;
|
|
33954
33967
|
const activeRotation = rotation;
|
|
33955
33968
|
const activeReelY = reelY;
|
|
@@ -34114,8 +34127,19 @@ function RandomPlayerPicker({
|
|
|
34114
34127
|
popTimer.current = null;
|
|
34115
34128
|
pendingPopIdxRef.current = null;
|
|
34116
34129
|
if (!removeWinnersRef.current) return;
|
|
34117
|
-
|
|
34118
|
-
|
|
34130
|
+
const survivors = activePool.filter((_, i) => i !== finalWinnerIdx);
|
|
34131
|
+
const survivor = survivors.length === 1 ? survivors[0] : void 0;
|
|
34132
|
+
if (survivor) {
|
|
34133
|
+
const promoted = [survivor, ...nextHistory].slice(0, 20);
|
|
34134
|
+
setPool([]);
|
|
34135
|
+
setWinner(survivor);
|
|
34136
|
+
setRevealKey((k) => k + 1);
|
|
34137
|
+
setHistory(promoted);
|
|
34138
|
+
onPick?.(survivor, promoted, { lastStanding: true });
|
|
34139
|
+
} else {
|
|
34140
|
+
setPool(survivors);
|
|
34141
|
+
setWinner(null);
|
|
34142
|
+
}
|
|
34119
34143
|
setRotation(0);
|
|
34120
34144
|
setReelY(0);
|
|
34121
34145
|
}, 2800);
|
|
@@ -38737,6 +38761,33 @@ function GameTimer({
|
|
|
38737
38761
|
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
38738
38762
|
};
|
|
38739
38763
|
}, [running, tick]);
|
|
38764
|
+
useEffect59(() => {
|
|
38765
|
+
if (!running || mode !== "countdown") return;
|
|
38766
|
+
let timeoutId = null;
|
|
38767
|
+
const disarm = () => {
|
|
38768
|
+
if (timeoutId !== null) {
|
|
38769
|
+
clearTimeout(timeoutId);
|
|
38770
|
+
timeoutId = null;
|
|
38771
|
+
}
|
|
38772
|
+
};
|
|
38773
|
+
const arm = () => {
|
|
38774
|
+
disarm();
|
|
38775
|
+
const remainingUntilDone = durationMs - elapsedRef.current;
|
|
38776
|
+
if (remainingUntilDone > 0) {
|
|
38777
|
+
timeoutId = setTimeout(tick, remainingUntilDone + 50);
|
|
38778
|
+
}
|
|
38779
|
+
};
|
|
38780
|
+
const onVisibility = () => {
|
|
38781
|
+
if (document.hidden) arm();
|
|
38782
|
+
else disarm();
|
|
38783
|
+
};
|
|
38784
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
38785
|
+
if (document.hidden) arm();
|
|
38786
|
+
return () => {
|
|
38787
|
+
disarm();
|
|
38788
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
38789
|
+
};
|
|
38790
|
+
}, [running, mode, durationMs, tick]);
|
|
38740
38791
|
const start = useCallback48(() => {
|
|
38741
38792
|
if (completed && mode === "countdown") return;
|
|
38742
38793
|
setRunning(true);
|