@webmate-studio/builder 0.2.98 → 0.2.100

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.98",
3
+ "version": "0.2.100",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -453,9 +453,6 @@ export const defaultDesignTokens = {
453
453
  }
454
454
  },
455
455
 
456
- // Base spacing unit - Tailwind berechnet p-1, p-2, p-4 etc. automatisch
457
- spacing: '0.25rem', // 4px base unit (Tailwind default)
458
-
459
456
  // Base border width
460
457
  borderWidth: '1px',
461
458
 
@@ -602,6 +599,18 @@ export const defaultDesignTokens = {
602
599
  opacity: 100,
603
600
  opacityHover: 100
604
601
  }
602
+ },
603
+
604
+ // Spacing between components
605
+ spacing: {
606
+ component: {
607
+ base: '3rem', // 48px - Mobile
608
+ sm: '3rem', // 48px - 640px+
609
+ md: '3.5rem', // 56px - 768px+
610
+ lg: '4rem', // 64px - 1024px+
611
+ xl: '4.5rem', // 72px - 1280px+
612
+ '2xl': '5rem' // 80px - 1536px+
613
+ }
605
614
  }
606
615
  };
607
616
 
@@ -787,11 +796,6 @@ export function generateTailwindV4Theme(tokens) {
787
796
  }
788
797
  }
789
798
 
790
- // Spacing base
791
- if (tokens.spacing) {
792
- lines.push(` --spacing: ${tokens.spacing};`);
793
- }
794
-
795
799
  // Border width base
796
800
  if (tokens.borderWidth) {
797
801
  lines.push(` --border-width: ${tokens.borderWidth};`);
@@ -1027,7 +1031,6 @@ export function generateTailwindConfig(tokens) {
1027
1031
  fontWeight: tokens.typography?.fontWeight || {},
1028
1032
  lineHeight: tokens.typography?.lineHeight || {},
1029
1033
  letterSpacing: tokens.typography?.letterSpacing || {},
1030
- spacing: tokens.spacing || {},
1031
1034
  borderRadius: tokens.borderRadius || {},
1032
1035
  boxShadow: tokens.boxShadow || {},
1033
1036
  maxWidth: tokens.container || {}
@@ -1100,18 +1103,6 @@ export function generateCSSFromTokens(tokens) {
1100
1103
  lines.push(` --tracking-${key}: ${value};`);
1101
1104
  }
1102
1105
 
1103
- // Spacing
1104
- if (typeof tokens.spacing === 'object' && tokens.spacing !== null) {
1105
- // Object format: { '0': '0', '1': '0.25rem', '2': '0.5rem', ... }
1106
- for (const [key, value] of Object.entries(tokens.spacing)) {
1107
- lines.push(` --spacing-${key.replace('.', '-')}: ${value};`);
1108
- }
1109
- } else if (typeof tokens.spacing === 'string') {
1110
- // String format (base unit): '0.25rem' - Tailwind v4 will auto-generate scale
1111
- // Output base spacing variable for Tailwind v4
1112
- lines.push(` --spacing: ${tokens.spacing};`);
1113
- }
1114
-
1115
1106
  // Container
1116
1107
  for (const [key, value] of Object.entries(tokens.container || {})) {
1117
1108
  lines.push(` --container-${key}: ${value};`);
@@ -1555,5 +1546,36 @@ export function generateCSSFromTokens(tokens) {
1555
1546
  lines.push(semanticUtilities);
1556
1547
  }
1557
1548
 
1549
+ // Add component spacing utilities
1550
+ if (tokens.spacing?.component) {
1551
+ lines.push('');
1552
+ lines.push('/* Component Spacing */');
1553
+ lines.push('.component-wrapper {');
1554
+ lines.push(' display: flex;');
1555
+ lines.push(' flex-direction: column;');
1556
+ lines.push(` gap: ${tokens.spacing.component.base || '3rem'};`);
1557
+ lines.push('}');
1558
+
1559
+ // Responsive spacing
1560
+ const breakpoints = {
1561
+ sm: '640px',
1562
+ md: '768px',
1563
+ lg: '1024px',
1564
+ xl: '1280px',
1565
+ '2xl': '1536px'
1566
+ };
1567
+
1568
+ for (const [breakpoint, minWidth] of Object.entries(breakpoints)) {
1569
+ if (tokens.spacing.component[breakpoint]) {
1570
+ lines.push('');
1571
+ lines.push(`@media (min-width: ${minWidth}) {`);
1572
+ lines.push(' .component-wrapper {');
1573
+ lines.push(` gap: ${tokens.spacing.component[breakpoint]};`);
1574
+ lines.push(' }');
1575
+ lines.push('}');
1576
+ }
1577
+ }
1578
+ }
1579
+
1558
1580
  return lines.join('\n');
1559
1581
  }