@projectwallace/css-parser 0.18.0 → 0.18.1
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/dist/{css-node-B3EzCweR.js → css-node-Cf8K9nWd.js} +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{node-types-BRnQyc9B.d.ts → node-types-D41wr72y.d.ts} +8 -4
- package/dist/parse-anplusb.d.ts +1 -1
- package/dist/parse-anplusb.js +1 -1
- package/dist/parse-atrule-prelude.d.ts +3 -1
- package/dist/parse-atrule-prelude.js +57 -31
- package/dist/parse-declaration.d.ts +1 -1
- package/dist/parse-declaration.js +1 -1
- package/dist/parse-selector.d.ts +1 -1
- package/dist/parse-selector.js +1 -1
- package/dist/parse-value.d.ts +1 -1
- package/dist/parse-value.js +1 -1
- package/dist/parse.d.ts +1 -1
- package/dist/parse.js +1 -1
- package/dist/walk.d.ts +1 -1
- package/dist/walk.js +1 -1
- package/package.json +1 -1
|
@@ -161,7 +161,7 @@ var CSSNode = class CSSNode {
|
|
|
161
161
|
/** Alias for `name` on declarations ("color" in "color: blue"), more semantic than `name` there. */
|
|
162
162
|
get property() {
|
|
163
163
|
let { type } = this;
|
|
164
|
-
if (type !== 4 && type !== 33) return;
|
|
164
|
+
if (type !== 4 && type !== 33 && type !== 57) return;
|
|
165
165
|
return this.get_content();
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
@@ -174,6 +174,7 @@ var CSSNode = class CSSNode {
|
|
|
174
174
|
if (type === 34) return text;
|
|
175
175
|
if (type === 4 && first_child) return first_child;
|
|
176
176
|
if (type === 33) return first_child ?? null;
|
|
177
|
+
if (type === 57) return first_child?.first_child ?? null;
|
|
177
178
|
if (type === 12) return parse_dimension(text).value;
|
|
178
179
|
if (type === 11) return Number(text);
|
|
179
180
|
if (type === 18) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { B as SUPPORTS_QUERY, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as SELECTOR_LIST, G as VALUE, H as UNICODE_RANGE, I as STRING, L as STYLESHEET, M as 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 UNIVERSAL_SELECTOR, V as TYPE_SELECTOR, W as URL, _ as ID_SELECTOR, a as CLASS_SELECTOR, b as MEDIA_FEATURE, c as CONTAINER_QUERY, d as DIMENSION, f as FEATURE_RANGE, g as IDENTIFIER, h as HASH, i as BLOCK, j as PSEUDO_CLASS_SELECTOR, k as PRELUDE_OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as LANG_SELECTOR, w as NTH_OF_SELECTOR, x as MEDIA_QUERY, y as LAYER_NAME, z as SUPPORTS_DECLARATION } from "./arena-Bx5vp6Sl.js";
|
|
2
2
|
import { NODE_TYPES } from "./constants.js";
|
|
3
3
|
import { A as TOKEN_URL, C as TOKEN_PERCENTAGE, D as TOKEN_SEMICOLON, E as TOKEN_RIGHT_PAREN, M as Token, N as TokenType, O as TOKEN_STRING, S as TOKEN_NUMBER, T as TOKEN_RIGHT_BRACKET, _ as TOKEN_HASH, a as TOKEN_AT_KEYWORD, b as TOKEN_LEFT_BRACKET, c as TOKEN_CDC, d as TOKEN_COMMA, f as TOKEN_COMMENT, g as TOKEN_FUNCTION, h as TOKEN_EOF, i as tokenize, j as TOKEN_WHITESPACE, k as TOKEN_UNICODE_RANGE, l as TOKEN_CDO, m as TOKEN_DIMENSION, o as TOKEN_BAD_STRING, p as TOKEN_DELIM, r as LexerPosition, s as TOKEN_BAD_URL, t as CommentInfo, u as TOKEN_COLON, v as TOKEN_IDENT, w as TOKEN_RIGHT_BRACE, x as TOKEN_LEFT_PAREN, y as TOKEN_LEFT_BRACE } from "./tokenize-DeZYFa9R.js";
|
|
4
|
-
import { $ as is_class_selector, A as PreludeSelectorList, At as is_stylesheet, B as SupportsDeclaration, Bt as TYPE_NAMES, C as NestingSelector, Ct as is_pseudo_class_selector, D as Operator, Dt as is_selector, E as Number, Et as is_rule, F as Selector, Ft as is_universal_selector, G as UniversalSelector, H as ToPlain, I as SelectorList, It as is_url, J as WithChildren, K as Url, L as SelectorNode, Lt as is_value, M as PseudoElementSelector, Mt as is_supports_query, N as Raw, Nt as is_type_selector, O as Parenthesis, Ot as is_selector_list, P as Rule, Pt as is_unicode_range, Q as is_block, R as String, Rt as CloneOptions, S as MediaType, St as is_prelude_selectorlist, T as NthSelector, Tt as is_raw, U as TypeSelector, V as SupportsQuery, W as UnicodeRange, X as is_atrule_prelude, Y as is_atrule, Z as is_attribute_selector, _ as Identifier, _t as is_nth_selector, a as Block, at as is_feature_range, b as MediaFeature, bt as is_parenthesis, c as Combinator, ct as is_id_selector, d as Declaration, dt as is_layer_name, et as is_combinator, f as Dimension, ft as is_media_feature, g as IdSelector, gt as is_nth_of_selector, h as Hash, ht as is_nesting_selector, i as AttributeSelector, it as is_dimension, j as PseudoClassSelector, jt as is_supports_declaration, k as PreludeOperator, kt as is_string, l as Comment, lt as is_identifier, m as Function, mt as is_media_type, n as Atrule, nt as is_container_query, o as CSSNode, ot as is_function, p as FeatureRange, pt as is_media_query, q as Value, r as AtrulePrelude, rt as is_declaration, s as ClassSelector, st as is_hash, t as AnyNode, tt as is_comment, u as ContainerQuery, ut as is_lang_selector, v as LangSelector, vt as is_number, w as NthOfSelector, wt as is_pseudo_element_selector, x as MediaQuery, xt as is_prelude_operator, y as LayerName, yt as is_operator, z as StyleSheet, zt as PlainCSSNode } from "./node-types-
|
|
4
|
+
import { $ as is_class_selector, A as PreludeSelectorList, At as is_stylesheet, B as SupportsDeclaration, Bt as TYPE_NAMES, C as NestingSelector, Ct as is_pseudo_class_selector, D as Operator, Dt as is_selector, E as Number, Et as is_rule, F as Selector, Ft as is_universal_selector, G as UniversalSelector, H as ToPlain, I as SelectorList, It as is_url, J as WithChildren, K as Url, L as SelectorNode, Lt as is_value, M as PseudoElementSelector, Mt as is_supports_query, N as Raw, Nt as is_type_selector, O as Parenthesis, Ot as is_selector_list, P as Rule, Pt as is_unicode_range, Q as is_block, R as String, Rt as CloneOptions, S as MediaType, St as is_prelude_selectorlist, T as NthSelector, Tt as is_raw, U as TypeSelector, V as SupportsQuery, W as UnicodeRange, X as is_atrule_prelude, Y as is_atrule, Z as is_attribute_selector, _ as Identifier, _t as is_nth_selector, a as Block, at as is_feature_range, b as MediaFeature, bt as is_parenthesis, c as Combinator, ct as is_id_selector, d as Declaration, dt as is_layer_name, et as is_combinator, f as Dimension, ft as is_media_feature, g as IdSelector, gt as is_nth_of_selector, h as Hash, ht as is_nesting_selector, i as AttributeSelector, it as is_dimension, j as PseudoClassSelector, jt as is_supports_declaration, k as PreludeOperator, kt as is_string, l as Comment, lt as is_identifier, m as Function, mt as is_media_type, n as Atrule, nt as is_container_query, o as CSSNode, ot as is_function, p as FeatureRange, pt as is_media_query, q as Value, r as AtrulePrelude, rt as is_declaration, s as ClassSelector, st as is_hash, t as AnyNode, tt as is_comment, u as ContainerQuery, ut as is_lang_selector, v as LangSelector, vt as is_number, w as NthOfSelector, wt as is_pseudo_element_selector, x as MediaQuery, xt as is_prelude_operator, y as LayerName, yt as is_operator, z as StyleSheet, zt as PlainCSSNode } from "./node-types-D41wr72y.js";
|
|
5
5
|
import { ParserOptions, parse } from "./parse.js";
|
|
6
6
|
import { parse_selector, parse_selector_list } from "./parse-selector.js";
|
|
7
7
|
import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as TOKEN_RIGHT_BRACKET, D as TOKEN_UNICODE_RANGE, E as TOKEN_STRING, O as TOKEN_URL, S as TOKEN_RIGHT_BRACE, T as TOKEN_SEMICOLON, _ as TOKEN_LEFT_BRACE, a as TOKEN_BAD_URL, b as TOKEN_NUMBER, c as TOKEN_COLON, d as TOKEN_DELIM, f as TOKEN_DIMENSION, g as TOKEN_IDENT, h as TOKEN_HASH, i as TOKEN_BAD_STRING, k as TOKEN_WHITESPACE, l as TOKEN_COMMA, m as TOKEN_FUNCTION, n as tokenize, o as TOKEN_CDC, p as TOKEN_EOF, r as TOKEN_AT_KEYWORD, s as TOKEN_CDO, u as TOKEN_COMMENT, v as TOKEN_LEFT_BRACKET, w as TOKEN_RIGHT_PAREN, x as TOKEN_PERCENTAGE, y as TOKEN_LEFT_PAREN } from "./tokenize-BiRLfVbm.js";
|
|
2
2
|
import { A as PSEUDO_CLASS_SELECTOR, B as TYPE_SELECTOR, C as NESTING_SELECTOR, D as OPERATOR, E as NUMBER, F as STRING, H as UNIVERSAL_SELECTOR, I as STYLESHEET, L as STYLE_RULE, M as RAW, N as SELECTOR, O as PARENTHESIS, P as SELECTOR_LIST, R as SUPPORTS_DECLARATION, 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_ELEMENT_SELECTOR, k as PRELUDE_OPERATOR, m as FUNCTION, n as AT_RULE, o as COMBINATOR, p as FLAG_IMPORTANT, r as AT_RULE_PRELUDE, s as COMMENT, t as ATTRIBUTE_SELECTOR, u as DECLARATION, v as LANG_SELECTOR, w as NTH_OF_SELECTOR, x as MEDIA_QUERY, y as LAYER_NAME, z as SUPPORTS_QUERY } from "./arena-CFwM4uQs.js";
|
|
3
3
|
import { c as str_starts_with, i as is_vendor_prefixed, o as str_equals, r as is_custom, s as str_index_of, t as parse_dimension } from "./parse-dimension-ouWXNHdx.js";
|
|
4
|
-
import { n as TYPE_NAMES } from "./css-node-
|
|
4
|
+
import { n as TYPE_NAMES } from "./css-node-Cf8K9nWd.js";
|
|
5
5
|
import { parse_selector, parse_selector_list } from "./parse-selector.js";
|
|
6
6
|
import { parse_atrule_prelude } from "./parse-atrule-prelude.js";
|
|
7
7
|
import { parse_value } from "./parse-value.js";
|
|
@@ -192,7 +192,7 @@ type Block = WithClone<CSSNode & WithChildren<Raw | Declaration | Atrule | Rule>
|
|
|
192
192
|
}>;
|
|
193
193
|
type Comment = Leaf<typeof COMMENT, 'Comment'>;
|
|
194
194
|
type Raw = Leaf<typeof RAW, 'Raw'>;
|
|
195
|
-
type ValueLike = Function | Identifier | Operator | Parenthesis | Url | UnicodeRange | String | Hash | Dimension | Number;
|
|
195
|
+
type ValueLike = Function | Identifier | Operator | Parenthesis | Url | UnicodeRange | String | Hash | Dimension | Number | SelectorList | SupportsDeclaration;
|
|
196
196
|
type Identifier = Leaf<typeof IDENTIFIER, 'Identifier', {
|
|
197
197
|
readonly name: string;
|
|
198
198
|
}>;
|
|
@@ -294,7 +294,7 @@ type LangSelector = Leaf<typeof LANG_SELECTOR, 'Lang', {
|
|
|
294
294
|
/** `"nl"`, `en-US` */
|
|
295
295
|
readonly name: string | null;
|
|
296
296
|
}>;
|
|
297
|
-
type AtrulePrelude = WithClone<CSSNode & WithChildren<Raw | MediaQuery | MediaType | ContainerQuery | SupportsQuery | LayerName | PreludeOperator | PreludeSelectorList | Parenthesis | Url> & {
|
|
297
|
+
type AtrulePrelude = WithClone<CSSNode & WithChildren<Raw | MediaQuery | MediaType | ContainerQuery | SupportsQuery | LayerName | PreludeOperator | PreludeSelectorList | Parenthesis | Url | Function | Identifier | String> & {
|
|
298
298
|
readonly type: typeof AT_RULE_PRELUDE;
|
|
299
299
|
readonly type_name: 'AtrulePrelude';
|
|
300
300
|
}>;
|
|
@@ -312,7 +312,7 @@ type MediaType = Leaf<typeof MEDIA_TYPE, 'MediaType', {
|
|
|
312
312
|
/** Media type text, e.g. "screen", "print" */
|
|
313
313
|
readonly value: string;
|
|
314
314
|
}>;
|
|
315
|
-
type ContainerQuery = WithClone<CSSNode & WithChildren<Identifier | MediaFeature | Function> & {
|
|
315
|
+
type ContainerQuery = WithClone<CSSNode & WithChildren<Identifier | MediaFeature | Function | PreludeOperator> & {
|
|
316
316
|
readonly type: typeof CONTAINER_QUERY;
|
|
317
317
|
readonly type_name: 'ContainerQuery';
|
|
318
318
|
}>;
|
|
@@ -325,6 +325,10 @@ type SupportsQuery = WithClone<CSSNode & WithChildren<SupportsDeclaration> & {
|
|
|
325
325
|
type SupportsDeclaration = WithClone<CSSNode & WithChildren<Declaration> & {
|
|
326
326
|
readonly type: typeof SUPPORTS_DECLARATION;
|
|
327
327
|
readonly type_name: 'SupportsDeclaration';
|
|
328
|
+
/** Property name, e.g. "display" from "(display: flex)" */
|
|
329
|
+
readonly property: string;
|
|
330
|
+
/** VALUE node for the declaration's value, e.g. "flex" from "(display: flex)" */
|
|
331
|
+
readonly value: Value | null;
|
|
328
332
|
}>;
|
|
329
333
|
type LayerName = Leaf<typeof LAYER_NAME, 'Layer', {
|
|
330
334
|
readonly name: string;
|
|
@@ -341,7 +345,7 @@ type PreludeSelectorList = Leaf<typeof PRELUDE_SELECTORLIST, 'PreludeSelectorLis
|
|
|
341
345
|
readonly value: string;
|
|
342
346
|
}>;
|
|
343
347
|
type PreludeOperator = Leaf<typeof PRELUDE_OPERATOR, 'Operator'>;
|
|
344
|
-
type FeatureRange = WithClone<CSSNode & WithChildren<Dimension |
|
|
348
|
+
type FeatureRange = WithClone<CSSNode & WithChildren<Dimension | PreludeOperator> & {
|
|
345
349
|
readonly type: typeof FEATURE_RANGE;
|
|
346
350
|
readonly type_name: 'MediaFeatureRange';
|
|
347
351
|
/** The feature name in a range comparison, e.g. "width" from "(width >= 400px)" */
|
package/dist/parse-anplusb.d.ts
CHANGED
package/dist/parse-anplusb.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Lexer } from "./tokenize-BiRLfVbm.js";
|
|
2
2
|
import { l as CSSDataArena } from "./arena-CFwM4uQs.js";
|
|
3
3
|
import { o as str_equals, s as str_index_of } from "./parse-dimension-ouWXNHdx.js";
|
|
4
|
-
import { t as CSSNode } from "./css-node-
|
|
4
|
+
import { t as CSSNode } from "./css-node-Cf8K9nWd.js";
|
|
5
5
|
//#region src/parse-anplusb.ts
|
|
6
6
|
/** @internal */
|
|
7
7
|
var ANplusBParser = class {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as CSSDataArena } from "./arena-Bx5vp6Sl.js";
|
|
2
|
-
import { t as AnyNode } from "./node-types-
|
|
2
|
+
import { t as AnyNode } from "./node-types-D41wr72y.js";
|
|
3
3
|
//#region src/parse-atrule-prelude.d.ts
|
|
4
4
|
/** @internal */
|
|
5
5
|
declare class AtRulePreludeParser {
|
|
@@ -8,12 +8,14 @@ declare class AtRulePreludeParser {
|
|
|
8
8
|
private source;
|
|
9
9
|
private prelude_end;
|
|
10
10
|
private value_node_parser;
|
|
11
|
+
private selector_parser;
|
|
11
12
|
constructor(arena: CSSDataArena, source: string);
|
|
12
13
|
parse_prelude(at_rule_name: string, start: number, end: number, line?: number, column?: number): number[];
|
|
13
14
|
private parse_prelude_dispatch;
|
|
14
15
|
private parse_media_query_list;
|
|
15
16
|
private create_node;
|
|
16
17
|
private is_and_or_not;
|
|
18
|
+
private parse_function_condition;
|
|
17
19
|
private parse_single_media_query;
|
|
18
20
|
private parse_media_feature;
|
|
19
21
|
private parse_container_query;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as Lexer } from "./tokenize-BiRLfVbm.js";
|
|
2
2
|
import { l as CSSDataArena } from "./arena-CFwM4uQs.js";
|
|
3
3
|
import { l as strip_vendor_prefix, o as str_equals } from "./parse-dimension-ouWXNHdx.js";
|
|
4
|
-
import { t as CSSNode } from "./css-node-
|
|
4
|
+
import { t as CSSNode } from "./css-node-Cf8K9nWd.js";
|
|
5
5
|
import { i as trim_boundaries, n as skip_whitespace_and_comments_forward } from "./parse-utils-D7srNG13.js";
|
|
6
|
+
import { SelectorParser } from "./parse-selector.js";
|
|
6
7
|
import { t as ValueNodeParser } from "./value-node-parser-CZ47v3hp.js";
|
|
7
8
|
//#region src/parse-atrule-prelude.ts
|
|
8
9
|
/** @internal */
|
|
@@ -12,12 +13,14 @@ var AtRulePreludeParser = class {
|
|
|
12
13
|
source;
|
|
13
14
|
prelude_end;
|
|
14
15
|
value_node_parser;
|
|
16
|
+
selector_parser;
|
|
15
17
|
constructor(arena, source) {
|
|
16
18
|
this.arena = arena;
|
|
17
19
|
this.source = source;
|
|
18
20
|
this.lexer = new Lexer(source);
|
|
19
21
|
this.prelude_end = 0;
|
|
20
22
|
this.value_node_parser = new ValueNodeParser(arena, source);
|
|
23
|
+
this.selector_parser = new SelectorParser(arena, source);
|
|
21
24
|
}
|
|
22
25
|
parse_prelude(at_rule_name, start, end, line = 1, column = 1) {
|
|
23
26
|
this.prelude_end = end;
|
|
@@ -67,18 +70,58 @@ var AtRulePreludeParser = class {
|
|
|
67
70
|
is_and_or_not(str) {
|
|
68
71
|
return str_equals("and", str) || str_equals("or", str) || str_equals("not", str);
|
|
69
72
|
}
|
|
73
|
+
parse_function_condition() {
|
|
74
|
+
let func_name = this.source.substring(this.lexer.token_start, this.lexer.token_end - 1);
|
|
75
|
+
let func_start = this.lexer.token_start;
|
|
76
|
+
let content_start = this.lexer.token_end;
|
|
77
|
+
let paren_depth = 1;
|
|
78
|
+
let func_end = this.lexer.token_end;
|
|
79
|
+
let content_end = content_start;
|
|
80
|
+
while (this.lexer.pos < this.prelude_end && paren_depth > 0) {
|
|
81
|
+
this.next_token();
|
|
82
|
+
let inner_token = this.lexer.token_type;
|
|
83
|
+
if (inner_token === 21 || inner_token === 2) paren_depth++;
|
|
84
|
+
else if (inner_token === 22) {
|
|
85
|
+
paren_depth--;
|
|
86
|
+
if (paren_depth === 0) {
|
|
87
|
+
content_end = this.lexer.token_start;
|
|
88
|
+
func_end = this.lexer.token_end;
|
|
89
|
+
}
|
|
90
|
+
} else if (inner_token === 26) break;
|
|
91
|
+
}
|
|
92
|
+
let func_node = this.create_node(15, func_start, func_end);
|
|
93
|
+
this.arena.set_content_start_delta(func_node, 0);
|
|
94
|
+
this.arena.set_content_length(func_node, func_name.length);
|
|
95
|
+
this.arena.set_value_start_delta(func_node, content_start - func_start);
|
|
96
|
+
this.arena.set_value_length(func_node, content_end - content_start);
|
|
97
|
+
if (str_equals("selector", func_name)) {
|
|
98
|
+
let selector_list = this.selector_parser.parse_selector(content_start, content_end, this.lexer.line, this.lexer.column);
|
|
99
|
+
if (selector_list !== null) this.arena.set_first_child(func_node, selector_list);
|
|
100
|
+
} else if (str_equals("style", func_name)) {
|
|
101
|
+
let colon_pos = this.find_colon_at_depth_zero(content_start, content_end);
|
|
102
|
+
if (colon_pos !== -1) {
|
|
103
|
+
let decl_child = this.create_supports_declaration(content_start, content_end, colon_pos);
|
|
104
|
+
this.arena.set_first_child(func_node, decl_child);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return func_node;
|
|
108
|
+
}
|
|
70
109
|
parse_single_media_query() {
|
|
71
110
|
let query_start = this.lexer.pos;
|
|
72
111
|
this.skip_whitespace();
|
|
73
112
|
if (this.lexer.pos >= this.prelude_end) return null;
|
|
113
|
+
let first_component = 0;
|
|
114
|
+
let last_component = 0;
|
|
74
115
|
const saved_token_start = this.lexer.save_position();
|
|
75
116
|
this.next_token();
|
|
76
117
|
if (this.lexer.token_type === 1) {
|
|
77
118
|
let text = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
78
|
-
if (
|
|
119
|
+
if (str_equals("only", text) || str_equals("not", text)) {
|
|
120
|
+
let modifier = this.create_node(38, this.lexer.token_start, this.lexer.token_end);
|
|
121
|
+
first_component = modifier;
|
|
122
|
+
last_component = modifier;
|
|
123
|
+
} else this.lexer.restore_position(saved_token_start);
|
|
79
124
|
} else this.lexer.restore_position(saved_token_start);
|
|
80
|
-
let first_component = 0;
|
|
81
|
-
let last_component = 0;
|
|
82
125
|
while (this.lexer.pos < this.prelude_end) {
|
|
83
126
|
this.skip_whitespace();
|
|
84
127
|
if (this.lexer.pos >= this.prelude_end) break;
|
|
@@ -172,32 +215,8 @@ var AtRulePreludeParser = class {
|
|
|
172
215
|
let token_type = this.lexer.token_type;
|
|
173
216
|
let component = null;
|
|
174
217
|
if (token_type === 21) component = this.parse_media_feature();
|
|
175
|
-
else if (token_type === 2)
|
|
176
|
-
|
|
177
|
-
let func_start = this.lexer.token_start;
|
|
178
|
-
let content_start = this.lexer.token_end;
|
|
179
|
-
let paren_depth = 1;
|
|
180
|
-
let func_end = this.lexer.token_end;
|
|
181
|
-
let content_end = content_start;
|
|
182
|
-
while (this.lexer.pos < this.prelude_end && paren_depth > 0) {
|
|
183
|
-
this.next_token();
|
|
184
|
-
let inner_token = this.lexer.token_type;
|
|
185
|
-
if (inner_token === 21 || inner_token === 2) paren_depth++;
|
|
186
|
-
else if (inner_token === 22) {
|
|
187
|
-
paren_depth--;
|
|
188
|
-
if (paren_depth === 0) {
|
|
189
|
-
content_end = this.lexer.token_start;
|
|
190
|
-
func_end = this.lexer.token_end;
|
|
191
|
-
}
|
|
192
|
-
} else if (inner_token === 26) break;
|
|
193
|
-
}
|
|
194
|
-
let func_node = this.create_node(15, func_start, func_end);
|
|
195
|
-
this.arena.set_content_start_delta(func_node, 0);
|
|
196
|
-
this.arena.set_content_length(func_node, func_name.length);
|
|
197
|
-
this.arena.set_value_start_delta(func_node, content_start - func_start);
|
|
198
|
-
this.arena.set_value_length(func_node, content_end - content_start);
|
|
199
|
-
component = func_node;
|
|
200
|
-
} else if (token_type === 1) {
|
|
218
|
+
else if (token_type === 2) component = this.parse_function_condition();
|
|
219
|
+
else if (token_type === 1) {
|
|
201
220
|
let text = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
202
221
|
if (this.is_and_or_not(text)) component = this.create_node(38, this.lexer.token_start, this.lexer.token_end);
|
|
203
222
|
else component = this.create_node(10, this.lexer.token_start, this.lexer.token_end);
|
|
@@ -252,7 +271,7 @@ var AtRulePreludeParser = class {
|
|
|
252
271
|
let op = this.create_node(38, this.lexer.token_start, this.lexer.token_end);
|
|
253
272
|
nodes.push(op);
|
|
254
273
|
}
|
|
255
|
-
}
|
|
274
|
+
} else if (token_type === 2) nodes.push(this.parse_function_condition());
|
|
256
275
|
}
|
|
257
276
|
return nodes;
|
|
258
277
|
}
|
|
@@ -286,6 +305,8 @@ var AtRulePreludeParser = class {
|
|
|
286
305
|
this.arena.set_first_child(decl, value_node);
|
|
287
306
|
}
|
|
288
307
|
let supports_decl = this.create_node(57, content_start, content_end);
|
|
308
|
+
this.arena.set_content_start_delta(supports_decl, prop_trimmed[0] - content_start);
|
|
309
|
+
this.arena.set_content_length(supports_decl, prop_trimmed[1] - prop_trimmed[0]);
|
|
289
310
|
this.arena.set_first_child(supports_decl, decl);
|
|
290
311
|
return supports_decl;
|
|
291
312
|
}
|
|
@@ -449,6 +470,11 @@ var AtRulePreludeParser = class {
|
|
|
449
470
|
if (trimmed) {
|
|
450
471
|
this.arena.set_value_start_delta(supports_node, trimmed[0] - supports_start);
|
|
451
472
|
this.arena.set_value_length(supports_node, trimmed[1] - trimmed[0]);
|
|
473
|
+
let colon_pos = this.find_colon_at_depth_zero(trimmed[0], trimmed[1]);
|
|
474
|
+
if (colon_pos !== -1) {
|
|
475
|
+
let decl_child = this.create_supports_declaration(trimmed[0], trimmed[1], colon_pos);
|
|
476
|
+
this.arena.set_first_child(supports_node, decl_child);
|
|
477
|
+
}
|
|
452
478
|
}
|
|
453
479
|
return supports_node;
|
|
454
480
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as CSSDataArena } from "./arena-Bx5vp6Sl.js";
|
|
2
2
|
import { n as Lexer } from "./tokenize-DeZYFa9R.js";
|
|
3
|
-
import { d as Declaration } from "./node-types-
|
|
3
|
+
import { d as Declaration } from "./node-types-D41wr72y.js";
|
|
4
4
|
//#region src/parse-declaration.d.ts
|
|
5
5
|
/** @internal */
|
|
6
6
|
declare class DeclarationParser {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Lexer } from "./tokenize-BiRLfVbm.js";
|
|
2
2
|
import { l as CSSDataArena } from "./arena-CFwM4uQs.js";
|
|
3
3
|
import { i as is_vendor_prefixed } from "./parse-dimension-ouWXNHdx.js";
|
|
4
|
-
import { t as CSSNode } from "./css-node-
|
|
4
|
+
import { t as CSSNode } from "./css-node-Cf8K9nWd.js";
|
|
5
5
|
import { i as trim_boundaries } from "./parse-utils-D7srNG13.js";
|
|
6
6
|
import { ValueParser } from "./parse-value.js";
|
|
7
7
|
//#region src/parse-declaration.ts
|
package/dist/parse-selector.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as CSSDataArena } from "./arena-Bx5vp6Sl.js";
|
|
2
|
-
import { F as Selector, I as SelectorList } from "./node-types-
|
|
2
|
+
import { F as Selector, I as SelectorList } from "./node-types-D41wr72y.js";
|
|
3
3
|
//#region src/parse-selector.d.ts
|
|
4
4
|
/** @internal */
|
|
5
5
|
declare class SelectorParser {
|
package/dist/parse-selector.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Lexer } from "./tokenize-BiRLfVbm.js";
|
|
2
2
|
import { l as CSSDataArena } from "./arena-CFwM4uQs.js";
|
|
3
3
|
import { a as is_whitespace, n as is_combinator, o as str_equals } from "./parse-dimension-ouWXNHdx.js";
|
|
4
|
-
import { t as CSSNode } from "./css-node-
|
|
4
|
+
import { t as CSSNode } from "./css-node-Cf8K9nWd.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-D7srNG13.js";
|
|
6
6
|
import { ANplusBParser } from "./parse-anplusb.js";
|
|
7
7
|
//#region src/parse-selector.ts
|
package/dist/parse-value.d.ts
CHANGED
package/dist/parse-value.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as CSSDataArena } from "./arena-CFwM4uQs.js";
|
|
2
|
-
import { t as CSSNode } from "./css-node-
|
|
2
|
+
import { t as CSSNode } from "./css-node-Cf8K9nWd.js";
|
|
3
3
|
import { t as ValueNodeParser } from "./value-node-parser-CZ47v3hp.js";
|
|
4
4
|
//#region src/parse-value.ts
|
|
5
5
|
/** @internal */
|
package/dist/parse.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as CSSDataArena } from "./arena-Bx5vp6Sl.js";
|
|
2
2
|
import { t as CommentInfo } from "./tokenize-DeZYFa9R.js";
|
|
3
|
-
import { z as StyleSheet } from "./node-types-
|
|
3
|
+
import { z as StyleSheet } from "./node-types-D41wr72y.js";
|
|
4
4
|
//#region src/parse.d.ts
|
|
5
5
|
interface ParserOptions {
|
|
6
6
|
parse_values?: boolean;
|
package/dist/parse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Lexer } from "./tokenize-BiRLfVbm.js";
|
|
2
2
|
import { l as CSSDataArena } from "./arena-CFwM4uQs.js";
|
|
3
|
-
import { t as CSSNode } from "./css-node-
|
|
3
|
+
import { t as CSSNode } from "./css-node-Cf8K9nWd.js";
|
|
4
4
|
import { i as trim_boundaries } from "./parse-utils-D7srNG13.js";
|
|
5
5
|
import { SelectorParser } from "./parse-selector.js";
|
|
6
6
|
import { AtRulePreludeParser } from "./parse-atrule-prelude.js";
|
package/dist/walk.d.ts
CHANGED
package/dist/walk.js
CHANGED