@osaedasia/oresume
Version:
A user-friendly library for generating complete Single Page Applications (SPAs)
55 lines (54 loc) • 2.08 kB
TypeScript
import { BaseTheme } from "../../domain/definitions/types/theme/BaseTheme";
import { CSSProperties } from "../../domain/definitions/types/theme/CSSProperties";
/**
* Represents a CSS theme with a set of properties and a base theme name.
* Provides functionality to generate and manage CSS content dynamically.
* @template PropName A string type representing the names of the theme's properties.
*/
export declare class Theme<PropName extends string> {
/**
* The generated CSS content as a string containing all theme properties.
*/
readonly cssContent: string;
/**
* The base theme identifier.
*/
private readonly _name;
/**
* Collection of CSS properties mapped to their corresponding values.
*/
private readonly _properties;
/**
* Array of property names from the CSS properties collection.
*/
private readonly _propertiesKeys;
/**
* Creates a new Theme instance.
* @param {BaseTheme<string>} name The base theme identifier.
* @param {CSSProperties<PropName>} properties The CSS properties for this theme.
*/
constructor(name: BaseTheme<string>, properties: CSSProperties<PropName>);
/**
* @returns {BaseTheme<string>} The theme's identifier.
*/
get name(): BaseTheme<string>;
/**
* Generates the complete CSS theme definition.
* @returns {string} The CSS theme as a class definition.
* @throws {InvalidThemePropertyError} If required properties are missing.
*/
private _generateTheme;
/**
* Creates a CSS custom property string.
* @param {PropName} propertyName The CSS property name.
* @param {CSSProperty} specs The property specifications.
* @returns {string} The formatted CSS custom property.
*/
private _generateCSSForProperty;
/**
* Validates the existence of a theme property.
* @param {PropName | string} key The property key to validate.
* @throws {MissingThemePropertyError} If the property doesn't exist in the theme.
*/
private _validateThemeProperty;
}