@webmate-studio/builder 0.2.73 → 0.2.75
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 +19 -41
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) {
|
|
@@ -680,7 +681,12 @@ export function generateTailwindV4Theme(tokens) {
|
|
|
680
681
|
|
|
681
682
|
// Text color (not responsive)
|
|
682
683
|
if (style.textColor) {
|
|
683
|
-
|
|
684
|
+
// Convert textColor to kebab-case (textBase -> text-base)
|
|
685
|
+
const colorKebab = style.textColor
|
|
686
|
+
.replace(/([A-Z])/g, '-$1')
|
|
687
|
+
.toLowerCase()
|
|
688
|
+
.replace(/^-/, '');
|
|
689
|
+
lines.push(` --text-${kebabName}-color: var(--color-${colorKebab});`);
|
|
684
690
|
}
|
|
685
691
|
}
|
|
686
692
|
}
|
|
@@ -857,47 +863,19 @@ body {
|
|
|
857
863
|
}
|
|
858
864
|
|
|
859
865
|
// 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
|
-
}
|
|
866
|
+
const breakpointValues = {
|
|
867
|
+
sm: '640px',
|
|
868
|
+
md: '768px',
|
|
869
|
+
lg: '1024px',
|
|
870
|
+
xl: '1280px',
|
|
871
|
+
'2xl': '1536px'
|
|
872
|
+
};
|
|
895
873
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}
|
|
874
|
+
for (const [bp, minWidth] of Object.entries(breakpointValues)) {
|
|
875
|
+
if (responsiveLines[bp] && responsiveLines[bp].length > 0) {
|
|
876
|
+
globalStyles += `\n\n@media (min-width: ${minWidth}) {\n :root {\n`;
|
|
877
|
+
globalStyles += responsiveLines[bp].join('\n');
|
|
878
|
+
globalStyles += '\n }\n}';
|
|
901
879
|
}
|
|
902
880
|
}
|
|
903
881
|
|