@digilogiclabs/saas-factory-ui 1.16.4 → 1.16.6

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) {
@@ -30697,35 +30704,13 @@ function DiceRoller({
30697
30704
  clampedCount,
30698
30705
  effectiveSize,
30699
30706
  starts,
30707
+ reducedMotion,
30700
30708
  refs: {
30701
30709
  die: dieWrapperRefs.current.map((el) => !!el),
30702
30710
  cube: cubeRefs.current.map((el) => !!el)
30703
30711
  }
30704
30712
  });
30705
30713
  }
30706
- if (reducedMotion) {
30707
- const final = defaultPositions(w, h, clampedCount);
30708
- currentPositionsRef.current = final;
30709
- for (let i = 0; i < clampedCount; i++) {
30710
- const p = final[i];
30711
- const el = dieWrapperRefs.current[i];
30712
- if (el) {
30713
- 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)`;
30715
- }
30716
- const tgt = SHOW_ROT[vals[i]];
30717
- writeCubeRotation(i, tgt.x, tgt.y, 0, true);
30718
- }
30719
- setResults(vals);
30720
- setRolling(false);
30721
- rollingRef.current = false;
30722
- const total2 = vals.reduce((a, b) => a + b, 0);
30723
- onRoll?.(vals, total2);
30724
- if (showHistory) {
30725
- setHistory((prev) => [{ vals, total: total2 }, ...prev].slice(0, historyMax));
30726
- }
30727
- return;
30728
- }
30729
30714
  const frames = simulateDice(w, h, effectiveSize, starts, clampedCount);
30730
30715
  for (let i = 0; i < clampedCount; i++) {
30731
30716
  writeCubeRotation(
@@ -30756,10 +30741,27 @@ function DiceRoller({
30756
30741
  }
30757
30742
  if (capturedStep === 0 && typeof console !== "undefined") {
30758
30743
  const el0 = dieWrapperRefs.current[0];
30744
+ const el1 = dieWrapperRefs.current[1];
30745
+ const describe = (el) => {
30746
+ if (!el) return null;
30747
+ const rect = el.getBoundingClientRect();
30748
+ return {
30749
+ inlineTransform: el.style.transform,
30750
+ diceX: el.style.getPropertyValue("--dice-x"),
30751
+ diceY: el.style.getPropertyValue("--dice-y"),
30752
+ computedTransform: typeof getComputedStyle !== "undefined" ? getComputedStyle(el).transform : "n/a",
30753
+ rect: {
30754
+ x: Math.round(rect.x),
30755
+ y: Math.round(rect.y),
30756
+ w: Math.round(rect.width),
30757
+ h: Math.round(rect.height)
30758
+ }
30759
+ };
30760
+ };
30759
30761
  console.log("[DiceRoller] first frame written", {
30760
30762
  frame0: frame,
30761
- el0transform: el0?.style.transform,
30762
- el0bounds: el0 ? { w: el0.offsetWidth, h: el0.offsetHeight } : null
30763
+ el0: describe(el0),
30764
+ el1: describe(el1)
30763
30765
  });
30764
30766
  }
30765
30767
  currentPositionsRef.current = frame.slice(0, clampedCount).map((f) => ({ x: f.x, y: f.y }));
@@ -30858,85 +30860,83 @@ function DiceRoller({
30858
30860
  cursor: trigger === "click" ? "pointer" : void 0
30859
30861
  },
30860
30862
  children: Array.from({ length: clampedCount }, (_, d) => {
30861
- return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(
30862
- "div",
30863
- {
30864
- 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
- },
30879
- children: [
30880
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30863
+ const wrapperStyle = {
30864
+ position: "absolute",
30865
+ left: 0,
30866
+ top: 0,
30867
+ width: effectiveSize,
30868
+ height: effectiveSize,
30869
+ transform: "translate3d(var(--dice-x, 0px), var(--dice-y, 0px), 0) scale3d(var(--dice-sx, 1), var(--dice-sy, 1), 1)",
30870
+ // Parent must preserve 3D so the inner cube's rotateX/Y/Z
30871
+ // still renders with depth — otherwise adding a transform
30872
+ // to the wrapper would flatten its children into 2D.
30873
+ transformStyle: "preserve-3d",
30874
+ willChange: "transform",
30875
+ zIndex: 2,
30876
+ perspective: 700,
30877
+ "--dice-x": "0px",
30878
+ "--dice-y": "0px",
30879
+ "--dice-sx": "1",
30880
+ "--dice-sy": "1"
30881
+ };
30882
+ return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { ref: getDieSetter(d), style: wrapperStyle, children: [
30883
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30884
+ "div",
30885
+ {
30886
+ ref: getShadowSetter(d),
30887
+ style: {
30888
+ position: "absolute",
30889
+ bottom: -6,
30890
+ left: "12%",
30891
+ width: "76%",
30892
+ height: 10,
30893
+ background: `radial-gradient(ellipse,${colors.shadow} 0%,transparent 70%)`,
30894
+ borderRadius: "50%",
30895
+ pointerEvents: "none",
30896
+ opacity: 0.85,
30897
+ transition: "opacity 0.3s"
30898
+ }
30899
+ }
30900
+ ),
30901
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30902
+ "div",
30903
+ {
30904
+ ref: getCubeSetter(d),
30905
+ style: {
30906
+ width: "100%",
30907
+ height: "100%",
30908
+ position: "relative",
30909
+ transformStyle: "preserve-3d",
30910
+ willChange: "transform"
30911
+ },
30912
+ children: [1, 2, 3, 4, 5, 6].map((val, fi) => /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30881
30913
  "div",
30882
30914
  {
30883
- ref: getShadowSetter(d),
30884
30915
  style: {
30885
30916
  position: "absolute",
30886
- bottom: -6,
30887
- left: "12%",
30888
- width: "76%",
30889
- height: 10,
30890
- background: `radial-gradient(ellipse,${colors.shadow} 0%,transparent 70%)`,
30891
- borderRadius: "50%",
30892
- pointerEvents: "none",
30893
- opacity: 0.85,
30894
- transition: "opacity 0.3s"
30895
- }
30896
- }
30897
- ),
30898
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30899
- "div",
30900
- {
30901
- ref: getCubeSetter(d),
30902
- style: {
30903
- width: "100%",
30904
- height: "100%",
30905
- position: "relative",
30906
- transformStyle: "preserve-3d",
30907
- willChange: "transform"
30917
+ width: effectiveSize,
30918
+ height: effectiveSize,
30919
+ background: colors.face,
30920
+ border: `1px solid ${colors.faceBorder}`,
30921
+ borderRadius: faceRadius,
30922
+ transform: faceTransforms[fi],
30923
+ transition: "background 0.3s, border-color 0.3s"
30908
30924
  },
30909
- children: [1, 2, 3, 4, 5, 6].map((val, fi) => /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30910
- "div",
30925
+ children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30926
+ Face,
30911
30927
  {
30912
- style: {
30913
- position: "absolute",
30914
- width: effectiveSize,
30915
- height: effectiveSize,
30916
- background: colors.face,
30917
- border: `1px solid ${colors.faceBorder}`,
30918
- borderRadius: faceRadius,
30919
- transform: faceTransforms[fi],
30920
- transition: "background 0.3s, border-color 0.3s"
30921
- },
30922
- children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
30923
- Face,
30924
- {
30925
- value: val,
30926
- pipColor: colors.pip,
30927
- pipShadow: colors.pipShadow,
30928
- pipDiameter
30929
- }
30930
- )
30931
- },
30932
- val
30933
- ))
30934
- }
30935
- )
30936
- ]
30937
- },
30938
- d
30939
- );
30928
+ value: val,
30929
+ pipColor: colors.pip,
30930
+ pipShadow: colors.pipShadow,
30931
+ pipDiameter
30932
+ }
30933
+ )
30934
+ },
30935
+ val
30936
+ ))
30937
+ }
30938
+ )
30939
+ ] }, d);
30940
30940
  })
30941
30941
  }
30942
30942
  ),