@nativescript/core 8.8.0-embed.0 → 8.8.0-embed.1-next-07-02-2024-9764786230
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.
- package/application/application-common.d.ts +2 -1
- package/application/application-common.js +21 -7
- package/application/application-common.js.map +1 -1
- package/application/application.android.d.ts +1 -1
- package/application/application.android.js +1 -1
- package/application/application.android.js.map +1 -1
- package/application/application.ios.d.ts +1 -1
- package/application/application.ios.js +2 -2
- package/application/application.ios.js.map +1 -1
- package/config/config.interface.d.ts +30 -0
- package/css/parser.d.ts +0 -38
- package/css/parser.js +0 -108
- package/css/parser.js.map +1 -1
- package/css/reworkcss.d.ts +15 -1
- package/css/system-classes.d.ts +1 -0
- package/css/system-classes.js +1 -0
- package/css/system-classes.js.map +1 -1
- package/css-mediaquery/index.d.ts +27 -0
- package/css-mediaquery/index.js +118 -0
- package/css-mediaquery/index.js.map +1 -0
- package/globals/index.js +2 -0
- package/globals/index.js.map +1 -1
- package/media-query-list/index.d.ts +21 -0
- package/media-query-list/index.js +169 -0
- package/media-query-list/index.js.map +1 -0
- package/package.json +2 -1
- package/platform/{index.android.d.ts → device/index.android.d.ts} +1 -16
- package/platform/{index.android.js → device/index.android.js} +4 -47
- package/platform/device/index.android.js.map +1 -0
- package/platform/device/index.d.ts +70 -0
- package/platform/{index.ios.d.ts → device/index.ios.d.ts} +1 -14
- package/platform/{index.ios.js → device/index.ios.js} +1 -34
- package/platform/device/index.ios.js.map +1 -0
- package/platform/index.d.ts +2 -118
- package/platform/index.js +4 -0
- package/platform/index.js.map +1 -0
- package/platform/screen/index.android.d.ts +16 -0
- package/platform/screen/index.android.js +41 -0
- package/platform/screen/index.android.js.map +1 -0
- package/platform/screen/index.d.ts +48 -0
- package/platform/screen/index.ios.d.ts +15 -0
- package/platform/screen/index.ios.js +35 -0
- package/platform/screen/index.ios.js.map +1 -0
- package/platforms/android/widgets-release.aar +0 -0
- package/profiling/index.js.map +1 -1
- package/trace/index.d.ts +1 -0
- package/trace/index.js +2 -1
- package/trace/index.js.map +1 -1
- package/ui/action-bar/index.android.d.ts +0 -2
- package/ui/action-bar/index.android.js +0 -26
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/activity-indicator/index.android.js +3 -2
- package/ui/activity-indicator/index.android.js.map +1 -1
- package/ui/animation/keyframe-animation.d.ts +3 -0
- package/ui/animation/keyframe-animation.js +4 -2
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/index.js.map +1 -1
- package/ui/builder/xml2ui.js.map +1 -1
- package/ui/button/index.android.d.ts +0 -2
- package/ui/button/index.android.js +0 -26
- package/ui/button/index.android.js.map +1 -1
- package/ui/core/view/index.android.d.ts +1 -1
- package/ui/core/view/index.android.js +49 -45
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/view-common.d.ts +1 -1
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.android.d.ts +7 -0
- package/ui/core/view/view-helper/index.android.js +53 -0
- package/ui/core/view/view-helper/index.android.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +10 -0
- package/ui/core/view/view-helper/index.ios.d.ts +1 -0
- package/ui/core/view/view-helper/index.ios.js +1 -0
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view-base/index.d.ts +7 -0
- package/ui/core/view-base/index.js +11 -2
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/frame/fragment.d.ts +5 -0
- package/ui/frame/fragment.ios.d.ts +3 -0
- package/ui/frame/fragment.ios.js +4 -0
- package/ui/frame/fragment.ios.js.map +1 -0
- package/ui/frame/index.android.d.ts +1 -1
- package/ui/frame/index.android.js +2 -2
- package/ui/frame/index.android.js.map +1 -1
- package/ui/index.d.ts +1 -1
- package/ui/index.js +1 -1
- package/ui/index.js.map +1 -1
- package/ui/layouts/grid-layout/grid-layout-common.d.ts +7 -2
- package/ui/layouts/grid-layout/grid-layout-common.js +32 -6
- package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
- package/ui/layouts/grid-layout/index.android.d.ts +9 -3
- package/ui/layouts/grid-layout/index.android.js +65 -38
- package/ui/layouts/grid-layout/index.android.js.map +1 -1
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/page/index.android.js +5 -2
- package/ui/page/index.android.js.map +1 -1
- package/ui/progress/index.android.js +5 -4
- package/ui/progress/index.android.js.map +1 -1
- package/ui/segmented-bar/index.android.js +4 -13
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/slider/index.android.js +7 -4
- package/ui/slider/index.android.js.map +1 -1
- package/ui/styling/css-selector.d.ts +88 -32
- package/ui/styling/css-selector.js +484 -130
- package/ui/styling/css-selector.js.map +1 -1
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/style-properties.js +1 -1
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js +288 -138
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/switch/index.android.js +7 -6
- package/ui/switch/index.android.js.map +1 -1
- package/ui/tab-view/index.android.js +10 -14
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/transition/page-transition.android.d.ts +2 -1
- package/ui/transition/page-transition.android.js +11 -4
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/utils.d.ts +5 -1
- package/ui/utils.ios.d.ts +1 -10
- package/ui/utils.ios.js.map +1 -1
- package/platform/index.android.js.map +0 -1
- package/platform/index.ios.js.map +0 -1
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { parse as convertToCSSWhatSelector } from 'css-what';
|
|
1
2
|
import '../../globals';
|
|
2
3
|
import { isCssVariable } from '../core/properties';
|
|
3
4
|
import { isNullOrUndefined } from '../../utils/types';
|
|
4
|
-
import {
|
|
5
|
+
import { CSSUtils } from '../../css/system-classes';
|
|
6
|
+
import { checkIfMediaQueryMatches } from '../../media-query-list';
|
|
7
|
+
export const MEDIA_QUERY_SEPARATOR = '&&';
|
|
8
|
+
var Combinator;
|
|
9
|
+
(function (Combinator) {
|
|
10
|
+
Combinator["descendant"] = " ";
|
|
11
|
+
Combinator["child"] = ">";
|
|
12
|
+
Combinator["adjacent"] = "+";
|
|
13
|
+
Combinator["sibling"] = "~";
|
|
14
|
+
// Not supported
|
|
15
|
+
Combinator["parent"] = "<";
|
|
16
|
+
Combinator["column-combinator"] = "||";
|
|
17
|
+
})(Combinator || (Combinator = {}));
|
|
18
|
+
var AttributeSelectorOperator;
|
|
19
|
+
(function (AttributeSelectorOperator) {
|
|
20
|
+
AttributeSelectorOperator["exists"] = "";
|
|
21
|
+
AttributeSelectorOperator["equals"] = "=";
|
|
22
|
+
AttributeSelectorOperator["start"] = "^=";
|
|
23
|
+
AttributeSelectorOperator["end"] = "$=";
|
|
24
|
+
AttributeSelectorOperator["any"] = "*=";
|
|
25
|
+
AttributeSelectorOperator["element"] = "~=";
|
|
26
|
+
AttributeSelectorOperator["hyphen"] = "|=";
|
|
27
|
+
})(AttributeSelectorOperator || (AttributeSelectorOperator = {}));
|
|
5
28
|
var Match;
|
|
6
29
|
(function (Match) {
|
|
7
30
|
/**
|
|
@@ -13,7 +36,22 @@ var Match;
|
|
|
13
36
|
*/
|
|
14
37
|
Match.Static = false;
|
|
15
38
|
})(Match || (Match = {}));
|
|
16
|
-
function
|
|
39
|
+
function eachNodePreviousGeneralSibling(node, callback) {
|
|
40
|
+
if (!node.parent || !node.parent.getChildIndex || !node.parent.getChildAt || !node.parent.getChildrenCount) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const nodeIndex = node.parent.getChildIndex(node);
|
|
44
|
+
if (nodeIndex === 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const count = node.parent.getChildrenCount();
|
|
48
|
+
let retVal = true;
|
|
49
|
+
for (let i = nodeIndex - 1; i >= 0 && retVal; i--) {
|
|
50
|
+
const sibling = node.parent.getChildAt(i);
|
|
51
|
+
retVal = callback(sibling);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function getNodePreviousDirectSibling(node) {
|
|
17
55
|
if (!node.parent || !node.parent.getChildIndex || !node.parent.getChildAt) {
|
|
18
56
|
return null;
|
|
19
57
|
}
|
|
@@ -32,7 +70,19 @@ function SelectorProperties(specificity, rarity, dynamic = false) {
|
|
|
32
70
|
return cls;
|
|
33
71
|
};
|
|
34
72
|
}
|
|
35
|
-
|
|
73
|
+
function FunctionalPseudoClassProperties(specificity, rarity, pseudoSelectorListType) {
|
|
74
|
+
return (cls) => {
|
|
75
|
+
cls.prototype.specificity = specificity;
|
|
76
|
+
cls.prototype.rarity = rarity;
|
|
77
|
+
cls.prototype.combinator = undefined;
|
|
78
|
+
cls.prototype.dynamic = false;
|
|
79
|
+
cls.prototype.pseudoSelectorListType = pseudoSelectorListType;
|
|
80
|
+
return cls;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export class SelectorBase {
|
|
84
|
+
}
|
|
85
|
+
let SelectorCore = class SelectorCore extends SelectorBase {
|
|
36
86
|
lookupSort(sorter, base) {
|
|
37
87
|
sorter.sortAsUniversal(base || this);
|
|
38
88
|
}
|
|
@@ -69,7 +119,7 @@ let InvalidSelector = class InvalidSelector extends SimpleSelector {
|
|
|
69
119
|
this.e = e;
|
|
70
120
|
}
|
|
71
121
|
toString() {
|
|
72
|
-
return
|
|
122
|
+
return `<${this.e}>`;
|
|
73
123
|
}
|
|
74
124
|
match(node) {
|
|
75
125
|
return false;
|
|
@@ -158,52 +208,55 @@ ClassSelector = __decorate([
|
|
|
158
208
|
], ClassSelector);
|
|
159
209
|
export { ClassSelector };
|
|
160
210
|
let AttributeSelector = class AttributeSelector extends SimpleSelector {
|
|
161
|
-
constructor(attribute, test, value) {
|
|
211
|
+
constructor(attribute, test, value, ignoreCase) {
|
|
162
212
|
super();
|
|
163
213
|
this.attribute = attribute;
|
|
164
214
|
this.test = test;
|
|
165
215
|
this.value = value;
|
|
166
|
-
|
|
167
|
-
// HasAttribute
|
|
168
|
-
this.match = (node) => !isNullOrUndefined(node[attribute]);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (!value) {
|
|
172
|
-
this.match = (node) => false;
|
|
173
|
-
}
|
|
174
|
-
this.match = (node) => {
|
|
175
|
-
const attr = node[attribute] + '';
|
|
176
|
-
if (test === '=') {
|
|
177
|
-
// Equals
|
|
178
|
-
return attr === value;
|
|
179
|
-
}
|
|
180
|
-
if (test === '^=') {
|
|
181
|
-
// PrefixMatch
|
|
182
|
-
return attr.startsWith(value);
|
|
183
|
-
}
|
|
184
|
-
if (test === '$=') {
|
|
185
|
-
// SuffixMatch
|
|
186
|
-
return attr.endsWith(value);
|
|
187
|
-
}
|
|
188
|
-
if (test === '*=') {
|
|
189
|
-
// SubstringMatch
|
|
190
|
-
return attr.indexOf(value) !== -1;
|
|
191
|
-
}
|
|
192
|
-
if (test === '~=') {
|
|
193
|
-
// Includes
|
|
194
|
-
const words = attr.split(' ');
|
|
195
|
-
return words && words.indexOf(value) !== -1;
|
|
196
|
-
}
|
|
197
|
-
if (test === '|=') {
|
|
198
|
-
// DashMatch
|
|
199
|
-
return attr === value || attr.startsWith(value + '-');
|
|
200
|
-
}
|
|
201
|
-
};
|
|
216
|
+
this.ignoreCase = ignoreCase;
|
|
202
217
|
}
|
|
203
218
|
toString() {
|
|
204
|
-
return `[${this.attribute}${wrap(this.test)}${
|
|
219
|
+
return `[${this.attribute}${wrap(AttributeSelectorOperator[this.test] ?? this.test)}${this.value || ''}]${wrap(this.combinator)}`;
|
|
205
220
|
}
|
|
206
221
|
match(node) {
|
|
222
|
+
let attr = node[this.attribute];
|
|
223
|
+
if (this.test === 'exists') {
|
|
224
|
+
return !isNullOrUndefined(attr);
|
|
225
|
+
}
|
|
226
|
+
if (!this.value) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
// Now, convert value to string
|
|
230
|
+
attr += '';
|
|
231
|
+
if (this.ignoreCase) {
|
|
232
|
+
attr = attr.toLowerCase();
|
|
233
|
+
this.value = this.value.toLowerCase();
|
|
234
|
+
}
|
|
235
|
+
// =
|
|
236
|
+
if (this.test === 'equals') {
|
|
237
|
+
return attr === this.value;
|
|
238
|
+
}
|
|
239
|
+
// ^=
|
|
240
|
+
if (this.test === 'start') {
|
|
241
|
+
return attr.startsWith(this.value);
|
|
242
|
+
}
|
|
243
|
+
// $=
|
|
244
|
+
if (this.test === 'end') {
|
|
245
|
+
return attr.endsWith(this.value);
|
|
246
|
+
}
|
|
247
|
+
// *=
|
|
248
|
+
if (this.test === 'any') {
|
|
249
|
+
return attr.indexOf(this.value) !== -1;
|
|
250
|
+
}
|
|
251
|
+
// ~=
|
|
252
|
+
if (this.test === 'element') {
|
|
253
|
+
const words = attr.split(' ');
|
|
254
|
+
return words && words.indexOf(this.value) !== -1;
|
|
255
|
+
}
|
|
256
|
+
// |=
|
|
257
|
+
if (this.test === 'hyphen') {
|
|
258
|
+
return attr === this.value || attr.startsWith(this.value + '-');
|
|
259
|
+
}
|
|
207
260
|
return false;
|
|
208
261
|
}
|
|
209
262
|
mayMatch(node) {
|
|
@@ -215,7 +268,7 @@ let AttributeSelector = class AttributeSelector extends SimpleSelector {
|
|
|
215
268
|
};
|
|
216
269
|
AttributeSelector = __decorate([
|
|
217
270
|
SelectorProperties(10 /* Specificity.Attribute */, 0 /* Rarity.Attribute */, Match.Dynamic),
|
|
218
|
-
__metadata("design:paramtypes", [String, String, String])
|
|
271
|
+
__metadata("design:paramtypes", [String, String, String, Boolean])
|
|
219
272
|
], AttributeSelector);
|
|
220
273
|
export { AttributeSelector };
|
|
221
274
|
let PseudoClassSelector = class PseudoClassSelector extends SimpleSelector {
|
|
@@ -241,12 +294,100 @@ PseudoClassSelector = __decorate([
|
|
|
241
294
|
__metadata("design:paramtypes", [String])
|
|
242
295
|
], PseudoClassSelector);
|
|
243
296
|
export { PseudoClassSelector };
|
|
297
|
+
export class FunctionalPseudoClassSelector extends PseudoClassSelector {
|
|
298
|
+
constructor(cssPseudoClass, dataType) {
|
|
299
|
+
super(cssPseudoClass);
|
|
300
|
+
const selectors = [];
|
|
301
|
+
const needsHighestSpecificity = this.specificity === -1 /* Specificity.SelectorListHighest */;
|
|
302
|
+
let specificity = 0;
|
|
303
|
+
if (Array.isArray(dataType)) {
|
|
304
|
+
for (const asts of dataType) {
|
|
305
|
+
const selector = createSelectorFromAst(asts);
|
|
306
|
+
if (selector instanceof InvalidSelector) {
|
|
307
|
+
// Only forgiving selector list can ignore invalid selectors
|
|
308
|
+
if (this.selectorListType !== 1 /* PseudoClassSelectorList.Forgiving */) {
|
|
309
|
+
selectors.splice(0);
|
|
310
|
+
specificity = 0;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
// The specificity of some pseudo-classes is replaced by the specificity of the most specific selector in its comma-separated argument of selectors
|
|
316
|
+
if (needsHighestSpecificity && selector.specificity > specificity) {
|
|
317
|
+
specificity = selector.specificity;
|
|
318
|
+
}
|
|
319
|
+
selectors.push(selector);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
this.selectors = selectors;
|
|
323
|
+
this.specificity = specificity;
|
|
324
|
+
// Functional pseudo-classes become dynamic based on selectors in selector list
|
|
325
|
+
this.dynamic = this.selectors.some((sel) => sel.dynamic);
|
|
326
|
+
}
|
|
327
|
+
toString() {
|
|
328
|
+
return `:${this.cssPseudoClass}(${this.selectors.join(', ')})${wrap(this.combinator)}`;
|
|
329
|
+
}
|
|
330
|
+
match(node) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
mayMatch(node) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
trackChanges(node, map) {
|
|
337
|
+
this.selectors.forEach((sel) => sel.trackChanges(node, map));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
let NotFunctionalPseudoClassSelector = class NotFunctionalPseudoClassSelector extends FunctionalPseudoClassSelector {
|
|
341
|
+
match(node) {
|
|
342
|
+
return !this.selectors.some((sel) => sel.match(node));
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
NotFunctionalPseudoClassSelector = __decorate([
|
|
346
|
+
FunctionalPseudoClassProperties(-1 /* Specificity.SelectorListHighest */, 0 /* Rarity.PseudoClass */, 0 /* PseudoClassSelectorList.Regular */)
|
|
347
|
+
], NotFunctionalPseudoClassSelector);
|
|
348
|
+
export { NotFunctionalPseudoClassSelector };
|
|
349
|
+
let IsFunctionalPseudoClassSelector = class IsFunctionalPseudoClassSelector extends FunctionalPseudoClassSelector {
|
|
350
|
+
match(node) {
|
|
351
|
+
return this.selectors.some((sel) => sel.match(node));
|
|
352
|
+
}
|
|
353
|
+
lookupSort(sorter, base) {
|
|
354
|
+
// A faster lookup can be performed when selector list contains just a single selector
|
|
355
|
+
if (this.selectors.length === 1) {
|
|
356
|
+
this.selectors[0].lookupSort(sorter, base || this);
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
super.lookupSort(sorter, base || this);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
IsFunctionalPseudoClassSelector = __decorate([
|
|
364
|
+
FunctionalPseudoClassProperties(-1 /* Specificity.SelectorListHighest */, 0 /* Rarity.PseudoClass */, 1 /* PseudoClassSelectorList.Forgiving */)
|
|
365
|
+
], IsFunctionalPseudoClassSelector);
|
|
366
|
+
export { IsFunctionalPseudoClassSelector };
|
|
367
|
+
let WhereFunctionalPseudoClassSelector = class WhereFunctionalPseudoClassSelector extends FunctionalPseudoClassSelector {
|
|
368
|
+
match(node) {
|
|
369
|
+
return this.selectors.some((sel) => sel.match(node));
|
|
370
|
+
}
|
|
371
|
+
lookupSort(sorter, base) {
|
|
372
|
+
// A faster lookup can be performed when selector list contains just a single selector
|
|
373
|
+
if (this.selectors.length === 1) {
|
|
374
|
+
this.selectors[0].lookupSort(sorter, base || this);
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
super.lookupSort(sorter, base || this);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
WhereFunctionalPseudoClassSelector = __decorate([
|
|
382
|
+
FunctionalPseudoClassProperties(0 /* Specificity.Zero */, 0 /* Rarity.PseudoClass */, 1 /* PseudoClassSelectorList.Forgiving */)
|
|
383
|
+
], WhereFunctionalPseudoClassSelector);
|
|
384
|
+
export { WhereFunctionalPseudoClassSelector };
|
|
244
385
|
export class SimpleSelectorSequence extends SimpleSelector {
|
|
245
386
|
constructor(selectors) {
|
|
246
387
|
super();
|
|
247
388
|
this.selectors = selectors;
|
|
248
389
|
this.specificity = selectors.reduce((sum, sel) => sel.specificity + sum, 0);
|
|
249
|
-
this.head =
|
|
390
|
+
this.head = selectors.reduce((prev, curr) => (!prev || curr.rarity > prev.rarity ? curr : prev), null);
|
|
250
391
|
this.dynamic = selectors.some((sel) => sel.dynamic);
|
|
251
392
|
}
|
|
252
393
|
toString() {
|
|
@@ -265,34 +406,41 @@ export class SimpleSelectorSequence extends SimpleSelector {
|
|
|
265
406
|
this.head.lookupSort(sorter, base || this);
|
|
266
407
|
}
|
|
267
408
|
}
|
|
268
|
-
export class
|
|
409
|
+
export class ComplexSelector extends SelectorCore {
|
|
269
410
|
constructor(selectors) {
|
|
270
411
|
super();
|
|
271
412
|
this.selectors = selectors;
|
|
272
|
-
|
|
273
|
-
let
|
|
274
|
-
let lastGroup;
|
|
413
|
+
let siblingsToGroup;
|
|
414
|
+
let currentGroup;
|
|
275
415
|
const groups = [];
|
|
276
416
|
this.specificity = 0;
|
|
277
417
|
this.dynamic = false;
|
|
278
|
-
for (let i = selectors.length - 1; i
|
|
418
|
+
for (let i = selectors.length - 1; i >= 0; i--) {
|
|
279
419
|
const sel = selectors[i];
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
420
|
+
switch (sel.combinator) {
|
|
421
|
+
case undefined:
|
|
422
|
+
case Combinator.descendant:
|
|
423
|
+
siblingsToGroup = [];
|
|
424
|
+
currentGroup = [siblingsToGroup];
|
|
425
|
+
groups.push(currentGroup);
|
|
426
|
+
break;
|
|
427
|
+
case Combinator.child:
|
|
428
|
+
siblingsToGroup = [];
|
|
429
|
+
currentGroup.push(siblingsToGroup);
|
|
430
|
+
break;
|
|
431
|
+
case Combinator.adjacent:
|
|
432
|
+
case Combinator.sibling:
|
|
433
|
+
break;
|
|
434
|
+
default:
|
|
435
|
+
throw new Error(`Unsupported combinator "${sel.combinator}" for selector ${sel}.`);
|
|
288
436
|
}
|
|
289
437
|
this.specificity += sel.specificity;
|
|
290
438
|
if (sel.dynamic) {
|
|
291
439
|
this.dynamic = true;
|
|
292
440
|
}
|
|
293
|
-
|
|
441
|
+
siblingsToGroup.push(sel);
|
|
294
442
|
}
|
|
295
|
-
this.groups = groups.map((g) => new Selector.ChildGroup(g.map((
|
|
443
|
+
this.groups = groups.map((g) => new Selector.ChildGroup(g.map((selectors) => (selectors.length > 1 ? new Selector.SiblingGroup(selectors) : selectors[0]))));
|
|
296
444
|
this.last = selectors[selectors.length - 1];
|
|
297
445
|
}
|
|
298
446
|
toString() {
|
|
@@ -301,13 +449,13 @@ export class Selector extends SelectorCore {
|
|
|
301
449
|
match(node) {
|
|
302
450
|
return this.groups.every((group, i) => {
|
|
303
451
|
if (i === 0) {
|
|
304
|
-
node = group.
|
|
452
|
+
node = group.getMatchingNode(node, true);
|
|
305
453
|
return !!node;
|
|
306
454
|
}
|
|
307
455
|
else {
|
|
308
456
|
let ancestor = node;
|
|
309
457
|
while ((ancestor = ancestor.parent ?? ancestor._modalParent)) {
|
|
310
|
-
if ((node = group.
|
|
458
|
+
if ((node = group.getMatchingNode(ancestor, true))) {
|
|
311
459
|
return true;
|
|
312
460
|
}
|
|
313
461
|
}
|
|
@@ -315,8 +463,14 @@ export class Selector extends SelectorCore {
|
|
|
315
463
|
}
|
|
316
464
|
});
|
|
317
465
|
}
|
|
466
|
+
mayMatch(node) {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
trackChanges(node, map) {
|
|
470
|
+
this.selectors.forEach((sel) => sel.trackChanges(node, map));
|
|
471
|
+
}
|
|
318
472
|
lookupSort(sorter, base) {
|
|
319
|
-
this.last.lookupSort(sorter, this);
|
|
473
|
+
this.last.lookupSort(sorter, base || this);
|
|
320
474
|
}
|
|
321
475
|
accumulateChanges(node, map) {
|
|
322
476
|
if (!this.dynamic) {
|
|
@@ -325,7 +479,7 @@ export class Selector extends SelectorCore {
|
|
|
325
479
|
const bounds = [];
|
|
326
480
|
const mayMatch = this.groups.every((group, i) => {
|
|
327
481
|
if (i === 0) {
|
|
328
|
-
const nextNode = group.
|
|
482
|
+
const nextNode = group.getMatchingNode(node, false);
|
|
329
483
|
bounds.push({ left: node, right: node });
|
|
330
484
|
node = nextNode;
|
|
331
485
|
return !!node;
|
|
@@ -333,7 +487,7 @@ export class Selector extends SelectorCore {
|
|
|
333
487
|
else {
|
|
334
488
|
let ancestor = node;
|
|
335
489
|
while ((ancestor = ancestor.parent)) {
|
|
336
|
-
const nextNode = group.
|
|
490
|
+
const nextNode = group.getMatchingNode(ancestor, false);
|
|
337
491
|
if (nextNode) {
|
|
338
492
|
bounds.push({ left: ancestor, right: null });
|
|
339
493
|
node = nextNode;
|
|
@@ -366,37 +520,112 @@ export class Selector extends SelectorCore {
|
|
|
366
520
|
return mayMatch;
|
|
367
521
|
}
|
|
368
522
|
}
|
|
523
|
+
export var Selector;
|
|
369
524
|
(function (Selector) {
|
|
370
525
|
// Non-spec. Selector sequences are grouped by ancestor then by child combinators for easier backtracking.
|
|
371
|
-
class ChildGroup {
|
|
526
|
+
class ChildGroup extends SelectorBase {
|
|
372
527
|
constructor(selectors) {
|
|
528
|
+
super();
|
|
373
529
|
this.selectors = selectors;
|
|
374
530
|
this.dynamic = selectors.some((sel) => sel.dynamic);
|
|
375
531
|
}
|
|
532
|
+
getMatchingNode(node, strict) {
|
|
533
|
+
const funcName = strict ? 'match' : 'mayMatch';
|
|
534
|
+
return this.selectors.every((sel, i) => (node = i === 0 ? node : node.parent) && sel[funcName](node)) ? node : null;
|
|
535
|
+
}
|
|
376
536
|
match(node) {
|
|
377
|
-
return this.
|
|
537
|
+
return this.getMatchingNode(node, true) != null;
|
|
378
538
|
}
|
|
379
539
|
mayMatch(node) {
|
|
380
|
-
return this.
|
|
540
|
+
return this.getMatchingNode(node, false) != null;
|
|
381
541
|
}
|
|
382
542
|
trackChanges(node, map) {
|
|
383
|
-
this.selectors.forEach((sel, i) =>
|
|
543
|
+
this.selectors.forEach((sel, i) => {
|
|
544
|
+
if (i === 0) {
|
|
545
|
+
node && sel.trackChanges(node, map);
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
node = node.parent;
|
|
549
|
+
if (node && sel.mayMatch(node)) {
|
|
550
|
+
sel.trackChanges(node, map);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
});
|
|
384
554
|
}
|
|
385
555
|
}
|
|
386
556
|
Selector.ChildGroup = ChildGroup;
|
|
387
|
-
class SiblingGroup {
|
|
557
|
+
class SiblingGroup extends SelectorBase {
|
|
388
558
|
constructor(selectors) {
|
|
559
|
+
super();
|
|
389
560
|
this.selectors = selectors;
|
|
390
561
|
this.dynamic = selectors.some((sel) => sel.dynamic);
|
|
391
562
|
}
|
|
392
563
|
match(node) {
|
|
393
|
-
return this.selectors.every((sel, i) =>
|
|
564
|
+
return this.selectors.every((sel, i) => {
|
|
565
|
+
if (i === 0) {
|
|
566
|
+
return node && sel.match(node);
|
|
567
|
+
}
|
|
568
|
+
if (sel.combinator === Combinator.adjacent) {
|
|
569
|
+
node = getNodePreviousDirectSibling(node);
|
|
570
|
+
return node && sel.match(node);
|
|
571
|
+
}
|
|
572
|
+
// Sibling combinator
|
|
573
|
+
let isMatching = false;
|
|
574
|
+
eachNodePreviousGeneralSibling(node, (sibling) => {
|
|
575
|
+
isMatching = sel.match(sibling);
|
|
576
|
+
return !isMatching;
|
|
577
|
+
});
|
|
578
|
+
return isMatching;
|
|
579
|
+
});
|
|
394
580
|
}
|
|
395
581
|
mayMatch(node) {
|
|
396
|
-
return this.selectors.every((sel, i) =>
|
|
582
|
+
return this.selectors.every((sel, i) => {
|
|
583
|
+
if (i === 0) {
|
|
584
|
+
return node && sel.mayMatch(node);
|
|
585
|
+
}
|
|
586
|
+
if (sel.combinator === Combinator.adjacent) {
|
|
587
|
+
node = getNodePreviousDirectSibling(node);
|
|
588
|
+
return node && sel.mayMatch(node);
|
|
589
|
+
}
|
|
590
|
+
// Sibling combinator
|
|
591
|
+
let isMatching = false;
|
|
592
|
+
eachNodePreviousGeneralSibling(node, (sibling) => {
|
|
593
|
+
isMatching = sel.mayMatch(sibling);
|
|
594
|
+
return !isMatching;
|
|
595
|
+
});
|
|
596
|
+
return isMatching;
|
|
597
|
+
});
|
|
397
598
|
}
|
|
398
599
|
trackChanges(node, map) {
|
|
399
|
-
this.selectors.forEach((sel, i) =>
|
|
600
|
+
this.selectors.forEach((sel, i) => {
|
|
601
|
+
if (i === 0) {
|
|
602
|
+
if (node) {
|
|
603
|
+
sel.trackChanges(node, map);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
if (sel.combinator === Combinator.adjacent) {
|
|
608
|
+
node = getNodePreviousDirectSibling(node);
|
|
609
|
+
if (node && sel.mayMatch(node)) {
|
|
610
|
+
sel.trackChanges(node, map);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
// Sibling combinator
|
|
615
|
+
let matchingSibling;
|
|
616
|
+
eachNodePreviousGeneralSibling(node, (sibling) => {
|
|
617
|
+
const isMatching = sel.mayMatch(sibling);
|
|
618
|
+
if (isMatching) {
|
|
619
|
+
matchingSibling = sibling;
|
|
620
|
+
}
|
|
621
|
+
return !isMatching;
|
|
622
|
+
});
|
|
623
|
+
if (matchingSibling) {
|
|
624
|
+
sel.trackChanges(matchingSibling, map);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
400
629
|
}
|
|
401
630
|
}
|
|
402
631
|
Selector.SiblingGroup = SiblingGroup;
|
|
@@ -408,112 +637,161 @@ export class RuleSet {
|
|
|
408
637
|
this.selectors.forEach((sel) => (sel.ruleset = this));
|
|
409
638
|
}
|
|
410
639
|
toString() {
|
|
411
|
-
|
|
640
|
+
let desc = `${this.selectors.join(', ')} {${this.declarations.map((d, i) => `${i === 0 ? ' ' : ''}${d.property}: ${d.value}`).join('; ')} }`;
|
|
641
|
+
if (this.mediaQueryString) {
|
|
642
|
+
desc = `@media ${this.mediaQueryString} { ${desc} }`;
|
|
643
|
+
}
|
|
644
|
+
return desc;
|
|
412
645
|
}
|
|
413
646
|
lookupSort(sorter) {
|
|
414
647
|
this.selectors.forEach((sel) => sel.lookupSort(sorter));
|
|
415
648
|
}
|
|
416
649
|
}
|
|
417
|
-
export function
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
return new RuleSet(selectors, declarations);
|
|
422
|
-
});
|
|
650
|
+
export function fromAstNode(astRule) {
|
|
651
|
+
const declarations = astRule.declarations.filter(isDeclaration).map(createDeclaration);
|
|
652
|
+
const selectors = astRule.selectors.map(createSelector);
|
|
653
|
+
return new RuleSet(selectors, declarations);
|
|
423
654
|
}
|
|
424
655
|
function createDeclaration(decl) {
|
|
425
656
|
return { property: isCssVariable(decl.property) ? decl.property : decl.property.toLowerCase(), value: decl.value };
|
|
426
657
|
}
|
|
427
658
|
function createSimpleSelectorFromAst(ast) {
|
|
428
|
-
if (ast.type === '
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
return new
|
|
659
|
+
if (ast.type === 'attribute') {
|
|
660
|
+
if (ast.name === 'class') {
|
|
661
|
+
return new ClassSelector(ast.value);
|
|
662
|
+
}
|
|
663
|
+
if (ast.name === 'id') {
|
|
664
|
+
return new IdSelector(ast.value);
|
|
665
|
+
}
|
|
666
|
+
return new AttributeSelector(ast.name, ast.action, ast.value, !!ast.ignoreCase);
|
|
436
667
|
}
|
|
437
|
-
if (ast.type === '
|
|
438
|
-
return new
|
|
668
|
+
if (ast.type === 'tag') {
|
|
669
|
+
return new TypeSelector(ast.name.replace('-', '').toLowerCase());
|
|
439
670
|
}
|
|
440
|
-
if (ast.type === '
|
|
441
|
-
|
|
671
|
+
if (ast.type === 'pseudo') {
|
|
672
|
+
if (ast.name === 'is') {
|
|
673
|
+
return new IsFunctionalPseudoClassSelector(ast.name, ast.data);
|
|
674
|
+
}
|
|
675
|
+
if (ast.name === 'where') {
|
|
676
|
+
return new WhereFunctionalPseudoClassSelector(ast.name, ast.data);
|
|
677
|
+
}
|
|
678
|
+
if (ast.name === 'not') {
|
|
679
|
+
return new NotFunctionalPseudoClassSelector(ast.name, ast.data);
|
|
680
|
+
}
|
|
681
|
+
return new PseudoClassSelector(ast.name);
|
|
442
682
|
}
|
|
443
|
-
if (ast.type === '
|
|
683
|
+
if (ast.type === 'universal') {
|
|
444
684
|
return new UniversalSelector();
|
|
445
685
|
}
|
|
686
|
+
return new InvalidSelector(new Error(ast.type));
|
|
446
687
|
}
|
|
447
|
-
function createSimpleSelectorSequenceFromAst(
|
|
448
|
-
if (
|
|
688
|
+
function createSimpleSelectorSequenceFromAst(asts) {
|
|
689
|
+
if (asts.length === 0) {
|
|
449
690
|
return new InvalidSelector(new Error('Empty simple selector sequence.'));
|
|
450
691
|
}
|
|
451
|
-
|
|
452
|
-
return createSimpleSelectorFromAst(
|
|
692
|
+
if (asts.length === 1) {
|
|
693
|
+
return createSimpleSelectorFromAst(asts[0]);
|
|
453
694
|
}
|
|
454
|
-
|
|
455
|
-
|
|
695
|
+
const sequenceSelectors = [];
|
|
696
|
+
for (const ast of asts) {
|
|
697
|
+
const selector = createSimpleSelectorFromAst(ast);
|
|
698
|
+
if (selector instanceof InvalidSelector) {
|
|
699
|
+
return selector;
|
|
700
|
+
}
|
|
701
|
+
sequenceSelectors.push(selector);
|
|
456
702
|
}
|
|
703
|
+
return new SimpleSelectorSequence(sequenceSelectors);
|
|
457
704
|
}
|
|
458
|
-
function createSelectorFromAst(
|
|
459
|
-
|
|
705
|
+
function createSelectorFromAst(asts) {
|
|
706
|
+
let result;
|
|
707
|
+
if (asts.length === 0) {
|
|
460
708
|
return new InvalidSelector(new Error('Empty selector.'));
|
|
461
709
|
}
|
|
462
|
-
|
|
463
|
-
return
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
710
|
+
if (asts.length === 1) {
|
|
711
|
+
return createSimpleSelectorFromAst(asts[0]);
|
|
712
|
+
}
|
|
713
|
+
const simpleSelectorSequences = [];
|
|
714
|
+
let sequenceAsts = [];
|
|
715
|
+
let combinatorCount = 0;
|
|
716
|
+
for (const ast of asts) {
|
|
717
|
+
const combinator = Combinator[ast.type];
|
|
718
|
+
// Combinator means the end of a sequence
|
|
719
|
+
if (combinator != null) {
|
|
720
|
+
const selector = createSimpleSelectorSequenceFromAst(sequenceAsts);
|
|
721
|
+
if (selector instanceof InvalidSelector) {
|
|
722
|
+
return selector;
|
|
723
|
+
}
|
|
724
|
+
selector.combinator = combinator;
|
|
725
|
+
simpleSelectorSequences.push(selector);
|
|
726
|
+
combinatorCount++;
|
|
727
|
+
// Cleanup stored selectors for the new sequence to take place
|
|
728
|
+
sequenceAsts = [];
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
sequenceAsts.push(ast);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (combinatorCount > 0) {
|
|
735
|
+
// Create a sequence using the remaining selectors after the last combinator
|
|
736
|
+
if (sequenceAsts.length) {
|
|
737
|
+
const selector = createSimpleSelectorSequenceFromAst(sequenceAsts);
|
|
738
|
+
if (selector instanceof InvalidSelector) {
|
|
739
|
+
return selector;
|
|
474
740
|
}
|
|
475
|
-
simpleSelectorSequences.push(
|
|
741
|
+
simpleSelectorSequences.push(selector);
|
|
476
742
|
}
|
|
477
|
-
return new
|
|
743
|
+
return new ComplexSelector(simpleSelectorSequences);
|
|
478
744
|
}
|
|
745
|
+
return createSimpleSelectorSequenceFromAst(sequenceAsts);
|
|
479
746
|
}
|
|
480
747
|
export function createSelector(sel) {
|
|
481
748
|
try {
|
|
482
|
-
const
|
|
483
|
-
if (!
|
|
749
|
+
const result = convertToCSSWhatSelector(sel);
|
|
750
|
+
if (!result?.length) {
|
|
484
751
|
return new InvalidSelector(new Error('Empty selector'));
|
|
485
752
|
}
|
|
486
|
-
return createSelectorFromAst(
|
|
753
|
+
return createSelectorFromAst(result[0]);
|
|
487
754
|
}
|
|
488
755
|
catch (e) {
|
|
489
756
|
return new InvalidSelector(e);
|
|
490
757
|
}
|
|
491
758
|
}
|
|
492
|
-
function isRule(node) {
|
|
493
|
-
return node.type === 'rule';
|
|
494
|
-
}
|
|
495
759
|
function isDeclaration(node) {
|
|
496
760
|
return node.type === 'declaration';
|
|
497
761
|
}
|
|
498
|
-
export
|
|
499
|
-
|
|
762
|
+
export function matchMediaQueryString(mediaQueryString, cachedQueries) {
|
|
763
|
+
// It can be a single or multiple queries in case of nested media queries
|
|
764
|
+
const mediaQueryStrings = mediaQueryString.split(MEDIA_QUERY_SEPARATOR);
|
|
765
|
+
return mediaQueryStrings.every((mq) => {
|
|
766
|
+
let isMatching;
|
|
767
|
+
// Query has already been validated
|
|
768
|
+
if (cachedQueries.includes(mq)) {
|
|
769
|
+
isMatching = true;
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
isMatching = checkIfMediaQueryMatches(mq);
|
|
773
|
+
if (isMatching) {
|
|
774
|
+
cachedQueries.push(mq);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return isMatching;
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
export class SelectorScope {
|
|
781
|
+
constructor() {
|
|
500
782
|
this.id = {};
|
|
501
783
|
this.class = {};
|
|
502
784
|
this.type = {};
|
|
503
785
|
this.universal = [];
|
|
504
786
|
this.position = 0;
|
|
505
|
-
rulesets.forEach((rule) => rule.lookupSort(this));
|
|
506
787
|
}
|
|
507
|
-
|
|
508
|
-
const selectorsMatch = new SelectorsMatch();
|
|
788
|
+
getSelectorCandidates(node) {
|
|
509
789
|
const { cssClasses, id, cssType } = node;
|
|
510
790
|
const selectorClasses = [this.universal, this.id[id], this.type[cssType]];
|
|
511
791
|
if (cssClasses && cssClasses.size) {
|
|
512
792
|
cssClasses.forEach((c) => selectorClasses.push(this.class[c]));
|
|
513
793
|
}
|
|
514
|
-
|
|
515
|
-
selectorsMatch.selectors = selectors.filter((sel) => sel.accumulateChanges(node, selectorsMatch)).sort((a, b) => a.specificity - b.specificity || a.pos - b.pos);
|
|
516
|
-
return selectorsMatch;
|
|
794
|
+
return selectorClasses.reduce((cur, next) => cur.concat(next || []), []);
|
|
517
795
|
}
|
|
518
796
|
sortById(id, sel) {
|
|
519
797
|
this.addToMap(this.id, id, sel);
|
|
@@ -538,11 +816,85 @@ export class SelectorsMap {
|
|
|
538
816
|
return sel;
|
|
539
817
|
}
|
|
540
818
|
}
|
|
819
|
+
export class MediaQuerySelectorScope extends SelectorScope {
|
|
820
|
+
constructor(mediaQueryString) {
|
|
821
|
+
super();
|
|
822
|
+
this._mediaQueryString = mediaQueryString;
|
|
823
|
+
}
|
|
824
|
+
get mediaQueryString() {
|
|
825
|
+
return this._mediaQueryString;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
export class StyleSheetSelectorScope extends SelectorScope {
|
|
829
|
+
constructor(rulesets) {
|
|
830
|
+
super();
|
|
831
|
+
this.lookupRulesets(rulesets);
|
|
832
|
+
}
|
|
833
|
+
createMediaQuerySelectorScope(mediaQueryString) {
|
|
834
|
+
const selectorScope = new MediaQuerySelectorScope(mediaQueryString);
|
|
835
|
+
selectorScope.position = this.position;
|
|
836
|
+
if (this.mediaQuerySelectorScopes) {
|
|
837
|
+
this.mediaQuerySelectorScopes.push(selectorScope);
|
|
838
|
+
}
|
|
839
|
+
else {
|
|
840
|
+
this.mediaQuerySelectorScopes = [selectorScope];
|
|
841
|
+
}
|
|
842
|
+
return selectorScope;
|
|
843
|
+
}
|
|
844
|
+
lookupRulesets(rulesets) {
|
|
845
|
+
let lastMediaSelectorScope;
|
|
846
|
+
for (let i = 0, length = rulesets.length; i < length; i++) {
|
|
847
|
+
const ruleset = rulesets[i];
|
|
848
|
+
if (lastMediaSelectorScope && lastMediaSelectorScope.mediaQueryString !== ruleset.mediaQueryString) {
|
|
849
|
+
// Once done with current media query scope, update stylesheet scope position
|
|
850
|
+
this.position = lastMediaSelectorScope.position;
|
|
851
|
+
lastMediaSelectorScope = null;
|
|
852
|
+
}
|
|
853
|
+
if (ruleset.mediaQueryString) {
|
|
854
|
+
// Create media query selector scope and register selector lookups there
|
|
855
|
+
if (!lastMediaSelectorScope) {
|
|
856
|
+
lastMediaSelectorScope = this.createMediaQuerySelectorScope(ruleset.mediaQueryString);
|
|
857
|
+
}
|
|
858
|
+
ruleset.lookupSort(lastMediaSelectorScope);
|
|
859
|
+
}
|
|
860
|
+
else {
|
|
861
|
+
ruleset.lookupSort(this);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
// If reference of last media selector scope is still kept, update stylesheet scope position
|
|
865
|
+
if (lastMediaSelectorScope) {
|
|
866
|
+
this.position = lastMediaSelectorScope.position;
|
|
867
|
+
lastMediaSelectorScope = null;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
query(node) {
|
|
871
|
+
const selectorsMatch = new SelectorsMatch();
|
|
872
|
+
const selectors = this.getSelectorCandidates(node);
|
|
873
|
+
// Validate media queries and include their selectors if needed
|
|
874
|
+
if (this.mediaQuerySelectorScopes) {
|
|
875
|
+
// Cache media query results to avoid validations of other identical queries
|
|
876
|
+
const validatedMediaQueries = [];
|
|
877
|
+
for (let i = 0, length = this.mediaQuerySelectorScopes.length; i < length; i++) {
|
|
878
|
+
const selectorScope = this.mediaQuerySelectorScopes[i];
|
|
879
|
+
const isMatchingAllQueries = matchMediaQueryString(selectorScope.mediaQueryString, validatedMediaQueries);
|
|
880
|
+
if (isMatchingAllQueries) {
|
|
881
|
+
const mediaQuerySelectors = selectorScope.getSelectorCandidates(node);
|
|
882
|
+
selectors.push(...mediaQuerySelectors);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
selectorsMatch.selectors = selectors.filter((sel) => sel.accumulateChanges(node, selectorsMatch)).sort((a, b) => a.specificity - b.specificity || a.pos - b.pos);
|
|
887
|
+
return selectorsMatch;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
541
890
|
export class SelectorsMatch {
|
|
542
891
|
constructor() {
|
|
543
892
|
this.changeMap = new Map();
|
|
544
893
|
}
|
|
545
894
|
addAttribute(node, attribute) {
|
|
895
|
+
if (CSSUtils.IgnoredCssDynamicAttributeTracking.has(attribute)) {
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
546
898
|
const deps = this.properties(node);
|
|
547
899
|
if (!deps.attributes) {
|
|
548
900
|
deps.attributes = new Set();
|
|
@@ -577,8 +929,10 @@ export const CSSHelper = {
|
|
|
577
929
|
SimpleSelectorSequence,
|
|
578
930
|
Selector,
|
|
579
931
|
RuleSet,
|
|
580
|
-
|
|
581
|
-
|
|
932
|
+
SelectorScope,
|
|
933
|
+
MediaQuerySelectorScope,
|
|
934
|
+
StyleSheetSelectorScope,
|
|
935
|
+
fromAstNode,
|
|
582
936
|
SelectorsMatch,
|
|
583
937
|
};
|
|
584
938
|
//# sourceMappingURL=css-selector.js.map
|