@webmate-studio/builder 0.2.110 → 0.2.113
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.js +16 -5
- package/src/expression-evaluator.js +1234 -0
- package/src/markdown.js +22 -3
- package/src/template-evaluator.js +379 -0
- package/src/template-parser.js +597 -0
- package/src/template-processor.js +87 -582
package/package.json
CHANGED
package/src/design-tokens.js
CHANGED
|
@@ -34,6 +34,7 @@ function generateSemanticColorUtilities(tokens) {
|
|
|
34
34
|
'infoLight': 'info-light',
|
|
35
35
|
|
|
36
36
|
// Base semantic colors (use prefixed names to avoid conflicts)
|
|
37
|
+
'bgBody': 'bg-body',
|
|
37
38
|
'bgBase': 'bg-default',
|
|
38
39
|
'bgElevated': 'bg-elevated',
|
|
39
40
|
'bgLifted': 'bg-lifted',
|
|
@@ -217,6 +218,7 @@ export const defaultDesignTokens = {
|
|
|
217
218
|
infoLight: '#dbeafe',
|
|
218
219
|
|
|
219
220
|
// Background Colors (Semantic)
|
|
221
|
+
bgBody: '#ffffff', // Page/body background
|
|
220
222
|
bgBase: '#ffffff',
|
|
221
223
|
bgElevated: '#f9fafb',
|
|
222
224
|
bgLifted: '#ffffff',
|
|
@@ -648,6 +650,7 @@ export function generateTailwindV4Theme(tokens) {
|
|
|
648
650
|
if (tokens.colors.infoLight) lines.push(` --color-info-light: ${tokens.colors.infoLight};`);
|
|
649
651
|
|
|
650
652
|
// Background colors (Semantic)
|
|
653
|
+
if (tokens.colors.bgBody) lines.push(` --color-bg-body: ${tokens.colors.bgBody};`);
|
|
651
654
|
if (tokens.colors.bgBase) lines.push(` --color-bg-base: ${tokens.colors.bgBase};`);
|
|
652
655
|
if (tokens.colors.bgElevated) lines.push(` --color-bg-elevated: ${tokens.colors.bgElevated};`);
|
|
653
656
|
if (tokens.colors.bgLifted) lines.push(` --color-bg-lifted: ${tokens.colors.bgLifted};`);
|
|
@@ -871,14 +874,17 @@ export function generateTailwindV4Theme(tokens) {
|
|
|
871
874
|
|
|
872
875
|
// Global styles (MUST be outside @theme block)
|
|
873
876
|
let globalStyles = `
|
|
874
|
-
/* Global baseline
|
|
877
|
+
/* Global baseline styles */
|
|
875
878
|
body {
|
|
876
879
|
font-family: var(--font-body);
|
|
880
|
+
background-color: var(--color-bg-body, var(--color-bg-base, #ffffff));
|
|
877
881
|
}`;
|
|
878
882
|
|
|
879
883
|
// Generate utility classes for text styles
|
|
884
|
+
// IMPORTANT: Wrap in @layer components so color utilities (@layer utilities) can override textColor
|
|
880
885
|
if (tokens.textStyles) {
|
|
881
886
|
globalStyles += '\n\n/* Text Style Utilities */';
|
|
887
|
+
globalStyles += '\n@layer components {';
|
|
882
888
|
for (const [styleName, style] of Object.entries(tokens.textStyles)) {
|
|
883
889
|
const kebabName = styleName
|
|
884
890
|
.replace(/([A-Z])/g, '-$1')
|
|
@@ -914,9 +920,11 @@ body {
|
|
|
914
920
|
}
|
|
915
921
|
globalStyles += `\n}`;
|
|
916
922
|
}
|
|
923
|
+
globalStyles += '\n}'; // Close @layer components for base text styles
|
|
917
924
|
|
|
918
925
|
// Generate responsive variants (sm:, md:, lg:, xl:, 2xl:) for Tailwind compatibility
|
|
919
926
|
// These allow switching to a different text style at a breakpoint: class="text-body lg:text-lead"
|
|
927
|
+
// IMPORTANT: @layer must be INSIDE @media for proper cascade behavior
|
|
920
928
|
const breakpointKeys = ['sm', 'md', 'lg', 'xl', '2xl'];
|
|
921
929
|
const breakpointValues = {
|
|
922
930
|
sm: '640px',
|
|
@@ -927,6 +935,8 @@ body {
|
|
|
927
935
|
};
|
|
928
936
|
|
|
929
937
|
for (const bp of breakpointKeys) {
|
|
938
|
+
globalStyles += `\n@media (min-width: ${breakpointValues[bp]}) {`;
|
|
939
|
+
globalStyles += `\n@layer components {`;
|
|
930
940
|
for (const [styleName, style] of Object.entries(tokens.textStyles)) {
|
|
931
941
|
const kebabName = styleName
|
|
932
942
|
.replace(/([A-Z])/g, '-$1')
|
|
@@ -937,7 +947,6 @@ body {
|
|
|
937
947
|
|
|
938
948
|
// Generate Tailwind-compatible breakpoint class: md:text-body
|
|
939
949
|
// Apply ALL properties of the text style, not just responsive values
|
|
940
|
-
globalStyles += `\n@media (min-width: ${breakpointValues[bp]}) {`;
|
|
941
950
|
globalStyles += `\n .${bp}\\:${className} {`;
|
|
942
951
|
|
|
943
952
|
// Font family
|
|
@@ -981,8 +990,9 @@ body {
|
|
|
981
990
|
}
|
|
982
991
|
|
|
983
992
|
globalStyles += `\n }`;
|
|
984
|
-
globalStyles += `\n}`;
|
|
985
993
|
}
|
|
994
|
+
globalStyles += '\n}'; // Close @layer components
|
|
995
|
+
globalStyles += '\n}'; // Close @media
|
|
986
996
|
}
|
|
987
997
|
}
|
|
988
998
|
|
|
@@ -1210,11 +1220,12 @@ export function generateCSSFromTokens(tokens) {
|
|
|
1210
1220
|
|
|
1211
1221
|
lines.push('}');
|
|
1212
1222
|
|
|
1213
|
-
// Add global body
|
|
1223
|
+
// Add global body styles as baseline
|
|
1214
1224
|
lines.push('');
|
|
1215
|
-
lines.push('/* Global baseline
|
|
1225
|
+
lines.push('/* Global baseline styles */');
|
|
1216
1226
|
lines.push('body {');
|
|
1217
1227
|
lines.push(' font-family: var(--font-body);');
|
|
1228
|
+
lines.push(' background-color: var(--color-bg-body, var(--color-bg-base, #ffffff));');
|
|
1218
1229
|
lines.push('}');
|
|
1219
1230
|
|
|
1220
1231
|
// Generate utility classes for text styles
|