@webmate-studio/builder 0.2.72 → 0.2.74

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.72",
3
+ "version": "0.2.74",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -514,6 +514,7 @@ export const defaultDesignTokens = {
514
514
  */
515
515
  export function generateTailwindV4Theme(tokens) {
516
516
  const lines = [];
517
+ const responsiveLines = {}; // { sm: [...], md: [...], lg: [...], xl: [...], '2xl': [...] }
517
518
 
518
519
  // Colors - Map to Tailwind v4 CSS variables
519
520
  if (tokens.colors) {
@@ -629,6 +630,13 @@ export function generateTailwindV4Theme(tokens) {
629
630
  if (style.fontSize.base) {
630
631
  lines.push(` --text-${kebabName}-font-size: ${style.fontSize.base};`);
631
632
  }
633
+ // Responsive: breakpoint values
634
+ for (const [breakpoint, value] of Object.entries(style.fontSize)) {
635
+ if (breakpoint !== 'base' && value) {
636
+ responsiveLines[breakpoint] = responsiveLines[breakpoint] || [];
637
+ responsiveLines[breakpoint].push(` --text-${kebabName}-font-size: ${value};`);
638
+ }
639
+ }
632
640
  } else {
633
641
  // Simple value
634
642
  lines.push(` --text-${kebabName}-font-size: ${style.fontSize};`);
@@ -641,6 +649,13 @@ export function generateTailwindV4Theme(tokens) {
641
649
  if (style.lineHeight.base) {
642
650
  lines.push(` --text-${kebabName}-line-height: ${style.lineHeight.base};`);
643
651
  }
652
+ // Responsive: breakpoint values
653
+ for (const [breakpoint, value] of Object.entries(style.lineHeight)) {
654
+ if (breakpoint !== 'base' && value) {
655
+ responsiveLines[breakpoint] = responsiveLines[breakpoint] || [];
656
+ responsiveLines[breakpoint].push(` --text-${kebabName}-line-height: ${value};`);
657
+ }
658
+ }
644
659
  } else {
645
660
  lines.push(` --text-${kebabName}-line-height: ${style.lineHeight};`);
646
661
  }
@@ -652,6 +667,13 @@ export function generateTailwindV4Theme(tokens) {
652
667
  if (style.letterSpacing.base) {
653
668
  lines.push(` --text-${kebabName}-letter-spacing: ${style.letterSpacing.base};`);
654
669
  }
670
+ // Responsive: breakpoint values
671
+ for (const [breakpoint, value] of Object.entries(style.letterSpacing)) {
672
+ if (breakpoint !== 'base' && value) {
673
+ responsiveLines[breakpoint] = responsiveLines[breakpoint] || [];
674
+ responsiveLines[breakpoint].push(` --text-${kebabName}-letter-spacing: ${value};`);
675
+ }
676
+ }
655
677
  } else {
656
678
  lines.push(` --text-${kebabName}-letter-spacing: ${style.letterSpacing};`);
657
679
  }
@@ -836,47 +858,19 @@ body {
836
858
  }
837
859
 
838
860
  // Add responsive media queries for textStyles (OUTSIDE @theme block!)
839
- if (tokens.textStyles) {
840
- const breakpointKeys = ['sm', 'md', 'lg', 'xl', '2xl'];
841
- const breakpointValues = {
842
- sm: '640px',
843
- md: '768px',
844
- lg: '1024px',
845
- xl: '1280px',
846
- '2xl': '1536px'
847
- };
848
-
849
- for (const bp of breakpointKeys) {
850
- const mediaQueryLines = [];
851
-
852
- for (const [styleName, style] of Object.entries(tokens.textStyles)) {
853
- const kebabName = styleName
854
- .replace(/([A-Z])/g, '-$1')
855
- .replace(/(\d+)/g, '-$1')
856
- .toLowerCase()
857
- .replace(/^-/, '');
858
-
859
- // Font size
860
- if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
861
- mediaQueryLines.push(` --text-${kebabName}-font-size: ${style.fontSize[bp]};`);
862
- }
863
-
864
- // Line height
865
- if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
866
- mediaQueryLines.push(` --text-${kebabName}-line-height: ${style.lineHeight[bp]};`);
867
- }
868
-
869
- // Letter spacing
870
- if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
871
- mediaQueryLines.push(` --text-${kebabName}-letter-spacing: ${style.letterSpacing[bp]};`);
872
- }
873
- }
861
+ const breakpointValues = {
862
+ sm: '640px',
863
+ md: '768px',
864
+ lg: '1024px',
865
+ xl: '1280px',
866
+ '2xl': '1536px'
867
+ };
874
868
 
875
- if (mediaQueryLines.length > 0) {
876
- globalStyles += `\n\n@media (min-width: ${breakpointValues[bp]}) {\n :root {\n`;
877
- globalStyles += mediaQueryLines.join('\n');
878
- globalStyles += '\n }\n}';
879
- }
869
+ for (const [bp, minWidth] of Object.entries(breakpointValues)) {
870
+ if (responsiveLines[bp] && responsiveLines[bp].length > 0) {
871
+ globalStyles += `\n\n@media (min-width: ${minWidth}) {\n :root {\n`;
872
+ globalStyles += responsiveLines[bp].join('\n');
873
+ globalStyles += '\n }\n}';
880
874
  }
881
875
  }
882
876