@bivy/bivy 0.19.2-staging.1 → 0.19.2-staging.3
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.
|
@@ -25,6 +25,15 @@ iframe { width:100%; height:100%; border:0; background:var(--bg); }
|
|
|
25
25
|
nav, #draw-bar { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:var(--space-1); max-width:100%; padding:var(--space-1); background:var(--surface); border:thin solid var(--line); border-radius:var(--radius-xl); box-shadow:var(--shadow-lg); }
|
|
26
26
|
nav .btn, #draw-bar .btn { flex-shrink:0; border-radius:var(--radius-full); }
|
|
27
27
|
nav .btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); }
|
|
28
|
+
/* One row, however narrow: a bar that wraps doubles what it covers. Past the
|
|
29
|
+
edge it scrolls sideways instead. */
|
|
30
|
+
nav { flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
|
|
31
|
+
nav::-webkit-scrollbar { display:none; }
|
|
32
|
+
/* The grip hides the bar on a tap and moves it to the other edge on a drag. */
|
|
33
|
+
#hide { color:var(--muted); cursor:grab; touch-action:none; }
|
|
34
|
+
#dock.dragging, #dock.dragging #hide { cursor:grabbing; }
|
|
35
|
+
#dock[data-edge="top"] { top:calc(var(--space-2) + env(safe-area-inset-top)); bottom:auto; flex-direction:column-reverse; }
|
|
36
|
+
#show[data-edge="top"] { top:calc(var(--space-3) + env(safe-area-inset-top)); bottom:auto; }
|
|
28
37
|
#name { display:flex; flex-direction:column; min-width:0; padding:0 var(--space-2); }
|
|
29
38
|
#title { font-size:var(--text-sm); font-weight:var(--weight-semibold); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:14em; }
|
|
30
39
|
#stamp { font-size:var(--text-xs); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
@@ -80,11 +89,11 @@ nav .btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accen
|
|
|
80
89
|
#compare[data-drawing] #compare-stage img { max-height:min(60vh, 560px); }
|
|
81
90
|
#compare[data-drawing] #compare-slider, #compare[data-drawing] #compare-hint, #compare[data-drawing] #compare-draw { display:none; }
|
|
82
91
|
.label-narrow { display:none; }
|
|
83
|
-
@media (max-width: 699px) { #lens { display:none; } #name { display:none; } .label-wide { display:none; } .label-narrow { display:inline; } }
|
|
92
|
+
@media (max-width: 699px) { #lens { display:none; } #name { display:none; } .label-wide { display:none; } .label-narrow { display:inline; } nav { gap:0; } nav .btn { padding-inline:var(--space-2); } }
|
|
84
93
|
/* "Made with Bivy": a quiet strip under a shared app, never over it. */
|
|
85
94
|
#made-with { flex-shrink:0; display:flex; align-items:center; justify-content:center; gap:var(--space-1); min-height:var(--space-6); padding:0 var(--space-3) env(safe-area-inset-bottom); box-sizing:border-box; background:var(--surface); border-top:thin solid var(--line); color:var(--muted); font-size:var(--text-xs); text-decoration:none; }
|
|
86
95
|
#made-with:hover, #made-with:focus-visible { color:var(--ink); }
|
|
87
|
-
body.badged #dock { bottom:calc(var(--space-2) + var(--space-6) + env(safe-area-inset-bottom)); }
|
|
96
|
+
body.badged #dock:not([data-edge="top"]) { bottom:calc(var(--space-2) + var(--space-6) + env(safe-area-inset-bottom)); }
|
|
88
97
|
[hidden] { display:none !important; }
|
|
89
98
|
</style></head><body>
|
|
90
99
|
<div class="banner" data-tone="warn" id="down" hidden><span class="banner-text" id="down-text" role="status"></span><span class="banner-actions"><button class="btn sm" id="ask" hidden>Ask agent to fix</button></span></div>
|
|
@@ -127,9 +136,9 @@ body.badged #dock { bottom:calc(var(--space-2) + var(--space-6) + env(safe-area-
|
|
|
127
136
|
<button class="btn sm primary" id="draw-done" type="button" disabled>Done</button>
|
|
128
137
|
</div>
|
|
129
138
|
<nav aria-label="Bivy preview controls">
|
|
139
|
+
<button class="btn sm ghost" id="hide" aria-label="Hide Bivy controls" title="Tap to hide · Drag to move" aria-keyshortcuts="ArrowUp ArrowDown"><svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true"><circle cx="9" cy="6" r="1.6"/><circle cx="15" cy="6" r="1.6"/><circle cx="9" cy="12" r="1.6"/><circle cx="15" cy="12" r="1.6"/><circle cx="9" cy="18" r="1.6"/><circle cx="15" cy="18" r="1.6"/></svg></button>
|
|
130
140
|
<button class="btn sm ghost" id="back" aria-label="Back to chat">‹ <span class="label-wide">Back to chat</span><span class="label-narrow">Chat</span></button>
|
|
131
141
|
<span id="name"><span id="title">App preview</span><span id="stamp" class="muted" role="status"></span></span>
|
|
132
|
-
<button class="btn sm ghost" id="hide" aria-label="Hide Bivy controls" title="Hide controls">⌄</button>
|
|
133
142
|
<button class="btn sm ghost" id="point" aria-pressed="false" disabled>Point</button>
|
|
134
143
|
<button class="btn sm ghost" id="draw" type="button" hidden>Draw</button>
|
|
135
144
|
<button class="btn sm ghost" id="compare-btn" aria-pressed="false" hidden>Compare</button>
|
|
@@ -468,8 +477,28 @@ compareBtn.onclick=async()=>{
|
|
|
468
477
|
};
|
|
469
478
|
const split=()=>{$('compare-before').style.clipPath='inset(0 '+(100-Number($('compare-slider').value))+'% 0 0)';};
|
|
470
479
|
$('compare-slider').oninput=split;
|
|
471
|
-
// The pill can cover an app's own
|
|
472
|
-
|
|
480
|
+
// The pill can cover an app's own bars: drag its grip to the other edge (kept
|
|
481
|
+
// for next time), or tap it to collapse the pill to a corner button.
|
|
482
|
+
const dock=$('dock'),grip=$('hide'),edgeKey='bivy-preview-edge';
|
|
483
|
+
function edge(to,keep){
|
|
484
|
+
dock.dataset.edge=to;$('show').dataset.edge=to;
|
|
485
|
+
if(keep)try{localStorage.setItem(edgeKey,to);}catch{}
|
|
486
|
+
}
|
|
487
|
+
try{edge(localStorage.getItem(edgeKey)==='top'?'top':'bottom');}catch{edge('bottom');}
|
|
488
|
+
let drag=null,dragged=false;
|
|
489
|
+
grip.onpointerdown=e=>{drag={y:e.clientY,moved:false};try{grip.setPointerCapture(e.pointerId);}catch{}};
|
|
490
|
+
grip.onpointermove=e=>{
|
|
491
|
+
if(!drag)return;const dy=e.clientY-drag.y;
|
|
492
|
+
if(!drag.moved&&Math.abs(dy)<8)return;
|
|
493
|
+
drag.moved=true;dock.classList.add('dragging');dock.style.transform='translateY('+dy+'px)';
|
|
494
|
+
};
|
|
495
|
+
grip.onpointerup=grip.onpointercancel=e=>{
|
|
496
|
+
if(!drag)return;const {moved}=drag;drag=null;
|
|
497
|
+
if(moved){const r=grip.getBoundingClientRect();edge(r.top+r.height/2<innerHeight/2?'top':'bottom',true);dragged=true;setTimeout(()=>{dragged=false;});}
|
|
498
|
+
dock.classList.remove('dragging');dock.style.transform='';
|
|
499
|
+
};
|
|
500
|
+
grip.onkeydown=e=>{if(e.key==='ArrowUp'||e.key==='ArrowDown'){e.preventDefault();edge(e.key==='ArrowUp'?'top':'bottom',true);}};
|
|
501
|
+
grip.onclick=()=>{if(dragged){dragged=false;return;}if(point.getAttribute('aria-pressed')==='true')pointing(false);dock.hidden=true;$('show').hidden=false;$('show').focus();};
|
|
473
502
|
$('show').onclick=()=>{$('dock').hidden=false;$('show').hidden=true;$('hide').focus();};
|
|
474
503
|
// Device lens (desktop widths)
|
|
475
504
|
for(const b of $('lens').querySelectorAll('button'))b.onclick=()=>{
|
package/dist/apps/screenshot.js
CHANGED
|
@@ -181,9 +181,12 @@ export async function takeShots(views, request, outDir, chrome = findChrome()) {
|
|
|
181
181
|
}
|
|
182
182
|
let scroll;
|
|
183
183
|
if (request.scroll) {
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
// Instant: a page's `scroll-behavior: smooth` would otherwise animate,
|
|
185
|
+
// so the position read (and the picture) would be mid-scroll.
|
|
186
|
+
await cdp.send("Runtime.evaluate", { expression: `scrollTo({left:${Number(request.scroll.x) || 0},top:${Number(request.scroll.y) || 0},behavior:'instant'})` }, sessionId);
|
|
186
187
|
await new Promise((r) => setTimeout(r, 150));
|
|
188
|
+
const { result } = await cdp.send("Runtime.evaluate", { expression: "[scrollX, scrollY]", returnByValue: true }, sessionId);
|
|
189
|
+
scroll = { x: Number(result?.value?.[0]) || 0, y: Number(result?.value?.[1]) || 0 };
|
|
187
190
|
}
|
|
188
191
|
const { data } = await cdp.send("Page.captureScreenshot", { format: "png" }, sessionId);
|
|
189
192
|
const file = path.join(outDir, `${entry.view.id.slice(0, 8)}-${width}-${theme}.png`);
|
package/package.json
CHANGED