@projectwallace/css-parser 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,19 +3,18 @@
3
3
  > [!WARNING]
4
4
  > This is a very experimental CSS parser. Expect several bugs and inconveniences!
5
5
 
6
- **High-performance CSS parser optimized for static analysis and formatting**
6
+ **High-performance CSS parser built for static analysis and tooling**
7
7
 
8
- Built for speed and efficiency, this parser handles large CSS files with minimal memory overhead and blazing-fast parse times. Designed with a data-oriented architecture using a single contiguous memory arena for zero allocations during parsing.
8
+ Parses large CSS files in microseconds with a fixed-size memory arena — no garbage collection pressure, no per-node allocations, no surprises. If you're building a formatter, linter, or analysis tool and need raw speed with precise source locations, this is built for that.
9
9
 
10
- This parser was heavily influenced by [CSSTree](https://github.com/csstree/csstree), one of the most robust CSS parsers available. Some of the parsing mechanics are taken from CSSTree, as well as some of the performance mechanics, but a lot of things are very different which is why this isn't a direct fork and there is very little overlap in API's.
10
+ Heavily influenced by [CSSTree](https://github.com/csstree/csstree). Some parsing mechanics are shared, but the memory model, architecture, and API are fundamentally different — not a fork.
11
11
 
12
12
  ## Features
13
13
 
14
- - **Modern CSS support** - CSS Nesting, `:is()`, `:where()`, `:has()`, `@layer`, `@container`
15
- - **Error recovery** - Continues parsing on malformed CSS
16
- - **Location tracking** - Line, column, offset, and length for all nodes
17
- - **Performance** - Low memory usage and excellent parsing speed
18
- - **Small bundle size** - Fast download and installation in any environment
14
+ - **Full modern CSS** — CSS Nesting, `:is()`, `:where()`, `:has()`, `@layer`, `@container`
15
+ - **Error-tolerant** — keeps parsing through malformed input; one bad rule won't kill the file
16
+ - **Precise source locations** — line, column, offset, and length on every node
17
+ - **Tiny footprint** — tree-shakeable subparsers; as small as 278 bytes gzipped, < 16 kB kB worst case
19
18
 
20
19
  ## Installation
21
20
 
@@ -59,20 +58,36 @@ for (const rule of ast) {
59
58
 
60
59
  ## Performance
61
60
 
62
- - **Small install size** (~200kB)
63
- - **Zero allocations during parsing** - all memory allocated upfront based on real world heuristics, which also helps prevent garbage collection running often
64
- - **Cache-friendly data layout** - contiguous memory for sequential access powered by concepts of Data Oriented Design
65
- - **First-class comment and location support** - while still being performant because analysis requires constant access to lines and columns
66
- - **No syntax validation** - focusing only on the raw data we can skip expensive syntax files and MDN data syncs
61
+ - **Zero allocations during parsing** — memory is reserved upfront using real-world heuristics; the GC never runs mid-parse
62
+ - **Cache-friendly layout** — all nodes live in a single contiguous arena, making sequential access fast
63
+ - **Location tracking with no penalty** — full line, column, and offset data without slowing the parser down
64
+ - **No syntax validation** — skipping spec checks and MDN data means nothing gets in the way of speed
65
+
66
+ ### Bundle sizes
67
+
68
+ All sizes are minified and bundled with dependencies. Import only what you need — bundlers will tree-shake the rest.
69
+
70
+ | Import | Description | Minified | Gzip |
71
+ | ------------------------------------------------- | ---------------------------- | -------- | ------- |
72
+ | `@projectwallace/css-parser` | Full parser (all subparsers) | 68.9 kB | 15.5 kB |
73
+ | `@projectwallace/css-parser/parse` | CSS stylesheet parser | 62.2 kB | 13.3 kB |
74
+ | `@projectwallace/css-parser/parse-atrule-prelude` | At-rule prelude parser | 35.4 kB | 8.4 kB |
75
+ | `@projectwallace/css-parser/parse-selector` | Selector parser | 37.7 kB | 8.9 kB |
76
+ | `@projectwallace/css-parser/parse-anplusb` | An+B syntax parser | 26.1 kB | 6.6 kB |
77
+ | `@projectwallace/css-parser/parse-declaration` | Declaration parser | 28.3 kB | 7.3 kB |
78
+ | `@projectwallace/css-parser/parse-value` | Value parser | 25.2 kB | 6.6 kB |
79
+ | `@projectwallace/css-parser/parse-dimension` | Dimension parser | 0.4 kB | 0.3 kB |
80
+ | `@projectwallace/css-parser/tokenizer` | Tokenizer | 9.8 kB | 2.4 kB |
67
81
 
68
82
  ## Documentation
69
83
 
70
- See [API.md](./API.md) for complete documentation of all parser functions and options.
84
+ See [API.md](./API.md) for complete documentation of all parser functions and nodes.
71
85
 
72
86
  ## Non-goals
73
87
 
74
- - **No syntax validation** - this parser does not try to validate your CSS structure. Everything can be anything
75
- - **No custom syntax support** - we're leaving the era of CSS preprocessors so we only focus on CSS
88
+ - **No syntax validation** — CSS structure is your responsibility; the parser accepts anything valid or not
89
+ - **No preprocessor syntax** — Sass, Less, and Stylus are out of scope; this parser targets plain CSS only
90
+ - **Tree operations** - Manipulating the AST is not within scope of this library
76
91
 
77
92
  ## License
78
93
 
@@ -52,13 +52,13 @@ var CSSDataArena = class CSSDataArena {
52
52
  growth_count;
53
53
  overflow_lengths;
54
54
  static GROWTH_FACTOR = 1.3;
55
- static NODES_PER_KB = 325;
56
- static CAPACITY_BUFFER = 1.2;
55
+ static NODES_PER_KB = 210;
56
+ static CAPACITY_BUFFER = 1.1;
57
57
  constructor(initial_capacity = 1024) {
58
58
  this.capacity = initial_capacity;
59
59
  this.count = 1;
60
60
  this.growth_count = 0;
61
- this.buffer = new ArrayBuffer(initial_capacity * BYTES_PER_NODE);
61
+ this.buffer = /* @__PURE__ */ new ArrayBuffer(initial_capacity * BYTES_PER_NODE);
62
62
  this.view = new DataView(this.buffer);
63
63
  this.overflow_lengths = /* @__PURE__ */ new Map();
64
64
  }
@@ -154,7 +154,7 @@ var CSSDataArena = class CSSDataArena {
154
154
  grow() {
155
155
  this.growth_count++;
156
156
  let new_capacity = Math.ceil(this.capacity * CSSDataArena.GROWTH_FACTOR);
157
- let new_buffer = new ArrayBuffer(new_capacity * BYTES_PER_NODE);
157
+ let new_buffer = /* @__PURE__ */ new ArrayBuffer(new_capacity * BYTES_PER_NODE);
158
158
  new Uint8Array(new_buffer).set(new Uint8Array(this.buffer));
159
159
  this.buffer = new_buffer;
160
160
  this.view = new DataView(new_buffer);
@@ -178,6 +178,22 @@ var CSSDataArena = class CSSDataArena {
178
178
  this.view.setUint32(offset + 4, children[0], true);
179
179
  for (let i = 0; i < children.length - 1; i++) this.set_next_sibling(children[i], children[i + 1]);
180
180
  }
181
+ /**
182
+ * Shrink the buffer to exactly the number of live nodes, releasing wasted capacity.
183
+ * Call once after parsing is complete. Safe to call multiple times (no-op if already tight).
184
+ *
185
+ * @see https://doc.rust-lang.org/std/vec/struct.Vec.html#method.shrink_to_fit
186
+ * @see https://en.cppreference.com/w/cpp/container/vector/shrink_to_fit
187
+ */
188
+ trim() {
189
+ if (this.count === this.capacity) return;
190
+ let byte_count = this.count * BYTES_PER_NODE;
191
+ let new_buffer = new ArrayBuffer(byte_count);
192
+ new Uint8Array(new_buffer).set(new Uint8Array(this.buffer, 0, byte_count));
193
+ this.buffer = new_buffer;
194
+ this.view = new DataView(new_buffer);
195
+ this.capacity = this.count;
196
+ }
181
197
  has_children(node_index) {
182
198
  return this.get_first_child(node_index) !== 0;
183
199
  }
@@ -84,6 +84,14 @@ declare class CSSDataArena {
84
84
  private grow;
85
85
  create_node(type: number, start_offset: number, length: number, start_line: number, start_column: number): number;
86
86
  append_children(parent_index: number, children: number[]): void;
87
+ /**
88
+ * Shrink the buffer to exactly the number of live nodes, releasing wasted capacity.
89
+ * Call once after parsing is complete. Safe to call multiple times (no-op if already tight).
90
+ *
91
+ * @see https://doc.rust-lang.org/std/vec/struct.Vec.html#method.shrink_to_fit
92
+ * @see https://en.cppreference.com/w/cpp/container/vector/shrink_to_fit
93
+ */
94
+ trim(): void;
87
95
  has_children(node_index: number): boolean;
88
96
  has_next_sibling(node_index: number): boolean;
89
97
  set_flag(node_index: number, flag: number): void;
@@ -1,4 +1,4 @@
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";
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-DfpuGV9Y.js";
2
2
 
3
3
  //#region src/constants.d.ts
4
4
  declare const NODE_TYPES: {
package/dist/constants.js CHANGED
@@ -1,4 +1,4 @@
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";
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-CCye9VYE.js";
2
2
  //#region src/constants.ts
3
3
  const NODE_TYPES = {
4
4
  STYLESHEET: 1,
@@ -1,5 +1,5 @@
1
- import "./arena-DnV0a_Ne.js";
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";
1
+ import "./arena-CCye9VYE.js";
2
+ import { a as is_whitespace, c as str_starts_with, i as is_vendor_prefixed, t as parse_dimension } from "./parse-dimension-B0AZRxxt.js";
3
3
  //#region src/css-node.ts
4
4
  const TYPE_NAMES = {
5
5
  [1]: "StyleSheet",
@@ -46,7 +46,7 @@ const TYPE_NAMES = {
46
46
  [40]: "AtrulePrelude",
47
47
  [41]: "PreludeSelectorList"
48
48
  };
49
- const nodes_with_name = new Set([
49
+ const nodes_with_name = /* @__PURE__ */ new Set([
50
50
  3,
51
51
  10,
52
52
  15,
@@ -62,7 +62,7 @@ const nodes_with_name = new Set([
62
62
  37,
63
63
  39
64
64
  ]);
65
- const nodes_with_children = new Set([
65
+ const nodes_with_children = /* @__PURE__ */ new Set([
66
66
  1,
67
67
  5,
68
68
  20,
@@ -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);
@@ -179,7 +187,7 @@ var CSSNode = class CSSNode {
179
187
  if (type === 4 && first_child) return first_child;
180
188
  if (type === 33) return first_child ?? null;
181
189
  if (type === 12) return parse_dimension(text).value;
182
- if (type === 11) return Number.parseFloat(text);
190
+ if (type === 11) return Number(text);
183
191
  if (type === 18) {
184
192
  if (first_child?.type === 13) return first_child.text;
185
193
  if (str_starts_with(text, "url(")) {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
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";
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-DfpuGV9Y.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-DeZYFa9R.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-BrZu8T2C.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";
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
- 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";
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-BiRLfVbm.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-CCye9VYE.js";
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-B0AZRxxt.js";
4
+ import { n as TYPE_NAMES } from "./css-node-CuLhABl8.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 };
@@ -1,4 +1,4 @@
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";
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-DfpuGV9Y.js";
2
2
 
3
3
  //#region src/css-node.d.ts
4
4
  declare const TYPE_NAMES: {
@@ -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
- import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { T as NthSelector } from "./node-types-DJytj0FB.js";
1
+ import { l as CSSDataArena } from "./arena-DfpuGV9Y.js";
2
+ import { T as NthSelector } from "./node-types-BrZu8T2C.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";
2
- import { l as CSSDataArena } from "./arena-DnV0a_Ne.js";
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";
1
+ import { t as Lexer } from "./tokenize-BiRLfVbm.js";
2
+ import { l as CSSDataArena } from "./arena-CCye9VYE.js";
3
+ import { o as str_equals, s as str_index_of } from "./parse-dimension-B0AZRxxt.js";
4
+ import { t as CSSNode } from "./css-node-CuLhABl8.js";
5
5
  //#region src/parse-anplusb.ts
6
6
  /** @internal */
7
7
  var ANplusBParser = class {
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-CSK5NfHq.js";
2
- import { t as AnyNode } from "./node-types-DJytj0FB.js";
1
+ import { l as CSSDataArena } from "./arena-DfpuGV9Y.js";
2
+ import { t as AnyNode } from "./node-types-BrZu8T2C.js";
3
3
 
4
4
  //#region src/parse-atrule-prelude.d.ts
5
5
  /** @internal */