reifyui 0.13.8 → 0.14.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.js CHANGED
@@ -14,8 +14,11 @@ import {
14
14
  sheetToDelimited
15
15
  } from "./chunk-G34T6ZLN.js";
16
16
  import {
17
- Chevron,
18
17
  CodeBlock,
18
+ Modal
19
+ } from "./chunk-AGSX5YKH.js";
20
+ import {
21
+ Chevron,
19
22
  IcCheck,
20
23
  IcDoc,
21
24
  IcDownload,
@@ -35,9 +38,8 @@ import {
35
38
  IcThink,
36
39
  IcTool,
37
40
  IcX,
38
- Modal,
39
41
  Svg
40
- } from "./chunk-J7SECRIG.js";
42
+ } from "./chunk-WAND7AYD.js";
41
43
  import {
42
44
  useOverlayEscape
43
45
  } from "./chunk-J633KV57.js";
@@ -1917,6 +1919,24 @@ function GoogleButton({ onCredential, onError, divider = true }) {
1917
1919
  if (!CLIENT_ID || !ref.current) return void 0;
1918
1920
  const SRC = "https://accounts.google.com/gsi/client";
1919
1921
  let done = false;
1922
+ let drawn = 0;
1923
+ let observer = null;
1924
+ const draw = () => {
1925
+ const g = window.google;
1926
+ if (!g?.accounts?.id || !ref.current) return;
1927
+ const box = ref.current.getBoundingClientRect().width || 320;
1928
+ const width = Math.round(Math.max(200, Math.min(400, box)));
1929
+ if (Math.abs(width - drawn) < 2) return;
1930
+ drawn = width;
1931
+ ref.current.innerHTML = "";
1932
+ g.accounts.id.renderButton(ref.current, {
1933
+ theme: "outline",
1934
+ size: "large",
1935
+ shape: "pill",
1936
+ text: "continue_with",
1937
+ width
1938
+ });
1939
+ };
1920
1940
  const render = () => {
1921
1941
  if (done) return;
1922
1942
  const g = window.google;
@@ -1930,14 +1950,16 @@ function GoogleButton({ onCredential, onError, divider = true }) {
1930
1950
  else cb.current.onError?.("Google sign in was cancelled.");
1931
1951
  }
1932
1952
  });
1933
- ref.current.innerHTML = "";
1934
- g.accounts.id.renderButton(ref.current, {
1935
- theme: "outline",
1936
- size: "large",
1937
- shape: "pill",
1938
- text: "continue_with",
1939
- width: 320
1940
- });
1953
+ draw();
1954
+ if (typeof ResizeObserver === "function") {
1955
+ observer = new ResizeObserver(() => {
1956
+ try {
1957
+ draw();
1958
+ } catch {
1959
+ }
1960
+ });
1961
+ observer.observe(ref.current);
1962
+ }
1941
1963
  } catch {
1942
1964
  setFailed(true);
1943
1965
  }
@@ -1961,6 +1983,7 @@ function GoogleButton({ onCredential, onError, divider = true }) {
1961
1983
  return () => {
1962
1984
  s?.removeEventListener("load", render);
1963
1985
  window.clearTimeout(check);
1986
+ observer?.disconnect();
1964
1987
  };
1965
1988
  }, []);
1966
1989
  if (!CLIENT_ID || failed) return null;