|
33 | 33 | }, |
34 | 34 | "at-rules": { |
35 | 35 | "patterns": [ |
| 36 | + { |
| 37 | + "begin": "(?xi)\n(?=\n @container # Match with the keyword `@container`, followed by one of the following:\n (?:\n \\s # Whitespace\n | \\( # Opening parenthesis\n | /\\* # Comment opening\n | $ # End of line\n )\n)", |
| 38 | + "end": "(?xi)\n(?<=}) # Match ends at the closing curly brace\n(?!\\G) # Allow another match to immediately follow", |
| 39 | + "patterns": [ |
| 40 | + { |
| 41 | + "begin": "(?i)\\G(@)container", |
| 42 | + "beginCaptures": { |
| 43 | + "0": { |
| 44 | + "name": "keyword.control.at-rule.container.css" |
| 45 | + }, |
| 46 | + "1": { |
| 47 | + "name": "punctuation.definition.keyword.css" |
| 48 | + } |
| 49 | + }, |
| 50 | + "end": "(?=\\s*[{;])", |
| 51 | + "name": "meta.at-rule.container.header.css", |
| 52 | + "patterns": [ |
| 53 | + { |
| 54 | + "include": "#container-condition" |
| 55 | + } |
| 56 | + ] |
| 57 | + }, |
| 58 | + { |
| 59 | + "begin": "{", |
| 60 | + "beginCaptures": { |
| 61 | + "0": { |
| 62 | + "name": "punctuation.section.container.begin.bracket.curly.css" |
| 63 | + } |
| 64 | + }, |
| 65 | + "end": "}", |
| 66 | + "endCaptures": { |
| 67 | + "0": { |
| 68 | + "name": "punctuation.section.container.end.bracket.curly.css" |
| 69 | + } |
| 70 | + }, |
| 71 | + "name": "meta.at-rule.container.body.css", |
| 72 | + "patterns": [ |
| 73 | + { |
| 74 | + "include": "#rule-list-innards" |
| 75 | + }, |
| 76 | + { |
| 77 | + "include": "$self" |
| 78 | + } |
| 79 | + ] |
| 80 | + } |
| 81 | + ] |
| 82 | + }, |
36 | 83 | { |
37 | 84 | "begin": "\\A(?:\\xEF\\xBB\\xBF)?(?i:(?=\\s*@charset\\b))", |
38 | 85 | "end": ";|(?=$)", |
|
679 | 726 | } |
680 | 727 | ] |
681 | 728 | }, |
| 729 | + "at-rule-supports-nested": { |
| 730 | + "begin": "(?i)(?=@supports(\\s|\\(|/\\*|$))", |
| 731 | + "end": "(?<=})(?!\\G)|(?=;)", |
| 732 | + "patterns": [ |
| 733 | + { |
| 734 | + "begin": "(?i)\\G(@)supports", |
| 735 | + "beginCaptures": { |
| 736 | + "0": { |
| 737 | + "name": "keyword.control.at-rule.supports.css" |
| 738 | + }, |
| 739 | + "1": { |
| 740 | + "name": "punctuation.definition.keyword.css" |
| 741 | + } |
| 742 | + }, |
| 743 | + "end": "(?=\\s*[{;])", |
| 744 | + "name": "meta.at-rule.supports.header.css", |
| 745 | + "patterns": [ |
| 746 | + { |
| 747 | + "include": "#feature-query-operators" |
| 748 | + }, |
| 749 | + { |
| 750 | + "include": "#feature-query" |
| 751 | + }, |
| 752 | + { |
| 753 | + "include": "#comment-block" |
| 754 | + }, |
| 755 | + { |
| 756 | + "include": "#escapes" |
| 757 | + } |
| 758 | + ] |
| 759 | + }, |
| 760 | + { |
| 761 | + "begin": "{", |
| 762 | + "beginCaptures": { |
| 763 | + "0": { |
| 764 | + "name": "punctuation.section.supports.begin.bracket.curly.css" |
| 765 | + } |
| 766 | + }, |
| 767 | + "end": "}", |
| 768 | + "endCaptures": { |
| 769 | + "0": { |
| 770 | + "name": "punctuation.section.supports.end.bracket.curly.css" |
| 771 | + } |
| 772 | + }, |
| 773 | + "name": "meta.at-rule.supports.body.css", |
| 774 | + "patterns": [ |
| 775 | + { |
| 776 | + "include": "#rule-list-innards" |
| 777 | + }, |
| 778 | + { |
| 779 | + "include": "$self" |
| 780 | + } |
| 781 | + ] |
| 782 | + } |
| 783 | + ] |
| 784 | + }, |
682 | 785 | "color-keywords": { |
683 | 786 | "patterns": [ |
684 | 787 | { |
|
733 | 836 | }, |
734 | 837 | "name": "comment.block.css" |
735 | 838 | }, |
| 839 | + "container-condition": { |
| 840 | + "begin": "\\G", |
| 841 | + "end": "(?=\\s*[{;])", |
| 842 | + "patterns": [ |
| 843 | + { |
| 844 | + "include": "#comment-block" |
| 845 | + }, |
| 846 | + { |
| 847 | + "include": "#escapes" |
| 848 | + }, |
| 849 | + { |
| 850 | + "match": "(?xi) (?<=not.*)not # Only one `not` is allowed per container condition", |
| 851 | + "name": "invalid.illegal.multiple-not.container.css" |
| 852 | + }, |
| 853 | + { |
| 854 | + "match": "(?xi)\n# Match must be preceded by one of the following:\n(?<=\n ^ # Beginning of line\n | \\s # Whitespace\n | \\*/ # Comment closing\n)\n\n# Match must be one of the following:\n(\n and\n | or\n | not\n)\n\n# Match must be followed by one of the following:\n(?=\n \\s # Whitespace\n | { # Opening curly brace\n | /\\* # Comment opening\n | $ # End of line\n)", |
| 855 | + "name": "keyword.operator.logical.$1.container.css" |
| 856 | + }, |
| 857 | + { |
| 858 | + "begin": "(?xi)\n\\G | (?<=\\*/)", |
| 859 | + "end": "(?xi)\n# Name ends when one of the following is reached:\n(?=\n \\(\n | not\n | scroll-state\\(\n | style\\(\n)", |
| 860 | + "patterns": [ |
| 861 | + { |
| 862 | + "include": "#comment-block" |
| 863 | + }, |
| 864 | + { |
| 865 | + "captures": { |
| 866 | + "1": { |
| 867 | + "name": "invalid.illegal.constant.container-name.css" |
| 868 | + }, |
| 869 | + "2": { |
| 870 | + "name": "support.constant.container-name.css" |
| 871 | + } |
| 872 | + }, |
| 873 | + "match": "(?xi)\n\n# Match must be preceded by one of the following:\n(?<=\n ^ # Beginning of line\n | \\s # Whitespace\n | \\*/ # Comment closing\n)\n\n# Match must one of the following:\n(?:\n (default|none) # Invalid name\n | ([\\w\\-\\\\]+) # Valid names (letters, digits, underscores, hyphens, and escapes allowed)\n)\n\n# Match must be followed by one of the following:\n(?=\n $ # End of line\n | \\s # Whitespace\n | \\( # Opening parenthesis\n | \\{ # Opening curly brace\n | \\; # Semicolon\n | /\\* # Comment opening\n)" |
| 874 | + } |
| 875 | + ] |
| 876 | + }, |
| 877 | + { |
| 878 | + "include": "#container-query" |
| 879 | + } |
| 880 | + ] |
| 881 | + }, |
| 882 | + "container-query": { |
| 883 | + "patterns": [ |
| 884 | + { |
| 885 | + "begin": "(?<=\\s)\\(", |
| 886 | + "beginCaptures": { |
| 887 | + "0": { |
| 888 | + "name": "punctuation.definition.parameters.begin.bracket.round.css" |
| 889 | + } |
| 890 | + }, |
| 891 | + "end": "\\)", |
| 892 | + "endCaptures": { |
| 893 | + "0": { |
| 894 | + "name": "punctuation.definition.parameters.end.bracket.round.css" |
| 895 | + } |
| 896 | + }, |
| 897 | + "patterns": [ |
| 898 | + { |
| 899 | + "include": "#container-query-features" |
| 900 | + }, |
| 901 | + { |
| 902 | + "match": "(?xi)\n# Match a slash as a property value delimiter if it's not enclosed by parentheses\n(?:\n (?<!\\(:[^\\)]*)\n /\n)", |
| 903 | + "name": "meta.property-value.delimiter.css" |
| 904 | + }, |
| 905 | + { |
| 906 | + "match": "(?xi)\n# Match must be preceded by one of the following:\n(?<=\n ^ # Start of line\n | \\s # Whitespace\n | \\( # Opening parenthesis\n | \\*/ # Comment closing\n)\n\n(?:\n # Standardised features\n (\n (?:\n min-\n | max-\n )?\n\n # Range features\n (?:\n aspect-ratio\n | block-size\n | height\n | inline-size\n | width\n )\n | orientation\n )\n)\n\n# Match must be followed by one of the following:\n(?=\n \\s # Whitespace\n | $ # End of line\n | [><:=] # Comparison operator\n | \\) # Closing parenthesis\n | /\\* # Comment opening\n)", |
| 907 | + "name": "support.type.property-name.container.css" |
| 908 | + }, |
| 909 | + { |
| 910 | + "match": "(?xi)\n# Match must be preceded by one of the following:\n(?<=\n ^ # Start of line\n | \\s # Whitespace\n | : # Colon\n | \\*/ # Comment closing\n)\n\n# Orientation\n(?:\n portrait\n | landscape\n)\n\n# Match must be followed by one of the following:\n(?=\n \\s # Whitespace\n | \\) # Closing parenthesis\n | /\\* # Comment opening\n | $ # End of line\n)", |
| 911 | + "name": "support.constant.property-value.container.css" |
| 912 | + }, |
| 913 | + { |
| 914 | + "include": "#functions" |
| 915 | + } |
| 916 | + ] |
| 917 | + }, |
| 918 | + { |
| 919 | + "begin": "(?<=\\s)(scroll-state)(\\()", |
| 920 | + "beginCaptures": { |
| 921 | + "1": { |
| 922 | + "name": "support.query-name.container.css" |
| 923 | + }, |
| 924 | + "2": { |
| 925 | + "name": "punctuation.definition.parameters.begin.bracket.round.css" |
| 926 | + } |
| 927 | + }, |
| 928 | + "end": "\\)", |
| 929 | + "endCaptures": { |
| 930 | + "0": { |
| 931 | + "name": "punctuation.definition.parameters.end.bracket.round.css" |
| 932 | + } |
| 933 | + }, |
| 934 | + "patterns": [ |
| 935 | + { |
| 936 | + "include": "#comment-block" |
| 937 | + }, |
| 938 | + { |
| 939 | + "match": ":", |
| 940 | + "name": "punctuation.separator.key-value.css" |
| 941 | + }, |
| 942 | + { |
| 943 | + "match": "(?:scrollable|snapped|stuck)(?=\\s*\\:)", |
| 944 | + "name": "support.type.property-name.container.css" |
| 945 | + }, |
| 946 | + { |
| 947 | + "match": "(?xi)\n (?:\n (?<=(scrollable|snapped|stuck)\\s*\\:\\s*)\n (?:none)\n )\n| (?:\n (?<=(scrollable|snapped)\\s*\\:\\s*)\n (?:\n x\n | y\n | block\n | inline\n )\n )\n| (?:\n (?<=(scrollable|stuck)\\s*\\:\\s*)\n (?:\n top\n | right\n | bottom\n | left\n | block-start\n | block-end\n | inline-start\n | inline-end\n )\n )\n| (?:\n (?<=(snapped)\\s*\\:\\s*)\n (?:both)\n )", |
| 948 | + "name": "support.constant.property-value.css" |
| 949 | + } |
| 950 | + ] |
| 951 | + }, |
| 952 | + { |
| 953 | + "begin": "(?<=\\s)(style)(\\()", |
| 954 | + "beginCaptures": { |
| 955 | + "1": { |
| 956 | + "name": "support.query-name.container.css" |
| 957 | + }, |
| 958 | + "2": { |
| 959 | + "name": "punctuation.definition.parameters.begin.bracket.round.css" |
| 960 | + } |
| 961 | + }, |
| 962 | + "end": "\\)", |
| 963 | + "endCaptures": { |
| 964 | + "0": { |
| 965 | + "name": "punctuation.definition.parameters.end.bracket.round.css" |
| 966 | + } |
| 967 | + }, |
| 968 | + "patterns": [ |
| 969 | + { |
| 970 | + "include": "#container-query-features" |
| 971 | + }, |
| 972 | + { |
| 973 | + "match": "(?xi)\n# Custom Property Name\n(?<=^|\\s|\\(|\\*/)\n# Preceded by whitespace, bracket or comment\n(?<![\\w-]) -- (?:[-a-zA-Z_] | [^\\x00-\\x7F])\n# First letter\n(?:[-a-zA-Z0-9_] | [^\\x00-\\x7F]\n# Remainder of identifier\n|\\\\(?:[0-9a-fA-F]{1,6}|.))*", |
| 974 | + "name": "variable.style-query.container.css" |
| 975 | + }, |
| 976 | + { |
| 977 | + "begin": "(?xi)\n(?<=[\\:\\s*|\\*/])\n# Preceded by colon and zero or more whitespaces, or a comment\n(?:(?!\\s))\n# Ignore trailing whitespace", |
| 978 | + "end": "(?=[\\s|\\)|$])", |
| 979 | + "patterns": [ |
| 980 | + { |
| 981 | + "match": "(true|false)", |
| 982 | + "name": "support.constant.boolean.container.css" |
| 983 | + }, |
| 984 | + { |
| 985 | + "include": "#functions" |
| 986 | + }, |
| 987 | + { |
| 988 | + "include": "#property-keywords" |
| 989 | + }, |
| 990 | + { |
| 991 | + "include": "#unicode-range" |
| 992 | + }, |
| 993 | + { |
| 994 | + "include": "#color-keywords" |
| 995 | + } |
| 996 | + ] |
| 997 | + } |
| 998 | + ] |
| 999 | + } |
| 1000 | + ] |
| 1001 | + }, |
| 1002 | + "container-query-features": { |
| 1003 | + "patterns": [ |
| 1004 | + { |
| 1005 | + "match": ":", |
| 1006 | + "name": "punctuation.separator.key-value.css" |
| 1007 | + }, |
| 1008 | + { |
| 1009 | + "match": ">=|<=|=|<|>", |
| 1010 | + "name": "keyword.operator.comparison.css" |
| 1011 | + }, |
| 1012 | + { |
| 1013 | + "include": "#numeric-values" |
| 1014 | + }, |
| 1015 | + { |
| 1016 | + "include": "#comment-block" |
| 1017 | + } |
| 1018 | + ] |
| 1019 | + }, |
736 | 1020 | "escapes": { |
737 | 1021 | "patterns": [ |
738 | 1022 | { |
|
864 | 1148 | ] |
865 | 1149 | }, |
866 | 1150 | { |
867 | | - "begin": "(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color)(\\()", |
| 1151 | + "begin": "(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color|light-dark)(\\()", |
868 | 1152 | "beginCaptures": { |
869 | 1153 | "1": { |
870 | 1154 | "name": "support.function.misc.css" |
|
1507 | 1791 | { |
1508 | 1792 | "match": "!\\s*important(?![\\w-])", |
1509 | 1793 | "name": "keyword.other.important.css" |
| 1794 | + }, |
| 1795 | + { |
| 1796 | + "match": "(?xi)\n# Match a slash as a property value delimiter if it's not enclosed by parentheses\n(?:\n (?<!\\([^\\)]*)\n /\n)", |
| 1797 | + "name": "meta.property-value.delimiter.css" |
1510 | 1798 | } |
1511 | 1799 | ] |
1512 | 1800 | }, |
|
1549 | 1837 | }, |
1550 | 1838 | "name": "meta.property-list.css", |
1551 | 1839 | "patterns": [ |
| 1840 | + { |
| 1841 | + "include": "#at-rule-supports-nested" |
| 1842 | + }, |
1552 | 1843 | { |
1553 | 1844 | "include": "#rule-list-innards" |
1554 | 1845 | }, |
|
1817 | 2108 | ] |
1818 | 2109 | }, |
1819 | 2110 | { |
1820 | | - "begin": "(?xi)\n# Selector match must be preceded by one of the following:\n(?<=\n ^ # Start of line\n | (^|[^\\:])\\s # Whitespace, after the start of a line or any character except a colon\n | [{}] # Opening or closing brace (condensed property list syntax)\n | \\*/ # Comment end\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence\n)\n\n(?=\n # Selector must match:\n (?:\n # HTML elements\n content|font|mark\n # SVG elements\n |cursor|filter\n )\n\n # Selector must NOT be followed by any any of the following:\n (?!\n .*; # Any characters followed by a semicolon (denotes a property)\n | [^{]*} # Any characters, except an opening brace, followed by a closing bracket (denotes a property)\n | - # A dash (denotes a property name)\n | \\: # A colon, unless it's with one of the following:\n (?!\n # A opening bracket before an closing bracket\n [^}]*{\n # A pseudo-class selectors\n | active|any-link|checked|disabled|empty|enabled|first\n | (?:first|last|only)-(?:child|of-type)|focus|focus-visible|focus-within|fullscreen|host|hover\n | in-range|indeterminate|invalid|link|out-of-range\n | read-only|read-write|required|root|scope|target|unresolved\n | valid|visited\n\n # A functional pseudo-class selectors\n | (?: dir|lang\n | not|has|matches|where|is\n | nth-(?:last-)?(?:child|of-type)\n )\\(\n\n # A single-colon pseudo-element selectors\n | after\n | before\n | first-letter\n | first-line\n | (?:\n \\-\n (?:\n ah|apple|atsc|epub|hp|khtml|moz\n | ms|o|rim|ro|tc|wap|webkit|xv\n )\n | (?:\n mso|prince\n )\n )\n -[a-z-]+\n )\n )\n)", |
| 2111 | + "begin": "(?xi)\n# Selector match must be preceded by one of the following:\n(?<=\n ^ # Start of line\n | (^|[^\\:])\\s # Whitespace, after the start of a line or any character except a colon\n | [{}] # Opening or closing brace (condensed property list syntax)\n | \\*/ # Comment end\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence\n)\n\n(?=\n # Selector must match:\n (?:\n # HTML elements\n content|font|mark\n # SVG elements\n |cursor|filter\n )\n\n # Selector must NOT be followed by any any of the following:\n (?!\n .*; # Any characters followed by a semicolon (denotes a property)\n | [^{]*} # Any characters, except an opening brace, followed by a closing bracket (denotes a property)\n | - # A dash (denotes a property name)\n | \\: # A colon, unless it's with one of the following:\n (?!\n # An unquoted opening bracket before an closing bracket\n [^}]*[^'\"]{\n # A pseudo-class selectors\n | active|any-link|checked|disabled|empty|enabled|first\n | (?:first|last|only)-(?:child|of-type)|focus|focus-visible|focus-within|fullscreen|host|hover\n | in-range|indeterminate|invalid|link|out-of-range\n | read-only|read-write|required|root|scope|target|unresolved\n | valid|visited\n\n # A functional pseudo-class selectors\n | (?: dir|lang\n | not|has|matches|where|is\n | nth-(?:last-)?(?:child|of-type)\n )\\(\n\n # A single-colon pseudo-element selectors\n | after\n | before\n | first-letter\n | first-line\n | (?:\n \\-\n (?:\n ah|apple|atsc|epub|hp|khtml|moz\n | ms|o|rim|ro|tc|wap|webkit|xv\n )\n | (?:\n mso|prince\n )\n )\n -[a-z-]+\n )\n )\n)", |
1821 | 2112 | "end": "(?xi)\n# Selector match ends with one of the following:\n(?=\n \\s # Whitespace\n | \\/\\* # Comment\n | , # Comma\n | { # Opening property list brace\n | $ # End of line\n)", |
1822 | 2113 | "patterns": [ |
1823 | 2114 | { |
|
0 commit comments