import * as react from 'react'; import { AIMarkdownMetadata, AIMarkdownProps, AIMarkdownTypographyProps, AIMarkdownExtraStylesComponent, AIMarkdownBehaviorProps } from '@ai-react-markdown/core'; /** * Mantine-specific type definitions and defaults: the `codeBlock` behavior * group and the metadata extension point. * * @module defs */ /** * Code block rendering options (the mantine `codeBlock` behavior group). * * v2 transport: passed as the flat `codeBlock` prop on `MantineAIMarkdown` * (group value replaces atomically) and read through * `useMantineCodeBlockOptions()`, which applies the defaults below inside * the hook — the single place defaults live at read time. */ interface MantineCodeBlockOptions { /** * Whether code blocks start in their expanded state. * When `false`, long code blocks are collapsed with an expand button. * * @default true */ defaultExpanded: boolean; /** * When `true`, uses `highlight.js` auto-detection to determine the language * of code blocks that lack an explicit language annotation. * * @default false */ autoDetectUnknownLanguage: boolean; /** Format JSON for display without changing numeric literals. @default true */ formatJson?: boolean; /** Expand string values containing JSON objects/arrays for display. @default true */ expandNestedJson?: boolean; /** Coalesce appended code display updates while streaming. Completion, * replacement and language changes update immediately; copy uses latest * source. Set 0 for every update. @default 50 */ highlightIntervalMs?: number; } /** Shipped defaults for the `codeBlock` behavior group. */ declare const defaultMantineCodeBlockOptions: Readonly; /** * Metadata type for the Mantine integration. * * Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point * so that consumers can augment metadata in Mantine-specific wrappers without * needing to reference the core type directly. */ interface MantineAIMarkdownMetadata extends AIMarkdownMetadata { } /** * Props for the {@link MantineAIMarkdown} component. * * Extends {@link AIMarkdownProps} with the mantine behavior groups. * All core props (`content`, `streaming`, `fontSize`, `enginePlugins`, etc.) * are inherited. * * @typeParam TMetadata - Metadata type, defaults to {@link MantineAIMarkdownMetadata}. */ interface MantineAIMarkdownProps extends AIMarkdownProps { /** * Code-block behavior group (Behaviors system). The group value replaces * atomically; omitted fields resolve to the shipped defaults inside * `useMantineCodeBlockOptions()`. `null` counts as absent. When absent, * this wrapper contributes NO `codeBlock` group, so a group provided by * an outer app-level `AIMarkdownBehaviorsProvider` passes through; when * present, this prop wins over any outer group (inner-wins merge). */ codeBlock?: Partial; } /** * Inner (non-memoized) implementation of the Mantine AI markdown component. * * Merges caller-provided `customComponents` with the Mantine defaults (the caller's * overrides take precedence). Automatically resolves the color scheme from Mantine's * `useComputedColorScheme` when no explicit `colorScheme` prop is provided. * * @typeParam TMetadata - Metadata type. */ declare const MantineAIMarkdownComponent: ({ Typography, ExtraStyles, customComponents, colorScheme, codeBlock, ...props }: MantineAIMarkdownProps) => react.JSX.Element; declare const _default: typeof MantineAIMarkdownComponent; /** * Mantine-themed typography wrapper for AI markdown content. * * Replaces the core default typography component with Mantine's `` * element, applying the configured `fontSize` at full width. This ensures all * rendered markdown inherits Mantine's font family, line height, and theming. * * Used as the default `Typography` prop in {@link MantineAIMarkdown}. * Can be replaced by passing a custom `Typography` component. * * @param props - Standard {@link AIMarkdownTypographyProps} from the core package. */ declare const MantineAIMarkdownTypography: react.MemoExoticComponent<({ children, fontSize, style }: AIMarkdownTypographyProps) => react.JSX.Element>; /** * Default extra styles wrapper for the Mantine integration. * * Wraps markdown content in a `
` with the `aim-mantine-extra-styles` CSS class, * which provides Mantine-compatible typography overrides including: * - Relative `em`-based Mantine spacing and font-size CSS custom properties * - Heading, list, paragraph, blockquote, and code styling * - Definition list layout * * Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}. */ declare const MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent; /** * Narrow hook for the mantine `codeBlock` behavior group. * * This is THE single type-assertion site for the group (the pattern that * retires the public caller-asserted `TConfig` generic): the opaque * extension record from `useAIMarkdownBehaviors()` is narrowed here, and * group defaults are applied here — read sites must consume this hook and * never re-apply defaults with bare `??` (multiple read sites duplicating * defaults will drift). * * @module hooks/useMantineCodeBlockOptions */ /** * Read the resolved code-block options from the behaviors context. * * Group values replace atomically at the transport layer; defaults are * filled in here, so a partial group (e.g. `codeBlock={{ defaultExpanded: * false }}`) resolves the omitted fields to the shipped defaults. * * Must be called inside a `` (or any `` * wrapped in the mantine Provider stack) — throws outside, same contract * as the core narrow hooks. */ declare function useMantineCodeBlockOptions(): Required; /** * Loads mermaid and highlight.js ahead of time. Both are imported on demand * by the code-block renderers (the first diagram / the first auto-detected * block pays the download); an app that would rather take that cost at * startup — a documentation page whose first screen shows a diagram, say — * calls this once at boot. Safe to call repeatedly; failures are swallowed * (the renderers will simply load lazily later). */ declare function preloadMantineCodeAssets(): Promise; /** * Widened `define*` factory for the mantine wrapper (EXECUTION-PLAN §4 * item 8): identity + mantine prop types + freeze, zero logic. Core * factories accept core fields only — passing `codeBlock` to core's * `defineBehaviors` is a TS error; this widened factory is the wrapper's * one-line obligation. * * @module define */ /** Behavior-system props packagable at integration time, mantine-widened. */ interface MantineBehaviorProps extends AIMarkdownBehaviorProps { /** The mantine `codeBlock` behavior group (atomic replacement; defaults applied at read time). */ codeBlock?: Partial; } /** Freeze a mantine behaviors fragment. Identity + types + freeze; zero logic. */ declare function defineMantineBehaviors(values: MantineBehaviorProps): Readonly; /** * Typed wrapper around the core {@link useAIMarkdownMetadata} hook. * * Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}. * Accepts an optional generic parameter for further extension. * * Metadata lives in a separate React context from the render state, meaning * metadata updates do not trigger re-renders in components that only consume * render state. * * Must be called inside a component rendered within the `` tree. * * @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}). * @returns The current metadata, or `undefined` if none was provided. * * @example * ```tsx * function MyComponent() { * const metadata = useMantineAIMarkdownMetadata(); * // Access Mantine-specific metadata fields * } * ``` */ declare const useMantineAIMarkdownMetadata: () => TMetadata | undefined; export { MantineAIMDefaultExtraStyles, type MantineAIMarkdownMetadata, type MantineAIMarkdownProps, MantineAIMarkdownTypography, type MantineBehaviorProps, type MantineCodeBlockOptions, _default as default, defaultMantineCodeBlockOptions, defineMantineBehaviors, preloadMantineCodeAssets, useMantineAIMarkdownMetadata, useMantineCodeBlockOptions };