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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reifyui",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.9",
|
|
4
4
|
"description": "The open-source rendering & interaction layer for agentic applications. Stream and render any agent's output as polished, application-native UI — model-agnostic, framework-agnostic, design-system-native. The foundation for building generative-UI and agent products.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -23,6 +23,24 @@ export function GoogleButton({ onCredential, onError, divider = true }) {
|
|
|
23
23
|
if (!CLIENT_ID || !ref.current) return undefined;
|
|
24
24
|
const SRC = 'https://accounts.google.com/gsi/client';
|
|
25
25
|
let done = false;
|
|
26
|
+
let drawn = 0;
|
|
27
|
+
let observer = null;
|
|
28
|
+
// Google draws its button at the width it is given (200 to 400 px). Give it
|
|
29
|
+
// the width of the box it sits in, the form's, so it lines up with the inputs
|
|
30
|
+
// and the Sign in button; draw it again when that width changes (a dialog
|
|
31
|
+
// that becomes a sheet on a phone).
|
|
32
|
+
const draw = () => {
|
|
33
|
+
const g = window.google;
|
|
34
|
+
if (!g?.accounts?.id || !ref.current) return;
|
|
35
|
+
const box = ref.current.getBoundingClientRect().width || 320;
|
|
36
|
+
const width = Math.round(Math.max(200, Math.min(400, box)));
|
|
37
|
+
if (Math.abs(width - drawn) < 2) return;
|
|
38
|
+
drawn = width;
|
|
39
|
+
ref.current.innerHTML = '';
|
|
40
|
+
g.accounts.id.renderButton(ref.current, {
|
|
41
|
+
theme: 'outline', size: 'large', shape: 'pill', text: 'continue_with', width,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
26
44
|
const render = () => {
|
|
27
45
|
if (done) return;
|
|
28
46
|
const g = window.google;
|
|
@@ -36,10 +54,11 @@ export function GoogleButton({ onCredential, onError, divider = true }) {
|
|
|
36
54
|
else cb.current.onError?.('Google sign in was cancelled.');
|
|
37
55
|
},
|
|
38
56
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
draw();
|
|
58
|
+
if (typeof ResizeObserver === 'function') {
|
|
59
|
+
observer = new ResizeObserver(() => { try { draw(); } catch { /* keep the last drawing */ } });
|
|
60
|
+
observer.observe(ref.current);
|
|
61
|
+
}
|
|
43
62
|
} catch {
|
|
44
63
|
setFailed(true);
|
|
45
64
|
}
|
|
@@ -65,6 +84,7 @@ export function GoogleButton({ onCredential, onError, divider = true }) {
|
|
|
65
84
|
return () => {
|
|
66
85
|
s?.removeEventListener('load', render);
|
|
67
86
|
window.clearTimeout(check);
|
|
87
|
+
observer?.disconnect();
|
|
68
88
|
};
|
|
69
89
|
}, []);
|
|
70
90
|
|