css-in-js-engine-pb 0.1.3 → 0.1.4

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;AAiB5C,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,WAAW,QA6BtB"}
1
+ {"version":3,"file":"insertWithBucket.d.ts","sourceRoot":"","sources":["../src/insertWithBucket.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAgB5C,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,WAAW,QAsBtB"}
@@ -1,7 +1,7 @@
1
1
  import { insertRulesOnce } from './insertOnce';
2
2
  import { StyleBucket } from './StyleBucket';
3
3
  const bucketRules = new Map();
4
- let highestFlushedBucket = -1;
4
+ const insertedBuckets = new Set();
5
5
  const ORDER = [
6
6
  StyleBucket.Reset,
7
7
  StyleBucket.Base,
@@ -22,17 +22,14 @@ export function insertRulesWithBucket(rules, bucket) {
22
22
  else {
23
23
  bucketRules.set(bucket, [...rules]);
24
24
  }
25
- const bucketIndex = ORDER.indexOf(bucket);
26
- if (bucketIndex === -1) {
27
- throw new Error(`StyleBucket ${bucket} is not in ORDER. Check enum/imports.`);
28
- }
29
- for (let i = highestFlushedBucket + 1; i <= bucketIndex; i++) {
30
- const b = ORDER[i];
31
- const r = bucketRules.get(b);
32
- if (r && r.length) {
33
- insertRulesOnce(r);
34
- bucketRules.set(b, []);
25
+ if (!insertedBuckets.has(bucket)) {
26
+ insertedBuckets.add(bucket);
27
+ for (const b of ORDER) {
28
+ const r = bucketRules.get(b);
29
+ if (r && r.length) {
30
+ insertRulesOnce(r);
31
+ bucketRules.set(b, []);
32
+ }
35
33
  }
36
34
  }
37
- highestFlushedBucket = Math.max(highestFlushedBucket, bucketIndex);
38
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "css-in-js-engine-pb",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A lightweight atomic CSS-in-JS engine built on the native CSS cascade",
5
5
  "license": "MIT",
6
6
  "type": "module",