Acceptance Criteria
xref schema in packages/runes/src/tags/xref.ts gains a preview attribute (enum "drawer" in v1; reserved "popover" | "details" | "sidenote").- Without
preview: behaviour unchanged — inline <a> to the entity's resolved URL (today's xref). - With
preview="drawer": inline <a href="#drawer-{id}"> (where {id} is the entity id) plus a hoist sentinel. The hoist payload populates the drawer body via the same resolver path {% expand "id" /%} uses, and the chrome footer with a link to the entity's sourceUrl (or the registry's resolved page URL). - Missing
sourceUrl: for entities with no resolved URL (heading entities, drawer-target entities), the drawer body still renders normally; the footer link silently hides. No build warning for this — it's a legitimate shape. - A11y parallels WORK-301: the inline
<a> carries aria-controls="drawer-{id}" and aria-expanded="false". - No-JS fallback parallels WORK-301: the in-page anchor scrolls to the hoisted drawer's SSR fallback (drawer rune's existing behaviour).
- Tests in
packages/runes/test/xref-preview*.test.ts cover: preview omitted → today's behaviour; preview set → sentinel emitted- inline link points at hoist id; entity without
sourceUrl → footer link hidden; dedup across multiple refs to same id (one drawer total per page); xref-patterns from refrakt.config.json still produce correct external-link footers.
Approach
A two-line schema extension (add preview to attributes) plus a transform branch that emits a hoist sentinel when preview is set, carrying the entity id as the payload key.
The payload-rendering side runs in WORK-300's hoist mechanism — it looks up the entity via the registry, calls the same expand resolver {% expand %} uses, and assembles body + footer. This work item is mostly plumbing on the xref side: detect the attribute, emit the sentinel.
xref preview="drawer" and {% expand %} stay distinct runes — expand is the in-flow content-inlining one (SPEC-066), xref preview="drawer" is the on-demand reveal. Different intents, same underlying expand resolver shared.
Dependencies
- WORK-298 — drawer footer slot.
- WORK-300 — hoist mechanism.
References
- SPEC-078 — Capability 2 (shared preview attribute).
- SPEC-065 — xref patterns; same registry the preview mode reads from.
- SPEC-066 —
expand; the in-flow counterpart.