@webmate-studio/builder 0.2.91 → 0.2.93
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/css-deduplicator.js +16 -0
- package/src/design-tokens.js +6 -1
package/package.json
CHANGED
package/src/css-deduplicator.js
CHANGED
|
@@ -66,6 +66,7 @@ export function deduplicateCSS(cssArray) {
|
|
|
66
66
|
base: new Set(),
|
|
67
67
|
properties: new Set(),
|
|
68
68
|
theme: new Set(),
|
|
69
|
+
components: new Set(),
|
|
69
70
|
utilities: new Set()
|
|
70
71
|
};
|
|
71
72
|
const regularRules = {
|
|
@@ -137,6 +138,10 @@ export function deduplicateCSS(cssArray) {
|
|
|
137
138
|
regularRules.charset.push(trimmed);
|
|
138
139
|
} else if (trimmed.startsWith('@import')) {
|
|
139
140
|
regularRules.imports.push(trimmed);
|
|
141
|
+
} else if (trimmed.startsWith('@layer') && trimmed.includes(';')) {
|
|
142
|
+
// Skip @layer declarations (we add our own)
|
|
143
|
+
duplicatesSkipped++;
|
|
144
|
+
continue;
|
|
140
145
|
} else {
|
|
141
146
|
regularRules.other.push(trimmed);
|
|
142
147
|
}
|
|
@@ -157,6 +162,12 @@ export function deduplicateCSS(cssArray) {
|
|
|
157
162
|
parts.push(...regularRules.imports);
|
|
158
163
|
}
|
|
159
164
|
|
|
165
|
+
// Add layer order declaration (only if we have any layers)
|
|
166
|
+
const hasLayers = tailwindLayers.base.size > 0 || tailwindLayers.components.size > 0 || tailwindLayers.utilities.size > 0;
|
|
167
|
+
if (hasLayers) {
|
|
168
|
+
parts.push('@layer base, components, utilities;');
|
|
169
|
+
}
|
|
170
|
+
|
|
160
171
|
// Tailwind layers in correct order
|
|
161
172
|
if (tailwindLayers.base.size > 0) {
|
|
162
173
|
parts.push(`@layer base {\n${Array.from(tailwindLayers.base).join('\n\n')}\n}`);
|
|
@@ -167,6 +178,11 @@ export function deduplicateCSS(cssArray) {
|
|
|
167
178
|
if (tailwindLayers.theme.size > 0) {
|
|
168
179
|
parts.push(`@layer theme {\n${Array.from(tailwindLayers.theme).join('\n\n')}\n}`);
|
|
169
180
|
}
|
|
181
|
+
if (tailwindLayers.components.size > 0) {
|
|
182
|
+
// Sort components by breakpoint before joining
|
|
183
|
+
const sortedComponents = sortUtilityRules(Array.from(tailwindLayers.components));
|
|
184
|
+
parts.push(`@layer components {\n${sortedComponents.join('\n\n')}\n}`);
|
|
185
|
+
}
|
|
170
186
|
if (tailwindLayers.utilities.size > 0) {
|
|
171
187
|
// Sort utilities by breakpoint before joining
|
|
172
188
|
const sortedUtilities = sortUtilityRules(Array.from(tailwindLayers.utilities));
|
package/src/design-tokens.js
CHANGED
|
@@ -1008,7 +1008,12 @@ export function generateTailwindConfig(tokens) {
|
|
|
1008
1008
|
* Generate CSS Variables from Design Tokens
|
|
1009
1009
|
*/
|
|
1010
1010
|
export function generateCSSFromTokens(tokens) {
|
|
1011
|
-
const lines = [
|
|
1011
|
+
const lines = [];
|
|
1012
|
+
|
|
1013
|
+
// Define layer order FIRST - this sets the priority (later = higher priority)
|
|
1014
|
+
lines.push('@layer base, components, utilities;');
|
|
1015
|
+
lines.push('');
|
|
1016
|
+
lines.push(':root {');
|
|
1012
1017
|
|
|
1013
1018
|
// Colors
|
|
1014
1019
|
for (const [key, value] of Object.entries(tokens.colors || {})) {
|