@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
42 lines • 2.52 kB
text/typescript
import * as React from 'react';
import type { ChunkContentProps as CoordinatedChunkContentProps } from "../CoordinatedLazy/types.mjs";
import type { Code, CodeHighlighterBaseProps, ContentLoadingProps } from "./types.mjs";
import type { CompressedFallback } from "./fallbackFormat.mjs";
/**
* The user props the CodeHighlighter chunk threads to its content + loaders. It
* carries the isomorphic CodeHighlighter props plus the values prepared up front:
* the rendered loading `fallback`, the compressed `residualFallbacks`, and the
* resolved `initialVariant`. The content generic is erased here (`{}`); the user's
* real content props ride through `Content`/`contentProps` and are rebuilt by
* `createClientProps`.
*/
export interface CodeHighlighterChunkUserProps extends CodeHighlighterBaseProps<{}> {
ContentLoading?: React.ComponentType<ContentLoadingProps<{}>>;
/** The resolved initial variant key. */
initialVariant?: string;
/** Pre-rendered loading fallback, when an initial paint was prepared up front. */
fallback?: React.ReactNode;
/** Compressed residual fallbacks prepared alongside `fallback`. */
residualFallbacks?: CompressedFallback;
/** Globals code already resolved from string URLs to `Code`, when available. */
processedGlobalsCode?: Array<Code>;
/** Skip rendering the loading fallback on the client swap. */
skipFallback?: boolean;
}
/** Props the chunk content/loaders receive (user props + resolved `data`/`loading`). */
export type CodeHighlighterChunkContentProps = CoordinatedChunkContentProps<CodeHighlighterChunkUserProps, Code>;
/**
* The isomorphic chunk that drives `CodeHighlighter`. `CodeHighlighter` computes the
* decision inputs (`controlled`/`isInitial`/`forceClient`/`awaitServerLoad`/
* `skipInitialLoad`) and this routes via the generic chunk decision:
*
* - content / content-initial / attempt-initial-client -> render the client directly
* (it self-manages its swap).
* - server-loader -> dynamically import `CodeSourceLoader` (load all variants).
* - server-initial -> dynamically import `CodeInitialSourceLoader` (load the initial,
* then re-enter this chunk to load the full content).
*
* The `Loader`/`InitialLoader` are only imported when the decision routes to them, so
* the heavy load/parse pipeline stays off the path that renders precomputed content.
*/
export declare const CodeHighlighterChunk: React.ComponentType<import("../CoordinatedLazy/index.mjs").ChunkComponentProps<CodeHighlighterChunkUserProps, Code, never>>;