@digilogiclabs/saas-factory-ui 2.8.1 → 2.9.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 +32 -6
- package/dist/index.d.ts +32 -6
- package/dist/index.js +266 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +267 -91
- package/dist/index.mjs.map +1 -1
- package/dist/web/index.d.mts +32 -6
- package/dist/web/index.d.ts +32 -6
- package/dist/web/index.js +266 -91
- package/dist/web/index.js.map +1 -1
- package/dist/web/index.mjs +267 -91
- package/dist/web/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/web/index.mjs
CHANGED
|
@@ -30227,6 +30227,7 @@ function TiltCard({
|
|
|
30227
30227
|
import {
|
|
30228
30228
|
useCallback as useCallback41,
|
|
30229
30229
|
useEffect as useEffect51,
|
|
30230
|
+
useId as useId3,
|
|
30230
30231
|
useMemo as useMemo26,
|
|
30231
30232
|
useRef as useRef40,
|
|
30232
30233
|
useState as useState66
|
|
@@ -30366,17 +30367,192 @@ function d6LandingRotation(value) {
|
|
|
30366
30367
|
y: Math.abs(p.y) === 180 ? 180 : -p.y || 0
|
|
30367
30368
|
};
|
|
30368
30369
|
}
|
|
30369
|
-
var
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30373
|
-
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30377
|
-
|
|
30370
|
+
var PHI = (1 + Math.sqrt(5)) / 2;
|
|
30371
|
+
var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
30372
|
+
var cross3 = (a, b) => [
|
|
30373
|
+
a[1] * b[2] - a[2] * b[1],
|
|
30374
|
+
a[2] * b[0] - a[0] * b[2],
|
|
30375
|
+
a[0] * b[1] - a[1] * b[0]
|
|
30376
|
+
];
|
|
30377
|
+
var sub3 = (a, b) => [
|
|
30378
|
+
a[0] - b[0],
|
|
30379
|
+
a[1] - b[1],
|
|
30380
|
+
a[2] - b[2]
|
|
30381
|
+
];
|
|
30382
|
+
var scale3 = (a, s) => [a[0] * s, a[1] * s, a[2] * s];
|
|
30383
|
+
var len3 = (a) => Math.hypot(a[0], a[1], a[2]);
|
|
30384
|
+
var norm3 = (a) => scale3(a, 1 / len3(a));
|
|
30385
|
+
function rotateAround(p, axis, angle) {
|
|
30386
|
+
const cosA = Math.cos(angle);
|
|
30387
|
+
const sinA = Math.sin(angle);
|
|
30388
|
+
const t1 = scale3(p, cosA);
|
|
30389
|
+
const t2 = scale3(cross3(axis, p), sinA);
|
|
30390
|
+
const t3 = scale3(axis, dot3(axis, p) * (1 - cosA));
|
|
30391
|
+
return [t1[0] + t2[0] + t3[0], t1[1] + t2[1] + t3[1], t1[2] + t2[2] + t3[2]];
|
|
30392
|
+
}
|
|
30393
|
+
function rotationTo(from, to) {
|
|
30394
|
+
const c = dot3(from, to);
|
|
30395
|
+
if (c > 1 - 1e-9) return (p) => p;
|
|
30396
|
+
const axis = c < -1 + 1e-9 ? norm3(
|
|
30397
|
+
Math.abs(from[0]) < 0.9 ? cross3(from, [1, 0, 0]) : cross3(from, [0, 1, 0])
|
|
30398
|
+
) : norm3(cross3(from, to));
|
|
30399
|
+
const angle = Math.acos(Math.max(-1, Math.min(1, c)));
|
|
30400
|
+
return (p) => rotateAround(p, axis, angle);
|
|
30401
|
+
}
|
|
30402
|
+
function solidVertices(sides) {
|
|
30403
|
+
switch (sides) {
|
|
30404
|
+
case 4:
|
|
30405
|
+
return [
|
|
30406
|
+
[1, 1, 1],
|
|
30407
|
+
[1, -1, -1],
|
|
30408
|
+
[-1, 1, -1],
|
|
30409
|
+
[-1, -1, 1]
|
|
30410
|
+
];
|
|
30411
|
+
case 8:
|
|
30412
|
+
return [
|
|
30413
|
+
[1, 0, 0],
|
|
30414
|
+
[-1, 0, 0],
|
|
30415
|
+
[0, 1, 0],
|
|
30416
|
+
[0, -1, 0],
|
|
30417
|
+
[0, 0, 1],
|
|
30418
|
+
[0, 0, -1]
|
|
30419
|
+
];
|
|
30420
|
+
case 10: {
|
|
30421
|
+
const h = 0.15;
|
|
30422
|
+
const cos36 = Math.cos(Math.PI / 5);
|
|
30423
|
+
const zApex = 2 * h / (1 - cos36) * cos36 + h;
|
|
30424
|
+
const verts = [
|
|
30425
|
+
[0, 0, zApex],
|
|
30426
|
+
[0, 0, -zApex]
|
|
30427
|
+
];
|
|
30428
|
+
for (let k = 0; k < 10; k++) {
|
|
30429
|
+
const a = k * Math.PI / 5;
|
|
30430
|
+
verts.push([Math.cos(a), Math.sin(a), k % 2 === 0 ? h : -h]);
|
|
30431
|
+
}
|
|
30432
|
+
return verts;
|
|
30433
|
+
}
|
|
30434
|
+
case 12: {
|
|
30435
|
+
const v = [];
|
|
30436
|
+
for (const sx of [1, -1])
|
|
30437
|
+
for (const sy of [1, -1])
|
|
30438
|
+
for (const sz of [1, -1]) v.push([sx, sy, sz]);
|
|
30439
|
+
const b = 1 / PHI;
|
|
30440
|
+
for (const s1 of [1, -1])
|
|
30441
|
+
for (const s2 of [1, -1]) {
|
|
30442
|
+
v.push([0, s1 * b, s2 * PHI]);
|
|
30443
|
+
v.push([s1 * b, s2 * PHI, 0]);
|
|
30444
|
+
v.push([s2 * PHI, 0, s1 * b]);
|
|
30445
|
+
}
|
|
30446
|
+
return v;
|
|
30447
|
+
}
|
|
30448
|
+
case 20: {
|
|
30449
|
+
const v = [];
|
|
30450
|
+
for (const s1 of [1, -1])
|
|
30451
|
+
for (const s2 of [1, -1]) {
|
|
30452
|
+
v.push([0, s1, s2 * PHI]);
|
|
30453
|
+
v.push([s1, s2 * PHI, 0]);
|
|
30454
|
+
v.push([s2 * PHI, 0, s1]);
|
|
30455
|
+
}
|
|
30456
|
+
return v;
|
|
30457
|
+
}
|
|
30378
30458
|
}
|
|
30379
|
-
}
|
|
30459
|
+
}
|
|
30460
|
+
function computeFaces(verts) {
|
|
30461
|
+
const faces = [];
|
|
30462
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30463
|
+
for (let i = 0; i < verts.length; i++)
|
|
30464
|
+
for (let j = i + 1; j < verts.length; j++)
|
|
30465
|
+
for (let k = j + 1; k < verts.length; k++) {
|
|
30466
|
+
let n = cross3(sub3(verts[j], verts[i]), sub3(verts[k], verts[i]));
|
|
30467
|
+
if (len3(n) < 1e-9) continue;
|
|
30468
|
+
n = norm3(n);
|
|
30469
|
+
let d = dot3(n, verts[i]);
|
|
30470
|
+
if (d < 0) {
|
|
30471
|
+
n = scale3(n, -1);
|
|
30472
|
+
d = -d;
|
|
30473
|
+
}
|
|
30474
|
+
if (verts.some((p) => dot3(n, p) > d + 1e-4)) continue;
|
|
30475
|
+
const ids = verts.flatMap(
|
|
30476
|
+
(p, idx) => Math.abs(dot3(n, p) - d) < 1e-4 ? [idx] : []
|
|
30477
|
+
);
|
|
30478
|
+
const key = ids.join(",");
|
|
30479
|
+
if (seen.has(key)) continue;
|
|
30480
|
+
seen.add(key);
|
|
30481
|
+
faces.push({ normal: n, ids });
|
|
30482
|
+
}
|
|
30483
|
+
return faces;
|
|
30484
|
+
}
|
|
30485
|
+
var polyhedronCache = /* @__PURE__ */ new Map();
|
|
30486
|
+
function buildPolyhedron(sides) {
|
|
30487
|
+
const cached = polyhedronCache.get(sides);
|
|
30488
|
+
if (cached) return cached;
|
|
30489
|
+
let verts = solidVertices(sides);
|
|
30490
|
+
const rough = computeFaces(verts);
|
|
30491
|
+
const front = rough.reduce(
|
|
30492
|
+
(best, f) => f.normal[2] > best.normal[2] + 1e-9 ? f : best
|
|
30493
|
+
);
|
|
30494
|
+
const rot = rotationTo(front.normal, [0, 0, 1]);
|
|
30495
|
+
verts = verts.map(rot);
|
|
30496
|
+
const rMax = Math.max(...verts.map(len3));
|
|
30497
|
+
verts = verts.map((p) => scale3(p, 1 / rMax));
|
|
30498
|
+
const raw = computeFaces(verts);
|
|
30499
|
+
const built = raw.map((f) => {
|
|
30500
|
+
const faceVerts = f.ids.map((i) => verts[i]);
|
|
30501
|
+
const centroid = scale3(
|
|
30502
|
+
faceVerts.reduce((a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]]),
|
|
30503
|
+
1 / faceVerts.length
|
|
30504
|
+
);
|
|
30505
|
+
const w = f.normal;
|
|
30506
|
+
let vRaw = sub3([0, 1, 0], scale3(w, w[1]));
|
|
30507
|
+
if (len3(vRaw) < 1e-6) vRaw = sub3([0, 0, 1], scale3(w, w[2]));
|
|
30508
|
+
const v = norm3(vRaw);
|
|
30509
|
+
const u = cross3(v, w);
|
|
30510
|
+
const pts = faceVerts.map((p) => [
|
|
30511
|
+
dot3(sub3(p, centroid), u),
|
|
30512
|
+
dot3(sub3(p, centroid), v)
|
|
30513
|
+
]).sort((a, b) => Math.atan2(a[1], a[0]) - Math.atan2(b[1], b[0]));
|
|
30514
|
+
return { normal: w, centroid, u, v, pts, value: 0 };
|
|
30515
|
+
});
|
|
30516
|
+
built.sort((a, b) => b.normal[2] - a.normal[2]);
|
|
30517
|
+
const oppOf = (i) => built.findIndex((g) => dot3(built[i].normal, g.normal) < -0.9999);
|
|
30518
|
+
const pool = [];
|
|
30519
|
+
for (let v2 = 1; v2 < sides; v2++) pool.push(v2);
|
|
30520
|
+
built[0].value = sides;
|
|
30521
|
+
const opp0 = oppOf(0);
|
|
30522
|
+
if (opp0 >= 0) {
|
|
30523
|
+
built[opp0].value = 1;
|
|
30524
|
+
pool.splice(pool.indexOf(1), 1);
|
|
30525
|
+
}
|
|
30526
|
+
for (let i = 1; i < built.length; i++) {
|
|
30527
|
+
if (built[i].value !== 0) continue;
|
|
30528
|
+
const v2 = pool.shift();
|
|
30529
|
+
built[i].value = v2;
|
|
30530
|
+
const j = oppOf(i);
|
|
30531
|
+
if (j >= 0 && built[j].value === 0) {
|
|
30532
|
+
built[j].value = sides + 1 - v2;
|
|
30533
|
+
pool.splice(pool.indexOf(sides + 1 - v2), 1);
|
|
30534
|
+
}
|
|
30535
|
+
}
|
|
30536
|
+
const faceRadius = Math.max(
|
|
30537
|
+
...built.flatMap((f) => f.pts.map(([x, y]) => Math.hypot(x, y)))
|
|
30538
|
+
);
|
|
30539
|
+
const edgeDist = (pts) => Math.min(
|
|
30540
|
+
...pts.map((p1, i2) => {
|
|
30541
|
+
const p2 = pts[(i2 + 1) % pts.length];
|
|
30542
|
+
const dx = p2[0] - p1[0];
|
|
30543
|
+
const dy = p2[1] - p1[1];
|
|
30544
|
+
const t = Math.max(
|
|
30545
|
+
0,
|
|
30546
|
+
Math.min(1, -(p1[0] * dx + p1[1] * dy) / (dx * dx + dy * dy))
|
|
30547
|
+
);
|
|
30548
|
+
return Math.hypot(p1[0] + t * dx, p1[1] + t * dy);
|
|
30549
|
+
})
|
|
30550
|
+
);
|
|
30551
|
+
const faceInradius = Math.min(...built.map((f) => edgeDist(f.pts)));
|
|
30552
|
+
const result = { faces: built, faceRadius, faceInradius };
|
|
30553
|
+
polyhedronCache.set(sides, result);
|
|
30554
|
+
return result;
|
|
30555
|
+
}
|
|
30380
30556
|
function formatDieValue(v, sides) {
|
|
30381
30557
|
return sides > 8 && (v === 6 || v === 9) ? `${v}.` : String(v);
|
|
30382
30558
|
}
|
|
@@ -30601,6 +30777,7 @@ function DiceRoller({
|
|
|
30601
30777
|
}
|
|
30602
30778
|
return numeralSetters.current[i];
|
|
30603
30779
|
};
|
|
30780
|
+
const sheenGradientId = useId3();
|
|
30604
30781
|
const timersRef = useRef40([]);
|
|
30605
30782
|
const rafHandleRef = useRef40(null);
|
|
30606
30783
|
const arenaRef = useRef40(null);
|
|
@@ -30986,57 +31163,97 @@ function DiceRoller({
|
|
|
30986
31163
|
},
|
|
30987
31164
|
val
|
|
30988
31165
|
)) : (() => {
|
|
30989
|
-
const
|
|
31166
|
+
const geo = buildPolyhedron(sides);
|
|
31167
|
+
const R = effectiveSize / 2;
|
|
31168
|
+
const S = Math.ceil(geo.faceRadius * R * 2) + 6;
|
|
31169
|
+
const fontSize = geo.faceInradius * R * 1.15;
|
|
30990
31170
|
const shown = results?.[d] ?? sides;
|
|
30991
|
-
|
|
30992
|
-
|
|
30993
|
-
|
|
30994
|
-
|
|
30995
|
-
|
|
30996
|
-
|
|
30997
|
-
|
|
30998
|
-
return /* @__PURE__ */ jsxs86(Fragment30, { children: [
|
|
30999
|
-
/* @__PURE__ */ jsxs86(
|
|
31171
|
+
return /* @__PURE__ */ jsx113(Fragment30, { children: geo.faces.map((f, fi) => {
|
|
31172
|
+
const m = `matrix3d(${f.u[0]},${f.u[1]},${f.u[2]},0,${f.v[0]},${f.v[1]},${f.v[2]},0,${f.normal[0]},${f.normal[1]},${f.normal[2]},0,${f.centroid[0] * R},${f.centroid[1] * R},${f.centroid[2] * R},1)`;
|
|
31173
|
+
const gid = `${sheenGradientId}-${d}-${fi}`;
|
|
31174
|
+
const pts = f.pts.map(
|
|
31175
|
+
([x, y]) => `${(x * R + S / 2).toFixed(2)},${(y * R + S / 2).toFixed(2)}`
|
|
31176
|
+
).join(" ");
|
|
31177
|
+
return /* @__PURE__ */ jsxs86(
|
|
31000
31178
|
"svg",
|
|
31001
31179
|
{
|
|
31002
|
-
|
|
31003
|
-
|
|
31004
|
-
|
|
31005
|
-
style:
|
|
31180
|
+
width: S,
|
|
31181
|
+
height: S,
|
|
31182
|
+
viewBox: `0 0 ${S} ${S}`,
|
|
31183
|
+
style: {
|
|
31184
|
+
position: "absolute",
|
|
31185
|
+
left: "50%",
|
|
31186
|
+
top: "50%",
|
|
31187
|
+
marginLeft: -S / 2,
|
|
31188
|
+
marginTop: -S / 2,
|
|
31189
|
+
overflow: "visible",
|
|
31190
|
+
transform: m,
|
|
31191
|
+
// Convex solid: a face is either front-
|
|
31192
|
+
// facing or hidden behind nearer faces,
|
|
31193
|
+
// so hiding backfaces is both correct
|
|
31194
|
+
// and the mirrored-numeral guard.
|
|
31195
|
+
backfaceVisibility: "hidden"
|
|
31196
|
+
},
|
|
31006
31197
|
"aria-hidden": "true",
|
|
31007
31198
|
children: [
|
|
31008
|
-
/* @__PURE__ */ jsx113(
|
|
31009
|
-
"
|
|
31199
|
+
/* @__PURE__ */ jsx113("defs", { children: /* @__PURE__ */ jsxs86(
|
|
31200
|
+
"radialGradient",
|
|
31010
31201
|
{
|
|
31011
|
-
|
|
31012
|
-
|
|
31013
|
-
|
|
31014
|
-
|
|
31015
|
-
|
|
31016
|
-
|
|
31202
|
+
id: gid,
|
|
31203
|
+
cx: "32%",
|
|
31204
|
+
cy: "26%",
|
|
31205
|
+
r: "80%",
|
|
31206
|
+
children: [
|
|
31207
|
+
/* @__PURE__ */ jsx113(
|
|
31208
|
+
"stop",
|
|
31209
|
+
{
|
|
31210
|
+
offset: "0%",
|
|
31211
|
+
stopColor: "#fff",
|
|
31212
|
+
stopOpacity: "0.38"
|
|
31213
|
+
}
|
|
31214
|
+
),
|
|
31215
|
+
/* @__PURE__ */ jsx113(
|
|
31216
|
+
"stop",
|
|
31217
|
+
{
|
|
31218
|
+
offset: "55%",
|
|
31219
|
+
stopColor: "#fff",
|
|
31220
|
+
stopOpacity: "0.08"
|
|
31221
|
+
}
|
|
31222
|
+
),
|
|
31223
|
+
/* @__PURE__ */ jsx113(
|
|
31224
|
+
"stop",
|
|
31225
|
+
{
|
|
31226
|
+
offset: "100%",
|
|
31227
|
+
stopColor: "#fff",
|
|
31228
|
+
stopOpacity: "0"
|
|
31229
|
+
}
|
|
31230
|
+
)
|
|
31231
|
+
]
|
|
31017
31232
|
}
|
|
31018
|
-
),
|
|
31233
|
+
) }),
|
|
31019
31234
|
/* @__PURE__ */ jsx113(
|
|
31020
31235
|
"polygon",
|
|
31021
31236
|
{
|
|
31022
|
-
points:
|
|
31023
|
-
fill:
|
|
31237
|
+
points: pts,
|
|
31238
|
+
fill: colors.face,
|
|
31024
31239
|
stroke: colors.faceBorder,
|
|
31025
31240
|
strokeWidth: 1.5,
|
|
31026
31241
|
strokeLinejoin: "round",
|
|
31027
|
-
|
|
31028
|
-
|
|
31242
|
+
style: {
|
|
31243
|
+
transition: "fill 0.3s, stroke 0.3s"
|
|
31244
|
+
}
|
|
31029
31245
|
}
|
|
31030
31246
|
),
|
|
31247
|
+
/* @__PURE__ */ jsx113("polygon", { points: pts, fill: `url(#${gid})` }),
|
|
31031
31248
|
/* @__PURE__ */ jsx113(
|
|
31032
31249
|
"text",
|
|
31033
31250
|
{
|
|
31034
|
-
ref: getNumeralSetter(d),
|
|
31035
|
-
x:
|
|
31036
|
-
y:
|
|
31251
|
+
ref: fi === 0 ? getNumeralSetter(d) : void 0,
|
|
31252
|
+
x: S / 2,
|
|
31253
|
+
y: S / 2,
|
|
31037
31254
|
textAnchor: "middle",
|
|
31038
31255
|
dominantBaseline: "central",
|
|
31039
|
-
fontSize
|
|
31256
|
+
fontSize,
|
|
31040
31257
|
fontWeight: 800,
|
|
31041
31258
|
fill: colors.pip,
|
|
31042
31259
|
style: {
|
|
@@ -31044,59 +31261,17 @@ function DiceRoller({
|
|
|
31044
31261
|
transition: "fill 0.3s",
|
|
31045
31262
|
userSelect: "none"
|
|
31046
31263
|
},
|
|
31047
|
-
children: formatDieValue(
|
|
31264
|
+
children: formatDieValue(
|
|
31265
|
+
fi === 0 ? shown : f.value,
|
|
31266
|
+
sides
|
|
31267
|
+
)
|
|
31048
31268
|
}
|
|
31049
31269
|
)
|
|
31050
31270
|
]
|
|
31051
|
-
}
|
|
31052
|
-
|
|
31053
|
-
|
|
31054
|
-
|
|
31055
|
-
{
|
|
31056
|
-
viewBox: "0 0 100 100",
|
|
31057
|
-
width: "100%",
|
|
31058
|
-
height: "100%",
|
|
31059
|
-
style: {
|
|
31060
|
-
...cardFaceStyle,
|
|
31061
|
-
transform: "rotateY(180deg)"
|
|
31062
|
-
},
|
|
31063
|
-
"aria-hidden": "true",
|
|
31064
|
-
children: [
|
|
31065
|
-
/* @__PURE__ */ jsx113(
|
|
31066
|
-
"polygon",
|
|
31067
|
-
{
|
|
31068
|
-
points: shape.points,
|
|
31069
|
-
fill: colors.face,
|
|
31070
|
-
stroke: colors.faceBorder,
|
|
31071
|
-
strokeWidth: 2.5,
|
|
31072
|
-
strokeLinejoin: "round",
|
|
31073
|
-
style: { transition: "fill 0.3s, stroke 0.3s" }
|
|
31074
|
-
}
|
|
31075
|
-
),
|
|
31076
|
-
/* @__PURE__ */ jsx113(
|
|
31077
|
-
"polygon",
|
|
31078
|
-
{
|
|
31079
|
-
points: shape.points,
|
|
31080
|
-
fill: "none",
|
|
31081
|
-
stroke: colors.faceBorder,
|
|
31082
|
-
strokeWidth: 1.5,
|
|
31083
|
-
strokeLinejoin: "round",
|
|
31084
|
-
opacity: 0.55,
|
|
31085
|
-
transform: "translate(50 50) scale(0.76) translate(-50 -50)"
|
|
31086
|
-
}
|
|
31087
|
-
),
|
|
31088
|
-
/* @__PURE__ */ jsx113(
|
|
31089
|
-
"polygon",
|
|
31090
|
-
{
|
|
31091
|
-
points: shape.points,
|
|
31092
|
-
fill: "#000",
|
|
31093
|
-
opacity: 0.14
|
|
31094
|
-
}
|
|
31095
|
-
)
|
|
31096
|
-
]
|
|
31097
|
-
}
|
|
31098
|
-
)
|
|
31099
|
-
] });
|
|
31271
|
+
},
|
|
31272
|
+
fi
|
|
31273
|
+
);
|
|
31274
|
+
}) });
|
|
31100
31275
|
})()
|
|
31101
31276
|
}
|
|
31102
31277
|
)
|
|
@@ -44076,6 +44251,7 @@ export {
|
|
|
44076
44251
|
audioAppTabs,
|
|
44077
44252
|
audioPlayerVariants,
|
|
44078
44253
|
breadcrumbsVariants,
|
|
44254
|
+
buildPolyhedron,
|
|
44079
44255
|
cn,
|
|
44080
44256
|
commonValidators,
|
|
44081
44257
|
containerVariants2 as containerVariants,
|