import type { PostContext, PublicSection, RenderImage, RenderOptions, SectionRendererMap } from './types.js';
/**
* Render options that mirror cms-admin `ADMIN_RENDER_OPTIONS`: identity
* sanitizer (rich text is sanitized on write) and a plain lazy `
` (no
* next/image pipeline inside the editor canvas).
*/
export declare const CANVAS_RENDER_OPTIONS: RenderOptions;
/**
* Normalize SSR HTML for stable equality across public vs canvas image
* pipelines. Strips whitespace and attributes that legitimately differ between
* `defaultRenderImage` and canvas plain `
` (loading / fetchpriority /
* decoding / sizes / LCP preload imageSizes) so structural drift still fails.
*/
export declare function normalizeSectionHtml(html: string): string;
export interface SectionRenderParityOptions {
/** Per-request post context (post-oriented sections). */
ctx?: PostContext;
/** Shared renderer map (the same map AdminRoot + PageSections must use). */
renderers?: SectionRendererMap;
/** Extra / override options for the public orchestrator path. */
publicOptions?: RenderOptions;
/** Extra / override options for the canvas orchestrator path. */
canvasOptions?: RenderOptions;
/** Custom normalizer; defaults to {@link normalizeSectionHtml}. */
normalize?: (html: string) => string;
}
/** Public orchestrator path — Astro/Next site via ``. */
export declare function renderPublicSectionsHtml(sections: PublicSection[], opts?: {
ctx?: PostContext;
renderers?: SectionRendererMap;
options?: RenderOptions;
}): string;
/**
* Canvas orchestrator path — same `` tree with canvas-equivalent
* options (mirrors how custom kits receive `ADMIN_RENDER_OPTIONS`).
*/
export declare function renderCanvasSectionsHtml(sections: PublicSection[], opts?: {
ctx?: PostContext;
renderers?: SectionRendererMap;
options?: RenderOptions;
}): string;
/**
* Assert that public and canvas orchestrators emit the same normalized tree
* for the given sections (+ optional shared renderer map).
*
* Throws with both HTML snippets on mismatch so CI failures are actionable.
*/
export declare function assertSectionRenderParity(sections: PublicSection[], opts?: SectionRenderParityOptions): void;
export interface SectionCoverageOptions {
/**
* Declared section types — the `sections.types` array from `prenta.config.ts`
* (objects with an `id`) or bare id strings.
*/
declared: ReadonlyArray;
/** The shared renderer map (public `` + ``). */
renderers: SectionRendererMap;
/**
* Ids that intentionally have no renderer — data-only types whose content is
* consumed by a code-owned template. Every entry must exist in `declared`
* and must NOT have a renderer; a stale entry fails so the opt-out list
* stays honest instead of silently masking real gaps.
*/
allowDataOnly?: readonly string[];
}
/**
* Assert the three-layer section contract agrees: every declared `sectionType`
* has a renderer (or is an explicit data-only opt-out), and every renderer
* corresponds to a declared type — so renaming a schema id and leaving the old
* renderer behind fails instead of shipping Structure view placeholders.
*
* This is the check the docs call `verify:sections`. Wire it as a one-line
* test against the SAME map you pass to both `` and
* ``:
*
* @example
* ```ts
* import { assertSectionCoverage } from '@prenta/sections-react/testing'
* import { marketingSectionTypes } from '../sections/types'
* import { sectionRenderers } from '../sections/register'
*
* assertSectionCoverage({
* declared: marketingSectionTypes,
* renderers: sectionRenderers,
* allowDataOnly: ['careers-listing'], // consumed by a code-owned template
* })
* ```
*
* @throws Error listing every problem at once so CI failures are actionable.
*/
export declare function assertSectionCoverage(options: SectionCoverageOptions): void;
/** Re-export for consumers that want to pin both sides to one image renderer. */
export type { RenderImage };
//# sourceMappingURL=testing.d.ts.map