/** * Canonical link interception, prefetch eligibility, and HTML fetch guards. * @module */ export type LinkNavigationPolicyOptions = { /** Attribute that forces a full document reload instead of SPA navigation. */ reloadAttribute?: string; /** Attribute that opts a link out of prefetch. */ noPrefetchAttribute?: string; }; export type LinkNavigationDecision = { shouldIntercept: true; href: string; } | { shouldIntercept: false; reason: 'modified-click' | 'non-left-click' | 'external-target' | 'explicit-reload' | 'download' | 'no-prefetch' | 'invalid-href' | 'cross-origin' | 'static-asset' | 'same-page-hash'; }; /** * Returns whether an href only adds a hash fragment on the current page. */ export declare function isSamePageHashNavigationHref(href: string): boolean; /** * Decides whether a pointer or click on an anchor should be handled as SPA navigation. */ export declare function getLinkNavigationDecision(event: MouseEvent | PointerEvent, link: HTMLAnchorElement, options: LinkNavigationPolicyOptions): LinkNavigationDecision; /** * Returns the href when SPA navigation should intercept the click, otherwise `null`. */ export declare function getNavigableHrefFromClick(event: MouseEvent | PointerEvent, link: HTMLAnchorElement, options: LinkNavigationPolicyOptions): string | null; /** * Returns whether a link is eligible for hover or viewport prefetch. */ export declare function shouldPrefetchLink(link: HTMLAnchorElement, options: LinkNavigationPolicyOptions): boolean; /** * @remarks * Prefetch and SPA fetches request HTML. Only explicit `text/html` and * `application/xhtml+xml` responses are accepted; missing or asset types are rejected. */ export declare function isHtmlPageResponse(response: Response): boolean; /** * @remarks * Servers should send `text/html`. When the type is missing or the runtime * defaults to `text/plain` (common in tests), a document-shaped body is accepted. */ export declare function assertHtmlPageResponse(response: Response): Promise;