@tbela99/css-parser 1.6.2 → 1.6.4
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 +40 -0
- package/README.md +8 -8
- package/dist/{lib/data → data}/properties.json.js +296 -29
- package/dist/{lib/data → data}/validation.json.js +6 -0
- package/dist/index-umd-web.js +678 -461
- package/dist/index.cjs +678 -461
- package/dist/index.d.ts +9 -4
- package/dist/lib/ast/expand.js +1 -1
- package/dist/lib/ast/features/if.js +1 -1
- package/dist/lib/ast/features/inlinecssvariables.js +1 -1
- package/dist/lib/ast/features/prefix.js +1 -1
- package/dist/lib/ast/features/shorthand.js +10 -5
- package/dist/lib/ast/features/transform.js +1 -1
- package/dist/lib/ast/minify.js +1 -1
- package/dist/lib/ast/transform/utils.js +2 -2
- package/dist/lib/ast/walk.js +108 -90
- package/dist/lib/parser/declaration/list.js +19 -26
- package/dist/lib/parser/declaration/map.js +152 -33
- package/dist/lib/parser/parse.js +7 -7
- package/dist/lib/parser/source.js +2 -2
- package/dist/lib/parser/utils/config.js +1 -1
- package/dist/lib/parser/utils/declaration.js +0 -18
- package/dist/lib/parser/utils/hash.js +10 -5
- package/dist/lib/parser/utils/selector.js +1 -1
- package/dist/lib/{renderer → printer}/render.js +17 -17
- package/dist/lib/syntax/color/lch.js +0 -1
- package/dist/lib/syntax/color/oklch.js +0 -1
- package/dist/lib/syntax/color/xyzd50.js +0 -17
- package/dist/lib/syntax/constants.js +1 -1
- package/dist/lib/validation/config.js +5 -33
- package/dist/lib/validation/match.js +50 -180
- package/dist/node.js +3 -3
- package/dist/web.js +3 -3
- package/package.json +2 -2
- /package/dist/lib/{renderer → printer}/sourcemap/lib/codec.js +0 -0
- /package/dist/lib/{renderer → printer}/sourcemap/sourcemap.js +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2577,6 +2577,9 @@ var declarations = {
|
|
|
2577
2577
|
scale: {
|
|
2578
2578
|
syntax: "none | [ <number> | <percentage> ]{1,3}"
|
|
2579
2579
|
},
|
|
2580
|
+
"scroll-axis-lock": {
|
|
2581
|
+
syntax: "auto | none"
|
|
2582
|
+
},
|
|
2580
2583
|
"scroll-behavior": {
|
|
2581
2584
|
syntax: "auto | smooth"
|
|
2582
2585
|
},
|
|
@@ -2982,6 +2985,9 @@ var declarations = {
|
|
|
2982
2985
|
"will-change": {
|
|
2983
2986
|
syntax: "auto | <animateable-feature>#"
|
|
2984
2987
|
},
|
|
2988
|
+
"window-drag": {
|
|
2989
|
+
syntax: "none | move"
|
|
2990
|
+
},
|
|
2985
2991
|
"word-break": {
|
|
2986
2992
|
syntax: "normal | break-all | keep-all | break-word | auto-phrase"
|
|
2987
2993
|
},
|
|
@@ -7053,7 +7059,6 @@ function color2lchToken(token) {
|
|
|
7053
7059
|
return lchToken(values);
|
|
7054
7060
|
}
|
|
7055
7061
|
function lchToken(values) {
|
|
7056
|
-
values[2] = values[2];
|
|
7057
7062
|
const chi = [
|
|
7058
7063
|
{ typ: exports.EnumToken.NumberTokenType, val: values[0] },
|
|
7059
7064
|
{ typ: exports.EnumToken.NumberTokenType, val: values[1] },
|
|
@@ -7177,23 +7182,6 @@ function getLCHComponents(token) {
|
|
|
7177
7182
|
return alpha == null ? [l, c, h] : [l, c, h, alpha];
|
|
7178
7183
|
}
|
|
7179
7184
|
|
|
7180
|
-
// export function srgb2xyzd50values(r: number, g: number, b: number, alpha: number | null = null): number[] {
|
|
7181
|
-
// [r, g, b] = srgb2lsrgbvalues(r, g, b);
|
|
7182
|
-
//
|
|
7183
|
-
// const rgb: number[] = [
|
|
7184
|
-
// 0.436065742824811 * r + 0.3851514688337912 * g + 0.14307845442264197 * b,
|
|
7185
|
-
//
|
|
7186
|
-
// 0.22249319175623702 * r + 0.7168870538238823 * g + 0.06061979053616537 * b,
|
|
7187
|
-
//
|
|
7188
|
-
// 0.013923904500943465 * r + 0.09708128566574634 * g + 0.7140993584005155 * b,
|
|
7189
|
-
// ];
|
|
7190
|
-
//
|
|
7191
|
-
// if (alpha != null && alpha != 1) {
|
|
7192
|
-
// rgb.push(alpha);
|
|
7193
|
-
// }
|
|
7194
|
-
//
|
|
7195
|
-
// return rgb;
|
|
7196
|
-
// }
|
|
7197
7185
|
/*
|
|
7198
7186
|
*/
|
|
7199
7187
|
function xyzd502lch(x, y, z, alpha) {
|
|
@@ -7340,7 +7328,6 @@ function color2oklchToken(token) {
|
|
|
7340
7328
|
return oklchToken(srgb2oklch(values[0], values[1], values[2], values[3]));
|
|
7341
7329
|
}
|
|
7342
7330
|
function oklchToken(values) {
|
|
7343
|
-
values[2] = values[2];
|
|
7344
7331
|
const chi = [
|
|
7345
7332
|
{ typ: exports.EnumToken.NumberTokenType, val: values[0] },
|
|
7346
7333
|
{ typ: exports.EnumToken.NumberTokenType, val: values[1] },
|
|
@@ -9645,20 +9632,34 @@ exports.WalkerEvent = void 0;
|
|
|
9645
9632
|
function* walk(node, filter, reverse) {
|
|
9646
9633
|
const parents = [node];
|
|
9647
9634
|
const root = node;
|
|
9648
|
-
const map = new Map();
|
|
9649
9635
|
let options = filter;
|
|
9650
9636
|
let isNumeric = false;
|
|
9651
|
-
let
|
|
9637
|
+
let children = true;
|
|
9638
|
+
let attributes = false;
|
|
9652
9639
|
let i = 0;
|
|
9653
9640
|
if (options != null && typeof options == "object") {
|
|
9654
9641
|
filter = options.filter;
|
|
9655
9642
|
reverse = options.reverse;
|
|
9656
|
-
|
|
9643
|
+
attributes = options.attributes;
|
|
9644
|
+
children = options.children ?? true;
|
|
9657
9645
|
}
|
|
9646
|
+
// @ts-expect-error
|
|
9647
|
+
const result = {
|
|
9648
|
+
node: null,
|
|
9649
|
+
parent: null,
|
|
9650
|
+
root,
|
|
9651
|
+
parents: function* () {
|
|
9652
|
+
let parent = node[PARENT];
|
|
9653
|
+
while (parent != null) {
|
|
9654
|
+
yield parent;
|
|
9655
|
+
parent = parent[PARENT];
|
|
9656
|
+
}
|
|
9657
|
+
},
|
|
9658
|
+
};
|
|
9658
9659
|
while ((node = parents[i++])) {
|
|
9659
9660
|
let option = null;
|
|
9660
9661
|
if (filter != null) {
|
|
9661
|
-
// @ts-
|
|
9662
|
+
// @ts-expect-error
|
|
9662
9663
|
option = filter(node);
|
|
9663
9664
|
isNumeric = typeof option == "number";
|
|
9664
9665
|
if (isNumeric) {
|
|
@@ -9671,38 +9672,43 @@ function* walk(node, filter, reverse) {
|
|
|
9671
9672
|
}
|
|
9672
9673
|
}
|
|
9673
9674
|
if (!isNumeric || (option & exports.WalkerOptionEnum.Children) === 0) {
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
root,
|
|
9679
|
-
// @ts-expect-error
|
|
9680
|
-
parents: function* () {
|
|
9681
|
-
let parent = map.get(node);
|
|
9682
|
-
while (parent != null) {
|
|
9683
|
-
yield parent;
|
|
9684
|
-
parent = map.get(parent);
|
|
9685
|
-
}
|
|
9686
|
-
},
|
|
9687
|
-
};
|
|
9675
|
+
result.node = node;
|
|
9676
|
+
// @ts-expect-error
|
|
9677
|
+
result.parent = node[PARENT];
|
|
9678
|
+
yield result;
|
|
9688
9679
|
}
|
|
9689
|
-
if (
|
|
9680
|
+
if (attributes) {
|
|
9690
9681
|
if (node[TOKENS] != null) {
|
|
9691
|
-
// @ts-
|
|
9682
|
+
// @ts-expect-error
|
|
9692
9683
|
parents.splice(i, 0, ...(reverse ? node[TOKENS].toReversed() : node[TOKENS]));
|
|
9693
|
-
|
|
9684
|
+
for (const child of node[TOKENS]) {
|
|
9685
|
+
if (child[PARENT] != node) {
|
|
9686
|
+
child[PARENT] = node;
|
|
9687
|
+
}
|
|
9688
|
+
}
|
|
9689
|
+
// @ts-expect-error
|
|
9694
9690
|
}
|
|
9695
9691
|
else if (Array.isArray(node.val)) {
|
|
9696
|
-
// @ts-
|
|
9692
|
+
// @ts-expect-error
|
|
9693
|
+
for (const val of node.val) {
|
|
9694
|
+
if (val[PARENT] != node) {
|
|
9695
|
+
val[PARENT] = node;
|
|
9696
|
+
}
|
|
9697
|
+
}
|
|
9698
|
+
// @ts-expect-error
|
|
9697
9699
|
parents.splice(i, 0, ...(reverse ? node.val.toReversed() : node.val));
|
|
9698
9700
|
}
|
|
9699
9701
|
}
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9702
|
+
if (children &&
|
|
9703
|
+
// @ts-expect-error
|
|
9704
|
+
node["chi"] != null &&
|
|
9705
|
+
(!isNumeric || (option & exports.WalkerOptionEnum.IgnoreChildren) === 0)) {
|
|
9706
|
+
// @ts-expect-error
|
|
9703
9707
|
parents.splice(i, 0, ...(reverse ? node.chi.toReversed() : node.chi));
|
|
9704
9708
|
for (const child of node.chi) {
|
|
9705
|
-
|
|
9709
|
+
if (child[PARENT] != node) {
|
|
9710
|
+
child[PARENT] = node;
|
|
9711
|
+
}
|
|
9706
9712
|
}
|
|
9707
9713
|
}
|
|
9708
9714
|
}
|
|
@@ -9756,8 +9762,6 @@ function* walk(node, filter, reverse) {
|
|
|
9756
9762
|
*/
|
|
9757
9763
|
function* walkValues(values, root = null, filter, reverse) {
|
|
9758
9764
|
const stack = values.slice();
|
|
9759
|
-
const map = new Map();
|
|
9760
|
-
const used = new Set();
|
|
9761
9765
|
let previous = null;
|
|
9762
9766
|
if (filter != null && typeof filter == "function") {
|
|
9763
9767
|
filter = {
|
|
@@ -9774,31 +9778,43 @@ function* walkValues(values, root = null, filter, reverse) {
|
|
|
9774
9778
|
let value;
|
|
9775
9779
|
let option;
|
|
9776
9780
|
let node;
|
|
9777
|
-
|
|
9781
|
+
let i = -1;
|
|
9778
9782
|
const eventType = filter.event ?? exports.WalkerEvent.Enter;
|
|
9779
|
-
|
|
9780
|
-
|
|
9783
|
+
// @ts-ignore
|
|
9784
|
+
const result = {
|
|
9785
|
+
value: null,
|
|
9786
|
+
parent: null,
|
|
9787
|
+
previousValue: null,
|
|
9788
|
+
nextValue: null,
|
|
9789
|
+
//
|
|
9790
|
+
root: root ?? null,
|
|
9791
|
+
parents: function* () {
|
|
9792
|
+
// @ts-ignore
|
|
9793
|
+
let result = root;
|
|
9794
|
+
while (result != null) {
|
|
9795
|
+
yield result;
|
|
9796
|
+
result = result[PARENT] ?? null;
|
|
9797
|
+
}
|
|
9798
|
+
},
|
|
9799
|
+
};
|
|
9800
|
+
while (++i < stack.length) {
|
|
9801
|
+
value = stack[i];
|
|
9781
9802
|
option = null;
|
|
9782
|
-
node = map.get(value) ?? null;
|
|
9783
|
-
if (used.has(value)) {
|
|
9784
|
-
continue;
|
|
9785
|
-
}
|
|
9786
|
-
used.add(value);
|
|
9787
9803
|
if (filter.fn != null && eventType & exports.WalkerEvent.Enter) {
|
|
9788
9804
|
const isValid = filter.type == null ||
|
|
9789
9805
|
value.typ == filter.type ||
|
|
9790
9806
|
(Array.isArray(filter.type) && filter.type.includes(value.typ)) ||
|
|
9791
9807
|
(typeof filter.type == "function" && filter.type(value));
|
|
9792
9808
|
if (isValid) {
|
|
9793
|
-
// @ts-
|
|
9794
|
-
option = filter.fn(value,
|
|
9809
|
+
// @ts-expect-error
|
|
9810
|
+
option = filter.fn(value, value[PARENT] ?? root, exports.WalkerEvent.Enter,
|
|
9795
9811
|
// @ts-expect-error
|
|
9796
9812
|
function* () {
|
|
9797
9813
|
// @ts-expect-error
|
|
9798
|
-
let parent =
|
|
9814
|
+
let parent = node[PARENT];
|
|
9799
9815
|
while (parent != null) {
|
|
9800
9816
|
yield parent;
|
|
9801
|
-
parent =
|
|
9817
|
+
parent = parent[PARENT] ?? null;
|
|
9802
9818
|
}
|
|
9803
9819
|
});
|
|
9804
9820
|
isNumeric = typeof option == "number";
|
|
@@ -9808,48 +9824,30 @@ function* walkValues(values, root = null, filter, reverse) {
|
|
|
9808
9824
|
if (isNumeric && option & exports.WalkerOptionEnum.Ignore) {
|
|
9809
9825
|
continue;
|
|
9810
9826
|
}
|
|
9811
|
-
//
|
|
9827
|
+
//
|
|
9812
9828
|
if (option != null && typeof option == "object" && ("typ" in option || Array.isArray(option))) {
|
|
9813
9829
|
const op = Array.isArray(option) ? option : [option];
|
|
9830
|
+
stack.splice(i, 0, ...(reverse ? op.toReversed() : op));
|
|
9814
9831
|
for (const o of op) {
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
stack.unshift(o);
|
|
9818
|
-
}
|
|
9819
|
-
else {
|
|
9820
|
-
stack.push(o);
|
|
9832
|
+
if (o[PARENT] != value) {
|
|
9833
|
+
o[PARENT] = value;
|
|
9821
9834
|
}
|
|
9822
9835
|
}
|
|
9823
9836
|
}
|
|
9824
9837
|
}
|
|
9825
9838
|
}
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
// @ts-ignore
|
|
9832
|
-
root: root ?? null,
|
|
9833
|
-
// @ts-expect-error
|
|
9834
|
-
parents: function* () {
|
|
9835
|
-
// @ts-expect-error
|
|
9836
|
-
let result = map.get(node) ?? root;
|
|
9837
|
-
let next;
|
|
9838
|
-
do {
|
|
9839
|
-
yield result;
|
|
9840
|
-
next = map.get(result) ?? root;
|
|
9841
|
-
if (next == result) {
|
|
9842
|
-
break;
|
|
9843
|
-
}
|
|
9844
|
-
result = next;
|
|
9845
|
-
} while (result != null);
|
|
9846
|
-
},
|
|
9847
|
-
};
|
|
9839
|
+
result.value = value;
|
|
9840
|
+
result.parent = value[PARENT] ?? root;
|
|
9841
|
+
result.previousValue = previous;
|
|
9842
|
+
result.nextValue = stack[0] ?? null;
|
|
9843
|
+
yield result;
|
|
9848
9844
|
if (!isNumeric || (option & exports.WalkerOptionEnum.IgnoreChildren) === 0) {
|
|
9849
9845
|
if ("chi" in value) {
|
|
9850
9846
|
const sliced = value.chi.slice();
|
|
9851
9847
|
for (const child of sliced) {
|
|
9852
|
-
|
|
9848
|
+
if (child[PARENT] != value) {
|
|
9849
|
+
child[PARENT] = value;
|
|
9850
|
+
}
|
|
9853
9851
|
if (reverse) {
|
|
9854
9852
|
stack.unshift(child);
|
|
9855
9853
|
}
|
|
@@ -9861,31 +9859,41 @@ function* walkValues(values, root = null, filter, reverse) {
|
|
|
9861
9859
|
else {
|
|
9862
9860
|
const values = [];
|
|
9863
9861
|
if ("l" in value && value.l != null) {
|
|
9864
|
-
// @ts-
|
|
9862
|
+
// @ts-expect-error
|
|
9865
9863
|
values.push(value.l);
|
|
9866
|
-
// @ts-
|
|
9867
|
-
|
|
9864
|
+
// @ts-expect-error
|
|
9865
|
+
if (value.l[PARENT] != value) {
|
|
9866
|
+
// @ts-expect-error
|
|
9867
|
+
value.l[PARENT] = value;
|
|
9868
|
+
}
|
|
9868
9869
|
}
|
|
9869
9870
|
if ("op" in value && typeof value.op == "object") {
|
|
9870
|
-
// @ts-
|
|
9871
|
+
// @ts-expect-error
|
|
9871
9872
|
values.push(value.op);
|
|
9872
|
-
// @ts-
|
|
9873
|
-
|
|
9873
|
+
// @ts-expect-error
|
|
9874
|
+
if (value.op[PARENT] != value) {
|
|
9875
|
+
// @ts-expect-error
|
|
9876
|
+
value.op[PARENT] = value;
|
|
9877
|
+
}
|
|
9874
9878
|
}
|
|
9875
9879
|
if ("r" in value && value.r != null) {
|
|
9876
9880
|
if (Array.isArray(value.r)) {
|
|
9877
9881
|
for (const r of value.r) {
|
|
9878
|
-
//
|
|
9882
|
+
//
|
|
9879
9883
|
values.push(r);
|
|
9880
|
-
|
|
9881
|
-
|
|
9884
|
+
if (r[PARENT] != value) {
|
|
9885
|
+
//
|
|
9886
|
+
r[PARENT] = value;
|
|
9887
|
+
}
|
|
9882
9888
|
}
|
|
9883
9889
|
}
|
|
9884
9890
|
else {
|
|
9885
|
-
//
|
|
9891
|
+
//
|
|
9886
9892
|
values.push(value.r);
|
|
9887
|
-
|
|
9888
|
-
|
|
9893
|
+
if (value.r[PARENT] != value) {
|
|
9894
|
+
//
|
|
9895
|
+
value.r[PARENT] = value;
|
|
9896
|
+
}
|
|
9889
9897
|
}
|
|
9890
9898
|
}
|
|
9891
9899
|
if (values.length > 0) {
|
|
@@ -9907,17 +9915,14 @@ function* walkValues(values, root = null, filter, reverse) {
|
|
|
9907
9915
|
(typeof filter.type == "function" && filter.type(value));
|
|
9908
9916
|
if (isValid) {
|
|
9909
9917
|
// @ts-ignore
|
|
9910
|
-
option = filter.fn(value,
|
|
9918
|
+
option = filter.fn(value, value[PARENT], exports.WalkerEvent.Leave);
|
|
9911
9919
|
// @ts-ignore
|
|
9912
9920
|
if (option != null && ("typ" in option || Array.isArray(option))) {
|
|
9913
9921
|
const op = Array.isArray(option) ? option : [option];
|
|
9922
|
+
stack.splice(i, 0, ...(reverse ? op.toReversed() : op));
|
|
9914
9923
|
for (const o of op) {
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
stack.unshift(o);
|
|
9918
|
-
}
|
|
9919
|
-
else {
|
|
9920
|
-
stack.push(o);
|
|
9924
|
+
if (o[PARENT] != value) {
|
|
9925
|
+
o[PARENT] = value;
|
|
9921
9926
|
}
|
|
9922
9927
|
}
|
|
9923
9928
|
}
|
|
@@ -12042,52 +12047,24 @@ function getSyntaxConfig() {
|
|
|
12042
12047
|
// @ts-expect-error
|
|
12043
12048
|
return config$4;
|
|
12044
12049
|
}
|
|
12045
|
-
// export const getSyntax = memoize((group: ValidationSyntaxGroupEnum, key: string | string[]): null | string => {
|
|
12046
|
-
// // @ts-expect-error
|
|
12047
|
-
// let obj = config[group] as Record<ValidationSyntaxGroupEnum, ValidationSyntaxNode>;
|
|
12048
|
-
//
|
|
12049
|
-
// const keys: string[] = Array.isArray(key) ? key : [key];
|
|
12050
|
-
//
|
|
12051
|
-
// for (let i = 0; i < keys.length; i++) {
|
|
12052
|
-
// key = keys[i];
|
|
12053
|
-
//
|
|
12054
|
-
// if (!(key in obj)) {
|
|
12055
|
-
// if ((i == 0 && key.charAt(0) == "@") || key.charAt(0) == "-") {
|
|
12056
|
-
// const matches: RegExpMatchArray = key.match(/^(@?)(-[a-zA-Z]+)-(.*?)$/) as RegExpMatchArray;
|
|
12057
|
-
//
|
|
12058
|
-
// if (matches != null) {
|
|
12059
|
-
// key = matches[1] + matches[3];
|
|
12060
|
-
// }
|
|
12061
|
-
// }
|
|
12062
|
-
// }
|
|
12063
|
-
//
|
|
12064
|
-
// // @ts-expect-error
|
|
12065
|
-
// obj = obj[key];
|
|
12066
|
-
// }
|
|
12067
|
-
//
|
|
12068
|
-
// // @ts-expect-error
|
|
12069
|
-
// return obj?.syntax ?? null;
|
|
12070
|
-
// }) as (group: ValidationSyntaxGroupEnum, key: string | string[]) => null | string;
|
|
12071
12050
|
function findNode(group, key) {
|
|
12072
12051
|
// @ts-expect-error
|
|
12073
12052
|
let obj = config$4[group];
|
|
12074
|
-
//
|
|
12075
|
-
|
|
12076
|
-
// key = keys[i];
|
|
12077
|
-
if (!(key in obj)) {
|
|
12053
|
+
// @ts-expect-error
|
|
12054
|
+
if (obj[key] == null) {
|
|
12078
12055
|
if (key.charAt(0) == "@" || key.charAt(0) == "-") {
|
|
12079
12056
|
const matches = key.match(/^(@?)(-[a-zA-Z]+)-(.*?)$/);
|
|
12080
12057
|
if (matches != null) {
|
|
12081
12058
|
key = matches[1] + matches[3];
|
|
12082
12059
|
}
|
|
12083
12060
|
}
|
|
12084
|
-
|
|
12061
|
+
// @ts-expect-error
|
|
12062
|
+
if (obj[key] == null) {
|
|
12085
12063
|
return null;
|
|
12086
12064
|
}
|
|
12087
12065
|
}
|
|
12088
12066
|
// @ts-expect-error
|
|
12089
12067
|
obj = obj[key];
|
|
12090
|
-
// }
|
|
12091
12068
|
return obj;
|
|
12092
12069
|
}
|
|
12093
12070
|
const getParsedSyntax = memoize((group, key) => {
|
|
@@ -12198,6 +12175,20 @@ function cloneNode(node, cloneChildren = false, cloneMap = null) {
|
|
|
12198
12175
|
const config$3 = getSyntaxConfig();
|
|
12199
12176
|
// @ts-expect-error
|
|
12200
12177
|
const allValues = config$3.declarations.all.syntax.split(/[\s|]+/g);
|
|
12178
|
+
const selectorNodeTypes = [
|
|
12179
|
+
exports.EnumToken.CommaTokenType,
|
|
12180
|
+
exports.EnumToken.ColumnCombinatorTokenType,
|
|
12181
|
+
exports.EnumToken.ChildCombinatorTokenType,
|
|
12182
|
+
exports.EnumToken.NextSiblingCombinatorTokenType,
|
|
12183
|
+
exports.EnumToken.SubsequentSiblingCombinatorTokenType,
|
|
12184
|
+
];
|
|
12185
|
+
const trimWhitespaceBefore = selectorNodeTypes.concat(exports.EnumToken.DelimTokenType, exports.EnumToken.DashMatchTokenType, exports.EnumToken.IncludeMatchTokenType, exports.EnumToken.ContainMatchTokenType, exports.EnumToken.StartMatchTokenType, exports.EnumToken.EndMatchTokenType, exports.EnumToken.AttrEndTokenType);
|
|
12186
|
+
const trimWhitespaceAfter = selectorNodeTypes.concat(exports.EnumToken.DelimTokenType, exports.EnumToken.DashMatchTokenType, exports.EnumToken.IncludeMatchTokenType, exports.EnumToken.ContainMatchTokenType, exports.EnumToken.StartMatchTokenType, exports.EnumToken.EndMatchTokenType, exports.EnumToken.AttrStartTokenType);
|
|
12187
|
+
const selectorEnumMap = new Map([
|
|
12188
|
+
[exports.EnumToken.Tilda, exports.EnumToken.SubsequentSiblingCombinatorTokenType],
|
|
12189
|
+
[exports.EnumToken.GtTokenType, exports.EnumToken.ChildCombinatorTokenType],
|
|
12190
|
+
]);
|
|
12191
|
+
const propertyKeywordValues = new Map();
|
|
12201
12192
|
/**
|
|
12202
12193
|
* @type {Array.<EnumToken>}
|
|
12203
12194
|
*/
|
|
@@ -12421,24 +12412,6 @@ function createValidationContext(tokens) {
|
|
|
12421
12412
|
getRemainingTokens() {
|
|
12422
12413
|
return this.tokens.slice(this.index + 1);
|
|
12423
12414
|
},
|
|
12424
|
-
// last() {
|
|
12425
|
-
// let index: number = this.tokens.length - 1;
|
|
12426
|
-
// let token: Token = this.tokens[index];
|
|
12427
|
-
// while (
|
|
12428
|
-
// (this.index >= 0 && token?.typ === EnumToken.WhitespaceTokenType) ||
|
|
12429
|
-
// token?.typ === EnumToken.CommentTokenType ||
|
|
12430
|
-
// token?.typ === EnumToken.CDOCOMMTokenType ||
|
|
12431
|
-
// token?.typ === EnumToken.InvalidCommentTokenType ||
|
|
12432
|
-
// token?.typ === EnumToken.BadCommentTokenType ||
|
|
12433
|
-
// token?.typ === EnumToken.BadStringTokenType
|
|
12434
|
-
// ) {
|
|
12435
|
-
// token = this.tokens[--index];
|
|
12436
|
-
// if (token == null) {
|
|
12437
|
-
// break;
|
|
12438
|
-
// }
|
|
12439
|
-
// }
|
|
12440
|
-
// return token;
|
|
12441
|
-
// },
|
|
12442
12415
|
end() {
|
|
12443
12416
|
this.index = this.tokens.length + 1;
|
|
12444
12417
|
return this;
|
|
@@ -12498,19 +12471,6 @@ function createValidationContext(tokens) {
|
|
|
12498
12471
|
function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
12499
12472
|
const stack = [];
|
|
12500
12473
|
const tokens = [];
|
|
12501
|
-
const nodes = [
|
|
12502
|
-
exports.EnumToken.CommaTokenType,
|
|
12503
|
-
exports.EnumToken.ColumnCombinatorTokenType,
|
|
12504
|
-
exports.EnumToken.ChildCombinatorTokenType,
|
|
12505
|
-
exports.EnumToken.NextSiblingCombinatorTokenType,
|
|
12506
|
-
exports.EnumToken.SubsequentSiblingCombinatorTokenType,
|
|
12507
|
-
];
|
|
12508
|
-
const trimWhitespaceBefore = nodes.concat(exports.EnumToken.DelimTokenType, exports.EnumToken.DashMatchTokenType, exports.EnumToken.IncludeMatchTokenType, exports.EnumToken.ContainMatchTokenType, exports.EnumToken.StartMatchTokenType, exports.EnumToken.EndMatchTokenType, exports.EnumToken.AttrEndTokenType);
|
|
12509
|
-
const trimWhitespaceAfter = nodes.concat(exports.EnumToken.DelimTokenType, exports.EnumToken.DashMatchTokenType, exports.EnumToken.IncludeMatchTokenType, exports.EnumToken.ContainMatchTokenType, exports.EnumToken.StartMatchTokenType, exports.EnumToken.EndMatchTokenType, exports.EnumToken.AttrStartTokenType);
|
|
12510
|
-
const enumMap = new Map([
|
|
12511
|
-
[exports.EnumToken.Tilda, exports.EnumToken.SubsequentSiblingCombinatorTokenType],
|
|
12512
|
-
[exports.EnumToken.GtTokenType, exports.EnumToken.ChildCombinatorTokenType],
|
|
12513
|
-
]);
|
|
12514
12474
|
let token;
|
|
12515
12475
|
let i = 0;
|
|
12516
12476
|
let success = true;
|
|
@@ -12550,15 +12510,15 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
12550
12510
|
}
|
|
12551
12511
|
tokens.push(token);
|
|
12552
12512
|
if (tokensfuncDefMap.has(token.typ)) {
|
|
12553
|
-
if (stack.length > 0 &&
|
|
12513
|
+
if (stack.length > 0 && selectorNodeTypes.includes(stack.at(-1).typ)) {
|
|
12554
12514
|
stack.pop();
|
|
12555
12515
|
}
|
|
12556
12516
|
stack.push(token);
|
|
12557
12517
|
continue;
|
|
12558
12518
|
}
|
|
12559
12519
|
if (stack.length > 0 &&
|
|
12560
|
-
|
|
12561
|
-
!
|
|
12520
|
+
selectorNodeTypes.includes(stack.at(-1).typ) &&
|
|
12521
|
+
!selectorNodeTypes.includes(token.typ) &&
|
|
12562
12522
|
token.typ !== exports.EnumToken.WhitespaceTokenType &&
|
|
12563
12523
|
token.typ !== exports.EnumToken.CommentTokenType &&
|
|
12564
12524
|
token.typ !== exports.EnumToken.CDOCOMMTokenType) {
|
|
@@ -12604,7 +12564,7 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
12604
12564
|
break;
|
|
12605
12565
|
case exports.EnumToken.Tilda:
|
|
12606
12566
|
case exports.EnumToken.GtTokenType:
|
|
12607
|
-
Object.assign(token, { typ:
|
|
12567
|
+
Object.assign(token, { typ: selectorEnumMap.get(token.typ) });
|
|
12608
12568
|
case exports.EnumToken.ColumnCombinatorTokenType:
|
|
12609
12569
|
case exports.EnumToken.ChildCombinatorTokenType:
|
|
12610
12570
|
case exports.EnumToken.UniversalSelectorTokenType:
|
|
@@ -12617,7 +12577,7 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
12617
12577
|
if (stack.length > 0 && stack.at(-1)?.typ === exports.EnumToken.UniversalSelectorTokenType) {
|
|
12618
12578
|
stack.pop();
|
|
12619
12579
|
}
|
|
12620
|
-
if (stack.length > 0 &&
|
|
12580
|
+
if (stack.length > 0 && selectorNodeTypes.includes(stack.at(-1)?.typ)) {
|
|
12621
12581
|
return {
|
|
12622
12582
|
success: false,
|
|
12623
12583
|
errors: [
|
|
@@ -12727,106 +12687,10 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
12727
12687
|
};
|
|
12728
12688
|
}
|
|
12729
12689
|
slice.shift();
|
|
12730
|
-
// if (slice.length > 0) {
|
|
12731
|
-
// return {
|
|
12732
|
-
// success: false,
|
|
12733
|
-
// errors: [
|
|
12734
|
-
// {
|
|
12735
|
-
// action: "drop",
|
|
12736
|
-
// message: `Unexpected token ${EnumToken[slice[0].typ]} at ${slice[0][LOC]!.src}:${slice[0][LOCSTA].lin}:${
|
|
12737
|
-
// slice[0][LOCSTA].col
|
|
12738
|
-
// }`,
|
|
12739
|
-
// node: slice[0],
|
|
12740
|
-
// location: slice[0][LOC],
|
|
12741
|
-
// },
|
|
12742
|
-
// ],
|
|
12743
|
-
// };
|
|
12744
|
-
// }
|
|
12745
12690
|
stack.pop();
|
|
12746
12691
|
break;
|
|
12747
12692
|
}
|
|
12748
|
-
// case EnumToken.ColonTokenType:
|
|
12749
|
-
// if (stream[i + 1]?.typ === EnumToken.IdenTokenType) {
|
|
12750
|
-
// Object.assign(token, {
|
|
12751
|
-
// typ:
|
|
12752
|
-
// (stream[i + 1] as IdentToken).val === "page"
|
|
12753
|
-
// ? EnumToken.PseudoPageTokenType
|
|
12754
|
-
// : pseudoElements.includes((token as PseudoElementToken).val)
|
|
12755
|
-
// ? EnumToken.PseudoElementTokenType
|
|
12756
|
-
// : EnumToken.PseudoClassTokenType,
|
|
12757
|
-
// val: ":" + (stream[i + 1] as IdentToken).val,
|
|
12758
|
-
// });
|
|
12759
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
12760
|
-
// break;
|
|
12761
|
-
// } else if (stream[i + 1]?.typ === EnumToken.FunctionTokenDefType) {
|
|
12762
|
-
// Object.assign(token, {
|
|
12763
|
-
// typ: EnumToken.PseudoClassFunctionTokenDefType,
|
|
12764
|
-
// val: ":" + (stream[i + 1] as IdentToken).val,
|
|
12765
|
-
// });
|
|
12766
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
12767
|
-
// stack.push(token);
|
|
12768
|
-
// break;
|
|
12769
|
-
// }
|
|
12770
|
-
// return {
|
|
12771
|
-
// success: false,
|
|
12772
|
-
// errors: [
|
|
12773
|
-
// {
|
|
12774
|
-
// action: "drop",
|
|
12775
|
-
// message: `Unexpected token ${EnumToken[token.typ]} at ${token[LOC]!.src}:${token[LOCSTA].lin}:${
|
|
12776
|
-
// token[LOCSTA].col
|
|
12777
|
-
// }`,
|
|
12778
|
-
// node: token,
|
|
12779
|
-
// location: token[LOC],
|
|
12780
|
-
// },
|
|
12781
|
-
// ],
|
|
12782
|
-
// };
|
|
12783
|
-
// case EnumToken.DoubleColonTokenType:
|
|
12784
|
-
// if (stream[i + 1]?.typ === EnumToken.IdenTokenType) {
|
|
12785
|
-
// Object.assign(token, {
|
|
12786
|
-
// typ:
|
|
12787
|
-
// (stream[i + 1] as IdentToken).val === "page"
|
|
12788
|
-
// ? EnumToken.PseudoPageTokenType
|
|
12789
|
-
// : EnumToken.PseudoElementTokenType,
|
|
12790
|
-
// val: "::" + (stream[i + 1] as IdentToken).val,
|
|
12791
|
-
// });
|
|
12792
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
12793
|
-
// break;
|
|
12794
|
-
// } else if (stream[i + 1]?.typ === EnumToken.FunctionTokenDefType) {
|
|
12795
|
-
// Object.assign(token, {
|
|
12796
|
-
// typ: EnumToken.PseudoClassFunctionTokenDefType,
|
|
12797
|
-
// val: "::" + (stream[i + 1] as IdentToken).val,
|
|
12798
|
-
// });
|
|
12799
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
12800
|
-
// stack.push(token);
|
|
12801
|
-
// break;
|
|
12802
|
-
// }
|
|
12803
|
-
// return {
|
|
12804
|
-
// success: false,
|
|
12805
|
-
// errors: [
|
|
12806
|
-
// {
|
|
12807
|
-
// action: "drop",
|
|
12808
|
-
// message: `Unexpected token ${EnumToken[token.typ]} at ${token[LOC]!.src}:${token[LOCSTA].lin}:${
|
|
12809
|
-
// token[LOCSTA].col
|
|
12810
|
-
// }`,
|
|
12811
|
-
// node: token,
|
|
12812
|
-
// location: token[LOC],
|
|
12813
|
-
// },
|
|
12814
|
-
// ],
|
|
12815
|
-
// };
|
|
12816
12693
|
case exports.EnumToken.StartParensTokenType:
|
|
12817
|
-
// if (
|
|
12818
|
-
// tokens.at(-2)?.typ === EnumToken.PseudoClassTokenType ||
|
|
12819
|
-
// tokens.at(-2)?.typ === EnumToken.PseudoElementTokenType
|
|
12820
|
-
// ) {
|
|
12821
|
-
// stack.push(
|
|
12822
|
-
// Object.assign(tokens.at(-2) as Token, {
|
|
12823
|
-
// typ: EnumToken.PseudoClassFunctionTokenDefType,
|
|
12824
|
-
// chi: [],
|
|
12825
|
-
// }),
|
|
12826
|
-
// );
|
|
12827
|
-
// // tokens.pop();
|
|
12828
|
-
// break;
|
|
12829
|
-
// }
|
|
12830
12694
|
return {
|
|
12831
12695
|
success: false,
|
|
12832
12696
|
errors: [
|
|
@@ -12846,19 +12710,6 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
12846
12710
|
if (stack.at(-1)?.typ === exports.EnumToken.PseudoClassFunctionTokenDefType ||
|
|
12847
12711
|
stack.at(-1)?.typ === exports.EnumToken.PseudoElementTokenType) {
|
|
12848
12712
|
const token = stack.at(-1);
|
|
12849
|
-
// if (!((stack.at(-1) as PseudoClassFunctionToken).val + "()" in config.selectors)) {
|
|
12850
|
-
// return {
|
|
12851
|
-
// errors: [
|
|
12852
|
-
// {
|
|
12853
|
-
// action: "drop",
|
|
12854
|
-
// message: `Unknown class element ${(token as PseudoElementToken).val}`,
|
|
12855
|
-
// node: token,
|
|
12856
|
-
// location: token[LOC]!,
|
|
12857
|
-
// },
|
|
12858
|
-
// ],
|
|
12859
|
-
// success: false,
|
|
12860
|
-
// };
|
|
12861
|
-
// }
|
|
12862
12713
|
const index = tokens.indexOf(token);
|
|
12863
12714
|
const result = matchAllSyntaxes(getParsedSyntax(ValidationSyntaxGroupEnum.Selectors, token.val + "()")?.[0]?.chi ?? [], createValidationContext(tokens.slice(index + 1, tokens.length - 1)), options);
|
|
12864
12715
|
if (!result.success) {
|
|
@@ -12998,6 +12849,7 @@ function matchListSyntax(syntax, context, options) {
|
|
|
12998
12849
|
let tmpResult;
|
|
12999
12850
|
let count = 0;
|
|
13000
12851
|
let range;
|
|
12852
|
+
let done = false;
|
|
13001
12853
|
success = false;
|
|
13002
12854
|
do {
|
|
13003
12855
|
range = context.peekRange(exports.EnumToken.CommaTokenType, exports.EnumToken.CommaTokenType, 1);
|
|
@@ -13013,12 +12865,9 @@ function matchListSyntax(syntax, context, options) {
|
|
|
13013
12865
|
else {
|
|
13014
12866
|
context.update(range.at(-1));
|
|
13015
12867
|
}
|
|
13016
|
-
|
|
13017
|
-
// context.end();
|
|
13018
|
-
break;
|
|
13019
|
-
}
|
|
12868
|
+
done = context.done();
|
|
13020
12869
|
}
|
|
13021
|
-
} while (tmpResult.success && !
|
|
12870
|
+
} while (tmpResult.success && !done);
|
|
13022
12871
|
return result == null
|
|
13023
12872
|
? {
|
|
13024
12873
|
success: false,
|
|
@@ -13056,6 +12905,9 @@ function matchOccurenceSyntax(syntax, context, options) {
|
|
|
13056
12905
|
context.end();
|
|
13057
12906
|
break;
|
|
13058
12907
|
}
|
|
12908
|
+
if (tmpResult.context.index === context.index) {
|
|
12909
|
+
break;
|
|
12910
|
+
}
|
|
13059
12911
|
context.update(tmpResult.context.current());
|
|
13060
12912
|
if (match?.max?.val != null && Number.isFinite(match?.max?.val) && count === match.max.val) {
|
|
13061
12913
|
break;
|
|
@@ -13101,7 +12953,6 @@ function matchSyntax(syntaxes, context, options) {
|
|
|
13101
12953
|
errors: [],
|
|
13102
12954
|
};
|
|
13103
12955
|
}
|
|
13104
|
-
syntaxes = syntaxes.slice();
|
|
13105
12956
|
let i = -1;
|
|
13106
12957
|
let success = false;
|
|
13107
12958
|
let token = null;
|
|
@@ -13433,21 +13284,19 @@ function matchSyntax(syntaxes, context, options) {
|
|
|
13433
13284
|
case ValidationTokenEnum.PipeToken:
|
|
13434
13285
|
{
|
|
13435
13286
|
result = null;
|
|
13436
|
-
const results = [];
|
|
13437
13287
|
let tmp = null;
|
|
13438
13288
|
for (const syntax of syntaxes[i].chi) {
|
|
13439
13289
|
tmp = matchSyntax(syntax, context.slice(), options);
|
|
13440
13290
|
if (tmp.success) {
|
|
13441
|
-
|
|
13291
|
+
if (result == null || tmp.context.index >= result.context.index) {
|
|
13292
|
+
result = tmp;
|
|
13293
|
+
}
|
|
13442
13294
|
if (tmp.context.done()) {
|
|
13443
13295
|
context.end();
|
|
13444
13296
|
return { ...tmp, context, syntaxToken: syntaxes[i + 1] };
|
|
13445
13297
|
}
|
|
13446
13298
|
}
|
|
13447
13299
|
}
|
|
13448
|
-
if (results.length > 0) {
|
|
13449
|
-
result = results.reduce((a, b) => (a.context.index > b.context.index ? a : b));
|
|
13450
|
-
}
|
|
13451
13300
|
if (result?.success) {
|
|
13452
13301
|
success = true;
|
|
13453
13302
|
options.visited.get(token).delete(syntaxes[i]);
|
|
@@ -13809,7 +13658,8 @@ function matchAmpersandSyntax(syntax, context, options) {
|
|
|
13809
13658
|
*/
|
|
13810
13659
|
function matchProperty(property, context, options) {
|
|
13811
13660
|
let success = false;
|
|
13812
|
-
|
|
13661
|
+
const token = context.peek();
|
|
13662
|
+
let t = token?.typ;
|
|
13813
13663
|
let checkCalc = (t == exports.EnumToken.MathFunctionTokenDefType || t == exports.EnumToken.MathFunctionTokenType) &&
|
|
13814
13664
|
[
|
|
13815
13665
|
"number",
|
|
@@ -13824,19 +13674,19 @@ function matchProperty(property, context, options) {
|
|
|
13824
13674
|
"calc-product",
|
|
13825
13675
|
].includes(property.val);
|
|
13826
13676
|
if (checkCalc && !["number", "zero", "integer", "percentage", "length-percentage"].includes(property.val)) {
|
|
13827
|
-
checkCalc =
|
|
13677
|
+
checkCalc = token.val === "calc";
|
|
13828
13678
|
}
|
|
13829
13679
|
if (checkCalc) {
|
|
13830
13680
|
let result;
|
|
13831
|
-
const syntax = getParsedSyntax(ValidationSyntaxGroupEnum.Syntaxes,
|
|
13681
|
+
const syntax = getParsedSyntax(ValidationSyntaxGroupEnum.Syntaxes, token.val + "()")?.[0]?.chi;
|
|
13832
13682
|
if (t === exports.EnumToken.MathFunctionTokenType) {
|
|
13833
|
-
result = matchSyntax(syntax, createValidationContext(
|
|
13683
|
+
result = matchSyntax(syntax, createValidationContext(token.chi), options);
|
|
13834
13684
|
if (result.success && result.context.done()) {
|
|
13835
13685
|
context.next();
|
|
13836
13686
|
return {
|
|
13837
13687
|
success: true,
|
|
13838
13688
|
valid: true,
|
|
13839
|
-
token:
|
|
13689
|
+
token: token,
|
|
13840
13690
|
context,
|
|
13841
13691
|
syntaxToken: null,
|
|
13842
13692
|
errors: [],
|
|
@@ -14010,13 +13860,16 @@ function matchProperty(property, context, options) {
|
|
|
14010
13860
|
case "display-outside":
|
|
14011
13861
|
case "display-legacy":
|
|
14012
13862
|
case "content-position":
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
config$3.syntaxes[property.val].syntax
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
13863
|
+
{
|
|
13864
|
+
let values = propertyKeywordValues.get(property.val);
|
|
13865
|
+
if (values == null) {
|
|
13866
|
+
values = new Set(config$3.syntaxes[property.val].syntax.split(/[\s|]+/));
|
|
13867
|
+
propertyKeywordValues.set(property.val, values);
|
|
13868
|
+
}
|
|
13869
|
+
success =
|
|
13870
|
+
token?.typ == exports.EnumToken.IdenTokenType && values.has(token.val.toLowerCase());
|
|
13871
|
+
break;
|
|
13872
|
+
}
|
|
14020
13873
|
case "mf-name":
|
|
14021
13874
|
{
|
|
14022
13875
|
const token = context.peek();
|
|
@@ -14037,9 +13890,9 @@ function matchProperty(property, context, options) {
|
|
|
14037
13890
|
case "counter-name":
|
|
14038
13891
|
case "counter-style-name":
|
|
14039
13892
|
success =
|
|
14040
|
-
|
|
14041
|
-
if (success &&
|
|
14042
|
-
const val =
|
|
13893
|
+
token?.typ == exports.EnumToken.IdenTokenType || token?.typ == exports.EnumToken.DashedIdenTokenType;
|
|
13894
|
+
if (success && token?.typ === exports.EnumToken.IdenTokenType) {
|
|
13895
|
+
const val = token.val.toLowerCase();
|
|
14043
13896
|
success = "none" !== val && !allValues.includes(val);
|
|
14044
13897
|
}
|
|
14045
13898
|
break;
|
|
@@ -14553,7 +14406,6 @@ function matchRepeatableSyntax(syntax, context, options) {
|
|
|
14553
14406
|
let result = null;
|
|
14554
14407
|
let tmpResult;
|
|
14555
14408
|
let success = !!isRepeatable;
|
|
14556
|
-
// let index: number = context.index;
|
|
14557
14409
|
do {
|
|
14558
14410
|
tmpResult = matchSyntax([rest], context.slice(), options);
|
|
14559
14411
|
if (tmpResult.success) {
|
|
@@ -14563,15 +14415,10 @@ function matchRepeatableSyntax(syntax, context, options) {
|
|
|
14563
14415
|
context.end();
|
|
14564
14416
|
break;
|
|
14565
14417
|
}
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14418
|
+
if (tmpResult.context.index === context.index) {
|
|
14419
|
+
break;
|
|
14420
|
+
}
|
|
14569
14421
|
context.update(result.context.current());
|
|
14570
|
-
// }
|
|
14571
|
-
// if (index === context.index) {
|
|
14572
|
-
// break;
|
|
14573
|
-
// }
|
|
14574
|
-
// index = context.index;
|
|
14575
14422
|
}
|
|
14576
14423
|
} while (tmpResult.success && !context.done());
|
|
14577
14424
|
return {
|
|
@@ -18180,35 +18027,6 @@ var properties = {
|
|
|
18180
18027
|
"border-left-color": {
|
|
18181
18028
|
map: "border",
|
|
18182
18029
|
shorthand: "border-color"
|
|
18183
|
-
},
|
|
18184
|
-
"grid-row": {
|
|
18185
|
-
shorthand: "grid-row",
|
|
18186
|
-
properties: [
|
|
18187
|
-
"grid-row-start",
|
|
18188
|
-
"grid-row-end"
|
|
18189
|
-
],
|
|
18190
|
-
types: [
|
|
18191
|
-
"Iden",
|
|
18192
|
-
"Number"
|
|
18193
|
-
],
|
|
18194
|
-
multiple: true,
|
|
18195
|
-
valueSeparator: {
|
|
18196
|
-
typ: "Literal",
|
|
18197
|
-
val: "/"
|
|
18198
|
-
},
|
|
18199
|
-
"default": [
|
|
18200
|
-
"auto"
|
|
18201
|
-
],
|
|
18202
|
-
keywords: [
|
|
18203
|
-
"auto",
|
|
18204
|
-
"span"
|
|
18205
|
-
]
|
|
18206
|
-
},
|
|
18207
|
-
"grid-row-start": {
|
|
18208
|
-
shorthand: "grid-row"
|
|
18209
|
-
},
|
|
18210
|
-
"grid-row-end": {
|
|
18211
|
-
shorthand: "grid-row"
|
|
18212
18030
|
}
|
|
18213
18031
|
};
|
|
18214
18032
|
var map = {
|
|
@@ -19474,6 +19292,302 @@ var map = {
|
|
|
19474
19292
|
},
|
|
19475
19293
|
"background-size": {
|
|
19476
19294
|
shorthand: "background"
|
|
19295
|
+
},
|
|
19296
|
+
"grid-area": {
|
|
19297
|
+
shorthand: "grid-area",
|
|
19298
|
+
pattern: "grid-row-start grid-column-start grid-row-end grid-column-end",
|
|
19299
|
+
keywords: [
|
|
19300
|
+
"auto"
|
|
19301
|
+
],
|
|
19302
|
+
"default": [
|
|
19303
|
+
"auto"
|
|
19304
|
+
],
|
|
19305
|
+
multiple: false,
|
|
19306
|
+
expandShorthands: true,
|
|
19307
|
+
separator: {
|
|
19308
|
+
typ: "Literal",
|
|
19309
|
+
val: "/"
|
|
19310
|
+
},
|
|
19311
|
+
mapping: {
|
|
19312
|
+
"auto/auto": "auto",
|
|
19313
|
+
"auto/auto/auto": "auto",
|
|
19314
|
+
"auto/auto/auto/auto": "auto"
|
|
19315
|
+
},
|
|
19316
|
+
expandedProperties: {
|
|
19317
|
+
"grid-row": [
|
|
19318
|
+
"grid-row-start",
|
|
19319
|
+
"grid-row-end"
|
|
19320
|
+
],
|
|
19321
|
+
"grid-column": [
|
|
19322
|
+
"grid-column-start",
|
|
19323
|
+
"grid-column-end"
|
|
19324
|
+
]
|
|
19325
|
+
},
|
|
19326
|
+
properties: {
|
|
19327
|
+
"grid-row-start": {
|
|
19328
|
+
map: "grid-area",
|
|
19329
|
+
shorthand: "grid-row",
|
|
19330
|
+
types: [
|
|
19331
|
+
"Iden",
|
|
19332
|
+
"Number"
|
|
19333
|
+
],
|
|
19334
|
+
"default": [
|
|
19335
|
+
"auto"
|
|
19336
|
+
],
|
|
19337
|
+
keywords: [
|
|
19338
|
+
"auto"
|
|
19339
|
+
]
|
|
19340
|
+
},
|
|
19341
|
+
"grid-column-start": {
|
|
19342
|
+
map: "grid-area",
|
|
19343
|
+
shorthand: "grid-column",
|
|
19344
|
+
types: [
|
|
19345
|
+
"Iden",
|
|
19346
|
+
"Number"
|
|
19347
|
+
],
|
|
19348
|
+
prefix: {
|
|
19349
|
+
typ: "Literal",
|
|
19350
|
+
val: "/"
|
|
19351
|
+
},
|
|
19352
|
+
"default": [
|
|
19353
|
+
"auto"
|
|
19354
|
+
],
|
|
19355
|
+
keywords: [
|
|
19356
|
+
"auto"
|
|
19357
|
+
]
|
|
19358
|
+
},
|
|
19359
|
+
"grid-row-end": {
|
|
19360
|
+
map: "grid-area",
|
|
19361
|
+
shorthand: "grid-row",
|
|
19362
|
+
types: [
|
|
19363
|
+
"Iden",
|
|
19364
|
+
"Number"
|
|
19365
|
+
],
|
|
19366
|
+
prefix: {
|
|
19367
|
+
typ: "Literal",
|
|
19368
|
+
val: "/"
|
|
19369
|
+
},
|
|
19370
|
+
"default": [
|
|
19371
|
+
"auto"
|
|
19372
|
+
],
|
|
19373
|
+
keywords: [
|
|
19374
|
+
"auto"
|
|
19375
|
+
]
|
|
19376
|
+
},
|
|
19377
|
+
"grid-column-end": {
|
|
19378
|
+
map: "grid-area",
|
|
19379
|
+
shorthand: "grid-column",
|
|
19380
|
+
types: [
|
|
19381
|
+
"Iden",
|
|
19382
|
+
"Number"
|
|
19383
|
+
],
|
|
19384
|
+
prefix: {
|
|
19385
|
+
typ: "Literal",
|
|
19386
|
+
val: "/"
|
|
19387
|
+
},
|
|
19388
|
+
"default": [
|
|
19389
|
+
"auto"
|
|
19390
|
+
],
|
|
19391
|
+
keywords: [
|
|
19392
|
+
"auto"
|
|
19393
|
+
]
|
|
19394
|
+
}
|
|
19395
|
+
}
|
|
19396
|
+
},
|
|
19397
|
+
"grid-row-start": {
|
|
19398
|
+
shorthand: "grid-row"
|
|
19399
|
+
},
|
|
19400
|
+
"grid-column-start": {
|
|
19401
|
+
shorthand: "grid-column"
|
|
19402
|
+
},
|
|
19403
|
+
"grid-row-end": {
|
|
19404
|
+
shorthand: "grid-row"
|
|
19405
|
+
},
|
|
19406
|
+
"grid-column-end": {
|
|
19407
|
+
shorthand: "grid-column"
|
|
19408
|
+
},
|
|
19409
|
+
"grid-row": {
|
|
19410
|
+
shorthand: "grid-row",
|
|
19411
|
+
map: "grid-area",
|
|
19412
|
+
pattern: "grid-row-start grid-row-end",
|
|
19413
|
+
types: [
|
|
19414
|
+
"Iden",
|
|
19415
|
+
"Number"
|
|
19416
|
+
],
|
|
19417
|
+
keywords: [
|
|
19418
|
+
"auto"
|
|
19419
|
+
],
|
|
19420
|
+
"default": [
|
|
19421
|
+
"auto"
|
|
19422
|
+
],
|
|
19423
|
+
multiple: false,
|
|
19424
|
+
mapping: {
|
|
19425
|
+
"auto auto": "auto",
|
|
19426
|
+
"auto/auto": "auto"
|
|
19427
|
+
},
|
|
19428
|
+
properties: {
|
|
19429
|
+
"grid-row-start": {
|
|
19430
|
+
map: "grid-area",
|
|
19431
|
+
types: [
|
|
19432
|
+
"Iden",
|
|
19433
|
+
"Number"
|
|
19434
|
+
],
|
|
19435
|
+
"default": [
|
|
19436
|
+
"auto"
|
|
19437
|
+
],
|
|
19438
|
+
multiple: true,
|
|
19439
|
+
keywords: [
|
|
19440
|
+
"auto"
|
|
19441
|
+
]
|
|
19442
|
+
},
|
|
19443
|
+
"grid-row-end": {
|
|
19444
|
+
map: "grid-area",
|
|
19445
|
+
types: [
|
|
19446
|
+
"Iden",
|
|
19447
|
+
"Number"
|
|
19448
|
+
],
|
|
19449
|
+
"default": [
|
|
19450
|
+
"auto"
|
|
19451
|
+
],
|
|
19452
|
+
prefix: {
|
|
19453
|
+
typ: "Literal",
|
|
19454
|
+
val: "/"
|
|
19455
|
+
},
|
|
19456
|
+
multiple: true,
|
|
19457
|
+
keywords: [
|
|
19458
|
+
"auto"
|
|
19459
|
+
]
|
|
19460
|
+
}
|
|
19461
|
+
}
|
|
19462
|
+
},
|
|
19463
|
+
"grid-column": {
|
|
19464
|
+
shorthand: "grid-column",
|
|
19465
|
+
map: "grid-area",
|
|
19466
|
+
pattern: "grid-column-start grid-column-end",
|
|
19467
|
+
types: [
|
|
19468
|
+
"Iden",
|
|
19469
|
+
"Number"
|
|
19470
|
+
],
|
|
19471
|
+
keywords: [
|
|
19472
|
+
"auto"
|
|
19473
|
+
],
|
|
19474
|
+
"default": [
|
|
19475
|
+
"auto"
|
|
19476
|
+
],
|
|
19477
|
+
multiple: false,
|
|
19478
|
+
mapping: {
|
|
19479
|
+
"auto/auto": "auto"
|
|
19480
|
+
},
|
|
19481
|
+
properties: {
|
|
19482
|
+
"grid-column-start": {
|
|
19483
|
+
map: "grid-area",
|
|
19484
|
+
types: [
|
|
19485
|
+
"Iden",
|
|
19486
|
+
"Number"
|
|
19487
|
+
],
|
|
19488
|
+
"default": [
|
|
19489
|
+
"auto"
|
|
19490
|
+
],
|
|
19491
|
+
multiple: true,
|
|
19492
|
+
keywords: [
|
|
19493
|
+
"auto"
|
|
19494
|
+
]
|
|
19495
|
+
},
|
|
19496
|
+
"grid-column-end": {
|
|
19497
|
+
map: "grid-area",
|
|
19498
|
+
types: [
|
|
19499
|
+
"Iden",
|
|
19500
|
+
"Number"
|
|
19501
|
+
],
|
|
19502
|
+
"default": [
|
|
19503
|
+
"auto"
|
|
19504
|
+
],
|
|
19505
|
+
multiple: true,
|
|
19506
|
+
prefix: {
|
|
19507
|
+
typ: "Literal",
|
|
19508
|
+
val: "/"
|
|
19509
|
+
},
|
|
19510
|
+
keywords: [
|
|
19511
|
+
"auto"
|
|
19512
|
+
]
|
|
19513
|
+
}
|
|
19514
|
+
}
|
|
19515
|
+
},
|
|
19516
|
+
"grid-template": {
|
|
19517
|
+
shorthand: "grid-template",
|
|
19518
|
+
pattern: "grid-template-areas grid-template-rows grid-template-columns",
|
|
19519
|
+
keywords: [
|
|
19520
|
+
"none"
|
|
19521
|
+
],
|
|
19522
|
+
"default": [
|
|
19523
|
+
"none"
|
|
19524
|
+
],
|
|
19525
|
+
multiple: false,
|
|
19526
|
+
mapping: {
|
|
19527
|
+
"none none": "none",
|
|
19528
|
+
"none/none": "none",
|
|
19529
|
+
"none none/none": "none"
|
|
19530
|
+
},
|
|
19531
|
+
properties: {
|
|
19532
|
+
"grid-template-areas": {
|
|
19533
|
+
types: [
|
|
19534
|
+
"String"
|
|
19535
|
+
],
|
|
19536
|
+
"default": [
|
|
19537
|
+
"none"
|
|
19538
|
+
],
|
|
19539
|
+
multiple: true,
|
|
19540
|
+
keywords: [
|
|
19541
|
+
"none",
|
|
19542
|
+
"auto"
|
|
19543
|
+
],
|
|
19544
|
+
mapping: {
|
|
19545
|
+
}
|
|
19546
|
+
},
|
|
19547
|
+
"grid-template-rows": {
|
|
19548
|
+
types: [
|
|
19549
|
+
"Perc",
|
|
19550
|
+
"Iden",
|
|
19551
|
+
"Length",
|
|
19552
|
+
"Flex"
|
|
19553
|
+
],
|
|
19554
|
+
"default": [
|
|
19555
|
+
"none"
|
|
19556
|
+
],
|
|
19557
|
+
multiple: true,
|
|
19558
|
+
keywords: [
|
|
19559
|
+
"none"
|
|
19560
|
+
]
|
|
19561
|
+
},
|
|
19562
|
+
"grid-template-columns": {
|
|
19563
|
+
types: [
|
|
19564
|
+
"Perc",
|
|
19565
|
+
"Iden",
|
|
19566
|
+
"Length",
|
|
19567
|
+
"Flex"
|
|
19568
|
+
],
|
|
19569
|
+
"default": [
|
|
19570
|
+
"none"
|
|
19571
|
+
],
|
|
19572
|
+
prefix: {
|
|
19573
|
+
typ: "Literal",
|
|
19574
|
+
val: "/"
|
|
19575
|
+
},
|
|
19576
|
+
multiple: true,
|
|
19577
|
+
keywords: [
|
|
19578
|
+
"none"
|
|
19579
|
+
]
|
|
19580
|
+
}
|
|
19581
|
+
}
|
|
19582
|
+
},
|
|
19583
|
+
"grid-template-areas": {
|
|
19584
|
+
shorthand: "grid-template"
|
|
19585
|
+
},
|
|
19586
|
+
"grid-template-rows": {
|
|
19587
|
+
shorthand: "grid-template"
|
|
19588
|
+
},
|
|
19589
|
+
"grid-template-columns": {
|
|
19590
|
+
shorthand: "grid-template"
|
|
19477
19591
|
}
|
|
19478
19592
|
};
|
|
19479
19593
|
var property = {
|
|
@@ -19744,18 +19858,50 @@ class PropertyMap {
|
|
|
19744
19858
|
return this;
|
|
19745
19859
|
}
|
|
19746
19860
|
[Symbol.iterator]() {
|
|
19861
|
+
const propertiesMapping = { ...this.config.properties };
|
|
19862
|
+
const patterns = this.config.pattern.split(" ");
|
|
19863
|
+
let hasMapping = false;
|
|
19747
19864
|
let iterable;
|
|
19748
19865
|
let requiredCount = 0;
|
|
19749
19866
|
let property;
|
|
19750
19867
|
let isShorthand = true;
|
|
19751
|
-
|
|
19752
|
-
|
|
19753
|
-
|
|
19868
|
+
let declarations = this.declarations;
|
|
19869
|
+
for (const key of declarations.keys()) {
|
|
19870
|
+
if (declarations.has(key) && declarations.get(key) instanceof PropertyMap) {
|
|
19871
|
+
hasMapping = true;
|
|
19872
|
+
break;
|
|
19873
|
+
}
|
|
19874
|
+
}
|
|
19875
|
+
if (hasMapping) {
|
|
19876
|
+
const mapped = {};
|
|
19877
|
+
for (const key of declarations.keys()) {
|
|
19878
|
+
const value = declarations.get(key);
|
|
19879
|
+
if (value instanceof PropertyMap) {
|
|
19880
|
+
for (const [k, v] of value.declarations) {
|
|
19881
|
+
mapped[k] = v;
|
|
19882
|
+
}
|
|
19883
|
+
}
|
|
19884
|
+
else {
|
|
19885
|
+
mapped[key] = value;
|
|
19886
|
+
}
|
|
19887
|
+
}
|
|
19888
|
+
if (patterns.length === Object.keys(mapped).length) {
|
|
19889
|
+
declarations = new Map();
|
|
19890
|
+
for (const key of patterns) {
|
|
19891
|
+
if (mapped[key] != null) {
|
|
19892
|
+
declarations.set(key, mapped[key]);
|
|
19893
|
+
}
|
|
19894
|
+
}
|
|
19895
|
+
}
|
|
19896
|
+
}
|
|
19897
|
+
for (property of Object.keys(propertiesMapping)) {
|
|
19898
|
+
if (propertiesMapping[property].required) {
|
|
19899
|
+
if (!declarations.has(property)) {
|
|
19754
19900
|
isShorthand = false;
|
|
19755
19901
|
break;
|
|
19756
19902
|
}
|
|
19757
19903
|
else {
|
|
19758
|
-
const val =
|
|
19904
|
+
const val = declarations.get(property);
|
|
19759
19905
|
if (val instanceof PropertySet && !val.isShortHand()) {
|
|
19760
19906
|
isShorthand = false;
|
|
19761
19907
|
break;
|
|
@@ -19767,10 +19913,10 @@ class PropertyMap {
|
|
|
19767
19913
|
}
|
|
19768
19914
|
}
|
|
19769
19915
|
if (requiredCount === 0) {
|
|
19770
|
-
requiredCount =
|
|
19916
|
+
requiredCount = declarations.size;
|
|
19771
19917
|
}
|
|
19772
19918
|
if (!isShorthand || requiredCount < this.requiredCount) {
|
|
19773
|
-
if (isShorthand &&
|
|
19919
|
+
if (isShorthand && declarations.has(this.config.shorthand)) {
|
|
19774
19920
|
const cache = new Map();
|
|
19775
19921
|
const removeDefaults = (declaration) => {
|
|
19776
19922
|
let i;
|
|
@@ -19845,8 +19991,8 @@ class PropertyMap {
|
|
|
19845
19991
|
}
|
|
19846
19992
|
return declaration;
|
|
19847
19993
|
};
|
|
19848
|
-
const values = [...
|
|
19849
|
-
if (curr instanceof PropertySet) {
|
|
19994
|
+
const values = [...declarations.values()].reduce((acc, curr) => {
|
|
19995
|
+
if (curr instanceof PropertySet || curr instanceof PropertyMap) {
|
|
19850
19996
|
for (const declaration of curr) {
|
|
19851
19997
|
acc.push(declaration);
|
|
19852
19998
|
}
|
|
@@ -19886,13 +20032,13 @@ class PropertyMap {
|
|
|
19886
20032
|
}
|
|
19887
20033
|
return (filtered.length > 0 ? filtered : values)[Symbol.iterator]();
|
|
19888
20034
|
}
|
|
19889
|
-
for (const declaration of
|
|
19890
|
-
if (declaration instanceof PropertySet) {
|
|
20035
|
+
for (const declaration of declarations.values()) {
|
|
20036
|
+
if (declaration instanceof PropertySet || declaration instanceof PropertyMap) {
|
|
19891
20037
|
continue;
|
|
19892
20038
|
}
|
|
19893
20039
|
const config = declaration.nam == this.config.shorthand
|
|
19894
20040
|
? this.config
|
|
19895
|
-
: (
|
|
20041
|
+
: (propertiesMapping[declaration.nam] ?? this.config);
|
|
19896
20042
|
if (!("mapping" in config)) {
|
|
19897
20043
|
continue;
|
|
19898
20044
|
}
|
|
@@ -19909,7 +20055,7 @@ class PropertyMap {
|
|
|
19909
20055
|
}
|
|
19910
20056
|
}
|
|
19911
20057
|
// @ts-ignore
|
|
19912
|
-
iterable =
|
|
20058
|
+
iterable = declarations.values();
|
|
19913
20059
|
}
|
|
19914
20060
|
else {
|
|
19915
20061
|
let count = 0;
|
|
@@ -19923,19 +20069,19 @@ class PropertyMap {
|
|
|
19923
20069
|
: null;
|
|
19924
20070
|
const tokens = {};
|
|
19925
20071
|
// @ts-ignore
|
|
19926
|
-
Object.entries(
|
|
19927
|
-
if (!
|
|
20072
|
+
Object.entries(propertiesMapping).reduce((acc, curr) => {
|
|
20073
|
+
if (!declarations.has(curr[0])) {
|
|
19928
20074
|
if (curr[1].required) {
|
|
19929
20075
|
acc.push(curr[0]);
|
|
19930
20076
|
}
|
|
19931
20077
|
return acc;
|
|
19932
20078
|
}
|
|
19933
20079
|
let current = 0;
|
|
19934
|
-
const props =
|
|
19935
|
-
const properties = (
|
|
19936
|
-
for (const declaration of
|
|
19937
|
-
|
|
19938
|
-
|
|
20080
|
+
const props = propertiesMapping[curr[0]];
|
|
20081
|
+
const properties = (declarations.get(curr[0]));
|
|
20082
|
+
for (const declaration of properties instanceof PropertySet || properties instanceof PropertyMap
|
|
20083
|
+
? [...properties].flat()
|
|
20084
|
+
: [properties]) {
|
|
19939
20085
|
// @ts-ignore
|
|
19940
20086
|
for (const val of declaration.val) {
|
|
19941
20087
|
// @ts-ignore
|
|
@@ -19982,9 +20128,45 @@ class PropertyMap {
|
|
|
19982
20128
|
}
|
|
19983
20129
|
return acc;
|
|
19984
20130
|
}, []);
|
|
20131
|
+
// grid-template
|
|
20132
|
+
if (this.config.shorthand == "grid-template" && patterns.length == Object.keys(tokens).length) {
|
|
20133
|
+
const k = tokens[patterns[0]][0].length;
|
|
20134
|
+
const l = tokens[patterns[1]][0].length;
|
|
20135
|
+
const j = k < l ? k : l;
|
|
20136
|
+
const result = [];
|
|
20137
|
+
let i;
|
|
20138
|
+
for (i = 0; i < j; i++) {
|
|
20139
|
+
if (i < k) {
|
|
20140
|
+
result.push(tokens[patterns[0]][0][i]);
|
|
20141
|
+
}
|
|
20142
|
+
if (i < l) {
|
|
20143
|
+
result.push(tokens[patterns[1]][0][i]);
|
|
20144
|
+
}
|
|
20145
|
+
}
|
|
20146
|
+
if (j < k) {
|
|
20147
|
+
result.push(...tokens[patterns[0]][0].slice(j));
|
|
20148
|
+
}
|
|
20149
|
+
if (j < l) {
|
|
20150
|
+
result.push(...tokens[patterns[1]][0].slice(j));
|
|
20151
|
+
}
|
|
20152
|
+
const separator = this.config.properties[patterns[2]]?.prefix;
|
|
20153
|
+
result.push(
|
|
20154
|
+
// @ts-ignore
|
|
20155
|
+
{ ...separator, typ: exports.EnumToken[separator.typ] }, ...tokens[patterns[2]][0].reduce((acc, curr) => {
|
|
20156
|
+
if (acc.length > 0) {
|
|
20157
|
+
acc.push({ typ: exports.EnumToken.WhitespaceTokenType });
|
|
20158
|
+
}
|
|
20159
|
+
acc.push(curr);
|
|
20160
|
+
return acc;
|
|
20161
|
+
}, []));
|
|
20162
|
+
const declaration = cloneNode(declarations.get(patterns[0]));
|
|
20163
|
+
declaration.nam = this.config.shorthand;
|
|
20164
|
+
declaration.val = result;
|
|
20165
|
+
return [declaration][Symbol.iterator]();
|
|
20166
|
+
}
|
|
19985
20167
|
count++;
|
|
19986
20168
|
if (!isShorthand ||
|
|
19987
|
-
Object.entries(
|
|
20169
|
+
Object.entries(propertiesMapping).some((entry) => {
|
|
19988
20170
|
// missing required property
|
|
19989
20171
|
return entry[1].required && !(entry[0] in tokens);
|
|
19990
20172
|
}) ||
|
|
@@ -19993,27 +20175,74 @@ class PropertyMap {
|
|
|
19993
20175
|
// @ts-expect-error
|
|
19994
20176
|
v.filter((t) => t.typ != exports.EnumToken.CommentTokenType).length === count)) {
|
|
19995
20177
|
// @ts-ignore
|
|
19996
|
-
iterable =
|
|
20178
|
+
iterable = declarations.values();
|
|
20179
|
+
}
|
|
20180
|
+
else if (hasMapping) {
|
|
20181
|
+
if (patterns.length == Object.keys(tokens).length) {
|
|
20182
|
+
const declaration = cloneNode(declarations.get(patterns[0]));
|
|
20183
|
+
declaration.nam = this.config.shorthand;
|
|
20184
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
20185
|
+
if (declaration.val.length > 0) {
|
|
20186
|
+
declaration.val.push(
|
|
20187
|
+
// @ts-ignore
|
|
20188
|
+
this.config.separator != null
|
|
20189
|
+
? {
|
|
20190
|
+
...this.config.separator,
|
|
20191
|
+
typ: exports.EnumToken[this.config.separator.typ],
|
|
20192
|
+
}
|
|
20193
|
+
: { typ: exports.EnumToken.WhitespaceTokenType });
|
|
20194
|
+
}
|
|
20195
|
+
declaration.val.push(...tokens[patterns[i]].reduce((acc, curr) => {
|
|
20196
|
+
if (acc.length > 0) {
|
|
20197
|
+
acc.push({ typ: exports.EnumToken.WhitespaceTokenType });
|
|
20198
|
+
}
|
|
20199
|
+
acc.push(...curr.reduce((acc, curr) => {
|
|
20200
|
+
if (acc.length > 0) {
|
|
20201
|
+
acc.push({ typ: exports.EnumToken.WhitespaceTokenType });
|
|
20202
|
+
}
|
|
20203
|
+
acc.push(curr);
|
|
20204
|
+
return acc;
|
|
20205
|
+
}, []));
|
|
20206
|
+
return acc;
|
|
20207
|
+
}, []));
|
|
20208
|
+
}
|
|
20209
|
+
return [declaration][Symbol.iterator]();
|
|
20210
|
+
}
|
|
20211
|
+
iterable = declarations.values();
|
|
19997
20212
|
}
|
|
19998
20213
|
else {
|
|
19999
20214
|
let values = Object.entries(tokens)
|
|
20000
20215
|
.reduce((acc, curr) => {
|
|
20001
|
-
const props =
|
|
20216
|
+
const props = propertiesMapping[curr[0]];
|
|
20002
20217
|
for (let i = 0; i < curr[1].length; i++) {
|
|
20003
20218
|
if (acc.length == i) {
|
|
20004
20219
|
acc.push([]);
|
|
20005
20220
|
}
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
|
|
20012
|
-
|
|
20221
|
+
// if (acc[acc.length - 1].length > 0) {
|
|
20222
|
+
// acc[acc.length - 1].push(
|
|
20223
|
+
// // @ts-ignore
|
|
20224
|
+
// this.config.separator != null ?
|
|
20225
|
+
// {
|
|
20226
|
+
// ...this.config.separator,
|
|
20227
|
+
// typ: EnumToken[this.config.separator.typ as keyof typeof EnumToken],
|
|
20228
|
+
// } : <Token>{ typ: EnumToken.WhitespaceTokenType },
|
|
20229
|
+
// )
|
|
20230
|
+
// }
|
|
20231
|
+
let values = curr[1][i];
|
|
20232
|
+
// .reduce(
|
|
20233
|
+
// (acc, curr) => {
|
|
20234
|
+
// // if (acc.length > 0) {
|
|
20235
|
+
// // acc.push(<Token>{ typ: EnumToken.WhitespaceTokenType });
|
|
20236
|
+
// // }
|
|
20237
|
+
// acc.push(curr);
|
|
20238
|
+
// return acc;
|
|
20239
|
+
// },
|
|
20240
|
+
// <Token[]>[],
|
|
20241
|
+
// );
|
|
20013
20242
|
if (props.default.includes(curr[1][i]
|
|
20014
20243
|
.reduce((acc, curr) => acc + renderValue(curr) + " ", "")
|
|
20015
20244
|
.trimEnd())) {
|
|
20016
|
-
if (!
|
|
20245
|
+
if (!propertiesMapping[curr[0]].required) {
|
|
20017
20246
|
continue;
|
|
20018
20247
|
}
|
|
20019
20248
|
}
|
|
@@ -20027,7 +20256,7 @@ class PropertyMap {
|
|
|
20027
20256
|
exports.EnumToken.IdenTokenType,
|
|
20028
20257
|
].includes(v.typ) ||
|
|
20029
20258
|
(v.typ == exports.EnumToken.IdenTokenType &&
|
|
20030
|
-
!
|
|
20259
|
+
!propertiesMapping[curr[0]].default.includes(v.val))) {
|
|
20031
20260
|
doFilterDefault = false;
|
|
20032
20261
|
break;
|
|
20033
20262
|
}
|
|
@@ -20044,7 +20273,7 @@ class PropertyMap {
|
|
|
20044
20273
|
props.default.includes(val.val)));
|
|
20045
20274
|
});
|
|
20046
20275
|
if (filtered.length > 0 ||
|
|
20047
|
-
!(this.requiredCount == requiredCount &&
|
|
20276
|
+
!(this.requiredCount == requiredCount && propertiesMapping[curr[0]].required)) {
|
|
20048
20277
|
values = filtered;
|
|
20049
20278
|
}
|
|
20050
20279
|
if (values.length > 0) {
|
|
@@ -20069,6 +20298,7 @@ class PropertyMap {
|
|
|
20069
20298
|
acc[i].push({ ...props.prefix, typ: exports.EnumToken[props.prefix.typ] });
|
|
20070
20299
|
}
|
|
20071
20300
|
else if (acc[i].length > 0) {
|
|
20301
|
+
// @ts-ignore
|
|
20072
20302
|
acc[i].push({ typ: exports.EnumToken.WhitespaceTokenType });
|
|
20073
20303
|
}
|
|
20074
20304
|
for (const v of values.reduce((acc, curr) => {
|
|
@@ -20110,6 +20340,8 @@ class PropertyMap {
|
|
|
20110
20340
|
}
|
|
20111
20341
|
return acc;
|
|
20112
20342
|
}, []);
|
|
20343
|
+
// console.error({hasMapping, shorthand: this.config.shorthand, requiredCount, isShorthand,
|
|
20344
|
+
// declarations: declarations.values(), values});
|
|
20113
20345
|
if (this.config.mapping != null) {
|
|
20114
20346
|
const val = values.reduce((acc, curr) => acc +
|
|
20115
20347
|
renderValue(curr, {
|
|
@@ -20302,12 +20534,17 @@ function toSortedString(input) {
|
|
|
20302
20534
|
return String(input);
|
|
20303
20535
|
}
|
|
20304
20536
|
if (Array.isArray(input)) {
|
|
20305
|
-
|
|
20537
|
+
const result = new Array(input.length);
|
|
20538
|
+
for (const value of input) {
|
|
20539
|
+
result.push(toSortedString(value));
|
|
20540
|
+
}
|
|
20541
|
+
return JSON.stringify(result);
|
|
20306
20542
|
}
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20543
|
+
const keys = Object.keys(input).sort();
|
|
20544
|
+
for (let i = 0; i < keys.length; i++) {
|
|
20545
|
+
keys[i] = `${keys[i]}:${toSortedString(input[keys[i]])}`;
|
|
20546
|
+
}
|
|
20547
|
+
return `{${keys.join(",")}}`;
|
|
20311
20548
|
}
|
|
20312
20549
|
/**
|
|
20313
20550
|
* Object hash
|
|
@@ -20400,14 +20637,7 @@ class PropertyList {
|
|
|
20400
20637
|
this.options = options;
|
|
20401
20638
|
this.declarations = new Map();
|
|
20402
20639
|
}
|
|
20403
|
-
|
|
20404
|
-
// return this.add({
|
|
20405
|
-
// typ: EnumToken.DeclarationNodeType,
|
|
20406
|
-
// nam,
|
|
20407
|
-
// val: Array.isArray(value) ? value : parseString(String(value)),
|
|
20408
|
-
// });
|
|
20409
|
-
// }
|
|
20410
|
-
add(...declarations) {
|
|
20640
|
+
add(declarations) {
|
|
20411
20641
|
let name;
|
|
20412
20642
|
let syntaxRules = null;
|
|
20413
20643
|
let result;
|
|
@@ -20445,22 +20675,8 @@ class PropertyList {
|
|
|
20445
20675
|
}
|
|
20446
20676
|
// do not compute shorthand for invalid declarations
|
|
20447
20677
|
if (declaration[STATE] !== exports.EnumAstNodeStatus.Validated) {
|
|
20448
|
-
// const key = objectHash(declaration);
|
|
20449
|
-
// if (!this.ketsey.has(key)) {
|
|
20450
|
-
// this.ketsey.set(key, [declaration.nam]);
|
|
20451
|
-
// console.error(
|
|
20452
|
-
// `Adding declaration : ${(<AstDeclaration>declaration).nam} with key : ${key}`
|
|
20453
|
-
// )
|
|
20454
|
-
// }
|
|
20455
|
-
// else {
|
|
20456
|
-
// console.error(
|
|
20457
|
-
// `Duplicate declaration found: ${(<AstDeclaration>declaration).nam} with key : [ ${key} => ${this.ketsey.get(key)} ]`
|
|
20458
|
-
// )
|
|
20459
|
-
// console.error(JSON.stringify(toSortedString(declaration)))
|
|
20460
|
-
// this.ketsey.get(key).push(declaration.nam);
|
|
20461
|
-
// }
|
|
20462
20678
|
this.declarations.set(objectHash(declaration), declaration);
|
|
20463
|
-
|
|
20679
|
+
continue;
|
|
20464
20680
|
}
|
|
20465
20681
|
let propertyName = declaration.nam;
|
|
20466
20682
|
let shortHandType;
|
|
@@ -20488,15 +20704,28 @@ class PropertyList {
|
|
|
20488
20704
|
// @ts-ignore
|
|
20489
20705
|
shorthand = config.property[propertyName];
|
|
20490
20706
|
}
|
|
20707
|
+
// console.error({shortHandType, propertyName, config: config.map[propertyName], map: config.map[shorthand].properties[propertyName]});
|
|
20491
20708
|
// @ts-ignore
|
|
20492
20709
|
if (shortHandType == "map") {
|
|
20710
|
+
let owner = this;
|
|
20493
20711
|
// @ts-ignore
|
|
20494
|
-
|
|
20712
|
+
const mapName = config.map[propertyName]?.map ?? config.map[shorthand]?.properties?.[propertyName]?.map;
|
|
20713
|
+
if (typeof mapName === "string") {
|
|
20714
|
+
if (!this.declarations.has(mapName)) {
|
|
20715
|
+
// @ts-ignore
|
|
20716
|
+
this.declarations.set(mapName, new PropertyMap(config.map[mapName]));
|
|
20717
|
+
}
|
|
20718
|
+
owner = this.declarations.get(mapName);
|
|
20719
|
+
// console.error({mapName});
|
|
20720
|
+
}
|
|
20721
|
+
// @ts-ignore
|
|
20722
|
+
if (!owner.declarations.has(shorthand)) {
|
|
20495
20723
|
// @ts-ignore
|
|
20496
|
-
|
|
20724
|
+
owner.declarations.set(shorthand, new PropertyMap(config.map[shorthand]));
|
|
20497
20725
|
}
|
|
20726
|
+
// console.error({propertyName,mapName, owned: owner == this});
|
|
20498
20727
|
// @ts-ignore
|
|
20499
|
-
|
|
20728
|
+
owner.declarations.get(shorthand).add(declaration);
|
|
20500
20729
|
}
|
|
20501
20730
|
// @ts-ignore
|
|
20502
20731
|
else if (shortHandType == "set") {
|
|
@@ -20583,6 +20812,7 @@ class PropertyList {
|
|
|
20583
20812
|
[Symbol.iterator]() {
|
|
20584
20813
|
let iterator = this.declarations.values();
|
|
20585
20814
|
const iterators = [];
|
|
20815
|
+
// console.error(this);
|
|
20586
20816
|
return {
|
|
20587
20817
|
next() {
|
|
20588
20818
|
let value = iterator.next();
|
|
@@ -20632,8 +20862,9 @@ class ComputeShorthandFeature {
|
|
|
20632
20862
|
const j = ast.chi.length;
|
|
20633
20863
|
let k = 0;
|
|
20634
20864
|
let l;
|
|
20635
|
-
let properties = new PropertyList(options);
|
|
20865
|
+
// let properties: PropertyList = new PropertyList(options);
|
|
20636
20866
|
const rules = [];
|
|
20867
|
+
const declarations = [];
|
|
20637
20868
|
// @ts-ignore
|
|
20638
20869
|
for (; k < j; k++) {
|
|
20639
20870
|
l = k;
|
|
@@ -20651,7 +20882,8 @@ class ComputeShorthandFeature {
|
|
|
20651
20882
|
const node = ast.chi[l];
|
|
20652
20883
|
if (node.typ == exports.EnumToken.DeclarationNodeType) {
|
|
20653
20884
|
for (let m = k; m <= l; m++) {
|
|
20654
|
-
|
|
20885
|
+
declarations.push(ast.chi[m]);
|
|
20886
|
+
// properties.add(ast.chi![m]);
|
|
20655
20887
|
}
|
|
20656
20888
|
}
|
|
20657
20889
|
else {
|
|
@@ -20661,9 +20893,12 @@ class ComputeShorthandFeature {
|
|
|
20661
20893
|
}
|
|
20662
20894
|
k = l;
|
|
20663
20895
|
}
|
|
20664
|
-
|
|
20665
|
-
|
|
20666
|
-
|
|
20896
|
+
// console.error([...new PropertyList(options).add(declarations)]);
|
|
20897
|
+
if (declarations.length > 0) {
|
|
20898
|
+
ast.chi.length = 0;
|
|
20899
|
+
// @ts-expect-error
|
|
20900
|
+
ast.chi.push(...new PropertyList(options).add(declarations), ...rules);
|
|
20901
|
+
}
|
|
20667
20902
|
return ast;
|
|
20668
20903
|
}
|
|
20669
20904
|
}
|
|
@@ -20878,7 +21113,7 @@ class ComputeCalcExpressionFeature {
|
|
|
20878
21113
|
}
|
|
20879
21114
|
}
|
|
20880
21115
|
|
|
20881
|
-
const identityMatrix = new
|
|
21116
|
+
const identityMatrix = new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
20882
21117
|
function identity() {
|
|
20883
21118
|
return identityMatrix.slice();
|
|
20884
21119
|
}
|
|
@@ -20894,7 +21129,7 @@ function dot(point1, point2) {
|
|
|
20894
21129
|
return point1[0] * point2[0] + point1[1] * point2[1] + point1[2] * point2[2];
|
|
20895
21130
|
}
|
|
20896
21131
|
function multiply(matrixA, matrixB) {
|
|
20897
|
-
const result = new
|
|
21132
|
+
const result = new Float64Array(16);
|
|
20898
21133
|
result[0] = matrixA[0] * matrixB[0] + matrixA[4] * matrixB[1] + matrixA[8] * matrixB[2] + matrixA[12] * matrixB[3];
|
|
20899
21134
|
result[1] = matrixA[1] * matrixB[0] + matrixA[5] * matrixB[1] + matrixA[9] * matrixB[2] + matrixA[13] * matrixB[3];
|
|
20900
21135
|
result[2] = matrixA[2] * matrixB[0] + matrixA[6] * matrixB[1] + matrixA[10] * matrixB[2] + matrixA[14] * matrixB[3];
|
|
@@ -24982,7 +25217,6 @@ let sourceId = 0;
|
|
|
24982
25217
|
* Source file helper class
|
|
24983
25218
|
*/
|
|
24984
25219
|
class SourceFile {
|
|
24985
|
-
inputSourceMap = null;
|
|
24986
25220
|
/**
|
|
24987
25221
|
* Source file ID
|
|
24988
25222
|
*/
|
|
@@ -24999,6 +25233,7 @@ class SourceFile {
|
|
|
24999
25233
|
* Source file content
|
|
25000
25234
|
*/
|
|
25001
25235
|
content;
|
|
25236
|
+
inputSourceMap = null;
|
|
25002
25237
|
/**
|
|
25003
25238
|
* Constructor
|
|
25004
25239
|
* @param content
|
|
@@ -25180,7 +25415,7 @@ function doRender(data, options = {}, mapping) {
|
|
|
25180
25415
|
}
|
|
25181
25416
|
return acc + curr.val;
|
|
25182
25417
|
}
|
|
25183
|
-
return acc + renderValue(curr, options, cache, reducer
|
|
25418
|
+
return acc + renderValue(curr, options, cache, reducer);
|
|
25184
25419
|
}, cache),
|
|
25185
25420
|
errors,
|
|
25186
25421
|
stats: {
|
|
@@ -25490,7 +25725,7 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
25490
25725
|
}
|
|
25491
25726
|
return acc + curr.val;
|
|
25492
25727
|
}
|
|
25493
|
-
return acc + renderValue(curr, options, cache, reducer
|
|
25728
|
+
return acc + renderValue(curr, options, cache, reducer);
|
|
25494
25729
|
};
|
|
25495
25730
|
}
|
|
25496
25731
|
switch (token.typ) {
|
|
@@ -26330,9 +26565,9 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
26330
26565
|
? renderValue(token.val, options, cache)
|
|
26331
26566
|
: minifyNumber(token.val);
|
|
26332
26567
|
case exports.EnumToken.InfinityTokenType:
|
|
26333
|
-
return "
|
|
26568
|
+
return "1/0";
|
|
26334
26569
|
case exports.EnumToken.NegativeInfinityTokenType:
|
|
26335
|
-
return "-
|
|
26570
|
+
return "-1/0";
|
|
26336
26571
|
case exports.EnumToken.NaNTokenType:
|
|
26337
26572
|
return "NaN";
|
|
26338
26573
|
case exports.EnumToken.AtRuleTokenType:
|
|
@@ -26368,22 +26603,22 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
26368
26603
|
return token.val;
|
|
26369
26604
|
case exports.EnumToken.SupportsQueryUnaryConditionTokenType:
|
|
26370
26605
|
case exports.EnumToken.WhenElseUnaryConditionTokenType:
|
|
26371
|
-
return (renderValue(token.l, options, cache, reducer
|
|
26606
|
+
return (renderValue(token.l, options, cache, reducer) +
|
|
26372
26607
|
" " +
|
|
26373
|
-
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer
|
|
26608
|
+
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer), ""));
|
|
26374
26609
|
case exports.EnumToken.SupportsQueryConditionTokenType:
|
|
26375
26610
|
case exports.EnumToken.WhenElseQueryConditionTokenType:
|
|
26376
|
-
return (token.l.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer
|
|
26611
|
+
return (token.l.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer), "") +
|
|
26377
26612
|
" " +
|
|
26378
|
-
renderValue(token.op, options, cache, reducer
|
|
26613
|
+
renderValue(token.op, options, cache, reducer) +
|
|
26379
26614
|
" " +
|
|
26380
|
-
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer
|
|
26615
|
+
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer), ""));
|
|
26381
26616
|
case exports.EnumToken.IfConditionTokenType:
|
|
26382
26617
|
return token.l.length == 0
|
|
26383
26618
|
? ""
|
|
26384
|
-
: token.l.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer
|
|
26619
|
+
: token.l.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer), "") +
|
|
26385
26620
|
":" +
|
|
26386
|
-
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer
|
|
26621
|
+
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer), "");
|
|
26387
26622
|
case exports.EnumToken.IfElseConditionTokenType:
|
|
26388
26623
|
return renderValue(token.l) + renderValue(token.r);
|
|
26389
26624
|
case exports.EnumToken.DeclarationNodeType:
|
|
@@ -26391,7 +26626,7 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
26391
26626
|
":" +
|
|
26392
26627
|
(options.minify ? filterValues(token.val) : token.val).reduce((acc, curr) => acc + renderValue(curr, options, cache), ""));
|
|
26393
26628
|
case exports.EnumToken.MediaQueryUnaryFeatureTokenType:
|
|
26394
|
-
return (renderValue(token.l, options, cache, reducer
|
|
26629
|
+
return (renderValue(token.l, options, cache, reducer) +
|
|
26395
26630
|
" " +
|
|
26396
26631
|
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache), ""));
|
|
26397
26632
|
case exports.EnumToken.MediaQueryConditionTokenType: {
|
|
@@ -26403,16 +26638,16 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
26403
26638
|
token.op.typ == exports.EnumToken.GteTokenType
|
|
26404
26639
|
? ""
|
|
26405
26640
|
: " ";
|
|
26406
|
-
return (token.l.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer
|
|
26641
|
+
return (token.l.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer), "") +
|
|
26407
26642
|
indent +
|
|
26408
|
-
renderValue(token.op, options, cache, reducer
|
|
26643
|
+
renderValue(token.op, options, cache, reducer) +
|
|
26409
26644
|
indent +
|
|
26410
26645
|
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache), ""));
|
|
26411
26646
|
}
|
|
26412
26647
|
case exports.EnumToken.MediaRangeQueryTokenType:
|
|
26413
26648
|
return (token.l.reduce((acc, curr) => acc + renderValue(curr, options, cache), "") +
|
|
26414
26649
|
renderValue(token.op1) +
|
|
26415
|
-
token.val.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer
|
|
26650
|
+
token.val.reduce((acc, curr) => acc + renderValue(curr, options, cache, reducer), "") +
|
|
26416
26651
|
renderValue(token.op2) +
|
|
26417
26652
|
token.r.reduce((acc, curr) => acc + renderValue(curr, options, cache), ""));
|
|
26418
26653
|
case exports.EnumToken.MediaFeatureTokenType:
|
|
@@ -26437,8 +26672,8 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
26437
26672
|
console.debug({ token });
|
|
26438
26673
|
throw new Error(`Unsupported token type for ${exports.EnumToken[token.typ]}`);
|
|
26439
26674
|
}
|
|
26440
|
-
errors?.push({ action: "ignore", message: `render: unexpected token ${JSON.stringify(token, null, 1)}` });
|
|
26441
|
-
return "";
|
|
26675
|
+
// errors?.push({ action: "ignore", message: `render: unexpected token ${JSON.stringify(token, null, 1)}` });
|
|
26676
|
+
// return "";
|
|
26442
26677
|
}
|
|
26443
26678
|
/**
|
|
26444
26679
|
* Remove whitespace tokens that are not needed
|
|
@@ -28882,24 +29117,6 @@ function parseDeclaration(tokens, parent, options, errors) {
|
|
|
28882
29117
|
if (tokens[index].chi[l].typ === exports.EnumToken.StringTokenType) {
|
|
28883
29118
|
break;
|
|
28884
29119
|
}
|
|
28885
|
-
// else if ((tokens[index] as FunctionToken).chi[l].typ === EnumToken.IdenTokenType) {
|
|
28886
|
-
// let m: number = l + 1;
|
|
28887
|
-
// while (
|
|
28888
|
-
// (tokens[index] as FunctionToken).chi[m]?.typ === EnumToken.ClassSelectorTokenType
|
|
28889
|
-
// ) {
|
|
28890
|
-
// Object.assign((tokens[index] as FunctionToken).chi[l], {
|
|
28891
|
-
// typ: EnumToken.UrlTokenTokenType,
|
|
28892
|
-
// val:
|
|
28893
|
-
// ((tokens[index] as FunctionToken).chi[l] as IdentToken | UrlToken).val +
|
|
28894
|
-
// ((tokens[index] as FunctionToken).chi[m] as ClassSelectorToken).val,
|
|
28895
|
-
// });
|
|
28896
|
-
// (tokens[index] as FunctionToken).chi[l][LOCEND] = (
|
|
28897
|
-
// tokens[index] as FunctionToken
|
|
28898
|
-
// ).chi[m][LOCEND];
|
|
28899
|
-
// (tokens[index] as FunctionToken).chi.splice(m, 1);
|
|
28900
|
-
// }
|
|
28901
|
-
// break;
|
|
28902
|
-
// }
|
|
28903
29120
|
}
|
|
28904
29121
|
if (tokens[index].chi[l]?.typ === exports.EnumToken.StringTokenType &&
|
|
28905
29122
|
/^[a-zA-Z0-0/_.-]+$/.test(tokens[index].chi[l].val.slice(1, -1))) {
|
|
@@ -33150,7 +33367,7 @@ function parseAtRule(stream, context, options, errors, parseAsBlock = null) {
|
|
|
33150
33367
|
atRule[LOCEND] = (stream.at(-1) ?? atRule)[LOCEND];
|
|
33151
33368
|
// @ts-expect-error
|
|
33152
33369
|
return Object.assign(atRule, {
|
|
33153
|
-
typ:
|
|
33370
|
+
typ: exports.EnumToken.AtRuleNodeType,
|
|
33154
33371
|
val: renderTokens(trimArray(stream), options),
|
|
33155
33372
|
});
|
|
33156
33373
|
}
|
|
@@ -33158,12 +33375,12 @@ function parseAtRule(stream, context, options, errors, parseAsBlock = null) {
|
|
|
33158
33375
|
return null;
|
|
33159
33376
|
}
|
|
33160
33377
|
atRule[TOKENS] = stream;
|
|
33161
|
-
atRule[STATE] = exports.EnumAstNodeStatus.Validated;
|
|
33378
|
+
atRule[STATE] = success ? exports.EnumAstNodeStatus.Validated : exports.EnumAstNodeStatus.Invalid;
|
|
33162
33379
|
atRule[ERRORS] = [];
|
|
33163
33380
|
atRule[LOCEND] = (stream.at(-1) ?? atRule)[LOCEND];
|
|
33164
33381
|
// @ts-expect-error
|
|
33165
33382
|
return Object.assign(atRule, {
|
|
33166
|
-
typ:
|
|
33383
|
+
typ: exports.EnumToken.AtRuleNodeType,
|
|
33167
33384
|
val: renderTokens(trimArray(stream), options),
|
|
33168
33385
|
});
|
|
33169
33386
|
}
|
|
@@ -33721,9 +33938,9 @@ function parseAtRule(stream, context, options, errors, parseAsBlock = null) {
|
|
|
33721
33938
|
let result = null;
|
|
33722
33939
|
if (syntax == null) {
|
|
33723
33940
|
// check matching '(' and ')'
|
|
33724
|
-
// check commas , or ,,
|
|
33725
|
-
// check colon :
|
|
33726
|
-
// check or and and
|
|
33941
|
+
// check commas ',' or ',,'
|
|
33942
|
+
// check colon ':'
|
|
33943
|
+
// check 'or' and 'and'
|
|
33727
33944
|
result = matchGenericSyntax(stream, options);
|
|
33728
33945
|
if (result.errors.length > 0) {
|
|
33729
33946
|
for (const error of result.errors) {
|