screw-bugs 0.1.1 → 0.1.2
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 +69 -19
- package/dist/browser-playwright/launch.js +3 -1
- package/dist/browser-playwright/page.d.ts +3 -11
- package/dist/browser-playwright/page.js +17 -1
- package/dist/browser-playwright/sign-in.d.ts +77 -0
- package/dist/browser-playwright/sign-in.js +217 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/app.js +4 -1
- package/dist/cli/commands.js +68 -3
- package/dist/cli/exit-codes.d.ts +6 -0
- package/dist/cli/exit-codes.js +6 -0
- package/dist/cli/mcp.js +17 -3
- package/dist/cli/operations.d.ts +31 -3
- package/dist/cli/operations.js +95 -3
- package/dist/cli/sign-in.d.ts +79 -0
- package/dist/cli/sign-in.js +305 -0
- package/dist/core/accounts.d.ts +40 -0
- package/dist/core/accounts.js +95 -0
- package/dist/core/engine.d.ts +4 -3
- package/dist/core/engine.js +30 -8
- package/dist/core/errors.d.ts +19 -0
- package/dist/core/errors.js +6 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/services.d.ts +77 -8
- package/dist/core/services.js +4 -1
- package/dist/report/bug.d.ts +2 -2
- package/dist/report/bug.js +5 -4
- package/dist/report/html.d.ts +1 -1
- package/dist/report/icons.d.ts +1 -0
- package/dist/report/icons.js +1 -0
- package/dist/report/index.d.ts +1 -0
- package/dist/report/index.js +1 -0
- package/dist/report/markup.d.ts +2 -0
- package/dist/report/markup.js +5 -4
- package/dist/report/player.d.ts +7 -2
- package/dist/report/player.js +16 -5
- package/dist/report/sign-in.d.ts +41 -0
- package/dist/report/sign-in.js +591 -0
- package/dist/report/styles.js +1 -1
- package/dist/report/walkthrough.d.ts +3 -2
- package/dist/report/walkthrough.js +47 -38
- package/dist/schema/accounts.d.ts +137 -0
- package/dist/schema/accounts.js +112 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/job.d.ts +27 -6
- package/dist/schema/job.js +12 -2
- package/dist/schema/ledger.d.ts +5 -1
- package/dist/store-local/accounts.d.ts +8 -4
- package/dist/store-local/accounts.js +82 -7
- package/dist/store-local/paths.d.ts +4 -1
- package/dist/store-local/paths.js +4 -1
- package/package.json +1 -1
|
@@ -21,7 +21,8 @@ export declare const GLIDE_S = 0.6;
|
|
|
21
21
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
22
22
|
* and, with "Skip inactive" on, jumps over the stretches where no step ran while it plays.
|
|
23
23
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
24
|
-
* (`.wt`), not only the video
|
|
24
|
+
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
25
|
+
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
25
26
|
* the step playing now as a caption under it, and the controls; the prompt and the script are left
|
|
26
27
|
* out. A session video that does not load
|
|
27
28
|
* is remembered as broken on its own (see `PLAYER_JS`). Without script, timecodes open the video
|
|
@@ -39,7 +40,7 @@ export declare const GLIDE_S = 0.6;
|
|
|
39
40
|
* and there is no ripple. A "Cursor" switch turns it off, remembered like the theme. Nothing is
|
|
40
41
|
* added to the page under test or to the video.
|
|
41
42
|
*/
|
|
42
|
-
export declare const WALKTHROUGH_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',()=>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 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 if(!d.fullscreenEnabled||!screen.requestFullscreen)full.hidden=true;\n else{full.addEventListener('click',()=>{if(d.fullscreenElement)d.exitFullscreen().catch(()=>{});else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',()=>{const f=d.fullscreenElement===screen;full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()})}\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\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB&&skipB.getAttribute('aria-pressed')==='true',P=null;\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
43
|
+
export declare const WALKTHROUGH_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\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB&&skipB.getAttribute('aria-pressed')==='true',P=null;\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
43
44
|
/**
|
|
44
45
|
* As the report's: the video by relative path, one script by hash, and from the network only
|
|
45
46
|
* Google Fonts' stylesheet and its fonts.
|
|
@@ -34,7 +34,8 @@ export const GLIDE_S = 0.6;
|
|
|
34
34
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
35
35
|
* and, with "Skip inactive" on, jumps over the stretches where no step ran while it plays.
|
|
36
36
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
37
|
-
* (`.wt`), not only the video
|
|
37
|
+
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
38
|
+
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
38
39
|
* the step playing now as a caption under it, and the controls; the prompt and the script are left
|
|
39
40
|
* out. A session video that does not load
|
|
40
41
|
* is remembered as broken on its own (see `PLAYER_JS`). Without script, timecodes open the video
|
|
@@ -102,7 +103,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
102
103
|
if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}
|
|
103
104
|
const g=geo();draw(t,g);fx(t,g);
|
|
104
105
|
};
|
|
105
|
-
P=player('wt',{tick,full:w,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});
|
|
106
|
+
P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});
|
|
106
107
|
if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}
|
|
107
108
|
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});
|
|
108
109
|
if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});
|
|
@@ -142,8 +143,8 @@ const walkthroughStyles = /* css */ `
|
|
|
142
143
|
.wt-stage .window { width: min(var(--win-cap), calc((100cqh - var(--win-h)) * var(--arw, 1.6) + var(--win-w))); margin: 0 auto; }
|
|
143
144
|
.wt-stage .controls { width: min(810px, 100%); }
|
|
144
145
|
.device-mobile .wt-stage { --win-cap: min(360px, 100cqw); width: min(540px, 100%); }
|
|
145
|
-
.wt.expanded:not(:fullscreen) .wt-stage { --win-cap: min(640px, 100cqw, calc((50vh - 160px) * var(--arw, 1.6))); }
|
|
146
|
-
.device-mobile.wt.expanded:not(:fullscreen) .wt-stage { --win-cap: min(260px, 100cqw, calc((60vh - 200px) * var(--arw, .46) + var(--win-w))); }
|
|
146
|
+
.wt.expanded:not(:fullscreen, .focus) .wt-stage { --win-cap: min(640px, 100cqw, calc((50vh - 160px) * var(--arw, 1.6))); }
|
|
147
|
+
.device-mobile.wt.expanded:not(:fullscreen, .focus) .wt-stage { --win-cap: min(260px, 100cqw, calc((60vh - 200px) * var(--arw, .46) + var(--win-w))); }
|
|
147
148
|
.wt-notes { margin: 12px 0 0; padding: 0; list-style: none; font: var(--t-control); color: var(--muted); text-align: center; }
|
|
148
149
|
.wt-notes li { margin: 4px 0; overflow-wrap: anywhere; }
|
|
149
150
|
.wt-panel { width: min(708px, 100%); border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 12px 16px 0; }
|
|
@@ -199,7 +200,6 @@ a.wt-pill:hover { background: var(--accent); color: var(--on-accent); }
|
|
|
199
200
|
.wt-problems .wt-pill { min-width: 64px; padding: 4px 8px; }
|
|
200
201
|
.wt-problems .why { overflow-wrap: anywhere; color: var(--muted); }
|
|
201
202
|
.wt-problems .why a { color: var(--text); }
|
|
202
|
-
.wt .foot { width: min(708px, 100%); margin: 28px auto 0; padding: 0 16px; font: var(--t-small); color: var(--muted); }
|
|
203
203
|
|
|
204
204
|
/* What is drawn over the video: the step's box, the cursor, ripples, typing rings, labels. */
|
|
205
205
|
.wt-box { position: absolute; outline: 3px solid var(--mark-step); outline-offset: 3px; border-radius: 2px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .85); pointer-events: none; }
|
|
@@ -234,30 +234,32 @@ a.wt-pill:hover { background: var(--accent); color: var(--on-accent); }
|
|
|
234
234
|
|
|
235
235
|
/* Fullscreen is the whole page: the top bar, the video in a dark card as big as fits, its address
|
|
236
236
|
over it and the step playing now as a caption across its foot, then the controls. The prompt,
|
|
237
|
-
the script and the notes stay out; the caption takes the place of the label by the cursor.
|
|
237
|
+
the script and the notes stay out; the caption takes the place of the label by the cursor. On a
|
|
238
|
+
wide screen it is \`.focus\`: the same layout in the browser's window, never its whole screen. */
|
|
238
239
|
.wt-cap { display: none; }
|
|
239
|
-
.wt:fullscreen { overflow: auto;
|
|
240
|
-
.wt:
|
|
241
|
-
.wt:fullscreen .wt-
|
|
242
|
-
.wt:fullscreen .wt-
|
|
243
|
-
.wt:fullscreen .wt-stage
|
|
244
|
-
.wt:fullscreen .wt-stage
|
|
245
|
-
.wt:fullscreen .
|
|
246
|
-
.wt:fullscreen .
|
|
247
|
-
.wt:fullscreen .
|
|
248
|
-
.wt:fullscreen .
|
|
249
|
-
.wt:fullscreen .
|
|
250
|
-
.wt:fullscreen .url:
|
|
251
|
-
.wt:
|
|
252
|
-
.wt:fullscreen .wt-cap
|
|
240
|
+
.wt:fullscreen { overflow: auto; }
|
|
241
|
+
.wt:is(:fullscreen, .focus) { padding-bottom: 0; background: var(--bg); }
|
|
242
|
+
.wt:is(:fullscreen, .focus) > .prompt, .wt:is(:fullscreen, .focus) :is(.alert, .wt-panel, .wt-problems, .wt-notes, .wt-act) { display: none !important; }
|
|
243
|
+
.wt:is(:fullscreen, .focus) .wt-main { display: block; padding: 0 24px; }
|
|
244
|
+
.wt:is(:fullscreen, .focus) .wt-stage { --fit-top: var(--wt-top, var(--bar)); --fit-gap: 20px; --win-cap: 100cqw; --win-h: 60px; --win-w: 2px; --player-pad: 0px; --player-cap: none; position: static; width: 100%; padding: 0; background: none; }
|
|
245
|
+
.wt:is(:fullscreen, .focus) .wt-stage::after { display: none; }
|
|
246
|
+
.wt:is(:fullscreen, .focus) .wt-stage .player { padding: 0; background: none; }
|
|
247
|
+
.wt:is(:fullscreen, .focus) .window { padding: 0 0 58px; border-radius: 12px; border-color: var(--video-edge); background: var(--video); box-shadow: none; }
|
|
248
|
+
.wt:is(:fullscreen, .focus) .screen { border-radius: 0; }
|
|
249
|
+
.wt:is(:fullscreen, .focus) .toolbar { position: absolute; top: 10px; left: 0; right: 0; z-index: 7; height: auto; margin: 0; padding: 0 12px; justify-content: center; border: 0; background: none; pointer-events: none; }
|
|
250
|
+
.wt:is(:fullscreen, .focus) .dots { display: none; }
|
|
251
|
+
.wt:is(:fullscreen, .focus) .url { position: static; transform: none; width: auto; max-width: min(420px, 70%); height: 24px; padding: 0 14px; border-radius: 999px; background: var(--subtle); }
|
|
252
|
+
.wt:is(:fullscreen, .focus) .url:has(span:empty) { visibility: hidden; }
|
|
253
|
+
.wt:is(:fullscreen, .focus) .wt-cap:not([hidden]) { display: block; position: absolute; left: 50%; bottom: 22px; z-index: 7; transform: translateX(-50%); max-width: min(720px, calc(100% - 32px)); margin: 0; padding: 12px 40px; border: 1px solid var(--caption-border); border-radius: 8px; background: var(--caption); color: var(--text); font: 400 18px/26px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
|
|
254
|
+
.wt:is(:fullscreen, .focus) .wt-cap code { font-size: .85em; }
|
|
253
255
|
.wt-ico { display: none; }
|
|
254
|
-
.wt:fullscreen .wt-cap .wt-ico { display: inline-block; margin-right: 10px; vertical-align: -4px; color: var(--muted); }
|
|
255
|
-
.wt:fullscreen .wt-cap .wt-ico svg { display: block; }
|
|
256
|
-
.wt:fullscreen .player.broken .wt-cap { display: none; }
|
|
257
|
-
.wt:fullscreen .wt-stage .controls { width: min(810px, 100%); }
|
|
256
|
+
.wt:is(:fullscreen, .focus) .wt-cap .wt-ico { display: inline-block; margin-right: 10px; vertical-align: -4px; color: var(--muted); }
|
|
257
|
+
.wt:is(:fullscreen, .focus) .wt-cap .wt-ico svg { display: block; }
|
|
258
|
+
.wt:is(:fullscreen, .focus) .player.broken .wt-cap { display: none; }
|
|
259
|
+
.wt:is(:fullscreen, .focus) .wt-stage .controls { width: min(810px, 100%); }
|
|
258
260
|
@media (max-width: 900px) {
|
|
259
|
-
.wt:fullscreen .wt-main { padding: 0 12px; }
|
|
260
|
-
.wt:fullscreen .wt-cap:not([hidden]) { bottom: 14px; padding: 8px 16px; font: var(--t-body); }
|
|
261
|
+
.wt:is(:fullscreen, .focus) .wt-main { padding: 0 12px; }
|
|
262
|
+
.wt:is(:fullscreen, .focus) .wt-cap:not([hidden]) { bottom: 14px; padding: 8px 16px; font: var(--t-body); }
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
/* A run on a phone, on a wide screen: the phone and its controls on the left, the script beside. */
|
|
@@ -277,8 +279,8 @@ a.wt-pill:hover { background: var(--accent); color: var(--on-accent); }
|
|
|
277
279
|
.device-mobile .wt-stage { --win-cap: min(224px, 100cqw); --player-pad: 20px; --player-cap: calc(44vh - 60px + var(--win-h) + var(--player-pad)); }
|
|
278
280
|
.device-mobile .wt-stage .player { padding: 10px 0; border-radius: 14px; background: var(--subtle); }
|
|
279
281
|
.device-mobile .wt-stage .window { box-shadow: var(--shadow); }
|
|
280
|
-
.wt.expanded:not(:fullscreen) .wt-stage { --win-cap: 100cqw; --player-cap: calc(96px + var(--win-h)); }
|
|
281
|
-
.device-mobile.wt.expanded:not(:fullscreen) .wt-stage { --win-cap: 120px; --player-cap: none; }
|
|
282
|
+
.wt.expanded:not(:fullscreen, .focus) .wt-stage { --win-cap: 100cqw; --player-cap: calc(96px + var(--win-h)); }
|
|
283
|
+
.device-mobile.wt.expanded:not(:fullscreen, .focus) .wt-stage { --win-cap: 120px; --player-cap: none; }
|
|
282
284
|
.wt-stage .controls { gap: 8px; margin-top: 10px; }
|
|
283
285
|
.wt-panel { padding: 10px 8px 0; }
|
|
284
286
|
.wt-step { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; min-height: 46px; padding: 6px 8px; font: var(--t-body); }
|
|
@@ -480,10 +482,23 @@ const stepRow = (view, step, sessions) => {
|
|
|
480
482
|
${decided && entry.reason ? why(entry) : ''}
|
|
481
483
|
</li>`;
|
|
482
484
|
};
|
|
485
|
+
/** Steps that only check the page, left out of the walkthrough's script, even one that decided its case. */
|
|
486
|
+
const checks = new Set([
|
|
487
|
+
'expectText',
|
|
488
|
+
'expectNoText',
|
|
489
|
+
'expectUrl',
|
|
490
|
+
'expectLink',
|
|
491
|
+
]);
|
|
492
|
+
/**
|
|
493
|
+
* The steps the walkthrough lists: what the run did. A case a check decided says why under its
|
|
494
|
+
* title instead, and in the cases that did not pass.
|
|
495
|
+
*/
|
|
496
|
+
const scriptSteps = (view) => view.steps.filter((s) => !checks.has(s.step.action));
|
|
483
497
|
const caseBlock = (view, position, sessions) => {
|
|
484
498
|
const { entry } = view;
|
|
485
499
|
const session = sessionOf(entry);
|
|
486
|
-
const
|
|
500
|
+
const steps = scriptSteps(view);
|
|
501
|
+
const decidedShown = steps.some((s) => s.state === 'decided');
|
|
487
502
|
const timedButNoVideo = view.steps.some((s) => s.timing !== undefined) && !sessions.has(session)
|
|
488
503
|
? html `<p class="wt-case-note">
|
|
489
504
|
Session ${session} has no video, so these times cannot be played.
|
|
@@ -499,9 +514,9 @@ const caseBlock = (view, position, sessions) => {
|
|
|
499
514
|
>
|
|
500
515
|
</div>
|
|
501
516
|
${timedButNoVideo}${entry.reason && !decidedShown ? why(entry, ' wt-case-why') : ''}
|
|
502
|
-
${
|
|
517
|
+
${steps.length > 0
|
|
503
518
|
? html `<ol class="wt-steps">
|
|
504
|
-
${
|
|
519
|
+
${steps.map((step) => stepRow(view, step, sessions))}
|
|
505
520
|
</ol>`
|
|
506
521
|
: html `<p class="wt-case-note">No steps recorded for this case.</p>`}
|
|
507
522
|
</li>`;
|
|
@@ -553,7 +568,7 @@ export const renderWalkthrough = (bundle, options) => {
|
|
|
553
568
|
// A page, not a file to load: relative even with an asset base URL (see `assets.ts`).
|
|
554
569
|
const report = safeRelative(bundle.files.html) ?? runFiles.html;
|
|
555
570
|
const missingVideo = (ledger.sessions ?? []).filter((s) => s.videoProblem || !s.video);
|
|
556
|
-
const actions = views.reduce((n, v) => n + v.
|
|
571
|
+
const actions = views.reduce((n, v) => n + scriptSteps(v).length, 0);
|
|
557
572
|
const urls = urlTimeline(bundle, views);
|
|
558
573
|
const idle = idleStretches(bundle);
|
|
559
574
|
const overlay = html `<div class="wt-box" id="wt-box" hidden><span></span></div>
|
|
@@ -664,12 +679,6 @@ export const renderWalkthrough = (bundle, options) => {
|
|
|
664
679
|
</section>
|
|
665
680
|
${problemsBlock(views, sessions)}
|
|
666
681
|
</main>
|
|
667
|
-
<p class="foot">
|
|
668
|
-
Statuses decided by code in a real browser. Boxes over the video mark the element a step
|
|
669
|
-
acted on, measured as it ran; none is drawn where it was not measured. The cursor,
|
|
670
|
-
clicks and labels over it are drawn here from where each action was recorded; they are
|
|
671
|
-
not in the video itself.
|
|
672
|
-
</p>
|
|
673
682
|
</div>
|
|
674
683
|
</body>
|
|
675
684
|
</html> `;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
/** At most this long, the `about` of an account (one line). */
|
|
3
|
+
export declare const ACCOUNT_ABOUT_MAX = 200;
|
|
4
|
+
/** A label such as `trial-user`: lower-case letters, digits and dashes, also a file name. */
|
|
5
|
+
export declare const AccountLabel: Schema.String;
|
|
6
|
+
/** What kind of user an account is, for the agent picking one: one line. */
|
|
7
|
+
export declare const AccountAbout: Schema.String;
|
|
8
|
+
/** A job's account: its label, or the label with what it is and whether to sign in again. */
|
|
9
|
+
export declare const JobAccount: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
10
|
+
readonly label: Schema.String;
|
|
11
|
+
readonly about: Schema.optionalKey<Schema.String>;
|
|
12
|
+
readonly renew: Schema.optionalKey<Schema.Boolean>;
|
|
13
|
+
}>]>;
|
|
14
|
+
export type JobAccount = typeof JobAccount.Type;
|
|
15
|
+
/** The label of a job's account. */
|
|
16
|
+
export declare const accountLabel: (account: JobAccount) => string;
|
|
17
|
+
/** The `about` a job gave its account, if any. */
|
|
18
|
+
export declare const accountAboutOf: (account: JobAccount) => string | undefined;
|
|
19
|
+
/** One saved account in `accounts.json`. Never a secret: the session is a file of its own. */
|
|
20
|
+
export declare const AccountEntry: Schema.Struct<{
|
|
21
|
+
readonly label: Schema.String;
|
|
22
|
+
readonly about: Schema.optionalKey<Schema.String>;
|
|
23
|
+
/** The origin it was signed in on, such as `http://localhost:3000`; runs elsewhere sign in again. */
|
|
24
|
+
readonly origin: Schema.String;
|
|
25
|
+
/** When the session was saved, as an ISO time. */
|
|
26
|
+
readonly savedAt: Schema.String;
|
|
27
|
+
}>;
|
|
28
|
+
export type AccountEntry = typeof AccountEntry.Type;
|
|
29
|
+
/** `.screw-bugs/accounts.json`: the saved accounts, for agents to pick from. */
|
|
30
|
+
export declare const AccountsFile: Schema.Struct<{
|
|
31
|
+
readonly version: Schema.Literal<1>;
|
|
32
|
+
readonly accounts: Schema.$Array<Schema.Struct<{
|
|
33
|
+
readonly label: Schema.String;
|
|
34
|
+
readonly about: Schema.optionalKey<Schema.String>;
|
|
35
|
+
/** The origin it was signed in on, such as `http://localhost:3000`; runs elsewhere sign in again. */
|
|
36
|
+
readonly origin: Schema.String;
|
|
37
|
+
/** When the session was saved, as an ISO time. */
|
|
38
|
+
readonly savedAt: Schema.String;
|
|
39
|
+
}>>;
|
|
40
|
+
}>;
|
|
41
|
+
export type AccountsFile = typeof AccountsFile.Type;
|
|
42
|
+
/**
|
|
43
|
+
* The parts of a saved session (Playwright's storage state) read to tell whether it may still
|
|
44
|
+
* work. Everything else in the file is only for the browser.
|
|
45
|
+
*/
|
|
46
|
+
export declare const SavedSession: Schema.Struct<{
|
|
47
|
+
/**
|
|
48
|
+
* Where and when this session was signed in, written in the same file (one atomic rename) so a
|
|
49
|
+
* run never pairs a session with another one's origin; `accounts.json` only lists it.
|
|
50
|
+
*/
|
|
51
|
+
readonly account: Schema.Struct<{
|
|
52
|
+
readonly label: Schema.String;
|
|
53
|
+
readonly origin: Schema.String;
|
|
54
|
+
readonly savedAt: Schema.String;
|
|
55
|
+
}>;
|
|
56
|
+
readonly cookies: Schema.$Array<Schema.Struct<{
|
|
57
|
+
readonly name: Schema.String;
|
|
58
|
+
readonly domain: Schema.String;
|
|
59
|
+
/** Seconds since the epoch; -1 for a cookie that lasts as long as the browser. */
|
|
60
|
+
readonly expires: Schema.Number;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly origins: Schema.$Array<Schema.Struct<{
|
|
63
|
+
readonly origin: Schema.String;
|
|
64
|
+
}>>;
|
|
65
|
+
}>;
|
|
66
|
+
export type SavedSession = typeof SavedSession.Type;
|
|
67
|
+
/** Why a job's account needs a person to sign in before it can run. */
|
|
68
|
+
export type SignInWhy = {
|
|
69
|
+
readonly _tag: 'none';
|
|
70
|
+
} | {
|
|
71
|
+
readonly _tag: 'origin';
|
|
72
|
+
readonly saved: string;
|
|
73
|
+
} | {
|
|
74
|
+
readonly _tag: 'expired';
|
|
75
|
+
} | {
|
|
76
|
+
readonly _tag: 'renew';
|
|
77
|
+
};
|
|
78
|
+
export declare const SignInInput: Schema.Union<readonly [Schema.Struct<{
|
|
79
|
+
readonly type: Schema.Literal<"mouse">;
|
|
80
|
+
readonly kind: Schema.Literals<readonly ["move", "down", "up"]>;
|
|
81
|
+
readonly x: Schema.Number;
|
|
82
|
+
readonly y: Schema.Number;
|
|
83
|
+
readonly button: Schema.optionalKey<Schema.Literals<readonly ["left", "middle", "right"]>>;
|
|
84
|
+
readonly clickCount: Schema.optionalKey<Schema.Int>;
|
|
85
|
+
}>, Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"wheel">;
|
|
87
|
+
readonly x: Schema.Number;
|
|
88
|
+
readonly y: Schema.Number;
|
|
89
|
+
readonly dx: Schema.Number;
|
|
90
|
+
readonly dy: Schema.Number;
|
|
91
|
+
}>, Schema.Struct<{
|
|
92
|
+
readonly type: Schema.Literal<"key">;
|
|
93
|
+
/** A `KeyboardEvent.key`, such as `Enter`, `ArrowLeft` or `a`. */
|
|
94
|
+
readonly key: Schema.String;
|
|
95
|
+
readonly modifiers: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["Alt", "Control", "Meta", "Shift"]>>>;
|
|
96
|
+
}>, Schema.Struct<{
|
|
97
|
+
readonly type: Schema.Literal<"text">;
|
|
98
|
+
readonly text: Schema.String;
|
|
99
|
+
}>, Schema.Struct<{
|
|
100
|
+
readonly type: Schema.Literal<"nav">;
|
|
101
|
+
readonly kind: Schema.Literals<readonly ["back", "forward", "reload"]>;
|
|
102
|
+
}>, Schema.Struct<{
|
|
103
|
+
readonly type: Schema.Literal<"viewport">;
|
|
104
|
+
readonly width: Schema.Int;
|
|
105
|
+
readonly height: Schema.Int;
|
|
106
|
+
}>]>;
|
|
107
|
+
export type SignInInput = typeof SignInInput.Type;
|
|
108
|
+
/** What the live view posts: a few inputs at a time. */
|
|
109
|
+
export declare const SignInInputs: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
110
|
+
readonly type: Schema.Literal<"mouse">;
|
|
111
|
+
readonly kind: Schema.Literals<readonly ["move", "down", "up"]>;
|
|
112
|
+
readonly x: Schema.Number;
|
|
113
|
+
readonly y: Schema.Number;
|
|
114
|
+
readonly button: Schema.optionalKey<Schema.Literals<readonly ["left", "middle", "right"]>>;
|
|
115
|
+
readonly clickCount: Schema.optionalKey<Schema.Int>;
|
|
116
|
+
}>, Schema.Struct<{
|
|
117
|
+
readonly type: Schema.Literal<"wheel">;
|
|
118
|
+
readonly x: Schema.Number;
|
|
119
|
+
readonly y: Schema.Number;
|
|
120
|
+
readonly dx: Schema.Number;
|
|
121
|
+
readonly dy: Schema.Number;
|
|
122
|
+
}>, Schema.Struct<{
|
|
123
|
+
readonly type: Schema.Literal<"key">;
|
|
124
|
+
/** A `KeyboardEvent.key`, such as `Enter`, `ArrowLeft` or `a`. */
|
|
125
|
+
readonly key: Schema.String;
|
|
126
|
+
readonly modifiers: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["Alt", "Control", "Meta", "Shift"]>>>;
|
|
127
|
+
}>, Schema.Struct<{
|
|
128
|
+
readonly type: Schema.Literal<"text">;
|
|
129
|
+
readonly text: Schema.String;
|
|
130
|
+
}>, Schema.Struct<{
|
|
131
|
+
readonly type: Schema.Literal<"nav">;
|
|
132
|
+
readonly kind: Schema.Literals<readonly ["back", "forward", "reload"]>;
|
|
133
|
+
}>, Schema.Struct<{
|
|
134
|
+
readonly type: Schema.Literal<"viewport">;
|
|
135
|
+
readonly width: Schema.Int;
|
|
136
|
+
readonly height: Schema.Int;
|
|
137
|
+
}>]>>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
/*
|
|
3
|
+
* Test accounts: sessions a person signed in to once, which runs start from. The agent picks an
|
|
4
|
+
* account by label for what its cases need (`about` says what kind of user it is); a person signs
|
|
5
|
+
* in to it in the live view, where what they type goes to that browser only: never logged, recorded
|
|
6
|
+
* or saved. Only the session is kept.
|
|
7
|
+
*/
|
|
8
|
+
/** At most this long, the `about` of an account (one line). */
|
|
9
|
+
export const ACCOUNT_ABOUT_MAX = 200;
|
|
10
|
+
/** A label such as `trial-user`: lower-case letters, digits and dashes, also a file name. */
|
|
11
|
+
export const AccountLabel = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9-]{0,39}$/, {
|
|
12
|
+
message: 'Use 1-40 lower-case letters, digits or dashes, starting with a letter or digit',
|
|
13
|
+
})).annotate({ description: 'Label of a test account, such as trial-user.' });
|
|
14
|
+
/** What kind of user an account is, for the agent picking one: one line. */
|
|
15
|
+
export const AccountAbout = Schema.String.check(Schema.makeFilter((text) => !text.trim()
|
|
16
|
+
? 'Must not be blank'
|
|
17
|
+
: text.length > ACCOUNT_ABOUT_MAX
|
|
18
|
+
? `At most ${ACCOUNT_ABOUT_MAX} characters`
|
|
19
|
+
: /[\r\n]/.test(text)
|
|
20
|
+
? 'Must be one line'
|
|
21
|
+
: undefined)).annotate({
|
|
22
|
+
description: 'What kind of user this is, such as "On a 14-day trial, no card on file".',
|
|
23
|
+
});
|
|
24
|
+
/** A job's account: its label, or the label with what it is and whether to sign in again. */
|
|
25
|
+
export const JobAccount = Schema.Union([
|
|
26
|
+
AccountLabel,
|
|
27
|
+
Schema.Struct({
|
|
28
|
+
label: AccountLabel,
|
|
29
|
+
about: Schema.optionalKey(AccountAbout),
|
|
30
|
+
renew: Schema.optionalKey(Schema.Boolean.annotate({
|
|
31
|
+
description: 'Ask the user to sign in to it again (its saved session no longer works), unless that ' +
|
|
32
|
+
'happened in the last 10 minutes.',
|
|
33
|
+
})),
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
/** The label of a job's account. */
|
|
37
|
+
export const accountLabel = (account) => typeof account === 'string' ? account : account.label;
|
|
38
|
+
/** The `about` a job gave its account, if any. */
|
|
39
|
+
export const accountAboutOf = (account) => typeof account === 'string' ? undefined : account.about;
|
|
40
|
+
/** One saved account in `accounts.json`. Never a secret: the session is a file of its own. */
|
|
41
|
+
export const AccountEntry = Schema.Struct({
|
|
42
|
+
label: AccountLabel,
|
|
43
|
+
about: Schema.optionalKey(Schema.String),
|
|
44
|
+
/** The origin it was signed in on, such as `http://localhost:3000`; runs elsewhere sign in again. */
|
|
45
|
+
origin: Schema.String,
|
|
46
|
+
/** When the session was saved, as an ISO time. */
|
|
47
|
+
savedAt: Schema.String,
|
|
48
|
+
});
|
|
49
|
+
/** `.screw-bugs/accounts.json`: the saved accounts, for agents to pick from. */
|
|
50
|
+
export const AccountsFile = Schema.Struct({
|
|
51
|
+
version: Schema.Literal(1),
|
|
52
|
+
accounts: Schema.Array(AccountEntry),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* The parts of a saved session (Playwright's storage state) read to tell whether it may still
|
|
56
|
+
* work. Everything else in the file is only for the browser.
|
|
57
|
+
*/
|
|
58
|
+
export const SavedSession = Schema.Struct({
|
|
59
|
+
/**
|
|
60
|
+
* Where and when this session was signed in, written in the same file (one atomic rename) so a
|
|
61
|
+
* run never pairs a session with another one's origin; `accounts.json` only lists it.
|
|
62
|
+
*/
|
|
63
|
+
account: Schema.Struct({ label: Schema.String, origin: Schema.String, savedAt: Schema.String }),
|
|
64
|
+
cookies: Schema.Array(Schema.Struct({
|
|
65
|
+
name: Schema.String,
|
|
66
|
+
domain: Schema.String,
|
|
67
|
+
/** Seconds since the epoch; -1 for a cookie that lasts as long as the browser. */
|
|
68
|
+
expires: Schema.Number,
|
|
69
|
+
})),
|
|
70
|
+
origins: Schema.Array(Schema.Struct({ origin: Schema.String })),
|
|
71
|
+
});
|
|
72
|
+
/** One input the live view sends for the person signing in, in viewport CSS pixels. */
|
|
73
|
+
const Coordinate = Schema.Number.check(Schema.isBetween({ minimum: -10_000, maximum: 10_000 }));
|
|
74
|
+
const Modifiers = Schema.Array(Schema.Literals(['Alt', 'Control', 'Meta', 'Shift'])).check(Schema.isMaxLength(4));
|
|
75
|
+
export const SignInInput = Schema.Union([
|
|
76
|
+
Schema.Struct({
|
|
77
|
+
type: Schema.Literal('mouse'),
|
|
78
|
+
kind: Schema.Literals(['move', 'down', 'up']),
|
|
79
|
+
x: Coordinate,
|
|
80
|
+
y: Coordinate,
|
|
81
|
+
button: Schema.optionalKey(Schema.Literals(['left', 'middle', 'right'])),
|
|
82
|
+
clickCount: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 3 }))),
|
|
83
|
+
}),
|
|
84
|
+
Schema.Struct({
|
|
85
|
+
type: Schema.Literal('wheel'),
|
|
86
|
+
x: Coordinate,
|
|
87
|
+
y: Coordinate,
|
|
88
|
+
dx: Coordinate,
|
|
89
|
+
dy: Coordinate,
|
|
90
|
+
}),
|
|
91
|
+
Schema.Struct({
|
|
92
|
+
type: Schema.Literal('key'),
|
|
93
|
+
/** A `KeyboardEvent.key`, such as `Enter`, `ArrowLeft` or `a`. */
|
|
94
|
+
key: Schema.String.check(Schema.isPattern(/^(?:[A-Za-z0-9]{1,20}|[^\s]|\s)$/u)),
|
|
95
|
+
modifiers: Schema.optionalKey(Modifiers),
|
|
96
|
+
}),
|
|
97
|
+
Schema.Struct({
|
|
98
|
+
type: Schema.Literal('text'),
|
|
99
|
+
text: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(2_000)),
|
|
100
|
+
}),
|
|
101
|
+
Schema.Struct({
|
|
102
|
+
type: Schema.Literal('nav'),
|
|
103
|
+
kind: Schema.Literals(['back', 'forward', 'reload']),
|
|
104
|
+
}),
|
|
105
|
+
Schema.Struct({
|
|
106
|
+
type: Schema.Literal('viewport'),
|
|
107
|
+
width: Schema.Int,
|
|
108
|
+
height: Schema.Int,
|
|
109
|
+
}),
|
|
110
|
+
]);
|
|
111
|
+
/** What the live view posts: a few inputs at a time. */
|
|
112
|
+
export const SignInInputs = Schema.Array(SignInInput).check(Schema.isMaxLength(100));
|
package/dist/schema/index.d.ts
CHANGED
package/dist/schema/index.js
CHANGED
package/dist/schema/job.d.ts
CHANGED
|
@@ -1059,8 +1059,15 @@ export declare const JobSpec: Schema.Struct<{
|
|
|
1059
1059
|
readonly success: Schema.optionalKey<Schema.String>;
|
|
1060
1060
|
}>>>;
|
|
1061
1061
|
readonly device: Schema.optionalKey<Schema.Literals<readonly ["desktop", "mobile"]>>;
|
|
1062
|
-
/**
|
|
1063
|
-
|
|
1062
|
+
/**
|
|
1063
|
+
* The test account the session starts signed in as (see `JobAccount`): a session a person saved
|
|
1064
|
+
* once for this origin. Its cases run signed in from the first step.
|
|
1065
|
+
*/
|
|
1066
|
+
readonly account: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
1067
|
+
readonly label: Schema.String;
|
|
1068
|
+
readonly about: Schema.optionalKey<Schema.String>;
|
|
1069
|
+
readonly renew: Schema.optionalKey<Schema.Boolean>;
|
|
1070
|
+
}>]>>;
|
|
1064
1071
|
}>;
|
|
1065
1072
|
export type JobSpec = typeof JobSpec.Type;
|
|
1066
1073
|
/**
|
|
@@ -1387,8 +1394,15 @@ export declare const NewJobSpec: Schema.Struct<{
|
|
|
1387
1394
|
readonly success: Schema.optionalKey<Schema.String>;
|
|
1388
1395
|
}>>>;
|
|
1389
1396
|
readonly device: Schema.optionalKey<Schema.Literals<readonly ["desktop", "mobile"]>>;
|
|
1390
|
-
/**
|
|
1391
|
-
|
|
1397
|
+
/**
|
|
1398
|
+
* The test account the session starts signed in as (see `JobAccount`): a session a person saved
|
|
1399
|
+
* once for this origin. Its cases run signed in from the first step.
|
|
1400
|
+
*/
|
|
1401
|
+
readonly account: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
1402
|
+
readonly label: Schema.String;
|
|
1403
|
+
readonly about: Schema.optionalKey<Schema.String>;
|
|
1404
|
+
readonly renew: Schema.optionalKey<Schema.Boolean>;
|
|
1405
|
+
}>]>>;
|
|
1392
1406
|
}>;
|
|
1393
1407
|
/** What `job.json` in a run folder holds. */
|
|
1394
1408
|
export declare const JobRecord: Schema.Struct<{
|
|
@@ -1712,8 +1726,15 @@ export declare const JobRecord: Schema.Struct<{
|
|
|
1712
1726
|
readonly success: Schema.optionalKey<Schema.String>;
|
|
1713
1727
|
}>>>;
|
|
1714
1728
|
readonly device: Schema.optionalKey<Schema.Literals<readonly ["desktop", "mobile"]>>;
|
|
1715
|
-
/**
|
|
1716
|
-
|
|
1729
|
+
/**
|
|
1730
|
+
* The test account the session starts signed in as (see `JobAccount`): a session a person saved
|
|
1731
|
+
* once for this origin. Its cases run signed in from the first step.
|
|
1732
|
+
*/
|
|
1733
|
+
readonly account: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
1734
|
+
readonly label: Schema.String;
|
|
1735
|
+
readonly about: Schema.optionalKey<Schema.String>;
|
|
1736
|
+
readonly renew: Schema.optionalKey<Schema.Boolean>;
|
|
1737
|
+
}>]>>;
|
|
1717
1738
|
}>;
|
|
1718
1739
|
readonly createdAt: Schema.String;
|
|
1719
1740
|
}>;
|
package/dist/schema/job.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
+
import { JobAccount } from './accounts.js';
|
|
2
3
|
/** Sortable by creation time and safe as a folder name, for example `20261029-104857-3f9a01c2`. */
|
|
3
4
|
export const JobId = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9-]*$/, {
|
|
4
5
|
message: 'A job ID has only letters, digits and dashes',
|
|
@@ -441,8 +442,17 @@ export const JobSpec = Schema.Struct({
|
|
|
441
442
|
description: 'Cases to run in order. Without cases, one "page loads" case runs.',
|
|
442
443
|
})),
|
|
443
444
|
device: Schema.optionalKey(Device),
|
|
444
|
-
/**
|
|
445
|
-
|
|
445
|
+
/**
|
|
446
|
+
* The test account the session starts signed in as (see `JobAccount`): a session a person saved
|
|
447
|
+
* once for this origin. Its cases run signed in from the first step.
|
|
448
|
+
*/
|
|
449
|
+
account: Schema.optionalKey(JobAccount.annotate({
|
|
450
|
+
description: 'Omit to run signed out (a fresh browser with no cookies or storage, whatever accounts ' +
|
|
451
|
+
'are saved). A test account to run signed in as: a label from .screw-bugs/accounts.json whose about ' +
|
|
452
|
+
'fits what the cases need (such as a user on a trial, or a paying one), or a new ' +
|
|
453
|
+
'{"label":"paid-user","about":"Pro plan, paying monthly"} for the user to sign in to. ' +
|
|
454
|
+
'Without a saved session nothing starts and the reply gives a link for the user.',
|
|
455
|
+
})),
|
|
446
456
|
});
|
|
447
457
|
/**
|
|
448
458
|
* A job as a caller submits it: a {@link JobSpec} whose case IDs are also unique ignoring case,
|
package/dist/schema/ledger.d.ts
CHANGED
|
@@ -667,7 +667,11 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
667
667
|
readonly success: Schema.optionalKey<Schema.String>;
|
|
668
668
|
}>>>;
|
|
669
669
|
readonly device: Schema.optionalKey<Schema.Literals<readonly ["desktop", "mobile"]>>;
|
|
670
|
-
readonly account: Schema.optionalKey<Schema.
|
|
670
|
+
readonly account: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
671
|
+
readonly label: Schema.String;
|
|
672
|
+
readonly about: Schema.optionalKey<Schema.String>;
|
|
673
|
+
readonly renew: Schema.optionalKey<Schema.Boolean>;
|
|
674
|
+
}>]>>;
|
|
671
675
|
}>;
|
|
672
676
|
readonly ledger: Schema.Struct<{
|
|
673
677
|
readonly jobId: Schema.brand<Schema.String, "JobId">;
|