@webmate-studio/builder 0.2.85 → 0.2.87

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.85",
3
+ "version": "0.2.87",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -7,7 +7,7 @@ function generateSemanticColorUtilities(tokens) {
7
7
  if (!tokens.colors) return '';
8
8
 
9
9
  let utilities = '\n/* Color Utilities */';
10
- utilities += '\n@layer components {';
10
+ utilities += '\n@layer utilities {';
11
11
 
12
12
  // Map of all colors: token name -> utility class base name
13
13
  const colorMap = {
@@ -1008,7 +1008,13 @@ export function generateTailwindConfig(tokens) {
1008
1008
  * Generate CSS Variables from Design Tokens
1009
1009
  */
1010
1010
  export function generateCSSFromTokens(tokens) {
1011
- const lines = [':root {'];
1011
+ const lines = [];
1012
+
1013
+ // Define layer order FIRST (before any other CSS)
1014
+ lines.push('/* CSS Layer Order Declaration */');
1015
+ lines.push('@layer base, components, utilities;');
1016
+ lines.push('');
1017
+ lines.push(':root {');
1012
1018
 
1013
1019
  // Colors
1014
1020
  for (const [key, value] of Object.entries(tokens.colors || {})) {
package/src/markdown.js CHANGED
@@ -20,10 +20,10 @@ marked.setOptions({
20
20
  });
21
21
 
22
22
  /**
23
- * Shift heading levels in HTML
23
+ * Shift heading levels in HTML and add correct text-heading-* classes
24
24
  * @param {string} html - HTML string
25
25
  * @param {number} startLevel - The level that h1 should become (e.g., 2 means h1 → h2)
26
- * @returns {string} HTML with shifted heading levels
26
+ * @returns {string} HTML with shifted heading levels and proper styling classes
27
27
  */
28
28
  function shiftHeadingLevels(html, startLevel) {
29
29
  if (!startLevel || startLevel === 1) return html;
@@ -35,11 +35,24 @@ function shiftHeadingLevels(html, startLevel) {
35
35
  for (let level = 6; level >= 1; level--) {
36
36
  const newLevel = Math.min(level + offset, 6);
37
37
  if (newLevel !== level) {
38
- // Replace opening and closing tags
38
+ // Add text-heading-{originalLevel} class to preserve original styling
39
+ // e.g., H1 becoming H2 gets class="text-heading-1" to keep H1 styles
40
+ const styleClass = `text-heading-${level}`;
41
+
42
+ // Replace opening tag and add class
39
43
  html = html.replace(
40
44
  new RegExp(`<h${level}(\\s|>)`, 'gi'),
41
- `<h${newLevel}$1`
45
+ (match, afterTag) => {
46
+ // If there's already a space (attributes exist), add class
47
+ if (afterTag === ' ') {
48
+ return `<h${newLevel} class="${styleClass}"`;
49
+ }
50
+ // Otherwise, add class before closing >
51
+ return `<h${newLevel} class="${styleClass}">`;
52
+ }
42
53
  );
54
+
55
+ // Replace closing tags
43
56
  html = html.replace(
44
57
  new RegExp(`</h${level}>`, 'gi'),
45
58
  `</h${newLevel}>`
@@ -411,6 +411,10 @@ ${themeCSS}
411
411
  result = stripNonUtilityLayers(result);
412
412
  console.log(`[Tailwind Generator] Generated CSS length AFTER stripping: ${result.length}`);
413
413
  console.log(`[Tailwind Generator] CSS contains @layer base: ${result.includes('@layer base')}`);
414
+
415
+ // Wrap in @layer components (btn, etc. are components, not utilities)
416
+ // Utilities from design tokens (@layer utilities) can then override them
417
+ result = `@layer components {\n${result}\n}`;
414
418
  }
415
419
 
416
420
  return result;