/** * How the Astro renderer hands an element its props, on the server and in * the browser alike. Dependency-free, so both sides import it. * * An attribute survives the trip in the HTML, and Lit reads it back into * its property when the element hydrates. A value that can't be an * attribute (an object, an array, or a property declared with * `attribute: false`) has to be set as a property instead, on the server for * the render and again in the browser before hydration, or the client's * first update would render without it and replace what the server sent. * * So an element that gets properties is rendered with `defer-hydration`, * and with {@link PROPS_ATTRIBUTE}, which says the renderer deferred it and * carries the values the browser needs. Only elements carrying it are * released by the renderer; a `defer-hydration` written by hand stays. */ /** * Marks an element the renderer deferred. Its value is the properties to * set before releasing it ({@link encodeProperties}), or empty for an * island, whose props Astro hands to the client renderer itself. */ export declare const PROPS_ATTRIBUTE = "data-lit-props"; /** The slice of a Lit element class the split reads. */ export interface PropertyDeclarations { /** `ReactiveElement.elementProperties`: options keyed by property name. */ elementProperties?: ReadonlyMap; prototype?: object; } export interface SplitProps { /** Serialized for the HTML, as Lit would read them back. */ attributes: Record; /** Set on the instance: the server's render, then the browser's. */ properties: Record; } /** * Splits the props an Astro page passes into attributes and properties. * A string, number or boolean is an attribute: under its own name, or under * the attribute of the reactive property it names (`fooBar` becomes * `foo-bar` when that is the property's attribute). `false`, `null` and * `undefined` leave it out, as Lit's boolean converter does. Anything else, * and any value for a property without an attribute or a plain class field, * is a property. */ export declare const splitProps: (ctor: PropertyDeclarations, props: Record) => SplitProps; /** * The properties for {@link PROPS_ATTRIBUTE}, for an element no island will * hand them to: plain JSON when that carries them all, else Astro's tags * for the whole object, a top-level array where plain JSON is an object. * Values neither can carry (functions, symbols, class instances, cycles) * are left out and named, for the caller to warn. */ export declare const encodeProperties: (properties: Record) => { json: string; dropped: string[]; }; /** The properties {@link encodeProperties} wrote, back as values. */ export declare const decodeProperties: (json: string) => Record; //# sourceMappingURL=props.d.ts.map