Skip to content

Align with TPEN messaging contract — read siblings from TPEN_CONTEXT#3

Merged
thehabes merged 2 commits into
mainfrom
5-2-tools-align
May 8, 2026
Merged

Align with TPEN messaging contract — read siblings from TPEN_CONTEXT#3
thehabes merged 2 commits into
mainfrom
5-2-tools-align

Conversation

@thehabes
Copy link
Copy Markdown
Member

@thehabes thehabes commented May 8, 2026

Summary

Align Compare-Pages with the canonical TPEN messaging contract. Replace the legacy CANVASES payload with TPEN_CONTEXT.canvases. The full contract is defined in CenterForDigitalHumanities/TPEN-interfaces#564.

Changes

  • iiif-image-viewer.js
    • Window message handler now matches TPEN_CONTEXT instead of CANVASES.
    • Reads event.data.canvases. Field shape is identical to the prior CANVASES payload: { id, label } per entry, where id is the canvas IRI for that page — Compare-Pages already fetches id as a IIIF canvas.
    • No outbound messages.

Coordinated cut

Hard cut, all PRs must merge together. Full contract and other PRs:

Test plan

Developer-validated locally on 2026-05-08 against CenterForDigitalHumanities/TPEN-interfaces#564 on :4000:

  • In TPEN-interfaces (jekyll s), add Compare-Pages to a project's tools. Open /transcribe.
  • Iframe loads → dropdown lists pages from the active layer; default selection renders an image; magnifier toggle works.
  • Switch to another option → image updates and magnifier resets. (not exercised — test project had a single page in the active layer; the dropdown-switch path is unchanged from the legacy CANVASES consumer)

Companion follow-up (deferred, does not block this cut)

Replace the dedicated CANVASES boot message with the canonical lean
TPEN_CONTEXT payload — sibling pages now arrive on the `siblings`
field of TPEN_CONTEXT instead of a separate canvases-only message.
Comment thread iiif-image-viewer.js Outdated
if (event.data.type === "TPEN_CONTEXT") {
try {
const canvases = event.data.canvases || []
const canvases = event.data.siblings || []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll need to check this... Does siblings include the current page?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes — and renamed to canvases in cd4d134 to match the parent rename in CenterForDigitalHumanities/TPEN-interfaces#564. The active canvas is included so the dropdown can label 'you are here' (matches the legacy CANVASES shape this replaces).

Match parent rename in CenterForDigitalHumanities/TPEN-interfaces#564.
Field shape unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thehabes thehabes merged commit e105dfe into main May 8, 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.

2 participants