@projectwallace/css-parser 0.6.5 → 0.6.7
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-BpZTUiy6.js → css-node-GOEvp2OO.js} +136 -0
- package/dist/css-node.d.ts +61 -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 +1 -1
- package/dist/parse-value.js +1 -1
- package/dist/parse.js +2 -2
- package/package.json +1 -1
|
@@ -735,6 +735,142 @@ class CSSNode {
|
|
|
735
735
|
}
|
|
736
736
|
return null;
|
|
737
737
|
}
|
|
738
|
+
// --- Compound Selector Helpers (for NODE_SELECTOR) ---
|
|
739
|
+
// Iterator over first compound selector parts (zero allocation)
|
|
740
|
+
// Yields parts before the first combinator
|
|
741
|
+
*compound_parts() {
|
|
742
|
+
if (this.type !== NODE_SELECTOR) return;
|
|
743
|
+
let child = this.first_child;
|
|
744
|
+
while (child) {
|
|
745
|
+
if (child.type === NODE_SELECTOR_COMBINATOR) break;
|
|
746
|
+
yield child;
|
|
747
|
+
child = child.next_sibling;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
// Get first compound selector as array
|
|
751
|
+
// Returns array of parts before first combinator
|
|
752
|
+
get first_compound() {
|
|
753
|
+
if (this.type !== NODE_SELECTOR) return [];
|
|
754
|
+
let result = [];
|
|
755
|
+
let child = this.first_child;
|
|
756
|
+
while (child) {
|
|
757
|
+
if (child.type === NODE_SELECTOR_COMBINATOR) break;
|
|
758
|
+
result.push(child);
|
|
759
|
+
child = child.next_sibling;
|
|
760
|
+
}
|
|
761
|
+
return result;
|
|
762
|
+
}
|
|
763
|
+
// Split selector into compound selectors
|
|
764
|
+
// Returns array of compound arrays split by combinators
|
|
765
|
+
get all_compounds() {
|
|
766
|
+
if (this.type !== NODE_SELECTOR) return [];
|
|
767
|
+
let compounds = [];
|
|
768
|
+
let current_compound = [];
|
|
769
|
+
let child = this.first_child;
|
|
770
|
+
while (child) {
|
|
771
|
+
if (child.type === NODE_SELECTOR_COMBINATOR) {
|
|
772
|
+
if (current_compound.length > 0) {
|
|
773
|
+
compounds.push(current_compound);
|
|
774
|
+
current_compound = [];
|
|
775
|
+
}
|
|
776
|
+
} else {
|
|
777
|
+
current_compound.push(child);
|
|
778
|
+
}
|
|
779
|
+
child = child.next_sibling;
|
|
780
|
+
}
|
|
781
|
+
if (current_compound.length > 0) {
|
|
782
|
+
compounds.push(current_compound);
|
|
783
|
+
}
|
|
784
|
+
return compounds;
|
|
785
|
+
}
|
|
786
|
+
// Check if selector is compound (no combinators)
|
|
787
|
+
get is_compound() {
|
|
788
|
+
if (this.type !== NODE_SELECTOR) return false;
|
|
789
|
+
let child = this.first_child;
|
|
790
|
+
while (child) {
|
|
791
|
+
if (child.type === NODE_SELECTOR_COMBINATOR) return false;
|
|
792
|
+
child = child.next_sibling;
|
|
793
|
+
}
|
|
794
|
+
return true;
|
|
795
|
+
}
|
|
796
|
+
// Get text of first compound selector (no node allocation)
|
|
797
|
+
get first_compound_text() {
|
|
798
|
+
if (this.type !== NODE_SELECTOR) return "";
|
|
799
|
+
let start = -1;
|
|
800
|
+
let end = -1;
|
|
801
|
+
let child = this.first_child;
|
|
802
|
+
while (child) {
|
|
803
|
+
if (child.type === NODE_SELECTOR_COMBINATOR) break;
|
|
804
|
+
if (start === -1) start = child.offset;
|
|
805
|
+
end = child.offset + child.length;
|
|
806
|
+
child = child.next_sibling;
|
|
807
|
+
}
|
|
808
|
+
if (start === -1) return "";
|
|
809
|
+
return this.source.substring(start, end);
|
|
810
|
+
}
|
|
811
|
+
// --- Node Cloning ---
|
|
812
|
+
/**
|
|
813
|
+
* Clone this node as a mutable plain JavaScript object
|
|
814
|
+
*
|
|
815
|
+
* Extracts all properties from the arena into a plain object with children as an array.
|
|
816
|
+
* The resulting object can be freely modified.
|
|
817
|
+
*
|
|
818
|
+
* @param options - Cloning configuration
|
|
819
|
+
* @param options.deep - Recursively clone children (default: true)
|
|
820
|
+
* @param options.locations - Include line/column/offset/length (default: false)
|
|
821
|
+
* @returns Plain object with children as array
|
|
822
|
+
*
|
|
823
|
+
* @example
|
|
824
|
+
* const ast = parse('div { color: red; }')
|
|
825
|
+
* const decl = ast.first_child.block.first_child
|
|
826
|
+
* const plain = decl.clone()
|
|
827
|
+
*
|
|
828
|
+
* // Access children as array
|
|
829
|
+
* plain.children.length
|
|
830
|
+
* plain.children[0]
|
|
831
|
+
* plain.children.push(newChild)
|
|
832
|
+
*/
|
|
833
|
+
clone(options = {}) {
|
|
834
|
+
const { deep = true, locations = false } = options;
|
|
835
|
+
let plain = {
|
|
836
|
+
type: this.type,
|
|
837
|
+
type_name: this.type_name,
|
|
838
|
+
text: this.text,
|
|
839
|
+
children: []
|
|
840
|
+
};
|
|
841
|
+
if (this.name) plain.name = this.name;
|
|
842
|
+
if (this.type === NODE_DECLARATION) plain.property = this.name;
|
|
843
|
+
if (this.value !== void 0 && this.value !== null) {
|
|
844
|
+
plain.value = this.value;
|
|
845
|
+
if (this.unit) plain.unit = this.unit;
|
|
846
|
+
}
|
|
847
|
+
if (this.type === NODE_AT_RULE && this.prelude) {
|
|
848
|
+
plain.prelude = this.prelude;
|
|
849
|
+
}
|
|
850
|
+
if (this.type === NODE_DECLARATION) plain.is_important = this.is_important;
|
|
851
|
+
plain.is_vendor_prefixed = this.is_vendor_prefixed;
|
|
852
|
+
plain.has_error = this.has_error;
|
|
853
|
+
if (this.type === NODE_SELECTOR_ATTRIBUTE) {
|
|
854
|
+
plain.attr_operator = this.attr_operator;
|
|
855
|
+
plain.attr_flags = this.attr_flags;
|
|
856
|
+
}
|
|
857
|
+
if (this.type === NODE_SELECTOR_NTH || this.type === NODE_SELECTOR_NTH_OF) {
|
|
858
|
+
plain.nth_a = this.nth_a;
|
|
859
|
+
plain.nth_b = this.nth_b;
|
|
860
|
+
}
|
|
861
|
+
if (locations) {
|
|
862
|
+
plain.line = this.line;
|
|
863
|
+
plain.column = this.column;
|
|
864
|
+
plain.offset = this.offset;
|
|
865
|
+
plain.length = this.length;
|
|
866
|
+
}
|
|
867
|
+
if (deep) {
|
|
868
|
+
for (let child of this.children) {
|
|
869
|
+
plain.children.push(child.clone({ deep: true, locations }));
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return plain;
|
|
873
|
+
}
|
|
738
874
|
}
|
|
739
875
|
|
|
740
876
|
export { NODE_BLOCK as $, ATTR_OPERATOR_NONE as A, NODE_SELECTOR_ATTRIBUTE as B, CSSNode as C, NODE_SELECTOR_PSEUDO_CLASS as D, NODE_SELECTOR_PSEUDO_ELEMENT as E, NODE_SELECTOR_COMBINATOR as F, NODE_SELECTOR_UNIVERSAL as G, NODE_SELECTOR_NESTING as H, NODE_SELECTOR_NTH as I, NODE_SELECTOR_NTH_OF as J, NODE_SELECTOR_LANG as K, NODE_PRELUDE_MEDIA_QUERY as L, NODE_PRELUDE_MEDIA_FEATURE as M, NODE_STYLE_RULE as N, NODE_PRELUDE_MEDIA_TYPE as O, NODE_PRELUDE_CONTAINER_QUERY as P, NODE_PRELUDE_SUPPORTS_QUERY as Q, NODE_PRELUDE_LAYER_NAME as R, NODE_PRELUDE_IDENTIFIER as S, TYPE_NAMES as T, NODE_PRELUDE_OPERATOR as U, NODE_PRELUDE_IMPORT_URL as V, NODE_PRELUDE_IMPORT_LAYER as W, NODE_PRELUDE_IMPORT_SUPPORTS as X, FLAG_IMPORTANT as Y, CSSDataArena as Z, FLAG_HAS_BLOCK as _, ATTR_OPERATOR_EQUAL as a, FLAG_HAS_DECLARATIONS as a0, is_vendor_prefixed as a1, FLAG_VENDOR_PREFIXED as a2, trim_boundaries as a3, CHAR_GREATER_THAN as a4, CHAR_PLUS as a5, CHAR_TILDE as a6, CHAR_PERIOD as a7, CHAR_ASTERISK as a8, CHAR_AMPERSAND as a9, CHAR_PIPE as aa, is_whitespace as ab, is_combinator as ac, skip_whitespace_and_comments_forward as ad, skip_whitespace_and_comments_backward as ae, CHAR_EQUALS as af, CHAR_CARET as ag, CHAR_DOLLAR as ah, CHAR_SINGLE_QUOTE as ai, CHAR_DOUBLE_QUOTE as aj, CHAR_COLON as ak, FLAG_HAS_PARENS as al, skip_whitespace_forward as am, str_equals as an, CHAR_MINUS_HYPHEN as ao, CHAR_FORWARD_SLASH as ap, 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_VALUE_PARENTHESIS as v, NODE_SELECTOR_LIST as w, NODE_SELECTOR_TYPE as x, NODE_SELECTOR_CLASS as y, NODE_SELECTOR_ID as z };
|
package/dist/css-node.d.ts
CHANGED
|
@@ -2,6 +2,40 @@ import type { CSSDataArena } from './arena';
|
|
|
2
2
|
import { NODE_STYLESHEET, NODE_STYLE_RULE, NODE_AT_RULE, NODE_DECLARATION, NODE_SELECTOR, NODE_COMMENT, NODE_BLOCK, NODE_VALUE_KEYWORD, NODE_VALUE_NUMBER, NODE_VALUE_DIMENSION, NODE_VALUE_STRING, NODE_VALUE_COLOR, NODE_VALUE_FUNCTION, NODE_VALUE_OPERATOR, NODE_VALUE_PARENTHESIS, 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_SELECTOR_LANG, 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 } from './arena';
|
|
3
3
|
export declare const TYPE_NAMES: Record<number, string>;
|
|
4
4
|
export type CSSNodeType = typeof NODE_STYLESHEET | typeof NODE_STYLE_RULE | typeof NODE_AT_RULE | typeof NODE_DECLARATION | typeof NODE_SELECTOR | typeof NODE_COMMENT | typeof NODE_BLOCK | typeof NODE_VALUE_KEYWORD | typeof NODE_VALUE_NUMBER | typeof NODE_VALUE_DIMENSION | typeof NODE_VALUE_STRING | typeof NODE_VALUE_COLOR | typeof NODE_VALUE_FUNCTION | typeof NODE_VALUE_OPERATOR | typeof NODE_VALUE_PARENTHESIS | typeof NODE_SELECTOR_LIST | typeof NODE_SELECTOR_TYPE | typeof NODE_SELECTOR_CLASS | typeof NODE_SELECTOR_ID | typeof NODE_SELECTOR_ATTRIBUTE | typeof NODE_SELECTOR_PSEUDO_CLASS | typeof NODE_SELECTOR_PSEUDO_ELEMENT | typeof NODE_SELECTOR_COMBINATOR | typeof NODE_SELECTOR_UNIVERSAL | typeof NODE_SELECTOR_NESTING | typeof NODE_SELECTOR_NTH | typeof NODE_SELECTOR_NTH_OF | typeof NODE_SELECTOR_LANG | typeof NODE_PRELUDE_MEDIA_QUERY | typeof NODE_PRELUDE_MEDIA_FEATURE | typeof NODE_PRELUDE_MEDIA_TYPE | typeof NODE_PRELUDE_CONTAINER_QUERY | typeof NODE_PRELUDE_SUPPORTS_QUERY | typeof NODE_PRELUDE_LAYER_NAME | typeof NODE_PRELUDE_IDENTIFIER | typeof NODE_PRELUDE_OPERATOR | typeof NODE_PRELUDE_IMPORT_URL | typeof NODE_PRELUDE_IMPORT_LAYER | typeof NODE_PRELUDE_IMPORT_SUPPORTS;
|
|
5
|
+
export interface CloneOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Recursively clone all children
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
deep?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Include location information (line, column, offset, length)
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
locations?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export type PlainCSSNode = {
|
|
18
|
+
type: number;
|
|
19
|
+
type_name: string;
|
|
20
|
+
text: string;
|
|
21
|
+
children: PlainCSSNode[];
|
|
22
|
+
name?: string;
|
|
23
|
+
property?: string;
|
|
24
|
+
value?: string | number | null;
|
|
25
|
+
unit?: string;
|
|
26
|
+
prelude?: string;
|
|
27
|
+
is_important?: boolean;
|
|
28
|
+
is_vendor_prefixed?: boolean;
|
|
29
|
+
has_error?: boolean;
|
|
30
|
+
attr_operator?: number;
|
|
31
|
+
attr_flags?: number;
|
|
32
|
+
nth_a?: string | null;
|
|
33
|
+
nth_b?: string | null;
|
|
34
|
+
line?: number;
|
|
35
|
+
column?: number;
|
|
36
|
+
offset?: number;
|
|
37
|
+
length?: number;
|
|
38
|
+
};
|
|
5
39
|
export declare class CSSNode {
|
|
6
40
|
private arena;
|
|
7
41
|
private source;
|
|
@@ -43,4 +77,31 @@ export declare class CSSNode {
|
|
|
43
77
|
get nth(): CSSNode | null;
|
|
44
78
|
get selector(): CSSNode | null;
|
|
45
79
|
get selector_list(): CSSNode | null;
|
|
80
|
+
compound_parts(): IterableIterator<CSSNode>;
|
|
81
|
+
get first_compound(): CSSNode[];
|
|
82
|
+
get all_compounds(): CSSNode[][];
|
|
83
|
+
get is_compound(): boolean;
|
|
84
|
+
get first_compound_text(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Clone this node as a mutable plain JavaScript object
|
|
87
|
+
*
|
|
88
|
+
* Extracts all properties from the arena into a plain object with children as an array.
|
|
89
|
+
* The resulting object can be freely modified.
|
|
90
|
+
*
|
|
91
|
+
* @param options - Cloning configuration
|
|
92
|
+
* @param options.deep - Recursively clone children (default: true)
|
|
93
|
+
* @param options.locations - Include line/column/offset/length (default: false)
|
|
94
|
+
* @returns Plain object with children as array
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* const ast = parse('div { color: red; }')
|
|
98
|
+
* const decl = ast.first_child.block.first_child
|
|
99
|
+
* const plain = decl.clone()
|
|
100
|
+
*
|
|
101
|
+
* // Access children as array
|
|
102
|
+
* plain.children.length
|
|
103
|
+
* plain.children[0]
|
|
104
|
+
* plain.children.push(newChild)
|
|
105
|
+
*/
|
|
106
|
+
clone(options?: CloneOptions): PlainCSSNode;
|
|
46
107
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { parse_value } from './parse-value';
|
|
|
5
5
|
export { tokenize } from './tokenize';
|
|
6
6
|
export { walk, traverse } from './walk';
|
|
7
7
|
export { type ParserOptions } from './parse';
|
|
8
|
-
export { CSSNode, type CSSNodeType, TYPE_NAMES } from './css-node';
|
|
8
|
+
export { CSSNode, type CSSNodeType, TYPE_NAMES, type CloneOptions, type PlainCSSNode } from './css-node';
|
|
9
9
|
export type { LexerPosition } from './lexer';
|
|
10
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_VALUE_PARENTHESIS, 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_SELECTOR_LANG, 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';
|
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 { 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, Y as FLAG_IMPORTANT, j as NODE_AT_RULE, k as NODE_COMMENT, l as NODE_DECLARATION, P as NODE_PRELUDE_CONTAINER_QUERY, S as NODE_PRELUDE_IDENTIFIER, W as NODE_PRELUDE_IMPORT_LAYER, X as NODE_PRELUDE_IMPORT_SUPPORTS, V as NODE_PRELUDE_IMPORT_URL, R as NODE_PRELUDE_LAYER_NAME, M as NODE_PRELUDE_MEDIA_FEATURE, L as NODE_PRELUDE_MEDIA_QUERY, O as NODE_PRELUDE_MEDIA_TYPE, U as NODE_PRELUDE_OPERATOR, Q as NODE_PRELUDE_SUPPORTS_QUERY, m as NODE_SELECTOR, B as NODE_SELECTOR_ATTRIBUTE, y as NODE_SELECTOR_CLASS, F as NODE_SELECTOR_COMBINATOR, z as NODE_SELECTOR_ID, K as NODE_SELECTOR_LANG, w as NODE_SELECTOR_LIST, H as NODE_SELECTOR_NESTING, I as NODE_SELECTOR_NTH, J as NODE_SELECTOR_NTH_OF, D as NODE_SELECTOR_PSEUDO_CLASS, E as NODE_SELECTOR_PSEUDO_ELEMENT, x as NODE_SELECTOR_TYPE, G 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, v as NODE_VALUE_PARENTHESIS, r as NODE_VALUE_STRING, T as TYPE_NAMES } from './css-node-
|
|
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, Y as FLAG_IMPORTANT, j as NODE_AT_RULE, k as NODE_COMMENT, l as NODE_DECLARATION, P as NODE_PRELUDE_CONTAINER_QUERY, S as NODE_PRELUDE_IDENTIFIER, W as NODE_PRELUDE_IMPORT_LAYER, X as NODE_PRELUDE_IMPORT_SUPPORTS, V as NODE_PRELUDE_IMPORT_URL, R as NODE_PRELUDE_LAYER_NAME, M as NODE_PRELUDE_MEDIA_FEATURE, L as NODE_PRELUDE_MEDIA_QUERY, O as NODE_PRELUDE_MEDIA_TYPE, U as NODE_PRELUDE_OPERATOR, Q as NODE_PRELUDE_SUPPORTS_QUERY, m as NODE_SELECTOR, B as NODE_SELECTOR_ATTRIBUTE, y as NODE_SELECTOR_CLASS, F as NODE_SELECTOR_COMBINATOR, z as NODE_SELECTOR_ID, K as NODE_SELECTOR_LANG, w as NODE_SELECTOR_LIST, H as NODE_SELECTOR_NESTING, I as NODE_SELECTOR_NTH, J as NODE_SELECTOR_NTH_OF, D as NODE_SELECTOR_PSEUDO_CLASS, E as NODE_SELECTOR_PSEUDO_ELEMENT, x as NODE_SELECTOR_TYPE, G 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, v as NODE_VALUE_PARENTHESIS, r as NODE_VALUE_STRING, T as TYPE_NAMES } from './css-node-GOEvp2OO.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 { ao as CHAR_MINUS_HYPHEN, a5 as CHAR_PLUS, am as skip_whitespace_forward, I as NODE_SELECTOR_NTH, C as CSSNode, Z as CSSDataArena } from './css-node-
|
|
2
|
+
import { ao as CHAR_MINUS_HYPHEN, a5 as CHAR_PLUS, am as skip_whitespace_forward, I as NODE_SELECTOR_NTH, C as CSSNode, Z as CSSDataArena } from './css-node-GOEvp2OO.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 { Z as CSSDataArena, C as CSSNode, an as str_equals, U as NODE_PRELUDE_OPERATOR, O as NODE_PRELUDE_MEDIA_TYPE, L as NODE_PRELUDE_MEDIA_QUERY, M as NODE_PRELUDE_MEDIA_FEATURE, a3 as trim_boundaries, S as NODE_PRELUDE_IDENTIFIER, P as NODE_PRELUDE_CONTAINER_QUERY, Q as NODE_PRELUDE_SUPPORTS_QUERY, R as NODE_PRELUDE_LAYER_NAME, V as NODE_PRELUDE_IMPORT_URL, W as NODE_PRELUDE_IMPORT_LAYER, X as NODE_PRELUDE_IMPORT_SUPPORTS, am as skip_whitespace_forward } from './css-node-
|
|
2
|
+
import { Z as CSSDataArena, C as CSSNode, an as str_equals, U as NODE_PRELUDE_OPERATOR, O as NODE_PRELUDE_MEDIA_TYPE, L as NODE_PRELUDE_MEDIA_QUERY, M as NODE_PRELUDE_MEDIA_FEATURE, a3 as trim_boundaries, S as NODE_PRELUDE_IDENTIFIER, P as NODE_PRELUDE_CONTAINER_QUERY, Q as NODE_PRELUDE_SUPPORTS_QUERY, R as NODE_PRELUDE_LAYER_NAME, V as NODE_PRELUDE_IMPORT_URL, W as NODE_PRELUDE_IMPORT_LAYER, X as NODE_PRELUDE_IMPORT_SUPPORTS, am as skip_whitespace_forward } from './css-node-GOEvp2OO.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 { Z as CSSDataArena, w as NODE_SELECTOR_LIST, C as CSSNode, m as NODE_SELECTOR, a4 as CHAR_GREATER_THAN, a5 as CHAR_PLUS, a6 as CHAR_TILDE, F as NODE_SELECTOR_COMBINATOR, a7 as CHAR_PERIOD, a8 as CHAR_ASTERISK, a9 as CHAR_AMPERSAND, H as NODE_SELECTOR_NESTING, aa as CHAR_PIPE, z as NODE_SELECTOR_ID, x as NODE_SELECTOR_TYPE, G as NODE_SELECTOR_UNIVERSAL, ab as is_whitespace, ac as is_combinator, y as NODE_SELECTOR_CLASS, B as NODE_SELECTOR_ATTRIBUTE, ad as skip_whitespace_and_comments_forward, ae as skip_whitespace_and_comments_backward, af as CHAR_EQUALS, ag as CHAR_CARET, ah 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, ai as CHAR_SINGLE_QUOTE, aj as CHAR_DOUBLE_QUOTE, h as ATTR_FLAG_CASE_INSENSITIVE, i as ATTR_FLAG_CASE_SENSITIVE, ak as CHAR_COLON, E as NODE_SELECTOR_PSEUDO_ELEMENT, D as NODE_SELECTOR_PSEUDO_CLASS, a1 as is_vendor_prefixed, a2 as FLAG_VENDOR_PREFIXED, al as FLAG_HAS_PARENS, K as NODE_SELECTOR_LANG, am as skip_whitespace_forward, J as NODE_SELECTOR_NTH_OF } from './css-node-
|
|
2
|
+
import { Z as CSSDataArena, w as NODE_SELECTOR_LIST, C as CSSNode, m as NODE_SELECTOR, a4 as CHAR_GREATER_THAN, a5 as CHAR_PLUS, a6 as CHAR_TILDE, F as NODE_SELECTOR_COMBINATOR, a7 as CHAR_PERIOD, a8 as CHAR_ASTERISK, a9 as CHAR_AMPERSAND, H as NODE_SELECTOR_NESTING, aa as CHAR_PIPE, z as NODE_SELECTOR_ID, x as NODE_SELECTOR_TYPE, G as NODE_SELECTOR_UNIVERSAL, ab as is_whitespace, ac as is_combinator, y as NODE_SELECTOR_CLASS, B as NODE_SELECTOR_ATTRIBUTE, ad as skip_whitespace_and_comments_forward, ae as skip_whitespace_and_comments_backward, af as CHAR_EQUALS, ag as CHAR_CARET, ah 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, ai as CHAR_SINGLE_QUOTE, aj as CHAR_DOUBLE_QUOTE, h as ATTR_FLAG_CASE_INSENSITIVE, i as ATTR_FLAG_CASE_SENSITIVE, ak as CHAR_COLON, E as NODE_SELECTOR_PSEUDO_ELEMENT, D as NODE_SELECTOR_PSEUDO_CLASS, a1 as is_vendor_prefixed, a2 as FLAG_VENDOR_PREFIXED, al as FLAG_HAS_PARENS, K as NODE_SELECTOR_LANG, am as skip_whitespace_forward, J as NODE_SELECTOR_NTH_OF } from './css-node-GOEvp2OO.js';
|
|
3
3
|
import { ANplusBParser } from './parse-anplusb.js';
|
|
4
4
|
|
|
5
5
|
class SelectorParser {
|
package/dist/parse-value.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as Lexer, y as TOKEN_EOF, t as TOKEN_LEFT_PAREN, 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, u as TOKEN_RIGHT_PAREN } from './lexer-CtBKgfVv.js';
|
|
2
|
-
import { Z as CSSDataArena, C as CSSNode, ab 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, a5 as CHAR_PLUS, ao as CHAR_MINUS_HYPHEN, a8 as CHAR_ASTERISK, ap as CHAR_FORWARD_SLASH, t as NODE_VALUE_FUNCTION, v as NODE_VALUE_PARENTHESIS } from './css-node-
|
|
2
|
+
import { Z as CSSDataArena, C as CSSNode, ab 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, a5 as CHAR_PLUS, ao as CHAR_MINUS_HYPHEN, a8 as CHAR_ASTERISK, ap as CHAR_FORWARD_SLASH, t as NODE_VALUE_FUNCTION, v as NODE_VALUE_PARENTHESIS } from './css-node-GOEvp2OO.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 { Z as CSSDataArena, n as NODE_STYLESHEET, C as CSSNode, N as NODE_STYLE_RULE, _ as FLAG_HAS_BLOCK, $ as NODE_BLOCK, a0 as FLAG_HAS_DECLARATIONS, w as NODE_SELECTOR_LIST, l as NODE_DECLARATION, a1 as is_vendor_prefixed, a2 as FLAG_VENDOR_PREFIXED, a3 as trim_boundaries, Y as FLAG_IMPORTANT, j as NODE_AT_RULE } from './css-node-
|
|
3
|
-
export { k as NODE_COMMENT, P as NODE_PRELUDE_CONTAINER_QUERY, S as NODE_PRELUDE_IDENTIFIER, W as NODE_PRELUDE_IMPORT_LAYER, X as NODE_PRELUDE_IMPORT_SUPPORTS, V as NODE_PRELUDE_IMPORT_URL, R as NODE_PRELUDE_LAYER_NAME, M as NODE_PRELUDE_MEDIA_FEATURE, L as NODE_PRELUDE_MEDIA_QUERY, O as NODE_PRELUDE_MEDIA_TYPE, U as NODE_PRELUDE_OPERATOR, Q as NODE_PRELUDE_SUPPORTS_QUERY, m as NODE_SELECTOR, B as NODE_SELECTOR_ATTRIBUTE, y as NODE_SELECTOR_CLASS, F as NODE_SELECTOR_COMBINATOR, z as NODE_SELECTOR_ID, K as NODE_SELECTOR_LANG, H as NODE_SELECTOR_NESTING, I as NODE_SELECTOR_NTH, J as NODE_SELECTOR_NTH_OF, D as NODE_SELECTOR_PSEUDO_CLASS, E as NODE_SELECTOR_PSEUDO_ELEMENT, x as NODE_SELECTOR_TYPE, G 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, v as NODE_VALUE_PARENTHESIS, r as NODE_VALUE_STRING } from './css-node-
|
|
2
|
+
import { Z as CSSDataArena, n as NODE_STYLESHEET, C as CSSNode, N as NODE_STYLE_RULE, _ as FLAG_HAS_BLOCK, $ as NODE_BLOCK, a0 as FLAG_HAS_DECLARATIONS, w as NODE_SELECTOR_LIST, l as NODE_DECLARATION, a1 as is_vendor_prefixed, a2 as FLAG_VENDOR_PREFIXED, a3 as trim_boundaries, Y as FLAG_IMPORTANT, j as NODE_AT_RULE } from './css-node-GOEvp2OO.js';
|
|
3
|
+
export { k as NODE_COMMENT, P as NODE_PRELUDE_CONTAINER_QUERY, S as NODE_PRELUDE_IDENTIFIER, W as NODE_PRELUDE_IMPORT_LAYER, X as NODE_PRELUDE_IMPORT_SUPPORTS, V as NODE_PRELUDE_IMPORT_URL, R as NODE_PRELUDE_LAYER_NAME, M as NODE_PRELUDE_MEDIA_FEATURE, L as NODE_PRELUDE_MEDIA_QUERY, O as NODE_PRELUDE_MEDIA_TYPE, U as NODE_PRELUDE_OPERATOR, Q as NODE_PRELUDE_SUPPORTS_QUERY, m as NODE_SELECTOR, B as NODE_SELECTOR_ATTRIBUTE, y as NODE_SELECTOR_CLASS, F as NODE_SELECTOR_COMBINATOR, z as NODE_SELECTOR_ID, K as NODE_SELECTOR_LANG, H as NODE_SELECTOR_NESTING, I as NODE_SELECTOR_NTH, J as NODE_SELECTOR_NTH_OF, D as NODE_SELECTOR_PSEUDO_CLASS, E as NODE_SELECTOR_PSEUDO_ELEMENT, x as NODE_SELECTOR_TYPE, G 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, v as NODE_VALUE_PARENTHESIS, r as NODE_VALUE_STRING } from './css-node-GOEvp2OO.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