@pygmalionjs/pygmalion 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist-lib/{FrozenRoutePreview-BVYL3dLT.js → FrozenRoutePreview-CBsH9Pei.js} +1574 -1494
- package/dist-lib/pygmalion.js +9238 -7501
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +1 -1
- package/dist-lib/types/canvas/CameraLayer.d.ts +3 -1
- package/dist-lib/types/canvas/FrameView.d.ts +2 -0
- package/dist-lib/types/editor/designImport.d.ts +7 -1
- package/dist-lib/types/editor/frameInteraction.d.ts +66 -0
- package/dist-lib/types/editor/frameScrollControls.d.ts +40 -0
- package/dist-lib/types/editor/previewBootstrap.d.ts +17 -1
- package/dist-lib/types/editor/shadowPreview.d.ts +2 -0
- package/dist-lib/types/editor/store.d.ts +27 -0
- package/dist-lib/types/editor/storyboardGraph.d.ts +17 -1
- package/dist-lib/types/editor/storyboardGraphView.d.ts +7 -0
- package/dist-lib/types/editor/storyboardJourney.d.ts +4 -0
- package/dist-lib/types/lib.d.ts +3 -1
- package/dist-lib/types/shell/ComponentStateControls.d.ts +14 -1
- package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +5 -1
- package/docs/screen-state-contract.md +27 -0
- package/node/storyboard-capture-runtime.mjs +33 -0
- package/package.json +1 -1
|
@@ -37,6 +37,19 @@ Use a same-frame axis when all of these are true:
|
|
|
37
37
|
Pseudo states such as hover, keyboard focus, and pointer active are always
|
|
38
38
|
interaction states. They must not become duplicate frames.
|
|
39
39
|
|
|
40
|
+
## Frame size
|
|
41
|
+
|
|
42
|
+
The W and H controls in the frame inspector change the frame viewport, not the
|
|
43
|
+
canvas camera. A committed size is part of the frame fingerprint and its exact
|
|
44
|
+
capture recipe. The request carries the route, width, height, conditions, and
|
|
45
|
+
interactions that produced that fingerprint, and a returned artifact is seeded
|
|
46
|
+
under that requested recipe instead of the authored catalog key.
|
|
47
|
+
|
|
48
|
+
This distinction is observable: resizing a frame may change responsive layout,
|
|
49
|
+
while changing canvas zoom only changes how large the same frame appears in the
|
|
50
|
+
editor. Hosts that implement an on-demand capture adapter must apply the
|
|
51
|
+
requested `route`, `width`, and `height` overrides before launching the capture.
|
|
52
|
+
|
|
40
53
|
## Automatic pseudo-state coverage
|
|
41
54
|
|
|
42
55
|
Pygmalion discovers pseudo-state surfaces while it serializes a screen. Every
|
|
@@ -160,6 +173,20 @@ result. This keeps empty strings and maximum-length samples out of the state
|
|
|
160
173
|
panel while still allowing a search input to reproduce a real empty-result
|
|
161
174
|
state.
|
|
162
175
|
|
|
176
|
+
## Scroll positions
|
|
177
|
+
|
|
178
|
+
A stable scroll endpoint is an interaction state. Use a `scroll` recipe step
|
|
179
|
+
with absolute `scrollX` and/or `scrollY` coordinates. With no selector the step
|
|
180
|
+
restores the document viewport; a selector targets a specific overflow
|
|
181
|
+
container. An omitted axis keeps its current position.
|
|
182
|
+
|
|
183
|
+
Absolute coordinates make the endpoint repeatable in both the in-editor replay
|
|
184
|
+
and the capture worker. A free wheel gesture remains transient until the host
|
|
185
|
+
preserves its endpoint as a recipe. The frame inspector enumerates the document
|
|
186
|
+
viewport and independently scrollable nested surfaces. Preserving one records
|
|
187
|
+
both its stable selector and coordinates; the target picker keeps nested list
|
|
188
|
+
or panel scroll distinct from the document viewport.
|
|
189
|
+
|
|
163
190
|
## Held pseudo states
|
|
164
191
|
|
|
165
192
|
Recipes support `hover`, `focus-visible`, and `active` in addition to `focus`.
|
|
@@ -423,6 +423,39 @@ export async function runStoryboardInteraction(page, interaction) {
|
|
|
423
423
|
return;
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
if (interaction.action === 'scroll') {
|
|
427
|
+
const position = {
|
|
428
|
+
x: Number.isFinite(interaction.scrollX) ? Math.max(0, interaction.scrollX) : null,
|
|
429
|
+
y: Number.isFinite(interaction.scrollY) ? Math.max(0, interaction.scrollY) : null,
|
|
430
|
+
};
|
|
431
|
+
if (interaction.selector || interaction.text) {
|
|
432
|
+
const timeoutMs = interaction.timeoutMs ?? 5_000;
|
|
433
|
+
const target = await waitForCandidateLocator(
|
|
434
|
+
page,
|
|
435
|
+
interaction,
|
|
436
|
+
timeoutMs,
|
|
437
|
+
);
|
|
438
|
+
if (!(await targetExists(target, Math.min(timeoutMs, 500)))) {
|
|
439
|
+
throw new Error(`"${interaction.label}" scroll target was not found.`);
|
|
440
|
+
}
|
|
441
|
+
await target.evaluate((element, next) => {
|
|
442
|
+
const left = next.x ?? element.scrollLeft;
|
|
443
|
+
const top = next.y ?? element.scrollTop;
|
|
444
|
+
if (typeof element.scrollTo === 'function') element.scrollTo(left, top);
|
|
445
|
+
else {
|
|
446
|
+
element.scrollLeft = left;
|
|
447
|
+
element.scrollTop = top;
|
|
448
|
+
}
|
|
449
|
+
}, position);
|
|
450
|
+
} else {
|
|
451
|
+
await page.evaluate((next) => {
|
|
452
|
+
window.scrollTo(next.x ?? window.scrollX, next.y ?? window.scrollY);
|
|
453
|
+
}, position);
|
|
454
|
+
}
|
|
455
|
+
await page.waitForTimeout(interaction.settleMs ?? 100);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
426
459
|
const timeoutMs = interaction.timeoutMs ?? 5_000;
|
|
427
460
|
const target = await waitForCandidateLocator(page, interaction, timeoutMs);
|
|
428
461
|
if (!(await targetExists(target, Math.min(timeoutMs, 500)))) {
|