@tbela99/css-parser 1.4.6 → 1.4.7
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 +17 -0
- package/README.md +1 -0
- package/dist/index-umd-web.js +6548 -6964
- package/dist/index.cjs +7784 -8198
- package/dist/index.d.ts +919 -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 +6 -2
- package/dist/lib/ast/walk.js +1 -1
- package/dist/lib/fs/resolve.js +46 -44
- package/dist/lib/parser/declaration/list.js +9 -10
- package/dist/lib/parser/declaration/map.js +13 -18
- package/dist/lib/parser/parse.js +331 -504
- 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 +286 -286
- 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 +150 -120
- package/dist/lib/syntax/color/alpha.js +1 -4
- package/dist/lib/syntax/color/color.js +5 -5
- 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/matrix.js +12 -11
- package/dist/lib/syntax/constants.js +22 -3
- package/dist/lib/syntax/syntax.js +252 -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 +16 -12
- package/dist/web.js +10 -8
- package/package.json +4 -4
- package/dist/lib/validation/utils/whitespace.js +0 -17
|
@@ -5,6 +5,7 @@ import { EnumToken } from '../../ast/types.js';
|
|
|
5
5
|
import { renderValue } from '../../renderer/render.js';
|
|
6
6
|
import { parseString } from '../parse.js';
|
|
7
7
|
import { PropertySet } from './set.js';
|
|
8
|
+
import { PROPERTYNAME } from '../../syntax/constants.js';
|
|
8
9
|
|
|
9
10
|
const propertiesConfig = getConfig();
|
|
10
11
|
class PropertyMap {
|
|
@@ -68,7 +69,7 @@ class PropertyMap {
|
|
|
68
69
|
}
|
|
69
70
|
if (
|
|
70
71
|
// @ts-ignore
|
|
71
|
-
|
|
72
|
+
acc[i][PROPERTYNAME] == property ||
|
|
72
73
|
matchType(acc[i], props)) {
|
|
73
74
|
if ("prefix" in props &&
|
|
74
75
|
props.previous != null &&
|
|
@@ -240,15 +241,15 @@ class PropertyMap {
|
|
|
240
241
|
}
|
|
241
242
|
value.push(t);
|
|
242
243
|
// @ts-ignore
|
|
243
|
-
if (
|
|
244
|
+
if (t[PROPERTYNAME] != null) {
|
|
244
245
|
// @ts-ignore
|
|
245
|
-
if (!map.has(t
|
|
246
|
+
if (!map.has(t[PROPERTYNAME])) {
|
|
246
247
|
// @ts-ignore
|
|
247
|
-
map.set(t
|
|
248
|
+
map.set(t[PROPERTYNAME], { t: [t], value: [cache.get(t)] });
|
|
248
249
|
}
|
|
249
250
|
else {
|
|
250
251
|
// @ts-ignore
|
|
251
|
-
const v = map.get(t
|
|
252
|
+
const v = map.get(t[PROPERTYNAME]);
|
|
252
253
|
v.t.push(t);
|
|
253
254
|
v.value.push(cache.get(t));
|
|
254
255
|
}
|
|
@@ -383,7 +384,7 @@ class PropertyMap {
|
|
|
383
384
|
isShorthand = match;
|
|
384
385
|
}
|
|
385
386
|
// @ts-ignore
|
|
386
|
-
if (
|
|
387
|
+
if (val[PROPERTYNAME] == property || match) {
|
|
387
388
|
if (!(curr[0] in tokens)) {
|
|
388
389
|
tokens[curr[0]] = [[]];
|
|
389
390
|
}
|
|
@@ -602,11 +603,8 @@ class PropertyMap {
|
|
|
602
603
|
}
|
|
603
604
|
let count = map.get(patterns[i]);
|
|
604
605
|
if (count > 0 && matchType(values[j], this.config.properties[patterns[i]])) {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
writable: true,
|
|
608
|
-
value: patterns[i],
|
|
609
|
-
});
|
|
606
|
+
// @ts-expect-error
|
|
607
|
+
values[j][PROPERTYNAME] = patterns[i];
|
|
610
608
|
map.set(patterns[i], --count);
|
|
611
609
|
values.splice(j--, 1);
|
|
612
610
|
}
|
|
@@ -620,14 +618,11 @@ class PropertyMap {
|
|
|
620
618
|
if (map.get(v) == 1) {
|
|
621
619
|
let i = declaration.val.length;
|
|
622
620
|
while (i--) {
|
|
623
|
-
// @ts-
|
|
624
|
-
if (declaration.val[i]
|
|
621
|
+
// @ts-expect-error
|
|
622
|
+
if (declaration.val[i][PROPERTYNAME] == key) {
|
|
625
623
|
const val = { ...declaration.val[i] };
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
writable: true,
|
|
629
|
-
value: v,
|
|
630
|
-
});
|
|
624
|
+
// @ts-expect-error
|
|
625
|
+
val[PROPERTYNAME] = v;
|
|
631
626
|
declaration.val.splice(i, 0, val, { typ: EnumToken.WhitespaceTokenType });
|
|
632
627
|
}
|
|
633
628
|
}
|