Skip to content

Commit c6dfb10

Browse files
committed
refactor(theme): remove root
1 parent ee81a8a commit c6dfb10

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

core/src/utils/theme.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ export const generateComponentsThemeCSS = (components: any): string => {
383383
const vars = generateCSSVars(componentTokens, `--${componentTag}-`);
384384

385385
const componentBlock = `
386-
${CSS_ROOT_SELECTOR} ${componentTag} {
386+
${componentTag} {
387387
${vars}
388388
}
389389
`;
@@ -407,7 +407,7 @@ export const applyComponentsTheme = (theme: any): any => {
407407

408408
// grab all the default components from theme
409409
const { components } = theme;
410-
410+
411411
// check if there is no components then return
412412
if (!components) {
413413
return '';
@@ -513,7 +513,7 @@ export const mix = (baseColor: string, mixColor: string, weight: string): string
513513

514514
/**
515515
* Converts a string to kebab-case
516-
*
516+
*
517517
* @param str The string to convert (e.g., 'IonChip')
518518
* @returns The kebab-case string (e.g., 'ion-chip')
519519
*/
@@ -531,14 +531,14 @@ const checkThemeValidity = (theme: any, source: string): boolean => {
531531
console.warn(`${source}: Invalid theme object provided`, theme);
532532
return false;
533533
}
534-
534+
535535
if (Object.keys(theme).length === 0) {
536536
console.warn(`${source}: Empty theme object provided`);
537537
return false;
538538
}
539539

540540
return true;
541-
}
541+
};
542542

543543
/**
544544
* Mimics the Sass `rgba` function logic to construct CSS rgba() values.
@@ -560,15 +560,9 @@ export function rgba(colorRgb: string, alpha: number | string): string {
560560
* @param subtle If true, uses the '--ion-color-subtle-' prefix.
561561
* @returns A string containing the CSS value (e.g., 'var(--ion-color-primary)' or 'rgba(var(--ion-color-primary-rgb), 0.16)').
562562
*/
563-
export function currentColor(
564-
variation: string,
565-
alpha: number | string | null = null,
566-
subtle: boolean = false
567-
): string {
563+
export function currentColor(variation: string, alpha: number | string | null = null, subtle: boolean = false): string {
568564
// 1. Determine the base CSS variable name
569-
const variable = subtle
570-
? `--ion-color-subtle-${variation}`
571-
: `--ion-color-${variation}`;
565+
const variable = subtle ? `--ion-color-subtle-${variation}` : `--ion-color-${variation}`;
572566

573567
// 2. Handle the case where no alpha is provided
574568
if (alpha === null) {
@@ -586,11 +580,11 @@ export function currentColor(
586580

587581
/**
588582
* Mimics the CSS `clamp` function logic.
589-
*
583+
*
590584
* @param min The minimum value
591585
* @param val The preferred value
592586
* @param max The maximum value
593-
* @returns
587+
* @returns
594588
*/
595589
export function clamp(min: number | string, val: number | string, max: number | string): string {
596590
return `clamp(${min}, ${val}, ${max})`;

0 commit comments

Comments
 (0)