@tbela99/css-parser 1.6.6 → 1.6.8
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/CHANGELOG.md +106 -0
- package/README.md +1 -58
- package/architecture.png +0 -0
- package/dist/index-umd-web.js +731 -459
- package/dist/index.cjs +724 -459
- package/dist/index.d.ts +67 -11
- package/dist/package.json.js +10 -0
- package/dist/{data → src/data}/properties.json.js +7 -0
- package/dist/{data → src/data}/validation.json.js +7 -0
- package/dist/{lib → src/lib}/ast/clone.js +7 -0
- package/dist/{lib → src/lib}/ast/expand.js +19 -10
- package/dist/{lib → src/lib}/ast/features/calc.js +7 -0
- package/dist/{lib → src/lib}/ast/features/if.js +7 -0
- package/dist/{lib → src/lib}/ast/features/index.js +7 -0
- package/dist/{lib → src/lib}/ast/features/inlinecssvariables.js +7 -0
- package/dist/{lib → src/lib}/ast/features/prefix.js +8 -3
- package/dist/{lib → src/lib}/ast/features/shorthand.js +7 -0
- package/dist/{lib → src/lib}/ast/features/transform.js +8 -1
- package/dist/{lib → src/lib}/ast/features/type.js +7 -0
- package/dist/{lib → src/lib}/ast/find.js +7 -0
- package/dist/{lib → src/lib}/ast/math/expression.js +7 -0
- package/dist/{lib → src/lib}/ast/math/math.js +7 -0
- package/dist/{lib → src/lib}/ast/minify.js +7 -0
- package/dist/{lib → src/lib}/ast/node.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/compute.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/matrix.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/minify.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/perspective.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/rotate.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/scale.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/skew.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/translate.js +7 -0
- package/dist/{lib → src/lib}/ast/transform/utils.js +7 -0
- package/dist/{lib → src/lib}/ast/types.js +28 -9
- package/dist/{lib → src/lib}/ast/walk.js +16 -0
- package/dist/{lib → src/lib}/fs/resolve.js +7 -0
- package/dist/{lib → src/lib}/parser/declaration/list.js +24 -8
- package/dist/{lib → src/lib}/parser/declaration/map.js +9 -1
- package/dist/{lib → src/lib}/parser/declaration/set.js +7 -0
- package/dist/{lib → src/lib}/parser/linesmap.js +7 -0
- package/dist/{lib → src/lib}/parser/parse.js +93 -49
- package/dist/{lib → src/lib}/parser/source.js +7 -0
- package/dist/{lib → src/lib}/parser/tokenize.js +24 -3
- package/dist/{lib → src/lib}/parser/utils/angle.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule-container.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule-font-feature-values.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule-generic.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule-import.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule-media.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule-support.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule-when-else.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/at-rule.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/base64.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/cache.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/config.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/declaration.js +17 -0
- package/dist/{lib → src/lib}/parser/utils/eq.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/hash.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/selector.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/text.js +7 -0
- package/dist/{lib → src/lib}/parser/utils/token.js +15 -4
- package/dist/{lib → src/lib}/parser/utils/type.js +7 -0
- package/dist/{lib → src/lib}/printer/render.js +20 -9
- package/dist/{lib → src/lib}/printer/sourcemap/lib/codec.js +7 -0
- package/dist/{lib → src/lib}/printer/sourcemap/sourcemap.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/a98rgb.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/alpha.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/cmyk.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/color-mix.js +139 -48
- package/dist/{lib → src/lib}/syntax/color/color.js +7 -1
- package/dist/{lib → src/lib}/syntax/color/hex.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/hsl.js +52 -38
- package/dist/{lib → src/lib}/syntax/color/hwb.js +90 -53
- package/dist/{lib → src/lib}/syntax/color/lab.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/lch.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/oklab.js +8 -1
- package/dist/{lib → src/lib}/syntax/color/oklch.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/p3.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/prophotorgb.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/rec2020.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/relative-color.js +36 -0
- package/dist/{lib → src/lib}/syntax/color/rgb.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/srgb.js +88 -58
- package/dist/{lib → src/lib}/syntax/color/utils/color-type.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/utils/colorspace.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/utils/components.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/utils/distance.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/utils/make-color.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/utils/matrix.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/xyz.js +7 -0
- package/dist/{lib → src/lib}/syntax/color/xyzd50.js +7 -0
- package/dist/{lib → src/lib}/syntax/constants.js +7 -0
- package/dist/{lib → src/lib}/syntax/syntax.js +7 -0
- package/dist/{lib → src/lib}/validation/config.js +7 -0
- package/dist/{lib → src/lib}/validation/match.js +37 -19
- package/dist/{lib → src/lib}/validation/parser/parse.js +7 -0
- package/dist/{lib → src/lib}/validation/parser/typedef.js +7 -0
- package/dist/{lib → src/lib}/validation/utils/list.js +7 -0
- package/dist/{node.js → src/node.js} +8 -0
- package/dist/{types.js → src/types.js} +7 -0
- package/dist/{utils → src/utils}/sync.js +7 -0
- package/dist/{web.js → src/web.js} +8 -0
- package/package.json +7 -6
- package/dist/lib/syntax/color/hsv.js +0 -20
package/dist/index.d.ts
CHANGED
|
@@ -16,35 +16,43 @@ declare enum EnumAstNodeStatus$1 {
|
|
|
16
16
|
/**
|
|
17
17
|
* Node passed validation
|
|
18
18
|
*/
|
|
19
|
-
Validated =
|
|
19
|
+
Validated = 1,
|
|
20
20
|
/**
|
|
21
21
|
* Node is invalid
|
|
22
22
|
*/
|
|
23
|
-
Invalid =
|
|
23
|
+
Invalid = 2,
|
|
24
24
|
/**
|
|
25
25
|
* node is not validated
|
|
26
26
|
*/
|
|
27
|
-
Unvalidated =
|
|
27
|
+
Unvalidated = 4,
|
|
28
28
|
/**
|
|
29
29
|
* Node did not pass validation, but is preserved.
|
|
30
30
|
*/
|
|
31
|
-
ValidationFailed =
|
|
31
|
+
ValidationFailed = 8,
|
|
32
32
|
/**
|
|
33
33
|
* Parsing the node is not supported yet or the node syntax definition does not exist.
|
|
34
34
|
*/
|
|
35
|
-
Unknown =
|
|
35
|
+
Unknown = 16,
|
|
36
36
|
/**
|
|
37
37
|
* Failed to parse the node.
|
|
38
38
|
*/
|
|
39
|
-
Unparsed =
|
|
39
|
+
Unparsed = 32,
|
|
40
40
|
/**
|
|
41
41
|
* Node is disallowed in the context
|
|
42
42
|
*/
|
|
43
|
-
Disallowed =
|
|
43
|
+
Disallowed = 64,
|
|
44
44
|
/**
|
|
45
45
|
* Node is malformed
|
|
46
46
|
*/
|
|
47
|
-
Malformed =
|
|
47
|
+
Malformed = 128,
|
|
48
|
+
/**
|
|
49
|
+
* Important declaration
|
|
50
|
+
*/
|
|
51
|
+
ImportantDeclaration = 256,
|
|
52
|
+
/**
|
|
53
|
+
* Color component without unit
|
|
54
|
+
*/
|
|
55
|
+
PowerlessColorComponent = 512
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* Enum of validation levels
|
|
@@ -526,7 +534,7 @@ declare enum EnumToken {
|
|
|
526
534
|
/**
|
|
527
535
|
* '|'
|
|
528
536
|
*/
|
|
529
|
-
|
|
537
|
+
PipeTokenType = 109,
|
|
530
538
|
/**
|
|
531
539
|
* '::'
|
|
532
540
|
*/
|
|
@@ -665,6 +673,10 @@ declare enum EnumToken {
|
|
|
665
673
|
* negative infinity token
|
|
666
674
|
*/
|
|
667
675
|
NegativeInfinityTokenType = 143,
|
|
676
|
+
/**
|
|
677
|
+
* CSS type token
|
|
678
|
+
*/
|
|
679
|
+
CssTypeTokenType = 144,
|
|
668
680
|
/**
|
|
669
681
|
* alias for time token type
|
|
670
682
|
*/
|
|
@@ -1062,6 +1074,20 @@ export declare interface IdentToken extends BaseToken {
|
|
|
1062
1074
|
val: string;
|
|
1063
1075
|
}
|
|
1064
1076
|
|
|
1077
|
+
/**
|
|
1078
|
+
* Css type token
|
|
1079
|
+
*/
|
|
1080
|
+
export declare interface CssTypeTokenType extends BaseToken {
|
|
1081
|
+
/**
|
|
1082
|
+
* @inheritdoc
|
|
1083
|
+
*/
|
|
1084
|
+
typ: EnumToken.CssTypeTokenType;
|
|
1085
|
+
/**
|
|
1086
|
+
* css type value
|
|
1087
|
+
*/
|
|
1088
|
+
val: string;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1065
1091
|
/**
|
|
1066
1092
|
* Ident list token
|
|
1067
1093
|
*/
|
|
@@ -2685,6 +2711,7 @@ export declare type Token$1 =
|
|
|
2685
2711
|
| NaNToken
|
|
2686
2712
|
| InfinityToken
|
|
2687
2713
|
| NegativeInfinityToken
|
|
2714
|
+
| CssTypeTokenType
|
|
2688
2715
|
| EOFToken;
|
|
2689
2716
|
|
|
2690
2717
|
/**
|
|
@@ -3399,6 +3426,7 @@ export declare type GenericVisitorSyncHandler<T> = (
|
|
|
3399
3426
|
export declare type GenericVisitorAstNodeSyncHandlerMap<T> =
|
|
3400
3427
|
| Record<string, GenericVisitorSyncHandler<T>>
|
|
3401
3428
|
| GenericVisitorSyncHandler<T>
|
|
3429
|
+
| Function<T>
|
|
3402
3430
|
| { type: WalkerEvent; handler: GenericVisitorSyncHandler<T> }
|
|
3403
3431
|
| { type: WalkerEvent; handler: Record<string, GenericVisitorSyncHandler<T>> };
|
|
3404
3432
|
|
|
@@ -3970,6 +3998,32 @@ export declare interface VisitorNodeMap {
|
|
|
3970
3998
|
[key: keyof typeof EnumToken]: GenericVisitorAstNodeHandlerMap<Token> | GenericVisitorAstNodeHandlerMap<AstNode>;
|
|
3971
3999
|
}
|
|
3972
4000
|
|
|
4001
|
+
/**
|
|
4002
|
+
* Parsed visitor handlers
|
|
4003
|
+
*/
|
|
4004
|
+
interface ParsedVisitorHandlers {
|
|
4005
|
+
/**
|
|
4006
|
+
* include tokens
|
|
4007
|
+
*/
|
|
4008
|
+
includeTokens: boolean;
|
|
4009
|
+
/**
|
|
4010
|
+
* all handlers
|
|
4011
|
+
*/
|
|
4012
|
+
allHandlers: Array<GenericVisitorAstNodeHandlerMap | Record<string, GenericVisitorAstNodeHandlerMap>>;
|
|
4013
|
+
/**
|
|
4014
|
+
* all visitors
|
|
4015
|
+
*/
|
|
4016
|
+
allVisitorsHandlers?: Set<GenericVisitorHandler<Token>> | Set<GenericVisitorHandler<AstNode>>;
|
|
4017
|
+
/**
|
|
4018
|
+
* pre all visitors
|
|
4019
|
+
*/
|
|
4020
|
+
preAllVisitorsHandlers?: Set<GenericVisitorHandler<Token>> | Set<GenericVisitorHandler<AstNode>>;
|
|
4021
|
+
/**
|
|
4022
|
+
* post all visitors
|
|
4023
|
+
*/
|
|
4024
|
+
postAllVisitorsHandlers?: Set<GenericVisitorHandler<Token>> | Set<GenericVisitorHandler<AstNode>>;
|
|
4025
|
+
}
|
|
4026
|
+
|
|
3973
4027
|
/**
|
|
3974
4028
|
* Generate and parse source map
|
|
3975
4029
|
*
|
|
@@ -6633,6 +6687,8 @@ declare function setNodeProperty(node: AstNode$1, key: 'errors', value: ErrorDes
|
|
|
6633
6687
|
*/
|
|
6634
6688
|
declare function setNodeProperty(node: AstNode$1, key: 'tokens', value: Token$1[] | null): void;
|
|
6635
6689
|
|
|
6690
|
+
declare let version: string;
|
|
6691
|
+
|
|
6636
6692
|
/**
|
|
6637
6693
|
* Load file or url
|
|
6638
6694
|
* @param url
|
|
@@ -7020,5 +7076,5 @@ declare function transform(options: ParseInputStreamOptions & TransformOptions):
|
|
|
7020
7076
|
*/
|
|
7021
7077
|
declare function transform(options: ParseInputFileOptions & TransformOptions): Promise<TransformResult>;
|
|
7022
7078
|
|
|
7023
|
-
export { ColorType$1 as ColorType, EnumAstNodeStatus$1 as EnumAstNodeStatus, EnumToken, FeatureWalkMode, ModuleCaseTransformEnum, ModuleScopeEnumOptions, ResponseType, SourceMap, ValidationLevel, WalkerEvent, WalkerOptionEnum, cloneNode, convertColor, dirname, expand, find, findAll, findByValue, findLast, getNodeProperty, isOkLabClose, load, minify, okLabDistance, parse, parseDeclarations, parseFile, parseString, parseSync, render, renderValue as renderToken, replaceNodeOrValue, resolve, setNodeProperty, transform, transformFile, transformSync, walk, walkValues };
|
|
7024
|
-
export type { AddToken, AndToken, AngleToken, AstAtRule, AstComment, AstDeclaration, AstInvalidAtRule, AstInvalidDeclaration, AstInvalidRule, AstKeyframesAtRule, AstKeyframesRule, AstNode$1 as AstNode, AstNodeStatus, 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, CssVariableImportTokenType, CssVariableMapTokenType, CssVariableToken, DashMatchToken, DashedIdentToken, DeclarationVisitorHandler, DelimToken, DescendantCombinatorToken, DimensionToken, DivToken, DoubleColonToken, EOFToken, EndMatchToken, EqualMatchToken, ErrorDescription$1 as ErrorDescription, FlexToken, Font, FontFamily, FontProperties, FontWeight, FontWeightConstraints, FontWeightMapping, FractionToken, FrequencyToken, FunctionDefToken, FunctionImageToken, FunctionToken, FunctionURLToken, GenericVisitorAstNodeHandlerMap, GenericVisitorAstNodeSyncHandlerMap, GenericVisitorAsyncResult, GenericVisitorHandler, GenericVisitorResult, GenericVisitorSyncHandler, GenericVisitorSyncResult, GreaterThanOrEqualToken, GreaterThanToken, GridTemplateFuncToken, HashToken, IdentListToken, IdentToken, IfConditionToken, IfElseConditionToken, ImportantToken, IncludeMatchToken, InfinityToken, InvalidAttrToken, InvalidClassSelectorToken, InvalidMediaQueryToken, LengthToken, LessThanOrEqualToken, LessThanToken, LineHeight, ListToken, LiteralToken, LoadResult, Map$1 as Map, MatchExpressionToken, MatchedSelector, MediaFeatureOnlyToken, MediaFeatureToken, MediaQueryConditionToken, MediaQueryUnaryFeatureToken, MediaRangeQueryToken, MinifyFeature, MinifyFeatureOptions, MinifyOptions, ModuleAsyncOptions, ModuleSyncOptions, MulToken, NaNToken, NameSpaceAttributeToken, NegativeInfinityToken, NestingSelectorToken, NextSiblingCombinatorToken, NotToken, NumberToken, OptimizedSelector, OptimizedSelectorToken, OrToken, Outline, OutlineProperties, ParensEndToken, ParensStartToken, ParensToken, ParseInfo$1 as ParseInfo, ParseInputFileOptions, ParseInputOptions, ParseInputStreamOptions, ParseResult, ParseResultStats, ParseSourceOptions, ParseTokenOptions, ParserOptions, ParserSourceMapOptions, ParserSyncOptions, PercentageToken, 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, SinglePropertyType, SinglePropertyTypeMapping, SourceLocation, SourceMapObject, StartMatchToken, StringToken, SubToken, SubsequentCombinatorToken, SupportsQueryConditionToken, SupportsQueryUnaryConditionToken, TimeToken, TimelineFunctionToken, TimingFunctionToken, Token$1 as Token, TokenSearchResult, TokenizeResult, TransformOptions, TransformResult, TransformSyncOptions, UnaryExpression, UnaryExpressionNode, UnclosedStringToken, UniversalSelectorToken, UrlToken, ValidationConfiguration, ValidationMediaFeature, ValidationOptions, ValidationResult, ValidationSelectorOptions, ValidationSyntaxNode, ValidationSyntaxResult, ValidationToken$1 as ValidationToken, Value, ValueVisitorHandler, ValueVisitorSyncHandler, VariableScopeInfo, VisitorNodeMap, VisitorSyncNodeMap, WalkAttributesResult, WalkResult, WalkerFilter, WalkerOption, WalkerOptions, WalkerValueFilter, WhenElseQueryConditionToken, WhenElseUnaryConditionToken, WhitespaceToken, WrappedValuesToken };
|
|
7079
|
+
export { ColorType$1 as ColorType, EnumAstNodeStatus$1 as EnumAstNodeStatus, EnumToken, FeatureWalkMode, ModuleCaseTransformEnum, ModuleScopeEnumOptions, ResponseType, SourceMap, ValidationLevel, WalkerEvent, WalkerOptionEnum, cloneNode, convertColor, dirname, expand, find, findAll, findByValue, findLast, getNodeProperty, isOkLabClose, load, minify, okLabDistance, parse, parseDeclarations, parseFile, parseString, parseSync, render, renderValue as renderToken, replaceNodeOrValue, resolve, setNodeProperty, transform, transformFile, transformSync, version, walk, walkValues };
|
|
7080
|
+
export type { AddToken, AndToken, AngleToken, AstAtRule, AstComment, AstDeclaration, AstInvalidAtRule, AstInvalidDeclaration, AstInvalidRule, AstKeyframesAtRule, AstKeyframesRule, AstNode$1 as AstNode, AstNodeStatus, 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, CssTypeTokenType, CssVariableImportTokenType, CssVariableMapTokenType, CssVariableToken, DashMatchToken, DashedIdentToken, DeclarationVisitorHandler, DelimToken, DescendantCombinatorToken, DimensionToken, DivToken, DoubleColonToken, EOFToken, EndMatchToken, EqualMatchToken, ErrorDescription$1 as ErrorDescription, FlexToken, Font, FontFamily, FontProperties, FontWeight, FontWeightConstraints, FontWeightMapping, FractionToken, FrequencyToken, FunctionDefToken, FunctionImageToken, FunctionToken, FunctionURLToken, GenericVisitorAstNodeHandlerMap, GenericVisitorAstNodeSyncHandlerMap, GenericVisitorAsyncResult, GenericVisitorHandler, GenericVisitorResult, GenericVisitorSyncHandler, GenericVisitorSyncResult, GreaterThanOrEqualToken, GreaterThanToken, GridTemplateFuncToken, HashToken, IdentListToken, IdentToken, IfConditionToken, IfElseConditionToken, ImportantToken, IncludeMatchToken, InfinityToken, InvalidAttrToken, InvalidClassSelectorToken, InvalidMediaQueryToken, LengthToken, LessThanOrEqualToken, LessThanToken, LineHeight, ListToken, LiteralToken, LoadResult, Map$1 as Map, MatchExpressionToken, MatchedSelector, MediaFeatureOnlyToken, MediaFeatureToken, MediaQueryConditionToken, MediaQueryUnaryFeatureToken, MediaRangeQueryToken, MinifyFeature, MinifyFeatureOptions, MinifyOptions, ModuleAsyncOptions, ModuleSyncOptions, MulToken, NaNToken, NameSpaceAttributeToken, NegativeInfinityToken, NestingSelectorToken, NextSiblingCombinatorToken, NotToken, NumberToken, OptimizedSelector, OptimizedSelectorToken, OrToken, Outline, OutlineProperties, ParensEndToken, ParensStartToken, ParensToken, ParseInfo$1 as ParseInfo, ParseInputFileOptions, ParseInputOptions, ParseInputStreamOptions, ParseResult, ParseResultStats, ParseSourceOptions, ParseTokenOptions, ParsedVisitorHandlers, ParserOptions, ParserSourceMapOptions, ParserSyncOptions, PercentageToken, 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, SinglePropertyType, SinglePropertyTypeMapping, SourceLocation, SourceMapObject, StartMatchToken, StringToken, SubToken, SubsequentCombinatorToken, SupportsQueryConditionToken, SupportsQueryUnaryConditionToken, TimeToken, TimelineFunctionToken, TimingFunctionToken, Token$1 as Token, TokenSearchResult, TokenizeResult, TransformOptions, TransformResult, TransformSyncOptions, UnaryExpression, UnaryExpressionNode, UnclosedStringToken, UniversalSelectorToken, UrlToken, ValidationConfiguration, ValidationMediaFeature, ValidationOptions, ValidationResult, ValidationSelectorOptions, ValidationSyntaxNode, ValidationSyntaxResult, ValidationToken$1 as ValidationToken, Value, ValueVisitorHandler, ValueVisitorSyncHandler, VariableScopeInfo, VisitorNodeMap, VisitorSyncNodeMap, WalkAttributesResult, WalkResult, WalkerFilter, WalkerOption, WalkerOptions, WalkerValueFilter, WhenElseQueryConditionToken, WhenElseUnaryConditionToken, WhitespaceToken, WrappedValuesToken };
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { splitRule } from './minify.js';
|
|
2
9
|
import { STATE, PARENT, combinators, RAW } from '../syntax/constants.js';
|
|
3
10
|
import { parseString } from '../parser/parse.js';
|
|
@@ -13,11 +20,12 @@ import { cloneNode } from './clone.js';
|
|
|
13
20
|
* @private
|
|
14
21
|
*/
|
|
15
22
|
function expand(ast) {
|
|
16
|
-
if (ast[STATE]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
if (ast[STATE] &
|
|
24
|
+
(EnumAstNodeStatus.Invalid |
|
|
25
|
+
EnumAstNodeStatus.Disallowed |
|
|
26
|
+
EnumAstNodeStatus.Unknown |
|
|
27
|
+
EnumAstNodeStatus.Unparsed |
|
|
28
|
+
EnumAstNodeStatus.Malformed)) {
|
|
21
29
|
return ast;
|
|
22
30
|
}
|
|
23
31
|
const result = Object.assign(cloneNode(ast), { chi: [] });
|
|
@@ -65,11 +73,12 @@ function expand(ast) {
|
|
|
65
73
|
return result;
|
|
66
74
|
}
|
|
67
75
|
function expandRule(node) {
|
|
68
|
-
if (node[STATE]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
if (node[STATE] &
|
|
77
|
+
(EnumAstNodeStatus.Invalid |
|
|
78
|
+
EnumAstNodeStatus.Disallowed |
|
|
79
|
+
EnumAstNodeStatus.Unknown |
|
|
80
|
+
EnumAstNodeStatus.Unparsed |
|
|
81
|
+
EnumAstNodeStatus.Malformed)) {
|
|
73
82
|
return [node];
|
|
74
83
|
}
|
|
75
84
|
const ast = Object.assign(cloneNode(node), { chi: node.chi.slice() });
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { EnumToken } from '../types.js';
|
|
2
9
|
import { walkValues } from '../walk.js';
|
|
3
10
|
import { evaluate } from '../math/expression.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { EnumToken } from '../types.js';
|
|
2
9
|
import { renderValue } from '../../printer/render.js';
|
|
3
10
|
import { FeatureWalkMode } from './type.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
export { ComputePrefixFeature } from './prefix.js';
|
|
2
9
|
export { InlineCssVariablesFeature } from './inlinecssvariables.js';
|
|
3
10
|
export { ComputeShorthandFeature } from './shorthand.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { EnumToken } from '../types.js';
|
|
2
9
|
import { walkValues } from '../walk.js';
|
|
3
10
|
import { renderValue } from '../../printer/render.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { EnumAstNodeStatus, EnumToken } from '../types.js';
|
|
2
9
|
import { walkValues } from '../walk.js';
|
|
3
10
|
import { pseudoAliasMap } from '../../syntax/syntax.js';
|
|
@@ -121,9 +128,7 @@ class ComputePrefixFeature {
|
|
|
121
128
|
}
|
|
122
129
|
}
|
|
123
130
|
run(node) {
|
|
124
|
-
if (node[STATE]
|
|
125
|
-
node[STATE] == EnumAstNodeStatus.Invalid ||
|
|
126
|
-
node[STATE] == EnumAstNodeStatus.Malformed) {
|
|
131
|
+
if (node[STATE] & (EnumAstNodeStatus.Disallowed | EnumAstNodeStatus.Invalid | EnumAstNodeStatus.Malformed)) {
|
|
127
132
|
return null;
|
|
128
133
|
}
|
|
129
134
|
if (node.typ == EnumToken.RuleNodeType) {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { PropertyList } from '../../parser/declaration/list.js';
|
|
2
9
|
import { EnumToken } from '../types.js';
|
|
3
10
|
import { FeatureWalkMode } from './type.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { EnumToken, EnumAstNodeStatus } from '../types.js';
|
|
2
9
|
import { compute } from '../transform/compute.js';
|
|
3
10
|
import { filterValues, renderValue } from '../../printer/render.js';
|
|
@@ -34,7 +41,7 @@ class TransformCssFeature {
|
|
|
34
41
|
for (; i < ast.chi.length; i++) {
|
|
35
42
|
// @ts-ignore
|
|
36
43
|
node = ast.chi[i];
|
|
37
|
-
if (node[STATE]
|
|
44
|
+
if (node[STATE] & (EnumAstNodeStatus.Invalid | EnumAstNodeStatus.ValidationFailed)) {
|
|
38
45
|
continue;
|
|
39
46
|
}
|
|
40
47
|
if (node.typ != EnumToken.DeclarationNodeType ||
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { EnumToken } from './types.js';
|
|
2
9
|
import { walk, walkValues } from './walk.js';
|
|
3
10
|
import { TOKENS } from '../syntax/constants.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { equalsIgnoreCase } from '../../parser/utils/text.js';
|
|
2
9
|
import { mathFuncs, PARENT, LOCEND, LOCSTA, LOCSRCID } from '../../syntax/constants.js';
|
|
3
10
|
import { EnumToken } from '../types.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { eq } from '../parser/utils/eq.js';
|
|
2
9
|
import { renderValue, doRender } from '../printer/render.js';
|
|
3
10
|
import * as index from './features/index.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { identity, multiply, toZero } from './utils.js';
|
|
2
9
|
import { EnumToken } from '../types.js';
|
|
3
10
|
import { stripCommaToken } from '../../validation/utils/list.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { identity, is2DMatrix } from './utils.js';
|
|
2
9
|
import { EnumToken } from '../types.js';
|
|
3
10
|
import { eq } from '../../parser/utils/eq.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { identity, multiply, decompose, round, toZero } from './utils.js';
|
|
2
9
|
import { epsilon } from '../../syntax/constants.js';
|
|
3
10
|
import { EnumToken } from '../types.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
import { epsilon } from '../../syntax/constants.js';
|
|
2
9
|
|
|
3
10
|
const identityMatrix = new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
CSS parser, minifier and validator for node and the browser
|
|
3
|
+
|
|
4
|
+
Author(s): Thierry Bela
|
|
5
|
+
Version: 1.6.8
|
|
6
|
+
License: MIT
|
|
7
|
+
*/
|
|
1
8
|
/**
|
|
2
9
|
* Syntax validation enum
|
|
3
10
|
*/
|
|
@@ -18,35 +25,43 @@ var EnumAstNodeStatus;
|
|
|
18
25
|
/**
|
|
19
26
|
* Node passed validation
|
|
20
27
|
*/
|
|
21
|
-
EnumAstNodeStatus[EnumAstNodeStatus["Validated"] =
|
|
28
|
+
EnumAstNodeStatus[EnumAstNodeStatus["Validated"] = 1] = "Validated";
|
|
22
29
|
/**
|
|
23
30
|
* Node is invalid
|
|
24
31
|
*/
|
|
25
|
-
EnumAstNodeStatus[EnumAstNodeStatus["Invalid"] =
|
|
32
|
+
EnumAstNodeStatus[EnumAstNodeStatus["Invalid"] = 2] = "Invalid";
|
|
26
33
|
/**
|
|
27
34
|
* node is not validated
|
|
28
35
|
*/
|
|
29
|
-
EnumAstNodeStatus[EnumAstNodeStatus["Unvalidated"] =
|
|
36
|
+
EnumAstNodeStatus[EnumAstNodeStatus["Unvalidated"] = 4] = "Unvalidated";
|
|
30
37
|
/**
|
|
31
38
|
* Node did not pass validation, but is preserved.
|
|
32
39
|
*/
|
|
33
|
-
EnumAstNodeStatus[EnumAstNodeStatus["ValidationFailed"] =
|
|
40
|
+
EnumAstNodeStatus[EnumAstNodeStatus["ValidationFailed"] = 8] = "ValidationFailed";
|
|
34
41
|
/**
|
|
35
42
|
* Parsing the node is not supported yet or the node syntax definition does not exist.
|
|
36
43
|
*/
|
|
37
|
-
EnumAstNodeStatus[EnumAstNodeStatus["Unknown"] =
|
|
44
|
+
EnumAstNodeStatus[EnumAstNodeStatus["Unknown"] = 16] = "Unknown";
|
|
38
45
|
/**
|
|
39
46
|
* Failed to parse the node.
|
|
40
47
|
*/
|
|
41
|
-
EnumAstNodeStatus[EnumAstNodeStatus["Unparsed"] =
|
|
48
|
+
EnumAstNodeStatus[EnumAstNodeStatus["Unparsed"] = 32] = "Unparsed";
|
|
42
49
|
/**
|
|
43
50
|
* Node is disallowed in the context
|
|
44
51
|
*/
|
|
45
|
-
EnumAstNodeStatus[EnumAstNodeStatus["Disallowed"] =
|
|
52
|
+
EnumAstNodeStatus[EnumAstNodeStatus["Disallowed"] = 64] = "Disallowed";
|
|
46
53
|
/**
|
|
47
54
|
* Node is malformed
|
|
48
55
|
*/
|
|
49
|
-
EnumAstNodeStatus[EnumAstNodeStatus["Malformed"] =
|
|
56
|
+
EnumAstNodeStatus[EnumAstNodeStatus["Malformed"] = 128] = "Malformed";
|
|
57
|
+
/**
|
|
58
|
+
* Important declaration
|
|
59
|
+
*/
|
|
60
|
+
EnumAstNodeStatus[EnumAstNodeStatus["ImportantDeclaration"] = 256] = "ImportantDeclaration";
|
|
61
|
+
/**
|
|
62
|
+
* Color component without unit
|
|
63
|
+
*/
|
|
64
|
+
EnumAstNodeStatus[EnumAstNodeStatus["PowerlessColorComponent"] = 512] = "PowerlessColorComponent";
|
|
50
65
|
})(EnumAstNodeStatus || (EnumAstNodeStatus = {}));
|
|
51
66
|
/**
|
|
52
67
|
* Enum of validation levels
|
|
@@ -533,7 +548,7 @@ var EnumToken;
|
|
|
533
548
|
/**
|
|
534
549
|
* '|'
|
|
535
550
|
*/
|
|
536
|
-
EnumToken[EnumToken["
|
|
551
|
+
EnumToken[EnumToken["PipeTokenType"] = 109] = "PipeTokenType";
|
|
537
552
|
/**
|
|
538
553
|
* '::'
|
|
539
554
|
*/
|
|
@@ -672,6 +687,10 @@ var EnumToken;
|
|
|
672
687
|
* negative infinity token
|
|
673
688
|
*/
|
|
674
689
|
EnumToken[EnumToken["NegativeInfinityTokenType"] = 143] = "NegativeInfinityTokenType";
|
|
690
|
+
/**
|
|
691
|
+
* CSS type token
|
|
692
|
+
*/
|
|
693
|
+
EnumToken[EnumToken["CssTypeTokenType"] = 144] = "CssTypeTokenType";
|
|
675
694
|
/* aliases */
|
|
676
695
|
/**
|
|
677
696
|
* alias for time token type
|