UNPKG

histoire

Version:

A fast story book powered by Vite

55 lines • 2.28 kB
/** Fixed host operation state; messages retain document and tuple authority. */ interface PreviewTestHostState { /** Captured generation and host lease identity. */ active: boolean; /** Readiness refers to exactly one sandbox document. */ ready: boolean; /** Exact collected story. */ storyId: string; /** Exact scoped variant. */ variantId: string; /** Host capability, absent from public URLs except nonce host path. */ nonce: string; /** Captured project generation. */ epoch: string; /** Current sandbox document lifetime. */ documentId?: string; /** Safe same-origin document lookup; cross-origin navigation loses authority. */ currentDocumentId: () => string | undefined; /** Fixed internal dispatch, installed before navigation. */ tests?: ReturnType<typeof installPreviewTestHost>; } /** Internal command accepts identifiers, never caller JavaScript or URLs. */ export interface PreviewTestCommand { /** Fixed operation kind. */ kind: 'collect' | 'run'; /** Fresh unique correlation ID for this request. */ id: string; /** Document that was ready before dispatch. */ documentId: string; /** Captured independent authority. */ nonce: string; /** Captured generation. */ epoch: string; /** Exact selected story. */ storyId: string; /** Exact selected variant. */ variantId: string; } /** Self-contained function serialized into trusted host, with no module globals. */ export declare function installPreviewTestHost(frame: HTMLIFrameElement, state: PreviewTestHostState, options: { origin: string; types: readonly string[]; resultBytes: number; }): { /** Dispatch once; response loss never repeats test side effects. */ request(command: PreviewTestCommand): boolean; /** Poll only completion or lost authority; Playwright owns deadline. */ settled(command: PreviewTestCommand): boolean; /** Consume one response and discard pending state on failed navigation. */ take(command: PreviewTestCommand): unknown; }; /** Fragment references only enclosing fixed bootstrap frame/state/options. */ export declare function renderPreviewTestScript(): string; export {}; //# sourceMappingURL=preview-test-script.d.ts.map