Files
Michael Ramos 44611e5300 feat(ui): publish the HTML annotation seams hosts were hand-rolling (#1395)
Parity seams for hosts of @plannotator/ui, requested by Workspaces after the HTML annotation handoff: projectHostThreads and buildPersistedHtmlAnchor in @plannotator/core; HtmlViewer onUnanchoredChange completed over the annotations prop with a restore-keyed report so hosts can drop their mark-applied listeners; published useHtmlRefresh with a fetchSnapshot adapter; published HtmlSurfaceControls (eye, refresh, pen) with label overrides; AnnotationPanel unanchoredIds chip (wired for Plannotator too); HtmlViewer maxAdditionalTargets and scrollBehavior carried on the bridge; shortcuts and utils/inputMethod blessed as consumer exports. Plannotator's behavior is unchanged apart from the new Unanchored chip, verified by a real-browser A/B including the orphan and re-anchor cycle and by a combined cross-surface verification with #1394.

AI-assisted (Claude) under maintainer direction.
2026-08-27 07:35:22 -07:00

38 lines
1.4 KiB
TypeScript

/**
* Host-side helpers for the raw-HTML viewer, re-exported from
* `@plannotator/core/html-anchor` with the package's `Annotation` type.
*
* `projectHostThreads` turns a host's stored rows into the `annotations`
* prop (output order == marker numbering); `buildPersistedHtmlAnchor` trims a
* composed comment's anchor to a bounded record the host can persist. Both
* are pure and dependency-free (they live in `@plannotator/core`).
*/
import {
projectHostThreads as projectHostThreadsCore,
type HostThread,
type ProjectHostThreadsOptions,
} from "@plannotator/core/html-anchor";
import type { Annotation } from "../../types";
export {
buildPersistedHtmlAnchor,
type BuildPersistedHtmlAnchorOptions,
type HostThread,
type PersistedHtmlAnchor,
type PersistedHtmlAnchorResult,
type ProjectHostThreadsOptions,
} from "@plannotator/core/html-anchor";
/**
* Project stored host rows onto the viewer's `annotations` prop, in the
* host's order (which becomes the marker numbering). See the core function
* for the projection rules; the `type` literals it emits are the string
* values of `AnnotationType`, so the cast below is representation-exact.
*/
export function projectHostThreads(
threads: readonly HostThread[],
options?: ProjectHostThreadsOptions,
): Annotation[] {
return projectHostThreadsCore(threads, options) as unknown as Annotation[];
}