@projectwallace/css-parser 0.15.0 → 0.16.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.
@@ -112,6 +112,14 @@ var CSSNode = class CSSNode {
112
112
  __get_arena() {
113
113
  return this.arena;
114
114
  }
115
+ /** @internal */
116
+ __get_source() {
117
+ return this.source;
118
+ }
119
+ /** @internal */
120
+ __get_index() {
121
+ return this.index;
122
+ }
115
123
  get_content() {
116
124
  let start = this.arena.get_content_start(this.index);
117
125
  let length = this.arena.get_content_length(this.index);
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { B as SUPPORTS_QUERY, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as SELECTOR_LIST, G as VALUE, H as UNICODE_RANGE, I as STRING, L as STYLESHEET, M as PSEUDO_ELEMENT_SELECTOR, N as RAW, O as PARENTHESIS, P as SELECTOR, R as STYLE_RULE, S as MEDIA_TYPE, T as NTH_SELECTOR, U as UNIVERSAL_SELECTOR, V as TYPE_SELECTOR, W as URL, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as MEDIA_FEATURE, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PSEUDO_CLASS_SELECTOR, k as PRELUDE_OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as LANG_SELECTOR, w as NTH_OF_SELECTOR, x as MEDIA_QUERY, y as LAYER_NAME, z as SUPPORTS_DECLARATION } from "./arena-CSK5NfHq.js";
2
2
  import { NODE_TYPES } from "./constants.js";
3
- import { A as TOKEN_URL, C as TOKEN_PERCENTAGE, D as TOKEN_SEMICOLON, E as TOKEN_RIGHT_PAREN, M as Token, N as TokenType, O as TOKEN_STRING, S as TOKEN_NUMBER, T as TOKEN_RIGHT_BRACKET, _ as TOKEN_HASH, a as TOKEN_AT_KEYWORD, b as TOKEN_LEFT_BRACKET, c as TOKEN_CDC, d as TOKEN_COMMA, f as TOKEN_COMMENT, g as TOKEN_FUNCTION, h as TOKEN_EOF, i as tokenize, j as TOKEN_WHITESPACE, k as TOKEN_UNICODE_RANGE, l as TOKEN_CDO, m as TOKEN_DIMENSION, o as TOKEN_BAD_STRING, p as TOKEN_DELIM, r as LexerPosition, s as TOKEN_BAD_URL, t as CommentInfo, u as TOKEN_COLON, v as TOKEN_IDENT, w as TOKEN_RIGHT_BRACE, x as TOKEN_LEFT_PAREN, y as TOKEN_LEFT_BRACE } from "./tokenize-CyiJelQC.js";
4
- import { $ as is_class_selector, A as PreludeSelectorList, At as is_stylesheet, B as SupportsDeclaration, Bt as TYPE_NAMES, C as NestingSelector, Ct as is_pseudo_class_selector, D as Operator, Dt as is_selector, E as Number, Et as is_rule, F as Selector, Ft as is_universal_selector, G as UniversalSelector, H as ToPlain, I as SelectorList, It as is_url, J as WithChildren, K as Url, L as SelectorNode, Lt as is_value, M as PseudoElementSelector, Mt as is_supports_query, N as Raw, Nt as is_type_selector, O as Parenthesis, Ot as is_selector_list, P as Rule, Pt as is_unicode_range, Q as is_block, R as String, Rt as CloneOptions, S as MediaType, St as is_prelude_selectorlist, T as NthSelector, Tt as is_raw, U as TypeSelector, V as SupportsQuery, W as UnicodeRange, X as is_atrule_prelude, Y as is_atrule, Z as is_attribute_selector, _ as Identifier, _t as is_nth_selector, a as Block, at as is_feature_range, b as MediaFeature, bt as is_parenthesis, c as Combinator, ct as is_id_selector, d as Declaration, dt as is_layer_name, et as is_combinator, f as Dimension, ft as is_media_feature, g as IdSelector, gt as is_nth_of_selector, h as Hash, ht as is_nesting_selector, i as AttributeSelector, it as is_dimension, j as PseudoClassSelector, jt as is_supports_declaration, k as PreludeOperator, kt as is_string, l as Comment, lt as is_identifier, m as Function, mt as is_media_type, n as Atrule, nt as is_container_query, o as CSSNode, ot as is_function, p as FeatureRange, pt as is_media_query, q as Value, r as AtrulePrelude, rt as is_declaration, s as ClassSelector, st as is_hash, t as AnyNode, tt as is_comment, u as ContainerQuery, ut as is_lang_selector, v as LangSelector, vt as is_number, w as NthOfSelector, wt as is_pseudo_element_selector, x as MediaQuery, xt as is_prelude_operator, y as LayerName, yt as is_operator, z as StyleSheet, zt as PlainCSSNode } from "./node-types-DJytj0FB.js";
3
+ import { A as TOKEN_URL, C as TOKEN_PERCENTAGE, D as TOKEN_SEMICOLON, E as TOKEN_RIGHT_PAREN, M as Token, N as TokenType, O as TOKEN_STRING, S as TOKEN_NUMBER, T as TOKEN_RIGHT_BRACKET, _ as TOKEN_HASH, a as TOKEN_AT_KEYWORD, b as TOKEN_LEFT_BRACKET, c as TOKEN_CDC, d as TOKEN_COMMA, f as TOKEN_COMMENT, g as TOKEN_FUNCTION, h as TOKEN_EOF, i as tokenize, j as TOKEN_WHITESPACE, k as TOKEN_UNICODE_RANGE, l as TOKEN_CDO, m as TOKEN_DIMENSION, o as TOKEN_BAD_STRING, p as TOKEN_DELIM, r as LexerPosition, s as TOKEN_BAD_URL, t as CommentInfo, u as TOKEN_COLON, v as TOKEN_IDENT, w as TOKEN_RIGHT_BRACE, x as TOKEN_LEFT_PAREN, y as TOKEN_LEFT_BRACE } from "./tokenize-mV23Aiyb.js";
4
+ import { $ as is_class_selector, A as PreludeSelectorList, At as is_stylesheet, B as SupportsDeclaration, Bt as TYPE_NAMES, C as NestingSelector, Ct as is_pseudo_class_selector, D as Operator, Dt as is_selector, E as Number, Et as is_rule, F as Selector, Ft as is_universal_selector, G as UniversalSelector, H as ToPlain, I as SelectorList, It as is_url, J as WithChildren, K as Url, L as SelectorNode, Lt as is_value, M as PseudoElementSelector, Mt as is_supports_query, N as Raw, Nt as is_type_selector, O as Parenthesis, Ot as is_selector_list, P as Rule, Pt as is_unicode_range, Q as is_block, R as String, Rt as CloneOptions, S as MediaType, St as is_prelude_selectorlist, T as NthSelector, Tt as is_raw, U as TypeSelector, V as SupportsQuery, W as UnicodeRange, X as is_atrule_prelude, Y as is_atrule, Z as is_attribute_selector, _ as Identifier, _t as is_nth_selector, a as Block, at as is_feature_range, b as MediaFeature, bt as is_parenthesis, c as Combinator, ct as is_id_selector, d as Declaration, dt as is_layer_name, et as is_combinator, f as Dimension, ft as is_media_feature, g as IdSelector, gt as is_nth_of_selector, h as Hash, ht as is_nesting_selector, i as AttributeSelector, it as is_dimension, j as PseudoClassSelector, jt as is_supports_declaration, k as PreludeOperator, kt as is_string, l as Comment, lt as is_identifier, m as Function, mt as is_media_type, n as Atrule, nt as is_container_query, o as CSSNode, ot as is_function, p as FeatureRange, pt as is_media_query, q as Value, r as AtrulePrelude, rt as is_declaration, s as ClassSelector, st as is_hash, t as AnyNode, tt as is_comment, u as ContainerQuery, ut as is_lang_selector, v as LangSelector, vt as is_number, w as NthOfSelector, wt as is_pseudo_element_selector, x as MediaQuery, xt as is_prelude_operator, y as LayerName, yt as is_operator, z as StyleSheet, zt as PlainCSSNode } from "./node-types-mntWKkN-.js";
5
5
  import { ParserOptions, parse } from "./parse.js";
6
- import { parse_selector } from "./parse-selector.js";
6
+ import { parse_selector, parse_selector_list } from "./parse-selector.js";
7
7
  import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
8
8
  import { parse_declaration } from "./parse-declaration.js";
9
9
  import { parse_value } from "./parse-value.js";
@@ -75,4 +75,4 @@ declare function is_vendor_prefixed(source: string, start: number, end: number):
75
75
  */
76
76
  declare function is_custom(str: string): boolean;
77
77
  //#endregion
78
- export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, type AnyNode, type Atrule, type AtrulePrelude, type AttributeSelector, BLOCK, BREAK, type Block, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, type CSSNode, type ClassSelector, type CloneOptions, type Combinator, type Comment, type CommentInfo, type ContainerQuery, DECLARATION, DIMENSION, type Declaration, type Dimension, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, type FeatureRange, type Function, HASH, type Hash, IDENTIFIER, ID_SELECTOR, type IdSelector, type Identifier, LANG_SELECTOR, LAYER_NAME, type LangSelector, type LayerName, type LexerPosition, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, type MediaFeature, type MediaQuery, type MediaType, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, type NestingSelector, type NthOfSelector, type NthSelector, type Number, OPERATOR, type Operator, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, type Parenthesis, type ParserOptions, type PlainCSSNode, type PreludeOperator, type PreludeSelectorList, type PseudoClassSelector, type PseudoElementSelector, RAW, type Raw, type Rule, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, type Selector, type SelectorList, type SelectorNode, type String, type StyleSheet, type SupportsDeclaration, type SupportsQuery, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_NAMES, TYPE_SELECTOR, type ToPlain, Token, TokenType, type TypeSelector, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, type UnicodeRange, type UniversalSelector, type Url, VALUE, type Value, type WithChildren, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_custom, is_declaration, is_dimension, is_feature_range, is_function, is_hash, is_id_selector, is_identifier, is_lang_selector, is_layer_name, is_media_feature, is_media_query, is_media_type, is_nesting_selector, is_nth_of_selector, is_nth_selector, is_number, is_operator, is_parenthesis, is_prelude_operator, is_prelude_selectorlist, is_pseudo_class_selector, is_pseudo_element_selector, is_raw, is_rule, is_selector, is_selector_list, is_string, is_stylesheet, is_supports_declaration, is_supports_query, is_type_selector, is_unicode_range, is_universal_selector, is_url, is_value, is_vendor_prefixed, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
78
+ export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, type AnyNode, type Atrule, type AtrulePrelude, type AttributeSelector, BLOCK, BREAK, type Block, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, type CSSNode, type ClassSelector, type CloneOptions, type Combinator, type Comment, type CommentInfo, type ContainerQuery, DECLARATION, DIMENSION, type Declaration, type Dimension, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, type FeatureRange, type Function, HASH, type Hash, IDENTIFIER, ID_SELECTOR, type IdSelector, type Identifier, LANG_SELECTOR, LAYER_NAME, type LangSelector, type LayerName, type LexerPosition, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, type MediaFeature, type MediaQuery, type MediaType, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, type NestingSelector, type NthOfSelector, type NthSelector, type Number, OPERATOR, type Operator, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, type Parenthesis, type ParserOptions, type PlainCSSNode, type PreludeOperator, type PreludeSelectorList, type PseudoClassSelector, type PseudoElementSelector, RAW, type Raw, type Rule, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, type Selector, type SelectorList, type SelectorNode, type String, type StyleSheet, type SupportsDeclaration, type SupportsQuery, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_NAMES, TYPE_SELECTOR, type ToPlain, Token, TokenType, type TypeSelector, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, type UnicodeRange, type UniversalSelector, type Url, VALUE, type Value, type WithChildren, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_custom, is_declaration, is_dimension, is_feature_range, is_function, is_hash, is_id_selector, is_identifier, is_lang_selector, is_layer_name, is_media_feature, is_media_query, is_media_type, is_nesting_selector, is_nth_of_selector, is_nth_selector, is_number, is_operator, is_parenthesis, is_prelude_operator, is_prelude_selectorlist, is_pseudo_class_selector, is_pseudo_element_selector, is_raw, is_rule, is_selector, is_selector_list, is_string, is_stylesheet, is_supports_declaration, is_supports_query, is_type_selector, is_unicode_range, is_universal_selector, is_url, is_value, is_vendor_prefixed, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_selector_list, parse_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { C as TOKEN_RIGHT_BRACKET, D as TOKEN_UNICODE_RANGE, E as TOKEN_STRING, O as TOKEN_URL, S as TOKEN_RIGHT_BRACE, T as TOKEN_SEMICOLON, _ as TOKEN_LEFT_BRACE, a as TOKEN_BAD_URL, b as TOKEN_NUMBER, c as TOKEN_COLON, d as TOKEN_DELIM, f as TOKEN_DIMENSION, g as TOKEN_IDENT, h as TOKEN_HASH, i as TOKEN_BAD_STRING, k as TOKEN_WHITESPACE, l as TOKEN_COMMA, m as TOKEN_FUNCTION, n as tokenize, o as TOKEN_CDC, p as TOKEN_EOF, r as TOKEN_AT_KEYWORD, s as TOKEN_CDO, u as TOKEN_COMMENT, v as TOKEN_LEFT_BRACKET, w as TOKEN_RIGHT_PAREN, x as TOKEN_PERCENTAGE, y as TOKEN_LEFT_PAREN } from "./tokenize-BSycRGm0.js";
1
+ import { C as TOKEN_RIGHT_BRACKET, D as TOKEN_UNICODE_RANGE, E as TOKEN_STRING, O as TOKEN_URL, S as TOKEN_RIGHT_BRACE, T as TOKEN_SEMICOLON, _ as TOKEN_LEFT_BRACE, a as TOKEN_BAD_URL, b as TOKEN_NUMBER, c as TOKEN_COLON, d as TOKEN_DELIM, f as TOKEN_DIMENSION, g as TOKEN_IDENT, h as TOKEN_HASH, i as TOKEN_BAD_STRING, k as TOKEN_WHITESPACE, l as TOKEN_COMMA, m as TOKEN_FUNCTION, n as tokenize, o as TOKEN_CDC, p as TOKEN_EOF, r as TOKEN_AT_KEYWORD, s as TOKEN_CDO, u as TOKEN_COMMENT, v as TOKEN_LEFT_BRACKET, w as TOKEN_RIGHT_PAREN, x as TOKEN_PERCENTAGE, y as TOKEN_LEFT_PAREN } from "./tokenize-BxUina14.js";
2
2
  import { A as PSEUDO_CLASS_SELECTOR, B as TYPE_SELECTOR, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as STRING, H as UNIVERSAL_SELECTOR, I as STYLESHEET, L as STYLE_RULE, M as RAW, N as SELECTOR, O as PARENTHESIS, P as SELECTOR_LIST, R as SUPPORTS_DECLARATION, S as MEDIA_TYPE, T as NTH_SELECTOR, U as URL, V as UNICODE_RANGE, W as VALUE, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as MEDIA_FEATURE, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PSEUDO_ELEMENT_SELECTOR, k as PRELUDE_OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as LANG_SELECTOR, w as NTH_OF_SELECTOR, x as MEDIA_QUERY, y as LAYER_NAME, z as SUPPORTS_QUERY } from "./arena-DnV0a_Ne.js";
3
3
  import { c as str_starts_with, i as is_vendor_prefixed, o as str_equals, r as is_custom, s as str_index_of, t as parse_dimension } from "./parse-dimension-CCn_XRDe.js";
4
- import { n as TYPE_NAMES } from "./css-node-C3t4b8Jt.js";
5
- import { parse_selector } from "./parse-selector.js";
4
+ import { n as TYPE_NAMES } from "./css-node-BTgoFWDU.js";
5
+ import { parse_selector, parse_selector_list } from "./parse-selector.js";
6
6
  import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
7
7
  import { parse_value } from "./parse-value.js";
8
8
  import { parse_declaration } from "./parse-declaration.js";
@@ -140,4 +140,4 @@ function is_prelude_selectorlist(node) {
140
140
  return node.type === 41;
141
141
  }
142
142
  //#endregion
143
- export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, BREAK, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, DECLARATION, DIMENSION, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, HASH, IDENTIFIER, ID_SELECTOR, LANG_SELECTOR, LAYER_NAME, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, OPERATOR, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, RAW, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_NAMES, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_custom, is_declaration, is_dimension, is_feature_range, is_function, is_hash, is_id_selector, is_identifier, is_lang_selector, is_layer_name, is_media_feature, is_media_query, is_media_type, is_nesting_selector, is_nth_of_selector, is_nth_selector, is_number, is_operator, is_parenthesis, is_prelude_operator, is_prelude_selectorlist, is_pseudo_class_selector, is_pseudo_element_selector, is_raw, is_rule, is_selector, is_selector_list, is_string, is_stylesheet, is_supports_declaration, is_supports_query, is_type_selector, is_unicode_range, is_universal_selector, is_url, is_value, is_vendor_prefixed, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
143
+ export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, BREAK, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, DECLARATION, DIMENSION, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, HASH, IDENTIFIER, ID_SELECTOR, LANG_SELECTOR, LAYER_NAME, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, OPERATOR, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, RAW, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_NAMES, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_custom, is_declaration, is_dimension, is_feature_range, is_function, is_hash, is_id_selector, is_identifier, is_lang_selector, is_layer_name, is_media_feature, is_media_query, is_media_type, is_nesting_selector, is_nth_of_selector, is_nth_selector, is_number, is_operator, is_parenthesis, is_prelude_operator, is_prelude_selectorlist, is_pseudo_class_selector, is_pseudo_element_selector, is_raw, is_rule, is_selector, is_selector_list, is_string, is_stylesheet, is_supports_declaration, is_supports_query, is_type_selector, is_unicode_range, is_universal_selector, is_url, is_value, is_vendor_prefixed, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_selector_list, parse_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
@@ -145,10 +145,12 @@ type ToPlain<T extends CSSNode> = PlainCSSNode & {
145
145
  } & { [K in Exclude<keyof T, keyof CSSNode | symbol | 'attr_operator' | 'attr_flags' | 'has_children' | 'child_count' | 'children'> as T[K] extends ((...args: any[]) => any) ? never : K]: T[K] extends CSSNode | null | undefined ? PlainCSSNode | Exclude<T[K], CSSNode> : T[K] extends CSSNode[] ? PlainCSSNode[] : T[K] };
146
146
  type StyleSheet = CSSNode & WithChildren & {
147
147
  readonly type: typeof STYLESHEET;
148
+ readonly type_name: 'StyleSheet';
148
149
  clone(options?: CloneOptions): ToPlain<StyleSheet>;
149
150
  };
150
151
  type Rule = CSSNode & {
151
152
  readonly type: typeof STYLE_RULE;
153
+ readonly type_name: 'Rule';
152
154
  readonly has_declarations: boolean;
153
155
  clone(options?: CloneOptions): ToPlain<Rule>;
154
156
  } & /** SELECTOR_LIST (parse_selectors=true) or RAW (parse_selectors=false) */({
@@ -165,7 +167,8 @@ type Rule = CSSNode & {
165
167
  readonly block: null;
166
168
  });
167
169
  type Atrule = CSSNode & {
168
- readonly type: typeof AT_RULE; /** At-rule keyword, e.g. "media", "keyframes" */
170
+ readonly type: typeof AT_RULE;
171
+ readonly type_name: 'Atrule'; /** At-rule keyword, e.g. "media", "keyframes" */
169
172
  readonly name: string;
170
173
  readonly has_declarations: boolean;
171
174
  clone(options?: CloneOptions): ToPlain<Atrule>;
@@ -183,7 +186,8 @@ type Atrule = CSSNode & {
183
186
  readonly block: null;
184
187
  });
185
188
  type Declaration = CSSNode & {
186
- readonly type: typeof DECLARATION; /** Property name, e.g. "color" */
189
+ readonly type: typeof DECLARATION;
190
+ readonly type_name: 'Declaration'; /** Property name, e.g. "color" */
187
191
  readonly property: string; /** VALUE node (parse_values=true), RAW node (parse_values=false), or null */
188
192
  readonly value: Value | Raw | null;
189
193
  readonly is_important: boolean;
@@ -193,10 +197,12 @@ type Declaration = CSSNode & {
193
197
  type SelectorNode = TypeSelector | IdSelector | ClassSelector | NthSelector | NthOfSelector | LangSelector | NestingSelector | AttributeSelector | UniversalSelector | PseudoClassSelector | PseudoElementSelector;
194
198
  type Selector = CSSNode & WithChildren<SelectorNode> & {
195
199
  readonly type: typeof SELECTOR;
200
+ readonly type_name: 'Selector';
196
201
  clone(options?: CloneOptions): ToPlain<Selector>;
197
202
  };
198
203
  type SelectorList = CSSNode & WithChildren<Selector> & {
199
204
  readonly type: typeof SELECTOR_LIST;
205
+ readonly type_name: 'SelectorList';
200
206
  clone(options?: CloneOptions): ToPlain<SelectorList>;
201
207
  };
202
208
  /**
@@ -216,6 +222,7 @@ type BlockChild = (Raw | Declaration | Atrule | Rule) & ({
216
222
  });
217
223
  type Block = CSSNode & WithChildren<Raw | Declaration | Atrule | Rule> & {
218
224
  readonly type: typeof BLOCK;
225
+ readonly type_name: 'Block';
219
226
  readonly is_empty: boolean; /** Block children with next_sibling narrowed to the Block child union. */
220
227
  readonly first_child: BlockChild;
221
228
  readonly children: BlockChild[];
@@ -224,83 +231,100 @@ type Block = CSSNode & WithChildren<Raw | Declaration | Atrule | Rule> & {
224
231
  };
225
232
  type Comment = CSSNode & {
226
233
  readonly type: typeof COMMENT;
234
+ readonly type_name: 'Comment';
227
235
  clone(options?: CloneOptions): ToPlain<Comment>;
228
236
  };
229
237
  type Raw = CSSNode & {
230
238
  readonly type: typeof RAW;
239
+ readonly type_name: 'Raw';
231
240
  clone(options?: CloneOptions): ToPlain<Raw>;
232
241
  };
233
242
  type ValueLike = Function | Identifier | Operator | Parenthesis | Url | UnicodeRange | String | Hash | Dimension | Number;
234
243
  type Identifier = CSSNode & {
235
244
  readonly type: typeof IDENTIFIER;
245
+ readonly type_name: 'Identifier';
236
246
  readonly name: string;
237
247
  clone(options?: CloneOptions): ToPlain<Identifier>;
238
248
  };
239
249
  type Number = CSSNode & {
240
250
  readonly type: typeof NUMBER;
251
+ readonly type_name: 'Number';
241
252
  readonly value: number;
242
253
  clone(options?: CloneOptions): ToPlain<Number>;
243
254
  };
244
255
  type Dimension = CSSNode & {
245
256
  readonly type: typeof DIMENSION;
257
+ readonly type_name: 'Dimension';
246
258
  readonly value: number; /** Unit string, e.g. "px", "%" */
247
259
  readonly unit: string;
248
260
  clone(options?: CloneOptions): ToPlain<Dimension>;
249
261
  };
250
262
  type String = CSSNode & {
251
263
  readonly type: typeof STRING;
264
+ readonly type_name: 'String';
252
265
  clone(options?: CloneOptions): ToPlain<String>;
253
266
  };
254
267
  type Hash = CSSNode & {
255
268
  readonly type: typeof HASH;
269
+ readonly type_name: 'Hash';
256
270
  clone(options?: CloneOptions): ToPlain<Hash>;
257
271
  };
258
272
  type Function = CSSNode & WithChildren<ValueLike> & {
259
- readonly type: typeof FUNCTION; /** Function name, e.g. "rgb", "calc" */
273
+ readonly type: typeof FUNCTION;
274
+ readonly type_name: 'Function'; /** Function name, e.g. "rgb", "calc" */
260
275
  readonly name: string; /** Function arguments as raw text, e.g. "255, 0, 0" for rgb(255, 0, 0) */
261
276
  readonly value: string | null;
262
277
  clone(options?: CloneOptions): ToPlain<Function>;
263
278
  };
264
279
  type Operator = CSSNode & {
265
- readonly type: typeof OPERATOR; /** The operator character(s), e.g. ",", "+", "-" */
280
+ readonly type: typeof OPERATOR;
281
+ readonly type_name: 'Operator'; /** The operator character(s), e.g. ",", "+", "-" */
266
282
  readonly value: string;
267
283
  clone(options?: CloneOptions): ToPlain<Operator>;
268
284
  };
269
285
  type Parenthesis = CSSNode & WithChildren & {
270
286
  readonly type: typeof PARENTHESIS;
287
+ readonly type_name: 'Parentheses';
271
288
  clone(options?: CloneOptions): ToPlain<Parenthesis>;
272
289
  };
273
290
  type Url = CSSNode & {
274
- readonly type: typeof URL; /** URL content, e.g. '"image.png"' (with quotes) or 'mycursor.cur' (unquoted) */
291
+ readonly type: typeof URL;
292
+ readonly type_name: 'Url'; /** URL content, e.g. '"image.png"' (with quotes) or 'mycursor.cur' (unquoted) */
275
293
  readonly value: string | null;
276
294
  clone(options?: CloneOptions): ToPlain<Url>;
277
295
  };
278
296
  type UnicodeRange = CSSNode & {
279
297
  readonly type: typeof UNICODE_RANGE;
298
+ readonly type_name: 'UnicodeRange';
280
299
  clone(options?: CloneOptions): ToPlain<UnicodeRange>;
281
300
  };
282
301
  type Value = CSSNode & WithChildren<ValueLike> & {
283
302
  readonly type: typeof VALUE;
303
+ readonly type_name: 'Value';
284
304
  clone(options?: CloneOptions): ToPlain<Value>;
285
305
  };
286
306
  type TypeSelector = CSSNode & {
287
- readonly type: typeof TYPE_SELECTOR; /** Local element name, e.g. "div" in both "div" and "ns|div" */
307
+ readonly type: typeof TYPE_SELECTOR;
308
+ readonly type_name: 'TypeSelector'; /** Local element name, e.g. "div" in both "div" and "ns|div" */
288
309
  readonly name: string; /** Namespace prefix: null if no qualifier, '' for |div, 'ns' for ns|div, '*' for *|div */
289
310
  readonly namespace: string | null;
290
311
  clone(options?: CloneOptions): ToPlain<TypeSelector>;
291
312
  };
292
313
  type ClassSelector = CSSNode & {
293
- readonly type: typeof CLASS_SELECTOR; /** Class name without dot, e.g. "foo" from ".foo" */
314
+ readonly type: typeof CLASS_SELECTOR;
315
+ readonly type_name: 'ClassSelector'; /** Class name without dot, e.g. "foo" from ".foo" */
294
316
  readonly name: string;
295
317
  clone(options?: CloneOptions): ToPlain<ClassSelector>;
296
318
  };
297
319
  type IdSelector = CSSNode & {
298
- readonly type: typeof ID_SELECTOR; /** Id without hash, e.g. "bar" from "#bar" */
320
+ readonly type: typeof ID_SELECTOR;
321
+ readonly type_name: 'IdSelector'; /** Id without hash, e.g. "bar" from "#bar" */
299
322
  readonly name: string;
300
323
  clone(options?: CloneOptions): ToPlain<IdSelector>;
301
324
  };
302
325
  type AttributeSelector = CSSNode & {
303
- readonly type: typeof ATTRIBUTE_SELECTOR; /** Attribute name, e.g. "href" from "[href]" */
326
+ readonly type: typeof ATTRIBUTE_SELECTOR;
327
+ readonly type_name: 'AttributeSelector'; /** Attribute name, e.g. "href" from "[href]" */
304
328
  readonly name: string; /** Operator string, e.g. "=", "~=", "|="; null if no operator ([attr] form) */
305
329
  readonly attr_operator: string | null; /** Flag character, e.g. "i", "s"; null if no flag */
306
330
  readonly attr_flags: string | null; /** Attribute value, e.g. "external" from [rel="external"] */
@@ -308,81 +332,97 @@ type AttributeSelector = CSSNode & {
308
332
  clone(options?: CloneOptions): ToPlain<AttributeSelector>;
309
333
  };
310
334
  type PseudoClassSelector = CSSNode & WithChildren<Selector | NthOfSelector> & {
311
- readonly type: typeof PSEUDO_CLASS_SELECTOR; /** Pseudo-class name without colon, e.g. "hover" */
335
+ readonly type: typeof PSEUDO_CLASS_SELECTOR;
336
+ readonly type_name: 'PseudoClassSelector'; /** Pseudo-class name without colon, e.g. "hover" */
312
337
  readonly name: string;
313
338
  clone(options?: CloneOptions): ToPlain<PseudoClassSelector>;
314
339
  };
315
340
  type PseudoElementSelector = CSSNode & WithChildren<SelectorList> & {
316
- readonly type: typeof PSEUDO_ELEMENT_SELECTOR; /** Pseudo-element name without colons, e.g. "before" */
341
+ readonly type: typeof PSEUDO_ELEMENT_SELECTOR;
342
+ readonly type_name: 'PseudoElementSelector'; /** Pseudo-element name without colons, e.g. "before" */
317
343
  readonly name: string;
318
344
  clone(options?: CloneOptions): ToPlain<PseudoElementSelector>;
319
345
  };
320
346
  type Combinator = CSSNode & {
321
- readonly type: typeof COMBINATOR; /** Combinator character(s), e.g. " ", ">", "~", "+", "||", "/deep/" */
347
+ readonly type: typeof COMBINATOR;
348
+ readonly type_name: 'Combinator'; /** Combinator character(s), e.g. " ", ">", "~", "+", "||", "/deep/" */
322
349
  readonly name: string;
323
350
  clone(options?: CloneOptions): ToPlain<Combinator>;
324
351
  };
325
352
  type UniversalSelector = CSSNode & {
326
- readonly type: typeof UNIVERSAL_SELECTOR; /** Always null — universal selector has no element name */
353
+ readonly type: typeof UNIVERSAL_SELECTOR;
354
+ readonly type_name: 'UniversalSelector'; /** Always null — universal selector has no element name */
327
355
  readonly name: null; /** Namespace prefix: null if no qualifier, '' for |*, 'ns' for ns|*, '*' for *|* */
328
356
  readonly namespace: string | null;
329
357
  clone(options?: CloneOptions): ToPlain<UniversalSelector>;
330
358
  };
331
359
  type NestingSelector = CSSNode & {
332
360
  readonly type: typeof NESTING_SELECTOR;
361
+ readonly type_name: 'NestingSelector';
333
362
  clone(options?: CloneOptions): ToPlain<NestingSelector>;
334
363
  };
335
364
  type NthSelector = CSSNode & {
336
- readonly type: typeof NTH_SELECTOR; /** The `An` part of the An+B formula, including keywords `odd`/`even`. Null when only a B value is present (e.g. `:nth-child(3)`). */
365
+ readonly type: typeof NTH_SELECTOR;
366
+ readonly type_name: 'Nth'; /** The `An` part of the An+B formula, including keywords `odd`/`even`. Null when only a B value is present (e.g. `:nth-child(3)`). */
337
367
  readonly nth_a: string | null; /** The `+B` part of the An+B formula. Null when only an A value is present (e.g. `:nth-child(2n)` or `:nth-child(odd)`). */
338
368
  readonly nth_b: string | null;
339
369
  clone(options?: CloneOptions): ToPlain<NthSelector>;
340
370
  };
341
371
  type NthOfSelector = CSSNode & {
342
- readonly type: typeof NTH_OF_SELECTOR; /** The An+B formula node */
372
+ readonly type: typeof NTH_OF_SELECTOR;
373
+ readonly type_name: 'NthOf'; /** The An+B formula node */
343
374
  readonly nth: NthSelector | null; /** The selector list from :nth-child(An+B of <selector>) */
344
375
  readonly selector: SelectorList | null;
345
376
  clone(options?: CloneOptions): ToPlain<NthOfSelector>;
346
377
  };
347
378
  type LangSelector = CSSNode & {
348
- readonly type: typeof LANG_SELECTOR; /** `"nl"`, `en-US` */
379
+ readonly type: typeof LANG_SELECTOR;
380
+ readonly type_name: 'Lang'; /** `"nl"`, `en-US` */
349
381
  readonly name: string | null;
350
382
  clone(options?: CloneOptions): ToPlain<LangSelector>;
351
383
  };
352
384
  type AtrulePrelude = CSSNode & WithChildren<Raw | MediaQuery | MediaType | ContainerQuery | SupportsQuery | LayerName | PreludeOperator | PreludeSelectorList | Parenthesis | Url> & {
353
385
  readonly type: typeof AT_RULE_PRELUDE;
386
+ readonly type_name: 'AtrulePrelude';
354
387
  clone(options?: CloneOptions): ToPlain<AtrulePrelude>;
355
388
  };
356
389
  type MediaQuery = CSSNode & WithChildren<MediaFeature | PreludeOperator | MediaType | FeatureRange> & {
357
390
  readonly type: typeof MEDIA_QUERY;
391
+ readonly type_name: 'MediaQuery';
358
392
  clone(options?: CloneOptions): ToPlain<MediaQuery>;
359
393
  };
360
394
  type MediaFeature = CSSNode & {
361
- readonly type: typeof MEDIA_FEATURE; /** Feature name, e.g. "min-width" */
395
+ readonly type: typeof MEDIA_FEATURE;
396
+ readonly type_name: 'Feature'; /** Feature name, e.g. "min-width" */
362
397
  readonly property: string; /** Feature value node, or null for boolean features like (hover) */
363
398
  readonly value: CSSNode | null;
364
399
  clone(options?: CloneOptions): ToPlain<MediaFeature>;
365
400
  };
366
401
  type MediaType = CSSNode & {
367
- readonly type: typeof MEDIA_TYPE; /** Media type text, e.g. "screen", "print" */
402
+ readonly type: typeof MEDIA_TYPE;
403
+ readonly type_name: 'MediaType'; /** Media type text, e.g. "screen", "print" */
368
404
  readonly value: string;
369
405
  clone(options?: CloneOptions): ToPlain<MediaType>;
370
406
  };
371
407
  type ContainerQuery = CSSNode & WithChildren<Identifier | MediaFeature | Function> & {
372
408
  readonly type: typeof CONTAINER_QUERY;
409
+ readonly type_name: 'ContainerQuery';
373
410
  clone(options?: CloneOptions): ToPlain<ContainerQuery>;
374
411
  };
375
412
  type SupportsQuery = CSSNode & WithChildren<SupportsDeclaration> & {
376
- readonly type: typeof SUPPORTS_QUERY; /** The supports condition text, e.g. "display: flex" from "supports(display: flex)" */
413
+ readonly type: typeof SUPPORTS_QUERY;
414
+ readonly type_name: 'SupportsQuery'; /** The supports condition text, e.g. "display: flex" from "supports(display: flex)" */
377
415
  readonly value: string;
378
416
  clone(options?: CloneOptions): ToPlain<SupportsQuery>;
379
417
  };
380
418
  type SupportsDeclaration = CSSNode & WithChildren<Declaration> & {
381
419
  readonly type: typeof SUPPORTS_DECLARATION;
420
+ readonly type_name: 'SupportsDeclaration';
382
421
  clone(options?: CloneOptions): ToPlain<SupportsDeclaration>;
383
422
  };
384
423
  type LayerName = CSSNode & {
385
424
  readonly type: typeof LAYER_NAME;
425
+ readonly type_name: 'Layer';
386
426
  readonly name: string; /** Alias for name — the layer name string, e.g. "base" from "layer(base)" */
387
427
  readonly value: string;
388
428
  clone(options?: CloneOptions): ToPlain<LayerName>;
@@ -405,15 +445,18 @@ type LayerName = CSSNode & {
405
445
  */
406
446
  type PreludeSelectorList = CSSNode & {
407
447
  readonly type: typeof PRELUDE_SELECTORLIST;
448
+ readonly type_name: 'PreludeSelectorList';
408
449
  readonly value: string;
409
450
  clone(options?: CloneOptions): ToPlain<PreludeSelectorList>;
410
451
  };
411
452
  type PreludeOperator = CSSNode & {
412
453
  readonly type: typeof PRELUDE_OPERATOR;
454
+ readonly type_name: 'Operator';
413
455
  clone(options?: CloneOptions): ToPlain<PreludeOperator>;
414
456
  };
415
457
  type FeatureRange = CSSNode & WithChildren<Dimension | Operator> & {
416
- readonly type: typeof FEATURE_RANGE; /** The feature name in a range comparison, e.g. "width" from "(width >= 400px)" */
458
+ readonly type: typeof FEATURE_RANGE;
459
+ readonly type_name: 'MediaFeatureRange'; /** The feature name in a range comparison, e.g. "width" from "(width >= 400px)" */
417
460
  readonly name: string;
418
461
  clone(options?: CloneOptions): ToPlain<FeatureRange>;
419
462
  };
@@ -1,5 +1,5 @@
1
1
  import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { T as NthSelector } from "./node-types-DJytj0FB.js";
2
+ import { T as NthSelector } from "./node-types-mntWKkN-.js";
3
3
 
4
4
  //#region src/parse-anplusb.d.ts
5
5
  /** @internal */
@@ -1,7 +1,7 @@
1
- import { t as Lexer } from "./tokenize-BSycRGm0.js";
1
+ import { t as Lexer } from "./tokenize-BxUina14.js";
2
2
  import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
3
3
  import { o as str_equals, s as str_index_of } from "./parse-dimension-CCn_XRDe.js";
4
- import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
4
+ import { t as CSSNode } from "./css-node-BTgoFWDU.js";
5
5
  //#region src/parse-anplusb.ts
6
6
  /** @internal */
7
7
  var ANplusBParser = class {
@@ -1,5 +1,5 @@
1
1
  import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { t as AnyNode } from "./node-types-DJytj0FB.js";
2
+ import { t as AnyNode } from "./node-types-mntWKkN-.js";
3
3
 
4
4
  //#region src/parse-atrule-prelude.d.ts
5
5
  /** @internal */
@@ -1,7 +1,7 @@
1
- import { t as Lexer } from "./tokenize-BSycRGm0.js";
1
+ import { t as Lexer } from "./tokenize-BxUina14.js";
2
2
  import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
3
3
  import { a as is_whitespace, l as strip_vendor_prefix, o as str_equals } from "./parse-dimension-CCn_XRDe.js";
4
- import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
4
+ import { t as CSSNode } from "./css-node-BTgoFWDU.js";
5
5
  import { i as trim_boundaries, n as skip_whitespace_and_comments_forward } from "./parse-utils-BxrmqJxI.js";
6
6
  //#region src/parse-atrule-prelude.ts
7
7
  /** @internal */
@@ -468,11 +468,9 @@ var AtRulePreludeParser = class {
468
468
  }
469
469
  }
470
470
  parse_feature_value(start, end) {
471
- let temp_lexer = new Lexer(this.source);
472
- temp_lexer.seek(start, this.lexer.line, this.lexer.column);
471
+ const saved_position = this.lexer.save_position();
472
+ this.lexer.seek(start, this.lexer.line, this.lexer.column);
473
473
  let nodes = [];
474
- let saved_lexer = this.lexer;
475
- this.lexer = temp_lexer;
476
474
  while (this.lexer.pos < end) {
477
475
  this.lexer.next_token_fast(false);
478
476
  if (this.lexer.token_start >= end) break;
@@ -485,7 +483,7 @@ var AtRulePreludeParser = class {
485
483
  let node = this.parse_value_token();
486
484
  if (node !== null) nodes.push(node);
487
485
  }
488
- this.lexer = saved_lexer;
486
+ this.lexer.restore_position(saved_position);
489
487
  return nodes;
490
488
  }
491
489
  parse_namespace_prelude() {
@@ -1,6 +1,6 @@
1
1
  import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { n as Lexer } from "./tokenize-CyiJelQC.js";
3
- import { d as Declaration } from "./node-types-DJytj0FB.js";
2
+ import { n as Lexer } from "./tokenize-mV23Aiyb.js";
3
+ import { d as Declaration } from "./node-types-mntWKkN-.js";
4
4
 
5
5
  //#region src/parse-declaration.d.ts
6
6
  /** @internal */
@@ -1,7 +1,7 @@
1
- import { t as Lexer } from "./tokenize-BSycRGm0.js";
1
+ import { t as Lexer } from "./tokenize-BxUina14.js";
2
2
  import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
3
3
  import { i as is_vendor_prefixed } from "./parse-dimension-CCn_XRDe.js";
4
- import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
4
+ import { t as CSSNode } from "./css-node-BTgoFWDU.js";
5
5
  import { i as trim_boundaries } from "./parse-utils-BxrmqJxI.js";
6
6
  import { ValueParser } from "./parse-value.js";
7
7
  //#region src/parse-declaration.ts
@@ -1,5 +1,5 @@
1
1
  import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { I as SelectorList } from "./node-types-DJytj0FB.js";
2
+ import { F as Selector, I as SelectorList } from "./node-types-mntWKkN-.js";
3
3
 
4
4
  //#region src/parse-selector.d.ts
5
5
  /** @internal */
@@ -8,6 +8,7 @@ declare class SelectorParser {
8
8
  private arena;
9
9
  private source;
10
10
  private selector_end;
11
+ private anplusb_parser;
11
12
  constructor(arena: CSSDataArena, source: string);
12
13
  parse_selector(start: number, end: number, line?: number, column?: number, allow_relative?: boolean): number | null;
13
14
  private parse_selector_list;
@@ -33,11 +34,7 @@ declare class SelectorParser {
33
34
  private create_node_at;
34
35
  private skip_whitespace;
35
36
  }
36
- /**
37
- * Parse a CSS selector string and return an AST
38
- * @param source - The CSS selector to parse (e.g., "div.class > p#id")
39
- * @returns The root CSSNode of the selector AST
40
- */
41
- declare function parse_selector(source: string): SelectorList;
37
+ declare function parse_selector_list(source: string): SelectorList;
38
+ declare function parse_selector(source: string): Selector;
42
39
  //#endregion
43
- export { SelectorParser, parse_selector };
40
+ export { SelectorParser, parse_selector, parse_selector_list };
@@ -1,7 +1,7 @@
1
- import { t as Lexer } from "./tokenize-BSycRGm0.js";
1
+ import { t as Lexer } from "./tokenize-BxUina14.js";
2
2
  import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
3
3
  import { a as is_whitespace, n as is_combinator, o as str_equals } from "./parse-dimension-CCn_XRDe.js";
4
- import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
4
+ import { t as CSSNode } from "./css-node-BTgoFWDU.js";
5
5
  import { n as skip_whitespace_and_comments_forward, r as skip_whitespace_forward, t as skip_whitespace_and_comments_backward } from "./parse-utils-BxrmqJxI.js";
6
6
  import { ANplusBParser } from "./parse-anplusb.js";
7
7
  //#region src/parse-selector.ts
@@ -11,11 +11,13 @@ var SelectorParser = class {
11
11
  arena;
12
12
  source;
13
13
  selector_end;
14
+ anplusb_parser;
14
15
  constructor(arena, source) {
15
16
  this.arena = arena;
16
17
  this.source = source;
17
18
  this.lexer = new Lexer(source);
18
19
  this.selector_end = 0;
20
+ this.anplusb_parser = new ANplusBParser(arena, source);
19
21
  }
20
22
  parse_selector(start, end, line = 1, column = 1, allow_relative = true) {
21
23
  this.selector_end = end;
@@ -372,11 +374,9 @@ var SelectorParser = class {
372
374
  return str_equals("nth-child", name) || str_equals("nth-last-child", name) || str_equals("nth-of-type", name) || str_equals("nth-last-of-type", name) || str_equals("nth-col", name) || str_equals("nth-last-col", name);
373
375
  }
374
376
  parse_lang_identifiers(start, end, parent_node) {
375
- let temp_lexer = new Lexer(this.source);
376
- temp_lexer.seek(start, this.lexer.line, this.lexer.column);
377
+ const saved_position = this.lexer.save_position();
378
+ this.lexer.seek(start, this.lexer.line, this.lexer.column);
377
379
  let saved_selector_end = this.selector_end;
378
- let saved_lexer = this.lexer;
379
- this.lexer = temp_lexer;
380
380
  this.selector_end = end;
381
381
  let first_child = null;
382
382
  let last_child = null;
@@ -397,11 +397,11 @@ var SelectorParser = class {
397
397
  }
398
398
  if (first_child !== null) this.arena.set_first_child(parent_node, first_child);
399
399
  this.selector_end = saved_selector_end;
400
- this.lexer = saved_lexer;
400
+ this.lexer.restore_position(saved_position);
401
401
  }
402
402
  parse_nth_expression(start, end) {
403
403
  let of_index = this.find_of_keyword(start, end);
404
- let anplusb_parser = new ANplusBParser(this.arena, this.source);
404
+ let anplusb_parser = this.anplusb_parser;
405
405
  if (of_index === -1) return anplusb_parser.parse_anplusb(start, end, this.lexer.line);
406
406
  let anplusb_node = anplusb_parser.parse_anplusb(start, of_index, this.lexer.line);
407
407
  let selector_start = of_index + 2;
@@ -470,16 +470,14 @@ var SelectorParser = class {
470
470
  }
471
471
  }
472
472
  };
473
- /**
474
- * Parse a CSS selector string and return an AST
475
- * @param source - The CSS selector to parse (e.g., "div.class > p#id")
476
- * @returns The root CSSNode of the selector AST
477
- */
478
- function parse_selector(source) {
473
+ function parse_selector_list(source) {
479
474
  const arena = new CSSDataArena(CSSDataArena.capacity_for_source(source.length));
480
475
  const selector_index = new SelectorParser(arena, source).parse_selector(0, source.length);
481
476
  if (selector_index === null) return new CSSNode(arena, source, arena.create_node(20, 0, 0, 1, 1));
482
477
  return new CSSNode(arena, source, selector_index);
483
478
  }
479
+ function parse_selector(source) {
480
+ return parse_selector_list(source).first_child;
481
+ }
484
482
  //#endregion
485
- export { SelectorParser, parse_selector };
483
+ export { SelectorParser, parse_selector, parse_selector_list };
@@ -1,5 +1,5 @@
1
1
  import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { q as Value } from "./node-types-DJytj0FB.js";
2
+ import { q as Value } from "./node-types-mntWKkN-.js";
3
3
 
4
4
  //#region src/parse-value.d.ts
5
5
  /** @internal */
@@ -1,7 +1,7 @@
1
- import { t as Lexer } from "./tokenize-BSycRGm0.js";
1
+ import { t as Lexer } from "./tokenize-BxUina14.js";
2
2
  import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
3
3
  import { a as is_whitespace, o as str_equals } from "./parse-dimension-CCn_XRDe.js";
4
- import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
4
+ import { t as CSSNode } from "./css-node-BTgoFWDU.js";
5
5
  //#region src/parse-value.ts
6
6
  /** @internal */
7
7
  var ValueParser = class {
package/dist/parse.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { t as CommentInfo } from "./tokenize-CyiJelQC.js";
3
- import { z as StyleSheet } from "./node-types-DJytj0FB.js";
2
+ import { t as CommentInfo } from "./tokenize-mV23Aiyb.js";
3
+ import { z as StyleSheet } from "./node-types-mntWKkN-.js";
4
4
 
5
5
  //#region src/parse.d.ts
6
6
  interface ParserOptions {
package/dist/parse.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as Lexer } from "./tokenize-BSycRGm0.js";
1
+ import { t as Lexer } from "./tokenize-BxUina14.js";
2
2
  import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
3
- import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
3
+ import { t as CSSNode } from "./css-node-BTgoFWDU.js";
4
4
  import { i as trim_boundaries } from "./parse-utils-BxrmqJxI.js";
5
5
  import { SelectorParser } from "./parse-selector.js";
6
6
  import { AtRulePreludeParser } from "./parse-atrule-prelude.js";