@webmate-studio/builder 0.2.73 → 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 +1 -1
- package/src/design-tokens.js +13 -40
package/package.json
CHANGED
package/src/design-tokens.js
CHANGED
|
@@ -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) {
|
|
@@ -857,47 +858,19 @@ body {
|
|
|
857
858
|
}
|
|
858
859
|
|
|
859
860
|
// Add responsive media queries for textStyles (OUTSIDE @theme block!)
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
'2xl': '1536px'
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
for (const bp of breakpointKeys) {
|
|
871
|
-
const mediaQueryLines = [];
|
|
872
|
-
|
|
873
|
-
for (const [styleName, style] of Object.entries(tokens.textStyles)) {
|
|
874
|
-
const kebabName = styleName
|
|
875
|
-
.replace(/([A-Z])/g, '-$1')
|
|
876
|
-
.replace(/(\d+)/g, '-$1')
|
|
877
|
-
.toLowerCase()
|
|
878
|
-
.replace(/^-/, '');
|
|
879
|
-
|
|
880
|
-
// Font size
|
|
881
|
-
if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
|
|
882
|
-
mediaQueryLines.push(` --text-${kebabName}-font-size: ${style.fontSize[bp]};`);
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
// Line height
|
|
886
|
-
if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
|
|
887
|
-
mediaQueryLines.push(` --text-${kebabName}-line-height: ${style.lineHeight[bp]};`);
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
// Letter spacing
|
|
891
|
-
if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
|
|
892
|
-
mediaQueryLines.push(` --text-${kebabName}-letter-spacing: ${style.letterSpacing[bp]};`);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
861
|
+
const breakpointValues = {
|
|
862
|
+
sm: '640px',
|
|
863
|
+
md: '768px',
|
|
864
|
+
lg: '1024px',
|
|
865
|
+
xl: '1280px',
|
|
866
|
+
'2xl': '1536px'
|
|
867
|
+
};
|
|
895
868
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}
|
|
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}';
|
|
901
874
|
}
|
|
902
875
|
}
|
|
903
876
|
|