@projectwallace/css-parser 0.18.9 → 0.18.12

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.
Files changed (40) hide show
  1. package/README.md +186 -18
  2. package/dist/{arena-e9O_g2AN.js → arena-Bsf96CQK.js} +27 -19
  3. package/dist/{arena-BGvFdbj5.d.ts → arena-DvT75bvK.d.ts} +2 -0
  4. package/dist/constants.d.ts +1 -1
  5. package/dist/constants.js +1 -1
  6. package/dist/{css-node-DfJEsKN0.js → css-node-yoUdFtNg.js} +101 -100
  7. package/dist/index.d.ts +6 -20
  8. package/dist/index.js +9 -146
  9. package/dist/{node-types-YnOKcNfU.d.ts → node-types-CY0JK9_a.d.ts} +9 -55
  10. package/dist/node-types.d.ts +2 -0
  11. package/dist/node-types.js +142 -0
  12. package/dist/parse-anplusb.d.ts +2 -2
  13. package/dist/parse-anplusb.js +5 -4
  14. package/dist/parse-atrule-prelude.d.ts +2 -2
  15. package/dist/parse-atrule-prelude.js +62 -61
  16. package/dist/parse-declaration.d.ts +3 -3
  17. package/dist/parse-declaration.js +20 -19
  18. package/dist/parse-dimension.js +47 -1
  19. package/dist/{parse-selector-rTXB4IN2.js → parse-selector-CqIpnBrQ.js} +74 -81
  20. package/dist/parse-selector.d.ts +2 -2
  21. package/dist/parse-selector.js +1 -1
  22. package/dist/parse-value.d.ts +2 -2
  23. package/dist/parse-value.js +8 -8
  24. package/dist/parse.d.ts +3 -3
  25. package/dist/parse.js +67 -46
  26. package/dist/string-helpers-BMWJduts.d.ts +18 -0
  27. package/dist/string-helpers.d.ts +2 -0
  28. package/dist/string-helpers.js +1 -0
  29. package/dist/{parse-dimension-CIaPOmBc.js → string-utils-DiRRd28d.js} +5 -49
  30. package/dist/token-types-Bqsf5FX-.d.ts +38 -0
  31. package/dist/token-types.d.ts +2 -0
  32. package/dist/token-types.js +30 -0
  33. package/dist/{tokenize-0ADWAELW.js → tokenize-Ccg58Z_k.js} +67 -96
  34. package/dist/tokenize.d.ts +97 -2
  35. package/dist/tokenize.js +1 -1
  36. package/dist/{value-node-parser-DizbcN1a.js → value-node-parser-BBwBxFR_.js} +133 -135
  37. package/dist/walk.d.ts +3 -2
  38. package/dist/walk.js +2 -2
  39. package/package.json +17 -4
  40. package/dist/tokenize-CaWtrHw_.d.ts +0 -134
@@ -1,54 +1,6 @@
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";
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-DvT75bvK.js";
2
2
  //#region src/css-node.d.ts
3
- declare const TYPE_NAMES: {
4
- readonly 1: 'StyleSheet';
5
- readonly 2: 'Rule';
6
- readonly 3: 'Atrule';
7
- readonly 4: 'Declaration';
8
- readonly 5: 'Selector';
9
- readonly 6: 'Comment';
10
- readonly 7: 'Block';
11
- readonly 8: 'Raw';
12
- readonly 10: 'Identifier';
13
- readonly 11: 'Number';
14
- readonly 12: 'Dimension';
15
- readonly 13: 'String';
16
- readonly 14: 'Hash';
17
- readonly 15: 'Function';
18
- readonly 16: 'Operator';
19
- readonly 17: 'Parentheses';
20
- readonly 18: 'Url';
21
- readonly 19: 'UnicodeRange';
22
- readonly 50: 'Value';
23
- readonly 20: 'SelectorList';
24
- readonly 21: 'TypeSelector';
25
- readonly 22: 'ClassSelector';
26
- readonly 23: 'IdSelector';
27
- readonly 24: 'AttributeSelector';
28
- readonly 25: 'PseudoClassSelector';
29
- readonly 26: 'PseudoElementSelector';
30
- readonly 27: 'Combinator';
31
- readonly 28: 'UniversalSelector';
32
- readonly 29: 'NestingSelector';
33
- readonly 30: 'Nth';
34
- readonly 31: 'NthOf';
35
- readonly 56: 'Lang';
36
- readonly 32: 'MediaQuery';
37
- readonly 33: 'Feature';
38
- readonly 34: 'MediaType';
39
- readonly 35: 'ContainerQuery';
40
- readonly 36: 'SupportsQuery';
41
- readonly 57: 'SupportsDeclaration';
42
- readonly 37: 'Layer';
43
- readonly 38: 'Operator';
44
- readonly 39: 'MediaFeatureRange';
45
- readonly 40: 'AtrulePrelude';
46
- readonly 41: 'PreludeSelectorList';
47
- readonly 58: 'Ratio';
48
- readonly 59: 'IfBranch';
49
- readonly 60: 'IfCondition';
50
- };
51
- type TypeName = (typeof TYPE_NAMES)[keyof typeof TYPE_NAMES] | 'unknown';
3
+ type TypeName = 'StyleSheet' | 'Rule' | 'Atrule' | 'Declaration' | 'Selector' | 'Comment' | 'Block' | 'Raw' | 'Identifier' | 'Number' | 'Dimension' | 'String' | 'Hash' | 'Function' | 'Operator' | 'Parentheses' | 'Url' | 'UnicodeRange' | 'Value' | 'SelectorList' | 'TypeSelector' | 'ClassSelector' | 'IdSelector' | 'AttributeSelector' | 'PseudoClassSelector' | 'PseudoElementSelector' | 'Combinator' | 'UniversalSelector' | 'NestingSelector' | 'Nth' | 'NthOf' | 'Lang' | 'MediaQuery' | 'Feature' | 'MediaType' | 'ContainerQuery' | 'SupportsQuery' | 'SupportsDeclaration' | 'Layer' | 'MediaFeatureRange' | 'AtrulePrelude' | 'PreludeSelectorList' | 'Ratio' | 'IfBranch' | 'IfCondition' | 'unknown';
52
4
  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;
53
5
  interface CloneOptions {
54
6
  /**
@@ -351,11 +303,13 @@ type MediaQuery = WithClone<CSSNode & WithChildren<MediaFeature | PreludeOperato
351
303
  readonly type: typeof MEDIA_QUERY;
352
304
  readonly type_name: 'MediaQuery';
353
305
  }>;
354
- type MediaFeature = Leaf<typeof MEDIA_FEATURE, 'Feature', {
306
+ type MediaFeature = WithClone<CSSNode & WithChildren<Identifier | Number | Dimension | Ratio> & {
307
+ readonly type: typeof MEDIA_FEATURE;
308
+ readonly type_name: 'Feature';
355
309
  /** Feature name, e.g. "min-width" */
356
310
  readonly property: string;
357
- /** Feature value node (e.g. Dimension, Number, Identifier, Ratio), or null for boolean features like (hover) */
358
- readonly value: CSSNode | null;
311
+ /** Feature value node (Dimension, Number, Identifier or Ratio), or null for boolean features like (hover). Hacks like `0\0` add further children after it. */
312
+ readonly value: Identifier | Number | Dimension | Ratio | null;
359
313
  }>;
360
314
  type MediaType = Leaf<typeof MEDIA_TYPE, 'MediaType', {
361
315
  /** Media type text, e.g. "screen", "print" */
@@ -394,7 +348,7 @@ type PreludeSelectorList = Leaf<typeof PRELUDE_SELECTORLIST, 'PreludeSelectorLis
394
348
  readonly value: string;
395
349
  }>;
396
350
  type PreludeOperator = Leaf<typeof PRELUDE_OPERATOR, 'Operator'>;
397
- type FeatureRange = WithClone<CSSNode & WithChildren<Dimension | PreludeOperator> & {
351
+ type FeatureRange = WithClone<CSSNode & WithChildren<Dimension | Function | PreludeOperator> & {
398
352
  readonly type: typeof FEATURE_RANGE;
399
353
  readonly type_name: 'MediaFeatureRange';
400
354
  /** The feature name in a range comparison, e.g. "width" from "(width >= 400px)" */
@@ -448,4 +402,4 @@ declare function is_feature_range(node: CSSNode): node is FeatureRange;
448
402
  declare function is_ratio(node: CSSNode): node is Ratio;
449
403
  declare function is_prelude_selectorlist(node: CSSNode): node is PreludeSelectorList;
450
404
  //#endregion
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 };
405
+ export { is_atrule as $, Operator as A, is_pseudo_element_selector as At, SelectorList as B, is_type_selector as Bt, MediaFeature as C, is_nth_selector as Ct, NthOfSelector as D, is_prelude_operator as Dt, NestingSelector as E, is_parenthesis as Et, PseudoElementSelector as F, is_selector_list as Ft, SupportsQuery as G, CloneOptions as Gt, String as H, is_universal_selector as Ht, Ratio as I, is_string as It, UnicodeRange as J, ToPlain as K, PlainCSSNode as Kt, Raw as L, is_stylesheet as Lt, PreludeOperator as M, is_raw as Mt, PreludeSelectorList as N, is_rule as Nt, NthSelector as O, is_prelude_selectorlist as Ot, PseudoClassSelector as P, is_selector as Pt, WithChildren as Q, Rule as R, is_supports_declaration as Rt, LayerName as S, is_nth_of_selector as St, MediaType as T, is_operator as Tt, StyleSheet as U, is_url as Ut, SelectorNode as V, is_unicode_range as Vt, SupportsDeclaration as W, is_value as Wt, Url as X, UniversalSelector as Y, Value as Z, IdSelector as _, is_layer_name as _t, Block as a, is_comment as at, IfCondition as b, is_media_type as bt, ClassSelector as c, is_dimension as ct, ContainerQuery as d, is_hash as dt, is_atrule_prelude as et, Declaration as f, is_id_selector as ft, Hash as g, is_lang_selector as gt, Function as h, is_if_condition as ht, AttributeSelector as i, is_combinator as it, Parenthesis as j, is_ratio as jt, Number as k, is_pseudo_class_selector as kt, Combinator as l, is_feature_range as lt, FeatureRange as m, is_if_branch as mt, Atrule as n, is_block as nt, BlockChild as o, is_container_query as ot, Dimension as p, is_identifier as pt, TypeSelector as q, AtrulePrelude as r, is_class_selector as rt, CSSNode as s, is_declaration as st, AnyNode as t, is_attribute_selector as tt, Comment as u, is_function as ut, Identifier as v, is_media_feature as vt, MediaQuery as w, is_number as wt, LangSelector as x, is_nesting_selector as xt, IfBranch as y, is_media_query as yt, Selector as z, is_supports_query as zt };
@@ -0,0 +1,2 @@
1
+ import { $ as is_atrule, A as Operator, At as is_pseudo_element_selector, B as SelectorList, Bt as is_type_selector, C as MediaFeature, Ct as is_nth_selector, D as NthOfSelector, Dt as is_prelude_operator, E as NestingSelector, Et as is_parenthesis, F as PseudoElementSelector, Ft as is_selector_list, G as SupportsQuery, Gt as CloneOptions, H as String, Ht as is_universal_selector, I as Ratio, It as is_string, J as UnicodeRange, K as ToPlain, Kt as PlainCSSNode, L as Raw, Lt as is_stylesheet, M as PreludeOperator, Mt as is_raw, N as PreludeSelectorList, Nt as is_rule, O as NthSelector, Ot as is_prelude_selectorlist, P as PseudoClassSelector, Pt as is_selector, Q as WithChildren, R as Rule, Rt as is_supports_declaration, S as LayerName, St as is_nth_of_selector, T as MediaType, Tt as is_operator, U as StyleSheet, Ut as is_url, V as SelectorNode, Vt as is_unicode_range, W as SupportsDeclaration, Wt as is_value, X as Url, Y as UniversalSelector, Z as Value, _ as IdSelector, _t as is_layer_name, a as Block, at as is_comment, b as IfCondition, bt as is_media_type, c as ClassSelector, ct as is_dimension, d as ContainerQuery, dt as is_hash, et as is_atrule_prelude, f as Declaration, ft as is_id_selector, g as Hash, gt as is_lang_selector, h as Function, ht as is_if_condition, i as AttributeSelector, it as is_combinator, j as Parenthesis, jt as is_ratio, k as Number, kt as is_pseudo_class_selector, l as Combinator, lt as is_feature_range, m as FeatureRange, mt as is_if_branch, n as Atrule, nt as is_block, o as BlockChild, ot as is_container_query, p as Dimension, pt as is_identifier, q as TypeSelector, r as AtrulePrelude, rt as is_class_selector, s as CSSNode, st as is_declaration, t as AnyNode, tt as is_attribute_selector, u as Comment, ut as is_function, v as Identifier, vt as is_media_feature, w as MediaQuery, wt as is_number, x as LangSelector, xt as is_nesting_selector, y as IfBranch, yt as is_media_query, z as Selector, zt as is_supports_query } from "./node-types-CY0JK9_a.js";
2
+ export { AnyNode, Atrule, AtrulePrelude, AttributeSelector, Block, BlockChild, CSSNode, ClassSelector, type CloneOptions, Combinator, Comment, ContainerQuery, Declaration, Dimension, FeatureRange, Function, Hash, IdSelector, Identifier, IfBranch, IfCondition, LangSelector, LayerName, MediaFeature, MediaQuery, MediaType, NestingSelector, NthOfSelector, NthSelector, Number, Operator, Parenthesis, type PlainCSSNode, PreludeOperator, PreludeSelectorList, PseudoClassSelector, PseudoElementSelector, Ratio, Raw, Rule, Selector, SelectorList, SelectorNode, String, StyleSheet, SupportsDeclaration, SupportsQuery, ToPlain, TypeSelector, UnicodeRange, UniversalSelector, Url, Value, WithChildren, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, 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 };
@@ -0,0 +1,142 @@
1
+ import "./arena-Bsf96CQK.js";
2
+ //#region src/node-types.ts
3
+ function is_stylesheet(node) {
4
+ return node.type === 1;
5
+ }
6
+ function is_rule(node) {
7
+ return node.type === 2;
8
+ }
9
+ function is_atrule(node) {
10
+ return node.type === 3;
11
+ }
12
+ function is_declaration(node) {
13
+ return node.type === 4;
14
+ }
15
+ function is_selector(node) {
16
+ return node.type === 5;
17
+ }
18
+ function is_selector_list(node) {
19
+ return node.type === 20;
20
+ }
21
+ function is_block(node) {
22
+ return node.type === 7;
23
+ }
24
+ function is_comment(node) {
25
+ return node.type === 6;
26
+ }
27
+ function is_raw(node) {
28
+ return node.type === 8;
29
+ }
30
+ function is_identifier(node) {
31
+ return node.type === 10;
32
+ }
33
+ function is_number(node) {
34
+ return node.type === 11;
35
+ }
36
+ function is_dimension(node) {
37
+ return node.type === 12;
38
+ }
39
+ function is_string(node) {
40
+ return node.type === 13;
41
+ }
42
+ function is_hash(node) {
43
+ return node.type === 14;
44
+ }
45
+ function is_function(node) {
46
+ return node.type === 15;
47
+ }
48
+ function is_operator(node) {
49
+ return node.type === 16;
50
+ }
51
+ function is_parenthesis(node) {
52
+ return node.type === 17;
53
+ }
54
+ function is_url(node) {
55
+ return node.type === 18;
56
+ }
57
+ function is_unicode_range(node) {
58
+ return node.type === 19;
59
+ }
60
+ function is_if_branch(node) {
61
+ return node.type === 59;
62
+ }
63
+ function is_if_condition(node) {
64
+ return node.type === 60;
65
+ }
66
+ function is_value(node) {
67
+ return node.type === 50;
68
+ }
69
+ function is_type_selector(node) {
70
+ return node.type === 21;
71
+ }
72
+ function is_class_selector(node) {
73
+ return node.type === 22;
74
+ }
75
+ function is_id_selector(node) {
76
+ return node.type === 23;
77
+ }
78
+ function is_attribute_selector(node) {
79
+ return node.type === 24;
80
+ }
81
+ function is_pseudo_class_selector(node) {
82
+ return node.type === 25;
83
+ }
84
+ function is_pseudo_element_selector(node) {
85
+ return node.type === 26;
86
+ }
87
+ function is_combinator(node) {
88
+ return node.type === 27;
89
+ }
90
+ function is_universal_selector(node) {
91
+ return node.type === 28;
92
+ }
93
+ function is_nesting_selector(node) {
94
+ return node.type === 29;
95
+ }
96
+ function is_nth_selector(node) {
97
+ return node.type === 30;
98
+ }
99
+ function is_nth_of_selector(node) {
100
+ return node.type === 31;
101
+ }
102
+ function is_lang_selector(node) {
103
+ return node.type === 56;
104
+ }
105
+ function is_atrule_prelude(node) {
106
+ return node.type === 40;
107
+ }
108
+ function is_media_query(node) {
109
+ return node.type === 32;
110
+ }
111
+ function is_media_feature(node) {
112
+ return node.type === 33;
113
+ }
114
+ function is_media_type(node) {
115
+ return node.type === 34;
116
+ }
117
+ function is_container_query(node) {
118
+ return node.type === 35;
119
+ }
120
+ function is_supports_query(node) {
121
+ return node.type === 36;
122
+ }
123
+ function is_supports_declaration(node) {
124
+ return node.type === 57;
125
+ }
126
+ function is_layer_name(node) {
127
+ return node.type === 37;
128
+ }
129
+ function is_prelude_operator(node) {
130
+ return node.type === 38;
131
+ }
132
+ function is_feature_range(node) {
133
+ return node.type === 39;
134
+ }
135
+ function is_ratio(node) {
136
+ return node.type === 58;
137
+ }
138
+ function is_prelude_selectorlist(node) {
139
+ return node.type === 41;
140
+ }
141
+ //#endregion
142
+ export { is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, 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 };
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-BGvFdbj5.js";
2
- import { D as NthSelector } from "./node-types-YnOKcNfU.js";
1
+ import { l as CSSDataArena } from "./arena-DvT75bvK.js";
2
+ import { O as NthSelector } from "./node-types-CY0JK9_a.js";
3
3
  //#region src/parse-anplusb.d.ts
4
4
  /** @internal */
5
5
  export declare class ANplusBParser {
@@ -1,7 +1,8 @@
1
- import { t as Lexer } from "./tokenize-0ADWAELW.js";
2
- import { l as CSSDataArena } from "./arena-e9O_g2AN.js";
3
- import { c as str_equals, u as str_index_of } from "./parse-dimension-CIaPOmBc.js";
4
- import { t as CSSNode } from "./css-node-DfJEsKN0.js";
1
+ import { t as Lexer } from "./tokenize-Ccg58Z_k.js";
2
+ import "./token-types.js";
3
+ import { l as CSSDataArena } from "./arena-Bsf96CQK.js";
4
+ import { l as str_index_of, s as str_equals } from "./string-utils-DiRRd28d.js";
5
+ import { t as CSSNode } from "./css-node-yoUdFtNg.js";
5
6
  //#region src/parse-anplusb.ts
6
7
  /** @internal */
7
8
  var ANplusBParser = class {
@@ -1,5 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-BGvFdbj5.js";
2
- import { t as AnyNode } from "./node-types-YnOKcNfU.js";
1
+ import { l as CSSDataArena } from "./arena-DvT75bvK.js";
2
+ import { t as AnyNode } from "./node-types-CY0JK9_a.js";
3
3
  //#region src/parse-atrule-prelude.d.ts
4
4
  /** @internal */
5
5
  export declare class AtRulePreludeParser {
@@ -1,9 +1,10 @@
1
- import { t as Lexer } from "./tokenize-0ADWAELW.js";
2
- import { l as CSSDataArena } from "./arena-e9O_g2AN.js";
3
- import { f as strip_vendor_prefix, l as str_equals_range, r as is_and_or_not_range } from "./parse-dimension-CIaPOmBc.js";
4
- import { t as CSSNode } from "./css-node-DfJEsKN0.js";
5
- import { s as trim_boundaries } from "./parse-selector-rTXB4IN2.js";
6
- import { n as ConditionParser, t as ValueNodeParser } from "./value-node-parser-DizbcN1a.js";
1
+ import { t as Lexer } from "./tokenize-Ccg58Z_k.js";
2
+ import "./token-types.js";
3
+ import { l as CSSDataArena } from "./arena-Bsf96CQK.js";
4
+ import { c as str_equals_range, d as strip_vendor_prefix, t as is_and_or_not_range } from "./string-utils-DiRRd28d.js";
5
+ import { t as CSSNode } from "./css-node-yoUdFtNg.js";
6
+ import { s as trim_boundaries } from "./parse-selector-CqIpnBrQ.js";
7
+ import { n as ConditionParser, t as ValueNodeParser } from "./value-node-parser-BBwBxFR_.js";
7
8
  //#region src/parse-atrule-prelude.ts
8
9
  /** @internal */
9
10
  var AtRulePreludeParser = class {
@@ -50,11 +51,11 @@ var AtRulePreludeParser = class {
50
51
  return [];
51
52
  }
52
53
  parse_media_query_list() {
53
- let nodes = [];
54
+ const nodes = [];
54
55
  while (this.lexer.pos < this.prelude_end) {
55
56
  this.skip_whitespace();
56
57
  if (this.lexer.pos >= this.prelude_end) break;
57
- let query = this.parse_single_media_query();
58
+ const query = this.parse_single_media_query();
58
59
  if (query !== null) nodes.push(query);
59
60
  this.skip_whitespace();
60
61
  const saved = this.lexer.save_position();
@@ -73,7 +74,7 @@ var AtRulePreludeParser = class {
73
74
  let content_end = this.lexer.pos;
74
75
  let close_end = this.lexer.token_end;
75
76
  while (this.lexer.pos < this.prelude_end && depth > 0) {
76
- let token_type = this.next_token();
77
+ const token_type = this.next_token();
77
78
  if (token_type === 21 || token_type === 2) depth++;
78
79
  else if (token_type === 22) {
79
80
  depth--;
@@ -88,7 +89,7 @@ var AtRulePreludeParser = class {
88
89
  return depth === 0;
89
90
  }
90
91
  parse_single_media_query() {
91
- let query_start = this.lexer.pos;
92
+ const query_start = this.lexer.pos;
92
93
  this.skip_whitespace();
93
94
  if (this.lexer.pos >= this.prelude_end) return null;
94
95
  let first_component = 0;
@@ -96,11 +97,11 @@ var AtRulePreludeParser = class {
96
97
  const saved_token_start = this.lexer.save_position();
97
98
  this.next_token();
98
99
  if (this.lexer.token_type === 1) {
99
- let source = this.source;
100
- let token_start = this.lexer.token_start;
101
- let token_end = this.lexer.token_end;
100
+ const source = this.source;
101
+ const token_start = this.lexer.token_start;
102
+ const token_end = this.lexer.token_end;
102
103
  if (str_equals_range(source, token_start, token_end, "only") || str_equals_range(source, token_start, token_end, "not")) {
103
- let modifier = this.create_node(38, token_start, token_end);
104
+ const modifier = this.create_node(38, token_start, token_end);
104
105
  first_component = modifier;
105
106
  last_component = modifier;
106
107
  } else this.lexer.restore_position(saved_token_start);
@@ -110,14 +111,14 @@ var AtRulePreludeParser = class {
110
111
  if (this.lexer.pos >= this.prelude_end) break;
111
112
  if (this.peek_token_type() === 18) break;
112
113
  this.next_token();
113
- let token_type = this.lexer.token_type;
114
+ const token_type = this.lexer.token_type;
114
115
  let component = null;
115
116
  if (token_type === 21) {
116
117
  component = this.condition_parser.parse_media_feature(this.lexer.token_start, this.prelude_end, this.lexer.token_line, this.lexer.token_column);
117
118
  if (component !== null) this.condition_parser.seek_to_end(this.lexer);
118
119
  } else if (token_type === 1) {
119
- let token_start = this.lexer.token_start;
120
- let token_end = this.lexer.token_end;
120
+ const token_start = this.lexer.token_start;
121
+ const token_end = this.lexer.token_end;
121
122
  if (is_and_or_not_range(this.source, token_start, token_end)) component = this.create_node(38, token_start, token_end);
122
123
  else component = this.create_node(34, token_start, token_end);
123
124
  } else break;
@@ -128,19 +129,19 @@ var AtRulePreludeParser = class {
128
129
  }
129
130
  }
130
131
  if (first_component === 0) return null;
131
- let query_node = this.create_node(32, query_start, this.lexer.pos);
132
+ const query_node = this.create_node(32, query_start, this.lexer.pos);
132
133
  this.arena.set_first_child(query_node, first_component);
133
134
  return query_node;
134
135
  }
135
136
  parse_container_query() {
136
- let query_start = this.lexer.pos;
137
+ const query_start = this.lexer.pos;
137
138
  let first_component = 0;
138
139
  let last_component = 0;
139
140
  while (this.lexer.pos < this.prelude_end) {
140
141
  this.skip_whitespace();
141
142
  if (this.lexer.pos >= this.prelude_end) break;
142
143
  this.next_token();
143
- let token_type = this.lexer.token_type;
144
+ const token_type = this.lexer.token_type;
144
145
  let component = null;
145
146
  if (token_type === 21) {
146
147
  component = this.condition_parser.parse_media_feature(this.lexer.token_start, this.prelude_end, this.lexer.token_line, this.lexer.token_column);
@@ -149,8 +150,8 @@ var AtRulePreludeParser = class {
149
150
  component = this.condition_parser.parse_function_condition(this.lexer.token_start, this.prelude_end, this.lexer.token_line, this.lexer.token_column);
150
151
  this.condition_parser.seek_to_end(this.lexer);
151
152
  } else if (token_type === 1) {
152
- let token_start = this.lexer.token_start;
153
- let token_end = this.lexer.token_end;
153
+ const token_start = this.lexer.token_start;
154
+ const token_end = this.lexer.token_end;
154
155
  if (is_and_or_not_range(this.source, token_start, token_end)) component = this.create_node(38, token_start, token_end);
155
156
  else component = this.create_node(10, token_start, token_end);
156
157
  }
@@ -161,7 +162,7 @@ var AtRulePreludeParser = class {
161
162
  }
162
163
  }
163
164
  if (first_component === 0) return [];
164
- let query_node = this.create_node(35, query_start, this.lexer.pos);
165
+ const query_node = this.create_node(35, query_start, this.lexer.pos);
165
166
  this.arena.set_first_child(query_node, first_component);
166
167
  return [query_node];
167
168
  }
@@ -169,29 +170,29 @@ var AtRulePreludeParser = class {
169
170
  return this.condition_parser.parse_supports_condition(this.lexer.pos, this.prelude_end, this.lexer.line, this.lexer.column);
170
171
  }
171
172
  parse_layer_names() {
172
- let nodes = [];
173
+ const nodes = [];
173
174
  while (this.lexer.pos < this.prelude_end) {
174
175
  this.skip_whitespace();
175
176
  if (this.lexer.pos >= this.prelude_end) break;
176
177
  this.next_token();
177
- let token_type = this.lexer.token_type;
178
+ const token_type = this.lexer.token_type;
178
179
  if (token_type === 1) {
179
- let name_start = this.lexer.token_start;
180
+ const name_start = this.lexer.token_start;
180
181
  let name_end = this.lexer.token_end;
181
182
  while (this.lexer.pos < this.prelude_end) {
182
- let saved = this.lexer.save_position();
183
+ const saved = this.lexer.save_position();
183
184
  if (this.next_token() !== 9 || this.source.charCodeAt(this.lexer.token_start) !== 46 || this.lexer.token_start !== name_end) {
184
185
  this.lexer.restore_position(saved);
185
186
  break;
186
187
  }
187
- let dot_end = this.lexer.token_end;
188
+ const dot_end = this.lexer.token_end;
188
189
  if (this.next_token() !== 1 || this.lexer.token_start !== dot_end) {
189
190
  this.lexer.restore_position(saved);
190
191
  break;
191
192
  }
192
193
  name_end = this.lexer.token_end;
193
194
  }
194
- let layer = this.create_node(37, name_start, name_end);
195
+ const layer = this.create_node(37, name_start, name_end);
195
196
  this.arena.set_content_start_delta(layer, 0);
196
197
  this.arena.set_content_length(layer, name_end - name_start);
197
198
  nodes.push(layer);
@@ -205,8 +206,8 @@ var AtRulePreludeParser = class {
205
206
  if (this.lexer.pos >= this.prelude_end) return [];
206
207
  this.next_token();
207
208
  if (this.lexer.token_type !== 2) return [];
208
- let name_start = this.lexer.token_start;
209
- let name_end = this.lexer.token_end - 1;
209
+ const name_start = this.lexer.token_start;
210
+ const name_end = this.lexer.token_end - 1;
210
211
  return [this.create_node(10, name_start, name_end)];
211
212
  }
212
213
  parse_identifier() {
@@ -224,30 +225,30 @@ var AtRulePreludeParser = class {
224
225
  return [this.create_node(13, this.lexer.token_start, this.lexer.token_end)];
225
226
  }
226
227
  parse_import_prelude() {
227
- let nodes = [];
228
+ const nodes = [];
228
229
  this.skip_whitespace();
229
230
  if (this.lexer.pos >= this.prelude_end) return [];
230
- let url_node = this.parse_import_url();
231
+ const url_node = this.parse_import_url();
231
232
  if (url_node === null) return [];
232
233
  nodes.push(url_node);
233
234
  this.skip_whitespace();
234
235
  if (this.lexer.pos >= this.prelude_end) return nodes;
235
- let layer_node = this.parse_import_layer();
236
+ const layer_node = this.parse_import_layer();
236
237
  if (layer_node !== null) nodes.push(layer_node);
237
238
  this.skip_whitespace();
238
239
  if (this.lexer.pos >= this.prelude_end) return nodes;
239
- let supports_node = this.parse_import_supports();
240
+ const supports_node = this.parse_import_supports();
240
241
  if (supports_node !== null) nodes.push(supports_node);
241
242
  this.skip_whitespace();
242
243
  if (this.lexer.pos >= this.prelude_end) return nodes;
243
- let media_nodes = this.parse_media_query_list();
244
+ const media_nodes = this.parse_media_query_list();
244
245
  nodes.push(...media_nodes);
245
246
  return nodes;
246
247
  }
247
248
  parse_import_url() {
248
249
  this.next_token();
249
250
  if (this.lexer.token_type !== 7 && this.lexer.token_type !== 2 && this.lexer.token_type !== 5) return null;
250
- let url_start = this.lexer.token_start;
251
+ const url_start = this.lexer.token_start;
251
252
  let url_end = this.lexer.token_end;
252
253
  if (this.lexer.token_type === 2) {
253
254
  this.scan_matching_paren();
@@ -259,25 +260,25 @@ var AtRulePreludeParser = class {
259
260
  const saved = this.lexer.save_position();
260
261
  this.next_token();
261
262
  if (this.lexer.token_type === 1 || this.lexer.token_type === 2) {
262
- let name_end = this.lexer.token_type === 2 ? this.lexer.token_end - 1 : this.lexer.token_end;
263
+ const name_end = this.lexer.token_type === 2 ? this.lexer.token_end - 1 : this.lexer.token_end;
263
264
  if (str_equals_range(this.source, this.lexer.token_start, name_end, "layer")) {
264
- let layer_start = this.lexer.token_start;
265
+ const layer_start = this.lexer.token_start;
265
266
  let layer_end = this.lexer.token_end;
266
267
  let content_start = 0;
267
268
  let content_length = 0;
268
269
  if (this.lexer.token_type === 2) {
269
270
  content_start = this.lexer.pos;
270
- let matched = this.scan_matching_paren();
271
- let content_end = this.paren_content_end;
272
- let close_end = this.paren_close_end;
271
+ const matched = this.scan_matching_paren();
272
+ const content_end = this.paren_content_end;
273
+ const close_end = this.paren_close_end;
273
274
  if (matched) {
274
275
  content_length = content_end - content_start;
275
276
  layer_end = close_end;
276
277
  }
277
278
  }
278
- let layer_node = this.create_node(37, layer_start, layer_end);
279
+ const layer_node = this.create_node(37, layer_start, layer_end);
279
280
  if (content_length > 0) {
280
- let trimmed = trim_boundaries(this.source, content_start, content_start + content_length);
281
+ const trimmed = trim_boundaries(this.source, content_start, content_start + content_length);
281
282
  if (trimmed) {
282
283
  this.arena.set_content_start_delta(layer_node, trimmed[0] - layer_start);
283
284
  this.arena.set_content_length(layer_node, trimmed[1] - trimmed[0]);
@@ -294,17 +295,17 @@ var AtRulePreludeParser = class {
294
295
  this.next_token();
295
296
  if (this.lexer.token_type === 2) {
296
297
  if (str_equals_range(this.source, this.lexer.token_start, this.lexer.token_end - 1, "supports")) {
297
- let supports_start = this.lexer.token_start;
298
- let content_start = this.lexer.token_end;
298
+ const supports_start = this.lexer.token_start;
299
+ const content_start = this.lexer.token_end;
299
300
  this.scan_matching_paren();
300
- let content_end = this.paren_content_end;
301
- let supports_end = this.paren_close_end;
302
- let supports_node = this.create_node(36, supports_start, supports_end);
303
- let trimmed = trim_boundaries(this.source, content_start, content_end);
301
+ const content_end = this.paren_content_end;
302
+ const supports_end = this.paren_close_end;
303
+ const supports_node = this.create_node(36, supports_start, supports_end);
304
+ const trimmed = trim_boundaries(this.source, content_start, content_end);
304
305
  if (trimmed) {
305
306
  this.arena.set_value_start_delta(supports_node, trimmed[0] - supports_start);
306
307
  this.arena.set_value_length(supports_node, trimmed[1] - trimmed[0]);
307
- let decl_child = this.condition_parser.parse_supports_declaration_content(trimmed[0], trimmed[1]);
308
+ const decl_child = this.condition_parser.parse_supports_declaration_content(trimmed[0], trimmed[1]);
308
309
  if (decl_child !== null) this.arena.set_first_child(supports_node, decl_child);
309
310
  }
310
311
  return supports_node;
@@ -319,7 +320,7 @@ var AtRulePreludeParser = class {
319
320
  peek_token_type() {
320
321
  const saved = this.lexer.save_position();
321
322
  this.next_token();
322
- let type = this.lexer.token_type;
323
+ const type = this.lexer.token_type;
323
324
  this.lexer.restore_position(saved);
324
325
  return type;
325
326
  }
@@ -331,7 +332,7 @@ var AtRulePreludeParser = class {
331
332
  return this.lexer.next_token_fast(false);
332
333
  }
333
334
  parse_namespace_prelude() {
334
- let nodes = [];
335
+ const nodes = [];
335
336
  this.skip_whitespace();
336
337
  if (this.lexer.pos >= this.prelude_end) return [];
337
338
  const saved = this.lexer.save_position();
@@ -345,20 +346,20 @@ var AtRulePreludeParser = class {
345
346
  return nodes;
346
347
  }
347
348
  parse_scope_prelude() {
348
- let nodes = [];
349
+ const nodes = [];
349
350
  while (this.lexer.pos < this.prelude_end) {
350
351
  this.skip_whitespace();
351
352
  if (this.lexer.pos >= this.prelude_end) break;
352
353
  const token_type = this.peek_token_type();
353
354
  if (token_type === 21) {
354
355
  this.next_token();
355
- let paren_start = this.lexer.token_start;
356
- let content_start = this.lexer.pos;
356
+ const paren_start = this.lexer.token_start;
357
+ const content_start = this.lexer.pos;
357
358
  this.scan_matching_paren();
358
- let content_end = this.paren_content_end;
359
- let paren_end = this.paren_close_end;
360
- let scope_node = this.create_node(41, paren_start, paren_end);
361
- let trimmed = trim_boundaries(this.source, content_start, content_end);
359
+ const content_end = this.paren_content_end;
360
+ const paren_end = this.paren_close_end;
361
+ const scope_node = this.create_node(41, paren_start, paren_end);
362
+ const trimmed = trim_boundaries(this.source, content_start, content_end);
362
363
  if (trimmed) {
363
364
  this.arena.set_value_start_delta(scope_node, trimmed[0] - paren_start);
364
365
  this.arena.set_value_length(scope_node, trimmed[1] - trimmed[0]);
@@ -372,7 +373,7 @@ var AtRulePreludeParser = class {
372
373
  return nodes;
373
374
  }
374
375
  parse_custom_media_prelude() {
375
- let nodes = [];
376
+ const nodes = [];
376
377
  this.skip_whitespace();
377
378
  if (this.lexer.pos >= this.prelude_end) return [];
378
379
  this.next_token();
@@ -1,6 +1,6 @@
1
- import { l as CSSDataArena } from "./arena-BGvFdbj5.js";
2
- import { n as Lexer } from "./tokenize-CaWtrHw_.js";
3
- import { d as Declaration } from "./node-types-YnOKcNfU.js";
1
+ import { l as CSSDataArena } from "./arena-DvT75bvK.js";
2
+ import { Lexer } from "./tokenize.js";
3
+ import { f as Declaration } from "./node-types-CY0JK9_a.js";
4
4
  //#region src/parse-declaration.d.ts
5
5
  /** @internal */
6
6
  export declare class DeclarationParser {