@projectwallace/css-parser 0.18.4 → 0.18.6

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.
@@ -17,6 +17,8 @@ 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;
21
+ declare const IF_CONDITION = 60;
20
22
  declare const SELECTOR_LIST = 20;
21
23
  declare const TYPE_SELECTOR = 21;
22
24
  declare const CLASS_SELECTOR = 22;
@@ -95,4 +97,4 @@ declare class CSSDataArena {
95
97
  has_flag(node_index: number, flag: number): boolean;
96
98
  }
97
99
  //#endregion
98
- export { PRELUDE_SELECTORLIST as A, SUPPORTS_DECLARATION as B, NESTING_SELECTOR as C, OPERATOR as D, NUMBER 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, PARENTHESIS as O, RAW as P, STYLESHEET as R, MEDIA_TYPE as S, NTH_SELECTOR as T, UNICODE_RANGE as U, SUPPORTS_QUERY as V, UNIVERSAL_SELECTOR 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, STYLE_RULE as z };
100
+ export { PARENTHESIS as A, STYLESHEET as B, MEDIA_QUERY as C, NTH_SELECTOR as D, NTH_OF_SELECTOR as E, RATIO as F, UNICODE_RANGE as G, SUPPORTS_DECLARATION as H, RAW as I, VALUE as J, UNIVERSAL_SELECTOR as K, SELECTOR as L, PRELUDE_SELECTORLIST as M, PSEUDO_CLASS_SELECTOR as N, NUMBER as O, PSEUDO_ELEMENT_SELECTOR as P, SELECTOR_LIST as R, MEDIA_FEATURE as S, NESTING_SELECTOR as T, SUPPORTS_QUERY as U, STYLE_RULE as V, TYPE_SELECTOR as W, ID_SELECTOR as _, CLASS_SELECTOR as a, LANG_SELECTOR as b, CONTAINER_QUERY as c, DIMENSION as d, FEATURE_RANGE as f, IDENTIFIER as g, HASH as h, BLOCK as i, PRELUDE_OPERATOR as j, OPERATOR as k, CSSDataArena as l, FUNCTION as m, AT_RULE as n, COMBINATOR as o, FLAG_IMPORTANT as p, URL as q, AT_RULE_PRELUDE as r, COMMENT as s, ATTRIBUTE_SELECTOR as t, DECLARATION as u, IF_BRANCH as v, MEDIA_TYPE as w, LAYER_NAME as x, IF_CONDITION as y, STRING as z };
@@ -18,6 +18,8 @@ const OPERATOR = 16;
18
18
  const PARENTHESIS = 17;
19
19
  const URL = 18;
20
20
  const UNICODE_RANGE = 19;
21
+ const IF_BRANCH = 59;
22
+ const IF_CONDITION = 60;
21
23
  const SELECTOR_LIST = 20;
22
24
  const TYPE_SELECTOR = 21;
23
25
  const CLASS_SELECTOR = 22;
@@ -217,4 +219,4 @@ var CSSDataArena = class CSSDataArena {
217
219
  }
218
220
  };
219
221
  //#endregion
220
- export { PSEUDO_CLASS_SELECTOR 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, RATIO 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_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_DECLARATION as z };
222
+ export { PARENTHESIS as A, STYLE_RULE as B, MEDIA_QUERY as C, NTH_SELECTOR as D, NTH_OF_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, NUMBER as O, RATIO as P, STRING as R, MEDIA_FEATURE as S, NESTING_SELECTOR as T, TYPE_SELECTOR as U, SUPPORTS_DECLARATION as V, UNICODE_RANGE as W, ID_SELECTOR as _, CLASS_SELECTOR as a, LANG_SELECTOR as b, CONTAINER_QUERY as c, DIMENSION as d, FEATURE_RANGE as f, IDENTIFIER as g, HASH as h, BLOCK as i, PRELUDE_OPERATOR as j, OPERATOR 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, MEDIA_TYPE as w, LAYER_NAME as x, IF_CONDITION as y, STYLESHEET as z };
@@ -1,4 +1,4 @@
1
- import { B as SUPPORTS_DECLARATION, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, 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 PARENTHESIS, P as RAW, R as STYLESHEET, S as MEDIA_TYPE, T as NTH_SELECTOR, U as UNICODE_RANGE, V as SUPPORTS_QUERY, W as UNIVERSAL_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as MEDIA_FEATURE, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PSEUDO_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 STYLE_RULE } from "./arena-C-uRgG5-.js";
1
+ import { A as PARENTHESIS, B as STYLESHEET, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_SELECTOR, F as RATIO, G as UNICODE_RANGE, H as SUPPORTS_DECLARATION, I as RAW, J as VALUE, K as UNIVERSAL_SELECTOR, L as SELECTOR, N as PSEUDO_CLASS_SELECTOR, O as NUMBER, P as PSEUDO_ELEMENT_SELECTOR, R as SELECTOR_LIST, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as SUPPORTS_QUERY, V as STYLE_RULE, W as TYPE_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, q as URL, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STRING } from "./arena-BGvFdbj5.js";
2
2
  //#region src/constants.d.ts
3
3
  declare const NODE_TYPES: {
4
4
  readonly STYLESHEET: 1;
@@ -19,6 +19,8 @@ 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;
23
+ readonly IF_CONDITION: 60;
22
24
  readonly VALUE: 50;
23
25
  readonly SELECTOR_LIST: 20;
24
26
  readonly TYPE_SELECTOR: 21;
@@ -46,4 +48,4 @@ declare const NODE_TYPES: {
46
48
  readonly RATIO: 58;
47
49
  };
48
50
  //#endregion
49
- export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, DECLARATION, DIMENSION, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, HASH, IDENTIFIER, ID_SELECTOR, LANG_SELECTOR, LAYER_NAME, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, OPERATOR, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, RATIO, RAW, SELECTOR, SELECTOR_LIST, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
51
+ 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, IF_CONDITION, 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 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 RATIO, 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_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_DECLARATION } from "./arena-C-ZXJe7F.js";
1
+ import { A as PARENTHESIS, B as STYLE_RULE, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_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 NUMBER, P as RATIO, R as STRING, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as TYPE_SELECTOR, V as SUPPORTS_DECLARATION, W as UNICODE_RANGE, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, 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 MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STYLESHEET } from "./arena-e9O_g2AN.js";
2
2
  //#region src/constants.ts
3
3
  const NODE_TYPES = {
4
4
  STYLESHEET: 1,
@@ -19,6 +19,8 @@ const NODE_TYPES = {
19
19
  PARENTHESIS: 17,
20
20
  URL: 18,
21
21
  UNICODE_RANGE: 19,
22
+ IF_BRANCH: 59,
23
+ IF_CONDITION: 60,
22
24
  VALUE: 50,
23
25
  SELECTOR_LIST: 20,
24
26
  TYPE_SELECTOR: 21,
@@ -46,4 +48,4 @@ const NODE_TYPES = {
46
48
  RATIO: 58
47
49
  };
48
50
  //#endregion
49
- export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, DECLARATION, DIMENSION, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, HASH, IDENTIFIER, ID_SELECTOR, LANG_SELECTOR, LAYER_NAME, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, OPERATOR, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, RATIO, RAW, SELECTOR, SELECTOR_LIST, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE };
51
+ 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, IF_CONDITION, 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-C-ZXJe7F.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-e9O_g2AN.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",
@@ -45,7 +45,9 @@ const TYPE_NAMES = {
45
45
  [39]: "MediaFeatureRange",
46
46
  [40]: "AtrulePrelude",
47
47
  [41]: "PreludeSelectorList",
48
- [58]: "Ratio"
48
+ [58]: "Ratio",
49
+ [59]: "IfBranch",
50
+ [60]: "IfCondition"
49
51
  };
50
52
  const nodes_with_name = /* @__PURE__ */ new Set([
51
53
  3,
@@ -79,7 +81,9 @@ const nodes_with_children = /* @__PURE__ */ new Set([
79
81
  35,
80
82
  39,
81
83
  36,
82
- 57
84
+ 57,
85
+ 59,
86
+ 60
83
87
  ]);
84
88
  const enumerable_properties = [
85
89
  "name",
@@ -92,6 +96,8 @@ const enumerable_properties = [
92
96
  "nth_a",
93
97
  "nth_b",
94
98
  "selector",
99
+ "condition",
100
+ "is_else",
95
101
  "is_browserhack",
96
102
  "is_vendor_prefixed",
97
103
  "has_error",
@@ -178,6 +184,7 @@ var CSSNode = class CSSNode {
178
184
  if (type === 4 && first_child) return first_child;
179
185
  if (type === 33) return first_child ?? null;
180
186
  if (type === 57) return first_child?.first_child ?? null;
187
+ if (type === 59) return first_child?.next_sibling ?? null;
181
188
  if (type === 12) return parse_dimension(text).value;
182
189
  if (type === 11) return Number(text);
183
190
  if (type === 18) {
@@ -251,6 +258,16 @@ var CSSNode = class CSSNode {
251
258
  if (this.type !== 58) return void 0;
252
259
  return this.first_child?.next_sibling ?? void 0;
253
260
  }
261
+ /** Get the parsed condition node of an if() branch, e.g. the Function "style(--active: 1)" or the Identifier "else" */
262
+ get condition() {
263
+ if (this.type !== 59) return;
264
+ return this.first_child ?? void 0;
265
+ }
266
+ /** True when this is the else branch of an if() function */
267
+ get is_else() {
268
+ if (this.type !== 59) return void 0;
269
+ return str_equals("else", this.get_content());
270
+ }
254
271
  /** Check if this declaration has !important */
255
272
  get is_important() {
256
273
  if (this.type !== 4) return void 0;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as SUPPORTS_DECLARATION, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, 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 PARENTHESIS, P as RAW, R as STYLESHEET, S as MEDIA_TYPE, T as NTH_SELECTOR, U as UNICODE_RANGE, V as SUPPORTS_QUERY, W as UNIVERSAL_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as MEDIA_FEATURE, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PSEUDO_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 STYLE_RULE } from "./arena-C-uRgG5-.js";
1
+ import { A as PARENTHESIS, B as STYLESHEET, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_SELECTOR, F as RATIO, G as UNICODE_RANGE, H as SUPPORTS_DECLARATION, I as RAW, J as VALUE, K as UNIVERSAL_SELECTOR, L as SELECTOR, N as PSEUDO_CLASS_SELECTOR, O as NUMBER, P as PSEUDO_ELEMENT_SELECTOR, R as SELECTOR_LIST, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as SUPPORTS_QUERY, V as STYLE_RULE, W as TYPE_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, q as URL, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STRING } from "./arena-BGvFdbj5.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_block, A as PreludeSelectorList, At as is_selector_list, B as StyleSheet, Bt as CloneOptions, C as NestingSelector, Ct as is_prelude_selectorlist, D as Operator, Dt as is_raw, E as Number, Et as is_ratio, F as Rule, Ft as is_type_selector, G as UnicodeRange, H as SupportsQuery, Ht as TYPE_NAMES, I as Selector, It as is_unicode_range, J as Value, K as UniversalSelector, L as SelectorList, Lt as is_universal_selector, M as PseudoElementSelector, Mt as is_stylesheet, N as Ratio, Nt as is_supports_declaration, O as Parenthesis, Ot as is_rule, P as Raw, Pt as is_supports_query, Q as is_attribute_selector, R as SelectorNode, Rt as is_url, S as MediaType, St as is_prelude_operator, T as NthSelector, Tt as is_pseudo_element_selector, U as ToPlain, V as SupportsDeclaration, Vt as PlainCSSNode, W as TypeSelector, X as is_atrule, Y as WithChildren, Z as is_atrule_prelude, _ as Identifier, _t as is_nth_of_selector, a as Block, at as is_dimension, b as MediaFeature, bt as is_operator, c as Combinator, ct as is_hash, d as Declaration, dt as is_lang_selector, et as is_class_selector, f as Dimension, ft as is_layer_name, g as IdSelector, gt as is_nesting_selector, h as Hash, ht as is_media_type, i as AttributeSelector, it as is_declaration, j as PseudoClassSelector, jt as is_string, k as PreludeOperator, kt as is_selector, l as Comment, lt as is_id_selector, m as Function, mt as is_media_query, n as Atrule, nt as is_comment, o as CSSNode, ot as is_feature_range, p as FeatureRange, pt as is_media_feature, q as Url, r as AtrulePrelude, rt as is_container_query, s as ClassSelector, st as is_function, t as AnyNode, tt as is_combinator, u as ContainerQuery, ut as is_identifier, v as LangSelector, vt as is_nth_selector, w as NthOfSelector, wt as is_pseudo_class_selector, x as MediaQuery, xt as is_parenthesis, y as LayerName, yt as is_number, z as String, zt as is_value } from "./node-types-Dh1wEDRK.js";
4
+ import { $ as is_atrule_prelude, A as Parenthesis, At as is_ratio, B as SelectorNode, Bt as is_unicode_range, C as MediaQuery, Ct as is_number, D as NthSelector, Dt as is_prelude_selectorlist, E as NthOfSelector, Et as is_prelude_operator, F as Ratio, Ft as is_string, G as ToPlain, Gt as PlainCSSNode, H as StyleSheet, Ht as is_url, I as Raw, It as is_stylesheet, J as UniversalSelector, K as TypeSelector, Kt as TYPE_NAMES, L as Rule, Lt as is_supports_declaration, M as PreludeSelectorList, Mt as is_rule, N as PseudoClassSelector, Nt as is_selector, O as Number, Ot as is_pseudo_class_selector, P as PseudoElementSelector, Pt as is_selector_list, Q as is_atrule, R as Selector, Rt as is_supports_query, S as MediaFeature, St as is_nth_selector, T as NestingSelector, Tt as is_parenthesis, U as SupportsDeclaration, Ut as is_value, V as String, Vt as is_universal_selector, W as SupportsQuery, Wt as CloneOptions, X as Value, Y as Url, Z as WithChildren, _ as Identifier, _t as is_media_feature, a as Block, at as is_container_query, b as LangSelector, bt as is_nesting_selector, c as Combinator, ct as is_feature_range, d as Declaration, dt as is_id_selector, et as is_attribute_selector, f as Dimension, ft as is_identifier, g as IdSelector, gt as is_layer_name, h as Hash, ht as is_lang_selector, i as AttributeSelector, it as is_comment, j as PreludeOperator, jt as is_raw, k as Operator, kt as is_pseudo_element_selector, l as Comment, lt as is_function, m as Function, mt as is_if_condition, n as Atrule, nt as is_class_selector, o as CSSNode, ot as is_declaration, p as FeatureRange, pt as is_if_branch, q as UnicodeRange, r as AtrulePrelude, rt as is_combinator, s as ClassSelector, st as is_dimension, t as AnyNode, tt as is_block, u as ContainerQuery, ut as is_hash, v as IfBranch, vt as is_media_query, w as MediaType, wt as is_operator, x as LayerName, xt as is_nth_of_selector, y as IfCondition, yt as is_media_type, z as SelectorList, zt as is_type_selector } from "./node-types-YnOKcNfU.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, 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_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 };
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, IF_CONDITION, type IdSelector, type Identifier, type IfBranch, type IfCondition, 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_if_condition, 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 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 RATIO, 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_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_DECLARATION } from "./arena-C-ZXJe7F.js";
2
+ import { A as PARENTHESIS, B as STYLE_RULE, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_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 NUMBER, P as RATIO, R as STRING, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as TYPE_SELECTOR, V as SUPPORTS_DECLARATION, W as UNICODE_RANGE, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, 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 MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STYLESHEET } from "./arena-e9O_g2AN.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-Briho45Z.js";
5
- import { parse_selector, parse_selector_list } from "./parse-selector.js";
4
+ import { n as TYPE_NAMES } from "./css-node-BmD2JJLr.js";
5
+ import { n as parse_selector, r as parse_selector_list } from "./parse-selector-DMduLN4o.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,12 @@ 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
+ }
73
+ function is_if_condition(node) {
74
+ return node.type === 60;
75
+ }
70
76
  function is_value(node) {
71
77
  return node.type === 50;
72
78
  }
@@ -143,4 +149,4 @@ function is_prelude_selectorlist(node) {
143
149
  return node.type === 41;
144
150
  }
145
151
  //#endregion
146
- 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, 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_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 };
152
+ 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, IF_CONDITION, 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_if_condition, 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_DECLARATION, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, 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 PARENTHESIS, P as RAW, R as STYLESHEET, S as MEDIA_TYPE, T as NTH_SELECTOR, U as UNICODE_RANGE, V as SUPPORTS_QUERY, W as UNIVERSAL_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as MEDIA_FEATURE, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PSEUDO_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 STYLE_RULE } from "./arena-C-uRgG5-.js";
1
+ import { A as PARENTHESIS, B as STYLESHEET, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_SELECTOR, F as RATIO, G as UNICODE_RANGE, H as SUPPORTS_DECLARATION, I as RAW, J as VALUE, K as UNIVERSAL_SELECTOR, L as SELECTOR, M as PRELUDE_SELECTORLIST, N as PSEUDO_CLASS_SELECTOR, O as NUMBER, P as PSEUDO_ELEMENT_SELECTOR, R as SELECTOR_LIST, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as SUPPORTS_QUERY, V as STYLE_RULE, W as TYPE_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, q as URL, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STRING } from "./arena-BGvFdbj5.js";
2
2
  //#region src/css-node.d.ts
3
3
  declare const TYPE_NAMES: {
4
4
  readonly 1: 'StyleSheet';
@@ -45,9 +45,11 @@ declare const TYPE_NAMES: {
45
45
  readonly 40: 'AtrulePrelude';
46
46
  readonly 41: 'PreludeSelectorList';
47
47
  readonly 58: 'Ratio';
48
+ readonly 59: 'IfBranch';
49
+ readonly 60: 'IfCondition';
48
50
  };
49
51
  type TypeName = (typeof TYPE_NAMES)[keyof typeof TYPE_NAMES] | 'unknown';
50
- type CSSNodeType = typeof STYLESHEET | typeof STYLE_RULE | typeof AT_RULE | typeof DECLARATION | typeof SELECTOR | typeof COMMENT | typeof BLOCK | typeof RAW | typeof IDENTIFIER | typeof NUMBER | typeof DIMENSION | typeof STRING | typeof HASH | typeof FUNCTION | typeof OPERATOR | typeof PARENTHESIS | typeof URL | typeof UNICODE_RANGE | typeof VALUE | typeof SELECTOR_LIST | typeof TYPE_SELECTOR | typeof CLASS_SELECTOR | typeof ID_SELECTOR | typeof ATTRIBUTE_SELECTOR | typeof PSEUDO_CLASS_SELECTOR | typeof PSEUDO_ELEMENT_SELECTOR | typeof COMBINATOR | typeof UNIVERSAL_SELECTOR | typeof NESTING_SELECTOR | typeof NTH_SELECTOR | typeof NTH_OF_SELECTOR | typeof LANG_SELECTOR | typeof MEDIA_QUERY | typeof MEDIA_FEATURE | typeof MEDIA_TYPE | typeof CONTAINER_QUERY | typeof SUPPORTS_QUERY | typeof LAYER_NAME | typeof PRELUDE_OPERATOR | typeof FEATURE_RANGE | typeof AT_RULE_PRELUDE | typeof PRELUDE_SELECTORLIST | typeof SUPPORTS_DECLARATION | typeof RATIO;
52
+ 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 | typeof IF_CONDITION;
51
53
  interface CloneOptions {
52
54
  /**
53
55
  * Recursively clone all children
@@ -74,6 +76,8 @@ type PlainCSSNode = {
74
76
  prelude?: PlainCSSNode | null;
75
77
  left?: PlainCSSNode;
76
78
  right?: PlainCSSNode;
79
+ condition?: PlainCSSNode;
80
+ is_else?: boolean;
77
81
  is_important?: boolean;
78
82
  is_vendor_prefixed?: boolean;
79
83
  is_browserhack?: boolean;
@@ -195,7 +199,7 @@ type Block = WithClone<CSSNode & WithChildren<Raw | Declaration | Atrule | Rule>
195
199
  }>;
196
200
  type Comment = Leaf<typeof COMMENT, 'Comment'>;
197
201
  type Raw = Leaf<typeof RAW, 'Raw'>;
198
- type ValueLike = Function | Identifier | Operator | Parenthesis | Url | UnicodeRange | String | Hash | Dimension | Number | Ratio | SelectorList | SupportsDeclaration;
202
+ type ValueLike = Function | IfBranch | Identifier | Operator | Parenthesis | Url | UnicodeRange | String | Hash | Dimension | Number | Ratio | SelectorList | SupportsDeclaration;
199
203
  type Identifier = Leaf<typeof IDENTIFIER, 'Identifier', {
200
204
  readonly name: string;
201
205
  }>;
@@ -214,7 +218,7 @@ type Dimension = Leaf<typeof DIMENSION, 'Dimension', {
214
218
  }>;
215
219
  type String = Leaf<typeof STRING, 'String'>;
216
220
  type Hash = Leaf<typeof HASH, 'Hash'>;
217
- type Function = WithClone<CSSNode & WithChildren<ValueLike> & {
221
+ type Function = WithClone<CSSNode & WithChildren<ValueLike | MediaFeature | SupportsDeclaration | SupportsQuery | FeatureRange | PreludeOperator> & {
218
222
  readonly type: typeof FUNCTION;
219
223
  readonly type_name: 'Function';
220
224
  /** Function name, e.g. "rgb", "calc" */
@@ -239,6 +243,43 @@ type Value = WithClone<CSSNode & WithChildren<ValueLike> & {
239
243
  readonly type: typeof VALUE;
240
244
  readonly type_name: 'Value';
241
245
  }>;
246
+ /**
247
+ * A compound `if()`-branch condition combining multiple tests with `not`/`and`/`or`,
248
+ * e.g. `not style(--scheme: light)` or `style(--a: 1) and media(width > 600px)`.
249
+ *
250
+ * Children are the flat sequence of PreludeOperator ("not"/"and"/"or") and
251
+ * Function (`style()`/`media()`/`supports()`) nodes, in source order — the same
252
+ * shape `@supports`'s own compound condition uses.
253
+ */
254
+ type IfCondition = WithClone<CSSNode & WithChildren<Function | PreludeOperator> & {
255
+ readonly type: typeof IF_CONDITION;
256
+ readonly type_name: 'IfCondition';
257
+ }>;
258
+ /**
259
+ * One branch inside a CSS `if()` inline conditional function.
260
+ *
261
+ * Each branch corresponds to a `<condition>: <value>` pair in:
262
+ * `if( <condition>: <value>; … else: <fallback> )`
263
+ *
264
+ * - `condition` — the parsed condition node: a Function (e.g. `style(--x: 1)`), an
265
+ * Identifier (`else`), or an IfCondition for compound `not`/`and`/`or` conditions
266
+ * (e.g. `not style(--x: 1)`)
267
+ * - `value` — the value text, e.g. `"green"`; `null` when omitted
268
+ * - `is_else` — `true` for the `else` branch
269
+ * - `first_child` — same node as `condition`
270
+ * - `children` — condition node followed by parsed value nodes
271
+ */
272
+ type IfBranch = CSSNode & WithChildren<Function | Identifier | IfCondition | Value> & {
273
+ readonly type: typeof IF_BRANCH;
274
+ readonly type_name: 'IfBranch';
275
+ /** The parsed condition node, e.g. the Function "style(--active: 1)", the Identifier "else", or an IfCondition for compound conditions */
276
+ readonly condition: Function | Identifier | IfCondition;
277
+ /** The parsed value as a VALUE node, or null when the branch value is empty */
278
+ readonly value: Value | null;
279
+ /** True when this is the else branch */
280
+ readonly is_else: boolean;
281
+ clone(options?: CloneOptions): ToPlain<IfBranch>;
282
+ };
242
283
  type TypeSelector = Leaf<typeof TYPE_SELECTOR, 'TypeSelector', {
243
284
  /** Local element name, e.g. "div" in both "div" and "ns|div" */
244
285
  readonly name: string;
@@ -359,7 +400,7 @@ type FeatureRange = WithClone<CSSNode & WithChildren<Dimension | PreludeOperator
359
400
  /** The feature name in a range comparison, e.g. "width" from "(width >= 400px)" */
360
401
  readonly name: string;
361
402
  }>;
362
- type AnyNode = StyleSheet | Rule | Atrule | Declaration | Selector | SelectorList | Block | Comment | Raw | Identifier | Number | Dimension | Ratio | 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;
403
+ type AnyNode = StyleSheet | Rule | Atrule | Declaration | Selector | SelectorList | Block | Comment | Raw | Identifier | Number | Dimension | Ratio | String | Hash | Function | Operator | Parenthesis | Url | UnicodeRange | IfBranch | IfCondition | Value | TypeSelector | ClassSelector | IdSelector | AttributeSelector | PseudoClassSelector | PseudoElementSelector | Combinator | UniversalSelector | NestingSelector | NthSelector | NthOfSelector | LangSelector | AtrulePrelude | MediaQuery | MediaFeature | MediaType | ContainerQuery | SupportsQuery | SupportsDeclaration | LayerName | PreludeOperator | FeatureRange | PreludeSelectorList;
363
404
  declare function is_stylesheet(node: CSSNode): node is StyleSheet;
364
405
  declare function is_rule(node: CSSNode): node is Rule;
365
406
  declare function is_atrule(node: CSSNode): node is Atrule;
@@ -379,6 +420,8 @@ declare function is_operator(node: CSSNode): node is Operator;
379
420
  declare function is_parenthesis(node: CSSNode): node is Parenthesis;
380
421
  declare function is_url(node: CSSNode): node is Url;
381
422
  declare function is_unicode_range(node: CSSNode): node is UnicodeRange;
423
+ declare function is_if_branch(node: CSSNode): node is IfBranch;
424
+ declare function is_if_condition(node: CSSNode): node is IfCondition;
382
425
  declare function is_value(node: CSSNode): node is Value;
383
426
  declare function is_type_selector(node: CSSNode): node is TypeSelector;
384
427
  declare function is_class_selector(node: CSSNode): node is ClassSelector;
@@ -405,4 +448,4 @@ declare function is_feature_range(node: CSSNode): node is FeatureRange;
405
448
  declare function is_ratio(node: CSSNode): node is Ratio;
406
449
  declare function is_prelude_selectorlist(node: CSSNode): node is PreludeSelectorList;
407
450
  //#endregion
408
- export { is_block as $, PreludeSelectorList as A, is_selector_list as At, StyleSheet as B, CloneOptions as Bt, NestingSelector as C, is_prelude_selectorlist as Ct, Operator as D, is_raw as Dt, Number as E, is_ratio as Et, Rule as F, is_type_selector as Ft, UnicodeRange as G, SupportsQuery as H, TYPE_NAMES as Ht, Selector as I, is_unicode_range as It, Value as J, UniversalSelector as K, SelectorList as L, is_universal_selector as Lt, PseudoElementSelector as M, is_stylesheet as Mt, Ratio as N, is_supports_declaration as Nt, Parenthesis as O, is_rule as Ot, Raw as P, is_supports_query as Pt, is_attribute_selector as Q, SelectorNode as R, is_url as Rt, MediaType as S, is_prelude_operator as St, NthSelector as T, is_pseudo_element_selector as Tt, ToPlain as U, SupportsDeclaration as V, PlainCSSNode as Vt, TypeSelector as W, is_atrule as X, WithChildren as Y, is_atrule_prelude as Z, Identifier as _, is_nth_of_selector as _t, Block as a, is_dimension as at, MediaFeature as b, is_operator as bt, Combinator as c, is_hash as ct, Declaration as d, is_lang_selector as dt, is_class_selector as et, Dimension as f, is_layer_name as ft, IdSelector as g, is_nesting_selector as gt, Hash as h, is_media_type as ht, AttributeSelector as i, is_declaration as it, PseudoClassSelector as j, is_string as jt, PreludeOperator as k, is_selector as kt, Comment as l, is_id_selector as lt, Function as m, is_media_query as mt, Atrule as n, is_comment as nt, CSSNode as o, is_feature_range as ot, FeatureRange as p, is_media_feature as pt, Url as q, AtrulePrelude as r, is_container_query as rt, ClassSelector as s, is_function as st, AnyNode as t, is_combinator as tt, ContainerQuery as u, is_identifier as ut, LangSelector as v, is_nth_selector as vt, NthOfSelector as w, is_pseudo_class_selector as wt, MediaQuery as x, is_parenthesis as xt, LayerName as y, is_number as yt, String as z, is_value as zt };
451
+ export { is_atrule_prelude as $, Parenthesis as A, is_ratio as At, SelectorNode as B, is_unicode_range as Bt, MediaQuery as C, is_number as Ct, NthSelector as D, is_prelude_selectorlist as Dt, NthOfSelector as E, is_prelude_operator as Et, Ratio as F, is_string as Ft, ToPlain as G, PlainCSSNode as Gt, StyleSheet as H, is_url as Ht, Raw as I, is_stylesheet as It, UniversalSelector as J, TypeSelector as K, TYPE_NAMES as Kt, Rule as L, is_supports_declaration as Lt, PreludeSelectorList as M, is_rule as Mt, PseudoClassSelector as N, is_selector as Nt, Number as O, is_pseudo_class_selector as Ot, PseudoElementSelector as P, is_selector_list as Pt, is_atrule as Q, Selector as R, is_supports_query as Rt, MediaFeature as S, is_nth_selector as St, NestingSelector as T, is_parenthesis as Tt, SupportsDeclaration as U, is_value as Ut, String as V, is_universal_selector as Vt, SupportsQuery as W, CloneOptions as Wt, Value as X, Url as Y, WithChildren as Z, Identifier as _, is_media_feature as _t, Block as a, is_container_query as at, LangSelector as b, is_nesting_selector as bt, Combinator as c, is_feature_range as ct, Declaration as d, is_id_selector as dt, is_attribute_selector as et, Dimension as f, is_identifier as ft, IdSelector as g, is_layer_name as gt, Hash as h, is_lang_selector as ht, AttributeSelector as i, is_comment as it, PreludeOperator as j, is_raw as jt, Operator as k, is_pseudo_element_selector as kt, Comment as l, is_function as lt, Function as m, is_if_condition as mt, Atrule as n, is_class_selector as nt, CSSNode as o, is_declaration as ot, FeatureRange as p, is_if_branch as pt, UnicodeRange as q, AtrulePrelude as r, is_combinator as rt, ClassSelector as s, is_dimension as st, AnyNode as t, is_block as tt, ContainerQuery as u, is_hash as ut, IfBranch as v, is_media_query as vt, MediaType as w, is_operator as wt, LayerName as x, is_nth_of_selector as xt, IfCondition as y, is_media_type as yt, SelectorList as z, is_type_selector as zt };
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-C-uRgG5-.js";
2
- import { T as NthSelector } from "./node-types-Dh1wEDRK.js";
1
+ import { l as CSSDataArena } from "./arena-BGvFdbj5.js";
2
+ import { D as NthSelector } from "./node-types-YnOKcNfU.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-C-ZXJe7F.js";
2
+ import { l as CSSDataArena } from "./arena-e9O_g2AN.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-Briho45Z.js";
4
+ import { t as CSSNode } from "./css-node-BmD2JJLr.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-C-uRgG5-.js";
2
- import { t as AnyNode } from "./node-types-Dh1wEDRK.js";
1
+ import { l as CSSDataArena } from "./arena-BGvFdbj5.js";
2
+ import { t as AnyNode } from "./node-types-YnOKcNfU.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,12 +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
- private wrap_ratio_value;
39
33
  private parse_namespace_prelude;
40
34
  private parse_scope_prelude;
41
35
  private parse_custom_media_prelude;
42
- private parse_feature_range;
43
36
  }
44
37
  /**
45
38
  * Parse an at-rule prelude string and return an array of AST nodes