@webmate-studio/builder 0.2.79 → 0.2.81

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.79",
3
+ "version": "0.2.81",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -1179,6 +1179,126 @@ export function generateCSSFromTokens(tokens) {
1179
1179
  lines.push('}');
1180
1180
  }
1181
1181
  }
1182
+
1183
+ // Generate markdown prose styles
1184
+ lines.push('');
1185
+ lines.push('/* Markdown Prose Styles */');
1186
+ lines.push('/* Headings use text-heading-* styles */');
1187
+
1188
+ // Map h1-h6 to heading1-heading6 text styles
1189
+ const headingMap = {
1190
+ 'h1': 'heading1',
1191
+ 'h2': 'heading2',
1192
+ 'h3': 'heading3',
1193
+ 'h4': 'heading4',
1194
+ 'h5': 'heading5',
1195
+ 'h6': 'heading6'
1196
+ };
1197
+
1198
+ for (const [tag, styleName] of Object.entries(headingMap)) {
1199
+ const style = tokens.textStyles[styleName];
1200
+ if (!style) continue;
1201
+
1202
+ lines.push(`.prose ${tag} {`);
1203
+ if (style.fontFamily) {
1204
+ const fontVar = `--font-${style.fontFamily}`;
1205
+ lines.push(` font-family: var(${fontVar});`);
1206
+ }
1207
+ if (style.fontWeight) {
1208
+ lines.push(` font-weight: ${style.fontWeight};`);
1209
+ }
1210
+ if (style.fontSize) {
1211
+ const fontSize = typeof style.fontSize === 'object' ? style.fontSize.base : style.fontSize;
1212
+ lines.push(` font-size: ${fontSize};`);
1213
+ }
1214
+ if (style.lineHeight) {
1215
+ const lineHeight = typeof style.lineHeight === 'object' ? style.lineHeight.base : style.lineHeight;
1216
+ lines.push(` line-height: ${lineHeight};`);
1217
+ }
1218
+ if (style.letterSpacing) {
1219
+ const letterSpacing = typeof style.letterSpacing === 'object' ? style.letterSpacing.base : style.letterSpacing;
1220
+ lines.push(` letter-spacing: ${letterSpacing};`);
1221
+ }
1222
+ if (style.textTransform) {
1223
+ lines.push(` text-transform: ${style.textTransform};`);
1224
+ }
1225
+ if (style.textColor) {
1226
+ const colorVar = `--color-${style.textColor.replace(/([A-Z])/g, '-$1').toLowerCase()}`;
1227
+ lines.push(` color: var(${colorVar});`);
1228
+ }
1229
+ lines.push(` margin-top: 1.5rem;`);
1230
+ lines.push(` margin-bottom: 0.75rem;`);
1231
+ lines.push('}');
1232
+ }
1233
+
1234
+ // Links
1235
+ lines.push('.prose a {');
1236
+ if (tokens.colors && tokens.colors.primary) {
1237
+ lines.push(' color: var(--color-primary);');
1238
+ }
1239
+ lines.push('}');
1240
+
1241
+ // Paragraphs
1242
+ lines.push('.prose p {');
1243
+ lines.push(' margin-top: 1rem;');
1244
+ lines.push(' margin-bottom: 1rem;');
1245
+ lines.push('}');
1246
+
1247
+ // Lists
1248
+ lines.push('.prose ul, .prose ol {');
1249
+ lines.push(' margin-top: 1rem;');
1250
+ lines.push(' margin-bottom: 1rem;');
1251
+ lines.push(' padding-left: 1.5rem;');
1252
+ lines.push('}');
1253
+ lines.push('.prose li {');
1254
+ lines.push(' margin-top: 0.25rem;');
1255
+ lines.push(' margin-bottom: 0.25rem;');
1256
+ lines.push('}');
1257
+
1258
+ // Inline styles
1259
+ lines.push('.prose strong {');
1260
+ lines.push(' font-weight: 700;');
1261
+ lines.push('}');
1262
+ lines.push('.prose em {');
1263
+ lines.push(' font-style: italic;');
1264
+ lines.push('}');
1265
+
1266
+ // Add responsive prose styles for headings
1267
+ for (const bp of breakpointKeys) {
1268
+ const mediaQueryLines = [];
1269
+
1270
+ for (const [tag, styleName] of Object.entries(headingMap)) {
1271
+ const style = tokens.textStyles[styleName];
1272
+ if (!style) continue;
1273
+
1274
+ const hasResponsive = (
1275
+ (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) ||
1276
+ (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) ||
1277
+ (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp])
1278
+ );
1279
+
1280
+ if (hasResponsive) {
1281
+ mediaQueryLines.push(` .prose ${tag} {`);
1282
+ if (style.fontSize && typeof style.fontSize === 'object' && style.fontSize[bp]) {
1283
+ mediaQueryLines.push(` font-size: ${style.fontSize[bp]};`);
1284
+ }
1285
+ if (style.lineHeight && typeof style.lineHeight === 'object' && style.lineHeight[bp]) {
1286
+ mediaQueryLines.push(` line-height: ${style.lineHeight[bp]};`);
1287
+ }
1288
+ if (style.letterSpacing && typeof style.letterSpacing === 'object' && style.letterSpacing[bp]) {
1289
+ mediaQueryLines.push(` letter-spacing: ${style.letterSpacing[bp]};`);
1290
+ }
1291
+ mediaQueryLines.push(` }`);
1292
+ }
1293
+ }
1294
+
1295
+ if (mediaQueryLines.length > 0) {
1296
+ lines.push('');
1297
+ lines.push(`@media (min-width: ${breakpointValues[bp]}) {`);
1298
+ lines.push(...mediaQueryLines);
1299
+ lines.push('}');
1300
+ }
1301
+ }
1182
1302
  }
1183
1303
 
1184
1304
  // Generate button utility classes
@@ -58,11 +58,18 @@ function transformIslandsToDataAttributes(html, availableIslands = []) {
58
58
  // Convert island name to kebab-case for Custom Element tag
59
59
  // SwiperTest → swiper-test
60
60
  // MyAwesomeComponent → my-awesome-component
61
- const kebabTag = tagName
61
+ let kebabTag = tagName
62
62
  .replace(/([A-Z])/g, '-$1')
63
63
  .toLowerCase()
64
64
  .replace(/^-/, '');
65
65
 
66
+ // Svelte requires custom element names to be hyphenated
67
+ // If there's no hyphen, add a prefix to make it valid
68
+ // IMPORTANT: Must match the prefix logic in injectSvelteOptions()
69
+ if (!kebabTag.includes('-')) {
70
+ kebabTag = 'wm-' + kebabTag; // e.g., "sidebar" → "wm-sidebar"
71
+ }
72
+
66
73
  // Parse attributes and convert to HTML attributes
67
74
  const attrs = [];
68
75