import type { ObservationProfile, RenderDocument, SubjectRef, Viewport } from '@variance-authority/core/format'; import { type StyleIndex } from './css.js'; /** * Acquisition — phase one: a live DOM becomes something you can send somewhere. * * This is the same extraction the semantic collector performs, aimed at a * different target. `collect()` produces a value built to be *compared*, so it * throws away everything volatile: ids become aliases, classes vanish, the * cascade is resolved. A render document is built to be *repainted*, so it keeps * all of that — a selector cannot match a class that was normalized away. * * What the two share is the expensive, load-bearing half: applicability pruning * (ADR-0003). A subject carrying Storybook's chrome, a preview reset, the design * system, and a CSS-in-JS tag that has been accreting since page load ships as * the rules that actually touch it — 1010 rules to 1 on the fixture in * `collect.test.ts`. * That is a correctness result for comparison and a *transport* result here: an * offloaded render is only worth offloading if the payload is not the whole * application. * * ## What this makes possible * * jsdom cannot rasterize. It can produce one of these, which is the sub-renderer * split ADR-0002 describes and the direct answer to paying for a container on * every tier: the deciding tier runs anywhere, and the residue that genuinely * needs pinned pixels is a serializable payload that can be sent to the one * machine that is pinned. */ export interface AcquireOptions { readonly subject: SubjectRef; readonly viewport: Viewport; /** See `CollectOptions.fonts`. Carried into the document, never resolved here. */ readonly fonts?: readonly string[]; readonly features?: Readonly>; readonly assets?: Readonly>; /** * Inherited values and custom properties in force at the subject root. * * Defaults to resolving the ancestor cascade, which is not an optimization * anyone can skip: design tokens are declared on `:root`, `:root` is outside * every subject's subtree, and pruning therefore *correctly* drops the rule * that defines them. Ship the pruned sheet without this and `var(--brand)` * resolves to nothing — the render is the design system with its colours * removed, which looks exactly like a catastrophic regression. */ readonly inherited?: Readonly>; /** Reuse an index already built for a capture of the same document. */ readonly index?: StyleIndex; /** Defaults to whichever profile the host can support. */ readonly profile?: ObservationProfile; } /** * Attribute stamped on every element, carrying its path from the subject root. * * Two jobs. It lets this function verify its own output — a rule is only worth * shipping if it still matches once the subtree is standing on a reconstructed * frame rather than inside the real page — and it survives into the rendered * document, where it is the exact node correspondence a geometric region join * has to approximate. * * Data attributes paint nothing, so its presence cannot move a pixel. It does * enter the document digest, which is correct: a different tree is a different * render. */ export declare const PATH_ATTRIBUTE = "data-va-path"; export declare function acquireDocument(root: Element, options: AcquireOptions): RenderDocument; export declare function serializeAttributes(attributes: Readonly>): string; //# sourceMappingURL=document.d.ts.map