SIGN IN SIGN UP

feat(core): carry elementContext through the html-anchor host seam (#1549)

* feat(core): carry elementContext through html-anchor host helpers

Persist and project elementContext through the core host helpers; move the validator into core and drop the ui mirror; add outline-less export option.

Closes #1521.

* refactor(ui): single definition of MAX_PAGE_URL_LENGTH in core

`packages/core/html-anchor.ts` gained its own `MAX_PAGE_URL_LENGTH` when
`parseHtmlElementContext` moved there, leaving a second copy in
`useHtmlAnnotation.ts` — exactly the hand-mirrored-constant shape the move
was meant to end. Delete the ui copy, import the core one, and re-export it
from `components/html-viewer` so the host import site and the live-protocol
tests keep reading it from where they already do.

* docs(ui): document the element-context host contract

HANDOFF.md still told hosts the element-context gap was open — that
`@plannotator/core/html-anchor` does not carry `elementContext` and that they
must persist and project it themselves. It ships in the ui tarball, so that
line was about to be wrong in a consumer's node_modules.

- HANDOFF.md: the stale gap sentence now names 0.39.0 as the release it
  describes and points forward. A new "Element context through the host seam"
  section says where the validator lives (`parseHtmlElementContext` in
  `@plannotator/core/html-anchor`, re-exported unchanged from
  `components/html-viewer`), what a host passes (`elementContext` on the
  build source, `context` per additional target, `elementContext` on a
  `HostThread`), what it gets back (`PersistedHtmlAnchor.elementContext`,
  `HtmlAnnotationTarget.context`, both on the projection) with the fixed key
  order that keeps context-less rows byte-identical on the wire, and that the
  caps, the attribute allowlist, the shed order and the 16 KiB budget are all
  unchanged — contexts are simply shed before targets. Plus a publishing
  bullet: core moves, so publish core first.
- README.md: the host-seam bullet now mentions the round trip.
- html-anchor.ts: the module doc claimed the validators mirror what ui
  enforces. They no longer mirror it; they are it.

* docs: name the validator's new home in the element-context section

---------

Co-authored-by: Michael Ramos <mdramos8@gmail.com>
F
FND committed
a42aefc8604b5e57a8a3cfabb122a0bad38b8867
Parent: 2b264a2
Committed by GitHub <noreply@github.com> on 9/17/2026, 7:34:02 AM