@webmate-studio/builder 0.2.110 → 0.2.113

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmate-studio/builder",
3
- "version": "0.2.110",
3
+ "version": "0.2.113",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -34,6 +34,7 @@ function generateSemanticColorUtilities(tokens) {
34
34
  'infoLight': 'info-light',
35
35
 
36
36
  // Base semantic colors (use prefixed names to avoid conflicts)
37
+ 'bgBody': 'bg-body',
37
38
  'bgBase': 'bg-default',
38
39
  'bgElevated': 'bg-elevated',
39
40
  'bgLifted': 'bg-lifted',
@@ -217,6 +218,7 @@ export const defaultDesignTokens = {
217
218
  infoLight: '#dbeafe',
218
219
 
219
220
  // Background Colors (Semantic)
221
+ bgBody: '#ffffff', // Page/body background
220
222
  bgBase: '#ffffff',
221
223
  bgElevated: '#f9fafb',
222
224
  bgLifted: '#ffffff',
@@ -648,6 +650,7 @@ export function generateTailwindV4Theme(tokens) {
648
650
  if (tokens.colors.infoLight) lines.push(` --color-info-light: ${tokens.colors.infoLight};`);
649
651
 
650
652
  // Background colors (Semantic)
653
+ if (tokens.colors.bgBody) lines.push(` --color-bg-body: ${tokens.colors.bgBody};`);
651
654
  if (tokens.colors.bgBase) lines.push(` --color-bg-base: ${tokens.colors.bgBase};`);
652
655
  if (tokens.colors.bgElevated) lines.push(` --color-bg-elevated: ${tokens.colors.bgElevated};`);
653
656
  if (tokens.colors.bgLifted) lines.push(` --color-bg-lifted: ${tokens.colors.bgLifted};`);
@@ -871,14 +874,17 @@ export function generateTailwindV4Theme(tokens) {
871
874
 
872
875
  // Global styles (MUST be outside @theme block)
873
876
  let globalStyles = `
874
- /* Global baseline font */
877
+ /* Global baseline styles */
875
878
  body {
876
879
  font-family: var(--font-body);
880
+ background-color: var(--color-bg-body, var(--color-bg-base, #ffffff));
877
881
  }`;
878
882
 
879
883
  // Generate utility classes for text styles
884
+ // IMPORTANT: Wrap in @layer components so color utilities (@layer utilities) can override textColor
880
885
  if (tokens.textStyles) {
881
886
  globalStyles += '\n\n/* Text Style Utilities */';
887
+ globalStyles += '\n@layer components {';
882
888
  for (const [styleName, style] of Object.entries(tokens.textStyles)) {
883
889
  const kebabName = styleName
884
890
  .replace(/([A-Z])/g, '-$1')
@@ -914,9 +920,11 @@ body {
914
920
  }
915
921
  globalStyles += `\n}`;
916
922
  }
923
+ globalStyles += '\n}'; // Close @layer components for base text styles
917
924
 
918
925
  // Generate responsive variants (sm:, md:, lg:, xl:, 2xl:) for Tailwind compatibility
919
926
  // These allow switching to a different text style at a breakpoint: class="text-body lg:text-lead"
927
+ // IMPORTANT: @layer must be INSIDE @media for proper cascade behavior
920
928
  const breakpointKeys = ['sm', 'md', 'lg', 'xl', '2xl'];
921
929
  const breakpointValues = {
922
930
  sm: '640px',
@@ -927,6 +935,8 @@ body {
927
935
  };
928
936
 
929
937
  for (const bp of breakpointKeys) {
938
+ globalStyles += `\n@media (min-width: ${breakpointValues[bp]}) {`;
939
+ globalStyles += `\n@layer components {`;
930
940
  for (const [styleName, style] of Object.entries(tokens.textStyles)) {
931
941
  const kebabName = styleName
932
942
  .replace(/([A-Z])/g, '-$1')
@@ -937,7 +947,6 @@ body {
937
947
 
938
948
  // Generate Tailwind-compatible breakpoint class: md:text-body
939
949
  // Apply ALL properties of the text style, not just responsive values
940
- globalStyles += `\n@media (min-width: ${breakpointValues[bp]}) {`;
941
950
  globalStyles += `\n .${bp}\\:${className} {`;
942
951
 
943
952
  // Font family
@@ -981,8 +990,9 @@ body {
981
990
  }
982
991
 
983
992
  globalStyles += `\n }`;
984
- globalStyles += `\n}`;
985
993
  }
994
+ globalStyles += '\n}'; // Close @layer components
995
+ globalStyles += '\n}'; // Close @media
986
996
  }
987
997
  }
988
998
 
@@ -1210,11 +1220,12 @@ export function generateCSSFromTokens(tokens) {
1210
1220
 
1211
1221
  lines.push('}');
1212
1222
 
1213
- // Add global body font-family as baseline
1223
+ // Add global body styles as baseline
1214
1224
  lines.push('');
1215
- lines.push('/* Global baseline font */');
1225
+ lines.push('/* Global baseline styles */');
1216
1226
  lines.push('body {');
1217
1227
  lines.push(' font-family: var(--font-body);');
1228
+ lines.push(' background-color: var(--color-bg-body, var(--color-bg-base, #ffffff));');
1218
1229
  lines.push('}');
1219
1230
 
1220
1231
  // Generate utility classes for text styles