@plumeria/webpack-plugin 0.21.5 → 0.22.1
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/dist/create.js +29 -3
- package/package.json +2 -2
package/dist/create.js
CHANGED
|
@@ -11,8 +11,33 @@ function compileToSingleCSS(object) {
|
|
|
11
11
|
const flat = {};
|
|
12
12
|
const nonFlat = {};
|
|
13
13
|
(0, zss_engine_1.splitAtomicAndNested)(styleObj, flat, nonFlat);
|
|
14
|
+
const props = Object.keys(flat);
|
|
15
|
+
const finalFlat = {};
|
|
16
|
+
for (let i = 0; i < props.length; i++) {
|
|
17
|
+
const prop = props[i];
|
|
18
|
+
const kebab = (0, zss_engine_1.camelToKebabCase)(prop);
|
|
19
|
+
const isShorthand = !!zss_engine_1.SHORTHAND_PROPERTIES[kebab];
|
|
20
|
+
if (isShorthand) {
|
|
21
|
+
finalFlat[prop] = flat[prop];
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
let isOverridden = false;
|
|
25
|
+
const shorthands = zss_engine_1.LONG_TO_SHORT[kebab] || [];
|
|
26
|
+
for (let j = i + 1; j < props.length; j++) {
|
|
27
|
+
const futureProp = props[j];
|
|
28
|
+
const futureKebab = (0, zss_engine_1.camelToKebabCase)(futureProp);
|
|
29
|
+
if (shorthands.includes(futureKebab)) {
|
|
30
|
+
isOverridden = true;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!isOverridden) {
|
|
35
|
+
finalFlat[prop] = flat[prop];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
14
39
|
const records = [];
|
|
15
|
-
Object.entries(
|
|
40
|
+
Object.entries(finalFlat).forEach(([prop, value]) => {
|
|
16
41
|
const hashes = new Set();
|
|
17
42
|
const sheets = new Set();
|
|
18
43
|
(0, zss_engine_1.processAtomicProps)({ [prop]: value }, hashes, sheets);
|
|
@@ -86,16 +111,17 @@ exports.createVars = createVars;
|
|
|
86
111
|
const createTokens = (object) => {
|
|
87
112
|
const styles = {};
|
|
88
113
|
Object.entries(object).forEach(([key, value]) => {
|
|
114
|
+
const kebabKey = (0, zss_engine_1.camelToKebabCase)(key);
|
|
89
115
|
Object.entries(value).forEach(([subKey, subValue]) => {
|
|
90
116
|
if (subKey.startsWith('@media')) {
|
|
91
117
|
styles[':root'] ||= {};
|
|
92
118
|
styles[':root'][subKey] ||= {};
|
|
93
|
-
styles[':root'][subKey][`--${
|
|
119
|
+
styles[':root'][subKey][`--${kebabKey}`] = subValue;
|
|
94
120
|
}
|
|
95
121
|
else {
|
|
96
122
|
const themeSelector = subKey === 'default' ? ':root' : `:root[data-theme="${subKey}"]`;
|
|
97
123
|
styles[themeSelector] ||= {};
|
|
98
|
-
styles[themeSelector][`--${
|
|
124
|
+
styles[themeSelector][`--${kebabKey}`] = subValue;
|
|
99
125
|
}
|
|
100
126
|
});
|
|
101
127
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/webpack-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "Plumeria Webpack plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@rust-gear/glob": "^0.2.2",
|
|
25
25
|
"@types/babel__core": "^7.20.5",
|
|
26
26
|
"webpack": "^5.101.0",
|
|
27
|
-
"zss-engine": "^0.2.
|
|
27
|
+
"zss-engine": "^0.2.94"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|