@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.45 → 0.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to the stan-design theme package will be documented in this file.
4
4
 
5
- ## [0.2.45] - 2025-10-07
5
+ ## [0.2.47] - 2025-10-07
6
6
 
7
7
  ### Added
8
8
  - Initial release of stan-design theme package
@@ -1 +1 @@
1
- {"version":3,"file":"theme-css-generator.d.ts","sourceRoot":"","sources":["../../src/plugins/theme-css-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,MAAM,CA2VlD"}
1
+ {"version":3,"file":"theme-css-generator.d.ts","sourceRoot":"","sources":["../../src/plugins/theme-css-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,MAAM,CA0WlD"}
@@ -83,14 +83,27 @@ export default function themeCSSGenerator() {
83
83
  css += '\n';
84
84
  return css;
85
85
  };
86
+ // Helper function to check if font is Google font
87
+ const isFontGoogleFont = (themeObj, fontKey) => {
88
+ const fonts = themeObj.fonts;
89
+ return fonts?.[fontKey]?.source?.type === 'google';
90
+ };
86
91
  // Recursively generate CSS variables from theme object
87
- const generateCSSVariables = (obj, path = []) => {
92
+ const generateCSSVariables = (obj, path = [], rootTheme) => {
88
93
  let css = '';
89
94
  if (typeof obj !== 'object' || obj === null) {
90
95
  return css;
91
96
  }
92
97
  Object.entries(obj).forEach(([key, value]) => {
93
98
  const currentPath = [...path, key];
99
+ // Skip font file paths for Google fonts
100
+ if (path.length >= 3 && path[0] === 'fonts' && path[2] === 'source' && key === 'files') {
101
+ const fontKey = path[1];
102
+ if (rootTheme && isFontGoogleFont(rootTheme, fontKey)) {
103
+ // Skip generating CSS variables for Google font files
104
+ return;
105
+ }
106
+ }
94
107
  if (typeof value === 'string' || typeof value === 'number') {
95
108
  // Generate CSS variable for primitive values
96
109
  const cssVarName = createCSSVarName(currentPath);
@@ -103,7 +116,7 @@ export default function themeCSSGenerator() {
103
116
  }
104
117
  else if (typeof value === 'object' && value !== null) {
105
118
  // Recursively process nested objects
106
- css += generateCSSVariables(value, currentPath);
119
+ css += generateCSSVariables(value, currentPath, rootTheme);
107
120
  }
108
121
  });
109
122
  return css;
@@ -126,7 +139,7 @@ export default function themeCSSGenerator() {
126
139
  // NEW: Generate breakpoint variables first
127
140
  css += generateBreakpointVariables(breakpoints);
128
141
  // Generate all other CSS variables
129
- css += generateCSSVariables(themeObj);
142
+ css += generateCSSVariables(themeObj, [], themeObj);
130
143
  css += '}\n\n';
131
144
  // Generate dark mode variables
132
145
  css += `.dark {\n`;
@@ -83,14 +83,27 @@ export default function themeCSSGenerator() {
83
83
  css += '\n';
84
84
  return css;
85
85
  };
86
+ // Helper function to check if font is Google font
87
+ const isFontGoogleFont = (themeObj, fontKey) => {
88
+ const fonts = themeObj.fonts;
89
+ return fonts?.[fontKey]?.source?.type === 'google';
90
+ };
86
91
  // Recursively generate CSS variables from theme object
87
- const generateCSSVariables = (obj, path = []) => {
92
+ const generateCSSVariables = (obj, path = [], rootTheme) => {
88
93
  let css = '';
89
94
  if (typeof obj !== 'object' || obj === null) {
90
95
  return css;
91
96
  }
92
97
  Object.entries(obj).forEach(([key, value]) => {
93
98
  const currentPath = [...path, key];
99
+ // Skip font file paths for Google fonts
100
+ if (path.length >= 3 && path[0] === 'fonts' && path[2] === 'source' && key === 'files') {
101
+ const fontKey = path[1];
102
+ if (rootTheme && isFontGoogleFont(rootTheme, fontKey)) {
103
+ // Skip generating CSS variables for Google font files
104
+ return;
105
+ }
106
+ }
94
107
  if (typeof value === 'string' || typeof value === 'number') {
95
108
  // Generate CSS variable for primitive values
96
109
  const cssVarName = createCSSVarName(currentPath);
@@ -103,7 +116,7 @@ export default function themeCSSGenerator() {
103
116
  }
104
117
  else if (typeof value === 'object' && value !== null) {
105
118
  // Recursively process nested objects
106
- css += generateCSSVariables(value, currentPath);
119
+ css += generateCSSVariables(value, currentPath, rootTheme);
107
120
  }
108
121
  });
109
122
  return css;
@@ -126,7 +139,7 @@ export default function themeCSSGenerator() {
126
139
  // NEW: Generate breakpoint variables first
127
140
  css += generateBreakpointVariables(breakpoints);
128
141
  // Generate all other CSS variables
129
- css += generateCSSVariables(themeObj);
142
+ css += generateCSSVariables(themeObj, [], themeObj);
130
143
  css += '}\n\n';
131
144
  // Generate dark mode variables
132
145
  css += `.dark {\n`;