import { ComponentType, ReactNode } from 'react'; import { SpecType } from '../contexts'; import { ConfigInterface } from '../config'; export interface GenericSectionProps { /** The document. Required standalone; unnecessary (and ignored) when rendered inside the matching provider. */ document?: T; config?: ConfigInterface; } /** * Builds a `SectionRoot`: renders `children` inside the ambient document * context if there is one of the matching spec type (composed mode, e.g. * under ), otherwise resolves the `document` prop and sets * up `Provider` itself (standalone mode). Shared behind both * public/sections.tsx (AsyncAPI) and public/openapiSections.tsx (OpenAPI), * which differ only in which document provider component backs them, the * label used in messages, and the spec type they expect. * * A mismatched ambient provider (an OpenAPI section under , * or vice versa) can't supply the section's document. When that happens the * section warns, then falls back to its own `document` prop if one was given; * without one it renders under the mismatched context anyway (typically * empty) rather than crashing the tree. */ export declare function createSectionRoot(Provider: ComponentType<{ document: T; config?: ConfigInterface; children: ReactNode; }>, specLabel: string, specType: SpecType): ({ document, config, children, }: GenericSectionProps & { children: ReactNode; }) => import("react").JSX.Element;