@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
27 lines • 1.29 kB
TypeScript
import { Code } from "./types.js";
/**
* Determines if all code variants are fully loaded and ready to render the complete content component.
*
* This function validates that we have all necessary data to transition from fallback/loading state
* to the full interactive code highlighter. It checks both main files and extra files for all variants.
*
* Used primarily to determine when to show the full Content component instead of ContentLoading
* fallback, ensuring a smooth user experience without rendering errors.
*
* @param variants - Array of variant names that must all be ready (e.g., ['javascript', 'typescript'])
* @param code - The code object containing variant data
* @param needsHighlight - Whether all sources need to be syntax highlighted (hast nodes, not strings)
* @returns True if all variants and their files are loaded and ready for full rendering
*
* @example
* ```typescript
* const readyForContent = hasAllVariants(['js', 'ts'], codeData, true);
*
* if (readyForContent) {
* return <Content {...contentProps} />; // Full interactive component
* } else {
* return <ContentLoading {...loadingProps} />; // Fallback state
* }
* ```
*/
export declare function hasAllVariants(variants: string[], code: Code, needsHighlight?: boolean): boolean;