Compare commits

..
Author SHA1 Message Date
Brent Vatne a70a9fcfec Capture timings review fixes: comment writes in turn, throttled waiting posts, and spans that close
- A job's comment writes go one at a time, each rendering the state when its turn comes, so a progress post can no longer land after, and undo, a later phase's or the failure's.
- The waiting status posts when the wait starts and ends, and at most every 3 minutes in between.
- Routes captured by setup steps have spans; appearances one session captures in turn are labelled by appearance; a session that cannot switch appearance closes its session-verify span; a controller fetch that fails records the run's finish.
- A baseline's worker heartbeat is named baseline; an EAS log link that ends a sentence is kept.
2026-10-23 16:34:24 -07:00
Brent Vatne 254f2045f9 CI capture: each job records where its time goes, and a review waiting on a baseline says what that baseline is doing
- Every capture job appends timings.jsonl to explore-diagnostics (already uploaded if: always()) and a table to the job summary: review and baseline phases, and per side and pass the build, repack, session, install, launch, routes and stop.
- The baseline wait names the step the baseline job is in, in its log line and in the sticky comment (through a post that skips the PR check and never fails the review), and records the baseline's steps. In brentvatne/euxy#179 the review waited 15 minutes on a baseline stuck installing ffmpeg, and said only "in progress".
- Heartbeats: the hosted repack and a followed shared repack print once a minute; blocking calls print their bound first; a worker blocked in one has its parent print while it is.
- Links written anywhere are rebuilt from validated ids; the redactor also covers fragment tokens and object-store signatures.
2026-10-23 16:02:34 -07:00
15 changed files with 85 additions and 477 deletions

No files matched your search

+4 -4
View File
@@ -153,10 +153,10 @@ Each new start logs the failed run's link and reason, for example `the hosted EA
1. `hostedRepackPeers` lists, in config order, the targets that repack the same app on EAS: one platform, EAS profile and bundle id. `capture:review`, `capture:review --compare` and `capture:baseline` pass them on.
- A capture gets a `RepackShare` when it has two or more peers and `GITHUB_RUN_ID`, `GITHUB_RUN_ATTEMPT` and `GITHUB_REPOSITORY` are set. Its scope is the run attempt, its leader is the first peer, and its rank is its place among the peers.
- A single target, a local review, `capture.repack: local`, and a native build this job made itself behave as before. The repack of a native build this job made carries no key, so it is never shared.
2. The build to repack is the newest finished build with the fingerprint that Explore did not repack itself (`existingBuild`, from 20 builds), else the newest repack. On a project that reviews often, the 20 are all repacks (euxy's 50 most recent `explore` builds were), so jobs that start minutes apart can pick different builds; the key below names the native code, not the build, so they still share.
- A single target, a local review, `capture.repack: local`, and a native build this job made itself behave as before. Nobody else's key can match a native build this job made.
2. The build to repack is the newest finished build with the fingerprint that Explore did not repack itself (`existingBuild`, from 20 builds). If repacks carry their source's fingerprint, every job still picks the same build.
3. Once the copy is staged, the capture takes a key (`hostedRepackShareKey`) from:
- the run attempt, the platform and the native fingerprint;
- the run attempt, the platform and the native build id;
- the EAS profile and environment name;
- a snapshot of the environment's variables: `eas env:list --format long` for the project and the account, which names each variable with its value (masked when sensitive or secret) and when it was last updated;
- the Explore release;
@@ -168,7 +168,7 @@ Each new start logs the failed run's link and reason, for example `the hosted EA
6. When the repack it follows fails, is cancelled or loses the key, the capture looks for another with the same key for 60 s, staggered the same way, before it repacks itself. That catches the leader's retry, which starts at once (#176).
7. It also repacks itself, with the retries above, when nothing appears in its wait, or when EAS fails to answer three times in a row. Looking stops while the budget still has 5 minutes for a repack of its own. A followed repack that does not finish within the budget fails the target. No capture waits on a job that cannot answer, and none waits past its budget.
Only a build whose marker is this capture's own key is used, and every input to the key but one is what this capture would itself have uploaded and built with. So two jobs share a repack only when their uploads, native fingerprint, profile, environment variables and Explore release are the same, in the same run attempt. The one input that is not this capture's own is the source build: a follower runs the leader's repack of the build the leader found, which has the same fingerprint as its own but may be another build of it. `existingBuild` already treats builds of one fingerprint as interchangeable; what a repack keeps from its source beyond the native code the fingerprint covers (its Info.plist, and the toolchain it was built with) can differ between such builds. The run attempt is in the scope, and a review's or a first attempt's repacks are never used by another run or attempt. That covers the baseline workflow, whose artifacts later reviews reuse, and "Re-run failed jobs" after an `EXPO_PUBLIC_*` value was fixed, which rebundles with the new value.
Only a build whose marker is this capture's own key is used, and every input to the key is what this capture would itself have uploaded and built with. So two jobs share a repack only when their uploads, native build, profile, environment variables and Explore release are the same, in the same run attempt. The run attempt is in the scope, and a review's or a first attempt's repacks are never used by another run or attempt. That covers the baseline workflow, whose artifacts later reviews reuse, and "Re-run failed jobs" after an `EXPO_PUBLIC_*` value was fixed, which rebundles with the new value.
What the key does not protect against: every input to it is public or predictable, and the pull request's head code runs in the capture job with `EXPO_TOKEN` (`app.config.*` under `eas config` and `eas fingerprint:generate`, and the app's build code on EAS). Head code could therefore make a build whose message carries the base side's marker, and base captures of the same run attempt in other matrix jobs would install it. That is within the trust the capture already gives EAS: the same credentials could publish a simulator build with a reused fingerprint, which every capture already reuses by fingerprint (the `build` stage above), and head code in one job can already tamper with that job's own base side on the runner. The run attempt in the scope keeps such a build out of every other run, including the baseline. Requiring the build's `initiatingActor` to be this job's own credentials would not exclude head code, which runs with the same token. Explore cannot tell offline which actor EAS records for a workflow's repack build, so it does not check it.
+2 -3
View File
@@ -22,10 +22,10 @@ Explore maps your app: a screenshot of every screen, connected by the taps betwe
<a href="docs/screenshots/readme-screens-light.png">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/readme-screens-dark.png">
<img width="100%" alt="The Screens view of a euxy review showing Changed 7 of All 19: a Search field and the app/ route tree on the left, and beside it a grid of the changed screens in the same order, each with its route below the screenshot: a red dot for the removed /lane-editor, orange for the modified /new-pattern and /channel-surf, green for the new /lane-editor/0, and Changed in dark under /p, /patterns and a /p/ link; at the top right, a switch between Grid and Filmstrip" src="docs/screenshots/readme-screens-light.png">
<img width="100%" alt="The Screens view of a euxy review showing Changed 7 of All 19: the app/ route tree on the left, and beside it a grid of the changed screens in the same order, each with its route below the screenshot: a red dot for the removed /lane-editor, orange for the modified /new-pattern and /channel-surf, green for the new /lane-editor/0, and Changed in dark under /p and /patterns" src="docs/screenshots/readme-screens-light.png">
</picture>
</a>
<strong>Screens</strong>: every capture, or only the changed ones, in a grid or one at a time in a filmstrip, beside the route tree, with a dot for what changed.
<strong>Screens</strong>: every capture in one grid, or only the changed ones, beside the route tree, with a dot for what changed.
</td>
<td width="50%" valign="top">
<a href="docs/screenshots/readme-pr-comment-light.png">
@@ -579,7 +579,6 @@ sequenceDiagram
- The review workflow runs on open, non-draft PRs from the repository whose author has write access. Bots such as Devin go under `ci.trustedAuthors` in `.expo-explore/config.yaml`.
- A screen with a source change is **Modified** if its captures differ.
- If EAS fails to start a session, Explore starts a new one, up to five times within 30 minutes. On your machine, a local simulator can stand in for EAS Simulator.
- Each capture job's summary shows where its time went, phase by phase, and its diagnostics artifact keeps the timings (`timings.jsonl`). When a review waits for the baseline of its base commit, its log and the PR comment name the step that baseline job is in.
The same review runs for any two commits without a PR ([`explore-compare.yml`](#compare-any-two-commits), linking the report from the run summary) and on your machine (`capture`, [above](#quick-start)). The workflows' logic lives in `expo-explore ci:*` commands, so a fix reaches CI with the `@expo/explore` version the workflows pin.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 KiB

After

Width:  |  Height:  |  Size: 316 KiB

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "@expo/explore",
"version": "0.22.0",
"version": "0.21.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@expo/explore",
"version": "0.22.0",
"version": "0.21.0",
"license": "MIT",
"dependencies": {
"@expo/repack-app": "0.10.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@expo/explore",
"version": "0.22.0",
"version": "0.21.0",
"description": "Source-driven mobile app maps, deterministic CI capture, and visual reviews",
"license": "MIT",
"type": "module",
+10 -17
View File
@@ -119,9 +119,9 @@ const EXPLORE_REPACK_MESSAGE = /^expo-explore (?:ios|android) capture: route obs
/**
* The finished build to repack from `eas build:list --fingerprint-hash`: the newest one Explore did not repack itself,
* else the newest. A repack keeps its source build's native code and carries its fingerprint, so on a project that
* reviews often every listed build is a repack, and this is the newest of them; jobs that look minutes apart can get
* different ones. A shared repack is keyed by the fingerprint, not by this build (hostedRepackShareKey).
* else the newest. A repack keeps its source build's native code, and may carry its fingerprint; preferring the build
* it came from has every job of a run pick the same one, which a shared repack's key needs (RepackShare), instead of a
* repack another job finished a minute earlier.
*/
export function existingBuild(stdout: string): EasBuildDescriptor | undefined {
const value = parseJson(stdout, "eas build:list");
@@ -712,18 +712,13 @@ export async function stagedProjectDigest(root: string): Promise<string> {
/**
* The key a shared repack's build carries in its message: everything the repack is made from, so two jobs share one only
* when each would have uploaded the same bytes onto the same native code, for the same profile, EAS environment (by name
* and by a snapshot of its variables) and Explore release, in the same run attempt.
*
* The native code is named by its fingerprint, not by the build a job found to repack: the build lookup returns the
* newest build with that fingerprint, which is often an earlier repack, and it moves as repacks finish. In
* brentvatne/euxy#179 (review run 40042718931) a target that started late found the repack the others had just made,
* so its key matched none; it waited 3 minutes for a repack it could not find, then made another.
* when each would have uploaded the same bytes for the same native build, profile, EAS environment (by name and by a
* snapshot of its variables) and Explore release, in the same run attempt.
*/
export function hostedRepackShareKey(input: { scope: string; platform: "ios" | "android"; fingerprint: string; easProfile: string;
export function hostedRepackShareKey(input: { scope: string; platform: "ios" | "android"; nativeBuildId: string; easProfile: string;
environment: string; environmentVariables: string; project: string }): string {
return createHash("sha256").update(JSON.stringify({ contract: "expo-explore.repack-share.v3", explore: EXPLORE_VERSION, scope: input.scope,
platform: input.platform, fingerprint: input.fingerprint, easProfile: input.easProfile, environment: input.environment,
return createHash("sha256").update(JSON.stringify({ contract: "expo-explore.repack-share.v2", explore: EXPLORE_VERSION, scope: input.scope,
platform: input.platform, nativeBuildId: input.nativeBuildId, easProfile: input.easProfile, environment: input.environment,
environmentVariables: input.environmentVariables, project: input.project })).digest("hex").slice(0, 32);
}
@@ -875,8 +870,6 @@ async function prepareHostedRepack(options: {
easCommand: string;
project: string;
nativeBuildId: string;
/** The native fingerprint of that build, which keys a shared repack (hostedRepackShareKey). */
fingerprint: string;
easProfile: string;
repackProfile: RepackProfile;
easEnvironment: NodeJS.ProcessEnv;
@@ -937,7 +930,7 @@ async function prepareHostedRepack(options: {
if (variables === undefined) options.say(`EAS did not list the ${environment} environment's variables; repacking here without sharing the repack`);
else {
// The digest is taken before the workflow file is written: the file's message carries the key made from it.
const marker = hostedRepackShareMarker(hostedRepackShareKey({ scope: options.share.scope, platform, fingerprint: options.fingerprint,
const marker = hostedRepackShareMarker(hostedRepackShareKey({ scope: options.share.scope, platform, nativeBuildId: options.nativeBuildId,
easProfile: options.easProfile, environment, environmentVariables: variables, project: await stagedProjectDigest(staged) }));
const shared = await options.timings.measure("repack-share-wait", () => sharedHostedRepack({ share: options.share!, marker, platform, say: options.say, clock,
list: () => eas(["build:list", "--platform", platform, "--limit", String(SHARED_REPACK_LIST_LIMIT), "--json", "--non-interactive"], 2 * 60_000).stdout,
@@ -1019,7 +1012,7 @@ export async function prepareExactSourceBuild(options: {
if ((options.repack ?? "eas") === "eas") {
if (!options.easProfile) throw new Error("The hosted repack needs the capture build profile name.");
const hosted = await prepareHostedRepack({ platform, runner: options.runner, easCommand: options.easCommand, project: options.project,
nativeBuildId: options.nativeBuildId, fingerprint: options.fingerprint, easProfile: options.easProfile, repackProfile: options.repackProfile,
nativeBuildId: options.nativeBuildId, easProfile: options.easProfile, repackProfile: options.repackProfile,
easEnvironment: options.easEnvironment, restrictedEnvironment: options.repackEnvironment, provider: providers[0]!,
parameterKeys: captureObserverParameterKeys(options.routes), root, share: options.share, say: options.progress ?? (() => undefined),
timings: options.timings ?? silentTimings, onBlocking: options.onBlocking,
+1 -1
View File
@@ -608,7 +608,7 @@ async function executeCiMap(options: CiMapOptions, setStage: (stage: string) =>
type BuiltApp = { fingerprint: string; nativeEasBuildId: string | null; easBuildId: string | null; app?: string; reused: boolean; version?: string; buildNumber?: string };
// What a hosted repack waits with and reports through: one deadline from the moment the session starts beside it, for
// the wait for another job's repack and every repack of its own. The repack is shared with this run's other matrix
// jobs only when it repacks a build EAS already had: a native build this job made is its own, so its repack carries no key and is never shared.
// jobs only when it repacks a build EAS already had: a native build this job made is its own, so nobody else's key matches it.
const repackWaits = (shared: boolean) => ({ ...(shared ? { share: options.repackShare } : {}), progress: say, now: options.now, sleep: options.sleep, timings, onBlocking: options.onBlocking,
signal: options.signal, deadline: (options.now ?? Date.now)() + HOSTED_REPACK_BUDGET_MS });
// `repacking` tells the captures sharing this build that their sessions can start too (sharedBuild).
+1 -141
View File
@@ -1493,40 +1493,8 @@ test("Screens' filmstrip: switched from the corner switch, stepped with the arro
await page.mouse.down({ clickCount: 2 });
await page.mouse.up({ clickCount: 2 });
await expect(middle).toHaveAttribute("data-screen-id", last);
// In the filmstrip the Inspector opens only from a click on the middle screen, so the one the first click opened closes.
await expect(inspector).toBeHidden();
// With the sidebar folded, the middle screen is at the centre of the canvas.
await expect(view.getByRole("button", { name: "Show sidebar" })).toBeVisible();
const centre = await middle.evaluate(element => { const box = element.getBoundingClientRect(); return box.left + box.width / 2; });
expect(Math.abs(centre - page.viewportSize()!.width / 2)).toBeLessThan(2);
// A sideways trackpad swipe moves the strip with it, and a short one springs back when it ends; a wheel notch steps.
const lastAt = ids.indexOf(last);
await middle.hover();
// Measured in the page two frames after the event: the swipe ends, and the strip settles, 100 ms after the last one.
const moved = await middle.evaluate(async element => {
element.dispatchEvent(new WheelEvent("wheel", { deltaX: -40, bubbles: true, cancelable: true }));
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
const box = element.getBoundingClientRect();
return { centre: box.left + box.width / 2, swiping: element.parentElement!.classList.contains("swiping") };
});
expect(moved.swiping).toBe(true);
expect(moved.centre - centre).toBeGreaterThan(20);
expect(moved.centre - centre).toBeLessThan(60);
await expect(strip.locator(".screens-strip-stage")).not.toHaveClass(/swiping/);
await expect(middle).toHaveAttribute("data-screen-id", last);
await expect.poll(() => middle.evaluate(element => { const box = element.getBoundingClientRect(); return Math.round(box.left + box.width / 2); }))
.toBe(Math.round(centre));
await page.mouse.wheel(0, -100);
await expect(middle).toHaveAttribute("data-screen-id", ids[lastAt - 1]!);
await page.waitForTimeout(300);
await page.mouse.wheel(100, 0);
await expect(middle).toHaveAttribute("data-screen-id", last);
// A click on the middle screen opens the Inspector; Esc closes it first, then steps back out to the grid.
await middle.locator(".screens-strip-target").click();
await expect(inspector).toBeVisible();
// Esc closes the Inspector first, then steps back out to the grid with the screen still picked.
await page.keyboard.press("Escape");
await expect(inspector).toBeHidden();
await expect(strip).toBeVisible();
@@ -1613,63 +1581,6 @@ test("Screens' filmstrip keeps Changed across a layout switch, opens only from a
await expect(page).toHaveURL(/[?&]layout=filmstrip/);
});
test("Screens' filmstrip gestures: a short flick lands where it carries the strip, and a step made during a swipe is not undone by it", async ({ page }) => {
await serveWorkspace(page);
await page.goto("/screens");
const view = page.getByRole("main", { name: "Screens" });
await view.getByRole("button", { name: /^All/ }).click();
const ids = await view.locator(".screens-grid .screens-cell").evaluateAll(elements => elements.map(element => element.getAttribute("data-screen-id")!));
await page.getByRole("group", { name: "Screens layout" }).getByRole("button", { name: "Filmstrip" }).click();
const strip = view.getByRole("region", { name: "Filmstrip" });
const middle = strip.locator(".screens-strip-frame.focused");
const stage = strip.locator(".screens-strip-stage");
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
const historyLength = await page.evaluate(() => history.length);
// A finger drags a quarter of a screen and lifts while still moving: the flick carries the strip past halfway, so it
// lands on the next screen though the finger never got there.
await stage.evaluate(async element => {
const box = element.getBoundingClientRect();
const y = box.top + box.height / 2, x = box.left + box.width * 0.6;
const pitch = (() => {
const [a, b] = [...element.querySelectorAll(".screens-strip-frame")].map(frame => { const r = frame.getBoundingClientRect(); return r.left + r.width / 2; });
return Math.abs(b! - a!);
})();
const fire = (type: string, at: number) => element.dispatchEvent(new PointerEvent(type, { pointerId: 9, pointerType: "touch", isPrimary: true,
clientX: at, clientY: y, bubbles: true, cancelable: true }));
fire("pointerdown", x);
const step = pitch / 16;
for (let n = 1; n <= 4; n++) { fire("pointermove", x - n * step); await new Promise(resolve => setTimeout(resolve, 16)); }
fire("pointerup", x - 4 * step);
});
await expect(middle).toHaveAttribute("data-screen-id", ids[1]!);
await expect(stage).not.toHaveClass(/swiping/);
// However many screens a swipe passes, it is one step back.
expect(await page.evaluate(() => history.length)).toBe(historyLength + 1);
// A short wheel swipe whose momentum is still coming in when ← steps back: the arrow's screen stays in the middle,
// neither settled over by the swipe nor dragged off by its momentum.
await middle.hover();
await page.evaluate(() => {
const stage = document.querySelector(".screens-strip-stage")!;
stage.dispatchEvent(new WheelEvent("wheel", { deltaX: 100, bubbles: true, cancelable: true }));
let left = 30;
const momentum = setInterval(() => {
stage.dispatchEvent(new WheelEvent("wheel", { deltaX: 1, bubbles: true, cancelable: true }));
if (--left === 0) clearInterval(momentum);
}, 16);
});
await page.keyboard.press("ArrowLeft");
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
await page.waitForTimeout(900);
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
await expect(stage).not.toHaveClass(/swiping/);
// A pinch (a wheel with Control) zooms; it does not move the strip.
await page.evaluate(() => document.querySelector(".screens-strip-stage")!.dispatchEvent(new WheelEvent("wheel", { deltaX: 400, ctrlKey: true, bubbles: true, cancelable: true })));
await page.waitForTimeout(300);
await expect(middle).toHaveAttribute("data-screen-id", ids[0]!);
});
test("Screens' layouts switch with G and E, and the sidebar folds by its own buttons and on each switch to the filmstrip", async ({ page }) => {
await serveWorkspace(page);
await page.goto("/screens");
@@ -5648,56 +5559,6 @@ test.describe("phone layout", () => {
await expect(page.getByRole("navigation", { name: "Views" })).toBeVisible();
await expect(page.locator(".map-canvas")).toBeVisible();
});
test("the filmstrip on a phone: switched beside Changed / All, swiped by a finger, and its middle screen opens the Inspector", async ({ page }) => {
await serveWorkspace(page);
await page.goto("/screens");
const view = page.getByRole("main", { name: "Screens" });
await view.getByRole("button", { name: /^All/ }).tap();
const layouts = view.getByRole("group", { name: "Screens layout" });
await expect(layouts.getByRole("button", { name: "Grid" })).toHaveAttribute("aria-pressed", "true");
await layouts.getByRole("button", { name: "Filmstrip" }).tap();
await expect(page).toHaveURL(/[?&]layout=filmstrip/);
const strip = view.getByRole("region", { name: "Filmstrip" });
const middle = strip.locator(".screens-strip-frame.focused");
const first = await middle.getAttribute("data-screen-id");
// The section chips give way to the path above the strip; the Tree still jumps anywhere.
await expect(view.locator(".screens-jump-chip:not(.tree)")).toHaveCount(0);
await expect(view.getByRole("button", { name: "Tree" })).toBeVisible();
await expectNoHorizontalOverflow(page);
// A finger dragged left moves the strip under it while it is down, and the strip settles on the next screen.
const stage = strip.locator(".screens-strip-stage");
const dragged = await stage.evaluate(async element => {
const box = element.getBoundingClientRect();
const y = box.top + box.height / 2, x = box.left + box.width * 0.7;
const fire = (type: string, at: number) => element.dispatchEvent(new PointerEvent(type, { pointerId: 7, pointerType: "touch", isPrimary: true,
clientX: at, clientY: y, bubbles: true, cancelable: true }));
const centre = () => { const frame = element.querySelector(".screens-strip-frame.focused")!.getBoundingClientRect(); return frame.left + frame.width / 2; };
const before = centre();
fire("pointerdown", x);
for (let step = 1; step <= 3; step++) { fire("pointermove", x - step * 20); await new Promise(resolve => setTimeout(resolve, 16)); }
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
const during = centre();
for (let step = 4; step <= 6; step++) { fire("pointermove", x - step * 20); await new Promise(resolve => setTimeout(resolve, 16)); }
fire("pointerup", x - 120);
return { moved: before - during, swiping: element.classList.contains("swiping") };
});
expect(dragged.moved).toBeGreaterThan(50);
expect(dragged.moved).toBeLessThan(70);
await expect(middle).not.toHaveAttribute("data-screen-id", first!);
await expect(stage).not.toHaveClass(/swiping/);
// A tap on the middle screen opens the Inspector; a tap on a neighbour only brings it to the middle.
const inspector = page.getByRole("complementary", { name: "Inspector panel" });
// The next screen peeks in at the right edge: a tap on the part that shows.
const next = strip.locator(".screens-strip-frame.focused + .screens-strip-frame");
const nextId = await next.getAttribute("data-screen-id");
await next.locator(".screens-strip-target").tap({ position: { x: 12, y: 60 } });
await expect(middle).toHaveAttribute("data-screen-id", nextId!);
await expect(inspector).toHaveCount(0);
await middle.locator(".screens-strip-target").tap();
await expect(inspector).toBeVisible();
});
});
test("the theme is Auto until the More menu picks one: it follows the system, and a pick outlives a reload", async ({ page }) => {
@@ -6237,5 +6098,4 @@ test.describe("a wide Inspector in a short window", () => {
await expect.poll(async () => (await frame.boundingBox())!.height).toBeLessThanOrEqual(421);
await expect.poll(async () => (await frame.boundingBox())!.height).toBeGreaterThan(300);
});
});
+1 -17
View File
@@ -243,7 +243,7 @@ async function fixture(t, settings = {}) {
if (listed === null) throw new Error('eas env:list exited with status 1: GraphQL request failed.');
return { stdout: listed ?? 'Environment: preview\nNo variables found for this environment.\n', stderr: '' };
}
if (command === 'build:list') return json(settings.reuse ? [{ id: settings.reusable ?? 'native-build', ...buildMetadata }] : []);
if (command === 'build:list') return json(settings.reuse ? [{ id: 'native-build', ...buildMetadata }] : []);
if (command === 'build') return json([{ id: 'built-app', fingerprint: { hash: 'source-fingerprint' }, ...buildMetadata }]);
if (command === 'env:pull') { writeFileSync(value(request, '--path'), '# Environment: preview\nEXPO_PUBLIC_ENDPOINT=sample\n'); return { stdout: '', stderr: '' }; }
if (command === 'build:download') {
@@ -2146,22 +2146,6 @@ test('two jobs of one run attempt that repack the same app share one hosted repa
assert.ok(lines.some(line => /using EAS build repacked-app, the hosted repack of this commit another target of this run made/.test(line)), lines.join('\n'));
});
test('a target that starts after the shared repack finished, and finds that repack as its build to repack, joins it', async t => {
const eas = easBuilds();
const leader = await fixture(t, { reuse: true, eas });
await runCiMap({ ...leader.options, ...share('iphone') });
eas.builds[0].status = 'FINISHED';
// The newest build with the fingerprint is now the leader's repack (brentvatne/euxy#179, review run 40042718931): a
// key made from the build each job found would differ, and this target would wait, then repack a repack itself.
const { f, lines, run } = await follow(t, eas, { reusable: 'repacked-app' });
const result = await run;
assert.equal(runs(f), 0, 'the late target does not repack');
assert.equal(shareLists(f), 1, 'its first look finds the finished repack');
assert.deepEqual(downloaded(f), ['repacked-app']);
assert.equal(result.easBuildId, 'repacked-app');
assert.ok(lines.some(line => /using EAS build repacked-app, the hosted repack of this commit another target of this run made/.test(line)), lines.join('\n'));
});
test("a target follows the leader's repack by its id while it runs, even once newer builds push it off the list", async t => {
const message = await leaderMessage(t);
const eas = easBuilds([{ id: 'leader-repack', status: 'IN_QUEUE', platform: 'IOS', message }]);
+2 -6
View File
@@ -129,17 +129,13 @@ test('the staged digest changes with any file, mode or link, and the share key w
await rm(join(root, 'entry.js')); await symlink('package.json', join(root, 'entry.js')); digests.push(await stagedProjectDigest(root));
await mkdir(join(root, 'empty')); digests.push(await stagedProjectDigest(root));
assert.equal(new Set(digests).size, digests.length);
const input = { scope: 'acme/example#39506405687.1', platform: 'ios', fingerprint: 'ea9bf84e1a5b0900000ba7c1e6b1c7e272e1306f', easProfile: 'explore', environment: 'preview', environmentVariables: 'a'.repeat(64), project: digests[0] };
const input = { scope: 'acme/example#39506405687.1', platform: 'ios', nativeBuildId: 'a81d5d80', easProfile: 'explore', environment: 'preview', environmentVariables: 'a'.repeat(64), project: digests[0] };
const key = hostedRepackShareKey(input);
assert.match(key, /^[0-9a-f]{32}$/);
for (const [name, other] of Object.entries({ scope: 'acme/example#39506405687.2', platform: 'android', fingerprint: 'fc2446ef4e6d0000000000000000000000000000', easProfile: 'other', environment: 'production',
for (const [name, other] of Object.entries({ scope: 'acme/example#39506405687.2', platform: 'android', nativeBuildId: 'b0000000', easProfile: 'other', environment: 'production',
environmentVariables: 'b'.repeat(64), project: digests[1] })) {
assert.notEqual(hostedRepackShareKey({ ...input, [name]: other }), key, name);
}
// Which build a job found to repack does not matter, only its native code: a target that starts after the others'
// repack finished finds that repack as its newest build of the fingerprint (brentvatne/euxy#179), and must still
// join it rather than make another.
assert.equal(hostedRepackShareKey({ ...input, nativeBuildId: '7f6b592a' }), hostedRepackShareKey({ ...input, nativeBuildId: '2ebcfd8d' }));
});
test("only a build whose message ends with this key, for this platform, is another job's repack", () => {
+6 -10
View File
@@ -888,8 +888,6 @@ const ViewerApp = memo(function ViewerApp({ reportKey }: { reportKey: number })
if (!rightCollapsedRef.current) inspectorDismissedRef.current = true;
setRightCollapsed((current) => !current);
}, []);
// A double-click that opens the filmstrip closes the Inspector its first click opened; it is not the reader dismissing it.
const closeInspector = useCallback(() => setRightCollapsed(true), []);
// Every canvas opens with the panel showing and the Inspector out of the way.
// The sidebar keeps whatever state the reader gave it; only the Inspector closes, because a
@@ -903,9 +901,9 @@ const ViewerApp = memo(function ViewerApp({ reportKey }: { reportKey: number })
// into the destination view.
// The report Screens' layout is remembered for: the loaded one, however it was loaded.
const runId = payload?.map.run.id;
/** Screens opens in the layout the reader last left it in for this report. */
/** Screens opens in the layout the reader last left it in for this report; phones have only their list. */
const rememberedScreensLayout = useCallback((canvas: CanvasView): Partial<Route> => (
canvas === "screens" && routeRef.current.canvas !== "screens" ? { layout: readScreensLayout(runId) } : {}
canvas === "screens" && routeRef.current.canvas !== "screens" && !phoneRef.current ? { layout: readScreensLayout(runId) } : {}
), [runId]);
const commitCanvasSelection = useCallback((canvas: CanvasView) => {
const current = routeRef.current;
@@ -952,8 +950,8 @@ const ViewerApp = memo(function ViewerApp({ reportKey }: { reportKey: number })
}, [navigate, runId]);
// A link that opens the filmstrip is remembered as a switch to it is.
useEffect(() => {
if (route.canvas === "screens" && route.layout === "filmstrip") writeScreensLayout(runId, "filmstrip");
}, [route.canvas, route.layout, runId]);
if (route.canvas === "screens" && route.layout === "filmstrip" && !phone) writeScreensLayout(runId, "filmstrip");
}, [phone, route.canvas, route.layout, runId]);
// The logo returns to the Map root, the equivalent of the "/map" URL.
const openMapHome = useCallback(() => {
@@ -1130,11 +1128,10 @@ const ViewerApp = memo(function ViewerApp({ reportKey }: { reportKey: number })
const pickedInPlaceRef = useRef<string | undefined>(undefined);
// The Screens tree and jump bar pick a screen in place: it is selected and scrolled to, and the
// Inspector stays as it was. A click on the screenshot, or I, opens it.
const pickScreenInPlace = useCallback((id: string, options?: { replace?: boolean }) => {
const pickScreenInPlace = useCallback((id: string) => {
const sameSelection = resolveScreenId(routeRef.current, contextRef.current) === id;
if (!sameSelection) pickedInPlaceRef.current = id;
// A swipe through the filmstrip is one step back, however many screens it passed.
navigate(screenPatch(id), { replace: sameSelection || options?.replace === true, focus: { target: "screen", id } });
navigate(screenPatch(id), { replace: sameSelection, focus: { target: "screen", id } });
}, [navigate, screenPatch]);
// On a phone the Inspector covers the map, so a tap selects the screen first (its ring, its
// connections, the Open hint) and only a second tap on the selected screen opens it.
@@ -1693,7 +1690,6 @@ const ViewerApp = memo(function ViewerApp({ reportKey }: { reportKey: number })
onClearSelection={clearSelectedScreen}
layout={route.layout ?? "grid"}
onChangeLayout={changeScreensLayout}
onCloseInspector={closeInspector}
/>
) : null}
{comparing && phone && diff && selectedScreenId && comparePicker ? (
+36 -196
View File
@@ -1,4 +1,4 @@
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent, type WheelEvent } from "react";
import { useLayoutEffect, useMemo, useState } from "react";
import { ChevronRight } from "lucide-react";
import { artifactUrl, isLaunchScreen, type MapIndex, type Screen } from "../../utils/model";
import { primaryScreenshotForScreen, screenshotSize, type ScreenshotSize } from "../../utils/screen-images";
@@ -7,29 +7,10 @@ import { screenLabel } from "../../utils/screen-path";
import { treeNodeKey, type ScreenTree, type ScreenTreeIndex, type ScreenTreeNode } from "../../utils/screen-tree";
import { ScreenshotImage } from "../shared/screenshot-image";
/**
* A neighbour's size and opacity by its distance from the screen in the middle. The last, invisible, place is where a
* screen waits to come in, so a swipe or a step fades it in rather than popping it.
*/
const SCALES = [1, 0.74, 0.54, 0.4, 0.3];
const OPACITIES = [1, 0.9, 0.6, 0.3, 0];
/** A neighbour's size and opacity by its distance from the screen in the middle. */
const SCALES = [1, 0.74, 0.54, 0.4];
const OPACITIES = [1, 0.9, 0.6, 0.3];
const GAP = 32;
/** A swipe has ended once its wheel events (and the trackpad's momentum after it) stop for this long. */
const SWIPE_END_MS = 100;
/**
* At the end of a swipe the strip settles on the next screen in its direction once it has moved this far towards it,
* so one wheel notch steps a screen and a twitch springs back.
*/
const SWIPE_COMMIT = 0.2;
/** How far a finger moves before a touch is a swipe rather than a tap. */
const TAP_SLOP_PX = 8;
/** How far ahead a flick's speed carries the strip when the finger lifts: its velocity times this. */
const FLICK_MS = 160;
/**
* How long the strip takes to settle after a gesture: longer the further it has left to go, so that a short way home
* is not crossed at the speed of a whole step and a long one does not snap.
*/
const settleMs = (distance: number) => Math.round(260 + 260 * Math.min(1, distance));
/** An iPhone's portrait shape, for a run with no screenshot sizes at all. */
const FALLBACK_SIZE: ScreenshotSize = { imageWidth: 390, imageHeight: 844 };
@@ -49,12 +30,10 @@ export type ScreensFilmstripProps = {
/** The tree's dot class for a screen: its status, shown beside its name as the grid and the tree show it. */
dot: (id: string) => string | undefined;
dimmed: (id: string) => boolean;
/** Brings a screen to the middle without opening the Inspector; `replace` keeps it out of the history. */
onPick: (id: string, options?: { replace?: boolean }) => void;
/** Brings a screen to the middle without opening the Inspector. */
onPick: (id: string) => void;
/** Selects a screen and opens it in the Inspector, as a click on its card does. */
onOpen: (id: string) => void;
/** The phone layout: the middle screen takes most of the width, and a finger swipes the strip. */
phone?: boolean | undefined;
};
function labelOf(screen: Screen, index: MapIndex): string {
@@ -85,24 +64,6 @@ function useSize(): [(element: HTMLDivElement | null) => void, { width: number;
export function ScreensFilmstrip(props: ScreensFilmstripProps) {
const [stageRef, stage] = useSize();
const at = props.order.indexOf(props.focusedId);
// While a swipe lasts, the strip sits at a fractional position in `order`, following the gesture.
const [swipe, setSwipe] = useState<{ position: number; direction: number } | null>(null);
// Once the gesture lets go, the strip eases the rest of the way on a timing of its own (settleMs).
const [settling, setSettling] = useState<number | null>(null);
const settled = useRef<ReturnType<typeof setTimeout>>(undefined);
// The swipe's position as of the last wheel event, which can arrive before the render that shows the one before it.
const live = useRef<number | null>(null);
// A finger on the strip: where it went down, the strip's position then, and its latest speed in px/ms.
const touch = useRef<{ id: number; x: number; from: number; lastX: number; lastAt: number; velocity: number; moved: boolean } | null>(null);
// A swipe ends with the finger lifting over a screen; the click that follows is not a tap on it.
const swallowClick = useRef(false);
const swipeEnd = useRef<ReturnType<typeof setTimeout>>(undefined);
useEffect(() => () => { clearTimeout(swipeEnd.current); clearTimeout(settled.current); }, []);
// The gesture under way: the screens it has put in the middle, the last of them, and whether it has added its one
// history entry. A screen put in the middle by anything else (an arrow key, the tree, a click) ends it.
const gesture = useRef<{ shown: string; ids: Set<string>; pushed: boolean; start: number } | null>(null);
const focusedNow = useRef(props.focusedId);
useEffect(() => { focusedNow.current = props.focusedId; });
const focused = props.index.screens.get(props.focusedId);
// A row of the tree by its fold key, as the path above the frame names it.
@@ -130,155 +91,36 @@ export function ScreensFilmstrip(props: ScreensFilmstripProps) {
return size.imageWidth / size.imageHeight;
};
// Every frame is laid out as the middle one would be, filling the stage's height short of growing wider than half
// the stage (on a phone, most of it, with the neighbours peeking in at the sides), so a landscape capture beside portrait ones is as wide as it may be rather than as tall; then it is scaled
// the stage, so a landscape capture beside portrait ones is as wide as it may be rather than as tall; then it is scaled
// down around its centre, and the centres are spaced so the scaled frames sit a gap apart, the gap shrinking with them.
const frameSize = (screen: Screen) => {
const height = Math.max(0, Math.min(stage.height - 16, (stage.width * (props.phone ? 0.7 : 0.5)) / aspect(screen)));
const height = Math.max(0, Math.min(stage.height - 16, (stage.width * 0.5) / aspect(screen)));
return { width: height * aspect(screen), height };
};
// Where each screen sits with the screen at `centre` in the middle: its distance and its centre's offset.
const layout = (centre: number) => {
const placed = new Map<string, { distance: number; x: number }>();
const middle = props.index.screens.get(props.order[centre] ?? "");
if (!middle) return placed;
placed.set(props.order[centre]!, { distance: 0, x: 0 });
for (const direction of [-1, 1]) {
let edge = frameSize(middle).width / 2;
for (let distance = 1; distance < SCALES.length; distance++) {
const id = props.order[centre + direction * distance];
const screen = id ? props.index.screens.get(id) : undefined;
if (!id || !screen) break;
const scaled = frameSize(screen).width * SCALES[distance]!;
const x = edge + GAP * SCALES[distance]! + scaled / 2;
placed.set(id, { distance, x: direction * x });
edge = x + scaled / 2;
}
const middle = frameSize(focused);
const frames: { id: string; screen: Screen; distance: number; x: number; width: number; height: number }[] = [
{ id: props.focusedId, screen: focused, distance: 0, x: 0, ...middle },
];
for (const direction of [-1, 1]) {
let edge = middle.width / 2;
for (let distance = 1; distance < SCALES.length; distance++) {
const id = props.order[at + direction * distance];
const screen = id ? props.index.screens.get(id) : undefined;
if (!id || !screen) break;
const size = frameSize(screen);
const scaled = size.width * SCALES[distance]!;
const centre = edge + GAP * SCALES[distance]! + scaled / 2;
frames.push({ id, screen, distance, x: direction * centre, ...size });
edge = centre + scaled / 2;
}
return placed;
};
// A swipe someone else's step overtook (an arrow key, a click) no longer places the strip.
const swiping = swipe !== null && Math.round(swipe.position) === at;
const position = swiping ? swipe.position : at;
const base = Math.floor(position), fraction = position - base;
const from = layout(base), to = fraction > 0 ? layout(base + 1) : from;
const lerp = (a: number, b: number) => a + (b - a) * fraction;
const last = SCALES.length - 1;
// In the strip's order, so the frames' elements keep their order in the page as the middle changes: React moves an
// element that changes place among its siblings, and a moved element jumps instead of easing to where it goes.
const placeOf = new Map(props.order.map((id, place) => [id, place]));
const frames = [...new Set([...from.keys(), ...to.keys()])].sort((a, b) => placeOf.get(a)! - placeOf.get(b)!).flatMap(id => {
const screen = props.index.screens.get(id);
if (!screen) return [];
const a = from.get(id), b = to.get(id);
// A screen in only one of the two places is coming in or going out at the invisible end.
const distance = lerp(a?.distance ?? last, b?.distance ?? last);
const x = lerp(a?.x ?? b!.x, b?.x ?? a!.x);
const scale = lerp(SCALES[a?.distance ?? last]!, SCALES[b?.distance ?? last]!);
const opacity = lerp(OPACITIES[a?.distance ?? last]!, OPACITIES[b?.distance ?? last]!);
return [{ id, screen, distance, x, scale, opacity, ...frameSize(screen) }];
});
// The frames' gap at rest, which one screen of swipe travels.
const pitch = Math.abs(layout(at).get(props.order[at + 1] ?? props.order[at - 1] ?? "")?.x ?? frameSize(focused).width) || 1;
const clamp = (value: number) => Math.max(0, Math.min(props.order.length - 1, value));
const abandon = () => { clearTimeout(swipeEnd.current); gesture.current = null; live.current = null; };
const overtaken = () => !gesture.current || !gesture.current.ids.has(focusedNow.current);
// Where a gesture starts: where the one under way has the strip, or the screen in the middle for a new one.
const begin = (): number => {
if (!overtaken() && live.current !== null) return live.current;
abandon();
const index = props.order.indexOf(focusedNow.current);
const start = index < 0 ? at : index;
gesture.current = { shown: focusedNow.current, ids: new Set([focusedNow.current]), pushed: false, start };
return start;
};
// Puts a screen in the middle for the gesture: its first pick is one step back in the history, the rest replace it.
const show = (id: string) => {
const current = gesture.current;
if (!current || id === current.shown) return;
current.shown = id; current.ids.add(id);
props.onPick(id, current.pushed ? { replace: true } : undefined);
current.pushed = true;
};
// Puts the strip at `next` while a gesture lasts; the middle screen, and with it the path above, follows the swipe as
// it passes halfway.
const moveTo = (next: number, direction: number) => {
live.current = next;
setSwipe({ position: next, direction });
show(props.order[Math.round(next)]!);
};
// When the gesture ends, the strip settles on the next screen in its direction once it is SWIPE_COMMIT of the way
// there; `next` may be ahead of where the strip is, carried on by a flick.
const settle = (next: number, direction: number) => {
if (overtaken()) { abandon(); setSwipe(null); return; }
const index = clamp(direction > 0 ? Math.floor(next + 1 - SWIPE_COMMIT) : direction < 0 ? Math.ceil(next - 1 + SWIPE_COMMIT) : Math.round(next));
show(props.order[index]!);
gesture.current = null;
const ms = settleMs(Math.abs(index - (live.current ?? next)));
clearTimeout(settled.current);
setSettling(ms);
settled.current = setTimeout(() => setSettling(null), ms);
live.current = null;
setSwipe(null);
};
// A swipe along either axis moves the strip with it, so a mouse wheel works as well as a trackpad; it has ended when
// its events stop.
const onWheel = (event: WheelEvent) => {
// A pinch arrives as a wheel with Control held; it zooms the page, not the strip.
if (event.ctrlKey) return;
const delta = Math.abs(event.deltaX) > Math.abs(event.deltaY) ? event.deltaX : event.deltaY;
const pixels = event.deltaMode === 1 ? delta * 16 : event.deltaMode === 2 ? delta * stage.width : delta;
if (!pixels) return;
const next = clamp(begin() + pixels / pitch);
// The way the whole swipe went, not its last event: momentum's last 1px back must not turn a swipe around.
const direction = Math.sign(next - gesture.current!.start) || Math.sign(pixels);
moveTo(next, direction);
clearTimeout(swipeEnd.current);
swipeEnd.current = setTimeout(() => settle(next, direction), SWIPE_END_MS);
};
// A finger drags the strip under it; on lifting, a flick carries it on by its speed before it settles. A mouse
// keeps its clicks and wheel.
const onPointerDown = (event: PointerEvent) => {
// A browser that sent no click after the last swipe must not have this press's click swallowed, by finger or mouse.
swallowClick.current = false;
// A touch whose end never reached the strip (it slid off before it moved enough to be held) gives way to this one.
if (event.pointerType === "mouse" || touch.current?.id === event.pointerId) return;
touch.current = { id: event.pointerId, x: event.clientX, from: begin(), lastX: event.clientX, lastAt: event.timeStamp, velocity: 0, moved: false };
};
const onPointerMove = (event: PointerEvent) => {
const current = touch.current;
if (!current || current.id !== event.pointerId) return;
const dx = event.clientX - current.x;
if (!current.moved && Math.abs(dx) < TAP_SLOP_PX) return;
// A wheel swipe's settle waits until the finger takes over; a tap leaves it to settle.
if (!current.moved) { current.moved = true; clearTimeout(swipeEnd.current); event.currentTarget.setPointerCapture(event.pointerId); }
const elapsed = event.timeStamp - current.lastAt;
if (elapsed > 0) current.velocity = (event.clientX - current.lastX) / elapsed;
current.lastX = event.clientX; current.lastAt = event.timeStamp;
moveTo(clamp(current.from - dx / pitch), -Math.sign(dx));
};
const onPointerEnd = (event: PointerEvent) => {
const current = touch.current;
if (!current || current.id !== event.pointerId) return;
touch.current = null;
if (!current.moved) return;
swallowClick.current = true;
// A finger that stopped before lifting carries nothing on.
const velocity = event.timeStamp - current.lastAt > 80 ? 0 : current.velocity;
const next = clamp((live.current ?? position) - (velocity * FLICK_MS) / pitch);
settle(next, velocity ? -Math.sign(velocity) : -Math.sign(event.clientX - current.x));
};
}
const path = (props.shape.ancestors.get(props.focusedId) ?? []).flatMap(key => rowLabels.get(key) ?? []);
const plain = props.index.plainTitles || isLaunchScreen(focused);
const dot = props.dot(props.focusedId);
return (
<section className={`screens-strip${props.phone ? " phone" : ""}`} aria-label="Filmstrip" onWheel={onWheel}
onPointerDown={onPointerDown} onPointerMove={onPointerMove} onPointerUp={onPointerEnd} onPointerCancel={onPointerEnd}
onClickCapture={(event) => { if (swallowClick.current) { swallowClick.current = false; event.preventDefault(); event.stopPropagation(); } }}>
<section className="screens-strip" aria-label="Filmstrip">
<div className="screens-strip-path">
{path.map((label, position) => (
<span key={position} className="screens-strip-crumb" title={label}>
@@ -292,36 +134,34 @@ export function ScreensFilmstrip(props: ScreensFilmstripProps) {
</span>
</div>
<div ref={stageRef} className={`screens-strip-stage${swiping ? " swiping" : settling ? " settling" : ""}`}
style={settling ? ({ "--strip-settle-ms": `${settling}ms` } as CSSProperties) : undefined}>
{stage.width > 0 ? frames.map(({ id, screen, distance, x, scale, opacity, width, height }) => {
<div ref={stageRef} className="screens-strip-stage">
{stage.width > 0 ? frames.map(({ id, screen, distance, x, width, height }) => {
const artifact = primaryScreenshotForScreen(screen, props.index);
const url = artifactUrl(artifact);
const size = screenshotSize(artifact);
const placeholder = <span className="screens-strip-placeholder" aria-hidden="true" />;
const frameDiff = props.diff?.screens.get(id);
const scale = SCALES[distance]!;
const label = labelOf(screen, props.index);
const middle = id === props.focusedId;
const hidden = opacity === 0;
return (
<div key={id} id={props.frameId(id)} data-screen-id={id}
className={`screens-strip-frame${middle ? " focused" : ""}${frameDiff ? ` ${diffClass(frameDiff)}` : ""}${props.dimmed(id) ? " dimmed" : ""}`}
className={`screens-strip-frame${distance === 0 ? " focused" : ""}${frameDiff ? ` ${diffClass(frameDiff)}` : ""}${props.dimmed(id) ? " dimmed" : ""}`}
style={{
width,
height,
opacity,
zIndex: Math.round((SCALES.length - distance) * 10),
opacity: OPACITIES[distance],
zIndex: SCALES.length - distance,
transform: `translate(-50%, -50%) translateX(${x}px) scale(${scale})`,
}}>
{/* Only the middle frame is in the tab order: the arrows step the strip, and focus on a neighbour the stage
clips would scroll it off its centre. */}
<button type="button" className="screens-strip-target" aria-label={label} title={middle ? undefined : label}
tabIndex={middle ? undefined : -1} aria-hidden={hidden || undefined} disabled={hidden}
aria-pressed={props.selectedId === id} aria-current={middle ? "true" : undefined}
onClick={() => (middle ? props.onOpen(id) : props.onPick(id))}>
<button type="button" className="screens-strip-target" aria-label={label} title={distance === 0 ? undefined : label}
tabIndex={distance === 0 ? undefined : -1}
aria-pressed={props.selectedId === id} aria-current={distance === 0 ? "true" : undefined}
onClick={() => (distance === 0 ? props.onOpen(id) : props.onPick(id))}>
{/* A downloaded report's screenshot is a reference that ScreenshotImage resolves. */}
{url ? (
<ScreenshotImage src={url} alt="" draggable={false} decoding="async" loading={distance <= 1.5 ? "eager" : "lazy"}
<ScreenshotImage src={url} alt="" draggable={false} decoding="async" loading={distance <= 1 ? "eager" : "lazy"}
{...(size ? { width: size.imageWidth, height: size.imageHeight } : {})} fallback={placeholder} />
) : placeholder}
</button>
+1 -46
View File
@@ -335,21 +335,6 @@ button.screens-tree-row:hover { color: var(--text); background: var(--panel-hove
.screens-jump-chip > svg { width: 14px; height: 14px; }
.screens-jump-chip .path { font-family: var(--screens-mono); }
.screens-page.phone .screens-body { display: block; margin: 0; }
/* Grid or Filmstrip as two icons at the end of the Changed / All row. */
.screens-page.phone .screens-head { display: flex; align-items: center; gap: 8px; }
.screens-layout-toggle { display: inline-flex; flex: none; gap: 2px; margin-left: auto; padding: 3px; border-radius: 999px; background: var(--element); }
.screens-layout-toggle > button { display: grid; width: 40px; height: 28px; place-items: center; border-radius: 999px; color: var(--secondary); }
.screens-layout-toggle > button[aria-pressed="true"] { color: var(--text); background: var(--selected); }
.screens-layout-toggle svg { width: 16px; height: 16px; }
/* The phone's filmstrip fills what the bars leave: the head and the Tree button above it, the tab bar below. */
.screens-page.phone.filmstrip { display: flex; flex-direction: column; overflow: hidden; }
.screens-page.phone.filmstrip::before,
.screens-page.phone.filmstrip :is(.screens-head, .screens-jump) { flex: none; }
.screens-page.phone.filmstrip .screens-body { display: flex; min-height: 0; flex: 1; height: auto; }
.screens-page.phone.filmstrip .screens-sections { padding: 4px 0 0; }
.screens-strip.phone .screens-strip-path { padding: 0 16px; }
/* On a phone the fade is narrower, so the neighbours peeking in at the sides stay legible. */
.screens-strip.phone .screens-strip-stage { mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent); }
/* Sections flow side by side, as on desktop, so a section of one screen leaves no empty row. Every
card takes a fraction of the page width, so cards from neighbouring sections share columns. */
.screens-page.phone .screens-sections { container-type: inline-size; gap: 32px 12px; padding: 20px 16px 0; }
@@ -398,17 +383,6 @@ button.screens-tree-row:hover { color: var(--text); background: var(--panel-hove
/* ── Filmstrip: one screen at a time, its neighbours smaller and fainter on either side ── */
/* The page stops scrolling; the strip fills the height between the pill and the bottom toolbar. */
.screens-page.filmstrip { overflow: hidden; padding-bottom: calc(84px * var(--ui-scale)); }
/* With the sidebar folded, its button floats where the sidebar starts and the strip takes the page's width, with the same
gap either side, so the middle screen sits at the centre of the canvas (beside an open Inspector, of what it leaves). */
.screens-page.filmstrip.side-folded { padding-left: 28px; }
.screens-page.filmstrip.side-folded .screens-side.collapsed {
position: absolute;
z-index: 3;
top: calc(var(--chrome-top) + var(--chrome-height) + 20px);
left: var(--canvas-chrome-inline-inset);
}
/* A sideways swipe steps the strip; it must not also take the browser back a page. */
html:has(.screens-page.filmstrip) { overscroll-behavior-x: none; }
.screens-page.filmstrip .screens-body { height: 100%; }
.screens-page.filmstrip .screens-side { max-height: 100%; }
.screens-page.filmstrip .screens-sections { display: flex; height: 100%; flex-wrap: nowrap; align-items: stretch; }
@@ -436,18 +410,7 @@ html:has(.screens-page.filmstrip) { overscroll-behavior-x: none; }
.screens-strip-crumb.current > .screens-tree-dot[class*="diff-"] { background: var(--diff); }
.screens-strip-crumb-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.screens-strip-crumb-label.path { font-size: 12px; }
.screens-strip-stage {
position: relative;
width: 100%;
min-height: 0;
flex: 1;
overflow: hidden;
overflow: clip;
/* The outer frames fade out towards the edges rather than being cut off. */
mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
/* A finger's sideways swipe moves the strip, on any touch screen; an upward one still scrolls the page. */
touch-action: pan-y;
}
.screens-strip-stage { position: relative; width: 100%; min-height: 0; flex: 1; overflow: hidden; overflow: clip; }
.screens-strip-frame {
position: absolute;
top: 50%;
@@ -456,14 +419,6 @@ html:has(.screens-page.filmstrip) { overscroll-behavior-x: none; }
transition: transform 300ms cubic-bezier(0.2, 0.75, 0.2, 1), width 300ms cubic-bezier(0.2, 0.75, 0.2, 1), height 300ms cubic-bezier(0.2, 0.75, 0.2, 1), opacity 300ms ease;
will-change: transform;
}
/* During a swipe the frames follow the gesture directly; they ease only when it lets go and the strip settles. */
.screens-strip-stage.swiping .screens-strip-frame { transition: none; }
/* After it lets go, the strip eases home from rest: by then the gesture (and a trackpad's momentum) has slowed to
nearly nothing, and a curve that starts fast, as a step's does, would jerk it into motion. */
.screens-strip-stage.settling .screens-strip-frame {
transition-duration: var(--strip-settle-ms);
transition-timing-function: cubic-bezier(0.45, 0, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) { .screens-strip-frame { transition: none; } }
.screens-strip-frame.dimmed:not(.focused) { opacity: calc(var(--dim-out) * 0.6) !important; }
.screens-strip-target {
+18 -33
View File
@@ -50,15 +50,13 @@ export type ScreensViewProps = {
onFindRequestDone?: (() => void) | undefined;
onSelectScreen: (id: string) => void;
/** The tree and jump bar pick a screen without opening the Inspector; a screenshot click selects it as the canvas does. */
onPickScreen?: ((id: string, options?: { replace?: boolean }) => void) | undefined;
onPickScreen?: ((id: string) => void) | undefined;
/** A click on the page around the cards clears the selection, as a click on a canvas's pane does. */
onClearSelection?: (() => void) | undefined;
/** Every card in a grid, or one screen at a time in a filmstrip. */
/** Desktop only: every card in a grid, or one screen at a time in a filmstrip. */
layout?: ScreensLayout | undefined;
/** A double-click on a card opens it in the filmstrip. */
onChangeLayout?: ((layout: ScreensLayout) => void) | undefined;
/** Closes the Inspector the first click of a double-click opened; in the filmstrip a click on its middle screen opens it. */
onCloseInspector?: (() => void) | undefined;
};
function statusOf(diff: BuildDiff | undefined, id: string): DiffStatus | undefined {
@@ -300,9 +298,9 @@ function Legend(props: { others: Appearance[] }) {
}
/**
* Screens as a page that scrolls. On desktop, one grid of every screen in the order of the tree beside it; on a phone,
* a section per route folder (or per tab, when there are no route files), with the tree behind a Tree button. Either
* can show the same screens one at a time in a filmstrip (screens-filmstrip.tsx), which a finger swipes on a phone.
* Screens as a page that scrolls. On desktop, one grid of every screen in the order of the tree beside it, or the same
* screens one at a time in a filmstrip (screens-filmstrip.tsx); on a phone, a section per route folder (or per tab,
* when there are no route files), with the tree behind a Tree button.
*/
export function ScreensView(props: ScreensViewProps) {
// The report's screens, as the Map draws them: a public report's routes it never captured are not among them.
@@ -338,7 +336,7 @@ export function ScreensView(props: ScreensViewProps) {
const treeOrder = useMemo(() => treeScreenOrder(tree), [tree]);
const order = props.phone ? sections.flatMap(section => section.screenIds) : treeOrder.filter(id => shown.has(id));
const others = [...new Set([...(props.changedElsewhere?.values() ?? [])].flat())];
const filmstrip = props.layout === "filmstrip";
const filmstrip = !props.phone && props.layout === "filmstrip";
// The filmstrip always has a screen in the middle: the selection when it is shown; else, when Changed or a find hides
// it, the nearest shown screen after it in the tree (before it, at the end), as the grid's arrows step from it; else
// the first screen.
@@ -633,7 +631,6 @@ export function ScreensView(props: ScreensViewProps) {
const openFilmstripRef = useRef<((id: string) => void) | undefined>(undefined);
openFilmstripRef.current = !props.phone && !filmstrip && props.onChangeLayout ? (id: string) => {
(props.onPickScreen ?? props.onSelectScreen)(id);
props.onCloseInspector?.();
props.onChangeLayout!("filmstrip");
} : undefined;
useEffect(() => {
@@ -680,16 +677,6 @@ export function ScreensView(props: ScreensViewProps) {
</div>
) : null;
// On a phone the switch is a pair of icons at the end of the Changed / All row.
const phoneLayoutSwitch = props.phone && props.onChangeLayout ? (
<div className="screens-layout-toggle" role="group" aria-label="Screens layout">
{([["grid", "Grid", <LayoutGrid key="grid" aria-hidden="true" />], ["filmstrip", "Filmstrip", <GalleryHorizontal key="filmstrip" aria-hidden="true" />]] as const)
.map(([value, label, icon]) => (
<button key={value} type="button" aria-label={label} aria-pressed={(filmstrip ? "filmstrip" : "grid") === value}
onClick={() => props.onChangeLayout!(value)}>{icon}</button>
))}
</div>
) : null;
const dimmed = (id: string) => Boolean(props.focus?.length) && !props.focus!.some((state) => state === focusStatusOf(props.diff?.screens.get(id)));
const cell = (id: string) => {
const screen = props.index.screens.get(id);
@@ -711,14 +698,6 @@ export function ScreensView(props: ScreensViewProps) {
) : null;
};
const strip = stripFocus ? (
<ScreensFilmstrip order={order} focusedId={stripFocus} selectedId={props.selectedScreenId}
index={props.index} diff={props.diff} tree={tree} shape={shape}
typicalSize={typicalSize} frameId={cardId} dimmed={dimmed} phone={props.phone}
dot={(id) => dotClass(props.diff, props.changedElsewhere, id)}
onPick={props.onPickScreen ?? props.onSelectScreen} onOpen={props.onSelectScreen} />
) : null;
// A find inside Changed can match only screens Changed hides; the empty state says so and offers All.
const noMatch = `No ${inChanged ? "changed " : ""}screens match “${findQuery.trim()}”`;
const matchedElsewhere = matches && inChanged ? [...matches].filter(id => !inFilter.has(id)).length : 0;
@@ -734,22 +713,21 @@ export function ScreensView(props: ScreensViewProps) {
return (
<>
{layoutSwitch}
<main ref={scroller} className={`screens-page${props.phone ? " phone" : ""}${filmstrip ? " filmstrip" : ""}${filmstrip && sideCollapsed && !props.phone ? " side-folded" : ""}`} aria-label="Screens" style={style}
<main ref={scroller} className={`screens-page${props.phone ? " phone" : ""}${filmstrip ? " filmstrip" : ""}`} aria-label="Screens" style={style}
onClick={(event) => {
// The filmstrip always shows a screen; clearing the pick there would only jump it back to the first.
if (!props.onClearSelection || !props.selectedScreenId || filmstrip) return;
if ((event.target as Element).closest("button, a, input, .screens-cell, .screens-side")) return;
props.onClearSelection();
}}>
{props.phone && (filterChips || phoneLayoutSwitch) ? <div className="screens-head">{filterChips}{phoneLayoutSwitch}</div> : null}
{props.phone && filterChips ? <div className="screens-head">{filterChips}</div> : null}
{props.phone ? (
<nav className="screens-jump" aria-label="Sections">
<button type="button" className="screens-jump-chip tree" onClick={() => setTreeOpen(true)}>
<ListTree aria-hidden="true" />Tree
</button>
{/* The filmstrip's path names where the screen is; the Tree jumps anywhere. */}
{filmstrip ? null : sections.map(section => {
{sections.map(section => {
const dot = section.screenIds.map(id => dotClass(props.diff, props.changedElsewhere, id)).find(Boolean);
return (
<a key={section.id} className="screens-jump-chip" href={`#${sectionAnchor(section.id)}`}
@@ -798,7 +776,7 @@ export function ScreensView(props: ScreensViewProps) {
</aside>
)}
<div className="screens-sections">
{props.phone ? strip ?? sections.map(section => (
{props.phone ? sections.map(section => (
<section key={section.id} id={sectionAnchor(section.id)} className="screens-section" aria-label={section.name ?? section.title}>
<header className="screens-section-head">
<h2>{section.name ?? section.title}</h2>
@@ -816,7 +794,14 @@ export function ScreensView(props: ScreensViewProps) {
<button type="button" className="screens-empty-all" onPointerDown={(event) => event.preventDefault()}
onClick={() => { setFilter("all"); focusFind(); }}>Show all</button></p>
: <p>Try part of a route, or press Esc to show every {inChanged ? "changed " : ""}screen.</p>}</div>
: strip ?? <div className="screens-grid">{order.map(cell)}</div>
: stripFocus ? (
<ScreensFilmstrip order={order} focusedId={stripFocus} selectedId={props.selectedScreenId}
index={props.index} diff={props.diff} tree={tree} shape={shape}
typicalSize={typicalSize} frameId={cardId} dimmed={dimmed}
dot={(id) => dotClass(props.diff, props.changedElsewhere, id)}
onPick={props.onPickScreen ?? props.onSelectScreen} onOpen={props.onSelectScreen} />
)
: <div className="screens-grid">{order.map(cell)}</div>
)}
</div>
</div>