@projectwallace/css-analyzer 9.3.0 → 9.5.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.
package/dist/index.d.ts CHANGED
@@ -1,592 +1,548 @@
1
- import { calculate as calculateSpecificity } from './selectors/specificity.js';
2
- import { CollectionCount } from './collection.js';
3
- import { colorFunctions } from './values/colors.js';
4
- import { colorKeywords } from './values/colors.js';
5
- import { keywords as cssKeywords } from './values/values.js';
6
- import { hasVendorPrefix } from './vendor-prefix.js';
7
- import { isAccessibility as isAccessibilitySelector } from './selectors/utils.js';
8
- import { isMediaBrowserhack } from './atrules/atrules.js';
9
- import { isHack as isPropertyHack } from './properties/property-utils.js';
10
- import { isPrefixed as isSelectorPrefixed } from './selectors/utils.js';
11
- import { isSupportsBrowserhack } from './atrules/atrules.js';
12
- import { isValuePrefixed } from './values/vendor-prefix.js';
13
- import { KeywordSet } from './keyword-set.js';
14
- import { Location as Location_2 } from './collection.js';
15
- import { namedColors } from './values/colors.js';
16
- import { getComplexity as selectorComplexity } from './selectors/utils.js';
17
- import { systemColors } from './values/colors.js';
18
- import { UniqueWithLocations } from './collection.js';
19
-
20
- export declare function analyze(css: string, options?: Options & {
21
- useLocations?: false | undefined;
22
- }): ReturnType<typeof analyzeInternal<false>>;
23
-
24
- export declare function analyze(css: string, options: Options & {
25
- useLocations: true;
26
- }): ReturnType<typeof analyzeInternal<true>>;
27
-
28
- declare function analyzeInternal<T extends boolean>(css: string, options: Options, useLocations: T): {
29
- stylesheet: {
30
- sourceLinesOfCode: number;
31
- linesOfCode: number;
32
- size: number;
33
- complexity: number;
34
- comments: {
35
- total: number;
36
- size: number;
37
- };
38
- embeddedContent: {
39
- size: {
40
- total: number;
41
- ratio: number;
42
- };
43
- types: {
44
- total: number;
45
- totalUnique: number;
46
- uniquenessRatio: number;
47
- unique: {
48
- [k: string]: {
49
- size: number;
50
- count: number;
51
- uniqueWithLocations?: Location_2[];
52
- };
53
- };
54
- };
55
- };
56
- };
57
- atrules: {
58
- total: number;
59
- totalUnique: number;
60
- unique: Record<string, number>;
61
- uniquenessRatio: number;
62
- } & (T extends true ? {
63
- uniqueWithLocations: UniqueWithLocations;
64
- } : {
65
- uniqueWithLocations?: undefined;
66
- }) & {
67
- fontface: {
68
- total: number;
69
- totalUnique: number;
70
- unique: Record<string, string>[];
71
- uniquenessRatio: number;
72
- } & ({
73
- uniqueWithLocations: UniqueWithLocations | undefined;
74
- } | {
75
- uniqueWithLocations?: undefined;
76
- });
77
- import: CollectionCount<T>;
78
- media: {
79
- total: number;
80
- totalUnique: number;
81
- unique: Record<string, number>;
82
- uniquenessRatio: number;
83
- } & (T extends true ? {
84
- uniqueWithLocations: UniqueWithLocations;
85
- } : {
86
- uniqueWithLocations?: undefined;
87
- }) & {
88
- browserhacks: CollectionCount<T>;
89
- features: CollectionCount<T>;
90
- };
91
- charset: CollectionCount<T>;
92
- supports: {
93
- total: number;
94
- totalUnique: number;
95
- unique: Record<string, number>;
96
- uniquenessRatio: number;
97
- } & (T extends true ? {
98
- uniqueWithLocations: UniqueWithLocations;
99
- } : {
100
- uniqueWithLocations?: undefined;
101
- }) & {
102
- browserhacks: CollectionCount<T>;
103
- };
104
- keyframes: {
105
- total: number;
106
- totalUnique: number;
107
- unique: Record<string, number>;
108
- uniquenessRatio: number;
109
- } & (T extends true ? {
110
- uniqueWithLocations: UniqueWithLocations;
111
- } : {
112
- uniqueWithLocations?: undefined;
113
- }) & {
114
- prefixed: {
115
- total: number;
116
- totalUnique: number;
117
- unique: Record<string, number>;
118
- uniquenessRatio: number;
119
- } & (T extends true ? {
120
- uniqueWithLocations: UniqueWithLocations;
121
- } : {
122
- uniqueWithLocations?: undefined;
123
- }) & {
124
- ratio: number;
125
- };
126
- };
127
- container: {
128
- total: number;
129
- totalUnique: number;
130
- unique: Record<string, number>;
131
- uniquenessRatio: number;
132
- } & (T extends true ? {
133
- uniqueWithLocations: UniqueWithLocations;
134
- } : {
135
- uniqueWithLocations?: undefined;
136
- }) & {
137
- names: CollectionCount<T>;
138
- };
139
- layer: CollectionCount<T>;
140
- property: CollectionCount<T>;
141
- scope: CollectionCount<T>;
142
- complexity: {
143
- min: number;
144
- max: number;
145
- mean: number;
146
- mode: number;
147
- range: number;
148
- sum: number;
149
- };
150
- nesting: {
151
- min: number;
152
- max: number;
153
- mean: number;
154
- mode: number;
155
- range: number;
156
- sum: number;
157
- } & {
158
- items: number[];
159
- } & {
160
- total: number;
161
- totalUnique: number;
162
- unique: Record<string, number>;
163
- uniquenessRatio: number;
164
- } & (T extends true ? {
165
- uniqueWithLocations: UniqueWithLocations;
166
- } : {
167
- uniqueWithLocations?: undefined;
168
- });
169
- };
170
- rules: {
171
- total: number;
172
- empty: {
173
- total: number;
174
- ratio: number;
175
- };
176
- sizes: {
177
- min: number;
178
- max: number;
179
- mean: number;
180
- mode: number;
181
- range: number;
182
- sum: number;
183
- } & {
184
- items: number[];
185
- } & {
186
- total: number;
187
- totalUnique: number;
188
- unique: Record<string, number>;
189
- uniquenessRatio: number;
190
- } & (T extends true ? {
191
- uniqueWithLocations: UniqueWithLocations;
192
- } : {
193
- uniqueWithLocations?: undefined;
194
- });
195
- nesting: {
196
- min: number;
197
- max: number;
198
- mean: number;
199
- mode: number;
200
- range: number;
201
- sum: number;
202
- } & {
203
- items: number[];
204
- } & {
205
- total: number;
206
- totalUnique: number;
207
- unique: Record<string, number>;
208
- uniquenessRatio: number;
209
- } & (T extends true ? {
210
- uniqueWithLocations: UniqueWithLocations;
211
- } : {
212
- uniqueWithLocations?: undefined;
213
- });
214
- selectors: {
215
- min: number;
216
- max: number;
217
- mean: number;
218
- mode: number;
219
- range: number;
220
- sum: number;
221
- } & {
222
- items: number[];
223
- } & {
224
- total: number;
225
- totalUnique: number;
226
- unique: Record<string, number>;
227
- uniquenessRatio: number;
228
- } & (T extends true ? {
229
- uniqueWithLocations: UniqueWithLocations;
230
- } : {
231
- uniqueWithLocations?: undefined;
232
- });
233
- declarations: {
234
- min: number;
235
- max: number;
236
- mean: number;
237
- mode: number;
238
- range: number;
239
- sum: number;
240
- } & {
241
- items: number[];
242
- } & {
243
- total: number;
244
- totalUnique: number;
245
- unique: Record<string, number>;
246
- uniquenessRatio: number;
247
- } & (T extends true ? {
248
- uniqueWithLocations: UniqueWithLocations;
249
- } : {
250
- uniqueWithLocations?: undefined;
251
- });
252
- };
253
- selectors: {
254
- total: number;
255
- totalUnique: number;
256
- uniquenessRatio: number;
257
- specificity: {
258
- /** @type Specificity */
259
- min: number[];
260
- /** @type Specificity */
261
- max: number[];
262
- /** @type Specificity */
263
- sum: number[];
264
- /** @type Specificity */
265
- mean: number[];
266
- /** @type Specificity */
267
- mode: number[];
268
- /** @type Specificity */
269
- items: Specificity[];
270
- } & {
271
- total: number;
272
- totalUnique: number;
273
- unique: Record<string, number>;
274
- uniquenessRatio: number;
275
- } & (T extends true ? {
276
- uniqueWithLocations: UniqueWithLocations;
277
- } : {
278
- uniqueWithLocations?: undefined;
279
- });
280
- complexity: {
281
- min: number;
282
- max: number;
283
- mean: number;
284
- mode: number;
285
- range: number;
286
- sum: number;
287
- } & {
288
- total: number;
289
- totalUnique: number;
290
- unique: Record<string, number>;
291
- uniquenessRatio: number;
292
- } & (T extends true ? {
293
- uniqueWithLocations: UniqueWithLocations;
294
- } : {
295
- uniqueWithLocations?: undefined;
296
- }) & {
297
- items: number[];
298
- };
299
- nesting: {
300
- min: number;
301
- max: number;
302
- mean: number;
303
- mode: number;
304
- range: number;
305
- sum: number;
306
- } & {
307
- items: number[];
308
- } & {
309
- total: number;
310
- totalUnique: number;
311
- unique: Record<string, number>;
312
- uniquenessRatio: number;
313
- } & (T extends true ? {
314
- uniqueWithLocations: UniqueWithLocations;
315
- } : {
316
- uniqueWithLocations?: undefined;
317
- });
318
- id: {
319
- total: number;
320
- totalUnique: number;
321
- unique: Record<string, number>;
322
- uniquenessRatio: number;
323
- } & (T extends true ? {
324
- uniqueWithLocations: UniqueWithLocations;
325
- } : {
326
- uniqueWithLocations?: undefined;
327
- }) & {
328
- ratio: number;
329
- };
330
- pseudoClasses: CollectionCount<T>;
331
- pseudoElements: CollectionCount<T>;
332
- accessibility: {
333
- total: number;
334
- totalUnique: number;
335
- unique: Record<string, number>;
336
- uniquenessRatio: number;
337
- } & (T extends true ? {
338
- uniqueWithLocations: UniqueWithLocations;
339
- } : {
340
- uniqueWithLocations?: undefined;
341
- }) & {
342
- ratio: number;
343
- };
344
- attributes: CollectionCount<T>;
345
- customElements: CollectionCount<T>;
346
- keyframes: CollectionCount<T>;
347
- prefixed: {
348
- total: number;
349
- totalUnique: number;
350
- unique: Record<string, number>;
351
- uniquenessRatio: number;
352
- } & (T extends true ? {
353
- uniqueWithLocations: UniqueWithLocations;
354
- } : {
355
- uniqueWithLocations?: undefined;
356
- }) & {
357
- ratio: number;
358
- };
359
- combinators: CollectionCount<T>;
360
- };
361
- declarations: {
362
- total: number;
363
- totalUnique: number;
364
- uniquenessRatio: number;
365
- importants: {
366
- total: number;
367
- ratio: number;
368
- inKeyframes: {
369
- total: number;
370
- ratio: number;
371
- };
372
- };
373
- complexity: {
374
- min: number;
375
- max: number;
376
- mean: number;
377
- mode: number;
378
- range: number;
379
- sum: number;
380
- };
381
- nesting: {
382
- min: number;
383
- max: number;
384
- mean: number;
385
- mode: number;
386
- range: number;
387
- sum: number;
388
- } & {
389
- items: number[];
390
- } & {
391
- total: number;
392
- totalUnique: number;
393
- unique: Record<string, number>;
394
- uniquenessRatio: number;
395
- } & (T extends true ? {
396
- uniqueWithLocations: UniqueWithLocations;
397
- } : {
398
- uniqueWithLocations?: undefined;
399
- });
400
- };
401
- properties: {
402
- total: number;
403
- totalUnique: number;
404
- unique: Record<string, number>;
405
- uniquenessRatio: number;
406
- } & (T extends true ? {
407
- uniqueWithLocations: UniqueWithLocations;
408
- } : {
409
- uniqueWithLocations?: undefined;
410
- }) & {
411
- prefixed: {
412
- total: number;
413
- totalUnique: number;
414
- unique: Record<string, number>;
415
- uniquenessRatio: number;
416
- } & (T extends true ? {
417
- uniqueWithLocations: UniqueWithLocations;
418
- } : {
419
- uniqueWithLocations?: undefined;
420
- }) & {
421
- ratio: number;
422
- };
423
- custom: {
424
- total: number;
425
- totalUnique: number;
426
- unique: Record<string, number>;
427
- uniquenessRatio: number;
428
- } & (T extends true ? {
429
- uniqueWithLocations: UniqueWithLocations;
430
- } : {
431
- uniqueWithLocations?: undefined;
432
- }) & {
433
- ratio: number;
434
- importants: {
435
- total: number;
436
- totalUnique: number;
437
- unique: Record<string, number>;
438
- uniquenessRatio: number;
439
- } & (T extends true ? {
440
- uniqueWithLocations: UniqueWithLocations;
441
- } : {
442
- uniqueWithLocations?: undefined;
443
- }) & {
444
- ratio: number;
445
- };
446
- };
447
- browserhacks: {
448
- total: number;
449
- totalUnique: number;
450
- unique: Record<string, number>;
451
- uniquenessRatio: number;
452
- } & (T extends true ? {
453
- uniqueWithLocations: UniqueWithLocations;
454
- } : {
455
- uniqueWithLocations?: undefined;
456
- }) & {
457
- ratio: number;
458
- };
459
- complexity: {
460
- min: number;
461
- max: number;
462
- mean: number;
463
- mode: number;
464
- range: number;
465
- sum: number;
466
- };
467
- };
468
- values: {
469
- colors: {
470
- total: number;
471
- totalUnique: number;
472
- unique: Record<string, number>;
473
- uniquenessRatio: number;
474
- } & (T extends true ? {
475
- uniqueWithLocations: UniqueWithLocations;
476
- } : {
477
- uniqueWithLocations?: undefined;
478
- }) & {
479
- itemsPerContext: {
480
- [k: string]: CollectionCount<T>;
481
- };
482
- } & {
483
- formats: CollectionCount<T>;
484
- };
485
- gradients: CollectionCount<T>;
486
- fontFamilies: CollectionCount<T>;
487
- fontSizes: CollectionCount<T>;
488
- lineHeights: CollectionCount<T>;
489
- zindexes: CollectionCount<T>;
490
- textShadows: CollectionCount<T>;
491
- boxShadows: CollectionCount<T>;
492
- borderRadiuses: {
493
- total: number;
494
- totalUnique: number;
495
- unique: Record<string, number>;
496
- uniquenessRatio: number;
497
- } & (T extends true ? {
498
- uniqueWithLocations: UniqueWithLocations;
499
- } : {
500
- uniqueWithLocations?: undefined;
501
- }) & {
502
- itemsPerContext: {
503
- [k: string]: CollectionCount<T>;
504
- };
505
- };
506
- animations: {
507
- durations: CollectionCount<T>;
508
- timingFunctions: CollectionCount<T>;
509
- };
510
- prefixes: CollectionCount<T>;
511
- browserhacks: CollectionCount<T>;
512
- units: {
513
- total: number;
514
- totalUnique: number;
515
- unique: Record<string, number>;
516
- uniquenessRatio: number;
517
- } & (T extends true ? {
518
- uniqueWithLocations: UniqueWithLocations;
519
- } : {
520
- uniqueWithLocations?: undefined;
521
- }) & {
522
- itemsPerContext: {
523
- [k: string]: CollectionCount<T>;
524
- };
525
- };
526
- complexity: {
527
- min: number;
528
- max: number;
529
- mean: number;
530
- mode: number;
531
- range: number;
532
- sum: number;
533
- };
534
- keywords: CollectionCount<T>;
535
- resets: CollectionCount<T>;
536
- displays: CollectionCount<T>;
537
- };
538
- __meta__: {
539
- parseTime: number;
540
- analyzeTime: number;
541
- total: number;
542
- };
543
- };
544
-
545
- export { calculateSpecificity }
546
-
547
- export { colorFunctions }
548
-
549
- export { colorKeywords }
550
-
551
- /**
552
- * Compare specificity A to Specificity B
553
- * @returns 0 when a==b, 1 when a<b, -1 when a>b
554
- */
555
- export declare function compareSpecificity(a: Specificity, b: Specificity): number;
556
-
557
- export { cssKeywords }
558
-
559
- export { hasVendorPrefix }
560
-
561
- export { isAccessibilitySelector }
562
-
563
- export { isMediaBrowserhack }
564
-
565
- export { isPropertyHack }
566
-
567
- export { isSelectorPrefixed }
568
-
569
- export { isSupportsBrowserhack }
570
-
571
- export { isValuePrefixed }
572
-
573
- export { KeywordSet }
574
-
575
- export { Location_2 as Location }
576
-
577
- export { namedColors }
578
-
579
- export declare type Options = {
580
- /** @description Use Locations (`{ 'item': [{ line, column, offset, length }] }`) instead of a regular count per occurrence (`{ 'item': 3 }`) */
581
- useLocations?: boolean;
582
- };
583
-
584
- export { selectorComplexity }
585
-
586
- export declare type Specificity = [number, number, number];
587
-
588
- export { systemColors }
589
-
590
- export { UniqueWithLocations }
591
-
592
- export { }
1
+ import { n as isSupportsBrowserhack, t as isMediaBrowserhack } from "./atrules-CvzPtm16.js";
2
+ import { a as calculate, c as CollectionCount, i as isPrefixed, l as Location, n as getComplexity, r as isAccessibility, u as UniqueWithLocations } from "./utils-BUeYqEL1.js";
3
+ import { a as namedColors, i as colorKeywords, n as keywords, o as systemColors, r as colorFunctions, s as KeywordSet } from "./values-Dw53soqy.js";
4
+ import { CSSNode } from "@projectwallace/css-parser";
5
+
6
+ //#region src/properties/property-utils.d.ts
7
+ /**
8
+ * @see https://github.com/csstree/csstree/blob/master/lib/utils/names.js#L69
9
+ */
10
+ declare function isHack(property: string): boolean;
11
+ //#endregion
12
+ //#region src/values/vendor-prefix.d.ts
13
+ declare function isValuePrefixed(node: CSSNode, on_value: (value: string) => void): void;
14
+ //#endregion
15
+ //#region src/vendor-prefix.d.ts
16
+ /** Kept for backwards compatibility */
17
+ declare function hasVendorPrefix(keyword: string): boolean;
18
+ //#endregion
19
+ //#region src/index.d.ts
20
+ type Specificity = [number, number, number];
21
+ type Options = {
22
+ /** @description Use Locations (`{ 'item': [{ line, column, offset, length }] }`) instead of a regular count per occurrence (`{ 'item': 3 }`) */useLocations?: boolean;
23
+ };
24
+ declare function analyze(css: string, options?: Options & {
25
+ useLocations?: false | undefined;
26
+ }): ReturnType<typeof analyzeInternal<false>>;
27
+ declare function analyze(css: string, options: Options & {
28
+ useLocations: true;
29
+ }): ReturnType<typeof analyzeInternal<true>>;
30
+ declare function analyzeInternal<T extends boolean>(css: string, options: Options, useLocations: T): {
31
+ stylesheet: {
32
+ sourceLinesOfCode: number;
33
+ linesOfCode: number;
34
+ size: number;
35
+ complexity: number;
36
+ comments: {
37
+ total: number;
38
+ size: number;
39
+ };
40
+ embeddedContent: {
41
+ size: {
42
+ total: number;
43
+ ratio: number;
44
+ };
45
+ types: {
46
+ total: number;
47
+ totalUnique: number;
48
+ uniquenessRatio: number;
49
+ unique: {
50
+ [k: string]: {
51
+ size: number;
52
+ count: number;
53
+ uniqueWithLocations?: Location[];
54
+ };
55
+ };
56
+ };
57
+ };
58
+ };
59
+ atrules: {
60
+ total: number;
61
+ totalUnique: number;
62
+ unique: Record<string, number>;
63
+ uniquenessRatio: number;
64
+ } & (T extends true ? {
65
+ uniqueWithLocations: UniqueWithLocations;
66
+ } : {
67
+ uniqueWithLocations?: undefined;
68
+ }) & {
69
+ fontface: {
70
+ total: number;
71
+ totalUnique: number;
72
+ unique: Record<string, string>[];
73
+ uniquenessRatio: number;
74
+ } & ({
75
+ uniqueWithLocations: UniqueWithLocations | undefined;
76
+ } | {
77
+ uniqueWithLocations?: undefined;
78
+ });
79
+ import: CollectionCount<T>;
80
+ media: {
81
+ total: number;
82
+ totalUnique: number;
83
+ unique: Record<string, number>;
84
+ uniquenessRatio: number;
85
+ } & (T extends true ? {
86
+ uniqueWithLocations: UniqueWithLocations;
87
+ } : {
88
+ uniqueWithLocations?: undefined;
89
+ }) & {
90
+ browserhacks: CollectionCount<T>;
91
+ features: CollectionCount<T>;
92
+ };
93
+ charset: CollectionCount<T>;
94
+ supports: {
95
+ total: number;
96
+ totalUnique: number;
97
+ unique: Record<string, number>;
98
+ uniquenessRatio: number;
99
+ } & (T extends true ? {
100
+ uniqueWithLocations: UniqueWithLocations;
101
+ } : {
102
+ uniqueWithLocations?: undefined;
103
+ }) & {
104
+ browserhacks: CollectionCount<T>;
105
+ };
106
+ keyframes: {
107
+ total: number;
108
+ totalUnique: number;
109
+ unique: Record<string, number>;
110
+ uniquenessRatio: number;
111
+ } & (T extends true ? {
112
+ uniqueWithLocations: UniqueWithLocations;
113
+ } : {
114
+ uniqueWithLocations?: undefined;
115
+ }) & {
116
+ prefixed: {
117
+ total: number;
118
+ totalUnique: number;
119
+ unique: Record<string, number>;
120
+ uniquenessRatio: number;
121
+ } & (T extends true ? {
122
+ uniqueWithLocations: UniqueWithLocations;
123
+ } : {
124
+ uniqueWithLocations?: undefined;
125
+ }) & {
126
+ ratio: number;
127
+ };
128
+ };
129
+ container: {
130
+ total: number;
131
+ totalUnique: number;
132
+ unique: Record<string, number>;
133
+ uniquenessRatio: number;
134
+ } & (T extends true ? {
135
+ uniqueWithLocations: UniqueWithLocations;
136
+ } : {
137
+ uniqueWithLocations?: undefined;
138
+ }) & {
139
+ names: CollectionCount<T>;
140
+ };
141
+ layer: CollectionCount<T>;
142
+ property: CollectionCount<T>;
143
+ function: CollectionCount<T>;
144
+ scope: CollectionCount<T>;
145
+ complexity: {
146
+ min: number;
147
+ max: number;
148
+ mean: number;
149
+ mode: number;
150
+ range: number;
151
+ sum: number;
152
+ };
153
+ nesting: {
154
+ min: number;
155
+ max: number;
156
+ mean: number;
157
+ mode: number;
158
+ range: number;
159
+ sum: number;
160
+ } & {
161
+ items: number[];
162
+ } & {
163
+ total: number;
164
+ totalUnique: number;
165
+ unique: Record<string, number>;
166
+ uniquenessRatio: number;
167
+ } & (T extends true ? {
168
+ uniqueWithLocations: UniqueWithLocations;
169
+ } : {
170
+ uniqueWithLocations?: undefined;
171
+ });
172
+ };
173
+ rules: {
174
+ total: number;
175
+ empty: {
176
+ total: number;
177
+ ratio: number;
178
+ };
179
+ sizes: {
180
+ min: number;
181
+ max: number;
182
+ mean: number;
183
+ mode: number;
184
+ range: number;
185
+ sum: number;
186
+ } & {
187
+ items: number[];
188
+ } & {
189
+ total: number;
190
+ totalUnique: number;
191
+ unique: Record<string, number>;
192
+ uniquenessRatio: number;
193
+ } & (T extends true ? {
194
+ uniqueWithLocations: UniqueWithLocations;
195
+ } : {
196
+ uniqueWithLocations?: undefined;
197
+ });
198
+ nesting: {
199
+ min: number;
200
+ max: number;
201
+ mean: number;
202
+ mode: number;
203
+ range: number;
204
+ sum: number;
205
+ } & {
206
+ items: number[];
207
+ } & {
208
+ total: number;
209
+ totalUnique: number;
210
+ unique: Record<string, number>;
211
+ uniquenessRatio: number;
212
+ } & (T extends true ? {
213
+ uniqueWithLocations: UniqueWithLocations;
214
+ } : {
215
+ uniqueWithLocations?: undefined;
216
+ });
217
+ selectors: {
218
+ min: number;
219
+ max: number;
220
+ mean: number;
221
+ mode: number;
222
+ range: number;
223
+ sum: number;
224
+ } & {
225
+ items: number[];
226
+ } & {
227
+ total: number;
228
+ totalUnique: number;
229
+ unique: Record<string, number>;
230
+ uniquenessRatio: number;
231
+ } & (T extends true ? {
232
+ uniqueWithLocations: UniqueWithLocations;
233
+ } : {
234
+ uniqueWithLocations?: undefined;
235
+ });
236
+ declarations: {
237
+ min: number;
238
+ max: number;
239
+ mean: number;
240
+ mode: number;
241
+ range: number;
242
+ sum: number;
243
+ } & {
244
+ items: number[];
245
+ } & {
246
+ total: number;
247
+ totalUnique: number;
248
+ unique: Record<string, number>;
249
+ uniquenessRatio: number;
250
+ } & (T extends true ? {
251
+ uniqueWithLocations: UniqueWithLocations;
252
+ } : {
253
+ uniqueWithLocations?: undefined;
254
+ });
255
+ };
256
+ selectors: {
257
+ total: number;
258
+ totalUnique: number;
259
+ uniquenessRatio: number;
260
+ specificity: {
261
+ /** @type Specificity */min: number[]; /** @type Specificity */
262
+ max: number[]; /** @type Specificity */
263
+ sum: number[]; /** @type Specificity */
264
+ mean: number[]; /** @type Specificity */
265
+ mode: number[]; /** @type Specificity */
266
+ items: Specificity[];
267
+ } & {
268
+ total: number;
269
+ totalUnique: number;
270
+ unique: Record<string, number>;
271
+ uniquenessRatio: number;
272
+ } & (T extends true ? {
273
+ uniqueWithLocations: UniqueWithLocations;
274
+ } : {
275
+ uniqueWithLocations?: undefined;
276
+ });
277
+ complexity: {
278
+ min: number;
279
+ max: number;
280
+ mean: number;
281
+ mode: number;
282
+ range: number;
283
+ sum: number;
284
+ } & {
285
+ total: number;
286
+ totalUnique: number;
287
+ unique: Record<string, number>;
288
+ uniquenessRatio: number;
289
+ } & (T extends true ? {
290
+ uniqueWithLocations: UniqueWithLocations;
291
+ } : {
292
+ uniqueWithLocations?: undefined;
293
+ }) & {
294
+ items: number[];
295
+ };
296
+ nesting: {
297
+ min: number;
298
+ max: number;
299
+ mean: number;
300
+ mode: number;
301
+ range: number;
302
+ sum: number;
303
+ } & {
304
+ items: number[];
305
+ } & {
306
+ total: number;
307
+ totalUnique: number;
308
+ unique: Record<string, number>;
309
+ uniquenessRatio: number;
310
+ } & (T extends true ? {
311
+ uniqueWithLocations: UniqueWithLocations;
312
+ } : {
313
+ uniqueWithLocations?: undefined;
314
+ });
315
+ id: {
316
+ total: number;
317
+ totalUnique: number;
318
+ unique: Record<string, number>;
319
+ uniquenessRatio: number;
320
+ } & (T extends true ? {
321
+ uniqueWithLocations: UniqueWithLocations;
322
+ } : {
323
+ uniqueWithLocations?: undefined;
324
+ }) & {
325
+ ratio: number;
326
+ };
327
+ pseudoClasses: CollectionCount<T>;
328
+ pseudoElements: CollectionCount<T>;
329
+ accessibility: {
330
+ total: number;
331
+ totalUnique: number;
332
+ unique: Record<string, number>;
333
+ uniquenessRatio: number;
334
+ } & (T extends true ? {
335
+ uniqueWithLocations: UniqueWithLocations;
336
+ } : {
337
+ uniqueWithLocations?: undefined;
338
+ }) & {
339
+ ratio: number;
340
+ };
341
+ attributes: CollectionCount<T>;
342
+ customElements: CollectionCount<T>;
343
+ keyframes: CollectionCount<T>;
344
+ prefixed: {
345
+ total: number;
346
+ totalUnique: number;
347
+ unique: Record<string, number>;
348
+ uniquenessRatio: number;
349
+ } & (T extends true ? {
350
+ uniqueWithLocations: UniqueWithLocations;
351
+ } : {
352
+ uniqueWithLocations?: undefined;
353
+ }) & {
354
+ ratio: number;
355
+ };
356
+ combinators: CollectionCount<T>;
357
+ };
358
+ declarations: {
359
+ total: number;
360
+ totalUnique: number;
361
+ uniquenessRatio: number;
362
+ importants: {
363
+ total: number;
364
+ ratio: number;
365
+ inKeyframes: {
366
+ total: number;
367
+ ratio: number;
368
+ };
369
+ };
370
+ complexity: {
371
+ min: number;
372
+ max: number;
373
+ mean: number;
374
+ mode: number;
375
+ range: number;
376
+ sum: number;
377
+ };
378
+ nesting: {
379
+ min: number;
380
+ max: number;
381
+ mean: number;
382
+ mode: number;
383
+ range: number;
384
+ sum: number;
385
+ } & {
386
+ items: number[];
387
+ } & {
388
+ total: number;
389
+ totalUnique: number;
390
+ unique: Record<string, number>;
391
+ uniquenessRatio: number;
392
+ } & (T extends true ? {
393
+ uniqueWithLocations: UniqueWithLocations;
394
+ } : {
395
+ uniqueWithLocations?: undefined;
396
+ });
397
+ };
398
+ properties: {
399
+ total: number;
400
+ totalUnique: number;
401
+ unique: Record<string, number>;
402
+ uniquenessRatio: number;
403
+ } & (T extends true ? {
404
+ uniqueWithLocations: UniqueWithLocations;
405
+ } : {
406
+ uniqueWithLocations?: undefined;
407
+ }) & {
408
+ prefixed: {
409
+ total: number;
410
+ totalUnique: number;
411
+ unique: Record<string, number>;
412
+ uniquenessRatio: number;
413
+ } & (T extends true ? {
414
+ uniqueWithLocations: UniqueWithLocations;
415
+ } : {
416
+ uniqueWithLocations?: undefined;
417
+ }) & {
418
+ ratio: number;
419
+ };
420
+ custom: {
421
+ total: number;
422
+ totalUnique: number;
423
+ unique: Record<string, number>;
424
+ uniquenessRatio: number;
425
+ } & (T extends true ? {
426
+ uniqueWithLocations: UniqueWithLocations;
427
+ } : {
428
+ uniqueWithLocations?: undefined;
429
+ }) & {
430
+ ratio: number;
431
+ importants: {
432
+ total: number;
433
+ totalUnique: number;
434
+ unique: Record<string, number>;
435
+ uniquenessRatio: number;
436
+ } & (T extends true ? {
437
+ uniqueWithLocations: UniqueWithLocations;
438
+ } : {
439
+ uniqueWithLocations?: undefined;
440
+ }) & {
441
+ ratio: number;
442
+ };
443
+ };
444
+ browserhacks: {
445
+ total: number;
446
+ totalUnique: number;
447
+ unique: Record<string, number>;
448
+ uniquenessRatio: number;
449
+ } & (T extends true ? {
450
+ uniqueWithLocations: UniqueWithLocations;
451
+ } : {
452
+ uniqueWithLocations?: undefined;
453
+ }) & {
454
+ ratio: number;
455
+ };
456
+ complexity: {
457
+ min: number;
458
+ max: number;
459
+ mean: number;
460
+ mode: number;
461
+ range: number;
462
+ sum: number;
463
+ };
464
+ };
465
+ values: {
466
+ colors: {
467
+ total: number;
468
+ totalUnique: number;
469
+ unique: Record<string, number>;
470
+ uniquenessRatio: number;
471
+ } & (T extends true ? {
472
+ uniqueWithLocations: UniqueWithLocations;
473
+ } : {
474
+ uniqueWithLocations?: undefined;
475
+ }) & {
476
+ itemsPerContext: {
477
+ [k: string]: CollectionCount<T>;
478
+ };
479
+ } & {
480
+ formats: CollectionCount<T>;
481
+ };
482
+ gradients: CollectionCount<T>;
483
+ fontFamilies: CollectionCount<T>;
484
+ fontSizes: CollectionCount<T>;
485
+ lineHeights: CollectionCount<T>;
486
+ zindexes: CollectionCount<T>;
487
+ textShadows: CollectionCount<T>;
488
+ boxShadows: CollectionCount<T>;
489
+ borderRadiuses: {
490
+ total: number;
491
+ totalUnique: number;
492
+ unique: Record<string, number>;
493
+ uniquenessRatio: number;
494
+ } & (T extends true ? {
495
+ uniqueWithLocations: UniqueWithLocations;
496
+ } : {
497
+ uniqueWithLocations?: undefined;
498
+ }) & {
499
+ itemsPerContext: {
500
+ [k: string]: CollectionCount<T>;
501
+ };
502
+ };
503
+ animations: {
504
+ durations: CollectionCount<T>;
505
+ timingFunctions: CollectionCount<T>;
506
+ };
507
+ prefixes: CollectionCount<T>;
508
+ browserhacks: CollectionCount<T>;
509
+ units: {
510
+ total: number;
511
+ totalUnique: number;
512
+ unique: Record<string, number>;
513
+ uniquenessRatio: number;
514
+ } & (T extends true ? {
515
+ uniqueWithLocations: UniqueWithLocations;
516
+ } : {
517
+ uniqueWithLocations?: undefined;
518
+ }) & {
519
+ itemsPerContext: {
520
+ [k: string]: CollectionCount<T>;
521
+ };
522
+ };
523
+ complexity: {
524
+ min: number;
525
+ max: number;
526
+ mean: number;
527
+ mode: number;
528
+ range: number;
529
+ sum: number;
530
+ };
531
+ keywords: CollectionCount<T>;
532
+ resets: CollectionCount<T>;
533
+ displays: CollectionCount<T>;
534
+ };
535
+ __meta__: {
536
+ parseTime: number;
537
+ analyzeTime: number;
538
+ total: number;
539
+ };
540
+ };
541
+ /**
542
+ * Compare specificity A to Specificity B
543
+ * @deprecated this one is the inverse of the one exported in /selectors/index.ts; wille be removed in next major version
544
+ * @returns 0 when a==b, 1 when a<b, -1 when a>b
545
+ */
546
+ declare function compareSpecificity(a: Specificity, b: Specificity): number;
547
+ //#endregion
548
+ export { KeywordSet, type Location, Options, Specificity, type UniqueWithLocations, analyze, calculate as calculateSpecificity, colorFunctions, colorKeywords, compareSpecificity, keywords as cssKeywords, hasVendorPrefix, isAccessibility as isAccessibilitySelector, isMediaBrowserhack, isHack as isPropertyHack, isPrefixed as isSelectorPrefixed, isSupportsBrowserhack, isValuePrefixed, namedColors, getComplexity as selectorComplexity, systemColors };