@tbela99/css-parser 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +53 -6
- package/dist/index-umd-web.js +5503 -5037
- package/dist/index.cjs +5510 -5044
- package/dist/index.d.ts +148 -41
- package/dist/lib/ast/expand.js +81 -65
- package/dist/lib/ast/features/calc.js +14 -36
- package/dist/lib/ast/features/inlinecssvariables.js +6 -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 +74 -172
- package/dist/lib/ast/math/math.js +24 -22
- package/dist/lib/ast/minify.js +249 -199
- package/dist/lib/ast/transform/compute.js +18 -41
- package/dist/lib/ast/transform/matrix.js +36 -36
- package/dist/lib/ast/transform/minify.js +37 -59
- package/dist/lib/ast/transform/perspective.js +1 -1
- package/dist/lib/ast/transform/rotate.js +13 -13
- package/dist/lib/ast/transform/scale.js +8 -8
- package/dist/lib/ast/transform/skew.js +4 -4
- package/dist/lib/ast/transform/translate.js +8 -8
- package/dist/lib/ast/transform/utils.js +80 -28
- package/dist/lib/ast/types.js +122 -2
- 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 +3 -3
- package/dist/lib/parser/parse.js +53 -107
- package/dist/lib/parser/tokenize.js +29 -53
- package/dist/lib/parser/utils/declaration.js +1 -1
- package/dist/lib/parser/utils/type.js +2 -2
- package/dist/lib/renderer/render.js +79 -194
- 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 +31 -33
- 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 +204 -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 +54 -41
- package/dist/lib/syntax/color/rgb.js +140 -0
- package/dist/lib/{renderer → syntax}/color/srgb.js +58 -46
- package/dist/lib/syntax/color/utils/components.js +46 -0
- package/dist/lib/{renderer → syntax}/color/utils/constants.js +6 -33
- package/dist/lib/syntax/color/utils/distance.js +40 -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 +78 -77
- 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 +2 -2
- package/dist/lib/validation/at-rules/font-feature-values.js +2 -2
- package/dist/lib/validation/at-rules/import.js +5 -5
- package/dist/lib/validation/at-rules/keyframes.js +3 -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 +7 -7
- package/dist/lib/validation/at-rules/when.js +1 -1
- package/dist/lib/validation/atrule.js +2 -2
- package/dist/lib/validation/config.js +0 -3
- package/dist/lib/validation/config.json.js +1 -1
- package/dist/lib/validation/parser/parse.js +8 -11
- package/dist/lib/validation/selector.js +1 -9
- package/dist/lib/validation/syntax.js +67 -137
- package/dist/lib/validation/syntaxes/complex-selector-list.js +2 -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 +5 -40
- package/dist/lib/validation/syntaxes/keyframe-selector.js +3 -22
- package/dist/lib/validation/syntaxes/layer-name.js +1 -1
- package/dist/lib/validation/syntaxes/relative-selector-list.js +1 -25
- package/dist/lib/validation/syntaxes/relative-selector.js +1 -1
- package/dist/lib/validation/syntaxes/url.js +3 -34
- package/dist/lib/validation/utils/list.js +2 -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/renderer/color/utils/components.js +0 -34
- 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
|
@@ -5,7 +5,7 @@ import '../../parser/parse.js';
|
|
|
5
5
|
import '../../parser/tokenize.js';
|
|
6
6
|
import '../../parser/utils/config.js';
|
|
7
7
|
import { mozExtensions, webkitExtensions } 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 { getSyntaxConfig } from '../config.js';
|
|
@@ -108,17 +108,7 @@ function validateCompoundSelector(tokens, root, options) {
|
|
|
108
108
|
while (tokens.length > 0 && tokens[0].typ == EnumToken.AttrTokenType) {
|
|
109
109
|
const children = tokens[0].chi.slice();
|
|
110
110
|
consumeWhitespace(children);
|
|
111
|
-
if (children.length == 0
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
return {
|
|
114
|
-
valid: SyntaxValidationResult.Drop,
|
|
115
|
-
context: [],
|
|
116
|
-
node: tokens[0],
|
|
117
|
-
syntax: null,
|
|
118
|
-
error: 'invalid attribute selector'
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (![
|
|
111
|
+
if (children.length == 0 || ![
|
|
122
112
|
EnumToken.IdenTokenType,
|
|
123
113
|
EnumToken.NameSpaceAttributeTokenType,
|
|
124
114
|
EnumToken.MatchExpressionTokenType
|
|
@@ -151,20 +141,11 @@ function validateCompoundSelector(tokens, root, options) {
|
|
|
151
141
|
EnumToken.StartMatchTokenType, EnumToken.ContainMatchTokenType,
|
|
152
142
|
EnumToken.EndMatchTokenType, EnumToken.IncludeMatchTokenType
|
|
153
143
|
].includes(children[0].op.typ) ||
|
|
154
|
-
!
|
|
144
|
+
![
|
|
155
145
|
EnumToken.StringTokenType,
|
|
156
146
|
EnumToken.IdenTokenType
|
|
157
|
-
].includes(children[0].r.typ)
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
valid: SyntaxValidationResult.Drop,
|
|
161
|
-
context: [],
|
|
162
|
-
node: tokens[0],
|
|
163
|
-
syntax: null,
|
|
164
|
-
error: 'invalid attribute selector'
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
if (children[0].attr != null && !['i', 's'].includes(children[0].attr)) {
|
|
147
|
+
].includes(children[0].r.typ) ||
|
|
148
|
+
(children[0].attr != null && !['i', 's'].includes(children[0].attr))) {
|
|
168
149
|
// @ts-ignore
|
|
169
150
|
return {
|
|
170
151
|
valid: SyntaxValidationResult.Drop,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumToken, SyntaxValidationResult } from '../../ast/types.js';
|
|
2
2
|
import '../../ast/minify.js';
|
|
3
3
|
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
|
|
|
@@ -12,18 +12,7 @@ function validateFamilyName(tokens, atRule) {
|
|
|
12
12
|
let node;
|
|
13
13
|
tokens = tokens.slice();
|
|
14
14
|
consumeWhitespace(tokens);
|
|
15
|
-
if (tokens.length == 0) {
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
return {
|
|
18
|
-
valid: SyntaxValidationResult.Drop,
|
|
19
|
-
matches: [],
|
|
20
|
-
node: atRule,
|
|
21
|
-
syntax: null,
|
|
22
|
-
error: 'expected at-rule prelude',
|
|
23
|
-
tokens
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
if (tokens[0].typ == EnumToken.CommaTokenType) {
|
|
15
|
+
if (tokens.length == 0 || tokens[0].typ == EnumToken.CommaTokenType) {
|
|
27
16
|
// @ts-ignore
|
|
28
17
|
return {
|
|
29
18
|
valid: SyntaxValidationResult.Drop,
|
|
@@ -35,22 +24,6 @@ function validateFamilyName(tokens, atRule) {
|
|
|
35
24
|
};
|
|
36
25
|
}
|
|
37
26
|
while (tokens.length > 0) {
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
if (tokens[0].typ == EnumToken.CommaTokenType) {
|
|
40
|
-
node = tokens.shift();
|
|
41
|
-
consumeWhitespace(tokens);
|
|
42
|
-
if (tokens.length == 0) {
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
return {
|
|
45
|
-
valid: SyntaxValidationResult.Drop,
|
|
46
|
-
matches: [],
|
|
47
|
-
node,
|
|
48
|
-
syntax: null,
|
|
49
|
-
error: 'unexpected token',
|
|
50
|
-
tokens
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
27
|
node = tokens[0];
|
|
55
28
|
if (![EnumToken.IdenTokenType, EnumToken.StringTokenType].includes(node.typ)) {
|
|
56
29
|
// @ts-ignore
|
|
@@ -66,16 +39,8 @@ function validateFamilyName(tokens, atRule) {
|
|
|
66
39
|
tokens.shift();
|
|
67
40
|
consumeWhitespace(tokens);
|
|
68
41
|
// @ts-ignore
|
|
69
|
-
if (tokens.length > 0 &&
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
valid: SyntaxValidationResult.Drop,
|
|
73
|
-
matches: [],
|
|
74
|
-
node: tokens[0],
|
|
75
|
-
syntax: null,
|
|
76
|
-
error: 'expected comma token',
|
|
77
|
-
tokens
|
|
78
|
-
};
|
|
42
|
+
if (tokens.length > 0 && tokens[0].typ == EnumToken.CommaTokenType) {
|
|
43
|
+
tokens.shift();
|
|
79
44
|
}
|
|
80
45
|
}
|
|
81
46
|
// @ts-ignore
|
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
2
2
|
import { splitTokenList } from '../utils/list.js';
|
|
3
|
-
import {
|
|
3
|
+
import { EnumToken, SyntaxValidationResult } from '../../ast/types.js';
|
|
4
4
|
import '../../ast/minify.js';
|
|
5
5
|
import '../../ast/walk.js';
|
|
6
6
|
import '../../parser/parse.js';
|
|
7
7
|
import '../../parser/tokenize.js';
|
|
8
8
|
import '../../parser/utils/config.js';
|
|
9
|
-
import '../../
|
|
9
|
+
import '../../syntax/color/utils/constants.js';
|
|
10
10
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
11
11
|
|
|
12
12
|
function validateKeyframeSelector(tokens, options) {
|
|
13
13
|
consumeWhitespace(tokens);
|
|
14
|
-
if (tokens.length == 0) {
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
return {
|
|
17
|
-
valid: SyntaxValidationResult.Drop,
|
|
18
|
-
context: [],
|
|
19
|
-
node: null,
|
|
20
|
-
syntax: null,
|
|
21
|
-
error: 'expected keyframe selector'
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
14
|
for (const t of splitTokenList(tokens)) {
|
|
25
|
-
if (t.length != 1) {
|
|
26
|
-
return {
|
|
27
|
-
valid: SyntaxValidationResult.Drop,
|
|
28
|
-
context: [],
|
|
29
|
-
node: t[0] ?? null,
|
|
30
|
-
syntax: null,
|
|
31
|
-
error: 'unexpected token'
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
if (t[0].typ != EnumToken.PercentageTokenType && !(t[0].typ == EnumToken.IdenTokenType && ['from', 'to', 'cover', 'contain', 'entry', 'exit', 'entry-crossing', 'exit-crossing'].includes(t[0].val))) {
|
|
15
|
+
if (t.length != 1 || (t[0].typ != EnumToken.PercentageTokenType && !(t[0].typ == EnumToken.IdenTokenType && ['from', 'to', 'cover', 'contain', 'entry', 'exit', 'entry-crossing', 'exit-crossing'].includes(t[0].val)))) {
|
|
35
16
|
return {
|
|
36
17
|
valid: SyntaxValidationResult.Drop,
|
|
37
18
|
context: [],
|
|
@@ -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 validateLayerName(tokens) {
|
|
@@ -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 { validateRelativeSelector } from './relative-selector.js';
|
|
10
10
|
import { consumeWhitespace } from '../utils/whitespace.js';
|
|
@@ -13,31 +13,7 @@ import { splitTokenList } from '../utils/list.js';
|
|
|
13
13
|
function validateRelativeSelectorList(tokens, root, options) {
|
|
14
14
|
tokens = tokens.slice();
|
|
15
15
|
consumeWhitespace(tokens);
|
|
16
|
-
if (tokens.length == 0) {
|
|
17
|
-
return {
|
|
18
|
-
valid: SyntaxValidationResult.Drop,
|
|
19
|
-
matches: [],
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
node: root,
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
syntax: null,
|
|
24
|
-
error: 'expecting relative selector list',
|
|
25
|
-
tokens
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
16
|
for (const t of splitTokenList(tokens)) {
|
|
29
|
-
if (t.length == 0) {
|
|
30
|
-
return {
|
|
31
|
-
valid: SyntaxValidationResult.Drop,
|
|
32
|
-
matches: [],
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
node: root,
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
syntax: null,
|
|
37
|
-
error: 'unexpected comma',
|
|
38
|
-
tokens
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
17
|
const result = validateRelativeSelector(t, root, options);
|
|
42
18
|
if (result.valid == SyntaxValidationResult.Drop) {
|
|
43
19
|
return result;
|
|
@@ -5,7 +5,7 @@ import '../../ast/walk.js';
|
|
|
5
5
|
import '../../parser/parse.js';
|
|
6
6
|
import '../../parser/tokenize.js';
|
|
7
7
|
import '../../parser/utils/config.js';
|
|
8
|
-
import '../../
|
|
8
|
+
import '../../syntax/color/utils/constants.js';
|
|
9
9
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
10
10
|
import { validateSelector } from './selector.js';
|
|
11
11
|
import { combinatorsTokens } from './complex-selector.js';
|
|
@@ -4,47 +4,16 @@ 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
|
|
|
11
11
|
function validateURL(token) {
|
|
12
|
-
if (token.typ == EnumToken.UrlTokenTokenType) {
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
return {
|
|
15
|
-
valid: SyntaxValidationResult.Valid,
|
|
16
|
-
context: [],
|
|
17
|
-
node: token,
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
syntax: 'url()',
|
|
20
|
-
error: ''
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
if (token.typ != EnumToken.UrlFunctionTokenType) {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
return {
|
|
26
|
-
valid: SyntaxValidationResult.Drop,
|
|
27
|
-
context: [],
|
|
28
|
-
node: token,
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
syntax: 'url()',
|
|
31
|
-
error: 'expected url()'
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
12
|
const children = token.chi.slice();
|
|
35
13
|
consumeWhitespace(children);
|
|
36
|
-
if (children.length
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
valid: SyntaxValidationResult.Drop,
|
|
40
|
-
context: [],
|
|
41
|
-
node: children[0] ?? token,
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
syntax: 'url()',
|
|
44
|
-
error: 'expected url-token'
|
|
45
|
-
};
|
|
14
|
+
if (children.length > 0 && [EnumToken.UrlTokenTokenType, EnumToken.StringTokenType, EnumToken.HashTokenType].includes(children[0].typ)) {
|
|
15
|
+
children.shift();
|
|
46
16
|
}
|
|
47
|
-
children.shift();
|
|
48
17
|
consumeWhitespace(children);
|
|
49
18
|
if (children.length > 0) {
|
|
50
19
|
// @ts-ignore
|
|
@@ -4,18 +4,14 @@ 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 stripCommaToken(tokenList) {
|
|
11
11
|
let result = [];
|
|
12
|
-
let last = null;
|
|
13
12
|
for (let i = 0; i < tokenList.length; i++) {
|
|
14
|
-
if (tokenList[i].typ == EnumToken.CommaTokenType && last != null && last.typ == EnumToken.CommaTokenType) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
13
|
if (tokenList[i].typ != EnumToken.WhitespaceTokenType) {
|
|
18
|
-
|
|
14
|
+
tokenList[i];
|
|
19
15
|
}
|
|
20
16
|
if (tokenList[i].typ == EnumToken.CommentTokenType || tokenList[i].typ == EnumToken.CommaTokenType) {
|
|
21
17
|
continue;
|
|
@@ -26,9 +22,6 @@ function stripCommaToken(tokenList) {
|
|
|
26
22
|
}
|
|
27
23
|
function splitTokenList(tokenList, split = [EnumToken.CommaTokenType]) {
|
|
28
24
|
return tokenList.reduce((acc, curr) => {
|
|
29
|
-
if (curr.typ == EnumToken.CommentTokenType) {
|
|
30
|
-
return acc;
|
|
31
|
-
}
|
|
32
25
|
if (split.includes(curr.typ)) {
|
|
33
26
|
acc.push([]);
|
|
34
27
|
}
|
|
@@ -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 consumeWhitespace(tokens) {
|
package/dist/node/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
|
-
export { EnumToken, ValidationLevel } from '../lib/ast/types.js';
|
|
2
|
+
export { ColorType, EnumToken, ValidationLevel } from '../lib/ast/types.js';
|
|
3
3
|
export { minify } from '../lib/ast/minify.js';
|
|
4
4
|
export { walk, walkValues } from '../lib/ast/walk.js';
|
|
5
5
|
export { expand } from '../lib/ast/expand.js';
|
|
6
6
|
import { doRender } from '../lib/renderer/render.js';
|
|
7
7
|
export { renderToken } from '../lib/renderer/render.js';
|
|
8
|
-
import '../lib/
|
|
8
|
+
import '../lib/syntax/color/utils/constants.js';
|
|
9
|
+
export { convertColor } from '../lib/syntax/color/color.js';
|
|
10
|
+
export { isOkLabClose, okLabDistance } from '../lib/syntax/color/utils/distance.js';
|
|
9
11
|
import { doParse } from '../lib/parser/parse.js';
|
|
10
12
|
export { parseString, parseTokens } from '../lib/parser/parse.js';
|
|
11
13
|
import '../lib/parser/tokenize.js';
|
package/dist/web/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export { EnumToken, ValidationLevel } from '../lib/ast/types.js';
|
|
1
|
+
export { ColorType, EnumToken, ValidationLevel } from '../lib/ast/types.js';
|
|
2
2
|
export { minify } from '../lib/ast/minify.js';
|
|
3
3
|
export { walk, walkValues } from '../lib/ast/walk.js';
|
|
4
4
|
export { expand } from '../lib/ast/expand.js';
|
|
5
5
|
import { doRender } from '../lib/renderer/render.js';
|
|
6
6
|
export { renderToken } from '../lib/renderer/render.js';
|
|
7
|
-
import '../lib/
|
|
7
|
+
import '../lib/syntax/color/utils/constants.js';
|
|
8
|
+
export { convertColor } from '../lib/syntax/color/color.js';
|
|
9
|
+
export { isOkLabClose, okLabDistance } from '../lib/syntax/color/utils/distance.js';
|
|
8
10
|
import { doParse } from '../lib/parser/parse.js';
|
|
9
11
|
export { parseString, parseTokens } from '../lib/parser/parse.js';
|
|
10
12
|
import '../lib/parser/tokenize.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbela99/css-parser",
|
|
3
3
|
"description": "CSS parser for node and the browser",
|
|
4
|
-
"version": "v1.
|
|
4
|
+
"version": "v1.3.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/node/index.js",
|
|
7
7
|
"./node": "./dist/node/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"test": "web-test-runner \"test/**/web.spec.js\" --node-resolve --playwright --browsers chromium firefox webkit --root-dir=.; mocha --reporter-options='maxDiffSize=1801920' --timeout=10000 \"test/**/node.spec.js\"",
|
|
20
20
|
"test:web": "web-test-runner \"test/**/web.spec.js\" --node-resolve --playwright --browsers chromium firefox webkit --root-dir=.",
|
|
21
21
|
"test:node": "mocha --reporter-options='maxDiffSize=1801920' \"test/**/node.spec.js\"",
|
|
22
|
-
"test:cov": "c8 -x 'test/specs/**/*.js'
|
|
23
|
-
"test:web-cov": "web-test-runner -x 'test/specs/**/*.js'
|
|
22
|
+
"test:cov": "c8 -x 'test/specs/**/*.js' --reporter=html --reporter=text --reporter=json-summary mocha --reporter-options='maxDiffSize=1801920' --timeout=10000 \"test/**/node.spec.js\"",
|
|
23
|
+
"test:web-cov": "web-test-runner -x 'test/specs/**/*.js' \"test/**/web.spec.js\" --node-resolve --playwright --browsers chromium firefox webkit --root-dir=. --coverage",
|
|
24
24
|
"profile": "node --enable-source-maps --inspect-brk test/inspect.js",
|
|
25
25
|
"syntax-update": "esno tools/validation.ts",
|
|
26
26
|
"debug": "web-test-runner \"test/**/web.spec.js\" --manual --open --node-resolve --root-dir=."
|
|
@@ -70,4 +70,4 @@
|
|
|
70
70
|
"rollup-plugin-dts": "^6.2.1",
|
|
71
71
|
"tslib": "^2.8.1"
|
|
72
72
|
}
|
|
73
|
-
}
|
|
73
|
+
}
|