import * as React from "react"; /** Light/dark presentation mode forwarded to extension-owned renderers. */ export type CodeBlockMode = "light" | "dark"; /** Framework-neutral input for an extension-owned syntax renderer. */ export interface CodeSyntaxRendererProps { code: string; language: string; mode: CodeBlockMode; } /** Framework-neutral input for an extension-owned diagram renderer. */ export interface CodeDiagramRendererProps { code: string; language: string; mode: CodeBlockMode; className?: string; } /** Optional rich rendering capabilities supplied outside core. */ export interface CodeBlockRenderers { syntax?: React.ComponentType | null; diagram?: React.ComponentType | null; } /** Props accepted by {@link CodeBlockRendererProvider}. */ export interface CodeBlockRendererProviderProps { renderers: CodeBlockRenderers; children: React.ReactNode; } /** Provide extension-owned syntax and diagram renderers to a React subtree. */ export declare function CodeBlockRendererProvider({ renderers, children, }: CodeBlockRendererProviderProps): React.ReactElement; /** Props accepted by ``. */ export interface CodeBlockProps { /** The source code to render. */ code: string; /** Language id exposed to the plain surface or injected renderer. */ language?: string; /** Additional class names for the outer container. */ className?: string; /** Render inside a collapsible shell (header stays, body toggles). */ collapsible?: boolean; /** When `collapsible`, start collapsed. @default false */ defaultCollapsed?: boolean; /** * Force the renderer mode. Defaults to `ColorModeProvider` when present, * otherwise `light`. */ mode?: CodeBlockMode; /** Per-instance renderer overrides; `null` explicitly selects plain source. */ renderers?: CodeBlockRenderers; /** Override the idle copy icon in the header copy button. */ copyIcon?: React.ReactNode; /** Override the collapse chevron icon (only used when `collapsible`). */ collapseIcon?: React.ReactNode; /** * Intercept the built-in header copy. The caller runs first and must call * `next()` to actually copy. */ onCopy?: (e: React.MouseEvent, next: () => void) => void; /** * Replace the header row entirely. Receives the language label, a `copy` * trigger, and (for the collapsible variant) the `collapsed` state + a * `toggle`. When provided, the built-in header/trigger row is not rendered. */ renderHeader?: (opts: { language?: string; /** * Copy the code. Pass the click event (for example, with * `onClick={copy}`) when an `onCopy` interceptor is configured. Eventless * calls fail closed in that case because React events cannot be fabricated. */ copy: (event?: React.MouseEvent) => void; collapsed: boolean; toggle: () => void; }) => React.ReactNode; } /** Result of {@link useClipboard}: transient copy feedback and a `copy` trigger. */ export interface UseClipboardResult { /** `true` for ~2s after a successful copy. */ copied: boolean; /** `true` for ~2s after both available copy mechanisms fail. */ failed: boolean; /** Copy `text` to the clipboard (with an `execCommand` fallback). */ copy: (ownerDocument?: Document) => void; } /** Copy `text` and expose transient success or failure feedback. */ export declare function useClipboard(text: string): UseClipboardResult; /** Props accepted by {@link CopyButton}. */ export interface CopyButtonProps { /** The text copied to the clipboard on click. */ code: string; /** * Override the idle copy icon (the copied/check state is unchanged). When * omitted, the built-in {@link CopyIcon} is used. */ copyIcon?: React.ReactNode; /** * Intercept the built-in copy. The caller runs first and must call `next()` * to actually copy. When omitted, the copy happens directly. */ onCopy?: (e: React.MouseEvent, next: () => void) => void; } export declare function CopyButton({ code, copyIcon, onCopy }: CopyButtonProps): React.ReactElement; /** Props accepted by {@link CodeSurface}. */ export interface CodeSurfaceProps { /** The source code to present. */ code: string; /** Language id exposed to the plain surface or renderer. */ language: string; /** Resolved light/dark mode. */ resolvedMode: CodeBlockMode; /** Explicit extension-owned renderer; omitted or `null` renders plain source. */ renderer?: React.ComponentType | null; } /** Render through an explicit extension capability or escaped plain source. */ export declare function CodeSurface({ code, language, resolvedMode, renderer, }: CodeSurfaceProps): React.ReactElement; /** Render escaped source or delegate to explicit syntax/diagram capabilities. */ export declare function CodeBlock({ code, language, className, collapsible, defaultCollapsed, mode, renderers, copyIcon, collapseIcon, onCopy, renderHeader, }: CodeBlockProps): React.ReactElement; export declare namespace CodeBlock { var displayName: string; } //# sourceMappingURL=code-block.d.ts.map