@projectwallace/css-parser 0.6.0 → 0.6.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/arena.d.ts +6 -0
- package/dist/{css-node-BzCSxoLM.js → css-node-CIM4dthB.js} +25 -1
- package/dist/css-node.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/parse-anplusb.js +1 -1
- package/dist/parse-atrule-prelude.js +1 -1
- package/dist/parse-selector.js +18 -1
- package/dist/parse-value.js +1 -1
- package/dist/parse.js +2 -2
- package/package.json +1 -1
package/dist/arena.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const FLAG_LENGTH_OVERFLOW: number;
|
|
|
42
42
|
export declare const FLAG_HAS_BLOCK: number;
|
|
43
43
|
export declare const FLAG_VENDOR_PREFIXED: number;
|
|
44
44
|
export declare const FLAG_HAS_DECLARATIONS: number;
|
|
45
|
+
export declare const FLAG_HAS_PARENS: number;
|
|
45
46
|
export declare const ATTR_OPERATOR_NONE = 0;
|
|
46
47
|
export declare const ATTR_OPERATOR_EQUAL = 1;
|
|
47
48
|
export declare const ATTR_OPERATOR_TILDE_EQUAL = 2;
|
|
@@ -49,6 +50,9 @@ export declare const ATTR_OPERATOR_PIPE_EQUAL = 3;
|
|
|
49
50
|
export declare const ATTR_OPERATOR_CARET_EQUAL = 4;
|
|
50
51
|
export declare const ATTR_OPERATOR_DOLLAR_EQUAL = 5;
|
|
51
52
|
export declare const ATTR_OPERATOR_STAR_EQUAL = 6;
|
|
53
|
+
export declare const ATTR_FLAG_NONE = 0;
|
|
54
|
+
export declare const ATTR_FLAG_CASE_INSENSITIVE = 1;
|
|
55
|
+
export declare const ATTR_FLAG_CASE_SENSITIVE = 2;
|
|
52
56
|
export declare class CSSDataArena {
|
|
53
57
|
private buffer;
|
|
54
58
|
private view;
|
|
@@ -69,6 +73,7 @@ export declare class CSSDataArena {
|
|
|
69
73
|
get_content_start(node_index: number): number;
|
|
70
74
|
get_content_length(node_index: number): number;
|
|
71
75
|
get_attr_operator(node_index: number): number;
|
|
76
|
+
get_attr_flags(node_index: number): number;
|
|
72
77
|
get_first_child(node_index: number): number;
|
|
73
78
|
get_last_child(node_index: number): number;
|
|
74
79
|
get_next_sibling(node_index: number): number;
|
|
@@ -83,6 +88,7 @@ export declare class CSSDataArena {
|
|
|
83
88
|
set_content_start(node_index: number, offset: number): void;
|
|
84
89
|
set_content_length(node_index: number, length: number): void;
|
|
85
90
|
set_attr_operator(node_index: number, operator: number): void;
|
|
91
|
+
set_attr_flags(node_index: number, flags: number): void;
|
|
86
92
|
set_first_child(node_index: number, childIndex: number): void;
|
|
87
93
|
set_last_child(node_index: number, childIndex: number): void;
|
|
88
94
|
set_next_sibling(node_index: number, siblingIndex: number): void;
|
|
@@ -42,6 +42,7 @@ const FLAG_HAS_ERROR = 1 << 1;
|
|
|
42
42
|
const FLAG_HAS_BLOCK = 1 << 3;
|
|
43
43
|
const FLAG_VENDOR_PREFIXED = 1 << 4;
|
|
44
44
|
const FLAG_HAS_DECLARATIONS = 1 << 5;
|
|
45
|
+
const FLAG_HAS_PARENS = 1 << 6;
|
|
45
46
|
const ATTR_OPERATOR_NONE = 0;
|
|
46
47
|
const ATTR_OPERATOR_EQUAL = 1;
|
|
47
48
|
const ATTR_OPERATOR_TILDE_EQUAL = 2;
|
|
@@ -49,6 +50,9 @@ const ATTR_OPERATOR_PIPE_EQUAL = 3;
|
|
|
49
50
|
const ATTR_OPERATOR_CARET_EQUAL = 4;
|
|
50
51
|
const ATTR_OPERATOR_DOLLAR_EQUAL = 5;
|
|
51
52
|
const ATTR_OPERATOR_STAR_EQUAL = 6;
|
|
53
|
+
const ATTR_FLAG_NONE = 0;
|
|
54
|
+
const ATTR_FLAG_CASE_INSENSITIVE = 1;
|
|
55
|
+
const ATTR_FLAG_CASE_SENSITIVE = 2;
|
|
52
56
|
class CSSDataArena {
|
|
53
57
|
buffer;
|
|
54
58
|
view;
|
|
@@ -115,6 +119,10 @@ class CSSDataArena {
|
|
|
115
119
|
get_attr_operator(node_index) {
|
|
116
120
|
return this.view.getUint8(this.node_offset(node_index) + 2);
|
|
117
121
|
}
|
|
122
|
+
// Read attribute flags (for NODE_SELECTOR_ATTRIBUTE)
|
|
123
|
+
get_attr_flags(node_index) {
|
|
124
|
+
return this.view.getUint8(this.node_offset(node_index) + 3);
|
|
125
|
+
}
|
|
118
126
|
// Read first child index (0 = no children)
|
|
119
127
|
get_first_child(node_index) {
|
|
120
128
|
return this.view.getUint32(this.node_offset(node_index) + 20, true);
|
|
@@ -172,6 +180,10 @@ class CSSDataArena {
|
|
|
172
180
|
set_attr_operator(node_index, operator) {
|
|
173
181
|
this.view.setUint8(this.node_offset(node_index) + 2, operator);
|
|
174
182
|
}
|
|
183
|
+
// Write attribute flags (for NODE_SELECTOR_ATTRIBUTE)
|
|
184
|
+
set_attr_flags(node_index, flags) {
|
|
185
|
+
this.view.setUint8(this.node_offset(node_index) + 3, flags);
|
|
186
|
+
}
|
|
175
187
|
// Write first child index
|
|
176
188
|
set_first_child(node_index, childIndex) {
|
|
177
189
|
this.view.setUint32(this.node_offset(node_index) + 20, childIndex, true);
|
|
@@ -465,6 +477,11 @@ class CSSNode {
|
|
|
465
477
|
get attr_operator() {
|
|
466
478
|
return this.arena.get_attr_operator(this.index);
|
|
467
479
|
}
|
|
480
|
+
// Get the attribute flags (for attribute selectors: i, s)
|
|
481
|
+
// Returns one of the ATTR_FLAG_* constants
|
|
482
|
+
get attr_flags() {
|
|
483
|
+
return this.arena.get_attr_flags(this.index);
|
|
484
|
+
}
|
|
468
485
|
// Get the unit for dimension nodes (e.g., "px" from "100px", "%" from "50%")
|
|
469
486
|
get unit() {
|
|
470
487
|
if (this.type !== NODE_VALUE_DIMENSION) return null;
|
|
@@ -585,7 +602,14 @@ class CSSNode {
|
|
|
585
602
|
return sibling_index !== 0;
|
|
586
603
|
}
|
|
587
604
|
// Check if this node has children
|
|
605
|
+
// For pseudo-class/pseudo-element functions, returns true if FLAG_HAS_PARENS is set
|
|
606
|
+
// This allows formatters to distinguish :lang() from :hover
|
|
588
607
|
get has_children() {
|
|
608
|
+
if (this.type === NODE_SELECTOR_PSEUDO_CLASS || this.type === NODE_SELECTOR_PSEUDO_ELEMENT) {
|
|
609
|
+
if (this.arena.has_flag(this.index, FLAG_HAS_PARENS)) {
|
|
610
|
+
return true;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
589
613
|
return this.arena.has_children(this.index);
|
|
590
614
|
}
|
|
591
615
|
// Get all children as an array
|
|
@@ -641,4 +665,4 @@ class CSSNode {
|
|
|
641
665
|
}
|
|
642
666
|
}
|
|
643
667
|
|
|
644
|
-
export {
|
|
668
|
+
export { FLAG_VENDOR_PREFIXED as $, ATTR_OPERATOR_NONE as A, NODE_SELECTOR_PSEUDO_CLASS as B, CSSNode as C, NODE_SELECTOR_PSEUDO_ELEMENT as D, NODE_SELECTOR_COMBINATOR as E, NODE_SELECTOR_UNIVERSAL as F, NODE_SELECTOR_NESTING as G, NODE_SELECTOR_NTH as H, NODE_SELECTOR_NTH_OF as I, NODE_PRELUDE_MEDIA_QUERY as J, NODE_PRELUDE_MEDIA_FEATURE as K, NODE_PRELUDE_MEDIA_TYPE as L, NODE_PRELUDE_CONTAINER_QUERY as M, NODE_STYLE_RULE as N, NODE_PRELUDE_SUPPORTS_QUERY as O, NODE_PRELUDE_LAYER_NAME as P, NODE_PRELUDE_IDENTIFIER as Q, NODE_PRELUDE_OPERATOR as R, NODE_PRELUDE_IMPORT_URL as S, NODE_PRELUDE_IMPORT_LAYER as T, NODE_PRELUDE_IMPORT_SUPPORTS as U, FLAG_IMPORTANT as V, CSSDataArena as W, FLAG_HAS_BLOCK as X, NODE_BLOCK as Y, FLAG_HAS_DECLARATIONS as Z, is_vendor_prefixed as _, ATTR_OPERATOR_EQUAL as a, trim_boundaries as a0, NODE_SELECTOR_LANG as a1, CHAR_GREATER_THAN as a2, CHAR_PLUS as a3, CHAR_TILDE as a4, CHAR_PERIOD as a5, CHAR_ASTERISK as a6, CHAR_AMPERSAND as a7, is_whitespace as a8, is_combinator as a9, skip_whitespace_and_comments_forward as aa, skip_whitespace_and_comments_backward as ab, CHAR_EQUALS as ac, CHAR_PIPE as ad, CHAR_CARET as ae, CHAR_DOLLAR as af, CHAR_SINGLE_QUOTE as ag, CHAR_DOUBLE_QUOTE as ah, CHAR_COLON as ai, FLAG_HAS_PARENS as aj, skip_whitespace_forward as ak, str_equals as al, CHAR_MINUS_HYPHEN as am, CHAR_FORWARD_SLASH as an, ATTR_OPERATOR_TILDE_EQUAL as b, ATTR_OPERATOR_PIPE_EQUAL as c, ATTR_OPERATOR_CARET_EQUAL as d, ATTR_OPERATOR_DOLLAR_EQUAL as e, ATTR_OPERATOR_STAR_EQUAL as f, ATTR_FLAG_NONE as g, ATTR_FLAG_CASE_INSENSITIVE as h, ATTR_FLAG_CASE_SENSITIVE as i, NODE_AT_RULE as j, NODE_COMMENT as k, NODE_DECLARATION as l, NODE_SELECTOR as m, NODE_STYLESHEET as n, NODE_VALUE_KEYWORD as o, NODE_VALUE_NUMBER as p, NODE_VALUE_DIMENSION as q, NODE_VALUE_STRING as r, NODE_VALUE_COLOR as s, NODE_VALUE_FUNCTION as t, NODE_VALUE_OPERATOR as u, NODE_SELECTOR_LIST as v, NODE_SELECTOR_TYPE as w, NODE_SELECTOR_CLASS as x, NODE_SELECTOR_ID as y, NODE_SELECTOR_ATTRIBUTE as z };
|
package/dist/css-node.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class CSSNode {
|
|
|
14
14
|
get value(): string | number | null;
|
|
15
15
|
get prelude(): string | null;
|
|
16
16
|
get attr_operator(): number;
|
|
17
|
+
get attr_flags(): number;
|
|
17
18
|
get unit(): string | null;
|
|
18
19
|
get is_important(): boolean | null;
|
|
19
20
|
get is_vendor_prefixed(): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export { walk, traverse } from './walk';
|
|
|
7
7
|
export { type ParserOptions } from './parse';
|
|
8
8
|
export { CSSNode, type CSSNodeType } from './css-node';
|
|
9
9
|
export type { LexerPosition } from './lexer';
|
|
10
|
-
export { ATTR_OPERATOR_NONE, ATTR_OPERATOR_EQUAL, ATTR_OPERATOR_TILDE_EQUAL, ATTR_OPERATOR_PIPE_EQUAL, ATTR_OPERATOR_CARET_EQUAL, ATTR_OPERATOR_DOLLAR_EQUAL, ATTR_OPERATOR_STAR_EQUAL, } from './arena';
|
|
10
|
+
export { ATTR_OPERATOR_NONE, ATTR_OPERATOR_EQUAL, ATTR_OPERATOR_TILDE_EQUAL, ATTR_OPERATOR_PIPE_EQUAL, ATTR_OPERATOR_CARET_EQUAL, ATTR_OPERATOR_DOLLAR_EQUAL, ATTR_OPERATOR_STAR_EQUAL, ATTR_FLAG_NONE, ATTR_FLAG_CASE_INSENSITIVE, ATTR_FLAG_CASE_SENSITIVE, } from './arena';
|
|
11
11
|
export { NODE_STYLE_RULE, NODE_AT_RULE, NODE_COMMENT, NODE_DECLARATION, NODE_SELECTOR, NODE_STYLESHEET, NODE_VALUE_KEYWORD, NODE_VALUE_NUMBER, NODE_VALUE_DIMENSION, NODE_VALUE_STRING, NODE_VALUE_COLOR, NODE_VALUE_FUNCTION, NODE_VALUE_OPERATOR, NODE_SELECTOR_LIST, NODE_SELECTOR_TYPE, NODE_SELECTOR_CLASS, NODE_SELECTOR_ID, NODE_SELECTOR_ATTRIBUTE, NODE_SELECTOR_PSEUDO_CLASS, NODE_SELECTOR_PSEUDO_ELEMENT, NODE_SELECTOR_COMBINATOR, NODE_SELECTOR_UNIVERSAL, NODE_SELECTOR_NESTING, NODE_SELECTOR_NTH, NODE_SELECTOR_NTH_OF, NODE_PRELUDE_MEDIA_QUERY, NODE_PRELUDE_MEDIA_FEATURE, NODE_PRELUDE_MEDIA_TYPE, NODE_PRELUDE_CONTAINER_QUERY, NODE_PRELUDE_SUPPORTS_QUERY, NODE_PRELUDE_LAYER_NAME, NODE_PRELUDE_IDENTIFIER, NODE_PRELUDE_OPERATOR, NODE_PRELUDE_IMPORT_URL, NODE_PRELUDE_IMPORT_LAYER, NODE_PRELUDE_IMPORT_SUPPORTS, FLAG_IMPORTANT, } from './parse';
|
|
12
12
|
export { TOKEN_IDENT, TOKEN_FUNCTION, TOKEN_AT_KEYWORD, TOKEN_HASH, TOKEN_STRING, TOKEN_BAD_STRING, TOKEN_URL, TOKEN_BAD_URL, TOKEN_DELIM, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_DIMENSION, TOKEN_WHITESPACE, TOKEN_CDO, TOKEN_CDC, TOKEN_COLON, TOKEN_SEMICOLON, TOKEN_COMMA, TOKEN_LEFT_BRACKET, TOKEN_RIGHT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKEN_LEFT_BRACE, TOKEN_RIGHT_BRACE, TOKEN_COMMENT, TOKEN_EOF, type Token, type TokenType, } from './token-types';
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { parse_selector } from './parse-selector.js';
|
|
|
3
3
|
export { parse_atrule_prelude } from './parse-atrule-prelude.js';
|
|
4
4
|
export { parse_value } from './parse-value.js';
|
|
5
5
|
export { tokenize } from './tokenize.js';
|
|
6
|
-
export { d as ATTR_OPERATOR_CARET_EQUAL, e as ATTR_OPERATOR_DOLLAR_EQUAL, a as ATTR_OPERATOR_EQUAL, A as ATTR_OPERATOR_NONE, c as ATTR_OPERATOR_PIPE_EQUAL, f as ATTR_OPERATOR_STAR_EQUAL, b as ATTR_OPERATOR_TILDE_EQUAL, C as CSSNode,
|
|
6
|
+
export { h as ATTR_FLAG_CASE_INSENSITIVE, i as ATTR_FLAG_CASE_SENSITIVE, g as ATTR_FLAG_NONE, d as ATTR_OPERATOR_CARET_EQUAL, e as ATTR_OPERATOR_DOLLAR_EQUAL, a as ATTR_OPERATOR_EQUAL, A as ATTR_OPERATOR_NONE, c as ATTR_OPERATOR_PIPE_EQUAL, f as ATTR_OPERATOR_STAR_EQUAL, b as ATTR_OPERATOR_TILDE_EQUAL, C as CSSNode, V as FLAG_IMPORTANT, j as NODE_AT_RULE, k as NODE_COMMENT, l as NODE_DECLARATION, M as NODE_PRELUDE_CONTAINER_QUERY, Q as NODE_PRELUDE_IDENTIFIER, T as NODE_PRELUDE_IMPORT_LAYER, U as NODE_PRELUDE_IMPORT_SUPPORTS, S as NODE_PRELUDE_IMPORT_URL, P as NODE_PRELUDE_LAYER_NAME, K as NODE_PRELUDE_MEDIA_FEATURE, J as NODE_PRELUDE_MEDIA_QUERY, L as NODE_PRELUDE_MEDIA_TYPE, R as NODE_PRELUDE_OPERATOR, O as NODE_PRELUDE_SUPPORTS_QUERY, m as NODE_SELECTOR, z as NODE_SELECTOR_ATTRIBUTE, x as NODE_SELECTOR_CLASS, E as NODE_SELECTOR_COMBINATOR, y as NODE_SELECTOR_ID, v as NODE_SELECTOR_LIST, G as NODE_SELECTOR_NESTING, H as NODE_SELECTOR_NTH, I as NODE_SELECTOR_NTH_OF, B as NODE_SELECTOR_PSEUDO_CLASS, D as NODE_SELECTOR_PSEUDO_ELEMENT, w as NODE_SELECTOR_TYPE, F as NODE_SELECTOR_UNIVERSAL, n as NODE_STYLESHEET, N as NODE_STYLE_RULE, s as NODE_VALUE_COLOR, q as NODE_VALUE_DIMENSION, t as NODE_VALUE_FUNCTION, o as NODE_VALUE_KEYWORD, p as NODE_VALUE_NUMBER, u as NODE_VALUE_OPERATOR, r as NODE_VALUE_STRING } from './css-node-CIM4dthB.js';
|
|
7
7
|
export { b as TOKEN_AT_KEYWORD, e as TOKEN_BAD_STRING, g as TOKEN_BAD_URL, n as TOKEN_CDC, m as TOKEN_CDO, o as TOKEN_COLON, q as TOKEN_COMMA, x as TOKEN_COMMENT, h as TOKEN_DELIM, k as TOKEN_DIMENSION, y as TOKEN_EOF, a as TOKEN_FUNCTION, c as TOKEN_HASH, T as TOKEN_IDENT, v as TOKEN_LEFT_BRACE, r as TOKEN_LEFT_BRACKET, t as TOKEN_LEFT_PAREN, i as TOKEN_NUMBER, j as TOKEN_PERCENTAGE, w as TOKEN_RIGHT_BRACE, s as TOKEN_RIGHT_BRACKET, u as TOKEN_RIGHT_PAREN, p as TOKEN_SEMICOLON, d as TOKEN_STRING, f as TOKEN_URL, l as TOKEN_WHITESPACE } from './lexer-CtBKgfVv.js';
|
|
8
8
|
|
|
9
9
|
function walk(node, callback, depth = 0) {
|
package/dist/parse-anplusb.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as Lexer, T as TOKEN_IDENT, h as TOKEN_DELIM, k as TOKEN_DIMENSION, i as TOKEN_NUMBER } from './lexer-CtBKgfVv.js';
|
|
2
|
-
import {
|
|
2
|
+
import { am as CHAR_MINUS_HYPHEN, a3 as CHAR_PLUS, ak as skip_whitespace_forward, H as NODE_SELECTOR_NTH, C as CSSNode, W as CSSDataArena } from './css-node-CIM4dthB.js';
|
|
3
3
|
|
|
4
4
|
class ANplusBParser {
|
|
5
5
|
lexer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as Lexer, q as TOKEN_COMMA, T as TOKEN_IDENT, t as TOKEN_LEFT_PAREN, u as TOKEN_RIGHT_PAREN, l as TOKEN_WHITESPACE, f as TOKEN_URL, a as TOKEN_FUNCTION, d as TOKEN_STRING, y as TOKEN_EOF } from './lexer-CtBKgfVv.js';
|
|
2
|
-
import {
|
|
2
|
+
import { W as CSSDataArena, C as CSSNode, al as str_equals, R as NODE_PRELUDE_OPERATOR, L as NODE_PRELUDE_MEDIA_TYPE, J as NODE_PRELUDE_MEDIA_QUERY, K as NODE_PRELUDE_MEDIA_FEATURE, a0 as trim_boundaries, Q as NODE_PRELUDE_IDENTIFIER, M as NODE_PRELUDE_CONTAINER_QUERY, O as NODE_PRELUDE_SUPPORTS_QUERY, P as NODE_PRELUDE_LAYER_NAME, S as NODE_PRELUDE_IMPORT_URL, T as NODE_PRELUDE_IMPORT_LAYER, U as NODE_PRELUDE_IMPORT_SUPPORTS, ak as skip_whitespace_forward } from './css-node-CIM4dthB.js';
|
|
3
3
|
|
|
4
4
|
class AtRulePreludeParser {
|
|
5
5
|
lexer;
|
package/dist/parse-selector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as Lexer, q as TOKEN_COMMA, h as TOKEN_DELIM, y as TOKEN_EOF, l as TOKEN_WHITESPACE, a as TOKEN_FUNCTION, o as TOKEN_COLON, r as TOKEN_LEFT_BRACKET, c as TOKEN_HASH, T as TOKEN_IDENT, s as TOKEN_RIGHT_BRACKET, t as TOKEN_LEFT_PAREN, u as TOKEN_RIGHT_PAREN, d as TOKEN_STRING } from './lexer-CtBKgfVv.js';
|
|
2
|
-
import {
|
|
2
|
+
import { W as CSSDataArena, v as NODE_SELECTOR_LIST, C as CSSNode, m as NODE_SELECTOR, a2 as CHAR_GREATER_THAN, a3 as CHAR_PLUS, a4 as CHAR_TILDE, a5 as CHAR_PERIOD, a6 as CHAR_ASTERISK, a7 as CHAR_AMPERSAND, a8 as is_whitespace, a9 as is_combinator, x as NODE_SELECTOR_CLASS, z as NODE_SELECTOR_ATTRIBUTE, aa as skip_whitespace_and_comments_forward, ab as skip_whitespace_and_comments_backward, ac as CHAR_EQUALS, ad as CHAR_PIPE, ae as CHAR_CARET, af as CHAR_DOLLAR, A as ATTR_OPERATOR_NONE, g as ATTR_FLAG_NONE, a as ATTR_OPERATOR_EQUAL, b as ATTR_OPERATOR_TILDE_EQUAL, c as ATTR_OPERATOR_PIPE_EQUAL, d as ATTR_OPERATOR_CARET_EQUAL, e as ATTR_OPERATOR_DOLLAR_EQUAL, f as ATTR_OPERATOR_STAR_EQUAL, ag as CHAR_SINGLE_QUOTE, ah as CHAR_DOUBLE_QUOTE, h as ATTR_FLAG_CASE_INSENSITIVE, i as ATTR_FLAG_CASE_SENSITIVE, ai as CHAR_COLON, D as NODE_SELECTOR_PSEUDO_ELEMENT, B as NODE_SELECTOR_PSEUDO_CLASS, _ as is_vendor_prefixed, $ as FLAG_VENDOR_PREFIXED, aj as FLAG_HAS_PARENS, a1 as NODE_SELECTOR_LANG, ak as skip_whitespace_forward, I as NODE_SELECTOR_NTH_OF, w as NODE_SELECTOR_TYPE, y as NODE_SELECTOR_ID, F as NODE_SELECTOR_UNIVERSAL, G as NODE_SELECTOR_NESTING, E as NODE_SELECTOR_COMBINATOR } from './css-node-CIM4dthB.js';
|
|
3
3
|
import { ANplusBParser } from './parse-anplusb.js';
|
|
4
4
|
|
|
5
5
|
class SelectorParser {
|
|
@@ -297,6 +297,7 @@ class SelectorParser {
|
|
|
297
297
|
let pos = skip_whitespace_and_comments_forward(this.source, name_end, end);
|
|
298
298
|
if (pos >= end) {
|
|
299
299
|
this.arena.set_attr_operator(node, ATTR_OPERATOR_NONE);
|
|
300
|
+
this.arena.set_attr_flags(node, ATTR_FLAG_NONE);
|
|
300
301
|
return;
|
|
301
302
|
}
|
|
302
303
|
let ch1 = this.source.charCodeAt(pos);
|
|
@@ -320,10 +321,12 @@ class SelectorParser {
|
|
|
320
321
|
this.arena.set_attr_operator(node, ATTR_OPERATOR_STAR_EQUAL);
|
|
321
322
|
} else {
|
|
322
323
|
this.arena.set_attr_operator(node, ATTR_OPERATOR_NONE);
|
|
324
|
+
this.arena.set_attr_flags(node, ATTR_FLAG_NONE);
|
|
323
325
|
return;
|
|
324
326
|
}
|
|
325
327
|
pos = skip_whitespace_and_comments_forward(this.source, operator_end, end);
|
|
326
328
|
if (pos >= end) {
|
|
329
|
+
this.arena.set_attr_flags(node, ATTR_FLAG_NONE);
|
|
327
330
|
return;
|
|
328
331
|
}
|
|
329
332
|
value_start = pos;
|
|
@@ -359,6 +362,19 @@ class SelectorParser {
|
|
|
359
362
|
this.arena.set_value_start(node, value_start);
|
|
360
363
|
this.arena.set_value_length(node, value_end - value_start);
|
|
361
364
|
}
|
|
365
|
+
pos = skip_whitespace_and_comments_forward(this.source, value_end, end);
|
|
366
|
+
if (pos < end) {
|
|
367
|
+
let flag_ch = this.source.charCodeAt(pos);
|
|
368
|
+
if (flag_ch === 105 || flag_ch === 73) {
|
|
369
|
+
this.arena.set_attr_flags(node, ATTR_FLAG_CASE_INSENSITIVE);
|
|
370
|
+
} else if (flag_ch === 115 || flag_ch === 83) {
|
|
371
|
+
this.arena.set_attr_flags(node, ATTR_FLAG_CASE_SENSITIVE);
|
|
372
|
+
} else {
|
|
373
|
+
this.arena.set_attr_flags(node, ATTR_FLAG_NONE);
|
|
374
|
+
}
|
|
375
|
+
} else {
|
|
376
|
+
this.arena.set_attr_flags(node, ATTR_FLAG_NONE);
|
|
377
|
+
}
|
|
362
378
|
}
|
|
363
379
|
// Parse pseudo-class or pseudo-element (:hover, ::before)
|
|
364
380
|
parse_pseudo(start) {
|
|
@@ -423,6 +439,7 @@ class SelectorParser {
|
|
|
423
439
|
this.arena.set_start_column(node, this.lexer.column);
|
|
424
440
|
this.arena.set_content_start(node, func_name_start);
|
|
425
441
|
this.arena.set_content_length(node, func_name_end - func_name_start);
|
|
442
|
+
this.arena.set_flag(node, FLAG_HAS_PARENS);
|
|
426
443
|
if (is_vendor_prefixed(this.source, func_name_start, func_name_end)) {
|
|
427
444
|
this.arena.set_flag(node, FLAG_VENDOR_PREFIXED);
|
|
428
445
|
}
|
package/dist/parse-value.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as Lexer, y as TOKEN_EOF, q as TOKEN_COMMA, h as TOKEN_DELIM, a as TOKEN_FUNCTION, c as TOKEN_HASH, d as TOKEN_STRING, k as TOKEN_DIMENSION, j as TOKEN_PERCENTAGE, i as TOKEN_NUMBER, T as TOKEN_IDENT, t as TOKEN_LEFT_PAREN, u as TOKEN_RIGHT_PAREN } from './lexer-CtBKgfVv.js';
|
|
2
|
-
import {
|
|
2
|
+
import { W as CSSDataArena, C as CSSNode, a8 as is_whitespace, u as NODE_VALUE_OPERATOR, s as NODE_VALUE_COLOR, r as NODE_VALUE_STRING, q as NODE_VALUE_DIMENSION, p as NODE_VALUE_NUMBER, o as NODE_VALUE_KEYWORD, a3 as CHAR_PLUS, am as CHAR_MINUS_HYPHEN, a6 as CHAR_ASTERISK, an as CHAR_FORWARD_SLASH, t as NODE_VALUE_FUNCTION } from './css-node-CIM4dthB.js';
|
|
3
3
|
|
|
4
4
|
class ValueParser {
|
|
5
5
|
lexer;
|
package/dist/parse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as Lexer, y as TOKEN_EOF, b as TOKEN_AT_KEYWORD, v as TOKEN_LEFT_BRACE, w as TOKEN_RIGHT_BRACE, T as TOKEN_IDENT, o as TOKEN_COLON, p as TOKEN_SEMICOLON, h as TOKEN_DELIM } from './lexer-CtBKgfVv.js';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { W as CSSDataArena, n as NODE_STYLESHEET, C as CSSNode, N as NODE_STYLE_RULE, X as FLAG_HAS_BLOCK, Y as NODE_BLOCK, Z as FLAG_HAS_DECLARATIONS, v as NODE_SELECTOR_LIST, l as NODE_DECLARATION, _ as is_vendor_prefixed, $ as FLAG_VENDOR_PREFIXED, a0 as trim_boundaries, V as FLAG_IMPORTANT, j as NODE_AT_RULE } from './css-node-CIM4dthB.js';
|
|
3
|
+
export { k as NODE_COMMENT, M as NODE_PRELUDE_CONTAINER_QUERY, Q as NODE_PRELUDE_IDENTIFIER, T as NODE_PRELUDE_IMPORT_LAYER, U as NODE_PRELUDE_IMPORT_SUPPORTS, S as NODE_PRELUDE_IMPORT_URL, P as NODE_PRELUDE_LAYER_NAME, K as NODE_PRELUDE_MEDIA_FEATURE, J as NODE_PRELUDE_MEDIA_QUERY, L as NODE_PRELUDE_MEDIA_TYPE, R as NODE_PRELUDE_OPERATOR, O as NODE_PRELUDE_SUPPORTS_QUERY, m as NODE_SELECTOR, z as NODE_SELECTOR_ATTRIBUTE, x as NODE_SELECTOR_CLASS, E as NODE_SELECTOR_COMBINATOR, y as NODE_SELECTOR_ID, a1 as NODE_SELECTOR_LANG, G as NODE_SELECTOR_NESTING, H as NODE_SELECTOR_NTH, I as NODE_SELECTOR_NTH_OF, B as NODE_SELECTOR_PSEUDO_CLASS, D as NODE_SELECTOR_PSEUDO_ELEMENT, w as NODE_SELECTOR_TYPE, F as NODE_SELECTOR_UNIVERSAL, s as NODE_VALUE_COLOR, q as NODE_VALUE_DIMENSION, t as NODE_VALUE_FUNCTION, o as NODE_VALUE_KEYWORD, p as NODE_VALUE_NUMBER, u as NODE_VALUE_OPERATOR, r as NODE_VALUE_STRING } from './css-node-CIM4dthB.js';
|
|
4
4
|
import { ValueParser } from './parse-value.js';
|
|
5
5
|
import { SelectorParser } from './parse-selector.js';
|
|
6
6
|
import { AtRulePreludeParser } from './parse-atrule-prelude.js';
|
package/package.json
CHANGED