@webmate-studio/builder 0.2.99 → 0.2.101
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 +56 -41
package/package.json
CHANGED
package/src/design-tokens.js
CHANGED
|
@@ -453,9 +453,6 @@ export const defaultDesignTokens = {
|
|
|
453
453
|
}
|
|
454
454
|
},
|
|
455
455
|
|
|
456
|
-
// Base spacing unit - Tailwind berechnet p-1, p-2, p-4 etc. automatisch
|
|
457
|
-
spacing: '0.25rem', // 4px base unit (Tailwind default)
|
|
458
|
-
|
|
459
456
|
// Base border width
|
|
460
457
|
borderWidth: '1px',
|
|
461
458
|
|
|
@@ -799,11 +796,6 @@ export function generateTailwindV4Theme(tokens) {
|
|
|
799
796
|
}
|
|
800
797
|
}
|
|
801
798
|
|
|
802
|
-
// Spacing base
|
|
803
|
-
if (tokens.spacing) {
|
|
804
|
-
lines.push(` --spacing: ${tokens.spacing};`);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
799
|
// Border width base
|
|
808
800
|
if (tokens.borderWidth) {
|
|
809
801
|
lines.push(` --border-width: ${tokens.borderWidth};`);
|
|
@@ -919,6 +911,49 @@ body {
|
|
|
919
911
|
}
|
|
920
912
|
globalStyles += `\n}`;
|
|
921
913
|
}
|
|
914
|
+
|
|
915
|
+
// Generate responsive variants (sm:, md:, lg:, xl:, 2xl:) for Tailwind compatibility
|
|
916
|
+
const breakpointKeys = ['sm', 'md', 'lg', 'xl', '2xl'];
|
|
917
|
+
const breakpointValues = {
|
|
918
|
+
sm: '640px',
|
|
919
|
+
md: '768px',
|
|
920
|
+
lg: '1024px',
|
|
921
|
+
xl: '1280px',
|
|
922
|
+
'2xl': '1536px'
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
for (const bp of breakpointKeys) {
|
|
926
|
+
for (const [styleName, style] of Object.entries(tokens.textStyles)) {
|
|
927
|
+
const kebabName = styleName
|
|
928
|
+
.replace(/([A-Z])/g, '-$1')
|
|
929
|
+
.replace(/(\d+)/g, '-$1')
|
|
930
|
+
.toLowerCase()
|
|
931
|
+
.replace(/^-/, '');
|
|
932
|
+
const className = `text-${kebabName}`;
|
|
933
|
+
const hasResponsive = (
|
|
934
|
+
(style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) ||
|
|
935
|
+
(style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) ||
|
|
936
|
+
(style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp])
|
|
937
|
+
);
|
|
938
|
+
|
|
939
|
+
if (hasResponsive) {
|
|
940
|
+
// Generate Tailwind-compatible breakpoint class: md:text-body
|
|
941
|
+
globalStyles += `\n@media (min-width: ${breakpointValues[bp]}) {`;
|
|
942
|
+
globalStyles += `\n .${bp}\\:${className} {`;
|
|
943
|
+
if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
|
|
944
|
+
globalStyles += `\n font-size: ${style.fontSize[bp]};`;
|
|
945
|
+
}
|
|
946
|
+
if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
|
|
947
|
+
globalStyles += `\n line-height: ${style.lineHeight[bp]};`;
|
|
948
|
+
}
|
|
949
|
+
if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
|
|
950
|
+
globalStyles += `\n letter-spacing: ${style.letterSpacing[bp]};`;
|
|
951
|
+
}
|
|
952
|
+
globalStyles += `\n }`;
|
|
953
|
+
globalStyles += `\n}`;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
922
957
|
}
|
|
923
958
|
|
|
924
959
|
// Generate utility classes for buttons
|
|
@@ -1039,7 +1074,6 @@ export function generateTailwindConfig(tokens) {
|
|
|
1039
1074
|
fontWeight: tokens.typography?.fontWeight || {},
|
|
1040
1075
|
lineHeight: tokens.typography?.lineHeight || {},
|
|
1041
1076
|
letterSpacing: tokens.typography?.letterSpacing || {},
|
|
1042
|
-
spacing: tokens.spacing || {},
|
|
1043
1077
|
borderRadius: tokens.borderRadius || {},
|
|
1044
1078
|
boxShadow: tokens.boxShadow || {},
|
|
1045
1079
|
maxWidth: tokens.container || {}
|
|
@@ -1112,18 +1146,6 @@ export function generateCSSFromTokens(tokens) {
|
|
|
1112
1146
|
lines.push(` --tracking-${key}: ${value};`);
|
|
1113
1147
|
}
|
|
1114
1148
|
|
|
1115
|
-
// Spacing
|
|
1116
|
-
if (typeof tokens.spacing === 'object' && tokens.spacing !== null) {
|
|
1117
|
-
// Object format: { '0': '0', '1': '0.25rem', '2': '0.5rem', ... }
|
|
1118
|
-
for (const [key, value] of Object.entries(tokens.spacing)) {
|
|
1119
|
-
lines.push(` --spacing-${key.replace('.', '-')}: ${value};`);
|
|
1120
|
-
}
|
|
1121
|
-
} else if (typeof tokens.spacing === 'string') {
|
|
1122
|
-
// String format (base unit): '0.25rem' - Tailwind v4 will auto-generate scale
|
|
1123
|
-
// Output base spacing variable for Tailwind v4
|
|
1124
|
-
lines.push(` --spacing: ${tokens.spacing};`);
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
1149
|
// Container
|
|
1128
1150
|
for (const [key, value] of Object.entries(tokens.container || {})) {
|
|
1129
1151
|
lines.push(` --container-${key}: ${value};`);
|
|
@@ -1207,11 +1229,10 @@ export function generateCSSFromTokens(tokens) {
|
|
|
1207
1229
|
}
|
|
1208
1230
|
lines.push(` }`);
|
|
1209
1231
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
// Add responsive media queries for textStyles
|
|
1213
|
-
const breakpointKeys = ['md', 'lg', 'xl', '2xl'];
|
|
1232
|
+
// Generate responsive variants (md:, lg:, xl:, 2xl:) for Tailwind compatibility
|
|
1233
|
+
const breakpointKeys = ['sm', 'md', 'lg', 'xl', '2xl'];
|
|
1214
1234
|
const breakpointValues = {
|
|
1235
|
+
sm: '640px',
|
|
1215
1236
|
md: '768px',
|
|
1216
1237
|
lg: '1024px',
|
|
1217
1238
|
xl: '1280px',
|
|
@@ -1219,8 +1240,6 @@ export function generateCSSFromTokens(tokens) {
|
|
|
1219
1240
|
};
|
|
1220
1241
|
|
|
1221
1242
|
for (const bp of breakpointKeys) {
|
|
1222
|
-
const mediaQueryLines = [];
|
|
1223
|
-
|
|
1224
1243
|
for (const [styleName, style] of Object.entries(tokens.textStyles)) {
|
|
1225
1244
|
const kebabName = styleName
|
|
1226
1245
|
.replace(/([A-Z])/g, '-$1')
|
|
@@ -1235,30 +1254,26 @@ export function generateCSSFromTokens(tokens) {
|
|
|
1235
1254
|
);
|
|
1236
1255
|
|
|
1237
1256
|
if (hasResponsive) {
|
|
1238
|
-
|
|
1257
|
+
// Generate Tailwind-compatible breakpoint class: md:text-body
|
|
1258
|
+
lines.push(` .${bp}\\:${className} {`);
|
|
1259
|
+
lines.push(` @media (min-width: ${breakpointValues[bp]}) {`);
|
|
1239
1260
|
if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
|
|
1240
|
-
|
|
1261
|
+
lines.push(` font-size: ${style.fontSize[bp]};`);
|
|
1241
1262
|
}
|
|
1242
1263
|
if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
|
|
1243
|
-
|
|
1264
|
+
lines.push(` line-height: ${style.lineHeight[bp]};`);
|
|
1244
1265
|
}
|
|
1245
1266
|
if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
|
|
1246
|
-
|
|
1267
|
+
lines.push(` letter-spacing: ${style.letterSpacing[bp]};`);
|
|
1247
1268
|
}
|
|
1248
|
-
|
|
1269
|
+
lines.push(` }`);
|
|
1270
|
+
lines.push(` }`);
|
|
1249
1271
|
}
|
|
1250
1272
|
}
|
|
1251
|
-
|
|
1252
|
-
if (mediaQueryLines.length > 0) {
|
|
1253
|
-
lines.push('');
|
|
1254
|
-
lines.push(`@layer components {`);
|
|
1255
|
-
lines.push(` @media (min-width: ${breakpointValues[bp]}) {`);
|
|
1256
|
-
lines.push(...mediaQueryLines);
|
|
1257
|
-
lines.push(` }`);
|
|
1258
|
-
lines.push('}');
|
|
1259
|
-
}
|
|
1260
1273
|
}
|
|
1261
1274
|
|
|
1275
|
+
lines.push('}'); // Close @layer components
|
|
1276
|
+
|
|
1262
1277
|
// Generate markdown prose styles
|
|
1263
1278
|
lines.push('');
|
|
1264
1279
|
lines.push('/* Markdown Prose Styles */');
|