css-engine-test-pb 0.2.0 → 0.2.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.
@@ -36,22 +36,33 @@ export class InsertionFactory {
36
36
  return;
37
37
  }
38
38
  bucketSet.add(cssRule);
39
- styleElement.textContent += cssRule + '\n';
39
+ const sheet = styleElement.sheet;
40
+ if (sheet) {
41
+ sheet.insertRule(cssRule, sheet.cssRules.length);
42
+ }
40
43
  }
41
44
  getCSSString() {
42
45
  const allRules = [];
43
46
  this.bucketOrder.forEach(bucket => {
44
47
  const styleElement = this.bucketElements.get(bucket);
45
- if (styleElement && styleElement.textContent) {
46
- allRules.push(styleElement.textContent);
48
+ if (styleElement?.sheet) {
49
+ const rules = styleElement.sheet.cssRules;
50
+ for (let i = 0; i < rules.length; i++) {
51
+ allRules.push(rules[i].cssText);
52
+ }
47
53
  }
48
54
  });
49
- return allRules.join('');
55
+ return allRules.join('\n');
50
56
  }
51
57
  clear() {
52
58
  this.bucketRules.forEach(set => set.clear());
53
59
  this.bucketElements.forEach(el => {
54
- el.textContent = '';
60
+ const sheet = el.sheet;
61
+ if (sheet) {
62
+ while (sheet.cssRules.length > 0) {
63
+ sheet.deleteRule(0);
64
+ }
65
+ }
55
66
  });
56
67
  }
57
68
  }
@@ -1 +1 @@
1
- export declare function mergeClasses(...classNames: (string | false | null | undefined)[]): string;
1
+ export declare function mergeClasses(...classNames: (string | number | false | null | undefined)[]): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "css-engine-test-pb",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",