mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
44611e5300
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.
38 lines
1.4 KiB
TypeScript
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[];
|
|
}
|