import type { ExampleLookup } from "../core/types.ts"; /** * A statically-recovered data value. Parsed front matter and evaluated * attribute literals are both plain data — scalars, dates, arrays, and * nested maps — never functions or class instances. */ export type EvaluatedValue = string | number | boolean | null | undefined | Date | EvaluatedValue[] | { [key: string]: EvaluatedValue; }; /** Evaluated props plus whether any attribute resisted static evaluation. */ interface EvaluatedProps { lossy: boolean; props: Record; } /** A child component extracted by name (e.g. each `` under ``). */ export interface ComponentMarkdownChild extends EvaluatedProps { /** The child's body, downleveled and dedented. */ children: string; } /** What a serializer receives for one component usage. */ export interface ComponentMarkdownContext extends EvaluatedProps { /** Direct child components of `name`, each with evaluated props and body. */ childComponents: (name: string) => ComponentMarkdownChild[]; /** The element's body, downleveled and dedented (empty if self-closing). */ children: string; /** * The page's parsed front-matter (empty when the caller has none). Lets a * serializer read page metadata directly, even when a prop expression is * not statically evaluable. */ frontmatter: Record; } /** * A component's Markdown serializer. Return the replacement Markdown, or * `null` to leave the component's JSX in the output verbatim (the safe * fallback when the props can't be recovered statically). */ export type ComponentMarkdown = (context: ComponentMarkdownContext) => string | null; /** * Build the `` serializer for a project's discovered examples. The * live preview can't survive the trip to Markdown, so the agent-facing output * carries the example's source — the same code the "Code" tab shows — as a * fenced block. An unknown `path` (or a missing `path` prop) declines, leaving * the JSX verbatim, mirroring the "no example found" note the component renders * on the page. */ export declare const exampleComponentSerializers: (examples: ExampleLookup) => { Component: ({ props }: ComponentMarkdownContext) => string | null; }; /** * Downlevel supported components in an MDX source to plain Markdown. Sources * with no supported components — and sources Satteri can't parse as MDX, e.g. * plain `.md` with literal `<`/`{` — are returned byte-identical. * * `components` adds user serializers from `ai.markdownComponents`, layered * over the built-ins: a same-name entry replaces the built-in serializer, and * one that always returns `null` effectively opts that component out. * * `frontmatter` is the page's parsed front-matter data. It is put in scope * when evaluating attribute expressions — so `prop={frontmatter.status}` * resolves the way it does when Astro renders the page — and handed to * serializers on their context. */ export declare const downlevelComponents: (source: string, components?: Record, frontmatter?: Record) => string; export {};