@webmate-studio/builder 0.2.159 → 0.2.161
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/design-tokens-v2-css.js +59 -1
package/package.json
CHANGED
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
DEFAULT_SURFACE_TOKENS,
|
|
17
17
|
defaultDesignTokensV2,
|
|
18
18
|
normalizeShadowValue,
|
|
19
|
-
isGradientValue
|
|
19
|
+
isGradientValue,
|
|
20
|
+
SHADOW_PRESETS
|
|
20
21
|
} from './design-tokens-v2.js';
|
|
21
22
|
|
|
22
23
|
|
|
@@ -53,6 +54,8 @@ export function generateTailwindV4ThemeV2(tokens) {
|
|
|
53
54
|
globalStyles += generateTextAliasClasses(t);
|
|
54
55
|
globalStyles += generateTextResponsiveVariants(t);
|
|
55
56
|
globalStyles += generateButtonClasses(t);
|
|
57
|
+
globalStyles += generateSpacingStyles(t);
|
|
58
|
+
globalStyles += generateShadowStyles(t);
|
|
56
59
|
globalStyles += generateResponsiveMediaQueries(responsiveLines);
|
|
57
60
|
|
|
58
61
|
return { themeVars, globalStyles };
|
|
@@ -1022,6 +1025,11 @@ function generateLayoutVariables(t, lines) {
|
|
|
1022
1025
|
if (t.borderWidth) lines.push(` --border-width: ${t.borderWidth};`);
|
|
1023
1026
|
if (t.borderRadius) lines.push(` --radius: ${t.borderRadius};`);
|
|
1024
1027
|
|
|
1028
|
+
if (t.spacing?.component) {
|
|
1029
|
+
lines.push(` /* component spacing */`);
|
|
1030
|
+
lines.push(` --spacing-component: ${t.spacing.component.base || '3rem'};`);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1025
1033
|
if (t.breakpoints) {
|
|
1026
1034
|
lines.push(' /* breakpoints */');
|
|
1027
1035
|
for (const [key, value] of Object.entries(t.breakpoints)) {
|
|
@@ -1031,6 +1039,56 @@ function generateLayoutVariables(t, lines) {
|
|
|
1031
1039
|
}
|
|
1032
1040
|
|
|
1033
1041
|
|
|
1042
|
+
// ─── Component Spacing ──────────────────────────────────────────────────────
|
|
1043
|
+
|
|
1044
|
+
function generateSpacingStyles(t) {
|
|
1045
|
+
if (!t.spacing?.component) return '';
|
|
1046
|
+
|
|
1047
|
+
const breakpoints = {
|
|
1048
|
+
sm: '640px', md: '768px', lg: '1024px', xl: '1280px', '2xl': '1536px'
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
let css = '\n\n/* Component Spacing */';
|
|
1052
|
+
css += '\n.component-wrapper {';
|
|
1053
|
+
css += '\n display: flex;';
|
|
1054
|
+
css += '\n flex-direction: column;';
|
|
1055
|
+
css += '\n}';
|
|
1056
|
+
css += '\n.component-wrapper > * + * {';
|
|
1057
|
+
css += '\n margin-top: var(--spacing-component);';
|
|
1058
|
+
css += '\n}';
|
|
1059
|
+
|
|
1060
|
+
// Spacing-Modi
|
|
1061
|
+
css += '\n[data-spacing="none"] { margin-top: 0 !important; }';
|
|
1062
|
+
css += '\n[data-spacing="half"] { margin-top: calc(var(--spacing-component) / 2) !important; }';
|
|
1063
|
+
css += '\n[data-spacing="double"] { margin-top: calc(var(--spacing-component) * 2) !important; }';
|
|
1064
|
+
|
|
1065
|
+
// Responsive Overrides
|
|
1066
|
+
for (const [bp, minWidth] of Object.entries(breakpoints)) {
|
|
1067
|
+
if (t.spacing.component[bp]) {
|
|
1068
|
+
css += `\n@media (min-width: ${minWidth}) {`;
|
|
1069
|
+
css += `\n :root { --spacing-component: ${t.spacing.component[bp]}; }`;
|
|
1070
|
+
css += '\n}';
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
return css;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
// ─── Shadow-Utilities ───────────────────────────────────────────────────────
|
|
1079
|
+
|
|
1080
|
+
function generateShadowStyles(t) {
|
|
1081
|
+
let css = '\n\n/* Shadow Utilities */';
|
|
1082
|
+
|
|
1083
|
+
for (const [name, value] of Object.entries(SHADOW_PRESETS)) {
|
|
1084
|
+
const resolved = resolveShadowToCSS(value, t);
|
|
1085
|
+
css += `\n.shadow-${name} { box-shadow: ${resolved}; }`;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
return css;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
|
|
1034
1092
|
// ─── Basis-Styles ───────────────────────────────────────────────────────────
|
|
1035
1093
|
|
|
1036
1094
|
function generateBaseStyles(t) {
|