@plumeria/webpack-plugin 0.24.1 → 0.24.3
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 +32 -31
- package/package.json +1 -1
package/dist/create.js
CHANGED
|
@@ -13,37 +13,42 @@ function compileToSingleCSS(object) {
|
|
|
13
13
|
(0, zss_engine_1.splitAtomicAndNested)(styleObj, flat, nonFlat);
|
|
14
14
|
const overrideLonghand = (style) => {
|
|
15
15
|
const props = Object.keys(style);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
16
|
+
const propsToRemove = new Set();
|
|
17
|
+
const plainProps = [];
|
|
18
|
+
for (let i = 0; i < props.length; i++) {
|
|
19
|
+
if (!props[i].startsWith('@')) {
|
|
20
|
+
plainProps.push({ key: props[i], index: i });
|
|
22
21
|
}
|
|
23
|
-
return finalStyle;
|
|
24
22
|
}
|
|
25
|
-
const
|
|
26
|
-
for (
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (isShorthand) {
|
|
31
|
-
finalStyle[prop] = style[prop];
|
|
23
|
+
const shorthandsInStyle = {};
|
|
24
|
+
for (const { key, index } of plainProps) {
|
|
25
|
+
const kebab = (0, zss_engine_1.camelToKebabCase)(key);
|
|
26
|
+
if (zss_engine_1.SHORTHAND_PROPERTIES[kebab]) {
|
|
27
|
+
shorthandsInStyle[kebab] = index;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
29
|
+
}
|
|
30
|
+
for (const { key, index } of plainProps) {
|
|
31
|
+
const kebab = (0, zss_engine_1.camelToKebabCase)(key);
|
|
32
|
+
if (!zss_engine_1.SHORTHAND_PROPERTIES[kebab]) {
|
|
33
|
+
const longhands = zss_engine_1.LONG_TO_SHORT[kebab] || [];
|
|
34
|
+
for (const shorthand of longhands) {
|
|
35
|
+
if (shorthandsInStyle[shorthand] > index) {
|
|
36
|
+
propsToRemove.add(key);
|
|
41
37
|
break;
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const finalStyle = {};
|
|
43
|
+
for (const prop of props) {
|
|
44
|
+
if (propsToRemove.has(prop)) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (prop.startsWith('@')) {
|
|
48
|
+
finalStyle[prop] = overrideLonghand(style[prop]);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
finalStyle[prop] = style[prop];
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
return finalStyle;
|
|
@@ -73,14 +78,10 @@ function compileToSingleCSS(object) {
|
|
|
73
78
|
});
|
|
74
79
|
});
|
|
75
80
|
if (Object.keys(nonFlat).length > 0) {
|
|
76
|
-
const
|
|
77
|
-
Object.entries(nonFlat).forEach(([atRule, nestedObj]) => {
|
|
78
|
-
finalNonFlat[atRule] = overrideLonghand(nestedObj);
|
|
79
|
-
});
|
|
80
|
-
const nonFlatObj = { [key]: finalNonFlat };
|
|
81
|
+
const nonFlatObj = { [key]: nonFlat };
|
|
81
82
|
const nonFlatHash = (0, zss_engine_1.genBase36Hash)(nonFlatObj, 1, 7);
|
|
82
83
|
const { styleSheet } = (0, zss_engine_1.transpile)(nonFlatObj, nonFlatHash);
|
|
83
|
-
Object.entries(
|
|
84
|
+
Object.entries(nonFlat).forEach(([atRule, nestedObj]) => {
|
|
84
85
|
Object.entries(nestedObj).forEach(([prop]) => {
|
|
85
86
|
records.push({
|
|
86
87
|
key: atRule + prop,
|