playwright-director 0.2.0 → 0.4.0
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 +101 -3
- package/dist/Tutorial.d.ts +33 -0
- package/dist/Tutorial.d.ts.map +1 -1
- package/dist/Tutorial.js +103 -0
- package/dist/Tutorial.js.map +1 -1
- package/dist/cursor.d.ts +2 -0
- package/dist/cursor.d.ts.map +1 -1
- package/dist/cursor.js +6 -1
- package/dist/cursor.js.map +1 -1
- package/dist/fast-forward.d.ts +49 -0
- package/dist/fast-forward.d.ts.map +1 -0
- package/dist/fast-forward.js +77 -0
- package/dist/fast-forward.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/merge.d.ts +4 -0
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +8 -1
- package/dist/merge.js.map +1 -1
- package/dist/overlay.js +3 -3
- package/dist/overlay.js.map +1 -1
- package/dist/styles.css +50 -0
- package/dist/timeline.d.ts +18 -1
- package/dist/timeline.d.ts.map +1 -1
- package/dist/timeline.js +47 -3
- package/dist/timeline.js.map +1 -1
- package/dist/zoom.d.ts +65 -0
- package/dist/zoom.d.ts.map +1 -0
- package/dist/zoom.js +295 -0
- package/dist/zoom.js.map +1 -0
- package/package.json +1 -1
- package/skills/tutorialize/SKILL.md +5 -0
- package/skills/tutorialize/agent.md +8 -0
- package/skills/tutorialize/references/api.md +90 -2
- package/skills/tutorialize/references/storytelling.md +54 -0
- package/src/styles.css +50 -0
package/dist/zoom.js
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
export const ZOOM_MAX_SCALE = 2.5;
|
|
2
|
+
const ZOOM_FILL = 0.7;
|
|
3
|
+
const ZOOM_DEFAULT_BLUR = 4;
|
|
4
|
+
/** The zoom factor for a target: explicit `scale` wins, otherwise fit the target to ~70% of the viewport. */
|
|
5
|
+
export function zoomScale(rect, viewport, scale) {
|
|
6
|
+
if (scale !== undefined)
|
|
7
|
+
return Math.max(1, scale);
|
|
8
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
9
|
+
return 1;
|
|
10
|
+
const fit = Math.min((viewport.width * ZOOM_FILL) / rect.width, (viewport.height * ZOOM_FILL) / rect.height);
|
|
11
|
+
return Math.min(ZOOM_MAX_SCALE, Math.max(1, fit));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The camera at progress `e` (0 → 1): scale grows from 1 to `scale` while the
|
|
15
|
+
* target's center glides toward the viewport center. The origin is clamped so
|
|
16
|
+
* the scaled page always covers the viewport — a target near an edge stays
|
|
17
|
+
* off-center rather than exposing blank canvas.
|
|
18
|
+
*/
|
|
19
|
+
export function zoomFrame(rect, viewport, scale, e) {
|
|
20
|
+
const k = 1 + (scale - 1) * e;
|
|
21
|
+
const axis = (center, size) => {
|
|
22
|
+
const target = center + (size / 2 - center) * e;
|
|
23
|
+
return Math.min(0, Math.max(size * (1 - k), target - k * center));
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
k,
|
|
27
|
+
ox: axis(rect.x + rect.width / 2, viewport.width),
|
|
28
|
+
oy: axis(rect.y + rect.height / 2, viewport.height),
|
|
29
|
+
e
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const easeInOut = (t) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);
|
|
33
|
+
/** Precomputed zoom-in frames (~60fps); zoom-out plays them backwards. */
|
|
34
|
+
export function zoomFrames(rect, viewport, scale, transitionMs) {
|
|
35
|
+
const n = Math.max(1, Math.round(transitionMs / 16));
|
|
36
|
+
return Array.from({ length: n + 1 }, (_, i) => zoomFrame(rect, viewport, scale, easeInOut(i / n)));
|
|
37
|
+
}
|
|
38
|
+
export function zoomBlurPx(blur) {
|
|
39
|
+
if (blur === true)
|
|
40
|
+
return ZOOM_DEFAULT_BLUR;
|
|
41
|
+
if (typeof blur === 'number' && blur > 0)
|
|
42
|
+
return blur;
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Camera zoom on the top-level page. The page (iframes and scenes included) is
|
|
47
|
+
* scaled with a CSS transform on `<html>`, while the tutorial UI (step banner,
|
|
48
|
+
* cursor, email preview, debug clock) is lifted into a top-layer popover so it
|
|
49
|
+
* stays crisp and in place. Returns the cursor's on-screen position at the end,
|
|
50
|
+
* so the Node-side cursor can continue from there.
|
|
51
|
+
*/
|
|
52
|
+
export class TutorialZoom {
|
|
53
|
+
page;
|
|
54
|
+
active = null;
|
|
55
|
+
constructor(page) {
|
|
56
|
+
this.page = page;
|
|
57
|
+
}
|
|
58
|
+
switchPage(page) {
|
|
59
|
+
this.page = page;
|
|
60
|
+
this.active = null;
|
|
61
|
+
}
|
|
62
|
+
get isZoomed() {
|
|
63
|
+
return this.active !== null;
|
|
64
|
+
}
|
|
65
|
+
async zoomIn(rect, viewport, options = {}) {
|
|
66
|
+
if (this.active)
|
|
67
|
+
await this.zoomOut();
|
|
68
|
+
const scale = zoomScale(rect, viewport, options.scale);
|
|
69
|
+
const durationMs = options.transition ?? 600;
|
|
70
|
+
const frames = zoomFrames(rect, viewport, scale, durationMs);
|
|
71
|
+
const blurPx = zoomBlurPx(options.blur);
|
|
72
|
+
this.active = { frames, rect, blurPx, durationMs };
|
|
73
|
+
return this.run({ frames, durationMs, rect, blurPx, direction: 'in' });
|
|
74
|
+
}
|
|
75
|
+
async zoomOut() {
|
|
76
|
+
if (!this.active)
|
|
77
|
+
return null;
|
|
78
|
+
const { frames, rect, blurPx, durationMs } = this.active;
|
|
79
|
+
this.active = null;
|
|
80
|
+
try {
|
|
81
|
+
return await this.run({ frames, durationMs, rect, blurPx, direction: 'out' });
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
// Usually the page navigated or closed while zoomed — nothing left to restore.
|
|
85
|
+
console.warn(`[Tutorial] zoomOut failed: ${error.message}`);
|
|
86
|
+
// Best effort: put the page back without animating.
|
|
87
|
+
await this.page
|
|
88
|
+
.evaluate(() => window.__tutorialZoom?.restore?.())
|
|
89
|
+
.catch(() => { });
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
run(args) {
|
|
94
|
+
return this.page.evaluate(async ({ frames, durationMs, rect, blurPx, direction }) => {
|
|
95
|
+
const UI_IDS = ['tutorial-overlay', 'tutorial-email-preview', 'tutorial-cursor', 'tutorial-debug-clock', 'tutorial-fast-forward'];
|
|
96
|
+
const html = document.documentElement;
|
|
97
|
+
const w = window;
|
|
98
|
+
let state = w.__tutorialZoom;
|
|
99
|
+
// Re-inserting a node restarts its CSS entrance animation (banner fade-in):
|
|
100
|
+
// jump finite ones to their end so moving the UI never flashes it.
|
|
101
|
+
const settle = (el) => {
|
|
102
|
+
for (const a of el.getAnimations({ subtree: true })) {
|
|
103
|
+
if (a.effect?.getComputedTiming().iterations !== Infinity)
|
|
104
|
+
a.finish();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const restore = (st) => {
|
|
108
|
+
removeEventListener('scroll', st.onScroll);
|
|
109
|
+
html.style.transform = st.prevTransform;
|
|
110
|
+
html.style.transformOrigin = st.prevOrigin;
|
|
111
|
+
html.removeAttribute('data-tutorial-zoom');
|
|
112
|
+
for (const { el, prev } of st.fixed)
|
|
113
|
+
el.style.translate = prev;
|
|
114
|
+
// Everything in the layer (incl. a banner shown while zoomed) goes back to <body>.
|
|
115
|
+
for (const el of Array.from(st.layer.children)) {
|
|
116
|
+
if (el === st.blur)
|
|
117
|
+
continue;
|
|
118
|
+
document.body.appendChild(el);
|
|
119
|
+
settle(el);
|
|
120
|
+
}
|
|
121
|
+
if (st.layer.matches(':popover-open'))
|
|
122
|
+
st.layer.hidePopover();
|
|
123
|
+
st.layer.remove();
|
|
124
|
+
if (w.__tutorialZoom === st)
|
|
125
|
+
delete w.__tutorialZoom;
|
|
126
|
+
};
|
|
127
|
+
if (direction === 'in') {
|
|
128
|
+
if (state)
|
|
129
|
+
restore(state); // a zoom left behind (e.g. a failed zoomOut)
|
|
130
|
+
// <html> becomes the containing block of fixed elements once it has a
|
|
131
|
+
// transform: each frame shifts them back by the live scroll offset so
|
|
132
|
+
// fixed headers (and the stage) stay put.
|
|
133
|
+
const htmlRect = html.getBoundingClientRect();
|
|
134
|
+
const base = { x: htmlRect.left + scrollX, y: htmlRect.top + scrollY };
|
|
135
|
+
const establishesBlock = (el) => {
|
|
136
|
+
const cs = getComputedStyle(el);
|
|
137
|
+
return cs.transform !== 'none' || cs.filter !== 'none' || cs.perspective !== 'none'
|
|
138
|
+
|| cs.backdropFilter !== 'none' || /paint|layout|strict|content/.test(cs.contain)
|
|
139
|
+
|| /transform|filter|perspective/.test(cs.willChange);
|
|
140
|
+
};
|
|
141
|
+
const fixed = [];
|
|
142
|
+
for (const el of Array.from(document.body.querySelectorAll('*'))) {
|
|
143
|
+
if (UI_IDS.includes(el.id) || getComputedStyle(el).position !== 'fixed')
|
|
144
|
+
continue;
|
|
145
|
+
let contained = false;
|
|
146
|
+
for (let p = el.parentElement; p && p !== html; p = p.parentElement) {
|
|
147
|
+
if (establishesBlock(p)) {
|
|
148
|
+
contained = true;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (contained)
|
|
153
|
+
continue;
|
|
154
|
+
const translate = getComputedStyle(el).translate;
|
|
155
|
+
const [tx = '0px', ty = '0px'] = translate === 'none' ? [] : translate.split(' ');
|
|
156
|
+
fixed.push({ el, prev: el.style.translate, tx, ty });
|
|
157
|
+
}
|
|
158
|
+
const layer = document.createElement('div');
|
|
159
|
+
layer.id = 'tutorial-zoom-layer';
|
|
160
|
+
layer.className = 'tutorial-zoom-layer';
|
|
161
|
+
layer.style.cssText = 'position:fixed;inset:0;width:auto;height:auto;margin:0;padding:0;border:0;'
|
|
162
|
+
+ 'background:transparent;overflow:visible;pointer-events:none;color:inherit;';
|
|
163
|
+
let blur = null;
|
|
164
|
+
if (blurPx > 0) {
|
|
165
|
+
blur = document.createElement('div');
|
|
166
|
+
blur.className = 'tutorial-zoom-blur';
|
|
167
|
+
blur.style.cssText = `position:fixed;inset:0;pointer-events:none;opacity:0;`
|
|
168
|
+
+ `backdrop-filter:blur(${blurPx}px);-webkit-backdrop-filter:blur(${blurPx}px);`;
|
|
169
|
+
layer.appendChild(blur);
|
|
170
|
+
}
|
|
171
|
+
document.body.appendChild(layer);
|
|
172
|
+
for (const id of UI_IDS) {
|
|
173
|
+
const el = document.getElementById(id);
|
|
174
|
+
if (el) {
|
|
175
|
+
layer.appendChild(el);
|
|
176
|
+
settle(el);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (typeof layer.showPopover === 'function') {
|
|
180
|
+
layer.setAttribute('popover', 'manual');
|
|
181
|
+
layer.showPopover();
|
|
182
|
+
}
|
|
183
|
+
const cursor = document.getElementById('tutorial-cursor');
|
|
184
|
+
const cursorBase = cursor && cursor.style.left
|
|
185
|
+
? { x: parseFloat(cursor.style.left), y: parseFloat(cursor.style.top) }
|
|
186
|
+
: null;
|
|
187
|
+
state = w.__tutorialZoom = {
|
|
188
|
+
base,
|
|
189
|
+
fixed,
|
|
190
|
+
layer,
|
|
191
|
+
blur,
|
|
192
|
+
cursorBase,
|
|
193
|
+
frame: null,
|
|
194
|
+
onScroll: null,
|
|
195
|
+
restore: null,
|
|
196
|
+
prevTransform: html.style.transform,
|
|
197
|
+
prevOrigin: html.style.transformOrigin
|
|
198
|
+
};
|
|
199
|
+
html.style.transformOrigin = '0 0';
|
|
200
|
+
html.setAttribute('data-tutorial-zoom', '');
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
if (!state)
|
|
204
|
+
return null;
|
|
205
|
+
// The cursor may have moved while zoomed: map it back into page space.
|
|
206
|
+
const last = frames[frames.length - 1];
|
|
207
|
+
const cursor = document.getElementById('tutorial-cursor');
|
|
208
|
+
state.cursorBase = cursor && cursor.style.left
|
|
209
|
+
? { x: (parseFloat(cursor.style.left) - last.ox) / last.k, y: (parseFloat(cursor.style.top) - last.oy) / last.k }
|
|
210
|
+
: null;
|
|
211
|
+
}
|
|
212
|
+
const st = state;
|
|
213
|
+
const apply = (f) => {
|
|
214
|
+
st.frame = f;
|
|
215
|
+
// The zoomed page can overflow, and a Playwright action may scroll it:
|
|
216
|
+
// use the live scroll so the picture stays put whatever happens.
|
|
217
|
+
const tl = { x: st.base.x - scrollX, y: st.base.y - scrollY };
|
|
218
|
+
html.style.transform = `translate(${f.ox - tl.x * (1 - f.k)}px, ${f.oy - tl.y * (1 - f.k)}px) scale(${f.k})`;
|
|
219
|
+
for (const { el, tx, ty } of st.fixed) {
|
|
220
|
+
el.style.translate = `calc(${tx} + ${-tl.x}px) calc(${ty} + ${-tl.y}px)`;
|
|
221
|
+
}
|
|
222
|
+
const cursor = document.getElementById('tutorial-cursor');
|
|
223
|
+
if (cursor && st.cursorBase) {
|
|
224
|
+
cursor.style.left = `${f.ox + f.k * st.cursorBase.x}px`;
|
|
225
|
+
cursor.style.top = `${f.oy + f.k * st.cursorBase.y}px`;
|
|
226
|
+
}
|
|
227
|
+
if (st.blur) {
|
|
228
|
+
const pad = 6 * f.k;
|
|
229
|
+
const x1 = f.ox + f.k * rect.x - pad;
|
|
230
|
+
const y1 = f.oy + f.k * rect.y - pad;
|
|
231
|
+
const x2 = f.ox + f.k * (rect.x + rect.width) + pad;
|
|
232
|
+
const y2 = f.oy + f.k * (rect.y + rect.height) + pad;
|
|
233
|
+
st.blur.style.opacity = String(f.e);
|
|
234
|
+
st.blur.style.clipPath = `polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, `
|
|
235
|
+
+ `${x1}px ${y1}px, ${x2}px ${y1}px, ${x2}px ${y2}px, ${x1}px ${y2}px, ${x1}px ${y1}px)`;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
if (direction === 'in') {
|
|
239
|
+
st.restore = () => restore(st);
|
|
240
|
+
st.onScroll = () => {
|
|
241
|
+
if (w.__tutorialZoom === st && st.frame)
|
|
242
|
+
apply(st.frame);
|
|
243
|
+
};
|
|
244
|
+
addEventListener('scroll', st.onScroll, { passive: true });
|
|
245
|
+
}
|
|
246
|
+
const sequence = direction === 'in' ? frames : [...frames].reverse();
|
|
247
|
+
await new Promise((resolve) => {
|
|
248
|
+
const start = performance.now();
|
|
249
|
+
const tick = (now) => {
|
|
250
|
+
// A newer zoom took over (or this one was torn down): stop touching the page.
|
|
251
|
+
if (w.__tutorialZoom !== st)
|
|
252
|
+
return resolve();
|
|
253
|
+
const t = Math.min(1, (now - start) / durationMs);
|
|
254
|
+
const pos = t * (sequence.length - 1);
|
|
255
|
+
const i = Math.min(sequence.length - 2, Math.floor(pos));
|
|
256
|
+
const a = sequence[Math.max(0, i)];
|
|
257
|
+
const b = sequence[Math.min(sequence.length - 1, i + 1)];
|
|
258
|
+
const u = pos - Math.max(0, i);
|
|
259
|
+
apply({
|
|
260
|
+
k: a.k + (b.k - a.k) * u,
|
|
261
|
+
ox: a.ox + (b.ox - a.ox) * u,
|
|
262
|
+
oy: a.oy + (b.oy - a.oy) * u,
|
|
263
|
+
e: a.e + (b.e - a.e) * u
|
|
264
|
+
});
|
|
265
|
+
if (t < 1)
|
|
266
|
+
schedule();
|
|
267
|
+
else
|
|
268
|
+
resolve();
|
|
269
|
+
};
|
|
270
|
+
// rAF drives the animation; a timer takes over if frames stall, so
|
|
271
|
+
// the zoom always completes instead of hanging the step.
|
|
272
|
+
const schedule = () => {
|
|
273
|
+
let fired = false;
|
|
274
|
+
const go = () => {
|
|
275
|
+
if (fired)
|
|
276
|
+
return;
|
|
277
|
+
fired = true;
|
|
278
|
+
tick(performance.now());
|
|
279
|
+
};
|
|
280
|
+
requestAnimationFrame(go);
|
|
281
|
+
setTimeout(go, 50);
|
|
282
|
+
};
|
|
283
|
+
schedule();
|
|
284
|
+
});
|
|
285
|
+
const cursor = document.getElementById('tutorial-cursor');
|
|
286
|
+
const cursorPos = cursor && cursor.style.left
|
|
287
|
+
? { x: parseFloat(cursor.style.left), y: parseFloat(cursor.style.top) }
|
|
288
|
+
: null;
|
|
289
|
+
if (direction === 'out' && w.__tutorialZoom === st)
|
|
290
|
+
restore(st);
|
|
291
|
+
return cursorPos;
|
|
292
|
+
}, args);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=zoom.js.map
|
package/dist/zoom.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom.js","sourceRoot":"","sources":["../src/zoom.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,6GAA6G;AAC7G,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,QAAsB,EAAE,KAAc;IAC/E,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACnD,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CACnB,CAAC,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,KAAK,EACzC,CAAC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAC3C,CAAC;IACF,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,QAAsB,EAAE,KAAa,EAAE,CAAS;IACzF,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KA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C;;wBACjB,OAAO,EAAE,CAAC;gBAChB,CAAC,CAAC;gBACF,mEAAmE;gBACnE,yDAAyD;gBACzD,MAAM,QAAQ,GAAG,GAAG,EAAE;oBACrB,IAAI,KAAK,GAAG,KAAK,CAAC;oBAClB,MAAM,EAAE,GAAG,GAAG,EAAE;wBACf,IAAI,KAAK;4BAAE,OAAO;wBAClB,KAAK,GAAG,IAAI,CAAC;wBACb,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;oBACzB,CAAC,CAAC;oBACF,qBAAqB,CAAC,EAAE,CAAC,CAAC;oBAC1B,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpB,CAAC,CAAC;gBACF,QAAQ,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAC1D,MAAM,SAAS,GAAG,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI;gBAC5C,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;gBACvE,CAAC,CAAC,IAAI,CAAC;YAER,IAAI,SAAS,KAAK,KAAK,IAAI,CAAC,CAAC,cAAc,KAAK,EAAE;gBAAE,OAAO,CAAC,EAAE,CAAC,CAAC;YAChE,OAAO,SAAS,CAAC;QAClB,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright-director",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "AI-assisted Playwright tool that turns executable tests into directed video guides — demos, tutorials, and documentation that never lag behind the product.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,6 +43,11 @@ COMPLETE: Celebrate the outcome, suggest what's next
|
|
|
43
43
|
### 3. Implement (read `api.md`)
|
|
44
44
|
- Use the Tutorial API: `context()`, `step()`, `complete()`
|
|
45
45
|
- Follow timing rules, blank-screen prevention, navigation handling
|
|
46
|
+
- Direct attention sparingly: `zoom()` (optionally `blur`) on the 1–3 moments
|
|
47
|
+
the viewer must not miss (`storytelling.md` §9, `api.md` §13); secrets go
|
|
48
|
+
through `typeBlurred()`
|
|
49
|
+
- Fast-forward the dead time: wrap slow generations or repetitive chores in
|
|
50
|
+
`fastForward(speed, …)` inside their step (`storytelling.md` §10, `api.md` §14)
|
|
46
51
|
- Apply the polish checklist before submitting
|
|
47
52
|
|
|
48
53
|
### 4. Verify
|
|
@@ -44,6 +44,14 @@ Follow all rules from `api.md`:
|
|
|
44
44
|
- Dual-mode (test works with and without TUTORIAL_MODE)
|
|
45
45
|
- `@tutorial` tag on the test
|
|
46
46
|
- Acronyms have `voiceText` where TTS mispronounces
|
|
47
|
+
- Camera zooms (`tutorial.zoom()`, `zoomIn()`/`zoomOut()`, optional `blur`) on
|
|
48
|
+
the 1–3 moments the narration names — a total, a status, a tiny badge, a
|
|
49
|
+
panel filled while zoomed (`storytelling.md` §9, `api.md` §13). Never on
|
|
50
|
+
every step
|
|
51
|
+
- Passwords, API keys and tokens typed with `tutorial.typeBlurred()`
|
|
52
|
+
- Long waits (generation, import) and repetitive chores wrapped in
|
|
53
|
+
`tutorial.fastForward(speed, …)` inside their step, announced in the narration,
|
|
54
|
+
ending before the payoff (`storytelling.md` §10, `api.md` §14)
|
|
47
55
|
- Multi-scene only: every step touching a scene carries `{ scene }`, scenes sit
|
|
48
56
|
on distinct origins, each tab switch is acknowledged in the narration, and
|
|
49
57
|
split ratios (`focus(['a','b'], { ratio: [30, 70] })`) are used to keep the
|
|
@@ -124,9 +124,15 @@ Use these inside step actions instead of raw Playwright calls — they add curso
|
|
|
124
124
|
| `tutorial.click(locator)` | `page.click(...)` | Cursor animation → highlight → click |
|
|
125
125
|
| `tutorial.fill(locator, value)` | `page.fill(...)` | Highlight → fill |
|
|
126
126
|
| `tutorial.typeSlowly(locator, value, delay?)` | `page.fill(...)` | Highlight → character-by-character typing |
|
|
127
|
+
| `tutorial.typeBlurred(locator, value, options?)` | `page.fill(...)` | Highlight → blur the field → type. Options `{ delay?: 50, blur?: 4, reveal?: false }`; the field **stays blurred** afterwards (use for passwords, API keys, tokens) |
|
|
128
|
+
| `tutorial.unblur(locator)` | — | Remove the blur left by `typeBlurred` |
|
|
127
129
|
| `tutorial.selectOption(locator, value)` | `page.selectOption(...)` | Highlight → select |
|
|
128
130
|
| `tutorial.highlight(locator, duration?)` | — | Pulsing highlight around element |
|
|
129
131
|
| `tutorial.unhighlight(locator)` | — | Remove highlight |
|
|
132
|
+
| `tutorial.zoom(locator, options?)` | — | Camera zoom on the element (button, field, whole card), hold `duration` (1500ms), zoom back out. Options: `scale` (auto: fit ~70% of viewport, max 2.5×), `blur` (`true` = 4px, or px), `transition` (600ms per direction) |
|
|
133
|
+
| `tutorial.zoomIn(locator, options?)` / `tutorial.zoomOut()` | — | Zoom in and stay zoomed — `tutorial.click()` etc. work in the zoomed view — then zoom out. Keep the pair inside one step |
|
|
134
|
+
| `tutorial.fastForward(speed, action, options?)` | — | Run `action` with the final video playing `speed`× faster (VHS look). Returns the action's result. Options: `vhs` (default `true`). See §14 |
|
|
135
|
+
| `tutorial.startFastForward(speed, options?)` / `tutorial.endFastForward()` | — | Explicit start / end markers of a fast-forwarded span. Keep the pair inside one step |
|
|
130
136
|
| `tutorial.moveMouseToElement(locator)` | — | Animate cursor to element |
|
|
131
137
|
| `tutorial.showEmailPreview(options)` | — | Simulated email popup |
|
|
132
138
|
| `tutorial.switchPage(page)` | — | Switch recording to another tab |
|
|
@@ -134,6 +140,8 @@ Use these inside step actions instead of raw Playwright calls — they add curso
|
|
|
134
140
|
|
|
135
141
|
`locator` can be a Playwright `Locator` or a CSS selector string.
|
|
136
142
|
|
|
143
|
+
**Zoom timing:** `zoom()` takes `2 × transition + duration` (default 2.7s) of the step's action time. In a voiced step it runs inside the narration like any action; pick `duration` so the zoom covers the sentence that talks about the element. Use it for "look here" moments (a total, a setting, a whole panel) — not on every click.
|
|
144
|
+
|
|
137
145
|
## 4. Timing Model
|
|
138
146
|
|
|
139
147
|
### Single-phase step (no `do`/`explain`)
|
|
@@ -299,7 +307,7 @@ Never override `--reporter` on the CLI — it disables the merge step.
|
|
|
299
307
|
```
|
|
300
308
|
tutorials/
|
|
301
309
|
├── output/
|
|
302
|
-
│ └── {name}_timeline.json # Timing + ffmpeg command
|
|
310
|
+
│ └── {name}_timeline.json # Timing (+ fast-forward spans) + ffmpeg command
|
|
303
311
|
├── transcripts/
|
|
304
312
|
│ └── {name}.md # Auto-generated transcript (editable — see below)
|
|
305
313
|
└── videos/
|
|
@@ -464,7 +472,84 @@ Any other variant name only suffixes outputs and stamps `data-tutorial-variant`
|
|
|
464
472
|
|
|
465
473
|
In tutorial mode `mobileStage()` records **oversampled 2× by default** (Playwright never upscales video, so 1× phone video is blurry): it forces `--force-device-scale-factor=2`, aligns `deviceScaleFactor` and doubles `video.size` — layout unchanged. Tune with `mobileStage(2, 'Pixel 7', { scale })`. Caveat: `test.use()` replaces the config's `launchOptions`; repeat any tutorial-mode Chromium args via `{ launchArgs: [...] }`.
|
|
466
474
|
|
|
467
|
-
## 13.
|
|
475
|
+
## 13. Camera zoom
|
|
476
|
+
|
|
477
|
+
`zoom()` is a camera push-in: the whole top-level page (stage and scenes included) scales up around an element, holds, and scales back. The step banner and cursor stay crisp and unscaled.
|
|
478
|
+
|
|
479
|
+
```typescript
|
|
480
|
+
// One-shot: zoom in, hold `duration`, zoom out
|
|
481
|
+
tutorial.step('Your total includes VAT', async () => {
|
|
482
|
+
await tutorial.zoom(page.locator('.invoice-total'), { blur: true });
|
|
483
|
+
}, { explain: 'That is the amount your client will pay.' });
|
|
484
|
+
|
|
485
|
+
// Stay zoomed while acting — clicks, typing and the cursor all work zoomed
|
|
486
|
+
tutorial.step('Turn on reminders', async () => {
|
|
487
|
+
await tutorial.zoomIn(page.locator('#reminders'), { blur: true });
|
|
488
|
+
await tutorial.click(page.locator('#auto-remind'));
|
|
489
|
+
await tutorial.typeSlowly(page.locator('#cc'), 'finance@acme.com');
|
|
490
|
+
await tutorial.zoomOut();
|
|
491
|
+
});
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
| Option | Default | Effect |
|
|
495
|
+
|---|---|---|
|
|
496
|
+
| `scale` | auto | Auto fits the element to ~70% of the viewport, capped at 2.5×, never below 1× (a huge element only gets the blur) |
|
|
497
|
+
| `duration` | `1500` | `zoom()` only — hold time in ms |
|
|
498
|
+
| `blur` | `false` | Blur + slight dim of everything but the element. `true` = 4px, a number = radius in px |
|
|
499
|
+
| `transition` | `600` | Each zoom-in / zoom-out animation in ms |
|
|
500
|
+
|
|
501
|
+
### Rules
|
|
502
|
+
|
|
503
|
+
- **Timing:** `zoom()` costs `2 × transition + duration` (2.7s by default) of action time. In a voiced step the action starts inside the narration — make the zoom cover the sentence that talks about the element.
|
|
504
|
+
- **Pair `zoomIn()` / `zoomOut()` in the same step.** A new step's banner shown while zoomed would be scaled with the page.
|
|
505
|
+
- **Target what the narration names.** Zoom on the total the narration mentions, not the whole invoice; on a whole panel when the narration is about the panel.
|
|
506
|
+
- **Small targets get big:** a badge or icon goes straight to 2.5×. Pass `scale: 1.5`–`2` when context around it matters.
|
|
507
|
+
- **Blur when the page is busy**, or when the element must read as "the only thing that matters". Skip it on sparse pages — it adds nothing.
|
|
508
|
+
- **Highlight + zoom combine:** `highlight(el, 600)` then `zoom(el)` reads as "look here… closer".
|
|
509
|
+
- Pure decoration: no-op without `TUTORIAL_MODE`, not recorded in the timeline, safe in plain E2E runs.
|
|
510
|
+
- Don't zoom on every step — 1 to 3 zooms per tutorial, on the moments the viewer must not miss (see `storytelling.md` §9).
|
|
511
|
+
|
|
512
|
+
## 14. Fast-forward
|
|
513
|
+
|
|
514
|
+
For a stretch nobody wants to watch in real time — a slow generation, an import, a repetitive fill — mark it with start/end markers: ffmpeg plays it `speed`× faster in the final video, VHS-style (`▶▶ ×N` badge, scanlines, rolling tracking band, tape grain, chroma shift). The test still runs at normal speed.
|
|
515
|
+
|
|
516
|
+
```typescript
|
|
517
|
+
tutorial.step('Generate the quarterly report', async () => {
|
|
518
|
+
await tutorial.click(page.locator('#generate'));
|
|
519
|
+
await tutorial.fastForward(8, async () => {
|
|
520
|
+
await expect(page.locator('#report')).toBeVisible({ timeout: 60_000 });
|
|
521
|
+
});
|
|
522
|
+
}, { explain: 'It takes a while — we skip ahead.' });
|
|
523
|
+
|
|
524
|
+
// Explicit markers
|
|
525
|
+
tutorial.step('Fill the twelve rows', async () => {
|
|
526
|
+
await tutorial.startFastForward(4, { vhs: false }); // plain speed-up, no VHS look
|
|
527
|
+
for (const row of rows) await tutorial.fill(page.locator(`#amount-${row.id}`), row.amount);
|
|
528
|
+
await tutorial.endFastForward();
|
|
529
|
+
});
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
| Argument / option | Default | Effect |
|
|
533
|
+
|---|---|---|
|
|
534
|
+
| `speed` | — (required, `> 1`) | Playback speed of the span in the final video |
|
|
535
|
+
| `vhs` | `true` | VHS look; `false` = plain speed-up |
|
|
536
|
+
|
|
537
|
+
### Timing
|
|
538
|
+
|
|
539
|
+
- Any number of spans per video, each with its own speed.
|
|
540
|
+
- A span of `L` ms at speed `S` lasts `L / S` ms on video. Final length = `tape − Σ L × (1 − 1/S)` — predictable to a few ms.
|
|
541
|
+
- Timeline JSON: `totalDurationMs` = final length, `tapeDurationMs` = recorded length, `fastForward[]` = spans (`startMs`/`endMs` tape time, `outputStartMs`/`outputEndMs` video time, `speed`). Step `startMs` values are already video time, so voice clips, transcripts and the gallery need nothing special.
|
|
542
|
+
- `startFastForward()` first **waits for the step's narration clip to finish** — speech is never sped up and never plays over sped-up video. So the step's narration plays at 1×, then the tape speeds up.
|
|
543
|
+
|
|
544
|
+
### Rules
|
|
545
|
+
|
|
546
|
+
- Call it **inside a step's action** — outside `complete()` it warns and does nothing.
|
|
547
|
+
- Keep the span inside its step; one left open is closed when the step's action returns (before the step screenshot).
|
|
548
|
+
- Say it in the narration ("this takes a moment — let's skip ahead") so the speed-up reads as intentional.
|
|
549
|
+
- Fast-forward the wait, not the payoff: end the span before the result the viewer must see.
|
|
550
|
+
- No-op without `TUTORIAL_MODE` — `fastForward()` just runs the action; a speed `≤ 1` throws in both modes.
|
|
551
|
+
|
|
552
|
+
## 15. Checklist
|
|
468
553
|
|
|
469
554
|
Before submitting a tutorialized test:
|
|
470
555
|
|
|
@@ -480,6 +565,9 @@ Before submitting a tutorialized test:
|
|
|
480
565
|
- [ ] Test passes without `TUTORIAL_MODE` (plain E2E)
|
|
481
566
|
- [ ] Test passes with `TUTORIAL_MODE=true` (video generation)
|
|
482
567
|
- [ ] Video watched — does it feel human?
|
|
568
|
+
- [ ] Zooms (if any) land on what the narration names, ≤ 3 per tutorial, each `zoomIn` paired with a `zoomOut` in the same step
|
|
569
|
+
- [ ] Secrets (passwords, API keys) typed with `typeBlurred`, never `fill`/`typeSlowly`
|
|
570
|
+
- [ ] Long waits / repetitive chores wrapped in `fastForward(speed, …)` inside their step, and the narration announces the skip
|
|
483
571
|
|
|
484
572
|
Multi-scene tutorials, additionally:
|
|
485
573
|
|
|
@@ -191,3 +191,57 @@ Labels are on screen the whole tutorial, so they carry the cast:
|
|
|
191
191
|
|
|
192
192
|
A named person makes the handoff feel like a story rather than a demo of two
|
|
193
193
|
browser windows.
|
|
194
|
+
|
|
195
|
+
## 9. Directing Attention — Highlight, Zoom, Blur
|
|
196
|
+
|
|
197
|
+
The viewer's eye goes where the screen moves. You have three tools, from soft to strong:
|
|
198
|
+
|
|
199
|
+
| Tool | What it says | Use for |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| `highlight()` (also implicit in `click`/`fill`) | "This is what we touch" | Every interaction — it's automatic |
|
|
202
|
+
| `zoom()` | "Look closer — this matters" | A number, a status, a setting the story hinges on |
|
|
203
|
+
| `zoom(…, { blur: true })` | "Nothing else matters right now" | The one thing on a busy screen the viewer must not miss |
|
|
204
|
+
|
|
205
|
+
### When a zoom earns its place
|
|
206
|
+
|
|
207
|
+
- **The payoff:** the total after adding lines, the "Paid" status after the client pays, the generated reference number.
|
|
208
|
+
- **The tiny thing:** a badge, a toggle, an icon that is unreadable at video resolution.
|
|
209
|
+
- **The panel in focus:** a settings block filled in while zoomed (`zoomIn` → actions → `zoomOut`), so the viewer reads the fields instead of hunting for them.
|
|
210
|
+
|
|
211
|
+
### When it doesn't
|
|
212
|
+
|
|
213
|
+
- Something the narration doesn't mention — the camera and the voice must point at the same thing.
|
|
214
|
+
- Every step. Zooms lose their meaning by repetition: **1 to 3 per tutorial**.
|
|
215
|
+
- Large, obvious elements on a sparse page — the viewer already sees them.
|
|
216
|
+
|
|
217
|
+
### Pace it with the words
|
|
218
|
+
|
|
219
|
+
A zoom is a beat. Let the narration name the thing *while* the camera pushes in — "your total, VAT included" — and let the hold breathe for the explain sentence. If the narration has moved on, the zoom has lasted too long.
|
|
220
|
+
|
|
221
|
+
### Secrets stay secret
|
|
222
|
+
|
|
223
|
+
Passwords, API keys and tokens are typed with `typeBlurred()` — the field is blurred before the first keystroke and stays blurred. Say so in the narration ("type your password — it stays hidden") so the blur reads as intentional, not as a glitch.
|
|
224
|
+
|
|
225
|
+
## 10. Pacing the Dead Time — Fast-Forward
|
|
226
|
+
|
|
227
|
+
A real app makes the viewer wait: a report generates for 30 seconds, an import churns, twelve rows get filled one by one. In real time that is where viewers drop off. `fastForward(speed, …)` keeps the wait on screen — so the viewer sees that it happens and roughly how long it takes — but plays it sped up, VHS-style.
|
|
228
|
+
|
|
229
|
+
### When to fast-forward
|
|
230
|
+
|
|
231
|
+
- **A wait the viewer must know about but needn't sit through:** a generation, a sync, an upload. Seeing the progress bar race tells them "this takes a while, it's normal".
|
|
232
|
+
- **Repetition after the first instance:** show the first row filled at normal speed, fast-forward the eleven others.
|
|
233
|
+
|
|
234
|
+
### When not to
|
|
235
|
+
|
|
236
|
+
- **The payoff.** End the span before the result appears — the viewer must see the report land at 1×.
|
|
237
|
+
- **Anything the narration explains.** The voice is never sped up; it plays first, then the tape speeds up. Fast-forward the silent part.
|
|
238
|
+
- **Short waits** (under ~3s) — a cut is smoother than a 1-second blur of scanlines.
|
|
239
|
+
|
|
240
|
+
### Pick the speed
|
|
241
|
+
|
|
242
|
+
- `4` — the viewer can still follow what changes (rows filling, a log scrolling).
|
|
243
|
+
- `8`–`16` — pure dead time: a progress bar, a spinner.
|
|
244
|
+
|
|
245
|
+
### Say it
|
|
246
|
+
|
|
247
|
+
Announce the skip in the step's narration — "this takes a minute — let's skip ahead" — so the speed-up reads as a directing choice, not a glitch.
|
package/src/styles.css
CHANGED
|
@@ -635,3 +635,53 @@ html[data-tutorial-variant='mobile'] .tutorial-progress {
|
|
|
635
635
|
.tutorial-stage[data-layout='split'] .tutorial-scene[data-active='false'] .tutorial-scene-label {
|
|
636
636
|
opacity: var(--tutorial-scene-inactive-opacity);
|
|
637
637
|
}
|
|
638
|
+
|
|
639
|
+
/* ── Fast-forward (VHS look) ────────────────────────────────
|
|
640
|
+
Shown by startFastForward() for the span ffmpeg speeds up. Recorded at real
|
|
641
|
+
speed, so --tutorial-ff-roll is already scaled by the speed. */
|
|
642
|
+
|
|
643
|
+
#tutorial-fast-forward {
|
|
644
|
+
position: fixed;
|
|
645
|
+
inset: 0;
|
|
646
|
+
z-index: 2147483646;
|
|
647
|
+
pointer-events: none;
|
|
648
|
+
overflow: hidden;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.tutorial-ff-scanlines {
|
|
652
|
+
position: absolute;
|
|
653
|
+
inset: 0;
|
|
654
|
+
background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 3px);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
.tutorial-ff-tracking {
|
|
658
|
+
position: absolute;
|
|
659
|
+
left: 0;
|
|
660
|
+
right: 0;
|
|
661
|
+
height: 7%;
|
|
662
|
+
top: -10%;
|
|
663
|
+
background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.16) 40%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.16) 60%, transparent);
|
|
664
|
+
mix-blend-mode: screen;
|
|
665
|
+
animation: tutorial-ff-roll var(--tutorial-ff-roll, 2.4s) linear infinite;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
@keyframes tutorial-ff-roll {
|
|
669
|
+
to { top: 110%; }
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.tutorial-ff-osd {
|
|
673
|
+
position: absolute;
|
|
674
|
+
left: var(--tutorial-ff-osd-left, 32px);
|
|
675
|
+
bottom: var(--tutorial-ff-osd-bottom, 28px);
|
|
676
|
+
font: 700 var(--tutorial-ff-osd-size, 44px)/1 'VCR OSD Mono', 'Courier New', ui-monospace, monospace;
|
|
677
|
+
letter-spacing: 0.06em;
|
|
678
|
+
color: #fff;
|
|
679
|
+
background: var(--tutorial-ff-osd-bg, rgba(0, 0, 0, 0.55));
|
|
680
|
+
padding: 8px 14px 6px;
|
|
681
|
+
border-radius: 6px;
|
|
682
|
+
text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.75), -1px 0 rgba(255, 0, 80, 0.6), 1px 0 rgba(0, 200, 255, 0.6);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
.tutorial-ff-arrows {
|
|
686
|
+
margin-right: 0.3em;
|
|
687
|
+
}
|