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