@plumeria/eslint-plugin 10.4.3 → 10.5.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/README.md +5 -1
- package/dist/index.js +5 -1
- package/dist/rules/format-properties.js +144 -87
- package/dist/rules/no-combinator.js +11 -14
- package/dist/rules/no-destructure.js +5 -4
- package/dist/rules/no-inline-object.d.ts +2 -0
- package/dist/rules/no-inline-object.js +54 -0
- package/dist/rules/no-inner-call.js +5 -4
- package/dist/rules/no-unknown-css-properties.js +23 -25
- package/dist/rules/no-unused-keys.js +13 -15
- package/dist/rules/sort-properties.js +142 -82
- package/dist/rules/validate-values.js +1669 -1611
- package/package.json +1 -1
|
@@ -482,1650 +482,1708 @@ exports.validateValues = {
|
|
|
482
482
|
schema: [],
|
|
483
483
|
},
|
|
484
484
|
create(context) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
485
|
+
const plumeriaAliases = {};
|
|
486
|
+
function checkStyleObject(node) {
|
|
487
|
+
const obj = node;
|
|
488
|
+
obj.properties.forEach((prop) => {
|
|
489
|
+
const property = prop;
|
|
490
|
+
if (property.type !== 'Property' || !property.key || !property.value) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
if (property.value.type === 'ObjectExpression') {
|
|
494
|
+
if (!property.computed && property.key.type === 'Identifier') {
|
|
495
|
+
const keyName = property.key.name;
|
|
496
|
+
if (validData_1.validData[keyName]) {
|
|
497
|
+
context.report({
|
|
498
|
+
node: property.value,
|
|
499
|
+
messageId: 'invalidPrimitive',
|
|
500
|
+
data: {
|
|
501
|
+
key: keyName,
|
|
502
|
+
type: 'object',
|
|
503
|
+
value: 'object',
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
checkStyleObject(property.value);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (property.computed ||
|
|
512
|
+
property.key.type !== 'Identifier' ||
|
|
513
|
+
typeof property.key.name !== 'string') {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
const key = property.key.name;
|
|
517
|
+
if (!validData_1.validData[key]) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
if (property.value.type !== 'Literal') {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
const rawValue = property.value.value;
|
|
524
|
+
if (typeof rawValue === 'boolean' || rawValue === null) {
|
|
525
|
+
context.report({
|
|
526
|
+
node: property.value,
|
|
527
|
+
messageId: 'invalidPrimitive',
|
|
528
|
+
data: {
|
|
529
|
+
key,
|
|
530
|
+
type: rawValue === null ? 'null' : 'boolean',
|
|
531
|
+
value: String(rawValue),
|
|
532
|
+
},
|
|
533
|
+
});
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (typeof rawValue === 'number') {
|
|
537
|
+
const allowsNumber = [
|
|
538
|
+
...lengthValueProperties,
|
|
539
|
+
...lengthPercentage,
|
|
540
|
+
...otherGroupProperties,
|
|
541
|
+
...integerGroupProperties,
|
|
542
|
+
...multipleValueProperties,
|
|
543
|
+
...flexProperties,
|
|
544
|
+
...borderRadiusProperties,
|
|
545
|
+
...animationIterationCountProperties,
|
|
546
|
+
...aspectRatioProperties,
|
|
547
|
+
...gridItemProperties,
|
|
548
|
+
...strokeMiterlimitProperties,
|
|
549
|
+
...strokeDasharrayProperties,
|
|
550
|
+
...borderImageSlice,
|
|
551
|
+
...maskBorderSliceProperties,
|
|
552
|
+
...maskBorderWidthProperties,
|
|
553
|
+
...maskBorderOutsetProperties,
|
|
554
|
+
...mathDepthProperties,
|
|
555
|
+
...initialLetterProperties,
|
|
556
|
+
...hyphenateLimitCharsProperties,
|
|
557
|
+
...shapeImageThresholdProperties,
|
|
558
|
+
...columnsProperties,
|
|
559
|
+
];
|
|
560
|
+
if (!allowsNumber.includes(key)) {
|
|
500
561
|
context.report({
|
|
501
562
|
node: property.value,
|
|
502
|
-
messageId: '
|
|
563
|
+
messageId: 'invalidNumber',
|
|
503
564
|
data: {
|
|
504
565
|
key,
|
|
505
|
-
type: 'object',
|
|
506
|
-
value: 'object',
|
|
507
566
|
},
|
|
508
567
|
});
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
if (property.value.type !== 'Literal') {
|
|
512
|
-
return;
|
|
513
568
|
}
|
|
514
|
-
|
|
515
|
-
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (typeof rawValue !== 'string') {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
const value = rawValue;
|
|
575
|
+
const createReport = (property, key, value) => {
|
|
576
|
+
return () => {
|
|
516
577
|
context.report({
|
|
517
578
|
node: property.value,
|
|
518
|
-
messageId: '
|
|
579
|
+
messageId: 'validateValue',
|
|
519
580
|
data: {
|
|
520
581
|
key,
|
|
521
|
-
|
|
522
|
-
|
|
582
|
+
value,
|
|
583
|
+
validValues: validData_1.validData[key].join(', '),
|
|
523
584
|
},
|
|
524
585
|
});
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
if (typeof rawValue === 'number') {
|
|
528
|
-
const allowsNumber = [
|
|
529
|
-
...lengthValueProperties,
|
|
530
|
-
...lengthPercentage,
|
|
531
|
-
...otherGroupProperties,
|
|
532
|
-
...integerGroupProperties,
|
|
533
|
-
...multipleValueProperties,
|
|
534
|
-
...flexProperties,
|
|
535
|
-
...borderRadiusProperties,
|
|
536
|
-
...animationIterationCountProperties,
|
|
537
|
-
...aspectRatioProperties,
|
|
538
|
-
...gridItemProperties,
|
|
539
|
-
...strokeMiterlimitProperties,
|
|
540
|
-
...strokeDasharrayProperties,
|
|
541
|
-
...borderImageSlice,
|
|
542
|
-
...maskBorderSliceProperties,
|
|
543
|
-
...maskBorderWidthProperties,
|
|
544
|
-
...maskBorderOutsetProperties,
|
|
545
|
-
...mathDepthProperties,
|
|
546
|
-
...initialLetterProperties,
|
|
547
|
-
...hyphenateLimitCharsProperties,
|
|
548
|
-
...shapeImageThresholdProperties,
|
|
549
|
-
...columnsProperties,
|
|
550
|
-
];
|
|
551
|
-
if (!allowsNumber.includes(key)) {
|
|
552
|
-
context.report({
|
|
553
|
-
node: property.value,
|
|
554
|
-
messageId: 'invalidNumber',
|
|
555
|
-
data: {
|
|
556
|
-
key,
|
|
557
|
-
},
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
if (typeof rawValue !== 'string') {
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
const value = rawValue;
|
|
566
|
-
const createReport = (property, key, value) => {
|
|
567
|
-
return () => {
|
|
568
|
-
context.report({
|
|
569
|
-
node: property.value,
|
|
570
|
-
messageId: 'validateValue',
|
|
571
|
-
data: {
|
|
572
|
-
key,
|
|
573
|
-
value,
|
|
574
|
-
validValues: validData_1.validData[key].join(', '),
|
|
575
|
-
},
|
|
576
|
-
});
|
|
577
|
-
};
|
|
578
586
|
};
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
hasWidth = true;
|
|
844
|
-
}
|
|
845
|
-
else if (lineStyle.includes(part)) {
|
|
846
|
-
if (hasStyle)
|
|
847
|
-
return false;
|
|
848
|
-
hasStyle = true;
|
|
849
|
-
}
|
|
850
|
-
else if (isValidColorValue(part)) {
|
|
851
|
-
if (hasColor)
|
|
852
|
-
return false;
|
|
853
|
-
hasColor = true;
|
|
854
|
-
}
|
|
855
|
-
else {
|
|
587
|
+
};
|
|
588
|
+
const report = createReport(property, key, value);
|
|
589
|
+
const globalValue = !validData_1.validData[key].includes(value) &&
|
|
590
|
+
!globalValues.includes(value) &&
|
|
591
|
+
!varRegex.test(value);
|
|
592
|
+
const isBorderWidth = borderWidthProperties.includes(key);
|
|
593
|
+
const multiAutoProperties = [
|
|
594
|
+
'borderImageWidth',
|
|
595
|
+
'margin',
|
|
596
|
+
'inset',
|
|
597
|
+
'backgroundSize',
|
|
598
|
+
'marginBlock',
|
|
599
|
+
'marginInline',
|
|
600
|
+
'scrollPaddingBlock',
|
|
601
|
+
'scrollPaddingInline',
|
|
602
|
+
];
|
|
603
|
+
const isAuto = multiAutoProperties.includes(key);
|
|
604
|
+
const numberAndLengthValues = [
|
|
605
|
+
'borderImageWidth',
|
|
606
|
+
'borderImageOutset',
|
|
607
|
+
'lineHeight',
|
|
608
|
+
'strokeDashoffset',
|
|
609
|
+
'strokeWidth',
|
|
610
|
+
'tabSize',
|
|
611
|
+
'zoom',
|
|
612
|
+
];
|
|
613
|
+
const isNumber = numberAndLengthValues.includes(key);
|
|
614
|
+
const isBackgroundSize = 'backgroundSize'.includes(key);
|
|
615
|
+
const isBackgroundPositionX = 'backgroundPositionX'.includes(key);
|
|
616
|
+
const isBackgroundPositionY = 'backgroundPositionY'.includes(key);
|
|
617
|
+
const isBackgroundPosition = 'backgroundPosition'.includes(key);
|
|
618
|
+
const integerValueRegex = RegExp(`^${integerPattern}$`);
|
|
619
|
+
const percentageValueRegex = RegExp(`^${percentagePattern}$`);
|
|
620
|
+
const isFitContentGroup = [
|
|
621
|
+
'width',
|
|
622
|
+
'maxWidth',
|
|
623
|
+
'minWidth',
|
|
624
|
+
'height',
|
|
625
|
+
'maxHeight',
|
|
626
|
+
'minHeight',
|
|
627
|
+
'flexBasis',
|
|
628
|
+
'blockSize',
|
|
629
|
+
'columnWidth',
|
|
630
|
+
'inlineSize',
|
|
631
|
+
];
|
|
632
|
+
const isFitContent = isFitContentGroup.includes(key);
|
|
633
|
+
const isLengthPercentage = lengthPercentage.includes(key);
|
|
634
|
+
const lengthValuePattern = `${lengthPattern}` +
|
|
635
|
+
(isLengthPercentage ? `|${percentagePattern}` : '') +
|
|
636
|
+
(isFitContent ? `|${fitContentString}` : '') +
|
|
637
|
+
(isNumber ? `|${numberPattern}` : '') +
|
|
638
|
+
(isAuto ? `|auto` : '') +
|
|
639
|
+
(isBorderWidth ? '|thin|medium|thick' : '') +
|
|
640
|
+
(isBackgroundPositionY ? '|top|center|bottom' : '') +
|
|
641
|
+
(isBackgroundPositionX ? '|left|center|right' : '') +
|
|
642
|
+
(isBackgroundPosition ? '|top|bottom|center|left|right' : '') +
|
|
643
|
+
(isBackgroundSize ? '|cover|contain' : '') +
|
|
644
|
+
`|${calcString}|${clampString}|${anchorString}|${anchorSizeString}|${minString}|${maxString}|${varString}`;
|
|
645
|
+
const lengthValueRegex = new RegExp(`^(${lengthValuePattern})$`);
|
|
646
|
+
const isOtherGroups = [
|
|
647
|
+
'opacity',
|
|
648
|
+
'stopOpacity',
|
|
649
|
+
'strokeOpacity',
|
|
650
|
+
].includes(key);
|
|
651
|
+
const otherSingleValue = `${numberPattern}` + (isOtherGroups ? '%?' : '') + `|0`;
|
|
652
|
+
const otherSingleValueRegex = new RegExp(`^(${otherSingleValue})$`);
|
|
653
|
+
const multipleValueRegex = new RegExp(`^(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,${valueCountMap[key] - 1}}$`);
|
|
654
|
+
const backgroundPairRegex = new RegExp(`^(${lengthValuePattern})(\\s+(${lengthValuePattern}))?(\\s*,\\s*(${lengthValuePattern})(\\s+(${lengthValuePattern}))?)*$`);
|
|
655
|
+
const backgroundPairProperties = [
|
|
656
|
+
'backgroundSize',
|
|
657
|
+
'backgroundPositionY',
|
|
658
|
+
'backgroundPositionX',
|
|
659
|
+
];
|
|
660
|
+
const backgroundQuadRegex = new RegExp(`^(${lengthValuePattern})(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?(\\s*,\\s*(${lengthValuePattern})(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?)*$`);
|
|
661
|
+
const backgroundQuadProperties = ['backgroundPosition'];
|
|
662
|
+
const visualBox = 'border-box|padding-box|content-box|' + varString;
|
|
663
|
+
const backgroundOriginRegex = new RegExp(`^(${visualBox})(\\s*,\\s*(${visualBox}))*$`);
|
|
664
|
+
const backgroundOriginProperties = [
|
|
665
|
+
'backgroundOrigin',
|
|
666
|
+
'backgroundClip',
|
|
667
|
+
];
|
|
668
|
+
const blendMode = [
|
|
669
|
+
'normal',
|
|
670
|
+
'multiply',
|
|
671
|
+
'screen',
|
|
672
|
+
'overlay',
|
|
673
|
+
'darken',
|
|
674
|
+
'lighten',
|
|
675
|
+
'color-dodge',
|
|
676
|
+
'color-burn',
|
|
677
|
+
'hard-light',
|
|
678
|
+
'soft-light',
|
|
679
|
+
'difference',
|
|
680
|
+
'exclusion',
|
|
681
|
+
'hue',
|
|
682
|
+
'saturation',
|
|
683
|
+
'color',
|
|
684
|
+
'luminosity',
|
|
685
|
+
varString,
|
|
686
|
+
].join('|');
|
|
687
|
+
const backgroundBlendModeRegex = new RegExp(`^(${blendMode})(\\s*,\\s*(${blendMode}))*$`);
|
|
688
|
+
const backgroundBlendModeProperties = ['backgroundBlendMode'];
|
|
689
|
+
const attachment = `scroll|fixed|local|${varString}`;
|
|
690
|
+
const backgroundAttachmentProperties = ['backgroundAttachment'];
|
|
691
|
+
const backgroundAttachmentRegex = new RegExp(`^(${attachment})(\\s*,\\s*(${attachment}))*$`);
|
|
692
|
+
const backgroundImageRegex = new RegExp(`^(${gradientString}|${urlString}|${varString}|none)(\\s*,\\s*(${gradientString}|${urlString}|${varString}|none))*$`);
|
|
693
|
+
const backgroundImageProperties = ['backgroundImage'];
|
|
694
|
+
const repeatKeyword = 'repeat|space|round|no-repeat';
|
|
695
|
+
const backgroundRepeatRegex = new RegExp(`^(((?:${repeatKeyword}|${varString})(\\s+(?:${repeatKeyword}|${varString})))?|(repeatX|repeatY))$`);
|
|
696
|
+
const backgroundRepeatProperties = ['backgroundRepeat'];
|
|
697
|
+
const backgroundRepeatSource = backgroundRepeatRegex.source.slice(1, -1);
|
|
698
|
+
const positionKeyword = `top|bottom|center|left|right|${varString}`;
|
|
699
|
+
const sizeKeyword = 'cover|contain';
|
|
700
|
+
const urlPattern = `(?:${urlString}|${gradientString}|${varString}\\s*)?`;
|
|
701
|
+
const positionPattern = `(?:${positionKeyword})(?:\\s+${positionKeyword})?`;
|
|
702
|
+
const singleValuePattern = `(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,2}?`;
|
|
703
|
+
const sizePattern = `(?:\\s*/\\s*(?:${sizeKeyword}|${singleValuePattern}))?`;
|
|
704
|
+
const repeatPattern = `(?:(?:${backgroundRepeatSource})\\s+)?`;
|
|
705
|
+
const attachmentPattern = `(?:${attachment}\\s+)?`;
|
|
706
|
+
const visualBoxPattern = `(?:${visualBox}\\s+)?`;
|
|
707
|
+
const colorValuePattern = `(?:\\s*${colorSource})?`;
|
|
708
|
+
const positionAndSizePattern = `(?:${positionPattern}${sizePattern})?`;
|
|
709
|
+
const flexibleLayerWithoutColor = [
|
|
710
|
+
positionAndSizePattern,
|
|
711
|
+
urlPattern,
|
|
712
|
+
repeatPattern,
|
|
713
|
+
attachmentPattern,
|
|
714
|
+
visualBoxPattern,
|
|
715
|
+
].join('|');
|
|
716
|
+
const flexibleLayerWithColor = `(?:${flexibleLayerWithoutColor}\\s*)*${colorValuePattern}`;
|
|
717
|
+
const backgroundRegex = new RegExp(`^(?!\\s)(?=\\S)${flexibleLayerWithColor}(?:\\s*,\\s*${flexibleLayerWithColor})*$`);
|
|
718
|
+
const backgroundProperties = ['background'];
|
|
719
|
+
const boxShadowRegex = new RegExp(`^(?:(?:inset\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${lengthValuePattern}))?\\s+(${colorSource}))(?:\\s*,\\s*(?:(?:inset\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${lengthValuePattern}))?\\s+(${colorSource})))*$`);
|
|
720
|
+
const boxShadowProperties = ['boxShadow'];
|
|
721
|
+
const borderRadiusRegex = new RegExp(`^(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,3}(\\s*/\\s*(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,3})?$`);
|
|
722
|
+
const borderStyleRegex = new RegExp(`^(${lineStyle})( (?!\\s)(${lineStyle})){0,3}$`);
|
|
723
|
+
function createBorderImageRegex() {
|
|
724
|
+
const imageSource = `(?:${imageRegex.source.slice(1, -1)}|${varString}|none)`;
|
|
725
|
+
const sliceStr = sliceValuePattern.slice(1, -1);
|
|
726
|
+
const widthStr = `(?:${varString}|${lengthPattern}|${percentagePattern}|${numberPattern}|auto)`;
|
|
727
|
+
const outsetStr = `(?:${varString}|${lengthPattern}|${numberPattern})`;
|
|
728
|
+
const slicePart = `(?:\\s+(?:${varString}|${sliceStr}))?`;
|
|
729
|
+
const widthPart = `(?:\\s*\\/\\s*${widthStr}(?:\\s+${widthStr}){0,3})?`;
|
|
730
|
+
const outsetPart = `(?:\\s*\\/\\s*${outsetStr}(?:\\s+${outsetStr}){0,3})?`;
|
|
731
|
+
const repeatPart = `(?:\\s+(?:${varString}|stretch|repeat|round|space)){0,2}?`;
|
|
732
|
+
return new RegExp(`^${imageSource}` +
|
|
733
|
+
`${slicePart}` +
|
|
734
|
+
`${widthPart}` +
|
|
735
|
+
`${outsetPart}` +
|
|
736
|
+
`${repeatPart}$`);
|
|
737
|
+
}
|
|
738
|
+
const borderImageRegex = createBorderImageRegex();
|
|
739
|
+
const aspectRatioRegex = new RegExp(`^(auto\\s+)?(${varString}|${numberPattern}(\\s*\\/\\s*${numberPattern})?|auto)(\\s+auto)?$`);
|
|
740
|
+
const timeUnit = '(s|ms)';
|
|
741
|
+
const animationTimeRegex = new RegExp(`^-?(${pureNumber}${timeUnit}|${varString})(,\\s-?(${pureNumber}${timeUnit}|${varString}))*$`);
|
|
742
|
+
const animationTimeProperties = [
|
|
743
|
+
'animationDelay',
|
|
744
|
+
'animationDuration',
|
|
745
|
+
'transitionDelay',
|
|
746
|
+
'transitionDuration',
|
|
747
|
+
];
|
|
748
|
+
const animationDirection = [
|
|
749
|
+
'normal',
|
|
750
|
+
'reverse',
|
|
751
|
+
'alternate',
|
|
752
|
+
'alternate-reverse',
|
|
753
|
+
varString,
|
|
754
|
+
].join('|');
|
|
755
|
+
const animationDirectionRegex = new RegExp(`^(${animationDirection})(,\\s*(${animationDirection}))*$`);
|
|
756
|
+
const animationDirectionProperties = ['animationDirection'];
|
|
757
|
+
const animationFillMode = [
|
|
758
|
+
'none',
|
|
759
|
+
'forwards',
|
|
760
|
+
'backwards',
|
|
761
|
+
'both',
|
|
762
|
+
varString,
|
|
763
|
+
].join('|');
|
|
764
|
+
const animationFillModeRegex = new RegExp(`^(${animationFillMode})(,\\s*(${animationFillMode}))*$`);
|
|
765
|
+
const animationFillModeProperties = ['animationFillMode'];
|
|
766
|
+
const animationPlayState = ['paused', 'running', varString].join('|');
|
|
767
|
+
const animationPlayStateRegex = new RegExp(`^(${animationPlayState})(,\\s*(${animationPlayState}))*$`);
|
|
768
|
+
const animationPlayStateProperties = ['animationPlayState'];
|
|
769
|
+
const animationIterationCountRegex = new RegExp(`^(${numberPattern}|infinite)(,\\s*(${numberPattern}|infinite))*$`);
|
|
770
|
+
const stringNameRegex = new RegExp('^.+$');
|
|
771
|
+
const stringNameProperties = [
|
|
772
|
+
'animationName',
|
|
773
|
+
'counterIncrement',
|
|
774
|
+
'counterReset',
|
|
775
|
+
'counterSet',
|
|
776
|
+
'font',
|
|
777
|
+
'fontFamily',
|
|
778
|
+
'gridArea',
|
|
779
|
+
'gridColumn',
|
|
780
|
+
'gridColumnEnd',
|
|
781
|
+
'gridColumnStart',
|
|
782
|
+
'gridRow',
|
|
783
|
+
'gridRowEnd',
|
|
784
|
+
'gridRowStart',
|
|
785
|
+
'listStyleType',
|
|
786
|
+
'listStyle',
|
|
787
|
+
'transitionProperty',
|
|
788
|
+
'transition',
|
|
789
|
+
'viewTransitionName',
|
|
790
|
+
'willChange',
|
|
791
|
+
];
|
|
792
|
+
const easing = [
|
|
793
|
+
'ease',
|
|
794
|
+
'ease-in',
|
|
795
|
+
'ease-out',
|
|
796
|
+
'ease-in-out',
|
|
797
|
+
'linear',
|
|
798
|
+
'step-start',
|
|
799
|
+
'step-end',
|
|
800
|
+
];
|
|
801
|
+
const easingPattern = easing.join('|');
|
|
802
|
+
const zeroToOne = '(0(\\.\\d+)?|1(\\.0+)?|0?\\.\\d+)';
|
|
803
|
+
const cubicBezierPattern = `cubic-bezier\\(\\s*${zeroToOne}\\s*,\\s*(-?\\d+(\\.\\d+)?)\\s*,\\s*${zeroToOne}\\s*,\\s*(-?\\d+(\\.\\d+)?)\\s*\\)`;
|
|
804
|
+
const numberPercentage = `${zeroToOne}(\\s+\\d+(\\.\\d+)?%){0,2}`;
|
|
805
|
+
const linearPattern = `linear\\(\\s*(${numberPercentage}(\\s*,\\s*${numberPercentage})*)+\\s*\\)`;
|
|
806
|
+
const stepPositions = [
|
|
807
|
+
'jump-start',
|
|
808
|
+
'jump-end',
|
|
809
|
+
'jump-none',
|
|
810
|
+
'jump-both',
|
|
811
|
+
'start',
|
|
812
|
+
'end',
|
|
813
|
+
];
|
|
814
|
+
const stepPositionPattern = stepPositions.join('|');
|
|
815
|
+
const stepPattern = `steps\\(\\s*(\\d+)\\s*,\\s*(${stepPositionPattern})\\s*\\)`;
|
|
816
|
+
const singleTimingFunctionPattern = `(${easingPattern}|${cubicBezierPattern}|${linearPattern}|${stepPattern}|${varString})`;
|
|
817
|
+
const animationTimingFunctionRegex = new RegExp(`^${singleTimingFunctionPattern}(\\s*,\\s*${singleTimingFunctionPattern})*$`);
|
|
818
|
+
const animationTimingFunctionProperties = [
|
|
819
|
+
'animationTimingFunction',
|
|
820
|
+
'transitionTimingFunction',
|
|
821
|
+
];
|
|
822
|
+
const filterNumFunction = [
|
|
823
|
+
'brightness',
|
|
824
|
+
'contrast',
|
|
825
|
+
'grayscale',
|
|
826
|
+
'invert',
|
|
827
|
+
'opacity',
|
|
828
|
+
'sepia',
|
|
829
|
+
'saturate',
|
|
830
|
+
].join('|');
|
|
831
|
+
const filterNumFunctionPattern = `(${filterNumFunction})\\(\\s*${numberPattern}%?\\s*\\)`;
|
|
832
|
+
const blurFunctionPattern = `blur\\(\\s*(${lengthPattern}|${calcString}|${clampString}|${minString}|${maxString})\\s*\\)`;
|
|
833
|
+
const angleFunctionPattern = `hue-rotate\\(\\s*${anglePattern}\\s*\\)`;
|
|
834
|
+
const dropShadowPattern = `^drop-shadow\\(\\s*(?:${colorSource}|${lengthValuePattern})(?:\\s+(?:${colorSource}|${lengthValuePattern})){2,3}\\s*\\)$`;
|
|
835
|
+
const filterAllPattern = `${filterNumFunctionPattern}|${blurFunctionPattern}|${angleFunctionPattern}|${dropShadowPattern}|${urlPattern}`;
|
|
836
|
+
const filterPattern = `^(${filterAllPattern}\\s*)+$`;
|
|
837
|
+
const filterRegex = new RegExp(filterPattern);
|
|
838
|
+
function isBorderValue(value) {
|
|
839
|
+
const parts = splitColorValues(value);
|
|
840
|
+
if (parts.length > 3)
|
|
841
|
+
return false;
|
|
842
|
+
let hasWidth = false;
|
|
843
|
+
let hasStyle = false;
|
|
844
|
+
let hasColor = false;
|
|
845
|
+
for (const part of parts) {
|
|
846
|
+
if (varRegex.test(part)) {
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
if (lineWidth.includes(part) || lengthValueRegex.test(part)) {
|
|
850
|
+
if (hasWidth)
|
|
856
851
|
return false;
|
|
857
|
-
|
|
852
|
+
hasWidth = true;
|
|
858
853
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
hasColor ||
|
|
862
|
-
parts.some((part) => varRegex.test(part)));
|
|
863
|
-
}
|
|
864
|
-
const matrixString = 'matrix\\([^\\)]+\\)';
|
|
865
|
-
const matrix3dString = 'matrix3d\\([^\\)]+\\)';
|
|
866
|
-
const perspectiveString = 'perspective\\([^\\)]+\\)';
|
|
867
|
-
const rotateString = 'rotate\\([^\\)]+\\)';
|
|
868
|
-
const rotate3dString = 'rotate3d\\([^\\)]+\\)';
|
|
869
|
-
const rotateXString = 'rotateX\\([^\\)]+\\)';
|
|
870
|
-
const rotateYString = 'rotateY\\([^\\)]+\\)';
|
|
871
|
-
const rotateZString = 'rotateZ\\([^\\)]+\\)';
|
|
872
|
-
const scaleString = 'scale\\([^\\)]+\\)';
|
|
873
|
-
const scale3dString = 'scale3d\\([^\\)]+\\)';
|
|
874
|
-
const scaleXString = 'scaleX\\([^\\)]+\\)';
|
|
875
|
-
const scaleYString = 'scaleY\\([^\\)]+\\)';
|
|
876
|
-
const scaleZString = 'scaleZ\\([^\\)]+\\)';
|
|
877
|
-
const skewString = 'skew\\([^\\)]+\\)';
|
|
878
|
-
const skewXString = 'skewX\\([^\\)]+\\)';
|
|
879
|
-
const skewYString = 'skewY\\([^\\)]+\\)';
|
|
880
|
-
const translateString = 'translate\\([^\\)]+\\)';
|
|
881
|
-
const translate3dString = 'translate3d\\([^\\)]+\\)';
|
|
882
|
-
const translateXString = 'translateX\\([^\\)]+\\)';
|
|
883
|
-
const translateYString = 'translateY\\([^\\)]+\\)';
|
|
884
|
-
const translateZString = 'translateZ\\([^\\)]+\\)';
|
|
885
|
-
const transformFunctions = [
|
|
886
|
-
matrixString,
|
|
887
|
-
matrix3dString,
|
|
888
|
-
perspectiveString,
|
|
889
|
-
rotateString,
|
|
890
|
-
rotate3dString,
|
|
891
|
-
rotateXString,
|
|
892
|
-
rotateYString,
|
|
893
|
-
rotateZString,
|
|
894
|
-
scaleString,
|
|
895
|
-
scale3dString,
|
|
896
|
-
scaleXString,
|
|
897
|
-
scaleYString,
|
|
898
|
-
scaleZString,
|
|
899
|
-
skewString,
|
|
900
|
-
skewXString,
|
|
901
|
-
skewYString,
|
|
902
|
-
translateString,
|
|
903
|
-
translate3dString,
|
|
904
|
-
translateXString,
|
|
905
|
-
translateYString,
|
|
906
|
-
translateZString,
|
|
907
|
-
].join('|');
|
|
908
|
-
const filterProperties = ['backdropFilter', 'filter'];
|
|
909
|
-
const geometryBaseSet = 'content-box|padding-box|border-box|fill-box|stroke-box|view-box';
|
|
910
|
-
const geometryBox = geometryBaseSet + '|margin-box';
|
|
911
|
-
const insetString = 'inset\\([^\\)]+\\)';
|
|
912
|
-
const circleString = 'circle\\([^\\)]+\\)';
|
|
913
|
-
const ellipseString = 'ellipse\\([^\\)]+\\)';
|
|
914
|
-
const polygonString = 'polygon\\([^\\)]+\\)';
|
|
915
|
-
const pathString = `path\\(${stringString}\\)`;
|
|
916
|
-
const rectString = 'rect\\([^\\)]+\\)';
|
|
917
|
-
const xywhString = 'xywh\\([^\\)]+\\)';
|
|
918
|
-
const basicShapeWithoutVar = `(${varString}|${insetString}|${circleString}|${ellipseString}|${polygonString}|${pathString}|${rectString}|${xywhString})`;
|
|
919
|
-
const basicShapeString = `(${varString}\\s+${varString}|${varString}|${basicShapeWithoutVar})`;
|
|
920
|
-
const geometryBoxWithVar = `(${geometryBox}|${varString})`;
|
|
921
|
-
const clipPathRegex = new RegExp(`^(${basicShapeString}|${geometryBoxWithVar}|${geometryBoxWithVar}\\s+${basicShapeString}|${basicShapeString}\\s+${geometryBoxWithVar})$`);
|
|
922
|
-
const clipPathProperties = ['clipPath'];
|
|
923
|
-
const columnsRegex = new RegExp(`^(?:auto\\s*(?:auto|${lengthValuePattern}|${numberPattern})?|${numberPattern}\\s*(?:auto|${lengthValuePattern}|${numberPattern})?|${lengthValuePattern}\\s*(?:auto|${lengthValuePattern}|${numberPattern})?)$`);
|
|
924
|
-
const contentValueRegex = new RegExp(`^(${urlString}|${gradientString}|${imageSetString}|${attrString}|${counterString}|${countersString}|${stringString})$`);
|
|
925
|
-
const contentProperty = ['content'];
|
|
926
|
-
function isValidCursor(value) {
|
|
927
|
-
const urlWithHotspotRegex = `(${urlString}|${varString})(\\s+(${numberPattern})(\\s+(${numberPattern}))?)?`;
|
|
928
|
-
const urlPart = `(${urlWithHotspotRegex})`;
|
|
929
|
-
const standalonePattern = new RegExp(`^(${cursorValue})$`);
|
|
930
|
-
const urlListPattern = new RegExp(`^${urlPart}(\\s*,\\s*${urlPart})*\\s*,\\s*(${cursorValue})$`);
|
|
931
|
-
if (standalonePattern.test(value)) {
|
|
932
|
-
return true;
|
|
933
|
-
}
|
|
934
|
-
if (!urlListPattern.test(value)) {
|
|
935
|
-
return false;
|
|
936
|
-
}
|
|
937
|
-
const parts = value.split(/\s*,\s*/);
|
|
938
|
-
const urlParts = parts.slice(0, -1);
|
|
939
|
-
return urlParts.every((part) => {
|
|
940
|
-
const urlRegex = new RegExp(`^${urlWithHotspotRegex}$`);
|
|
941
|
-
return urlRegex.test(part);
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
const cursorProperty = ['cursor'];
|
|
945
|
-
function isValidFlexValue(value) {
|
|
946
|
-
const cleanValue = value.replace(/\s+/g, ' ').trim();
|
|
947
|
-
if (!cleanValue) {
|
|
948
|
-
return false;
|
|
949
|
-
}
|
|
950
|
-
const parts = cleanValue.split(' ');
|
|
951
|
-
if (parts.length > 3) {
|
|
952
|
-
return false;
|
|
953
|
-
}
|
|
954
|
-
if (parts.length === 1) {
|
|
955
|
-
return (new RegExp(`^${numberPattern}$`).test(parts[0]) ||
|
|
956
|
-
new RegExp(lengthValuePattern).test(parts[0]));
|
|
957
|
-
}
|
|
958
|
-
if (parts.length === 2) {
|
|
959
|
-
if (!new RegExp(`^${numberPattern}$`).test(parts[0])) {
|
|
854
|
+
else if (lineStyle.includes(part)) {
|
|
855
|
+
if (hasStyle)
|
|
960
856
|
return false;
|
|
961
|
-
|
|
962
|
-
return (new RegExp(`^${numberPattern}$`).test(parts[1]) ||
|
|
963
|
-
new RegExp(lengthValuePattern).test(parts[1]));
|
|
857
|
+
hasStyle = true;
|
|
964
858
|
}
|
|
965
|
-
if (
|
|
966
|
-
if (
|
|
967
|
-
!new RegExp(`^${numberPattern}$`).test(parts[1])) {
|
|
859
|
+
else if (isValidColorValue(part)) {
|
|
860
|
+
if (hasColor)
|
|
968
861
|
return false;
|
|
969
|
-
|
|
970
|
-
return new RegExp(`^(${lengthValuePattern}|auto)$`).test(parts[2]);
|
|
862
|
+
hasColor = true;
|
|
971
863
|
}
|
|
972
|
-
|
|
973
|
-
const tagA_E = [
|
|
974
|
-
'aalt',
|
|
975
|
-
'abvf',
|
|
976
|
-
'abvm',
|
|
977
|
-
'abvs',
|
|
978
|
-
'afrc',
|
|
979
|
-
'akhn',
|
|
980
|
-
'apkn',
|
|
981
|
-
'blwf',
|
|
982
|
-
'blwm',
|
|
983
|
-
'blws',
|
|
984
|
-
'calt',
|
|
985
|
-
'case',
|
|
986
|
-
'ccmp',
|
|
987
|
-
'cfar',
|
|
988
|
-
'chws',
|
|
989
|
-
'cjct',
|
|
990
|
-
'clig',
|
|
991
|
-
'cpct',
|
|
992
|
-
'cpsp',
|
|
993
|
-
'cswh',
|
|
994
|
-
'curs',
|
|
995
|
-
'cv(0[1-9]|[1-9][0-9])',
|
|
996
|
-
'c2pc',
|
|
997
|
-
'c2sc',
|
|
998
|
-
'dist',
|
|
999
|
-
'dlig',
|
|
1000
|
-
'dnom',
|
|
1001
|
-
'dtls',
|
|
1002
|
-
'expt',
|
|
1003
|
-
]
|
|
1004
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1005
|
-
.join('|');
|
|
1006
|
-
const tagF_J = [
|
|
1007
|
-
'falt',
|
|
1008
|
-
'fin2',
|
|
1009
|
-
'fin3',
|
|
1010
|
-
'fina',
|
|
1011
|
-
'flac',
|
|
1012
|
-
'frac',
|
|
1013
|
-
'fwid',
|
|
1014
|
-
'half',
|
|
1015
|
-
'haln',
|
|
1016
|
-
'hist',
|
|
1017
|
-
'hkna',
|
|
1018
|
-
'hlig',
|
|
1019
|
-
'hojo',
|
|
1020
|
-
'hwid',
|
|
1021
|
-
'init',
|
|
1022
|
-
'isol',
|
|
1023
|
-
'ital',
|
|
1024
|
-
'jalt',
|
|
1025
|
-
'jp78',
|
|
1026
|
-
'jp83',
|
|
1027
|
-
'jp90',
|
|
1028
|
-
'jp04',
|
|
1029
|
-
]
|
|
1030
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1031
|
-
.join('|');
|
|
1032
|
-
const tagsK_O = [
|
|
1033
|
-
'kern',
|
|
1034
|
-
'lfbd',
|
|
1035
|
-
'liga',
|
|
1036
|
-
'ljmo',
|
|
1037
|
-
'lnum',
|
|
1038
|
-
'locl',
|
|
1039
|
-
'ltra',
|
|
1040
|
-
'ltrm',
|
|
1041
|
-
'mark',
|
|
1042
|
-
'med2',
|
|
1043
|
-
'medi',
|
|
1044
|
-
'mgrk',
|
|
1045
|
-
'mkmk',
|
|
1046
|
-
'mset',
|
|
1047
|
-
'nalt',
|
|
1048
|
-
'nlck',
|
|
1049
|
-
'nukt',
|
|
1050
|
-
'numr',
|
|
1051
|
-
'onum',
|
|
1052
|
-
'ordn',
|
|
1053
|
-
'ornm',
|
|
1054
|
-
]
|
|
1055
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1056
|
-
.join('|');
|
|
1057
|
-
const tagsP_T = [
|
|
1058
|
-
'palt',
|
|
1059
|
-
'pcap',
|
|
1060
|
-
'pkna',
|
|
1061
|
-
'pnum',
|
|
1062
|
-
'pref',
|
|
1063
|
-
'pres',
|
|
1064
|
-
'pstf',
|
|
1065
|
-
'psts',
|
|
1066
|
-
'pwid',
|
|
1067
|
-
'qwid',
|
|
1068
|
-
'rand',
|
|
1069
|
-
'rclt',
|
|
1070
|
-
'rkrf',
|
|
1071
|
-
'rlig',
|
|
1072
|
-
'rphf',
|
|
1073
|
-
'rtbd',
|
|
1074
|
-
'rtla',
|
|
1075
|
-
'rtlm',
|
|
1076
|
-
'ruby',
|
|
1077
|
-
'rvrn',
|
|
1078
|
-
'salt',
|
|
1079
|
-
'sinf',
|
|
1080
|
-
'size',
|
|
1081
|
-
'smcp',
|
|
1082
|
-
'smpl',
|
|
1083
|
-
'ss(0[1-9]|1[0-9]|20)',
|
|
1084
|
-
'ssty',
|
|
1085
|
-
'stch',
|
|
1086
|
-
'subs',
|
|
1087
|
-
'sups',
|
|
1088
|
-
'swsh',
|
|
1089
|
-
'titl',
|
|
1090
|
-
'tjmo',
|
|
1091
|
-
'tnam',
|
|
1092
|
-
'tnum',
|
|
1093
|
-
'trad',
|
|
1094
|
-
'twid',
|
|
1095
|
-
]
|
|
1096
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1097
|
-
.join('|');
|
|
1098
|
-
const tagsU_Z = [
|
|
1099
|
-
'unic',
|
|
1100
|
-
'valt',
|
|
1101
|
-
'vapk',
|
|
1102
|
-
'vatu',
|
|
1103
|
-
'vchw',
|
|
1104
|
-
'vert',
|
|
1105
|
-
'vhal',
|
|
1106
|
-
'vjmo',
|
|
1107
|
-
'vkna',
|
|
1108
|
-
'vkrn',
|
|
1109
|
-
'vpal',
|
|
1110
|
-
'vrt2',
|
|
1111
|
-
'vrtr',
|
|
1112
|
-
'zero',
|
|
1113
|
-
]
|
|
1114
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1115
|
-
.join('|');
|
|
1116
|
-
const featureTag = [tagA_E, tagF_J, tagsK_O, tagsP_T, tagsU_Z].join('|');
|
|
1117
|
-
const singlePair = `(${featureTag}|${varString})(\\s+(-?\\d+|on|off|${varString}))?`;
|
|
1118
|
-
const fontFeatureSettingsRegex = new RegExp(`^${singlePair}(\\s*,\\s*${singlePair})*$`);
|
|
1119
|
-
const fontFeatureSettingsProperties = ['fontFeatureSettings'];
|
|
1120
|
-
const stringValueRegex = RegExp(`^${stringString}$`);
|
|
1121
|
-
const stringStringProperties = [
|
|
1122
|
-
'fontLanguageOverride',
|
|
1123
|
-
'hyphenateCharacter',
|
|
1124
|
-
];
|
|
1125
|
-
const fontPaletteRegex = new RegExp(`^(${dashedIdentString}|${paletteMixString})$`);
|
|
1126
|
-
const fontPaletteProperties = 'fontPalette';
|
|
1127
|
-
const fontMetric = `ex-height|cap-height|ch-width|ic-width|ic-height|${varString}`;
|
|
1128
|
-
function isValidFontSizeAdjust(value) {
|
|
1129
|
-
const cleanValue = value.replace(/\s+/g, ' ').trim();
|
|
1130
|
-
if (!cleanValue) {
|
|
864
|
+
else {
|
|
1131
865
|
return false;
|
|
1132
866
|
}
|
|
1133
|
-
const parts = cleanValue.split(' ');
|
|
1134
|
-
if (parts.length > 2) {
|
|
1135
|
-
return false;
|
|
1136
|
-
}
|
|
1137
|
-
if (parts.length === 1) {
|
|
1138
|
-
return new RegExp(`^(${numberPattern}|from-font)$`).test(parts[0]);
|
|
1139
|
-
}
|
|
1140
|
-
if (parts.length === 2) {
|
|
1141
|
-
const isValidFirstPart = new RegExp(`^(${fontMetric})$`).test(parts[0]);
|
|
1142
|
-
if (!isValidFirstPart) {
|
|
1143
|
-
return false;
|
|
1144
|
-
}
|
|
1145
|
-
return new RegExp(`^(${numberPattern}|from-font)$`).test(parts[1]);
|
|
1146
|
-
}
|
|
1147
867
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
868
|
+
return (hasStyle ||
|
|
869
|
+
hasWidth ||
|
|
870
|
+
hasColor ||
|
|
871
|
+
parts.some((part) => varRegex.test(part)));
|
|
872
|
+
}
|
|
873
|
+
const matrixString = 'matrix\\([^\\)]+\\)';
|
|
874
|
+
const matrix3dString = 'matrix3d\\([^\\)]+\\)';
|
|
875
|
+
const perspectiveString = 'perspective\\([^\\)]+\\)';
|
|
876
|
+
const rotateString = 'rotate\\([^\\)]+\\)';
|
|
877
|
+
const rotate3dString = 'rotate3d\\([^\\)]+\\)';
|
|
878
|
+
const rotateXString = 'rotateX\\([^\\)]+\\)';
|
|
879
|
+
const rotateYString = 'rotateY\\([^\\)]+\\)';
|
|
880
|
+
const rotateZString = 'rotateZ\\([^\\)]+\\)';
|
|
881
|
+
const scaleString = 'scale\\([^\\)]+\\)';
|
|
882
|
+
const scale3dString = 'scale3d\\([^\\)]+\\)';
|
|
883
|
+
const scaleXString = 'scaleX\\([^\\)]+\\)';
|
|
884
|
+
const scaleYString = 'scaleY\\([^\\)]+\\)';
|
|
885
|
+
const scaleZString = 'scaleZ\\([^\\)]+\\)';
|
|
886
|
+
const skewString = 'skew\\([^\\)]+\\)';
|
|
887
|
+
const skewXString = 'skewX\\([^\\)]+\\)';
|
|
888
|
+
const skewYString = 'skewY\\([^\\)]+\\)';
|
|
889
|
+
const translateString = 'translate\\([^\\)]+\\)';
|
|
890
|
+
const translate3dString = 'translate3d\\([^\\)]+\\)';
|
|
891
|
+
const translateXString = 'translateX\\([^\\)]+\\)';
|
|
892
|
+
const translateYString = 'translateY\\([^\\)]+\\)';
|
|
893
|
+
const translateZString = 'translateZ\\([^\\)]+\\)';
|
|
894
|
+
const transformFunctions = [
|
|
895
|
+
matrixString,
|
|
896
|
+
matrix3dString,
|
|
897
|
+
perspectiveString,
|
|
898
|
+
rotateString,
|
|
899
|
+
rotate3dString,
|
|
900
|
+
rotateXString,
|
|
901
|
+
rotateYString,
|
|
902
|
+
rotateZString,
|
|
903
|
+
scaleString,
|
|
904
|
+
scale3dString,
|
|
905
|
+
scaleXString,
|
|
906
|
+
scaleYString,
|
|
907
|
+
scaleZString,
|
|
908
|
+
skewString,
|
|
909
|
+
skewXString,
|
|
910
|
+
skewYString,
|
|
911
|
+
translateString,
|
|
912
|
+
translate3dString,
|
|
913
|
+
translateXString,
|
|
914
|
+
translateYString,
|
|
915
|
+
translateZString,
|
|
916
|
+
].join('|');
|
|
917
|
+
const filterProperties = ['backdropFilter', 'filter'];
|
|
918
|
+
const geometryBaseSet = 'content-box|padding-box|border-box|fill-box|stroke-box|view-box';
|
|
919
|
+
const geometryBox = geometryBaseSet + '|margin-box';
|
|
920
|
+
const insetString = 'inset\\([^\\)]+\\)';
|
|
921
|
+
const circleString = 'circle\\([^\\)]+\\)';
|
|
922
|
+
const ellipseString = 'ellipse\\([^\\)]+\\)';
|
|
923
|
+
const polygonString = 'polygon\\([^\\)]+\\)';
|
|
924
|
+
const pathString = `path\\(${stringString}\\)`;
|
|
925
|
+
const rectString = 'rect\\([^\\)]+\\)';
|
|
926
|
+
const xywhString = 'xywh\\([^\\)]+\\)';
|
|
927
|
+
const basicShapeWithoutVar = `(${varString}|${insetString}|${circleString}|${ellipseString}|${polygonString}|${pathString}|${rectString}|${xywhString})`;
|
|
928
|
+
const basicShapeString = `(${varString}\\s+${varString}|${varString}|${basicShapeWithoutVar})`;
|
|
929
|
+
const geometryBoxWithVar = `(${geometryBox}|${varString})`;
|
|
930
|
+
const clipPathRegex = new RegExp(`^(${basicShapeString}|${geometryBoxWithVar}|${geometryBoxWithVar}\\s+${basicShapeString}|${basicShapeString}\\s+${geometryBoxWithVar})$`);
|
|
931
|
+
const clipPathProperties = ['clipPath'];
|
|
932
|
+
const columnsRegex = new RegExp(`^(?:auto\\s*(?:auto|${lengthValuePattern}|${numberPattern})?|${numberPattern}\\s*(?:auto|${lengthValuePattern}|${numberPattern})?|${lengthValuePattern}\\s*(?:auto|${lengthValuePattern}|${numberPattern})?)$`);
|
|
933
|
+
const contentValueRegex = new RegExp(`^(${urlString}|${gradientString}|${imageSetString}|${attrString}|${counterString}|${countersString}|${stringString})$`);
|
|
934
|
+
const contentProperty = ['content'];
|
|
935
|
+
function isValidCursor(value) {
|
|
936
|
+
const urlWithHotspotRegex = `(${urlString}|${varString})(\\s+(${numberPattern})(\\s+(${numberPattern}))?)?`;
|
|
937
|
+
const urlPart = `(${urlWithHotspotRegex})`;
|
|
938
|
+
const standalonePattern = new RegExp(`^(${cursorValue})$`);
|
|
939
|
+
const urlListPattern = new RegExp(`^${urlPart}(\\s*,\\s*${urlPart})*\\s*,\\s*(${cursorValue})$`);
|
|
940
|
+
if (standalonePattern.test(value)) {
|
|
941
|
+
return true;
|
|
942
|
+
}
|
|
943
|
+
if (!urlListPattern.test(value)) {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
const parts = value.split(/\s*,\s*/);
|
|
947
|
+
const urlParts = parts.slice(0, -1);
|
|
948
|
+
return urlParts.every((part) => {
|
|
949
|
+
const urlRegex = new RegExp(`^${urlWithHotspotRegex}$`);
|
|
950
|
+
return urlRegex.test(part);
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
const cursorProperty = ['cursor'];
|
|
954
|
+
function isValidFlexValue(value) {
|
|
955
|
+
const cleanValue = value.replace(/\s+/g, ' ').trim();
|
|
956
|
+
if (!cleanValue) {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
const parts = cleanValue.split(' ');
|
|
960
|
+
if (parts.length > 3) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
if (parts.length === 1) {
|
|
964
|
+
return (new RegExp(`^${numberPattern}$`).test(parts[0]) ||
|
|
965
|
+
new RegExp(lengthValuePattern).test(parts[0]));
|
|
966
|
+
}
|
|
967
|
+
if (parts.length === 2) {
|
|
968
|
+
if (!new RegExp(`^${numberPattern}$`).test(parts[0])) {
|
|
1167
969
|
return false;
|
|
1168
970
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
971
|
+
return (new RegExp(`^${numberPattern}$`).test(parts[1]) ||
|
|
972
|
+
new RegExp(lengthValuePattern).test(parts[1]));
|
|
973
|
+
}
|
|
974
|
+
if (!new RegExp(`^${numberPattern}$`).test(parts[0]) ||
|
|
975
|
+
!new RegExp(`^${numberPattern}$`).test(parts[1])) {
|
|
976
|
+
return false;
|
|
977
|
+
}
|
|
978
|
+
return new RegExp(`^(${lengthValuePattern}|auto)$`).test(parts[2]);
|
|
979
|
+
}
|
|
980
|
+
const tagA_E = [
|
|
981
|
+
'aalt',
|
|
982
|
+
'abvf',
|
|
983
|
+
'abvm',
|
|
984
|
+
'abvs',
|
|
985
|
+
'afrc',
|
|
986
|
+
'akhn',
|
|
987
|
+
'apkn',
|
|
988
|
+
'blwf',
|
|
989
|
+
'blwm',
|
|
990
|
+
'blws',
|
|
991
|
+
'calt',
|
|
992
|
+
'case',
|
|
993
|
+
'ccmp',
|
|
994
|
+
'cfar',
|
|
995
|
+
'chws',
|
|
996
|
+
'cjct',
|
|
997
|
+
'clig',
|
|
998
|
+
'cpct',
|
|
999
|
+
'cpsp',
|
|
1000
|
+
'cswh',
|
|
1001
|
+
'curs',
|
|
1002
|
+
'cv(0[1-9]|[1-9][0-9])',
|
|
1003
|
+
'c2pc',
|
|
1004
|
+
'c2sc',
|
|
1005
|
+
'dist',
|
|
1006
|
+
'dlig',
|
|
1007
|
+
'dnom',
|
|
1008
|
+
'dtls',
|
|
1009
|
+
'expt',
|
|
1010
|
+
]
|
|
1011
|
+
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1012
|
+
.join('|');
|
|
1013
|
+
const tagF_J = [
|
|
1014
|
+
'falt',
|
|
1015
|
+
'fin2',
|
|
1016
|
+
'fin3',
|
|
1017
|
+
'fina',
|
|
1018
|
+
'flac',
|
|
1019
|
+
'frac',
|
|
1020
|
+
'fwid',
|
|
1021
|
+
'half',
|
|
1022
|
+
'haln',
|
|
1023
|
+
'hist',
|
|
1024
|
+
'hkna',
|
|
1025
|
+
'hlig',
|
|
1026
|
+
'hojo',
|
|
1027
|
+
'hwid',
|
|
1028
|
+
'init',
|
|
1029
|
+
'isol',
|
|
1030
|
+
'ital',
|
|
1031
|
+
'jalt',
|
|
1032
|
+
'jp78',
|
|
1033
|
+
'jp83',
|
|
1034
|
+
'jp90',
|
|
1035
|
+
'jp04',
|
|
1036
|
+
]
|
|
1037
|
+
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1038
|
+
.join('|');
|
|
1039
|
+
const tagsK_O = [
|
|
1040
|
+
'kern',
|
|
1041
|
+
'lfbd',
|
|
1042
|
+
'liga',
|
|
1043
|
+
'ljmo',
|
|
1044
|
+
'lnum',
|
|
1045
|
+
'locl',
|
|
1046
|
+
'ltra',
|
|
1047
|
+
'ltrm',
|
|
1048
|
+
'mark',
|
|
1049
|
+
'med2',
|
|
1050
|
+
'medi',
|
|
1051
|
+
'mgrk',
|
|
1052
|
+
'mkmk',
|
|
1053
|
+
'mset',
|
|
1054
|
+
'nalt',
|
|
1055
|
+
'nlck',
|
|
1056
|
+
'nukt',
|
|
1057
|
+
'numr',
|
|
1058
|
+
'onum',
|
|
1059
|
+
'ordn',
|
|
1060
|
+
'ornm',
|
|
1061
|
+
]
|
|
1062
|
+
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1063
|
+
.join('|');
|
|
1064
|
+
const tagsP_T = [
|
|
1065
|
+
'palt',
|
|
1066
|
+
'pcap',
|
|
1067
|
+
'pkna',
|
|
1068
|
+
'pnum',
|
|
1069
|
+
'pref',
|
|
1070
|
+
'pres',
|
|
1071
|
+
'pstf',
|
|
1072
|
+
'psts',
|
|
1073
|
+
'pwid',
|
|
1074
|
+
'qwid',
|
|
1075
|
+
'rand',
|
|
1076
|
+
'rclt',
|
|
1077
|
+
'rkrf',
|
|
1078
|
+
'rlig',
|
|
1079
|
+
'rphf',
|
|
1080
|
+
'rtbd',
|
|
1081
|
+
'rtla',
|
|
1082
|
+
'rtlm',
|
|
1083
|
+
'ruby',
|
|
1084
|
+
'rvrn',
|
|
1085
|
+
'salt',
|
|
1086
|
+
'sinf',
|
|
1087
|
+
'size',
|
|
1088
|
+
'smcp',
|
|
1089
|
+
'smpl',
|
|
1090
|
+
'ss(0[1-9]|1[0-9]|20)',
|
|
1091
|
+
'ssty',
|
|
1092
|
+
'stch',
|
|
1093
|
+
'subs',
|
|
1094
|
+
'sups',
|
|
1095
|
+
'swsh',
|
|
1096
|
+
'titl',
|
|
1097
|
+
'tjmo',
|
|
1098
|
+
'tnam',
|
|
1099
|
+
'tnum',
|
|
1100
|
+
'trad',
|
|
1101
|
+
'twid',
|
|
1102
|
+
]
|
|
1103
|
+
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1104
|
+
.join('|');
|
|
1105
|
+
const tagsU_Z = [
|
|
1106
|
+
'unic',
|
|
1107
|
+
'valt',
|
|
1108
|
+
'vapk',
|
|
1109
|
+
'vatu',
|
|
1110
|
+
'vchw',
|
|
1111
|
+
'vert',
|
|
1112
|
+
'vhal',
|
|
1113
|
+
'vjmo',
|
|
1114
|
+
'vkna',
|
|
1115
|
+
'vkrn',
|
|
1116
|
+
'vpal',
|
|
1117
|
+
'vrt2',
|
|
1118
|
+
'vrtr',
|
|
1119
|
+
'zero',
|
|
1120
|
+
]
|
|
1121
|
+
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1122
|
+
.join('|');
|
|
1123
|
+
const featureTag = [tagA_E, tagF_J, tagsK_O, tagsP_T, tagsU_Z].join('|');
|
|
1124
|
+
const singlePair = `(${featureTag}|${varString})(\\s+(-?\\d+|on|off|${varString}))?`;
|
|
1125
|
+
const fontFeatureSettingsRegex = new RegExp(`^${singlePair}(\\s*,\\s*${singlePair})*$`);
|
|
1126
|
+
const fontFeatureSettingsProperties = ['fontFeatureSettings'];
|
|
1127
|
+
const stringValueRegex = RegExp(`^${stringString}$`);
|
|
1128
|
+
const stringStringProperties = [
|
|
1129
|
+
'fontLanguageOverride',
|
|
1130
|
+
'hyphenateCharacter',
|
|
1131
|
+
];
|
|
1132
|
+
const fontPaletteRegex = new RegExp(`^(${dashedIdentString}|${paletteMixString})$`);
|
|
1133
|
+
const fontPaletteProperties = 'fontPalette';
|
|
1134
|
+
const fontMetric = `ex-height|cap-height|ch-width|ic-width|ic-height|${varString}`;
|
|
1135
|
+
function isValidFontSizeAdjust(value) {
|
|
1136
|
+
const cleanValue = value.replace(/\s+/g, ' ').trim();
|
|
1137
|
+
if (!cleanValue) {
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
const parts = cleanValue.split(' ');
|
|
1141
|
+
if (parts.length > 2) {
|
|
1142
|
+
return false;
|
|
1143
|
+
}
|
|
1144
|
+
if (parts.length === 1) {
|
|
1145
|
+
return new RegExp(`^(${numberPattern}|from-font)$`).test(parts[0]);
|
|
1146
|
+
}
|
|
1147
|
+
const isValidFirstPart = new RegExp(`^(${fontMetric})$`).test(parts[0]);
|
|
1148
|
+
if (!isValidFirstPart) {
|
|
1149
|
+
return false;
|
|
1150
|
+
}
|
|
1151
|
+
return new RegExp(`^(${numberPattern}|from-font)$`).test(parts[1]);
|
|
1152
|
+
}
|
|
1153
|
+
const fontSizeAdjustProperties = ['fontSizeAdjust'];
|
|
1154
|
+
const fontStretchProperties = ['fontStretch'];
|
|
1155
|
+
const fontStyleRegex = new RegExp(`^(oblique|${anglePattern})(\\s+(oblique|${anglePattern}))?$`);
|
|
1156
|
+
const fontStyleProperties = ['fontStyle'];
|
|
1157
|
+
const fontSynthesisRegex = new RegExp(`^(?:(weight|style|small-caps|position|${varString})(?:\\s+(?!\\1)(weight|style|small-caps|position|${varString}))*)?$`, 'i');
|
|
1158
|
+
const fontSynthesisProperties = ['fontSynthesis'];
|
|
1159
|
+
const fontVariantAlternatesRegex = new RegExp(`^(?:` +
|
|
1160
|
+
`(?:(?:${notationFuncs})(?:\\s+(?:${notationFuncs})){0,5})` +
|
|
1161
|
+
`|(?:` +
|
|
1162
|
+
`(?:(?:${notationFuncs})\\s+){0,6}(historical-forms|${varString})` +
|
|
1163
|
+
`(?:\\s+(?:${notationFuncs})){0,6})` +
|
|
1164
|
+
`)$`, 'i');
|
|
1165
|
+
const fontVariantAlternatesProperties = ['fontVariantAlternates'];
|
|
1166
|
+
const fontVariantEastAsianRegex = new RegExp('^' +
|
|
1167
|
+
`(?:jis78|jis83|jis90|jis04|simplified|traditional|full-width|proportional-width|ruby|${varString})` +
|
|
1168
|
+
`(?:\\s+(?:jis78|jis83|jis90|jis04|simplified|traditional|full-width|proportional-width|ruby|${varString})){0,2}` +
|
|
1169
|
+
'$', 'i');
|
|
1170
|
+
function isValidFontVariantEastAsian(value) {
|
|
1171
|
+
if (!fontVariantEastAsianRegex.test(value)) {
|
|
1172
|
+
return false;
|
|
1173
|
+
}
|
|
1174
|
+
const values = value.toLowerCase().split(/\s+/);
|
|
1175
|
+
const jisCount = values.filter((value) => [
|
|
1176
|
+
'jis78',
|
|
1177
|
+
'jis83',
|
|
1178
|
+
'jis90',
|
|
1179
|
+
'jis04',
|
|
1180
|
+
'simplified',
|
|
1181
|
+
'traditional',
|
|
1182
|
+
].includes(value)).length;
|
|
1183
|
+
const widthCount = values.filter((v) => ['full-width', 'proportional-width'].includes(v)).length;
|
|
1184
|
+
const rubyCount = values.filter((v) => v === 'ruby').length;
|
|
1185
|
+
return jisCount <= 1 && widthCount <= 1 && rubyCount <= 1;
|
|
1186
|
+
}
|
|
1187
|
+
const fontVariantEastAsianProperties = ['fontVariantEastAsian'];
|
|
1188
|
+
const commonLig = 'common-ligatures|no-common-ligatures' + `|${varString}`;
|
|
1189
|
+
const discretionaryLig = 'discretionary-ligatures|no-discretionary-ligatures' +
|
|
1190
|
+
`|${varString}`;
|
|
1191
|
+
const historicalLig = 'historical-ligatures|no-historical-ligatures' + `|${varString}`;
|
|
1192
|
+
const contextualAlt = 'contextual|no-contextual' + `|${varString}`;
|
|
1193
|
+
const fontVariantLigaturesRegex = new RegExp(`^(?:(?:(${commonLig})|)(?: (${discretionaryLig})|)(?: (${historicalLig})|)(?: (${contextualAlt})|)){1,4}$`);
|
|
1194
|
+
const fontVariantLigaturesProperties = ['fontVariantLigatures'];
|
|
1195
|
+
const alternatesValues = `(?:${notationFuncs}|historical-forms)`;
|
|
1196
|
+
const numericFigureValues = 'lining-nums|oldstyle-nums';
|
|
1197
|
+
const numericSpacingValues = 'proportional-nums|tabular-nums';
|
|
1198
|
+
const numericFractionValues = 'diagonal-fractions|stacked-fractions';
|
|
1199
|
+
const numericOtherValues = 'normal|ordinal|slashed-zero';
|
|
1200
|
+
const eastAsianVariantValues = 'jis78|jis83|jis90|jis04|simplified|traditional';
|
|
1201
|
+
const eastAsianWidthValues = 'full-width|proportional-width';
|
|
1202
|
+
const eastAsianRuby = 'ruby';
|
|
1203
|
+
const capsValues = 'small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps';
|
|
1204
|
+
const emojiValues = 'text|emoji|unicode';
|
|
1205
|
+
const positionValues = 'sub|super';
|
|
1206
|
+
const figureSpacingFractionValues = [
|
|
1207
|
+
numericFigureValues,
|
|
1208
|
+
numericSpacingValues,
|
|
1209
|
+
numericFractionValues,
|
|
1210
|
+
numericOtherValues,
|
|
1211
|
+
varString,
|
|
1212
|
+
].join('|');
|
|
1213
|
+
const fontVariantNumericRegex = new RegExp(`^(?:(${figureSpacingFractionValues})(?:\\s+(?!\\1)(${figureSpacingFractionValues}))*)?$`, 'i');
|
|
1214
|
+
const fontVariantNumericProperties = ['fontVariantNumeric'];
|
|
1215
|
+
const fontVariantRegex = new RegExp(`^(?:normal|none|` +
|
|
1216
|
+
`(?:` +
|
|
1217
|
+
`(?:(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})` +
|
|
1218
|
+
`(?:\\s+(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})){0,3})|` +
|
|
1219
|
+
`(?:${capsValues})|` +
|
|
1220
|
+
`(?:${alternatesValues}(?:\\s+${alternatesValues})*)|` +
|
|
1221
|
+
`(?:(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})` +
|
|
1222
|
+
`(?:\\s+(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})){0,3})|` +
|
|
1223
|
+
`(?:(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})` +
|
|
1224
|
+
`(?:\\s+(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})){0,2})|` +
|
|
1225
|
+
`(?:${positionValues})|` +
|
|
1226
|
+
`(?:${emojiValues})` +
|
|
1227
|
+
`)` +
|
|
1228
|
+
`(?:\\s+` +
|
|
1229
|
+
`(?:` +
|
|
1230
|
+
`(?:(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})` +
|
|
1231
|
+
`(?:\\s+(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})){0,3})|` +
|
|
1232
|
+
`(?:${capsValues})|` +
|
|
1233
|
+
`(?:${alternatesValues}(?:\\s+${alternatesValues})*)|` +
|
|
1234
|
+
`(?:(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})` +
|
|
1235
|
+
`(?:\\s+(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})){0,3})|` +
|
|
1236
|
+
`(?:(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})` +
|
|
1237
|
+
`(?:\\s+(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})){0,2})|` +
|
|
1238
|
+
`(?:${positionValues})|` +
|
|
1239
|
+
`(?:${emojiValues})` +
|
|
1240
|
+
`)` +
|
|
1241
|
+
`)*` +
|
|
1242
|
+
`)$`, 'i');
|
|
1243
|
+
const fontVariantProperties = ['fontVariant'];
|
|
1244
|
+
const axisTagDouble = '"wght"|"wdth"|"slnt"|"ital"|"opsz"';
|
|
1245
|
+
const axisTagSingle = "'wght'|'wdth'|'slnt'|'ital'|'opsz'";
|
|
1246
|
+
const fontVariationSettingsRegex = new RegExp(`^(${axisTagDouble}|${axisTagSingle}|${varString})\\s+(${numberPattern})$`);
|
|
1247
|
+
const fontVariationSettingsProperties = ['fontVariationSettings'];
|
|
1248
|
+
const frPattern = `${numberPattern}fr`;
|
|
1249
|
+
const inArrayPattern = '[a-zA-Z][a-zA-Z0-9-_]*';
|
|
1250
|
+
const lineNamesString = `\\[\\s*${inArrayPattern}(?:\\s+${inArrayPattern})*\\s*\\]`;
|
|
1251
|
+
const lineNamesPattern = `(${lineNamesString}|${varString})`;
|
|
1252
|
+
const trackSizeKeywords = 'auto|min-content|max-content|subgrid|masonry|row|column|row dense|column dense';
|
|
1253
|
+
const autoFlowPattern = `(?:auto-flow(?:\\s+dense)?|${varString})?`;
|
|
1254
|
+
const gridTrackListPattern = [
|
|
1255
|
+
trackSizeKeywords,
|
|
1256
|
+
lengthValuePattern,
|
|
1257
|
+
frPattern,
|
|
1258
|
+
percentagePattern,
|
|
1259
|
+
minmaxString,
|
|
1260
|
+
fitContentString,
|
|
1261
|
+
repeatString,
|
|
1262
|
+
varString,
|
|
1263
|
+
].join('|');
|
|
1264
|
+
const gridAutoColumnsRegex = new RegExp(`^(?:${gridTrackListPattern})(?:\\s+(?:${gridTrackListPattern}))*$`);
|
|
1265
|
+
const gridAutoColumnsRowsProperties = [
|
|
1266
|
+
'gridAutoColumns',
|
|
1267
|
+
'gridAutoRows',
|
|
1268
|
+
];
|
|
1269
|
+
const quoteRegex = new RegExp(`${stringString}`);
|
|
1270
|
+
const gridTemplateAreasProperties = ['gridTemplateAreas'];
|
|
1271
|
+
const gridAreaRowPattern = `(?:${lineNamesPattern}\\s+)?` +
|
|
1272
|
+
`(?:${stringString}|${varString})?` +
|
|
1273
|
+
`(?:\\s+(?:${gridTrackListPattern}))?` +
|
|
1274
|
+
`(?:\\s+${lineNamesPattern})?`;
|
|
1275
|
+
const explicitTrackPattern = `(?:${lineNamesPattern}(?:\\s+|\\s*))?` +
|
|
1276
|
+
`(?:${gridTrackListPattern})` +
|
|
1277
|
+
`(?:\\s+${lineNamesPattern})?`;
|
|
1278
|
+
const gridRegex = new RegExp('^(?:' +
|
|
1279
|
+
`(?:${gridAreaRowPattern}|${autoFlowPattern}\\s*)+?` +
|
|
1280
|
+
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+)?|` +
|
|
1281
|
+
`(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+` +
|
|
1282
|
+
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+)?|` +
|
|
1283
|
+
`\\s*\\/\\s*(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+` +
|
|
1284
|
+
')$');
|
|
1285
|
+
const gridProperties = ['grid'];
|
|
1286
|
+
const isTemplateColumns = 'gridTemplateColumns'.includes(key);
|
|
1287
|
+
const templateTrackListPattern = [
|
|
1288
|
+
trackSizeKeywords,
|
|
1289
|
+
lineNamesPattern,
|
|
1290
|
+
lengthValuePattern,
|
|
1291
|
+
frPattern,
|
|
1292
|
+
percentagePattern,
|
|
1293
|
+
minmaxString,
|
|
1294
|
+
repeatString,
|
|
1295
|
+
varString,
|
|
1296
|
+
...(isTemplateColumns ? [fitContentString] : []),
|
|
1297
|
+
].join('|');
|
|
1298
|
+
const gridTemplateTrackListRegex = new RegExp(`^(?:${templateTrackListPattern})(?:\\s+(?:${templateTrackListPattern}))*$`);
|
|
1299
|
+
const gridTemplateTrackListProperties = [
|
|
1300
|
+
'gridTemplateColumns',
|
|
1301
|
+
'gridTemplateRows',
|
|
1302
|
+
];
|
|
1303
|
+
const isValidateGridTemplate = (value) => {
|
|
1266
1304
|
const gridAreaRowPattern = `(?:${lineNamesPattern}\\s+)?` +
|
|
1267
|
-
`(?:${stringString}|${varString})
|
|
1268
|
-
`(?:\\s+(?:${
|
|
1305
|
+
`(?:${stringString}|${varString})` +
|
|
1306
|
+
`(?:\\s+(?:${templateTrackListPattern}))?` +
|
|
1269
1307
|
`(?:\\s+${lineNamesPattern})?`;
|
|
1270
1308
|
const explicitTrackPattern = `(?:${lineNamesPattern}(?:\\s+|\\s*))?` +
|
|
1271
|
-
`(?:${
|
|
1309
|
+
`(?:${templateTrackListPattern}|${repeatString})` +
|
|
1272
1310
|
`(?:\\s+${lineNamesPattern})?`;
|
|
1273
|
-
|
|
1274
|
-
`(?:${gridAreaRowPattern}
|
|
1275
|
-
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}
|
|
1276
|
-
`(?:${explicitTrackPattern}
|
|
1277
|
-
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}
|
|
1278
|
-
`\\s*\\/\\s*(?:${explicitTrackPattern}
|
|
1279
|
-
')$');
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1311
|
+
return new RegExp('^(?:' +
|
|
1312
|
+
`(?:${gridAreaRowPattern}\\s*)+?` +
|
|
1313
|
+
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+)?|` +
|
|
1314
|
+
`(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+` +
|
|
1315
|
+
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+)?|` +
|
|
1316
|
+
`\\s*\\/\\s*(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+` +
|
|
1317
|
+
')$').test(value);
|
|
1318
|
+
};
|
|
1319
|
+
const gridTemplateProperties = ['gridTemplate'];
|
|
1320
|
+
const hyphenateLimitCharsRegex = new RegExp(`^(${numberPattern}|auto)( (?!\\s)(${numberPattern}|auto)){0,2}$`);
|
|
1321
|
+
const imageOrientationRegex = new RegExp(`^(${anglePattern})( (?!\\s)(flip|${varString})){0,1}$`);
|
|
1322
|
+
const imageOrientationProperties = ['imageOrientation'];
|
|
1323
|
+
const initialLetterRegex = new RegExp(`^(${numberPattern})( (?!\\s)(${integerPattern}|drop|raise)){0,1}$`);
|
|
1324
|
+
const insetPairRegex = new RegExp(`^(${lengthValuePattern}|auto)(\\s+(${lengthValuePattern}))?$`);
|
|
1325
|
+
const insetPairProperties = ['insetBlock', 'insetInline'];
|
|
1326
|
+
const marginPairRegex = new RegExp(`^(${lengthValuePattern})(\\s+(${lengthValuePattern}))?$`);
|
|
1327
|
+
const marginPairProperties = [
|
|
1328
|
+
'marginBlock',
|
|
1329
|
+
'marginInline',
|
|
1330
|
+
'scrollPaddingBlock',
|
|
1331
|
+
'scrollPaddingInline',
|
|
1332
|
+
'paddingBlock',
|
|
1333
|
+
'paddingInline',
|
|
1334
|
+
'scrollMarginBlock',
|
|
1335
|
+
'scrollMarginInline',
|
|
1336
|
+
];
|
|
1337
|
+
const markerProperties = [
|
|
1338
|
+
'marker',
|
|
1339
|
+
'markerEnd',
|
|
1340
|
+
'markerMid',
|
|
1341
|
+
'markerStart',
|
|
1342
|
+
];
|
|
1343
|
+
const maskBorderOutsetRegex = new RegExp(`^(${lengthValuePattern}|${numberPattern})( (?!\\s)(${lengthValuePattern}|${numberPattern})){0,3}$`);
|
|
1344
|
+
const maskBorderSliceRegex = new RegExp(`^(${percentagePattern}|${numberPattern}|fill)( (?!\\s)(${percentagePattern}|${numberPattern}|fill)){0,3}$`);
|
|
1345
|
+
const maskBorderWidthRegex = new RegExp(`^(${lengthValuePattern}|${numberPattern}|auto)( (?!\\s)(${lengthValuePattern}|${numberPattern}|auto)){0,3}$`);
|
|
1346
|
+
const modeKeyword = `luminance|alpha|${varString}`;
|
|
1347
|
+
const repeatFullSet = `(${repeatKeyword}|${backgroundRepeatRegex.source.slice(1, -1)})`;
|
|
1348
|
+
const maskBorderOutsetSource = maskBorderOutsetRegex.source.slice(1, -1);
|
|
1349
|
+
const maskBorderSliceSource = maskBorderSliceRegex.source.slice(1, -1);
|
|
1350
|
+
const maskBorderWidthSource = maskBorderWidthRegex.source.slice(1, -1);
|
|
1351
|
+
const maskBorderRegex = new RegExp(`^(?:${gradientString}|${urlString})` +
|
|
1352
|
+
`(?:\\s+${maskBorderSliceSource})?` +
|
|
1353
|
+
`(?:\\s?/\\s?${maskBorderWidthSource})?` +
|
|
1354
|
+
`(?:\\s?/\\s?${maskBorderOutsetSource})?` +
|
|
1355
|
+
`(?:\\s+(?:${repeatFullSet}))?` +
|
|
1356
|
+
`(?:\\s+(?:${modeKeyword}))?$`);
|
|
1357
|
+
const maskBorderProperties = ['maskBorder'];
|
|
1358
|
+
const maskClipKeyword = geometryBaseSet + `|no-clip|border|padding|content|text|${varString}`;
|
|
1359
|
+
const maskClipRegex = new RegExp(`^(${maskClipKeyword})(,\\s*(${maskClipKeyword}))*$`);
|
|
1360
|
+
const maskClipProperties = ['maskClip'];
|
|
1361
|
+
const compositeKeyword = `add|subtract|intersect|exclude|${varString}`;
|
|
1362
|
+
const maskCompositeRegex = new RegExp(`^(${compositeKeyword})(,\\s*(${compositeKeyword}))*$`);
|
|
1363
|
+
const maskCompositeProperties = ['maskComposite'];
|
|
1364
|
+
const maskModeKeyword = `alpha|luminance|match-source|${varString}`;
|
|
1365
|
+
const maskModeRegex = new RegExp(`^(${maskModeKeyword})(,\\s*(${maskModeKeyword}))*$`);
|
|
1366
|
+
const maksModeProperties = ['maskMode'];
|
|
1367
|
+
const maskOriginKeyword = geometryBaseSet + `|content|padding|border|${varString}`;
|
|
1368
|
+
const maskOriginRegex = new RegExp(`^(${maskOriginKeyword})(,\\s*(${maskOriginKeyword}))*$`);
|
|
1369
|
+
const maskOriginProperties = ['maskOrigin'];
|
|
1370
|
+
const maskPositionRegex = new RegExp(`^(?:(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3})(?:,\\s*(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3})*$`);
|
|
1371
|
+
const maskPositionProperties = ['maskPosition'];
|
|
1372
|
+
const maskRepeatRegex = new RegExp(`^(${backgroundRepeatSource})(,\\s*(${backgroundRepeatSource}))*$`);
|
|
1373
|
+
const maskRepeatProperties = ['maskRepeat'];
|
|
1374
|
+
const maskRepeatKeyword = 'stretch|repeat|round|space';
|
|
1375
|
+
const maskBorderRepeatRegex = new RegExp(`^((?:${maskRepeatKeyword}|${varString})(?:\\s+(?:${maskRepeatKeyword}|${varString}))?)$`);
|
|
1376
|
+
const maskBorderRepeatProperties = [
|
|
1377
|
+
'maskBorderRepeat',
|
|
1378
|
+
'borderImageRepeat',
|
|
1379
|
+
];
|
|
1380
|
+
const maskSizeRegex = new RegExp(`^(${lengthValuePattern}|cover|contain|auto)(\\s+(${lengthValuePattern}|cover|contain|auto))?(,\\s*(${lengthValuePattern}|cover|contain|auto)(\\s+(${lengthValuePattern}|cover|contain|auto))?)*$`);
|
|
1381
|
+
const maskSizeProperties = ['maskSize'];
|
|
1382
|
+
const position = `${positionKeyword}|${lengthValuePattern}`;
|
|
1383
|
+
const bgSize = `${lengthValuePattern}|cover|contain|auto`;
|
|
1384
|
+
const positionPair = `(${position})( (?!\\s)(${position})){0,1}?`;
|
|
1385
|
+
const bgSizePair = `(${bgSize})( (?!\\s)(${bgSize})){0,1}?`;
|
|
1386
|
+
const maskLayerRegex = `(?:${gradientString}|${urlString})` +
|
|
1387
|
+
`(?:\\s+${positionPair})?` +
|
|
1388
|
+
`(?:\\s?/\\s?${bgSizePair})?` +
|
|
1389
|
+
`(?:\\s+${backgroundRepeatSource})?` +
|
|
1390
|
+
`(?:\\s+${maskOriginKeyword})?` +
|
|
1391
|
+
`(?:\\s+${maskClipKeyword})?` +
|
|
1392
|
+
`(?:\\s+${compositeKeyword})?` +
|
|
1393
|
+
`(?:\\s+${maskModeKeyword})?`;
|
|
1394
|
+
const maskRegex = new RegExp(`^${maskLayerRegex}(?:,(?:\\s+${maskLayerRegex}))*$`);
|
|
1395
|
+
const maskProperties = ['mask'];
|
|
1396
|
+
const mathDepthRegex = new RegExp(`^(${addString}|${integerPattern})$`);
|
|
1397
|
+
const lengthPositionRegex = new RegExp(`^(${lengthValuePattern}|${percentagePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${percentagePattern}|${positionKeyword})){0,3}$`);
|
|
1398
|
+
const lengthPositionProperties = [
|
|
1399
|
+
'objectPosition',
|
|
1400
|
+
'offsetAnchor',
|
|
1401
|
+
'offsetPosition',
|
|
1402
|
+
'perspectiveOrigin',
|
|
1403
|
+
];
|
|
1404
|
+
const rayString = 'ray\\([^\\)]+\\)';
|
|
1405
|
+
const offsetPathRegex = new RegExp(`^(${rayString}|${urlString}|${basicShapeString}|${geometryBaseSet})$`);
|
|
1406
|
+
const offsetPathProperties = ['offsetPath'];
|
|
1407
|
+
const offsetRotateRegex = new RegExp(`^(${anglePattern}|auto|reverse)( (?!\\s)(${anglePattern})){0,1}$`);
|
|
1408
|
+
const offsetRotateProperties = ['offsetRotate'];
|
|
1409
|
+
const offsetPositionSource = lengthPositionRegex.source.slice(1, -1);
|
|
1410
|
+
const offsetRotateSource = offsetRotateRegex.source.slice(1, -1);
|
|
1411
|
+
const offsetPathSource = offsetPathRegex.source.slice(1, -1);
|
|
1412
|
+
const offsetRegex = new RegExp(`^(?!\\s)(?=\\S)(${offsetPositionSource})?\\s*(${offsetPathSource}(\\s(${lengthValuePattern}(\\s+${offsetRotateSource})?|${offsetRotateSource}))?)?\\s*(\\/\\s*${offsetPositionSource})?(?<!\\s)$`);
|
|
1413
|
+
const offsetProperties = ['offset'];
|
|
1414
|
+
const oveflowKeyword = `visible|hidden|clip|scroll|auto|${varString}`;
|
|
1415
|
+
const oveflowRegex = new RegExp(`^(${oveflowKeyword})(\\s+(${oveflowKeyword}))?$`);
|
|
1416
|
+
const oveflowProperties = ['overflow'];
|
|
1417
|
+
const overflowClipMarginRegex = new RegExp(`^(?:${lengthValuePattern}$|${visualBox}$|${lengthValuePattern}\\s+${visualBox}$|${visualBox}\\s+${lengthValuePattern}$)`);
|
|
1418
|
+
const overflowClipMarginProperties = ['overflowClipMargin'];
|
|
1419
|
+
const overscrollBehaviorRegex = new RegExp(`^(auto|contain|${varString})( (?!\\s)(auto|contain|${varString})){0,1}$`);
|
|
1420
|
+
const overscrollBehaviorProperties = ['overscrollBehavior'];
|
|
1421
|
+
const fill = `(fill|${varString})`;
|
|
1422
|
+
const stroke = `(stroke|${varString})`;
|
|
1423
|
+
const markers = `(markers|${varString})`;
|
|
1424
|
+
const paintOrderPattern = `(?:(${fill})(\\s+(${stroke}))?(\\s+(${markers}))?)?` +
|
|
1425
|
+
`(?:(${fill})(\\s+(${markers}))?(\\s+(${stroke}))?)?` +
|
|
1426
|
+
`(?:(${stroke})(\\s+(${fill}))?(\\s+(${markers}))?)?` +
|
|
1427
|
+
`(?:(${stroke})(\\s+(${markers}))?(\\s+(${fill}))?)?` +
|
|
1428
|
+
`(?:(${markers})(\\s+(${fill}))?(\\s+(${stroke}))?)?` +
|
|
1429
|
+
`(?:(${markers})(\\s+(${stroke}))?(\\s+(${fill}))?)?`;
|
|
1430
|
+
const paintOrderRegex = new RegExp(`^(${paintOrderPattern})$`);
|
|
1431
|
+
const paintOrderProperties = ['paintOrder'];
|
|
1432
|
+
const quotesRegex = new RegExp(`^(${stringString}|${varString})(\\s(${stringString}|${varString}))*$`);
|
|
1433
|
+
const quotesProperties = ['quotes'];
|
|
1434
|
+
const rotatePattern = `(?:(x|y|z|${varString})\\s+${anglePattern})?` +
|
|
1435
|
+
`(?:${numberPattern}\\s+${numberPattern}\\s+${numberPattern}\\s+${anglePattern})?` +
|
|
1436
|
+
`(?:${anglePattern})?`;
|
|
1437
|
+
const rotateRegex = new RegExp(`^(${rotatePattern})$`);
|
|
1438
|
+
const rotateProperties = ['rotate'];
|
|
1439
|
+
const numberAndPercentagePattern = `${numberPattern}|${percentagePattern}`;
|
|
1440
|
+
const scaleRegex = new RegExp(`^(${numberAndPercentagePattern})( (?!\\s)(${numberAndPercentagePattern})){0,2}$`);
|
|
1441
|
+
const scaleProperties = ['scale'];
|
|
1442
|
+
const scrollMarginRegex = new RegExp(`^(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,3}$`);
|
|
1443
|
+
const scrollMarginProperties = ['scrollMargin'];
|
|
1444
|
+
const scrollPaddingRegex = new RegExp(`^(${lengthValuePattern}|auto)( (?!\\s)(${lengthValuePattern}|auto)){0,3}$`);
|
|
1445
|
+
const scrollPaddingProperties = ['scrollPadding'];
|
|
1446
|
+
const scrollbarColorRegex = new RegExp(`^(${colorSource}(\\s${colorSource})?)$`);
|
|
1447
|
+
const scrollbarColorProperties = ['scrollbarColor'];
|
|
1448
|
+
const shapeImageThresholdRegex = new RegExp(`^(${numberAndPercentagePattern})$`);
|
|
1449
|
+
const outsideShape = `(${insetString}|${circleString}|${ellipseString}|${polygonString}|${varString})`;
|
|
1450
|
+
const shapeVisualBox = 'margin-box|' + visualBox;
|
|
1451
|
+
const shapeOutsideRegex = new RegExp(`^(?:` +
|
|
1452
|
+
`(?:${outsideShape}(?:\\s+${shapeVisualBox})?)|` +
|
|
1453
|
+
`(?:${shapeVisualBox}(?:\\s+${outsideShape})?)|` +
|
|
1454
|
+
`${gradientString}|${urlString}|${varString}` +
|
|
1455
|
+
`)$`);
|
|
1456
|
+
const shapeOutsideProperties = ['shapeOutside'];
|
|
1457
|
+
const strokeRegex = new RegExp(`^${gradientString}|${urlString}|${colorSource}$`);
|
|
1458
|
+
const strokeProperties = ['stroke'];
|
|
1459
|
+
const strokeDasharrayRegex = new RegExp(`^(${numberPattern}|${lengthValuePattern})(,\\s(${numberPattern}|${lengthValuePattern}))*$`);
|
|
1460
|
+
const strokeMiterlimitRegex = new RegExp(`^(${numberPattern})$`);
|
|
1461
|
+
const isValidTextDecorationLine = (value) => {
|
|
1462
|
+
const decorationValues = [
|
|
1463
|
+
'underline',
|
|
1464
|
+
'overline',
|
|
1465
|
+
'line-through',
|
|
1466
|
+
'blink',
|
|
1331
1467
|
];
|
|
1332
|
-
const
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
const modeKeyword = `luminance|alpha|${varString}`;
|
|
1342
|
-
const repeatFullSet = `(${repeatKeyword}|${backgroundRepeatRegex.source.slice(1, -1)})`;
|
|
1343
|
-
const maskBorderOutsetSource = maskBorderOutsetRegex.source.slice(1, -1);
|
|
1344
|
-
const maskBorderSliceSource = maskBorderSliceRegex.source.slice(1, -1);
|
|
1345
|
-
const maskBorderWidthSource = maskBorderWidthRegex.source.slice(1, -1);
|
|
1346
|
-
const maskBorderRegex = new RegExp(`^(?:${gradientString}|${urlString})` +
|
|
1347
|
-
`(?:\\s+${maskBorderSliceSource})?` +
|
|
1348
|
-
`(?:\\s?/\\s?${maskBorderWidthSource})?` +
|
|
1349
|
-
`(?:\\s?/\\s?${maskBorderOutsetSource})?` +
|
|
1350
|
-
`(?:\\s+(?:${repeatFullSet}))?` +
|
|
1351
|
-
`(?:\\s+(?:${modeKeyword}))?$`);
|
|
1352
|
-
const maskBorderProperties = ['maskBorder'];
|
|
1353
|
-
const maskClipKeyword = geometryBaseSet +
|
|
1354
|
-
`|no-clip|border|padding|content|text|${varString}`;
|
|
1355
|
-
const maskClipRegex = new RegExp(`^(${maskClipKeyword})(,\\s*(${maskClipKeyword}))*$`);
|
|
1356
|
-
const maskClipProperties = ['maskClip'];
|
|
1357
|
-
const compositeKeyword = `add|subtract|intersect|exclude|${varString}`;
|
|
1358
|
-
const maskCompositeRegex = new RegExp(`^(${compositeKeyword})(,\\s*(${compositeKeyword}))*$`);
|
|
1359
|
-
const maskCompositeProperties = ['maskComposite'];
|
|
1360
|
-
const maskModeKeyword = `alpha|luminance|match-source|${varString}`;
|
|
1361
|
-
const maskModeRegex = new RegExp(`^(${maskModeKeyword})(,\\s*(${maskModeKeyword}))*$`);
|
|
1362
|
-
const maksModeProperties = ['maskMode'];
|
|
1363
|
-
const maskOriginKeyword = geometryBaseSet + `|content|padding|border|${varString}`;
|
|
1364
|
-
const maskOriginRegex = new RegExp(`^(${maskOriginKeyword})(,\\s*(${maskOriginKeyword}))*$`);
|
|
1365
|
-
const maskOriginProperties = ['maskOrigin'];
|
|
1366
|
-
const maskPositionRegex = new RegExp(`^(?:(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3})(?:,\\s*(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3})*$`);
|
|
1367
|
-
const maskPositionProperties = ['maskPosition'];
|
|
1368
|
-
const maskRepeatRegex = new RegExp(`^(${backgroundRepeatSource})(,\\s*(${backgroundRepeatSource}))*$`);
|
|
1369
|
-
const maskRepeatProperties = ['maskRepeat'];
|
|
1370
|
-
const maskRepeatKeyword = 'stretch|repeat|round|space';
|
|
1371
|
-
const maskBorderRepeatRegex = new RegExp(`^((?:${maskRepeatKeyword}|${varString})(?:\\s+(?:${maskRepeatKeyword}|${varString}))?)$`);
|
|
1372
|
-
const maskBorderRepeatProperties = [
|
|
1373
|
-
'maskBorderRepeat',
|
|
1374
|
-
'borderImageRepeat',
|
|
1375
|
-
];
|
|
1376
|
-
const maskSizeRegex = new RegExp(`^(${lengthValuePattern}|cover|contain|auto)(\\s+(${lengthValuePattern}|cover|contain|auto))?(,\\s*(${lengthValuePattern}|cover|contain|auto)(\\s+(${lengthValuePattern}|cover|contain|auto))?)*$`);
|
|
1377
|
-
const maskSizeProperties = ['maskSize'];
|
|
1378
|
-
const position = `${positionKeyword}|${lengthValuePattern}`;
|
|
1379
|
-
const bgSize = `${lengthValuePattern}|cover|contain|auto`;
|
|
1380
|
-
const positionPair = `(${position})( (?!\\s)(${position})){0,1}?`;
|
|
1381
|
-
const bgSizePair = `(${bgSize})( (?!\\s)(${bgSize})){0,1}?`;
|
|
1382
|
-
const maskLayerRegex = `(?:${gradientString}|${urlString})` +
|
|
1383
|
-
`(?:\\s+${positionPair})?` +
|
|
1384
|
-
`(?:\\s?/\\s?${bgSizePair})?` +
|
|
1385
|
-
`(?:\\s+${backgroundRepeatSource})?` +
|
|
1386
|
-
`(?:\\s+${maskOriginKeyword})?` +
|
|
1387
|
-
`(?:\\s+${maskClipKeyword})?` +
|
|
1388
|
-
`(?:\\s+${compositeKeyword})?` +
|
|
1389
|
-
`(?:\\s+${maskModeKeyword})?`;
|
|
1390
|
-
const maskRegex = new RegExp(`^${maskLayerRegex}(?:,(?:\\s+${maskLayerRegex}))*$`);
|
|
1391
|
-
const maskProperties = ['mask'];
|
|
1392
|
-
const mathDepthRegex = new RegExp(`^(${addString}|${integerPattern})$`);
|
|
1393
|
-
const lengthPositionRegex = new RegExp(`^(${lengthValuePattern}|${percentagePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${percentagePattern}|${positionKeyword})){0,3}$`);
|
|
1394
|
-
const lengthPositionProperties = [
|
|
1395
|
-
'objectPosition',
|
|
1396
|
-
'offsetAnchor',
|
|
1397
|
-
'offsetPosition',
|
|
1398
|
-
'perspectiveOrigin',
|
|
1399
|
-
];
|
|
1400
|
-
const rayString = 'ray\\([^\\)]+\\)';
|
|
1401
|
-
const offsetPathRegex = new RegExp(`^(${rayString}|${urlString}|${basicShapeString}|${geometryBaseSet})$`);
|
|
1402
|
-
const offsetPathProperties = ['offsetPath'];
|
|
1403
|
-
const offsetRotateRegex = new RegExp(`^(${anglePattern}|auto|reverse)( (?!\\s)(${anglePattern})){0,1}$`);
|
|
1404
|
-
const offsetRotateProperties = ['offsetRotate'];
|
|
1405
|
-
const offsetPositionSource = lengthPositionRegex.source.slice(1, -1);
|
|
1406
|
-
const offsetRotateSource = offsetRotateRegex.source.slice(1, -1);
|
|
1407
|
-
const offsetPathSource = offsetPathRegex.source.slice(1, -1);
|
|
1408
|
-
const offsetRegex = new RegExp(`^(?!\\s)(?=\\S)(${offsetPositionSource})?\\s*(${offsetPathSource}(\\s(${lengthValuePattern}(\\s+${offsetRotateSource})?|${offsetRotateSource}))?)?\\s*(\\/\\s*${offsetPositionSource})?(?<!\\s)$`);
|
|
1409
|
-
const offsetProperties = ['offset'];
|
|
1410
|
-
const oveflowKeyword = `visible|hidden|clip|scroll|auto|${varString}`;
|
|
1411
|
-
const oveflowRegex = new RegExp(`^(${oveflowKeyword})(\\s+(${oveflowKeyword}))?$`);
|
|
1412
|
-
const oveflowProperties = ['overflow'];
|
|
1413
|
-
const overflowClipMarginRegex = new RegExp(`^(?:${lengthValuePattern}$|${visualBox}$|${lengthValuePattern}\\s+${visualBox}$|${visualBox}\\s+${lengthValuePattern}$)`);
|
|
1414
|
-
const overflowClipMarginProperties = ['overflowClipMargin'];
|
|
1415
|
-
const overscrollBehaviorRegex = new RegExp(`^(auto|contain|${varString})( (?!\\s)(auto|contain|${varString})){0,1}$`);
|
|
1416
|
-
const overscrollBehaviorProperties = ['overscrollBehavior'];
|
|
1417
|
-
const fill = `(fill|${varString})`;
|
|
1418
|
-
const stroke = `(stroke|${varString})`;
|
|
1419
|
-
const markers = `(markers|${varString})`;
|
|
1420
|
-
const paintOrderPattern = `(?:(${fill})(\\s+(${stroke}))?(\\s+(${markers}))?)?` +
|
|
1421
|
-
`(?:(${fill})(\\s+(${markers}))?(\\s+(${stroke}))?)?` +
|
|
1422
|
-
`(?:(${stroke})(\\s+(${fill}))?(\\s+(${markers}))?)?` +
|
|
1423
|
-
`(?:(${stroke})(\\s+(${markers}))?(\\s+(${fill}))?)?` +
|
|
1424
|
-
`(?:(${markers})(\\s+(${fill}))?(\\s+(${stroke}))?)?` +
|
|
1425
|
-
`(?:(${markers})(\\s+(${stroke}))?(\\s+(${fill}))?)?`;
|
|
1426
|
-
const paintOrderRegex = new RegExp(`^(${paintOrderPattern})$`);
|
|
1427
|
-
const paintOrderProperties = ['paintOrder'];
|
|
1428
|
-
const quotesRegex = new RegExp(`^(${stringString}|${varString})(\\s(${stringString}|${varString}))*$`);
|
|
1429
|
-
const quotesProperties = ['quotes'];
|
|
1430
|
-
const rotatePattern = `(?:(x|y|z|${varString})\\s+${anglePattern})?` +
|
|
1431
|
-
`(?:${numberPattern}\\s+${numberPattern}\\s+${numberPattern}\\s+${anglePattern})?` +
|
|
1432
|
-
`(?:${anglePattern})?`;
|
|
1433
|
-
const rotateRegex = new RegExp(`^(${rotatePattern})$`);
|
|
1434
|
-
const rotateProperties = ['rotate'];
|
|
1435
|
-
const numberAndPercentagePattern = `${numberPattern}|${percentagePattern}`;
|
|
1436
|
-
const scaleRegex = new RegExp(`^(${numberAndPercentagePattern})( (?!\\s)(${numberAndPercentagePattern})){0,2}$`);
|
|
1437
|
-
const scaleProperties = ['scale'];
|
|
1438
|
-
const scrollMarginRegex = new RegExp(`^(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,3}$`);
|
|
1439
|
-
const scrollMarginProperties = ['scrollMargin'];
|
|
1440
|
-
const scrollPaddingRegex = new RegExp(`^(${lengthValuePattern}|auto)( (?!\\s)(${lengthValuePattern}|auto)){0,3}$`);
|
|
1441
|
-
const scrollPaddingProperties = ['scrollPadding'];
|
|
1442
|
-
const scrollbarColorRegex = new RegExp(`^(${colorSource}(\\s${colorSource})?)$`);
|
|
1443
|
-
const scrollbarColorProperties = ['scrollbarColor'];
|
|
1444
|
-
const shapeImageThresholdRegex = new RegExp(`^(${numberAndPercentagePattern})$`);
|
|
1445
|
-
const outsideShape = `(${insetString}|${circleString}|${ellipseString}|${polygonString}|${varString})`;
|
|
1446
|
-
const shapeVisualBox = 'margin-box|' + visualBox;
|
|
1447
|
-
const shapeOutsideRegex = new RegExp(`^(?:` +
|
|
1448
|
-
`(?:${outsideShape}(?:\\s+${shapeVisualBox})?)|` +
|
|
1449
|
-
`(?:${shapeVisualBox}(?:\\s+${outsideShape})?)|` +
|
|
1450
|
-
`${gradientString}|${urlString}|${varString}` +
|
|
1451
|
-
`)$`);
|
|
1452
|
-
const shapeOutsideProperties = ['shapeOutside'];
|
|
1453
|
-
const strokeRegex = new RegExp(`^${gradientString}|${urlString}|${colorSource}$`);
|
|
1454
|
-
const strokeProperties = ['stroke'];
|
|
1455
|
-
const strokeDasharrayRegex = new RegExp(`^(${numberPattern}|${lengthValuePattern})(,\\s(${numberPattern}|${lengthValuePattern}))*$`);
|
|
1456
|
-
const strokeMiterlimitRegex = new RegExp(`^(${numberPattern})$`);
|
|
1457
|
-
const isValidTextDecorationLine = (value) => {
|
|
1458
|
-
const decorationValues = [
|
|
1459
|
-
'underline',
|
|
1460
|
-
'overline',
|
|
1461
|
-
'line-through',
|
|
1462
|
-
'blink',
|
|
1463
|
-
];
|
|
1464
|
-
const usedValues = new Set();
|
|
1465
|
-
const trimmedValue = value.trim();
|
|
1466
|
-
if (value !== trimmedValue) {
|
|
1467
|
-
return false;
|
|
1468
|
+
const usedValues = new Set();
|
|
1469
|
+
const trimmedValue = value.trim();
|
|
1470
|
+
if (value !== trimmedValue) {
|
|
1471
|
+
return false;
|
|
1472
|
+
}
|
|
1473
|
+
const tokens = value.trim().split(/\s+/);
|
|
1474
|
+
return tokens.every((token) => {
|
|
1475
|
+
if (token.startsWith('var(') && varRegex.test(token)) {
|
|
1476
|
+
return true;
|
|
1468
1477
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1478
|
+
if (decorationValues.includes(token) || varString.includes(token)) {
|
|
1479
|
+
return !usedValues.has(token) && usedValues.add(token);
|
|
1480
|
+
}
|
|
1481
|
+
return false;
|
|
1482
|
+
});
|
|
1483
|
+
};
|
|
1484
|
+
const textDecorationProperties = ['textDecorationLine'];
|
|
1485
|
+
const textIndentRegex = new RegExp(`^(${lengthValuePattern})(\\s(hanging|${varString})?)?(\\s(each-line|${varString})?)?$`);
|
|
1486
|
+
const textIndentProperties = ['textIndent'];
|
|
1487
|
+
const textShadowRegex = new RegExp(`^(?:(?:(${colorSource})\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${colorSource}))?(?:\\s*,\\s*(?:(${colorSource})\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${colorSource}))?)*|none)$`);
|
|
1488
|
+
const textShadowProperties = ['textShadow'];
|
|
1489
|
+
const alignKeyword = `start|end|center|flex-start|flex-end|${varString}`;
|
|
1490
|
+
const firstLast = `first|last|${varString}`;
|
|
1491
|
+
const baseline = `baseline|${varString}`;
|
|
1492
|
+
const touchActionProperties = ['touchAction'];
|
|
1493
|
+
const alignContentRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${alignKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1494
|
+
const alignContentProperties = ['alignContent'];
|
|
1495
|
+
const itemsSelfKeyword = `self-start|self-end|anchor-center|start|end|center|flex-start|flex-end|${varString}`;
|
|
1496
|
+
const alignItemsSelfRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${itemsSelfKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1497
|
+
const alignItemsSelfProperties = ['alignItems', 'alignSelf'];
|
|
1498
|
+
const leftGroup = `block|inline|${varString}`;
|
|
1499
|
+
const rightGroup = `flex|flow|flow-root|table|grid|ruby|math|run-in|${varString}`;
|
|
1500
|
+
const listItem = `list-item|${varString}`;
|
|
1501
|
+
const listItemRightGroup = `block|inline|flow|flow-root|run-in|${varString}`;
|
|
1502
|
+
const displayRegex = new RegExp(`^(((${leftGroup})\\s+(${rightGroup}))|(${listItem})\\s+(${listItemRightGroup}))$`);
|
|
1503
|
+
const displayProperties = ['display'];
|
|
1504
|
+
const direction = 'row|row-reverse|column|column-reverse';
|
|
1505
|
+
const wrap = 'nowrap|wrap|wrap-reverse';
|
|
1506
|
+
const flexFlowRegex = new RegExp(`^((${direction}|${varString})(\\s+(${wrap}|${varString})))$`);
|
|
1507
|
+
const flexFlowProperties = ['flexFlow'];
|
|
1508
|
+
const first = `(first|${varString})`;
|
|
1509
|
+
const last = `(last|${varString})`;
|
|
1510
|
+
const forceAllow = `(force-end|allow-end|${varString})`;
|
|
1511
|
+
const hangingPunctuationPattern = `(?:${first}(?:\\s+${forceAllow})?)?` +
|
|
1512
|
+
`(?:${last}(?:\\s+${forceAllow})?)?` +
|
|
1513
|
+
`(?:${first}\\s+${forceAllow}\\s+${last})?` +
|
|
1514
|
+
`(?:${first}\\s+${last})?`;
|
|
1515
|
+
const hangingPunctuationRegex = new RegExp(`^(${hangingPunctuationPattern})$`);
|
|
1516
|
+
const hangingPunctuationProperties = ['hangingPunctuation'];
|
|
1517
|
+
const justifyContentKeyword = `left|right|stretch|start|end|center|flex-start|flex-end|${varString}`;
|
|
1518
|
+
const justifyContentRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${justifyContentKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1519
|
+
const justifyContentProperties = ['justifyContent'];
|
|
1520
|
+
const justifyItemsSelfKeyword = `left|right|anchor-center|stretch|self-start|self-end|start|end|center|flex-start|flex-end|${varString}`;
|
|
1521
|
+
const justifySelfRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${justifyItemsSelfKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1522
|
+
const justifySelfProperties = ['justifySelf'];
|
|
1523
|
+
const legacyValues = `(legacy|${varString})\\s+(left|right|center|${varString})`;
|
|
1524
|
+
const justifyItemsRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${justifyItemsSelfKeyword}))|(${firstLast})\\s+(${baseline})|(${legacyValues}))$`);
|
|
1525
|
+
const justifyItemsProperties = ['justifyItems'];
|
|
1526
|
+
const scrollSnapAlignKeyword = 'start|end|center';
|
|
1527
|
+
const scrollSnapAlignRegex = new RegExp(`^((?:${scrollSnapAlignKeyword}|${varString})(?:\\s+(?:${scrollSnapAlignKeyword}|${varString}))?)$`);
|
|
1528
|
+
const scrollSnapAlignProperties = ['scrollSnapAlign'];
|
|
1529
|
+
const scrollSnapTypeKeyword = 'x|y|block|inline|both';
|
|
1530
|
+
const snapStrictKeyowrd = 'mandatory|proximity';
|
|
1531
|
+
const scrollSnapTypeRegex = new RegExp(`^((?:${scrollSnapTypeKeyword}|${varString})(?:\\s+(?:${snapStrictKeyowrd}|${varString}))?)$`);
|
|
1532
|
+
const scrollSnapTypeProperties = ['scrollSnapType'];
|
|
1533
|
+
const leftRight = `left|right|${varString}`;
|
|
1534
|
+
const overUnder = `over|under|${varString}`;
|
|
1535
|
+
const textEmphasisPositionRegex = new RegExp(`^(((?:${overUnder})(?:\\s+(?:${leftRight}))|(?:${leftRight})(?:\\s+(?:${overUnder})))?)$`);
|
|
1536
|
+
const textEmphasisPositionProperties = ['textEmphasisPosition'];
|
|
1537
|
+
const filledOpen = `filled|open|${varString}`;
|
|
1538
|
+
const emphasisStyleKeyword = `dot|circle|double-circle|triangle|sesame|${varString}`;
|
|
1539
|
+
const textEmphasisStyleRegex = new RegExp(`^(((?:${filledOpen})(?:\\s+(?:${emphasisStyleKeyword})))?|${stringString}?)$`);
|
|
1540
|
+
const textEmphasisStyleProperties = ['textEmphasisStyle'];
|
|
1541
|
+
const textEmphasisRegex = new RegExp(`^(((?:${filledOpen})(?:\\s+(?:${emphasisStyleKeyword}|${colorSource})))?|${stringString}?)$`);
|
|
1542
|
+
const textEmphasisProperties = ['textEmphasis'];
|
|
1543
|
+
const transformValue = `(${lengthValuePattern}|left|center|right|top|bottom)`;
|
|
1544
|
+
const transformOriginRegex = new RegExp(`^(${transformValue})(\\s(${transformValue}))?(\\s(${transformValue}))?$`);
|
|
1545
|
+
const transformOriginProperties = ['transformOrigin'];
|
|
1546
|
+
const transformRegex = new RegExp(`^((${transformFunctions})(\\s+(${transformFunctions}))*)?$`);
|
|
1547
|
+
const transformProperties = ['transform'];
|
|
1548
|
+
const translateRegex = new RegExp(`^(${lengthValuePattern}|${percentagePattern})(\\s(${lengthValuePattern}|${percentagePattern}))?(\\s(${lengthValuePattern}))?$`);
|
|
1549
|
+
const translateProperties = ['translate'];
|
|
1550
|
+
const placeContentProperties = ['placeContent'];
|
|
1551
|
+
const placeItemsProperties = ['placeItems'];
|
|
1552
|
+
const placeSelfProperties = ['placeSelf'];
|
|
1553
|
+
if (translateProperties.includes(key)) {
|
|
1554
|
+
if (!translateRegex.test(value) && globalValue) {
|
|
1555
|
+
report();
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
else if (transformProperties.includes(key)) {
|
|
1559
|
+
if (!transformRegex.test(value) && globalValue) {
|
|
1560
|
+
report();
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
else if (transformOriginProperties.includes(key)) {
|
|
1564
|
+
if (!transformOriginRegex.test(value) && globalValue) {
|
|
1565
|
+
report();
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
else if (textEmphasisProperties.includes(key)) {
|
|
1569
|
+
if (!textEmphasisRegex.test(value) && globalValue) {
|
|
1570
|
+
report();
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
else if (textEmphasisStyleProperties.includes(key)) {
|
|
1574
|
+
if (!textEmphasisStyleRegex.test(value) && globalValue) {
|
|
1575
|
+
report();
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
else if (textEmphasisPositionProperties.includes(key)) {
|
|
1579
|
+
if (!textEmphasisPositionRegex.test(value) && globalValue) {
|
|
1580
|
+
report();
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
else if (scrollSnapTypeProperties.includes(key)) {
|
|
1584
|
+
if (!scrollSnapTypeRegex.test(value) && globalValue) {
|
|
1585
|
+
report();
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
else if (scrollSnapAlignProperties.includes(key)) {
|
|
1589
|
+
if (!scrollSnapAlignRegex.test(value) && globalValue) {
|
|
1590
|
+
report();
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
else if (maskBorderRepeatProperties.includes(key)) {
|
|
1594
|
+
if (!maskBorderRepeatRegex.test(value) && globalValue) {
|
|
1595
|
+
report();
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
else if (justifyItemsProperties.includes(key)) {
|
|
1599
|
+
if (!justifyItemsRegex.test(value) && globalValue) {
|
|
1600
|
+
report();
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
else if (justifySelfProperties.includes(key)) {
|
|
1604
|
+
if (!justifySelfRegex.test(value) && globalValue) {
|
|
1605
|
+
report();
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
else if (justifyContentProperties.includes(key)) {
|
|
1609
|
+
if (!justifyContentRegex.test(value) && globalValue) {
|
|
1610
|
+
report();
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
else if (hangingPunctuationProperties.includes(key)) {
|
|
1614
|
+
if (!hangingPunctuationRegex.test(value) && globalValue) {
|
|
1615
|
+
report();
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
else if (flexFlowProperties.includes(key)) {
|
|
1619
|
+
if (!flexFlowRegex.test(value) && globalValue) {
|
|
1620
|
+
report();
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
else if (backgroundRepeatProperties.includes(key)) {
|
|
1624
|
+
if (!backgroundRepeatRegex.test(value) && globalValue) {
|
|
1625
|
+
report();
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
else if (placeSelfProperties.includes(key)) {
|
|
1629
|
+
if (!(0, place_1.isValidPlaceSelf)(value) && globalValue) {
|
|
1630
|
+
report();
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
else if (placeItemsProperties.includes(key)) {
|
|
1634
|
+
if (!(0, place_1.isValidPlaceItems)(value) && globalValue) {
|
|
1635
|
+
report();
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
else if (placeContentProperties.includes(key)) {
|
|
1639
|
+
if (!(0, place_1.isValidPlaceContent)(value) && globalValue) {
|
|
1640
|
+
report();
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
else if (displayProperties.includes(key)) {
|
|
1644
|
+
if (!displayRegex.test(value) && globalValue) {
|
|
1645
|
+
report();
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
else if (alignItemsSelfProperties.includes(key)) {
|
|
1649
|
+
if (!alignItemsSelfRegex.test(value) && globalValue) {
|
|
1650
|
+
report();
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
else if (alignContentProperties.includes(key)) {
|
|
1654
|
+
if (!alignContentRegex.test(value) && globalValue) {
|
|
1655
|
+
report();
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
else if (touchActionProperties.includes(key)) {
|
|
1659
|
+
if (!(0, place_1.isValidTouchAction)(value) && globalValue) {
|
|
1660
|
+
report();
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
else if (textShadowProperties.includes(key)) {
|
|
1664
|
+
if (!textShadowRegex.test(value) && globalValue) {
|
|
1665
|
+
report();
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
else if (textIndentProperties.includes(key)) {
|
|
1669
|
+
if (!textIndentRegex.test(value) && globalValue) {
|
|
1670
|
+
report();
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
else if (textDecorationProperties.includes(key)) {
|
|
1674
|
+
if (!isValidTextDecorationLine(value) && globalValue) {
|
|
1675
|
+
report();
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
else if (strokeMiterlimitProperties.includes(key)) {
|
|
1679
|
+
if (!strokeMiterlimitRegex.test(value) && globalValue) {
|
|
1680
|
+
report();
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
else if (strokeDasharrayProperties.includes(key)) {
|
|
1684
|
+
if (!strokeDasharrayRegex.test(value) && globalValue) {
|
|
1685
|
+
report();
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
else if (strokeProperties.includes(key)) {
|
|
1689
|
+
if (!strokeRegex.test(value) && globalValue) {
|
|
1690
|
+
report();
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
else if (shapeOutsideProperties.includes(key)) {
|
|
1694
|
+
if (!shapeOutsideRegex.test(value) && globalValue) {
|
|
1695
|
+
report();
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
else if (shapeImageThresholdProperties.includes(key)) {
|
|
1699
|
+
if (!shapeImageThresholdRegex.test(value) && globalValue) {
|
|
1700
|
+
report();
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
else if (scrollbarColorProperties.includes(key)) {
|
|
1704
|
+
if (!scrollbarColorRegex.test(value) && globalValue) {
|
|
1705
|
+
report();
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
else if (scrollPaddingProperties.includes(key)) {
|
|
1709
|
+
if (!scrollPaddingRegex.test(value) && globalValue) {
|
|
1710
|
+
report();
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
else if (scrollMarginProperties.includes(key)) {
|
|
1714
|
+
if (!scrollMarginRegex.test(value) && globalValue) {
|
|
1715
|
+
report();
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
else if (scaleProperties.includes(key)) {
|
|
1719
|
+
if (!scaleRegex.test(value) && globalValue) {
|
|
1720
|
+
report();
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
else if (rotateProperties.includes(key)) {
|
|
1724
|
+
if (!rotateRegex.test(value) && globalValue) {
|
|
1725
|
+
report();
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
else if (quotesProperties.includes(key)) {
|
|
1729
|
+
if (!quotesRegex.test(value) && globalValue) {
|
|
1730
|
+
report();
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
else if (paintOrderProperties.includes(key)) {
|
|
1734
|
+
if (!paintOrderRegex.test(value) && globalValue) {
|
|
1735
|
+
report();
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
else if (overscrollBehaviorProperties.includes(key)) {
|
|
1739
|
+
if (!overscrollBehaviorRegex.test(value) && globalValue) {
|
|
1740
|
+
report();
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
else if (overflowClipMarginProperties.includes(key)) {
|
|
1744
|
+
if (!overflowClipMarginRegex.test(value) && globalValue) {
|
|
1745
|
+
report();
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
else if (oveflowProperties.includes(key)) {
|
|
1749
|
+
if (!oveflowRegex.test(value) && globalValue) {
|
|
1750
|
+
report();
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
else if (offsetProperties.includes(key)) {
|
|
1754
|
+
if (!offsetRegex.test(value) && globalValue) {
|
|
1755
|
+
report();
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
else if (offsetPathProperties.includes(key)) {
|
|
1759
|
+
if (!offsetPathRegex.test(value) && globalValue) {
|
|
1760
|
+
report();
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
else if (offsetRotateProperties.includes(key)) {
|
|
1764
|
+
if (!offsetRotateRegex.test(value) && globalValue) {
|
|
1765
|
+
report();
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
else if (lengthPositionProperties.includes(key)) {
|
|
1769
|
+
if (!lengthPositionRegex.test(value)) {
|
|
1770
|
+
report();
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
else if (mathDepthProperties.includes(key)) {
|
|
1774
|
+
if (!mathDepthRegex.test(value) && globalValue) {
|
|
1775
|
+
report();
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
else if (maskProperties.includes(key)) {
|
|
1779
|
+
if (!maskRegex.test(value) && globalValue) {
|
|
1780
|
+
report();
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
else if (maskBorderProperties.includes(key)) {
|
|
1784
|
+
if (!maskBorderRegex.test(value) && globalValue) {
|
|
1785
|
+
report();
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
else if (maskSizeProperties.includes(key)) {
|
|
1789
|
+
if (!maskSizeRegex.test(value) && globalValue) {
|
|
1790
|
+
report();
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
else if (maskRepeatProperties.includes(key)) {
|
|
1794
|
+
if (!maskRepeatRegex.test(value) && globalValue) {
|
|
1795
|
+
report();
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
else if (maskPositionProperties.includes(key)) {
|
|
1799
|
+
if (!maskPositionRegex.test(value) && globalValue) {
|
|
1800
|
+
report();
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
else if (maskOriginProperties.includes(key)) {
|
|
1804
|
+
if (!maskOriginRegex.test(value) && globalValue) {
|
|
1805
|
+
report();
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
else if (maksModeProperties.includes(key)) {
|
|
1809
|
+
if (!maskModeRegex.test(value) && globalValue) {
|
|
1810
|
+
report();
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
else if (maskCompositeProperties.includes(key)) {
|
|
1814
|
+
if (!maskCompositeRegex.test(value) && globalValue) {
|
|
1815
|
+
report();
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
else if (maskClipProperties.includes(key)) {
|
|
1819
|
+
if (!maskClipRegex.test(value) && globalValue) {
|
|
1820
|
+
report();
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
else if (maskBorderWidthProperties.includes(key)) {
|
|
1824
|
+
if (!maskBorderWidthRegex.test(value) && globalValue) {
|
|
1825
|
+
report();
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
else if (maskBorderSliceProperties.includes(key)) {
|
|
1829
|
+
if (!maskBorderSliceRegex.test(value) && globalValue) {
|
|
1830
|
+
report();
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
else if (maskBorderOutsetProperties.includes(key)) {
|
|
1834
|
+
if (!maskBorderOutsetRegex.test(value) && globalValue) {
|
|
1835
|
+
report();
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
else if (markerProperties.includes(key)) {
|
|
1839
|
+
if (!urlRegex.test(value) && globalValue) {
|
|
1840
|
+
report();
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
else if (marginPairProperties.includes(key)) {
|
|
1844
|
+
if (!marginPairRegex.test(value) && globalValue) {
|
|
1845
|
+
report();
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
else if (insetPairProperties.includes(key)) {
|
|
1849
|
+
if (!insetPairRegex.test(value) && globalValue) {
|
|
1850
|
+
report();
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
else if (initialLetterProperties.includes(key)) {
|
|
1854
|
+
if (!initialLetterRegex.test(value) && globalValue) {
|
|
1855
|
+
report();
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
else if (imageOrientationProperties.includes(key)) {
|
|
1859
|
+
if (!imageOrientationRegex.test(value) && globalValue) {
|
|
1860
|
+
report();
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
else if (hyphenateLimitCharsProperties.includes(key)) {
|
|
1864
|
+
if (!hyphenateLimitCharsRegex.test(value) && globalValue) {
|
|
1865
|
+
report();
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
else if (gridProperties.includes(key)) {
|
|
1869
|
+
if (!gridRegex.test(value)) {
|
|
1870
|
+
report();
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
else if (gridTemplateProperties.includes(key)) {
|
|
1874
|
+
if (!isValidateGridTemplate(value) && globalValue) {
|
|
1875
|
+
report();
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
else if (gridTemplateTrackListProperties.includes(key)) {
|
|
1879
|
+
if (!gridTemplateTrackListRegex.test(value) && globalValue) {
|
|
1880
|
+
report();
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
else if (gridTemplateAreasProperties.includes(key)) {
|
|
1884
|
+
if (!quoteRegex.test(value) && globalValue) {
|
|
1885
|
+
report();
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
else if (gridAutoColumnsRowsProperties.includes(key)) {
|
|
1889
|
+
if (!gridAutoColumnsRegex.test(value) && globalValue) {
|
|
1890
|
+
report();
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
else if (stringNameProperties.includes(key)) {
|
|
1894
|
+
if (!stringNameRegex.test(value) && globalValue) {
|
|
1895
|
+
report();
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
else if (fontFeatureSettingsProperties.includes(key)) {
|
|
1899
|
+
if (!fontFeatureSettingsRegex.test(value) && globalValue) {
|
|
1900
|
+
report();
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
else if (fontVariantProperties.includes(key)) {
|
|
1904
|
+
if (!fontVariantRegex.test(value) && globalValue) {
|
|
1905
|
+
report();
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
else if (fontVariationSettingsProperties.includes(key)) {
|
|
1909
|
+
if (!fontVariationSettingsRegex.test(value) && globalValue) {
|
|
1910
|
+
report();
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
else if (fontVariantNumericProperties.includes(key)) {
|
|
1914
|
+
if (!fontVariantNumericRegex.test(value) && globalValue) {
|
|
1915
|
+
report();
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
else if (fontVariantLigaturesProperties.includes(key)) {
|
|
1919
|
+
if (!fontVariantLigaturesRegex.test(value) && globalValue) {
|
|
1920
|
+
report();
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
else if (fontVariantEastAsianProperties.includes(key)) {
|
|
1924
|
+
if (!isValidFontVariantEastAsian(value) && globalValue) {
|
|
1925
|
+
report();
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
else if (fontVariantAlternatesProperties.includes(key)) {
|
|
1929
|
+
if (!fontVariantAlternatesRegex.test(value) && globalValue) {
|
|
1930
|
+
report();
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
else if (fontSynthesisProperties.includes(key)) {
|
|
1934
|
+
if (!fontSynthesisRegex.test(value) && globalValue) {
|
|
1935
|
+
report();
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
else if (fontStyleProperties.includes(key)) {
|
|
1939
|
+
if (!fontStyleRegex.test(value) && globalValue) {
|
|
1940
|
+
report();
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
else if (fontPaletteProperties.includes(key)) {
|
|
1944
|
+
if (!fontPaletteRegex.test(value) && globalValue) {
|
|
1945
|
+
report();
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
else if (fontSizeAdjustProperties.includes(key)) {
|
|
1949
|
+
if (!isValidFontSizeAdjust(value) && globalValue) {
|
|
1950
|
+
report();
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
else if (stringStringProperties.includes(key)) {
|
|
1954
|
+
if (!stringValueRegex.test(value) && globalValue) {
|
|
1955
|
+
report();
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
else if (fontStretchProperties.includes(key)) {
|
|
1959
|
+
if (!percentageValueRegex.test(value) && globalValue) {
|
|
1960
|
+
report();
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
else if (flexProperties.includes(key)) {
|
|
1964
|
+
if (!isValidFlexValue(value) && globalValue) {
|
|
1965
|
+
report();
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
else if (cursorProperty.includes(key)) {
|
|
1969
|
+
if (!isValidCursor(value) && globalValue) {
|
|
1970
|
+
report();
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
else if (contentProperty.includes(key)) {
|
|
1974
|
+
if (!contentValueRegex.test(value) && globalValue) {
|
|
1975
|
+
report();
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
else if (columnsProperties.includes(key)) {
|
|
1979
|
+
if (!columnsRegex.test(value) && globalValue) {
|
|
1980
|
+
report();
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
else if (clipPathProperties.includes(key)) {
|
|
1984
|
+
if (!clipPathRegex.test(value) && globalValue) {
|
|
1985
|
+
report();
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
else if (boxShadowProperties.includes(key)) {
|
|
1989
|
+
if (!boxShadowRegex.test(value) && globalValue) {
|
|
1990
|
+
report();
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
else if (backgroundProperties.includes(key)) {
|
|
1994
|
+
if (!backgroundRegex.test(value) && globalValue) {
|
|
1995
|
+
report();
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
else if (backgroundAttachmentProperties.includes(key)) {
|
|
1999
|
+
if (!backgroundAttachmentRegex.test(value) && globalValue) {
|
|
2000
|
+
report();
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
else if (backgroundBlendModeProperties.includes(key)) {
|
|
2004
|
+
if (!backgroundBlendModeRegex.test(value) && globalValue) {
|
|
2005
|
+
report();
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
else if (backgroundImageProperties.includes(key)) {
|
|
2009
|
+
if (!backgroundImageRegex.test(value) && globalValue) {
|
|
2010
|
+
report();
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
else if (backgroundOriginProperties.includes(key)) {
|
|
2014
|
+
if (!backgroundOriginRegex.test(value) && globalValue) {
|
|
2015
|
+
report();
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
else if (backgroundQuadProperties.includes(key)) {
|
|
2019
|
+
if (!backgroundQuadRegex.test(value) && globalValue) {
|
|
2020
|
+
report();
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
else if (backgroundPairProperties.includes(key)) {
|
|
2024
|
+
if (!backgroundPairRegex.test(value) && globalValue) {
|
|
2025
|
+
report();
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
else if (filterProperties.includes(key)) {
|
|
2029
|
+
if (!filterRegex.test(value) && globalValue) {
|
|
2030
|
+
report();
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
else if (animationTimingFunctionProperties.includes(key)) {
|
|
2034
|
+
if (!animationTimingFunctionRegex.test(value) && globalValue) {
|
|
2035
|
+
report();
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
else if (animationIterationCountProperties.includes(key)) {
|
|
2039
|
+
if (!animationIterationCountRegex.test(value) && globalValue) {
|
|
2040
|
+
report();
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
else if (animationPlayStateProperties.includes(key)) {
|
|
2044
|
+
if (!animationPlayStateRegex.test(value) && globalValue) {
|
|
2045
|
+
report();
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
else if (animationFillModeProperties.includes(key)) {
|
|
2049
|
+
if (!animationFillModeRegex.test(value) && globalValue) {
|
|
2050
|
+
report();
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
else if (animationDirectionProperties.includes(key)) {
|
|
2054
|
+
if (!animationDirectionRegex.test(value) && globalValue) {
|
|
2055
|
+
report();
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
else if (animationTimeProperties.includes(key)) {
|
|
2059
|
+
if (!animationTimeRegex.test(value) && globalValue) {
|
|
2060
|
+
report();
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
else if (aspectRatioProperties.includes(key)) {
|
|
2064
|
+
if (!aspectRatioRegex.test(value) && globalValue) {
|
|
2065
|
+
report();
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
else if (borderImageProperties.includes(key)) {
|
|
2069
|
+
if (!borderImageRegex.test(value) && globalValue) {
|
|
2070
|
+
report();
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
else if (borderImageSlice.includes(key)) {
|
|
2074
|
+
if (!sliceRegex.test(value) && globalValue) {
|
|
2075
|
+
report();
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
else if (ImageSourceProperties.includes(key)) {
|
|
2079
|
+
if (!imageRegex.test(value) && globalValue) {
|
|
2080
|
+
report();
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
else if (borderProperties.includes(key)) {
|
|
2084
|
+
if (!isBorderValue(value) && globalValue) {
|
|
2085
|
+
report();
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
else if (singleColorProperties.includes(key)) {
|
|
2089
|
+
if (!colorRegex.test(value) && globalValue) {
|
|
2090
|
+
report();
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
else if (borderColorProperties.includes(key)) {
|
|
2094
|
+
if (!isValidMultipleColorValues(value) && globalValue) {
|
|
2095
|
+
report();
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
else if (integerGroupProperties.includes(key)) {
|
|
2099
|
+
if (!integerValueRegex.test(value) && globalValue) {
|
|
2100
|
+
report();
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
else if (otherGroupProperties.includes(key)) {
|
|
2104
|
+
if (!otherSingleValueRegex.test(value) && globalValue) {
|
|
2105
|
+
report();
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
else if (lengthValueProperties.includes(key)) {
|
|
2109
|
+
if (!lengthValueRegex.test(value) && globalValue) {
|
|
2110
|
+
report();
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
else if (borderRadiusProperties.includes(key)) {
|
|
2114
|
+
if (!borderRadiusRegex.test(value) && globalValue) {
|
|
2115
|
+
report();
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
else if (borderStyleProperties.includes(key)) {
|
|
2119
|
+
if (!borderStyleRegex.test(value) && globalValue) {
|
|
2120
|
+
report();
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
else if (multipleValueProperties.includes(key)) {
|
|
2124
|
+
if (!multipleValueRegex.test(value) && globalValue) {
|
|
2125
|
+
report();
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
else {
|
|
2129
|
+
if (globalValue) {
|
|
2130
|
+
report();
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
return {
|
|
2136
|
+
ImportDeclaration(node) {
|
|
2137
|
+
if (node.source.value === '@plumeria/core') {
|
|
2138
|
+
node.specifiers.forEach((specifier) => {
|
|
2139
|
+
if (specifier.type === 'ImportNamespaceSpecifier' ||
|
|
2140
|
+
specifier.type === 'ImportDefaultSpecifier') {
|
|
2141
|
+
plumeriaAliases[specifier.local.name] = 'NAMESPACE';
|
|
2142
|
+
}
|
|
2143
|
+
else {
|
|
2144
|
+
const spec = specifier;
|
|
2145
|
+
const importedName = spec.imported.type === 'Identifier'
|
|
2146
|
+
? spec.imported.name
|
|
2147
|
+
: String(spec.imported.value);
|
|
2148
|
+
plumeriaAliases[specifier.local.name] = importedName;
|
|
2149
|
+
}
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
},
|
|
2153
|
+
CallExpression(node) {
|
|
2154
|
+
let isCssProperties = false;
|
|
2155
|
+
if (node.callee.type === 'MemberExpression') {
|
|
2156
|
+
if (node.callee.object.type === 'Identifier' &&
|
|
2157
|
+
plumeriaAliases[node.callee.object.name] === 'NAMESPACE') {
|
|
2158
|
+
const propertyName = node.callee.property.type === 'Identifier'
|
|
2159
|
+
? node.callee.property.name
|
|
2160
|
+
: null;
|
|
2161
|
+
if (propertyName === 'create' ||
|
|
2162
|
+
propertyName === 'keyframes' ||
|
|
2163
|
+
propertyName === 'viewTransition') {
|
|
2164
|
+
isCssProperties = true;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
else if (node.callee.type === 'Identifier') {
|
|
2169
|
+
const alias = plumeriaAliases[node.callee.name];
|
|
2170
|
+
if (alias === 'create' ||
|
|
2171
|
+
alias === 'keyframes' ||
|
|
2172
|
+
alias === 'viewTransition') {
|
|
2173
|
+
isCssProperties = true;
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
if (!isCssProperties) {
|
|
2177
|
+
return;
|
|
2178
|
+
}
|
|
2179
|
+
node.arguments.forEach((arg) => {
|
|
2180
|
+
if (arg.type === 'ObjectExpression') {
|
|
2181
|
+
arg.properties.forEach((prop) => {
|
|
2182
|
+
if (prop.type === 'Property' &&
|
|
2183
|
+
prop.value.type === 'ObjectExpression') {
|
|
2184
|
+
checkStyleObject(prop.value);
|
|
1477
2185
|
}
|
|
1478
|
-
return false;
|
|
1479
2186
|
});
|
|
1480
|
-
};
|
|
1481
|
-
const textDecorationProperties = ['textDecorationLine'];
|
|
1482
|
-
const textIndentRegex = new RegExp(`^(${lengthValuePattern})(\\s(hanging|${varString})?)?(\\s(each-line|${varString})?)?$`);
|
|
1483
|
-
const textIndentProperties = ['textIndent'];
|
|
1484
|
-
const textShadowRegex = new RegExp(`^(?:(?:(${colorSource})\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${colorSource}))?(?:\\s*,\\s*(?:(${colorSource})\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${colorSource}))?)*|none)$`);
|
|
1485
|
-
const textShadowProperties = ['textShadow'];
|
|
1486
|
-
const alignKeyword = `start|end|center|flex-start|flex-end|${varString}`;
|
|
1487
|
-
const firstLast = `first|last|${varString}`;
|
|
1488
|
-
const baseline = `baseline|${varString}`;
|
|
1489
|
-
const touchActionProperties = ['touchAction'];
|
|
1490
|
-
const alignContentRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${alignKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1491
|
-
const alignContentProperties = ['alignContent'];
|
|
1492
|
-
const itemsSelfKeyword = `self-start|self-end|anchor-center|start|end|center|flex-start|flex-end|${varString}`;
|
|
1493
|
-
const alignItemsSelfRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${itemsSelfKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1494
|
-
const alignItemsSelfProperties = ['alignItems', 'alignSelf'];
|
|
1495
|
-
const leftGroup = `block|inline|${varString}`;
|
|
1496
|
-
const rightGroup = `flex|flow|flow-root|table|grid|ruby|math|run-in|${varString}`;
|
|
1497
|
-
const listItem = `list-item|${varString}`;
|
|
1498
|
-
const listItemRightGroup = `block|inline|flow|flow-root|run-in|${varString}`;
|
|
1499
|
-
const displayRegex = new RegExp(`^(((${leftGroup})\\s+(${rightGroup}))|(${listItem})\\s+(${listItemRightGroup}))$`);
|
|
1500
|
-
const displayProperties = ['display'];
|
|
1501
|
-
const direction = 'row|row-reverse|column|column-reverse';
|
|
1502
|
-
const wrap = 'nowrap|wrap|wrap-reverse';
|
|
1503
|
-
const flexFlowRegex = new RegExp(`^((${direction}|${varString})(\\s+(${wrap}|${varString})))$`);
|
|
1504
|
-
const flexFlowProperties = ['flexFlow'];
|
|
1505
|
-
const first = `(first|${varString})`;
|
|
1506
|
-
const last = `(last|${varString})`;
|
|
1507
|
-
const forceAllow = `(force-end|allow-end|${varString})`;
|
|
1508
|
-
const hangingPunctuationPattern = `(?:${first}(?:\\s+${forceAllow})?)?` +
|
|
1509
|
-
`(?:${last}(?:\\s+${forceAllow})?)?` +
|
|
1510
|
-
`(?:${first}\\s+${forceAllow}\\s+${last})?` +
|
|
1511
|
-
`(?:${first}\\s+${last})?`;
|
|
1512
|
-
const hangingPunctuationRegex = new RegExp(`^(${hangingPunctuationPattern})$`);
|
|
1513
|
-
const hangingPunctuationProperties = ['hangingPunctuation'];
|
|
1514
|
-
const justifyContentKeyword = `left|right|stretch|start|end|center|flex-start|flex-end|${varString}`;
|
|
1515
|
-
const justifyContentRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${justifyContentKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1516
|
-
const justifyContentProperties = ['justifyContent'];
|
|
1517
|
-
const justifyItemsSelfKeyword = `left|right|anchor-center|stretch|self-start|self-end|start|end|center|flex-start|flex-end|${varString}`;
|
|
1518
|
-
const justifySelfRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${justifyItemsSelfKeyword}))|(${firstLast})\\s+(${baseline}))$`);
|
|
1519
|
-
const justifySelfProperties = ['justifySelf'];
|
|
1520
|
-
const legacyValues = `(legacy|${varString})\\s+(left|right|center|${varString})`;
|
|
1521
|
-
const justifyItemsRegex = new RegExp(`^(((safe|unsafe|${varString})\\s+(${justifyItemsSelfKeyword}))|(${firstLast})\\s+(${baseline})|(${legacyValues}))$`);
|
|
1522
|
-
const justifyItemsProperties = ['justifyItems'];
|
|
1523
|
-
const scrollSnapAlignKeyword = 'start|end|center';
|
|
1524
|
-
const scrollSnapAlignRegex = new RegExp(`^((?:${scrollSnapAlignKeyword}|${varString})(?:\\s+(?:${scrollSnapAlignKeyword}|${varString}))?)$`);
|
|
1525
|
-
const scrollSnapAlignProperties = ['scrollSnapAlign'];
|
|
1526
|
-
const scrollSnapTypeKeyword = 'x|y|block|inline|both';
|
|
1527
|
-
const snapStrictKeyowrd = 'mandatory|proximity';
|
|
1528
|
-
const scrollSnapTypeRegex = new RegExp(`^((?:${scrollSnapTypeKeyword}|${varString})(?:\\s+(?:${snapStrictKeyowrd}|${varString}))?)$`);
|
|
1529
|
-
const scrollSnapTypeProperties = ['scrollSnapType'];
|
|
1530
|
-
const leftRight = `left|right|${varString}`;
|
|
1531
|
-
const overUnder = `over|under|${varString}`;
|
|
1532
|
-
const textEmphasisPositionRegex = new RegExp(`^(((?:${overUnder})(?:\\s+(?:${leftRight}))|(?:${leftRight})(?:\\s+(?:${overUnder})))?)$`);
|
|
1533
|
-
const textEmphasisPositionProperties = ['textEmphasisPosition'];
|
|
1534
|
-
const filledOpen = `filled|open|${varString}`;
|
|
1535
|
-
const emphasisStyleKeyword = `dot|circle|double-circle|triangle|sesame|${varString}`;
|
|
1536
|
-
const textEmphasisStyleRegex = new RegExp(`^(((?:${filledOpen})(?:\\s+(?:${emphasisStyleKeyword})))?|${stringString}?)$`);
|
|
1537
|
-
const textEmphasisStyleProperties = ['textEmphasisStyle'];
|
|
1538
|
-
const textEmphasisRegex = new RegExp(`^(((?:${filledOpen})(?:\\s+(?:${emphasisStyleKeyword}|${colorSource})))?|${stringString}?)$`);
|
|
1539
|
-
const textEmphasisProperties = ['textEmphasis'];
|
|
1540
|
-
const transformValue = `(${lengthValuePattern}|left|center|right|top|bottom)`;
|
|
1541
|
-
const transformOriginRegex = new RegExp(`^(${transformValue})(\\s(${transformValue}))?(\\s(${transformValue}))?$`);
|
|
1542
|
-
const transformOriginProperties = ['transformOrigin'];
|
|
1543
|
-
const transformRegex = new RegExp(`^((${transformFunctions})(\\s+(${transformFunctions}))*)?$`);
|
|
1544
|
-
const transformProperties = ['transform'];
|
|
1545
|
-
const translateRegex = new RegExp(`^(${lengthValuePattern}|${percentagePattern})(\\s(${lengthValuePattern}|${percentagePattern}))?(\\s(${lengthValuePattern}))?$`);
|
|
1546
|
-
const translateProperties = ['translate'];
|
|
1547
|
-
const placeContentProperties = ['placeContent'];
|
|
1548
|
-
const placeItemsProperties = ['placeItems'];
|
|
1549
|
-
const placeSelfProperties = ['placeSelf'];
|
|
1550
|
-
if (translateProperties.includes(key)) {
|
|
1551
|
-
if (!translateRegex.test(value) && globalValue) {
|
|
1552
|
-
report();
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
else if (transformProperties.includes(key)) {
|
|
1556
|
-
if (!transformRegex.test(value) && globalValue) {
|
|
1557
|
-
report();
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
else if (transformOriginProperties.includes(key)) {
|
|
1561
|
-
if (!transformOriginRegex.test(value) && globalValue) {
|
|
1562
|
-
report();
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
else if (textEmphasisProperties.includes(key)) {
|
|
1566
|
-
if (!textEmphasisRegex.test(value) && globalValue) {
|
|
1567
|
-
report();
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
else if (textEmphasisStyleProperties.includes(key)) {
|
|
1571
|
-
if (!textEmphasisStyleRegex.test(value) && globalValue) {
|
|
1572
|
-
report();
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
else if (textEmphasisPositionProperties.includes(key)) {
|
|
1576
|
-
if (!textEmphasisPositionRegex.test(value) && globalValue) {
|
|
1577
|
-
report();
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
else if (scrollSnapTypeProperties.includes(key)) {
|
|
1581
|
-
if (!scrollSnapTypeRegex.test(value) && globalValue) {
|
|
1582
|
-
report();
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
else if (scrollSnapAlignProperties.includes(key)) {
|
|
1586
|
-
if (!scrollSnapAlignRegex.test(value) && globalValue) {
|
|
1587
|
-
report();
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
else if (maskBorderRepeatProperties.includes(key)) {
|
|
1591
|
-
if (!maskBorderRepeatRegex.test(value) && globalValue) {
|
|
1592
|
-
report();
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
else if (justifyItemsProperties.includes(key)) {
|
|
1596
|
-
if (!justifyItemsRegex.test(value) && globalValue) {
|
|
1597
|
-
report();
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
else if (justifySelfProperties.includes(key)) {
|
|
1601
|
-
if (!justifySelfRegex.test(value) && globalValue) {
|
|
1602
|
-
report();
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
else if (justifyContentProperties.includes(key)) {
|
|
1606
|
-
if (!justifyContentRegex.test(value) && globalValue) {
|
|
1607
|
-
report();
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
else if (hangingPunctuationProperties.includes(key)) {
|
|
1611
|
-
if (!hangingPunctuationRegex.test(value) && globalValue) {
|
|
1612
|
-
report();
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
else if (flexFlowProperties.includes(key)) {
|
|
1616
|
-
if (!flexFlowRegex.test(value) && globalValue) {
|
|
1617
|
-
report();
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
else if (backgroundRepeatProperties.includes(key)) {
|
|
1621
|
-
if (!backgroundRepeatRegex.test(value) && globalValue) {
|
|
1622
|
-
report();
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
else if (placeSelfProperties.includes(key)) {
|
|
1626
|
-
if (!(0, place_1.isValidPlaceSelf)(value) && globalValue) {
|
|
1627
|
-
report();
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
else if (placeItemsProperties.includes(key)) {
|
|
1631
|
-
if (!(0, place_1.isValidPlaceItems)(value) && globalValue) {
|
|
1632
|
-
report();
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
else if (placeContentProperties.includes(key)) {
|
|
1636
|
-
if (!(0, place_1.isValidPlaceContent)(value) && globalValue) {
|
|
1637
|
-
report();
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
else if (displayProperties.includes(key)) {
|
|
1641
|
-
if (!displayRegex.test(value) && globalValue) {
|
|
1642
|
-
report();
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
else if (alignItemsSelfProperties.includes(key)) {
|
|
1646
|
-
if (!alignItemsSelfRegex.test(value) && globalValue) {
|
|
1647
|
-
report();
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
1650
|
-
else if (alignContentProperties.includes(key)) {
|
|
1651
|
-
if (!alignContentRegex.test(value) && globalValue) {
|
|
1652
|
-
report();
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
else if (touchActionProperties.includes(key)) {
|
|
1656
|
-
if (!(0, place_1.isValidTouchAction)(value) && globalValue) {
|
|
1657
|
-
report();
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
else if (textShadowProperties.includes(key)) {
|
|
1661
|
-
if (!textShadowRegex.test(value) && globalValue) {
|
|
1662
|
-
report();
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
else if (textIndentProperties.includes(key)) {
|
|
1666
|
-
if (!textIndentRegex.test(value) && globalValue) {
|
|
1667
|
-
report();
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
else if (textDecorationProperties.includes(key)) {
|
|
1671
|
-
if (!isValidTextDecorationLine(value) && globalValue) {
|
|
1672
|
-
report();
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
else if (strokeMiterlimitProperties.includes(key)) {
|
|
1676
|
-
if (!strokeMiterlimitRegex.test(value) && globalValue) {
|
|
1677
|
-
report();
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
else if (strokeDasharrayProperties.includes(key)) {
|
|
1681
|
-
if (!strokeDasharrayRegex.test(value) && globalValue) {
|
|
1682
|
-
report();
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
else if (strokeProperties.includes(key)) {
|
|
1686
|
-
if (!strokeRegex.test(value) && globalValue) {
|
|
1687
|
-
report();
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
else if (shapeOutsideProperties.includes(key)) {
|
|
1691
|
-
if (!shapeOutsideRegex.test(value) && globalValue) {
|
|
1692
|
-
report();
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
else if (shapeImageThresholdProperties.includes(key)) {
|
|
1696
|
-
if (!shapeImageThresholdRegex.test(value) && globalValue) {
|
|
1697
|
-
report();
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
else if (scrollbarColorProperties.includes(key)) {
|
|
1701
|
-
if (!scrollbarColorRegex.test(value) && globalValue) {
|
|
1702
|
-
report();
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
else if (scrollPaddingProperties.includes(key)) {
|
|
1706
|
-
if (!scrollPaddingRegex.test(value) && globalValue) {
|
|
1707
|
-
report();
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
else if (scrollMarginProperties.includes(key)) {
|
|
1711
|
-
if (!scrollMarginRegex.test(value) && globalValue) {
|
|
1712
|
-
report();
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
else if (scaleProperties.includes(key)) {
|
|
1716
|
-
if (!scaleRegex.test(value) && globalValue) {
|
|
1717
|
-
report();
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
else if (rotateProperties.includes(key)) {
|
|
1721
|
-
if (!rotateRegex.test(value) && globalValue) {
|
|
1722
|
-
report();
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
else if (quotesProperties.includes(key)) {
|
|
1726
|
-
if (!quotesRegex.test(value) && globalValue) {
|
|
1727
|
-
report();
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
else if (paintOrderProperties.includes(key)) {
|
|
1731
|
-
if (!paintOrderRegex.test(value) && globalValue) {
|
|
1732
|
-
report();
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
else if (overscrollBehaviorProperties.includes(key)) {
|
|
1736
|
-
if (!overscrollBehaviorRegex.test(value) && globalValue) {
|
|
1737
|
-
report();
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
else if (overflowClipMarginProperties.includes(key)) {
|
|
1741
|
-
if (!overflowClipMarginRegex.test(value) && globalValue) {
|
|
1742
|
-
report();
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
else if (oveflowProperties.includes(key)) {
|
|
1746
|
-
if (!oveflowRegex.test(value) && globalValue) {
|
|
1747
|
-
report();
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
else if (offsetProperties.includes(key)) {
|
|
1751
|
-
if (!offsetRegex.test(value) && globalValue) {
|
|
1752
|
-
report();
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
else if (offsetPathProperties.includes(key)) {
|
|
1756
|
-
if (!offsetPathRegex.test(value) && globalValue) {
|
|
1757
|
-
report();
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
else if (offsetRotateProperties.includes(key)) {
|
|
1761
|
-
if (!offsetRotateRegex.test(value) && globalValue) {
|
|
1762
|
-
report();
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
else if (lengthPositionProperties.includes(key)) {
|
|
1766
|
-
if (!lengthPositionRegex.test(value)) {
|
|
1767
|
-
report();
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
else if (mathDepthProperties.includes(key)) {
|
|
1771
|
-
if (!mathDepthRegex.test(value) && globalValue) {
|
|
1772
|
-
report();
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
else if (maskProperties.includes(key)) {
|
|
1776
|
-
if (!maskRegex.test(value) && globalValue) {
|
|
1777
|
-
report();
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
else if (maskBorderProperties.includes(key)) {
|
|
1781
|
-
if (!maskBorderRegex.test(value) && globalValue) {
|
|
1782
|
-
report();
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
else if (maskSizeProperties.includes(key)) {
|
|
1786
|
-
if (!maskSizeRegex.test(value) && globalValue) {
|
|
1787
|
-
report();
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
else if (maskRepeatProperties.includes(key)) {
|
|
1791
|
-
if (!maskRepeatRegex.test(value) && globalValue) {
|
|
1792
|
-
report();
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
else if (maskPositionProperties.includes(key)) {
|
|
1796
|
-
if (!maskPositionRegex.test(value) && globalValue) {
|
|
1797
|
-
report();
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
else if (maskOriginProperties.includes(key)) {
|
|
1801
|
-
if (!maskOriginRegex.test(value) && globalValue) {
|
|
1802
|
-
report();
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
else if (maksModeProperties.includes(key)) {
|
|
1806
|
-
if (!maskModeRegex.test(value) && globalValue) {
|
|
1807
|
-
report();
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
else if (maskCompositeProperties.includes(key)) {
|
|
1811
|
-
if (!maskCompositeRegex.test(value) && globalValue) {
|
|
1812
|
-
report();
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
else if (maskClipProperties.includes(key)) {
|
|
1816
|
-
if (!maskClipRegex.test(value) && globalValue) {
|
|
1817
|
-
report();
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
else if (maskBorderWidthProperties.includes(key)) {
|
|
1821
|
-
if (!maskBorderWidthRegex.test(value) && globalValue) {
|
|
1822
|
-
report();
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
else if (maskBorderSliceProperties.includes(key)) {
|
|
1826
|
-
if (!maskBorderSliceRegex.test(value) && globalValue) {
|
|
1827
|
-
report();
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
else if (maskBorderOutsetProperties.includes(key)) {
|
|
1831
|
-
if (!maskBorderOutsetRegex.test(value) && globalValue) {
|
|
1832
|
-
report();
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
else if (markerProperties.includes(key)) {
|
|
1836
|
-
if (!urlRegex.test(value) && globalValue) {
|
|
1837
|
-
report();
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
else if (marginPairProperties.includes(key)) {
|
|
1841
|
-
if (!marginPairRegex.test(value) && globalValue) {
|
|
1842
|
-
report();
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
else if (insetPairProperties.includes(key)) {
|
|
1846
|
-
if (!insetPairRegex.test(value) && globalValue) {
|
|
1847
|
-
report();
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
else if (initialLetterProperties.includes(key)) {
|
|
1851
|
-
if (!initialLetterRegex.test(value) && globalValue) {
|
|
1852
|
-
report();
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
else if (imageOrientationProperties.includes(key)) {
|
|
1856
|
-
if (!imageOrientationRegex.test(value) && globalValue) {
|
|
1857
|
-
report();
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
else if (hyphenateLimitCharsProperties.includes(key)) {
|
|
1861
|
-
if (!hyphenateLimitCharsRegex.test(value) && globalValue) {
|
|
1862
|
-
report();
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
else if (gridProperties.includes(key)) {
|
|
1866
|
-
if (!gridRegex.test(value)) {
|
|
1867
|
-
report();
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
else if (gridTemplateProperties.includes(key)) {
|
|
1871
|
-
if (!isValidateGridTemplate(value) && globalValue) {
|
|
1872
|
-
report();
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
else if (gridTemplateTrackListProperties.includes(key)) {
|
|
1876
|
-
if (!gridTemplateTrackListRegex.test(value) && globalValue) {
|
|
1877
|
-
report();
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
else if (gridTemplateAreasProperties.includes(key)) {
|
|
1881
|
-
if (!quoteRegex.test(value) && globalValue) {
|
|
1882
|
-
report();
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
else if (gridAutoColumnsRowsProperties.includes(key)) {
|
|
1886
|
-
if (!gridAutoColumnsRegex.test(value) && globalValue) {
|
|
1887
|
-
report();
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
else if (stringNameProperties.includes(key)) {
|
|
1891
|
-
if (!stringNameRegex.test(value) && globalValue) {
|
|
1892
|
-
report();
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
else if (fontFeatureSettingsProperties.includes(key)) {
|
|
1896
|
-
if (!fontFeatureSettingsRegex.test(value) && globalValue) {
|
|
1897
|
-
report();
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
else if (fontVariantProperties.includes(key)) {
|
|
1901
|
-
if (!fontVariantRegex.test(value) && globalValue) {
|
|
1902
|
-
report();
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
else if (fontVariationSettingsProperties.includes(key)) {
|
|
1906
|
-
if (!fontVariationSettingsRegex.test(value) && globalValue) {
|
|
1907
|
-
report();
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
else if (fontVariantNumericProperties.includes(key)) {
|
|
1911
|
-
if (!fontVariantNumericRegex.test(value) && globalValue) {
|
|
1912
|
-
report();
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
else if (fontVariantLigaturesProperties.includes(key)) {
|
|
1916
|
-
if (!fontVariantLigaturesRegex.test(value) && globalValue) {
|
|
1917
|
-
report();
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
else if (fontVariantEastAsianProperties.includes(key)) {
|
|
1921
|
-
if (!isValidFontVariantEastAsian(value) && globalValue) {
|
|
1922
|
-
report();
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
else if (fontVariantAlternatesProperties.includes(key)) {
|
|
1926
|
-
if (!fontVariantAlternatesRegex.test(value) && globalValue) {
|
|
1927
|
-
report();
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
else if (fontSynthesisProperties.includes(key)) {
|
|
1931
|
-
if (!fontSynthesisRegex.test(value) && globalValue) {
|
|
1932
|
-
report();
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
else if (fontStyleProperties.includes(key)) {
|
|
1936
|
-
if (!fontStyleRegex.test(value) && globalValue) {
|
|
1937
|
-
report();
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
else if (fontPaletteProperties.includes(key)) {
|
|
1941
|
-
if (!fontPaletteRegex.test(value) && globalValue) {
|
|
1942
|
-
report();
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
else if (fontSizeAdjustProperties.includes(key)) {
|
|
1946
|
-
if (!isValidFontSizeAdjust(value) && globalValue) {
|
|
1947
|
-
report();
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
else if (stringStringProperties.includes(key)) {
|
|
1951
|
-
if (!stringValueRegex.test(value) && globalValue) {
|
|
1952
|
-
report();
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
else if (fontStretchProperties.includes(key)) {
|
|
1956
|
-
if (!percentageValueRegex.test(value) && globalValue) {
|
|
1957
|
-
report();
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
else if (flexProperties.includes(key)) {
|
|
1961
|
-
if (!isValidFlexValue(value) && globalValue) {
|
|
1962
|
-
report();
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
else if (cursorProperty.includes(key)) {
|
|
1966
|
-
if (!isValidCursor(value) && globalValue) {
|
|
1967
|
-
report();
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
else if (contentProperty.includes(key)) {
|
|
1971
|
-
if (!contentValueRegex.test(value) && globalValue) {
|
|
1972
|
-
report();
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
else if (columnsProperties.includes(key)) {
|
|
1976
|
-
if (!columnsRegex.test(value) && globalValue) {
|
|
1977
|
-
report();
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
else if (clipPathProperties.includes(key)) {
|
|
1981
|
-
if (!clipPathRegex.test(value) && globalValue) {
|
|
1982
|
-
report();
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
else if (boxShadowProperties.includes(key)) {
|
|
1986
|
-
if (!boxShadowRegex.test(value) && globalValue) {
|
|
1987
|
-
report();
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
else if (backgroundProperties.includes(key)) {
|
|
1991
|
-
if (!backgroundRegex.test(value) && globalValue) {
|
|
1992
|
-
report();
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
else if (backgroundAttachmentProperties.includes(key)) {
|
|
1996
|
-
if (!backgroundAttachmentRegex.test(value) && globalValue) {
|
|
1997
|
-
report();
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
else if (backgroundBlendModeProperties.includes(key)) {
|
|
2001
|
-
if (!backgroundBlendModeRegex.test(value) && globalValue) {
|
|
2002
|
-
report();
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
else if (backgroundImageProperties.includes(key)) {
|
|
2006
|
-
if (!backgroundImageRegex.test(value) && globalValue) {
|
|
2007
|
-
report();
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
else if (backgroundOriginProperties.includes(key)) {
|
|
2011
|
-
if (!backgroundOriginRegex.test(value) && globalValue) {
|
|
2012
|
-
report();
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
else if (backgroundQuadProperties.includes(key)) {
|
|
2016
|
-
if (!backgroundQuadRegex.test(value) && globalValue) {
|
|
2017
|
-
report();
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
|
-
else if (backgroundPairProperties.includes(key)) {
|
|
2021
|
-
if (!backgroundPairRegex.test(value) && globalValue) {
|
|
2022
|
-
report();
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
else if (filterProperties.includes(key)) {
|
|
2026
|
-
if (!filterRegex.test(value) && globalValue) {
|
|
2027
|
-
report();
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
else if (animationTimingFunctionProperties.includes(key)) {
|
|
2031
|
-
if (!animationTimingFunctionRegex.test(value) && globalValue) {
|
|
2032
|
-
report();
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
else if (animationIterationCountProperties.includes(key)) {
|
|
2036
|
-
if (!animationIterationCountRegex.test(value) && globalValue) {
|
|
2037
|
-
report();
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
else if (animationPlayStateProperties.includes(key)) {
|
|
2041
|
-
if (!animationPlayStateRegex.test(value) && globalValue) {
|
|
2042
|
-
report();
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
else if (animationFillModeProperties.includes(key)) {
|
|
2046
|
-
if (!animationFillModeRegex.test(value) && globalValue) {
|
|
2047
|
-
report();
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
else if (animationDirectionProperties.includes(key)) {
|
|
2051
|
-
if (!animationDirectionRegex.test(value) && globalValue) {
|
|
2052
|
-
report();
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
else if (animationTimeProperties.includes(key)) {
|
|
2056
|
-
if (!animationTimeRegex.test(value) && globalValue) {
|
|
2057
|
-
report();
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
else if (aspectRatioProperties.includes(key)) {
|
|
2061
|
-
if (!aspectRatioRegex.test(value) && globalValue) {
|
|
2062
|
-
report();
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
else if (borderImageProperties.includes(key)) {
|
|
2066
|
-
if (!borderImageRegex.test(value) && globalValue) {
|
|
2067
|
-
report();
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
else if (borderImageSlice.includes(key)) {
|
|
2071
|
-
if (!sliceRegex.test(value) && globalValue) {
|
|
2072
|
-
report();
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
else if (ImageSourceProperties.includes(key)) {
|
|
2076
|
-
if (!imageRegex.test(value) && globalValue) {
|
|
2077
|
-
report();
|
|
2078
|
-
}
|
|
2079
|
-
}
|
|
2080
|
-
else if (borderProperties.includes(key)) {
|
|
2081
|
-
if (!isBorderValue(value) && globalValue) {
|
|
2082
|
-
report();
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
else if (singleColorProperties.includes(key)) {
|
|
2086
|
-
if (!colorRegex.test(value) && globalValue) {
|
|
2087
|
-
report();
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
else if (borderColorProperties.includes(key)) {
|
|
2091
|
-
if (!isValidMultipleColorValues(value) && globalValue) {
|
|
2092
|
-
report();
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
else if (integerGroupProperties.includes(key)) {
|
|
2096
|
-
if (!integerValueRegex.test(value) && globalValue) {
|
|
2097
|
-
report();
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
else if (otherGroupProperties.includes(key)) {
|
|
2101
|
-
if (!otherSingleValueRegex.test(value) && globalValue) {
|
|
2102
|
-
report();
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2105
|
-
else if (lengthValueProperties.includes(key)) {
|
|
2106
|
-
if (!lengthValueRegex.test(value) && globalValue) {
|
|
2107
|
-
report();
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
else if (borderRadiusProperties.includes(key)) {
|
|
2111
|
-
if (!borderRadiusRegex.test(value) && globalValue) {
|
|
2112
|
-
report();
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
else if (borderStyleProperties.includes(key)) {
|
|
2116
|
-
if (!borderStyleRegex.test(value) && globalValue) {
|
|
2117
|
-
report();
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
else if (multipleValueProperties.includes(key)) {
|
|
2121
|
-
if (!multipleValueRegex.test(value) && globalValue) {
|
|
2122
|
-
report();
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
else {
|
|
2126
|
-
if (globalValue) {
|
|
2127
|
-
report();
|
|
2128
|
-
}
|
|
2129
2187
|
}
|
|
2130
2188
|
});
|
|
2131
2189
|
},
|