@tbela99/css-parser 1.4.2 → 1.4.3
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/.nyc_output/4874b20e-6f53-4d7a-be5a-cf68316925f2.json +1 -0
- package/.nyc_output/6193bc4c-6f5f-4898-8950-c628825e6342.json +1 -0
- package/.nyc_output/processinfo/4874b20e-6f53-4d7a-be5a-cf68316925f2.json +1 -0
- package/.nyc_output/processinfo/6193bc4c-6f5f-4898-8950-c628825e6342.json +1 -0
- package/.repl_history +4 -0
- package/CHANGELOG.md +164 -4
- package/README.md +43 -0
- package/badges/coverage.svg +20 -0
- package/deno.lock +2861 -0
- package/dist/config.json.js +33 -1
- package/dist/index-umd-web.js +24382 -18476
- package/dist/index.cjs +24522 -18618
- package/dist/index.d.ts +1396 -929
- package/dist/lib/ast/clone.d.ts +10 -0
- package/dist/lib/ast/clone.js +45 -0
- package/dist/lib/ast/expand.d.ts +14 -0
- package/dist/lib/ast/expand.js +89 -64
- package/dist/lib/ast/features/calc.d.ts +10 -0
- package/dist/lib/ast/features/calc.js +62 -24
- package/dist/lib/ast/features/if.d.ts +10 -0
- package/dist/lib/ast/features/if.js +215 -0
- package/dist/lib/ast/features/index.d.ts +6 -0
- package/dist/lib/ast/features/index.js +1 -0
- package/dist/lib/ast/features/inlinecssvariables.d.ts +15 -0
- package/dist/lib/ast/features/inlinecssvariables.js +32 -27
- package/dist/lib/ast/features/prefix.d.ts +8 -0
- package/dist/lib/ast/features/prefix.js +68 -43
- package/dist/lib/ast/features/shorthand.d.ts +12 -0
- package/dist/lib/ast/features/shorthand.js +6 -9
- package/dist/lib/ast/features/transform.d.ts +10 -0
- package/dist/lib/ast/features/transform.js +9 -13
- package/dist/lib/ast/features/type.d.ts +15 -0
- package/dist/lib/ast/find.d.ts +165 -0
- package/dist/lib/ast/find.js +175 -0
- package/dist/lib/ast/math/expression.d.ts +18 -0
- package/dist/lib/ast/math/expression.js +140 -98
- package/dist/lib/ast/math/math.d.ts +6 -0
- package/dist/lib/ast/math/math.js +30 -41
- package/dist/lib/ast/minify.d.ts +19 -0
- package/dist/lib/ast/minify.js +541 -217
- package/dist/lib/ast/transform/compute.d.ts +8 -0
- package/dist/lib/ast/transform/compute.js +82 -69
- package/dist/lib/ast/transform/matrix.d.ts +22 -0
- package/dist/lib/ast/transform/matrix.js +12 -26
- package/dist/lib/ast/transform/minify.d.ts +5 -0
- package/dist/lib/ast/transform/minify.js +20 -20
- package/dist/lib/ast/transform/perspective.d.ts +3 -0
- package/dist/lib/ast/transform/perspective.js +1 -1
- package/dist/lib/ast/transform/rotate.d.ts +12 -0
- package/dist/lib/ast/transform/rotate.js +1 -1
- package/dist/lib/ast/transform/scale.d.ts +6 -0
- package/dist/lib/ast/transform/scale.js +1 -1
- package/dist/lib/ast/transform/skew.d.ts +4 -0
- package/dist/lib/ast/transform/skew.js +1 -1
- package/dist/lib/ast/transform/translate.d.ts +6 -0
- package/dist/lib/ast/transform/translate.js +1 -1
- package/dist/lib/ast/transform/utils.d.ts +9 -0
- package/dist/lib/ast/types.d.ts +903 -0
- package/dist/lib/ast/types.js +277 -23
- package/dist/lib/ast/walk.d.ts +162 -0
- package/dist/lib/ast/walk.js +116 -60
- package/dist/lib/fs/resolve.d.ts +20 -0
- package/dist/lib/fs/resolve.js +37 -45
- package/dist/lib/parser/declaration/list.d.ts +16 -0
- package/dist/lib/parser/declaration/list.js +26 -24
- package/dist/lib/parser/declaration/map.d.ts +15 -0
- package/dist/lib/parser/declaration/map.js +140 -95
- package/dist/lib/parser/declaration/set.d.ts +9 -0
- package/dist/lib/parser/declaration/set.js +30 -25
- package/dist/lib/parser/node.d.ts +7 -0
- package/dist/lib/parser/parse.d.ts +107 -0
- package/dist/lib/parser/parse.js +1454 -1445
- package/dist/lib/parser/tokenize.d.ts +57 -0
- package/dist/lib/parser/tokenize.js +557 -404
- package/dist/lib/parser/utils/at-rule-container.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-container.js +486 -0
- package/dist/lib/parser/utils/at-rule-font-feature-values.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-font-feature-values.js +13 -0
- package/dist/lib/parser/utils/at-rule-generic.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-generic.js +118 -0
- package/dist/lib/parser/utils/at-rule-import.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-import.js +393 -0
- package/dist/lib/parser/utils/at-rule-media.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-media.js +603 -0
- package/dist/lib/parser/utils/at-rule-page.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-page.js +28 -0
- package/dist/lib/parser/utils/at-rule-support.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-support.js +366 -0
- package/dist/lib/parser/utils/at-rule-token.d.ts +1 -0
- package/dist/lib/parser/utils/at-rule-when-else.d.ts +5 -0
- package/dist/lib/parser/utils/at-rule-when-else.js +363 -0
- package/dist/lib/parser/utils/at-rule.d.ts +13 -0
- package/dist/lib/parser/utils/at-rule.js +37 -0
- package/dist/lib/parser/utils/cache.d.ts +6 -0
- package/dist/lib/parser/utils/cache.js +19 -0
- package/dist/lib/parser/utils/config.d.ts +2 -0
- package/dist/lib/parser/utils/config.js +1 -0
- package/dist/lib/parser/utils/declaration-list.d.ts +5 -0
- package/dist/lib/parser/utils/declaration.d.ts +18 -0
- package/dist/lib/parser/utils/declaration.js +569 -91
- package/dist/lib/parser/utils/eq.d.ts +1 -0
- package/dist/lib/parser/utils/hash.d.ts +21 -0
- package/dist/lib/parser/utils/hash.js +1 -1
- package/dist/lib/parser/utils/selector.d.ts +5 -0
- package/dist/lib/parser/utils/selector.js +476 -0
- package/dist/lib/parser/utils/text.d.ts +3 -0
- package/dist/lib/parser/utils/text.js +17 -1
- package/dist/lib/parser/utils/token.d.ts +14 -0
- package/dist/lib/parser/utils/token.js +102 -0
- package/dist/lib/parser/utils/type.d.ts +2 -0
- package/dist/lib/parser/utils/type.js +29 -18
- package/dist/lib/renderer/render.d.ts +28 -0
- package/dist/lib/renderer/render.js +421 -262
- package/dist/lib/renderer/sourcemap/lib/encode.d.ts +1 -0
- package/dist/lib/renderer/sourcemap/sourcemap.d.ts +26 -0
- package/dist/lib/renderer/sourcemap/sourcemap.js +17 -7
- package/dist/lib/syntax/color/a98rgb.d.ts +2 -0
- package/dist/lib/syntax/color/a98rgb.js +8 -12
- package/dist/lib/syntax/color/cmyk.d.ts +10 -0
- package/dist/lib/syntax/color/cmyk.js +23 -21
- package/dist/lib/syntax/color/color-mix.d.ts +2 -0
- package/dist/lib/syntax/color/color-mix.js +88 -77
- package/dist/lib/syntax/color/color.d.ts +42 -0
- package/dist/lib/syntax/color/color.js +65 -68
- package/dist/lib/syntax/color/hex.d.ts +16 -0
- package/dist/lib/syntax/color/hex.js +27 -31
- package/dist/lib/syntax/color/hsl.d.ts +20 -0
- package/dist/lib/syntax/color/hsl.js +5 -12
- package/dist/lib/syntax/color/hsv.d.ts +2 -0
- package/dist/lib/syntax/color/hwb.d.ts +21 -0
- package/dist/lib/syntax/color/hwb.js +8 -21
- package/dist/lib/syntax/color/lab.d.ts +25 -0
- package/dist/lib/syntax/color/lab.js +20 -21
- package/dist/lib/syntax/color/lch.d.ts +23 -0
- package/dist/lib/syntax/color/lch.js +13 -15
- package/dist/lib/syntax/color/oklab.d.ts +22 -0
- package/dist/lib/syntax/color/oklab.js +20 -39
- package/dist/lib/syntax/color/oklch.d.ts +20 -0
- package/dist/lib/syntax/color/oklch.js +14 -16
- package/dist/lib/syntax/color/p3.d.ts +6 -0
- package/dist/lib/syntax/color/p3.js +0 -8
- package/dist/lib/syntax/color/prophotorgb.d.ts +2 -0
- package/dist/lib/syntax/color/rec2020.d.ts +2 -0
- package/dist/lib/syntax/color/rec2020.js +9 -13
- package/dist/lib/syntax/color/relativecolor.d.ts +13 -0
- package/dist/lib/syntax/color/relativecolor.js +68 -41
- package/dist/lib/syntax/color/rgb.d.ts +20 -0
- package/dist/lib/syntax/color/rgb.js +14 -18
- package/dist/lib/syntax/color/srgb.d.ts +23 -0
- package/dist/lib/syntax/color/srgb.js +27 -26
- package/dist/lib/syntax/color/utils/components.d.ts +2 -0
- package/dist/lib/syntax/color/utils/components.js +30 -14
- package/dist/lib/syntax/color/utils/distance.d.ts +18 -0
- package/dist/lib/syntax/color/utils/distance.js +1 -8
- package/dist/lib/syntax/color/utils/matrix.d.ts +6 -0
- package/dist/lib/syntax/color/xyz.d.ts +5 -0
- package/dist/lib/syntax/color/xyz.js +8 -20
- package/dist/lib/syntax/color/xyzd50.d.ts +4 -0
- package/dist/lib/syntax/color/xyzd50.js +6 -20
- package/dist/lib/syntax/constants.d.ts +67 -0
- package/dist/lib/syntax/constants.js +436 -0
- package/dist/lib/syntax/syntax.d.ts +38 -0
- package/dist/lib/syntax/syntax.js +533 -568
- package/dist/lib/validation/config.d.ts +14 -0
- package/dist/lib/validation/config.js +72 -33
- package/dist/lib/validation/config.json.js +1159 -74
- package/dist/lib/validation/json.d.ts +2 -0
- package/dist/lib/validation/match.d.ts +38 -0
- package/dist/lib/validation/match.js +2985 -0
- package/dist/lib/validation/parser/parse.d.ts +8 -0
- package/dist/lib/validation/parser/parse.js +684 -935
- package/dist/lib/validation/parser/typedef.d.ts +95 -0
- package/dist/lib/validation/parser/typedef.js +100 -0
- package/dist/lib/validation/utils/list.d.ts +4 -0
- package/dist/lib/validation/utils/list.js +4 -11
- package/dist/lib/validation/utils/whitespace.d.ts +2 -0
- package/dist/lib/validation/utils/whitespace.js +2 -8
- package/dist/node.d.ts +207 -0
- package/dist/node.js +42 -39
- package/dist/web.d.ts +169 -0
- package/dist/web.js +38 -33
- package/package.json +15 -12
- package/playground/index.html +1328 -0
- package/playground/sw.js +55 -0
- package/playground/tree.js +176 -0
- package/dist/lib/syntax/color/utils/constants.js +0 -214
- package/dist/lib/syntax/utils.js +0 -70
- package/dist/lib/validation/at-rules/container.js +0 -342
- package/dist/lib/validation/at-rules/counter-style.js +0 -90
- package/dist/lib/validation/at-rules/custom-media.js +0 -50
- package/dist/lib/validation/at-rules/document.js +0 -89
- package/dist/lib/validation/at-rules/else.js +0 -5
- package/dist/lib/validation/at-rules/font-feature-values.js +0 -63
- package/dist/lib/validation/at-rules/import.js +0 -150
- package/dist/lib/validation/at-rules/keyframes.js +0 -67
- package/dist/lib/validation/at-rules/layer.js +0 -41
- package/dist/lib/validation/at-rules/media.js +0 -255
- package/dist/lib/validation/at-rules/namespace.js +0 -81
- package/dist/lib/validation/at-rules/page-margin-box.js +0 -64
- package/dist/lib/validation/at-rules/page.js +0 -100
- package/dist/lib/validation/at-rules/supports.js +0 -295
- package/dist/lib/validation/at-rules/when.js +0 -185
- package/dist/lib/validation/atrule.js +0 -184
- package/dist/lib/validation/selector.js +0 -36
- package/dist/lib/validation/syntax.js +0 -1073
- package/dist/lib/validation/syntaxes/complex-selector-list.js +0 -27
- package/dist/lib/validation/syntaxes/complex-selector.js +0 -52
- package/dist/lib/validation/syntaxes/compound-selector.js +0 -196
- package/dist/lib/validation/syntaxes/family-name.js +0 -57
- package/dist/lib/validation/syntaxes/keyframe-selector.js +0 -36
- package/dist/lib/validation/syntaxes/layer-name.js +0 -57
- package/dist/lib/validation/syntaxes/relative-selector-list.js +0 -31
- package/dist/lib/validation/syntaxes/relative-selector.js +0 -38
- package/dist/lib/validation/syntaxes/selector-list.js +0 -5
- package/dist/lib/validation/syntaxes/selector.js +0 -5
- package/dist/lib/validation/syntaxes/url.js +0 -40
package/dist/index.d.ts
CHANGED
|
@@ -369,7 +369,7 @@ declare enum EnumToken {
|
|
|
369
369
|
/**
|
|
370
370
|
* invalid rule token type
|
|
371
371
|
*/
|
|
372
|
-
|
|
372
|
+
InvalidRuleNodeType = 81,
|
|
373
373
|
/**
|
|
374
374
|
* invalid class selector token type
|
|
375
375
|
*/
|
|
@@ -381,7 +381,7 @@ declare enum EnumToken {
|
|
|
381
381
|
/**
|
|
382
382
|
* invalid at rule token type
|
|
383
383
|
*/
|
|
384
|
-
|
|
384
|
+
InvalidAtRuleNodeType = 84,
|
|
385
385
|
/**
|
|
386
386
|
* media query condition token type
|
|
387
387
|
*/
|
|
@@ -393,19 +393,19 @@ declare enum EnumToken {
|
|
|
393
393
|
/**
|
|
394
394
|
* media feature only token type
|
|
395
395
|
*/
|
|
396
|
-
|
|
396
|
+
OnlyTokenType = 87,
|
|
397
397
|
/**
|
|
398
398
|
* media feature not token type
|
|
399
399
|
*/
|
|
400
|
-
|
|
400
|
+
NotTokenType = 88,
|
|
401
401
|
/**
|
|
402
402
|
* media feature and token type
|
|
403
403
|
*/
|
|
404
|
-
|
|
404
|
+
AndTokenType = 89,
|
|
405
405
|
/**
|
|
406
406
|
* media feature or token type
|
|
407
407
|
*/
|
|
408
|
-
|
|
408
|
+
OrTokenType = 90,
|
|
409
409
|
/**
|
|
410
410
|
* pseudo page token type
|
|
411
411
|
*/
|
|
@@ -438,6 +438,172 @@ declare enum EnumToken {
|
|
|
438
438
|
* css variable declaration map token type
|
|
439
439
|
*/
|
|
440
440
|
CssVariableDeclarationMapTokenType = 98,
|
|
441
|
+
/**
|
|
442
|
+
* media range query token type
|
|
443
|
+
*/
|
|
444
|
+
MediaRangeQueryTokenType = 99,
|
|
445
|
+
/**
|
|
446
|
+
* invalid media query token type
|
|
447
|
+
*/
|
|
448
|
+
InvalidMediaQueryTokenType = 100,
|
|
449
|
+
/**
|
|
450
|
+
* supports query condition token type
|
|
451
|
+
*/
|
|
452
|
+
SupportsQueryConditionTokenType = 101,
|
|
453
|
+
/**
|
|
454
|
+
* supports query unary condition token type
|
|
455
|
+
*/
|
|
456
|
+
SupportsQueryUnaryConditionTokenType = 102,
|
|
457
|
+
/**
|
|
458
|
+
* when else query condition token type
|
|
459
|
+
*/
|
|
460
|
+
WhenElseQueryConditionTokenType = 103,
|
|
461
|
+
/**
|
|
462
|
+
* when else query unary condition token type
|
|
463
|
+
*/
|
|
464
|
+
WhenElseUnaryConditionTokenType = 104,
|
|
465
|
+
/**
|
|
466
|
+
* container style range token type
|
|
467
|
+
*/
|
|
468
|
+
ContainerStyleRangeTokenType = 105,
|
|
469
|
+
/**
|
|
470
|
+
* '*'
|
|
471
|
+
*/
|
|
472
|
+
Star = 106,
|
|
473
|
+
/**
|
|
474
|
+
* '+'
|
|
475
|
+
*/
|
|
476
|
+
Plus = 107,
|
|
477
|
+
/**
|
|
478
|
+
* '~'
|
|
479
|
+
*/
|
|
480
|
+
Tilda = 108,
|
|
481
|
+
/**
|
|
482
|
+
* '|'
|
|
483
|
+
*/
|
|
484
|
+
Pipe = 109,
|
|
485
|
+
/**
|
|
486
|
+
* '::'
|
|
487
|
+
*/
|
|
488
|
+
DoubleColonTokenType = 110,
|
|
489
|
+
/**
|
|
490
|
+
* math function token type such as'calc(' etc.
|
|
491
|
+
*/
|
|
492
|
+
MathFunctionTokenType = 111,
|
|
493
|
+
/**
|
|
494
|
+
* transform function token type such as 'translate(' etc.
|
|
495
|
+
*/
|
|
496
|
+
TransformFunctionTokenType = 112,
|
|
497
|
+
/**
|
|
498
|
+
* when function token type such as 'supports(' etc.
|
|
499
|
+
*/
|
|
500
|
+
WhenElseFunctionTokenType = 113,
|
|
501
|
+
/**
|
|
502
|
+
* general enclosed function token type 'font-tech(' etc.
|
|
503
|
+
*/
|
|
504
|
+
GeneralEnclosedFunctionTokenType = 114,
|
|
505
|
+
/**
|
|
506
|
+
* supports function token type such as 'at-rule('
|
|
507
|
+
*/
|
|
508
|
+
SupportsFunctionTokenType = 115,
|
|
509
|
+
/**
|
|
510
|
+
* container function token type such as 'style(' or 'scroll-state('
|
|
511
|
+
*/
|
|
512
|
+
ContainerFunctionTokenType = 116,
|
|
513
|
+
/**
|
|
514
|
+
* unrecognized node token type
|
|
515
|
+
*/
|
|
516
|
+
RawNodeTokenType = 117,
|
|
517
|
+
/**
|
|
518
|
+
* media query boolean token type
|
|
519
|
+
* @media not ()
|
|
520
|
+
* @media only ()
|
|
521
|
+
*/
|
|
522
|
+
MediaQueryUnaryFeatureTokenType = 118,
|
|
523
|
+
/**
|
|
524
|
+
* grid template function token type such as 'minmax('
|
|
525
|
+
*/
|
|
526
|
+
GridTemplateFuncTokenDefType = 119,
|
|
527
|
+
/**
|
|
528
|
+
* image function token type such as 'image(' etc.
|
|
529
|
+
*/
|
|
530
|
+
ImageFunctionTokenDefType = 120,
|
|
531
|
+
/**
|
|
532
|
+
* function token type such as 'view(' etc.
|
|
533
|
+
*/
|
|
534
|
+
TimelineFunctionTokenDefType = 121,
|
|
535
|
+
/**
|
|
536
|
+
* function token type
|
|
537
|
+
*/
|
|
538
|
+
FunctionTokenDefType = 122,
|
|
539
|
+
/**
|
|
540
|
+
* timing function token type such as 'linear(' etc.
|
|
541
|
+
*/
|
|
542
|
+
TimingFunctionTokenDefType = 123,
|
|
543
|
+
/**
|
|
544
|
+
* color function token type such as 'rgb(' etc.
|
|
545
|
+
*/
|
|
546
|
+
ColorFunctionTokenDefType = 124,
|
|
547
|
+
/**
|
|
548
|
+
* math function token type such as 'calc(' etc.
|
|
549
|
+
*/
|
|
550
|
+
MathFunctionTokenDefType = 125,
|
|
551
|
+
/**
|
|
552
|
+
* container function token type such as 'style(' or 'scroll-state('
|
|
553
|
+
*/
|
|
554
|
+
ContainerFunctionTokenDefType = 126,
|
|
555
|
+
/**
|
|
556
|
+
* url function token type 'url('
|
|
557
|
+
*/
|
|
558
|
+
UrlFunctionTokenDefType = 127,
|
|
559
|
+
/**
|
|
560
|
+
* pseudo-class function token type
|
|
561
|
+
*/
|
|
562
|
+
PseudoClassFunctionTokenDefType = 128,
|
|
563
|
+
/**
|
|
564
|
+
* transform function token type such as 'translate(' etc.
|
|
565
|
+
*/
|
|
566
|
+
TransformFunctionTokenDefType = 129,
|
|
567
|
+
/**
|
|
568
|
+
* when function token type such as 'supports(' or 'media('
|
|
569
|
+
*/
|
|
570
|
+
WhenElseFunctionTokenDefType = 130,
|
|
571
|
+
/**
|
|
572
|
+
* general enclosed function token type 'font-tech(' etc.
|
|
573
|
+
*/
|
|
574
|
+
GeneralEnclosedFunctionTokenDefType = 131,
|
|
575
|
+
/**
|
|
576
|
+
* supports function token type 'font-tech('
|
|
577
|
+
*/
|
|
578
|
+
SupportsFunctionTokenDefType = 132,
|
|
579
|
+
/**
|
|
580
|
+
* CDOCOMMTokenType not allowed in this context
|
|
581
|
+
*/
|
|
582
|
+
InvalidCommentTokenType = 133,
|
|
583
|
+
/**
|
|
584
|
+
* custom function token type '--function-name('
|
|
585
|
+
*/
|
|
586
|
+
CustomFunctionTokenDefType = 134,
|
|
587
|
+
/**
|
|
588
|
+
* custom function token type
|
|
589
|
+
*/
|
|
590
|
+
CustomFunctionTokenType = 135,
|
|
591
|
+
/**
|
|
592
|
+
* function tokens such as 'var(', 'env(', 'if(')
|
|
593
|
+
*/
|
|
594
|
+
WildCardFunctionTokenDefType = 136,
|
|
595
|
+
/**
|
|
596
|
+
* function such as 'var()', 'env()', 'if()'
|
|
597
|
+
*/
|
|
598
|
+
WildCardFunctionTokenType = 137,
|
|
599
|
+
/**
|
|
600
|
+
* if condition token
|
|
601
|
+
*/
|
|
602
|
+
IfConditionTokenType = 138,
|
|
603
|
+
/**
|
|
604
|
+
* if-Else condition token
|
|
605
|
+
*/
|
|
606
|
+
IfElseConditionTokenType = 139,
|
|
441
607
|
/**
|
|
442
608
|
* alias for time token type
|
|
443
609
|
*/
|
|
@@ -550,7 +716,7 @@ declare enum EnumToken {
|
|
|
550
716
|
/**
|
|
551
717
|
* supported color types enum
|
|
552
718
|
*/
|
|
553
|
-
declare enum ColorType {
|
|
719
|
+
declare enum ColorType$1 {
|
|
554
720
|
/**
|
|
555
721
|
* deprecated system colors
|
|
556
722
|
*/
|
|
@@ -572,31 +738,31 @@ declare enum ColorType {
|
|
|
572
738
|
*/
|
|
573
739
|
RGBA = 4,
|
|
574
740
|
/**
|
|
575
|
-
* colors
|
|
741
|
+
* colors using rgb
|
|
576
742
|
*/
|
|
577
743
|
HSLA = 5,
|
|
578
744
|
/**
|
|
579
|
-
* colors
|
|
745
|
+
* colors using hwb
|
|
580
746
|
*/
|
|
581
747
|
HWB = 6,
|
|
582
748
|
/**
|
|
583
|
-
* colors
|
|
749
|
+
* colors using cmyk
|
|
584
750
|
*/
|
|
585
751
|
CMYK = 7,
|
|
586
752
|
/**
|
|
587
|
-
* colors
|
|
753
|
+
* colors using oklab
|
|
588
754
|
* */
|
|
589
755
|
OKLAB = 8,
|
|
590
756
|
/**
|
|
591
|
-
* colors
|
|
757
|
+
* colors using oklch
|
|
592
758
|
* */
|
|
593
759
|
OKLCH = 9,
|
|
594
760
|
/**
|
|
595
|
-
* colors
|
|
761
|
+
* colors using lab
|
|
596
762
|
*/
|
|
597
763
|
LAB = 10,
|
|
598
764
|
/**
|
|
599
|
-
* colors
|
|
765
|
+
* colors using lch
|
|
600
766
|
*/
|
|
601
767
|
LCH = 11,
|
|
602
768
|
/**
|
|
@@ -604,35 +770,35 @@ declare enum ColorType {
|
|
|
604
770
|
*/
|
|
605
771
|
COLOR = 12,
|
|
606
772
|
/**
|
|
607
|
-
* color using srgb
|
|
773
|
+
* color using srgb
|
|
608
774
|
*/
|
|
609
775
|
SRGB = 13,
|
|
610
776
|
/**
|
|
611
|
-
* color using prophoto-rgb
|
|
777
|
+
* color using prophoto-rgb
|
|
612
778
|
*/
|
|
613
779
|
PROPHOTO_RGB = 14,
|
|
614
780
|
/**
|
|
615
|
-
* color using a98-rgb
|
|
781
|
+
* color using a98-rgb
|
|
616
782
|
*/
|
|
617
783
|
A98_RGB = 15,
|
|
618
784
|
/**
|
|
619
|
-
* color using rec2020
|
|
785
|
+
* color using rec2020
|
|
620
786
|
*/
|
|
621
787
|
REC2020 = 16,
|
|
622
788
|
/**
|
|
623
|
-
* color using display-p3
|
|
789
|
+
* color using display-p3
|
|
624
790
|
*/
|
|
625
791
|
DISPLAY_P3 = 17,
|
|
626
792
|
/**
|
|
627
|
-
* color using srgb-linear
|
|
793
|
+
* color using srgb-linear
|
|
628
794
|
*/
|
|
629
795
|
SRGB_LINEAR = 18,
|
|
630
796
|
/**
|
|
631
|
-
* color using xyz-d50
|
|
797
|
+
* color using xyz-d50
|
|
632
798
|
*/
|
|
633
799
|
XYZ_D50 = 19,
|
|
634
800
|
/**
|
|
635
|
-
* color using xyz-d65
|
|
801
|
+
* color using xyz-d65
|
|
636
802
|
*/
|
|
637
803
|
XYZ_D65 = 20,
|
|
638
804
|
/**
|
|
@@ -643,6 +809,14 @@ declare enum ColorType {
|
|
|
643
809
|
* color-mix() color function
|
|
644
810
|
*/
|
|
645
811
|
COLOR_MIX = 22,
|
|
812
|
+
/**
|
|
813
|
+
* non-standard color
|
|
814
|
+
*/
|
|
815
|
+
NON_STD = 23,
|
|
816
|
+
/**
|
|
817
|
+
* custom color
|
|
818
|
+
*/
|
|
819
|
+
CUSTOM_COLOR = 24,
|
|
646
820
|
/**
|
|
647
821
|
* alias for rgba
|
|
648
822
|
*/
|
|
@@ -698,421 +872,161 @@ declare enum ModuleScopeEnumOptions {
|
|
|
698
872
|
/**
|
|
699
873
|
* export using ICSS module format
|
|
700
874
|
*/
|
|
701
|
-
ICSS = 256
|
|
875
|
+
ICSS = 256,
|
|
876
|
+
/**
|
|
877
|
+
* use the shortest name possible. pattern is ignored.
|
|
878
|
+
* it will produce names such as
|
|
879
|
+
*
|
|
880
|
+
* ```css
|
|
881
|
+
* .a {
|
|
882
|
+
* content: 'a';
|
|
883
|
+
* }
|
|
884
|
+
*
|
|
885
|
+
* .b {
|
|
886
|
+
* content: 'b';
|
|
887
|
+
* }
|
|
888
|
+
*
|
|
889
|
+
* .c {
|
|
890
|
+
* content: 'c';
|
|
891
|
+
* }
|
|
892
|
+
* ...
|
|
893
|
+
* ```
|
|
894
|
+
*/
|
|
895
|
+
Shortest = 512
|
|
702
896
|
}
|
|
703
897
|
|
|
704
898
|
/**
|
|
705
|
-
*
|
|
706
|
-
* @param ast
|
|
707
|
-
* @param options
|
|
708
|
-
* @param recursive
|
|
709
|
-
* @param errors
|
|
710
|
-
* @param nestingContent
|
|
711
|
-
*
|
|
712
|
-
* @private
|
|
899
|
+
* Literal token
|
|
713
900
|
*/
|
|
714
|
-
declare
|
|
901
|
+
declare interface LiteralToken extends BaseToken {
|
|
902
|
+
typ: EnumToken.LiteralTokenType;
|
|
903
|
+
val: string;
|
|
904
|
+
}
|
|
715
905
|
|
|
716
906
|
/**
|
|
717
|
-
*
|
|
907
|
+
* Class selector token
|
|
718
908
|
*/
|
|
719
|
-
declare
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
*/
|
|
723
|
-
Ignore = 1,
|
|
724
|
-
/**
|
|
725
|
-
* stop walking the tree
|
|
726
|
-
*/
|
|
727
|
-
Stop = 2,
|
|
728
|
-
/**
|
|
729
|
-
* ignore the current node and process its children
|
|
730
|
-
*/
|
|
731
|
-
Children = 4,
|
|
732
|
-
/**
|
|
733
|
-
* ignore the current node children
|
|
734
|
-
*/
|
|
735
|
-
IgnoreChildren = 8
|
|
909
|
+
declare interface ClassSelectorToken extends BaseToken {
|
|
910
|
+
typ: EnumToken.ClassSelectorTokenType;
|
|
911
|
+
val: string;
|
|
736
912
|
}
|
|
913
|
+
|
|
737
914
|
/**
|
|
738
|
-
*
|
|
915
|
+
* Invalid class selector token
|
|
739
916
|
*/
|
|
740
|
-
declare
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
*/
|
|
744
|
-
Enter = 1,
|
|
745
|
-
/**
|
|
746
|
-
* leave node
|
|
747
|
-
*/
|
|
748
|
-
Leave = 2
|
|
917
|
+
declare interface InvalidClassSelectorToken extends BaseToken {
|
|
918
|
+
typ: EnumToken.InvalidClassSelectorTokenType;
|
|
919
|
+
val: string;
|
|
749
920
|
}
|
|
921
|
+
|
|
750
922
|
/**
|
|
751
|
-
*
|
|
752
|
-
* @param node initial node
|
|
753
|
-
* @param filter control the walk process
|
|
754
|
-
* @param reverse walk in reverse order
|
|
755
|
-
*
|
|
756
|
-
* ```ts
|
|
757
|
-
*
|
|
758
|
-
* import {walk} from '@tbela99/css-parser';
|
|
759
|
-
*
|
|
760
|
-
* const css = `
|
|
761
|
-
* body { color: color(from var(--base-color) display-p3 r calc(g + 0.24) calc(b + 0.15)); }
|
|
762
|
-
*
|
|
763
|
-
* html,
|
|
764
|
-
* body {
|
|
765
|
-
* line-height: 1.474;
|
|
766
|
-
* }
|
|
767
|
-
*
|
|
768
|
-
* .ruler {
|
|
769
|
-
*
|
|
770
|
-
* height: 10px;
|
|
771
|
-
* }
|
|
772
|
-
* `;
|
|
773
|
-
*
|
|
774
|
-
* for (const {node, parent, root} of walk(ast)) {
|
|
775
|
-
*
|
|
776
|
-
* // do something with node
|
|
777
|
-
* }
|
|
778
|
-
* ```
|
|
779
|
-
*
|
|
780
|
-
* Using a {@link filter} function to control the ast traversal. the filter function returns a value of type {@link WalkerOption}.
|
|
781
|
-
*
|
|
782
|
-
* ```ts
|
|
783
|
-
* import {EnumToken, transform, walk, WalkerOptionEnum} from '@tbela99/css-parser';
|
|
784
|
-
*
|
|
785
|
-
* const css = `
|
|
786
|
-
* body { color: color(from var(--base-color) display-p3 r calc(g + 0.24) calc(b + 0.15)); }
|
|
787
|
-
*
|
|
788
|
-
* html,
|
|
789
|
-
* body {
|
|
790
|
-
* line-height: 1.474;
|
|
791
|
-
* }
|
|
792
|
-
*
|
|
793
|
-
* .ruler {
|
|
794
|
-
*
|
|
795
|
-
* height: 10px;
|
|
796
|
-
* }
|
|
797
|
-
* `;
|
|
798
|
-
*
|
|
799
|
-
* function filter(node) {
|
|
800
|
-
*
|
|
801
|
-
* if (node.typ == EnumToken.AstRule && node.sel.includes('html')) {
|
|
802
|
-
*
|
|
803
|
-
* // skip the children of the current node
|
|
804
|
-
* return WalkerOptionEnum.IgnoreChildren;
|
|
805
|
-
* }
|
|
806
|
-
* }
|
|
807
|
-
*
|
|
808
|
-
* const result = await transform(css);
|
|
809
|
-
* for (const {node} of walk(result.ast, filter)) {
|
|
810
|
-
*
|
|
811
|
-
* console.error([EnumToken[node.typ]]);
|
|
812
|
-
* }
|
|
813
|
-
*
|
|
814
|
-
* // [ "StyleSheetNodeType" ]
|
|
815
|
-
* // [ "RuleNodeType" ]
|
|
816
|
-
* // [ "DeclarationNodeType" ]
|
|
817
|
-
* // [ "RuleNodeType" ]
|
|
818
|
-
* // [ "DeclarationNodeType" ]
|
|
819
|
-
* // [ "RuleNodeType" ]
|
|
820
|
-
* // [ "DeclarationNodeType" ]
|
|
821
|
-
* ```
|
|
923
|
+
* Universal selector token
|
|
822
924
|
*/
|
|
823
|
-
declare
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
* @param root
|
|
828
|
-
* @param filter
|
|
829
|
-
* @param reverse
|
|
830
|
-
*
|
|
831
|
-
* Example:
|
|
832
|
-
*
|
|
833
|
-
* ```ts
|
|
834
|
-
*
|
|
835
|
-
* import {AstDeclaration, EnumToken, transform, walkValues} from '@tbela99/css-parser';
|
|
836
|
-
*
|
|
837
|
-
* const css = `
|
|
838
|
-
* body { color: color(from var(--base-color) display-p3 r calc(g + 0.24) calc(b + 0.15)); }
|
|
839
|
-
* `;
|
|
840
|
-
*
|
|
841
|
-
* const result = await transform(css);
|
|
842
|
-
* const declaration = result.ast.chi[0].chi[0] as AstDeclaration;
|
|
843
|
-
*
|
|
844
|
-
* // walk the node attribute's tokens in reverse order
|
|
845
|
-
* for (const {value} of walkValues(declaration.val, null, null,true)) {
|
|
846
|
-
*
|
|
847
|
-
* console.error([EnumToken[value.typ], value.val]);
|
|
848
|
-
* }
|
|
849
|
-
*
|
|
850
|
-
* // [ "Color", "color" ]
|
|
851
|
-
* // [ "FunctionTokenType", "calc" ]
|
|
852
|
-
* // [ "Number", 0.15 ]
|
|
853
|
-
* // [ "Add", undefined ]
|
|
854
|
-
* // [ "Iden", "b" ]
|
|
855
|
-
* // [ "Whitespace", undefined ]
|
|
856
|
-
* // [ "FunctionTokenType", "calc" ]
|
|
857
|
-
* // [ "Number", 0.24 ]
|
|
858
|
-
* // [ "Add", undefined ]
|
|
859
|
-
* // [ "Iden", "g" ]
|
|
860
|
-
* // [ "Whitespace", undefined ]
|
|
861
|
-
* // [ "Iden", "r" ]
|
|
862
|
-
* // [ "Whitespace", undefined ]
|
|
863
|
-
* // [ "Iden", "display-p3" ]
|
|
864
|
-
* // [ "Whitespace", undefined ]
|
|
865
|
-
* // [ "FunctionTokenType", "var" ]
|
|
866
|
-
* // [ "DashedIden", "--base-color" ]
|
|
867
|
-
* // [ "Whitespace", undefined ]
|
|
868
|
-
* // [ "Iden", "from" ]
|
|
869
|
-
* ```
|
|
870
|
-
*/
|
|
871
|
-
declare function walkValues(values: Token$1[], root?: AstNode$1 | Token$1 | null, filter?: WalkerValueFilter | null | {
|
|
872
|
-
event?: WalkerEvent;
|
|
873
|
-
fn?: WalkerValueFilter;
|
|
874
|
-
type?: EnumToken | EnumToken[] | ((token: Token$1) => boolean);
|
|
875
|
-
}, reverse?: boolean): Generator<WalkAttributesResult>;
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* expand css nesting ast nodes
|
|
879
|
-
* @param ast
|
|
880
|
-
*
|
|
881
|
-
* @private
|
|
882
|
-
*/
|
|
883
|
-
declare function expand(ast: AstStyleSheet | AstAtRule | AstRule): AstNode$1;
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
*
|
|
887
|
-
* @param token
|
|
888
|
-
* @param options
|
|
889
|
-
*
|
|
890
|
-
* @private
|
|
891
|
-
*/
|
|
892
|
-
declare function renderToken(token: Token$1, options?: RenderOptions, cache?: {
|
|
893
|
-
[key: string]: any;
|
|
894
|
-
}, reducer?: (acc: string, curr: Token$1) => string, errors?: ErrorDescription[]): string;
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Source map class
|
|
898
|
-
* @internal
|
|
899
|
-
*/
|
|
900
|
-
declare class SourceMap {
|
|
901
|
-
#private;
|
|
902
|
-
/**
|
|
903
|
-
* Last location
|
|
904
|
-
*/
|
|
905
|
-
lastLocation: Location | null;
|
|
906
|
-
/**
|
|
907
|
-
* Add a location
|
|
908
|
-
* @param source
|
|
909
|
-
* @param original
|
|
910
|
-
*/
|
|
911
|
-
add(source: Location, original: Location): void;
|
|
912
|
-
/**
|
|
913
|
-
* Convert to URL encoded string
|
|
914
|
-
*/
|
|
915
|
-
toUrl(): string;
|
|
916
|
-
/**
|
|
917
|
-
* Convert to JSON object
|
|
918
|
-
*/
|
|
919
|
-
toJSON(): SourceMapObject;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* parse a string as an array of declaration nodes
|
|
924
|
-
* @param declaration
|
|
925
|
-
*
|
|
926
|
-
* Example:
|
|
927
|
-
* ````ts
|
|
928
|
-
*
|
|
929
|
-
* const declarations = await parseDeclarations('color: red; background: blue');
|
|
930
|
-
* console.log(declarations);
|
|
931
|
-
* ```
|
|
932
|
-
*/
|
|
933
|
-
declare function parseDeclarations(declaration: string): Promise<Array<AstDeclaration | AstComment>>;
|
|
934
|
-
/**
|
|
935
|
-
* parse css string and return an array of tokens
|
|
936
|
-
* @param src
|
|
937
|
-
* @param options
|
|
938
|
-
*
|
|
939
|
-
* @private
|
|
940
|
-
*
|
|
941
|
-
* Example:
|
|
942
|
-
*
|
|
943
|
-
* ```ts
|
|
944
|
-
*
|
|
945
|
-
* import {parseString} from '@tbela99/css-parser';
|
|
946
|
-
*
|
|
947
|
-
* let tokens = parseString('body { color: red; }');
|
|
948
|
-
* console.log(tokens);
|
|
949
|
-
*
|
|
950
|
-
* tokens = parseString('#c322c980');
|
|
951
|
-
* console.log(tokens);
|
|
952
|
-
* ```
|
|
953
|
-
*/
|
|
954
|
-
declare function parseString(src: string, options?: {
|
|
955
|
-
location: boolean;
|
|
956
|
-
}): Token$1[];
|
|
957
|
-
/**
|
|
958
|
-
* parse function tokens in a token array
|
|
959
|
-
* @param tokens
|
|
960
|
-
* @param options
|
|
961
|
-
*
|
|
962
|
-
* Example:
|
|
963
|
-
*
|
|
964
|
-
* ```ts
|
|
965
|
-
*
|
|
966
|
-
* import {parseString, parseTokens} from '@tbela99/css-parser';
|
|
967
|
-
*
|
|
968
|
-
* let tokens = parseString('body { color: red; }');
|
|
969
|
-
* console.log(parseTokens(tokens));
|
|
970
|
-
*
|
|
971
|
-
* tokens = parseString('#c322c980');
|
|
972
|
-
* console.log(parseTokens(tokens));
|
|
973
|
-
* ```
|
|
974
|
-
*
|
|
975
|
-
* @private
|
|
976
|
-
*/
|
|
977
|
-
declare function parseTokens(tokens: Token$1[], options?: ParseTokenOptions): Token$1[];
|
|
978
|
-
|
|
979
|
-
/**
|
|
980
|
-
* Literal token
|
|
981
|
-
*/
|
|
982
|
-
export declare interface LiteralToken extends BaseToken {
|
|
983
|
-
|
|
984
|
-
typ: EnumToken.LiteralTokenType;
|
|
985
|
-
val: string;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
* Class selector token
|
|
990
|
-
*/
|
|
991
|
-
export declare interface ClassSelectorToken extends BaseToken {
|
|
992
|
-
|
|
993
|
-
typ: EnumToken.ClassSelectorTokenType;
|
|
994
|
-
val: string;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
/**
|
|
998
|
-
* Invalid class selector token
|
|
999
|
-
*/
|
|
1000
|
-
export declare interface InvalidClassSelectorToken extends BaseToken {
|
|
1001
|
-
|
|
1002
|
-
typ: EnumToken.InvalidClassSelectorTokenType;
|
|
1003
|
-
val: string;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
/**
|
|
1007
|
-
* Universal selector token
|
|
1008
|
-
*/
|
|
1009
|
-
export declare interface UniversalSelectorToken extends BaseToken {
|
|
1010
|
-
|
|
1011
|
-
typ: EnumToken.UniversalSelectorTokenType;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
925
|
+
declare interface UniversalSelectorToken extends BaseToken {
|
|
926
|
+
typ: EnumToken.UniversalSelectorTokenType;
|
|
927
|
+
}
|
|
928
|
+
|
|
1014
929
|
/**
|
|
1015
930
|
* Ident token
|
|
1016
931
|
*/
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
typ: EnumToken.IdenTokenType,
|
|
932
|
+
declare interface IdentToken extends BaseToken {
|
|
933
|
+
typ: EnumToken.IdenTokenType;
|
|
1020
934
|
val: string;
|
|
1021
935
|
}
|
|
1022
936
|
|
|
1023
937
|
/**
|
|
1024
938
|
* Ident list token
|
|
1025
939
|
*/
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
typ: EnumToken.IdenListTokenType,
|
|
940
|
+
declare interface IdentListToken extends BaseToken {
|
|
941
|
+
typ: EnumToken.IdenListTokenType;
|
|
1029
942
|
val: string;
|
|
1030
943
|
}
|
|
1031
944
|
|
|
1032
945
|
/**
|
|
1033
946
|
* Dashed ident token
|
|
1034
947
|
*/
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
typ: EnumToken.DashedIdenTokenType,
|
|
948
|
+
declare interface DashedIdentToken extends BaseToken {
|
|
949
|
+
typ: EnumToken.DashedIdenTokenType;
|
|
1038
950
|
val: string;
|
|
1039
951
|
}
|
|
1040
952
|
|
|
1041
953
|
/**
|
|
1042
954
|
* Comma token
|
|
1043
955
|
*/
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
typ: EnumToken.CommaTokenType
|
|
956
|
+
declare interface CommaToken extends BaseToken {
|
|
957
|
+
typ: EnumToken.CommaTokenType;
|
|
1047
958
|
}
|
|
1048
959
|
|
|
1049
960
|
/**
|
|
1050
961
|
* Colon token
|
|
1051
962
|
*/
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
typ: EnumToken.ColonTokenType
|
|
963
|
+
declare interface ColonToken extends BaseToken {
|
|
964
|
+
typ: EnumToken.ColonTokenType;
|
|
1055
965
|
}
|
|
1056
966
|
|
|
1057
967
|
/**
|
|
1058
968
|
* Semicolon token
|
|
1059
969
|
*/
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
typ: EnumToken.SemiColonTokenType
|
|
970
|
+
declare interface SemiColonToken extends BaseToken {
|
|
971
|
+
typ: EnumToken.SemiColonTokenType;
|
|
1063
972
|
}
|
|
1064
973
|
|
|
1065
974
|
/**
|
|
1066
975
|
* Nesting selector token
|
|
1067
976
|
*/
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
typ: EnumToken.NestingSelectorTokenType
|
|
977
|
+
declare interface NestingSelectorToken extends BaseToken {
|
|
978
|
+
typ: EnumToken.NestingSelectorTokenType;
|
|
1071
979
|
}
|
|
1072
980
|
|
|
1073
981
|
/**
|
|
1074
982
|
* Number token
|
|
1075
983
|
*/
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
984
|
+
declare interface NumberToken extends BaseToken {
|
|
985
|
+
typ: EnumToken.NumberTokenType;
|
|
986
|
+
sign?: "-" | "+";
|
|
1079
987
|
val: number | FractionToken;
|
|
1080
988
|
}
|
|
1081
989
|
|
|
1082
990
|
/**
|
|
1083
991
|
* At rule token
|
|
1084
992
|
*/
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
val
|
|
1089
|
-
pre: string;
|
|
993
|
+
declare interface AtRuleToken extends BaseToken {
|
|
994
|
+
typ: EnumToken.AtRuleTokenType;
|
|
995
|
+
nam: string;
|
|
996
|
+
val?: string;
|
|
1090
997
|
}
|
|
1091
998
|
|
|
1092
999
|
/**
|
|
1093
1000
|
* Percentage token
|
|
1094
1001
|
*/
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
typ: EnumToken.PercentageTokenType,
|
|
1002
|
+
declare interface PercentageToken extends BaseToken {
|
|
1003
|
+
typ: EnumToken.PercentageTokenType;
|
|
1098
1004
|
val: number | FractionToken;
|
|
1099
1005
|
}
|
|
1100
1006
|
|
|
1101
1007
|
/**
|
|
1102
1008
|
* Flex token
|
|
1103
1009
|
*/
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
typ: EnumToken.FlexTokenType,
|
|
1010
|
+
declare interface FlexToken extends BaseToken {
|
|
1011
|
+
typ: EnumToken.FlexTokenType;
|
|
1107
1012
|
val: number | FractionToken;
|
|
1108
1013
|
}
|
|
1109
1014
|
|
|
1110
1015
|
/**
|
|
1111
1016
|
* Function token
|
|
1112
1017
|
*/
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1018
|
+
declare interface FunctionToken extends BaseToken {
|
|
1019
|
+
typ:
|
|
1020
|
+
| EnumToken.FunctionTokenType
|
|
1021
|
+
| EnumToken.UrlFunctionTokenType
|
|
1022
|
+
| EnumToken.GridTemplateFuncTokenType
|
|
1023
|
+
| EnumToken.ImageFunctionTokenType
|
|
1024
|
+
| EnumToken.TimelineFunctionTokenType
|
|
1025
|
+
| EnumToken.TimingFunctionTokenType
|
|
1026
|
+
| EnumToken.ColorFunctionTokenType
|
|
1027
|
+
| EnumToken.MathFunctionTokenType
|
|
1028
|
+
| EnumToken.PseudoClassFunctionTokenType
|
|
1029
|
+
| EnumToken.TransformFunctionTokenType;
|
|
1116
1030
|
val: string;
|
|
1117
1031
|
chi: Token$1[];
|
|
1118
1032
|
}
|
|
@@ -1120,9 +1034,8 @@ export declare interface FunctionToken extends BaseToken {
|
|
|
1120
1034
|
/**
|
|
1121
1035
|
* Grid template function token
|
|
1122
1036
|
*/
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
typ: EnumToken.GridTemplateFuncTokenType,
|
|
1037
|
+
declare interface GridTemplateFuncToken extends BaseToken {
|
|
1038
|
+
typ: EnumToken.GridTemplateFuncTokenType;
|
|
1126
1039
|
val: string;
|
|
1127
1040
|
chi: Token$1[];
|
|
1128
1041
|
}
|
|
@@ -1130,28 +1043,34 @@ export declare interface GridTemplateFuncToken extends BaseToken {
|
|
|
1130
1043
|
/**
|
|
1131
1044
|
* Function URL token
|
|
1132
1045
|
*/
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
val: 'url';
|
|
1046
|
+
declare interface FunctionURLToken extends BaseToken {
|
|
1047
|
+
typ: EnumToken.UrlFunctionTokenType;
|
|
1048
|
+
val: "url";
|
|
1137
1049
|
chi: Array<UrlToken | StringToken | CommentToken>;
|
|
1138
1050
|
}
|
|
1139
1051
|
|
|
1140
1052
|
/**
|
|
1141
1053
|
* Function image token
|
|
1142
1054
|
*/
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1055
|
+
declare interface FunctionImageToken extends BaseToken {
|
|
1056
|
+
typ: EnumToken.ImageFunctionTokenType;
|
|
1057
|
+
val:
|
|
1058
|
+
| "linear-gradient"
|
|
1059
|
+
| "radial-gradient"
|
|
1060
|
+
| "repeating-linear-gradient"
|
|
1061
|
+
| "repeating-radial-gradient"
|
|
1062
|
+
| "conic-gradient"
|
|
1063
|
+
| "image"
|
|
1064
|
+
| "image-set"
|
|
1065
|
+
| "element"
|
|
1066
|
+
| "cross-fade";
|
|
1147
1067
|
chi: Array<UrlToken | CommentToken>;
|
|
1148
1068
|
}
|
|
1149
1069
|
|
|
1150
1070
|
/**
|
|
1151
1071
|
* Timing function token
|
|
1152
1072
|
*/
|
|
1153
|
-
|
|
1154
|
-
|
|
1073
|
+
declare interface TimingFunctionToken extends BaseToken {
|
|
1155
1074
|
typ: EnumToken.TimingFunctionTokenType;
|
|
1156
1075
|
val: string;
|
|
1157
1076
|
chi: Token$1[];
|
|
@@ -1160,8 +1079,7 @@ export declare interface TimingFunctionToken extends BaseToken {
|
|
|
1160
1079
|
/**
|
|
1161
1080
|
* Timeline function token
|
|
1162
1081
|
*/
|
|
1163
|
-
|
|
1164
|
-
|
|
1082
|
+
declare interface TimelineFunctionToken extends BaseToken {
|
|
1165
1083
|
typ: EnumToken.TimelineFunctionTokenType;
|
|
1166
1084
|
val: string;
|
|
1167
1085
|
chi: Token$1[];
|
|
@@ -1170,8 +1088,7 @@ export declare interface TimelineFunctionToken extends BaseToken {
|
|
|
1170
1088
|
/**
|
|
1171
1089
|
* String token
|
|
1172
1090
|
*/
|
|
1173
|
-
|
|
1174
|
-
|
|
1091
|
+
declare interface StringToken extends BaseToken {
|
|
1175
1092
|
typ: EnumToken.StringTokenType;
|
|
1176
1093
|
val: string;
|
|
1177
1094
|
}
|
|
@@ -1179,8 +1096,7 @@ export declare interface StringToken extends BaseToken {
|
|
|
1179
1096
|
/**
|
|
1180
1097
|
* Bad string token
|
|
1181
1098
|
*/
|
|
1182
|
-
|
|
1183
|
-
|
|
1099
|
+
declare interface BadStringToken extends BaseToken {
|
|
1184
1100
|
typ: EnumToken.BadStringTokenType;
|
|
1185
1101
|
val: string;
|
|
1186
1102
|
}
|
|
@@ -1188,8 +1104,7 @@ export declare interface BadStringToken extends BaseToken {
|
|
|
1188
1104
|
/**
|
|
1189
1105
|
* Unclosed string token
|
|
1190
1106
|
*/
|
|
1191
|
-
|
|
1192
|
-
|
|
1107
|
+
declare interface UnclosedStringToken extends BaseToken {
|
|
1193
1108
|
typ: EnumToken.UnclosedStringTokenType;
|
|
1194
1109
|
val: string;
|
|
1195
1110
|
}
|
|
@@ -1197,8 +1112,7 @@ export declare interface UnclosedStringToken extends BaseToken {
|
|
|
1197
1112
|
/**
|
|
1198
1113
|
* Dimension token
|
|
1199
1114
|
*/
|
|
1200
|
-
|
|
1201
|
-
|
|
1115
|
+
declare interface DimensionToken extends BaseToken {
|
|
1202
1116
|
typ: EnumToken.DimensionTokenType;
|
|
1203
1117
|
val: number | FractionToken;
|
|
1204
1118
|
unit: string;
|
|
@@ -1207,8 +1121,7 @@ export declare interface DimensionToken extends BaseToken {
|
|
|
1207
1121
|
/**
|
|
1208
1122
|
* Length token
|
|
1209
1123
|
*/
|
|
1210
|
-
|
|
1211
|
-
|
|
1124
|
+
declare interface LengthToken extends BaseToken {
|
|
1212
1125
|
typ: EnumToken.LengthTokenType;
|
|
1213
1126
|
val: number | FractionToken;
|
|
1214
1127
|
unit: string;
|
|
@@ -1217,8 +1130,7 @@ export declare interface LengthToken extends BaseToken {
|
|
|
1217
1130
|
/**
|
|
1218
1131
|
* Angle token
|
|
1219
1132
|
*/
|
|
1220
|
-
|
|
1221
|
-
|
|
1133
|
+
declare interface AngleToken extends BaseToken {
|
|
1222
1134
|
typ: EnumToken.AngleTokenType;
|
|
1223
1135
|
val: number | FractionToken;
|
|
1224
1136
|
unit: string;
|
|
@@ -1227,38 +1139,34 @@ export declare interface AngleToken extends BaseToken {
|
|
|
1227
1139
|
/**
|
|
1228
1140
|
* Time token
|
|
1229
1141
|
*/
|
|
1230
|
-
|
|
1231
|
-
|
|
1142
|
+
declare interface TimeToken extends BaseToken {
|
|
1232
1143
|
typ: EnumToken.TimeTokenType;
|
|
1233
1144
|
val: number | FractionToken;
|
|
1234
|
-
unit:
|
|
1145
|
+
unit: "ms" | "s";
|
|
1235
1146
|
}
|
|
1236
1147
|
|
|
1237
1148
|
/**
|
|
1238
1149
|
* Frequency token
|
|
1239
1150
|
*/
|
|
1240
|
-
|
|
1241
|
-
|
|
1151
|
+
declare interface FrequencyToken extends BaseToken {
|
|
1242
1152
|
typ: EnumToken.FrequencyTokenType;
|
|
1243
1153
|
val: number | FractionToken;
|
|
1244
|
-
unit:
|
|
1154
|
+
unit: "Hz" | "Khz";
|
|
1245
1155
|
}
|
|
1246
1156
|
|
|
1247
1157
|
/**
|
|
1248
1158
|
* Resolution token
|
|
1249
1159
|
*/
|
|
1250
|
-
|
|
1251
|
-
|
|
1160
|
+
declare interface ResolutionToken extends BaseToken {
|
|
1252
1161
|
typ: EnumToken.ResolutionTokenType;
|
|
1253
1162
|
val: number | FractionToken;
|
|
1254
|
-
unit:
|
|
1163
|
+
unit: "dpi" | "dpcm" | "dppx" | "x";
|
|
1255
1164
|
}
|
|
1256
1165
|
|
|
1257
1166
|
/**
|
|
1258
1167
|
* Hash token
|
|
1259
1168
|
*/
|
|
1260
|
-
|
|
1261
|
-
|
|
1169
|
+
declare interface HashToken extends BaseToken {
|
|
1262
1170
|
typ: EnumToken.HashTokenType;
|
|
1263
1171
|
val: string;
|
|
1264
1172
|
}
|
|
@@ -1266,24 +1174,21 @@ export declare interface HashToken extends BaseToken {
|
|
|
1266
1174
|
/**
|
|
1267
1175
|
* Block start token
|
|
1268
1176
|
*/
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
typ: EnumToken.BlockStartTokenType
|
|
1177
|
+
declare interface BlockStartToken extends BaseToken {
|
|
1178
|
+
typ: EnumToken.BlockStartTokenType;
|
|
1272
1179
|
}
|
|
1273
1180
|
|
|
1274
1181
|
/**
|
|
1275
1182
|
* Block end token
|
|
1276
1183
|
*/
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
typ: EnumToken.BlockEndTokenType
|
|
1184
|
+
declare interface BlockEndToken extends BaseToken {
|
|
1185
|
+
typ: EnumToken.BlockEndTokenType;
|
|
1280
1186
|
}
|
|
1281
1187
|
|
|
1282
1188
|
/**
|
|
1283
1189
|
* Attribute start token
|
|
1284
1190
|
*/
|
|
1285
|
-
|
|
1286
|
-
|
|
1191
|
+
declare interface AttrStartToken extends BaseToken {
|
|
1287
1192
|
typ: EnumToken.AttrStartTokenType;
|
|
1288
1193
|
chi?: Token$1[];
|
|
1289
1194
|
}
|
|
@@ -1291,32 +1196,28 @@ export declare interface AttrStartToken extends BaseToken {
|
|
|
1291
1196
|
/**
|
|
1292
1197
|
* Attribute end token
|
|
1293
1198
|
*/
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
typ: EnumToken.AttrEndTokenType
|
|
1199
|
+
declare interface AttrEndToken extends BaseToken {
|
|
1200
|
+
typ: EnumToken.AttrEndTokenType;
|
|
1297
1201
|
}
|
|
1298
1202
|
|
|
1299
1203
|
/**
|
|
1300
1204
|
* Parenthesis start token
|
|
1301
1205
|
*/
|
|
1302
|
-
|
|
1303
|
-
|
|
1206
|
+
declare interface ParensStartToken extends BaseToken {
|
|
1304
1207
|
typ: EnumToken.StartParensTokenType;
|
|
1305
1208
|
}
|
|
1306
1209
|
|
|
1307
1210
|
/**
|
|
1308
1211
|
* Parenthesis end token
|
|
1309
1212
|
*/
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
typ: EnumToken.EndParensTokenType
|
|
1213
|
+
declare interface ParensEndToken extends BaseToken {
|
|
1214
|
+
typ: EnumToken.EndParensTokenType;
|
|
1313
1215
|
}
|
|
1314
1216
|
|
|
1315
1217
|
/**
|
|
1316
1218
|
* Parenthesis token
|
|
1317
1219
|
*/
|
|
1318
|
-
|
|
1319
|
-
|
|
1220
|
+
declare interface ParensToken extends BaseToken {
|
|
1320
1221
|
typ: EnumToken.ParensTokenType;
|
|
1321
1222
|
chi: Token$1[];
|
|
1322
1223
|
}
|
|
@@ -1324,16 +1225,15 @@ export declare interface ParensToken extends BaseToken {
|
|
|
1324
1225
|
/**
|
|
1325
1226
|
* Whitespace token
|
|
1326
1227
|
*/
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1228
|
+
declare interface WhitespaceToken extends BaseToken {
|
|
1229
|
+
typ: EnumToken.WhitespaceTokenType;
|
|
1230
|
+
val?: string;
|
|
1330
1231
|
}
|
|
1331
1232
|
|
|
1332
1233
|
/**
|
|
1333
1234
|
* Comment token
|
|
1334
1235
|
*/
|
|
1335
|
-
|
|
1336
|
-
|
|
1236
|
+
declare interface CommentToken extends BaseToken {
|
|
1337
1237
|
typ: EnumToken.CommentTokenType;
|
|
1338
1238
|
val: string;
|
|
1339
1239
|
}
|
|
@@ -1341,8 +1241,7 @@ export declare interface CommentToken extends BaseToken {
|
|
|
1341
1241
|
/**
|
|
1342
1242
|
* Bad comment token
|
|
1343
1243
|
*/
|
|
1344
|
-
|
|
1345
|
-
|
|
1244
|
+
declare interface BadCommentToken extends BaseToken {
|
|
1346
1245
|
typ: EnumToken.BadCommentTokenType;
|
|
1347
1246
|
val: string;
|
|
1348
1247
|
}
|
|
@@ -1350,8 +1249,7 @@ export declare interface BadCommentToken extends BaseToken {
|
|
|
1350
1249
|
/**
|
|
1351
1250
|
* CDO comment token
|
|
1352
1251
|
*/
|
|
1353
|
-
|
|
1354
|
-
|
|
1252
|
+
declare interface CDOCommentToken extends BaseToken {
|
|
1355
1253
|
typ: EnumToken.CDOCOMMTokenType;
|
|
1356
1254
|
val: string;
|
|
1357
1255
|
}
|
|
@@ -1359,8 +1257,7 @@ export declare interface CDOCommentToken extends BaseToken {
|
|
|
1359
1257
|
/**
|
|
1360
1258
|
* Bad CDO comment token
|
|
1361
1259
|
*/
|
|
1362
|
-
|
|
1363
|
-
|
|
1260
|
+
declare interface BadCDOCommentToken extends BaseToken {
|
|
1364
1261
|
typ: EnumToken.BadCdoTokenType;
|
|
1365
1262
|
val: string;
|
|
1366
1263
|
}
|
|
@@ -1368,8 +1265,7 @@ export declare interface BadCDOCommentToken extends BaseToken {
|
|
|
1368
1265
|
/**
|
|
1369
1266
|
* Include match token
|
|
1370
1267
|
*/
|
|
1371
|
-
|
|
1372
|
-
|
|
1268
|
+
declare interface IncludeMatchToken extends BaseToken {
|
|
1373
1269
|
typ: EnumToken.IncludeMatchTokenType;
|
|
1374
1270
|
// val: '~=';
|
|
1375
1271
|
}
|
|
@@ -1377,8 +1273,7 @@ export declare interface IncludeMatchToken extends BaseToken {
|
|
|
1377
1273
|
/**
|
|
1378
1274
|
* Dash match token
|
|
1379
1275
|
*/
|
|
1380
|
-
|
|
1381
|
-
|
|
1276
|
+
declare interface DashMatchToken extends BaseToken {
|
|
1382
1277
|
typ: EnumToken.DashMatchTokenType;
|
|
1383
1278
|
// val: '|=';
|
|
1384
1279
|
}
|
|
@@ -1386,8 +1281,7 @@ export declare interface DashMatchToken extends BaseToken {
|
|
|
1386
1281
|
/**
|
|
1387
1282
|
* Equal match token
|
|
1388
1283
|
*/
|
|
1389
|
-
|
|
1390
|
-
|
|
1284
|
+
declare interface EqualMatchToken extends BaseToken {
|
|
1391
1285
|
typ: EnumToken.EqualMatchTokenType;
|
|
1392
1286
|
// val: '|=';
|
|
1393
1287
|
}
|
|
@@ -1395,8 +1289,7 @@ export declare interface EqualMatchToken extends BaseToken {
|
|
|
1395
1289
|
/**
|
|
1396
1290
|
* Start match token
|
|
1397
1291
|
*/
|
|
1398
|
-
|
|
1399
|
-
|
|
1292
|
+
declare interface StartMatchToken extends BaseToken {
|
|
1400
1293
|
typ: EnumToken.StartMatchTokenType;
|
|
1401
1294
|
// val: '^=';
|
|
1402
1295
|
}
|
|
@@ -1404,8 +1297,7 @@ export declare interface StartMatchToken extends BaseToken {
|
|
|
1404
1297
|
/**
|
|
1405
1298
|
* End match token
|
|
1406
1299
|
*/
|
|
1407
|
-
|
|
1408
|
-
|
|
1300
|
+
declare interface EndMatchToken extends BaseToken {
|
|
1409
1301
|
typ: EnumToken.EndMatchTokenType;
|
|
1410
1302
|
// val: '|=';
|
|
1411
1303
|
}
|
|
@@ -1413,8 +1305,7 @@ export declare interface EndMatchToken extends BaseToken {
|
|
|
1413
1305
|
/**
|
|
1414
1306
|
* Contain match token
|
|
1415
1307
|
*/
|
|
1416
|
-
|
|
1417
|
-
|
|
1308
|
+
declare interface ContainMatchToken extends BaseToken {
|
|
1418
1309
|
typ: EnumToken.ContainMatchTokenType;
|
|
1419
1310
|
// val: '|=';
|
|
1420
1311
|
}
|
|
@@ -1422,48 +1313,42 @@ export declare interface ContainMatchToken extends BaseToken {
|
|
|
1422
1313
|
/**
|
|
1423
1314
|
* Less than token
|
|
1424
1315
|
*/
|
|
1425
|
-
|
|
1426
|
-
|
|
1316
|
+
declare interface LessThanToken extends BaseToken {
|
|
1427
1317
|
typ: EnumToken.LtTokenType;
|
|
1428
1318
|
}
|
|
1429
1319
|
|
|
1430
1320
|
/**
|
|
1431
1321
|
* Less than or equal token
|
|
1432
1322
|
*/
|
|
1433
|
-
|
|
1434
|
-
|
|
1323
|
+
declare interface LessThanOrEqualToken extends BaseToken {
|
|
1435
1324
|
typ: EnumToken.LteTokenType;
|
|
1436
1325
|
}
|
|
1437
1326
|
|
|
1438
1327
|
/**
|
|
1439
1328
|
* Greater than token
|
|
1440
1329
|
*/
|
|
1441
|
-
|
|
1442
|
-
|
|
1330
|
+
declare interface GreaterThanToken extends BaseToken {
|
|
1443
1331
|
typ: EnumToken.GtTokenType;
|
|
1444
1332
|
}
|
|
1445
1333
|
|
|
1446
1334
|
/**
|
|
1447
1335
|
* Greater than or equal token
|
|
1448
1336
|
*/
|
|
1449
|
-
|
|
1450
|
-
|
|
1337
|
+
declare interface GreaterThanOrEqualToken extends BaseToken {
|
|
1451
1338
|
typ: EnumToken.GteTokenType;
|
|
1452
1339
|
}
|
|
1453
1340
|
|
|
1454
1341
|
/**
|
|
1455
1342
|
* Column combinator token
|
|
1456
1343
|
*/
|
|
1457
|
-
|
|
1458
|
-
|
|
1344
|
+
declare interface ColumnCombinatorToken extends BaseToken {
|
|
1459
1345
|
typ: EnumToken.ColumnCombinatorTokenType;
|
|
1460
1346
|
}
|
|
1461
1347
|
|
|
1462
1348
|
/**
|
|
1463
1349
|
* Pseudo class token
|
|
1464
1350
|
*/
|
|
1465
|
-
|
|
1466
|
-
|
|
1351
|
+
declare interface PseudoClassToken extends BaseToken {
|
|
1467
1352
|
typ: EnumToken.PseudoClassTokenType;
|
|
1468
1353
|
val: string;
|
|
1469
1354
|
}
|
|
@@ -1471,8 +1356,7 @@ export declare interface PseudoClassToken extends BaseToken {
|
|
|
1471
1356
|
/**
|
|
1472
1357
|
* Pseudo element token
|
|
1473
1358
|
*/
|
|
1474
|
-
|
|
1475
|
-
|
|
1359
|
+
declare interface PseudoElementToken extends BaseToken {
|
|
1476
1360
|
typ: EnumToken.PseudoElementTokenType;
|
|
1477
1361
|
val: string;
|
|
1478
1362
|
}
|
|
@@ -1480,8 +1364,7 @@ export declare interface PseudoElementToken extends BaseToken {
|
|
|
1480
1364
|
/**
|
|
1481
1365
|
* Pseudo page token
|
|
1482
1366
|
*/
|
|
1483
|
-
|
|
1484
|
-
|
|
1367
|
+
declare interface PseudoPageToken extends BaseToken {
|
|
1485
1368
|
typ: EnumToken.PseudoPageTokenType;
|
|
1486
1369
|
val: string;
|
|
1487
1370
|
}
|
|
@@ -1489,8 +1372,7 @@ export declare interface PseudoPageToken extends BaseToken {
|
|
|
1489
1372
|
/**
|
|
1490
1373
|
* Pseudo class function token
|
|
1491
1374
|
*/
|
|
1492
|
-
|
|
1493
|
-
|
|
1375
|
+
declare interface PseudoClassFunctionToken extends BaseToken {
|
|
1494
1376
|
typ: EnumToken.PseudoClassFuncTokenType;
|
|
1495
1377
|
val: string;
|
|
1496
1378
|
chi: Token$1[];
|
|
@@ -1499,200 +1381,250 @@ export declare interface PseudoClassFunctionToken extends BaseToken {
|
|
|
1499
1381
|
/**
|
|
1500
1382
|
* Delim token
|
|
1501
1383
|
*/
|
|
1502
|
-
|
|
1503
|
-
|
|
1384
|
+
declare interface DelimToken extends BaseToken {
|
|
1504
1385
|
typ: EnumToken.DelimTokenType;
|
|
1505
1386
|
}
|
|
1506
1387
|
|
|
1507
1388
|
/**
|
|
1508
1389
|
* Bad URL token
|
|
1509
1390
|
*/
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
typ: EnumToken.BadUrlTokenType,
|
|
1391
|
+
declare interface BadUrlToken extends BaseToken {
|
|
1392
|
+
typ: EnumToken.BadUrlTokenType;
|
|
1513
1393
|
val: string;
|
|
1514
1394
|
}
|
|
1515
1395
|
|
|
1516
1396
|
/**
|
|
1517
1397
|
* URL token
|
|
1518
1398
|
*/
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
typ: EnumToken.UrlTokenTokenType,
|
|
1399
|
+
declare interface UrlToken extends BaseToken {
|
|
1400
|
+
typ: EnumToken.UrlTokenTokenType;
|
|
1522
1401
|
val: string;
|
|
1523
1402
|
}
|
|
1524
1403
|
|
|
1525
1404
|
/**
|
|
1526
1405
|
* EOF token
|
|
1527
1406
|
*/
|
|
1528
|
-
|
|
1529
|
-
|
|
1407
|
+
declare interface EOFToken extends BaseToken {
|
|
1530
1408
|
typ: EnumToken.EOFTokenType;
|
|
1531
1409
|
}
|
|
1532
1410
|
|
|
1533
1411
|
/**
|
|
1534
1412
|
* Important token
|
|
1535
1413
|
*/
|
|
1536
|
-
|
|
1537
|
-
|
|
1414
|
+
declare interface ImportantToken extends BaseToken {
|
|
1538
1415
|
typ: EnumToken.ImportantTokenType;
|
|
1539
1416
|
}
|
|
1540
1417
|
|
|
1541
1418
|
/**
|
|
1542
1419
|
* Color token
|
|
1543
1420
|
*/
|
|
1544
|
-
|
|
1545
|
-
|
|
1421
|
+
declare interface ColorToken extends BaseToken {
|
|
1546
1422
|
typ: EnumToken.ColorTokenType;
|
|
1547
1423
|
val: string;
|
|
1548
|
-
kin: ColorType;
|
|
1424
|
+
kin: ColorType$1;
|
|
1549
1425
|
chi?: Token$1[];
|
|
1550
1426
|
/* calculated */
|
|
1551
|
-
cal?:
|
|
1427
|
+
cal?: "rel" | "mix" | "col";
|
|
1552
1428
|
}
|
|
1553
1429
|
|
|
1554
1430
|
/**
|
|
1555
1431
|
* Attribute token
|
|
1556
1432
|
*/
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
chi: Token$1[]
|
|
1433
|
+
declare interface AttrToken extends BaseToken {
|
|
1434
|
+
typ: EnumToken.AttrTokenType;
|
|
1435
|
+
chi: Token$1[];
|
|
1561
1436
|
}
|
|
1562
1437
|
|
|
1563
1438
|
/**
|
|
1564
1439
|
* Invalid attribute token
|
|
1565
1440
|
*/
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
chi: Token$1[]
|
|
1441
|
+
declare interface InvalidAttrToken extends BaseToken {
|
|
1442
|
+
typ: EnumToken.InvalidAttrTokenType;
|
|
1443
|
+
chi: Token$1[];
|
|
1570
1444
|
}
|
|
1571
1445
|
|
|
1572
1446
|
/**
|
|
1573
1447
|
* Child combinator token
|
|
1574
1448
|
*/
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
typ: EnumToken.ChildCombinatorTokenType
|
|
1449
|
+
declare interface ChildCombinatorToken extends BaseToken {
|
|
1450
|
+
typ: EnumToken.ChildCombinatorTokenType;
|
|
1578
1451
|
}
|
|
1579
1452
|
|
|
1580
1453
|
/**
|
|
1581
1454
|
* Media feature token
|
|
1582
1455
|
*/
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
typ: EnumToken.MediaFeatureTokenType,
|
|
1456
|
+
declare interface MediaFeatureToken extends BaseToken {
|
|
1457
|
+
typ: EnumToken.MediaFeatureTokenType;
|
|
1586
1458
|
val: string;
|
|
1587
1459
|
}
|
|
1588
1460
|
|
|
1589
1461
|
/**
|
|
1590
1462
|
* Media feature not token
|
|
1591
1463
|
*/
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
typ: EnumToken.MediaFeatureNotTokenType,
|
|
1464
|
+
declare interface NotToken extends BaseToken {
|
|
1465
|
+
typ: EnumToken.NotTokenType;
|
|
1595
1466
|
val: Token$1;
|
|
1596
1467
|
}
|
|
1597
1468
|
|
|
1598
1469
|
/**
|
|
1599
1470
|
* Media feature only token
|
|
1600
1471
|
*/
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
typ: EnumToken.MediaFeatureOnlyTokenType,
|
|
1472
|
+
declare interface MediaFeatureOnlyToken extends BaseToken {
|
|
1473
|
+
typ: EnumToken.OnlyTokenType;
|
|
1604
1474
|
val: Token$1;
|
|
1605
1475
|
}
|
|
1606
1476
|
|
|
1607
1477
|
/**
|
|
1608
1478
|
* Media feature and token
|
|
1609
1479
|
*/
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
typ: EnumToken.MediaFeatureAndTokenType;
|
|
1480
|
+
declare interface AndToken extends BaseToken {
|
|
1481
|
+
typ: EnumToken.AndTokenType;
|
|
1613
1482
|
}
|
|
1614
1483
|
|
|
1615
1484
|
/**
|
|
1616
1485
|
* Media feature or token
|
|
1617
1486
|
*/
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
typ: EnumToken.MediaFeatureOrTokenType;
|
|
1487
|
+
declare interface OrToken extends BaseToken {
|
|
1488
|
+
typ: EnumToken.OrTokenType;
|
|
1621
1489
|
}
|
|
1622
1490
|
|
|
1623
1491
|
/**
|
|
1624
1492
|
* Media query condition token
|
|
1625
1493
|
*/
|
|
1626
|
-
|
|
1494
|
+
declare interface MediaQueryUnaryFeatureToken extends BaseToken {
|
|
1495
|
+
typ: EnumToken.MediaQueryUnaryFeatureTokenType;
|
|
1496
|
+
l: Token$1;
|
|
1497
|
+
r: Token$1[];
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
declare interface SupportsQueryUnaryConditionToken extends BaseToken {
|
|
1501
|
+
typ: EnumToken.SupportsQueryUnaryConditionTokenType;
|
|
1502
|
+
l: Token$1;
|
|
1503
|
+
r: Token$1[];
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
declare interface SupportsQueryConditionToken extends BaseToken {
|
|
1507
|
+
typ: EnumToken.SupportsQueryConditionTokenType;
|
|
1508
|
+
op: AndToken | OrToken;
|
|
1509
|
+
l: Token$1[];
|
|
1510
|
+
r: Token$1[];
|
|
1511
|
+
}
|
|
1627
1512
|
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
op:
|
|
1631
|
-
|
|
1513
|
+
declare interface WhenElseQueryConditionToken extends BaseToken {
|
|
1514
|
+
typ: EnumToken.WhenElseQueryConditionTokenType;
|
|
1515
|
+
op: AndToken | OrToken;
|
|
1516
|
+
l: Token$1[];
|
|
1517
|
+
r: Token$1[];
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
declare interface WhenElseUnaryConditionToken extends BaseToken {
|
|
1521
|
+
typ: EnumToken.WhenElseUnaryConditionTokenType;
|
|
1522
|
+
l: Token$1;
|
|
1523
|
+
r: Token$1[];
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
declare interface MediaQueryConditionToken extends BaseToken {
|
|
1527
|
+
typ: EnumToken.MediaQueryConditionTokenType;
|
|
1528
|
+
l: Token$1[];
|
|
1529
|
+
op:
|
|
1530
|
+
| ColonToken
|
|
1531
|
+
| DelimToken
|
|
1532
|
+
| GreaterThanToken
|
|
1533
|
+
| LessThanToken
|
|
1534
|
+
| GreaterThanOrEqualToken
|
|
1535
|
+
| LessThanOrEqualToken
|
|
1536
|
+
| AndToken
|
|
1537
|
+
| OrToken;
|
|
1538
|
+
r: Token$1[];
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
declare interface IfConditionToken extends BaseToken {
|
|
1542
|
+
typ: EnumToken.IfConditionTokenType;
|
|
1543
|
+
l: Token$1[];
|
|
1544
|
+
r: Token$1[];
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
declare interface IfElseConditionToken extends BaseToken {
|
|
1548
|
+
typ: EnumToken.IfElseConditionTokenType;
|
|
1549
|
+
l: IfConditionToken;
|
|
1550
|
+
r: IfConditionToken;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
declare interface ContainerStyleRangeToken extends BaseToken {
|
|
1554
|
+
typ: EnumToken.ContainerStyleRangeTokenType;
|
|
1555
|
+
l: Token$1[];
|
|
1556
|
+
op: Token$1[];
|
|
1557
|
+
r: Token$1[];
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
declare interface MediaRangeQueryToken extends BaseToken {
|
|
1561
|
+
typ: EnumToken.MediaRangeQueryTokenType;
|
|
1562
|
+
l: Token$1[];
|
|
1563
|
+
val: Token$1[];
|
|
1564
|
+
op1: LessThanToken | GreaterThanToken | LessThanOrEqualToken | GreaterThanOrEqualToken;
|
|
1565
|
+
op2: LessThanToken | GreaterThanToken | LessThanOrEqualToken | GreaterThanOrEqualToken;
|
|
1566
|
+
r: Token$1[];
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
declare interface InvalidMediaQueryToken extends BaseToken {
|
|
1570
|
+
typ: EnumToken.InvalidMediaQueryTokenType;
|
|
1571
|
+
chi: Token$1[];
|
|
1632
1572
|
}
|
|
1633
1573
|
|
|
1634
1574
|
/**
|
|
1635
1575
|
* Descendant combinator token
|
|
1636
1576
|
*/
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
typ: EnumToken.DescendantCombinatorTokenType
|
|
1577
|
+
declare interface DescendantCombinatorToken extends BaseToken {
|
|
1578
|
+
typ: EnumToken.DescendantCombinatorTokenType;
|
|
1640
1579
|
}
|
|
1641
1580
|
|
|
1642
1581
|
/**
|
|
1643
1582
|
* Next sibling combinator token
|
|
1644
1583
|
*/
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
typ: EnumToken.NextSiblingCombinatorTokenType
|
|
1584
|
+
declare interface NextSiblingCombinatorToken extends BaseToken {
|
|
1585
|
+
typ: EnumToken.NextSiblingCombinatorTokenType;
|
|
1648
1586
|
}
|
|
1649
1587
|
|
|
1650
1588
|
/**
|
|
1651
1589
|
* Subsequent sibling combinator token
|
|
1652
1590
|
*/
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
typ: EnumToken.SubsequentSiblingCombinatorTokenType
|
|
1591
|
+
declare interface SubsequentCombinatorToken extends BaseToken {
|
|
1592
|
+
typ: EnumToken.SubsequentSiblingCombinatorTokenType;
|
|
1656
1593
|
}
|
|
1657
1594
|
|
|
1658
1595
|
/**
|
|
1659
1596
|
* Add token
|
|
1660
1597
|
*/
|
|
1661
|
-
|
|
1662
|
-
|
|
1598
|
+
declare interface AddToken extends BaseToken {
|
|
1663
1599
|
typ: EnumToken.Add;
|
|
1664
1600
|
}
|
|
1665
1601
|
|
|
1666
1602
|
/**
|
|
1667
1603
|
* Sub token
|
|
1668
1604
|
*/
|
|
1669
|
-
|
|
1670
|
-
|
|
1605
|
+
declare interface SubToken extends BaseToken {
|
|
1671
1606
|
typ: EnumToken.Sub;
|
|
1672
1607
|
}
|
|
1673
1608
|
|
|
1674
1609
|
/**
|
|
1675
1610
|
* Div token
|
|
1676
1611
|
*/
|
|
1677
|
-
|
|
1678
|
-
|
|
1612
|
+
declare interface DivToken extends BaseToken {
|
|
1679
1613
|
typ: EnumToken.Div;
|
|
1680
1614
|
}
|
|
1681
1615
|
|
|
1682
1616
|
/**
|
|
1683
1617
|
* Mul token
|
|
1684
1618
|
*/
|
|
1685
|
-
|
|
1686
|
-
|
|
1619
|
+
declare interface MulToken extends BaseToken {
|
|
1687
1620
|
typ: EnumToken.Mul;
|
|
1688
1621
|
}
|
|
1689
1622
|
|
|
1690
1623
|
/**
|
|
1691
1624
|
* Unary expression token
|
|
1692
1625
|
*/
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
typ: EnumToken.UnaryExpressionTokenType
|
|
1626
|
+
declare interface UnaryExpression extends BaseToken {
|
|
1627
|
+
typ: EnumToken.UnaryExpressionTokenType;
|
|
1696
1628
|
sign: EnumToken.Add | EnumToken.Sub;
|
|
1697
1629
|
val: UnaryExpressionNode;
|
|
1698
1630
|
}
|
|
@@ -1700,8 +1632,7 @@ export declare interface UnaryExpression extends BaseToken {
|
|
|
1700
1632
|
/**
|
|
1701
1633
|
* Fraction token
|
|
1702
1634
|
*/
|
|
1703
|
-
|
|
1704
|
-
|
|
1635
|
+
declare interface FractionToken extends BaseToken {
|
|
1705
1636
|
typ: EnumToken.FractionTokenType;
|
|
1706
1637
|
l: NumberToken;
|
|
1707
1638
|
r: NumberToken;
|
|
@@ -1710,9 +1641,8 @@ export declare interface FractionToken extends BaseToken {
|
|
|
1710
1641
|
/**
|
|
1711
1642
|
* Binary expression token
|
|
1712
1643
|
*/
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
typ: EnumToken.BinaryExpressionTokenType
|
|
1644
|
+
declare interface BinaryExpressionToken extends BaseToken {
|
|
1645
|
+
typ: EnumToken.BinaryExpressionTokenType;
|
|
1716
1646
|
op: EnumToken.Add | EnumToken.Sub | EnumToken.Div | EnumToken.Mul;
|
|
1717
1647
|
l: BinaryExpressionNode | Token$1;
|
|
1718
1648
|
r: BinaryExpressionNode | Token$1;
|
|
@@ -1721,21 +1651,19 @@ export declare interface BinaryExpressionToken extends BaseToken {
|
|
|
1721
1651
|
/**
|
|
1722
1652
|
* Match expression token
|
|
1723
1653
|
*/
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
typ: EnumToken.MatchExpressionTokenType
|
|
1654
|
+
declare interface MatchExpressionToken extends BaseToken {
|
|
1655
|
+
typ: EnumToken.MatchExpressionTokenType;
|
|
1727
1656
|
op: EqualMatchToken | DashMatchToken | StartMatchToken | ContainMatchToken | EndMatchToken | IncludeMatchToken;
|
|
1728
1657
|
l: Token$1;
|
|
1729
1658
|
r: Token$1;
|
|
1730
|
-
attr?:
|
|
1659
|
+
attr?: "i" | "s";
|
|
1731
1660
|
}
|
|
1732
1661
|
|
|
1733
1662
|
/**
|
|
1734
1663
|
* Name space attribute token
|
|
1735
1664
|
*/
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
typ: EnumToken.NameSpaceAttributeTokenType
|
|
1665
|
+
declare interface NameSpaceAttributeToken extends BaseToken {
|
|
1666
|
+
typ: EnumToken.NameSpaceAttributeTokenType;
|
|
1739
1667
|
l?: Token$1;
|
|
1740
1668
|
r: Token$1;
|
|
1741
1669
|
}
|
|
@@ -1743,17 +1671,15 @@ export declare interface NameSpaceAttributeToken extends BaseToken {
|
|
|
1743
1671
|
/**
|
|
1744
1672
|
* List token
|
|
1745
1673
|
*/
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
typ: EnumToken.ListToken
|
|
1674
|
+
declare interface ListToken extends BaseToken {
|
|
1675
|
+
typ: EnumToken.ListToken;
|
|
1749
1676
|
chi: Token$1[];
|
|
1750
1677
|
}
|
|
1751
1678
|
|
|
1752
1679
|
/**
|
|
1753
1680
|
* Composes selector token
|
|
1754
1681
|
*/
|
|
1755
|
-
|
|
1756
|
-
|
|
1682
|
+
declare interface ComposesSelectorToken extends BaseToken {
|
|
1757
1683
|
typ: EnumToken.ComposesSelectorTokenType;
|
|
1758
1684
|
l: Token$1[];
|
|
1759
1685
|
r: Token$1 | null;
|
|
@@ -1762,32 +1688,50 @@ export declare interface ComposesSelectorToken extends BaseToken {
|
|
|
1762
1688
|
/**
|
|
1763
1689
|
* Css variable token
|
|
1764
1690
|
*/
|
|
1765
|
-
|
|
1766
|
-
|
|
1691
|
+
declare interface CssVariableToken$1 extends BaseToken {
|
|
1767
1692
|
typ: EnumToken.CssVariableTokenType;
|
|
1768
1693
|
nam: string;
|
|
1769
1694
|
val: Token$1[];
|
|
1770
1695
|
}
|
|
1771
1696
|
|
|
1772
|
-
|
|
1773
|
-
|
|
1697
|
+
declare interface CssVariableImportTokenType$1 extends BaseToken {
|
|
1774
1698
|
typ: EnumToken.CssVariableImportTokenType;
|
|
1775
1699
|
nam: string;
|
|
1776
1700
|
val: Token$1[];
|
|
1777
1701
|
}
|
|
1778
1702
|
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
typ: EnumToken.CssVariableMapTokenType;
|
|
1703
|
+
declare interface CssVariableMapTokenType extends BaseToken {
|
|
1704
|
+
typ: EnumToken.CssVariableDeclarationMapTokenType;
|
|
1782
1705
|
vars: Token$1[];
|
|
1783
1706
|
from: Token$1[];
|
|
1784
1707
|
}
|
|
1785
1708
|
|
|
1709
|
+
declare interface FunctionDefToken extends BaseToken {
|
|
1710
|
+
typ:
|
|
1711
|
+
| EnumToken.FunctionDefTokenType
|
|
1712
|
+
| EnumToken.UrlFunctionTokenDefType
|
|
1713
|
+
| EnumToken.GridTemplateFuncTokenDefType
|
|
1714
|
+
| EnumToken.ImageFunctionTokenDefType
|
|
1715
|
+
| EnumToken.TimelineFunctionTokenDefType
|
|
1716
|
+
| EnumToken.TimingFunctionTokenDefType
|
|
1717
|
+
| EnumToken.ColorFunctionTokenDefType
|
|
1718
|
+
| EnumToken.MathFunctionTokenDefType
|
|
1719
|
+
| EnumToken.PseudoClassFunctionTokenDefType
|
|
1720
|
+
| EnumToken.TransformFunctionTokenDefType;
|
|
1721
|
+
nam: string;
|
|
1722
|
+
val: string;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
declare interface RawNodeToken extends BaseToken {
|
|
1726
|
+
typ: EnumToken.RawNodeTokenType;
|
|
1727
|
+
chi: Token$1[];
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1786
1730
|
/**
|
|
1787
1731
|
* Unary expression node
|
|
1788
1732
|
*/
|
|
1789
|
-
|
|
1790
|
-
BinaryExpressionNode
|
|
1733
|
+
declare type UnaryExpressionNode =
|
|
1734
|
+
| BinaryExpressionNode
|
|
1791
1735
|
| NumberToken
|
|
1792
1736
|
| DimensionToken
|
|
1793
1737
|
| TimeToken
|
|
@@ -1798,17 +1742,26 @@ export declare type UnaryExpressionNode =
|
|
|
1798
1742
|
/**
|
|
1799
1743
|
* Binary expression node
|
|
1800
1744
|
*/
|
|
1801
|
-
|
|
1802
|
-
|
|
1745
|
+
declare type BinaryExpressionNode =
|
|
1746
|
+
| NumberToken
|
|
1747
|
+
| DimensionToken
|
|
1748
|
+
| PercentageToken
|
|
1749
|
+
| FlexToken
|
|
1750
|
+
| FractionToken
|
|
1751
|
+
| AngleToken
|
|
1752
|
+
| LengthToken
|
|
1753
|
+
| FrequencyToken
|
|
1754
|
+
| BinaryExpressionToken
|
|
1755
|
+
| FunctionToken
|
|
1756
|
+
| ParensToken;
|
|
1803
1757
|
|
|
1804
1758
|
/**
|
|
1805
1759
|
* Token
|
|
1806
1760
|
*/
|
|
1807
|
-
|
|
1808
|
-
InvalidClassSelectorToken
|
|
1761
|
+
declare type Token$1 =
|
|
1762
|
+
| InvalidClassSelectorToken
|
|
1809
1763
|
| InvalidAttrToken
|
|
1810
|
-
|
|
|
1811
|
-
LiteralToken
|
|
1764
|
+
| LiteralToken
|
|
1812
1765
|
| IdentToken
|
|
1813
1766
|
| IdentListToken
|
|
1814
1767
|
| DashedIdentToken
|
|
@@ -1823,16 +1776,23 @@ export declare type Token$1 =
|
|
|
1823
1776
|
| SubsequentCombinatorToken
|
|
1824
1777
|
| ColumnCombinatorToken
|
|
1825
1778
|
| NestingSelectorToken
|
|
1826
|
-
|
|
|
1827
|
-
|
|
1779
|
+
| WhenElseUnaryConditionToken
|
|
1780
|
+
| WhenElseQueryConditionToken
|
|
1781
|
+
| SupportsQueryUnaryConditionToken
|
|
1782
|
+
| SupportsQueryConditionToken
|
|
1783
|
+
| MediaQueryConditionToken
|
|
1828
1784
|
| MediaFeatureToken
|
|
1829
|
-
|
|
|
1785
|
+
| MediaQueryUnaryFeatureToken
|
|
1786
|
+
| IfConditionToken
|
|
1787
|
+
| IfElseConditionToken
|
|
1788
|
+
| NotToken
|
|
1830
1789
|
| MediaFeatureOnlyToken
|
|
1831
|
-
|
|
|
1832
|
-
|
|
|
1790
|
+
| AndToken
|
|
1791
|
+
| OrToken
|
|
1792
|
+
| MediaRangeQueryToken
|
|
1793
|
+
| ContainerStyleRangeToken
|
|
1833
1794
|
| AstDeclaration
|
|
1834
|
-
|
|
|
1835
|
-
NumberToken
|
|
1795
|
+
| NumberToken
|
|
1836
1796
|
| AtRuleToken
|
|
1837
1797
|
| PercentageToken
|
|
1838
1798
|
| FlexToken
|
|
@@ -1844,27 +1804,23 @@ export declare type Token$1 =
|
|
|
1844
1804
|
| GridTemplateFuncToken
|
|
1845
1805
|
| DimensionToken
|
|
1846
1806
|
| LengthToken
|
|
1847
|
-
|
|
|
1848
|
-
AngleToken
|
|
1807
|
+
| AngleToken
|
|
1849
1808
|
| StringToken
|
|
1850
1809
|
| TimeToken
|
|
1851
1810
|
| FrequencyToken
|
|
1852
1811
|
| ResolutionToken
|
|
1853
|
-
|
|
|
1854
|
-
UnclosedStringToken
|
|
1812
|
+
| UnclosedStringToken
|
|
1855
1813
|
| HashToken
|
|
1856
1814
|
| BadStringToken
|
|
1857
1815
|
| BlockStartToken
|
|
1858
1816
|
| BlockEndToken
|
|
1859
|
-
|
|
|
1860
|
-
AttrStartToken
|
|
1817
|
+
| AttrStartToken
|
|
1861
1818
|
| AttrEndToken
|
|
1862
1819
|
| ParensStartToken
|
|
1863
1820
|
| ParensEndToken
|
|
1864
1821
|
| ParensToken
|
|
1865
1822
|
| CDOCommentToken
|
|
1866
|
-
|
|
|
1867
|
-
BadCDOCommentToken
|
|
1823
|
+
| BadCDOCommentToken
|
|
1868
1824
|
| CommentToken
|
|
1869
1825
|
| BadCommentToken
|
|
1870
1826
|
| WhitespaceToken
|
|
@@ -1876,15 +1832,13 @@ export declare type Token$1 =
|
|
|
1876
1832
|
| NameSpaceAttributeToken
|
|
1877
1833
|
| ComposesSelectorToken
|
|
1878
1834
|
| CssVariableToken$1
|
|
1879
|
-
|
|
|
1880
|
-
DashMatchToken
|
|
1835
|
+
| DashMatchToken
|
|
1881
1836
|
| EqualMatchToken
|
|
1882
1837
|
| LessThanToken
|
|
1883
1838
|
| LessThanOrEqualToken
|
|
1884
1839
|
| GreaterThanToken
|
|
1885
1840
|
| GreaterThanOrEqualToken
|
|
1886
|
-
|
|
|
1887
|
-
ListToken
|
|
1841
|
+
| ListToken
|
|
1888
1842
|
| PseudoClassToken
|
|
1889
1843
|
| PseudoPageToken
|
|
1890
1844
|
| PseudoElementToken
|
|
@@ -1893,200 +1847,24 @@ export declare type Token$1 =
|
|
|
1893
1847
|
| BinaryExpressionToken
|
|
1894
1848
|
| UnaryExpression
|
|
1895
1849
|
| FractionToken
|
|
1896
|
-
|
|
|
1897
|
-
AddToken
|
|
1850
|
+
| AddToken
|
|
1898
1851
|
| SubToken
|
|
1899
1852
|
| DivToken
|
|
1900
1853
|
| MulToken
|
|
1901
|
-
|
|
|
1902
|
-
BadUrlToken
|
|
1854
|
+
| BadUrlToken
|
|
1903
1855
|
| UrlToken
|
|
1904
1856
|
| ImportantToken
|
|
1905
1857
|
| ColorToken
|
|
1906
1858
|
| AttrToken
|
|
1859
|
+
| FunctionDefToken
|
|
1860
|
+
| RawNodeToken
|
|
1861
|
+
| InvalidMediaQueryToken
|
|
1907
1862
|
| EOFToken;
|
|
1908
1863
|
|
|
1909
|
-
declare enum ValidationTokenEnum {
|
|
1910
|
-
Root = 0,
|
|
1911
|
-
Keyword = 1,
|
|
1912
|
-
PropertyType = 2,
|
|
1913
|
-
DeclarationType = 3,
|
|
1914
|
-
AtRule = 4,
|
|
1915
|
-
ValidationFunctionDefinition = 5,
|
|
1916
|
-
OpenBracket = 6,
|
|
1917
|
-
CloseBracket = 7,
|
|
1918
|
-
OpenParenthesis = 8,
|
|
1919
|
-
CloseParenthesis = 9,
|
|
1920
|
-
Comma = 10,
|
|
1921
|
-
Pipe = 11,
|
|
1922
|
-
Column = 12,
|
|
1923
|
-
Star = 13,
|
|
1924
|
-
OpenCurlyBrace = 14,
|
|
1925
|
-
CloseCurlyBrace = 15,
|
|
1926
|
-
HashMark = 16,
|
|
1927
|
-
QuestionMark = 17,
|
|
1928
|
-
Function = 18,
|
|
1929
|
-
Number = 19,
|
|
1930
|
-
Whitespace = 20,
|
|
1931
|
-
Parenthesis = 21,
|
|
1932
|
-
Bracket = 22,
|
|
1933
|
-
Block = 23,
|
|
1934
|
-
AtLeastOnce = 24,
|
|
1935
|
-
Separator = 25,
|
|
1936
|
-
Exclamation = 26,
|
|
1937
|
-
Ampersand = 27,
|
|
1938
|
-
PipeToken = 28,
|
|
1939
|
-
ColumnToken = 29,
|
|
1940
|
-
AmpersandToken = 30,
|
|
1941
|
-
Parens = 31,
|
|
1942
|
-
PseudoClassToken = 32,
|
|
1943
|
-
PseudoClassFunctionToken = 33,
|
|
1944
|
-
StringToken = 34,
|
|
1945
|
-
AtRuleDefinition = 35,
|
|
1946
|
-
DeclarationNameToken = 36,
|
|
1947
|
-
DeclarationDefinitionToken = 37,
|
|
1948
|
-
SemiColon = 38,
|
|
1949
|
-
Character = 39,
|
|
1950
|
-
InfinityToken = 40
|
|
1951
|
-
}
|
|
1952
|
-
declare const enum ValidationSyntaxGroupEnum {
|
|
1953
|
-
Declarations = "declarations",
|
|
1954
|
-
Functions = "functions",
|
|
1955
|
-
Syntaxes = "syntaxes",
|
|
1956
|
-
Selectors = "selectors",
|
|
1957
|
-
AtRules = "atRules"
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
interface Position$1 {
|
|
1961
|
-
|
|
1962
|
-
ind: number;
|
|
1963
|
-
lin: number;
|
|
1964
|
-
col: number;
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
interface ValidationToken$1 {
|
|
1968
|
-
|
|
1969
|
-
typ: ValidationTokenEnum;
|
|
1970
|
-
pos: Position$1;
|
|
1971
|
-
isList?: boolean;
|
|
1972
|
-
text?: string;
|
|
1973
|
-
isRepeatable?: boolean;
|
|
1974
|
-
atLeastOnce?: boolean;
|
|
1975
|
-
isOptional?: boolean;
|
|
1976
|
-
isRepeatableGroup?: boolean;
|
|
1977
|
-
occurence?: {
|
|
1978
|
-
min: number;
|
|
1979
|
-
max: number | null;
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
export declare interface ValidationSyntaxNode {
|
|
1984
|
-
|
|
1985
|
-
syntax: string;
|
|
1986
|
-
ast?: ValidationToken$1[];
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
interface ValidationSelectorOptions extends ValidationOptions {
|
|
1990
|
-
|
|
1991
|
-
nestedSelector?: boolean;
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
export declare interface ValidationConfiguration {
|
|
1995
|
-
|
|
1996
|
-
[ValidationSyntaxGroupEnum.Declarations]: ValidationSyntaxNode;
|
|
1997
|
-
[ValidationSyntaxGroupEnum.Functions]: ValidationSyntaxNode;
|
|
1998
|
-
[ValidationSyntaxGroupEnum.Syntaxes]: ValidationSyntaxNode;
|
|
1999
|
-
[ValidationSyntaxGroupEnum.Selectors]: ValidationSyntaxNode;
|
|
2000
|
-
[ValidationSyntaxGroupEnum.AtRules]: ValidationSyntaxNode;
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
//= Record<keyof ValidationSyntaxGroupEnum, ValidationSyntaxNode>;
|
|
2004
|
-
|
|
2005
|
-
interface ValidationResult {
|
|
2006
|
-
|
|
2007
|
-
valid: SyntaxValidationResult;
|
|
2008
|
-
node: AstNode$1 | Token$1 | null;
|
|
2009
|
-
syntax: ValidationToken$1 | string | null;
|
|
2010
|
-
error: string;
|
|
2011
|
-
cycle?: boolean;
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
interface ValidationSyntaxResult extends ValidationResult {
|
|
2015
|
-
|
|
2016
|
-
syntax: ValidationToken$1 | string | null;
|
|
2017
|
-
context: Context<Token$1> | Token$1[];
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
interface Context<Type> {
|
|
2021
|
-
|
|
2022
|
-
index: number;
|
|
2023
|
-
|
|
2024
|
-
/**
|
|
2025
|
-
* The length of the context tokens to be consumed
|
|
2026
|
-
*/
|
|
2027
|
-
|
|
2028
|
-
readonly length: number;
|
|
2029
|
-
|
|
2030
|
-
current<Type>(): Type | null;
|
|
2031
|
-
|
|
2032
|
-
update<Type>(context: Context<Type>): void;
|
|
2033
|
-
|
|
2034
|
-
consume<Type>(token: Type, howMany?: number): boolean;
|
|
2035
|
-
|
|
2036
|
-
peek<Type>(): Type | null;
|
|
2037
|
-
|
|
2038
|
-
// tokens<Type>(): Type[];
|
|
2039
|
-
|
|
2040
|
-
next<Type>(): Type | null;
|
|
2041
|
-
|
|
2042
|
-
consume<Type>(token: Type, howMany?: number): boolean;
|
|
2043
|
-
|
|
2044
|
-
slice<Type>(): Type[];
|
|
2045
|
-
|
|
2046
|
-
clone<Type>(): Context<Type>;
|
|
2047
|
-
|
|
2048
|
-
done(): boolean;
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
/**
|
|
2052
|
-
* Converts a color to another color space
|
|
2053
|
-
* @param token
|
|
2054
|
-
* @param to
|
|
2055
|
-
*
|
|
2056
|
-
* @private
|
|
2057
|
-
*
|
|
2058
|
-
* <code>
|
|
2059
|
-
*
|
|
2060
|
-
* const token = {typ: EnumToken.ColorTokenType, kin: ColorType.HEX, val: '#F00'}
|
|
2061
|
-
* const result = convertColor(token, ColorType.LCH);
|
|
2062
|
-
*
|
|
2063
|
-
* </code>
|
|
2064
|
-
*/
|
|
2065
|
-
declare function convertColor(token: ColorToken, to: ColorType): ColorToken | null;
|
|
2066
|
-
|
|
2067
|
-
/**
|
|
2068
|
-
* Calculate the distance between two okLab colors.
|
|
2069
|
-
* @param okLab1
|
|
2070
|
-
* @param okLab2
|
|
2071
|
-
*
|
|
2072
|
-
* @private
|
|
2073
|
-
*/
|
|
2074
|
-
declare function okLabDistance(okLab1: [number, number, number], okLab2: [number, number, number]): number;
|
|
2075
|
-
/**
|
|
2076
|
-
* Check if two colors are close in okLab space.
|
|
2077
|
-
* @param color1
|
|
2078
|
-
* @param color2
|
|
2079
|
-
* @param threshold
|
|
2080
|
-
*
|
|
2081
|
-
* @private
|
|
2082
|
-
*/
|
|
2083
|
-
declare function isOkLabClose(color1: ColorToken, color2: ColorToken, threshold?: number): boolean;
|
|
2084
|
-
|
|
2085
1864
|
/**
|
|
2086
1865
|
* Position
|
|
2087
1866
|
*/
|
|
2088
|
-
|
|
2089
|
-
|
|
1867
|
+
declare interface Position$1 {
|
|
2090
1868
|
/**
|
|
2091
1869
|
* index in the source
|
|
2092
1870
|
*/
|
|
@@ -2104,24 +1882,22 @@ export declare interface Position {
|
|
|
2104
1882
|
/**
|
|
2105
1883
|
* token or node location
|
|
2106
1884
|
*/
|
|
2107
|
-
|
|
2108
|
-
|
|
1885
|
+
declare interface Location {
|
|
2109
1886
|
/**
|
|
2110
1887
|
* start position
|
|
2111
1888
|
*/
|
|
2112
|
-
sta: Position;
|
|
1889
|
+
sta: Position$1;
|
|
2113
1890
|
/**
|
|
2114
1891
|
* end position
|
|
2115
1892
|
*/
|
|
2116
|
-
end: Position;
|
|
1893
|
+
end: Position$1;
|
|
2117
1894
|
/**
|
|
2118
1895
|
* source file
|
|
2119
1896
|
*/
|
|
2120
1897
|
src: string;
|
|
2121
1898
|
}
|
|
2122
1899
|
|
|
2123
|
-
|
|
2124
|
-
|
|
1900
|
+
declare interface BaseToken {
|
|
2125
1901
|
/**
|
|
2126
1902
|
* token type
|
|
2127
1903
|
*/
|
|
@@ -2147,9 +1923,8 @@ export declare interface BaseToken {
|
|
|
2147
1923
|
/**
|
|
2148
1924
|
* comment node
|
|
2149
1925
|
*/
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
typ: EnumToken.CommentNodeType | EnumToken.CDOCOMMNodeType,
|
|
1926
|
+
declare interface AstComment extends BaseToken {
|
|
1927
|
+
typ: EnumToken.CommentNodeType | EnumToken.CDOCOMMNodeType;
|
|
2153
1928
|
tokens?: null;
|
|
2154
1929
|
val: string;
|
|
2155
1930
|
}
|
|
@@ -2157,22 +1932,22 @@ export declare interface AstComment extends BaseToken {
|
|
|
2157
1932
|
/**
|
|
2158
1933
|
* declaration node
|
|
2159
1934
|
*/
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
nam: string,
|
|
1935
|
+
declare interface AstDeclaration extends BaseToken {
|
|
1936
|
+
nam: string;
|
|
2163
1937
|
tokens?: null;
|
|
2164
1938
|
val: Token$1[];
|
|
2165
|
-
typ: EnumToken.DeclarationNodeType
|
|
1939
|
+
typ: EnumToken.DeclarationNodeType;
|
|
2166
1940
|
}
|
|
2167
1941
|
|
|
2168
1942
|
/**
|
|
2169
1943
|
* rule node
|
|
2170
1944
|
*/
|
|
2171
|
-
|
|
2172
|
-
|
|
1945
|
+
declare interface AstRule extends BaseToken {
|
|
2173
1946
|
typ: EnumToken.RuleNodeType;
|
|
2174
1947
|
sel: string;
|
|
2175
|
-
chi: Array<
|
|
1948
|
+
chi: Array<
|
|
1949
|
+
AstDeclaration | AstComment | AstRule | AstAtRule | AstInvalidRule | AstInvalidDeclaration | AstInvalidAtRule
|
|
1950
|
+
>;
|
|
2176
1951
|
optimized?: OptimizedSelector | null;
|
|
2177
1952
|
raw?: RawSelectorTokens | null;
|
|
2178
1953
|
}
|
|
@@ -2180,9 +1955,8 @@ export declare interface AstRule extends BaseToken {
|
|
|
2180
1955
|
/**
|
|
2181
1956
|
* invalid rule node
|
|
2182
1957
|
*/
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
typ: EnumToken.InvalidRuleTokenType;
|
|
1958
|
+
declare interface AstInvalidRule extends BaseToken {
|
|
1959
|
+
typ: EnumToken.InvalidRuleNodeType;
|
|
2186
1960
|
sel: string;
|
|
2187
1961
|
chi: Array<AstNode$1>;
|
|
2188
1962
|
}
|
|
@@ -2190,8 +1964,7 @@ export declare interface AstInvalidRule extends BaseToken {
|
|
|
2190
1964
|
/**
|
|
2191
1965
|
* invalid declaration node
|
|
2192
1966
|
*/
|
|
2193
|
-
|
|
2194
|
-
|
|
1967
|
+
declare interface AstInvalidDeclaration extends BaseToken {
|
|
2195
1968
|
typ: EnumToken.InvalidDeclarationNodeType;
|
|
2196
1969
|
tokens?: null;
|
|
2197
1970
|
val: Array<Token$1>;
|
|
@@ -2200,9 +1973,8 @@ export declare interface AstInvalidDeclaration extends BaseToken {
|
|
|
2200
1973
|
/**
|
|
2201
1974
|
* invalid at rule node
|
|
2202
1975
|
*/
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
typ: EnumToken.InvalidAtRuleTokenType;
|
|
1976
|
+
declare interface AstInvalidAtRule extends BaseToken {
|
|
1977
|
+
typ: EnumToken.InvalidAtRuleNodeType;
|
|
2206
1978
|
nam: string;
|
|
2207
1979
|
val: string;
|
|
2208
1980
|
chi?: Array<AstNode$1>;
|
|
@@ -2211,30 +1983,29 @@ export declare interface AstInvalidAtRule extends BaseToken {
|
|
|
2211
1983
|
/**
|
|
2212
1984
|
* keyframe rule node
|
|
2213
1985
|
*/
|
|
2214
|
-
|
|
2215
|
-
|
|
1986
|
+
declare interface AstKeyFrameRule extends BaseToken {
|
|
2216
1987
|
typ: EnumToken.KeyFramesRuleNodeType;
|
|
2217
1988
|
sel: string;
|
|
2218
1989
|
chi: Array<AstDeclaration | AstComment | AstInvalidDeclaration>;
|
|
2219
1990
|
optimized?: OptimizedSelector;
|
|
2220
1991
|
raw?: RawSelectorTokens;
|
|
2221
|
-
tokens?: Token$1[]
|
|
1992
|
+
tokens?: Token$1[];
|
|
2222
1993
|
}
|
|
2223
1994
|
|
|
2224
1995
|
/**
|
|
2225
1996
|
* raw selector tokens
|
|
2226
1997
|
*/
|
|
2227
|
-
|
|
1998
|
+
declare type RawSelectorTokens = string[][];
|
|
2228
1999
|
|
|
2229
2000
|
/**
|
|
2230
2001
|
* optimized selector
|
|
2231
2002
|
*
|
|
2232
2003
|
* @private
|
|
2233
2004
|
*/
|
|
2234
|
-
|
|
2005
|
+
declare interface OptimizedSelector {
|
|
2235
2006
|
match: boolean;
|
|
2236
2007
|
optimized: string[];
|
|
2237
|
-
selector: string[][]
|
|
2008
|
+
selector: string[][];
|
|
2238
2009
|
reducible: boolean;
|
|
2239
2010
|
}
|
|
2240
2011
|
|
|
@@ -2243,29 +2014,27 @@ export declare interface OptimizedSelector {
|
|
|
2243
2014
|
*
|
|
2244
2015
|
* @private
|
|
2245
2016
|
*/
|
|
2246
|
-
|
|
2017
|
+
declare interface OptimizedSelectorToken {
|
|
2247
2018
|
match: boolean;
|
|
2248
2019
|
optimized: Token$1[];
|
|
2249
|
-
selector: Token$1[][]
|
|
2020
|
+
selector: Token$1[][];
|
|
2250
2021
|
reducible: boolean;
|
|
2251
2022
|
}
|
|
2252
2023
|
|
|
2253
2024
|
/**
|
|
2254
2025
|
* at rule node
|
|
2255
2026
|
*/
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
typ: EnumToken.AtRuleNodeType,
|
|
2027
|
+
declare interface AstAtRule extends BaseToken {
|
|
2028
|
+
typ: EnumToken.AtRuleNodeType;
|
|
2259
2029
|
nam: string;
|
|
2260
2030
|
val: string;
|
|
2261
|
-
chi?: Array<
|
|
2031
|
+
chi?: Array<AstNode$1>;
|
|
2262
2032
|
}
|
|
2263
2033
|
|
|
2264
2034
|
/**
|
|
2265
2035
|
* keyframe rule node
|
|
2266
2036
|
*/
|
|
2267
|
-
|
|
2268
|
-
|
|
2037
|
+
declare interface AstKeyframesRule extends BaseToken {
|
|
2269
2038
|
typ: EnumToken.KeyFramesRuleNodeType;
|
|
2270
2039
|
sel: string;
|
|
2271
2040
|
chi: Array<AstDeclaration | AstInvalidDeclaration | AstComment | AstRuleList>;
|
|
@@ -2276,9 +2045,8 @@ export declare interface AstKeyframesRule extends BaseToken {
|
|
|
2276
2045
|
/**
|
|
2277
2046
|
* keyframe at rule node
|
|
2278
2047
|
*/
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
typ: EnumToken.KeyframesAtRuleNodeType,
|
|
2048
|
+
declare interface AstKeyframesAtRule extends BaseToken {
|
|
2049
|
+
typ: EnumToken.KeyframesAtRuleNodeType;
|
|
2282
2050
|
nam: string;
|
|
2283
2051
|
val: string;
|
|
2284
2052
|
chi: Array<AstKeyframesRule | AstComment>;
|
|
@@ -2287,8 +2055,8 @@ export declare interface AstKeyframesAtRule extends BaseToken {
|
|
|
2287
2055
|
/**
|
|
2288
2056
|
* rule list node
|
|
2289
2057
|
*/
|
|
2290
|
-
|
|
2291
|
-
AstStyleSheet
|
|
2058
|
+
declare type AstRuleList =
|
|
2059
|
+
| AstStyleSheet
|
|
2292
2060
|
| AstAtRule
|
|
2293
2061
|
| AstRule
|
|
2294
2062
|
| AstKeyframesAtRule
|
|
@@ -2298,60 +2066,234 @@ export declare type AstRuleList =
|
|
|
2298
2066
|
/**
|
|
2299
2067
|
* stylesheet node
|
|
2300
2068
|
*/
|
|
2301
|
-
|
|
2302
|
-
typ: EnumToken.StyleSheetNodeType
|
|
2303
|
-
chi: Array<AstRule | AstAtRule | astKeyframesAtRule | AstComment | AstInvalidAtRule | AstInvalidRule>;
|
|
2304
|
-
tokens?: null;
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2069
|
+
declare interface AstStyleSheet extends BaseToken {
|
|
2070
|
+
typ: EnumToken.StyleSheetNodeType;
|
|
2071
|
+
chi: Array<AstRule | AstAtRule | astKeyframesAtRule | AstComment | AstInvalidAtRule | AstInvalidRule>;
|
|
2072
|
+
tokens?: null;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* ast node
|
|
2077
|
+
*/
|
|
2078
|
+
declare type AstNode$1 =
|
|
2079
|
+
| AstStyleSheet
|
|
2080
|
+
| AstRuleList
|
|
2081
|
+
| AstComment
|
|
2082
|
+
| AstAtRule
|
|
2083
|
+
| AstRule
|
|
2084
|
+
| AstDeclaration
|
|
2085
|
+
| AstKeyframesAtRule
|
|
2086
|
+
| AstKeyFrameRule
|
|
2087
|
+
| AstInvalidRule
|
|
2088
|
+
| AstInvalidAtRule
|
|
2089
|
+
| AstInvalidDeclaration
|
|
2090
|
+
| CssVariableToken
|
|
2091
|
+
| CssVariableImportTokenType;
|
|
2092
|
+
|
|
2093
|
+
|
|
2094
|
+
interface TokenSearchResult {
|
|
2095
|
+
node: Token$1 | null;
|
|
2096
|
+
parent: AstNode$1 | Token$1 | null;
|
|
2097
|
+
root: AstNode$1 | Token$1 | null;
|
|
2098
|
+
parents: Generator<Token$1> | null;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
type AstValueMatcher = ((value: Token$1) => boolean) | ((token: Token$1, node: AstNode$1) => boolean);
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* options for the walk function
|
|
2105
|
+
*/
|
|
2106
|
+
declare enum WalkerOptionEnum {
|
|
2107
|
+
/**
|
|
2108
|
+
* ignore the current node and its children
|
|
2109
|
+
*/
|
|
2110
|
+
Ignore = 1,
|
|
2111
|
+
/**
|
|
2112
|
+
* stop walking the tree
|
|
2113
|
+
*/
|
|
2114
|
+
Stop = 2,
|
|
2115
|
+
/**
|
|
2116
|
+
* ignore the current node and process its children
|
|
2117
|
+
*/
|
|
2118
|
+
Children = 4,
|
|
2119
|
+
/**
|
|
2120
|
+
* ignore the current node children
|
|
2121
|
+
*/
|
|
2122
|
+
IgnoreChildren = 8
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* event types for the walkValues function
|
|
2126
|
+
*/
|
|
2127
|
+
declare enum WalkerEvent {
|
|
2128
|
+
/**
|
|
2129
|
+
* enter node
|
|
2130
|
+
*/
|
|
2131
|
+
Enter = 1,
|
|
2132
|
+
/**
|
|
2133
|
+
* leave node
|
|
2134
|
+
*/
|
|
2135
|
+
Leave = 2
|
|
2136
|
+
}
|
|
2137
|
+
/**
|
|
2138
|
+
* walk ast nodes
|
|
2139
|
+
* @param node initial node
|
|
2140
|
+
* @param filter control the walk process
|
|
2141
|
+
* @param reverse walk in reverse order
|
|
2142
|
+
*
|
|
2143
|
+
* ```ts
|
|
2144
|
+
*
|
|
2145
|
+
* import {walk} from '@tbela99/css-parser';
|
|
2146
|
+
*
|
|
2147
|
+
* const css = `
|
|
2148
|
+
* body { color: color(from var(--base-color) display-p3 r calc(g + 0.24) calc(b + 0.15)); }
|
|
2149
|
+
*
|
|
2150
|
+
* html,
|
|
2151
|
+
* body {
|
|
2152
|
+
* line-height: 1.474;
|
|
2153
|
+
* }
|
|
2154
|
+
*
|
|
2155
|
+
* .ruler {
|
|
2156
|
+
*
|
|
2157
|
+
* height: 10px;
|
|
2158
|
+
* }
|
|
2159
|
+
* `;
|
|
2160
|
+
*
|
|
2161
|
+
* for (const {node, parent, root} of walk(ast)) {
|
|
2162
|
+
*
|
|
2163
|
+
* // do something with node
|
|
2164
|
+
* }
|
|
2165
|
+
* ```
|
|
2166
|
+
*
|
|
2167
|
+
* Using a {@link filter} function to control the ast traversal. the filter function returns a value of type {@link WalkerOption}.
|
|
2168
|
+
*
|
|
2169
|
+
* ```ts
|
|
2170
|
+
* import {EnumToken, transform, walk, WalkerOptionEnum} from '@tbela99/css-parser';
|
|
2171
|
+
*
|
|
2172
|
+
* const css = `
|
|
2173
|
+
* body { color: color(from var(--base-color) display-p3 r calc(g + 0.24) calc(b + 0.15)); }
|
|
2174
|
+
*
|
|
2175
|
+
* html,
|
|
2176
|
+
* body {
|
|
2177
|
+
* line-height: 1.474;
|
|
2178
|
+
* }
|
|
2179
|
+
*
|
|
2180
|
+
* .ruler {
|
|
2181
|
+
*
|
|
2182
|
+
* height: 10px;
|
|
2183
|
+
* }
|
|
2184
|
+
* `;
|
|
2185
|
+
*
|
|
2186
|
+
* function filter(node) {
|
|
2187
|
+
*
|
|
2188
|
+
* if (node.typ == EnumToken.AstRule && node.sel.includes('html')) {
|
|
2189
|
+
*
|
|
2190
|
+
* // skip the children of the current node
|
|
2191
|
+
* return WalkerOptionEnum.IgnoreChildren;
|
|
2192
|
+
* }
|
|
2193
|
+
* }
|
|
2194
|
+
*
|
|
2195
|
+
* const result = await transform(css);
|
|
2196
|
+
* for (const {node} of walk(result.ast, filter)) {
|
|
2197
|
+
*
|
|
2198
|
+
* console.error([EnumToken[node.typ]]);
|
|
2199
|
+
* }
|
|
2200
|
+
*
|
|
2201
|
+
* // [ "StyleSheetNodeType" ]
|
|
2202
|
+
* // [ "RuleNodeType" ]
|
|
2203
|
+
* // [ "DeclarationNodeType" ]
|
|
2204
|
+
* // [ "RuleNodeType" ]
|
|
2205
|
+
* // [ "DeclarationNodeType" ]
|
|
2206
|
+
* // [ "RuleNodeType" ]
|
|
2207
|
+
* // [ "DeclarationNodeType" ]
|
|
2208
|
+
* ```
|
|
2209
|
+
*/
|
|
2210
|
+
declare function walk(node: AstNode$1, filter?: WalkerFilter | null, reverse?: boolean): Generator<WalkResult>;
|
|
2307
2211
|
/**
|
|
2308
|
-
* ast node
|
|
2212
|
+
* walk ast node value tokens
|
|
2213
|
+
* @param values
|
|
2214
|
+
* @param root
|
|
2215
|
+
* @param filter
|
|
2216
|
+
* @param reverse
|
|
2217
|
+
*
|
|
2218
|
+
* Example:
|
|
2219
|
+
*
|
|
2220
|
+
* ```ts
|
|
2221
|
+
*
|
|
2222
|
+
* import {AstDeclaration, EnumToken, transform, walkValues} from '@tbela99/css-parser';
|
|
2223
|
+
*
|
|
2224
|
+
* const css = `
|
|
2225
|
+
* body { color: color(from var(--base-color) display-p3 r calc(g + 0.24) calc(b + 0.15)); }
|
|
2226
|
+
* `;
|
|
2227
|
+
*
|
|
2228
|
+
* const result = await transform(css);
|
|
2229
|
+
* const declaration = result.ast.chi[0].chi[0] as AstDeclaration;
|
|
2230
|
+
*
|
|
2231
|
+
* // walk the node attribute's tokens in reverse order
|
|
2232
|
+
* for (const {value} of walkValues(declaration.val, null, null,true)) {
|
|
2233
|
+
*
|
|
2234
|
+
* console.error([EnumToken[value.typ], value.val]);
|
|
2235
|
+
* }
|
|
2236
|
+
*
|
|
2237
|
+
* // [ "Color", "color" ]
|
|
2238
|
+
* // [ "FunctionTokenType", "calc" ]
|
|
2239
|
+
* // [ "Number", 0.15 ]
|
|
2240
|
+
* // [ "Add", undefined ]
|
|
2241
|
+
* // [ "Iden", "b" ]
|
|
2242
|
+
* // [ "Whitespace", undefined ]
|
|
2243
|
+
* // [ "FunctionTokenType", "calc" ]
|
|
2244
|
+
* // [ "Number", 0.24 ]
|
|
2245
|
+
* // [ "Add", undefined ]
|
|
2246
|
+
* // [ "Iden", "g" ]
|
|
2247
|
+
* // [ "Whitespace", undefined ]
|
|
2248
|
+
* // [ "Iden", "r" ]
|
|
2249
|
+
* // [ "Whitespace", undefined ]
|
|
2250
|
+
* // [ "Iden", "display-p3" ]
|
|
2251
|
+
* // [ "Whitespace", undefined ]
|
|
2252
|
+
* // [ "FunctionTokenType", "var" ]
|
|
2253
|
+
* // [ "DashedIden", "--base-color" ]
|
|
2254
|
+
* // [ "Whitespace", undefined ]
|
|
2255
|
+
* // [ "Iden", "from" ]
|
|
2256
|
+
* ```
|
|
2309
2257
|
*/
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
|
2314
|
-
|
|
2315
|
-
| AstRule
|
|
2316
|
-
| AstDeclaration
|
|
2317
|
-
| AstKeyframesAtRule
|
|
2318
|
-
| AstKeyFrameRule
|
|
2319
|
-
| AstInvalidRule
|
|
2320
|
-
| AstInvalidAtRule
|
|
2321
|
-
| AstInvalidDeclaration
|
|
2322
|
-
| CssVariableToken
|
|
2323
|
-
| CssVariableImportTokenType;
|
|
2258
|
+
declare function walkValues(values: Token$1[], root?: AstNode$1 | Token$1 | null, filter?: WalkerValueFilter | null | {
|
|
2259
|
+
event?: WalkerEvent;
|
|
2260
|
+
fn?: WalkerValueFilter;
|
|
2261
|
+
type?: EnumToken | EnumToken[] | ((token: Token$1) => boolean);
|
|
2262
|
+
}, reverse?: boolean): Generator<WalkAttributesResult>;
|
|
2324
2263
|
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2264
|
+
declare type GenericVisitorResult<T> = T | T[] | Promise<T> | Promise<T[]> | null | Promise<null>;
|
|
2265
|
+
declare type GenericVisitorHandler<T> = (
|
|
2266
|
+
node: T,
|
|
2267
|
+
parent?: AstNode | Token,
|
|
2268
|
+
root?: AstNode | Token,
|
|
2269
|
+
) => GenericVisitorResult<T>;
|
|
2270
|
+
declare type GenericVisitorAstNodeHandlerMap<T> =
|
|
2271
|
+
| Record<string, GenericVisitorHandler<T>>
|
|
2329
2272
|
| GenericVisitorHandler<T>
|
|
2330
|
-
| { type: WalkerEvent
|
|
2331
|
-
| { type: WalkerEvent
|
|
2273
|
+
| { type: WalkerEvent; handler: GenericVisitorHandler<T> }
|
|
2274
|
+
| { type: WalkerEvent; handler: Record<string, GenericVisitorHandler<T>> };
|
|
2332
2275
|
|
|
2333
|
-
|
|
2276
|
+
declare type ValueVisitorHandler = GenericVisitorHandler<Token>;
|
|
2334
2277
|
|
|
2335
2278
|
/**
|
|
2336
2279
|
* Declaration visitor handler
|
|
2337
2280
|
*/
|
|
2338
|
-
|
|
2281
|
+
declare type DeclarationVisitorHandler = GenericVisitorHandler<AstDeclaration>;
|
|
2339
2282
|
/**
|
|
2340
2283
|
* Rule visitor handler
|
|
2341
2284
|
*/
|
|
2342
|
-
|
|
2285
|
+
declare type RuleVisitorHandler = GenericVisitorHandler<AstRule>;
|
|
2343
2286
|
|
|
2344
2287
|
/**
|
|
2345
2288
|
* AtRule visitor handler
|
|
2346
2289
|
*/
|
|
2347
|
-
|
|
2290
|
+
declare type AtRuleVisitorHandler = GenericVisitorHandler<AstAtRule>;
|
|
2348
2291
|
|
|
2349
2292
|
/**
|
|
2350
2293
|
* node visitor callback map
|
|
2351
2294
|
*
|
|
2352
2295
|
*/
|
|
2353
|
-
|
|
2354
|
-
|
|
2296
|
+
declare interface VisitorNodeMap {
|
|
2355
2297
|
/**
|
|
2356
2298
|
* at rule visitor
|
|
2357
2299
|
*
|
|
@@ -2596,10 +2538,36 @@ export declare interface VisitorNodeMap {
|
|
|
2596
2538
|
* // body {color:#f3fff0}
|
|
2597
2539
|
* ```
|
|
2598
2540
|
*/
|
|
2599
|
-
[key
|
|
2541
|
+
[key: keyof typeof EnumToken]: GenericVisitorAstNodeHandlerMap<Token> | GenericVisitorAstNodeHandlerMap<AstNode>;
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
/**
|
|
2545
|
+
* Source map class
|
|
2546
|
+
* @internal
|
|
2547
|
+
*/
|
|
2548
|
+
declare class SourceMap {
|
|
2549
|
+
#private;
|
|
2550
|
+
/**
|
|
2551
|
+
* Last location
|
|
2552
|
+
*/
|
|
2553
|
+
lastLocation: Location | null;
|
|
2554
|
+
/**
|
|
2555
|
+
* Add a location
|
|
2556
|
+
* @param source
|
|
2557
|
+
* @param original
|
|
2558
|
+
*/
|
|
2559
|
+
add(source: Location, original: Location): void;
|
|
2560
|
+
/**
|
|
2561
|
+
* Convert to URL encoded string
|
|
2562
|
+
*/
|
|
2563
|
+
toUrl(): string;
|
|
2564
|
+
/**
|
|
2565
|
+
* Convert to JSON object
|
|
2566
|
+
*/
|
|
2567
|
+
toJSON(): SourceMapObject;
|
|
2600
2568
|
}
|
|
2601
2569
|
|
|
2602
|
-
|
|
2570
|
+
declare interface PropertyListOptions {
|
|
2603
2571
|
|
|
2604
2572
|
removeDuplicateDeclarations?: boolean | string | string[];
|
|
2605
2573
|
computeShorthand?: boolean;
|
|
@@ -2608,7 +2576,12 @@ export declare interface PropertyListOptions {
|
|
|
2608
2576
|
/**
|
|
2609
2577
|
* parse info
|
|
2610
2578
|
*/
|
|
2611
|
-
|
|
2579
|
+
declare interface ParseInfo$1 {
|
|
2580
|
+
|
|
2581
|
+
/**
|
|
2582
|
+
* source file or url
|
|
2583
|
+
*/
|
|
2584
|
+
src: string;
|
|
2612
2585
|
|
|
2613
2586
|
/**
|
|
2614
2587
|
* read buffer
|
|
@@ -2618,19 +2591,30 @@ export declare interface ParseInfo {
|
|
|
2618
2591
|
* stream
|
|
2619
2592
|
*/
|
|
2620
2593
|
stream: string;
|
|
2594
|
+
|
|
2595
|
+
/**
|
|
2596
|
+
* the accumulated css string
|
|
2597
|
+
*/
|
|
2598
|
+
// acc: string;
|
|
2599
|
+
|
|
2621
2600
|
/**
|
|
2622
2601
|
* last token position
|
|
2623
2602
|
*/
|
|
2624
|
-
position: Position;
|
|
2603
|
+
position: Position$1;
|
|
2625
2604
|
/**
|
|
2626
2605
|
* current parsing position
|
|
2627
2606
|
*/
|
|
2628
|
-
currentPosition: Position;
|
|
2607
|
+
currentPosition: Position$1;
|
|
2629
2608
|
|
|
2630
2609
|
/**
|
|
2631
2610
|
* offset
|
|
2632
2611
|
*/
|
|
2633
2612
|
offset: number;
|
|
2613
|
+
|
|
2614
|
+
/**
|
|
2615
|
+
* tokenizing time
|
|
2616
|
+
*/
|
|
2617
|
+
time: number;
|
|
2634
2618
|
}
|
|
2635
2619
|
|
|
2636
2620
|
/**
|
|
@@ -2649,18 +2633,159 @@ declare enum FeatureWalkMode {
|
|
|
2649
2633
|
Post = 2
|
|
2650
2634
|
}
|
|
2651
2635
|
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2636
|
+
declare enum ValidationTokenEnum {
|
|
2637
|
+
Root = 0,
|
|
2638
|
+
Keyword = 1,
|
|
2639
|
+
PropertyType = 2,
|
|
2640
|
+
DeclarationType = 3,
|
|
2641
|
+
AtRule = 4,
|
|
2642
|
+
FunctionDefinition = 5,
|
|
2643
|
+
OpenBracket = 6,
|
|
2644
|
+
CloseBracket = 7,
|
|
2645
|
+
OpenParenthesis = 8,
|
|
2646
|
+
CloseParenthesis = 9,
|
|
2647
|
+
Comma = 10,
|
|
2648
|
+
Pipe = 11,
|
|
2649
|
+
Column = 12,
|
|
2650
|
+
Star = 13,
|
|
2651
|
+
OpenCurlyBrace = 14,
|
|
2652
|
+
CloseCurlyBrace = 15,
|
|
2653
|
+
HashMark = 16,
|
|
2654
|
+
QuestionMark = 17,
|
|
2655
|
+
Function = 18,
|
|
2656
|
+
Number = 19,
|
|
2657
|
+
Whitespace = 20,
|
|
2658
|
+
Parenthesis = 21,
|
|
2659
|
+
Bracket = 22,
|
|
2660
|
+
Block = 23,
|
|
2661
|
+
Plus = 24,
|
|
2662
|
+
Separator = 25,
|
|
2663
|
+
Exclamation = 26,
|
|
2664
|
+
Ampersand = 27,
|
|
2665
|
+
PipeToken = 28,
|
|
2666
|
+
ColumnToken = 29,
|
|
2667
|
+
AmpersandToken = 30,
|
|
2668
|
+
Parens = 31,
|
|
2669
|
+
PseudoClassToken = 32,
|
|
2670
|
+
PseudoClassFunctionToken = 33,
|
|
2671
|
+
StringToken = 34,
|
|
2672
|
+
AtRuleDefinition = 35,
|
|
2673
|
+
DeclarationNameToken = 36,
|
|
2674
|
+
DeclarationDefinitionToken = 37,
|
|
2675
|
+
SemiColon = 38,
|
|
2676
|
+
Character = 39,
|
|
2677
|
+
InfinityToken = 40,
|
|
2678
|
+
LessThan = 41,
|
|
2679
|
+
GreaterThan = 42,
|
|
2680
|
+
/**
|
|
2681
|
+
* end of token stream
|
|
2682
|
+
*/
|
|
2683
|
+
EOF = 43,
|
|
2684
|
+
/**
|
|
2685
|
+
* optional group or tokens, used to group validation tokens
|
|
2686
|
+
*
|
|
2687
|
+
* ```ts
|
|
2688
|
+
* // <bg-layer>#? , <final-bg-layer> -> [<bg-layer>#? ,]? <final-bg-layer>
|
|
2689
|
+
* // , <angular-color-stop> ]#? -> [, <angular-color-stop> ]#?]?
|
|
2690
|
+
* ```
|
|
2691
|
+
*/
|
|
2692
|
+
OptionalGroupToken = 44,
|
|
2693
|
+
/**
|
|
2694
|
+
* dimension token
|
|
2695
|
+
*
|
|
2696
|
+
* ```ts
|
|
2697
|
+
* // <time [0s,∞]> -> {
|
|
2698
|
+
* // typ: ValidationTokenEnum.PropertyType
|
|
2699
|
+
* // val: 'time',
|
|
2700
|
+
* // range: {
|
|
2701
|
+
* // min: ValidationNumberToken,
|
|
2702
|
+
* // max: null | ValidationNumberToken | ValidationInfinityToken
|
|
2703
|
+
* // }
|
|
2704
|
+
* // }
|
|
2705
|
+
* ```
|
|
2706
|
+
*/
|
|
2707
|
+
Dimension = 45,
|
|
2708
|
+
DisallowWhitespace = 46,
|
|
2709
|
+
Colon = 47
|
|
2710
|
+
}
|
|
2711
|
+
declare enum ValidationSyntaxGroupEnum {
|
|
2712
|
+
Declarations = "declarations",
|
|
2713
|
+
Functions = "functions",
|
|
2714
|
+
Syntaxes = "syntaxes",
|
|
2715
|
+
Selectors = "selectors",
|
|
2716
|
+
AtRules = "atRules",
|
|
2717
|
+
Units = "units",
|
|
2718
|
+
Languages = "languages",
|
|
2719
|
+
mediaFeatures = "mediaFeatures"
|
|
2720
|
+
}
|
|
2721
|
+
declare enum MediaFeatureType {
|
|
2722
|
+
BooleanType = "boolean",
|
|
2723
|
+
IntergerType = "integer",
|
|
2724
|
+
KeywordType = "keyword",
|
|
2725
|
+
LengthType = "length",
|
|
2726
|
+
NumberType = "number",
|
|
2727
|
+
RatioType = "ratio",
|
|
2728
|
+
ResolutionType = "resolution",
|
|
2729
|
+
StringType = "string"
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
interface Position {
|
|
2733
|
+
|
|
2734
|
+
ind: number;
|
|
2735
|
+
lin: number;
|
|
2736
|
+
col: number;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
interface ValidationValueRangeMatch {
|
|
2740
|
+
min: ValidationNumberToken;
|
|
2741
|
+
max: ValidationNumberToken | null;
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
interface ValidationDimensionRangeMatch {
|
|
2745
|
+
min: ValidationDimensionToken;
|
|
2746
|
+
max: ValidationDimensionToken | null;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
interface ValidationToken$1 {
|
|
2750
|
+
|
|
2751
|
+
typ: ValidationTokenEnum;
|
|
2752
|
+
pos: Position;
|
|
2753
|
+
// a#
|
|
2754
|
+
isList?: boolean;
|
|
2755
|
+
text?: string;
|
|
2756
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax
|
|
2757
|
+
// a*
|
|
2758
|
+
isRepeatable?: boolean;
|
|
2759
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax
|
|
2760
|
+
// a+
|
|
2761
|
+
isRepeatableAtLeastOnce?: boolean;
|
|
2762
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax
|
|
2763
|
+
// a?
|
|
2764
|
+
isOptional?: boolean;
|
|
2765
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax
|
|
2766
|
+
// a!
|
|
2767
|
+
isMandatatoryGroup?: boolean;
|
|
2768
|
+
// a{1,2}
|
|
2769
|
+
match?: {
|
|
2770
|
+
min: ValidationNumberToken;
|
|
2771
|
+
max: ValidationNumberToken | null;
|
|
2772
|
+
},
|
|
2773
|
+
range?: ValidationValueRangeMatch | ValidationDimensionRangeMatch
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
interface ValidationNumberToken extends ValidationToken$1 {
|
|
2777
|
+
|
|
2778
|
+
typ: ValidationTokenEnum.Number;
|
|
2779
|
+
val: number;
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
interface ValidationDimensionToken extends ValidationToken$1 {
|
|
2783
|
+
|
|
2784
|
+
typ: ValidationTokenEnum.AtRuleName;
|
|
2785
|
+
val: number;
|
|
2786
|
+
unitText: string;
|
|
2787
|
+
unit: keyof EnumToken
|
|
2788
|
+
}
|
|
2664
2789
|
|
|
2665
2790
|
interface PropertyType {
|
|
2666
2791
|
|
|
@@ -2678,6 +2803,10 @@ interface ShorthandPropertyType {
|
|
|
2678
2803
|
typ: keyof EnumToken;
|
|
2679
2804
|
val: string
|
|
2680
2805
|
};
|
|
2806
|
+
valueSeparator?: {
|
|
2807
|
+
typ: keyof EnumToken;
|
|
2808
|
+
val: string
|
|
2809
|
+
};
|
|
2681
2810
|
keywords: string[];
|
|
2682
2811
|
}
|
|
2683
2812
|
|
|
@@ -2760,7 +2889,7 @@ interface ShorthandType {
|
|
|
2760
2889
|
/**
|
|
2761
2890
|
* @private
|
|
2762
2891
|
*/
|
|
2763
|
-
|
|
2892
|
+
declare interface PropertiesConfig {
|
|
2764
2893
|
properties: PropertiesConfigProperties;
|
|
2765
2894
|
map: Map$1;
|
|
2766
2895
|
}
|
|
@@ -3160,7 +3289,18 @@ interface BorderRadius {
|
|
|
3160
3289
|
/**
|
|
3161
3290
|
* node walker option
|
|
3162
3291
|
*/
|
|
3163
|
-
|
|
3292
|
+
declare type WalkerOption = WalkerOptionEnum | AstNode$1 | Token$1 | null;
|
|
3293
|
+
/**
|
|
3294
|
+
* returned value:
|
|
3295
|
+
* - {@link WalkerOptionEnum.Ignore}: ignore this node and its children
|
|
3296
|
+
* - {@link WalkerOptionEnum.Stop}: stop walking the tree
|
|
3297
|
+
* - {@link WalkerOptionEnum.Children}: walk the children and ignore the current node
|
|
3298
|
+
* - {@link WalkerOptionEnum.IgnoreChildren}: walk the node and ignore children
|
|
3299
|
+
* - {@link AstNode}:
|
|
3300
|
+
* - {@link Token}:
|
|
3301
|
+
*/
|
|
3302
|
+
declare type WalkerFilter = (node: AstNode$1) => WalkerOption;
|
|
3303
|
+
|
|
3164
3304
|
/**
|
|
3165
3305
|
* returned value:
|
|
3166
3306
|
* - {@link WalkerOptionEnum.Ignore}: ignore this node and its children
|
|
@@ -3170,37 +3310,38 @@ export declare type WalkerOption = WalkerOptionEnum | AstNode$1 | Token$1 | null
|
|
|
3170
3310
|
* - {@link AstNode}:
|
|
3171
3311
|
* - {@link Token}:
|
|
3172
3312
|
*/
|
|
3173
|
-
|
|
3313
|
+
declare type WalkerValueFilter = (
|
|
3314
|
+
node: AstNode$1 | Token$1,
|
|
3315
|
+
parent?: AstNode$1 | Token$1 | AstNode$1[] | Token$1[] | null,
|
|
3316
|
+
event?: WalkerEvent,
|
|
3317
|
+
parents?: Generator<Token$1>,
|
|
3318
|
+
) => WalkerOption | null;
|
|
3174
3319
|
|
|
3175
|
-
|
|
3176
|
-
* filter nodes
|
|
3177
|
-
*/
|
|
3178
|
-
export declare type WalkerValueFilter = (node: AstNode$1 | Token$1, parent?: AstNode$1 | Token$1 | AstNode$1[] | Token$1[] | null, event?: WalkerEvent) => WalkerOption | null;
|
|
3179
|
-
|
|
3180
|
-
export declare interface WalkResult {
|
|
3320
|
+
declare interface WalkResult {
|
|
3181
3321
|
node: AstNode$1;
|
|
3182
3322
|
parent?: AstRuleList;
|
|
3183
3323
|
root?: AstNode$1;
|
|
3324
|
+
parents: Generator<AstNode$1>;
|
|
3184
3325
|
}
|
|
3185
3326
|
|
|
3186
|
-
|
|
3327
|
+
declare interface WalkAttributesResult {
|
|
3187
3328
|
value: Token$1;
|
|
3188
3329
|
previousValue: Token$1 | null;
|
|
3189
3330
|
nextValue: Token$1 | null;
|
|
3190
3331
|
root?: AstNode$1 | Token$1 | null;
|
|
3191
3332
|
parent: AstNode$1 | Token$1 | null;
|
|
3333
|
+
parents: Generator<Token$1>;
|
|
3192
3334
|
}
|
|
3193
3335
|
|
|
3194
3336
|
/**
|
|
3195
3337
|
* error description
|
|
3196
3338
|
*/
|
|
3197
|
-
|
|
3198
|
-
|
|
3339
|
+
declare interface ErrorDescription {
|
|
3199
3340
|
/**
|
|
3200
3341
|
* drop rule or declaration
|
|
3201
3342
|
*/
|
|
3202
3343
|
|
|
3203
|
-
action:
|
|
3344
|
+
action: "drop" | "ignore";
|
|
3204
3345
|
/**
|
|
3205
3346
|
* error message
|
|
3206
3347
|
*/
|
|
@@ -3208,7 +3349,7 @@ export declare interface ErrorDescription {
|
|
|
3208
3349
|
/**
|
|
3209
3350
|
* syntax error description
|
|
3210
3351
|
*/
|
|
3211
|
-
syntax?: string | null;
|
|
3352
|
+
syntax?: string | ValidationToken$1 | null;
|
|
3212
3353
|
/**
|
|
3213
3354
|
* error node
|
|
3214
3355
|
*/
|
|
@@ -3232,46 +3373,58 @@ export declare interface ErrorDescription {
|
|
|
3232
3373
|
*/
|
|
3233
3374
|
interface ValidationOptions {
|
|
3234
3375
|
|
|
3376
|
+
/**
|
|
3377
|
+
* nested rule context
|
|
3378
|
+
*/
|
|
3379
|
+
nestedRule?: boolean;
|
|
3380
|
+
|
|
3235
3381
|
/**
|
|
3236
3382
|
* enable css validation
|
|
3237
3383
|
*
|
|
3238
3384
|
* see {@link ValidationLevel}
|
|
3239
3385
|
*/
|
|
3240
3386
|
validation?: boolean | ValidationLevel;
|
|
3387
|
+
|
|
3241
3388
|
/**
|
|
3242
3389
|
* lenient validation. retain nodes that failed validation
|
|
3243
3390
|
*/
|
|
3244
3391
|
lenient?: boolean;
|
|
3392
|
+
|
|
3245
3393
|
/**
|
|
3246
3394
|
* visited tokens
|
|
3247
3395
|
*
|
|
3248
3396
|
* @private
|
|
3249
3397
|
*/
|
|
3250
|
-
visited?:
|
|
3398
|
+
visited?: Map<Token$1, Set<ValidationToken$1>>;
|
|
3399
|
+
|
|
3251
3400
|
/**
|
|
3252
3401
|
* is optional
|
|
3253
3402
|
*
|
|
3254
3403
|
* @private
|
|
3255
3404
|
*/
|
|
3256
3405
|
isOptional?: boolean | null;
|
|
3406
|
+
|
|
3257
3407
|
/**
|
|
3258
3408
|
* is repeatable
|
|
3259
3409
|
*
|
|
3260
3410
|
* @private
|
|
3261
3411
|
*/
|
|
3262
3412
|
isRepeatable?: boolean | null;
|
|
3413
|
+
|
|
3263
3414
|
/**
|
|
3264
3415
|
* is list
|
|
3265
3416
|
*
|
|
3266
3417
|
* @private
|
|
3267
3418
|
*/
|
|
3268
3419
|
isList?: boolean | null;
|
|
3420
|
+
|
|
3269
3421
|
/**
|
|
3270
3422
|
* occurence
|
|
3271
3423
|
*
|
|
3272
3424
|
* @private
|
|
3273
3425
|
*/
|
|
3274
3426
|
occurrence?: boolean | null;
|
|
3427
|
+
|
|
3275
3428
|
/**
|
|
3276
3429
|
* at least once
|
|
3277
3430
|
*
|
|
@@ -3284,7 +3437,6 @@ interface ValidationOptions {
|
|
|
3284
3437
|
* minify options
|
|
3285
3438
|
*/
|
|
3286
3439
|
interface MinifyOptions {
|
|
3287
|
-
|
|
3288
3440
|
/**
|
|
3289
3441
|
* enable minification
|
|
3290
3442
|
*/
|
|
@@ -3361,14 +3513,13 @@ interface MinifyOptions {
|
|
|
3361
3513
|
pass?: number;
|
|
3362
3514
|
}
|
|
3363
3515
|
|
|
3364
|
-
|
|
3365
|
-
Promise<ReadableStream<Uint8Array>>
|
|
3516
|
+
declare type LoadResult =
|
|
3517
|
+
| Promise<ReadableStream<Uint8Array>>
|
|
3366
3518
|
| ReadableStream<Uint8Array>
|
|
3367
3519
|
| string
|
|
3368
3520
|
| Promise<string>;
|
|
3369
3521
|
|
|
3370
|
-
|
|
3371
|
-
|
|
3522
|
+
declare interface ModuleOptions {
|
|
3372
3523
|
/**
|
|
3373
3524
|
* use local scope vs global scope
|
|
3374
3525
|
*/
|
|
@@ -3470,7 +3621,7 @@ export declare interface ModuleOptions {
|
|
|
3470
3621
|
* - {@link ModuleCaseTransformEnum.DashCaseOnly}: dashCase {@link ParseResult.mapping} key name and the scoped class name
|
|
3471
3622
|
*
|
|
3472
3623
|
*/
|
|
3473
|
-
naming?: ModuleCaseTransformEnum
|
|
3624
|
+
naming?: ModuleCaseTransformEnum;
|
|
3474
3625
|
|
|
3475
3626
|
/**
|
|
3476
3627
|
* optional function to generate scoped name
|
|
@@ -3483,15 +3634,15 @@ export declare interface ModuleOptions {
|
|
|
3483
3634
|
localName: string,
|
|
3484
3635
|
filePath: string,
|
|
3485
3636
|
pattern: string,
|
|
3486
|
-
hashLength?: number
|
|
3637
|
+
hashLength?: number,
|
|
3487
3638
|
) => string | Promise<string>;
|
|
3488
3639
|
}
|
|
3489
3640
|
|
|
3490
3641
|
/**
|
|
3491
3642
|
* parser options
|
|
3492
3643
|
*/
|
|
3493
|
-
|
|
3494
|
-
|
|
3644
|
+
declare interface ParserOptions
|
|
3645
|
+
extends MinifyOptions, MinifyFeatureOptions, ValidationOptions, PropertyListOptions {
|
|
3495
3646
|
/**
|
|
3496
3647
|
* source file to be used for sourcemap
|
|
3497
3648
|
*/
|
|
@@ -3499,7 +3650,7 @@ export declare interface ParserOptions extends MinifyOptions, MinifyFeatureOptio
|
|
|
3499
3650
|
/**
|
|
3500
3651
|
* include sourcemap in the ast. sourcemap info is always generated
|
|
3501
3652
|
*/
|
|
3502
|
-
sourcemap?: boolean |
|
|
3653
|
+
sourcemap?: boolean | "inline";
|
|
3503
3654
|
/**
|
|
3504
3655
|
* remove at-rule charset
|
|
3505
3656
|
*/
|
|
@@ -3518,6 +3669,12 @@ export declare interface ParserOptions extends MinifyOptions, MinifyFeatureOptio
|
|
|
3518
3669
|
* expand nested rules
|
|
3519
3670
|
*/
|
|
3520
3671
|
expandNestingRules?: boolean;
|
|
3672
|
+
|
|
3673
|
+
/**
|
|
3674
|
+
* experimental, convert css if() function into legacy syntax.
|
|
3675
|
+
*/
|
|
3676
|
+
expandIfSyntax?: boolean;
|
|
3677
|
+
|
|
3521
3678
|
/**
|
|
3522
3679
|
* url and file loader
|
|
3523
3680
|
* @param url
|
|
@@ -3525,7 +3682,11 @@ export declare interface ParserOptions extends MinifyOptions, MinifyFeatureOptio
|
|
|
3525
3682
|
* @param responseType
|
|
3526
3683
|
*
|
|
3527
3684
|
*/
|
|
3528
|
-
load?: (
|
|
3685
|
+
load?: (
|
|
3686
|
+
url: string,
|
|
3687
|
+
currentDirectory: string,
|
|
3688
|
+
responseType?: boolean | ResponseType,
|
|
3689
|
+
) => Promise<string | ArrayBuffer | ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
3529
3690
|
/**
|
|
3530
3691
|
* get directory name
|
|
3531
3692
|
* @param path
|
|
@@ -3544,7 +3705,11 @@ export declare interface ParserOptions extends MinifyOptions, MinifyFeatureOptio
|
|
|
3544
3705
|
* @param currentWorkingDirectory
|
|
3545
3706
|
*
|
|
3546
3707
|
*/
|
|
3547
|
-
resolve?: (
|
|
3708
|
+
resolve?: (
|
|
3709
|
+
url: string,
|
|
3710
|
+
currentUrl: string,
|
|
3711
|
+
currentWorkingDirectory?: string,
|
|
3712
|
+
) => {
|
|
3548
3713
|
absolute: string;
|
|
3549
3714
|
relative: string;
|
|
3550
3715
|
};
|
|
@@ -3583,7 +3748,13 @@ export declare interface ParserOptions extends MinifyOptions, MinifyFeatureOptio
|
|
|
3583
3748
|
/**
|
|
3584
3749
|
* css modules options
|
|
3585
3750
|
*/
|
|
3586
|
-
module?: boolean | ModuleCaseTransformEnum | ModuleScopeEnumOptions | ModuleOptions
|
|
3751
|
+
module?: boolean | ModuleCaseTransformEnum | ModuleScopeEnumOptions | ModuleOptions;
|
|
3752
|
+
|
|
3753
|
+
/**
|
|
3754
|
+
* tokenizing info
|
|
3755
|
+
* @private
|
|
3756
|
+
*/
|
|
3757
|
+
parseInfo?: ParseInfo;
|
|
3587
3758
|
}
|
|
3588
3759
|
|
|
3589
3760
|
/**
|
|
@@ -3591,8 +3762,7 @@ export declare interface ParserOptions extends MinifyOptions, MinifyFeatureOptio
|
|
|
3591
3762
|
*
|
|
3592
3763
|
* @internal
|
|
3593
3764
|
*/
|
|
3594
|
-
|
|
3595
|
-
|
|
3765
|
+
declare interface MinifyFeatureOptions {
|
|
3596
3766
|
/**
|
|
3597
3767
|
* minify features
|
|
3598
3768
|
*
|
|
@@ -3606,8 +3776,7 @@ export declare interface MinifyFeatureOptions {
|
|
|
3606
3776
|
*
|
|
3607
3777
|
* @internal
|
|
3608
3778
|
*/
|
|
3609
|
-
|
|
3610
|
-
|
|
3779
|
+
declare interface MinifyFeature {
|
|
3611
3780
|
/**
|
|
3612
3781
|
* accepted tokens
|
|
3613
3782
|
*/
|
|
@@ -3634,16 +3803,22 @@ export declare interface MinifyFeature {
|
|
|
3634
3803
|
* @param context
|
|
3635
3804
|
* @param mode
|
|
3636
3805
|
*/
|
|
3637
|
-
run: (
|
|
3638
|
-
|
|
3639
|
-
|
|
3806
|
+
run: (
|
|
3807
|
+
ast: AstRule | AstAtRule,
|
|
3808
|
+
options: ParserOptions,
|
|
3809
|
+
parent: AstRule | AstAtRule | AstStyleSheet,
|
|
3810
|
+
context: {
|
|
3811
|
+
[key: string]: any;
|
|
3812
|
+
},
|
|
3813
|
+
mode: FeatureWalkMode,
|
|
3814
|
+
) => AstNode$1 | null;
|
|
3640
3815
|
}
|
|
3641
3816
|
|
|
3642
3817
|
/**
|
|
3643
3818
|
* resolved path
|
|
3644
3819
|
* @internal
|
|
3645
3820
|
*/
|
|
3646
|
-
|
|
3821
|
+
declare interface ResolvedPath {
|
|
3647
3822
|
/**
|
|
3648
3823
|
* absolute path
|
|
3649
3824
|
*/
|
|
@@ -3657,8 +3832,7 @@ export declare interface ResolvedPath {
|
|
|
3657
3832
|
/**
|
|
3658
3833
|
* ast node render options
|
|
3659
3834
|
*/
|
|
3660
|
-
|
|
3661
|
-
|
|
3835
|
+
declare interface RenderOptions {
|
|
3662
3836
|
/**
|
|
3663
3837
|
* minify css values.
|
|
3664
3838
|
*/
|
|
@@ -3698,7 +3872,7 @@ export declare interface RenderOptions {
|
|
|
3698
3872
|
/**
|
|
3699
3873
|
* generate sourcemap object. 'inline' will embed it in the css
|
|
3700
3874
|
*/
|
|
3701
|
-
sourcemap?: boolean |
|
|
3875
|
+
sourcemap?: boolean | "inline";
|
|
3702
3876
|
/**
|
|
3703
3877
|
* indent string
|
|
3704
3878
|
*/
|
|
@@ -3739,14 +3913,12 @@ export declare interface RenderOptions {
|
|
|
3739
3913
|
/**
|
|
3740
3914
|
* transform options
|
|
3741
3915
|
*/
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
}
|
|
3916
|
+
declare interface TransformOptions extends ParserOptions, RenderOptions {}
|
|
3745
3917
|
|
|
3746
3918
|
/**
|
|
3747
3919
|
* parse result stats object
|
|
3748
3920
|
*/
|
|
3749
|
-
|
|
3921
|
+
declare interface ParseResultStats {
|
|
3750
3922
|
/**
|
|
3751
3923
|
* source file
|
|
3752
3924
|
*/
|
|
@@ -3759,12 +3931,18 @@ export declare interface ParseResultStats {
|
|
|
3759
3931
|
* bytes read from imported files
|
|
3760
3932
|
*/
|
|
3761
3933
|
importedBytesIn: number;
|
|
3934
|
+
|
|
3935
|
+
/**
|
|
3936
|
+
* tokenizing processing time
|
|
3937
|
+
*/
|
|
3938
|
+
|
|
3939
|
+
tokenize: string;
|
|
3762
3940
|
/**
|
|
3763
|
-
*
|
|
3941
|
+
* parsing processing time
|
|
3764
3942
|
*/
|
|
3765
3943
|
parse: string;
|
|
3766
3944
|
/**
|
|
3767
|
-
*
|
|
3945
|
+
* minification processing time
|
|
3768
3946
|
*/
|
|
3769
3947
|
minify: string;
|
|
3770
3948
|
/**
|
|
@@ -3778,7 +3956,7 @@ export declare interface ParseResultStats {
|
|
|
3778
3956
|
/**
|
|
3779
3957
|
* imported files stats
|
|
3780
3958
|
*/
|
|
3781
|
-
imports: ParseResultStats[]
|
|
3959
|
+
imports: ParseResultStats[];
|
|
3782
3960
|
|
|
3783
3961
|
/**
|
|
3784
3962
|
* nodes count
|
|
@@ -3794,7 +3972,7 @@ export declare interface ParseResultStats {
|
|
|
3794
3972
|
/**
|
|
3795
3973
|
* parse result object
|
|
3796
3974
|
*/
|
|
3797
|
-
|
|
3975
|
+
declare interface ParseResult {
|
|
3798
3976
|
/**
|
|
3799
3977
|
* parsed ast tree
|
|
3800
3978
|
*/
|
|
@@ -3827,7 +4005,7 @@ export declare interface ParseResult {
|
|
|
3827
4005
|
/**
|
|
3828
4006
|
* render result object
|
|
3829
4007
|
*/
|
|
3830
|
-
|
|
4008
|
+
declare interface RenderResult {
|
|
3831
4009
|
/**
|
|
3832
4010
|
* rendered css
|
|
3833
4011
|
*/
|
|
@@ -3844,18 +4022,17 @@ export declare interface RenderResult {
|
|
|
3844
4022
|
* render time
|
|
3845
4023
|
*/
|
|
3846
4024
|
total: string;
|
|
3847
|
-
}
|
|
4025
|
+
};
|
|
3848
4026
|
/**
|
|
3849
4027
|
* source map
|
|
3850
4028
|
*/
|
|
3851
|
-
map?: SourceMap
|
|
4029
|
+
map?: SourceMap;
|
|
3852
4030
|
}
|
|
3853
4031
|
|
|
3854
4032
|
/**
|
|
3855
4033
|
* transform result object
|
|
3856
4034
|
*/
|
|
3857
|
-
|
|
3858
|
-
|
|
4035
|
+
declare interface TransformResult extends ParseResult, RenderResult {
|
|
3859
4036
|
/**
|
|
3860
4037
|
* transform stats
|
|
3861
4038
|
*/
|
|
@@ -3896,40 +4073,23 @@ export declare interface TransformResult extends ParseResult, RenderResult {
|
|
|
3896
4073
|
* imported files stats
|
|
3897
4074
|
*/
|
|
3898
4075
|
imports: ParseResultStats[];
|
|
3899
|
-
}
|
|
4076
|
+
};
|
|
3900
4077
|
}
|
|
3901
4078
|
|
|
3902
4079
|
/**
|
|
3903
4080
|
* parse token options
|
|
3904
4081
|
*/
|
|
3905
|
-
|
|
3906
|
-
}
|
|
4082
|
+
declare interface ParseTokenOptions extends ParserOptions {}
|
|
3907
4083
|
|
|
3908
4084
|
/**
|
|
3909
4085
|
* tokenize result object
|
|
3910
4086
|
* @internal
|
|
3911
4087
|
*/
|
|
3912
|
-
|
|
4088
|
+
declare interface TokenizeResult {
|
|
3913
4089
|
/**
|
|
3914
4090
|
* token
|
|
3915
4091
|
*/
|
|
3916
|
-
token:
|
|
3917
|
-
/**
|
|
3918
|
-
* token length
|
|
3919
|
-
*/
|
|
3920
|
-
len: number;
|
|
3921
|
-
/**
|
|
3922
|
-
* token type hint
|
|
3923
|
-
*/
|
|
3924
|
-
hint?: EnumToken;
|
|
3925
|
-
/**
|
|
3926
|
-
* token start position
|
|
3927
|
-
*/
|
|
3928
|
-
sta: Position;
|
|
3929
|
-
/**
|
|
3930
|
-
* token end position
|
|
3931
|
-
*/
|
|
3932
|
-
end: Position;
|
|
4092
|
+
token: Token$1;
|
|
3933
4093
|
/**
|
|
3934
4094
|
* bytes in
|
|
3935
4095
|
*/
|
|
@@ -3940,7 +4100,7 @@ export declare interface TokenizeResult {
|
|
|
3940
4100
|
* matched selector object
|
|
3941
4101
|
* @internal
|
|
3942
4102
|
*/
|
|
3943
|
-
|
|
4103
|
+
declare interface MatchedSelector {
|
|
3944
4104
|
/**
|
|
3945
4105
|
* matched selector
|
|
3946
4106
|
*/
|
|
@@ -3956,14 +4116,14 @@ export declare interface MatchedSelector {
|
|
|
3956
4116
|
/**
|
|
3957
4117
|
* selectors partially match
|
|
3958
4118
|
*/
|
|
3959
|
-
eq: boolean
|
|
4119
|
+
eq: boolean;
|
|
3960
4120
|
}
|
|
3961
4121
|
|
|
3962
4122
|
/**
|
|
3963
4123
|
* variable scope info object
|
|
3964
4124
|
* @internal
|
|
3965
4125
|
*/
|
|
3966
|
-
|
|
4126
|
+
declare interface VariableScopeInfo {
|
|
3967
4127
|
/**
|
|
3968
4128
|
* global scope
|
|
3969
4129
|
*/
|
|
@@ -3994,7 +4154,7 @@ export declare interface VariableScopeInfo {
|
|
|
3994
4154
|
* source map object
|
|
3995
4155
|
* @internal
|
|
3996
4156
|
*/
|
|
3997
|
-
|
|
4157
|
+
declare interface SourceMapObject {
|
|
3998
4158
|
version: number;
|
|
3999
4159
|
file?: string;
|
|
4000
4160
|
sourceRoot?: string;
|
|
@@ -4042,6 +4202,313 @@ declare enum ResponseType$1 {
|
|
|
4042
4202
|
ArrayBuffer = 2
|
|
4043
4203
|
}
|
|
4044
4204
|
|
|
4205
|
+
declare interface ValidationSyntaxNode {
|
|
4206
|
+
syntax: string;
|
|
4207
|
+
ast?: ValidationToken[];
|
|
4208
|
+
descriptors?: Record<string, Record<string, string>>;
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4211
|
+
interface ValidationSelectorOptions extends ValidationOptions {
|
|
4212
|
+
nestedSelector?: boolean;
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
declare interface ValidationMediaFeature {
|
|
4216
|
+
type: MediaFeatureType;
|
|
4217
|
+
status?: string;
|
|
4218
|
+
category: string;
|
|
4219
|
+
values?: Array<string> | Array<number>;
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4222
|
+
declare type ValidationConfiguration = Record<
|
|
4223
|
+
ValidationSyntaxGroupEnum,
|
|
4224
|
+
ValidationSyntaxNode | Record<string, string[]> | Record<string, ValidationMediaFeature>
|
|
4225
|
+
>;
|
|
4226
|
+
|
|
4227
|
+
interface ValidationResult {
|
|
4228
|
+
valid: SyntaxValidationResult;
|
|
4229
|
+
node: AstNode$1 | Token$1 | null;
|
|
4230
|
+
syntax: ValidationToken | string | null;
|
|
4231
|
+
error: string;
|
|
4232
|
+
cycle?: boolean;
|
|
4233
|
+
}
|
|
4234
|
+
|
|
4235
|
+
interface ValidationSyntaxResult extends ValidationResult {
|
|
4236
|
+
syntax: ValidationToken | string | null;
|
|
4237
|
+
context: Context<Token$1> | Token$1[];
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4240
|
+
interface Context<Type> {
|
|
4241
|
+
index: number;
|
|
4242
|
+
|
|
4243
|
+
/**
|
|
4244
|
+
* The length of the context tokens to be consumed
|
|
4245
|
+
*/
|
|
4246
|
+
|
|
4247
|
+
readonly length: number;
|
|
4248
|
+
|
|
4249
|
+
current<Type>(): Type | null;
|
|
4250
|
+
|
|
4251
|
+
update<Type>(context: Context<Type>): void;
|
|
4252
|
+
|
|
4253
|
+
consume<Type>(token: Type, howMany?: number): boolean;
|
|
4254
|
+
|
|
4255
|
+
peek<Type>(): Type | null;
|
|
4256
|
+
|
|
4257
|
+
// tokens<Type>(): Type[];
|
|
4258
|
+
|
|
4259
|
+
next<Type>(): Type | null;
|
|
4260
|
+
|
|
4261
|
+
consume<Type>(token: Type, howMany?: number): boolean;
|
|
4262
|
+
|
|
4263
|
+
slice<Type>(): Type[];
|
|
4264
|
+
|
|
4265
|
+
clone<Type>(): Context<Type>;
|
|
4266
|
+
|
|
4267
|
+
done(): boolean;
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
/**
|
|
4271
|
+
* apply minification rules to the ast tree
|
|
4272
|
+
* @param ast
|
|
4273
|
+
* @param options
|
|
4274
|
+
* @param recursive
|
|
4275
|
+
* @param errors
|
|
4276
|
+
* @param nestingContent
|
|
4277
|
+
*
|
|
4278
|
+
* @private
|
|
4279
|
+
*/
|
|
4280
|
+
declare function minify(ast: AstNode$1, options: ParserOptions | MinifyFeatureOptions, recursive: boolean, errors?: ErrorDescription[], nestingContent?: boolean): AstNode$1;
|
|
4281
|
+
|
|
4282
|
+
/**
|
|
4283
|
+
* expand css nesting ast nodes
|
|
4284
|
+
* @param ast
|
|
4285
|
+
*
|
|
4286
|
+
* @private
|
|
4287
|
+
*/
|
|
4288
|
+
declare function expand(ast: AstStyleSheet | AstAtRule | AstRule): AstNode$1;
|
|
4289
|
+
|
|
4290
|
+
/**
|
|
4291
|
+
* parse a string as an array of declaration nodes
|
|
4292
|
+
* @param declaration
|
|
4293
|
+
*
|
|
4294
|
+
* Example:
|
|
4295
|
+
* ````ts
|
|
4296
|
+
*
|
|
4297
|
+
* const declarations = await parseDeclarations('color: red; background: blue');
|
|
4298
|
+
* console.log(declarations);
|
|
4299
|
+
* ```
|
|
4300
|
+
*/
|
|
4301
|
+
declare function parseDeclarations(declaration: string): Promise<Array<AstDeclaration | AstComment>>;
|
|
4302
|
+
/**
|
|
4303
|
+
* parse css string and return an array of tokens
|
|
4304
|
+
* @param src
|
|
4305
|
+
* @param options
|
|
4306
|
+
*
|
|
4307
|
+
* @private
|
|
4308
|
+
*
|
|
4309
|
+
* Example:
|
|
4310
|
+
*
|
|
4311
|
+
* ```ts
|
|
4312
|
+
*
|
|
4313
|
+
* import {parseString} from '@tbela99/css-parser';
|
|
4314
|
+
*
|
|
4315
|
+
* let tokens = parseString('body { color: red; }');
|
|
4316
|
+
* console.log(tokens);
|
|
4317
|
+
*
|
|
4318
|
+
* tokens = parseString('#c322c980');
|
|
4319
|
+
* console.log(tokens);
|
|
4320
|
+
* ```
|
|
4321
|
+
*/
|
|
4322
|
+
declare function parseString(src: string, options?: {
|
|
4323
|
+
location: boolean;
|
|
4324
|
+
src?: string;
|
|
4325
|
+
}): Token$1[];
|
|
4326
|
+
|
|
4327
|
+
/**
|
|
4328
|
+
* render ast token
|
|
4329
|
+
* @param token
|
|
4330
|
+
* @param options
|
|
4331
|
+
* @private
|
|
4332
|
+
*/
|
|
4333
|
+
declare function renderToken(token: Token$1, options?: RenderOptions, cache?: {
|
|
4334
|
+
[key: string]: any;
|
|
4335
|
+
}, reducer?: (acc: string, curr: Token$1) => string, errors?: ErrorDescription[]): string;
|
|
4336
|
+
|
|
4337
|
+
/**
|
|
4338
|
+
* Converts a color to another color space
|
|
4339
|
+
* @param token
|
|
4340
|
+
* @param to
|
|
4341
|
+
*
|
|
4342
|
+
* @private
|
|
4343
|
+
*
|
|
4344
|
+
* ```ts
|
|
4345
|
+
*
|
|
4346
|
+
* const token = {typ: EnumToken.ColorTokenType, kin: ColorType.HEX, val: '#F00'}
|
|
4347
|
+
* const result = convertColor(token, ColorType.LCH);
|
|
4348
|
+
*
|
|
4349
|
+
* ```
|
|
4350
|
+
*/
|
|
4351
|
+
declare function convertColor(token: ColorToken, to: ColorType$1): ColorToken | null;
|
|
4352
|
+
|
|
4353
|
+
/**
|
|
4354
|
+
* Calculate the distance between two okLab colors.
|
|
4355
|
+
* @param okLab1
|
|
4356
|
+
* @param okLab2
|
|
4357
|
+
*
|
|
4358
|
+
* @private
|
|
4359
|
+
*/
|
|
4360
|
+
declare function okLabDistance(okLab1: [number, number, number], okLab2: [number, number, number]): number;
|
|
4361
|
+
/**
|
|
4362
|
+
* Check if two colors are close in okLab space.
|
|
4363
|
+
* @param color1
|
|
4364
|
+
* @param color2
|
|
4365
|
+
* @param threshold
|
|
4366
|
+
*
|
|
4367
|
+
* @private
|
|
4368
|
+
*/
|
|
4369
|
+
declare function isOkLabClose(color1: ColorToken, color2: ColorToken, threshold?: number): boolean;
|
|
4370
|
+
|
|
4371
|
+
/**
|
|
4372
|
+
* search the ast tree and return the first match
|
|
4373
|
+
*
|
|
4374
|
+
* ```ts
|
|
4375
|
+
* // find the first ast declaration node which name is 'aspect-ratio'
|
|
4376
|
+
import { find, EnumToken, transform } from "@tbela99/css-parser";
|
|
4377
|
+
import type { AstNode } from "@tbela99/css-parser";
|
|
4378
|
+
|
|
4379
|
+
* const css = `
|
|
4380
|
+
|
|
4381
|
+
button {
|
|
4382
|
+
aspect-ratio: 1;
|
|
4383
|
+
width: if(media(any-pointer: fine): 30px; else: 44px);
|
|
4384
|
+
}
|
|
4385
|
+
`;
|
|
4386
|
+
|
|
4387
|
+
// find declaration which contain a '30px'
|
|
4388
|
+
const nodeMatcher = (node: AstNode) =>
|
|
4389
|
+
return node.typ == EnumToken.DeclarationNodeType && (node as AstDeclaration).nam == 'aspect-ratio';
|
|
4390
|
+
|
|
4391
|
+
const result = await transform(css);
|
|
4392
|
+
const node = find(result.ast, nodeMatcher);
|
|
4393
|
+
|
|
4394
|
+
console.log({node});
|
|
4395
|
+
|
|
4396
|
+
```
|
|
4397
|
+
*
|
|
4398
|
+
* @param ast
|
|
4399
|
+
* @param matcher
|
|
4400
|
+
* @returns
|
|
4401
|
+
*/
|
|
4402
|
+
declare function find(ast: AstNode$1, matcher: (node: AstNode$1) => boolean): AstNode$1 | null;
|
|
4403
|
+
/**
|
|
4404
|
+
* search the ast tree by checking each node's value and return the first match
|
|
4405
|
+
*
|
|
4406
|
+
* ```ts
|
|
4407
|
+
* // find the first ast node which contains the length token '30px'
|
|
4408
|
+
import { findByValue, EnumToken, transform } from "@tbela99/css-parser";
|
|
4409
|
+
import type { AstNode } from "@tbela99/css-parser";
|
|
4410
|
+
|
|
4411
|
+
* const css = `
|
|
4412
|
+
|
|
4413
|
+
button {
|
|
4414
|
+
aspect-ratio: 1;
|
|
4415
|
+
width: if(media(any-pointer: fine): 30px; else: 44px);
|
|
4416
|
+
}
|
|
4417
|
+
`;
|
|
4418
|
+
|
|
4419
|
+
// find declaration which contain a '30px'
|
|
4420
|
+
const nodeMatcher = (value: Token) =>
|
|
4421
|
+
return value.typ == EnumToken.LengthTokenType && (value as LengthToken).val == 30 && (value as LengthToken).unit == 'px' ;
|
|
4422
|
+
|
|
4423
|
+
const result = await transform(css);
|
|
4424
|
+
const { node, value } = findByValue(result.ast, nodeMatcher) ?? {};
|
|
4425
|
+
|
|
4426
|
+
console.log({node, value});
|
|
4427
|
+
|
|
4428
|
+
```
|
|
4429
|
+
*
|
|
4430
|
+
* @param ast
|
|
4431
|
+
* @param matcher
|
|
4432
|
+
* @returns
|
|
4433
|
+
*/
|
|
4434
|
+
declare function findByValue(ast: AstNode$1, matcher: AstValueMatcher): {
|
|
4435
|
+
node: AstNode$1;
|
|
4436
|
+
value: TokenSearchResult;
|
|
4437
|
+
} | null;
|
|
4438
|
+
/**
|
|
4439
|
+
* search the ast tree and return all matches
|
|
4440
|
+
*
|
|
4441
|
+
* ```ts
|
|
4442
|
+
* // find the first ast declaration node which name is 'aspect-ratio'
|
|
4443
|
+
import { findAll, EnumToken, transform } from "@tbela99/css-parser";
|
|
4444
|
+
import type { AstNode } from "@tbela99/css-parser";
|
|
4445
|
+
|
|
4446
|
+
* const css = `
|
|
4447
|
+
|
|
4448
|
+
button {
|
|
4449
|
+
aspect-ratio: 1;
|
|
4450
|
+
width: if(media(any-pointer: fine): 30px; else: 44px);
|
|
4451
|
+
}
|
|
4452
|
+
`;
|
|
4453
|
+
|
|
4454
|
+
// find declaration which contain a '30px'
|
|
4455
|
+
const nodeMatcher = (node: AstNode) =>
|
|
4456
|
+
return node.typ == EnumToken.DeclarationNodeType && (node as AstDeclaration).nam == 'aspect-ratio';
|
|
4457
|
+
|
|
4458
|
+
const result = await transform(css);
|
|
4459
|
+
const nodes = findAll(result.ast, nodeMatcher);
|
|
4460
|
+
|
|
4461
|
+
console.log({nodes});
|
|
4462
|
+
|
|
4463
|
+
```
|
|
4464
|
+
*
|
|
4465
|
+
* @param ast
|
|
4466
|
+
* @param matcher
|
|
4467
|
+
* @returns
|
|
4468
|
+
*/
|
|
4469
|
+
declare function findAll(ast: AstNode$1, matcher: (node: AstNode$1) => boolean): AstNode$1[];
|
|
4470
|
+
/**
|
|
4471
|
+
* search the ast tree and return the last match
|
|
4472
|
+
*
|
|
4473
|
+
* ```ts
|
|
4474
|
+
* // find the first ast declaration node which name is 'aspect-ratio'
|
|
4475
|
+
import { findLast, EnumToken, transform } from "@tbela99/css-parser";
|
|
4476
|
+
import type { AstNode } from "@tbela99/css-parser";
|
|
4477
|
+
|
|
4478
|
+
* const css = `
|
|
4479
|
+
|
|
4480
|
+
button {
|
|
4481
|
+
aspect-ratio: 1;
|
|
4482
|
+
width: if(media(any-pointer: fine): 30px; else: 44px);
|
|
4483
|
+
}
|
|
4484
|
+
`;
|
|
4485
|
+
|
|
4486
|
+
// find declaration which contain a '30px'
|
|
4487
|
+
const nodeMatcher = (node: AstNode) =>
|
|
4488
|
+
return node.typ == EnumToken.DeclarationNodeType && (node as AstDeclaration).nam == 'aspect-ratio';
|
|
4489
|
+
|
|
4490
|
+
const result = await transform(css);
|
|
4491
|
+
const node = findLast(result.ast, nodeMatcher);
|
|
4492
|
+
|
|
4493
|
+
console.log({node});
|
|
4494
|
+
|
|
4495
|
+
```
|
|
4496
|
+
*
|
|
4497
|
+
* @param ast
|
|
4498
|
+
* @param matcher
|
|
4499
|
+
* @returns
|
|
4500
|
+
*/
|
|
4501
|
+
declare function findLast(ast: AstNode$1, matcher: (node: AstNode$1) => boolean): AstNode$1 | null;
|
|
4502
|
+
|
|
4503
|
+
/**
|
|
4504
|
+
*
|
|
4505
|
+
* @param node he nod to clone
|
|
4506
|
+
* @param cloneChildren deep clone
|
|
4507
|
+
* @param cloneMap a map of existing children as keys and their clones as values
|
|
4508
|
+
* @returns
|
|
4509
|
+
*/
|
|
4510
|
+
declare function cloneNode(node: AstNode$1, cloneChildren?: boolean, cloneMap?: Map<Token$1 | AstNode$1, Token$1 | AstNode$1> | null): AstNode$1;
|
|
4511
|
+
|
|
4045
4512
|
/**
|
|
4046
4513
|
* load file or url
|
|
4047
4514
|
* @param url
|
|
@@ -4225,5 +4692,5 @@ declare function transformFile(file: string, options?: TransformOptions, asStrea
|
|
|
4225
4692
|
*/
|
|
4226
4693
|
declare function transform(css: string | ReadableStream<Uint8Array>, options?: TransformOptions): Promise<TransformResult>;
|
|
4227
4694
|
|
|
4228
|
-
export { ColorType, EnumToken, FeatureWalkMode, ModuleCaseTransformEnum, ModuleScopeEnumOptions, ResponseType$1 as ResponseType, SourceMap, ValidationLevel, WalkerEvent, WalkerOptionEnum, convertColor, dirname, expand, isOkLabClose, load,
|
|
4229
|
-
export type { AddToken, AngleToken, AstAtRule, AstComment, AstDeclaration, AstInvalidAtRule, AstInvalidDeclaration, AstInvalidRule, AstKeyFrameRule, AstKeyframesAtRule, AstKeyframesRule, AstNode$1 as AstNode, AstRule, AstRuleList, AstStyleSheet, AtRuleToken, AtRuleVisitorHandler, AttrEndToken, AttrStartToken, AttrToken, Background, BackgroundAttachmentMapping, BackgroundPosition, BackgroundPositionClass, BackgroundPositionConstraints, BackgroundPositionMapping, BackgroundProperties, BackgroundRepeat, BackgroundRepeatMapping, BackgroundSize, BackgroundSizeMapping, BadCDOCommentToken, BadCommentToken, BadStringToken, BadUrlToken, BaseToken, BinaryExpressionNode, BinaryExpressionToken, BlockEndToken, BlockStartToken, Border, BorderColor, BorderColorClass, BorderProperties, BorderRadius, CDOCommentToken, ChildCombinatorToken, ClassSelectorToken, ColonToken, ColorToken, ColumnCombinatorToken, CommaToken, CommentToken, ComposesSelectorToken, ConstraintsMapping, ContainMatchToken, Context, CssVariableImportTokenType$1 as CssVariableImportTokenType, CssVariableMapTokenType, CssVariableToken$1 as CssVariableToken, DashMatchToken, DashedIdentToken, DeclarationVisitorHandler, DelimToken, DescendantCombinatorToken, DimensionToken, DivToken, EOFToken, EndMatchToken, EqualMatchToken, ErrorDescription, FlexToken, Font, FontFamily, FontProperties, FontWeight, FontWeightConstraints, FontWeightMapping, FractionToken, FrequencyToken, FunctionImageToken, FunctionToken, FunctionURLToken, GenericVisitorAstNodeHandlerMap, GenericVisitorHandler, GenericVisitorResult, GreaterThanOrEqualToken, GreaterThanToken, GridTemplateFuncToken, HashToken, IdentListToken, IdentToken, ImportantToken, IncludeMatchToken, InvalidAttrToken, InvalidClassSelectorToken, LengthToken, LessThanOrEqualToken, LessThanToken, LineHeight, ListToken, LiteralToken, LoadResult, Location, Map$1 as Map, MatchExpressionToken, MatchedSelector,
|
|
4695
|
+
export { ColorType$1 as ColorType, EnumToken, FeatureWalkMode, ModuleCaseTransformEnum, ModuleScopeEnumOptions, ResponseType$1 as ResponseType, SourceMap, ValidationLevel, WalkerEvent, WalkerOptionEnum, cloneNode, convertColor, dirname, expand, find, findAll, findByValue, findLast, isOkLabClose, load, minify, okLabDistance, parse, parseDeclarations, parseFile, parseString, render, renderToken, resolve, transform, transformFile, walk, walkValues };
|
|
4696
|
+
export type { AddToken, AndToken, AngleToken, AstAtRule, AstComment, AstDeclaration, AstInvalidAtRule, AstInvalidDeclaration, AstInvalidRule, AstKeyFrameRule, AstKeyframesAtRule, AstKeyframesRule, AstNode$1 as AstNode, AstRule, AstRuleList, AstStyleSheet, AstValueMatcher, AtRuleToken, AtRuleVisitorHandler, AttrEndToken, AttrStartToken, AttrToken, Background, BackgroundAttachmentMapping, BackgroundPosition, BackgroundPositionClass, BackgroundPositionConstraints, BackgroundPositionMapping, BackgroundProperties, BackgroundRepeat, BackgroundRepeatMapping, BackgroundSize, BackgroundSizeMapping, BadCDOCommentToken, BadCommentToken, BadStringToken, BadUrlToken, BaseToken, BinaryExpressionNode, BinaryExpressionToken, BlockEndToken, BlockStartToken, Border, BorderColor, BorderColorClass, BorderProperties, BorderRadius, CDOCommentToken, ChildCombinatorToken, ClassSelectorToken, ColonToken, ColorToken, ColumnCombinatorToken, CommaToken, CommentToken, ComposesSelectorToken, ConstraintsMapping, ContainMatchToken, ContainerStyleRangeToken, Context, CssVariableImportTokenType$1 as CssVariableImportTokenType, CssVariableMapTokenType, CssVariableToken$1 as CssVariableToken, DashMatchToken, DashedIdentToken, DeclarationVisitorHandler, DelimToken, DescendantCombinatorToken, DimensionToken, DivToken, EOFToken, EndMatchToken, EqualMatchToken, ErrorDescription, FlexToken, Font, FontFamily, FontProperties, FontWeight, FontWeightConstraints, FontWeightMapping, FractionToken, FrequencyToken, FunctionDefToken, FunctionImageToken, FunctionToken, FunctionURLToken, GenericVisitorAstNodeHandlerMap, GenericVisitorHandler, GenericVisitorResult, GreaterThanOrEqualToken, GreaterThanToken, GridTemplateFuncToken, HashToken, IdentListToken, IdentToken, IfConditionToken, IfElseConditionToken, ImportantToken, IncludeMatchToken, InvalidAttrToken, InvalidClassSelectorToken, InvalidMediaQueryToken, LengthToken, LessThanOrEqualToken, LessThanToken, LineHeight, ListToken, LiteralToken, LoadResult, Location, Map$1 as Map, MatchExpressionToken, MatchedSelector, MediaFeatureOnlyToken, MediaFeatureToken, MediaQueryConditionToken, MediaQueryUnaryFeatureToken, MediaRangeQueryToken, MinifyFeature, MinifyFeatureOptions, MinifyOptions, ModuleOptions, MulToken, NameSpaceAttributeToken, NestingSelectorToken, NextSiblingCombinatorToken, NotToken, NumberToken, OptimizedSelector, OptimizedSelectorToken, OrToken, Outline, OutlineProperties, ParensEndToken, ParensStartToken, ParensToken, ParseInfo$1 as ParseInfo, ParseResult, ParseResultStats, ParseTokenOptions, ParserOptions, PercentageToken, Position$1 as Position, Prefix, PropertiesConfig, PropertiesConfigProperties, PropertyListOptions, PropertyMapType, PropertySetType, PropertyType, PseudoClassFunctionToken, PseudoClassToken, PseudoElementToken, PseudoPageToken, PurpleBackgroundAttachment, RawNodeToken, RawSelectorTokens, RenderOptions, RenderResult, ResolutionToken, ResolvedPath, RuleVisitorHandler, SemiColonToken, Separator, ShorthandDef, ShorthandMapType, ShorthandProperties, ShorthandPropertyType, ShorthandType, SourceMapObject, StartMatchToken, StringToken, SubToken, SubsequentCombinatorToken, SupportsQueryConditionToken, SupportsQueryUnaryConditionToken, TimeToken, TimelineFunctionToken, TimingFunctionToken, Token$1 as Token, TokenSearchResult, TokenizeResult, TransformOptions, TransformResult, UnaryExpression, UnaryExpressionNode, UnclosedStringToken, UniversalSelectorToken, UrlToken, ValidationConfiguration, ValidationMediaFeature, ValidationOptions, ValidationResult, ValidationSelectorOptions, ValidationSyntaxNode, ValidationSyntaxResult, ValidationToken$1 as ValidationToken, Value, ValueVisitorHandler, VariableScopeInfo, VisitorNodeMap, WalkAttributesResult, WalkResult, WalkerFilter, WalkerOption, WalkerValueFilter, WhenElseQueryConditionToken, WhenElseUnaryConditionToken, WhitespaceToken };
|