/** * This must be imported standalone for downstream treeshaking to work. */ import '../../utils/languages'; import { BoxOwnProps, CopyButtonProps, PolymorphicComponentProps } from '@stoplight/mosaic'; import * as React from 'react'; import { CodeViewerLanguage } from '../../utils'; declare type CodeViewerBaseProps = { value: string; showLineNumbers?: boolean; showMaxLines?: number; title?: string; noCopyButton?: boolean; /** * Props to pass to the inner code container */ innerProps?: BoxOwnProps; /** * Defaults to 500 */ maxHeight?: string; /** * Applied to the innermost highlight container */ highlightPadding?: { x: number; y: number; }; }; declare type CodeViewerWithLanguage = CodeViewerBaseProps & { language: CodeViewerLanguage; customLanguage?: never; }; declare type CodeViewerWithCustomLanguage = CodeViewerBaseProps & { customLanguage: string; language?: never; }; export declare type CodeViewerOwnProps = CodeViewerWithLanguage | CodeViewerWithCustomLanguage; export declare type CodeViewerProps = PolymorphicComponentProps; export declare const DEFAULT_HIGHLIGHT_PADDING: { x: number; y: number; }; export declare const CODE_LINE_HEIGHT = 21; export declare const CodeViewer: (props: CodeViewerProps) => React.ReactElement | null; export declare const useHighlight: ({ value, language, showLineNumbers, showMaxLines, style: propStyle, }: { value: string; language?: CodeViewerLanguage | string; showLineNumbers?: boolean; showMaxLines?: number; style?: React.CSSProperties; }) => { pad: number; lines: number; gutterWidth: number; renderHighlight: () => JSX.Element; code: string; }; export declare const HighlightCodeFallback: ({ lines, highlightPadding, }: { lines?: number; highlightPadding?: CodeViewerOwnProps['highlightPadding']; }) => JSX.Element; export declare const CodeContainer: React.NamedExoticComponent; } & import("@stoplight/mosaic").BorderWidthProps & import("@stoplight/mosaic").BorderRoundedProps & import("@stoplight/mosaic").IRingProps & import("@stoplight/mosaic").IInteractivityProps & import("@stoplight/mosaic").IFlexProps & import("@stoplight/mosaic").IPositionProps & import("@stoplight/mosaic").TransformProps & import("@stoplight/mosaic").ILayoutProps & import("@stoplight/mosaic").DatasetProps & { as?: React.ElementType; className?: string; role?: string; noFocusRing?: boolean; children?: React.ReactNode; } & Omit & { renderHighlight: () => JSX.Element; showAsRaw?: boolean; maxHeight?: number; innerProps?: CodeViewerOwnProps['innerProps']; language?: CodeViewerLanguage | string; lines?: number; copyValue?: string; highlightPadding?: CodeViewerOwnProps['highlightPadding']; }>; export declare const CornerCopyButton: (props: CopyButtonProps) => JSX.Element; export {};