@tbela99/css-parser 1.1.1-alpha4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/README.md +53 -6
- package/dist/index-umd-web.js +4195 -3375
- package/dist/index.cjs +5468 -4648
- package/dist/index.d.ts +42 -31
- package/dist/lib/ast/expand.js +81 -65
- package/dist/lib/ast/features/calc.js +37 -35
- package/dist/lib/ast/features/inlinecssvariables.js +25 -17
- package/dist/lib/ast/features/prefix.js +22 -19
- package/dist/lib/ast/features/shorthand.js +1 -1
- package/dist/lib/ast/features/transform.js +17 -2
- package/dist/lib/ast/math/expression.js +184 -159
- package/dist/lib/ast/math/math.js +22 -20
- package/dist/lib/ast/minify.js +249 -200
- package/dist/lib/ast/transform/compute.js +48 -38
- package/dist/lib/ast/transform/matrix.js +6 -5
- package/dist/lib/ast/transform/minify.js +31 -34
- package/dist/lib/ast/transform/utils.js +76 -16
- package/dist/lib/ast/types.js +32 -1
- package/dist/lib/fs/resolve.js +1 -14
- package/dist/lib/parser/declaration/list.js +1 -1
- package/dist/lib/parser/declaration/map.js +1 -1
- package/dist/lib/parser/declaration/set.js +1 -1
- package/dist/lib/parser/parse.js +19 -95
- package/dist/lib/parser/tokenize.js +1 -13
- package/dist/lib/parser/utils/declaration.js +1 -1
- package/dist/lib/parser/utils/type.js +1 -1
- package/dist/lib/renderer/render.js +44 -168
- package/dist/lib/{renderer → syntax}/color/a98rgb.js +2 -2
- package/dist/lib/syntax/color/cmyk.js +104 -0
- package/dist/lib/{renderer → syntax}/color/color-mix.js +20 -21
- package/dist/lib/syntax/color/color.js +581 -0
- package/dist/lib/syntax/color/hex.js +179 -0
- package/dist/lib/syntax/color/hsl.js +201 -0
- package/dist/lib/syntax/color/hwb.js +185 -0
- package/dist/lib/syntax/color/lab.js +262 -0
- package/dist/lib/syntax/color/lch.js +194 -0
- package/dist/lib/syntax/color/oklab.js +237 -0
- package/dist/lib/syntax/color/oklch.js +166 -0
- package/dist/lib/{renderer → syntax}/color/p3.js +3 -3
- package/dist/lib/{renderer → syntax}/color/rec2020.js +11 -11
- package/dist/lib/{renderer → syntax}/color/relativecolor.js +53 -40
- package/dist/lib/syntax/color/rgb.js +140 -0
- package/dist/lib/{renderer → syntax}/color/srgb.js +58 -46
- package/dist/lib/{renderer → syntax}/color/utils/components.js +7 -7
- package/dist/lib/{renderer → syntax}/color/utils/constants.js +7 -34
- package/dist/lib/syntax/color/utils/distance.js +30 -0
- package/dist/lib/{renderer → syntax}/color/xyz.js +27 -14
- package/dist/lib/{renderer → syntax}/color/xyzd50.js +8 -8
- package/dist/lib/syntax/syntax.js +77 -67
- package/dist/lib/syntax/utils.js +70 -0
- package/dist/lib/validation/at-rules/container.js +1 -1
- package/dist/lib/validation/at-rules/counter-style.js +1 -1
- package/dist/lib/validation/at-rules/custom-media.js +1 -1
- package/dist/lib/validation/at-rules/document.js +1 -1
- package/dist/lib/validation/at-rules/font-feature-values.js +2 -2
- package/dist/lib/validation/at-rules/import.js +1 -1
- package/dist/lib/validation/at-rules/keyframes.js +14 -13
- package/dist/lib/validation/at-rules/layer.js +1 -1
- package/dist/lib/validation/at-rules/media.js +1 -1
- package/dist/lib/validation/at-rules/namespace.js +1 -1
- package/dist/lib/validation/at-rules/page-margin-box.js +1 -1
- package/dist/lib/validation/at-rules/page.js +1 -1
- package/dist/lib/validation/at-rules/supports.js +1 -1
- package/dist/lib/validation/at-rules/when.js +1 -1
- package/dist/lib/validation/atrule.js +2 -2
- package/dist/lib/validation/config.js +4 -3
- package/dist/lib/validation/config.json.js +1 -1
- package/dist/lib/validation/parser/parse.js +12 -7
- package/dist/lib/validation/selector.js +9 -8
- package/dist/lib/validation/syntax.js +171 -132
- package/dist/lib/validation/syntaxes/complex-selector-list.js +13 -19
- package/dist/lib/validation/syntaxes/complex-selector.js +1 -1
- package/dist/lib/validation/syntaxes/compound-selector.js +5 -24
- package/dist/lib/validation/syntaxes/family-name.js +36 -39
- package/dist/lib/validation/syntaxes/keyframe-selector.js +14 -22
- package/dist/lib/validation/syntaxes/layer-name.js +1 -1
- package/dist/lib/validation/syntaxes/relative-selector-list.js +27 -25
- package/dist/lib/validation/syntaxes/relative-selector.js +1 -1
- package/dist/lib/validation/syntaxes/url.js +35 -33
- package/dist/lib/validation/utils/list.js +10 -9
- package/dist/lib/validation/utils/whitespace.js +1 -1
- package/dist/node/index.js +4 -2
- package/dist/web/index.js +4 -2
- package/package.json +4 -4
- package/.editorconfig +0 -484
- package/dist/lib/ast/transform/convert.js +0 -33
- package/dist/lib/ast/utils/utils.js +0 -104
- package/dist/lib/renderer/color/color.js +0 -654
- package/dist/lib/renderer/color/hex.js +0 -105
- package/dist/lib/renderer/color/hsl.js +0 -125
- package/dist/lib/renderer/color/hwb.js +0 -103
- package/dist/lib/renderer/color/lab.js +0 -148
- package/dist/lib/renderer/color/lch.js +0 -90
- package/dist/lib/renderer/color/oklab.js +0 -131
- package/dist/lib/renderer/color/oklch.js +0 -75
- package/dist/lib/renderer/color/rgb.js +0 -50
- package/dist/lib/validation/syntaxes/keyframe-block-list.js +0 -28
- package/dist/lib/{renderer → syntax}/color/hsv.js +0 -0
- package/dist/lib/{renderer → syntax}/color/prophotorgb.js +1 -1
- /package/dist/lib/{renderer → syntax}/color/utils/matrix.js +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { EnumToken } from '../ast/types.js';
|
|
2
|
+
import '../ast/minify.js';
|
|
3
|
+
import '../ast/walk.js';
|
|
4
|
+
import '../parser/parse.js';
|
|
5
|
+
import '../parser/tokenize.js';
|
|
6
|
+
import '../parser/utils/config.js';
|
|
7
|
+
import './color/utils/constants.js';
|
|
8
|
+
import '../renderer/sourcemap/lib/encode.js';
|
|
9
|
+
|
|
10
|
+
function length2Px(value) {
|
|
11
|
+
let result = null;
|
|
12
|
+
if (value.typ == EnumToken.NumberTokenType) {
|
|
13
|
+
result = +value.val;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
switch (value.unit) {
|
|
17
|
+
case 'cm':
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
result = value.val * 37.8;
|
|
20
|
+
break;
|
|
21
|
+
case 'mm':
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
result = value.val * 3.78;
|
|
24
|
+
break;
|
|
25
|
+
case 'Q':
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
result = value.val * 37.8 / 40;
|
|
28
|
+
break;
|
|
29
|
+
case 'in':
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
result = value.val / 96;
|
|
32
|
+
break;
|
|
33
|
+
case 'pc':
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
result = value.val / 16;
|
|
36
|
+
break;
|
|
37
|
+
case 'pt':
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
result = value.val * 4 / 3;
|
|
40
|
+
break;
|
|
41
|
+
case 'px':
|
|
42
|
+
result = +value.val;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return isNaN(result) ? null : result;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* minify number
|
|
50
|
+
* @param val
|
|
51
|
+
*/
|
|
52
|
+
function minifyNumber(val) {
|
|
53
|
+
val = String(+val);
|
|
54
|
+
if (val === '0') {
|
|
55
|
+
return '0';
|
|
56
|
+
}
|
|
57
|
+
const chr = val.charAt(0);
|
|
58
|
+
if (chr == '-') {
|
|
59
|
+
const slice = val.slice(0, 2);
|
|
60
|
+
if (slice == '-0') {
|
|
61
|
+
return val.length == 2 ? '0' : '-' + val.slice(2);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (chr == '0') {
|
|
65
|
+
return val.slice(1);
|
|
66
|
+
}
|
|
67
|
+
return val;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { length2Px, minifyNumber };
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
10
10
|
import { splitTokenList } from '../utils/list.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
|
|
10
10
|
function validateAtRuleCounterStyle(atRule, options, root) {
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
10
10
|
import { validateAtRuleMediaQueryList } from './media.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
10
10
|
import { splitTokenList } from '../utils/list.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { validateFamilyName } from '../syntaxes/family-name.js';
|
|
10
10
|
import '../syntaxes/complex-selector.js';
|
|
@@ -23,7 +23,7 @@ function validateAtRuleFontFeatureValues(atRule, options, root) {
|
|
|
23
23
|
tokens: []
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
const result = validateFamilyName(atRule.tokens
|
|
26
|
+
const result = validateFamilyName(atRule.tokens);
|
|
27
27
|
if (result.valid == SyntaxValidationResult.Drop) {
|
|
28
28
|
return result;
|
|
29
29
|
}
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { validateAtRuleMediaQueryList } from './media.js';
|
|
10
10
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
10
10
|
|
|
@@ -19,19 +19,20 @@ function validateAtRuleKeyframes(atRule, options, root) {
|
|
|
19
19
|
error: 'expecting at-rule prelude'
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
const tokens = atRule.tokens.slice();
|
|
22
|
+
const tokens = atRule.tokens.filter((t) => t.typ != EnumToken.CommentTokenType).slice();
|
|
23
23
|
consumeWhitespace(tokens);
|
|
24
|
-
if (tokens.length == 0) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
24
|
+
// if (tokens.length == 0) {
|
|
25
|
+
//
|
|
26
|
+
// // @ts-ignore
|
|
27
|
+
// return {
|
|
28
|
+
// valid: SyntaxValidationResult.Drop,
|
|
29
|
+
// context: [],
|
|
30
|
+
// node: atRule,
|
|
31
|
+
// syntax: '@keyframes',
|
|
32
|
+
// error: 'expecting at-rule prelude'
|
|
33
|
+
// } as ValidationSyntaxResult;
|
|
34
|
+
// }
|
|
35
|
+
if (tokens.length == 0 || ![EnumToken.StringTokenType, EnumToken.IdenTokenType].includes(tokens[0].typ)) {
|
|
35
36
|
// @ts-ignore
|
|
36
37
|
return {
|
|
37
38
|
valid: SyntaxValidationResult.Drop,
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { validateLayerName } from '../syntaxes/layer-name.js';
|
|
10
10
|
import '../syntaxes/complex-selector.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import { generalEnclosedFunc } from '../../
|
|
7
|
+
import { generalEnclosedFunc } from '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
10
10
|
import { splitTokenList } from '../utils/list.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
10
10
|
import { validateURL } from '../syntaxes/url.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
|
|
10
10
|
function validateAtRulePageMarginBox(atRule, options, root) {
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import '../../
|
|
7
|
+
import '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { splitTokenList } from '../utils/list.js';
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ import '../../parser/parse.js';
|
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
7
|
import { colorFontTech, fontFeaturesTech, fontFormat } from '../../syntax/syntax.js';
|
|
8
|
-
import '../../
|
|
8
|
+
import '../../syntax/color/utils/constants.js';
|
|
9
9
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
10
10
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
11
11
|
import { splitTokenList } from '../utils/list.js';
|
|
@@ -4,7 +4,7 @@ import '../../ast/walk.js';
|
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
|
-
import { generalEnclosedFunc } from '../../
|
|
7
|
+
import { generalEnclosedFunc } from '../../syntax/color/utils/constants.js';
|
|
8
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
10
10
|
import { splitTokenList } from '../utils/list.js';
|
|
@@ -4,7 +4,7 @@ import '../ast/walk.js';
|
|
|
4
4
|
import '../parser/parse.js';
|
|
5
5
|
import '../parser/tokenize.js';
|
|
6
6
|
import '../parser/utils/config.js';
|
|
7
|
-
import '../
|
|
7
|
+
import '../syntax/color/utils/constants.js';
|
|
8
8
|
import '../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { getSyntaxConfig, getParsedSyntax } from './config.js';
|
|
10
10
|
import { validateAtRuleMedia } from './at-rules/media.js';
|
|
@@ -77,7 +77,7 @@ function validateAtRule(atRule, options, root) {
|
|
|
77
77
|
return validateAtRuleCustomMedia(atRule);
|
|
78
78
|
}
|
|
79
79
|
if (['position-try', 'property', 'font-palette-values'].includes(atRule.nam)) {
|
|
80
|
-
if (!(
|
|
80
|
+
if (!Array.isArray(atRule.tokens) || atRule.tokens.length == 0) {
|
|
81
81
|
return {
|
|
82
82
|
valid: SyntaxValidationResult.Drop,
|
|
83
83
|
node: atRule,
|
|
@@ -3340,7 +3340,7 @@ var syntaxes = {
|
|
|
3340
3340
|
syntax: "cover | contain | entry | exit | entry-crossing | exit-crossing"
|
|
3341
3341
|
},
|
|
3342
3342
|
"track-breadth": {
|
|
3343
|
-
syntax: "<length-percentage> | <flex> | min-content | max-content | auto"
|
|
3343
|
+
syntax: "<length-percentage> | <flex> | min-content | max-content | auto | <-non-standard-size>"
|
|
3344
3344
|
},
|
|
3345
3345
|
"track-list": {
|
|
3346
3346
|
syntax: "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ValidationTokenEnum } from './types.js';
|
|
2
2
|
import { isIdent, isPseudo } from '../../syntax/syntax.js';
|
|
3
|
-
import { getTokenType as getTokenType$1 } from '../../parser/parse.js';
|
|
4
|
-
import '../../parser/tokenize.js';
|
|
5
|
-
import '../../parser/utils/config.js';
|
|
6
3
|
import { EnumToken } from '../../ast/types.js';
|
|
7
4
|
import '../../ast/minify.js';
|
|
8
5
|
import '../../ast/walk.js';
|
|
9
|
-
import '../../
|
|
6
|
+
import { getTokenType as getTokenType$1 } from '../../parser/parse.js';
|
|
7
|
+
import '../../parser/tokenize.js';
|
|
8
|
+
import '../../parser/utils/config.js';
|
|
9
|
+
import '../../syntax/color/utils/constants.js';
|
|
10
10
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
11
11
|
|
|
12
12
|
const skipped = [
|
|
@@ -351,9 +351,10 @@ function matchAtRule(syntax, iterator) {
|
|
|
351
351
|
token.typ = ValidationTokenEnum.AtRule;
|
|
352
352
|
break;
|
|
353
353
|
}
|
|
354
|
-
if (item.value.typ != ValidationTokenEnum.Whitespace) {
|
|
355
|
-
|
|
356
|
-
|
|
354
|
+
// if (item.value.typ != ValidationTokenEnum.Whitespace) {
|
|
355
|
+
//
|
|
356
|
+
// console.error('unexpected token', item.value);
|
|
357
|
+
// }
|
|
357
358
|
item = iterator.next();
|
|
358
359
|
if (item.done) {
|
|
359
360
|
break;
|
|
@@ -665,6 +666,10 @@ function parseSyntaxTokens(syntax, iterator) {
|
|
|
665
666
|
}
|
|
666
667
|
}
|
|
667
668
|
}
|
|
669
|
+
if ('occurence' in item.value) {
|
|
670
|
+
// @ts-ignore
|
|
671
|
+
items[i].occurence = { ...item.value.occurence };
|
|
672
|
+
}
|
|
668
673
|
break;
|
|
669
674
|
case ValidationTokenEnum.Pipe:
|
|
670
675
|
item.value.chi = item.value.chi.map((t) => parseSyntaxTokens(syntax, t[Symbol.iterator]()));
|
|
@@ -4,23 +4,24 @@ import '../ast/walk.js';
|
|
|
4
4
|
import '../parser/parse.js';
|
|
5
5
|
import '../parser/tokenize.js';
|
|
6
6
|
import '../parser/utils/config.js';
|
|
7
|
-
import '../
|
|
7
|
+
import '../syntax/color/utils/constants.js';
|
|
8
8
|
import '../renderer/sourcemap/lib/encode.js';
|
|
9
9
|
import { validateRelativeSelectorList } from './syntaxes/relative-selector-list.js';
|
|
10
10
|
import './syntaxes/complex-selector.js';
|
|
11
|
-
import { validateKeyframeBlockList } from './syntaxes/keyframe-block-list.js';
|
|
12
11
|
import './syntax.js';
|
|
13
12
|
import './config.js';
|
|
14
13
|
import { validateSelectorList } from './syntaxes/selector-list.js';
|
|
15
14
|
|
|
16
15
|
function validateSelector(selector, options, root) {
|
|
17
|
-
if (root == null) {
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
// if (root == null) {
|
|
17
|
+
//
|
|
18
|
+
// return validateSelectorList(selector, root, options);
|
|
19
|
+
// }
|
|
20
20
|
// @ts-ignore
|
|
21
|
-
if (root.typ == EnumToken.AtRuleNodeType && root.nam.match(/^(-[a-z]+-)?keyframes$/)) {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// if (root.typ == EnumToken.AtRuleNodeType && root.nam.match(/^(-[a-z]+-)?keyframes$/)) {
|
|
22
|
+
//
|
|
23
|
+
// return validateKeyframeBlockList(selector, root as AstAtRule, options);
|
|
24
|
+
// }
|
|
24
25
|
let isNested = root.typ == EnumToken.RuleNodeType ? 1 : 0;
|
|
25
26
|
let currentRoot = root.parent;
|
|
26
27
|
while (currentRoot != null && isNested == 0) {
|