@projectwallace/css-parser 0.19.3 → 0.19.4

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 +14 -2
  2. package/dist/{arena-D123N1LO.js → arena-CaLnNKbP.js} +1 -2
  3. package/dist/{arena-DnAc8Oy_.d.ts → arena-D689Bo6V.d.ts} +0 -2
  4. package/dist/constants.d.ts +46 -48
  5. package/dist/constants.js +2 -3
  6. package/dist/{css-node-D9rqMgMI.js → css-node-CDTLvxo3.js} +3 -4
  7. package/dist/index.d.ts +6 -6
  8. package/dist/index.js +6 -6
  9. package/dist/{node-types-Pa1MR4CP.d.ts → node-types-BF6bhAjo.d.ts} +54 -62
  10. package/dist/node-types.d.ts +1 -1
  11. package/dist/node-types.js +2 -3
  12. package/dist/parse-anplusb.d.ts +3 -5
  13. package/dist/parse-anplusb.js +5 -6
  14. package/dist/{value-node-parser-ysQ7ssqf.js → parse-atrule-prelude-BMkgCZjw.js} +450 -12
  15. package/dist/parse-atrule-prelude.d.ts +3 -5
  16. package/dist/parse-atrule-prelude.js +1 -431
  17. package/dist/parse-declaration.d.ts +3 -5
  18. package/dist/parse-declaration.js +6 -7
  19. package/dist/parse-dimension.d.ts +1 -3
  20. package/dist/parse-dimension.js +2 -3
  21. package/dist/{parse-selector-BMeyZ-oJ.js → parse-selector-CMKZgPmu.js} +6 -8
  22. package/dist/parse-selector.d.ts +3 -5
  23. package/dist/parse-selector.js +1 -1
  24. package/dist/parse-value.d.ts +3 -5
  25. package/dist/parse-value.js +4 -5
  26. package/dist/parse.d.ts +3 -5
  27. package/dist/parse.js +6 -7
  28. package/dist/{string-helpers-t7UofIfp.d.ts → string-helpers-CwNEcEhd.d.ts} +0 -2
  29. package/dist/string-helpers.d.ts +1 -1
  30. package/dist/string-helpers.js +1 -1
  31. package/dist/{string-utils-aEEsA2CS.js → string-utils-BYH1Oe8a.js} +0 -1
  32. package/dist/{token-types-Bqsf5FX-.d.ts → token-types-BhoXrORA.d.ts} +0 -2
  33. package/dist/token-types.d.ts +1 -1
  34. package/dist/token-types.js +1 -2
  35. package/dist/{tokenize-B2QSzdrM.js → tokenize-DC2Vb0J_.js} +20 -6
  36. package/dist/tokenize.d.ts +17 -5
  37. package/dist/tokenize.js +1 -1
  38. package/dist/walk.d.ts +1 -3
  39. package/dist/walk.js +3 -4
  40. package/package.json +3 -3
@@ -1,431 +1 @@
1
- import { t as Lexer } from "./tokenize-B2QSzdrM.js";
2
- import "./token-types.js";
3
- import { l as CSSDataArena } from "./arena-D123N1LO.js";
4
- import { c as str_equals_range, d as strip_vendor_prefix, t as is_and_or_not_range } from "./string-utils-aEEsA2CS.js";
5
- import { t as CSSNode } from "./css-node-D9rqMgMI.js";
6
- import { s as trim_boundaries, t as SelectorParser } from "./parse-selector-BMeyZ-oJ.js";
7
- import { n as ConditionParser, t as ValueNodeParser } from "./value-node-parser-ysQ7ssqf.js";
8
- //#region src/parse-atrule-prelude.ts
9
- var AtRulePreludeParser = class {
10
- lexer;
11
- arena;
12
- source;
13
- prelude_end;
14
- value_node_parser;
15
- condition_parser;
16
- selector_parser;
17
- constructor(arena, source, media_feature_range_name_as_child = false) {
18
- this.arena = arena;
19
- this.source = source;
20
- this.lexer = new Lexer(source);
21
- this.prelude_end = 0;
22
- this.value_node_parser = new ValueNodeParser(arena, source, media_feature_range_name_as_child);
23
- this.condition_parser = new ConditionParser(arena, source, this.value_node_parser, media_feature_range_name_as_child);
24
- this.selector_parser = new SelectorParser(arena, source);
25
- }
26
- parse_prelude(at_rule_name, start, end, line = 1, column = 1) {
27
- this.prelude_end = end;
28
- this.lexer.seek(start, line, column);
29
- return this.parse_prelude_dispatch(at_rule_name);
30
- }
31
- parse_prelude_dispatch(at_rule_name) {
32
- switch (strip_vendor_prefix(at_rule_name).toLowerCase()) {
33
- case "media": return this.parse_media_query_list();
34
- case "container": return this.parse_container_query();
35
- case "supports": return this.parse_supports_query();
36
- case "layer": return this.parse_layer_names();
37
- case "keyframes":
38
- case "property":
39
- case "counter-style":
40
- case "color-profile":
41
- case "font-palette-values":
42
- case "position-try":
43
- case "font-feature-values":
44
- case "page": return this.parse_identifier();
45
- case "function": return this.parse_function_prelude();
46
- case "import": return this.parse_import_prelude();
47
- case "charset": return this.parse_charset_prelude();
48
- case "namespace": return this.parse_namespace_prelude();
49
- case "scope": return this.parse_scope_prelude();
50
- case "custom-media": return this.parse_custom_media_prelude();
51
- }
52
- return [];
53
- }
54
- parse_media_query_list() {
55
- const nodes = [];
56
- while (this.lexer.pos < this.prelude_end) {
57
- this.skip_whitespace();
58
- if (this.lexer.pos >= this.prelude_end) break;
59
- const query = this.parse_single_media_query();
60
- if (query !== null) nodes.push(query);
61
- this.skip_whitespace();
62
- const saved = this.lexer.save_position();
63
- this.next_token();
64
- if (this.lexer.token_type !== 18) this.lexer.restore_position(saved);
65
- }
66
- return nodes;
67
- }
68
- create_node(type, start, end) {
69
- return this.arena.create_node(type, start, end - start, this.lexer.token_line, this.lexer.token_column);
70
- }
71
- paren_content_end = 0;
72
- paren_close_end = 0;
73
- scan_matching_paren() {
74
- let depth = 1;
75
- let content_end = this.lexer.pos;
76
- let close_end = this.lexer.token_end;
77
- while (this.lexer.pos < this.prelude_end && depth > 0) {
78
- const token_type = this.next_token();
79
- if (token_type === 21 || token_type === 2) depth++;
80
- else if (token_type === 22) {
81
- depth--;
82
- if (depth === 0) {
83
- content_end = this.lexer.token_start;
84
- close_end = this.lexer.token_end;
85
- }
86
- } else if (token_type === 26) break;
87
- }
88
- this.paren_content_end = content_end;
89
- this.paren_close_end = close_end;
90
- return depth === 0;
91
- }
92
- parse_single_media_query() {
93
- const query_start = this.lexer.pos;
94
- this.skip_whitespace();
95
- if (this.lexer.pos >= this.prelude_end) return null;
96
- let first_component = 0;
97
- let last_component = 0;
98
- const saved_token_start = this.lexer.save_position();
99
- this.next_token();
100
- if (this.lexer.token_type === 1) {
101
- const source = this.source;
102
- const token_start = this.lexer.token_start;
103
- const token_end = this.lexer.token_end;
104
- if (str_equals_range(source, token_start, token_end, "only") || str_equals_range(source, token_start, token_end, "not")) {
105
- const modifier = this.create_node(38, token_start, token_end);
106
- first_component = modifier;
107
- last_component = modifier;
108
- } else this.lexer.restore_position(saved_token_start);
109
- } else this.lexer.restore_position(saved_token_start);
110
- while (this.lexer.pos < this.prelude_end) {
111
- this.skip_whitespace();
112
- if (this.lexer.pos >= this.prelude_end) break;
113
- if (this.peek_token_type() === 18) break;
114
- this.next_token();
115
- const token_type = this.lexer.token_type;
116
- let component = null;
117
- if (token_type === 21) {
118
- component = this.condition_parser.parse_media_feature(this.lexer.token_start, this.prelude_end, this.lexer.token_line, this.lexer.token_column);
119
- if (component !== null) this.condition_parser.seek_to_end(this.lexer);
120
- } else if (token_type === 1) {
121
- const token_start = this.lexer.token_start;
122
- const token_end = this.lexer.token_end;
123
- if (is_and_or_not_range(this.source, token_start, token_end)) component = this.create_node(38, token_start, token_end);
124
- else component = this.create_node(34, token_start, token_end);
125
- } else break;
126
- if (component !== null) {
127
- if (first_component === 0) first_component = component;
128
- else this.arena.set_next_sibling(last_component, component);
129
- last_component = component;
130
- }
131
- }
132
- if (first_component === 0) return null;
133
- const query_node = this.create_node(32, query_start, this.lexer.pos);
134
- this.arena.set_first_child(query_node, first_component);
135
- return query_node;
136
- }
137
- parse_container_query() {
138
- const query_start = this.lexer.pos;
139
- let first_component = 0;
140
- let last_component = 0;
141
- while (this.lexer.pos < this.prelude_end) {
142
- this.skip_whitespace();
143
- if (this.lexer.pos >= this.prelude_end) break;
144
- this.next_token();
145
- const token_type = this.lexer.token_type;
146
- let component = null;
147
- if (token_type === 21) {
148
- component = this.condition_parser.parse_media_feature(this.lexer.token_start, this.prelude_end, this.lexer.token_line, this.lexer.token_column);
149
- if (component !== null) this.condition_parser.seek_to_end(this.lexer);
150
- } else if (token_type === 2) {
151
- component = this.condition_parser.parse_function_condition(this.lexer.token_start, this.prelude_end, this.lexer.token_line, this.lexer.token_column);
152
- this.condition_parser.seek_to_end(this.lexer);
153
- } else if (token_type === 1) {
154
- const token_start = this.lexer.token_start;
155
- const token_end = this.lexer.token_end;
156
- if (is_and_or_not_range(this.source, token_start, token_end)) component = this.create_node(38, token_start, token_end);
157
- else component = this.create_node(10, token_start, token_end);
158
- }
159
- if (component !== null) {
160
- if (first_component === 0) first_component = component;
161
- else this.arena.set_next_sibling(last_component, component);
162
- last_component = component;
163
- }
164
- }
165
- if (first_component === 0) return [];
166
- const query_node = this.create_node(35, query_start, this.lexer.pos);
167
- this.arena.set_first_child(query_node, first_component);
168
- return [query_node];
169
- }
170
- parse_supports_query() {
171
- return this.condition_parser.parse_supports_condition(this.lexer.pos, this.prelude_end, this.lexer.line, this.lexer.column);
172
- }
173
- parse_layer_names() {
174
- const nodes = [];
175
- while (this.lexer.pos < this.prelude_end) {
176
- this.skip_whitespace();
177
- if (this.lexer.pos >= this.prelude_end) break;
178
- this.next_token();
179
- const token_type = this.lexer.token_type;
180
- if (token_type === 1) {
181
- const name_start = this.lexer.token_start;
182
- let name_end = this.lexer.token_end;
183
- while (this.lexer.pos < this.prelude_end) {
184
- const saved = this.lexer.save_position();
185
- if (this.next_token() !== 9 || this.source.charCodeAt(this.lexer.token_start) !== 46 || this.lexer.token_start !== name_end) {
186
- this.lexer.restore_position(saved);
187
- break;
188
- }
189
- const dot_end = this.lexer.token_end;
190
- if (this.next_token() !== 1 || this.lexer.token_start !== dot_end) {
191
- this.lexer.restore_position(saved);
192
- break;
193
- }
194
- name_end = this.lexer.token_end;
195
- }
196
- const layer = this.create_node(37, name_start, name_end);
197
- this.arena.set_content_start_delta(layer, 0);
198
- this.arena.set_content_length(layer, name_end - name_start);
199
- nodes.push(layer);
200
- } else if (token_type === 18) continue;
201
- else if (token_type === 13) continue;
202
- }
203
- return nodes;
204
- }
205
- parse_function_prelude() {
206
- this.skip_whitespace();
207
- if (this.lexer.pos >= this.prelude_end) return [];
208
- this.next_token();
209
- if (this.lexer.token_type !== 2) return [];
210
- const name_start = this.lexer.token_start;
211
- const name_end = this.lexer.token_end - 1;
212
- return [this.create_node(10, name_start, name_end)];
213
- }
214
- parse_identifier() {
215
- this.skip_whitespace();
216
- if (this.lexer.pos >= this.prelude_end) return [];
217
- this.next_token();
218
- if (this.lexer.token_type !== 1) return [];
219
- return [this.create_node(10, this.lexer.token_start, this.lexer.token_end)];
220
- }
221
- parse_charset_prelude() {
222
- this.skip_whitespace();
223
- if (this.lexer.pos >= this.prelude_end) return [];
224
- this.next_token();
225
- if (this.lexer.token_type !== 5) return [];
226
- return [this.create_node(13, this.lexer.token_start, this.lexer.token_end)];
227
- }
228
- parse_import_prelude() {
229
- const nodes = [];
230
- this.skip_whitespace();
231
- if (this.lexer.pos >= this.prelude_end) return [];
232
- const url_node = this.parse_import_url();
233
- if (url_node === null) return [];
234
- nodes.push(url_node);
235
- this.skip_whitespace();
236
- if (this.lexer.pos >= this.prelude_end) return nodes;
237
- const layer_node = this.parse_import_layer();
238
- if (layer_node !== null) nodes.push(layer_node);
239
- this.skip_whitespace();
240
- if (this.lexer.pos >= this.prelude_end) return nodes;
241
- const supports_node = this.parse_import_supports();
242
- if (supports_node !== null) nodes.push(supports_node);
243
- this.skip_whitespace();
244
- if (this.lexer.pos >= this.prelude_end) return nodes;
245
- const media_nodes = this.parse_media_query_list();
246
- nodes.push(...media_nodes);
247
- return nodes;
248
- }
249
- parse_import_url() {
250
- this.next_token();
251
- if (this.lexer.token_type !== 7 && this.lexer.token_type !== 2 && this.lexer.token_type !== 5) return null;
252
- const url_start = this.lexer.token_start;
253
- let url_end = this.lexer.token_end;
254
- if (this.lexer.token_type === 2) {
255
- this.scan_matching_paren();
256
- url_end = this.paren_close_end;
257
- }
258
- return this.create_node(18, url_start, url_end);
259
- }
260
- parse_import_layer() {
261
- const saved = this.lexer.save_position();
262
- this.next_token();
263
- if (this.lexer.token_type === 1 || this.lexer.token_type === 2) {
264
- const name_end = this.lexer.token_type === 2 ? this.lexer.token_end - 1 : this.lexer.token_end;
265
- if (str_equals_range(this.source, this.lexer.token_start, name_end, "layer")) {
266
- const layer_start = this.lexer.token_start;
267
- if (this.lexer.token_type === 1) {
268
- const layer_node = this.create_node(37, layer_start, this.lexer.token_end);
269
- this.arena.set_content_start_delta(layer_node, 0);
270
- this.arena.set_content_length(layer_node, 0);
271
- return layer_node;
272
- }
273
- const content_start = this.lexer.token_end;
274
- const after_open = this.lexer.save_position();
275
- const matched = this.scan_matching_paren();
276
- const content_end = this.paren_content_end;
277
- const layer_end = matched ? this.paren_close_end : this.lexer.pos;
278
- const func_node = this.create_node(15, layer_start, layer_end);
279
- this.arena.set_content_start_delta(func_node, 0);
280
- this.arena.set_content_length(func_node, name_end - layer_start);
281
- const trimmed = matched ? trim_boundaries(this.source, content_start, content_end) : null;
282
- if (trimmed) {
283
- this.arena.set_value_start_delta(func_node, trimmed[0] - layer_start);
284
- this.arena.set_value_length(func_node, trimmed[1] - trimmed[0]);
285
- const after_close = this.lexer.save_position();
286
- const saved_prelude_end = this.prelude_end;
287
- this.lexer.restore_position(after_open);
288
- this.prelude_end = content_end;
289
- const names = this.parse_layer_names();
290
- this.prelude_end = saved_prelude_end;
291
- this.lexer.restore_position(after_close);
292
- this.arena.append_children(func_node, names);
293
- }
294
- return func_node;
295
- }
296
- }
297
- this.lexer.restore_position(saved);
298
- return null;
299
- }
300
- parse_import_supports() {
301
- const saved = this.lexer.save_position();
302
- this.next_token();
303
- if (this.lexer.token_type === 2) {
304
- if (str_equals_range(this.source, this.lexer.token_start, this.lexer.token_end - 1, "supports")) {
305
- const supports_start = this.lexer.token_start;
306
- const name_end = this.lexer.token_end - 1;
307
- const content_start = this.lexer.token_end;
308
- const line = this.lexer.line;
309
- const column = this.lexer.column;
310
- this.scan_matching_paren();
311
- const content_end = this.paren_content_end;
312
- const supports_end = this.paren_close_end;
313
- const func_node = this.create_node(15, supports_start, supports_end);
314
- this.arena.set_content_start_delta(func_node, 0);
315
- this.arena.set_content_length(func_node, name_end - supports_start);
316
- const trimmed = trim_boundaries(this.source, content_start, content_end);
317
- if (trimmed) {
318
- const condition_start = trimmed[0];
319
- const condition_end = trimmed[1];
320
- const condition_length = condition_end - condition_start;
321
- this.arena.set_value_start_delta(func_node, condition_start - supports_start);
322
- this.arena.set_value_length(func_node, condition_length);
323
- const decl_child = this.condition_parser.parse_supports_declaration_content(condition_start, condition_end);
324
- if (decl_child === null) {
325
- const children = this.condition_parser.parse_supports_condition(condition_start, condition_end, line, column);
326
- this.arena.append_children(func_node, children);
327
- } else {
328
- const query = this.create_node(36, condition_start, condition_end);
329
- this.arena.set_value_start_delta(query, 0);
330
- this.arena.set_value_length(query, condition_length);
331
- this.arena.set_first_child(query, decl_child);
332
- this.arena.set_first_child(func_node, query);
333
- }
334
- }
335
- return func_node;
336
- }
337
- }
338
- this.lexer.restore_position(saved);
339
- return null;
340
- }
341
- skip_whitespace() {
342
- this.lexer.skip_whitespace_in_range(this.prelude_end);
343
- }
344
- peek_token_type() {
345
- const saved = this.lexer.save_position();
346
- this.next_token();
347
- const type = this.lexer.token_type;
348
- this.lexer.restore_position(saved);
349
- return type;
350
- }
351
- next_token() {
352
- if (this.lexer.pos >= this.prelude_end) {
353
- this.lexer.token_type = 26;
354
- return 26;
355
- }
356
- return this.lexer.next_token(false);
357
- }
358
- parse_namespace_prelude() {
359
- const nodes = [];
360
- this.skip_whitespace();
361
- if (this.lexer.pos >= this.prelude_end) return [];
362
- const saved = this.lexer.save_position();
363
- this.next_token();
364
- if (this.lexer.token_type === 1) {
365
- nodes.push(this.create_node(10, this.lexer.token_start, this.lexer.token_end));
366
- this.skip_whitespace();
367
- } else this.lexer.restore_position(saved);
368
- const url_node = this.parse_import_url();
369
- if (url_node !== null) nodes.push(url_node);
370
- return nodes;
371
- }
372
- parse_scope_prelude() {
373
- const nodes = [];
374
- while (this.lexer.pos < this.prelude_end) {
375
- this.skip_whitespace();
376
- if (this.lexer.pos >= this.prelude_end) break;
377
- const token_type = this.peek_token_type();
378
- if (token_type === 21) {
379
- this.next_token();
380
- const paren_start = this.lexer.token_start;
381
- const content_start = this.lexer.pos;
382
- const content_line = this.lexer.token_line;
383
- const content_column = this.lexer.token_column;
384
- this.scan_matching_paren();
385
- const content_end = this.paren_content_end;
386
- const paren_end = this.paren_close_end;
387
- const scope_node = this.create_node(41, paren_start, paren_end);
388
- const trimmed = trim_boundaries(this.source, content_start, content_end);
389
- if (trimmed) {
390
- this.arena.set_value_start_delta(scope_node, trimmed[0] - paren_start);
391
- this.arena.set_value_length(scope_node, trimmed[1] - trimmed[0]);
392
- let line = content_line;
393
- let column = content_column;
394
- for (let i = content_start; i < trimmed[0]; i++) if (this.source.charCodeAt(i) === 10) {
395
- line++;
396
- column = 1;
397
- } else column++;
398
- const selector_list = this.selector_parser.parse_selector(trimmed[0], trimmed[1], line, column, false);
399
- if (selector_list !== null) this.arena.set_first_child(scope_node, selector_list);
400
- }
401
- nodes.push(scope_node);
402
- } else if (token_type === 1) {
403
- this.next_token();
404
- if (str_equals_range(this.source, this.lexer.token_start, this.lexer.token_end, "to")) nodes.push(this.create_node(38, this.lexer.token_start, this.lexer.token_end));
405
- } else this.next_token();
406
- }
407
- return nodes;
408
- }
409
- parse_custom_media_prelude() {
410
- const nodes = [];
411
- this.skip_whitespace();
412
- if (this.lexer.pos >= this.prelude_end) return [];
413
- this.next_token();
414
- if (this.lexer.token_type !== 1) return [];
415
- nodes.push(this.create_node(10, this.lexer.token_start, this.lexer.token_end), ...this.parse_media_query_list());
416
- return nodes;
417
- }
418
- };
419
- /**
420
- * Parse an at-rule prelude string and return an array of AST nodes
421
- * @param at_rule_name - The name of the at-rule (e.g., "media", "supports", "layer")
422
- * @param prelude - The at-rule prelude to parse (e.g., "(min-width: 768px)", "utilities")
423
- * @param options - Parser options (`media_feature_range_name_as_child`: also add the feature name of a media range as an Identifier child. This will become the default behavior in 0.20.0.)
424
- * @returns An array of CSSNode objects representing the parsed prelude
425
- */
426
- function parse_atrule_prelude(at_rule_name, prelude, options) {
427
- const arena = new CSSDataArena(CSSDataArena.capacity_for_source(prelude.length));
428
- return new AtRulePreludeParser(arena, prelude, options?.media_feature_range_name_as_child ?? false).parse_prelude(at_rule_name, 0, prelude.length).map((index) => new CSSNode(arena, prelude, index));
429
- }
430
- //#endregion
431
- export { AtRulePreludeParser, parse_atrule_prelude };
1
+ export { t as AtRulePreludeParser, n as parse_atrule_prelude } from "./parse-atrule-prelude-BMkgCZjw.js";
@@ -1,7 +1,6 @@
1
- import { l as CSSDataArena } from "./arena-DnAc8Oy_.js";
1
+ import { l as CSSDataArena } from "./arena-D689Bo6V.js";
2
2
  import { Lexer } from "./tokenize.js";
3
- import { f as Declaration } from "./node-types-Pa1MR4CP.js";
4
- //#region src/parse-declaration.d.ts
3
+ import { f as Declaration } from "./node-types-BF6bhAjo.js";
5
4
  /** @internal */
6
5
  export declare class DeclarationParser {
7
6
  private arena;
@@ -17,5 +16,4 @@ export declare class DeclarationParser {
17
16
  * @param source - The CSS declaration to parse (e.g., "color: red", "margin: 10px !important")
18
17
  * @returns The DECLARATION CSSNode
19
18
  */
20
- export declare function parse_declaration(source: string): Declaration;
21
- //#endregion
19
+ export declare function parse_declaration(source: string): Declaration;
@@ -1,11 +1,11 @@
1
- import { t as Lexer } from "./tokenize-B2QSzdrM.js";
1
+ import { t as Lexer } from "./tokenize-DC2Vb0J_.js";
2
2
  import "./token-types.js";
3
- import { l as CSSDataArena } from "./arena-D123N1LO.js";
4
- import { a as is_vendor_prefixed } from "./string-utils-aEEsA2CS.js";
5
- import { t as CSSNode } from "./css-node-D9rqMgMI.js";
6
- import { a as skip_whitespace_and_comments_backward, o as skip_whitespace_and_comments_forward } from "./parse-selector-BMeyZ-oJ.js";
3
+ import { l as CSSDataArena } from "./arena-CaLnNKbP.js";
4
+ import { a as is_vendor_prefixed } from "./string-utils-BYH1Oe8a.js";
5
+ import { t as CSSNode } from "./css-node-CDTLvxo3.js";
6
+ import { a as skip_whitespace_and_comments_backward, o as skip_whitespace_and_comments_forward } from "./parse-selector-CMKZgPmu.js";
7
7
  import { ValueParser } from "./parse-value.js";
8
- //#region src/parse-declaration.ts
8
+ // src/parse-declaration.ts
9
9
  /** @internal */
10
10
  var DeclarationParser = class {
11
11
  arena;
@@ -180,5 +180,4 @@ function parse_declaration(source) {
180
180
  }
181
181
  return new CSSNode(arena, source, decl_index);
182
182
  }
183
- //#endregion
184
183
  export { DeclarationParser, parse_declaration };
@@ -1,4 +1,3 @@
1
- //#region src/parse-dimension.d.ts
2
1
  /**
3
2
  * Find where a dimension's numeric part ends, e.g. 3 for "100px" or 2 for "2%".
4
3
  * No allocation — callers that only need `value` or only `unit` can slice just
@@ -11,5 +10,4 @@ export declare function dimension_number_end(text: string): number;
11
10
  export declare function parse_dimension(text: string): {
12
11
  value: number;
13
12
  unit: string;
14
- };
15
- //#endregion
13
+ };
@@ -1,5 +1,5 @@
1
- import { i as is_digit } from "./string-utils-aEEsA2CS.js";
2
- //#region src/parse-dimension.ts
1
+ import { i as is_digit } from "./string-utils-BYH1Oe8a.js";
2
+ // src/parse-dimension.ts
3
3
  /**
4
4
  * Find where a dimension's numeric part ends, e.g. 3 for "100px" or 2 for "2%".
5
5
  * No allocation — callers that only need `value` or only `unit` can slice just
@@ -43,5 +43,4 @@ function parse_dimension(text) {
43
43
  unit
44
44
  };
45
45
  }
46
- //#endregion
47
46
  export { dimension_number_end, parse_dimension };
@@ -1,10 +1,10 @@
1
- import { t as Lexer } from "./tokenize-B2QSzdrM.js";
1
+ import { t as Lexer } from "./tokenize-DC2Vb0J_.js";
2
2
  import "./token-types.js";
3
- import { l as CSSDataArena } from "./arena-D123N1LO.js";
4
- import { c as str_equals_range, n as is_combinator, o as is_whitespace } from "./string-utils-aEEsA2CS.js";
5
- import { t as CSSNode } from "./css-node-D9rqMgMI.js";
3
+ import { l as CSSDataArena } from "./arena-CaLnNKbP.js";
4
+ import { c as str_equals_range, n as is_combinator, o as is_whitespace } from "./string-utils-BYH1Oe8a.js";
5
+ import { t as CSSNode } from "./css-node-CDTLvxo3.js";
6
6
  import { ANplusBParser } from "./parse-anplusb.js";
7
- //#region src/parse-utils.ts
7
+ // src/parse-utils.ts
8
8
  function skip_whitespace_forward(source, pos, end) {
9
9
  while (pos < end && is_whitespace(source.charCodeAt(pos))) pos++;
10
10
  return pos;
@@ -69,8 +69,7 @@ function find_colon_at_depth_zero(source, start, end) {
69
69
  }
70
70
  return -1;
71
71
  }
72
- //#endregion
73
- //#region src/parse-selector.ts
72
+ // src/parse-selector.ts
74
73
  /** @internal */
75
74
  var SelectorParser = class {
76
75
  lexer;
@@ -514,5 +513,4 @@ function parse_selector_list(source) {
514
513
  function parse_selector(source) {
515
514
  return parse_selector_list(source).first_child;
516
515
  }
517
- //#endregion
518
516
  export { skip_whitespace_and_comments_backward as a, find_colon_at_depth_zero as i, parse_selector as n, skip_whitespace_and_comments_forward as o, parse_selector_list as r, trim_boundaries as s, SelectorParser as t };
@@ -1,6 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-DnAc8Oy_.js";
2
- import { B as SelectorList, z as Selector } from "./node-types-Pa1MR4CP.js";
3
- //#region src/parse-selector.d.ts
1
+ import { l as CSSDataArena } from "./arena-D689Bo6V.js";
2
+ import { B as SelectorList, z as Selector } from "./node-types-BF6bhAjo.js";
4
3
  /** @internal */
5
4
  export declare class SelectorParser {
6
5
  private lexer;
@@ -33,5 +32,4 @@ export declare class SelectorParser {
33
32
  private skip_whitespace;
34
33
  }
35
34
  export declare function parse_selector_list(source: string): SelectorList;
36
- export declare function parse_selector(source: string): Selector;
37
- //#endregion
35
+ export declare function parse_selector(source: string): Selector;
@@ -1 +1 @@
1
- export { t as SelectorParser, n as parse_selector, r as parse_selector_list } from "./parse-selector-BMeyZ-oJ.js";
1
+ export { t as SelectorParser, n as parse_selector, r as parse_selector_list } from "./parse-selector-CMKZgPmu.js";
@@ -1,6 +1,5 @@
1
- import { l as CSSDataArena } from "./arena-DnAc8Oy_.js";
2
- import { Z as Value } from "./node-types-Pa1MR4CP.js";
3
- //#region src/parse-value.d.ts
1
+ import { l as CSSDataArena } from "./arena-D689Bo6V.js";
2
+ import { Z as Value } from "./node-types-BF6bhAjo.js";
4
3
  /** @internal */
5
4
  export declare class ValueParser {
6
5
  private nodes;
@@ -13,5 +12,4 @@ export declare class ValueParser {
13
12
  * @param value_string - The CSS value to parse (e.g., "1px solid red")
14
13
  * @returns A CSSNode VALUE wrapper containing the parsed value tokens as children
15
14
  */
16
- export declare function parse_value(value_string: string): Value;
17
- //#endregion
15
+ export declare function parse_value(value_string: string): Value;
@@ -1,7 +1,7 @@
1
- import { l as CSSDataArena } from "./arena-D123N1LO.js";
2
- import { t as CSSNode } from "./css-node-D9rqMgMI.js";
3
- import { t as ValueNodeParser } from "./value-node-parser-ysQ7ssqf.js";
4
- //#region src/parse-value.ts
1
+ import { l as CSSDataArena } from "./arena-CaLnNKbP.js";
2
+ import { t as CSSNode } from "./css-node-CDTLvxo3.js";
3
+ import { r as ValueNodeParser } from "./parse-atrule-prelude-BMkgCZjw.js";
4
+ // src/parse-value.ts
5
5
  /** @internal */
6
6
  var ValueParser = class {
7
7
  nodes;
@@ -31,5 +31,4 @@ function parse_value(value_string) {
31
31
  const value_node_index = new ValueParser(arena, value_string).parse_value(0, value_string.length, 1, 1);
32
32
  return new CSSNode(arena, value_string, value_node_index);
33
33
  }
34
- //#endregion
35
34
  export { ValueParser, parse_value };
package/dist/parse.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { l as CSSDataArena } from "./arena-DnAc8Oy_.js";
1
+ import { l as CSSDataArena } from "./arena-D689Bo6V.js";
2
2
  import { CommentInfo } from "./tokenize.js";
3
- import { U as StyleSheet } from "./node-types-Pa1MR4CP.js";
4
- //#region src/parse.d.ts
3
+ import { U as StyleSheet } from "./node-types-BF6bhAjo.js";
5
4
  export interface ParserOptions {
6
5
  parse_values?: boolean;
7
6
  parse_selectors?: boolean;
@@ -47,5 +46,4 @@ export declare class Parser {
47
46
  * @param options - Parser options
48
47
  * @returns The root CSSNode of the AST
49
48
  */
50
- export declare function parse(source: string, options?: ParserOptions): StyleSheet;
51
- //#endregion
49
+ export declare function parse(source: string, options?: ParserOptions): StyleSheet;
package/dist/parse.js CHANGED
@@ -1,11 +1,11 @@
1
- import { t as Lexer } from "./tokenize-B2QSzdrM.js";
1
+ import { t as Lexer } from "./tokenize-DC2Vb0J_.js";
2
2
  import "./token-types.js";
3
- import { l as CSSDataArena } from "./arena-D123N1LO.js";
4
- import { t as CSSNode } from "./css-node-D9rqMgMI.js";
5
- import { a as skip_whitespace_and_comments_backward, o as skip_whitespace_and_comments_forward, t as SelectorParser } from "./parse-selector-BMeyZ-oJ.js";
6
- import { AtRulePreludeParser } from "./parse-atrule-prelude.js";
3
+ import { l as CSSDataArena } from "./arena-CaLnNKbP.js";
4
+ import { t as CSSNode } from "./css-node-CDTLvxo3.js";
5
+ import { a as skip_whitespace_and_comments_backward, o as skip_whitespace_and_comments_forward, t as SelectorParser } from "./parse-selector-CMKZgPmu.js";
6
+ import { t as AtRulePreludeParser } from "./parse-atrule-prelude-BMkgCZjw.js";
7
7
  import { DeclarationParser } from "./parse-declaration.js";
8
- //#region src/parse.ts
8
+ // src/parse.ts
9
9
  const DECLARATION_AT_RULES = /* @__PURE__ */ new Set([
10
10
  "font-face",
11
11
  "styleset",
@@ -266,5 +266,4 @@ var Parser = class {
266
266
  function parse(source, options) {
267
267
  return new Parser(source, options).parse();
268
268
  }
269
- //#endregion
270
269
  export { Parser, parse };
@@ -1,4 +1,3 @@
1
- //#region src/string-utils.d.ts
2
1
  /** Case-insensitive ASCII equality without allocations. `a` MUST be lowercase. */
3
2
  declare function str_equals(a: string, b: string): boolean;
4
3
  /** Case-insensitive ASCII prefix check without allocations. `prefix` MUST be lowercase. */
@@ -12,5 +11,4 @@ declare function is_vendor_prefixed(source: string, start: number, end: number):
12
11
  declare function is_custom(str: string): boolean;
13
12
  /** Strip a vendor prefix, e.g. `-webkit-keyframes` → `keyframes`. Returns the input unchanged if it has no prefix. */
14
13
  declare function strip_vendor_prefix(str: string): string;
15
- //#endregion
16
14
  export { str_starts_with as a, str_index_of as i, is_vendor_prefixed as n, strip_vendor_prefix as o, str_equals as r, is_custom as t };
@@ -1,2 +1,2 @@
1
- import { a as str_starts_with, i as str_index_of, n as is_vendor_prefixed, o as strip_vendor_prefix, r as str_equals, t as is_custom } from "./string-helpers-t7UofIfp.js";
1
+ import { a as str_starts_with, i as str_index_of, n as is_vendor_prefixed, o as strip_vendor_prefix, r as str_equals, t as is_custom } from "./string-helpers-CwNEcEhd.js";
2
2
  export { is_custom, is_vendor_prefixed, str_equals, str_index_of, str_starts_with, strip_vendor_prefix };
@@ -1 +1 @@
1
- export { r as is_custom, a as is_vendor_prefixed, s as str_equals, l as str_index_of, u as str_starts_with, d as strip_vendor_prefix } from "./string-utils-aEEsA2CS.js";
1
+ export { r as is_custom, a as is_vendor_prefixed, s as str_equals, l as str_index_of, u as str_starts_with, d as strip_vendor_prefix } from "./string-utils-BYH1Oe8a.js";
@@ -99,5 +99,4 @@ function strip_vendor_prefix(str) {
99
99
  for (let i = 2; i < str.length; i++) if (str.charCodeAt(i) === 45) return str.substring(i + 1);
100
100
  return str;
101
101
  }
102
- //#endregion
103
102
  export { is_vendor_prefixed as a, str_equals_range as c, strip_vendor_prefix as d, is_digit as i, str_index_of as l, is_combinator as n, is_whitespace as o, is_custom as r, str_equals as s, is_and_or_not_range as t, str_starts_with as u };