zss-engine 1.1.0 → 1.2.0
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.
|
@@ -29,11 +29,11 @@ Object.entries(shorthand_js_1.SHORTHAND_PROPERTIES).forEach(([shorthand, longhan
|
|
|
29
29
|
LONG_TO_SHORT[long] = shorthand;
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
function processAtomicProps(flatProps,
|
|
32
|
+
function processAtomicProps(flatProps, atomicMap, parentAtRule) {
|
|
33
33
|
const resultQueue = [];
|
|
34
34
|
for (const [property, value] of Object.entries(flatProps)) {
|
|
35
35
|
if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
36
|
-
processAtomicProps(value,
|
|
36
|
+
processAtomicProps(value, atomicMap, property);
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
39
|
resultQueue.push([property, value]);
|
|
@@ -44,13 +44,12 @@ function processAtomicProps(flatProps, atomicHashes, allStyleSheets, parentAtRul
|
|
|
44
44
|
const singlePropObj = { [property]: normalizedValue };
|
|
45
45
|
const styleObj = parentAtRule ? { [parentAtRule]: singlePropObj } : singlePropObj;
|
|
46
46
|
const atomicHash = (0, index_js_1.genBase36Hash)(styleObj, 1, 8);
|
|
47
|
-
if (
|
|
47
|
+
if (atomicMap.has(atomicHash))
|
|
48
48
|
continue;
|
|
49
|
-
atomicHashes.add(atomicHash);
|
|
50
49
|
let styleSheet = (0, index_js_1.transpileAtomic)(property, value, atomicHash);
|
|
51
50
|
if (parentAtRule) {
|
|
52
51
|
styleSheet = `${parentAtRule} { ${styleSheet} }`;
|
|
53
52
|
}
|
|
54
|
-
|
|
53
|
+
atomicMap.set(atomicHash, styleSheet + '\n');
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -25,11 +25,11 @@ Object.entries(SHORTHAND_PROPERTIES).forEach(([shorthand, longhands]) => {
|
|
|
25
25
|
LONG_TO_SHORT[long] = shorthand;
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
function processAtomicProps(flatProps,
|
|
28
|
+
function processAtomicProps(flatProps, atomicMap, parentAtRule) {
|
|
29
29
|
const resultQueue = [];
|
|
30
30
|
for (const [property, value] of Object.entries(flatProps)) {
|
|
31
31
|
if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
32
|
-
processAtomicProps(value,
|
|
32
|
+
processAtomicProps(value, atomicMap, property);
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
resultQueue.push([property, value]);
|
|
@@ -40,14 +40,13 @@ function processAtomicProps(flatProps, atomicHashes, allStyleSheets, parentAtRul
|
|
|
40
40
|
const singlePropObj = { [property]: normalizedValue };
|
|
41
41
|
const styleObj = parentAtRule ? { [parentAtRule]: singlePropObj } : singlePropObj;
|
|
42
42
|
const atomicHash = genBase36Hash(styleObj, 1, 8);
|
|
43
|
-
if (
|
|
43
|
+
if (atomicMap.has(atomicHash))
|
|
44
44
|
continue;
|
|
45
|
-
atomicHashes.add(atomicHash);
|
|
46
45
|
let styleSheet = transpileAtomic(property, value, atomicHash);
|
|
47
46
|
if (parentAtRule) {
|
|
48
47
|
styleSheet = `${parentAtRule} { ${styleSheet} }`;
|
|
49
48
|
}
|
|
50
|
-
|
|
49
|
+
atomicMap.set(atomicHash, styleSheet + '\n');
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
export { splitAtomicAndNested, processAtomicProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CSSProperties, CreateStyle } from '../index.js';
|
|
2
2
|
declare function splitAtomicAndNested(obj: CSSProperties, flat: CreateStyle, nonFlat: CreateStyle): void;
|
|
3
|
-
declare function processAtomicProps(flatProps: CSSProperties,
|
|
3
|
+
declare function processAtomicProps(flatProps: CSSProperties, atomicMap: Map<string, string>, parentAtRule?: string): void;
|
|
4
4
|
export { splitAtomicAndNested, processAtomicProps };
|