11import type { Color , CssClassMap } from '../interface' ;
2- import type { Theme } from '../themes/base/default.tokens' ;
32
43import { deepMerge } from './helpers' ;
54
6- // Global constants
75export const CSS_PROPS_PREFIX = '--ion-' ;
86export const CSS_ROOT_SELECTOR = ':root' ;
97
@@ -47,7 +45,7 @@ export const getClassMap = (classes: string | string[] | undefined): CssClassMap
4745 * @param prefix The CSS prefix to use (e.g., '--ion-')
4846 * @returns CSS string with custom properties
4947 */
50- const generateCSSVars = ( theme : any , prefix : string = CSS_PROPS_PREFIX ) : string => {
48+ export const generateCSSVars = ( theme : any , prefix : string = CSS_PROPS_PREFIX ) : string => {
5149 const cssProps = Object . entries ( theme )
5250 . flatMap ( ( [ key , val ] ) => {
5351 // Skip invalid keys or values
@@ -95,7 +93,7 @@ const generateCSSVars = (theme: any, prefix: string = CSS_PROPS_PREFIX): string
9593 * @param css The CSS string to inject
9694 * @param target The target element to inject into
9795 */
98- const injectCSS = ( css : string , target : Element | ShadowRoot = document . head ) => {
96+ export const injectCSS = ( css : string , target : Element | ShadowRoot = document . head ) => {
9997 const style = document . createElement ( 'style' ) ;
10098 style . innerHTML = css ;
10199 target . appendChild ( style ) ;
@@ -106,7 +104,7 @@ const injectCSS = (css: string, target: Element | ShadowRoot = document.head) =>
106104 * @param theme The theme object to generate CSS for
107105 * @returns The generated CSS string
108106 */
109- const generateGlobalThemeCSS = ( theme : Theme ) : string => {
107+ export const generateGlobalThemeCSS = ( theme : any ) : string => {
110108 if ( typeof theme !== 'object' || Array . isArray ( theme ) ) {
111109 console . warn ( 'generateGlobalThemeCSS: Invalid theme object provided' , theme ) ;
112110 return '' ;
@@ -156,7 +154,7 @@ const generateGlobalThemeCSS = (theme: Theme): string => {
156154 * @param userTheme The user's custom theme (optional)
157155 * @returns The combined theme object (or base theme if no user theme was provided)
158156 */
159- export const applyGlobalTheme = ( baseTheme : Theme , userTheme ?: any ) : any => {
157+ export const applyGlobalTheme = ( baseTheme : any , userTheme ?: any ) : any => {
160158 // If no base theme provided, error
161159 if ( typeof baseTheme !== 'object' || Array . isArray ( baseTheme ) ) {
162160 console . error ( 'applyGlobalTheme: Valid base theme object is required' , baseTheme ) ;
@@ -181,12 +179,12 @@ export const applyGlobalTheme = (baseTheme: Theme, userTheme?: any): any => {
181179/**
182180 * Generates component's themed CSS class with CSS variables
183181 * from its theme object
184- * @param theme The theme object to generate CSS for
182+ * @param componentTheme The component's object to generate CSS for (e.g., IonChip { })
185183 * @param componentName The component name without any prefixes (e.g., 'chip')
186184 * @returns string containing the component's themed CSS variables
187185 */
188- const generateComponentThemeCSS = ( theme : Theme , componentName : string ) : string => {
189- const cssProps = generateCSSVars ( theme , `${ CSS_PROPS_PREFIX } ${ componentName } -` ) ;
186+ export const generateComponentThemeCSS = ( componentTheme : any , componentName : string ) : string => {
187+ const cssProps = generateCSSVars ( componentTheme , `${ CSS_PROPS_PREFIX } ${ componentName } -` ) ;
190188
191189 return `
192190 :host(.${ componentName } -themed) {
0 commit comments