@webstudio-is/css-engine 0.34.0 → 0.35.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.
@@ -104,6 +104,12 @@ class CssEngine {
104
104
  unmount() {
105
105
  __privateGet(this, _element).unmount();
106
106
  }
107
+ setAttribute(name, value) {
108
+ __privateGet(this, _element).setAttribute(name, value);
109
+ }
110
+ getAttribute(name) {
111
+ return __privateGet(this, _element).getAttribute(name);
112
+ }
107
113
  get cssText() {
108
114
  if (__privateGet(this, _isDirty) === false) {
109
115
  return __privateGet(this, _cssText);
@@ -67,6 +67,16 @@ class StyleElement {
67
67
  __privateGet(this, _element).textContent = cssText;
68
68
  }
69
69
  }
70
+ setAttribute(name, value) {
71
+ if (__privateGet(this, _element)) {
72
+ __privateGet(this, _element).setAttribute(name, value);
73
+ }
74
+ }
75
+ getAttribute(name) {
76
+ if (__privateGet(this, _element)) {
77
+ return __privateGet(this, _element).getAttribute(name);
78
+ }
79
+ }
70
80
  }
71
81
  _element = new WeakMap();
72
82
  _name = new WeakMap();
@@ -86,6 +86,12 @@ class CssEngine {
86
86
  unmount() {
87
87
  __privateGet(this, _element).unmount();
88
88
  }
89
+ setAttribute(name, value) {
90
+ __privateGet(this, _element).setAttribute(name, value);
91
+ }
92
+ getAttribute(name) {
93
+ return __privateGet(this, _element).getAttribute(name);
94
+ }
89
95
  get cssText() {
90
96
  if (__privateGet(this, _isDirty) === false) {
91
97
  return __privateGet(this, _cssText);
@@ -44,6 +44,16 @@ class StyleElement {
44
44
  __privateGet(this, _element).textContent = cssText;
45
45
  }
46
46
  }
47
+ setAttribute(name, value) {
48
+ if (__privateGet(this, _element)) {
49
+ __privateGet(this, _element).setAttribute(name, value);
50
+ }
51
+ }
52
+ getAttribute(name) {
53
+ if (__privateGet(this, _element)) {
54
+ return __privateGet(this, _element).getAttribute(name);
55
+ }
56
+ }
47
57
  }
48
58
  _element = new WeakMap();
49
59
  _name = new WeakMap();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-engine",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "CSS Renderer for Webstudio",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -9,7 +9,7 @@
9
9
  "hyphenate-style-name": "^1.0.4",
10
10
  "react": "^17.0.2",
11
11
  "react-dom": "^17.0.2",
12
- "@webstudio-is/fonts": "^0.34.0"
12
+ "@webstudio-is/fonts": "^0.35.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@jest/globals": "^29.3.1",
@@ -21,7 +21,7 @@
21
21
  "@types/react-dom": "^17.0.9",
22
22
  "jest": "^29.3.1",
23
23
  "typescript": "4.9.5",
24
- "@webstudio-is/css-data": "^0.34.0",
24
+ "@webstudio-is/css-data": "^0.35.0",
25
25
  "@webstudio-is/jest-config": "^1.0.2",
26
26
  "@webstudio-is/scripts": "^0.0.0",
27
27
  "@webstudio-is/storybook-config": "^0.0.0",
@@ -73,6 +73,12 @@ export class CssEngine {
73
73
  unmount() {
74
74
  this.#element.unmount();
75
75
  }
76
+ setAttribute(name: string, value: string) {
77
+ this.#element.setAttribute(name, value);
78
+ }
79
+ getAttribute(name: string) {
80
+ return this.#element.getAttribute(name);
81
+ }
76
82
  get cssText() {
77
83
  if (this.#isDirty === false) {
78
84
  return this.#cssText;
@@ -25,4 +25,14 @@ export class StyleElement {
25
25
  this.#element.textContent = cssText;
26
26
  }
27
27
  }
28
+ setAttribute(name: string, value: string) {
29
+ if (this.#element) {
30
+ this.#element.setAttribute(name, value);
31
+ }
32
+ }
33
+ getAttribute(name: string) {
34
+ if (this.#element) {
35
+ return this.#element.getAttribute(name);
36
+ }
37
+ }
28
38
  }