/** * Document assembly. * * The emitted artifact is a single file that must be self-defending: it is * opened from `file://`, so it cannot rely on response headers. The Content * Security Policy is therefore embedded, derived from the page's own network * policy, and the inline style and script elements carry deterministic nonces * so the policy can name exactly what is allowed instead of falling back to * `'unsafe-inline'`. * * Nonces are derived from a content hash, not from randomness: a random nonce * would break byte-determinism, and a nonce does not need to be unpredictable * to be useful here (it only has to distinguish the compiler's own elements). */ import type { IrDocument } from '../ir.js'; export interface DocumentInput { ir: IrDocument; compilerVersion: string; css: string; js: string; body: string; /** Extra origins a permitted capability needs in the policy, deduplicated. */ allowedOrigins: string[]; themeToggle: boolean; /** Resolved theme density, emitted as a document-level attribute. */ density: string; /** The theme turned motion off; the runtime reads this from the root element. */ motionDisabled?: boolean; /** * Resolved component recipes. Each non-default choice becomes a * `data-r-` attribute that scopes its recipe sheet; defaults emit * nothing, so a page without recipes keeps its bytes. */ recipes?: Readonly>; /** Rendered page outline; omitted or empty when the page has none. */ outline?: string; /** * Emit the live region. Omitted: derived from the core features the page's * blocks declare; the compiler passes it so registry features count too. */ liveRegion?: boolean; } export interface AssembledDocument { html: string; csp: string; styleNonce: string; scriptNonce: string; } export declare function buildContentSecurityPolicy(input: DocumentInput): { csp: string; styleNonce: string; scriptNonce: string; }; export declare function assembleDocument(input: DocumentInput): AssembledDocument; //# sourceMappingURL=document.d.ts.map