screw-bugs 0.1.6 → 0.1.8
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 +86 -16
- package/dist/browser-playwright/launch.d.ts +4 -2
- package/dist/browser-playwright/launch.js +8 -1
- package/dist/browser-playwright/page.d.ts +2 -2
- package/dist/browser-playwright/page.js +15 -2
- package/dist/browser-playwright/still.d.ts +12 -0
- package/dist/browser-playwright/still.js +51 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/app.d.ts +1 -1
- package/dist/cli/commands.js +57 -12
- package/dist/cli/mcp.d.ts +11 -4
- package/dist/cli/mcp.js +86 -23
- package/dist/cli/operations.d.ts +30 -2
- package/dist/cli/operations.js +126 -20
- package/dist/cli/report-links.js +2 -2
- package/dist/cli/report-server.d.ts +41 -9
- package/dist/cli/report-server.js +139 -23
- package/dist/cli/share.d.ts +71 -4
- package/dist/cli/share.js +549 -118
- package/dist/cli/sign-in.d.ts +22 -10
- package/dist/cli/sign-in.js +23 -23
- package/dist/core/engine.js +67 -17
- package/dist/core/liveness.js +3 -1
- package/dist/core/services.d.ts +30 -5
- package/dist/core/share.d.ts +31 -0
- package/dist/core/share.js +139 -0
- package/dist/core/steps.d.ts +5 -0
- package/dist/core/steps.js +15 -1
- package/dist/core/video.d.ts +31 -0
- package/dist/core/video.js +132 -0
- package/dist/report/html.d.ts +4 -2
- package/dist/report/html.js +45 -13
- package/dist/report/icons.d.ts +3 -0
- package/dist/report/icons.js +5 -1
- package/dist/report/index.d.ts +3 -1
- package/dist/report/index.js +3 -1
- package/dist/report/live.d.ts +7 -0
- package/dist/report/live.js +135 -0
- package/dist/report/menu-bar.d.ts +3 -3
- package/dist/report/menu-bar.js +4 -4
- package/dist/report/player.d.ts +3 -3
- package/dist/report/player.js +3 -3
- package/dist/report/share-page.d.ts +48 -0
- package/dist/report/share-page.js +291 -0
- package/dist/report/styles.d.ts +2 -0
- package/dist/report/styles.js +2 -2
- package/dist/report/view.d.ts +16 -5
- package/dist/report/view.js +60 -24
- package/dist/report/walkthrough.d.ts +7 -3
- package/dist/report/walkthrough.js +21 -8
- package/dist/schema/accounts.js +10 -1
- package/dist/schema/evidence.d.ts +30 -8
- package/dist/schema/evidence.js +17 -4
- package/dist/schema/findings.js +1 -1
- package/dist/schema/job.d.ts +205 -65
- package/dist/schema/job.js +63 -11
- package/dist/schema/ledger.d.ts +88 -16
- package/dist/schema/ledger.js +36 -0
- package/dist/schema/share.d.ts +17 -0
- package/dist/schema/share.js +22 -0
- package/package.json +1 -1
package/dist/core/steps.js
CHANGED
|
@@ -48,6 +48,8 @@ export const describeStep = (step) => {
|
|
|
48
48
|
return 'reload';
|
|
49
49
|
case 'click':
|
|
50
50
|
return `click ${describeTarget(step.target)}`;
|
|
51
|
+
case 'hover':
|
|
52
|
+
return `hover ${describeTarget(step.target)}`;
|
|
51
53
|
case 'fill':
|
|
52
54
|
return `fill ${describeTarget(step.target)}`;
|
|
53
55
|
case 'upload':
|
|
@@ -174,6 +176,7 @@ const ACTIONS = [
|
|
|
174
176
|
'goto',
|
|
175
177
|
'reload',
|
|
176
178
|
'click',
|
|
179
|
+
'hover',
|
|
177
180
|
'fill',
|
|
178
181
|
'upload',
|
|
179
182
|
'press',
|
|
@@ -182,7 +185,7 @@ const ACTIONS = [
|
|
|
182
185
|
* What a page load that went wrong means for the step during which it started: an HTTP error
|
|
183
186
|
* fails it; a load that failed or did not finish blocks it. Every page load is counted against
|
|
184
187
|
* the step that was running when it started (`BrowserPage.settle`). An action (goto, reload,
|
|
185
|
-
* click, fill, upload, press) is taken to have caused it; during an expectation or a screenshot, which cause nothing,
|
|
188
|
+
* click, hover, fill, upload, press) is taken to have caused it; during an expectation or a screenshot, which cause nothing,
|
|
186
189
|
* the page did it on its own, so the reason says only when it started.
|
|
187
190
|
*/
|
|
188
191
|
const loadOutcome = (problem, step) => {
|
|
@@ -287,6 +290,13 @@ const runStep = (page, step, jobUrl, capture, stepShot, uploads) => {
|
|
|
287
290
|
message: `It links to a ${scheme} URL, so it was not clicked; ${ONLY_WEB}.`,
|
|
288
291
|
}),
|
|
289
292
|
}));
|
|
293
|
+
case 'hover':
|
|
294
|
+
// Measured and shown after it, like a fill: the step is there for what the hover shows.
|
|
295
|
+
return action(page.hover(step.target, { timeoutMs: step.timeoutMs }), lookedFor(step.target, noMatch)).pipe(Effect.tap((outcome) => outcome._tag === 'ok'
|
|
296
|
+
? page
|
|
297
|
+
.onScreen(step.target, 'act', { timeoutMs: step.timeoutMs })
|
|
298
|
+
.pipe(Effect.andThen(stepShot(step.target)))
|
|
299
|
+
: Effect.void));
|
|
290
300
|
case 'fill':
|
|
291
301
|
return action(page.fill(step.target, step.value, { timeoutMs: step.timeoutMs }), lookedFor(step.target, noMatch)).pipe(Effect.tap((outcome) => outcome._tag === 'ok'
|
|
292
302
|
? page
|
|
@@ -439,6 +449,7 @@ const runStep = (page, step, jobUrl, capture, stepShot, uploads) => {
|
|
|
439
449
|
};
|
|
440
450
|
/** The element a step acts on, if it has one. */
|
|
441
451
|
const targetOf = (step) => step.action === 'click' ||
|
|
452
|
+
step.action === 'hover' ||
|
|
442
453
|
step.action === 'fill' ||
|
|
443
454
|
step.action === 'upload' ||
|
|
444
455
|
step.action === 'waitFor' ||
|
|
@@ -623,6 +634,7 @@ export const runCase = (page, spec, options) => Effect.gen(function* () {
|
|
|
623
634
|
goto: (url, wait) => traced('goto', page.goto(url, wait)),
|
|
624
635
|
reload: (wait) => traced('reload', page.reload(wait)),
|
|
625
636
|
click: (target, wait) => traced('click', page.click(target, wait)),
|
|
637
|
+
hover: (target, wait) => traced('hover', page.hover(target, wait)),
|
|
626
638
|
fill: (target, value, wait) => traced('fill', page.fill(target, value, wait)),
|
|
627
639
|
upload: (target, files, wait) => traced('upload', page.upload(target, files, wait)),
|
|
628
640
|
press: (key) => traced('press', page.press(key)),
|
|
@@ -655,6 +667,8 @@ export const runCase = (page, spec, options) => Effect.gen(function* () {
|
|
|
655
667
|
if (settled !== undefined)
|
|
656
668
|
return settled;
|
|
657
669
|
current = index + 1 - offset;
|
|
670
|
+
if (options.onStep !== undefined)
|
|
671
|
+
yield* options.onStep(current, step.action);
|
|
658
672
|
acted = undefined;
|
|
659
673
|
measured = undefined;
|
|
660
674
|
const from = Math.round(yield* options.now);
|
package/dist/core/video.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StillStretch } from '../schema/index.js';
|
|
1
2
|
/** How many bytes from the start of a video file `webmDurationMs` needs. */
|
|
2
3
|
export declare const VIDEO_HEAD_BYTES: number;
|
|
3
4
|
/**
|
|
@@ -14,3 +15,33 @@ export declare const videoProblemOf: (file: {
|
|
|
14
15
|
readonly size: number;
|
|
15
16
|
readonly durationMs: number | undefined;
|
|
16
17
|
} | undefined, sessionMs: number) => string | undefined;
|
|
18
|
+
/** Frames a second the video is sampled at to find where it stands still. */
|
|
19
|
+
export declare const STILL_FPS = 4;
|
|
20
|
+
/** How wide, in pixels, each sampled frame is (its height keeps the video's shape). */
|
|
21
|
+
export declare const STILL_WIDTH = 64;
|
|
22
|
+
/** A pixel changed when its grey level moved by more than this (the video's own noise stays under it). */
|
|
23
|
+
export declare const STILL_LEVEL = 8;
|
|
24
|
+
/** A frame changed when at least this many of its pixels did. */
|
|
25
|
+
export declare const STILL_PIXELS = 3;
|
|
26
|
+
/** Still stretches shorter than this are not recorded. */
|
|
27
|
+
export declare const STILL_MIN_MS = 1000;
|
|
28
|
+
/** A grey image: one byte a pixel, row by row. */
|
|
29
|
+
export interface GrayImage {
|
|
30
|
+
readonly width: number;
|
|
31
|
+
readonly height: number;
|
|
32
|
+
readonly pixels: Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The pixels of an 8-bit greyscale, non-interlaced PNG (what ffmpeg writes with `-pix_fmt gray`),
|
|
36
|
+
* with `inflate` to undo its zlib compression; undefined for any other PNG or a broken one.
|
|
37
|
+
*/
|
|
38
|
+
export declare const grayPng: (bytes: Uint8Array, inflate: (data: Uint8Array) => Uint8Array) => GrayImage | undefined;
|
|
39
|
+
/** Whether `next` shows something other than `previous`: `STILL_PIXELS` or more moved past `STILL_LEVEL`. */
|
|
40
|
+
export declare const frameChanged: (previous: GrayImage, next: GrayImage) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The stretches in which frames sampled every `frameMs` (the first at 0) did not change (from one
|
|
43
|
+
* to the next, nor from the first of the stretch), at least
|
|
44
|
+
* `STILL_MIN_MS` long: from the first frame of each still run to its last, and to the end of the
|
|
45
|
+
* last frame for a run that lasts to the end. In time order.
|
|
46
|
+
*/
|
|
47
|
+
export declare const stillStretches: (frames: ReadonlyArray<GrayImage>, frameMs: number) => ReadonlyArray<StillStretch>;
|
package/dist/core/video.js
CHANGED
|
@@ -99,3 +99,135 @@ export const videoProblemOf = (file, sessionMs) => {
|
|
|
99
99
|
? `The video is ${seconds(file.durationMs)} long, but the session ran for ${seconds(sessionMs)}.`
|
|
100
100
|
: undefined;
|
|
101
101
|
};
|
|
102
|
+
/*
|
|
103
|
+
* Where a session's video stands still, for the walkthrough's "Skip inactive". After a session,
|
|
104
|
+
* Playwright's ffmpeg writes the video as small grey PNG frames (`STILL_FPS` a second,
|
|
105
|
+
* `STILL_WIDTH` pixels wide); here, in pure code, they are decoded and compared one after
|
|
106
|
+
* another. Measuring never changes the video, a status or anything a run did.
|
|
107
|
+
*/
|
|
108
|
+
/** Frames a second the video is sampled at to find where it stands still. */
|
|
109
|
+
export const STILL_FPS = 4;
|
|
110
|
+
/** How wide, in pixels, each sampled frame is (its height keeps the video's shape). */
|
|
111
|
+
export const STILL_WIDTH = 64;
|
|
112
|
+
/** A pixel changed when its grey level moved by more than this (the video's own noise stays under it). */
|
|
113
|
+
export const STILL_LEVEL = 8;
|
|
114
|
+
/** A frame changed when at least this many of its pixels did. */
|
|
115
|
+
export const STILL_PIXELS = 3;
|
|
116
|
+
/** Still stretches shorter than this are not recorded. */
|
|
117
|
+
export const STILL_MIN_MS = 1000;
|
|
118
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
119
|
+
const paeth = (a, b, c) => {
|
|
120
|
+
const p = a + b - c;
|
|
121
|
+
const pa = Math.abs(p - a);
|
|
122
|
+
const pb = Math.abs(p - b);
|
|
123
|
+
const pc = Math.abs(p - c);
|
|
124
|
+
return pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The pixels of an 8-bit greyscale, non-interlaced PNG (what ffmpeg writes with `-pix_fmt gray`),
|
|
128
|
+
* with `inflate` to undo its zlib compression; undefined for any other PNG or a broken one.
|
|
129
|
+
*/
|
|
130
|
+
export const grayPng = (bytes, inflate) => {
|
|
131
|
+
if (bytes.length < 8 || PNG_SIGNATURE.some((b, i) => bytes[i] !== b))
|
|
132
|
+
return undefined;
|
|
133
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
134
|
+
const tag = (at) => String.fromCharCode(...bytes.subarray(at, at + 4));
|
|
135
|
+
let width = 0;
|
|
136
|
+
let height = 0;
|
|
137
|
+
const data = [];
|
|
138
|
+
let at = 8;
|
|
139
|
+
while (at + 12 <= bytes.length) {
|
|
140
|
+
const length = view.getUint32(at);
|
|
141
|
+
const type = tag(at + 4);
|
|
142
|
+
const body = at + 8;
|
|
143
|
+
if (body + length > bytes.length)
|
|
144
|
+
return undefined;
|
|
145
|
+
if (type === 'IHDR') {
|
|
146
|
+
if (length < 13)
|
|
147
|
+
return undefined;
|
|
148
|
+
width = view.getUint32(body);
|
|
149
|
+
height = view.getUint32(body + 4);
|
|
150
|
+
const [depth, color, , , interlace] = bytes.subarray(body + 8, body + 13);
|
|
151
|
+
if (depth !== 8 || color !== 0 || interlace !== 0)
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
else if (type === 'IDAT')
|
|
155
|
+
data.push(bytes.subarray(body, body + length));
|
|
156
|
+
else if (type === 'IEND')
|
|
157
|
+
break;
|
|
158
|
+
at = body + length + 4;
|
|
159
|
+
}
|
|
160
|
+
if (width === 0 || height === 0 || data.length === 0)
|
|
161
|
+
return undefined;
|
|
162
|
+
const joined = new Uint8Array(data.reduce((n, d) => n + d.length, 0));
|
|
163
|
+
data.reduce((offset, d) => (joined.set(d, offset), offset + d.length), 0);
|
|
164
|
+
let raw;
|
|
165
|
+
try {
|
|
166
|
+
raw = inflate(joined);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
if (raw.length < height * (width + 1))
|
|
172
|
+
return undefined;
|
|
173
|
+
const pixels = new Uint8Array(width * height);
|
|
174
|
+
for (let y = 0; y < height; y++) {
|
|
175
|
+
const filter = raw[y * (width + 1)];
|
|
176
|
+
const row = y * width;
|
|
177
|
+
for (let x = 0; x < width; x++) {
|
|
178
|
+
const value = raw[y * (width + 1) + 1 + x];
|
|
179
|
+
const left = x > 0 ? pixels[row + x - 1] : 0;
|
|
180
|
+
const up = y > 0 ? pixels[row - width + x] : 0;
|
|
181
|
+
const corner = x > 0 && y > 0 ? pixels[row - width + x - 1] : 0;
|
|
182
|
+
const predicted = filter === 0
|
|
183
|
+
? 0
|
|
184
|
+
: filter === 1
|
|
185
|
+
? left
|
|
186
|
+
: filter === 2
|
|
187
|
+
? up
|
|
188
|
+
: filter === 3
|
|
189
|
+
? (left + up) >> 1
|
|
190
|
+
: filter === 4
|
|
191
|
+
? paeth(left, up, corner)
|
|
192
|
+
: undefined;
|
|
193
|
+
if (predicted === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
pixels[row + x] = (value + predicted) & 0xff;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return { width, height, pixels };
|
|
199
|
+
};
|
|
200
|
+
/** Whether `next` shows something other than `previous`: `STILL_PIXELS` or more moved past `STILL_LEVEL`. */
|
|
201
|
+
export const frameChanged = (previous, next) => {
|
|
202
|
+
if (previous.width !== next.width || previous.height !== next.height)
|
|
203
|
+
return true;
|
|
204
|
+
let changed = 0;
|
|
205
|
+
for (let i = 0; i < next.pixels.length; i++)
|
|
206
|
+
if (Math.abs(next.pixels[i] - previous.pixels[i]) > STILL_LEVEL && ++changed >= STILL_PIXELS)
|
|
207
|
+
return true;
|
|
208
|
+
return false;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* The stretches in which frames sampled every `frameMs` (the first at 0) did not change (from one
|
|
212
|
+
* to the next, nor from the first of the stretch), at least
|
|
213
|
+
* `STILL_MIN_MS` long: from the first frame of each still run to its last, and to the end of the
|
|
214
|
+
* last frame for a run that lasts to the end. In time order.
|
|
215
|
+
*/
|
|
216
|
+
export const stillStretches = (frames, frameMs) => {
|
|
217
|
+
const stretches = [];
|
|
218
|
+
const add = (from, to) => {
|
|
219
|
+
if (to - from >= STILL_MIN_MS)
|
|
220
|
+
stretches.push({ fromMs: from, toMs: to });
|
|
221
|
+
};
|
|
222
|
+
let start = 0;
|
|
223
|
+
// Each frame is compared with the one before and with the first of its still run, so a change
|
|
224
|
+
// too slow to show between two frames (a fade) still ends the run.
|
|
225
|
+
for (let i = 1; i < frames.length; i++)
|
|
226
|
+
if (frameChanged(frames[i - 1], frames[i]) || frameChanged(frames[start], frames[i])) {
|
|
227
|
+
add(start * frameMs, (i - 1) * frameMs);
|
|
228
|
+
start = i;
|
|
229
|
+
}
|
|
230
|
+
if (frames.length > 0)
|
|
231
|
+
add(start * frameMs, frames.length * frameMs);
|
|
232
|
+
return stretches;
|
|
233
|
+
};
|
package/dist/report/html.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ import { type RenderOptions } from './assets.js';
|
|
|
11
11
|
* (a case with no video to play stops the player, which says so in the video's place); a click
|
|
12
12
|
* on a case, a scrubber segment or a case link makes that case current (scrolling it to the line,
|
|
13
13
|
* with scroll detection held off for 700 ms meanwhile); with "Loop case" off the current case
|
|
14
|
-
* follows the playhead.
|
|
14
|
+
* follows the playhead. With "Skip inactive" on (as the walkthrough's, and remembered with it), it
|
|
15
|
+
* jumps over the stretches where nothing happened (`idleStretches`) while it plays; a stretch that
|
|
16
|
+
* runs past the end of the case being looped starts the case again instead. A timecode seeks the player there, playing on only when it was playing.
|
|
15
17
|
* The status filters hide cards (a hidden current case hands over to the
|
|
16
18
|
* first shown). Screenshots open in a modal viewer that steps through the case's shots (arrow
|
|
17
19
|
* keys, Esc, focus back where it was). A screenshot that cannot load says so in its figure, as
|
|
@@ -19,7 +21,7 @@ import { type RenderOptions } from './assets.js';
|
|
|
19
21
|
* failed. Without script: the video has its own controls, timecodes open the video at their time
|
|
20
22
|
* and screenshots open the image.
|
|
21
23
|
*/
|
|
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(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,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){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}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=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));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 const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\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})();";
|
|
24
|
+
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:')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(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,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){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}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=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));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 const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\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'),skipB=d.getElementById('rp-skip'),dlg=d.getElementById('viewer');\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 let skip=!!skipB;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));\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 const lp=loop&&timed(cur)&&cur.dataset.s===s,x=lp?span(cur):null;\n if(lp&&!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}\n if(skip&&!P.v.paused){const gap=idle.find(g=>g.s===s&&t>=g.a&&t<g.b-0.05);if(gap){let to=gap.b;if(lp&&lastT<x[1]&&to>=x[1]-0.03)to=x[0];lastT=to;P.v.currentTime=to;return}}\n if(!loop){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 if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});\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
25
|
/**
|
|
24
26
|
* Images and video load from the run folder by relative path (`'self'`, and `file:` for a report
|
|
25
27
|
* opened from disk); styles are inline, but for Google Fonts' stylesheet, whose fonts come from
|
package/dist/report/html.js
CHANGED
|
@@ -5,11 +5,12 @@ import { assetsOf, contentPolicy } from './assets.js';
|
|
|
5
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, videoFixPrompt, } from './player.js';
|
|
7
7
|
import { CHROME_LOGO } from './logos.js';
|
|
8
|
+
import { renderLivePage } from './live.js';
|
|
8
9
|
import { topBar } from './menu-bar.js';
|
|
9
10
|
import { cspHash } from './sha256.js';
|
|
10
11
|
import { cardShot, viewerShot } from './shots.js';
|
|
11
12
|
import { styles } from './styles.js';
|
|
12
|
-
import { cardShots, caseShots, caseSpans, caseViews, checksNote, countsOf, countWords, browserWords, deviceWords, durationOf, evaluationOf, formatBytes, formatClock, formatTime, formatTimecode, fragmentSeconds, reportHeading, runMs, severityLabel, statusLabel, statuses, stepParts, uploadNotes, urlAt, urlTimeline, verdictOf, waitNote, } from './view.js';
|
|
13
|
+
import { cardShots, caseShots, caseSpans, caseViews, checksNote, countsOf, countWords, browserWords, deviceWords, durationOf, evaluationOf, formatBytes, formatClock, formatTime, formatTimecode, fragmentSeconds, idleStretches, reportHeading, runMs, severityLabel, statusLabel, statuses, stepParts, uploadNotes, urlAt, urlTimeline, verdictOf, waitNote, } from './view.js';
|
|
13
14
|
import { renderWalkthrough } from './walkthrough.js';
|
|
14
15
|
/*
|
|
15
16
|
* The report: one page, one player. At the top, the run in a line and what was asked; then the
|
|
@@ -28,7 +29,9 @@ import { renderWalkthrough } from './walkthrough.js';
|
|
|
28
29
|
* (a case with no video to play stops the player, which says so in the video's place); a click
|
|
29
30
|
* on a case, a scrubber segment or a case link makes that case current (scrolling it to the line,
|
|
30
31
|
* with scroll detection held off for 700 ms meanwhile); with "Loop case" off the current case
|
|
31
|
-
* follows the playhead.
|
|
32
|
+
* follows the playhead. With "Skip inactive" on (as the walkthrough's, and remembered with it), it
|
|
33
|
+
* jumps over the stretches where nothing happened (`idleStretches`) while it plays; a stretch that
|
|
34
|
+
* runs past the end of the case being looped starts the case again instead. A timecode seeks the player there, playing on only when it was playing.
|
|
32
35
|
* The status filters hide cards (a hidden current case hands over to the
|
|
33
36
|
* first shown). Screenshots open in a modal viewer that steps through the case's shots (arrow
|
|
34
37
|
* keys, Esc, focus back where it was). A screenshot that cannot load says so in its figure, as
|
|
@@ -44,7 +47,9 @@ addEventListener('load',scan);
|
|
|
44
47
|
d.addEventListener('DOMContentLoaded',()=>{
|
|
45
48
|
chrome();scan();
|
|
46
49
|
const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];
|
|
47
|
-
const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),dlg=d.getElementById('viewer');
|
|
50
|
+
const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),skipB=d.getElementById('rp-skip'),dlg=d.getElementById('viewer');
|
|
51
|
+
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)}));
|
|
52
|
+
let skip=!!skipB;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));
|
|
48
53
|
const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;
|
|
49
54
|
const timed=c=>!!c&&c.dataset.t0!==undefined;
|
|
50
55
|
const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];
|
|
@@ -83,8 +88,10 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
83
88
|
broken:paintNow,fine:paintNow,
|
|
84
89
|
tick:t=>{
|
|
85
90
|
if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
const lp=loop&&timed(cur)&&cur.dataset.s===s,x=lp?span(cur):null;
|
|
92
|
+
if(lp&&!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}
|
|
93
|
+
if(skip&&!P.v.paused){const gap=idle.find(g=>g.s===s&&t>=g.a&&t<g.b-0.05);if(gap){let to=gap.b;if(lp&&lastT<x[1]&&to>=x[1]-0.03)to=x[0];lastT=to;P.v.currentTime=to;return}}
|
|
94
|
+
if(!loop){const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}
|
|
88
95
|
lastT=t;
|
|
89
96
|
},
|
|
90
97
|
seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},
|
|
@@ -96,6 +103,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
96
103
|
},
|
|
97
104
|
});
|
|
98
105
|
if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});
|
|
106
|
+
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});
|
|
99
107
|
const filter=f=>{
|
|
100
108
|
d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));
|
|
101
109
|
cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});
|
|
@@ -179,6 +187,8 @@ const reportStyles = /* css */ `
|
|
|
179
187
|
height but the player, which shrinks to what is left; its window then fits that space, at the
|
|
180
188
|
recording's shape (\`--win-h\` and \`--win-w\` are what the window adds around the screen).
|
|
181
189
|
\`--win-cap\` is the widest the window may be; \`--player-cap\` the tallest the player may be. */
|
|
190
|
+
/* Over the case segments, an inactive stretch dims the segment under it. */
|
|
191
|
+
.rp-sticky .idle { background: color-mix(in srgb, var(--bg) 55%, transparent); pointer-events: none; }
|
|
182
192
|
.rp-sticky { --stuck: calc(var(--bar) + 20px); --fit-gap: 20px; --win-cap: 100cqw; position: sticky; top: var(--stuck); display: flex; flex-direction: column; max-height: calc(100dvh - max(var(--rp-top, 0px), var(--stuck)) - var(--fit-gap)); container-type: inline-size; }
|
|
183
193
|
.rp-sticky > * { flex: none; }
|
|
184
194
|
.rp-sticky > .player { flex: 0 1 auto; min-height: 0; height: calc((var(--win-cap) - var(--win-w)) / var(--arw, 1.6) + var(--win-h)); max-height: var(--player-cap, none); container-type: size; }
|
|
@@ -337,6 +347,10 @@ a.tc:hover { background: var(--accent); color: var(--on-accent); }
|
|
|
337
347
|
.rp-head h1 { font-size: 24px; line-height: 30px; }
|
|
338
348
|
.filters button { height: 44px; }
|
|
339
349
|
.rp-main { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 18px 0 0; }
|
|
350
|
+
/* The player no wider than on a phone, centered: in a window wider than a phone, a full-width
|
|
351
|
+
player would be pinned so tall that little room is left to read the cases under it. Its strip
|
|
352
|
+
stays full width, so the cases still scroll out of sight under it. */
|
|
353
|
+
.rp-sticky { max-width: 416px; margin: 0 auto; }
|
|
340
354
|
/* The player is pinned under the top bar; the cases fade out under it instead. */
|
|
341
355
|
.rp-left { position: sticky; top: var(--bar); z-index: 2; background: var(--bg); padding: 8px 12px 10px; }
|
|
342
356
|
.rp-left::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: var(--fade); background: linear-gradient(var(--bg), transparent); pointer-events: none; }
|
|
@@ -355,6 +369,11 @@ a.tc:hover { background: var(--accent); color: var(--on-accent); }
|
|
|
355
369
|
.play, .full { width: 44px; height: 44px; }
|
|
356
370
|
.speed button { height: 38px; }
|
|
357
371
|
}
|
|
372
|
+
/* Between a small window and the two columns, the cases as wide as the player, so their lines do
|
|
373
|
+
not run across the whole window; narrower windows give them all of their width. */
|
|
374
|
+
@media (min-width: 641px) and (max-width: 900px) {
|
|
375
|
+
.rp-right { max-width: 440px; margin: 0 auto; }
|
|
376
|
+
}
|
|
358
377
|
`;
|
|
359
378
|
const caseAnchor = (id) => `case-${id}`;
|
|
360
379
|
/** A timecode: a link that opens the video at that time, which the page's script turns into a
|
|
@@ -644,6 +663,7 @@ const playerBlock = (bundle, views, spans, playable, hosted) => {
|
|
|
644
663
|
const firstSpan = firstCase ? spans.get(firstCase.entry.id) : undefined;
|
|
645
664
|
const first = playable.find((p) => p.number === firstSpan?.session) ?? playable[0];
|
|
646
665
|
const problems = (bundle.ledger.sessions ?? []).filter((s) => s.videoProblem || !s.video);
|
|
666
|
+
const idle = idleStretches(bundle);
|
|
647
667
|
const notes = problems.length > 0
|
|
648
668
|
? html `<ul class="video-notes">
|
|
649
669
|
${problems.map((s) => html `<li>
|
|
@@ -678,20 +698,31 @@ const playerBlock = (bundle, views, spans, playable, hosted) => {
|
|
|
678
698
|
sessions: playable,
|
|
679
699
|
progress: false,
|
|
680
700
|
label: 'Seek in the recording; each segment is a case',
|
|
681
|
-
marks: (session, length) => views
|
|
701
|
+
marks: (session, length) => views
|
|
702
|
+
.flatMap((view) => {
|
|
682
703
|
const span = spans.get(view.entry.id);
|
|
683
704
|
if (span === undefined || span.session !== session)
|
|
684
705
|
return [];
|
|
685
706
|
return [
|
|
686
707
|
html `<span
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
708
|
+
class="seg s-${view.entry.status}"
|
|
709
|
+
data-case="${view.entry.id}"
|
|
710
|
+
title="${`${view.entry.title} (${statusLabel[view.entry.status]})`}"
|
|
711
|
+
style="${`left:${share(span.startMs, length)};width:calc(${share(span.endMs - span.startMs, length)} - 2px)`}"
|
|
712
|
+
></span>`,
|
|
692
713
|
];
|
|
693
|
-
})
|
|
694
|
-
|
|
714
|
+
})
|
|
715
|
+
.concat(idle
|
|
716
|
+
.filter((g) => g.session === session)
|
|
717
|
+
.map((g) => html `<span
|
|
718
|
+
class="idle"
|
|
719
|
+
data-a="${fragmentSeconds(g.fromMs)}"
|
|
720
|
+
data-b="${fragmentSeconds(g.toMs)}"
|
|
721
|
+
style="${`left:${share(g.fromMs, length)};width:${share(g.toMs - g.fromMs, length)}`}"
|
|
722
|
+
></span>`)),
|
|
723
|
+
toggles: html `${toggleButton('rp-loop', html `Loop<span class="wide"> case</span>`, true)}${idle.length > 0
|
|
724
|
+
? toggleButton('rp-skip', html `Skip<span class="wide"> inactive</span>`, true)
|
|
725
|
+
: ''}`,
|
|
695
726
|
})}
|
|
696
727
|
<div class="nowplaying" id="rp-now" aria-live="polite">
|
|
697
728
|
<span class="np-st">${firstEntry ? statusIcon(firstEntry.status) : ''}</span>
|
|
@@ -888,4 +919,5 @@ export const renderHtmlReport = (bundle, options) => {
|
|
|
888
919
|
export const ReportRendererHtml = Layer.succeed(ReportRenderer, {
|
|
889
920
|
html: (bundle) => renderHtmlReport(bundle),
|
|
890
921
|
walkthrough: (bundle) => renderWalkthrough(bundle),
|
|
922
|
+
live: (page) => renderLivePage(page),
|
|
891
923
|
});
|
package/dist/report/icons.d.ts
CHANGED
|
@@ -10,12 +10,15 @@ 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 copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>';
|
|
14
|
+
readonly 'external-link': '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>';
|
|
13
15
|
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"/>';
|
|
14
16
|
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"/>';
|
|
15
17
|
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"/>';
|
|
16
18
|
readonly minus: '<path d="M5 12h14"/>';
|
|
17
19
|
readonly mouse: '<rect x="5" y="2" width="14" height="20" rx="7"/><path d="M12 6v4"/>';
|
|
18
20
|
readonly 'mouse-left': '<path d="M12 7.318V10"/><path d="M5 10v5a7 7 0 0 0 14 0V9c0-3.527-2.608-6.515-6-7"/><circle cx="7" cy="4" r="2"/>';
|
|
21
|
+
readonly 'mouse-pointer-2': '<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/>';
|
|
19
22
|
readonly monitor: '<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>';
|
|
20
23
|
readonly moon: '<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>';
|
|
21
24
|
readonly pause: '<rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/>';
|
package/dist/report/icons.js
CHANGED
|
@@ -19,7 +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, file-text, maximize, minus,
|
|
22
|
+
* Of these, check, chevron-left, chevron-right, copy, external-link, file-text, maximize, minus,
|
|
23
|
+
* monitor, moon, share,
|
|
23
24
|
* smartphone and x are derived from the Feather project, under its MIT License:
|
|
24
25
|
*
|
|
25
26
|
* The MIT License (MIT) (for the icons listed above)
|
|
@@ -56,12 +57,15 @@ export const ICONS = {
|
|
|
56
57
|
'chevrons-up-down': '<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',
|
|
57
58
|
'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"/>',
|
|
58
59
|
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"/>',
|
|
60
|
+
copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
|
|
61
|
+
'external-link': '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
|
|
59
62
|
'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
63
|
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
64
|
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
65
|
minus: '<path d="M5 12h14"/>',
|
|
63
66
|
mouse: '<rect x="5" y="2" width="14" height="20" rx="7"/><path d="M12 6v4"/>',
|
|
64
67
|
'mouse-left': '<path d="M12 7.318V10"/><path d="M5 10v5a7 7 0 0 0 14 0V9c0-3.527-2.608-6.515-6-7"/><circle cx="7" cy="4" r="2"/>',
|
|
68
|
+
'mouse-pointer-2': '<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/>',
|
|
65
69
|
monitor: '<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>',
|
|
66
70
|
moon: '<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',
|
|
67
71
|
pause: '<rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/>',
|
package/dist/report/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ export * from './html.js';
|
|
|
2
2
|
export * from './pr-summary.js';
|
|
3
3
|
export { SHARE_START_PATH } from './menu-bar.js';
|
|
4
4
|
export { stepText } from './view.js';
|
|
5
|
-
export { hex, hmacSha256, sha256 } from './sha256.js';
|
|
5
|
+
export { base64, cspHash, hex, hmacSha256, sha256 } from './sha256.js';
|
|
6
6
|
export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
|
|
7
7
|
export { AssetBaseUrl, type RenderOptions } from './assets.js';
|
|
8
8
|
export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
|
|
9
|
+
export { LIVE_CSP, LIVE_REFRESH_S, renderLivePage } from './live.js';
|
|
10
|
+
export { renderSharePage, SHARE_PAGE_SCRIPT, SHARE_POLL_MS, SHARE_WEBP_QUALITY, type SharePage, sharePageCsp, } from './share-page.js';
|
package/dist/report/index.js
CHANGED
|
@@ -2,7 +2,9 @@ export * from './html.js';
|
|
|
2
2
|
export * from './pr-summary.js';
|
|
3
3
|
export { SHARE_START_PATH } from './menu-bar.js';
|
|
4
4
|
export { stepText } from './view.js';
|
|
5
|
-
export { hex, hmacSha256, sha256 } from './sha256.js';
|
|
5
|
+
export { base64, cspHash, hex, hmacSha256, sha256 } from './sha256.js';
|
|
6
6
|
export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
|
|
7
7
|
export { AssetBaseUrl } from './assets.js';
|
|
8
8
|
export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
|
|
9
|
+
export { LIVE_CSP, LIVE_REFRESH_S, renderLivePage } from './live.js';
|
|
10
|
+
export { renderSharePage, SHARE_PAGE_SCRIPT, SHARE_POLL_MS, SHARE_WEBP_QUALITY, sharePageCsp, } from './share-page.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LivePage } from '../core/index.js';
|
|
2
|
+
/** How often the page reloads itself while the run is going, in seconds. */
|
|
3
|
+
export declare const LIVE_REFRESH_S = 3;
|
|
4
|
+
/** No script, nothing from elsewhere: only its own styles and the favicon's data URL. */
|
|
5
|
+
export declare const LIVE_CSP = "default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'";
|
|
6
|
+
/** The whole `live.html`. */
|
|
7
|
+
export declare const renderLivePage: (page: LivePage) => string;
|