@projectwallace/css-analyzer 7.6.1 → 7.6.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.
- package/dist/css-analyzer.js +433 -428
- package/dist/index.d.ts +584 -953
- package/package.json +1 -1
package/dist/css-analyzer.js
CHANGED
|
@@ -2,15 +2,15 @@ var pi = Object.defineProperty;
|
|
|
2
2
|
var Zt = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var hi = (i, e,
|
|
6
|
-
var $t = (i, e,
|
|
7
|
-
var h = (i, e,
|
|
8
|
-
var Ye = (i, e,
|
|
9
|
-
set _(
|
|
10
|
-
|
|
5
|
+
var hi = (i, e, t) => e in i ? pi(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
|
+
var $t = (i, e, t) => hi(i, typeof e != "symbol" ? e + "" : e, t), Jt = (i, e, t) => e.has(i) || Zt("Cannot " + t);
|
|
7
|
+
var h = (i, e, t) => (Jt(i, e, "read from private field"), t ? t.call(i) : e.get(i)), _ = (i, e, t) => e.has(i) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), R = (i, e, t, r) => (Jt(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t);
|
|
8
|
+
var Ye = (i, e, t, r) => ({
|
|
9
|
+
set _(n) {
|
|
10
|
+
R(i, e, n, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return h(i, e,
|
|
13
|
+
return h(i, e, r);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
import mi from "css-tree/parser";
|
|
@@ -22,68 +22,68 @@ function Je(i, e) {
|
|
|
22
22
|
}
|
|
23
23
|
function q(i, e) {
|
|
24
24
|
if (i === e) return !0;
|
|
25
|
-
let
|
|
26
|
-
if (
|
|
27
|
-
for (let
|
|
28
|
-
if (Je(i.charCodeAt(
|
|
25
|
+
let t = i.length;
|
|
26
|
+
if (t !== e.length) return !1;
|
|
27
|
+
for (let r = 0; r < t; r++)
|
|
28
|
+
if (Je(i.charCodeAt(r), e.charCodeAt(r)) === !1)
|
|
29
29
|
return !1;
|
|
30
30
|
return !0;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function I(i, e) {
|
|
33
33
|
if (i === e) return !0;
|
|
34
|
-
let
|
|
35
|
-
if (
|
|
34
|
+
let t = e.length, r = t - i.length;
|
|
35
|
+
if (r < 0)
|
|
36
36
|
return !1;
|
|
37
|
-
for (let
|
|
38
|
-
if (Je(i.charCodeAt(
|
|
37
|
+
for (let n = t - 1; n >= r; n--)
|
|
38
|
+
if (Je(i.charCodeAt(n - r), e.charCodeAt(n)) === !1)
|
|
39
39
|
return !1;
|
|
40
40
|
return !0;
|
|
41
41
|
}
|
|
42
42
|
function Xe(i, e) {
|
|
43
43
|
if (i === e) return !0;
|
|
44
|
-
let
|
|
45
|
-
if (e.length <
|
|
46
|
-
for (let
|
|
47
|
-
if (Je(i.charCodeAt(
|
|
44
|
+
let t = i.length;
|
|
45
|
+
if (e.length < t) return !1;
|
|
46
|
+
for (let r = 0; r < t; r++)
|
|
47
|
+
if (Je(i.charCodeAt(r), e.charCodeAt(r)) === !1)
|
|
48
48
|
return !1;
|
|
49
49
|
return !0;
|
|
50
50
|
}
|
|
51
|
-
const Ge = "Atrule", di = "MediaQuery", Qe = "Rule", yi = "Selector", wi = "Value",
|
|
52
|
-
function Xt(i, e,
|
|
53
|
-
let
|
|
54
|
-
return q(e, i.property) &&
|
|
51
|
+
const Ge = "Atrule", di = "MediaQuery", Qe = "Rule", yi = "Selector", wi = "Value", V = "Identifier", ki = "Nth", bi = "Combinator", ni = "Number", Le = "Dimension", Z = "Operator", xi = "Hash", Ci = "Url", et = "Function";
|
|
52
|
+
function Xt(i, e, t) {
|
|
53
|
+
let r = i.value.children.first;
|
|
54
|
+
return q(e, i.property) && r.type === V && q(t, r.name);
|
|
55
55
|
}
|
|
56
56
|
function vi(i) {
|
|
57
57
|
let e = !1;
|
|
58
|
-
return li(i, function(
|
|
59
|
-
if (
|
|
58
|
+
return li(i, function(t) {
|
|
59
|
+
if (t.type === "Declaration" && (Xt(t, "-webkit-appearance", "none") || Xt(t, "-moz-appearance", "meterbar")))
|
|
60
60
|
return e = !0, this.break;
|
|
61
61
|
}), e;
|
|
62
62
|
}
|
|
63
63
|
function Si(i) {
|
|
64
64
|
let e = !1;
|
|
65
|
-
return li(i, function(
|
|
66
|
-
let { mediaType:
|
|
67
|
-
if (
|
|
68
|
-
if (Xe("\\0",
|
|
65
|
+
return li(i, function(t) {
|
|
66
|
+
let { mediaType: r, name: n, value: c, type: g, kind: w } = t;
|
|
67
|
+
if (g === di && r !== null) {
|
|
68
|
+
if (Xe("\\0", r) || I("\\9 ", r))
|
|
69
69
|
return e = !0, this.break;
|
|
70
|
-
} else if (
|
|
71
|
-
if (
|
|
70
|
+
} else if (g === "Feature" && w === "media") {
|
|
71
|
+
if (c && c.unit && c.unit === "\\0")
|
|
72
72
|
return e = !0, this.break;
|
|
73
|
-
if (q("-moz-images-in-menus",
|
|
73
|
+
if (q("-moz-images-in-menus", n) || q("min--moz-device-pixel-ratio", n) || q("-ms-high-contrast", n))
|
|
74
74
|
return e = !0, this.break;
|
|
75
|
-
if (q("min-resolution",
|
|
75
|
+
if (q("min-resolution", n) && c && q(".001", c.value) && q("dpcm", c.unit))
|
|
76
76
|
return e = !0, this.break;
|
|
77
|
-
if (q("-webkit-min-device-pixel-ratio",
|
|
77
|
+
if (q("-webkit-min-device-pixel-ratio", n) && c && c.value && (q("0", c.value) || q("10000", c.value)))
|
|
78
78
|
return e = !0, this.break;
|
|
79
79
|
}
|
|
80
80
|
}), e;
|
|
81
81
|
}
|
|
82
|
-
const
|
|
83
|
-
function
|
|
84
|
-
return i.charCodeAt(0) ===
|
|
82
|
+
const Lt = 45;
|
|
83
|
+
function N(i) {
|
|
84
|
+
return i.charCodeAt(0) === Lt && i.charCodeAt(1) !== Lt && i.indexOf("-", 2) !== -1;
|
|
85
85
|
}
|
|
86
|
-
class
|
|
86
|
+
class D {
|
|
87
87
|
constructor(e) {
|
|
88
88
|
$t(this, "set");
|
|
89
89
|
this.set = new Set(e);
|
|
@@ -92,27 +92,27 @@ class O {
|
|
|
92
92
|
return this.set.has(e.toLowerCase());
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
let
|
|
95
|
+
function si(i, e) {
|
|
96
|
+
let t = [];
|
|
97
97
|
return C(i, {
|
|
98
98
|
visit: "Selector",
|
|
99
|
-
enter: function(
|
|
100
|
-
|
|
99
|
+
enter: function(r) {
|
|
100
|
+
t.push(e(r));
|
|
101
101
|
}
|
|
102
|
-
}),
|
|
102
|
+
}), t;
|
|
103
103
|
}
|
|
104
|
-
const ai = new
|
|
104
|
+
const ai = new D(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
|
|
105
105
|
function oi(i) {
|
|
106
106
|
let e = !1;
|
|
107
|
-
return C(i, function(
|
|
108
|
-
if (
|
|
109
|
-
let
|
|
110
|
-
if (q("role",
|
|
107
|
+
return C(i, function(t) {
|
|
108
|
+
if (t.type === "AttributeSelector") {
|
|
109
|
+
let r = t.name.name;
|
|
110
|
+
if (q("role", r) || Xe("aria-", r))
|
|
111
111
|
return e = !0, C.break;
|
|
112
|
-
} else if (
|
|
113
|
-
let
|
|
114
|
-
for (let
|
|
115
|
-
if (
|
|
112
|
+
} else if (t.type === "PseudoClassSelector" && ai.has(t.name)) {
|
|
113
|
+
let r = si(t, oi);
|
|
114
|
+
for (let n of r)
|
|
115
|
+
if (n === !0) {
|
|
116
116
|
e = !0;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
@@ -122,67 +122,67 @@ function oi(i) {
|
|
|
122
122
|
}
|
|
123
123
|
function zi(i) {
|
|
124
124
|
let e = !1;
|
|
125
|
-
return C(i, function(
|
|
126
|
-
let
|
|
127
|
-
if ((
|
|
125
|
+
return C(i, function(t) {
|
|
126
|
+
let r = t.type;
|
|
127
|
+
if ((r === "PseudoElementSelector" || r === "TypeSelector" || r === "PseudoClassSelector") && N(t.name))
|
|
128
128
|
return e = !0, C.break;
|
|
129
129
|
}), e;
|
|
130
130
|
}
|
|
131
131
|
function qi(i) {
|
|
132
132
|
let e = [];
|
|
133
|
-
return C(i, function(
|
|
134
|
-
|
|
133
|
+
return C(i, function(t) {
|
|
134
|
+
t.type === "PseudoClassSelector" && e.push(t.name);
|
|
135
135
|
}), e.length === 0 ? !1 : e;
|
|
136
136
|
}
|
|
137
137
|
function ui(i) {
|
|
138
138
|
let e = 0;
|
|
139
|
-
return C(i, function(
|
|
140
|
-
let
|
|
141
|
-
if (!(
|
|
142
|
-
if (e++, (
|
|
143
|
-
return
|
|
144
|
-
if (
|
|
145
|
-
let
|
|
146
|
-
if (
|
|
147
|
-
for (let
|
|
148
|
-
e +=
|
|
139
|
+
return C(i, function(t) {
|
|
140
|
+
let r = t.type;
|
|
141
|
+
if (!(r === "Selector" || r === ki)) {
|
|
142
|
+
if (e++, (r === "PseudoElementSelector" || r === "TypeSelector" || r === "PseudoClassSelector") && N(t.name) && e++, r === "AttributeSelector")
|
|
143
|
+
return t.value && e++, C.skip;
|
|
144
|
+
if (r === "PseudoClassSelector" && ai.has(t.name)) {
|
|
145
|
+
let n = si(t, ui);
|
|
146
|
+
if (n.length === 0) return;
|
|
147
|
+
for (let c of n)
|
|
148
|
+
e += c;
|
|
149
149
|
return C.skip;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}), e;
|
|
153
153
|
}
|
|
154
154
|
function Ai(i, e) {
|
|
155
|
-
C(i, function(
|
|
156
|
-
if (
|
|
157
|
-
let
|
|
158
|
-
if (
|
|
159
|
-
let
|
|
160
|
-
offset:
|
|
161
|
-
line:
|
|
162
|
-
column:
|
|
155
|
+
C(i, function(t, r) {
|
|
156
|
+
if (t.type === bi) {
|
|
157
|
+
let n = t.loc, c = t.name;
|
|
158
|
+
if (n === null) {
|
|
159
|
+
let g = r.prev.data.loc.end, w = {
|
|
160
|
+
offset: g.offset,
|
|
161
|
+
line: g.line,
|
|
162
|
+
column: g.column
|
|
163
163
|
};
|
|
164
164
|
e({
|
|
165
|
-
name:
|
|
165
|
+
name: c,
|
|
166
166
|
// @ts-expect-error TODO: fix this
|
|
167
167
|
loc: {
|
|
168
|
-
start:
|
|
168
|
+
start: w,
|
|
169
169
|
end: {
|
|
170
|
-
offset:
|
|
171
|
-
line:
|
|
172
|
-
column:
|
|
170
|
+
offset: w.offset + 1,
|
|
171
|
+
line: w.line,
|
|
172
|
+
column: w.column + 1
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
} else
|
|
177
177
|
e({
|
|
178
|
-
name:
|
|
178
|
+
name: c,
|
|
179
179
|
// @ts-expect-error TODO: fix this
|
|
180
|
-
loc:
|
|
180
|
+
loc: n
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
const Pi = new
|
|
185
|
+
const Pi = new D([
|
|
186
186
|
// CSS Named Colors
|
|
187
187
|
// Spec: https://drafts.csswg.org/css-color/#named-colors
|
|
188
188
|
// Heuristic: popular names first for quick finding in set.has()
|
|
@@ -335,7 +335,7 @@ const Pi = new O([
|
|
|
335
335
|
"mediumorchid",
|
|
336
336
|
"darksalmon",
|
|
337
337
|
"mediumspringgreen"
|
|
338
|
-
]),
|
|
338
|
+
]), Ri = new D([
|
|
339
339
|
// CSS System Colors
|
|
340
340
|
// Spec: https://drafts.csswg.org/css-color/#css-system-colors
|
|
341
341
|
"accentcolor",
|
|
@@ -357,7 +357,7 @@ const Pi = new O([
|
|
|
357
357
|
"selecteditem",
|
|
358
358
|
"selecteditemtext",
|
|
359
359
|
"visitedtext"
|
|
360
|
-
]), Oi = new
|
|
360
|
+
]), Oi = new D(["rgba", "rgb", "hsla", "hsl", "oklch", "color", "hwb", "lch", "lab", "oklab"]), Di = new D(["transparent", "currentcolor"]), pe = new D([
|
|
361
361
|
"auto",
|
|
362
362
|
"none",
|
|
363
363
|
// for `text-shadow`, `box-shadow` and `background`
|
|
@@ -367,22 +367,22 @@ const Pi = new O([
|
|
|
367
367
|
"revert",
|
|
368
368
|
"revert-layer"
|
|
369
369
|
]);
|
|
370
|
-
function
|
|
371
|
-
let e = i.children,
|
|
372
|
-
if (!e ||
|
|
373
|
-
let
|
|
374
|
-
return
|
|
370
|
+
function fe(i) {
|
|
371
|
+
let e = i.children, t = e.size;
|
|
372
|
+
if (!e || t > 1 || t === 0) return !1;
|
|
373
|
+
let r = e.first;
|
|
374
|
+
return r.type === V && pe.has(r.name);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function ei(i) {
|
|
377
377
|
return parseFloat(i) === 0;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Fi(i) {
|
|
380
380
|
for (let e of i.children.toArray())
|
|
381
|
-
if (!(e.type ===
|
|
381
|
+
if (!(e.type === ni && ei(e.value)) && !(e.type === Le && ei(e.value)))
|
|
382
382
|
return !1;
|
|
383
383
|
return !0;
|
|
384
384
|
}
|
|
385
|
-
const
|
|
385
|
+
const Ei = new D(["caption", "icon", "menu", "message-box", "small-caption", "status-bar"]), _i = new D([
|
|
386
386
|
/* <absolute-size> values */
|
|
387
387
|
"xx-small",
|
|
388
388
|
"x-small",
|
|
@@ -395,85 +395,85 @@ const Fi = new O(["caption", "icon", "menu", "message-box", "small-caption", "st
|
|
|
395
395
|
/* <relative-size> values */
|
|
396
396
|
"smaller",
|
|
397
397
|
"larger"
|
|
398
|
-
]),
|
|
398
|
+
]), Ii = 44, ti = 47;
|
|
399
399
|
function Ze(i) {
|
|
400
400
|
let e = i.children.first;
|
|
401
|
-
return e === null ? !1 : e.type ===
|
|
401
|
+
return e === null ? !1 : e.type === V && Ei.has(e.name);
|
|
402
402
|
}
|
|
403
|
-
function Mi(i, e,
|
|
404
|
-
var
|
|
405
|
-
let
|
|
403
|
+
function Mi(i, e, t) {
|
|
404
|
+
var w;
|
|
405
|
+
let r = [void 0, void 0], n, c;
|
|
406
406
|
if (i.children.first.type === "Function" && i.children.first.name.toLowerCase() === "var")
|
|
407
407
|
return null;
|
|
408
|
-
i.children.forEach(function(b,
|
|
409
|
-
let
|
|
410
|
-
if (b.type ===
|
|
408
|
+
i.children.forEach(function(b, x) {
|
|
409
|
+
let O = x.prev ? x.prev.data : void 0, A = x.next ? x.next.data : void 0;
|
|
410
|
+
if (b.type === V && pe.has(b.name) && t({
|
|
411
411
|
type: "keyword",
|
|
412
412
|
value: b.name
|
|
413
|
-
}),
|
|
414
|
-
|
|
413
|
+
}), A && A.type === Z && A.value.charCodeAt(0) === ti) {
|
|
414
|
+
n = e(b);
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
417
|
-
if (
|
|
418
|
-
|
|
417
|
+
if (O && O.type === Z && O.value.charCodeAt(0) === ti) {
|
|
418
|
+
c = e(b);
|
|
419
419
|
return;
|
|
420
420
|
}
|
|
421
|
-
if (
|
|
422
|
-
|
|
421
|
+
if (A && A.type === Z && A.value.charCodeAt(0) === Ii && !r[0]) {
|
|
422
|
+
r[0] = b, !n && O && (n = e(O));
|
|
423
423
|
return;
|
|
424
424
|
}
|
|
425
|
-
if (b.type !==
|
|
426
|
-
if (
|
|
427
|
-
|
|
425
|
+
if (b.type !== ni) {
|
|
426
|
+
if (x.next === null) {
|
|
427
|
+
r[1] = b, !n && !r[0] && O && (n = e(O));
|
|
428
428
|
return;
|
|
429
429
|
}
|
|
430
|
-
if (b.type ===
|
|
431
|
-
let
|
|
432
|
-
if (
|
|
433
|
-
|
|
430
|
+
if (b.type === V) {
|
|
431
|
+
let F = b.name;
|
|
432
|
+
if (_i.has(F)) {
|
|
433
|
+
n = F;
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
|
-
let
|
|
439
|
+
let g = r[0] || r[1] ? e({
|
|
440
440
|
loc: {
|
|
441
441
|
// @ts-expect-error TODO: fix this
|
|
442
442
|
start: {
|
|
443
443
|
// @ts-expect-error TODO: fix this
|
|
444
|
-
offset: (
|
|
444
|
+
offset: (r[0] || r[1]).loc.start.offset
|
|
445
445
|
},
|
|
446
446
|
// @ts-expect-error TODO: fix this
|
|
447
447
|
end: {
|
|
448
448
|
// Either the node we detected as the last node, or the end of the whole value
|
|
449
449
|
// It's never 0 because the first node is always a font-size or font-style
|
|
450
|
-
offset: ((
|
|
450
|
+
offset: ((w = r[1]) == null ? void 0 : w.loc.end.offset) || i.loc.end.offset
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
}) : null;
|
|
454
454
|
return {
|
|
455
|
-
font_size:
|
|
456
|
-
line_height:
|
|
457
|
-
font_family:
|
|
455
|
+
font_size: n,
|
|
456
|
+
line_height: c,
|
|
457
|
+
font_family: g
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
|
-
const
|
|
461
|
-
function
|
|
462
|
-
let
|
|
463
|
-
for (let
|
|
464
|
-
let
|
|
465
|
-
|
|
460
|
+
const Ui = new D(["linear", "ease", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"]), Ti = new D(["cubic-bezier", "steps"]);
|
|
461
|
+
function Vi(i, e) {
|
|
462
|
+
let t = !1;
|
|
463
|
+
for (let r of i) {
|
|
464
|
+
let n = r.type, c = r.name;
|
|
465
|
+
n === Z ? t = !1 : n === Le && t === !1 ? (t = !0, e({
|
|
466
466
|
type: "duration",
|
|
467
|
-
value:
|
|
468
|
-
})) :
|
|
467
|
+
value: r
|
|
468
|
+
})) : n === V ? Ui.has(c) ? e({
|
|
469
469
|
type: "fn",
|
|
470
|
-
value:
|
|
471
|
-
}) :
|
|
470
|
+
value: r
|
|
471
|
+
}) : pe.has(c) && e({
|
|
472
472
|
type: "keyword",
|
|
473
|
-
value:
|
|
474
|
-
}) :
|
|
473
|
+
value: r
|
|
474
|
+
}) : n === et && Ti.has(c) && e({
|
|
475
475
|
type: "fn",
|
|
476
|
-
value:
|
|
476
|
+
value: r
|
|
477
477
|
});
|
|
478
478
|
}
|
|
479
479
|
}
|
|
@@ -481,72 +481,78 @@ function ci(i) {
|
|
|
481
481
|
let e = i.children;
|
|
482
482
|
if (!e)
|
|
483
483
|
return !1;
|
|
484
|
-
for (let
|
|
485
|
-
let { type:
|
|
486
|
-
if (
|
|
484
|
+
for (let t of e) {
|
|
485
|
+
let { type: r, name: n } = t;
|
|
486
|
+
if (r === V && N(n) || r === et && (N(n) || ci(t)))
|
|
487
487
|
return !0;
|
|
488
488
|
}
|
|
489
489
|
return !1;
|
|
490
490
|
}
|
|
491
|
-
var H,
|
|
492
|
-
class
|
|
491
|
+
var H, M, U, $;
|
|
492
|
+
class o {
|
|
493
493
|
constructor(e = !1) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
494
|
+
_(this, H);
|
|
495
|
+
_(this, M);
|
|
496
|
+
_(this, U, []);
|
|
497
|
+
_(this, $);
|
|
498
|
+
R(this, H, /* @__PURE__ */ new Map()), R(this, M, 0), e && R(this, U, []), R(this, $, e);
|
|
499
499
|
}
|
|
500
|
-
p(e,
|
|
501
|
-
let
|
|
500
|
+
p(e, t) {
|
|
501
|
+
let r = h(this, M);
|
|
502
502
|
if (h(this, $)) {
|
|
503
|
-
let
|
|
504
|
-
h(this,
|
|
503
|
+
let n = t.start, c = n.offset, g = r * 4;
|
|
504
|
+
h(this, U)[g] = n.line, h(this, U)[g + 1] = n.column, h(this, U)[g + 2] = c, h(this, U)[g + 3] = t.end.offset - c;
|
|
505
505
|
}
|
|
506
506
|
if (h(this, H).has(e)) {
|
|
507
|
-
h(this, H).get(e).push(
|
|
507
|
+
h(this, H).get(e).push(r), Ye(this, M)._++;
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
h(this, H).set(e, [
|
|
510
|
+
h(this, H).set(e, [r]), Ye(this, M)._++;
|
|
511
511
|
}
|
|
512
512
|
size() {
|
|
513
|
-
return h(this,
|
|
513
|
+
return h(this, M);
|
|
514
514
|
}
|
|
515
515
|
c() {
|
|
516
|
-
let e = /* @__PURE__ */ new Map(),
|
|
517
|
-
|
|
518
|
-
if (
|
|
519
|
-
let
|
|
520
|
-
let
|
|
516
|
+
let e = /* @__PURE__ */ new Map(), t = {}, r = h(this, $), n = h(this, H), c = h(this, U), g = n.size;
|
|
517
|
+
n.forEach((b, x) => {
|
|
518
|
+
if (r) {
|
|
519
|
+
let O = b.map(function(A) {
|
|
520
|
+
let F = A * 4;
|
|
521
521
|
return {
|
|
522
|
-
line:
|
|
523
|
-
column:
|
|
524
|
-
offset:
|
|
525
|
-
length:
|
|
522
|
+
line: c[F],
|
|
523
|
+
column: c[F + 1],
|
|
524
|
+
offset: c[F + 2],
|
|
525
|
+
length: c[F + 3]
|
|
526
526
|
};
|
|
527
527
|
});
|
|
528
|
-
e.set(x,
|
|
528
|
+
e.set(x, O);
|
|
529
529
|
} else
|
|
530
|
-
|
|
530
|
+
t[x] = b.length;
|
|
531
531
|
});
|
|
532
|
-
let
|
|
533
|
-
return {
|
|
534
|
-
total:
|
|
535
|
-
totalUnique:
|
|
536
|
-
unique:
|
|
537
|
-
uniquenessRatio:
|
|
538
|
-
uniqueWithLocations:
|
|
532
|
+
let w = h(this, M);
|
|
533
|
+
return r ? {
|
|
534
|
+
total: w,
|
|
535
|
+
totalUnique: g,
|
|
536
|
+
unique: t,
|
|
537
|
+
uniquenessRatio: w === 0 ? 0 : g / w,
|
|
538
|
+
uniqueWithLocations: Object.fromEntries(e)
|
|
539
|
+
} : {
|
|
540
|
+
total: w,
|
|
541
|
+
totalUnique: g,
|
|
542
|
+
unique: t,
|
|
543
|
+
uniquenessRatio: w === 0 ? 0 : g / w,
|
|
544
|
+
uniqueWithLocations: void 0
|
|
539
545
|
};
|
|
540
546
|
}
|
|
541
547
|
}
|
|
542
|
-
H = new WeakMap(),
|
|
543
|
-
var J, K,
|
|
548
|
+
H = new WeakMap(), M = new WeakMap(), U = new WeakMap(), $ = new WeakMap();
|
|
549
|
+
var J, K, le;
|
|
544
550
|
class $e {
|
|
545
551
|
constructor(e) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
552
|
+
_(this, J);
|
|
553
|
+
_(this, K);
|
|
554
|
+
_(this, le);
|
|
555
|
+
R(this, J, new o(e)), R(this, K, /* @__PURE__ */ new Map()), R(this, le, e);
|
|
550
556
|
}
|
|
551
557
|
/**
|
|
552
558
|
* Add an item to this #list's context
|
|
@@ -554,46 +560,46 @@ class $e {
|
|
|
554
560
|
* @param context Context to push Item to
|
|
555
561
|
* @param node_location
|
|
556
562
|
*/
|
|
557
|
-
push(e,
|
|
558
|
-
h(this, J).p(e,
|
|
563
|
+
push(e, t, r) {
|
|
564
|
+
h(this, J).p(e, r), h(this, K).has(t) || h(this, K).set(t, new o(h(this, le))), h(this, K).get(t).p(e, r);
|
|
559
565
|
}
|
|
560
566
|
count() {
|
|
561
567
|
let e = /* @__PURE__ */ new Map();
|
|
562
|
-
for (let [
|
|
563
|
-
e.set(
|
|
568
|
+
for (let [t, r] of h(this, K).entries())
|
|
569
|
+
e.set(t, r.c());
|
|
564
570
|
return Object.assign(h(this, J).c(), {
|
|
565
571
|
itemsPerContext: Object.fromEntries(e)
|
|
566
572
|
});
|
|
567
573
|
}
|
|
568
574
|
}
|
|
569
|
-
J = new WeakMap(), K = new WeakMap(),
|
|
570
|
-
function
|
|
571
|
-
let e = /* @__PURE__ */ new Map(),
|
|
572
|
-
for (let
|
|
573
|
-
let
|
|
574
|
-
e.set(
|
|
575
|
+
J = new WeakMap(), K = new WeakMap(), le = new WeakMap();
|
|
576
|
+
function Wi(i) {
|
|
577
|
+
let e = /* @__PURE__ */ new Map(), t = -1, r = 0, n = 0, c = i.length;
|
|
578
|
+
for (let g = 0; g < c; g++) {
|
|
579
|
+
let w = i[g], b = (e.get(w) || 0) + 1;
|
|
580
|
+
e.set(w, b), b > t && (t = b, r = 0, n = 0), b >= t && (r++, n += w);
|
|
575
581
|
}
|
|
576
|
-
return
|
|
582
|
+
return n / r;
|
|
577
583
|
}
|
|
578
|
-
var
|
|
584
|
+
var T, X;
|
|
579
585
|
class S {
|
|
580
586
|
constructor() {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
587
|
+
_(this, T);
|
|
588
|
+
_(this, X);
|
|
589
|
+
R(this, T, []), R(this, X, 0);
|
|
584
590
|
}
|
|
585
591
|
/**
|
|
586
592
|
* Add a new Integer at the end of this AggregateCollection
|
|
587
593
|
* @param item - The item to add
|
|
588
594
|
*/
|
|
589
595
|
push(e) {
|
|
590
|
-
h(this,
|
|
596
|
+
h(this, T).push(e), R(this, X, h(this, X) + e);
|
|
591
597
|
}
|
|
592
598
|
size() {
|
|
593
|
-
return h(this,
|
|
599
|
+
return h(this, T).length;
|
|
594
600
|
}
|
|
595
601
|
aggregate() {
|
|
596
|
-
let e = h(this,
|
|
602
|
+
let e = h(this, T).length;
|
|
597
603
|
if (e === 0)
|
|
598
604
|
return {
|
|
599
605
|
min: 0,
|
|
@@ -603,23 +609,23 @@ class S {
|
|
|
603
609
|
range: 0,
|
|
604
610
|
sum: 0
|
|
605
611
|
};
|
|
606
|
-
let
|
|
612
|
+
let t = h(this, T).slice().sort((w, b) => w - b), r = t[0], n = t[e - 1], c = Wi(t), g = h(this, X);
|
|
607
613
|
return {
|
|
608
|
-
min:
|
|
609
|
-
max:
|
|
610
|
-
mean:
|
|
611
|
-
mode:
|
|
612
|
-
range:
|
|
613
|
-
sum:
|
|
614
|
+
min: r,
|
|
615
|
+
max: n,
|
|
616
|
+
mean: g / e,
|
|
617
|
+
mode: c,
|
|
618
|
+
range: n - r,
|
|
619
|
+
sum: g
|
|
614
620
|
};
|
|
615
621
|
}
|
|
616
622
|
toArray() {
|
|
617
|
-
return h(this,
|
|
623
|
+
return h(this, T);
|
|
618
624
|
}
|
|
619
625
|
}
|
|
620
|
-
|
|
626
|
+
T = new WeakMap(), X = new WeakMap();
|
|
621
627
|
function Hi(i) {
|
|
622
|
-
if (
|
|
628
|
+
if (tt(i) || N(i)) return !1;
|
|
623
629
|
let e = i.charCodeAt(0);
|
|
624
630
|
return e === 47 || // /
|
|
625
631
|
e === 42 || // *
|
|
@@ -629,28 +635,28 @@ function Hi(i) {
|
|
|
629
635
|
e === 36 || // $
|
|
630
636
|
e === 35;
|
|
631
637
|
}
|
|
632
|
-
function
|
|
638
|
+
function tt(i) {
|
|
633
639
|
return i.length < 3 ? !1 : i.charCodeAt(0) === 45 && i.charCodeAt(1) === 45;
|
|
634
640
|
}
|
|
635
641
|
function m(i, e) {
|
|
636
|
-
return
|
|
642
|
+
return tt(e) ? !1 : I(i, e);
|
|
637
643
|
}
|
|
638
644
|
function Ki(i) {
|
|
639
|
-
return
|
|
640
|
-
}
|
|
641
|
-
function Wi(i) {
|
|
642
|
-
let e = 5, r = i.indexOf(";"), t = i.indexOf(",");
|
|
643
|
-
return r === -1 || t !== -1 && t < r ? i.substring(e, t) : i.substring(e, r);
|
|
645
|
+
return N(i) ? i.slice(i.indexOf("-", 2) + 1) : i;
|
|
644
646
|
}
|
|
645
647
|
function Ni(i) {
|
|
648
|
+
let e = 5, t = i.indexOf(";"), r = i.indexOf(",");
|
|
649
|
+
return t === -1 || r !== -1 && r < t ? i.substring(e, r) : i.substring(e, t);
|
|
650
|
+
}
|
|
651
|
+
function ji(i) {
|
|
646
652
|
let e = i.children;
|
|
647
653
|
if (e) {
|
|
648
|
-
let
|
|
649
|
-
return !!(
|
|
654
|
+
let t = e.last;
|
|
655
|
+
return !!(t && t.type === V && I("\\9", t.name));
|
|
650
656
|
}
|
|
651
657
|
return !1;
|
|
652
658
|
}
|
|
653
|
-
let
|
|
659
|
+
let Bi = new D([
|
|
654
660
|
"border-radius",
|
|
655
661
|
"border-top-left-radius",
|
|
656
662
|
"border-top-right-radius",
|
|
@@ -664,117 +670,116 @@ let ji = new O([
|
|
|
664
670
|
function z(i, e) {
|
|
665
671
|
return e === 0 ? 0 : i / e;
|
|
666
672
|
}
|
|
667
|
-
let Bi = {
|
|
668
|
-
useLocations: !1
|
|
669
|
-
};
|
|
670
673
|
function Ji(i, e = {}) {
|
|
671
|
-
|
|
674
|
+
return e.useLocations === !0 ? ii(i, e, !0) : ii(i, e, !1);
|
|
675
|
+
}
|
|
676
|
+
function ii(i, e, t) {
|
|
677
|
+
let r = Date.now();
|
|
672
678
|
function n(l) {
|
|
673
|
-
return
|
|
679
|
+
return c(l).trim();
|
|
674
680
|
}
|
|
675
|
-
function
|
|
676
|
-
let
|
|
677
|
-
return i.substring(
|
|
681
|
+
function c(l) {
|
|
682
|
+
let re = l.loc;
|
|
683
|
+
return i.substring(re.start.offset, re.end.offset);
|
|
678
684
|
}
|
|
679
|
-
let
|
|
685
|
+
let g = 0, w = 0, b = 0, x = {
|
|
680
686
|
total: 0,
|
|
681
|
-
/** @type {Map<string, { size: number, count: number } & ({ uniqueWithLocations?: undefined } | ({ uniqueWithLocations: { offset: number, line: number, column: number, length: number }[] })) }>} */
|
|
682
687
|
unique: /* @__PURE__ */ new Map()
|
|
683
|
-
},
|
|
688
|
+
}, O = Date.now(), A = mi(i, {
|
|
684
689
|
parseCustomProperty: !0,
|
|
685
690
|
// To find font-families, colors, etc.
|
|
686
691
|
positions: !0,
|
|
687
692
|
// So we can use stringifyNode()
|
|
688
693
|
onComment: function(l) {
|
|
689
|
-
|
|
694
|
+
g++, w += l.length;
|
|
690
695
|
}
|
|
691
|
-
}),
|
|
692
|
-
C(
|
|
696
|
+
}), F = Date.now(), fi = A.loc.end.line - A.loc.start.line + 1, it = new o(t), he = new S(), me = [], rt = new o(t), ge = new o(t), lt = new o(t), nt = new o(t), st = new o(t), at = new o(t), ot = new o(t), de = new o(t), ut = new o(t), ye = new o(t), we = new o(t), ct = new o(t), ne = new o(t), ft = new o(t), ke = new S(), pt = new o(t), be = 0, xe = 0, Ce = new S(), ve = new S(), Se = new S(), ht = new o(t), mt = new o(t), gt = new o(t), ze = new S(), dt = new o(t), qe = new o(t), yt = /* @__PURE__ */ new Set(), Ae = new o(t), j, B, wt = new S(), kt = new S(), bt = new S(), xt = new o(t), se = new S(), Ct = new o(t), vt = [], Pe = new o(t), Re = new o(t), St = new o(t), zt = new o(t), Oe = new S(), qt = new o(t), At = /* @__PURE__ */ new Set(), L = 0, Pt = new S(), ae = 0, De = 0, Fe = new o(t), Ee = new S(), Rt = new o(t), ee = new o(t), _e = new o(t), Ie = new o(t), oe = new o(t), te = new S(), Me = new S(), Ot = new o(t), Ue = new o(t), Dt = new o(t), Ft = new o(t), Et = new o(t), Te = new o(t), Ve = new o(t), We = new o(t), ue = new o(t), ce = new o(t), Y = new $e(t), G = new o(t), He = new $e(t), _t = new o(t), ie = new o(t), It = new $e(t), Mt = new o(t), E = 0;
|
|
697
|
+
C(A, {
|
|
693
698
|
enter(l) {
|
|
694
|
-
var
|
|
699
|
+
var re, Yt, Gt;
|
|
695
700
|
switch (l.type) {
|
|
696
701
|
case Ge: {
|
|
697
|
-
|
|
702
|
+
it.p(l.name, l.loc), ke.push(E), pt.p(E, l.loc);
|
|
698
703
|
let s = l.name;
|
|
699
704
|
if (s === "font-face") {
|
|
700
705
|
let a = /* @__PURE__ */ Object.create(null);
|
|
701
|
-
t &&
|
|
702
|
-
|
|
703
|
-
}),
|
|
706
|
+
t && rt.p(l.loc.start.offset, l.loc), (re = l.block) == null || re.children.forEach((u) => {
|
|
707
|
+
u.type === "Declaration" && (a[u.property] = n(u.value));
|
|
708
|
+
}), me.push(a), he.push(1);
|
|
704
709
|
break;
|
|
705
710
|
}
|
|
706
|
-
let
|
|
711
|
+
let d = 1;
|
|
707
712
|
if (l.prelude !== null) {
|
|
708
|
-
let a = l.prelude,
|
|
713
|
+
let a = l.prelude, u = a && n(l.prelude), p = a.loc;
|
|
709
714
|
if (s === "media")
|
|
710
|
-
nt.p(
|
|
715
|
+
nt.p(u, p), Si(a) && (st.p(u, p), d++);
|
|
711
716
|
else if (s === "supports")
|
|
712
|
-
|
|
713
|
-
else if (
|
|
714
|
-
let
|
|
715
|
-
|
|
717
|
+
de.p(u, p), vi(a) && (ut.p(u, p), d++);
|
|
718
|
+
else if (I("keyframes", s)) {
|
|
719
|
+
let y = "@" + s + " " + u;
|
|
720
|
+
N(s) && (we.p(y, p), d++), ye.p(y, p);
|
|
716
721
|
} else if (s === "import")
|
|
717
|
-
C(l, (
|
|
718
|
-
if (
|
|
719
|
-
let f = n(
|
|
720
|
-
return
|
|
722
|
+
C(l, (y) => {
|
|
723
|
+
if (y.type === "Condition" && y.kind === "supports") {
|
|
724
|
+
let f = n(y);
|
|
725
|
+
return de.p(f, y.loc), C.break;
|
|
721
726
|
}
|
|
722
|
-
}),
|
|
727
|
+
}), lt.p(u, p);
|
|
723
728
|
else if (s === "charset")
|
|
724
|
-
|
|
729
|
+
ot.p(u, p);
|
|
725
730
|
else if (s === "container") {
|
|
726
|
-
if (
|
|
727
|
-
let
|
|
728
|
-
ne.p(
|
|
731
|
+
if (ct.p(u, p), a.type === "AtrulePrelude" && ((Yt = a.children.first) == null ? void 0 : Yt.type) === "Identifier") {
|
|
732
|
+
let y = a.children.first.name;
|
|
733
|
+
ne.p(y, p);
|
|
729
734
|
}
|
|
730
|
-
} else s === "property" &&
|
|
735
|
+
} else s === "property" && ft.p(u, p);
|
|
731
736
|
} else
|
|
732
|
-
s === "layer" && (
|
|
733
|
-
|
|
737
|
+
s === "layer" && (ge.p("<anonymous>", l.loc), d++);
|
|
738
|
+
he.push(d);
|
|
734
739
|
break;
|
|
735
740
|
}
|
|
736
741
|
// @ts-expect-error Oudated css-tree types
|
|
737
742
|
case "Layer": {
|
|
738
|
-
l.name !== null &&
|
|
743
|
+
l.name !== null && ge.p(l.name, l.loc);
|
|
739
744
|
break;
|
|
740
745
|
}
|
|
741
746
|
// @ts-expect-error Oudated css-tree types
|
|
742
747
|
case "Feature": {
|
|
743
|
-
|
|
748
|
+
at.p(l.name, l.loc);
|
|
744
749
|
break;
|
|
745
750
|
}
|
|
746
751
|
case Qe: {
|
|
747
|
-
let s = l.prelude,
|
|
748
|
-
|
|
752
|
+
let s = l.prelude, d = l.block, a = s.children, u = d.children, p = a ? a.size : 0, y = u ? u.size : 0;
|
|
753
|
+
Ce.push(p + y), ht.p(p + y, l.loc), ve.push(p), mt.p(p, s.loc), Se.push(y), gt.p(y, d.loc), ze.push(E), dt.p(E, l.loc), be++, y === 0 && xe++;
|
|
749
754
|
break;
|
|
750
755
|
}
|
|
751
756
|
case yi: {
|
|
752
757
|
let s = n(l);
|
|
753
|
-
if (this.atrule &&
|
|
754
|
-
return
|
|
755
|
-
oi(l) &&
|
|
756
|
-
let
|
|
757
|
-
if (
|
|
758
|
-
for (let v of
|
|
759
|
-
|
|
758
|
+
if (this.atrule && I("keyframes", this.atrule.name))
|
|
759
|
+
return qe.p(s, l.loc), this.skip;
|
|
760
|
+
oi(l) && Re.p(s, l.loc);
|
|
761
|
+
let d = qi(l);
|
|
762
|
+
if (d !== !1)
|
|
763
|
+
for (let v of d)
|
|
764
|
+
St.p(v, l.loc);
|
|
760
765
|
let a = ui(l);
|
|
761
|
-
zi(l) &&
|
|
762
|
-
let
|
|
763
|
-
return
|
|
764
|
-
|
|
766
|
+
zi(l) && Ae.p(s, l.loc), yt.add(s), se.push(a), Ct.p(a, l.loc), Oe.push(E - 1), qt.p(E - 1, l.loc);
|
|
767
|
+
let u = gi(l).toArray(), [p, y, f] = u;
|
|
768
|
+
return xt.p(u.toString(), l.loc), wt.push(p), kt.push(y), bt.push(f), j === void 0 && (j = u), B === void 0 && (B = u), B !== void 0 && ri(B, u) < 0 && (B = u), j !== void 0 && ri(j, u) > 0 && (j = u), vt.push(u), p > 0 && Pe.p(s, l.loc), Ai(l, function(P) {
|
|
769
|
+
zt.p(P.name, P.loc);
|
|
765
770
|
}), this.skip;
|
|
766
771
|
}
|
|
767
|
-
case
|
|
772
|
+
case Le: {
|
|
768
773
|
if (!this.declaration)
|
|
769
774
|
break;
|
|
770
775
|
let s = l.unit;
|
|
771
|
-
return
|
|
776
|
+
return I("\\9", s) ? He.push(s.substring(0, s.length - 2), this.declaration.property, l.loc) : He.push(s, this.declaration.property, l.loc), this.skip;
|
|
772
777
|
}
|
|
773
778
|
case Ci: {
|
|
774
779
|
if (Xe("data:", l.value)) {
|
|
775
|
-
let s = l.value,
|
|
776
|
-
x.total++,
|
|
777
|
-
let
|
|
780
|
+
let s = l.value, d = s.length, a = Ni(s);
|
|
781
|
+
x.total++, b += d;
|
|
782
|
+
let u = {
|
|
778
783
|
line: l.loc.start.line,
|
|
779
784
|
column: l.loc.start.column,
|
|
780
785
|
offset: l.loc.start.offset,
|
|
@@ -782,12 +787,12 @@ function Ji(i, e = {}) {
|
|
|
782
787
|
};
|
|
783
788
|
if (x.unique.has(a)) {
|
|
784
789
|
let p = x.unique.get(a);
|
|
785
|
-
p.count++, p.size +=
|
|
790
|
+
p.count++, p.size += d, x.unique.set(a, p), t && p.uniqueWithLocations && p.uniqueWithLocations.push(u);
|
|
786
791
|
} else {
|
|
787
792
|
let p = {
|
|
788
793
|
count: 1,
|
|
789
|
-
size:
|
|
790
|
-
uniqueWithLocations: t ? [
|
|
794
|
+
size: d,
|
|
795
|
+
uniqueWithLocations: t ? [u] : void 0
|
|
791
796
|
};
|
|
792
797
|
x.unique.set(a, p);
|
|
793
798
|
}
|
|
@@ -796,97 +801,97 @@ function Ji(i, e = {}) {
|
|
|
796
801
|
}
|
|
797
802
|
case wi: {
|
|
798
803
|
let s = l.loc;
|
|
799
|
-
if (
|
|
800
|
-
|
|
804
|
+
if (fe(l)) {
|
|
805
|
+
Me.push(1), ie.p(n(l), s);
|
|
801
806
|
break;
|
|
802
807
|
}
|
|
803
|
-
let
|
|
804
|
-
ci(l) && (
|
|
805
|
-
let
|
|
806
|
-
if (
|
|
807
|
-
|
|
808
|
+
let d = this.declaration, { property: a, important: u } = d, p = 1;
|
|
809
|
+
ci(l) && (Ot.p(n(l), s), p++), typeof u == "string" && (Ue.p(c(l) + "!" + u, s), p++), ji(l) && (Ue.p(n(l), s), p++);
|
|
810
|
+
let y = l.children;
|
|
811
|
+
if (Me.push(p), m("margin", a) || m("margin-block", a) || m("margin-inline", a) || m("margin-top", a) || m("margin-right", a) || m("margin-bottom", a) || m("margin-left", a) || m("padding", a) || m("padding-block", a) || m("padding-inline", a) || m("padding-top", a) || m("padding-right", a) || m("padding-bottom", a) || m("padding-left", a))
|
|
812
|
+
Fi(l) && Mt.p(a, d.loc);
|
|
808
813
|
else {
|
|
809
814
|
if (m("z-index", a))
|
|
810
815
|
return Dt.p(n(l), s), this.skip;
|
|
811
816
|
if (m("font", a)) {
|
|
812
817
|
if (Ze(l)) return;
|
|
813
818
|
let f = Mi(l, n, function(Qt) {
|
|
814
|
-
Qt.type === "keyword" &&
|
|
819
|
+
Qt.type === "keyword" && ie.p(Qt.value, s);
|
|
815
820
|
});
|
|
816
821
|
if (!f)
|
|
817
822
|
return this.skip;
|
|
818
|
-
let { font_size: v, line_height: P, font_family:
|
|
819
|
-
|
|
823
|
+
let { font_size: v, line_height: P, font_family: W } = f;
|
|
824
|
+
W && Te.p(W, s), v && Ve.p(v, s), P && We.p(P, s);
|
|
820
825
|
break;
|
|
821
826
|
} else if (m("font-size", a)) {
|
|
822
827
|
Ze(l) || Ve.p(n(l), s);
|
|
823
828
|
break;
|
|
824
829
|
} else if (m("font-family", a)) {
|
|
825
|
-
Ze(l) ||
|
|
830
|
+
Ze(l) || Te.p(n(l), s);
|
|
826
831
|
break;
|
|
827
832
|
} else if (m("line-height", a))
|
|
828
|
-
|
|
833
|
+
We.p(n(l), s);
|
|
829
834
|
else if (m("transition", a) || m("animation", a)) {
|
|
830
|
-
|
|
831
|
-
f.type === "fn" ?
|
|
835
|
+
Vi(y, function(f) {
|
|
836
|
+
f.type === "fn" ? ue.p(n(f.value), s) : f.type === "duration" ? ce.p(n(f.value), s) : f.type === "keyword" && ie.p(n(f.value), s);
|
|
832
837
|
});
|
|
833
838
|
break;
|
|
834
839
|
} else if (m("animation-duration", a) || m("transition-duration", a)) {
|
|
835
|
-
|
|
836
|
-
f.type !== Z && fe.p(n(f), s);
|
|
837
|
-
}) : fe.p(n(l), s);
|
|
838
|
-
break;
|
|
839
|
-
} else if (m("transition-timing-function", a) || m("animation-timing-function", a)) {
|
|
840
|
-
d && d.size > 1 ? d.forEach((f) => {
|
|
840
|
+
y && y.size > 1 ? y.forEach((f) => {
|
|
841
841
|
f.type !== Z && ce.p(n(f), s);
|
|
842
842
|
}) : ce.p(n(l), s);
|
|
843
843
|
break;
|
|
844
|
+
} else if (m("transition-timing-function", a) || m("animation-timing-function", a)) {
|
|
845
|
+
y && y.size > 1 ? y.forEach((f) => {
|
|
846
|
+
f.type !== Z && ue.p(n(f), s);
|
|
847
|
+
}) : ue.p(n(l), s);
|
|
848
|
+
break;
|
|
844
849
|
} else if (m("container-name", a))
|
|
845
850
|
ne.p(n(l), s);
|
|
846
851
|
else if (m("container", a))
|
|
847
|
-
((Gt =
|
|
848
|
-
else if (
|
|
849
|
-
|
|
852
|
+
((Gt = y.first) == null ? void 0 : Gt.type) === "Identifier" && ne.p(y.first.name, s);
|
|
853
|
+
else if (Bi.has(Ki(a))) {
|
|
854
|
+
fe(l) || It.push(n(l), a, s);
|
|
850
855
|
break;
|
|
851
|
-
} else m("text-shadow", a) ?
|
|
856
|
+
} else m("text-shadow", a) ? fe(l) || Ft.p(n(l), s) : m("box-shadow", a) && (fe(l) || Et.p(n(l), s));
|
|
852
857
|
}
|
|
853
858
|
C(l, function(f) {
|
|
854
859
|
let v = f.name;
|
|
855
860
|
switch (f.type) {
|
|
856
861
|
case xi: {
|
|
857
862
|
let P = f.value.length;
|
|
858
|
-
return
|
|
863
|
+
return I("\\9", f.value) && (P = P - 2), Y.push("#" + f.value, a, s), G.p("hex" + P, s), C.skip;
|
|
859
864
|
}
|
|
860
|
-
case
|
|
861
|
-
|
|
865
|
+
case V: {
|
|
866
|
+
pe.has(v) && ie.p(v, s);
|
|
862
867
|
let P = v.length;
|
|
863
868
|
if (P > 20 || P < 3)
|
|
864
869
|
return C.skip;
|
|
865
|
-
if (
|
|
866
|
-
let
|
|
867
|
-
Y.push(
|
|
870
|
+
if (Di.has(v)) {
|
|
871
|
+
let W = n(f);
|
|
872
|
+
Y.push(W, a, s), G.p(v.toLowerCase(), s);
|
|
868
873
|
return;
|
|
869
874
|
}
|
|
870
875
|
if (Pi.has(v)) {
|
|
871
|
-
let
|
|
872
|
-
Y.push(
|
|
876
|
+
let W = n(f);
|
|
877
|
+
Y.push(W, a, s), G.p("named", s);
|
|
873
878
|
return;
|
|
874
879
|
}
|
|
875
|
-
if (
|
|
876
|
-
let
|
|
877
|
-
Y.push(
|
|
880
|
+
if (Ri.has(v)) {
|
|
881
|
+
let W = n(f);
|
|
882
|
+
Y.push(W, a, s), G.p("system", s);
|
|
878
883
|
return;
|
|
879
884
|
}
|
|
880
885
|
return C.skip;
|
|
881
886
|
}
|
|
882
|
-
case
|
|
887
|
+
case et: {
|
|
883
888
|
if (q("var", v))
|
|
884
889
|
return C.skip;
|
|
885
890
|
if (Oi.has(v)) {
|
|
886
891
|
Y.push(n(f), a, f.loc), G.p(v.toLowerCase(), f.loc);
|
|
887
892
|
return;
|
|
888
893
|
}
|
|
889
|
-
if (
|
|
894
|
+
if (I("gradient", v)) {
|
|
890
895
|
_t.p(n(f), f.loc);
|
|
891
896
|
return;
|
|
892
897
|
}
|
|
@@ -898,48 +903,48 @@ function Ji(i, e = {}) {
|
|
|
898
903
|
case "Declaration": {
|
|
899
904
|
if (this.atrulePrelude !== null)
|
|
900
905
|
return this.skip;
|
|
901
|
-
|
|
906
|
+
L++;
|
|
902
907
|
let s = 1;
|
|
903
|
-
|
|
908
|
+
At.add(n(l)), Ee.push(E - 1), Rt.p(E - 1, l.loc), l.important === !0 && (ae++, s++, this.atrule && I("keyframes", this.atrule.name) && (De++, s++)), Pt.push(s);
|
|
904
909
|
let {
|
|
905
|
-
property:
|
|
910
|
+
property: d,
|
|
906
911
|
// @ts-expect-error TODO: fix this
|
|
907
912
|
loc: { start: a }
|
|
908
|
-
} = l,
|
|
913
|
+
} = l, u = {
|
|
909
914
|
start: {
|
|
910
915
|
line: a.line,
|
|
911
916
|
column: a.column,
|
|
912
917
|
offset: a.offset
|
|
913
918
|
},
|
|
914
919
|
end: {
|
|
915
|
-
offset: a.offset +
|
|
920
|
+
offset: a.offset + d.length
|
|
916
921
|
}
|
|
917
922
|
};
|
|
918
|
-
|
|
923
|
+
ee.p(d, u), N(d) ? (Ie.p(d, u), te.push(2)) : Hi(d) ? (_e.p(d, u), te.push(2)) : tt(d) ? (oe.p(d, u), te.push(l.important ? 3 : 2), l.important === !0 && Fe.p(d, u)) : te.push(1);
|
|
919
924
|
break;
|
|
920
925
|
}
|
|
921
926
|
}
|
|
922
|
-
(l.type === Qe || l.type === Ge) &&
|
|
927
|
+
(l.type === Qe || l.type === Ge) && E++;
|
|
923
928
|
},
|
|
924
929
|
leave(l) {
|
|
925
|
-
(l.type === Qe || l.type === Ge) &&
|
|
930
|
+
(l.type === Qe || l.type === Ge) && E--;
|
|
926
931
|
}
|
|
927
932
|
});
|
|
928
|
-
let
|
|
933
|
+
let Ut = At.size, Q = se.size(), Ke = wt.aggregate(), Ne = kt.aggregate(), je = bt.aggregate(), Tt = yt.size, k = Object.assign, Vt = i.length, Be = me.length, Wt = he.aggregate(), Ht = se.aggregate(), Kt = Pt.aggregate(), Nt = te.aggregate(), jt = Me.aggregate(), Bt = it.c();
|
|
929
934
|
return {
|
|
930
935
|
stylesheet: {
|
|
931
|
-
sourceLinesOfCode: Bt.total + Q +
|
|
936
|
+
sourceLinesOfCode: Bt.total + Q + L + qe.size(),
|
|
932
937
|
linesOfCode: fi,
|
|
933
938
|
size: Vt,
|
|
934
|
-
complexity:
|
|
939
|
+
complexity: Wt.sum + Ht.sum + Kt.sum + Nt.sum + jt.sum,
|
|
935
940
|
comments: {
|
|
936
|
-
total:
|
|
937
|
-
size:
|
|
941
|
+
total: g,
|
|
942
|
+
size: w
|
|
938
943
|
},
|
|
939
944
|
embeddedContent: {
|
|
940
945
|
size: {
|
|
941
|
-
total:
|
|
942
|
-
ratio: z(
|
|
946
|
+
total: b,
|
|
947
|
+
ratio: z(b, Vt)
|
|
943
948
|
},
|
|
944
949
|
types: {
|
|
945
950
|
total: x.total,
|
|
@@ -949,188 +954,188 @@ function Ji(i, e = {}) {
|
|
|
949
954
|
}
|
|
950
955
|
}
|
|
951
956
|
},
|
|
952
|
-
atrules:
|
|
953
|
-
fontface:
|
|
957
|
+
atrules: k(Bt, {
|
|
958
|
+
fontface: k(
|
|
954
959
|
{
|
|
955
960
|
total: Be,
|
|
956
961
|
totalUnique: Be,
|
|
957
|
-
unique:
|
|
962
|
+
unique: me,
|
|
958
963
|
uniquenessRatio: Be === 0 ? 0 : 1
|
|
959
964
|
},
|
|
960
965
|
t ? {
|
|
961
|
-
uniqueWithLocations:
|
|
966
|
+
uniqueWithLocations: rt.c().uniqueWithLocations
|
|
962
967
|
} : {}
|
|
963
968
|
),
|
|
964
|
-
import:
|
|
965
|
-
media:
|
|
966
|
-
browserhacks:
|
|
967
|
-
features:
|
|
969
|
+
import: lt.c(),
|
|
970
|
+
media: k(nt.c(), {
|
|
971
|
+
browserhacks: st.c(),
|
|
972
|
+
features: at.c()
|
|
968
973
|
}),
|
|
969
|
-
charset:
|
|
970
|
-
supports:
|
|
971
|
-
browserhacks:
|
|
974
|
+
charset: ot.c(),
|
|
975
|
+
supports: k(de.c(), {
|
|
976
|
+
browserhacks: ut.c()
|
|
972
977
|
}),
|
|
973
|
-
keyframes:
|
|
974
|
-
prefixed:
|
|
975
|
-
ratio: z(
|
|
978
|
+
keyframes: k(ye.c(), {
|
|
979
|
+
prefixed: k(we.c(), {
|
|
980
|
+
ratio: z(we.size(), ye.size())
|
|
976
981
|
})
|
|
977
982
|
}),
|
|
978
|
-
container:
|
|
983
|
+
container: k(ct.c(), {
|
|
979
984
|
names: ne.c()
|
|
980
985
|
}),
|
|
981
|
-
layer:
|
|
982
|
-
property:
|
|
983
|
-
complexity:
|
|
984
|
-
nesting:
|
|
985
|
-
|
|
986
|
+
layer: ge.c(),
|
|
987
|
+
property: ft.c(),
|
|
988
|
+
complexity: Wt,
|
|
989
|
+
nesting: k(
|
|
990
|
+
ke.aggregate(),
|
|
986
991
|
{
|
|
987
|
-
items:
|
|
992
|
+
items: ke.toArray()
|
|
988
993
|
},
|
|
989
|
-
|
|
994
|
+
pt.c()
|
|
990
995
|
)
|
|
991
996
|
}),
|
|
992
997
|
rules: {
|
|
993
|
-
total:
|
|
998
|
+
total: be,
|
|
994
999
|
empty: {
|
|
995
|
-
total:
|
|
996
|
-
ratio: z(
|
|
1000
|
+
total: xe,
|
|
1001
|
+
ratio: z(xe, be)
|
|
997
1002
|
},
|
|
998
|
-
sizes:
|
|
999
|
-
|
|
1003
|
+
sizes: k(
|
|
1004
|
+
Ce.aggregate(),
|
|
1000
1005
|
{
|
|
1001
|
-
items:
|
|
1006
|
+
items: Ce.toArray()
|
|
1002
1007
|
},
|
|
1003
|
-
|
|
1008
|
+
ht.c()
|
|
1004
1009
|
),
|
|
1005
|
-
nesting:
|
|
1006
|
-
|
|
1010
|
+
nesting: k(
|
|
1011
|
+
ze.aggregate(),
|
|
1007
1012
|
{
|
|
1008
|
-
items:
|
|
1013
|
+
items: ze.toArray()
|
|
1009
1014
|
},
|
|
1010
|
-
|
|
1015
|
+
dt.c()
|
|
1011
1016
|
),
|
|
1012
|
-
selectors:
|
|
1013
|
-
|
|
1017
|
+
selectors: k(
|
|
1018
|
+
ve.aggregate(),
|
|
1014
1019
|
{
|
|
1015
|
-
items:
|
|
1020
|
+
items: ve.toArray()
|
|
1016
1021
|
},
|
|
1017
|
-
|
|
1022
|
+
mt.c()
|
|
1018
1023
|
),
|
|
1019
|
-
declarations:
|
|
1020
|
-
|
|
1024
|
+
declarations: k(
|
|
1025
|
+
Se.aggregate(),
|
|
1021
1026
|
{
|
|
1022
|
-
items:
|
|
1027
|
+
items: Se.toArray()
|
|
1023
1028
|
},
|
|
1024
|
-
|
|
1029
|
+
gt.c()
|
|
1025
1030
|
)
|
|
1026
1031
|
},
|
|
1027
1032
|
selectors: {
|
|
1028
1033
|
total: Q,
|
|
1029
|
-
totalUnique:
|
|
1030
|
-
uniquenessRatio: z(
|
|
1031
|
-
specificity:
|
|
1034
|
+
totalUnique: Tt,
|
|
1035
|
+
uniquenessRatio: z(Tt, Q),
|
|
1036
|
+
specificity: k(
|
|
1032
1037
|
{
|
|
1033
1038
|
/** @type Specificity */
|
|
1034
1039
|
min: B === void 0 ? [0, 0, 0] : B,
|
|
1035
1040
|
/** @type Specificity */
|
|
1036
1041
|
max: j === void 0 ? [0, 0, 0] : j,
|
|
1037
1042
|
/** @type Specificity */
|
|
1038
|
-
sum: [
|
|
1043
|
+
sum: [Ke.sum, Ne.sum, je.sum],
|
|
1039
1044
|
/** @type Specificity */
|
|
1040
|
-
mean: [
|
|
1045
|
+
mean: [Ke.mean, Ne.mean, je.mean],
|
|
1041
1046
|
/** @type Specificity */
|
|
1042
|
-
mode: [
|
|
1047
|
+
mode: [Ke.mode, Ne.mode, je.mode],
|
|
1043
1048
|
/** @type Specificity */
|
|
1044
|
-
items:
|
|
1049
|
+
items: vt
|
|
1045
1050
|
},
|
|
1046
|
-
|
|
1051
|
+
xt.c()
|
|
1047
1052
|
),
|
|
1048
|
-
complexity:
|
|
1049
|
-
items:
|
|
1053
|
+
complexity: k(Ht, Ct.c(), {
|
|
1054
|
+
items: se.toArray()
|
|
1050
1055
|
}),
|
|
1051
|
-
nesting:
|
|
1052
|
-
|
|
1056
|
+
nesting: k(
|
|
1057
|
+
Oe.aggregate(),
|
|
1053
1058
|
{
|
|
1054
|
-
items:
|
|
1059
|
+
items: Oe.toArray()
|
|
1055
1060
|
},
|
|
1056
|
-
|
|
1061
|
+
qt.c()
|
|
1057
1062
|
),
|
|
1058
|
-
id:
|
|
1059
|
-
ratio: z(
|
|
1063
|
+
id: k(Pe.c(), {
|
|
1064
|
+
ratio: z(Pe.size(), Q)
|
|
1060
1065
|
}),
|
|
1061
|
-
pseudoClasses:
|
|
1062
|
-
accessibility:
|
|
1063
|
-
ratio: z(
|
|
1066
|
+
pseudoClasses: St.c(),
|
|
1067
|
+
accessibility: k(Re.c(), {
|
|
1068
|
+
ratio: z(Re.size(), Q)
|
|
1064
1069
|
}),
|
|
1065
|
-
keyframes:
|
|
1066
|
-
prefixed:
|
|
1067
|
-
ratio: z(
|
|
1070
|
+
keyframes: qe.c(),
|
|
1071
|
+
prefixed: k(Ae.c(), {
|
|
1072
|
+
ratio: z(Ae.size(), Q)
|
|
1068
1073
|
}),
|
|
1069
|
-
combinators:
|
|
1074
|
+
combinators: zt.c()
|
|
1070
1075
|
},
|
|
1071
1076
|
declarations: {
|
|
1072
|
-
total:
|
|
1073
|
-
totalUnique:
|
|
1074
|
-
uniquenessRatio: z(
|
|
1077
|
+
total: L,
|
|
1078
|
+
totalUnique: Ut,
|
|
1079
|
+
uniquenessRatio: z(Ut, L),
|
|
1075
1080
|
importants: {
|
|
1076
|
-
total:
|
|
1077
|
-
ratio: z(
|
|
1081
|
+
total: ae,
|
|
1082
|
+
ratio: z(ae, L),
|
|
1078
1083
|
inKeyframes: {
|
|
1079
1084
|
total: De,
|
|
1080
|
-
ratio: z(De,
|
|
1085
|
+
ratio: z(De, ae)
|
|
1081
1086
|
}
|
|
1082
1087
|
},
|
|
1083
|
-
complexity:
|
|
1084
|
-
nesting:
|
|
1088
|
+
complexity: Kt,
|
|
1089
|
+
nesting: k(
|
|
1085
1090
|
Ee.aggregate(),
|
|
1086
1091
|
{
|
|
1087
1092
|
items: Ee.toArray()
|
|
1088
1093
|
},
|
|
1089
|
-
|
|
1094
|
+
Rt.c()
|
|
1090
1095
|
)
|
|
1091
1096
|
},
|
|
1092
|
-
properties:
|
|
1093
|
-
prefixed:
|
|
1094
|
-
ratio: z(
|
|
1097
|
+
properties: k(ee.c(), {
|
|
1098
|
+
prefixed: k(Ie.c(), {
|
|
1099
|
+
ratio: z(Ie.size(), ee.size())
|
|
1095
1100
|
}),
|
|
1096
|
-
custom:
|
|
1097
|
-
ratio: z(
|
|
1098
|
-
importants:
|
|
1099
|
-
ratio: z(Fe.size(),
|
|
1101
|
+
custom: k(oe.c(), {
|
|
1102
|
+
ratio: z(oe.size(), ee.size()),
|
|
1103
|
+
importants: k(Fe.c(), {
|
|
1104
|
+
ratio: z(Fe.size(), oe.size())
|
|
1100
1105
|
})
|
|
1101
1106
|
}),
|
|
1102
|
-
browserhacks:
|
|
1103
|
-
ratio: z(_e.size(),
|
|
1107
|
+
browserhacks: k(_e.c(), {
|
|
1108
|
+
ratio: z(_e.size(), ee.size())
|
|
1104
1109
|
}),
|
|
1105
1110
|
complexity: Nt
|
|
1106
1111
|
}),
|
|
1107
1112
|
values: {
|
|
1108
|
-
colors:
|
|
1113
|
+
colors: k(Y.count(), {
|
|
1109
1114
|
formats: G.c()
|
|
1110
1115
|
}),
|
|
1111
1116
|
gradients: _t.c(),
|
|
1112
|
-
fontFamilies:
|
|
1117
|
+
fontFamilies: Te.c(),
|
|
1113
1118
|
fontSizes: Ve.c(),
|
|
1114
|
-
lineHeights:
|
|
1119
|
+
lineHeights: We.c(),
|
|
1115
1120
|
zindexes: Dt.c(),
|
|
1116
1121
|
textShadows: Ft.c(),
|
|
1117
1122
|
boxShadows: Et.c(),
|
|
1118
|
-
borderRadiuses:
|
|
1123
|
+
borderRadiuses: It.count(),
|
|
1119
1124
|
animations: {
|
|
1120
|
-
durations:
|
|
1121
|
-
timingFunctions:
|
|
1125
|
+
durations: ce.c(),
|
|
1126
|
+
timingFunctions: ue.c()
|
|
1122
1127
|
},
|
|
1123
|
-
prefixes:
|
|
1124
|
-
browserhacks:
|
|
1125
|
-
units:
|
|
1128
|
+
prefixes: Ot.c(),
|
|
1129
|
+
browserhacks: Ue.c(),
|
|
1130
|
+
units: He.count(),
|
|
1126
1131
|
complexity: jt,
|
|
1127
|
-
keywords:
|
|
1128
|
-
resets:
|
|
1132
|
+
keywords: ie.c(),
|
|
1133
|
+
resets: Mt.c()
|
|
1129
1134
|
},
|
|
1130
1135
|
__meta__: {
|
|
1131
|
-
parseTime:
|
|
1132
|
-
analyzeTime: Date.now() -
|
|
1133
|
-
total: Date.now() -
|
|
1136
|
+
parseTime: F - O,
|
|
1137
|
+
analyzeTime: Date.now() - F,
|
|
1138
|
+
total: Date.now() - r
|
|
1134
1139
|
}
|
|
1135
1140
|
};
|
|
1136
1141
|
}
|
|
@@ -1138,13 +1143,13 @@ function ri(i, e) {
|
|
|
1138
1143
|
return i[0] === e[0] ? i[1] === e[1] ? e[2] - i[2] : e[1] - i[1] : e[0] - i[0];
|
|
1139
1144
|
}
|
|
1140
1145
|
export {
|
|
1141
|
-
|
|
1146
|
+
D as KeywordSet,
|
|
1142
1147
|
Ji as analyze,
|
|
1143
1148
|
Oi as colorFunctions,
|
|
1144
|
-
|
|
1149
|
+
Di as colorKeywords,
|
|
1145
1150
|
ri as compareSpecificity,
|
|
1146
|
-
|
|
1147
|
-
|
|
1151
|
+
pe as cssKeywords,
|
|
1152
|
+
N as hasVendorPrefix,
|
|
1148
1153
|
oi as isAccessibilitySelector,
|
|
1149
1154
|
Si as isMediaBrowserhack,
|
|
1150
1155
|
Hi as isPropertyHack,
|
|
@@ -1153,5 +1158,5 @@ export {
|
|
|
1153
1158
|
ci as isValuePrefixed,
|
|
1154
1159
|
Pi as namedColors,
|
|
1155
1160
|
ui as selectorComplexity,
|
|
1156
|
-
|
|
1161
|
+
Ri as systemColors
|
|
1157
1162
|
};
|