/** * @fileoverview Saasflare CodeBlock — framing UI for source-code blocks. * @author Saasflare™ * * Provides the visual chrome (filename header, language badge, copy button, * optional line numbers, scrollable container) around code. Syntax * highlighting is intentionally NOT bundled — pass pre-highlighted HTML * via the `highlighted` prop (Shiki / Prism / Highlight.js are all heavy * and opinionated) or fall back to plain monospace via the `code` prop. * * @module packages/ui/components/ui/code-block * @package ui * @layer core * * @example * // Plain (no highlighting) * * * @example * // With pre-rendered HTML from Shiki on the server. * // NOTE: `highlighted` is injected via dangerouslySetInnerHTML — it MUST be * // trusted, server-generated markup. Never pass untrusted HTML (XSS sink). * */ import * as React from "react"; import { type SaasflareComponentProps } from "../../providers"; /** Props for the CodeBlock component. */ export interface CodeBlockProps extends Omit, keyof SaasflareComponentProps>, SaasflareComponentProps { /** Plain source code (rendered as monospace, no highlighting). */ code?: string; /** * Pre-highlighted HTML — e.g. output from Shiki's `codeToHtml`. Injected * verbatim via `dangerouslySetInnerHTML`, so it MUST be trusted, * server-generated markup. Never pass untrusted/user-supplied HTML. */ highlighted?: string; /** Language label shown in the header (purely cosmetic). */ language?: string; /** Filename shown left of the language badge. */ filename?: string; /** * Show 1-based line numbers in the gutter. Only applies to the plain * `code` path; when `highlighted` HTML is supplied it owns its own * rendering and this flag is ignored. */ showLineNumbers?: boolean; /** Hide the top bar (copy button still floats inside the block). */ hideHeader?: boolean; /** Hide the copy-to-clipboard button. */ hideCopyButton?: boolean; } /** * Code block with filename header, language badge, copy button, and optional * line numbers. Highlighting is BYO (pass `highlighted` HTML or `code` text). * * @component * @layer core */ export declare function CodeBlock({ code, highlighted, language, filename, showLineNumbers, hideHeader, hideCopyButton, className, surface, radius, animated, iconWeight, ...props }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;