@webmate-studio/builder 0.2.100 → 0.2.102

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.100",
3
+ "version": "0.2.102",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -911,6 +911,49 @@ body {
911
911
  }
912
912
  globalStyles += `\n}`;
913
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
+ }
914
957
  }
915
958
 
916
959
  // Generate utility classes for buttons
@@ -1185,12 +1228,42 @@ export function generateCSSFromTokens(tokens) {
1185
1228
  lines.push(` color: var(${colorVar});`);
1186
1229
  }
1187
1230
  lines.push(` }`);
1188
- }
1189
- lines.push('}'); // Close @layer components
1190
1231
 
1191
- // Add responsive media queries for textStyles
1192
- const breakpointKeys = ['md', 'lg', 'xl', '2xl'];
1232
+ // Add intrinsic responsive values (if the style itself has responsive values)
1233
+ const intrinsicBreakpoints = ['sm', 'md', 'lg', 'xl', '2xl'];
1234
+ for (const bp of intrinsicBreakpoints) {
1235
+ const hasIntrinsicResponsive = (
1236
+ (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) ||
1237
+ (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) ||
1238
+ (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp])
1239
+ );
1240
+
1241
+ if (hasIntrinsicResponsive) {
1242
+ const bpValue = intrinsicBreakpoints.indexOf(bp) === 0 ? '640px' :
1243
+ intrinsicBreakpoints.indexOf(bp) === 1 ? '768px' :
1244
+ intrinsicBreakpoints.indexOf(bp) === 2 ? '1024px' :
1245
+ intrinsicBreakpoints.indexOf(bp) === 3 ? '1280px' : '1536px';
1246
+
1247
+ lines.push(` @media (min-width: ${bpValue}) {`);
1248
+ lines.push(` .${className} {`);
1249
+ if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
1250
+ lines.push(` font-size: ${style.fontSize[bp]};`);
1251
+ }
1252
+ if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
1253
+ lines.push(` line-height: ${style.lineHeight[bp]};`);
1254
+ }
1255
+ if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
1256
+ lines.push(` letter-spacing: ${style.letterSpacing[bp]};`);
1257
+ }
1258
+ lines.push(` }`);
1259
+ lines.push(` }`);
1260
+ }
1261
+ }
1262
+ }
1263
+ // Generate responsive variants (md:, lg:, xl:, 2xl:) for Tailwind compatibility
1264
+ const breakpointKeys = ['sm', 'md', 'lg', 'xl', '2xl'];
1193
1265
  const breakpointValues = {
1266
+ sm: '640px',
1194
1267
  md: '768px',
1195
1268
  lg: '1024px',
1196
1269
  xl: '1280px',
@@ -1198,8 +1271,6 @@ export function generateCSSFromTokens(tokens) {
1198
1271
  };
1199
1272
 
1200
1273
  for (const bp of breakpointKeys) {
1201
- const mediaQueryLines = [];
1202
-
1203
1274
  for (const [styleName, style] of Object.entries(tokens.textStyles)) {
1204
1275
  const kebabName = styleName
1205
1276
  .replace(/([A-Z])/g, '-$1')
@@ -1214,30 +1285,26 @@ export function generateCSSFromTokens(tokens) {
1214
1285
  );
1215
1286
 
1216
1287
  if (hasResponsive) {
1217
- mediaQueryLines.push(` .${className} {`);
1288
+ // Generate Tailwind-compatible breakpoint class: md:text-body
1289
+ lines.push(` .${bp}\\:${className} {`);
1290
+ lines.push(` @media (min-width: ${breakpointValues[bp]}) {`);
1218
1291
  if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
1219
- mediaQueryLines.push(` font-size: ${style.fontSize[bp]};`);
1292
+ lines.push(` font-size: ${style.fontSize[bp]};`);
1220
1293
  }
1221
1294
  if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
1222
- mediaQueryLines.push(` line-height: ${style.lineHeight[bp]};`);
1295
+ lines.push(` line-height: ${style.lineHeight[bp]};`);
1223
1296
  }
1224
1297
  if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
1225
- mediaQueryLines.push(` letter-spacing: ${style.letterSpacing[bp]};`);
1298
+ lines.push(` letter-spacing: ${style.letterSpacing[bp]};`);
1226
1299
  }
1227
- mediaQueryLines.push(` }`);
1300
+ lines.push(` }`);
1301
+ lines.push(` }`);
1228
1302
  }
1229
1303
  }
1230
-
1231
- if (mediaQueryLines.length > 0) {
1232
- lines.push('');
1233
- lines.push(`@layer components {`);
1234
- lines.push(` @media (min-width: ${breakpointValues[bp]}) {`);
1235
- lines.push(...mediaQueryLines);
1236
- lines.push(` }`);
1237
- lines.push('}');
1238
- }
1239
1304
  }
1240
1305
 
1306
+ lines.push('}'); // Close @layer components
1307
+
1241
1308
  // Generate markdown prose styles
1242
1309
  lines.push('');
1243
1310
  lines.push('/* Markdown Prose Styles */');