@plumeria/core 0.24.0 → 0.24.2
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/index.js +23 -21
- package/dist/index.mjs +23 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,31 +10,33 @@ function create(object) {
|
|
|
10
10
|
(0, zss_engine.splitAtomicAndNested)(styleObj, flat, nonFlat);
|
|
11
11
|
const overrideLonghand = (style) => {
|
|
12
12
|
const props$1 = Object.keys(style);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const propsToRemove = new Set();
|
|
14
|
+
const plainProps = [];
|
|
15
|
+
for (let i = 0; i < props$1.length; i++) if (!props$1[i].startsWith("@")) plainProps.push({
|
|
16
|
+
key: props$1[i],
|
|
17
|
+
index: i
|
|
18
|
+
});
|
|
19
|
+
const shorthandsInStyle = {};
|
|
20
|
+
for (const { key: key$1, index } of plainProps) {
|
|
21
|
+
const kebab = (0, zss_engine.camelToKebabCase)(key$1);
|
|
22
|
+
if (zss_engine.SHORTHAND_PROPERTIES[kebab]) shorthandsInStyle[kebab] = index;
|
|
17
23
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let isOverridden = false;
|
|
26
|
-
const shorthands = zss_engine.LONG_TO_SHORT[kebab] || [];
|
|
27
|
-
for (let j = i + 1; j < props$1.length; j++) {
|
|
28
|
-
const futureProp = props$1[j];
|
|
29
|
-
const futureKebab = (0, zss_engine.camelToKebabCase)(futureProp);
|
|
30
|
-
if (shorthands.includes(futureKebab)) {
|
|
31
|
-
isOverridden = true;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
24
|
+
for (const { key: key$1, index } of plainProps) {
|
|
25
|
+
const kebab = (0, zss_engine.camelToKebabCase)(key$1);
|
|
26
|
+
if (!zss_engine.SHORTHAND_PROPERTIES[kebab]) {
|
|
27
|
+
const longhands = zss_engine.LONG_TO_SHORT[kebab] || [];
|
|
28
|
+
for (const shorthand of longhands) if (shorthandsInStyle[shorthand] > index) {
|
|
29
|
+
propsToRemove.add(key$1);
|
|
30
|
+
break;
|
|
34
31
|
}
|
|
35
|
-
if (!isOverridden) finalStyle[prop] = style[prop];
|
|
36
32
|
}
|
|
37
33
|
}
|
|
34
|
+
const finalStyle = {};
|
|
35
|
+
for (const prop of props$1) {
|
|
36
|
+
if (propsToRemove.has(prop)) continue;
|
|
37
|
+
if (prop.startsWith("@")) finalStyle[prop] = overrideLonghand(style[prop]);
|
|
38
|
+
else finalStyle[prop] = style[prop];
|
|
39
|
+
}
|
|
38
40
|
return finalStyle;
|
|
39
41
|
};
|
|
40
42
|
const finalFlat = overrideLonghand(flat);
|
package/dist/index.mjs
CHANGED
|
@@ -10,31 +10,33 @@ function create(object) {
|
|
|
10
10
|
splitAtomicAndNested(styleObj, flat, nonFlat);
|
|
11
11
|
const overrideLonghand = (style) => {
|
|
12
12
|
const props$1 = Object.keys(style);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const propsToRemove = new Set();
|
|
14
|
+
const plainProps = [];
|
|
15
|
+
for (let i = 0; i < props$1.length; i++) if (!props$1[i].startsWith("@")) plainProps.push({
|
|
16
|
+
key: props$1[i],
|
|
17
|
+
index: i
|
|
18
|
+
});
|
|
19
|
+
const shorthandsInStyle = {};
|
|
20
|
+
for (const { key: key$1, index } of plainProps) {
|
|
21
|
+
const kebab = camelToKebabCase(key$1);
|
|
22
|
+
if (SHORTHAND_PROPERTIES[kebab]) shorthandsInStyle[kebab] = index;
|
|
17
23
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let isOverridden = false;
|
|
26
|
-
const shorthands = LONG_TO_SHORT[kebab] || [];
|
|
27
|
-
for (let j = i + 1; j < props$1.length; j++) {
|
|
28
|
-
const futureProp = props$1[j];
|
|
29
|
-
const futureKebab = camelToKebabCase(futureProp);
|
|
30
|
-
if (shorthands.includes(futureKebab)) {
|
|
31
|
-
isOverridden = true;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
24
|
+
for (const { key: key$1, index } of plainProps) {
|
|
25
|
+
const kebab = camelToKebabCase(key$1);
|
|
26
|
+
if (!SHORTHAND_PROPERTIES[kebab]) {
|
|
27
|
+
const longhands = LONG_TO_SHORT[kebab] || [];
|
|
28
|
+
for (const shorthand of longhands) if (shorthandsInStyle[shorthand] > index) {
|
|
29
|
+
propsToRemove.add(key$1);
|
|
30
|
+
break;
|
|
34
31
|
}
|
|
35
|
-
if (!isOverridden) finalStyle[prop] = style[prop];
|
|
36
32
|
}
|
|
37
33
|
}
|
|
34
|
+
const finalStyle = {};
|
|
35
|
+
for (const prop of props$1) {
|
|
36
|
+
if (propsToRemove.has(prop)) continue;
|
|
37
|
+
if (prop.startsWith("@")) finalStyle[prop] = overrideLonghand(style[prop]);
|
|
38
|
+
else finalStyle[prop] = style[prop];
|
|
39
|
+
}
|
|
38
40
|
return finalStyle;
|
|
39
41
|
};
|
|
40
42
|
const finalFlat = overrideLonghand(flat);
|