@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
43 lines • 1.75 kB
text/typescript
import * as React from 'react';
import { type UseCopierOpts } from "../useCopier/index.mjs";
import type { Fallbacks, VariantCode, VariantSource } from "../CodeHighlighter/types.mjs";
import type { FallbackNode } from "../CodeHighlighter/fallbackFormat.mjs";
import { type MarkdownFile } from "./generateVariantMarkdown.mjs";
import type { TransformedFiles } from "./useCodeUtils.mjs";
interface UseCopyFunctionalityProps {
selectedFile: VariantSource | null;
selectedVariant: VariantCode | null;
transformedFiles: TransformedFiles | undefined;
/**
* Per-file fallbacks for the selected variant (keyed by file name). Used as
* the DEFLATE dictionary to decode `hastCompressed` sources back to text.
*/
fallbacks?: Fallbacks;
/** Fallback for the single selected file (the dictionary for `selectedFile`). */
selectedFileFallback?: FallbackNode[];
/** Title used as the heading for the Markdown copy. */
title?: string;
copyOpts?: UseCopierOpts;
}
export interface UseCopyFunctionalityResult {
copy: (event: React.MouseEvent<Element>) => Promise<void>;
/**
* Copies all files in the current variant to the clipboard as a Markdown
* snippet (heading + per-file fenced code blocks).
*/
copyMarkdown: (event: React.MouseEvent<Element>) => Promise<void>;
}
export declare function collectVariantFiles(selectedVariant: VariantCode | null, transformedFiles: TransformedFiles | undefined, fallbacks?: Fallbacks): MarkdownFile[];
/**
* Hook for managing copy-to-clipboard functionality
*/
export declare function useCopyFunctionality({
selectedFile,
selectedVariant,
transformedFiles,
fallbacks,
selectedFileFallback,
title,
copyOpts
}: UseCopyFunctionalityProps): UseCopyFunctionalityResult;
export {};