screw-bugs 0.1.2 → 0.1.4
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/README.md +1 -1
- package/dist/build-info.json +3 -3
- package/dist/core/engine.d.ts +4 -1
- package/dist/core/engine.js +9 -1
- package/dist/report/assets.js +1 -1
- package/dist/report/html.d.ts +4 -3
- package/dist/report/html.js +17 -13
- package/dist/report/icons.d.ts +1 -0
- package/dist/report/icons.js +3 -3
- package/dist/report/index.d.ts +1 -1
- package/dist/report/index.js +1 -1
- package/dist/report/markup.d.ts +5 -14
- package/dist/report/markup.js +31 -69
- package/dist/report/menu-bar.d.ts +60 -0
- package/dist/report/menu-bar.js +157 -0
- package/dist/report/player.d.ts +3 -3
- package/dist/report/player.js +8 -8
- package/dist/report/sign-in.d.ts +1 -1
- package/dist/report/sign-in.js +13 -65
- package/dist/report/styles.js +9 -33
- package/dist/report/walkthrough.d.ts +1 -1
- package/dist/report/walkthrough.js +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ Set up screw-bugs (local browser QA for coding agents, over MCP) in this project
|
|
|
83
83
|
|
|
84
84
|
## Requirements
|
|
85
85
|
|
|
86
|
-
Node.js 22.
|
|
86
|
+
Node.js 22.19 or newer, and Google Chrome or Microsoft Edge (or Playwright's Chromium). Check with:
|
|
87
87
|
|
|
88
88
|
```sh
|
|
89
89
|
npx screw-bugs@latest doctor
|
package/dist/build-info.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "2026-11-
|
|
3
|
-
"builtAt": "2026-11-
|
|
4
|
-
"commit": "
|
|
2
|
+
"id": "2026-11-13T11:00:20.917Z-81dac5f8",
|
|
3
|
+
"builtAt": "2026-11-13T11:00:20.917Z",
|
|
4
|
+
"commit": "61e415a9507f4ee3261dba9b5318a1d419b38b72"
|
|
5
5
|
}
|
package/dist/core/engine.d.ts
CHANGED
|
@@ -50,7 +50,10 @@ declare const Engine_base: Context.ServiceClass<Engine, "screw-bugs/Engine", {
|
|
|
50
50
|
* whether the run may get one (never an interrupted run).
|
|
51
51
|
*/
|
|
52
52
|
readonly writeWalkthrough: (jobId: JobId) => Effect.Effect<string, RunNotFound | StorageFailed>;
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* The report bundle of a run as it is now, with the agent's write-up if it gave one, naming
|
|
55
|
+
* its `walkthrough.html` when the run folder has one beside its own `report.html`.
|
|
56
|
+
*/
|
|
54
57
|
readonly bundle: (jobId: JobId) => Effect.Effect<ReportBundle, RunNotFound | StorageFailed>;
|
|
55
58
|
/**
|
|
56
59
|
* Checks an agent's findings against an ended run (`checkFindings`), saves them as
|
package/dist/core/engine.js
CHANGED
|
@@ -475,7 +475,15 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
475
475
|
}),
|
|
476
476
|
bundle: (jobId) => Effect.gen(function* () {
|
|
477
477
|
const job = yield* storage.readJob(jobId);
|
|
478
|
-
|
|
478
|
+
const { bundle } = yield* assemble(job, yield* status(jobId));
|
|
479
|
+
// Names the walkthrough as the written report does, when the run has one: a share
|
|
480
|
+
// built from this bundle shows it only then. Only beside the run's own report: a
|
|
481
|
+
// walkthrough left by a run that died before writing it belongs to no report.
|
|
482
|
+
const walkthrough = yield* storage.probe(jobId, runFiles.walkthrough, 0);
|
|
483
|
+
const report = yield* storage.probe(jobId, runFiles.html, 0);
|
|
484
|
+
return walkthrough === undefined || report === undefined
|
|
485
|
+
? bundle
|
|
486
|
+
: { ...bundle, files: { ...bundle.files, walkthrough: runFiles.walkthrough } };
|
|
479
487
|
}),
|
|
480
488
|
submitFindings: (jobId, findings) => Effect.gen(function* () {
|
|
481
489
|
const job = yield* storage.readJob(jobId);
|
package/dist/report/assets.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Schema } from 'effect';
|
|
|
8
8
|
* plus the file's path, and the page's Content Security Policy lets images and media, and nothing
|
|
9
9
|
* else, load from its origin.
|
|
10
10
|
*
|
|
11
|
-
* Links from one page to the other (the report's "Walkthrough", the walkthrough's "
|
|
11
|
+
* Links from one page to the other (the report's "Walkthrough", the walkthrough's "Report")
|
|
12
12
|
* stay relative: they are pages, not files to load, and a host serves them side by side under its
|
|
13
13
|
* own policy, never from the file origin, which should not serve HTML that runs as a page.
|
|
14
14
|
*/
|
package/dist/report/html.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { type RenderOptions } from './assets.js';
|
|
|
19
19
|
* failed. Without script: the video has its own controls, timecodes open the video at their time
|
|
20
20
|
* and screenshots open the image.
|
|
21
21
|
*/
|
|
22
|
-
export declare const REPORT_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.top');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nconst setTheme=m=>{r.dataset.theme=m;d.querySelectorAll('[data-theme-set]').forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.themeSet===m)))};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst chrome=()=>{\n setTheme(r.dataset.theme);\n d.querySelectorAll('.theme').forEach(t=>{t.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n e.textContent=p.month+' '+p.day+', '+p.year+' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute;\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.addEventListener('click',e=>{const b=e.target.closest('[data-theme-set]');if(!b)return;setTheme(b.dataset.themeSet);try{localStorage.setItem(K,b.dataset.themeSet)}catch(x){}});\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),empty=d.getElementById(p+'-none');let cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{if(!v.error)return;dead.add(cur);if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nconst badImg=i=>{const f=i.closest('figure');if(!f||f.classList.contains('broken'))return;f.classList.add('broken');f.querySelectorAll('.unloaded').forEach(u=>u.removeAttribute('aria-hidden'))};\nconst scan=()=>d.querySelectorAll('figure img').forEach(i=>{if(i.complete&&i.naturalWidth===0)badImg(i)});\nd.addEventListener('error',e=>{const t=e.target;if(t instanceof Element&&t.matches('figure img'))badImg(t)},true);\naddEventListener('load',scan);\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();scan();\n const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];\n const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),dlg=d.getElementById('viewer');\n const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;\n const timed=c=>!!c&&c.dataset.t0!==undefined;\n const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];\n const shown=()=>cards.filter(c=>!c.hidden);\n const line=()=>{const b=topEdge();if(matchMedia('(max-width: 900px)').matches){const s=d.querySelector('.rp-left');return s?s.getBoundingClientRect().bottom+24:b+120}return Math.round(b+(innerHeight-b)*0.3)};\n const playable=c=>timed(c)&&!!P&&P.has(c.dataset.s);\n const chip=c=>{if(!playable(c)||P.down()!==null)return '';const s=span(c);return (loop?'Looping ':'Playing ')+clock(s[0])+dash+clock(s[1])};\n const paintNow=()=>{\n if(!np||!cur)return;\n np.querySelector('.np-st').replaceChildren(cur.querySelector('.case-head .st').cloneNode(true));\n np.querySelector('.np-n').textContent=cur.dataset.i+' / '+N;\n np.querySelector('.np-title').textContent=cur.querySelector('.case-go').textContent;\n np.querySelector('.np-status').textContent=cur.dataset.label+': ';\n const ch=np.querySelector('.np-chip'),t=chip(cur);ch.querySelector('span').textContent=t||'No video';ch.classList.toggle('none',!t);\n };\n const toCard=c=>{lock=Date.now()+700;const y=c.getBoundingClientRect().top+scrollY-line()+2;scrollTo({top:Math.max(0,y),behavior:still()?'auto':'smooth'})};\n const setCurrent=(c,seek,scroll)=>{\n if(!c)return;\n if(c!==cur){if(cur){cur.classList.remove('on');cur.removeAttribute('aria-current')}cur=c;c.classList.add('on');c.setAttribute('aria-current','true');segs.forEach(x=>x.classList.toggle('on',x.dataset.case===c.dataset.id));paintNow()}\n if(seek&&P){if(playable(c)){const a=span(c)[0];lastT=a;P.load(c.dataset.s,a,P.playing())}else P.none()}\n if(scroll)toCard(c);\n };\n const caseAt=(s,t)=>{let f=null;for(const c of shown()){if(timed(c)&&c.dataset.s===s){const x=span(c);if(t>=x[0]&&t<x[1])f=c}}return f};\n const onScroll=()=>{\n if(Date.now()<lock)return;const vis=shown();if(!vis.length)return;\n const L=line();let pick=vis[0];for(const c of vis){if(c.getBoundingClientRect().top<=L)pick=c}\n const last=vis[vis.length-1];if(innerHeight+scrollY>=r.scrollHeight-2&&last.getBoundingClientRect().bottom<=innerHeight)pick=last;\n if(pick!==cur)setCurrent(pick,true,false);\n };\n const stk=d.querySelector('.rp-sticky'),head=d.querySelector('.rp-head');\n const fit=()=>{if(stk)stk.style.setProperty('--rp-top',Math.round(stk.getBoundingClientRect().top)+'px')};\n fit();addEventListener('resize',fit);addEventListener('load',fit);\n if(head&&window.ResizeObserver)new ResizeObserver(fit).observe(head);\n addEventListener('scroll',()=>{if(!sr)sr=requestAnimationFrame(()=>{sr=0;fit();onScroll()})},{passive:true});\n if(d.getElementById('rp-video'))P=player('rp',{\n broken:paintNow,fine:paintNow,\n tick:t=>{\n if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();\n if(loop){if(timed(cur)&&cur.dataset.s===s){const x=span(cur);if(!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}}}\n else{const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}\n lastT=t;\n },\n seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},\n ended:()=>{\n if(!cur)return false;\n if(loop&&timed(cur)&&cur.dataset.s===P.cur()){P.load(P.cur(),span(cur)[0],true);return true}\n if(!loop){const later=shown().find(c=>timed(c)&&Number(c.dataset.s)>Number(P.cur())&&P.has(c.dataset.s));if(later){setCurrent(later,false,true);P.load(later.dataset.s,span(later)[0],true);return true}}\n return false;\n },\n });\n if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});\n const filter=f=>{\n d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));\n cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});\n segs.forEach(x=>{const c=cards.find(k=>k.dataset.id===x.dataset.case);x.classList.toggle('off',!!c&&c.hidden)});\n if(cur&&cur.hidden)setCurrent(shown()[0],true,false);\n };\n d.querySelectorAll('[data-filter]').forEach(b=>b.addEventListener('click',()=>filter(b.dataset.filter)));\n d.querySelectorAll('.filters').forEach(f=>f.classList.add('live'));\n let vCase=null,vIdx=0,opener=null;\n const q=s=>dlg.querySelector(s);\n const list=c=>{const t=c&&c.querySelector('template.shots');return t?[...t.content.children]:[]};\n const showShot=()=>{\n const l=list(vCase),f=l[vIdx];if(!f)return;\n q('.v-body').replaceChildren(f.cloneNode(true));\n q('.v-st').replaceChildren(vCase.querySelector('.case-head .st').cloneNode(true));\n q('.v-title').textContent=vCase.querySelector('.case-go').textContent;\n q('.v-what').textContent=f.dataset.cap+(l.length>1?' ('+(vIdx+1)+' of '+l.length+')':'');\n q('.v-prev').disabled=vIdx===0;q('.v-next').disabled=vIdx>=l.length-1;scan();\n };\n if(dlg){\n q('.v-prev').addEventListener('click',()=>{if(vIdx>0){vIdx--;showShot()}});\n q('.v-next').addEventListener('click',()=>{if(vIdx<list(vCase).length-1){vIdx++;showShot()}});\n q('.v-close').addEventListener('click',()=>dlg.close());\n dlg.addEventListener('click',e=>{if(e.target===dlg)dlg.close()});\n dlg.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();q('.v-prev').click()}else if(e.key==='ArrowRight'){e.preventDefault();q('.v-next').click()}});\n dlg.addEventListener('close',()=>{q('.v-body').replaceChildren();if(opener&&opener.isConnected)opener.focus()});\n }\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const tc=t.closest('a.tc[data-t]');\n if(tc){if(!P||!P.has(tc.dataset.s))return;e.preventDefault();const s=tc.dataset.s,at=Number(tc.dataset.t),c=caseAt(s,at)||tc.closest('.case')||(dlg&&dlg.open?vCase:null);if(dlg&&dlg.open)dlg.close();if(c)setCurrent(c,false,!tc.closest('.case'));lastT=at;P.load(s,at,P.playing());return}\n const go=t.closest('a[href^=\"#case-\"]');\n if(go){const c=d.getElementById(go.getAttribute('href').slice(1));if(!c||!c.matches('.case[data-i]'))return;e.preventDefault();if(c.hidden)filter('all');toCard(c);setCurrent(c,true,false);return}\n const shot=t.closest('[data-shot]');\n if(shot&&dlg&&dlg.showModal){e.preventDefault();opener=shot;vCase=shot.closest('.case');vIdx=Number(shot.dataset.shot)||0;showShot();dlg.showModal();q('.v-close').focus();return}\n const c=t.closest('.case[data-i]');\n if(!c||t.closest('a,summary,details,input,label')||(t.closest('button')&&!t.closest('.case-go')))return;\n toCard(c);setCurrent(c,true,false);\n });\n const first=cards.find(c=>timed(c)&&(!P||P.has(c.dataset.s)))||cards[0];\n if(first){setCurrent(first,false,false);if(timed(first))lastT=span(first)[0]}\n});\n})();";
|
|
22
|
+
export declare const REPORT_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),empty=d.getElementById(p+'-none');let cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{if(!v.error)return;dead.add(cur);if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nconst badImg=i=>{const f=i.closest('figure');if(!f||f.classList.contains('broken'))return;f.classList.add('broken');f.querySelectorAll('.unloaded').forEach(u=>u.removeAttribute('aria-hidden'))};\nconst scan=()=>d.querySelectorAll('figure img').forEach(i=>{if(i.complete&&i.naturalWidth===0)badImg(i)});\nd.addEventListener('error',e=>{const t=e.target;if(t instanceof Element&&t.matches('figure img'))badImg(t)},true);\naddEventListener('load',scan);\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();scan();\n const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];\n const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),dlg=d.getElementById('viewer');\n const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;\n const timed=c=>!!c&&c.dataset.t0!==undefined;\n const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];\n const shown=()=>cards.filter(c=>!c.hidden);\n const line=()=>{const b=topEdge();if(matchMedia('(max-width: 900px)').matches){const s=d.querySelector('.rp-left');return s?s.getBoundingClientRect().bottom+24:b+120}return Math.round(b+(innerHeight-b)*0.3)};\n const playable=c=>timed(c)&&!!P&&P.has(c.dataset.s);\n const chip=c=>{if(!playable(c)||P.down()!==null)return '';const s=span(c);return (loop?'Looping ':'Playing ')+clock(s[0])+dash+clock(s[1])};\n const paintNow=()=>{\n if(!np||!cur)return;\n np.querySelector('.np-st').replaceChildren(cur.querySelector('.case-head .st').cloneNode(true));\n np.querySelector('.np-n').textContent=cur.dataset.i+' / '+N;\n np.querySelector('.np-title').textContent=cur.querySelector('.case-go').textContent;\n np.querySelector('.np-status').textContent=cur.dataset.label+': ';\n const ch=np.querySelector('.np-chip'),t=chip(cur);ch.querySelector('span').textContent=t||'No video';ch.classList.toggle('none',!t);\n };\n const toCard=c=>{lock=Date.now()+700;const y=c.getBoundingClientRect().top+scrollY-line()+2;scrollTo({top:Math.max(0,y),behavior:still()?'auto':'smooth'})};\n const setCurrent=(c,seek,scroll)=>{\n if(!c)return;\n if(c!==cur){if(cur){cur.classList.remove('on');cur.removeAttribute('aria-current')}cur=c;c.classList.add('on');c.setAttribute('aria-current','true');segs.forEach(x=>x.classList.toggle('on',x.dataset.case===c.dataset.id));paintNow()}\n if(seek&&P){if(playable(c)){const a=span(c)[0];lastT=a;P.load(c.dataset.s,a,P.playing())}else P.none()}\n if(scroll)toCard(c);\n };\n const caseAt=(s,t)=>{let f=null;for(const c of shown()){if(timed(c)&&c.dataset.s===s){const x=span(c);if(t>=x[0]&&t<x[1])f=c}}return f};\n const onScroll=()=>{\n if(Date.now()<lock)return;const vis=shown();if(!vis.length)return;\n const L=line();let pick=vis[0];for(const c of vis){if(c.getBoundingClientRect().top<=L)pick=c}\n const last=vis[vis.length-1];if(innerHeight+scrollY>=r.scrollHeight-2&&last.getBoundingClientRect().bottom<=innerHeight)pick=last;\n if(pick!==cur)setCurrent(pick,true,false);\n };\n const stk=d.querySelector('.rp-sticky'),head=d.querySelector('.rp-head');\n const fit=()=>{if(stk)stk.style.setProperty('--rp-top',Math.round(stk.getBoundingClientRect().top)+'px')};\n fit();addEventListener('resize',fit);addEventListener('load',fit);\n if(head&&window.ResizeObserver)new ResizeObserver(fit).observe(head);\n addEventListener('scroll',()=>{if(!sr)sr=requestAnimationFrame(()=>{sr=0;fit();onScroll()})},{passive:true});\n if(d.getElementById('rp-video'))P=player('rp',{\n broken:paintNow,fine:paintNow,\n tick:t=>{\n if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();\n if(loop){if(timed(cur)&&cur.dataset.s===s){const x=span(cur);if(!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}}}\n else{const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}\n lastT=t;\n },\n seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},\n ended:()=>{\n if(!cur)return false;\n if(loop&&timed(cur)&&cur.dataset.s===P.cur()){P.load(P.cur(),span(cur)[0],true);return true}\n if(!loop){const later=shown().find(c=>timed(c)&&Number(c.dataset.s)>Number(P.cur())&&P.has(c.dataset.s));if(later){setCurrent(later,false,true);P.load(later.dataset.s,span(later)[0],true);return true}}\n return false;\n },\n });\n if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});\n const filter=f=>{\n d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));\n cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});\n segs.forEach(x=>{const c=cards.find(k=>k.dataset.id===x.dataset.case);x.classList.toggle('off',!!c&&c.hidden)});\n if(cur&&cur.hidden)setCurrent(shown()[0],true,false);\n };\n d.querySelectorAll('[data-filter]').forEach(b=>b.addEventListener('click',()=>filter(b.dataset.filter)));\n d.querySelectorAll('.filters').forEach(f=>f.classList.add('live'));\n let vCase=null,vIdx=0,opener=null;\n const q=s=>dlg.querySelector(s);\n const list=c=>{const t=c&&c.querySelector('template.shots');return t?[...t.content.children]:[]};\n const showShot=()=>{\n const l=list(vCase),f=l[vIdx];if(!f)return;\n q('.v-body').replaceChildren(f.cloneNode(true));\n q('.v-st').replaceChildren(vCase.querySelector('.case-head .st').cloneNode(true));\n q('.v-title').textContent=vCase.querySelector('.case-go').textContent;\n q('.v-what').textContent=f.dataset.cap+(l.length>1?' ('+(vIdx+1)+' of '+l.length+')':'');\n q('.v-prev').disabled=vIdx===0;q('.v-next').disabled=vIdx>=l.length-1;scan();\n };\n if(dlg){\n q('.v-prev').addEventListener('click',()=>{if(vIdx>0){vIdx--;showShot()}});\n q('.v-next').addEventListener('click',()=>{if(vIdx<list(vCase).length-1){vIdx++;showShot()}});\n q('.v-close').addEventListener('click',()=>dlg.close());\n dlg.addEventListener('click',e=>{if(e.target===dlg)dlg.close()});\n dlg.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();q('.v-prev').click()}else if(e.key==='ArrowRight'){e.preventDefault();q('.v-next').click()}});\n dlg.addEventListener('close',()=>{q('.v-body').replaceChildren();if(opener&&opener.isConnected)opener.focus()});\n }\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const tc=t.closest('a.tc[data-t]');\n if(tc){if(!P||!P.has(tc.dataset.s))return;e.preventDefault();const s=tc.dataset.s,at=Number(tc.dataset.t),c=caseAt(s,at)||tc.closest('.case')||(dlg&&dlg.open?vCase:null);if(dlg&&dlg.open)dlg.close();if(c)setCurrent(c,false,!tc.closest('.case'));lastT=at;P.load(s,at,P.playing());return}\n const go=t.closest('a[href^=\"#case-\"]');\n if(go){const c=d.getElementById(go.getAttribute('href').slice(1));if(!c||!c.matches('.case[data-i]'))return;e.preventDefault();if(c.hidden)filter('all');toCard(c);setCurrent(c,true,false);return}\n const shot=t.closest('[data-shot]');\n if(shot&&dlg&&dlg.showModal){e.preventDefault();opener=shot;vCase=shot.closest('.case');vIdx=Number(shot.dataset.shot)||0;showShot();dlg.showModal();q('.v-close').focus();return}\n const c=t.closest('.case[data-i]');\n if(!c||t.closest('a,summary,details,input,label')||(t.closest('button')&&!t.closest('.case-go')))return;\n toCard(c);setCurrent(c,true,false);\n });\n const first=cards.find(c=>timed(c)&&(!P||P.has(c.dataset.s)))||cards[0];\n if(first){setCurrent(first,false,false);if(timed(first))lastT=span(first)[0]}\n});\n})();";
|
|
23
23
|
/**
|
|
24
24
|
* Images and video load from the run folder by relative path (`'self'`, and `file:` for a report
|
|
25
25
|
* opened from disk); styles are inline, but for Google Fonts' stylesheet, whose fonts come from
|
|
@@ -34,8 +34,9 @@ export declare const reportCsp: (assetOrigin?: string) => string;
|
|
|
34
34
|
* A self-contained HTML report: inline CSS, one inline script, and from the network only Geist
|
|
35
35
|
* and Geist Mono from Google Fonts (system fonts offline). Screenshots and the video are linked by
|
|
36
36
|
* paths relative to the run folder, so the page works from disk and after the folder is zipped or
|
|
37
|
-
* moved; or, with `options.assetBaseUrl`, under that URL (see `RenderOptions`)
|
|
38
|
-
* the
|
|
37
|
+
* moved; or, with `options.assetBaseUrl`, under that URL (see `RenderOptions`), and then without
|
|
38
|
+
* the details' raw data row (a host keeps no JSON files). With no options the page is exactly the
|
|
39
|
+
* local one. Code lays out every part and decides every status; the
|
|
39
40
|
* agent's write-up, when it submitted one, fills fixed slots and is labelled as its own. Every
|
|
40
41
|
* piece of text from the job, the page or the agent is escaped.
|
|
41
42
|
*/
|
package/dist/report/html.js
CHANGED
|
@@ -2,9 +2,10 @@ import { Layer } from 'effect';
|
|
|
2
2
|
import { ReportRenderer, SESSION_NOTE } from '../core/index.js';
|
|
3
3
|
import { isWebUrl, runFiles } from '../schema/index.js';
|
|
4
4
|
import { assetsOf, contentPolicy } from './assets.js';
|
|
5
|
-
import { favicon, generatorMeta, html, icon, Markup, promptBlock, safeRelative, statusIcon, textParts,
|
|
5
|
+
import { favicon, generatorMeta, html, icon, Markup, promptBlock, safeRelative, statusIcon, textParts, webFonts, } from './markup.js';
|
|
6
6
|
import { controlsBlock, PLAYER_JS, playableSessions, playerWindow, shapeStyle, share, toggleButton, } from './player.js';
|
|
7
7
|
import { CHROME_LOGO } from './logos.js';
|
|
8
|
+
import { topBar } from './menu-bar.js';
|
|
8
9
|
import { cspHash } from './sha256.js';
|
|
9
10
|
import { cardShot, viewerShot } from './shots.js';
|
|
10
11
|
import { styles } from './styles.js';
|
|
@@ -720,11 +721,18 @@ const versionDetail = (bundle) => {
|
|
|
720
721
|
? run
|
|
721
722
|
: html `${run} <span class="note">· report built with ${built}</span>`;
|
|
722
723
|
};
|
|
723
|
-
/**
|
|
724
|
-
|
|
724
|
+
/**
|
|
725
|
+
* The run's details, all from the run: what it checks, where, when, and its raw files. The raw
|
|
726
|
+
* files are left out when `hosted` (an asset base URL): a host stores the screenshots and videos,
|
|
727
|
+
* never the run's JSON files, so links to them would only fail.
|
|
728
|
+
*/
|
|
729
|
+
const runDetails = (bundle, assets, hosted) => {
|
|
725
730
|
const { spec, ledger, summary } = bundle;
|
|
726
731
|
const duration = durationOf(bundle.startedAt, bundle.finishedAt);
|
|
727
732
|
const findings = assets.url(runFiles.findings);
|
|
733
|
+
const rawData = detail('Raw data', html `<a class="file" href="${assets.url(bundle.files.ledger)}">${bundle.files.ledger}</a> ·
|
|
734
|
+
<a class="file" href="${assets.url(runFiles.job)}">${runFiles.job}</a> ·
|
|
735
|
+
<a class="file" href="${assets.url(runFiles.evidence)}">${runFiles.evidence}</a>${bundle.findings ? html ` · <a class="file" href="${findings}">${runFiles.findings}</a>` : ''}`);
|
|
728
736
|
return html `<section class="details" aria-labelledby="details-title">
|
|
729
737
|
<h2 id="details-title">Run details</h2>
|
|
730
738
|
<dl>
|
|
@@ -739,12 +747,7 @@ const runDetails = (bundle, assets) => {
|
|
|
739
747
|
: html `<span class="note">not yet</span>`)}
|
|
740
748
|
${detail('Duration', duration ?? html `<span class="note">n/a</span>`)}
|
|
741
749
|
${detail('Video', videoSummary(bundle, assets))}
|
|
742
|
-
${detail('screw-bugs', versionDetail(bundle))}
|
|
743
|
-
${detail('Raw data', html `<a class="file" href="${assets.url(bundle.files.ledger)}">${bundle.files.ledger}</a> ·
|
|
744
|
-
<a class="file" href="${assets.url(runFiles.job)}">${runFiles.job}</a> ·
|
|
745
|
-
<a class="file" href="${assets.url(runFiles.evidence)}">${runFiles.evidence}</a>${bundle.findings
|
|
746
|
-
? html ` · <a class="file" href="${findings}">${runFiles.findings}</a>`
|
|
747
|
-
: ''}`)}
|
|
750
|
+
${detail('screw-bugs', versionDetail(bundle))} ${hosted ? '' : rawData}
|
|
748
751
|
</dl>
|
|
749
752
|
${ledger.sessions && ledger.sessions.length > 0 ? html `<p>${SESSION_NOTE}</p>` : ''}
|
|
750
753
|
</section>`;
|
|
@@ -769,8 +772,9 @@ const viewerDialog = html `<dialog class="viewer" id="viewer" aria-labelledby="v
|
|
|
769
772
|
* A self-contained HTML report: inline CSS, one inline script, and from the network only Geist
|
|
770
773
|
* and Geist Mono from Google Fonts (system fonts offline). Screenshots and the video are linked by
|
|
771
774
|
* paths relative to the run folder, so the page works from disk and after the folder is zipped or
|
|
772
|
-
* moved; or, with `options.assetBaseUrl`, under that URL (see `RenderOptions`)
|
|
773
|
-
* the
|
|
775
|
+
* moved; or, with `options.assetBaseUrl`, under that URL (see `RenderOptions`), and then without
|
|
776
|
+
* the details' raw data row (a host keeps no JSON files). With no options the page is exactly the
|
|
777
|
+
* local one. Code lays out every part and decides every status; the
|
|
774
778
|
* agent's write-up, when it submitted one, fills fixed slots and is labelled as its own. Every
|
|
775
779
|
* piece of text from the job, the page or the agent is escaped.
|
|
776
780
|
*/
|
|
@@ -805,7 +809,7 @@ export const renderHtmlReport = (bundle, options) => {
|
|
|
805
809
|
<body>
|
|
806
810
|
${scriptTag}
|
|
807
811
|
<div class="${`rp device-${bundle.device.kind}`}" style="${shapeStyle(bundle)}">
|
|
808
|
-
${topBar(bundle.startedAt, bundle.jobId, walkthrough ?
|
|
812
|
+
${topBar(bundle.startedAt, bundle.jobId, walkthrough ? { href: walkthrough, name: 'Walkthrough', icon: 'play' } : undefined)}
|
|
809
813
|
<header class="rp-head">
|
|
810
814
|
<h1>${reportHeading(bundle)}</h1>
|
|
811
815
|
<ul class="meta" aria-label="Run">
|
|
@@ -846,7 +850,7 @@ export const renderHtmlReport = (bundle, options) => {
|
|
|
846
850
|
</ol>
|
|
847
851
|
</section>`
|
|
848
852
|
: ''}
|
|
849
|
-
${runDetails(bundle, assets)}
|
|
853
|
+
${runDetails(bundle, assets, options?.assetBaseUrl !== undefined)}
|
|
850
854
|
<footer class="foot">
|
|
851
855
|
<p>
|
|
852
856
|
Statuses decided by code in a real browser; write-up by the agent.
|
package/dist/report/icons.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const ICONS: {
|
|
|
10
10
|
readonly 'chevrons-up-down': '<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>';
|
|
11
11
|
readonly 'circle-question-mark': '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>';
|
|
12
12
|
readonly maximize: '<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>';
|
|
13
|
+
readonly 'file-text': '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>';
|
|
13
14
|
readonly keyboard: '<path d="M10 8h.01"/><path d="M12 12h.01"/><path d="M14 8h.01"/><path d="M16 12h.01"/><path d="M18 8h.01"/><path d="M6 8h.01"/><path d="M7 16h10"/><path d="M8 12h.01"/><rect width="20" height="16" x="2" y="4" rx="2"/>';
|
|
14
15
|
readonly minimize: '<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>';
|
|
15
16
|
readonly minus: '<path d="M5 12h14"/>';
|
package/dist/report/icons.js
CHANGED
|
@@ -19,9 +19,8 @@
|
|
|
19
19
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
20
20
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
21
21
|
*
|
|
22
|
-
* Of these, check, chevron-left, chevron-right, maximize, minus, monitor, moon, share,
|
|
23
|
-
* x
|
|
24
|
-
* are derived from the Feather project, under its MIT License:
|
|
22
|
+
* Of these, check, chevron-left, chevron-right, file-text, maximize, minus, monitor, moon, share,
|
|
23
|
+
* smartphone and x are derived from the Feather project, under its MIT License:
|
|
25
24
|
*
|
|
26
25
|
* The MIT License (MIT) (for the icons listed above)
|
|
27
26
|
*
|
|
@@ -57,6 +56,7 @@ export const ICONS = {
|
|
|
57
56
|
'chevrons-up-down': '<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',
|
|
58
57
|
'circle-question-mark': '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
|
|
59
58
|
maximize: '<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>',
|
|
59
|
+
'file-text': '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',
|
|
60
60
|
keyboard: '<path d="M10 8h.01"/><path d="M12 12h.01"/><path d="M14 8h.01"/><path d="M16 12h.01"/><path d="M18 8h.01"/><path d="M6 8h.01"/><path d="M7 16h10"/><path d="M8 12h.01"/><rect width="20" height="16" x="2" y="4" rx="2"/>',
|
|
61
61
|
minimize: '<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>',
|
|
62
62
|
minus: '<path d="M5 12h14"/>',
|
package/dist/report/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './html.js';
|
|
2
2
|
export * from './pr-summary.js';
|
|
3
|
-
export { SHARE_START_PATH } from './
|
|
3
|
+
export { SHARE_START_PATH } from './menu-bar.js';
|
|
4
4
|
export { stepText } from './view.js';
|
|
5
5
|
export { hex, hmacSha256, sha256 } from './sha256.js';
|
|
6
6
|
export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
|
package/dist/report/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './html.js';
|
|
2
2
|
export * from './pr-summary.js';
|
|
3
|
-
export { SHARE_START_PATH } from './
|
|
3
|
+
export { SHARE_START_PATH } from './menu-bar.js';
|
|
4
4
|
export { stepText } from './view.js';
|
|
5
5
|
export { hex, hmacSha256, sha256 } from './sha256.js';
|
|
6
6
|
export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
|
package/dist/report/markup.d.ts
CHANGED
|
@@ -25,12 +25,14 @@ export declare const textParts: (parts: ReadonlyArray<TextPart>) => Markup[];
|
|
|
25
25
|
* bundle does not know it.
|
|
26
26
|
*/
|
|
27
27
|
export declare const generatorMeta: ({ generator }: ReportBundle) => "" | Markup;
|
|
28
|
+
/**
|
|
29
|
+
* The pages' favicon: the system's colors at first, and each theme's in `data-*`, which the theme
|
|
30
|
+
* button's script (`THEME_BUTTON_JS`) puts in `href` as the reader switches.
|
|
31
|
+
*/
|
|
28
32
|
export declare const favicon: Markup;
|
|
29
33
|
export declare const webFonts: Markup;
|
|
30
34
|
/** A Lucide icon (see `icons.ts`) as markup for the page templates. */
|
|
31
35
|
export declare const icon: (name: IconName, options?: IconOptions) => Markup;
|
|
32
|
-
/** Light, dark, or the system's: icons with their names; hidden until the page's script runs. */
|
|
33
|
-
export declare const themeSwitch: Markup;
|
|
34
36
|
/** screw-bugs' website, which the brand links to. */
|
|
35
37
|
export declare const SITE_URL = "https://screwbugs.dev";
|
|
36
38
|
/** The project's home, from `package.json`'s `repository`. */
|
|
@@ -39,19 +41,8 @@ export declare const REPO_URL = "https://github.com/uxstudioteam/screw-bugs";
|
|
|
39
41
|
export declare const statusIcon: (status: CaseStatus) => Markup;
|
|
40
42
|
/** A status as an icon and its words, such as ✕ Failed. */
|
|
41
43
|
export declare const statusTag: (status: CaseStatus) => Markup;
|
|
42
|
-
/** The bug of each theme (`bugMark`), for the
|
|
44
|
+
/** The bug of each theme (`bugMark`), for the menu bar (`menu-bar.ts`). */
|
|
43
45
|
export declare const brandMark: Markup;
|
|
44
|
-
/**
|
|
45
|
-
* Where a page's Share button starts sharing its run on screw-bugs Cloud: a route of the local
|
|
46
|
-
* report server (`src/cli/share.ts`), by absolute path, so it is the server the page came from.
|
|
47
|
-
*/
|
|
48
|
-
export declare const SHARE_START_PATH = "/.screw-bugs/share/start";
|
|
49
|
-
/**
|
|
50
|
-
* The top row of both pages: the brand (a link to the website), when the run started, and links (the other page, the
|
|
51
|
-
* project's GitHub) with the Share button (see `shareButton`) and the theme switch. When the run started is in UTC, saying so, until the
|
|
52
|
-
* page's script puts it in the reader's own time (see `PLAYER_JS`).
|
|
53
|
-
*/
|
|
54
|
-
export declare const topBar: (startedAt: string, jobId: string, links: ReadonlyArray<Markup>) => Markup;
|
|
55
46
|
/**
|
|
56
47
|
* What the user asked, in quotes, clamped to two lines; the page's script offers the rest in place
|
|
57
48
|
* when it does not fit. Nothing when the job recorded no request.
|
package/dist/report/markup.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BUG_DARK, BUG_GIF_ON_DARK, BUG_GIF_ON_LIGHT, BUG_LIME, bugStill } from './bug.js';
|
|
2
2
|
import { iconSvg } from './icons.js';
|
|
3
|
-
import {
|
|
4
|
-
import { formatDate, statusLabel } from './view.js';
|
|
3
|
+
import { statusLabel } from './view.js';
|
|
5
4
|
/*
|
|
6
5
|
* The pieces both HTML pages (the report and the walkthrough) are built from: escaped templates,
|
|
7
|
-
* safe relative links, status icons, the
|
|
6
|
+
* safe relative links, status icons, the brand's bug, and the prompt (the top bar: `menu-bar.ts`).
|
|
8
7
|
*/
|
|
9
8
|
/** Markup that is already safe. Everything else that goes into the page is escaped. */
|
|
10
9
|
export class Markup {
|
|
@@ -49,17 +48,26 @@ export const textParts = (parts) => parts.map((part) => part.kind === 'text'
|
|
|
49
48
|
? html `<q class="value">${part.text}</q>`
|
|
50
49
|
: html `<code>${part.text}</code>`);
|
|
51
50
|
/**
|
|
52
|
-
* The
|
|
53
|
-
*
|
|
54
|
-
* `prefers-color-scheme
|
|
55
|
-
* page stays one file; the CSP allows `data:` images.
|
|
51
|
+
* The report icon on its 15 × 15 pixel grid, as the design's light and dark favicons draw it: a
|
|
52
|
+
* dark page on a lime rounded square, or lime on dark. `faviconSvg(style)` colors it: `light`, `dark`,
|
|
53
|
+
* or `system`, which follows `prefers-color-scheme` (the browser's, not the page's theme button).
|
|
54
|
+
* Inline, so the page stays one file; the CSP allows `data:` images.
|
|
56
55
|
*/
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"<
|
|
56
|
+
const LIME = '#96F011';
|
|
57
|
+
const INK = '#1D1D1D';
|
|
58
|
+
const faviconSvg = (style) => "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15'>" +
|
|
59
|
+
`<style>${style}</style>` +
|
|
60
|
+
"<rect width='15' height='15' rx='2'/>" +
|
|
61
|
+
"<path d='M4 2h7v1H4zM4 12h7v1H4zM3 3h1v9H3zM11 3h1v9h-1zM5 5h5v1H5zM5 7h5v1H5zM5 9h3.2v1H5z'/>" +
|
|
62
62
|
'</svg>';
|
|
63
|
+
const LIGHT_STYLE = `rect{fill:${LIME}}path{fill:${INK}}`;
|
|
64
|
+
const DARK_STYLE = `rect{fill:${INK}}path{fill:${LIME}}`;
|
|
65
|
+
const iconUrl = (style) => `data:image/svg+xml,${faviconSvg(style).replaceAll('#', '%23')}`;
|
|
66
|
+
const FAVICON = {
|
|
67
|
+
light: iconUrl(LIGHT_STYLE),
|
|
68
|
+
dark: iconUrl(DARK_STYLE),
|
|
69
|
+
system: iconUrl(`${LIGHT_STYLE}@media (prefers-color-scheme:dark){${DARK_STYLE}}`),
|
|
70
|
+
};
|
|
63
71
|
/**
|
|
64
72
|
* `<meta name="generator">` with the screw-bugs version that built the page's bundle, so whoever
|
|
65
73
|
* serves or shares the page can tell which version made it without the bundle; nothing when the
|
|
@@ -71,14 +79,22 @@ export const generatorMeta = ({ generator }) => {
|
|
|
71
79
|
const content = `${generator.name} ${generator.version}`;
|
|
72
80
|
return html `<meta name="generator" content="${content}" />`;
|
|
73
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* The pages' favicon: the system's colors at first, and each theme's in `data-*`, which the theme
|
|
84
|
+
* button's script (`THEME_BUTTON_JS`) puts in `href` as the reader switches.
|
|
85
|
+
*/
|
|
74
86
|
export const favicon = html `<link
|
|
75
87
|
rel="icon"
|
|
76
88
|
type="image/svg+xml"
|
|
77
|
-
href="${
|
|
89
|
+
href="${FAVICON.system}"
|
|
90
|
+
id="favicon"
|
|
91
|
+
data-light="${FAVICON.light}"
|
|
92
|
+
data-dark="${FAVICON.dark}"
|
|
93
|
+
data-system="${FAVICON.system}"
|
|
78
94
|
/>`;
|
|
79
95
|
/**
|
|
80
96
|
* Geist and Geist Mono from Google Fonts, in exactly the weights the pages use (Geist 400,
|
|
81
|
-
* 500, 600 for the
|
|
97
|
+
* 500, 600 for the menu bar (`menu-bar.ts`), and 700; Geist Mono 400 and 500). Offline, or where Google cannot be reached, the pages use
|
|
82
98
|
* the system fonts after them in `--sans` and `--mono`. The CSPs allow these two hosts only.
|
|
83
99
|
*/
|
|
84
100
|
const GOOGLE_FONTS_CSS = 'https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap';
|
|
@@ -87,25 +103,6 @@ export const webFonts = html `<link rel="preconnect" href="https://fonts.googlea
|
|
|
87
103
|
<link rel="stylesheet" href="${GOOGLE_FONTS_CSS}" />`;
|
|
88
104
|
/** A Lucide icon (see `icons.ts`) as markup for the page templates. */
|
|
89
105
|
export const icon = (name, options) => new Markup(iconSvg(name, options));
|
|
90
|
-
const themeButton = (theme, name, icon, pressed) => html `<button
|
|
91
|
-
type="button"
|
|
92
|
-
data-theme-set="${theme}"
|
|
93
|
-
aria-pressed="${String(pressed)}"
|
|
94
|
-
aria-label="${name}"
|
|
95
|
-
title="${name}"
|
|
96
|
-
>
|
|
97
|
-
${icon}
|
|
98
|
-
</button>`;
|
|
99
|
-
/** Light, dark, or the system's: icons with their names; hidden until the page's script runs. */
|
|
100
|
-
export const themeSwitch = html `<div
|
|
101
|
-
class="theme"
|
|
102
|
-
id="theme"
|
|
103
|
-
role="group"
|
|
104
|
-
aria-label="Color theme"
|
|
105
|
-
hidden
|
|
106
|
-
>
|
|
107
|
-
${themeButton('light', 'Light theme', icon('sun', { size: 14 }), false)}${themeButton('dark', 'Dark theme', icon('moon', { size: 14 }), false)}${themeButton('system', 'Theme from system', icon('monitor', { size: 14 }), true)}
|
|
108
|
-
</div>`;
|
|
109
106
|
/** screw-bugs' website, which the brand links to. */
|
|
110
107
|
export const SITE_URL = 'https://screwbugs.dev';
|
|
111
108
|
/** The project's home, from `package.json`'s `repository`. */
|
|
@@ -140,43 +137,8 @@ const bugMark = (gif, color, theme) => html `<picture class="${`bug bug-${theme}
|
|
|
140
137
|
><source media="(prefers-reduced-motion: reduce)" srcset="${bugStill(color)}" />
|
|
141
138
|
<img src="${gif}" alt=""
|
|
142
139
|
/></picture>`;
|
|
143
|
-
/** The bug of each theme (`bugMark`), for the
|
|
140
|
+
/** The bug of each theme (`bugMark`), for the menu bar (`menu-bar.ts`). */
|
|
144
141
|
export const brandMark = html `${bugMark(BUG_GIF_ON_LIGHT, BUG_DARK, 'light')}${bugMark(BUG_GIF_ON_DARK, BUG_LIME, 'dark')}`;
|
|
145
|
-
/**
|
|
146
|
-
* Where a page's Share button starts sharing its run on screw-bugs Cloud: a route of the local
|
|
147
|
-
* report server (`src/cli/share.ts`), by absolute path, so it is the server the page came from.
|
|
148
|
-
*/
|
|
149
|
-
export const SHARE_START_PATH = '/.screw-bugs/share/start';
|
|
150
|
-
/**
|
|
151
|
-
* The Share button: a link to the report server's start of a share. Hidden until the page's script
|
|
152
|
-
* finds it was served by the local report server (`http:` on 127.0.0.1 or localhost): opened from
|
|
153
|
-
* disk or on a host such as screw-bugs Cloud, there is no server to share it.
|
|
154
|
-
*/
|
|
155
|
-
const shareButton = (jobId) => html `<a
|
|
156
|
-
class="share-btn"
|
|
157
|
-
href="${`${SHARE_START_PATH}?run=${encodeURIComponent(jobId)}`}"
|
|
158
|
-
title="Share this report on screw-bugs Cloud: a link anyone can open for 7 days"
|
|
159
|
-
hidden
|
|
160
|
-
>${icon('share', { size: 14, strokeWidth: 2.25 })}<span>Share</span></a
|
|
161
|
-
>`;
|
|
162
|
-
/**
|
|
163
|
-
* The top row of both pages: the brand (a link to the website), when the run started, and links (the other page, the
|
|
164
|
-
* project's GitHub) with the Share button (see `shareButton`) and the theme switch. When the run started is in UTC, saying so, until the
|
|
165
|
-
* page's script puts it in the reader's own time (see `PLAYER_JS`).
|
|
166
|
-
*/
|
|
167
|
-
export const topBar = (startedAt, jobId, links) => html `<header class="top">
|
|
168
|
-
<a class="brand" href="${SITE_URL}" rel="noopener noreferrer"
|
|
169
|
-
>${brandMark}<span class="brand-name">screwbugs.dev</span></a
|
|
170
|
-
>
|
|
171
|
-
<time class="when" datetime="${startedAt}">${formatDate(startedAt)}</time>
|
|
172
|
-
<nav class="links" aria-label="Links">
|
|
173
|
-
${links.map((link) => html `${link}<span class="sep" data-orientation="vertical" aria-hidden="true"></span>`)}
|
|
174
|
-
<a class="gh" href="${REPO_URL}" rel="noopener noreferrer"
|
|
175
|
-
>${new Markup(GITHUB_MARK)}GitHub</a
|
|
176
|
-
>
|
|
177
|
-
${shareButton(jobId)} ${themeSwitch}
|
|
178
|
-
</nav>
|
|
179
|
-
</header>`;
|
|
180
142
|
/**
|
|
181
143
|
* What the user asked, in quotes, clamped to two lines; the page's script offers the rest in place
|
|
182
144
|
* when it does not fit. Nothing when the job recorded no request.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { IconName } from './icons.js';
|
|
2
|
+
import { Markup } from './markup.js';
|
|
3
|
+
/** The project on GitHub, as the menu bar names it: `owner/name`. */
|
|
4
|
+
export declare const REPO: string;
|
|
5
|
+
/**
|
|
6
|
+
* Where a page's Share button starts sharing its run on screw-bugs Cloud: a route of the local
|
|
7
|
+
* report server (`src/cli/share.ts`), by absolute path, so it is the server the page came from.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SHARE_START_PATH = "/.screw-bugs/share/start";
|
|
10
|
+
/**
|
|
11
|
+
* The Share button, in the place of Cloud's Sign in button: a link to the report server's start of
|
|
12
|
+
* a share. Hidden until the page's script finds it was served by the local report server (`http:`
|
|
13
|
+
* on 127.0.0.1 or localhost): opened from disk or on a host such as screw-bugs Cloud, there is no
|
|
14
|
+
* server to share it.
|
|
15
|
+
*/
|
|
16
|
+
export declare const shareButton: (jobId: string) => Markup;
|
|
17
|
+
/**
|
|
18
|
+
* The theme button: light, dark or the system's, in turn, as on Cloud's menu bar; it shows the
|
|
19
|
+
* current one (`THEME_BUTTON_JS` names it and switches). `hidden` until a script shows it, where a
|
|
20
|
+
* page's script may not run.
|
|
21
|
+
*/
|
|
22
|
+
export declare const themeButton: (hidden: boolean) => Markup;
|
|
23
|
+
/**
|
|
24
|
+
* The script of the theme button (`themeButton`): `themeCycle(button, key)` names the theme it
|
|
25
|
+
* shows and, on a click, moves to the next one, kept under `key` in `localStorage` where the browser
|
|
26
|
+
* allows (none: not kept). The favicon (`#favicon`, where the page has its own) follows it. Plain ES2020, without backslashes, for the pages' scripts to include.
|
|
27
|
+
*/
|
|
28
|
+
export declare const THEME_BUTTON_JS = "const themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};";
|
|
29
|
+
/** The project on GitHub, by its mark; `owner/name` beside it from `from` px wide. */
|
|
30
|
+
export declare const githubLink: (from: 640 | 1280) => Markup;
|
|
31
|
+
/** A link to another page of the run (report ↔ walkthrough), by its icon and name. */
|
|
32
|
+
export declare const pageLink: (href: string, name: string, mark: IconName, from: 640 | 1280) => Markup;
|
|
33
|
+
/**
|
|
34
|
+
* The bar: the brand (a link to the website), the middle capsule when there is one, and the right
|
|
35
|
+
* capsule (`ends`). `className` adds the page's own classes to the header.
|
|
36
|
+
*/
|
|
37
|
+
export declare const menuBar: (options: {
|
|
38
|
+
readonly middle?: Markup;
|
|
39
|
+
readonly ends: Markup;
|
|
40
|
+
readonly className?: string;
|
|
41
|
+
}) => Markup;
|
|
42
|
+
/**
|
|
43
|
+
* The reports' bar (the report's and the walkthrough's): when the run started in the middle, in UTC
|
|
44
|
+
* and saying so until the page's script puts it in the reader's own time (see `PLAYER_JS`); on the
|
|
45
|
+
* right the other page of the run (`other`, when there is one), the project's GitHub, the theme
|
|
46
|
+
* button and the Share button (see `shareButton`). The theme button and Share wait for the script.
|
|
47
|
+
*/
|
|
48
|
+
export declare const topBar: (startedAt: string, jobId: string, other: {
|
|
49
|
+
readonly href: string;
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly icon: IconName;
|
|
52
|
+
} | undefined) => Markup;
|
|
53
|
+
/**
|
|
54
|
+
* The bar's styles, in the landing's own colors (`--l-*`, which differ a little from the reports'),
|
|
55
|
+
* its sizes and breakpoints: 56 px tall, 72 px from 768 px wide; capsules 40 px tall, the page's
|
|
56
|
+
* background at 70 % over a 12 px blur. The three capsules sit in a grid, the middle one centered
|
|
57
|
+
* between the ends; on a phone (below 640 px) the right capsule keeps only icons and the middle one
|
|
58
|
+
* only the date's shortest form (see `topBar`), so the bar stays one row down to 360 px.
|
|
59
|
+
*/
|
|
60
|
+
export declare const menuBarStyles = "\n.menubar { --l-text: #303030; --l-muted: #636363; --l-icon: #000000; }\n@media (prefers-color-scheme: dark) { :root:not([data-theme=\"light\"]) .menubar { --l-text: #eceeec; --l-muted: #afb5ad; --l-icon: #eceeec; } }\n:root[data-theme=\"dark\"] .menubar { --l-text: #eceeec; --l-muted: #afb5ad; --l-icon: #eceeec; }\n.menubar { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; height: 56px; padding: 0 12px; background: transparent; font: 600 13px/16px var(--sans); letter-spacing: -0.03em; color: var(--l-text); }\n.capsule { display: flex; align-items: center; height: 40px; box-sizing: border-box; border-radius: 999px; background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }\n.menubar .brand { grid-column: 1; justify-self: start; gap: 8px; padding: 0 16px 0 12px; white-space: nowrap; color: inherit; text-decoration: none; }\n.menubar .mid { grid-column: 2; min-width: 0; padding: 0 16px; font: 400 12px/16px var(--mono); letter-spacing: -0.038em; white-space: nowrap; }\n.menubar .ends { grid-column: 3; justify-self: end; flex: none; gap: 6px; padding: 4px 4px 4px 12px; }\n.menubar .ends a:not(.share-btn) { display: inline-flex; align-items: center; gap: 6px; font: 400 12px/16px var(--mono); letter-spacing: -0.038em; color: inherit; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }\n.menubar .ends a:not(.share-btn):hover { color: var(--l-muted); }\n.menubar .ends .logo, .menubar .ends .icon { width: 16px; height: 16px; }\n.menubar .ends .page .icon { color: var(--l-icon); }\n.menubar .gh .logo path { fill: var(--l-icon); }\n.menubar .from-640, .menubar .from-1280 { display: none; }\n.menubar .theme { display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--l-text); cursor: pointer; }\n.menubar .theme:hover { background: color-mix(in srgb, var(--l-text) 8%, transparent); }\n.menubar .theme .t-light, .menubar .theme .t-dark, :root[data-theme=\"light\"] .menubar .theme .t-system, :root[data-theme=\"dark\"] .menubar .theme .t-system { display: none; }\n:root[data-theme=\"light\"] .menubar .theme .t-light, :root[data-theme=\"dark\"] .menubar .theme .t-dark { display: block; }\n.menubar .share-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; height: 32px; padding: 0 16px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 500 14px/20px var(--sans); letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }\n.menubar .share-btn:hover { filter: brightness(.95); }\n/* Three capsules on a phone: the brand by its bug alone, the date without its year, Share by its\n icon (each still named for screen readers). */\n@media (max-width: 639px) {\n .menubar.with-mid .brand { padding: 0 8px; }\n .menubar.with-mid :is(.brand-name, .share-word) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n .menubar.with-mid .share-btn { width: 32px; padding: 0; }\n /* Icon-only links get the theme button's 32 px cell, a target a finger can hit, with the\n capsule's padding and gaps taken in by as much, so it stays as wide. */\n .menubar.with-mid .ends { gap: 0; padding-left: 4px; }\n .menubar.with-mid .ends a:not(.share-btn) { justify-content: center; width: 32px; height: 32px; border-radius: 999px; }\n .menubar .when .year { display: none; }\n}\n/* The reports' bar is sticky over a dense page: it keeps the page's background behind it, so no\n text runs between the capsules (the sign-in page's, over a page that does not scroll under it,\n stays see-through). */\n.menubar.solid { background: var(--bg); }\n@media (min-width: 400px) { .menubar .ends { gap: 8px; } }\n@media (min-width: 640px) { .menubar .from-640 { display: inline; } .menubar .share-btn { padding: 0 20px; } }\n@media (min-width: 768px) { .menubar { height: 72px; padding: 0 32px; } .menubar .ends { gap: 12px; } .menubar .share-btn { padding: 0 28px; } }\n@media (min-width: 1280px) { .menubar .from-1280 { display: inline; } }\n@media print { .menubar .theme, .menubar .share-btn { display: none; } }\n";
|