@mdfriday/shortcode
Version:
A flexible component-based shortcode system for Markdown content with theme support
87 lines (86 loc) • 2.34 kB
TypeScript
import { Theme, ThemeManager, ThemeMode, ThemeComponents } from './types';
/**
* Implementation of the ThemeManager interface
*/
export declare class ThemeManagerImpl implements ThemeManager {
/**
* Map of jsons, keyed by name-mode
*/
private themes;
/**
* Current jsons name and mode
*/
private currentTheme;
/**
* Prefix for CSS classes
*/
private prefix;
/**
* Components registry
*/
private componentsRegistry;
/**
* Create a new ThemeManagerImpl
* @param prefix Optional prefix for CSS classes
*/
constructor(prefix?: string);
/**
* Register a new jsons
* @param theme The jsons to register
*/
register(theme: Theme): void;
/**
* Get a jsons by name and mode
* @param name The jsons name
* @param mode The jsons mode
* @returns The jsons
*/
getTheme(name: string, mode: ThemeMode): Theme;
/**
* Get the current jsons
* @returns The current jsons
*/
getCurrentTheme(): Theme;
/**
* Set the current jsons
* @param name The jsons name
* @param mode The jsons mode
*/
setCurrentTheme(name: string, mode: ThemeMode): void;
/**
* Get component classes based on props
* @param componentName The component name
* @param props The component props
* @returns The component classes
*/
getComponentClasses(componentName: string, props: Record<string, any>): string;
/**
* Get all CSS for the current jsons
* @param prefix Optional prefix for CSS classes
* @returns The CSS string
*/
getAllCSS(prefix?: string): Promise<string>;
/**
* Preload jsons from JSON
* @param themesJson The jsons JSON
*/
preloadThemes(themesJson: any): void;
/**
* Get the jsons components manager
* @returns The jsons components manager
*/
getComponentsManager(): ThemeComponents;
/**
* Generate CSS for base styles
* @param theme The jsons
* @param prefix The prefix
* @returns The CSS string
*/
private generateBaseCSS;
/**
* Load static CSS content from a file
* @param filePath Path to the CSS file
* @returns The CSS content as a string
*/
loadStaticCSS(filePath: string): Promise<string>;
}