@webmate-studio/builder 0.2.100 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmate-studio/builder",
3
- "version": "0.2.100",
3
+ "version": "0.2.101",
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
@@ -1186,11 +1229,10 @@ export function generateCSSFromTokens(tokens) {
1186
1229
  }
1187
1230
  lines.push(` }`);
1188
1231
  }
1189
- lines.push('}'); // Close @layer components
1190
-
1191
- // Add responsive media queries for textStyles
1192
- 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'];
1193
1234
  const breakpointValues = {
1235
+ sm: '640px',
1194
1236
  md: '768px',
1195
1237
  lg: '1024px',
1196
1238
  xl: '1280px',
@@ -1198,8 +1240,6 @@ export function generateCSSFromTokens(tokens) {
1198
1240
  };
1199
1241
 
1200
1242
  for (const bp of breakpointKeys) {
1201
- const mediaQueryLines = [];
1202
-
1203
1243
  for (const [styleName, style] of Object.entries(tokens.textStyles)) {
1204
1244
  const kebabName = styleName
1205
1245
  .replace(/([A-Z])/g, '-$1')
@@ -1214,30 +1254,26 @@ export function generateCSSFromTokens(tokens) {
1214
1254
  );
1215
1255
 
1216
1256
  if (hasResponsive) {
1217
- mediaQueryLines.push(` .${className} {`);
1257
+ // Generate Tailwind-compatible breakpoint class: md:text-body
1258
+ lines.push(` .${bp}\\:${className} {`);
1259
+ lines.push(` @media (min-width: ${breakpointValues[bp]}) {`);
1218
1260
  if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
1219
- mediaQueryLines.push(` font-size: ${style.fontSize[bp]};`);
1261
+ lines.push(` font-size: ${style.fontSize[bp]};`);
1220
1262
  }
1221
1263
  if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
1222
- mediaQueryLines.push(` line-height: ${style.lineHeight[bp]};`);
1264
+ lines.push(` line-height: ${style.lineHeight[bp]};`);
1223
1265
  }
1224
1266
  if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
1225
- mediaQueryLines.push(` letter-spacing: ${style.letterSpacing[bp]};`);
1267
+ lines.push(` letter-spacing: ${style.letterSpacing[bp]};`);
1226
1268
  }
1227
- mediaQueryLines.push(` }`);
1269
+ lines.push(` }`);
1270
+ lines.push(` }`);
1228
1271
  }
1229
1272
  }
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
1273
  }
1240
1274
 
1275
+ lines.push('}'); // Close @layer components
1276
+
1241
1277
  // Generate markdown prose styles
1242
1278
  lines.push('');
1243
1279
  lines.push('/* Markdown Prose Styles */');