@node-projects/web-component-designer 0.1.60 → 0.1.62
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,15 +36,17 @@ export class AbstractStylesheetService {
|
|
|
36
36
|
else if (stylesheets != null) {
|
|
37
37
|
targetMap.clear();
|
|
38
38
|
for (let stylesheet of stylesheets) {
|
|
39
|
+
let ast = null;
|
|
39
40
|
try {
|
|
40
|
-
|
|
41
|
-
stylesheet: stylesheet,
|
|
42
|
-
ast: await this.internalParse(stylesheet.content)
|
|
43
|
-
});
|
|
41
|
+
ast = await this.internalParse(stylesheet.content);
|
|
44
42
|
}
|
|
45
43
|
catch (err) {
|
|
46
44
|
console.warn("error parsing stylesheet", stylesheet, err);
|
|
47
45
|
}
|
|
46
|
+
targetMap.set(stylesheet.name, {
|
|
47
|
+
stylesheet: stylesheet,
|
|
48
|
+
ast: ast
|
|
49
|
+
});
|
|
48
50
|
}
|
|
49
51
|
if (targetMap == this._stylesheets)
|
|
50
52
|
this.stylesheetsChanged.emit();
|
|
@@ -94,7 +96,7 @@ export class AbstractStylesheetService {
|
|
|
94
96
|
}
|
|
95
97
|
return style;
|
|
96
98
|
}
|
|
97
|
-
static traverseAndCollectRules(ruleContainer) {
|
|
99
|
+
static traverseAndCollectRules(ruleContainer, noPatch = false) {
|
|
98
100
|
let t = '';
|
|
99
101
|
for (let rule of ruleContainer.cssRules) {
|
|
100
102
|
if ((rule instanceof CSSContainerRule
|
|
@@ -108,18 +110,23 @@ export class AbstractStylesheetService {
|
|
|
108
110
|
t += rule.cssText;
|
|
109
111
|
}
|
|
110
112
|
else if (rule instanceof CSSStyleRule) {
|
|
111
|
-
let parts = rule.selectorText.split(',');
|
|
112
113
|
let sel = "";
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
if (!noPatch) {
|
|
115
|
+
let parts = rule.selectorText.split(',');
|
|
116
|
+
for (let p of parts) {
|
|
117
|
+
if (p == ':host')
|
|
118
|
+
sel += DesignerCanvas.cssprefixConstant;
|
|
119
|
+
else if (p.includes(DesignerCanvas.cssprefixConstant)) {
|
|
120
|
+
sel += p;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (sel)
|
|
124
|
+
sel += ',';
|
|
125
|
+
sel += DesignerCanvas.cssprefixConstant + p.trimStart();
|
|
119
126
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
sel
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
sel = rule.selectorText;
|
|
123
130
|
}
|
|
124
131
|
t += sel;
|
|
125
132
|
let cssText = rule.style.cssText;
|
|
@@ -131,10 +138,12 @@ export class AbstractStylesheetService {
|
|
|
131
138
|
cssText += e[0] + ':' + e[1].toString() + ';';
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
|
-
t += '{' + cssText
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
141
|
+
t += '{' + cssText;
|
|
142
|
+
if (rule.cssRules?.length) {
|
|
143
|
+
const part = this.traverseAndCollectRules(rule, true);
|
|
144
|
+
t += part;
|
|
145
|
+
}
|
|
146
|
+
t += '}';
|
|
138
147
|
}
|
|
139
148
|
}
|
|
140
149
|
return t;
|
|
@@ -64,7 +64,7 @@ export class UndoService {
|
|
|
64
64
|
}
|
|
65
65
|
clearTransactionstackIfNotEmpty() {
|
|
66
66
|
if (this._transactionStack.length) {
|
|
67
|
-
console.
|
|
67
|
+
console.error("transactionStack was not empty, but should be", this._transactionStack);
|
|
68
68
|
this._transactionStack = [];
|
|
69
69
|
}
|
|
70
70
|
}
|