@digilogiclabs/saas-factory-ui 2.9.0 → 2.9.2
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 +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +81 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -23
- package/dist/index.mjs.map +1 -1
- package/dist/web/index.d.mts +12 -1
- package/dist/web/index.d.ts +12 -1
- package/dist/web/index.js +81 -23
- package/dist/web/index.js.map +1 -1
- package/dist/web/index.mjs +81 -23
- package/dist/web/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30661,10 +30661,44 @@ function buildPolyhedron(sides) {
|
|
|
30661
30661
|
})
|
|
30662
30662
|
);
|
|
30663
30663
|
const faceInradius = Math.min(...built.map((f) => edgeDist(f.pts)));
|
|
30664
|
-
const
|
|
30664
|
+
const opposite = built.map((_, i) => oppOf(i));
|
|
30665
|
+
const result = {
|
|
30666
|
+
faces: built,
|
|
30667
|
+
opposite,
|
|
30668
|
+
faceRadius,
|
|
30669
|
+
faceInradius
|
|
30670
|
+
};
|
|
30665
30671
|
polyhedronCache.set(sides, result);
|
|
30666
30672
|
return result;
|
|
30667
30673
|
}
|
|
30674
|
+
function dealFaceValues(geo, sides, rolled) {
|
|
30675
|
+
const n = geo.faces.length;
|
|
30676
|
+
const out = new Array(n).fill(0);
|
|
30677
|
+
const used = /* @__PURE__ */ new Set([rolled]);
|
|
30678
|
+
out[0] = rolled;
|
|
30679
|
+
const opp0 = geo.opposite[0];
|
|
30680
|
+
if (opp0 >= 0) {
|
|
30681
|
+
out[opp0] = sides + 1 - rolled;
|
|
30682
|
+
used.add(sides + 1 - rolled);
|
|
30683
|
+
}
|
|
30684
|
+
const values = [];
|
|
30685
|
+
for (let v = 1; v <= sides; v++) if (!used.has(v)) values.push(v);
|
|
30686
|
+
for (let i = values.length - 1; i > 0; i--) {
|
|
30687
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
30688
|
+
[values[i], values[j]] = [values[j], values[i]];
|
|
30689
|
+
}
|
|
30690
|
+
for (let fi = 1; fi < n; fi++) {
|
|
30691
|
+
if (out[fi] !== 0) continue;
|
|
30692
|
+
const v = values.shift();
|
|
30693
|
+
out[fi] = v;
|
|
30694
|
+
const o = geo.opposite[fi];
|
|
30695
|
+
if (o >= 0 && out[o] === 0) {
|
|
30696
|
+
out[o] = sides + 1 - v;
|
|
30697
|
+
values.splice(values.indexOf(sides + 1 - v), 1);
|
|
30698
|
+
}
|
|
30699
|
+
}
|
|
30700
|
+
return out;
|
|
30701
|
+
}
|
|
30668
30702
|
function formatDieValue(v, sides) {
|
|
30669
30703
|
return sides > 8 && (v === 6 || v === 9) ? `${v}.` : String(v);
|
|
30670
30704
|
}
|
|
@@ -30850,7 +30884,7 @@ function DiceRoller({
|
|
|
30850
30884
|
const dieWrapperRefs = useRef39([]);
|
|
30851
30885
|
const cubeRefs = useRef39([]);
|
|
30852
30886
|
const shadowRefs = useRef39([]);
|
|
30853
|
-
const
|
|
30887
|
+
const faceTextRefs = useRef39([]);
|
|
30854
30888
|
const currentPositionsRef = useRef39(null);
|
|
30855
30889
|
const rollingRef = useRef39(false);
|
|
30856
30890
|
const dieSetters = useRef39([]);
|
|
@@ -30880,14 +30914,16 @@ function DiceRoller({
|
|
|
30880
30914
|
}
|
|
30881
30915
|
return shadowSetters.current[i];
|
|
30882
30916
|
};
|
|
30883
|
-
const
|
|
30884
|
-
const
|
|
30885
|
-
if (!
|
|
30886
|
-
|
|
30887
|
-
|
|
30917
|
+
const faceTextSetters = useRef39([]);
|
|
30918
|
+
const getFaceTextSetter = (i, fi) => {
|
|
30919
|
+
if (!faceTextSetters.current[i]) faceTextSetters.current[i] = [];
|
|
30920
|
+
if (!faceTextSetters.current[i][fi]) {
|
|
30921
|
+
faceTextSetters.current[i][fi] = (el) => {
|
|
30922
|
+
if (!faceTextRefs.current[i]) faceTextRefs.current[i] = [];
|
|
30923
|
+
faceTextRefs.current[i][fi] = el;
|
|
30888
30924
|
};
|
|
30889
30925
|
}
|
|
30890
|
-
return
|
|
30926
|
+
return faceTextSetters.current[i][fi];
|
|
30891
30927
|
};
|
|
30892
30928
|
const sheenGradientId = useId3();
|
|
30893
30929
|
const timersRef = useRef39([]);
|
|
@@ -31087,22 +31123,48 @@ function DiceRoller({
|
|
|
31087
31123
|
}, capturedStep * stepMs);
|
|
31088
31124
|
timersRef.current.push(timer);
|
|
31089
31125
|
}
|
|
31126
|
+
let dealtAll = null;
|
|
31127
|
+
const writeDealtValues = () => {
|
|
31128
|
+
if (!dealtAll) return;
|
|
31129
|
+
for (let i = 0; i < clampedCount; i++) {
|
|
31130
|
+
const texts = faceTextRefs.current[i];
|
|
31131
|
+
const dealt = dealtAll[i];
|
|
31132
|
+
if (!texts || !dealt) continue;
|
|
31133
|
+
for (let fi = 0; fi < dealt.length; fi++) {
|
|
31134
|
+
const el = texts[fi];
|
|
31135
|
+
if (el) el.textContent = formatDieValue(dealt[fi], sides);
|
|
31136
|
+
}
|
|
31137
|
+
}
|
|
31138
|
+
};
|
|
31090
31139
|
if (sides !== 6) {
|
|
31091
|
-
const
|
|
31092
|
-
|
|
31140
|
+
const geo = buildPolyhedron(sides);
|
|
31141
|
+
dealtAll = vals.map(
|
|
31142
|
+
(v) => dealFaceValues(geo, sides, v)
|
|
31143
|
+
);
|
|
31144
|
+
const finalAt = Math.floor(TUMBLE_MS * 0.72);
|
|
31145
|
+
const flickerTicks = 6;
|
|
31146
|
+
const flickerStep = Math.max(
|
|
31147
|
+
50,
|
|
31148
|
+
Math.floor((finalAt - 60) / flickerTicks)
|
|
31149
|
+
);
|
|
31093
31150
|
for (let f = 1; f <= flickerTicks; f++) {
|
|
31094
31151
|
const t = setTimeout(() => {
|
|
31095
31152
|
for (let i = 0; i < clampedCount; i++) {
|
|
31096
|
-
const
|
|
31097
|
-
if (
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
31153
|
+
const texts = faceTextRefs.current[i];
|
|
31154
|
+
if (!texts) continue;
|
|
31155
|
+
for (const el of texts) {
|
|
31156
|
+
if (el)
|
|
31157
|
+
el.textContent = formatDieValue(
|
|
31158
|
+
Math.floor(Math.random() * sides) + 1,
|
|
31159
|
+
sides
|
|
31160
|
+
);
|
|
31161
|
+
}
|
|
31102
31162
|
}
|
|
31103
31163
|
}, f * flickerStep);
|
|
31104
31164
|
timersRef.current.push(t);
|
|
31105
31165
|
}
|
|
31166
|
+
const finalTimer = setTimeout(writeDealtValues, finalAt);
|
|
31167
|
+
timersRef.current.push(finalTimer);
|
|
31106
31168
|
}
|
|
31107
31169
|
requestAnimationFrame(() => {
|
|
31108
31170
|
requestAnimationFrame(() => {
|
|
@@ -31124,12 +31186,7 @@ function DiceRoller({
|
|
|
31124
31186
|
});
|
|
31125
31187
|
});
|
|
31126
31188
|
const settleTimer = setTimeout(() => {
|
|
31127
|
-
|
|
31128
|
-
for (let i = 0; i < clampedCount; i++) {
|
|
31129
|
-
const el = numeralRefs.current[i];
|
|
31130
|
-
if (el) el.textContent = formatDieValue(vals[i], sides);
|
|
31131
|
-
}
|
|
31132
|
-
}
|
|
31189
|
+
writeDealtValues();
|
|
31133
31190
|
setResults(vals);
|
|
31134
31191
|
setRolling(false);
|
|
31135
31192
|
rollingRef.current = false;
|
|
@@ -31360,7 +31417,7 @@ function DiceRoller({
|
|
|
31360
31417
|
/* @__PURE__ */ jsx114(
|
|
31361
31418
|
"text",
|
|
31362
31419
|
{
|
|
31363
|
-
ref:
|
|
31420
|
+
ref: getFaceTextSetter(d, fi),
|
|
31364
31421
|
x: S / 2,
|
|
31365
31422
|
y: S / 2,
|
|
31366
31423
|
textAnchor: "middle",
|
|
@@ -45851,6 +45908,7 @@ export {
|
|
|
45851
45908
|
createTransition,
|
|
45852
45909
|
d6LandingRotation,
|
|
45853
45910
|
dailyTrendingConfig,
|
|
45911
|
+
dealFaceValues,
|
|
45854
45912
|
detectAuthProvider,
|
|
45855
45913
|
detectDelimiter,
|
|
45856
45914
|
detectHeader,
|