UNPKG

histoire

Version:

A fast story book powered by Vite

50 lines • 2.14 kB
import type { HistoireGlobals } from '@histoire/protocol'; /** Trusted target resolved from dev catalog or immutable Node manifest. */ export interface PreviewHostTarget { /** Actual listener origin used for browser navigation. */ origin: string; /** Exact story, never a URL or source path. */ storyId: string; /** Exact scoped variant. */ variantId: string; /** Current process-owned epoch. */ epoch: string; /** Validated iframe width. */ width: number; /** Validated iframe height. */ height: number; /** Validated device pixels per CSS pixel; omitted preserves DPR 1. */ deviceScaleFactor?: number; /** Bounded primitive runtime globals delivered through existing settings sync. */ globals?: HistoireGlobals; /** Bounded complete matrix cell props applied through existing runtime message. */ propsOverride?: Record<string, unknown>; /** Existing Histoire color preference. */ colorScheme?: 'light' | 'dark'; /** Configured initial preview background. */ backgroundColor: string; /** Existing preview text direction. */ textDirection: 'ltr' | 'rtl'; /** Captured runtime ownership guard. */ isActive: () => boolean; } /** Expiring same-origin host registry, independent of Vite and MCP transports. */ export declare function createPreviewHostRegistry(options: { base: string; }): { /** Dedicated prefix lets HTTP adapters reject expired routes before fallback. */ prefix: string; /** Acquire a random route only after an operation reaches the execution lane. */ open(target: PreviewHostTarget): { nonce: string; url: string; close: () => boolean; }; /** Match exact raw route; query, traversal and expired leases have no document. */ render(path: string): string | undefined; /** All old capabilities cease serving immediately on generation release. */ close(): void; }; /** Shared registry shape accepted by standalone production routing. */ export type PreviewHostRegistry = ReturnType<typeof createPreviewHostRegistry>; //# sourceMappingURL=preview-host.d.ts.map