@jay-js/system
Version:
A powerful and flexible TypeScript library for UI, state management, lazy loading, routing and managing draggable elements in modern web applications.
60 lines (59 loc) • 1.93 kB
TypeScript
/**
* @file Theme Configuration
* @description Configuration options and setup for the theme management system.
*/
import type { TThemeOptions } from "../types.js";
/**
* Default theme configuration options.
*
* @type {TThemeOptions}
*/
export declare const themeOptions: TThemeOptions;
/**
* Configures the theme system with custom options and initializes the theme.
*
* This function processes the configuration to ensure a default theme exists,
* then applies the theme based on the new configuration. The defaultTheme and
* defaultDarkTheme properties are used to create a default theme definition
* if one doesn't exist.
*
* @param {Partial<TThemeOptions>} options - Custom theme options to merge with defaults
*
* @example
* // Legacy configuration - automatically creates default theme
* themeDefineOptions({
* defaultTheme: "light",
* defaultDarkTheme: "dark",
* });
* // Results in: themes: [{ id: "default", light: "light", dark: "dark" }]
*
* @example
* // Modern configuration with theme definitions
* themeDefineOptions({
* themes: [
* { id: "orange", light: "orange-light", dark: "orange-dark" },
* { id: "red", light: "volcano", dark: "cave" },
* {
* id: "blue",
* light: "skytheme",
* dark: "alaska",
* lightStyle: { "text-decoration": "underline" },
* darkStyle: { "font-size": "16px" }
* }
* ]
* });
* // Automatically adds: { id: "default", light: "light", dark: "dark" }
*
* @example
* // Mixed configuration - preserves existing default
* themeDefineOptions({
* defaultTheme: "custom-light",
* defaultDarkTheme: "custom-dark",
* themes: [
* { id: "default", light: "light", dark: "dark" },
* { id: "red", light: "volcano", dark: "cave" }
* ]
* });
* // No changes - default theme already exists
*/
export declare function themeDefineOptions(options: Partial<TThemeOptions>): void;