@plumeria/utils 10.4.3 → 10.5.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 +35 -44
- package/package.json +1 -1
package/dist/create.js
CHANGED
|
@@ -22,16 +22,14 @@ function getStyleRecords(styleRule) {
|
|
|
22
22
|
queryHashes.push(hash);
|
|
23
23
|
}
|
|
24
24
|
const queryKey = prop + ':' + innerProp;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
}
|
|
25
|
+
records.push({
|
|
26
|
+
key: queryKey,
|
|
27
|
+
hash: queryHashes.join(' '),
|
|
28
|
+
sheet: querySheets.join(''),
|
|
29
|
+
});
|
|
32
30
|
});
|
|
33
31
|
}
|
|
34
|
-
else {
|
|
32
|
+
else if (typeof value === 'string' || typeof value === 'number') {
|
|
35
33
|
const atomicMap = new Map();
|
|
36
34
|
(0, zss_engine_1.processAtomicProps)({ [prop]: value }, atomicMap);
|
|
37
35
|
const sheets = [];
|
|
@@ -40,13 +38,11 @@ function getStyleRecords(styleRule) {
|
|
|
40
38
|
sheets.push(sheet);
|
|
41
39
|
hashes.push(hash);
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
}
|
|
41
|
+
records.push({
|
|
42
|
+
key: prop,
|
|
43
|
+
hash: hashes.join(' '),
|
|
44
|
+
sheet: sheets.join(''),
|
|
45
|
+
});
|
|
50
46
|
}
|
|
51
47
|
});
|
|
52
48
|
if (Object.keys(nonFlat).length > 0) {
|
|
@@ -61,36 +57,31 @@ function getStyleRecords(styleRule) {
|
|
|
61
57
|
}
|
|
62
58
|
});
|
|
63
59
|
const processSelectorStyle = (selector, style, atRule) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
sheet =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
? `${atRule}:${selector}:${prop}`
|
|
88
|
-
: `${selector}:${prop}`,
|
|
89
|
-
hash,
|
|
90
|
-
sheet: sheet + '\n',
|
|
91
|
-
});
|
|
60
|
+
Object.entries(style).forEach(([prop, value]) => {
|
|
61
|
+
let hashSource = { [prop]: value };
|
|
62
|
+
if (atRule) {
|
|
63
|
+
hashSource = {
|
|
64
|
+
[atRule]: {
|
|
65
|
+
[selector]: hashSource,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
hashSource = { [selector]: hashSource };
|
|
71
|
+
}
|
|
72
|
+
const hash = (0, zss_engine_1.genBase36Hash)(hashSource, 1, 8);
|
|
73
|
+
const notSuffix = prop.startsWith('--') ? '' : notNormalize;
|
|
74
|
+
let sheet = (0, zss_engine_1.transpileAtomic)(prop, value, hash, selector);
|
|
75
|
+
sheet = sheet.replace(`.${hash}`, `.${hash}${notSuffix}`);
|
|
76
|
+
if (atRule) {
|
|
77
|
+
sheet = `${atRule} { ${sheet} }`;
|
|
78
|
+
}
|
|
79
|
+
records.push({
|
|
80
|
+
key: atRule ? `${atRule}:${selector}:${prop}` : `${selector}:${prop}`,
|
|
81
|
+
hash,
|
|
82
|
+
sheet: sheet + '\n',
|
|
92
83
|
});
|
|
93
|
-
}
|
|
84
|
+
});
|
|
94
85
|
};
|
|
95
86
|
Object.entries(nonFlatBase).forEach(([selector, style]) => {
|
|
96
87
|
processSelectorStyle(selector, style, undefined);
|