@projectwallace/css-parser 0.13.10 → 0.13.11

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.
@@ -301,6 +301,16 @@ var CSSNode = class CSSNode {
301
301
  }
302
302
  return this.arena.has_children(this.index);
303
303
  }
304
+ /** Count children without allocating an intermediate array */
305
+ get child_count() {
306
+ let count = 0;
307
+ let child_index = this.arena.get_first_child(this.index);
308
+ while (child_index !== 0) {
309
+ count++;
310
+ child_index = this.arena.get_next_sibling(child_index);
311
+ }
312
+ return count;
313
+ }
304
314
  /** Get all children as an array */
305
315
  get children() {
306
316
  let result = [];
@@ -180,6 +180,8 @@ declare class CSSNode {
180
180
  * This allows formatters to distinguish :lang() from :hover
181
181
  */
182
182
  get has_children(): boolean;
183
+ /** Count children without allocating an intermediate array */
184
+ get child_count(): number;
183
185
  /** Get all children as an array */
184
186
  get children(): CSSNode[];
185
187
  /** Make CSSNode iterable over its children */
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { A as MEDIA_FEATURE, B as PSEUDO_CLASS_SELECTOR, C as FLAG_IMPORTANT, D as ID_SELECTOR, E as IDENTIFIER, F as NTH_SELECTOR, G as STRING, H as RAW, I as NUMBER, J as SUPPORTS_QUERY, K as STYLESHEET, L as OPERATOR, M as MEDIA_TYPE, N as NESTING_SELECTOR, O as LANG_SELECTOR, P as NTH_OF_SELECTOR, Q as VALUE, R as PARENTHESIS, S as FEATURE_RANGE, T as HASH, U as SELECTOR, V as PSEUDO_ELEMENT_SELECTOR, W as SELECTOR_LIST, X as UNIVERSAL_SELECTOR, Y as TYPE_SELECTOR, Z as URL, _ as COMMENT, a as ATTR_OPERATOR_CARET_EQUAL, b as DECLARATION, c as ATTR_OPERATOR_NONE, d as ATTR_OPERATOR_TILDE_EQUAL, f as AT_RULE, g as COMBINATOR, h as CLASS_SELECTOR, i as ATTR_FLAG_NONE, j as MEDIA_QUERY, k as LAYER_NAME, l as ATTR_OPERATOR_PIPE_EQUAL, m as BLOCK, n as ATTR_FLAG_CASE_INSENSITIVE, o as ATTR_OPERATOR_DOLLAR_EQUAL, p as AT_RULE_PRELUDE, q as STYLE_RULE, r as ATTR_FLAG_CASE_SENSITIVE, s as ATTR_OPERATOR_EQUAL, t as ATTRIBUTE_SELECTOR, u as ATTR_OPERATOR_STAR_EQUAL, v as CONTAINER_QUERY, w as FUNCTION, x as DIMENSION, z as PRELUDE_OPERATOR } from "./arena-BtlVZlkG.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 { a as CloneOptions, i as CSSNodeType, n as ATTR_OPERATOR_NAMES, o as PlainCSSNode, r as CSSNode, s as TYPE_NAMES, t as ATTR_FLAG_NAMES } from "./css-node-B9tSb6YD.js";
4
+ import { a as CloneOptions, i as CSSNodeType, n as ATTR_OPERATOR_NAMES, o as PlainCSSNode, r as CSSNode, s as TYPE_NAMES, t as ATTR_FLAG_NAMES } from "./css-node-CudZ-lzp.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";
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
2
  import { A as MEDIA_FEATURE, B as PSEUDO_CLASS_SELECTOR, C as FLAG_IMPORTANT, D as ID_SELECTOR, E as IDENTIFIER, F as NTH_SELECTOR, G as STRING, H as RAW, I as NUMBER, J as SUPPORTS_QUERY, K as STYLESHEET, L as OPERATOR, M as MEDIA_TYPE, N as NESTING_SELECTOR, O as LANG_SELECTOR, P as NTH_OF_SELECTOR, Q as VALUE, R as PARENTHESIS, S as FEATURE_RANGE, T as HASH, U as SELECTOR, V as PSEUDO_ELEMENT_SELECTOR, W as SELECTOR_LIST, X as UNIVERSAL_SELECTOR, Y as TYPE_SELECTOR, Z as URL, _ as COMMENT, a as ATTR_OPERATOR_CARET_EQUAL, b as DECLARATION, c as ATTR_OPERATOR_NONE, d as ATTR_OPERATOR_TILDE_EQUAL, f as AT_RULE, g as COMBINATOR, h as CLASS_SELECTOR, i as ATTR_FLAG_NONE, j as MEDIA_QUERY, k as LAYER_NAME, l as ATTR_OPERATOR_PIPE_EQUAL, m as BLOCK, n as ATTR_FLAG_CASE_INSENSITIVE, o as ATTR_OPERATOR_DOLLAR_EQUAL, p as AT_RULE_PRELUDE, q as STYLE_RULE, r as ATTR_FLAG_CASE_SENSITIVE, s as ATTR_OPERATOR_EQUAL, t as ATTRIBUTE_SELECTOR, u as ATTR_OPERATOR_STAR_EQUAL, v as CONTAINER_QUERY, w as FUNCTION, x as DIMENSION, z as PRELUDE_OPERATOR } from "./arena-CDAx4eAB.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 { i as TYPE_NAMES, n as ATTR_OPERATOR_NAMES, r as CSSNode, t as ATTR_FLAG_NAMES } from "./css-node-CZf-PvCf.js";
4
+ import { i as TYPE_NAMES, n as ATTR_OPERATOR_NAMES, r as CSSNode, t as ATTR_FLAG_NAMES } from "./css-node-BYpol6td.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";
@@ -1,5 +1,5 @@
1
1
  import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
2
+ import { r as CSSNode } from "./css-node-CudZ-lzp.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
2
  import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
3
3
  import { o as str_equals, s as str_index_of } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { r as CSSNode } from "./css-node-BYpol6td.js";
5
5
  //#region src/parse-anplusb.ts
6
6
  /** @internal */
7
7
  var ANplusBParser = class {
@@ -1,5 +1,5 @@
1
1
  import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
2
+ import { r as CSSNode } from "./css-node-CudZ-lzp.js";
3
3
 
4
4
  //#region src/parse-atrule-prelude.d.ts
5
5
  /** @internal */
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
2
  import { y as CSSDataArena } from "./arena-CDAx4eAB.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 { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { r as CSSNode } from "./css-node-BYpol6td.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 */
@@ -1,6 +1,6 @@
1
1
  import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
2
  import { n as Lexer } from "./tokenize-CyiJelQC.js";
3
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
3
+ import { r as CSSNode } from "./css-node-CudZ-lzp.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
2
  import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
3
3
  import { i as is_vendor_prefixed } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { r as CSSNode } from "./css-node-BYpol6td.js";
5
5
  import { i as trim_boundaries } from "./parse-utils-BxrmqJxI.js";
6
6
  import { ValueParser } from "./parse-value.js";
7
7
  //#region src/parse-declaration.ts
@@ -1,5 +1,5 @@
1
1
  import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
2
+ import { r as CSSNode } from "./css-node-CudZ-lzp.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
2
  import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
3
3
  import { a as is_whitespace, n as is_combinator, o as str_equals } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { r as CSSNode } from "./css-node-BYpol6td.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
@@ -1,5 +1,5 @@
1
1
  import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
2
+ import { r as CSSNode } from "./css-node-CudZ-lzp.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
2
  import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
3
3
  import { a as is_whitespace, o as str_equals } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { r as CSSNode } from "./css-node-BYpol6td.js";
5
5
  //#region src/parse-value.ts
6
6
  /** @internal */
7
7
  var ValueParser = class {
package/dist/parse.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
2
  import { t as CommentInfo } from "./tokenize-CyiJelQC.js";
3
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
3
+ import { r as CSSNode } from "./css-node-CudZ-lzp.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
2
  import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
3
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
3
+ import { r as CSSNode } from "./css-node-BYpol6td.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";
package/dist/walk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
1
+ import { r as CSSNode } from "./css-node-CudZ-lzp.js";
2
2
 
3
3
  //#region src/walk.d.ts
4
4
  declare const SKIP: unique symbol;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectwallace/css-parser",
3
- "version": "0.13.10",
3
+ "version": "0.13.11",
4
4
  "description": "High-performance CSS lexer and parser, optimized for CSS inspection and analysis",
5
5
  "keywords": [
6
6
  "ast",