@digilogiclabs/saas-factory-ui 2.9.0 → 2.9.1
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 +67 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -17
- 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 +67 -17
- package/dist/web/index.js.map +1 -1
- package/dist/web/index.mjs +67 -17
- 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([]);
|
|
@@ -31093,12 +31129,15 @@ function DiceRoller({
|
|
|
31093
31129
|
for (let f = 1; f <= flickerTicks; f++) {
|
|
31094
31130
|
const t = setTimeout(() => {
|
|
31095
31131
|
for (let i = 0; i < clampedCount; i++) {
|
|
31096
|
-
const
|
|
31097
|
-
if (
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
31132
|
+
const texts = faceTextRefs.current[i];
|
|
31133
|
+
if (!texts) continue;
|
|
31134
|
+
for (const el of texts) {
|
|
31135
|
+
if (el)
|
|
31136
|
+
el.textContent = formatDieValue(
|
|
31137
|
+
Math.floor(Math.random() * sides) + 1,
|
|
31138
|
+
sides
|
|
31139
|
+
);
|
|
31140
|
+
}
|
|
31102
31141
|
}
|
|
31103
31142
|
}, f * flickerStep);
|
|
31104
31143
|
timersRef.current.push(t);
|
|
@@ -31125,9 +31164,19 @@ function DiceRoller({
|
|
|
31125
31164
|
});
|
|
31126
31165
|
const settleTimer = setTimeout(() => {
|
|
31127
31166
|
if (sides !== 6) {
|
|
31167
|
+
const geo = buildPolyhedron(sides);
|
|
31128
31168
|
for (let i = 0; i < clampedCount; i++) {
|
|
31129
|
-
const
|
|
31130
|
-
if (
|
|
31169
|
+
const texts = faceTextRefs.current[i];
|
|
31170
|
+
if (!texts) continue;
|
|
31171
|
+
const dealt = dealFaceValues(
|
|
31172
|
+
geo,
|
|
31173
|
+
sides,
|
|
31174
|
+
vals[i]
|
|
31175
|
+
);
|
|
31176
|
+
for (let fi = 0; fi < dealt.length; fi++) {
|
|
31177
|
+
const el = texts[fi];
|
|
31178
|
+
if (el) el.textContent = formatDieValue(dealt[fi], sides);
|
|
31179
|
+
}
|
|
31131
31180
|
}
|
|
31132
31181
|
}
|
|
31133
31182
|
setResults(vals);
|
|
@@ -31360,7 +31409,7 @@ function DiceRoller({
|
|
|
31360
31409
|
/* @__PURE__ */ jsx114(
|
|
31361
31410
|
"text",
|
|
31362
31411
|
{
|
|
31363
|
-
ref:
|
|
31412
|
+
ref: getFaceTextSetter(d, fi),
|
|
31364
31413
|
x: S / 2,
|
|
31365
31414
|
y: S / 2,
|
|
31366
31415
|
textAnchor: "middle",
|
|
@@ -45851,6 +45900,7 @@ export {
|
|
|
45851
45900
|
createTransition,
|
|
45852
45901
|
d6LandingRotation,
|
|
45853
45902
|
dailyTrendingConfig,
|
|
45903
|
+
dealFaceValues,
|
|
45854
45904
|
detectAuthProvider,
|
|
45855
45905
|
detectDelimiter,
|
|
45856
45906
|
detectHeader,
|