@tbela99/css-parser 1.4.6 → 1.4.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 +23 -0
- package/README.md +1 -0
- package/dist/index-umd-web.js +6578 -6969
- package/dist/index.cjs +7808 -8197
- package/dist/index.d.ts +923 -51
- package/dist/lib/ast/clone.js +16 -23
- package/dist/lib/ast/expand.js +2 -2
- package/dist/lib/ast/features/if.js +88 -87
- package/dist/lib/ast/features/inlinecssvariables.js +2 -2
- package/dist/lib/ast/features/prefix.js +26 -22
- package/dist/lib/ast/features/transform.js +3 -3
- package/dist/lib/ast/find.js +17 -14
- package/dist/lib/ast/minify.js +97 -94
- package/dist/lib/ast/types.js +10 -2
- package/dist/lib/ast/walk.js +1 -1
- package/dist/lib/fs/resolve.js +47 -45
- package/dist/lib/parser/arena.js +206 -0
- package/dist/lib/parser/declaration/list.js +9 -10
- package/dist/lib/parser/declaration/map.js +13 -18
- package/dist/lib/parser/linemap.js +62 -0
- package/dist/lib/parser/parse.js +331 -504
- package/dist/lib/parser/source.js +72 -0
- package/dist/lib/parser/tokenize.js +39 -33
- package/dist/lib/parser/utils/at-rule-container.js +244 -247
- package/dist/lib/parser/utils/at-rule-generic.js +25 -25
- package/dist/lib/parser/utils/at-rule-import.js +194 -234
- package/dist/lib/parser/utils/at-rule-media.js +284 -283
- package/dist/lib/parser/utils/at-rule-support.js +279 -251
- package/dist/lib/parser/utils/at-rule-when-else.js +256 -259
- package/dist/lib/parser/utils/at-rule.js +19 -16
- package/dist/lib/parser/utils/cache.js +33 -5
- package/dist/lib/parser/utils/declaration.js +260 -298
- package/dist/lib/parser/utils/hash.js +15 -15
- package/dist/lib/parser/utils/selector.js +182 -222
- package/dist/lib/parser/utils/token.js +4 -7
- package/dist/lib/renderer/render.js +152 -121
- package/dist/lib/syntax/color/alpha.js +1 -4
- package/dist/lib/syntax/color/color-mix.js +8 -1
- package/dist/lib/syntax/color/color.js +17 -9
- package/dist/lib/syntax/color/hex.js +1 -1
- package/dist/lib/syntax/color/p3.js +9 -1
- package/dist/lib/syntax/color/utils/colorspace.js +3 -3
- package/dist/lib/syntax/color/utils/components.js +21 -22
- package/dist/lib/syntax/color/utils/distance.js +6 -1
- package/dist/lib/syntax/color/utils/matrix.js +12 -11
- package/dist/lib/syntax/constants.js +25 -3
- package/dist/lib/syntax/syntax.js +240 -311
- package/dist/lib/validation/config.js +16 -17
- package/dist/lib/validation/match.js +1118 -1131
- package/dist/lib/validation/parser/parse.js +130 -286
- package/dist/node.js +18 -14
- package/dist/web.js +12 -10
- package/package.json +4 -4
- package/dist/lib/validation/utils/whitespace.js +0 -17
- /package/dist/lib/syntax/color/{relativecolor.js → relative-color.js} +0 -0
|
@@ -12,23 +12,23 @@ function getSyntaxConfig() {
|
|
|
12
12
|
function findNode(group, key) {
|
|
13
13
|
// @ts-expect-error
|
|
14
14
|
let obj = config[group];
|
|
15
|
-
const keys = Array.isArray(key) ? key : [key];
|
|
16
|
-
for (let i = 0; i < keys.length; i++) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (!(key in obj)) {
|
|
26
|
-
return null;
|
|
15
|
+
// const keys: string[] = Array.isArray(key) ? key : [key];
|
|
16
|
+
// for (let i = 0; i < keys.length; i++) {
|
|
17
|
+
// key = keys[i];
|
|
18
|
+
if (!(key in obj)) {
|
|
19
|
+
if (key.charAt(0) == "@" || key.charAt(0) == "-") {
|
|
20
|
+
const matches = key.match(/^(@?)(-[a-zA-Z]+)-(.*?)$/);
|
|
21
|
+
if (matches != null) {
|
|
22
|
+
key = matches[1] + matches[3];
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
if (!(key in obj)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
31
28
|
}
|
|
29
|
+
// @ts-expect-error
|
|
30
|
+
obj = obj[key];
|
|
31
|
+
// }
|
|
32
32
|
return obj;
|
|
33
33
|
}
|
|
34
34
|
const getParsedSyntax = memoize((group, key) => {
|
|
@@ -37,8 +37,7 @@ const getParsedSyntax = memoize((group, key) => {
|
|
|
37
37
|
if (obj == null) {
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
const index = group + "." + keys.join(".");
|
|
40
|
+
const index = group + "." + key;
|
|
42
41
|
if (!parsedSyntaxes.has(index)) {
|
|
43
42
|
const syntax = Object.freeze(trimSyntaxArray(parseSyntax(obj.syntax)));
|
|
44
43
|
parsedSyntaxes.set(index, syntax);
|
|
@@ -91,7 +90,7 @@ const getSyntaxRule = memoize((group, key) => {
|
|
|
91
90
|
node.syntax.includes("<stylesheet>"),
|
|
92
91
|
getPreludeRules: () => prelude,
|
|
93
92
|
getBlockRules: () => (block == null || block.length === 0 ? null : block),
|
|
94
|
-
getRules: () => syntaxRules,
|
|
93
|
+
// getRules: () => syntaxRules,
|
|
95
94
|
getPropertyDescriptors: () => propertyDescriptors,
|
|
96
95
|
};
|
|
97
96
|
});
|