@projectwallace/css-parser 0.18.2 → 0.18.5

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.
@@ -18,6 +18,7 @@ const OPERATOR = 16;
18
18
  const PARENTHESIS = 17;
19
19
  const URL = 18;
20
20
  const UNICODE_RANGE = 19;
21
+ const IF_BRANCH = 59;
21
22
  const SELECTOR_LIST = 20;
22
23
  const TYPE_SELECTOR = 21;
23
24
  const CLASS_SELECTOR = 22;
@@ -41,6 +42,7 @@ const PRELUDE_OPERATOR = 38;
41
42
  const FEATURE_RANGE = 39;
42
43
  const AT_RULE_PRELUDE = 40;
43
44
  const SUPPORTS_DECLARATION = 57;
45
+ const RATIO = 58;
44
46
  const VALUE = 50;
45
47
  const FLAG_IMPORTANT = 1;
46
48
  /** @internal */
@@ -216,4 +218,4 @@ var CSSDataArena = class CSSDataArena {
216
218
  }
217
219
  };
218
220
  //#endregion
219
- 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 };
221
+ export { PRELUDE_OPERATOR as A, SUPPORTS_DECLARATION as B, MEDIA_TYPE as C, NUMBER as D, NTH_SELECTOR as E, SELECTOR as F, URL as G, TYPE_SELECTOR as H, SELECTOR_LIST as I, VALUE as K, STRING as L, PSEUDO_ELEMENT_SELECTOR as M, RATIO as N, OPERATOR as O, RAW as P, STYLESHEET as R, MEDIA_QUERY as S, NTH_OF_SELECTOR as T, UNICODE_RANGE as U, SUPPORTS_QUERY as V, UNIVERSAL_SELECTOR as W, ID_SELECTOR as _, CLASS_SELECTOR as a, LAYER_NAME 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, PARENTHESIS 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, IF_BRANCH as v, NESTING_SELECTOR as w, MEDIA_FEATURE as x, LANG_SELECTOR as y, STYLE_RULE as z };
@@ -17,6 +17,7 @@ declare const OPERATOR = 16;
17
17
  declare const PARENTHESIS = 17;
18
18
  declare const URL = 18;
19
19
  declare const UNICODE_RANGE = 19;
20
+ declare const IF_BRANCH = 59;
20
21
  declare const SELECTOR_LIST = 20;
21
22
  declare const TYPE_SELECTOR = 21;
22
23
  declare const CLASS_SELECTOR = 22;
@@ -41,6 +42,7 @@ declare const FEATURE_RANGE = 39;
41
42
  declare const AT_RULE_PRELUDE = 40;
42
43
  declare const PRELUDE_SELECTORLIST = 41;
43
44
  declare const SUPPORTS_DECLARATION = 57;
45
+ declare const RATIO = 58;
44
46
  declare const VALUE = 50;
45
47
  declare const FLAG_IMPORTANT: number;
46
48
  /** @internal */
@@ -94,4 +96,4 @@ declare class CSSDataArena {
94
96
  has_flag(node_index: number, flag: number): boolean;
95
97
  }
96
98
  //#endregion
97
- 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 };
99
+ export { PRELUDE_OPERATOR as A, STYLE_RULE as B, MEDIA_TYPE as C, NUMBER as D, NTH_SELECTOR as E, RAW as F, UNIVERSAL_SELECTOR as G, SUPPORTS_QUERY as H, SELECTOR as I, URL as K, SELECTOR_LIST as L, PSEUDO_CLASS_SELECTOR as M, PSEUDO_ELEMENT_SELECTOR as N, OPERATOR as O, RATIO as P, STRING as R, MEDIA_QUERY as S, NTH_OF_SELECTOR as T, TYPE_SELECTOR as U, SUPPORTS_DECLARATION as V, UNICODE_RANGE as W, ID_SELECTOR as _, CLASS_SELECTOR as a, LAYER_NAME as b, CONTAINER_QUERY as c, DIMENSION as d, FEATURE_RANGE as f, IDENTIFIER as g, HASH as h, BLOCK as i, PRELUDE_SELECTORLIST as j, PARENTHESIS as k, CSSDataArena as l, FUNCTION as m, AT_RULE as n, COMBINATOR as o, FLAG_IMPORTANT as p, VALUE as q, AT_RULE_PRELUDE as r, COMMENT as s, ATTRIBUTE_SELECTOR as t, DECLARATION as u, IF_BRANCH as v, NESTING_SELECTOR as w, MEDIA_FEATURE as x, LANG_SELECTOR as y, STYLESHEET as z };
@@ -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-Bx5vp6Sl.js";
1
+ import { A as PRELUDE_OPERATOR, B as STYLE_RULE, C as MEDIA_TYPE, D as NUMBER, E as NTH_SELECTOR, F as RAW, G as UNIVERSAL_SELECTOR, H as SUPPORTS_QUERY, I as SELECTOR, K as URL, L as SELECTOR_LIST, M as PSEUDO_CLASS_SELECTOR, N as PSEUDO_ELEMENT_SELECTOR, O as OPERATOR, P as RATIO, R as STRING, S as MEDIA_QUERY, T as NTH_OF_SELECTOR, U as TYPE_SELECTOR, V as SUPPORTS_DECLARATION, W as UNICODE_RANGE, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LAYER_NAME, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, k as PARENTHESIS, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, q as VALUE, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as NESTING_SELECTOR, x as MEDIA_FEATURE, y as LANG_SELECTOR, z as STYLESHEET } from "./arena-DcrS77hW.js";
2
2
  //#region src/constants.d.ts
3
3
  declare const NODE_TYPES: {
4
4
  readonly STYLESHEET: 1;
@@ -19,6 +19,7 @@ declare const NODE_TYPES: {
19
19
  readonly PARENTHESIS: 17;
20
20
  readonly URL: 18;
21
21
  readonly UNICODE_RANGE: 19;
22
+ readonly IF_BRANCH: 59;
22
23
  readonly VALUE: 50;
23
24
  readonly SELECTOR_LIST: 20;
24
25
  readonly TYPE_SELECTOR: 21;
@@ -43,6 +44,7 @@ declare const NODE_TYPES: {
43
44
  readonly PRELUDE_OPERATOR: 38;
44
45
  readonly FEATURE_RANGE: 39;
45
46
  readonly AT_RULE_PRELUDE: 40;
47
+ readonly RATIO: 58;
46
48
  };
47
49
  //#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_DECLARATION, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
50
+ 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, IF_BRANCH, 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, RATIO, 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 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-CFwM4uQs.js";
1
+ import { A as PRELUDE_OPERATOR, B as SUPPORTS_DECLARATION, C as MEDIA_TYPE, D as NUMBER, E as NTH_SELECTOR, F as SELECTOR, G as URL, H as TYPE_SELECTOR, I as SELECTOR_LIST, K as VALUE, L as STRING, M as PSEUDO_ELEMENT_SELECTOR, N as RATIO, O as OPERATOR, P as RAW, R as STYLESHEET, S as MEDIA_QUERY, T as NTH_OF_SELECTOR, U as UNICODE_RANGE, V as SUPPORTS_QUERY, W as UNIVERSAL_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LAYER_NAME, 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 PARENTHESIS, 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 IF_BRANCH, w as NESTING_SELECTOR, x as MEDIA_FEATURE, y as LANG_SELECTOR, z as STYLE_RULE } from "./arena-DKhfTFT5.js";
2
2
  //#region src/constants.ts
3
3
  const NODE_TYPES = {
4
4
  STYLESHEET: 1,
@@ -19,6 +19,7 @@ const NODE_TYPES = {
19
19
  PARENTHESIS: 17,
20
20
  URL: 18,
21
21
  UNICODE_RANGE: 19,
22
+ IF_BRANCH: 59,
22
23
  VALUE: 50,
23
24
  SELECTOR_LIST: 20,
24
25
  TYPE_SELECTOR: 21,
@@ -42,7 +43,8 @@ const NODE_TYPES = {
42
43
  LAYER_NAME: 37,
43
44
  PRELUDE_OPERATOR: 38,
44
45
  FEATURE_RANGE: 39,
45
- AT_RULE_PRELUDE: 40
46
+ AT_RULE_PRELUDE: 40,
47
+ RATIO: 58
46
48
  };
47
49
  //#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_DECLARATION, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
50
+ 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, IF_BRANCH, 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, RATIO, RAW, SELECTOR, SELECTOR_LIST, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
@@ -1,5 +1,5 @@
1
- import "./arena-CFwM4uQs.js";
2
- import { a as is_whitespace, c as str_starts_with, i as is_vendor_prefixed, t as parse_dimension } from "./parse-dimension-ouWXNHdx.js";
1
+ import "./arena-DKhfTFT5.js";
2
+ import { a as is_whitespace, c as str_starts_with, i as is_vendor_prefixed, o as str_equals, t as parse_dimension } from "./parse-dimension-ouWXNHdx.js";
3
3
  //#region src/css-node.ts
4
4
  const TYPE_NAMES = {
5
5
  [1]: "StyleSheet",
@@ -44,7 +44,9 @@ const TYPE_NAMES = {
44
44
  [38]: "Operator",
45
45
  [39]: "MediaFeatureRange",
46
46
  [40]: "AtrulePrelude",
47
- [41]: "PreludeSelectorList"
47
+ [41]: "PreludeSelectorList",
48
+ [58]: "Ratio",
49
+ [59]: "IfBranch"
48
50
  };
49
51
  const nodes_with_name = /* @__PURE__ */ new Set([
50
52
  3,
@@ -78,7 +80,8 @@ const nodes_with_children = /* @__PURE__ */ new Set([
78
80
  35,
79
81
  39,
80
82
  36,
81
- 57
83
+ 57,
84
+ 59
82
85
  ]);
83
86
  const enumerable_properties = [
84
87
  "name",
@@ -91,10 +94,14 @@ const enumerable_properties = [
91
94
  "nth_a",
92
95
  "nth_b",
93
96
  "selector",
97
+ "condition",
98
+ "is_else",
94
99
  "is_browserhack",
95
100
  "is_vendor_prefixed",
96
101
  "has_error",
97
- "is_important"
102
+ "is_important",
103
+ "left",
104
+ "right"
98
105
  ];
99
106
  var CSSNode = class CSSNode {
100
107
  arena;
@@ -175,6 +182,7 @@ var CSSNode = class CSSNode {
175
182
  if (type === 4 && first_child) return first_child;
176
183
  if (type === 33) return first_child ?? null;
177
184
  if (type === 57) return first_child?.first_child ?? null;
185
+ if (type === 59) return first_child?.next_sibling ?? null;
178
186
  if (type === 12) return parse_dimension(text).value;
179
187
  if (type === 11) return Number(text);
180
188
  if (type === 18) {
@@ -238,6 +246,26 @@ var CSSNode = class CSSNode {
238
246
  if (this.type !== 12) return void 0;
239
247
  return parse_dimension(this.text).unit;
240
248
  }
249
+ /** Numerator for ratio values, e.g. the Number "16" in `aspect-ratio: 16/9` */
250
+ get left() {
251
+ if (this.type !== 58) return void 0;
252
+ return this.first_child ?? void 0;
253
+ }
254
+ /** Denominator for ratio values, e.g. the Number "9" in `aspect-ratio: 16/9` */
255
+ get right() {
256
+ if (this.type !== 58) return void 0;
257
+ return this.first_child?.next_sibling ?? void 0;
258
+ }
259
+ /** Get the parsed condition node of an if() branch, e.g. the Function "style(--active: 1)" or the Identifier "else" */
260
+ get condition() {
261
+ if (this.type !== 59) return;
262
+ return this.first_child ?? void 0;
263
+ }
264
+ /** True when this is the else branch of an if() function */
265
+ get is_else() {
266
+ if (this.type !== 59) return void 0;
267
+ return str_equals("else", this.get_content());
268
+ }
241
269
  /** Check if this declaration has !important */
242
270
  get is_important() {
243
271
  if (this.type !== 4) return void 0;
@@ -441,7 +469,11 @@ var CSSNode = class CSSNode {
441
469
  };
442
470
  for (let key of enumerable_properties) {
443
471
  let val = this[key];
444
- if (val !== void 0 && val !== false) plain[key] = val;
472
+ if (val instanceof CSSNode) plain[key] = val.clone({
473
+ deep,
474
+ locations
475
+ });
476
+ else if (val !== void 0 && val !== false) plain[key] = val;
445
477
  }
446
478
  if (locations) {
447
479
  plain.line = this.line;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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-Bx5vp6Sl.js";
1
+ import { A as PRELUDE_OPERATOR, B as STYLE_RULE, C as MEDIA_TYPE, D as NUMBER, E as NTH_SELECTOR, F as RAW, G as UNIVERSAL_SELECTOR, H as SUPPORTS_QUERY, I as SELECTOR, K as URL, L as SELECTOR_LIST, M as PSEUDO_CLASS_SELECTOR, N as PSEUDO_ELEMENT_SELECTOR, O as OPERATOR, P as RATIO, R as STRING, S as MEDIA_QUERY, T as NTH_OF_SELECTOR, U as TYPE_SELECTOR, V as SUPPORTS_DECLARATION, W as UNICODE_RANGE, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LAYER_NAME, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, k as PARENTHESIS, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, q as VALUE, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as NESTING_SELECTOR, x as MEDIA_FEATURE, y as LANG_SELECTOR, z as STYLESHEET } from "./arena-DcrS77hW.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-CDEnYcVG.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-D41wr72y.js";
4
+ import { $ as is_attribute_selector, A as PreludeOperator, At as is_rule, B as String, Bt as is_url, C as MediaType, Ct as is_parenthesis, D as Number, Dt as is_pseudo_element_selector, E as NthSelector, Et as is_pseudo_class_selector, F as Raw, Ft as is_supports_declaration, G as TypeSelector, H as SupportsDeclaration, Ht as CloneOptions, I as Rule, It as is_supports_query, J as Url, K as UnicodeRange, L as Selector, Lt as is_type_selector, M as PseudoClassSelector, Mt as is_selector_list, N as PseudoElementSelector, Nt as is_string, O as Operator, Ot as is_ratio, P as Ratio, Pt as is_stylesheet, Q as is_atrule_prelude, R as SelectorList, Rt as is_unicode_range, S as MediaQuery, St as is_operator, T as NthOfSelector, Tt as is_prelude_selectorlist, U as SupportsQuery, Ut as PlainCSSNode, V as StyleSheet, Vt as is_value, W as ToPlain, Wt as TYPE_NAMES, X as WithChildren, Y as Value, Z as is_atrule, _ as Identifier, _t as is_media_type, a as Block, at as is_declaration, b as LayerName, bt as is_nth_selector, c as Combinator, ct as is_function, d as Declaration, dt as is_identifier, et as is_block, f as Dimension, ft as is_if_branch, g as IdSelector, gt as is_media_query, h as Hash, ht as is_media_feature, i as AttributeSelector, it as is_container_query, j as PreludeSelectorList, jt as is_selector, k as Parenthesis, kt as is_raw, l as Comment, lt as is_hash, m as Function, mt as is_layer_name, n as Atrule, nt as is_combinator, o as CSSNode, ot as is_dimension, p as FeatureRange, pt as is_lang_selector, q as UniversalSelector, r as AtrulePrelude, rt as is_comment, s as ClassSelector, st as is_feature_range, t as AnyNode, tt as is_class_selector, u as ContainerQuery, ut as is_id_selector, v as IfBranch, vt as is_nesting_selector, w as NestingSelector, wt as is_prelude_operator, x as MediaFeature, xt as is_number, y as LangSelector, yt as is_nth_of_selector, z as SelectorNode, zt as is_universal_selector } from "./node-types-u3Sbl3_p.js";
5
5
  import { ParserOptions, parse } from "./parse.js";
6
6
  import { parse_selector, parse_selector_list } from "./parse-selector.js";
7
7
  import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
@@ -25,4 +25,4 @@ declare function is_vendor_prefixed(source: string, start: number, end: number):
25
25
  /** True if the string is a CSS custom property (starts with `--`). */
26
26
  declare function is_custom(str: string): boolean;
27
27
  //#endregion
28
- 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 };
28
+ 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, IF_BRANCH, type IdSelector, type Identifier, type IfBranch, 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, RATIO, RAW, type Ratio, 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_if_branch, 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_ratio, 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
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-DK24ACbY.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-CFwM4uQs.js";
2
+ import { A as PRELUDE_OPERATOR, B as SUPPORTS_DECLARATION, C as MEDIA_TYPE, D as NUMBER, E as NTH_SELECTOR, F as SELECTOR, G as URL, H as TYPE_SELECTOR, I as SELECTOR_LIST, K as VALUE, L as STRING, M as PSEUDO_ELEMENT_SELECTOR, N as RATIO, O as OPERATOR, P as RAW, R as STYLESHEET, S as MEDIA_QUERY, T as NTH_OF_SELECTOR, U as UNICODE_RANGE, V as SUPPORTS_QUERY, W as UNIVERSAL_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LAYER_NAME, 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 PARENTHESIS, 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 IF_BRANCH, w as NESTING_SELECTOR, x as MEDIA_FEATURE, y as LANG_SELECTOR, z as STYLE_RULE } from "./arena-DKhfTFT5.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-ouWXNHdx.js";
4
- import { n as TYPE_NAMES } from "./css-node-Cf8K9nWd.js";
5
- import { parse_selector, parse_selector_list } from "./parse-selector.js";
4
+ import { n as TYPE_NAMES } from "./css-node-DKr6cufe.js";
5
+ import { n as parse_selector, r as parse_selector_list } from "./parse-selector-DBdUc04T.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";
@@ -67,6 +67,9 @@ function is_url(node) {
67
67
  function is_unicode_range(node) {
68
68
  return node.type === 19;
69
69
  }
70
+ function is_if_branch(node) {
71
+ return node.type === 59;
72
+ }
70
73
  function is_value(node) {
71
74
  return node.type === 50;
72
75
  }
@@ -136,8 +139,11 @@ function is_prelude_operator(node) {
136
139
  function is_feature_range(node) {
137
140
  return node.type === 39;
138
141
  }
142
+ function is_ratio(node) {
143
+ return node.type === 58;
144
+ }
139
145
  function is_prelude_selectorlist(node) {
140
146
  return node.type === 41;
141
147
  }
142
148
  //#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_selector_list, parse_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
149
+ 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, IF_BRANCH, 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, RATIO, 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_if_branch, 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_ratio, 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-Bx5vp6Sl.js";
1
+ import { A as PRELUDE_OPERATOR, B as STYLE_RULE, C as MEDIA_TYPE, D as NUMBER, E as NTH_SELECTOR, F as RAW, G as UNIVERSAL_SELECTOR, H as SUPPORTS_QUERY, I as SELECTOR, K as URL, L as SELECTOR_LIST, M as PSEUDO_CLASS_SELECTOR, N as PSEUDO_ELEMENT_SELECTOR, O as OPERATOR, P as RATIO, R as STRING, S as MEDIA_QUERY, T as NTH_OF_SELECTOR, U as TYPE_SELECTOR, V as SUPPORTS_DECLARATION, W as UNICODE_RANGE, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LAYER_NAME, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_SELECTORLIST, k as PARENTHESIS, m as FUNCTION, n as AT_RULE, o as COMBINATOR, q as VALUE, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as NESTING_SELECTOR, x as MEDIA_FEATURE, y as LANG_SELECTOR, z as STYLESHEET } from "./arena-DcrS77hW.js";
2
2
  //#region src/css-node.d.ts
3
3
  declare const TYPE_NAMES: {
4
4
  readonly 1: 'StyleSheet';
@@ -44,9 +44,11 @@ declare const TYPE_NAMES: {
44
44
  readonly 39: 'MediaFeatureRange';
45
45
  readonly 40: 'AtrulePrelude';
46
46
  readonly 41: 'PreludeSelectorList';
47
+ readonly 58: 'Ratio';
48
+ readonly 59: 'IfBranch';
47
49
  };
48
50
  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 | typeof SUPPORTS_DECLARATION;
51
+ 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 | typeof RATIO | typeof IF_BRANCH;
50
52
  interface CloneOptions {
51
53
  /**
52
54
  * Recursively clone all children
@@ -71,6 +73,10 @@ type PlainCSSNode = {
71
73
  value?: PlainCSSNode | string | number | null;
72
74
  unit?: string;
73
75
  prelude?: PlainCSSNode | null;
76
+ left?: PlainCSSNode;
77
+ right?: PlainCSSNode;
78
+ condition?: PlainCSSNode;
79
+ is_else?: boolean;
74
80
  is_important?: boolean;
75
81
  is_vendor_prefixed?: boolean;
76
82
  is_browserhack?: boolean;
@@ -192,13 +198,18 @@ type Block = WithClone<CSSNode & WithChildren<Raw | Declaration | Atrule | Rule>
192
198
  }>;
193
199
  type Comment = Leaf<typeof COMMENT, 'Comment'>;
194
200
  type Raw = Leaf<typeof RAW, 'Raw'>;
195
- type ValueLike = Function | Identifier | Operator | Parenthesis | Url | UnicodeRange | String | Hash | Dimension | Number | SelectorList | SupportsDeclaration;
201
+ type ValueLike = Function | IfBranch | Identifier | Operator | Parenthesis | Url | UnicodeRange | String | Hash | Dimension | Number | Ratio | SelectorList | SupportsDeclaration;
196
202
  type Identifier = Leaf<typeof IDENTIFIER, 'Identifier', {
197
203
  readonly name: string;
198
204
  }>;
199
205
  type Number = Leaf<typeof NUMBER, 'Number', {
200
206
  readonly value: number;
201
207
  }>;
208
+ /** Ratio value, e.g. "16/9" in `aspect-ratio: 16/9`. A bare number like `aspect-ratio: 1` parses as a plain Number instead. */
209
+ type Ratio = Leaf<typeof RATIO, 'Ratio', {
210
+ readonly left: Number;
211
+ readonly right: Number;
212
+ }>;
202
213
  type Dimension = Leaf<typeof DIMENSION, 'Dimension', {
203
214
  readonly value: number;
204
215
  /** Unit string, e.g. "px", "%" */
@@ -206,7 +217,7 @@ type Dimension = Leaf<typeof DIMENSION, 'Dimension', {
206
217
  }>;
207
218
  type String = Leaf<typeof STRING, 'String'>;
208
219
  type Hash = Leaf<typeof HASH, 'Hash'>;
209
- type Function = WithClone<CSSNode & WithChildren<ValueLike> & {
220
+ type Function = WithClone<CSSNode & WithChildren<ValueLike | MediaFeature | SupportsDeclaration | SupportsQuery | FeatureRange | PreludeOperator> & {
210
221
  readonly type: typeof FUNCTION;
211
222
  readonly type_name: 'Function';
212
223
  /** Function name, e.g. "rgb", "calc" */
@@ -231,6 +242,29 @@ type Value = WithClone<CSSNode & WithChildren<ValueLike> & {
231
242
  readonly type: typeof VALUE;
232
243
  readonly type_name: 'Value';
233
244
  }>;
245
+ /**
246
+ * One branch inside a CSS `if()` inline conditional function.
247
+ *
248
+ * Each branch corresponds to a `<condition>: <value>` pair in:
249
+ * `if( <condition>: <value>; … else: <fallback> )`
250
+ *
251
+ * - `condition` — the parsed condition node (Function, e.g. `style(--x: 1)`, or Identifier `else`)
252
+ * - `value` — the value text, e.g. `"green"`; `null` when omitted
253
+ * - `is_else` — `true` for the `else` branch
254
+ * - `first_child` — same node as `condition`
255
+ * - `children` — condition node followed by parsed value nodes
256
+ */
257
+ type IfBranch = CSSNode & WithChildren<Function | Identifier | Value> & {
258
+ readonly type: typeof IF_BRANCH;
259
+ readonly type_name: 'IfBranch';
260
+ /** The parsed condition node, e.g. the Function "style(--active: 1)" or the Identifier "else" */
261
+ readonly condition: Function | Identifier;
262
+ /** The parsed value as a VALUE node, or null when the branch value is empty */
263
+ readonly value: Value | null;
264
+ /** True when this is the else branch */
265
+ readonly is_else: boolean;
266
+ clone(options?: CloneOptions): ToPlain<IfBranch>;
267
+ };
234
268
  type TypeSelector = Leaf<typeof TYPE_SELECTOR, 'TypeSelector', {
235
269
  /** Local element name, e.g. "div" in both "div" and "ns|div" */
236
270
  readonly name: string;
@@ -305,7 +339,7 @@ type MediaQuery = WithClone<CSSNode & WithChildren<MediaFeature | PreludeOperato
305
339
  type MediaFeature = Leaf<typeof MEDIA_FEATURE, 'Feature', {
306
340
  /** Feature name, e.g. "min-width" */
307
341
  readonly property: string;
308
- /** Feature value node, or null for boolean features like (hover) */
342
+ /** Feature value node (e.g. Dimension, Number, Identifier, Ratio), or null for boolean features like (hover) */
309
343
  readonly value: CSSNode | null;
310
344
  }>;
311
345
  type MediaType = Leaf<typeof MEDIA_TYPE, 'MediaType', {
@@ -351,7 +385,7 @@ type FeatureRange = WithClone<CSSNode & WithChildren<Dimension | PreludeOperator
351
385
  /** The feature name in a range comparison, e.g. "width" from "(width >= 400px)" */
352
386
  readonly name: string;
353
387
  }>;
354
- 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;
388
+ type AnyNode = StyleSheet | Rule | Atrule | Declaration | Selector | SelectorList | Block | Comment | Raw | Identifier | Number | Dimension | Ratio | String | Hash | Function | Operator | Parenthesis | Url | UnicodeRange | IfBranch | Value | TypeSelector | ClassSelector | IdSelector | AttributeSelector | PseudoClassSelector | PseudoElementSelector | Combinator | UniversalSelector | NestingSelector | NthSelector | NthOfSelector | LangSelector | AtrulePrelude | MediaQuery | MediaFeature | MediaType | ContainerQuery | SupportsQuery | SupportsDeclaration | LayerName | PreludeOperator | FeatureRange | PreludeSelectorList;
355
389
  declare function is_stylesheet(node: CSSNode): node is StyleSheet;
356
390
  declare function is_rule(node: CSSNode): node is Rule;
357
391
  declare function is_atrule(node: CSSNode): node is Atrule;
@@ -371,6 +405,7 @@ declare function is_operator(node: CSSNode): node is Operator;
371
405
  declare function is_parenthesis(node: CSSNode): node is Parenthesis;
372
406
  declare function is_url(node: CSSNode): node is Url;
373
407
  declare function is_unicode_range(node: CSSNode): node is UnicodeRange;
408
+ declare function is_if_branch(node: CSSNode): node is IfBranch;
374
409
  declare function is_value(node: CSSNode): node is Value;
375
410
  declare function is_type_selector(node: CSSNode): node is TypeSelector;
376
411
  declare function is_class_selector(node: CSSNode): node is ClassSelector;
@@ -394,6 +429,7 @@ declare function is_supports_declaration(node: CSSNode): node is SupportsDeclara
394
429
  declare function is_layer_name(node: CSSNode): node is LayerName;
395
430
  declare function is_prelude_operator(node: CSSNode): node is PreludeOperator;
396
431
  declare function is_feature_range(node: CSSNode): node is FeatureRange;
432
+ declare function is_ratio(node: CSSNode): node is Ratio;
397
433
  declare function is_prelude_selectorlist(node: CSSNode): node is PreludeSelectorList;
398
434
  //#endregion
399
- 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 };
435
+ export { is_attribute_selector as $, PreludeOperator as A, is_rule as At, String as B, is_url as Bt, MediaType as C, is_parenthesis as Ct, Number as D, is_pseudo_element_selector as Dt, NthSelector as E, is_pseudo_class_selector as Et, Raw as F, is_supports_declaration as Ft, TypeSelector as G, SupportsDeclaration as H, CloneOptions as Ht, Rule as I, is_supports_query as It, Url as J, UnicodeRange as K, Selector as L, is_type_selector as Lt, PseudoClassSelector as M, is_selector_list as Mt, PseudoElementSelector as N, is_string as Nt, Operator as O, is_ratio as Ot, Ratio as P, is_stylesheet as Pt, is_atrule_prelude as Q, SelectorList as R, is_unicode_range as Rt, MediaQuery as S, is_operator as St, NthOfSelector as T, is_prelude_selectorlist as Tt, SupportsQuery as U, PlainCSSNode as Ut, StyleSheet as V, is_value as Vt, ToPlain as W, TYPE_NAMES as Wt, WithChildren as X, Value as Y, is_atrule as Z, Identifier as _, is_media_type as _t, Block as a, is_declaration as at, LayerName as b, is_nth_selector as bt, Combinator as c, is_function as ct, Declaration as d, is_identifier as dt, is_block as et, Dimension as f, is_if_branch as ft, IdSelector as g, is_media_query as gt, Hash as h, is_media_feature as ht, AttributeSelector as i, is_container_query as it, PreludeSelectorList as j, is_selector as jt, Parenthesis as k, is_raw as kt, Comment as l, is_hash as lt, Function as m, is_layer_name as mt, Atrule as n, is_combinator as nt, CSSNode as o, is_dimension as ot, FeatureRange as p, is_lang_selector as pt, UniversalSelector as q, AtrulePrelude as r, is_comment as rt, ClassSelector as s, is_feature_range as st, AnyNode as t, is_class_selector as tt, ContainerQuery as u, is_id_selector as ut, IfBranch as v, is_nesting_selector as vt, NestingSelector as w, is_prelude_operator as wt, MediaFeature as x, is_number as xt, LangSelector as y, is_nth_of_selector as yt, SelectorNode as z, is_universal_selector as zt };
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-Bx5vp6Sl.js";
2
- import { T as NthSelector } from "./node-types-D41wr72y.js";
1
+ import { l as CSSDataArena } from "./arena-DcrS77hW.js";
2
+ import { E as NthSelector } from "./node-types-u3Sbl3_p.js";
3
3
  //#region src/parse-anplusb.d.ts
4
4
  /** @internal */
5
5
  declare class ANplusBParser {
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-DK24ACbY.js";
2
- import { l as CSSDataArena } from "./arena-CFwM4uQs.js";
2
+ import { l as CSSDataArena } from "./arena-DKhfTFT5.js";
3
3
  import { o as str_equals, s as str_index_of } from "./parse-dimension-ouWXNHdx.js";
4
- import { t as CSSNode } from "./css-node-Cf8K9nWd.js";
4
+ import { t as CSSNode } from "./css-node-DKr6cufe.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-Bx5vp6Sl.js";
2
- import { t as AnyNode } from "./node-types-D41wr72y.js";
1
+ import { l as CSSDataArena } from "./arena-DcrS77hW.js";
2
+ import { t as AnyNode } from "./node-types-u3Sbl3_p.js";
3
3
  //#region src/parse-atrule-prelude.d.ts
4
4
  /** @internal */
5
5
  declare class AtRulePreludeParser {
@@ -8,7 +8,7 @@ declare class AtRulePreludeParser {
8
8
  private source;
9
9
  private prelude_end;
10
10
  private value_node_parser;
11
- private selector_parser;
11
+ private condition_parser;
12
12
  constructor(arena: CSSDataArena, source: string);
13
13
  parse_prelude(at_rule_name: string, start: number, end: number, line?: number, column?: number): number[];
14
14
  private parse_prelude_dispatch;
@@ -16,13 +16,9 @@ declare class AtRulePreludeParser {
16
16
  private create_node;
17
17
  private is_and_or_not;
18
18
  private scan_matching_paren;
19
- private parse_function_condition;
20
19
  private parse_single_media_query;
21
- private parse_media_feature;
22
20
  private parse_container_query;
23
21
  private parse_supports_query;
24
- private find_colon_at_depth_zero;
25
- private create_supports_declaration;
26
22
  private parse_layer_names;
27
23
  private parse_function_prelude;
28
24
  private parse_identifier;
@@ -34,11 +30,9 @@ declare class AtRulePreludeParser {
34
30
  private skip_whitespace;
35
31
  private peek_token_type;
36
32
  private next_token;
37
- private parse_feature_value;
38
33
  private parse_namespace_prelude;
39
34
  private parse_scope_prelude;
40
35
  private parse_custom_media_prelude;
41
- private parse_feature_range;
42
36
  }
43
37
  /**
44
38
  * Parse an at-rule prelude string and return an array of AST nodes