@projectwallace/css-parser 0.18.8 → 0.18.11
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.
- package/README.md +186 -18
- package/dist/{arena-e9O_g2AN.js → arena-Bsf96CQK.js} +27 -19
- package/dist/{arena-BGvFdbj5.d.ts → arena-DvT75bvK.d.ts} +2 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/{css-node-CH5HqF0J.js → css-node-yoUdFtNg.js} +101 -106
- package/dist/index.d.ts +6 -20
- package/dist/index.js +9 -146
- package/dist/{node-types-YnOKcNfU.d.ts → node-types-DG8OKqPu.d.ts} +8 -54
- package/dist/node-types.d.ts +2 -0
- package/dist/node-types.js +142 -0
- package/dist/parse-anplusb.d.ts +2 -2
- package/dist/parse-anplusb.js +5 -4
- package/dist/parse-atrule-prelude.d.ts +4 -3
- package/dist/parse-atrule-prelude.js +82 -77
- package/dist/parse-declaration.d.ts +4 -3
- package/dist/parse-declaration.js +28 -26
- package/dist/parse-dimension.js +46 -1
- package/dist/{parse-selector-PhqFezCi.js → parse-selector-CqIpnBrQ.js} +74 -89
- package/dist/parse-selector.d.ts +2 -2
- package/dist/parse-selector.js +1 -2
- package/dist/parse-value.d.ts +2 -2
- package/dist/parse-value.js +8 -8
- package/dist/parse.d.ts +3 -3
- package/dist/parse.js +49 -47
- package/dist/string-helpers-BMWJduts.d.ts +18 -0
- package/dist/string-helpers.d.ts +2 -0
- package/dist/string-helpers.js +1 -0
- package/dist/{parse-dimension-CQELWb5z.js → string-utils-DiRRd28d.js} +9 -59
- package/dist/token-types-Bqsf5FX-.d.ts +38 -0
- package/dist/token-types.d.ts +2 -0
- package/dist/token-types.js +30 -0
- package/dist/{tokenize-BYl6GvyV.js → tokenize-Ccg58Z_k.js} +79 -96
- package/dist/tokenize.d.ts +97 -2
- package/dist/tokenize.js +1 -2
- package/dist/{value-node-parser-tjY982sG.js → value-node-parser-D0qnA_bD.js} +153 -219
- package/dist/walk.d.ts +3 -2
- package/dist/walk.js +2 -2
- package/package.json +29 -18
- package/dist/tokenize-CDEnYcVG.d.ts +0 -133
|
@@ -1,54 +1,7 @@
|
|
|
1
|
-
import "./arena-
|
|
2
|
-
import { a as is_vendor_prefixed, o as is_whitespace, s as str_equals,
|
|
1
|
+
import "./arena-Bsf96CQK.js";
|
|
2
|
+
import { a as is_vendor_prefixed, o as is_whitespace, s as str_equals, u as str_starts_with } from "./string-utils-DiRRd28d.js";
|
|
3
|
+
import { dimension_number_end } from "./parse-dimension.js";
|
|
3
4
|
//#region src/css-node.ts
|
|
4
|
-
const TYPE_NAMES = {
|
|
5
|
-
[1]: "StyleSheet",
|
|
6
|
-
[2]: "Rule",
|
|
7
|
-
[3]: "Atrule",
|
|
8
|
-
[4]: "Declaration",
|
|
9
|
-
[5]: "Selector",
|
|
10
|
-
[6]: "Comment",
|
|
11
|
-
[7]: "Block",
|
|
12
|
-
[8]: "Raw",
|
|
13
|
-
[10]: "Identifier",
|
|
14
|
-
[11]: "Number",
|
|
15
|
-
[12]: "Dimension",
|
|
16
|
-
[13]: "String",
|
|
17
|
-
[14]: "Hash",
|
|
18
|
-
[15]: "Function",
|
|
19
|
-
[16]: "Operator",
|
|
20
|
-
[17]: "Parentheses",
|
|
21
|
-
[18]: "Url",
|
|
22
|
-
[19]: "UnicodeRange",
|
|
23
|
-
[50]: "Value",
|
|
24
|
-
[20]: "SelectorList",
|
|
25
|
-
[21]: "TypeSelector",
|
|
26
|
-
[22]: "ClassSelector",
|
|
27
|
-
[23]: "IdSelector",
|
|
28
|
-
[24]: "AttributeSelector",
|
|
29
|
-
[25]: "PseudoClassSelector",
|
|
30
|
-
[26]: "PseudoElementSelector",
|
|
31
|
-
[27]: "Combinator",
|
|
32
|
-
[28]: "UniversalSelector",
|
|
33
|
-
[29]: "NestingSelector",
|
|
34
|
-
[30]: "Nth",
|
|
35
|
-
[31]: "NthOf",
|
|
36
|
-
[56]: "Lang",
|
|
37
|
-
[32]: "MediaQuery",
|
|
38
|
-
[33]: "Feature",
|
|
39
|
-
[34]: "MediaType",
|
|
40
|
-
[35]: "ContainerQuery",
|
|
41
|
-
[36]: "SupportsQuery",
|
|
42
|
-
[57]: "SupportsDeclaration",
|
|
43
|
-
[37]: "Layer",
|
|
44
|
-
[38]: "Operator",
|
|
45
|
-
[39]: "MediaFeatureRange",
|
|
46
|
-
[40]: "AtrulePrelude",
|
|
47
|
-
[41]: "PreludeSelectorList",
|
|
48
|
-
[58]: "Ratio",
|
|
49
|
-
[59]: "IfBranch",
|
|
50
|
-
[60]: "IfCondition"
|
|
51
|
-
};
|
|
52
5
|
const nodes_with_name = /* @__PURE__ */ new Set([
|
|
53
6
|
3,
|
|
54
7
|
10,
|
|
@@ -114,24 +67,18 @@ var CSSNode = class CSSNode {
|
|
|
114
67
|
this.source = source;
|
|
115
68
|
this.index = index;
|
|
116
69
|
}
|
|
117
|
-
/**
|
|
118
|
-
* @internal
|
|
119
|
-
* Get the arena (for internal/advanced use only)
|
|
120
|
-
*/
|
|
121
70
|
__get_arena() {
|
|
122
71
|
return this.arena;
|
|
123
72
|
}
|
|
124
|
-
/** @internal */
|
|
125
73
|
__get_source() {
|
|
126
74
|
return this.source;
|
|
127
75
|
}
|
|
128
|
-
/** @internal */
|
|
129
76
|
__get_index() {
|
|
130
77
|
return this.index;
|
|
131
78
|
}
|
|
132
79
|
get_content() {
|
|
133
|
-
|
|
134
|
-
|
|
80
|
+
const start = this.arena.get_content_start(this.index);
|
|
81
|
+
const length = this.arena.get_content_length(this.index);
|
|
135
82
|
if (length === 0) return "";
|
|
136
83
|
return this.source.substring(start, start + length);
|
|
137
84
|
}
|
|
@@ -141,35 +88,83 @@ var CSSNode = class CSSNode {
|
|
|
141
88
|
}
|
|
142
89
|
/** Get node type as human-readable string */
|
|
143
90
|
get type_name() {
|
|
144
|
-
|
|
91
|
+
switch (this.type) {
|
|
92
|
+
case 1: return "StyleSheet";
|
|
93
|
+
case 2: return "Rule";
|
|
94
|
+
case 3: return "Atrule";
|
|
95
|
+
case 4: return "Declaration";
|
|
96
|
+
case 5: return "Selector";
|
|
97
|
+
case 6: return "Comment";
|
|
98
|
+
case 7: return "Block";
|
|
99
|
+
case 8: return "Raw";
|
|
100
|
+
case 10: return "Identifier";
|
|
101
|
+
case 11: return "Number";
|
|
102
|
+
case 12: return "Dimension";
|
|
103
|
+
case 13: return "String";
|
|
104
|
+
case 14: return "Hash";
|
|
105
|
+
case 15: return "Function";
|
|
106
|
+
case 16: return "Operator";
|
|
107
|
+
case 17: return "Parentheses";
|
|
108
|
+
case 18: return "Url";
|
|
109
|
+
case 19: return "UnicodeRange";
|
|
110
|
+
case 50: return "Value";
|
|
111
|
+
case 20: return "SelectorList";
|
|
112
|
+
case 21: return "TypeSelector";
|
|
113
|
+
case 22: return "ClassSelector";
|
|
114
|
+
case 23: return "IdSelector";
|
|
115
|
+
case 24: return "AttributeSelector";
|
|
116
|
+
case 25: return "PseudoClassSelector";
|
|
117
|
+
case 26: return "PseudoElementSelector";
|
|
118
|
+
case 27: return "Combinator";
|
|
119
|
+
case 28: return "UniversalSelector";
|
|
120
|
+
case 29: return "NestingSelector";
|
|
121
|
+
case 30: return "Nth";
|
|
122
|
+
case 31: return "NthOf";
|
|
123
|
+
case 56: return "Lang";
|
|
124
|
+
case 32: return "MediaQuery";
|
|
125
|
+
case 33: return "Feature";
|
|
126
|
+
case 34: return "MediaType";
|
|
127
|
+
case 35: return "ContainerQuery";
|
|
128
|
+
case 36: return "SupportsQuery";
|
|
129
|
+
case 57: return "SupportsDeclaration";
|
|
130
|
+
case 37: return "Layer";
|
|
131
|
+
case 38: return "Operator";
|
|
132
|
+
case 39: return "MediaFeatureRange";
|
|
133
|
+
case 40: return "AtrulePrelude";
|
|
134
|
+
case 41: return "PreludeSelectorList";
|
|
135
|
+
case 58: return "Ratio";
|
|
136
|
+
case 59: return "IfBranch";
|
|
137
|
+
case 60: return "IfCondition";
|
|
138
|
+
default: return "unknown";
|
|
139
|
+
}
|
|
145
140
|
}
|
|
146
141
|
/** Get the full text of this node from source */
|
|
147
142
|
get text() {
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
const start = this.arena.get_start_offset(this.index);
|
|
144
|
+
const length = this.arena.get_length(this.index);
|
|
150
145
|
return this.source.substring(start, start + length);
|
|
151
146
|
}
|
|
152
147
|
/** Get the "content" text (at-rule name for at-rules, layer name for import layers) */
|
|
153
148
|
get name() {
|
|
154
149
|
if (!nodes_with_name.has(this.type)) return;
|
|
155
|
-
|
|
150
|
+
const { type } = this;
|
|
156
151
|
if (type === 28) return null;
|
|
157
|
-
|
|
152
|
+
const content = this.get_content();
|
|
158
153
|
if (type === 56 && content === "") return null;
|
|
159
154
|
return content;
|
|
160
155
|
}
|
|
161
156
|
/** Namespace prefix for type/universal selectors: null (none), '' (`|div`), 'ns' (`ns|div`), or '*' (`*|div`). */
|
|
162
157
|
get namespace() {
|
|
163
|
-
|
|
158
|
+
const { type } = this;
|
|
164
159
|
if (type !== 21 && type !== 28) return void 0;
|
|
165
160
|
if (!this.arena.has_flag(this.index, 16)) return null;
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
const start = this.arena.get_value_start(this.index);
|
|
162
|
+
const length = this.arena.get_value_length(this.index);
|
|
168
163
|
return this.source.substring(start, start + length);
|
|
169
164
|
}
|
|
170
165
|
/** Alias for `name` on declarations ("color" in "color: blue"), more semantic than `name` there. */
|
|
171
166
|
get property() {
|
|
172
|
-
|
|
167
|
+
const { type } = this;
|
|
173
168
|
if (type !== 4 && type !== 33 && type !== 57) return;
|
|
174
169
|
return this.get_content();
|
|
175
170
|
}
|
|
@@ -178,7 +173,7 @@ var CSSNode = class CSSNode {
|
|
|
178
173
|
* String: content without quotes. URL: quoted string keeps quotes, unquoted URL doesn't.
|
|
179
174
|
*/
|
|
180
175
|
get value() {
|
|
181
|
-
|
|
176
|
+
const { type, text, first_child } = this;
|
|
182
177
|
if (type === 3) return void 0;
|
|
183
178
|
if (type === 34) return text;
|
|
184
179
|
if (type === 4 && first_child) return first_child;
|
|
@@ -186,29 +181,29 @@ var CSSNode = class CSSNode {
|
|
|
186
181
|
if (type === 57) return first_child?.first_child ?? null;
|
|
187
182
|
if (type === 59) return first_child?.next_sibling ?? null;
|
|
188
183
|
if (type === 12) {
|
|
189
|
-
|
|
184
|
+
const num_str = text.substring(0, dimension_number_end(text));
|
|
190
185
|
return num_str ? Number.parseFloat(num_str) : 0;
|
|
191
186
|
}
|
|
192
187
|
if (type === 11) return Number(text);
|
|
193
188
|
if (type === 18) {
|
|
194
189
|
if (first_child?.type === 13) return first_child.text;
|
|
195
190
|
if (str_starts_with(text, "url(")) {
|
|
196
|
-
|
|
197
|
-
|
|
191
|
+
const open_paren = text.indexOf("(");
|
|
192
|
+
const close_paren = text.lastIndexOf(")");
|
|
198
193
|
if (open_paren !== -1 && close_paren !== -1 && close_paren > open_paren) return text.substring(open_paren + 1, close_paren).trim();
|
|
199
194
|
} else if (text.startsWith("\"") || text.startsWith("'")) return text;
|
|
200
195
|
}
|
|
201
196
|
if (type === 16 || type === 37) return this.get_content();
|
|
202
197
|
if (type !== 4 && type !== 15 && type !== 24 && type !== 36 && type !== 41) return;
|
|
203
|
-
|
|
204
|
-
|
|
198
|
+
const start = this.arena.get_value_start(this.index);
|
|
199
|
+
const length = this.arena.get_value_length(this.index);
|
|
205
200
|
if (length === 0) return null;
|
|
206
201
|
return this.source.substring(start, start + length);
|
|
207
202
|
}
|
|
208
203
|
/** At-rules: AT_RULE_PRELUDE wrapper (media queries, layer names, …). Style rules: SELECTOR_LIST/SELECTOR. Null if none. */
|
|
209
204
|
get prelude() {
|
|
210
205
|
if (this.type === 3) {
|
|
211
|
-
|
|
206
|
+
const first = this.first_child;
|
|
212
207
|
if (first?.type === 40 || first?.type === 8) return first;
|
|
213
208
|
return null;
|
|
214
209
|
}
|
|
@@ -217,13 +212,13 @@ var CSSNode = class CSSNode {
|
|
|
217
212
|
/** Attribute selector operator (=, ~=, |=, ^=, $=, *=), or null for the bare `[attr]` form. */
|
|
218
213
|
get attr_operator() {
|
|
219
214
|
if (this.type !== 24) return void 0;
|
|
220
|
-
|
|
221
|
-
|
|
215
|
+
const content_end = this.arena.get_content_start(this.index) + this.arena.get_content_length(this.index);
|
|
216
|
+
const node_end = this.arena.get_start_offset(this.index) + this.arena.get_length(this.index);
|
|
222
217
|
let pos = content_end;
|
|
223
218
|
while (pos < node_end && is_whitespace(this.source.charCodeAt(pos))) pos++;
|
|
224
219
|
if (pos >= node_end) return null;
|
|
225
|
-
|
|
226
|
-
|
|
220
|
+
const ch1 = this.source.charCodeAt(pos);
|
|
221
|
+
const ch2 = pos + 1 < node_end ? this.source.charCodeAt(pos + 1) : 0;
|
|
227
222
|
if (ch1 === 61) return this.source.at(pos);
|
|
228
223
|
if (ch1 === 126 && ch2 === 61) return this.source.substring(pos, pos + 2);
|
|
229
224
|
if (ch1 === 124 && ch2 === 61) return this.source.substring(pos, pos + 2);
|
|
@@ -235,21 +230,21 @@ var CSSNode = class CSSNode {
|
|
|
235
230
|
/** Attribute selector flag: "i" (case-insensitive), "s" (case-sensitive), or null if absent. */
|
|
236
231
|
get attr_flags() {
|
|
237
232
|
if (this.type !== 24) return void 0;
|
|
238
|
-
|
|
233
|
+
const value_len = this.arena.get_value_length(this.index);
|
|
239
234
|
if (value_len === 0) return null;
|
|
240
|
-
|
|
241
|
-
|
|
235
|
+
const value_end = this.arena.get_value_start(this.index) + value_len;
|
|
236
|
+
const node_end = this.arena.get_start_offset(this.index) + this.arena.get_length(this.index);
|
|
242
237
|
let pos = value_end;
|
|
243
238
|
while (pos < node_end && is_whitespace(this.source.charCodeAt(pos))) pos++;
|
|
244
239
|
if (pos >= node_end) return null;
|
|
245
|
-
|
|
240
|
+
const flag_ch = this.source.charCodeAt(pos);
|
|
246
241
|
if (flag_ch === 105 || flag_ch === 73 || flag_ch === 115 || flag_ch === 83) return this.source.at(pos);
|
|
247
242
|
return null;
|
|
248
243
|
}
|
|
249
244
|
/** Get the unit for dimension nodes (e.g., "px" from "100px", "%" from "50%") */
|
|
250
245
|
get unit() {
|
|
251
246
|
if (this.type !== 12) return void 0;
|
|
252
|
-
|
|
247
|
+
const text = this.text;
|
|
253
248
|
return text.substring(dimension_number_end(text));
|
|
254
249
|
}
|
|
255
250
|
/** Numerator for ratio values, e.g. the Number "16" in `aspect-ratio: 16/9` */
|
|
@@ -301,7 +296,7 @@ var CSSNode = class CSSNode {
|
|
|
301
296
|
}
|
|
302
297
|
/** Check if this node has a prelude (at-rules and style rules) */
|
|
303
298
|
get has_prelude() {
|
|
304
|
-
|
|
299
|
+
const { type } = this;
|
|
305
300
|
if (type === 3) return this.first_child !== null && this.first_child.type !== 7;
|
|
306
301
|
if (type === 2) return this.first_child !== null;
|
|
307
302
|
return false;
|
|
@@ -312,17 +307,17 @@ var CSSNode = class CSSNode {
|
|
|
312
307
|
}
|
|
313
308
|
/** Check if this style rule has declarations */
|
|
314
309
|
get has_declarations() {
|
|
315
|
-
|
|
310
|
+
const { type } = this;
|
|
316
311
|
if (type !== 3 && type !== 2) return void 0;
|
|
317
312
|
return this.arena.has_flag(this.index, 32);
|
|
318
313
|
}
|
|
319
314
|
/** Get the block node (for style rules and at-rules with blocks) */
|
|
320
315
|
get block() {
|
|
321
|
-
|
|
316
|
+
const { type } = this;
|
|
322
317
|
if (type === 2) {
|
|
323
|
-
|
|
318
|
+
const first = this.first_child;
|
|
324
319
|
if (!first) return null;
|
|
325
|
-
|
|
320
|
+
const block_node = first.next_sibling;
|
|
326
321
|
if (block_node?.type === 7) return block_node;
|
|
327
322
|
return null;
|
|
328
323
|
}
|
|
@@ -371,13 +366,13 @@ var CSSNode = class CSSNode {
|
|
|
371
366
|
}
|
|
372
367
|
/** Get first child node */
|
|
373
368
|
get first_child() {
|
|
374
|
-
|
|
369
|
+
const child_index = this.arena.get_first_child(this.index);
|
|
375
370
|
if (child_index === 0) return null;
|
|
376
371
|
return new CSSNode(this.arena, this.source, child_index);
|
|
377
372
|
}
|
|
378
373
|
/** Get next sibling node */
|
|
379
374
|
get next_sibling() {
|
|
380
|
-
|
|
375
|
+
const sibling_index = this.arena.get_next_sibling(this.index);
|
|
381
376
|
if (sibling_index === 0) return null;
|
|
382
377
|
return new CSSNode(this.arena, this.source, sibling_index);
|
|
383
378
|
}
|
|
@@ -387,7 +382,7 @@ var CSSNode = class CSSNode {
|
|
|
387
382
|
}
|
|
388
383
|
/** Whether this node has children. For pseudo-class/element functions, tracks FLAG_HAS_PARENS so formatters can tell `:lang()` from `:hover`. */
|
|
389
384
|
get has_children() {
|
|
390
|
-
|
|
385
|
+
const { type } = this;
|
|
391
386
|
if (type === 25 || type === 26) {
|
|
392
387
|
if (this.arena.has_flag(this.index, 64)) return true;
|
|
393
388
|
}
|
|
@@ -405,7 +400,7 @@ var CSSNode = class CSSNode {
|
|
|
405
400
|
}
|
|
406
401
|
/** Get all children as an array */
|
|
407
402
|
get children() {
|
|
408
|
-
|
|
403
|
+
const result = [];
|
|
409
404
|
let child = this.first_child;
|
|
410
405
|
while (child) {
|
|
411
406
|
result.push(child);
|
|
@@ -423,24 +418,24 @@ var CSSNode = class CSSNode {
|
|
|
423
418
|
}
|
|
424
419
|
/** Get the 'a' coefficient from An+B expression (e.g., "2n" from "2n+1", "odd" from "odd") */
|
|
425
420
|
get nth_a() {
|
|
426
|
-
|
|
421
|
+
const { type, arena, index } = this;
|
|
427
422
|
if (type !== 30 && type !== 31) return void 0;
|
|
428
|
-
|
|
423
|
+
const len = arena.get_content_length(index);
|
|
429
424
|
if (len === 0) return null;
|
|
430
|
-
|
|
425
|
+
const start = arena.get_content_start(index);
|
|
431
426
|
return this.source.substring(start, start + len);
|
|
432
427
|
}
|
|
433
428
|
/** Get the 'b' coefficient from An+B expression (e.g., "+1" from "2n+1") */
|
|
434
429
|
get nth_b() {
|
|
435
|
-
|
|
430
|
+
const { type, arena, index, source } = this;
|
|
436
431
|
if (type !== 30 && type !== 31) return void 0;
|
|
437
|
-
|
|
432
|
+
const len = arena.get_value_length(index);
|
|
438
433
|
if (len === 0) return null;
|
|
439
|
-
|
|
434
|
+
const start = arena.get_value_start(index);
|
|
440
435
|
let value = source.substring(start, start + len);
|
|
441
436
|
let check_pos = start - 1;
|
|
442
437
|
while (check_pos >= 0) {
|
|
443
|
-
|
|
438
|
+
const ch = source.charCodeAt(check_pos);
|
|
444
439
|
if (is_whitespace(ch)) {
|
|
445
440
|
check_pos--;
|
|
446
441
|
continue;
|
|
@@ -467,14 +462,14 @@ var CSSNode = class CSSNode {
|
|
|
467
462
|
*/
|
|
468
463
|
clone(options = {}) {
|
|
469
464
|
const { deep = true, locations = false } = options;
|
|
470
|
-
|
|
471
|
-
|
|
465
|
+
const { type } = this;
|
|
466
|
+
const plain = {
|
|
472
467
|
type,
|
|
473
468
|
type_name: this.type_name,
|
|
474
469
|
text: this.text
|
|
475
470
|
};
|
|
476
|
-
for (
|
|
477
|
-
|
|
471
|
+
for (const key of enumerable_properties) {
|
|
472
|
+
const val = this[key];
|
|
478
473
|
if (val instanceof CSSNode) plain[key] = val.clone({
|
|
479
474
|
deep,
|
|
480
475
|
locations
|
|
@@ -492,8 +487,8 @@ var CSSNode = class CSSNode {
|
|
|
492
487
|
plain.children = [];
|
|
493
488
|
plain.child_count = this.child_count;
|
|
494
489
|
plain.has_children = this.has_children;
|
|
495
|
-
|
|
496
|
-
if (children) for (
|
|
490
|
+
const children = this.children;
|
|
491
|
+
if (children) for (const child of children) plain.children.push(child.clone({
|
|
497
492
|
deep: true,
|
|
498
493
|
locations
|
|
499
494
|
}));
|
|
@@ -502,4 +497,4 @@ var CSSNode = class CSSNode {
|
|
|
502
497
|
}
|
|
503
498
|
};
|
|
504
499
|
//#endregion
|
|
505
|
-
export {
|
|
500
|
+
export { CSSNode as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { A as PARENTHESIS, B as STYLESHEET, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_SELECTOR, F as RATIO, G as UNICODE_RANGE, H as SUPPORTS_DECLARATION, I as RAW, J as VALUE, K as UNIVERSAL_SELECTOR, L as SELECTOR, N as PSEUDO_CLASS_SELECTOR, O as NUMBER, P as PSEUDO_ELEMENT_SELECTOR, R as SELECTOR_LIST, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as SUPPORTS_QUERY, V as STYLE_RULE, W as TYPE_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, q as URL, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STRING } from "./arena-
|
|
1
|
+
import { A as PARENTHESIS, B as STYLESHEET, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_SELECTOR, F as RATIO, G as UNICODE_RANGE, H as SUPPORTS_DECLARATION, I as RAW, J as VALUE, K as UNIVERSAL_SELECTOR, L as SELECTOR, N as PSEUDO_CLASS_SELECTOR, O as NUMBER, P as PSEUDO_ELEMENT_SELECTOR, R as SELECTOR_LIST, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as SUPPORTS_QUERY, V as STYLE_RULE, W as TYPE_SELECTOR, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, q as URL, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STRING } from "./arena-DvT75bvK.js";
|
|
2
2
|
import { NODE_TYPES } from "./constants.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { C as TOKEN_SEMICOLON, D as TOKEN_WHITESPACE, E as TOKEN_URL, O as Token, S as TOKEN_RIGHT_PAREN, T as TOKEN_UNICODE_RANGE, _ as TOKEN_LEFT_PAREN, a as TOKEN_CDO, b as TOKEN_RIGHT_BRACE, c as TOKEN_COMMENT, d as TOKEN_EOF, f as TOKEN_FUNCTION, g as TOKEN_LEFT_BRACKET, h as TOKEN_LEFT_BRACE, i as TOKEN_CDC, k as TokenType, l as TOKEN_DELIM, m as TOKEN_IDENT, n as TOKEN_BAD_STRING, o as TOKEN_COLON, p as TOKEN_HASH, r as TOKEN_BAD_URL, s as TOKEN_COMMA, t as TOKEN_AT_KEYWORD, u as TOKEN_DIMENSION, v as TOKEN_NUMBER, w as TOKEN_STRING, x as TOKEN_RIGHT_BRACKET, y as TOKEN_PERCENTAGE } from "./token-types-Bqsf5FX-.js";
|
|
4
|
+
import { CommentInfo, LexerPosition, tokenize } from "./tokenize.js";
|
|
5
|
+
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, 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-DG8OKqPu.js";
|
|
5
6
|
import { ParserOptions, parse } from "./parse.js";
|
|
6
7
|
import { parse_selector, parse_selector_list } from "./parse-selector.js";
|
|
7
8
|
import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
|
|
@@ -9,20 +10,5 @@ import { parse_declaration } from "./parse-declaration.js";
|
|
|
9
10
|
import { parse_value } from "./parse-value.js";
|
|
10
11
|
import { parse_dimension } from "./parse-dimension.js";
|
|
11
12
|
import { BREAK, SKIP, traverse, walk } from "./walk.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @param a Base string, MUST be lowercase!
|
|
15
|
-
* @param b Compare string
|
|
16
|
-
*/
|
|
17
|
-
export declare function str_equals(a: string, b: string): boolean;
|
|
18
|
-
/** Case-insensitive ASCII prefix check without allocations. `prefix` MUST be lowercase. */
|
|
19
|
-
export declare function str_starts_with(str: string, prefix: string): boolean;
|
|
20
|
-
/** Case-insensitive substring search without allocations, or -1 if not found. `searchChar` MUST be lowercase. */
|
|
21
|
-
export declare function str_index_of(str: string, searchChar: string): number;
|
|
22
|
-
/** True if the string/range is vendor-prefixed (-webkit-, -moz-, -ms-, -o-). `--custom-property` is not. */
|
|
23
|
-
export declare function is_vendor_prefixed(text: string): boolean;
|
|
24
|
-
export declare function is_vendor_prefixed(source: string, start: number, end: number): boolean;
|
|
25
|
-
/** True if the string is a CSS custom property (starts with `--`). */
|
|
26
|
-
export declare function is_custom(str: string): boolean;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, type AnyNode, type Atrule, type AtrulePrelude, type AttributeSelector, BLOCK, BREAK, type Block, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, type CSSNode, type ClassSelector, type CloneOptions, type Combinator, type Comment, type CommentInfo, type ContainerQuery, DECLARATION, DIMENSION, type Declaration, type Dimension, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, type FeatureRange, type Function, HASH, type Hash, IDENTIFIER, ID_SELECTOR, IF_BRANCH, IF_CONDITION, type IdSelector, type Identifier, type IfBranch, type IfCondition, LANG_SELECTOR, LAYER_NAME, type LangSelector, type LayerName, type LexerPosition, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, type MediaFeature, type MediaQuery, type MediaType, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, type NestingSelector, type NthOfSelector, type NthSelector, type Number, OPERATOR, type Operator, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, type Parenthesis, type ParserOptions, type PlainCSSNode, type PreludeOperator, type PreludeSelectorList, type PseudoClassSelector, type PseudoElementSelector, RATIO, RAW, type Ratio, type Raw, type Rule, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, type Selector, type SelectorList, type SelectorNode, type String, type StyleSheet, type SupportsDeclaration, type SupportsQuery, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_NAMES, TYPE_SELECTOR, type ToPlain, Token, TokenType, type TypeSelector, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, type UnicodeRange, type UniversalSelector, type Url, VALUE, type Value, type WithChildren, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_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, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_selector_list, parse_value, tokenize, traverse, walk };
|
|
13
|
+
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-BMWJduts.js";
|
|
14
|
+
export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, type AnyNode, type Atrule, type AtrulePrelude, type AttributeSelector, BLOCK, BREAK, type Block, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, type CSSNode, type ClassSelector, type CloneOptions, type Combinator, type Comment, type CommentInfo, type ContainerQuery, DECLARATION, DIMENSION, type Declaration, type Dimension, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, type FeatureRange, type Function, HASH, type Hash, IDENTIFIER, ID_SELECTOR, IF_BRANCH, IF_CONDITION, type IdSelector, type Identifier, type IfBranch, type IfCondition, LANG_SELECTOR, LAYER_NAME, type LangSelector, type LayerName, type LexerPosition, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, type MediaFeature, type MediaQuery, type MediaType, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, type NestingSelector, type NthOfSelector, type NthSelector, type Number, OPERATOR, type Operator, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, type Parenthesis, type ParserOptions, type PlainCSSNode, type PreludeOperator, type PreludeSelectorList, type PseudoClassSelector, type PseudoElementSelector, RATIO, RAW, type Ratio, type Raw, type Rule, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, type Selector, type SelectorList, type SelectorNode, type String, type StyleSheet, type SupportsDeclaration, type SupportsQuery, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_SELECTOR, type ToPlain, Token, TokenType, type TypeSelector, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, type UnicodeRange, type UniversalSelector, type Url, VALUE, type Value, type WithChildren, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_custom, is_declaration, is_dimension, is_feature_range, is_function, is_hash, is_id_selector, is_identifier, is_if_branch, is_if_condition, is_lang_selector, is_layer_name, is_media_feature, is_media_query, is_media_type, is_nesting_selector, is_nth_of_selector, is_nth_selector, is_number, is_operator, is_parenthesis, is_prelude_operator, is_prelude_selectorlist, is_pseudo_class_selector, is_pseudo_element_selector, is_ratio, is_raw, is_rule, is_selector, is_selector_list, is_string, is_stylesheet, is_supports_declaration, is_supports_query, is_type_selector, is_unicode_range, is_universal_selector, is_url, is_value, is_vendor_prefixed, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_selector_list, parse_value, str_equals, str_index_of, str_starts_with, strip_vendor_prefix, tokenize, traverse, walk };
|
package/dist/index.js
CHANGED
|
@@ -1,152 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { n as tokenize } from "./tokenize-Ccg58Z_k.js";
|
|
2
|
+
import { TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE } from "./token-types.js";
|
|
3
|
+
import { A as PARENTHESIS, B as STYLE_RULE, C as MEDIA_QUERY, D as NTH_SELECTOR, E as NTH_OF_SELECTOR, F as RAW, G as UNIVERSAL_SELECTOR, H as SUPPORTS_QUERY, I as SELECTOR, K as URL, L as SELECTOR_LIST, M as PSEUDO_CLASS_SELECTOR, N as PSEUDO_ELEMENT_SELECTOR, O as NUMBER, P as RATIO, R as STRING, S as MEDIA_FEATURE, T as NESTING_SELECTOR, U as TYPE_SELECTOR, V as SUPPORTS_DECLARATION, W as UNICODE_RANGE, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as LANG_SELECTOR, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PRELUDE_OPERATOR, k as OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, q as VALUE, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as IF_BRANCH, w as MEDIA_TYPE, x as LAYER_NAME, y as IF_CONDITION, z as STYLESHEET } from "./arena-Bsf96CQK.js";
|
|
4
|
+
import { a as is_vendor_prefixed, d as strip_vendor_prefix, l as str_index_of, r as is_custom, s as str_equals, u as str_starts_with } from "./string-utils-DiRRd28d.js";
|
|
5
|
+
import { parse_dimension } from "./parse-dimension.js";
|
|
6
|
+
import { n as parse_selector, r as parse_selector_list } from "./parse-selector-CqIpnBrQ.js";
|
|
6
7
|
import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
|
|
7
8
|
import { parse_value } from "./parse-value.js";
|
|
8
9
|
import { parse_declaration } from "./parse-declaration.js";
|
|
9
10
|
import { parse } from "./parse.js";
|
|
10
11
|
import { NODE_TYPES } from "./constants.js";
|
|
11
12
|
import { BREAK, SKIP, traverse, walk } from "./walk.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
function is_rule(node) {
|
|
17
|
-
return node.type === 2;
|
|
18
|
-
}
|
|
19
|
-
function is_atrule(node) {
|
|
20
|
-
return node.type === 3;
|
|
21
|
-
}
|
|
22
|
-
function is_declaration(node) {
|
|
23
|
-
return node.type === 4;
|
|
24
|
-
}
|
|
25
|
-
function is_selector(node) {
|
|
26
|
-
return node.type === 5;
|
|
27
|
-
}
|
|
28
|
-
function is_selector_list(node) {
|
|
29
|
-
return node.type === 20;
|
|
30
|
-
}
|
|
31
|
-
function is_block(node) {
|
|
32
|
-
return node.type === 7;
|
|
33
|
-
}
|
|
34
|
-
function is_comment(node) {
|
|
35
|
-
return node.type === 6;
|
|
36
|
-
}
|
|
37
|
-
function is_raw(node) {
|
|
38
|
-
return node.type === 8;
|
|
39
|
-
}
|
|
40
|
-
function is_identifier(node) {
|
|
41
|
-
return node.type === 10;
|
|
42
|
-
}
|
|
43
|
-
function is_number(node) {
|
|
44
|
-
return node.type === 11;
|
|
45
|
-
}
|
|
46
|
-
function is_dimension(node) {
|
|
47
|
-
return node.type === 12;
|
|
48
|
-
}
|
|
49
|
-
function is_string(node) {
|
|
50
|
-
return node.type === 13;
|
|
51
|
-
}
|
|
52
|
-
function is_hash(node) {
|
|
53
|
-
return node.type === 14;
|
|
54
|
-
}
|
|
55
|
-
function is_function(node) {
|
|
56
|
-
return node.type === 15;
|
|
57
|
-
}
|
|
58
|
-
function is_operator(node) {
|
|
59
|
-
return node.type === 16;
|
|
60
|
-
}
|
|
61
|
-
function is_parenthesis(node) {
|
|
62
|
-
return node.type === 17;
|
|
63
|
-
}
|
|
64
|
-
function is_url(node) {
|
|
65
|
-
return node.type === 18;
|
|
66
|
-
}
|
|
67
|
-
function is_unicode_range(node) {
|
|
68
|
-
return node.type === 19;
|
|
69
|
-
}
|
|
70
|
-
function is_if_branch(node) {
|
|
71
|
-
return node.type === 59;
|
|
72
|
-
}
|
|
73
|
-
function is_if_condition(node) {
|
|
74
|
-
return node.type === 60;
|
|
75
|
-
}
|
|
76
|
-
function is_value(node) {
|
|
77
|
-
return node.type === 50;
|
|
78
|
-
}
|
|
79
|
-
function is_type_selector(node) {
|
|
80
|
-
return node.type === 21;
|
|
81
|
-
}
|
|
82
|
-
function is_class_selector(node) {
|
|
83
|
-
return node.type === 22;
|
|
84
|
-
}
|
|
85
|
-
function is_id_selector(node) {
|
|
86
|
-
return node.type === 23;
|
|
87
|
-
}
|
|
88
|
-
function is_attribute_selector(node) {
|
|
89
|
-
return node.type === 24;
|
|
90
|
-
}
|
|
91
|
-
function is_pseudo_class_selector(node) {
|
|
92
|
-
return node.type === 25;
|
|
93
|
-
}
|
|
94
|
-
function is_pseudo_element_selector(node) {
|
|
95
|
-
return node.type === 26;
|
|
96
|
-
}
|
|
97
|
-
function is_combinator(node) {
|
|
98
|
-
return node.type === 27;
|
|
99
|
-
}
|
|
100
|
-
function is_universal_selector(node) {
|
|
101
|
-
return node.type === 28;
|
|
102
|
-
}
|
|
103
|
-
function is_nesting_selector(node) {
|
|
104
|
-
return node.type === 29;
|
|
105
|
-
}
|
|
106
|
-
function is_nth_selector(node) {
|
|
107
|
-
return node.type === 30;
|
|
108
|
-
}
|
|
109
|
-
function is_nth_of_selector(node) {
|
|
110
|
-
return node.type === 31;
|
|
111
|
-
}
|
|
112
|
-
function is_lang_selector(node) {
|
|
113
|
-
return node.type === 56;
|
|
114
|
-
}
|
|
115
|
-
function is_atrule_prelude(node) {
|
|
116
|
-
return node.type === 40;
|
|
117
|
-
}
|
|
118
|
-
function is_media_query(node) {
|
|
119
|
-
return node.type === 32;
|
|
120
|
-
}
|
|
121
|
-
function is_media_feature(node) {
|
|
122
|
-
return node.type === 33;
|
|
123
|
-
}
|
|
124
|
-
function is_media_type(node) {
|
|
125
|
-
return node.type === 34;
|
|
126
|
-
}
|
|
127
|
-
function is_container_query(node) {
|
|
128
|
-
return node.type === 35;
|
|
129
|
-
}
|
|
130
|
-
function is_supports_query(node) {
|
|
131
|
-
return node.type === 36;
|
|
132
|
-
}
|
|
133
|
-
function is_supports_declaration(node) {
|
|
134
|
-
return node.type === 57;
|
|
135
|
-
}
|
|
136
|
-
function is_layer_name(node) {
|
|
137
|
-
return node.type === 37;
|
|
138
|
-
}
|
|
139
|
-
function is_prelude_operator(node) {
|
|
140
|
-
return node.type === 38;
|
|
141
|
-
}
|
|
142
|
-
function is_feature_range(node) {
|
|
143
|
-
return node.type === 39;
|
|
144
|
-
}
|
|
145
|
-
function is_ratio(node) {
|
|
146
|
-
return node.type === 58;
|
|
147
|
-
}
|
|
148
|
-
function is_prelude_selectorlist(node) {
|
|
149
|
-
return node.type === 41;
|
|
150
|
-
}
|
|
151
|
-
//#endregion
|
|
152
|
-
export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, BREAK, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, DECLARATION, DIMENSION, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, HASH, IDENTIFIER, ID_SELECTOR, IF_BRANCH, IF_CONDITION, LANG_SELECTOR, LAYER_NAME, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, OPERATOR, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, RATIO, RAW, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_NAMES, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_custom, is_declaration, is_dimension, is_feature_range, is_function, is_hash, is_id_selector, is_identifier, is_if_branch, is_if_condition, is_lang_selector, is_layer_name, is_media_feature, is_media_query, is_media_type, is_nesting_selector, is_nth_of_selector, is_nth_selector, is_number, is_operator, is_parenthesis, is_prelude_operator, is_prelude_selectorlist, is_pseudo_class_selector, is_pseudo_element_selector, is_ratio, is_raw, is_rule, is_selector, is_selector_list, is_string, is_stylesheet, is_supports_declaration, is_supports_query, is_type_selector, is_unicode_range, is_universal_selector, is_url, is_value, is_vendor_prefixed, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_selector_list, parse_value, str_equals, str_index_of, str_starts_with, tokenize, traverse, walk };
|
|
13
|
+
import "./string-helpers.js";
|
|
14
|
+
import { 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 } from "./node-types.js";
|
|
15
|
+
export { ATTRIBUTE_SELECTOR, AT_RULE, AT_RULE_PRELUDE, BLOCK, BREAK, CLASS_SELECTOR, COMBINATOR, COMMENT, CONTAINER_QUERY, DECLARATION, DIMENSION, FEATURE_RANGE, FLAG_IMPORTANT, FUNCTION, HASH, IDENTIFIER, ID_SELECTOR, IF_BRANCH, IF_CONDITION, LANG_SELECTOR, LAYER_NAME, MEDIA_FEATURE, MEDIA_QUERY, MEDIA_TYPE, NESTING_SELECTOR, NODE_TYPES, NTH_OF_SELECTOR, NTH_SELECTOR, NUMBER, OPERATOR, PARENTHESIS, PRELUDE_OPERATOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, RATIO, RAW, SELECTOR, SELECTOR_LIST, SKIP, STRING, STYLESHEET, STYLE_RULE, SUPPORTS_DECLARATION, SUPPORTS_QUERY, TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, TYPE_SELECTOR, UNICODE_RANGE, UNIVERSAL_SELECTOR, URL, VALUE, is_atrule, is_atrule_prelude, is_attribute_selector, is_block, is_class_selector, is_combinator, is_comment, is_container_query, is_custom, is_declaration, is_dimension, is_feature_range, is_function, is_hash, is_id_selector, is_identifier, is_if_branch, is_if_condition, is_lang_selector, is_layer_name, is_media_feature, is_media_query, is_media_type, is_nesting_selector, is_nth_of_selector, is_nth_selector, is_number, is_operator, is_parenthesis, is_prelude_operator, is_prelude_selectorlist, is_pseudo_class_selector, is_pseudo_element_selector, is_ratio, is_raw, is_rule, is_selector, is_selector_list, is_string, is_stylesheet, is_supports_declaration, is_supports_query, is_type_selector, is_unicode_range, is_universal_selector, is_url, is_value, is_vendor_prefixed, parse, parse_atrule_prelude, parse_declaration, parse_dimension, parse_selector, parse_selector_list, parse_value, str_equals, str_index_of, str_starts_with, strip_vendor_prefix, tokenize, traverse, walk };
|