@webmate-studio/builder 0.2.43 → 0.2.45
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/tailwind-generator.js +16 -5
package/package.json
CHANGED
|
@@ -70,6 +70,7 @@ function stripNonUtilityLayers(css) {
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Extract Tailwind classes from HTML content
|
|
73
|
+
* Supports: class="...", class='...', and Svelte's class:xxx={...}
|
|
73
74
|
* @param {string} html - HTML content
|
|
74
75
|
* @returns {Set<string>} Set of unique Tailwind classes
|
|
75
76
|
*/
|
|
@@ -90,6 +91,17 @@ export function extractTailwindClasses(html) {
|
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
// Match Svelte conditional classes: class:xxx={...}
|
|
95
|
+
// Supports arbitrary values with brackets: class:lg:pb-[calc(10px + 30px)]={...}
|
|
96
|
+
// Same pattern as CLI preview-ui for consistency
|
|
97
|
+
const svelteClassRegex = /class:((?:[^\s=[]|\[[^\]]*\])+)=/g;
|
|
98
|
+
while ((match = svelteClassRegex.exec(html)) !== null) {
|
|
99
|
+
const className = match[1];
|
|
100
|
+
if (className.trim()) {
|
|
101
|
+
classes.add(className.trim());
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
return classes;
|
|
94
106
|
}
|
|
95
107
|
|
|
@@ -292,13 +304,12 @@ export async function generateTailwindCSS(classes, options = {}) {
|
|
|
292
304
|
}
|
|
293
305
|
|
|
294
306
|
// Create input CSS with Tailwind v4 syntax
|
|
295
|
-
//
|
|
296
|
-
//
|
|
307
|
+
// Always include theme (for color/spacing variables)
|
|
308
|
+
// We'll strip base/properties layers afterwards if includeBaseLayers is false
|
|
297
309
|
let inputCSS;
|
|
298
310
|
|
|
299
|
-
// Always
|
|
300
|
-
|
|
301
|
-
const themeCSS = includeBaseLayers ? generateThemeCSS(themeColors) : '';
|
|
311
|
+
// Always generate theme CSS (needed for utility classes like bg-primary)
|
|
312
|
+
const themeCSS = generateThemeCSS(themeColors);
|
|
302
313
|
inputCSS = `
|
|
303
314
|
@import "tailwindcss";
|
|
304
315
|
|