@projectwallace/css-parser 0.13.10 → 0.14.0

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.
@@ -0,0 +1,456 @@
1
+ import { A as PRELUDE_SELECTORLIST, B as TYPE_SELECTOR, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as SELECTOR_LIST, H as UNIVERSAL_SELECTOR, 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 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_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_QUERY } from "./arena-D6TANE5e.js";
2
+
3
+ //#region src/css-node.d.ts
4
+ declare const TYPE_NAMES: {
5
+ readonly 1: "StyleSheet";
6
+ readonly 2: "Rule";
7
+ readonly 3: "Atrule";
8
+ readonly 4: "Declaration";
9
+ readonly 5: "Selector";
10
+ readonly 6: "Comment";
11
+ readonly 7: "Block";
12
+ readonly 8: "Raw";
13
+ readonly 10: "Identifier";
14
+ readonly 11: "Number";
15
+ readonly 12: "Dimension";
16
+ readonly 13: "String";
17
+ readonly 14: "Hash";
18
+ readonly 15: "Function";
19
+ readonly 16: "Operator";
20
+ readonly 17: "Parentheses";
21
+ readonly 18: "Url";
22
+ readonly 19: "UnicodeRange";
23
+ readonly 50: "Value";
24
+ readonly 20: "SelectorList";
25
+ readonly 21: "TypeSelector";
26
+ readonly 22: "ClassSelector";
27
+ readonly 23: "IdSelector";
28
+ readonly 24: "AttributeSelector";
29
+ readonly 25: "PseudoClassSelector";
30
+ readonly 26: "PseudoElementSelector";
31
+ readonly 27: "Combinator";
32
+ readonly 28: "UniversalSelector";
33
+ readonly 29: "NestingSelector";
34
+ readonly 30: "Nth";
35
+ readonly 31: "NthOf";
36
+ readonly 56: "Lang";
37
+ readonly 32: "MediaQuery";
38
+ readonly 33: "Feature";
39
+ readonly 34: "MediaType";
40
+ readonly 35: "ContainerQuery";
41
+ readonly 36: "SupportsQuery";
42
+ readonly 37: "Layer";
43
+ readonly 38: "Operator";
44
+ readonly 39: "MediaFeatureRange";
45
+ readonly 40: "AtrulePrelude";
46
+ readonly 41: "PreludeSelectorList";
47
+ };
48
+ 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;
50
+ interface CloneOptions {
51
+ /**
52
+ * Recursively clone all children
53
+ * @default true
54
+ */
55
+ deep?: boolean;
56
+ /**
57
+ * Include location information (line, column, start, length)
58
+ * @default false
59
+ */
60
+ locations?: boolean;
61
+ }
62
+ type PlainCSSNode = {
63
+ type: number;
64
+ type_name: TypeName;
65
+ text: string;
66
+ children?: PlainCSSNode[];
67
+ child_count?: number;
68
+ has_children?: boolean;
69
+ name?: string;
70
+ property?: string;
71
+ value?: PlainCSSNode | string | number | null;
72
+ unit?: string;
73
+ prelude?: PlainCSSNode | null;
74
+ is_important?: boolean;
75
+ is_vendor_prefixed?: boolean;
76
+ is_browserhack?: boolean;
77
+ has_error?: boolean;
78
+ attr_operator?: string | null;
79
+ attr_flags?: string | null;
80
+ nth_a?: string | null;
81
+ nth_b?: string | null;
82
+ line?: number;
83
+ column?: number;
84
+ start?: number;
85
+ length?: number;
86
+ end?: number;
87
+ };
88
+ //#endregion
89
+ //#region src/node-types.d.ts
90
+ interface CSSNode {
91
+ readonly type: CSSNodeType;
92
+ readonly type_name: TypeName;
93
+ readonly text: string;
94
+ readonly has_error: boolean;
95
+ readonly is_vendor_prefixed: boolean;
96
+ readonly line: number;
97
+ readonly column: number;
98
+ readonly start: number;
99
+ readonly length: number;
100
+ readonly end: number;
101
+ /** Low-level linked-list pointer used by walk()/traverse(). Prefer .children on nodes that have it. */
102
+ readonly first_child: CSSNode | null;
103
+ /** Low-level linked-list pointer used by walk()/traverse(). */
104
+ readonly next_sibling: CSSNode | null;
105
+ readonly has_next: boolean;
106
+ clone(options?: CloneOptions): PlainCSSNode;
107
+ }
108
+ /**
109
+ * Mixin for node types that have child nodes.
110
+ *
111
+ * Only a subset of node types expose children — structural and container nodes
112
+ * like StyleSheet, Block, SelectorList, Value, Function, etc. Leaf nodes
113
+ * (Identifier, Number, Dimension, …) do not extend WithChildren, reflecting
114
+ * that they never carry child nodes in a well-formed tree.
115
+ */
116
+ interface WithChildren {
117
+ readonly has_children: boolean;
118
+ readonly child_count: number;
119
+ readonly children: AnyNode[];
120
+ [Symbol.iterator](): Iterator<AnyNode>;
121
+ }
122
+ /**
123
+ * Maps a CssNodeCommon subtype interface to its plain-object equivalent,
124
+ * as returned by clone().
125
+ *
126
+ * The result is always a subtype of PlainCSSNode (the intersection starts
127
+ * with PlainCSSNode), with two additions:
128
+ * - `type` is narrowed to T's specific literal (enables discriminated unions)
129
+ * - subtype-specific properties (those not on CssNodeCommon) are added with
130
+ * CssNodeCommon references replaced by PlainCSSNode
131
+ *
132
+ * Traversal properties (first_child, next_sibling, etc.) are excluded since
133
+ * they live on CssNodeCommon and are never serialised by clone().
134
+ *
135
+ * const rule = root.first_child as Rule
136
+ * rule.clone().prelude // PlainCSSNode | null — not PlainCSSNode | undefined
137
+ * rule.clone().block // PlainCSSNode | null
138
+ */
139
+ type ToPlain<T extends CSSNode> = PlainCSSNode & {
140
+ type: T['type'];
141
+ } & { [K in Exclude<keyof T, keyof CSSNode | symbol | 'attr_operator' | 'attr_flags' | 'has_children' | 'child_count' | 'children'> as T[K] extends ((...args: any[]) => any) ? never : K]: T[K] extends CSSNode | null | undefined ? PlainCSSNode | Exclude<T[K], CSSNode> : T[K] extends CSSNode[] ? PlainCSSNode[] : T[K] };
142
+ interface StyleSheet extends CSSNode, WithChildren {
143
+ readonly type: typeof STYLESHEET;
144
+ clone(options?: CloneOptions): ToPlain<StyleSheet>;
145
+ }
146
+ type Rule = CSSNode & {
147
+ readonly type: typeof STYLE_RULE;
148
+ readonly name: string;
149
+ readonly has_declarations: boolean;
150
+ clone(options?: CloneOptions): ToPlain<Rule>;
151
+ } & /** SELECTOR_LIST (parse_selectors=true) or RAW (parse_selectors=false) */({
152
+ readonly has_prelude: true;
153
+ readonly prelude: SelectorList | Raw;
154
+ } | {
155
+ readonly has_prelude: false;
156
+ readonly prelude: null;
157
+ }) & ({
158
+ readonly has_block: true;
159
+ readonly block: Block;
160
+ } | {
161
+ readonly has_block: false;
162
+ readonly block: null;
163
+ });
164
+ type Atrule = CSSNode & {
165
+ readonly type: typeof AT_RULE; /** At-rule keyword, e.g. "media", "keyframes" */
166
+ readonly name: string;
167
+ readonly has_declarations: boolean;
168
+ clone(options?: CloneOptions): ToPlain<Atrule>;
169
+ } & /** AT_RULE_PRELUDE (parse_atrule_preludes=true) or RAW (parse_atrule_preludes=false) */({
170
+ readonly has_prelude: true;
171
+ readonly prelude: AtrulePrelude | Raw;
172
+ } | {
173
+ readonly has_prelude: false;
174
+ readonly prelude: null;
175
+ }) & ({
176
+ readonly has_block: true;
177
+ readonly block: Block;
178
+ } | {
179
+ readonly has_block: false;
180
+ readonly block: null;
181
+ });
182
+ interface Declaration extends CSSNode {
183
+ readonly type: typeof DECLARATION;
184
+ /** Property name, e.g. "color" */
185
+ readonly property: string;
186
+ /** VALUE node (parse_values=true), RAW node (parse_values=false), or null */
187
+ readonly value: Value | Raw | null;
188
+ readonly is_important: boolean;
189
+ readonly is_browserhack: boolean;
190
+ clone(options?: CloneOptions): ToPlain<Declaration>;
191
+ }
192
+ interface Selector extends CSSNode, WithChildren {
193
+ readonly type: typeof SELECTOR;
194
+ clone(options?: CloneOptions): ToPlain<Selector>;
195
+ }
196
+ interface SelectorList extends CSSNode, WithChildren {
197
+ readonly type: typeof SELECTOR_LIST;
198
+ clone(options?: CloneOptions): ToPlain<SelectorList>;
199
+ }
200
+ interface Block extends CSSNode, WithChildren {
201
+ readonly type: typeof BLOCK;
202
+ readonly is_empty: boolean;
203
+ clone(options?: CloneOptions): ToPlain<Block>;
204
+ }
205
+ interface Comment extends CSSNode {
206
+ readonly type: typeof COMMENT;
207
+ clone(options?: CloneOptions): ToPlain<Comment>;
208
+ }
209
+ interface Raw extends CSSNode {
210
+ readonly type: typeof RAW;
211
+ clone(options?: CloneOptions): ToPlain<Raw>;
212
+ }
213
+ interface Identifier extends CSSNode {
214
+ readonly type: typeof IDENTIFIER;
215
+ readonly name: string;
216
+ clone(options?: CloneOptions): ToPlain<Identifier>;
217
+ }
218
+ interface Number extends CSSNode {
219
+ readonly type: typeof NUMBER;
220
+ readonly value: number;
221
+ clone(options?: CloneOptions): ToPlain<Number>;
222
+ }
223
+ interface Dimension extends CSSNode {
224
+ readonly type: typeof DIMENSION;
225
+ readonly value: number;
226
+ /** Unit string, e.g. "px", "%" */
227
+ readonly unit: string;
228
+ clone(options?: CloneOptions): ToPlain<Dimension>;
229
+ }
230
+ interface String extends CSSNode {
231
+ readonly type: typeof STRING;
232
+ clone(options?: CloneOptions): ToPlain<String>;
233
+ }
234
+ interface Hash extends CSSNode {
235
+ readonly type: typeof HASH;
236
+ clone(options?: CloneOptions): ToPlain<Hash>;
237
+ }
238
+ interface Function extends CSSNode, WithChildren {
239
+ readonly type: typeof FUNCTION;
240
+ /** Function name, e.g. "rgb", "calc" */
241
+ readonly name: string;
242
+ /** Function arguments as raw text, e.g. "255, 0, 0" for rgb(255, 0, 0) */
243
+ readonly value: string | null;
244
+ clone(options?: CloneOptions): ToPlain<Function>;
245
+ }
246
+ interface Operator extends CSSNode {
247
+ readonly type: typeof OPERATOR;
248
+ /** The operator character(s), e.g. ",", "+", "-" */
249
+ readonly value: string;
250
+ clone(options?: CloneOptions): ToPlain<Operator>;
251
+ }
252
+ interface Parenthesis extends CSSNode, WithChildren {
253
+ readonly type: typeof PARENTHESIS;
254
+ clone(options?: CloneOptions): ToPlain<Parenthesis>;
255
+ }
256
+ interface Url extends CSSNode {
257
+ readonly type: typeof URL;
258
+ /** URL content, e.g. '"image.png"' (with quotes) or 'mycursor.cur' (unquoted) */
259
+ readonly value: string | null;
260
+ clone(options?: CloneOptions): ToPlain<Url>;
261
+ }
262
+ interface UnicodeRange extends CSSNode {
263
+ readonly type: typeof UNICODE_RANGE;
264
+ clone(options?: CloneOptions): ToPlain<UnicodeRange>;
265
+ }
266
+ interface Value extends CSSNode, WithChildren {
267
+ readonly type: typeof VALUE;
268
+ clone(options?: CloneOptions): ToPlain<Value>;
269
+ }
270
+ interface TypeSelector extends CSSNode {
271
+ readonly type: typeof TYPE_SELECTOR;
272
+ /** Element type, e.g. "div", "span" */
273
+ readonly name: string;
274
+ clone(options?: CloneOptions): ToPlain<TypeSelector>;
275
+ }
276
+ interface ClassSelector extends CSSNode {
277
+ readonly type: typeof CLASS_SELECTOR;
278
+ /** Class name without dot, e.g. "foo" from ".foo" */
279
+ readonly name: string;
280
+ clone(options?: CloneOptions): ToPlain<ClassSelector>;
281
+ }
282
+ interface IdSelector extends CSSNode {
283
+ readonly type: typeof ID_SELECTOR;
284
+ /** Id without hash, e.g. "bar" from "#bar" */
285
+ readonly name: string;
286
+ clone(options?: CloneOptions): ToPlain<IdSelector>;
287
+ }
288
+ interface AttributeSelector extends CSSNode {
289
+ readonly type: typeof ATTRIBUTE_SELECTOR;
290
+ /** Attribute name, e.g. "href" from "[href]" */
291
+ readonly name: string;
292
+ /** Operator string, e.g. "=", "~=", "|="; null if no operator ([attr] form) */
293
+ readonly attr_operator: string | null;
294
+ /** Flag character, e.g. "i", "s"; null if no flag */
295
+ readonly attr_flags: string | null;
296
+ clone(options?: CloneOptions): ToPlain<AttributeSelector>;
297
+ }
298
+ interface PseudoClassSelector extends CSSNode, WithChildren {
299
+ readonly type: typeof PSEUDO_CLASS_SELECTOR;
300
+ /** Pseudo-class name without colon, e.g. "hover" */
301
+ readonly name: string;
302
+ clone(options?: CloneOptions): ToPlain<PseudoClassSelector>;
303
+ }
304
+ interface PseudoElementSelector extends CSSNode, WithChildren {
305
+ readonly type: typeof PSEUDO_ELEMENT_SELECTOR;
306
+ /** Pseudo-element name without colons, e.g. "before" */
307
+ readonly name: string;
308
+ clone(options?: CloneOptions): ToPlain<PseudoElementSelector>;
309
+ }
310
+ interface Combinator extends CSSNode {
311
+ readonly type: typeof COMBINATOR;
312
+ /** Combinator character(s), e.g. " ", ">", "~", "+", "||", "/deep/" */
313
+ readonly name: string;
314
+ clone(options?: CloneOptions): ToPlain<Combinator>;
315
+ }
316
+ interface UniversalSelector extends CSSNode {
317
+ readonly type: typeof UNIVERSAL_SELECTOR;
318
+ /** Namespace qualifier (e.g. 'ns' in 'ns|*'), undefined if no namespace */
319
+ readonly name: string | undefined;
320
+ clone(options?: CloneOptions): ToPlain<UniversalSelector>;
321
+ }
322
+ interface NestingSelector extends CSSNode {
323
+ readonly type: typeof NESTING_SELECTOR;
324
+ clone(options?: CloneOptions): ToPlain<NestingSelector>;
325
+ }
326
+ interface NthSelector extends CSSNode {
327
+ readonly type: typeof NTH_SELECTOR;
328
+ readonly nth_a: string | undefined;
329
+ readonly nth_b: string | undefined;
330
+ clone(options?: CloneOptions): ToPlain<NthSelector>;
331
+ }
332
+ interface NthOfSelector extends CSSNode {
333
+ readonly type: typeof NTH_OF_SELECTOR;
334
+ /** The An+B formula node */
335
+ readonly nth: NthSelector | null;
336
+ /** The selector list from :nth-child(An+B of <selector>) */
337
+ readonly selector: SelectorList | null;
338
+ clone(options?: CloneOptions): ToPlain<NthOfSelector>;
339
+ }
340
+ interface LangSelector extends CSSNode {
341
+ readonly type: typeof LANG_SELECTOR;
342
+ clone(options?: CloneOptions): ToPlain<LangSelector>;
343
+ }
344
+ interface AtrulePrelude extends CSSNode, WithChildren {
345
+ readonly type: typeof AT_RULE_PRELUDE;
346
+ clone(options?: CloneOptions): ToPlain<AtrulePrelude>;
347
+ }
348
+ interface MediaQuery extends CSSNode, WithChildren {
349
+ readonly type: typeof MEDIA_QUERY;
350
+ clone(options?: CloneOptions): ToPlain<MediaQuery>;
351
+ }
352
+ interface MediaFeature extends CSSNode, WithChildren {
353
+ readonly type: typeof MEDIA_FEATURE;
354
+ /** Feature name, e.g. "min-width" */
355
+ readonly property: string;
356
+ clone(options?: CloneOptions): ToPlain<MediaFeature>;
357
+ }
358
+ interface MediaType extends CSSNode {
359
+ readonly type: typeof MEDIA_TYPE;
360
+ /** Media type text, e.g. "screen", "print" */
361
+ readonly value: string;
362
+ clone(options?: CloneOptions): ToPlain<MediaType>;
363
+ }
364
+ interface ContainerQuery extends CSSNode, WithChildren {
365
+ readonly type: typeof CONTAINER_QUERY;
366
+ clone(options?: CloneOptions): ToPlain<ContainerQuery>;
367
+ }
368
+ interface SupportsQuery extends CSSNode {
369
+ readonly type: typeof SUPPORTS_QUERY;
370
+ /** The supports condition text, e.g. "display: flex" from "supports(display: flex)" */
371
+ readonly value: string;
372
+ clone(options?: CloneOptions): ToPlain<SupportsQuery>;
373
+ }
374
+ interface LayerName extends CSSNode {
375
+ readonly type: typeof LAYER_NAME;
376
+ readonly name: string;
377
+ /** Alias for name — the layer name string, e.g. "base" from "layer(base)" */
378
+ readonly value: string;
379
+ clone(options?: CloneOptions): ToPlain<LayerName>;
380
+ }
381
+ /**
382
+ * A parenthesised selector argument in an at-rule prelude.
383
+ *
384
+ * This node type exists because at-rule preludes that contain selectors (like
385
+ * @scope) cannot reuse SELECTOR_LIST: that type already appears inside the
386
+ * rule's block, and mixing the two would make traversal ambiguous. A distinct
387
+ * type lets walkers and tooling distinguish "this is a selector used as a
388
+ * scoping argument" from "this is a selector that matches elements".
389
+ *
390
+ * Currently produced only by @scope:
391
+ * @scope (.parent) to (.child) { }
392
+ * ^^^^^^^^^ ^^^^^^^^ — each parenthesised group is a PRELUDE_SELECTORLIST
393
+ *
394
+ * `value` is the raw selector text inside the parentheses, trimmed of
395
+ * whitespace: ".parent" from "(.parent)".
396
+ */
397
+ interface PreludeSelectorList extends CSSNode {
398
+ readonly type: typeof PRELUDE_SELECTORLIST;
399
+ readonly value: string;
400
+ clone(options?: CloneOptions): ToPlain<PreludeSelectorList>;
401
+ }
402
+ interface PreludeOperator extends CSSNode {
403
+ readonly type: typeof PRELUDE_OPERATOR;
404
+ clone(options?: CloneOptions): ToPlain<PreludeOperator>;
405
+ }
406
+ interface FeatureRange extends CSSNode, WithChildren {
407
+ readonly type: typeof FEATURE_RANGE;
408
+ /** The feature name in a range comparison, e.g. "width" from "(width >= 400px)" */
409
+ readonly name: string;
410
+ clone(options?: CloneOptions): ToPlain<FeatureRange>;
411
+ }
412
+ 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 | LayerName | PreludeOperator | FeatureRange | PreludeSelectorList;
413
+ declare function is_stylesheet(node: CSSNode): node is StyleSheet;
414
+ declare function is_rule(node: CSSNode): node is Rule;
415
+ declare function is_atrule(node: CSSNode): node is Atrule;
416
+ declare function is_declaration(node: CSSNode): node is Declaration;
417
+ declare function is_selector(node: CSSNode): node is Selector;
418
+ declare function is_selector_list(node: CSSNode): node is SelectorList;
419
+ declare function is_block(node: CSSNode): node is Block;
420
+ declare function is_comment(node: CSSNode): node is Comment;
421
+ declare function is_raw(node: CSSNode): node is Raw;
422
+ declare function is_identifier(node: CSSNode): node is Identifier;
423
+ declare function is_number(node: CSSNode): node is Number;
424
+ declare function is_dimension(node: CSSNode): node is Dimension;
425
+ declare function is_string(node: CSSNode): node is String;
426
+ declare function is_hash(node: CSSNode): node is Hash;
427
+ declare function is_function(node: CSSNode): node is Function;
428
+ declare function is_operator(node: CSSNode): node is Operator;
429
+ declare function is_parenthesis(node: CSSNode): node is Parenthesis;
430
+ declare function is_url(node: CSSNode): node is Url;
431
+ declare function is_unicode_range(node: CSSNode): node is UnicodeRange;
432
+ declare function is_value(node: CSSNode): node is Value;
433
+ declare function is_type_selector(node: CSSNode): node is TypeSelector;
434
+ declare function is_class_selector(node: CSSNode): node is ClassSelector;
435
+ declare function is_id_selector(node: CSSNode): node is IdSelector;
436
+ declare function is_attribute_selector(node: CSSNode): node is AttributeSelector;
437
+ declare function is_pseudo_class_selector(node: CSSNode): node is PseudoClassSelector;
438
+ declare function is_pseudo_element_selector(node: CSSNode): node is PseudoElementSelector;
439
+ declare function is_combinator(node: CSSNode): node is Combinator;
440
+ declare function is_universal_selector(node: CSSNode): node is UniversalSelector;
441
+ declare function is_nesting_selector(node: CSSNode): node is NestingSelector;
442
+ declare function is_nth_selector(node: CSSNode): node is NthSelector;
443
+ declare function is_nth_of_selector(node: CSSNode): node is NthOfSelector;
444
+ declare function is_lang_selector(node: CSSNode): node is LangSelector;
445
+ declare function is_atrule_prelude(node: CSSNode): node is AtrulePrelude;
446
+ declare function is_media_query(node: CSSNode): node is MediaQuery;
447
+ declare function is_media_feature(node: CSSNode): node is MediaFeature;
448
+ declare function is_media_type(node: CSSNode): node is MediaType;
449
+ declare function is_container_query(node: CSSNode): node is ContainerQuery;
450
+ declare function is_supports_query(node: CSSNode): node is SupportsQuery;
451
+ declare function is_layer_name(node: CSSNode): node is LayerName;
452
+ declare function is_prelude_operator(node: CSSNode): node is PreludeOperator;
453
+ declare function is_feature_range(node: CSSNode): node is FeatureRange;
454
+ declare function is_prelude_selectorlist(node: CSSNode): node is PreludeSelectorList;
455
+ //#endregion
456
+ export { is_comment as $, PreludeSelectorList as A, is_type_selector as At, ToPlain as B, NestingSelector as C, is_raw as Ct, Operator as D, is_string as Dt, Number as E, is_selector_list as Et, Selector as F, CloneOptions as Ft, Value as G, UnicodeRange as H, SelectorList as I, TYPE_NAMES as It, is_atrule_prelude as J, WithChildren as K, String as L, PseudoElementSelector as M, is_universal_selector as Mt, Raw as N, is_url as Nt, Parenthesis as O, is_stylesheet as Ot, Rule as P, is_value as Pt, is_combinator as Q, StyleSheet as R, MediaType as S, is_pseudo_element_selector as St, NthSelector as T, is_selector as Tt, UniversalSelector as U, TypeSelector as V, Url as W, is_block as X, is_attribute_selector as Y, is_class_selector as Z, Identifier as _, is_operator as _t, Block as a, is_hash as at, MediaFeature as b, is_prelude_selectorlist as bt, Combinator as c, is_lang_selector as ct, Declaration as d, is_media_query as dt, is_container_query as et, Dimension as f, is_media_type as ft, IdSelector as g, is_number as gt, Hash as h, is_nth_selector as ht, AttributeSelector as i, is_function as it, PseudoClassSelector as j, is_unicode_range as jt, PreludeOperator as k, is_supports_query as kt, Comment as l, is_layer_name as lt, Function as m, is_nth_of_selector as mt, Atrule as n, is_dimension as nt, CSSNode as o, is_id_selector as ot, FeatureRange as p, is_nesting_selector as pt, is_atrule as q, AtrulePrelude as r, is_feature_range as rt, ClassSelector as s, is_identifier as st, AnyNode as t, is_declaration as tt, ContainerQuery as u, is_media_feature as ut, LangSelector as v, is_parenthesis as vt, NthOfSelector as w, is_rule as wt, MediaQuery as x, is_pseudo_class_selector as xt, LayerName as y, is_prelude_operator as yt, SupportsQuery as z };
@@ -1,5 +1,5 @@
1
- import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
1
+ import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
+ import { T as NthSelector } from "./node-types-Dt096ytO.js";
3
3
 
4
4
  //#region src/parse-anplusb.d.ts
5
5
  /** @internal */
@@ -22,6 +22,6 @@ declare class ANplusBParser {
22
22
  private skip_whitespace;
23
23
  private create_anplusb_node;
24
24
  }
25
- declare function parse_anplusb(expr: string): CSSNode | null;
25
+ declare function parse_anplusb(expr: string): NthSelector | null;
26
26
  //#endregion
27
27
  export { ANplusBParser, parse_anplusb };
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
2
+ import { l as CSSDataArena } from "./arena-CveFYH2l.js";
3
3
  import { o as str_equals, s as str_index_of } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { t as CSSNode } from "./css-node-CbNQbD4P.js";
5
5
  //#region src/parse-anplusb.ts
6
6
  /** @internal */
7
7
  var ANplusBParser = class {
@@ -1,5 +1,5 @@
1
- import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
1
+ import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
+ import { t as AnyNode } from "./node-types-Dt096ytO.js";
3
3
 
4
4
  //#region src/parse-atrule-prelude.d.ts
5
5
  /** @internal */
@@ -42,6 +42,6 @@ declare class AtRulePreludeParser {
42
42
  * @param prelude - The at-rule prelude to parse (e.g., "(min-width: 768px)", "utilities")
43
43
  * @returns An array of CSSNode objects representing the parsed prelude
44
44
  */
45
- declare function parse_atrule_prelude(at_rule_name: string, prelude: string): CSSNode[];
45
+ declare function parse_atrule_prelude(at_rule_name: string, prelude: string): AnyNode[];
46
46
  //#endregion
47
47
  export { AtRulePreludeParser, parse_atrule_prelude };
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
2
+ import { l as CSSDataArena } from "./arena-CveFYH2l.js";
3
3
  import { a as is_whitespace, l as strip_vendor_prefix, o as str_equals } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { t as CSSNode } from "./css-node-CbNQbD4P.js";
5
5
  import { i as trim_boundaries, n as skip_whitespace_and_comments_forward } from "./parse-utils-BxrmqJxI.js";
6
6
  //#region src/parse-atrule-prelude.ts
7
7
  /** @internal */
@@ -259,8 +259,8 @@ var AtRulePreludeParser = class {
259
259
  let token_type = this.lexer.token_type;
260
260
  if (token_type === 1) {
261
261
  let layer = this.create_node(37, this.lexer.token_start, this.lexer.token_end);
262
- this.arena.set_value_start_delta(layer, 0);
263
- this.arena.set_value_length(layer, this.lexer.token_end - this.lexer.token_start);
262
+ this.arena.set_content_start_delta(layer, 0);
263
+ this.arena.set_content_length(layer, this.lexer.token_end - this.lexer.token_start);
264
264
  nodes.push(layer);
265
265
  } else if (token_type === 18) continue;
266
266
  else if (token_type === 13) continue;
@@ -361,8 +361,6 @@ var AtRulePreludeParser = class {
361
361
  if (trimmed) {
362
362
  this.arena.set_content_start_delta(layer_node, trimmed[0] - layer_start);
363
363
  this.arena.set_content_length(layer_node, trimmed[1] - trimmed[0]);
364
- this.arena.set_value_start_delta(layer_node, trimmed[0] - layer_start);
365
- this.arena.set_value_length(layer_node, trimmed[1] - trimmed[0]);
366
364
  }
367
365
  }
368
366
  return layer_node;
@@ -1,6 +1,6 @@
1
- import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
1
+ import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
2
  import { n as Lexer } from "./tokenize-CyiJelQC.js";
3
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
3
+ import { d as Declaration } from "./node-types-Dt096ytO.js";
4
4
 
5
5
  //#region src/parse-declaration.d.ts
6
6
  /** @internal */
@@ -17,6 +17,6 @@ declare class DeclarationParser {
17
17
  * @param source - The CSS declaration to parse (e.g., "color: red", "margin: 10px !important")
18
18
  * @returns The DECLARATION CSSNode
19
19
  */
20
- declare function parse_declaration(source: string): CSSNode;
20
+ declare function parse_declaration(source: string): Declaration;
21
21
  //#endregion
22
22
  export { DeclarationParser, parse_declaration };
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
2
+ import { l as CSSDataArena } from "./arena-CveFYH2l.js";
3
3
  import { i as is_vendor_prefixed } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { t as CSSNode } from "./css-node-CbNQbD4P.js";
5
5
  import { i as trim_boundaries } from "./parse-utils-BxrmqJxI.js";
6
6
  import { ValueParser } from "./parse-value.js";
7
7
  //#region src/parse-declaration.ts
@@ -1,5 +1,5 @@
1
- import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
1
+ import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
+ import { I as SelectorList } from "./node-types-Dt096ytO.js";
3
3
 
4
4
  //#region src/parse-selector.d.ts
5
5
  /** @internal */
@@ -38,6 +38,6 @@ declare class SelectorParser {
38
38
  * @param source - The CSS selector to parse (e.g., "div.class > p#id")
39
39
  * @returns The root CSSNode of the selector AST
40
40
  */
41
- declare function parse_selector(source: string): CSSNode;
41
+ declare function parse_selector(source: string): SelectorList;
42
42
  //#endregion
43
43
  export { SelectorParser, parse_selector };
@@ -1,7 +1,7 @@
1
1
  import { t as Lexer } from "./tokenize-BSycRGm0.js";
2
- import { y as CSSDataArena } from "./arena-CDAx4eAB.js";
2
+ import { l as CSSDataArena } from "./arena-CveFYH2l.js";
3
3
  import { a as is_whitespace, n as is_combinator, o as str_equals } from "./parse-dimension-CCn_XRDe.js";
4
- import { r as CSSNode } from "./css-node-CZf-PvCf.js";
4
+ import { t as CSSNode } from "./css-node-CbNQbD4P.js";
5
5
  import { n as skip_whitespace_and_comments_forward, r as skip_whitespace_forward, t as skip_whitespace_and_comments_backward } from "./parse-utils-BxrmqJxI.js";
6
6
  import { ANplusBParser } from "./parse-anplusb.js";
7
7
  //#region src/parse-selector.ts
@@ -260,41 +260,18 @@ var SelectorParser = class {
260
260
  this.arena.set_content_length(node, name_end - name_start);
261
261
  }
262
262
  let pos = skip_whitespace_and_comments_forward(this.source, name_end, end);
263
- if (pos >= end) {
264
- this.arena.set_attr_operator(node, 0);
265
- this.arena.set_attr_flags(node, 0);
266
- return;
267
- }
263
+ if (pos >= end) return;
268
264
  let ch1 = this.source.charCodeAt(pos);
269
265
  let ch2 = pos + 1 < end ? this.source.charCodeAt(pos + 1) : 0;
270
- if (ch1 === 61) {
271
- operator_end = pos + 1;
272
- this.arena.set_attr_operator(node, 1);
273
- } else if (ch1 === 126 && ch2 === 61) {
274
- operator_end = pos + 2;
275
- this.arena.set_attr_operator(node, 2);
276
- } else if (ch1 === 124 && ch2 === 61) {
277
- operator_end = pos + 2;
278
- this.arena.set_attr_operator(node, 3);
279
- } else if (ch1 === 94 && ch2 === 61) {
280
- operator_end = pos + 2;
281
- this.arena.set_attr_operator(node, 4);
282
- } else if (ch1 === 36 && ch2 === 61) {
283
- operator_end = pos + 2;
284
- this.arena.set_attr_operator(node, 5);
285
- } else if (ch1 === 42 && ch2 === 61) {
286
- operator_end = pos + 2;
287
- this.arena.set_attr_operator(node, 6);
288
- } else {
289
- this.arena.set_attr_operator(node, 0);
290
- this.arena.set_attr_flags(node, 0);
291
- return;
292
- }
266
+ if (ch1 === 61) operator_end = pos + 1;
267
+ else if (ch1 === 126 && ch2 === 61) operator_end = pos + 2;
268
+ else if (ch1 === 124 && ch2 === 61) operator_end = pos + 2;
269
+ else if (ch1 === 94 && ch2 === 61) operator_end = pos + 2;
270
+ else if (ch1 === 36 && ch2 === 61) operator_end = pos + 2;
271
+ else if (ch1 === 42 && ch2 === 61) operator_end = pos + 2;
272
+ else return;
293
273
  pos = skip_whitespace_and_comments_forward(this.source, operator_end, end);
294
- if (pos >= end) {
295
- this.arena.set_attr_flags(node, 0);
296
- return;
297
- }
274
+ if (pos >= end) return;
298
275
  value_start = pos;
299
276
  let ch = this.source.charCodeAt(pos);
300
277
  if (ch === 39 || ch === 34) {
@@ -322,13 +299,6 @@ var SelectorParser = class {
322
299
  this.arena.set_value_start_delta(node, value_start - this.arena.get_start_offset(node));
323
300
  this.arena.set_value_length(node, value_end - value_start);
324
301
  }
325
- pos = skip_whitespace_and_comments_forward(this.source, value_end, end);
326
- if (pos < end) {
327
- let flag_ch = this.source.charCodeAt(pos);
328
- if (flag_ch === 105 || flag_ch === 73) this.arena.set_attr_flags(node, 1);
329
- else if (flag_ch === 115 || flag_ch === 83) this.arena.set_attr_flags(node, 2);
330
- else this.arena.set_attr_flags(node, 0);
331
- } else this.arena.set_attr_flags(node, 0);
332
302
  }
333
303
  parse_pseudo(start) {
334
304
  const saved = this.lexer.save_position();
@@ -1,5 +1,5 @@
1
- import { y as CSSDataArena } from "./arena-BtlVZlkG.js";
2
- import { r as CSSNode } from "./css-node-B9tSb6YD.js";
1
+ import { l as CSSDataArena } from "./arena-D6TANE5e.js";
2
+ import { G as Value } from "./node-types-Dt096ytO.js";
3
3
 
4
4
  //#region src/parse-value.d.ts
5
5
  /** @internal */
@@ -24,6 +24,6 @@ declare class ValueParser {
24
24
  * @param value_string - The CSS value to parse (e.g., "1px solid red")
25
25
  * @returns A CSSNode VALUE wrapper containing the parsed value tokens as children
26
26
  */
27
- declare function parse_value(value_string: string): CSSNode;
27
+ declare function parse_value(value_string: string): Value;
28
28
  //#endregion
29
29
  export { ValueParser, parse_value };