Skip to content

feat(zoom): data-zoom-aside shows a caption beside the zoomed item, and the events map copies to the page and back - #14

Merged
vite-hub[bot] merged 11 commits into
mainfrom
feat/zoom-aside
Oct 20, 2026
Merged

vite-hub[bot] merged 11 commits into
mainfrom
feat/zoom-aside

Conversation

@onmax

@onmax onmax commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Hosts need two things the zoomed view doesn't give them yet. One is room for an item's caption, so it stays readable however far the item zooms. The other is a way to tell which page element a node of the zoomed copy stands for.

  • data-zoom-aside="<selector>" on an item shows a copy of that element in a column beside the zoomed item, at its own size, or in a band below it on screens narrower than 48rem. It's the first match outside the item, in its innermost context or else its parent. The stage is measured after the column is laid out, so the item fits the space that's left.
  • data-zoom-context now copies every ancestor that matches the selector, outermost first, instead of only the closest. An item can carry its colors from one wrapper and its layout from another, for example .ca,.ca-screenshot. A single class behaves as before.
  • open and change carry aside, plus copyOf(element) and originalOf(element), which map between the page and both copies by child position and return null for anything the zoom doesn't show. Drop needs these for its comment pins. Without them it rebuilds the mapping itself, from how this package happens to build the copy.
  • The events are typed on DocumentEventMap too, since they bubble and hosts listen once on the document.
  • content is now the copy of the item itself. With a context it used to be the outer context copy, and with several contexts that would be the outermost wrapper, not what was zoomed.
  • An aside never matches an element that holds the item, which would copy the item a second time.

Stacked on #12, and it will be rebased onto main once #11, #12, and the zoom review PR land. comark-annotate uses this in the PR stacked on this one.

🤖 Generated with Claude Code

onmax added 4 commits October 20, 2026 10:01
The zoomed copy sits in the dialog, so it took the dialog's font and line height and reflowed to another height;
the original then took its place on the last frame. The copy now inherits the page's text styles. Annotate
screenshots zoom inside a copy of their .ca wrapper, so styles set on it reach the zoomed view.
…igned side notes

- Issues go in `meta.issues`, appended so other plugins can add theirs.
- Every message names its block: a screenshot by its src, or by its position
  and alt when the src is missing or shared; a compare by its position and
  title; an annotation by its position in its own screenshot, with its stamp
  number or side.
- Unknown props are reported with the valid ones and a likely fix, and so is
  a `:bound` prop that points at missing frontmatter. Bindings to render-time
  `data` or `props` are still left to the renderer.
- `mark="none"` without a `side` is reported, since nothing would point.
- Coordinates must be plain decimals: `10%` and `0x10` are reported, and a
  missing one says it is required.
- Hex colors must have 3 or 6 digits, and their stamp gets a dark number
  when the color is light.
- Viewports are parsed as WxH (with x or ×, and spaces), so "1440 × 900"
  matches "1440x900"; anything else is reported.
- A host's `.ca { --ca-color }` now reaches the marks: the palette and gutters
  are declared on `.ca` only, and a zoomed screenshot sits in a copy of it.
- Left and right notes line up with their arrows when the screenshot also has
  a note above it.
- `::compare{title}` names the comparison for screen readers.
- The CLI checks several files, prefixing each issue with its file, prints one
  line when a file can't be read or written, and knows `::carousel` and
  `::zoom`.

BREAKING CHANGE: `meta.annotateIssues` is now `meta.issues`.
BREAKING CHANGE: `::screenshot{label}` is now `title`.
BREAKING CHANGE: `::screenshot{url}` is now `href`, and its link reads as the URL's host instead of "Preview".
…nd the events map copies to the page and back
@onmax
onmax force-pushed the fix/annotate-review branch from 772dd4e to cd11f5f Compare October 20, 2026 08:30
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 492a0e8 2026-10-20T11:23:59.357Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 4ffe9e0 2026-10-20T11:17:24.674Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 5a75a80 2026-10-20T11:08:52.944Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ a376400 2026-10-20T10:56:39.484Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 9389bd0 2026-10-20T10:29:52.350Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 90f5465 2026-10-20T10:01:04.886Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 63d2c92 2026-10-20T09:12:08.350Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 8f22c09 2026-10-20T08:29:21.613Z Visit the dashboard ↗

@onmax
onmax marked this pull request as ready for review October 20, 2026 09:20

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The annotate integration does not activate the new aside behavior, so screenshot captions and notes still do not appear beside the zoomed item.

Reviewed changes

  • Annotate validation and rendering — moves diagnostics to shared meta.issues, adds clearer prop and coordinate validation, renames screenshot and compare metadata, and updates rendered headings and theming.
  • Annotate CLI and documentation — adds multi-file checking, mixed zoom/carousel previews, and documents the updated APIs.
  • Zoom runtime — adds nested context copies, aside layout, page/copy mapping helpers, and typed bubbling events.
  • Tests and browser coverage — updates annotate unit coverage and adds end-to-end checks for theming and side-note alignment.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/annotate/src/html.ts Resolved
@vite-hub
vite-hub Bot changed the base branch from fix/annotate-review to main October 20, 2026 09:45
@vite-hub

vite-hub Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Starting Not started —
View session Completed 2026-10-20T11:24:23.730Z 2m 35s
View session Completed 2026-10-20T11:17:41.504Z 5m 55s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

Session

Waiting for GitHub merge request 47c3454e-b372-4342-a937-66e750e6e666.

View session

Current HEAD has a P1 required-check failure: annotate tests expect outdated href and diagnostic messages at lines 224, 306, and 434, while the implementation emits stricter current messages. No review threads remain actionable; historical Pullfrog findings are resolved. The repair push window is closed until 2026-10-21T09:59:18Z, so the expectation updates require a later repair pass.

Session

Fixed the required lint/typecheck failures by restoring bundled client CSS defaults, correcting event-map declarations, removing the unused epoch, and cleaning the E2E import. Zoom tests pass 9/9; local E2E could not start because port 4173 is restricted. Pushed commit 492a0e8. Historical Pullfrog P1 findings are already resolved; no new actionable review findings remain.

Session

Fixed the required lint/typecheck failures by restoring bundled client CSS defaults, correcting event-map declarations, removing the unused epoch, and cleaning the E2E import. Zoom tests pass 9/9; local E2E could not start because port 4173 is restricted. Pushed commit 492a0e8. Historical Pullfrog P1 findings are already resolved; no new actionable review findings remain.

Session

Fixed the required lint/typecheck failures by restoring bundled client CSS defaults, correcting event-map declarations, removing the unused epoch, and cleaning the E2E import. Zoom tests pass 9/9; local E2E could not start because port 4173 is restricted. Pushed commit 492a0e8. Historical Pullfrog P1 findings are already resolved; no new actionable review findings remain.

View session

Fixed the required lint/typecheck failures by restoring bundled client CSS defaults, correcting event-map declarations, removing the unused epoch, and cleaning the E2E import. Zoom tests pass 9/9; local E2E could not start because port 4173 is restricted. Pushed commit 492a0e8. Historical Pullfrog P1 findings are already resolved; no new actionable review findings remain.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new scroll-restoration lifecycle can leave pages in manual mode when a zoom is stopped while a close is still traversing history and the host remounts the zoom during popstate.

Reviewed changes

  • Activated annotate asides — Added data-zoom-aside="figcaption" to generated screenshots so captions and notes are copied beside the zoomed item.
  • Reworked close navigation — Added scroll-restoration management, interrupted-animation handling, and center-aware travel paths for zoom opening and closing.
  • Pinned workflow and packaging dependencies — Pinned the Pullfrog workflow actions and made package prepack scripts build their workspace runtime dependencies.
  • Adjusted E2E typing — Added Playwright Locator and Page type imports for the retained helper surface.

The shared restoration slot is overwritten by a new open() before the earlier asynchronous shut() has finished. In a stop/remount sequence, the old popstate listener can then consume the newer value and clear the slot, so the later close has nothing left to restore.

Technical details
# Preserve scroll restoration across overlapping zoom lifecycles

## Affected sites
- `packages/zoom/src/client.ts:85` — stores restoration state in one module-level variable shared by all asynchronous closes.
- `packages/zoom/src/client.ts:434-440` — overwrites that shared state while opening a new zoom and only restores it from the current slot on failure.
- `packages/zoom/src/client.ts:463-471` — the previous close consumes and clears the slot during `history.back()`.
- `packages/zoom/src/client.ts:577-584` — `stop()` starts `shut()` without awaiting it, allowing a remount/open to overlap the old close.

## Required outcome
- Keep each zoom lifecycle's saved `history.scrollRestoration` value associated with that lifecycle until its own history traversal and close cleanup finish.
- Ensure stopping and remounting during the close sequence cannot leave the page in `manual` mode or consume the newer zoom's restoration state.

## Suggested approach
- Avoid a shared mutable restoration slot across overlapping views, or serialize/guard remounts until the prior `shut()` has completed.

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • packages/zoom/src/client.ts:85 (RIGHT) — line 85 (RIGHT) is not inside a diff hunk

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@vite-hub

vite-hub Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Fixed the P1 scroll-restoration lifecycle race by storing restoration state on each zoom view, so overlapping stop/remount closes cannot consume a newer view's state. Also resolved the prepared merge conflicts and updated the annotate expectation for data-zoom-aside. Focused tests could not run locally because Corepack could not download pnpm (DNS/network); dependencies were preinstalled successfully by the host.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The per-view restoration state fixes the previous slot collision, but an old delayed restoration callback can still overwrite a newly opened zoom's manual setting.

Reviewed changes

  • Isolated scroll restoration per view — Moved the saved history.scrollRestoration value from shared module state onto each zoom view and updated close/popstate cleanup to use that view.
  • Hardened bound-link diagnostics — Resolved bound src and href values independently when checking for unsafe URLs, including when a plain prop is present alongside the binding.
  • Expanded annotate regression coverage — Added public-interface tests for generated aside attributes, unsafe bound links beside plain links, native attributes, and quoted diagnostic names.

⚠️ Delayed restoration can overwrite a newly opened zoom

restore() schedules a global write to history.scrollRestoration after the browser processes popstate. If an old view queues that callback while its asynchronous close is still unwinding, a remounted host can open a new view and set restoration to manual, then the old callback writes the previous value back and leaves the new zoom without its required scroll lock.

Technical details
# Keep delayed restoration tied to its view lifecycle

## Affected sites
- `packages/zoom/src/client.ts:362-366` — the timeout callback unconditionally assigns the saved value to global `history.scrollRestoration` after `current.restoration` has been cleared.
- `packages/zoom/src/client.ts:434-438` — a newly opened view stores the current global setting and sets it to `manual`.
- `packages/zoom/src/client.ts:568-572` — the `popstate` handler restores the current view before starting its asynchronous close.

## Required outcome
- A delayed restoration from an older view must not overwrite `history.scrollRestoration` after a newer view has opened.
- Preserve the saved setting for the lifecycle that initiated the history traversal while keeping the active view's scroll restoration mode intact.

## Suggested approach
- Guard the delayed assignment with the view's active/closing identity or cancel pending restoration callbacks when a newer view opens.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/zoom/src/client.ts Resolved
@vite-hub

vite-hub Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Fixed the P1 delayed scroll-restoration race by invalidating callbacks when a new zoom lifecycle opens. Also repaired the required annotate test regressions (P1: native attributes, host validation, and diagnostic quoting). Local Vitest was blocked by unresolved workspace package links; host CI should verify.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The incremental restoration guard still permits an old runtime to overwrite a remounted zoom's manual scroll setting.

Reviewed changes

  • Guarded delayed restoration — Added an epoch check before restoring history.scrollRestoration and incremented it when opening a zoom.
  • Restored annotate diagnostics — Reinstated the stricter URL and viewport validation behavior and corresponding public-interface expectations.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/zoom/src/client.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Merged carousel runtime updates — Incorporated the main branch changes for nested carousel scoping, RTL paging, scroll synchronization, and zoom-follow behavior.
  • Updated carousel normalization and rendering — Added the merged slide normalization, renderer attributes, and nested carousel handling across the HTML, Vue, React, and Svelte surfaces.
  • Expanded carousel verification — Added public-interface and browser coverage for nested carousels, quick paging, hidden carousels, reduced motion, multiple columns, RTL behavior, keyboard exclusions, and script-free scrolling.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Shared remount restoration guard — Moved the delayed scroll-restoration epoch to window so a callback from a stopped runtime cannot overwrite a newly mounted zoom's manual setting.
  • Added lifecycle regression coverage — Added browser coverage for opening a new zoom while another runtime is still closing, including the expected restoration state through the second close.
  • Clarified zoom API documentation — Updated the event, theming, context, and aside documentation to match the current runtime and public entry points.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@vite-hub

vite-hub Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Required check failure is a current P1: annotate tests still expect the pre-merge href/diagnostic wording, while packages/annotate/src/read.ts emits the stricter messages now used by the implementation. The three failures are at annotate.test.ts:224, 306, and 434. The repair push window is closed, so this needs a follow-up push updating those expectations before merge.

@vite-hub
vite-hub Bot merged commit 142b3d0 into main Oct 20, 2026
5 of 7 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026
vite-hub Bot pushed a commit that referenced this pull request Oct 20, 2026
#14 was squashed from a branch older than #12 and #21, so it put back annotate's earlier read.ts and tests:
an unknown prop named `constructor` or `__proto__` printed Object's own value as its hint, viewports compared as
strings ("0900x0360" no longer matched "900x360"), and two tests expected the old href message. Those parts
are restored; #17's compare mode stays.

The slider e2e test clicked at coordinates measured before focusing the handle, which can scroll the page, so it
missed the slider under load. It measures again before that click.

zoom's client.ts holds its own copy of the zoom script since #14, so its doctor suppression covers it too.
vite-hub Bot pushed a commit that referenced this pull request Oct 20, 2026
… too (#25)

#14 was squashed from a branch older than #16, so it added data-zoom-aside, copyOf, and originalOf to a copy of the
zoom script in client.ts, while the HTML renderer kept inlining script.ts without them. Pages rendered to HTML got
no aside and no mapping, and start() lost #16's fixes: keyboard opening of nested items, hidden items left out of a
group, and data-zoom-src loading behind the page image.

script.ts has the aside and the mapping again, on top of #16, and client.ts is the wrapper around it it was before.
An e2e test checks both on a page from the HTML renderer.
onmax added a commit that referenced this pull request Oct 20, 2026
onmax added a commit that referenced this pull request Oct 20, 2026
onmax added a commit that referenced this pull request Oct 20, 2026
…mark lights up its note there

The stage, not the figure, is the zoom item now, with `.ca` and `.ca-screenshot` as its contexts and the figcaption
as its aside (#14, #25), so the notes sit beside the zoomed image at a size that reads. In the zoom, hovering a mark
or a note lights the other, between the zoomed copy and the aside only: the thumbnails are copies too.

e2e checks that the aside is to the right of the frame, that a note lights its mark and no thumbnail, and that the
zoom's copyOf/originalOf map the image and the note to the page and back.
onmax added a commit that referenced this pull request Oct 20, 2026
…mark lights up its note there (#15)

The stage, not the figure, is the zoom item now, with `.ca` and `.ca-screenshot` as its contexts and the figcaption
as its aside (#14, #25), so the notes sit beside the zoomed image at a size that reads. In the zoom, hovering a mark
or a note lights the other, between the zoomed copy and the aside only: the thumbnails are copies too.

e2e checks that the aside is to the right of the frame, that a note lights its mark and no thumbnail, and that the
zoom's copyOf/originalOf map the image and the note to the page and back.
This was referenced Oct 22, 2026
@onmax
onmax deleted the feat/zoom-aside branch November 1, 2026 11:04
vite-hub Bot pushed a commit that referenced this pull request Nov 25, 2026
…ts that #14 dropped (#490)

#14 (142b3d0) merged a stale branch over e2e/zoom.e2e.ts and deleted five tests and the lastFrame helper that 26233e9 had.

They are back against today's fixtures. The closing test and lastFrame live in e2e/motion-zoom.e2e.ts, since the closing travel has come from comark-motion since #474 and the zoom-only renderer closes at once. The screenshot's zoom item is now .ca-stage, and the tab order steps over each screenshot's Copy button, which #26 added.
@github-actions github-actions Bot mentioned this pull request Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant