@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
44 lines • 1.87 kB
TypeScript
import type { VariantSource, VariantCode, Code, Transforms } from "../CodeHighlighter/types.js";
interface TransformedFile {
name: string;
originalName: string;
source: VariantSource;
component: React.ReactNode;
}
export interface TransformedFiles {
files: TransformedFile[];
filenameMap: {
[originalName: string]: string;
};
}
/**
* Pure function to get available transforms from effective code data.
* Only includes transforms that have actual deltas (file changes), not just filename changes.
*
* @param effectiveCode - The effective code object containing all variants
* @param selectedVariantKey - The currently selected variant key
* @returns Array of available transform keys that have deltas
*/
export declare function getAvailableTransforms(effectiveCode: Code, selectedVariantKey: string): string[];
/**
* Pure helper function to apply transform to a source file.
*
* @param source - The source code to transform
* @param fileName - The filename for the source
* @param transforms - Available transforms for this source
* @param selectedTransform - The transform to apply
* @returns Object with transformed source and name
*/
export declare function applyTransformToSource(source: VariantSource, fileName: string, transforms: Transforms | undefined, selectedTransform: string): {
transformedSource: VariantSource;
transformedName: string;
};
/**
* Pure function to create transformed files from a variant and selected transform.
*
* @param selectedVariant - The currently selected variant
* @param selectedTransform - The transform to apply
* @returns Object with transformed files and filename mapping, or undefined if no transform
*/
export declare function createTransformedFiles(selectedVariant: VariantCode | null, selectedTransform: string | null, shouldHighlight: boolean): TransformedFiles | undefined;
export {};