reifyui 0.13.8 → 0.13.9
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.cjs +29 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/auth/GoogleButton.jsx +24 -4
package/dist/index.js
CHANGED
|
@@ -1917,6 +1917,24 @@ function GoogleButton({ onCredential, onError, divider = true }) {
|
|
|
1917
1917
|
if (!CLIENT_ID || !ref.current) return void 0;
|
|
1918
1918
|
const SRC = "https://accounts.google.com/gsi/client";
|
|
1919
1919
|
let done = false;
|
|
1920
|
+
let drawn = 0;
|
|
1921
|
+
let observer = null;
|
|
1922
|
+
const draw = () => {
|
|
1923
|
+
const g = window.google;
|
|
1924
|
+
if (!g?.accounts?.id || !ref.current) return;
|
|
1925
|
+
const box = ref.current.getBoundingClientRect().width || 320;
|
|
1926
|
+
const width = Math.round(Math.max(200, Math.min(400, box)));
|
|
1927
|
+
if (Math.abs(width - drawn) < 2) return;
|
|
1928
|
+
drawn = width;
|
|
1929
|
+
ref.current.innerHTML = "";
|
|
1930
|
+
g.accounts.id.renderButton(ref.current, {
|
|
1931
|
+
theme: "outline",
|
|
1932
|
+
size: "large",
|
|
1933
|
+
shape: "pill",
|
|
1934
|
+
text: "continue_with",
|
|
1935
|
+
width
|
|
1936
|
+
});
|
|
1937
|
+
};
|
|
1920
1938
|
const render = () => {
|
|
1921
1939
|
if (done) return;
|
|
1922
1940
|
const g = window.google;
|
|
@@ -1930,14 +1948,16 @@ function GoogleButton({ onCredential, onError, divider = true }) {
|
|
|
1930
1948
|
else cb.current.onError?.("Google sign in was cancelled.");
|
|
1931
1949
|
}
|
|
1932
1950
|
});
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1951
|
+
draw();
|
|
1952
|
+
if (typeof ResizeObserver === "function") {
|
|
1953
|
+
observer = new ResizeObserver(() => {
|
|
1954
|
+
try {
|
|
1955
|
+
draw();
|
|
1956
|
+
} catch {
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
observer.observe(ref.current);
|
|
1960
|
+
}
|
|
1941
1961
|
} catch {
|
|
1942
1962
|
setFailed(true);
|
|
1943
1963
|
}
|
|
@@ -1961,6 +1981,7 @@ function GoogleButton({ onCredential, onError, divider = true }) {
|
|
|
1961
1981
|
return () => {
|
|
1962
1982
|
s?.removeEventListener("load", render);
|
|
1963
1983
|
window.clearTimeout(check);
|
|
1984
|
+
observer?.disconnect();
|
|
1964
1985
|
};
|
|
1965
1986
|
}, []);
|
|
1966
1987
|
if (!CLIENT_ID || failed) return null;
|