@projectwallace/css-parser 0.14.10 → 0.15.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.
@@ -40,6 +40,7 @@ declare const PRELUDE_OPERATOR = 38;
40
40
  declare const FEATURE_RANGE = 39;
41
41
  declare const AT_RULE_PRELUDE = 40;
42
42
  declare const PRELUDE_SELECTORLIST = 41;
43
+ declare const SUPPORTS_DECLARATION = 57;
43
44
  declare const VALUE = 50;
44
45
  declare const FLAG_IMPORTANT: number;
45
46
  /** @internal */
@@ -90,4 +91,4 @@ declare class CSSDataArena {
90
91
  has_flag(node_index: number, flag: number): boolean;
91
92
  }
92
93
  //#endregion
93
- export { PRELUDE_SELECTORLIST as A, TYPE_SELECTOR as B, NESTING_SELECTOR as C, OPERATOR as D, NUMBER as E, SELECTOR_LIST as F, UNIVERSAL_SELECTOR as H, STRING as I, STYLESHEET as L, PSEUDO_ELEMENT_SELECTOR as M, RAW as N, PARENTHESIS as O, SELECTOR as P, STYLE_RULE as R, MEDIA_TYPE as S, NTH_SELECTOR as T, URL as U, UNICODE_RANGE as V, VALUE as W, ID_SELECTOR as _, CLASS_SELECTOR as a, MEDIA_FEATURE as b, CONTAINER_QUERY as c, DIMENSION as d, FEATURE_RANGE as f, IDENTIFIER as g, HASH as h, BLOCK as i, PSEUDO_CLASS_SELECTOR as j, PRELUDE_OPERATOR as k, CSSDataArena as l, FUNCTION as m, AT_RULE as n, COMBINATOR as o, FLAG_IMPORTANT as p, AT_RULE_PRELUDE as r, COMMENT as s, ATTRIBUTE_SELECTOR as t, DECLARATION as u, LANG_SELECTOR as v, NTH_OF_SELECTOR as w, MEDIA_QUERY as x, LAYER_NAME as y, SUPPORTS_QUERY as z };
94
+ export { PRELUDE_SELECTORLIST as A, SUPPORTS_QUERY as B, NESTING_SELECTOR as C, OPERATOR as D, NUMBER as E, SELECTOR_LIST as F, VALUE as G, UNICODE_RANGE as H, STRING as I, STYLESHEET as L, PSEUDO_ELEMENT_SELECTOR as M, RAW as N, PARENTHESIS as O, SELECTOR as P, STYLE_RULE as R, MEDIA_TYPE as S, NTH_SELECTOR as T, UNIVERSAL_SELECTOR as U, TYPE_SELECTOR as V, URL as W, ID_SELECTOR as _, CLASS_SELECTOR as a, MEDIA_FEATURE as b, CONTAINER_QUERY as c, DIMENSION as d, FEATURE_RANGE as f, IDENTIFIER as g, HASH as h, BLOCK as i, PSEUDO_CLASS_SELECTOR as j, PRELUDE_OPERATOR as k, CSSDataArena as l, FUNCTION as m, AT_RULE as n, COMBINATOR as o, FLAG_IMPORTANT as p, AT_RULE_PRELUDE as r, COMMENT as s, ATTRIBUTE_SELECTOR as t, DECLARATION as u, LANG_SELECTOR as v, NTH_OF_SELECTOR as w, MEDIA_QUERY as x, LAYER_NAME as y, SUPPORTS_DECLARATION as z };
@@ -40,6 +40,7 @@ const LAYER_NAME = 37;
40
40
  const PRELUDE_OPERATOR = 38;
41
41
  const FEATURE_RANGE = 39;
42
42
  const AT_RULE_PRELUDE = 40;
43
+ const SUPPORTS_DECLARATION = 57;
43
44
  const VALUE = 50;
44
45
  const FLAG_IMPORTANT = 1;
45
46
  /** @internal */
@@ -196,4 +197,4 @@ var CSSDataArena = class CSSDataArena {
196
197
  }
197
198
  };
198
199
  //#endregion
199
- export { PSEUDO_CLASS_SELECTOR as A, UNICODE_RANGE as B, NESTING_SELECTOR as C, OPERATOR as D, NUMBER as E, STRING as F, URL as H, STYLESHEET as I, STYLE_RULE as L, RAW as M, SELECTOR as N, PARENTHESIS as O, SELECTOR_LIST as P, SUPPORTS_QUERY as R, MEDIA_TYPE as S, NTH_SELECTOR as T, VALUE as U, UNIVERSAL_SELECTOR as V, ID_SELECTOR as _, CLASS_SELECTOR as a, MEDIA_FEATURE as b, CONTAINER_QUERY as c, DIMENSION as d, FEATURE_RANGE as f, IDENTIFIER as g, HASH as h, BLOCK as i, PSEUDO_ELEMENT_SELECTOR as j, PRELUDE_OPERATOR as k, CSSDataArena as l, FUNCTION as m, AT_RULE as n, COMBINATOR as o, FLAG_IMPORTANT as p, AT_RULE_PRELUDE as r, COMMENT as s, ATTRIBUTE_SELECTOR as t, DECLARATION as u, LANG_SELECTOR as v, NTH_OF_SELECTOR as w, MEDIA_QUERY as x, LAYER_NAME as y, TYPE_SELECTOR as z };
200
+ export { PSEUDO_CLASS_SELECTOR as A, TYPE_SELECTOR as B, NESTING_SELECTOR as C, OPERATOR as D, NUMBER as E, STRING as F, UNIVERSAL_SELECTOR as H, STYLESHEET as I, STYLE_RULE as L, RAW as M, SELECTOR as N, PARENTHESIS as O, SELECTOR_LIST as P, SUPPORTS_DECLARATION as R, MEDIA_TYPE as S, NTH_SELECTOR as T, URL as U, UNICODE_RANGE as V, VALUE as W, ID_SELECTOR as _, CLASS_SELECTOR as a, MEDIA_FEATURE as b, CONTAINER_QUERY as c, DIMENSION as d, FEATURE_RANGE as f, IDENTIFIER as g, HASH as h, BLOCK as i, PSEUDO_ELEMENT_SELECTOR as j, PRELUDE_OPERATOR as k, CSSDataArena as l, FUNCTION as m, AT_RULE as n, COMBINATOR as o, FLAG_IMPORTANT as p, AT_RULE_PRELUDE as r, COMMENT as s, ATTRIBUTE_SELECTOR as t, DECLARATION as u, LANG_SELECTOR as v, NTH_OF_SELECTOR as w, MEDIA_QUERY as x, LAYER_NAME as y, SUPPORTS_QUERY as z };
@@ -1,4 +1,4 @@
1
- import { B as TYPE_SELECTOR, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as SELECTOR_LIST, H as UNIVERSAL_SELECTOR, 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 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_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_QUERY } from "./arena-D6TANE5e.js";
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
 
3
3
  //#region src/constants.d.ts
4
4
  declare const NODE_TYPES: {
@@ -39,10 +39,11 @@ declare const NODE_TYPES: {
39
39
  readonly MEDIA_TYPE: 34;
40
40
  readonly CONTAINER_QUERY: 35;
41
41
  readonly SUPPORTS_QUERY: 36;
42
+ readonly SUPPORTS_DECLARATION: 57;
42
43
  readonly LAYER_NAME: 37;
43
44
  readonly PRELUDE_OPERATOR: 38;
44
45
  readonly FEATURE_RANGE: 39;
45
46
  readonly AT_RULE_PRELUDE: 40;
46
47
  };
47
48
  //#endregion
48
- export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, 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, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
49
+ export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, 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, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
package/dist/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as PSEUDO_CLASS_SELECTOR, B as UNICODE_RANGE, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as STRING, H as URL, I as STYLESHEET, L as STYLE_RULE, M as RAW, N as SELECTOR, O as PARENTHESIS, P as SELECTOR_LIST, R as SUPPORTS_QUERY, S as MEDIA_TYPE, T as NTH_SELECTOR, U as VALUE, V as UNIVERSAL_SELECTOR, _ 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 TYPE_SELECTOR } from "./arena-CveFYH2l.js";
1
+ 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";
2
2
  //#region src/constants.ts
3
3
  const NODE_TYPES = {
4
4
  STYLESHEET: 1,
@@ -38,10 +38,11 @@ const NODE_TYPES = {
38
38
  MEDIA_TYPE: 34,
39
39
  CONTAINER_QUERY: 35,
40
40
  SUPPORTS_QUERY: 36,
41
+ SUPPORTS_DECLARATION: 57,
41
42
  LAYER_NAME: 37,
42
43
  PRELUDE_OPERATOR: 38,
43
44
  FEATURE_RANGE: 39,
44
45
  AT_RULE_PRELUDE: 40
45
46
  };
46
47
  //#endregion
47
- export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, 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, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
48
+ export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, 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, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
@@ -1,4 +1,4 @@
1
- import "./arena-CveFYH2l.js";
1
+ import "./arena-DnV0a_Ne.js";
2
2
  import { a as is_whitespace, c as str_starts_with, i as is_vendor_prefixed, t as parse_dimension } from "./parse-dimension-CCn_XRDe.js";
3
3
  //#region src/css-node.ts
4
4
  const TYPE_NAMES = {
@@ -39,6 +39,7 @@ const TYPE_NAMES = {
39
39
  [34]: "MediaType",
40
40
  [35]: "ContainerQuery",
41
41
  [36]: "SupportsQuery",
42
+ [57]: "SupportsDeclaration",
42
43
  [37]: "Layer",
43
44
  [38]: "Operator",
44
45
  [39]: "MediaFeatureRange",
@@ -75,10 +76,13 @@ const nodes_with_children = new Set([
75
76
  32,
76
77
  33,
77
78
  35,
78
- 39
79
+ 39,
80
+ 36,
81
+ 57
79
82
  ]);
80
83
  const enumerable_properties = [
81
84
  "name",
85
+ "namespace",
82
86
  "property",
83
87
  "value",
84
88
  "unit",
@@ -131,12 +135,28 @@ var CSSNode = class CSSNode {
131
135
  /** Get the "content" text (at-rule name for at-rules, layer name for import layers) */
132
136
  get name() {
133
137
  if (!nodes_with_name.has(this.type)) return;
134
- let content = this.get_content();
135
138
  let { type } = this;
136
- if ((type === 28 || type === 56) && content === "") return null;
139
+ if (type === 28) return null;
140
+ let content = this.get_content();
141
+ if (type === 56 && content === "") return null;
137
142
  return content;
138
143
  }
139
144
  /**
145
+ * Namespace prefix for type and universal selectors.
146
+ * - `null` — no namespace qualifier (plain `div` or `*`)
147
+ * - `''` — empty namespace (`|div` or `|*`)
148
+ * - `'ns'` — named namespace (`ns|div` or `ns|*`)
149
+ * - `'*'` — any namespace (`*|div` or `*|*`)
150
+ */
151
+ get namespace() {
152
+ let { type } = this;
153
+ if (type !== 21 && type !== 28) return void 0;
154
+ if (!this.arena.has_flag(this.index, 16)) return null;
155
+ let start = this.arena.get_value_start(this.index);
156
+ let length = this.arena.get_value_length(this.index);
157
+ return this.source.substring(start, start + length);
158
+ }
159
+ /**
140
160
  * Alias for name (for declarations: "color" in "color: blue")
141
161
  * More semantic than `name` for declaration nodes
142
162
  */
@@ -157,6 +177,7 @@ var CSSNode = class CSSNode {
157
177
  if (type === 3) return void 0;
158
178
  if (type === 34) return text;
159
179
  if (type === 4 && first_child) return first_child;
180
+ if (type === 33) return first_child ?? null;
160
181
  if (type === 12) return parse_dimension(text).value;
161
182
  if (type === 11) return Number.parseFloat(text);
162
183
  if (type === 18) {
@@ -251,6 +272,7 @@ var CSSNode = class CSSNode {
251
272
  case 3: return is_vendor_prefixed(this.get_content());
252
273
  case 15: return is_vendor_prefixed(this.get_content());
253
274
  case 10: return is_vendor_prefixed(this.text);
275
+ case 33: return is_vendor_prefixed(this.get_content());
254
276
  default: return false;
255
277
  }
256
278
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as TYPE_SELECTOR, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as SELECTOR_LIST, H as UNIVERSAL_SELECTOR, 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 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_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_QUERY } from "./arena-D6TANE5e.js";
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
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_combinator, A as PreludeSelectorList, At as is_supports_query, B as SupportsQuery, C as NestingSelector, Ct as is_pseudo_element_selector, D as Operator, Dt as is_selector_list, E as Number, Et as is_selector, F as Selector, Ft as is_value, G as Url, H as TypeSelector, I as SelectorList, It as CloneOptions, J as is_atrule, K as Value, L as SelectorNode, Lt as PlainCSSNode, M as PseudoElementSelector, Mt as is_unicode_range, N as Raw, Nt as is_universal_selector, O as Parenthesis, Ot as is_string, P as Rule, Pt as is_url, Q as is_class_selector, R as String, Rt as TYPE_NAMES, S as MediaType, St as is_pseudo_class_selector, T as NthSelector, Tt as is_rule, U as UnicodeRange, V as ToPlain, W as UniversalSelector, X as is_attribute_selector, Y as is_atrule_prelude, Z as is_block, _ as Identifier, _t as is_number, a as Block, at as is_function, b as MediaFeature, bt as is_prelude_operator, c as Combinator, ct as is_identifier, d as Declaration, dt as is_media_feature, et as is_comment, f as Dimension, ft as is_media_query, g as IdSelector, gt as is_nth_selector, h as Hash, ht as is_nth_of_selector, i as AttributeSelector, it as is_feature_range, j as PseudoClassSelector, jt as is_type_selector, k as PreludeOperator, kt as is_stylesheet, l as Comment, lt as is_lang_selector, m as Function, mt as is_nesting_selector, n as Atrule, nt as is_declaration, o as CSSNode, ot as is_hash, p as FeatureRange, pt as is_media_type, q as WithChildren, r as AtrulePrelude, rt as is_dimension, s as ClassSelector, st as is_id_selector, t as AnyNode, tt as is_container_query, u as ContainerQuery, ut as is_layer_name, v as LangSelector, vt as is_operator, w as NthOfSelector, wt as is_raw, x as MediaQuery, xt as is_prelude_selectorlist, y as LayerName, yt as is_parenthesis, z as StyleSheet } from "./node-types-D282RMOz.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";
5
5
  import { ParserOptions, parse } from "./parse.js";
6
6
  import { parse_selector } from "./parse-selector.js";
7
7
  import { parse_atrule_prelude } from "./parse-atrule-prelude.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_QUERY, type Selector, type SelectorList, type SelectorNode, type String, type StyleSheet, 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_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_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
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";
2
- import { A as PSEUDO_CLASS_SELECTOR, B as UNICODE_RANGE, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as STRING, H as URL, I as STYLESHEET, L as STYLE_RULE, M as RAW, N as SELECTOR, O as PARENTHESIS, P as SELECTOR_LIST, R as SUPPORTS_QUERY, S as MEDIA_TYPE, T as NTH_SELECTOR, U as VALUE, V as UNIVERSAL_SELECTOR, _ 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 TYPE_SELECTOR } from "./arena-CveFYH2l.js";
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-DMd5jbdm.js";
4
+ import { n as TYPE_NAMES } from "./css-node-C3t4b8Jt.js";
5
5
  import { parse_selector } from "./parse-selector.js";
6
6
  import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
7
7
  import { parse_value } from "./parse-value.js";
@@ -124,6 +124,9 @@ function is_container_query(node) {
124
124
  function is_supports_query(node) {
125
125
  return node.type === 36;
126
126
  }
127
+ function is_supports_declaration(node) {
128
+ return node.type === 57;
129
+ }
127
130
  function is_layer_name(node) {
128
131
  return node.type === 37;
129
132
  }
@@ -137,4 +140,4 @@ function is_prelude_selectorlist(node) {
137
140
  return node.type === 41;
138
141
  }
139
142
  //#endregion
140
- 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_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_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_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
@@ -1,4 +1,4 @@
1
- import { A as PRELUDE_SELECTORLIST, B as TYPE_SELECTOR, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as SELECTOR_LIST, H as UNIVERSAL_SELECTOR, 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 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_CLASS_SELECTOR, k as PRELUDE_OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, 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-D6TANE5e.js";
1
+ import { A as PRELUDE_SELECTORLIST, 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, 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
 
3
3
  //#region src/css-node.d.ts
4
4
  declare const TYPE_NAMES: {
@@ -39,6 +39,7 @@ declare const TYPE_NAMES: {
39
39
  readonly 34: "MediaType";
40
40
  readonly 35: "ContainerQuery";
41
41
  readonly 36: "SupportsQuery";
42
+ readonly 57: "SupportsDeclaration";
42
43
  readonly 37: "Layer";
43
44
  readonly 38: "Operator";
44
45
  readonly 39: "MediaFeatureRange";
@@ -46,7 +47,7 @@ declare const TYPE_NAMES: {
46
47
  readonly 41: "PreludeSelectorList";
47
48
  };
48
49
  type TypeName = (typeof TYPE_NAMES)[keyof typeof TYPE_NAMES] | 'unknown';
49
- type CSSNodeType = typeof STYLESHEET | typeof STYLE_RULE | typeof AT_RULE | typeof DECLARATION | typeof SELECTOR | typeof COMMENT | typeof BLOCK | typeof RAW | typeof IDENTIFIER | typeof NUMBER | typeof DIMENSION | typeof STRING | typeof HASH | typeof FUNCTION | typeof OPERATOR | typeof PARENTHESIS | typeof URL | typeof UNICODE_RANGE | typeof VALUE | typeof SELECTOR_LIST | typeof TYPE_SELECTOR | typeof CLASS_SELECTOR | typeof ID_SELECTOR | typeof ATTRIBUTE_SELECTOR | typeof PSEUDO_CLASS_SELECTOR | typeof PSEUDO_ELEMENT_SELECTOR | typeof COMBINATOR | typeof UNIVERSAL_SELECTOR | typeof NESTING_SELECTOR | typeof NTH_SELECTOR | typeof NTH_OF_SELECTOR | typeof LANG_SELECTOR | typeof MEDIA_QUERY | typeof MEDIA_FEATURE | typeof MEDIA_TYPE | typeof CONTAINER_QUERY | typeof SUPPORTS_QUERY | typeof LAYER_NAME | typeof PRELUDE_OPERATOR | typeof FEATURE_RANGE | typeof AT_RULE_PRELUDE | typeof PRELUDE_SELECTORLIST;
50
+ type CSSNodeType = typeof STYLESHEET | typeof STYLE_RULE | typeof AT_RULE | typeof DECLARATION | typeof SELECTOR | typeof COMMENT | typeof BLOCK | typeof RAW | typeof IDENTIFIER | typeof NUMBER | typeof DIMENSION | typeof STRING | typeof HASH | typeof FUNCTION | typeof OPERATOR | typeof PARENTHESIS | typeof URL | typeof UNICODE_RANGE | typeof VALUE | typeof SELECTOR_LIST | typeof TYPE_SELECTOR | typeof CLASS_SELECTOR | typeof ID_SELECTOR | typeof ATTRIBUTE_SELECTOR | typeof PSEUDO_CLASS_SELECTOR | typeof PSEUDO_ELEMENT_SELECTOR | typeof COMBINATOR | typeof UNIVERSAL_SELECTOR | typeof NESTING_SELECTOR | typeof NTH_SELECTOR | typeof NTH_OF_SELECTOR | typeof LANG_SELECTOR | typeof MEDIA_QUERY | typeof MEDIA_FEATURE | typeof MEDIA_TYPE | typeof CONTAINER_QUERY | typeof SUPPORTS_QUERY | typeof LAYER_NAME | typeof PRELUDE_OPERATOR | typeof FEATURE_RANGE | typeof AT_RULE_PRELUDE | typeof PRELUDE_SELECTORLIST | typeof SUPPORTS_DECLARATION;
50
51
  interface CloneOptions {
51
52
  /**
52
53
  * Recursively clone all children
@@ -283,8 +284,9 @@ type Value = CSSNode & WithChildren<ValueLike> & {
283
284
  clone(options?: CloneOptions): ToPlain<Value>;
284
285
  };
285
286
  type TypeSelector = CSSNode & {
286
- readonly type: typeof TYPE_SELECTOR; /** Element type, e.g. "div", "span" */
287
- readonly name: string;
287
+ readonly type: typeof TYPE_SELECTOR; /** Local element name, e.g. "div" in both "div" and "ns|div" */
288
+ readonly name: string; /** Namespace prefix: null if no qualifier, '' for |div, 'ns' for ns|div, '*' for *|div */
289
+ readonly namespace: string | null;
288
290
  clone(options?: CloneOptions): ToPlain<TypeSelector>;
289
291
  };
290
292
  type ClassSelector = CSSNode & {
@@ -321,8 +323,9 @@ type Combinator = CSSNode & {
321
323
  clone(options?: CloneOptions): ToPlain<Combinator>;
322
324
  };
323
325
  type UniversalSelector = CSSNode & {
324
- readonly type: typeof UNIVERSAL_SELECTOR; /** Namespace qualifier (e.g. 'ns' in 'ns|*'), null if no namespace */
325
- readonly name: string | null;
326
+ readonly type: typeof UNIVERSAL_SELECTOR; /** Always null — universal selector has no element name */
327
+ readonly name: null; /** Namespace prefix: null if no qualifier, '' for |*, 'ns' for ns|*, '*' for *|* */
328
+ readonly namespace: string | null;
326
329
  clone(options?: CloneOptions): ToPlain<UniversalSelector>;
327
330
  };
328
331
  type NestingSelector = CSSNode & {
@@ -354,9 +357,10 @@ type MediaQuery = CSSNode & WithChildren<MediaFeature | PreludeOperator | MediaT
354
357
  readonly type: typeof MEDIA_QUERY;
355
358
  clone(options?: CloneOptions): ToPlain<MediaQuery>;
356
359
  };
357
- type MediaFeature = CSSNode & WithChildren & {
360
+ type MediaFeature = CSSNode & {
358
361
  readonly type: typeof MEDIA_FEATURE; /** Feature name, e.g. "min-width" */
359
- readonly property: string;
362
+ readonly property: string; /** Feature value node, or null for boolean features like (hover) */
363
+ readonly value: CSSNode | null;
360
364
  clone(options?: CloneOptions): ToPlain<MediaFeature>;
361
365
  };
362
366
  type MediaType = CSSNode & {
@@ -368,11 +372,15 @@ type ContainerQuery = CSSNode & WithChildren<Identifier | MediaFeature | Functio
368
372
  readonly type: typeof CONTAINER_QUERY;
369
373
  clone(options?: CloneOptions): ToPlain<ContainerQuery>;
370
374
  };
371
- type SupportsQuery = CSSNode & {
375
+ type SupportsQuery = CSSNode & WithChildren<SupportsDeclaration> & {
372
376
  readonly type: typeof SUPPORTS_QUERY; /** The supports condition text, e.g. "display: flex" from "supports(display: flex)" */
373
377
  readonly value: string;
374
378
  clone(options?: CloneOptions): ToPlain<SupportsQuery>;
375
379
  };
380
+ type SupportsDeclaration = CSSNode & WithChildren<Declaration> & {
381
+ readonly type: typeof SUPPORTS_DECLARATION;
382
+ clone(options?: CloneOptions): ToPlain<SupportsDeclaration>;
383
+ };
376
384
  type LayerName = CSSNode & {
377
385
  readonly type: typeof LAYER_NAME;
378
386
  readonly name: string; /** Alias for name — the layer name string, e.g. "base" from "layer(base)" */
@@ -409,7 +417,7 @@ type FeatureRange = CSSNode & WithChildren<Dimension | Operator> & {
409
417
  readonly name: string;
410
418
  clone(options?: CloneOptions): ToPlain<FeatureRange>;
411
419
  };
412
- type AnyNode = StyleSheet | Rule | Atrule | Declaration | Selector | SelectorList | Block | Comment | Raw | Identifier | Number | Dimension | String | Hash | Function | Operator | Parenthesis | Url | UnicodeRange | Value | TypeSelector | ClassSelector | IdSelector | AttributeSelector | PseudoClassSelector | PseudoElementSelector | Combinator | UniversalSelector | NestingSelector | NthSelector | NthOfSelector | LangSelector | AtrulePrelude | MediaQuery | MediaFeature | MediaType | ContainerQuery | SupportsQuery | LayerName | PreludeOperator | FeatureRange | PreludeSelectorList;
420
+ type AnyNode = StyleSheet | Rule | Atrule | Declaration | Selector | SelectorList | Block | Comment | Raw | Identifier | Number | Dimension | String | Hash | Function | Operator | Parenthesis | Url | UnicodeRange | Value | TypeSelector | ClassSelector | IdSelector | AttributeSelector | PseudoClassSelector | PseudoElementSelector | Combinator | UniversalSelector | NestingSelector | NthSelector | NthOfSelector | LangSelector | AtrulePrelude | MediaQuery | MediaFeature | MediaType | ContainerQuery | SupportsQuery | SupportsDeclaration | LayerName | PreludeOperator | FeatureRange | PreludeSelectorList;
413
421
  declare function is_stylesheet(node: CSSNode): node is StyleSheet;
414
422
  declare function is_rule(node: CSSNode): node is Rule;
415
423
  declare function is_atrule(node: CSSNode): node is Atrule;
@@ -448,9 +456,10 @@ declare function is_media_feature(node: CSSNode): node is MediaFeature;
448
456
  declare function is_media_type(node: CSSNode): node is MediaType;
449
457
  declare function is_container_query(node: CSSNode): node is ContainerQuery;
450
458
  declare function is_supports_query(node: CSSNode): node is SupportsQuery;
459
+ declare function is_supports_declaration(node: CSSNode): node is SupportsDeclaration;
451
460
  declare function is_layer_name(node: CSSNode): node is LayerName;
452
461
  declare function is_prelude_operator(node: CSSNode): node is PreludeOperator;
453
462
  declare function is_feature_range(node: CSSNode): node is FeatureRange;
454
463
  declare function is_prelude_selectorlist(node: CSSNode): node is PreludeSelectorList;
455
464
  //#endregion
456
- export { is_combinator as $, PreludeSelectorList as A, is_supports_query as At, SupportsQuery as B, NestingSelector as C, is_pseudo_element_selector as Ct, Operator as D, is_selector_list as Dt, Number as E, is_selector as Et, Selector as F, is_value as Ft, Url as G, TypeSelector as H, SelectorList as I, CloneOptions as It, is_atrule as J, Value as K, SelectorNode as L, PlainCSSNode as Lt, PseudoElementSelector as M, is_unicode_range as Mt, Raw as N, is_universal_selector as Nt, Parenthesis as O, is_string as Ot, Rule as P, is_url as Pt, is_class_selector as Q, String as R, TYPE_NAMES as Rt, MediaType as S, is_pseudo_class_selector as St, NthSelector as T, is_rule as Tt, UnicodeRange as U, ToPlain as V, UniversalSelector as W, is_attribute_selector as X, is_atrule_prelude as Y, is_block as Z, Identifier as _, is_number as _t, Block as a, is_function as at, MediaFeature as b, is_prelude_operator as bt, Combinator as c, is_identifier as ct, Declaration as d, is_media_feature as dt, is_comment as et, Dimension as f, is_media_query as ft, IdSelector as g, is_nth_selector as gt, Hash as h, is_nth_of_selector as ht, AttributeSelector as i, is_feature_range as it, PseudoClassSelector as j, is_type_selector as jt, PreludeOperator as k, is_stylesheet as kt, Comment as l, is_lang_selector as lt, Function as m, is_nesting_selector as mt, Atrule as n, is_declaration as nt, CSSNode as o, is_hash as ot, FeatureRange as p, is_media_type as pt, WithChildren as q, AtrulePrelude as r, is_dimension as rt, ClassSelector as s, is_id_selector as st, AnyNode as t, is_container_query as tt, ContainerQuery as u, is_layer_name as ut, LangSelector as v, is_operator as vt, NthOfSelector as w, is_raw as wt, MediaQuery as x, is_prelude_selectorlist as xt, LayerName as y, is_parenthesis as yt, StyleSheet as z };
465
+ export { is_class_selector as $, PreludeSelectorList as A, is_stylesheet as At, SupportsDeclaration as B, TYPE_NAMES as Bt, NestingSelector as C, is_pseudo_class_selector as Ct, Operator as D, is_selector as Dt, Number as E, is_rule as Et, Selector as F, is_universal_selector as Ft, UniversalSelector as G, ToPlain as H, SelectorList as I, is_url as It, WithChildren as J, Url as K, SelectorNode as L, is_value as Lt, PseudoElementSelector as M, is_supports_query as Mt, Raw as N, is_type_selector as Nt, Parenthesis as O, is_selector_list as Ot, Rule as P, is_unicode_range as Pt, is_block as Q, String as R, CloneOptions as Rt, MediaType as S, is_prelude_selectorlist as St, NthSelector as T, is_raw as Tt, TypeSelector as U, SupportsQuery as V, UnicodeRange as W, is_atrule_prelude as X, is_atrule as Y, is_attribute_selector as Z, Identifier as _, is_nth_selector as _t, Block as a, is_feature_range as at, MediaFeature as b, is_parenthesis as bt, Combinator as c, is_id_selector as ct, Declaration as d, is_layer_name as dt, is_combinator as et, Dimension as f, is_media_feature as ft, IdSelector as g, is_nth_of_selector as gt, Hash as h, is_nesting_selector as ht, AttributeSelector as i, is_dimension as it, PseudoClassSelector as j, is_supports_declaration as jt, PreludeOperator as k, is_string as kt, Comment as l, is_identifier as lt, Function as m, is_media_type as mt, Atrule as n, is_container_query as nt, CSSNode as o, is_function as ot, FeatureRange as p, is_media_query as pt, Value as q, AtrulePrelude as r, is_declaration as rt, ClassSelector as s, is_hash as st, AnyNode as t, is_comment as tt, ContainerQuery as u, is_lang_selector as ut, LangSelector as v, is_number as vt, NthOfSelector as w, is_pseudo_element_selector as wt, MediaQuery as x, is_prelude_operator as xt, LayerName as y, is_operator as yt, StyleSheet as z, PlainCSSNode as zt };
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
- import { T as NthSelector } from "./node-types-D282RMOz.js";
1
+ import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
+ import { T as NthSelector } from "./node-types-DJytj0FB.js";
3
3
 
4
4
  //#region src/parse-anplusb.d.ts
5
5
  /** @internal */
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { l as CSSDataArena } from "./arena-CveFYH2l.js";
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-DMd5jbdm.js";
4
+ import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
5
5
  //#region src/parse-anplusb.ts
6
6
  /** @internal */
7
7
  var ANplusBParser = class {
@@ -58,7 +58,7 @@ var ANplusBParser = class {
58
58
  b_start = this.lexer.token_start;
59
59
  b_end = this.lexer.token_end;
60
60
  }
61
- return this.create_anplusb_node(node_start, a_start, a_end, b !== null ? b_start : 0, b !== null ? b_end : 0);
61
+ return this.create_anplusb_node(node_start, a_start, a_end, b === null ? 0 : b_start, b === null ? 0 : b_end);
62
62
  }
63
63
  if (first_char === 110) {
64
64
  if (this.lexer.token_end > this.lexer.token_start + 1) {
@@ -78,7 +78,7 @@ var ANplusBParser = class {
78
78
  b_start = this.lexer.token_start;
79
79
  b_end = this.lexer.token_end;
80
80
  }
81
- return this.create_anplusb_node(node_start, a_start, a_end, b !== null ? b_start : 0, b !== null ? b_end : 0);
81
+ return this.create_anplusb_node(node_start, a_start, a_end, b === null ? 0 : b_start, b === null ? 0 : b_end);
82
82
  }
83
83
  return null;
84
84
  }
@@ -102,7 +102,7 @@ var ANplusBParser = class {
102
102
  b_start = this.lexer.token_start;
103
103
  b_end = this.lexer.token_end;
104
104
  }
105
- return this.create_anplusb_node(node_start, a_start, a_end, b !== null ? b_start : 0, b !== null ? b_end : 0);
105
+ return this.create_anplusb_node(node_start, a_start, a_end, b === null ? 0 : b_start, b === null ? 0 : b_end);
106
106
  }
107
107
  }
108
108
  this.lexer.restore_position(saved);
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
- import { t as AnyNode } from "./node-types-D282RMOz.js";
1
+ import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
+ import { t as AnyNode } from "./node-types-DJytj0FB.js";
3
3
 
4
4
  //#region src/parse-atrule-prelude.d.ts
5
5
  /** @internal */
@@ -18,6 +18,8 @@ declare class AtRulePreludeParser {
18
18
  private parse_media_feature;
19
19
  private parse_container_query;
20
20
  private parse_supports_query;
21
+ private find_colon_at_depth_zero;
22
+ private create_supports_declaration;
21
23
  private parse_layer_names;
22
24
  private parse_function_prelude;
23
25
  private parse_identifier;
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { l as CSSDataArena } from "./arena-CveFYH2l.js";
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-DMd5jbdm.js";
4
+ import { t as CSSNode } from "./css-node-C3t4b8Jt.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 */
@@ -138,7 +138,13 @@ var AtRulePreludeParser = class {
138
138
  }
139
139
  j++;
140
140
  }
141
- if (colon_pos !== -1) {
141
+ if (colon_pos === -1) {
142
+ let trimmed = trim_boundaries(this.source, content_start, content_end);
143
+ if (trimmed) {
144
+ this.arena.set_content_start_delta(feature, trimmed[0] - feature_start);
145
+ this.arena.set_content_length(feature, trimmed[1] - trimmed[0]);
146
+ }
147
+ } else {
142
148
  let name_trimmed = trim_boundaries(this.source, content_start, colon_pos);
143
149
  if (name_trimmed) {
144
150
  this.arena.set_content_start_delta(feature, name_trimmed[0] - feature_start);
@@ -149,12 +155,6 @@ var AtRulePreludeParser = class {
149
155
  let value_nodes = this.parse_feature_value(value_trimmed[0], value_trimmed[1]);
150
156
  if (value_nodes.length > 0) this.arena.append_children(feature, value_nodes);
151
157
  }
152
- } else {
153
- let trimmed = trim_boundaries(this.source, content_start, content_end);
154
- if (trimmed) {
155
- this.arena.set_content_start_delta(feature, trimmed[0] - feature_start);
156
- this.arena.set_content_length(feature, trimmed[1] - trimmed[0]);
157
- }
158
158
  }
159
159
  return feature;
160
160
  }
@@ -237,6 +237,11 @@ var AtRulePreludeParser = class {
237
237
  if (trimmed) {
238
238
  this.arena.set_value_start_delta(query, trimmed[0] - feature_start);
239
239
  this.arena.set_value_length(query, trimmed[1] - trimmed[0]);
240
+ let colon_pos = this.find_colon_at_depth_zero(trimmed[0], trimmed[1]);
241
+ if (colon_pos !== -1) {
242
+ let decl_child = this.create_supports_declaration(trimmed[0], trimmed[1], colon_pos);
243
+ this.arena.append_children(query, [decl_child]);
244
+ }
240
245
  }
241
246
  nodes.push(query);
242
247
  }
@@ -250,6 +255,39 @@ var AtRulePreludeParser = class {
250
255
  }
251
256
  return nodes;
252
257
  }
258
+ find_colon_at_depth_zero(start, end) {
259
+ let depth = 0;
260
+ for (let i = start; i < end; i++) {
261
+ let ch = this.source.charCodeAt(i);
262
+ if (ch === 40) depth++;
263
+ else if (ch === 41) depth--;
264
+ else if (ch === 58 && depth === 0) return i;
265
+ }
266
+ return -1;
267
+ }
268
+ create_supports_declaration(content_start, content_end, colon_pos) {
269
+ let prop_trimmed = trim_boundaries(this.source, content_start, colon_pos);
270
+ let val_trimmed = trim_boundaries(this.source, colon_pos + 1, content_end);
271
+ if (!prop_trimmed) return this.create_node(57, content_start, content_end);
272
+ let decl_start = prop_trimmed[0];
273
+ let decl_end = val_trimmed ? val_trimmed[1] : colon_pos + 1;
274
+ let decl = this.create_node(4, decl_start, decl_end);
275
+ this.arena.set_content_start_delta(decl, 0);
276
+ this.arena.set_content_length(decl, prop_trimmed[1] - prop_trimmed[0]);
277
+ if (val_trimmed) {
278
+ let value_nodes = this.parse_feature_value(val_trimmed[0], val_trimmed[1]);
279
+ let value_node;
280
+ if (value_nodes.length === 0) value_node = this.arena.create_node(50, val_trimmed[0], 0, this.lexer.token_line, this.lexer.token_column);
281
+ else {
282
+ value_node = this.arena.create_node(50, val_trimmed[0], val_trimmed[1] - val_trimmed[0], this.lexer.token_line, this.lexer.token_column);
283
+ this.arena.append_children(value_node, value_nodes);
284
+ }
285
+ this.arena.append_children(decl, [value_node]);
286
+ }
287
+ let supports_decl = this.create_node(57, content_start, content_end);
288
+ this.arena.append_children(supports_decl, [decl]);
289
+ return supports_decl;
290
+ }
253
291
  parse_layer_names() {
254
292
  let nodes = [];
255
293
  while (this.lexer.pos < this.prelude_end) {
@@ -295,8 +333,8 @@ var AtRulePreludeParser = class {
295
333
  this.skip_whitespace();
296
334
  if (this.lexer.pos >= this.prelude_end) return [];
297
335
  let url_node = this.parse_import_url();
298
- if (url_node !== null) nodes.push(url_node);
299
- else return [];
336
+ if (url_node === null) return [];
337
+ nodes.push(url_node);
300
338
  this.skip_whitespace();
301
339
  if (this.lexer.pos >= this.prelude_end) return nodes;
302
340
  let layer_node = this.parse_import_layer();
@@ -1,6 +1,6 @@
1
- import { l as CSSDataArena } from "./arena-D6TANE5e.js";
1
+ import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
2
  import { n as Lexer } from "./tokenize-CyiJelQC.js";
3
- import { d as Declaration } from "./node-types-D282RMOz.js";
3
+ import { d as Declaration } from "./node-types-DJytj0FB.js";
4
4
 
5
5
  //#region src/parse-declaration.d.ts
6
6
  /** @internal */
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { l as CSSDataArena } from "./arena-CveFYH2l.js";
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-DMd5jbdm.js";
4
+ import { t as CSSNode } from "./css-node-C3t4b8Jt.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
- import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
- import { I as SelectorList } from "./node-types-D282RMOz.js";
1
+ import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
+ import { I as SelectorList } from "./node-types-DJytj0FB.js";
3
3
 
4
4
  //#region src/parse-selector.d.ts
5
5
  /** @internal */
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { l as CSSDataArena } from "./arena-CveFYH2l.js";
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-DMd5jbdm.js";
4
+ import { t as CSSNode } from "./css-node-C3t4b8Jt.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
@@ -53,7 +53,7 @@ var SelectorParser = class {
53
53
  continue;
54
54
  } else break;
55
55
  }
56
- if (selectors.length >= 1) {
56
+ if (selectors.length > 0) {
57
57
  let list_node = this.arena.create_node(20, list_start, this.lexer.pos - list_start, list_line, list_column);
58
58
  this.arena.append_children(list_node, selectors);
59
59
  return list_node;
@@ -77,8 +77,8 @@ var SelectorParser = class {
77
77
  }
78
78
  while (this.lexer.pos < this.selector_end) {
79
79
  let compound = this.parse_compound_selector();
80
- if (compound !== null) components.push(compound);
81
- else break;
80
+ if (compound === null) break;
81
+ components.push(compound);
82
82
  let combinator = this.try_parse_combinator();
83
83
  if (combinator !== null) {
84
84
  components.push(combinator);
@@ -115,11 +115,11 @@ var SelectorParser = class {
115
115
  if (this.lexer.token_start >= this.selector_end) break;
116
116
  if (this.lexer.token_type === 26) break;
117
117
  let part = this.parse_simple_selector();
118
- if (part !== null) parts.push(part);
119
- else {
118
+ if (part === null) {
120
119
  this.lexer.restore_position(saved);
121
120
  break;
122
121
  }
122
+ parts.push(part);
123
123
  }
124
124
  if (parts.length === 0) return null;
125
125
  for (let i = 0; i < parts.length - 1; i++) this.arena.set_next_sibling(parts[i], parts[i + 1]);
@@ -132,13 +132,14 @@ var SelectorParser = class {
132
132
  switch (token_type) {
133
133
  case 1: return this.parse_type_or_namespace_selector(start, end);
134
134
  case 4: return this.create_node(23, start, end);
135
- case 9:
135
+ case 9: {
136
136
  let ch = this.source.charCodeAt(start);
137
137
  if (ch === 46) return this.parse_class_selector(start);
138
138
  else if (ch === 42) return this.parse_universal_or_namespace_selector(start, end);
139
139
  else if (ch === 38) return this.create_node(29, start, end);
140
140
  else if (ch === 124) return this.parse_empty_namespace_selector(start);
141
141
  return null;
142
+ }
142
143
  case 19: return this.parse_attribute_selector(start);
143
144
  case 16: return this.parse_pseudo(start);
144
145
  case 2: return this.parse_pseudo_function(start, end);
@@ -148,7 +149,7 @@ var SelectorParser = class {
148
149
  default: return null;
149
150
  }
150
151
  }
151
- parse_namespace_local_part(selector_start, namespace_start, namespace_length) {
152
+ parse_namespace_local_part(selector_start, namespace_start, namespace_prefix_length) {
152
153
  const saved = this.lexer.save_position();
153
154
  this.lexer.next_token_fast(false);
154
155
  let node_type;
@@ -158,9 +159,14 @@ var SelectorParser = class {
158
159
  this.lexer.restore_position(saved);
159
160
  return null;
160
161
  }
161
- let node = this.create_node(node_type, selector_start, this.lexer.token_end);
162
- this.arena.set_content_start_delta(node, namespace_start - selector_start);
163
- this.arena.set_content_length(node, namespace_length);
162
+ let local_start = this.lexer.token_start;
163
+ let local_end = this.lexer.token_end;
164
+ let node = this.create_node(node_type, selector_start, local_end);
165
+ this.arena.set_flag(node, 16);
166
+ this.arena.set_content_start_delta(node, local_start - selector_start);
167
+ this.arena.set_content_length(node, local_end - local_start);
168
+ this.arena.set_value_start_delta(node, namespace_start - selector_start);
169
+ this.arena.set_value_length(node, namespace_prefix_length);
164
170
  return node;
165
171
  }
166
172
  parse_type_or_namespace_selector(start, end) {
@@ -171,8 +177,8 @@ var SelectorParser = class {
171
177
  this.lexer.pos++;
172
178
  let node = this.parse_namespace_local_part(start, start, end - start);
173
179
  if (node !== null) return node;
174
- this.lexer.restore_position(saved);
175
- } else this.lexer.restore_position(saved);
180
+ }
181
+ this.lexer.restore_position(saved);
176
182
  return this.create_node(21, start, end);
177
183
  }
178
184
  parse_universal_or_namespace_selector(start, end) {
@@ -182,12 +188,12 @@ var SelectorParser = class {
182
188
  this.lexer.pos++;
183
189
  let node = this.parse_namespace_local_part(start, start, end - start);
184
190
  if (node !== null) return node;
185
- this.lexer.restore_position(saved);
186
- } else this.lexer.restore_position(saved);
191
+ }
192
+ this.lexer.restore_position(saved);
187
193
  return this.create_node(28, start, end);
188
194
  }
189
195
  parse_empty_namespace_selector(start) {
190
- return this.parse_namespace_local_part(start, start, 1);
196
+ return this.parse_namespace_local_part(start, start, 0);
191
197
  }
192
198
  try_parse_combinator() {
193
199
  const saved_whitespace_start = this.lexer.save_position();
@@ -287,14 +293,11 @@ var SelectorParser = class {
287
293
  if (c === 92) pos += 2;
288
294
  else pos++;
289
295
  }
290
- value_end = pos;
291
- } else {
292
- while (pos < end) {
293
- if (is_whitespace(this.source.charCodeAt(pos))) break;
294
- pos++;
295
- }
296
- value_end = pos;
296
+ } else while (pos < end) {
297
+ if (is_whitespace(this.source.charCodeAt(pos))) break;
298
+ pos++;
297
299
  }
300
+ value_end = pos;
298
301
  if (value_end > value_start) {
299
302
  this.arena.set_value_start_delta(node, value_start - this.arena.get_start_offset(node));
300
303
  this.arena.set_value_length(node, value_end - value_start);
@@ -398,24 +401,24 @@ var SelectorParser = class {
398
401
  }
399
402
  parse_nth_expression(start, end) {
400
403
  let of_index = this.find_of_keyword(start, end);
401
- if (of_index !== -1) {
402
- let anplusb_node = new ANplusBParser(this.arena, this.source).parse_anplusb(start, of_index, this.lexer.line);
403
- let selector_start = of_index + 2;
404
- selector_start = skip_whitespace_forward(this.source, selector_start, end);
405
- let saved_selector_end = this.selector_end;
406
- const saved = this.lexer.save_position();
407
- this.selector_end = end;
408
- this.lexer.pos = selector_start;
409
- let selector_list = this.parse_selector_list();
410
- this.selector_end = saved_selector_end;
411
- this.lexer.restore_position(saved);
412
- let of_node = this.arena.create_node(31, start, end - start, this.lexer.line, 1);
413
- if (anplusb_node !== null && selector_list !== null) {
414
- this.arena.set_first_child(of_node, anplusb_node);
415
- this.arena.set_next_sibling(anplusb_node, selector_list);
416
- } else if (anplusb_node !== null) this.arena.set_first_child(of_node, anplusb_node);
417
- return of_node;
418
- } else return new ANplusBParser(this.arena, this.source).parse_anplusb(start, end, this.lexer.line);
404
+ let anplusb_parser = new ANplusBParser(this.arena, this.source);
405
+ if (of_index === -1) return anplusb_parser.parse_anplusb(start, end, this.lexer.line);
406
+ let anplusb_node = anplusb_parser.parse_anplusb(start, of_index, this.lexer.line);
407
+ let selector_start = of_index + 2;
408
+ selector_start = skip_whitespace_forward(this.source, selector_start, end);
409
+ let saved_selector_end = this.selector_end;
410
+ const saved = this.lexer.save_position();
411
+ this.selector_end = end;
412
+ this.lexer.pos = selector_start;
413
+ let selector_list = this.parse_selector_list();
414
+ this.selector_end = saved_selector_end;
415
+ this.lexer.restore_position(saved);
416
+ let of_node = this.arena.create_node(31, start, end - start, this.lexer.line, 1);
417
+ if (anplusb_node !== null && selector_list !== null) {
418
+ this.arena.set_first_child(of_node, anplusb_node);
419
+ this.arena.set_next_sibling(anplusb_node, selector_list);
420
+ } else if (anplusb_node !== null) this.arena.set_first_child(of_node, anplusb_node);
421
+ return of_node;
419
422
  }
420
423
  find_of_keyword(start, end) {
421
424
  let i = start;
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
- import { K as Value } from "./node-types-D282RMOz.js";
1
+ import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
+ import { q as Value } from "./node-types-DJytj0FB.js";
3
3
 
4
4
  //#region src/parse-value.d.ts
5
5
  /** @internal */
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { l as CSSDataArena } from "./arena-CveFYH2l.js";
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-DMd5jbdm.js";
4
+ import { t as CSSNode } from "./css-node-C3t4b8Jt.js";
5
5
  //#region src/parse-value.ts
6
6
  /** @internal */
7
7
  var ValueParser = class {
@@ -21,7 +21,7 @@ var ValueParser = class {
21
21
  let value_nodes = this.parse_value_tokens();
22
22
  if (value_nodes.length === 0) return this.arena.create_node(50, start, 0, start_line, start_column);
23
23
  let first_node_start = this.arena.get_start_offset(value_nodes[0]);
24
- let last_node_index = value_nodes[value_nodes.length - 1];
24
+ let last_node_index = value_nodes.at(-1);
25
25
  let last_node_end = this.arena.get_start_offset(last_node_index) + this.arena.get_length(last_node_index);
26
26
  let value_node = this.arena.create_node(50, first_node_start, last_node_end - first_node_start, start_line, start_column);
27
27
  this.arena.append_children(value_node, value_nodes);
package/dist/parse.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { l as CSSDataArena } from "./arena-D6TANE5e.js";
1
+ import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
2
  import { t as CommentInfo } from "./tokenize-CyiJelQC.js";
3
- import { z as StyleSheet } from "./node-types-D282RMOz.js";
3
+ import { z as StyleSheet } from "./node-types-DJytj0FB.js";
4
4
 
5
5
  //#region src/parse.d.ts
6
6
  interface ParserOptions {
package/dist/parse.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { l as CSSDataArena } from "./arena-CveFYH2l.js";
3
- import { t as CSSNode } from "./css-node-DMd5jbdm.js";
2
+ import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
3
+ import { t as CSSNode } from "./css-node-C3t4b8Jt.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";
@@ -35,7 +35,8 @@ var Parser = class {
35
35
  this.parse_selectors_enabled = opts.parse_selectors ?? true;
36
36
  this.parse_atrule_preludes_enabled = opts.parse_atrule_preludes ?? true;
37
37
  this.lexer = new Lexer(source, opts.on_comment);
38
- this.arena = new CSSDataArena(CSSDataArena.capacity_for_source(source.length));
38
+ let capacity = CSSDataArena.capacity_for_source(source.length);
39
+ this.arena = new CSSDataArena(capacity);
39
40
  this.selector_parser = this.parse_selectors_enabled ? new SelectorParser(this.arena, source) : null;
40
41
  this.prelude_parser = this.parse_atrule_preludes_enabled ? new AtRulePreludeParser(this.arena, source) : null;
41
42
  this.declaration_parser = new DeclarationParser(this.arena, source, this.parse_values_enabled);
@@ -61,8 +62,8 @@ var Parser = class {
61
62
  let rules = [];
62
63
  while (!this.is_eof()) {
63
64
  let rule = this.parse_rule();
64
- if (rule !== null) rules.push(rule);
65
- else this.next_token();
65
+ if (rule === null) this.next_token();
66
+ else rules.push(rule);
66
67
  }
67
68
  this.arena.append_children(stylesheet, rules);
68
69
  return new CSSNode(this.arena, this.source, stylesheet);
@@ -92,8 +93,8 @@ var Parser = class {
92
93
  if (token_type === 24) break;
93
94
  if (token_type === 3) {
94
95
  let nested_at_rule = this.parse_atrule();
95
- if (nested_at_rule !== null) block_children.push(nested_at_rule);
96
- else this.next_token();
96
+ if (nested_at_rule === null) this.next_token();
97
+ else block_children.push(nested_at_rule);
97
98
  continue;
98
99
  }
99
100
  let declaration = this.parse_declaration();
@@ -103,8 +104,8 @@ var Parser = class {
103
104
  continue;
104
105
  }
105
106
  let nested_rule = this.parse_style_rule();
106
- if (nested_rule !== null) block_children.push(nested_rule);
107
- else this.next_token();
107
+ if (nested_rule === null) this.next_token();
108
+ else block_children.push(nested_rule);
108
109
  }
109
110
  let block_end = this.lexer.token_start;
110
111
  let rule_end = this.lexer.token_end;
@@ -195,16 +196,16 @@ var Parser = class {
195
196
  if (has_declarations) while (!this.is_eof()) {
196
197
  if (this.peek_type() === 24) break;
197
198
  let declaration = this.parse_declaration();
198
- if (declaration !== null) block_children.push(declaration);
199
- else this.next_token();
199
+ if (declaration === null) this.next_token();
200
+ else block_children.push(declaration);
200
201
  }
201
202
  else while (!this.is_eof()) {
202
203
  let token_type = this.peek_type();
203
204
  if (token_type === 24) break;
204
205
  if (token_type === 3) {
205
206
  let nested_at_rule = this.parse_atrule();
206
- if (nested_at_rule !== null) block_children.push(nested_at_rule);
207
- else this.next_token();
207
+ if (nested_at_rule === null) this.next_token();
208
+ else block_children.push(nested_at_rule);
208
209
  continue;
209
210
  }
210
211
  let declaration = this.parse_declaration();
@@ -213,8 +214,8 @@ var Parser = class {
213
214
  continue;
214
215
  }
215
216
  let nested_rule = this.parse_style_rule();
216
- if (nested_rule !== null) block_children.push(nested_rule);
217
- else this.next_token();
217
+ if (nested_rule === null) this.next_token();
218
+ else block_children.push(nested_rule);
218
219
  }
219
220
  if (this.peek_type() === 24) {
220
221
  let block_end = this.lexer.token_start;
@@ -228,12 +229,11 @@ var Parser = class {
228
229
  at_rule_children.push(block_node);
229
230
  this.arena.set_length(at_rule, last_end - at_rule_start);
230
231
  this.arena.append_children(at_rule, at_rule_children);
231
- } else if (this.peek_type() === 17) {
232
- last_end = this.lexer.token_end;
233
- this.next_token();
234
- this.arena.set_length(at_rule, last_end - at_rule_start);
235
- if (prelude_wrapper !== null) this.arena.append_children(at_rule, [prelude_wrapper]);
236
232
  } else {
233
+ if (this.peek_type() === 17) {
234
+ last_end = this.lexer.token_end;
235
+ this.next_token();
236
+ }
237
237
  this.arena.set_length(at_rule, last_end - at_rule_start);
238
238
  if (prelude_wrapper !== null) this.arena.append_children(at_rule, [prelude_wrapper]);
239
239
  }
package/dist/walk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as CSSNode, t as AnyNode } from "./node-types-D282RMOz.js";
1
+ import { o as CSSNode, t as AnyNode } from "./node-types-DJytj0FB.js";
2
2
 
3
3
  //#region src/walk.d.ts
4
4
  declare const SKIP: unique symbol;
package/dist/walk.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./arena-CveFYH2l.js";
1
+ import "./arena-DnV0a_Ne.js";
2
2
  import "./constants.js";
3
3
  //#region src/walk.ts
4
4
  const SKIP = Symbol("SKIP");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectwallace/css-parser",
3
- "version": "0.14.10",
3
+ "version": "0.15.0",
4
4
  "description": "High-performance CSS lexer and parser, optimized for CSS inspection and analysis",
5
5
  "keywords": [
6
6
  "ast",
@@ -83,22 +83,22 @@
83
83
  "precommit": "npm run test -- --run; npm run lint; npm run check"
84
84
  },
85
85
  "devDependencies": {
86
- "@codecov/rollup-plugin": "^1.9.1",
87
- "@projectwallace/preset-oxlint": "^0.0.7",
86
+ "@codecov/rollup-plugin": "^2.0.1",
87
+ "@projectwallace/preset-oxlint": "^0.0.10",
88
88
  "@types/node": "^24.10.1",
89
- "@vitest/coverage-v8": "^4.0.8",
89
+ "@vitest/coverage-v8": "^4.1.5",
90
90
  "bootstrap": "^5.3.8",
91
91
  "css-tree": "^3.1.0",
92
- "knip": "^6.0.1",
93
- "oxfmt": "^0.43.0",
94
- "oxlint": "^1.28.0",
92
+ "knip": "^6.11.0",
93
+ "oxfmt": "^0.47.0",
94
+ "oxlint": "^1.62.0",
95
95
  "postcss": "^8.5.6",
96
96
  "publint": "^0.3.18",
97
97
  "tailwindcss": "^2.2.8",
98
- "tinybench": "^6.0.0",
98
+ "tinybench": "^6.0.1",
99
99
  "tsdown": "^0.21.0",
100
- "typescript": "^6.0.2",
101
- "vitest": "^4.0.8"
100
+ "typescript": "^6.0.3",
101
+ "vitest": "^4.1.5"
102
102
  },
103
103
  "issues": "https://github.com/projectwallace/css-parser/issues"
104
104
  }