@digilogiclabs/saas-factory-ui 1.33.0 → 1.33.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 CHANGED
@@ -3759,8 +3759,16 @@ declare function useEscapeKey(handler: () => void, enabled?: boolean): void;
3759
3759
  * 3. `prefers-color-scheme: dark` media query.
3760
3760
  *
3761
3761
  * Live-updates via a `MutationObserver` watching the root class attribute
3762
- * and a `change` listener on the media query. Safe for SSR — returns
3763
- * `false` when `document` is undefined.
3762
+ * and a `change` listener on the media query.
3763
+ *
3764
+ * SSR-safe by construction: the FIRST render always returns `false` (or the
3765
+ * `forced` value when provided), matching what the server renders. Detection
3766
+ * only runs after mount in `useEffect`, so the initial client render is
3767
+ * byte-identical to SSR — no hydration mismatch warnings. The trade-off is
3768
+ * a brief flash of light-theme markup before the effect commits the real
3769
+ * value; a no-flash app should also set `.dark` on `<html>` via a synchronous
3770
+ * script tag in the document head before React hydrates (next-themes does
3771
+ * this), in which case this hook then picks up that class on mount.
3764
3772
  */
3765
3773
  declare function useDarkMode(forced?: boolean): boolean;
3766
3774
 
package/dist/index.d.ts CHANGED
@@ -3759,8 +3759,16 @@ declare function useEscapeKey(handler: () => void, enabled?: boolean): void;
3759
3759
  * 3. `prefers-color-scheme: dark` media query.
3760
3760
  *
3761
3761
  * Live-updates via a `MutationObserver` watching the root class attribute
3762
- * and a `change` listener on the media query. Safe for SSR — returns
3763
- * `false` when `document` is undefined.
3762
+ * and a `change` listener on the media query.
3763
+ *
3764
+ * SSR-safe by construction: the FIRST render always returns `false` (or the
3765
+ * `forced` value when provided), matching what the server renders. Detection
3766
+ * only runs after mount in `useEffect`, so the initial client render is
3767
+ * byte-identical to SSR — no hydration mismatch warnings. The trade-off is
3768
+ * a brief flash of light-theme markup before the effect commits the real
3769
+ * value; a no-flash app should also set `.dark` on `<html>` via a synchronous
3770
+ * script tag in the document head before React hydrates (next-themes does
3771
+ * this), in which case this hook then picks up that class on mount.
3764
3772
  */
3765
3773
  declare function useDarkMode(forced?: boolean): boolean;
3766
3774
 
package/dist/index.js CHANGED
@@ -25443,11 +25443,6 @@ var import_react55 = require("react");
25443
25443
  function useDarkMode(forced) {
25444
25444
  const [dark, setDark] = (0, import_react55.useState)(() => {
25445
25445
  if (typeof forced === "boolean") return forced;
25446
- if (typeof document === "undefined") return false;
25447
- if (document.documentElement.classList.contains("dark")) return true;
25448
- if (typeof window !== "undefined" && window.matchMedia) {
25449
- return window.matchMedia("(prefers-color-scheme: dark)").matches;
25450
- }
25451
25446
  return false;
25452
25447
  });
25453
25448
  (0, import_react55.useEffect)(() => {
@@ -31768,8 +31763,7 @@ function BracketGenerator({
31768
31763
  champion: null
31769
31764
  };
31770
31765
  setBracketState(newState);
31771
- onStateChange?.(newState);
31772
- }, [effectiveParticipants, seedingStrategy, onStateChange]);
31766
+ }, [effectiveParticipants, seedingStrategy]);
31773
31767
  const simulateNext = (0, import_react69.useCallback)(() => {
31774
31768
  setBracketState((prev) => {
31775
31769
  const next = prev.matches.find((m) => m.a && m.b && !m.winner);
@@ -31782,13 +31776,9 @@ function BracketGenerator({
31782
31776
  matches = propagateWinner(matches, completed);
31783
31777
  const finalMatch = matches.find((m) => m.round === prev.rounds - 1);
31784
31778
  const champion = finalMatch?.winner || null;
31785
- onMatchComplete?.(completed, completed.winner);
31786
- if (champion && !prev.champion) onChampion?.(champion);
31787
- const newState = { ...prev, matches, champion };
31788
- onStateChange?.(newState);
31789
- return newState;
31779
+ return { ...prev, matches, champion };
31790
31780
  });
31791
- }, [onMatchComplete, onChampion, onStateChange]);
31781
+ }, []);
31792
31782
  const autoPlay = (0, import_react69.useCallback)(() => {
31793
31783
  if (simulating) {
31794
31784
  if (autoRef.current) clearTimeout(autoRef.current);
@@ -31811,17 +31801,13 @@ function BracketGenerator({
31811
31801
  matches = propagateWinner(matches, completed);
31812
31802
  const finalMatch = matches.find((m) => m.round === prev.rounds - 1);
31813
31803
  const champion = finalMatch?.winner || null;
31814
- onMatchComplete?.(completed, completed.winner);
31815
- if (champion && !prev.champion) onChampion?.(champion);
31816
- const newState = { ...prev, matches, champion };
31817
- onStateChange?.(newState);
31818
31804
  if (!champion) autoRef.current = setTimeout(tick, simulateDelayMs);
31819
31805
  else setSimulating(false);
31820
- return newState;
31806
+ return { ...prev, matches, champion };
31821
31807
  });
31822
31808
  };
31823
31809
  tick();
31824
- }, [simulating, simulateDelayMs, onMatchComplete, onChampion, onStateChange]);
31810
+ }, [simulating, simulateDelayMs]);
31825
31811
  const advanceWinner = (0, import_react69.useCallback)(
31826
31812
  (matchId, winnerSlot) => {
31827
31813
  setBracketState((prev) => {
@@ -31840,15 +31826,31 @@ function BracketGenerator({
31840
31826
  matches = propagateWinner(matches, completed);
31841
31827
  const finalMatch = matches.find((x) => x.round === prev.rounds - 1);
31842
31828
  const champion = finalMatch?.winner || null;
31843
- onMatchComplete?.(completed, winner);
31844
- if (champion && !prev.champion) onChampion?.(champion);
31845
- const newState = { ...prev, matches, champion };
31846
- onStateChange?.(newState);
31847
- return newState;
31829
+ return { ...prev, matches, champion };
31848
31830
  });
31849
31831
  },
31850
- [onMatchComplete, onChampion, onStateChange]
31832
+ []
31851
31833
  );
31834
+ const prevBracketStateRef = (0, import_react69.useRef)(bracketState);
31835
+ (0, import_react69.useEffect)(() => {
31836
+ const prev = prevBracketStateRef.current;
31837
+ const next = bracketState;
31838
+ if (prev === next) return;
31839
+ if (onMatchComplete) {
31840
+ const prevById = new Map(prev.matches.map((m) => [m.id, m]));
31841
+ for (const m of next.matches) {
31842
+ const before = prevById.get(m.id);
31843
+ if (m.winner && !before?.winner) {
31844
+ onMatchComplete(m, m.winner);
31845
+ }
31846
+ }
31847
+ }
31848
+ if (onChampion && next.champion && !prev.champion) {
31849
+ onChampion(next.champion);
31850
+ }
31851
+ onStateChange?.(next);
31852
+ prevBracketStateRef.current = next;
31853
+ }, [bracketState, onMatchComplete, onChampion, onStateChange]);
31852
31854
  (0, import_react69.useEffect)(() => {
31853
31855
  seedBracket();
31854
31856
  return () => {
@@ -31940,7 +31942,7 @@ function BracketGenerator({
31940
31942
  height: MATCH_H / 2,
31941
31943
  cursor: hasBoth && !m.winner ? "pointer" : "default",
31942
31944
  opacity: isLoss ? 0.45 : 1,
31943
- textDecoration: isLoss ? "line-through" : "none",
31945
+ textDecorationLine: isLoss ? "line-through" : "none",
31944
31946
  textDecorationColor: colors.faint,
31945
31947
  transition: "background 0.2s, color 0.2s",
31946
31948
  fontStyle: !p ? "italic" : "normal"
@@ -35475,7 +35477,7 @@ function CtaButton({
35475
35477
  background: isPrimary ? accent : isGhost ? "transparent" : "rgba(255,255,255,0.06)",
35476
35478
  color: isPrimary ? "#fff" : "rgba(255,255,255,0.8)",
35477
35479
  cursor: "pointer",
35478
- textDecoration: isGhost ? "underline" : "none",
35480
+ textDecorationLine: isGhost ? "underline" : "none",
35479
35481
  textUnderlineOffset: isGhost ? 4 : void 0,
35480
35482
  letterSpacing: "-0.01em",
35481
35483
  boxShadow: isPrimary ? `0 4px 20px ${glow}33` : "none",