css-in-js-engine-pb 0.1.1 → 0.1.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertWithBucket.d.ts","sourceRoot":"","sources":["../src/insertWithBucket.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"insertWithBucket.d.ts","sourceRoot":"","sources":["../src/insertWithBucket.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiB5C,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,WAAW,QAwBtB"}
|
package/dist/insertWithBucket.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { insertRulesOnce } from './insertOnce';
|
|
2
2
|
import { StyleBucket } from './StyleBucket';
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const
|
|
3
|
+
const bucketRules = new Map();
|
|
4
|
+
let highestFlushedBucket = -1;
|
|
5
|
+
const ORDER = [
|
|
6
6
|
StyleBucket.Reset,
|
|
7
7
|
StyleBucket.Base,
|
|
8
8
|
StyleBucket.Appearance,
|
|
@@ -15,21 +15,22 @@ const orderedBuckets = [
|
|
|
15
15
|
export function insertRulesWithBucket(rules, bucket) {
|
|
16
16
|
if (!rules.length)
|
|
17
17
|
return;
|
|
18
|
-
const existing =
|
|
18
|
+
const existing = bucketRules.get(bucket);
|
|
19
19
|
if (existing) {
|
|
20
20
|
existing.push(...rules);
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
|
|
23
|
+
bucketRules.set(bucket, [...rules]);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
const bucketIndex = ORDER.indexOf(bucket);
|
|
26
|
+
// Flush all buckets up to this one
|
|
27
|
+
for (let i = highestFlushedBucket + 1; i <= bucketIndex; i++) {
|
|
28
|
+
const b = ORDER[i];
|
|
29
|
+
const r = bucketRules.get(b);
|
|
30
|
+
if (r && r.length) {
|
|
31
|
+
insertRulesOnce(r);
|
|
32
|
+
bucketRules.set(b, []);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
highestFlushedBucket = Math.max(highestFlushedBucket, bucketIndex);
|
|
35
36
|
}
|