import type { MatchedRule, ObservationProfile, Provenance, RawNode } from '@variance-authority/core/format'; /** * The boxes CSS generates inside an element: `::before` and `::after`. * * A generated box paints like a child — it has text, a colour, a background — * and the DOM has no node for it, so a walk over child nodes never meets one. * `.badge::before { content: "New" }` rewritten to `"Old"` repaints the badge * and moved nothing a capture read. These are read here, from the element they * hang from, and enter the capture as the children they render as: `::before` * first, `::after` last, each with the rules that style it and the text it says * as a `#text` child — the same shape an element's * text takes, so a reworded box diffs like reworded text. * * Only these two. `::marker`, `::placeholder` and the rest style a box the * capture already holds or one only some elements have; their rules still reach * the render document, and none is read as a node. */ export declare const GENERATED_BOXES: readonly ['::before', '::after']; /** * What a generated box under a host without a layout engine could not say. * * JSDOM implements no generated content: `getComputedStyle(element, '::before')` * logs "Not implemented" and answers with the *element's* style. The cascade is * still read here: the winning `content` says its words when it is made of * strings and `attr()`. A counter, a quote, a `var()` or a `url()` is resolved * only by a layout engine or a runtime, so a box whose content holds one is * marked with the parts it could not resolve, and says nothing rather than a guess. */ export declare function unreadWords(unresolved: readonly string[]): string; /** * The generated box `pseudo` adds to `element`, or nothing when it adds none. * * A box exists when its `content` makes one and its `display` is not `none`. * With computed style, the engine answers both. Without it, the declared rules * answer, and {@link declaredValue} picks the winner among them by the same * order normalization uses for every other property. The box then says the * words of the winning `content` when {@link readContent} can read them, or is * marked {@link unreadWords} when it cannot. */ export declare function generatedBox(element: Element, pseudo: (typeof GENERATED_BOXES)[number], rules: readonly MatchedRule[], profile: ObservationProfile, view: Window | null, provenance: Provenance | undefined): RawNode | undefined; /** The words a `content` value says, or the parts of it that only an engine or a runtime resolves. */ export type ContentReading = { readonly text: string; } | { readonly unresolved: readonly string[]; }; /** * Read the words a `content` value says on `host`. * * Strings are unescaped and joined, and `attr(name)` is the host's attribute, * or nothing when it has none — which is what an engine paints for both. * Alternative text after `/` is for assistive technology and is not painted. * Anything else — `counter()`, `open-quote`, `var()`, `url()`, an `attr()` with * a type or a fallback — is named in `unresolved`, each once, in order, and * so is the rest of a value this reader cannot split into those parts. A * string left open runs to the end of the value, as CSS syntax closes it. */ export declare function readContent(content: string, host: Element): ContentReading; /** An element's computed style, projected onto the allowlist. */ export declare function computedStyleOf(element: Element, view: Window): Record; /** * Text is carried on a synthetic node rather than merged into its parent. * * `

Hello world

` has two text runs whose order matters. Folding * them into the parent's `text` would report a reordering of prose as no change. * * It carries the parent's owner chain, because that is whose chain it is — React * attaches no fiber expando to a text node, but the component that rendered the * element rendered its text too. Without this, every text delta lands in * `unattributed` and cannot be grouped with the element delta that caused it, * which turns one root into several. */ export declare function textNode(text: string, provenance: Provenance | undefined): RawNode; //# sourceMappingURL=generated-box.d.ts.map