@digilogiclabs/saas-factory-ui 1.16.4 → 1.16.5

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.js CHANGED
@@ -30630,7 +30630,10 @@ function DiceRoller({
30630
30630
  (i, x, y, sx = 1, sy = 1) => {
30631
30631
  const el = dieWrapperRefs.current[i];
30632
30632
  if (!el) return;
30633
- el.style.transform = `translate3d(${x - half}px, ${y - half}px, 0) scale3d(${sx}, ${sy}, 1)`;
30633
+ el.style.setProperty("--dice-x", `${x - half}px`);
30634
+ el.style.setProperty("--dice-y", `${y - half}px`);
30635
+ el.style.setProperty("--dice-sx", String(sx));
30636
+ el.style.setProperty("--dice-sy", String(sy));
30634
30637
  },
30635
30638
  [half]
30636
30639
  );
@@ -30644,9 +30647,10 @@ function DiceRoller({
30644
30647
  []
30645
30648
  );
30646
30649
  (0, import_react66.useEffect)(() => {
30647
- const w = arenaRef.current?.offsetWidth ?? arena.w;
30648
- const h = arenaRef.current?.offsetHeight ?? arenaHeight;
30649
- if (w === 0 || h === 0) return;
30650
+ const rawW = arenaRef.current?.offsetWidth ?? 0;
30651
+ const rawH = arenaRef.current?.offsetHeight ?? 0;
30652
+ const w = rawW > 20 ? rawW : arena.w > 20 ? arena.w : 400;
30653
+ const h = rawH > 20 ? rawH : arenaHeight > 20 ? arenaHeight : 260;
30650
30654
  const initial = defaultPositions(w, h, clampedCount);
30651
30655
  currentPositionsRef.current = initial;
30652
30656
  for (let i = 0; i < clampedCount; i++) {
@@ -30654,7 +30658,10 @@ function DiceRoller({
30654
30658
  const el = dieWrapperRefs.current[i];
30655
30659
  if (el) {
30656
30660
  el.style.transition = "transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94)";
30657
- el.style.transform = `translate3d(${pos.x - half}px, ${pos.y - half}px, 0) scale3d(1, 1, 1)`;
30661
+ el.style.setProperty("--dice-x", `${pos.x - half}px`);
30662
+ el.style.setProperty("--dice-y", `${pos.y - half}px`);
30663
+ el.style.setProperty("--dice-sx", "1");
30664
+ el.style.setProperty("--dice-sy", "1");
30658
30665
  }
30659
30666
  const cube = cubeRefs.current[i];
30660
30667
  if (cube) {
@@ -30711,7 +30718,10 @@ function DiceRoller({
30711
30718
  const el = dieWrapperRefs.current[i];
30712
30719
  if (el) {
30713
30720
  el.style.transition = "transform 0.2s ease-out";
30714
- el.style.transform = `translate3d(${p.x - half}px, ${p.y - half}px, 0) scale3d(1, 1, 1)`;
30721
+ el.style.setProperty("--dice-x", `${p.x - half}px`);
30722
+ el.style.setProperty("--dice-y", `${p.y - half}px`);
30723
+ el.style.setProperty("--dice-sx", "1");
30724
+ el.style.setProperty("--dice-sy", "1");
30715
30725
  }
30716
30726
  const tgt = SHOW_ROT[vals[i]];
30717
30727
  writeCubeRotation(i, tgt.x, tgt.y, 0, true);
@@ -30756,10 +30766,27 @@ function DiceRoller({
30756
30766
  }
30757
30767
  if (capturedStep === 0 && typeof console !== "undefined") {
30758
30768
  const el0 = dieWrapperRefs.current[0];
30769
+ const el1 = dieWrapperRefs.current[1];
30770
+ const describe = (el) => {
30771
+ if (!el) return null;
30772
+ const rect = el.getBoundingClientRect();
30773
+ return {
30774
+ inlineTransform: el.style.transform,
30775
+ diceX: el.style.getPropertyValue("--dice-x"),
30776
+ diceY: el.style.getPropertyValue("--dice-y"),
30777
+ computedTransform: typeof getComputedStyle !== "undefined" ? getComputedStyle(el).transform : "n/a",
30778
+ rect: {
30779
+ x: Math.round(rect.x),
30780
+ y: Math.round(rect.y),
30781
+ w: Math.round(rect.width),
30782
+ h: Math.round(rect.height)
30783
+ }
30784
+ };
30785
+ };
30759
30786
  console.log("[DiceRoller] first frame written", {
30760
30787
  frame0: frame,
30761
- el0transform: el0?.style.transform,
30762
- el0bounds: el0 ? { w: el0.offsetWidth, h: el0.offsetHeight } : null
30788
+ el0: describe(el0),
30789
+ el1: describe(el1)
30763
30790
  });
30764
30791
  }
30765
30792
  currentPositionsRef.current = frame.slice(0, clampedCount).map((f) => ({ x: f.x, y: f.y }));
@@ -30858,24 +30885,30 @@ function DiceRoller({
30858
30885
  cursor: trigger === "click" ? "pointer" : void 0
30859
30886
  },
30860
30887
  children: Array.from({ length: clampedCount }, (_, d) => {
30888
+ const wrapperStyle = {
30889
+ position: "absolute",
30890
+ left: 0,
30891
+ top: 0,
30892
+ width: effectiveSize,
30893
+ height: effectiveSize,
30894
+ transform: "translate3d(var(--dice-x, 0px), var(--dice-y, 0px), 0) scale3d(var(--dice-sx, 1), var(--dice-sy, 1), 1)",
30895
+ // Parent must preserve 3D so the inner cube's rotateX/Y/Z
30896
+ // still renders with depth — otherwise adding a transform
30897
+ // to the wrapper would flatten its children into 2D.
30898
+ transformStyle: "preserve-3d",
30899
+ willChange: "transform",
30900
+ zIndex: 2,
30901
+ perspective: 700,
30902
+ "--dice-x": "0px",
30903
+ "--dice-y": "0px",
30904
+ "--dice-sx": "1",
30905
+ "--dice-sy": "1"
30906
+ };
30861
30907
  return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(
30862
30908
  "div",
30863
30909
  {
30864
30910
  ref: getDieSetter(d),
30865
- style: {
30866
- position: "absolute",
30867
- left: 0,
30868
- top: 0,
30869
- width: effectiveSize,
30870
- height: effectiveSize,
30871
- // Parent must preserve 3D so the inner cube's rotateX/Y/Z
30872
- // still renders with depth — otherwise adding a transform
30873
- // to the wrapper would flatten its children into 2D.
30874
- transformStyle: "preserve-3d",
30875
- willChange: "transform",
30876
- zIndex: 2,
30877
- perspective: 700
30878
- },
30911
+ style: wrapperStyle,
30879
30912
  children: [
30880
30913
  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30881
30914
  "div",