@tbela99/css-parser 0.1.0 → 0.3.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.
Files changed (40) hide show
  1. package/README.md +267 -2
  2. package/dist/config.json.js +611 -4
  3. package/dist/index-umd-web.js +2898 -1223
  4. package/dist/index.cjs +2898 -1223
  5. package/dist/lib/ast/expand.js +11 -11
  6. package/dist/lib/ast/features/calc.js +33 -224
  7. package/dist/lib/ast/features/index.js +3 -3
  8. package/dist/lib/ast/features/inlinecssvariables.js +46 -31
  9. package/dist/lib/ast/features/shorthand.js +7 -7
  10. package/dist/lib/ast/features/utils/math.js +95 -0
  11. package/dist/lib/ast/math/expression.js +185 -0
  12. package/dist/lib/ast/math/math.js +95 -0
  13. package/dist/lib/ast/minify.js +34 -29
  14. package/dist/lib/ast/types.js +108 -78
  15. package/dist/lib/ast/walk.js +42 -9
  16. package/dist/lib/fs/resolve.js +4 -3
  17. package/dist/lib/iterable/set.js +48 -0
  18. package/dist/lib/iterable/weakmap.js +53 -0
  19. package/dist/lib/iterable/weakset.js +48 -0
  20. package/dist/lib/parser/declaration/list.js +7 -3
  21. package/dist/lib/parser/declaration/map.js +86 -7
  22. package/dist/lib/parser/declaration/set.js +43 -23
  23. package/dist/lib/parser/parse.js +561 -387
  24. package/dist/lib/parser/tokenize.js +42 -13
  25. package/dist/lib/parser/utils/declaration.js +67 -0
  26. package/dist/lib/parser/utils/syntax.js +32 -2
  27. package/dist/lib/parser/utils/type.js +7 -2
  28. package/dist/lib/renderer/render.js +163 -47
  29. package/dist/lib/renderer/utils/calccolor.js +238 -0
  30. package/dist/lib/renderer/utils/color.js +36 -164
  31. package/dist/lib/renderer/utils/hex.js +124 -0
  32. package/dist/lib/renderer/utils/hsl.js +49 -0
  33. package/dist/lib/renderer/utils/hsv.js +15 -0
  34. package/dist/lib/renderer/utils/hwb.js +50 -0
  35. package/dist/lib/renderer/utils/rgb.js +66 -0
  36. package/dist/node/index.js +8 -12
  37. package/dist/web/index.js +8 -12
  38. package/package.json +9 -7
  39. package/dist/index.d.ts +0 -1056
  40. /package/dist/lib/ast/{utiles → utils}/minifyfeature.js +0 -0
package/dist/index.d.ts DELETED
@@ -1,1056 +0,0 @@
1
- declare const enum NodeType {
2
- CommentNodeType = 0,
3
- CDOCOMMNodeType = 1,
4
- StyleSheetNodeType = 2,
5
- AtRuleNodeType = 3,
6
- RuleNodeType = 4,
7
- DeclarationNodeType = 5
8
- }
9
- declare enum EnumToken$1 {
10
- CommentTokenType = 0,
11
- CDOCOMMTokenType = 1,
12
- LiteralTokenType = 2,
13
- IdenTokenType = 3,
14
- CommaTokenType = 4,
15
- ColonTokenType = 5,
16
- SemiColonTokenType = 6,
17
- NumberTokenType = 7,
18
- AtRuleTokenType = 8,
19
- PercentageTokenType = 9,
20
- FunctionTokenType = 10,
21
- UrlFunctionTokenType = 11,
22
- StringTokenType = 12,
23
- UnclosedStringTokenType = 13,
24
- DimensionTokenType = 14,
25
- LengthTokenType = 15,
26
- AngleTokenType = 16,
27
- TimeTokenType = 17,
28
- FrequencyTokenType = 18,
29
- ResolutionTokenType = 19,
30
- HashTokenType = 20,
31
- BlockStartTokenType = 21,
32
- BlockEndTokenType = 22,
33
- AttrStartTokenType = 23,
34
- AttrEndTokenType = 24,
35
- StartParensTokenType = 25,
36
- EndParensTokenType = 26,
37
- ParensTokenType = 27,
38
- WhitespaceTokenType = 28,
39
- IncludesTokenType = 29,
40
- DashMatchTokenType = 30,
41
- LtTokenType = 31,
42
- LteTokenType = 32,
43
- GtTokenType = 33,
44
- GteTokenType = 34,
45
- PseudoClassTokenType = 35,
46
- PseudoClassFuncTokenType = 36,
47
- DelimTokenType = 37,
48
- UrlTokenTokenType = 38,
49
- EOFTokenType = 39,
50
- ImportantTokenType = 40,
51
- ColorTokenType = 41,
52
- AttrTokenType = 42,
53
- BadCommentTokenType = 43,
54
- BadCdoTokenType = 44,
55
- BadUrlTokenType = 45,
56
- BadStringTokenType = 46,
57
- BinaryExpressionTokenType = 47,
58
- UnaryExpressionTokenType = 48,
59
- ListToken = 49,
60
- Add = 50,
61
- Mul = 51,
62
- Div = 52,
63
- Sub = 53,
64
- Time = 17,
65
- Iden = 3,
66
- Hash = 20,
67
- Angle = 16,
68
- Color = 41,
69
- Comma = 4,
70
- String = 12,
71
- Length = 15,
72
- Number = 7,
73
- Perc = 9,
74
- Literal = 2,
75
- Comment = 0,
76
- UrlFunc = 11,
77
- Dimension = 14,
78
- Frequency = 18,
79
- Resolution = 19,
80
- Whitespace = 28
81
- }
82
-
83
- declare const combinators: string[];
84
- declare function minify(ast: AstNode, options?: ParserOptions | MinifyOptions, recursive?: boolean, errors?: ErrorDescription[], nestingContent?: boolean, context?: {
85
- [key: string]: any;
86
- }): AstNode;
87
- declare function reduceSelector(selector: string[][]): {
88
- match: boolean;
89
- optimized: string[];
90
- selector: string[][];
91
- reducible: boolean;
92
- } | null;
93
- declare function hasDeclaration(node: AstRule): boolean;
94
- declare function splitRule(buffer: string): string[][];
95
-
96
- declare function walk(node: AstNode): Generator<WalkResult>;
97
- declare function walkValues(values: Token[]): Generator<WalkAttributesResult>;
98
-
99
- declare function expand(ast: AstNode): AstNode;
100
- declare function replaceCompound(input: string, replace: string): string;
101
-
102
- declare const colorsFunc: string[];
103
- declare function reduceNumber(val: string | number): string;
104
- declare function doRender(data: AstNode, options?: RenderOptions): RenderResult;
105
- declare function renderToken(token: Token, options?: RenderOptions, cache?: {
106
- [key: string]: any;
107
- }, reducer?: (acc: string, curr: Token) => string, errors?: ErrorDescription[]): string;
108
-
109
- declare const urlTokenMatcher: RegExp;
110
- declare function doParse(iterator: string, options?: ParserOptions): Promise<ParseResult>;
111
- declare function parseString(src: string, options?: {
112
- location: boolean;
113
- }): Token[];
114
- declare function parseTokens(tokens: Token[], options?: ParseTokenOptions): Token[];
115
-
116
- declare function tokenize(stream: string): Generator<TokenizeResult>;
117
-
118
- declare function isLength(dimension: DimensionToken): boolean;
119
- declare function isResolution(dimension: DimensionToken): boolean;
120
- declare function isAngle(dimension: DimensionToken): boolean;
121
- declare function isTime(dimension: DimensionToken): boolean;
122
- declare function isFrequency(dimension: DimensionToken): boolean;
123
- declare function isColor(token: Token): boolean;
124
- declare function isIdentStart(codepoint: number): boolean;
125
- declare function isDigit(codepoint: number): boolean;
126
- declare function isIdentCodepoint(codepoint: number): boolean;
127
- declare function isIdent(name: string): boolean;
128
- declare function isNonPrintable(codepoint: number): boolean;
129
- declare function isPseudo(name: string): boolean;
130
- declare function isHash(name: string): boolean;
131
- declare function isNumber(name: string): boolean;
132
- declare function isDimension(name: string): boolean;
133
- declare function isPercentage(name: string): boolean;
134
- declare function parseDimension(name: string): DimensionToken | LengthToken | AngleToken;
135
- declare function isHexColor(name: string): boolean;
136
- declare function isFunction(name: string): boolean;
137
- declare function isAtKeyword(name: string): boolean;
138
- declare function isNewLine(codepoint: number): boolean;
139
- declare function isWhiteSpace(codepoint: number): boolean;
140
-
141
- declare const getConfig: () => PropertiesConfig;
142
-
143
- declare const funcList: string[];
144
- declare function matchType(val: Token, properties: PropertyMapType): boolean;
145
-
146
- interface BaseToken {
147
-
148
- typ: EnumToken$1;
149
- loc?: Location;
150
- }
151
-
152
- interface LiteralToken extends BaseToken {
153
-
154
- typ: EnumToken$1.LiteralTokenType;
155
- val: string;
156
- }
157
-
158
- interface IdentToken extends BaseToken {
159
-
160
- typ: EnumToken$1.IdenTokenType,
161
- val: string;
162
- }
163
-
164
- interface CommaToken extends BaseToken {
165
-
166
- typ: EnumToken$1.CommaTokenType
167
- }
168
-
169
- interface ColonToken extends BaseToken {
170
-
171
- typ: EnumToken$1.ColonTokenType
172
- }
173
-
174
- interface SemiColonToken extends BaseToken {
175
-
176
- typ: EnumToken$1.SemiColonTokenType
177
- }
178
-
179
- interface NumberToken extends BaseToken {
180
-
181
- typ: EnumToken$1.NumberTokenType,
182
- val: string;
183
- }
184
-
185
- interface AtRuleToken extends BaseToken {
186
-
187
- typ: EnumToken$1.AtRuleTokenType,
188
- val: string;
189
- }
190
-
191
- interface PercentageToken extends BaseToken {
192
-
193
- typ: EnumToken$1.PercentageTokenType,
194
- val: string;
195
- }
196
-
197
- interface FunctionToken extends BaseToken {
198
-
199
- typ: EnumToken$1.FunctionTokenType,
200
- val: string;
201
- chi: Token[];
202
- }
203
-
204
- interface FunctionURLToken extends BaseToken {
205
-
206
- typ: EnumToken$1.UrlFunctionTokenType,
207
- val: 'url';
208
- chi: Array<UrlToken | CommentToken>;
209
- }
210
-
211
- interface StringToken extends BaseToken {
212
-
213
- typ: EnumToken$1.StringTokenType;
214
- val: string;
215
- }
216
-
217
- interface BadStringToken extends BaseToken {
218
-
219
- typ: EnumToken$1.BadStringTokenType;
220
- val: string;
221
- }
222
-
223
- interface UnclosedStringToken extends BaseToken {
224
-
225
- typ: EnumToken$1.UnclosedStringTokenType;
226
- val: string;
227
- }
228
-
229
- interface DimensionToken extends BaseToken {
230
-
231
- typ: EnumToken$1.DimensionTokenType;
232
- val: string | BinaryExpressionToken;
233
- unit: string;
234
- }
235
-
236
- interface LengthToken extends BaseToken {
237
-
238
- typ: EnumToken$1.LengthTokenType;
239
- val: string | BinaryExpressionToken;
240
- unit: string;
241
- }
242
-
243
- interface AngleToken extends BaseToken {
244
-
245
- typ: EnumToken$1.AngleTokenType;
246
- val: string | BinaryExpressionToken;
247
- unit: string;
248
- }
249
-
250
- interface TimeToken extends BaseToken {
251
-
252
- typ: EnumToken$1.TimeTokenType;
253
- val: string | BinaryExpressionToken;
254
- unit: 'ms' | 's';
255
- }
256
-
257
- interface FrequencyToken extends BaseToken {
258
-
259
- typ: EnumToken$1.FrequencyTokenType;
260
- val: string | BinaryExpressionToken;
261
- unit: 'Hz' | 'Khz';
262
- }
263
-
264
- interface ResolutionToken extends BaseToken {
265
-
266
- typ: EnumToken$1.ResolutionTokenType;
267
- val: string | BinaryExpressionToken;
268
- unit: 'dpi' | 'dpcm' | 'dppx' | 'x';
269
- }
270
-
271
- interface HashToken extends BaseToken {
272
-
273
- typ: EnumToken$1.HashTokenType;
274
- val: string;
275
- }
276
-
277
- interface BlockStartToken extends BaseToken {
278
-
279
- typ: EnumToken$1.BlockStartTokenType
280
- }
281
-
282
- interface BlockEndToken extends BaseToken {
283
-
284
- typ: EnumToken$1.BlockEndTokenType
285
- }
286
-
287
- interface AttrStartToken extends BaseToken {
288
-
289
- typ: EnumToken$1.AttrStartTokenType;
290
- chi?: Token[];
291
- }
292
-
293
- interface AttrEndToken extends BaseToken {
294
-
295
- typ: EnumToken$1.AttrEndTokenType
296
- }
297
-
298
- interface ParensStartToken extends BaseToken {
299
-
300
- typ: EnumToken$1.StartParensTokenType;
301
- }
302
-
303
- interface ParensEndToken extends BaseToken {
304
-
305
- typ: EnumToken$1.EndParensTokenType
306
- }
307
-
308
- interface ParensToken extends BaseToken {
309
-
310
- typ: EnumToken$1.ParensTokenType;
311
- chi: Token[];
312
- }
313
-
314
- interface WhitespaceToken extends BaseToken {
315
-
316
- typ: EnumToken$1.WhitespaceTokenType
317
- }
318
-
319
- interface CommentToken extends BaseToken {
320
-
321
- typ: EnumToken$1.CommentTokenType;
322
- val: string;
323
- }
324
-
325
- interface BadCommentToken extends BaseToken {
326
-
327
- typ: EnumToken$1.BadCommentTokenType;
328
- val: string;
329
- }
330
-
331
- interface CDOCommentToken extends BaseToken {
332
-
333
- typ: EnumToken$1.CDOCOMMTokenType;
334
- val: string;
335
- }
336
-
337
- interface BadCDOCommentToken extends BaseToken {
338
-
339
- typ: EnumToken$1.BadCdoTokenType;
340
- val: string;
341
- }
342
-
343
- interface IncludesToken extends BaseToken {
344
-
345
- typ: EnumToken$1.IncludesTokenType;
346
- val: '~=';
347
- }
348
-
349
- interface DashMatchToken extends BaseToken {
350
-
351
- typ: EnumToken$1.DashMatchTokenType;
352
- val: '|=';
353
- }
354
-
355
- interface LessThanToken extends BaseToken {
356
-
357
- typ: EnumToken$1.LtTokenType;
358
- }
359
-
360
- interface LessThanOrEqualToken extends BaseToken {
361
-
362
- typ: EnumToken$1.LteTokenType;
363
- }
364
-
365
- interface GreaterThanToken extends BaseToken {
366
-
367
- typ: EnumToken$1.GtTokenType;
368
- }
369
-
370
- interface GreaterThanOrEqualToken extends BaseToken {
371
-
372
- typ: EnumToken$1.GteTokenType;
373
- }
374
-
375
- interface PseudoClassToken extends BaseToken {
376
-
377
- typ: EnumToken$1.PseudoClassTokenType;
378
- val: string;
379
- }
380
-
381
- interface PseudoClassFunctionToken extends BaseToken {
382
-
383
- typ: EnumToken$1.PseudoClassFuncTokenType;
384
- val: string;
385
- chi: Token[];
386
- }
387
-
388
- interface DelimToken extends BaseToken {
389
-
390
- typ: EnumToken$1.DelimTokenType;
391
- val: '=';
392
- }
393
-
394
- interface BadUrlToken extends BaseToken {
395
-
396
- typ: EnumToken$1.BadUrlTokenType,
397
- val: string;
398
- }
399
-
400
- interface UrlToken extends BaseToken {
401
-
402
- typ: EnumToken$1.UrlTokenTokenType,
403
- val: string;
404
- }
405
-
406
- interface EOFToken extends BaseToken {
407
-
408
- typ: EnumToken$1.EOFTokenType;
409
- }
410
-
411
- interface ImportantToken extends BaseToken {
412
-
413
- typ: EnumToken$1.ImportantTokenType;
414
- }
415
-
416
- interface ColorToken extends BaseToken {
417
-
418
- typ: EnumToken$1.ColorTokenType;
419
- val: string;
420
- kin: 'lit' | 'hex' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hwb' | 'device-cmyk';
421
- chi?: Token[];
422
- }
423
-
424
- interface AttrToken extends BaseToken {
425
-
426
- typ: EnumToken$1.AttrTokenType,
427
- chi: Token[]
428
- }
429
-
430
- interface AddToken extends BaseToken {
431
-
432
- typ: EnumToken$1.Add;
433
- }
434
-
435
- interface SubToken extends BaseToken {
436
-
437
- typ: EnumToken$1.Sub;
438
- }
439
-
440
- interface DivToken extends BaseToken {
441
-
442
- typ: EnumToken$1.Div;
443
- }
444
-
445
- interface MulToken extends BaseToken {
446
-
447
- typ: EnumToken$1.Mul;
448
- }
449
-
450
- interface UnaryExpression extends BaseToken {
451
-
452
- typ: EnumToken$1.UnaryExpressionTokenType
453
- sign: EnumToken$1.Add | EnumToken$1.Sub ;
454
- val: UnaryExpressionNode;
455
- }
456
-
457
- interface BinaryExpressionToken extends BaseToken {
458
-
459
- typ: EnumToken$1.BinaryExpressionTokenType
460
- op: EnumToken$1.Add | EnumToken$1.Sub | EnumToken$1.Div | EnumToken$1.Mul;
461
- l: BinaryExpressionNode;
462
- r: BinaryExpressionNode;
463
- }
464
-
465
- interface ListToken extends BaseToken {
466
-
467
- typ: EnumToken$1.ListToken
468
- chi: Token[];
469
- }
470
-
471
- declare type UnaryExpressionNode = BinaryExpressionNode | NumberToken | DimensionToken | TimeToken | LengthToken | AngleToken | FrequencyToken;
472
-
473
- declare type BinaryExpressionNode = NumberToken | DimensionToken | PercentageToken |
474
- AngleToken | LengthToken | FrequencyToken | BinaryExpressionToken | FunctionToken | ParensToken;
475
- declare type Token = LiteralToken | IdentToken | CommaToken | ColonToken | SemiColonToken |
476
- NumberToken | AtRuleToken | PercentageToken | FunctionURLToken | FunctionToken | DimensionToken | LengthToken |
477
- AngleToken | StringToken | TimeToken | FrequencyToken | ResolutionToken |
478
- UnclosedStringToken | HashToken | BadStringToken | BlockStartToken | BlockEndToken |
479
- AttrStartToken | AttrEndToken | ParensStartToken | ParensEndToken | ParensToken | CDOCommentToken |
480
- BadCDOCommentToken | CommentToken | BadCommentToken | WhitespaceToken | IncludesToken |
481
- DashMatchToken | LessThanToken | LessThanOrEqualToken | GreaterThanToken | GreaterThanOrEqualToken |
482
- ListToken | PseudoClassToken | PseudoClassFunctionToken | DelimToken | BinaryExpressionToken | UnaryExpression |
483
- AddToken | SubToken | DivToken | MulToken |
484
- BadUrlToken | UrlToken | ImportantToken | ColorToken | AttrToken | EOFToken;
485
-
486
- interface PropertyMapType {
487
-
488
- default: string[];
489
- types: string[];
490
- keywords: string[];
491
- required?: boolean;
492
- multiple?: boolean;
493
- prefix?: {
494
- typ: 'Literal',
495
- val: string
496
- };
497
- previous?: string;
498
- separator?: {
499
-
500
- typ: 'Comma'
501
- };
502
- constraints?: {
503
- [key: string]: {
504
- [key: string]: any;
505
- }
506
- };
507
- mapping?: {
508
- [key: string]: any
509
- }
510
- }
511
-
512
- // generated from config.json at https://app.quicktype.io/?l=ts
513
-
514
- interface PropertiesConfig {
515
- properties: PropertiesConfigProperties;
516
- map: Map;
517
- }
518
-
519
- interface Map {
520
- border: Border;
521
- "border-color": BackgroundPositionClass;
522
- "border-style": BackgroundPositionClass;
523
- "border-width": BackgroundPositionClass;
524
- outline: Outline;
525
- "outline-color": BackgroundPositionClass;
526
- "outline-style": BackgroundPositionClass;
527
- "outline-width": BackgroundPositionClass;
528
- font: Font;
529
- "font-weight": BackgroundPositionClass;
530
- "font-style": BackgroundPositionClass;
531
- "font-size": BackgroundPositionClass;
532
- "line-height": BackgroundPositionClass;
533
- "font-stretch": BackgroundPositionClass;
534
- "font-variant": BackgroundPositionClass;
535
- "font-family": BackgroundPositionClass;
536
- background: Background;
537
- "background-repeat": BackgroundPositionClass;
538
- "background-color": BackgroundPositionClass;
539
- "background-image": BackgroundPositionClass;
540
- "background-attachment": BackgroundPositionClass;
541
- "background-clip": BackgroundPositionClass;
542
- "background-origin": BackgroundPositionClass;
543
- "background-position": BackgroundPositionClass;
544
- "background-size": BackgroundPositionClass;
545
- }
546
-
547
- interface Background {
548
- shorthand: string;
549
- pattern: string;
550
- keywords: string[];
551
- default: any[];
552
- multiple: boolean;
553
- separator: Separator;
554
- properties: BackgroundProperties;
555
- }
556
-
557
- interface BackgroundProperties {
558
- "background-repeat": BackgroundRepeat;
559
- "background-color": PurpleBackgroundAttachment;
560
- "background-image": PurpleBackgroundAttachment;
561
- "background-attachment": PurpleBackgroundAttachment;
562
- "background-clip": PurpleBackgroundAttachment;
563
- "background-origin": PurpleBackgroundAttachment;
564
- "background-position": BackgroundPosition;
565
- "background-size": BackgroundSize;
566
- }
567
-
568
- interface PurpleBackgroundAttachment {
569
- types: string[];
570
- default: string[];
571
- keywords: string[];
572
- required?: boolean;
573
- mapping?: BackgroundAttachmentMapping;
574
- }
575
-
576
- interface BackgroundAttachmentMapping {
577
- "ultra-condensed": string;
578
- "extra-condensed": string;
579
- condensed: string;
580
- "semi-condensed": string;
581
- normal: string;
582
- "semi-expanded": string;
583
- expanded: string;
584
- "extra-expanded": string;
585
- "ultra-expanded": string;
586
- }
587
-
588
- interface BackgroundPosition {
589
- multiple: boolean;
590
- types: string[];
591
- default: string[];
592
- keywords: string[];
593
- mapping: BackgroundPositionMapping;
594
- constraints: BackgroundPositionConstraints;
595
- }
596
-
597
- interface BackgroundPositionConstraints {
598
- mapping: ConstraintsMapping;
599
- }
600
-
601
- interface ConstraintsMapping {
602
- max: number;
603
- }
604
-
605
- interface BackgroundPositionMapping {
606
- left: string;
607
- top: string;
608
- center: string;
609
- bottom: string;
610
- right: string;
611
- }
612
-
613
- interface BackgroundRepeat {
614
- types: any[];
615
- default: string[];
616
- multiple: boolean;
617
- keywords: string[];
618
- mapping: BackgroundRepeatMapping;
619
- }
620
-
621
- interface BackgroundRepeatMapping {
622
- "repeat no-repeat": string;
623
- "no-repeat repeat": string;
624
- "repeat repeat": string;
625
- "space space": string;
626
- "round round": string;
627
- "no-repeat no-repeat": string;
628
- }
629
-
630
- interface BackgroundSize {
631
- multiple: boolean;
632
- previous: string;
633
- prefix: Prefix;
634
- types: string[];
635
- default: string[];
636
- keywords: string[];
637
- mapping: BackgroundSizeMapping;
638
- }
639
-
640
- interface BackgroundSizeMapping {
641
- "auto auto": string;
642
- }
643
-
644
- interface Prefix {
645
- typ: string;
646
- val: string;
647
- }
648
-
649
- interface Separator {
650
- typ: string;
651
- }
652
-
653
- interface BackgroundPositionClass {
654
- shorthand: string;
655
- }
656
-
657
- interface Border {
658
- shorthand: string;
659
- pattern: string;
660
- keywords: string[];
661
- default: string[];
662
- properties: BorderProperties;
663
- }
664
-
665
- interface BorderProperties {
666
- "border-color": BorderColorClass;
667
- "border-style": BorderColorClass;
668
- "border-width": BorderColorClass;
669
- }
670
-
671
- interface BorderColorClass {
672
- }
673
-
674
- interface Font {
675
- shorthand: string;
676
- pattern: string;
677
- keywords: string[];
678
- default: any[];
679
- properties: FontProperties;
680
- }
681
-
682
- interface FontProperties {
683
- "font-weight": FontWeight;
684
- "font-style": PurpleBackgroundAttachment;
685
- "font-size": PurpleBackgroundAttachment;
686
- "line-height": LineHeight;
687
- "font-stretch": PurpleBackgroundAttachment;
688
- "font-variant": PurpleBackgroundAttachment;
689
- "font-family": FontFamily;
690
- }
691
-
692
- interface FontFamily {
693
- types: string[];
694
- default: any[];
695
- keywords: string[];
696
- required: boolean;
697
- multiple: boolean;
698
- separator: Separator;
699
- }
700
-
701
- interface FontWeight {
702
- types: string[];
703
- default: string[];
704
- keywords: string[];
705
- constraints: FontWeightConstraints;
706
- mapping: FontWeightMapping;
707
- }
708
-
709
- interface FontWeightConstraints {
710
- value: Value;
711
- }
712
-
713
- interface Value {
714
- min: string;
715
- max: string;
716
- }
717
-
718
- interface FontWeightMapping {
719
- thin: string;
720
- hairline: string;
721
- "extra light": string;
722
- "ultra light": string;
723
- light: string;
724
- normal: string;
725
- regular: string;
726
- medium: string;
727
- "semi bold": string;
728
- "demi bold": string;
729
- bold: string;
730
- "extra bold": string;
731
- "ultra bold": string;
732
- black: string;
733
- heavy: string;
734
- "extra black": string;
735
- "ultra black": string;
736
- }
737
-
738
- interface LineHeight {
739
- types: string[];
740
- default: string[];
741
- keywords: string[];
742
- previous: string;
743
- prefix: Prefix;
744
- }
745
-
746
- interface Outline {
747
- shorthand: string;
748
- pattern: string;
749
- keywords: string[];
750
- default: string[];
751
- properties: OutlineProperties;
752
- }
753
-
754
- interface OutlineProperties {
755
- "outline-color": PurpleBackgroundAttachment;
756
- "outline-style": PurpleBackgroundAttachment;
757
- "outline-width": PurpleBackgroundAttachment;
758
- }
759
-
760
- interface PropertiesConfigProperties {
761
- inset: BorderRadius;
762
- top: BackgroundPositionClass;
763
- right: BackgroundPositionClass;
764
- bottom: BackgroundPositionClass;
765
- left: BackgroundPositionClass;
766
- margin: BorderRadius;
767
- "margin-top": BackgroundPositionClass;
768
- "margin-right": BackgroundPositionClass;
769
- "margin-bottom": BackgroundPositionClass;
770
- "margin-left": BackgroundPositionClass;
771
- padding: BorderColor;
772
- "padding-top": BackgroundPositionClass;
773
- "padding-right": BackgroundPositionClass;
774
- "padding-bottom": BackgroundPositionClass;
775
- "padding-left": BackgroundPositionClass;
776
- "border-radius": BorderRadius;
777
- "border-top-left-radius": BackgroundPositionClass;
778
- "border-top-right-radius": BackgroundPositionClass;
779
- "border-bottom-right-radius": BackgroundPositionClass;
780
- "border-bottom-left-radius": BackgroundPositionClass;
781
- "border-width": BorderColor;
782
- "border-top-width": BackgroundPositionClass;
783
- "border-right-width": BackgroundPositionClass;
784
- "border-bottom-width": BackgroundPositionClass;
785
- "border-left-width": BackgroundPositionClass;
786
- "border-style": BorderColor;
787
- "border-top-style": BackgroundPositionClass;
788
- "border-right-style": BackgroundPositionClass;
789
- "border-bottom-style": BackgroundPositionClass;
790
- "border-left-style": BackgroundPositionClass;
791
- "border-color": BorderColor;
792
- "border-top-color": BackgroundPositionClass;
793
- "border-right-color": BackgroundPositionClass;
794
- "border-bottom-color": BackgroundPositionClass;
795
- "border-left-color": BackgroundPositionClass;
796
- }
797
-
798
- interface BorderColor {
799
- shorthand: string;
800
- map?: string;
801
- properties: string[];
802
- types: string[];
803
- keywords: string[];
804
- }
805
-
806
- interface BorderRadius {
807
- shorthand: string;
808
- properties: string[];
809
- types: string[];
810
- multiple: boolean;
811
- separator: null | string;
812
- keywords: string[];
813
- }
814
-
815
- interface ErrorDescription {
816
-
817
- // drop rule or declaration | fix rule or declaration
818
- action: 'drop' | 'ignore';
819
- message: string;
820
- location?: {
821
- src: string,
822
- lin: number,
823
- col: number;
824
- };
825
- error?: Error;
826
- }
827
-
828
- interface PropertyListOptions {
829
-
830
- removeDuplicateDeclarations?: boolean;
831
- computeShorthand?: boolean;
832
- }
833
-
834
- interface MinifyFeature {
835
-
836
- ordering: number;
837
-
838
- register: (options: MinifyOptions | ParserOptions) => void;
839
- run: (ast: AstRule | AstAtRule, options: ParserOptions = {}, parent: AstRule | AstAtRule | AstRuleStyleSheet, context: {
840
- [key: string]: any
841
- }) => void;
842
- cleanup?: (ast: AstRuleStyleSheet, options: ParserOptions = {}, context: { [key: string]: any }) => void;
843
- }
844
-
845
- interface ParserOptions extends PropertyListOptions {
846
-
847
- minify?: boolean;
848
- src?: string;
849
- sourcemap?: boolean;
850
- nestingRules?: boolean;
851
- expandNestingRules?: boolean;
852
- removeCharset?: boolean;
853
- removeEmpty?: boolean;
854
- resolveUrls?: boolean;
855
- resolveImport?: boolean;
856
- cwd?: string;
857
- removeDuplicateDeclarations?: boolean;
858
- computeShorthand?: boolean;
859
- inlineCssVariables?: boolean;
860
- computeCalcExpression?: boolean;
861
- load?: (url: string, currentUrl: string) => Promise<string>;
862
- dirname?: (path: string) => string;
863
- resolve?: (url: string, currentUrl: string, currentWorkingDirectory?: string) => {
864
- absolute: string,
865
- relative: string
866
- };
867
- nodeEventFilter?: NodeType[]
868
- }
869
-
870
- interface MinifyOptions extends ParserOptions {
871
-
872
- features: MinifyFeature[];
873
- }
874
-
875
- interface ResoledPath {
876
- absolute: string;
877
- relative: string;
878
- }
879
-
880
- interface RenderOptions {
881
-
882
- minify?: boolean;
883
- expandNestingRules?: boolean;
884
- preserveLicense?: boolean;
885
- sourcemap?: boolean;
886
- indent?: string;
887
- newLine?: string;
888
- removeComments?: boolean;
889
- colorConvert?: boolean;
890
- output?: string;
891
- cwd?: string;
892
- load?: (url: string, currentUrl: string) => Promise<string>;
893
- resolve?: (url: string, currentUrl: string, currentWorkingDirectory?: string) => ResoledPath;
894
-
895
- }
896
-
897
- interface TransformOptions extends ParserOptions, RenderOptions {
898
-
899
- }
900
-
901
- interface ParseResult {
902
- ast: AstRuleStyleSheet;
903
- errors: ErrorDescription[];
904
- stats: {
905
- bytesIn: number;
906
- parse: string;
907
- minify: string;
908
- total: string;
909
- }
910
- }
911
-
912
- interface RenderResult {
913
- code: string;
914
- errors: ErrorDescription[];
915
- stats: {
916
- total: string;
917
- },
918
- map?: SourceMapObject
919
- }
920
-
921
- interface TransformResult extends ParseResult, RenderResult {
922
-
923
- stats: {
924
- bytesIn: number;
925
- bytesOut: number;
926
- parse: string;
927
- minify: string;
928
- render: string;
929
- total: string;
930
- }
931
- }
932
-
933
- interface ParseTokenOptions extends ParserOptions {
934
- parseColor?: boolean;
935
- }
936
-
937
- interface TokenizeResult {
938
- token: string;
939
- hint?: EnumToken;
940
- position: Position;
941
- bytesIn: number;
942
- }
943
-
944
- interface Position {
945
-
946
- ind: number;
947
- lin: number;
948
- col: number;
949
- }
950
-
951
- interface Location {
952
-
953
- sta: Position;
954
- // end: Position;
955
- src: string;
956
- }
957
-
958
- interface Node {
959
-
960
- typ: NodeType;
961
- loc?: Location;
962
- }
963
-
964
- interface AstComment extends Node {
965
-
966
- typ: NodeType.CommentNodeType | NodeType.CDOCOMMNodeType,
967
- val: string;
968
- }
969
-
970
- interface AstDeclaration extends Node {
971
-
972
- nam: string,
973
- val: Token[];
974
- typ: NodeType.DeclarationNodeType
975
- }
976
-
977
- interface AstRule extends Node {
978
-
979
- typ: NodeType.RuleNodeType;
980
- sel: string;
981
- chi: Array<AstDeclaration | AstComment | AstRuleList>;
982
- optimized?: OptimizedSelector;
983
- raw?: RawSelectorTokens;
984
- }
985
-
986
- declare type RawSelectorTokens = string[][];
987
-
988
- interface OptimizedSelector {
989
- match: boolean;
990
- optimized: string[];
991
- selector: string[][],
992
- reducible: boolean;
993
- }
994
-
995
- interface AstAtRule extends Node {
996
-
997
- typ: AtRuleNodeType,
998
- nam: string;
999
- val: string;
1000
- chi?: Array<AstDeclaration | AstComment> | Array<AstRule | AstComment>
1001
- }
1002
-
1003
- interface AstRuleList extends Node {
1004
-
1005
- typ: StyleSheetNodeType | RuleNodeType | AtRuleNodeType,
1006
- chi: Array<Node | AstComment>
1007
- }
1008
-
1009
- interface AstRuleStyleSheet extends AstRuleList {
1010
- typ: StyleSheetNodeType,
1011
- chi: Array<AstRuleList | AstComment>
1012
- }
1013
-
1014
- type AstNode =
1015
- AstRuleStyleSheet
1016
- | AstRuleList
1017
- | AstComment
1018
- | AstAtRule
1019
- | AstRule
1020
- | AstDeclaration;
1021
-
1022
- interface WalkResult {
1023
- node: AstNode;
1024
- parent?: AstRuleList;
1025
- root?: AstRuleList;
1026
- }
1027
-
1028
- interface WalkAttributesResult {
1029
- value: Token;
1030
- parent: FunctionToken | ParensToken | null;
1031
- }
1032
-
1033
- interface SourceMapObject {
1034
- version: number;
1035
- file?: string;
1036
- sourceRoot?: string;
1037
- sources?: string[];
1038
- sourcesContent?: Array<string | null>;
1039
- names?: string[];
1040
- mappings: string;
1041
- }
1042
-
1043
- declare function load(url: string, currentFile: string): Promise<string>;
1044
-
1045
- declare const matchUrl: RegExp;
1046
- declare function dirname(path: string): string;
1047
- declare function resolve(url: string, currentDirectory: string, cwd?: string): {
1048
- absolute: string;
1049
- relative: string;
1050
- };
1051
-
1052
- declare function render(data: AstNode, options?: RenderOptions): RenderResult;
1053
- declare function parse(iterator: string, opt?: ParserOptions): Promise<ParseResult>;
1054
- declare function transform(css: string, options?: TransformOptions): Promise<TransformResult>;
1055
-
1056
- export { EnumToken$1 as EnumToken, NodeType, colorsFunc, combinators, dirname, doParse, doRender, expand, funcList, getConfig, hasDeclaration, isAngle, isAtKeyword, isColor, isDigit, isDimension, isFrequency, isFunction, isHash, isHexColor, isIdent, isIdentCodepoint, isIdentStart, isLength, isNewLine, isNonPrintable, isNumber, isPercentage, isPseudo, isResolution, isTime, isWhiteSpace, load, matchType, matchUrl, minify, parse, parseDimension, parseString, parseTokens, reduceNumber, reduceSelector, render, renderToken, replaceCompound, resolve, splitRule, tokenize, transform, urlTokenMatcher, walk, walkValues };