@projectwallace/css-parser 0.18.9 → 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-DfJEsKN0.js → css-node-yoUdFtNg.js} +101 -100
- 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 +2 -2
- package/dist/parse-atrule-prelude.js +62 -61
- package/dist/parse-declaration.d.ts +3 -3
- package/dist/parse-declaration.js +20 -19
- package/dist/parse-dimension.js +47 -1
- package/dist/{parse-selector-rTXB4IN2.js → parse-selector-CqIpnBrQ.js} +74 -81
- package/dist/parse-selector.d.ts +2 -2
- package/dist/parse-selector.js +1 -1
- 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 +45 -44
- 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-CIaPOmBc.js → string-utils-DiRRd28d.js} +5 -49
- 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-0ADWAELW.js → tokenize-Ccg58Z_k.js} +67 -96
- package/dist/tokenize.d.ts +97 -2
- package/dist/tokenize.js +1 -1
- package/dist/{value-node-parser-DizbcN1a.js → value-node-parser-D0qnA_bD.js} +129 -134
- package/dist/walk.d.ts +3 -2
- package/dist/walk.js +2 -2
- package/package.json +17 -4
- package/dist/tokenize-CaWtrHw_.d.ts +0 -134
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install @projectwallace/css-parser
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
|
-
import { parse,
|
|
28
|
+
import { parse, STYLE_RULE, DECLARATION } from '@projectwallace/css-parser'
|
|
29
29
|
|
|
30
30
|
const ast = parse(`
|
|
31
31
|
body {
|
|
@@ -42,13 +42,13 @@ const ast = parse(`
|
|
|
42
42
|
|
|
43
43
|
// Iterate over top-level rules
|
|
44
44
|
for (const rule of ast) {
|
|
45
|
-
if (rule.type ===
|
|
45
|
+
if (rule.type === STYLE_RULE) {
|
|
46
46
|
const selector = rule.first_child
|
|
47
47
|
console.log(`Selector: ${selector.text}`)
|
|
48
48
|
|
|
49
49
|
// Iterate over declarations
|
|
50
50
|
for (const node of rule) {
|
|
51
|
-
if (node.type ===
|
|
51
|
+
if (node.type === DECLARATION) {
|
|
52
52
|
console.log(` ${node.property}: ${node.value}`)
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -63,25 +63,193 @@ for (const rule of ast) {
|
|
|
63
63
|
- **Location tracking with no penalty** — full line, column, and offset data without slowing the parser down
|
|
64
64
|
- **No syntax validation** — skipping spec checks and MDN data means nothing gets in the way of speed
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
## API
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Everything is exported from the package root. Each part is also available from its own entry point, so you can import only what you need and skip evaluating the rest of the package. Node properties and return types ship as TypeScript types, so this section sticks to short examples.
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
| ------------------------------------------------- | ---------------------------- | -------- | ------- |
|
|
72
|
-
| `@projectwallace/css-parser` | Full parser (all subparsers) | 68.9 kB | 15.5 kB |
|
|
73
|
-
| `@projectwallace/css-parser/parse` | CSS stylesheet parser | 62.2 kB | 13.3 kB |
|
|
74
|
-
| `@projectwallace/css-parser/parse-atrule-prelude` | At-rule prelude parser | 35.4 kB | 8.4 kB |
|
|
75
|
-
| `@projectwallace/css-parser/parse-selector` | Selector parser | 37.7 kB | 8.9 kB |
|
|
76
|
-
| `@projectwallace/css-parser/parse-anplusb` | An+B syntax parser | 26.1 kB | 6.6 kB |
|
|
77
|
-
| `@projectwallace/css-parser/parse-declaration` | Declaration parser | 28.3 kB | 7.3 kB |
|
|
78
|
-
| `@projectwallace/css-parser/parse-value` | Value parser | 25.2 kB | 6.6 kB |
|
|
79
|
-
| `@projectwallace/css-parser/parse-dimension` | Dimension parser | 0.4 kB | 0.3 kB |
|
|
80
|
-
| `@projectwallace/css-parser/tokenizer` | Tokenizer | 9.8 kB | 2.4 kB |
|
|
70
|
+
### Entry points
|
|
81
71
|
|
|
82
|
-
|
|
72
|
+
| Import | Exports |
|
|
73
|
+
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| `@projectwallace/css-parser` | Everything below, except the `Lexer` and `Parser` classes |
|
|
75
|
+
| `@projectwallace/css-parser/parse` | `parse`, `Parser`, `ParserOptions` |
|
|
76
|
+
| `@projectwallace/css-parser/parse-selector` | `parse_selector`, `parse_selector_list` |
|
|
77
|
+
| `@projectwallace/css-parser/parse-atrule-prelude` | `parse_atrule_prelude` |
|
|
78
|
+
| `@projectwallace/css-parser/parse-declaration` | `parse_declaration` |
|
|
79
|
+
| `@projectwallace/css-parser/parse-value` | `parse_value` |
|
|
80
|
+
| `@projectwallace/css-parser/parse-anplusb` | `parse_anplusb` |
|
|
81
|
+
| `@projectwallace/css-parser/parse-dimension` | `parse_dimension` |
|
|
82
|
+
| `@projectwallace/css-parser/tokenizer` | `tokenize`, `Lexer` |
|
|
83
|
+
| `@projectwallace/css-parser/walker` | `walk`, `traverse`, `SKIP`, `BREAK` |
|
|
84
|
+
| `@projectwallace/css-parser/nodes` | Node type constants (`STYLE_RULE`, `DECLARATION`, …), `NODE_TYPES` |
|
|
85
|
+
| `@projectwallace/css-parser/node-types` | Type guards (`is_declaration`, `is_rule`, …) and node types (`CSSNode`, `Rule`, `Declaration`, …) |
|
|
86
|
+
| `@projectwallace/css-parser/string-utils` | `is_custom`, `is_vendor_prefixed`, `strip_vendor_prefix`, `str_equals`, `str_starts_with`, `str_index_of` |
|
|
87
|
+
| `@projectwallace/css-parser/token-types` | Token type constants (`TOKEN_*`) |
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
### `parse(source, options?)`
|
|
90
|
+
|
|
91
|
+
Parses a full stylesheet and returns the root `StyleSheet` node. Nodes are iterable and expose `first_child`, `next_sibling`, `children`, `text`, `line`, `column`, `start`, `end` and `length`.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { parse } from '@projectwallace/css-parser'
|
|
95
|
+
|
|
96
|
+
const ast = parse('body { color: red; }')
|
|
97
|
+
const rule = ast.first_child
|
|
98
|
+
rule.block.first_child.property // "color"
|
|
99
|
+
rule.block.first_child.value.text // "red"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Options:
|
|
103
|
+
|
|
104
|
+
- `parse_values` (default `true`) — parse declaration values into nodes
|
|
105
|
+
- `parse_selectors` (default `true`) — parse selectors into nodes
|
|
106
|
+
- `parse_atrule_preludes` (default `true`) — parse at-rule preludes into nodes
|
|
107
|
+
- `on_comment` — called for every comment; comments are never part of the tree
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
const comments = []
|
|
111
|
+
parse('/* hi */ a { color: red }', {
|
|
112
|
+
parse_values: false,
|
|
113
|
+
on_comment: (info) => comments.push(info), // { start, end, length, line, column }
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### `parse_selector(source)` and `parse_selector_list(source)`
|
|
118
|
+
|
|
119
|
+
`parse_selector` returns the first selector, `parse_selector_list` the whole `SelectorList`.
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { parse_selector, parse_selector_list } from '@projectwallace/css-parser'
|
|
123
|
+
|
|
124
|
+
parse_selector('a.b > c').children.map((part) => part.text) // ["a", ".b", ">", "c"]
|
|
125
|
+
parse_selector_list('h1, h2').children.map((s) => s.text) // ["h1", "h2"]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### `parse_declaration(source)`
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { parse_declaration } from '@projectwallace/css-parser'
|
|
132
|
+
|
|
133
|
+
const decl = parse_declaration('color: red !important')
|
|
134
|
+
decl.property // "color"
|
|
135
|
+
decl.is_important // true
|
|
136
|
+
decl.value.text // "red"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### `parse_value(source)`
|
|
140
|
+
|
|
141
|
+
Parses a declaration value into a `Value` node with one child per component.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { parse_value } from '@projectwallace/css-parser'
|
|
145
|
+
|
|
146
|
+
for (const node of parse_value('10px 20px')) {
|
|
147
|
+
console.log(node.type_name, node.value, node.unit) // "Dimension" 10 "px", then "Dimension" 20 "px"
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### `parse_atrule_prelude(name, prelude)`
|
|
152
|
+
|
|
153
|
+
Returns an array of nodes for the prelude of the at-rule called `name` (without the `@`).
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { parse_atrule_prelude } from '@projectwallace/css-parser'
|
|
157
|
+
|
|
158
|
+
const [query] = parse_atrule_prelude('media', '(min-width: 768px)')
|
|
159
|
+
query.type_name // "MediaQuery"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### `parse_dimension(text)`
|
|
163
|
+
|
|
164
|
+
Splits a number from its unit. It works for anything shaped like a number followed by a unit: lengths (`100px`), percentages (`2%`), durations (`200ms`) and so on. It does not validate; text without a leading number gives `value: 0`.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { parse_dimension } from '@projectwallace/css-parser'
|
|
168
|
+
|
|
169
|
+
parse_dimension('100px') // { value: 100, unit: "px" }
|
|
170
|
+
parse_dimension('2%') // { value: 2, unit: "%" }
|
|
171
|
+
parse_dimension('1.5e3s') // { value: 1500, unit: "s" }
|
|
172
|
+
parse_dimension('5') // { value: 5, unit: "" }
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### `walk(node, callback)` and `traverse(node, { enter, leave })`
|
|
176
|
+
|
|
177
|
+
Both walk the tree depth-first. Return `SKIP` to skip the children of a node and `BREAK` to stop entirely. `walk` also passes a `depth` that counts rule and at-rule nesting. `traverse` calls `enter` before and `leave` after the children (`leave` still runs after `SKIP`, but not after `BREAK`).
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import {
|
|
181
|
+
parse,
|
|
182
|
+
walk,
|
|
183
|
+
traverse,
|
|
184
|
+
SKIP,
|
|
185
|
+
BREAK,
|
|
186
|
+
DECLARATION,
|
|
187
|
+
AT_RULE,
|
|
188
|
+
} from '@projectwallace/css-parser'
|
|
189
|
+
|
|
190
|
+
const ast = parse('@media screen { a { color: red; margin: 0 } }')
|
|
191
|
+
|
|
192
|
+
walk(ast, (node) => {
|
|
193
|
+
if (node.type === DECLARATION) {
|
|
194
|
+
console.log(node.property) // "color"
|
|
195
|
+
return BREAK
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
traverse(ast, {
|
|
200
|
+
enter(node) {
|
|
201
|
+
if (node.type === AT_RULE) return SKIP // leave() still runs for this node
|
|
202
|
+
},
|
|
203
|
+
leave(node) {},
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### `tokenize(source, on_comment?)`
|
|
208
|
+
|
|
209
|
+
A generator of tokens; comments are skipped and reported through `on_comment`.
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import { tokenize } from '@projectwallace/css-parser'
|
|
213
|
+
|
|
214
|
+
for (const token of tokenize('a { color: red }')) {
|
|
215
|
+
console.log(token.type, token.start, token.end)
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Node types, type guards and `clone()`
|
|
220
|
+
|
|
221
|
+
Node type constants (`STYLE_RULE`, `DECLARATION`, `DIMENSION`, …) and `NODE_TYPES` are exported from the root and from `@projectwallace/css-parser/nodes`. Type guards such as `is_declaration()` and `is_dimension()` that narrow a node to its specific type are exported from the root and from `@projectwallace/css-parser/node-types`. `node.clone({ deep?, locations? })` returns a mutable plain-object copy of a node.
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
import { parse, is_declaration } from '@projectwallace/css-parser'
|
|
225
|
+
|
|
226
|
+
const decl = parse('a { color: red }').first_child.block.first_child
|
|
227
|
+
is_declaration(decl) // true
|
|
228
|
+
decl.type_name // "Declaration"
|
|
229
|
+
decl.clone({ deep: false }).property // "color"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### String helpers
|
|
233
|
+
|
|
234
|
+
Allocation-free helpers, handy when working with node names. Also available from `@projectwallace/css-parser/string-utils`; token type constants (`TOKEN_*`) are available from `@projectwallace/css-parser/token-types`. The lowercase argument is the first one for `str_equals` and the second one for `str_starts_with` and `str_index_of`. This inconsistency will be fixed in a future breaking change.
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
import {
|
|
238
|
+
is_custom,
|
|
239
|
+
is_vendor_prefixed,
|
|
240
|
+
strip_vendor_prefix,
|
|
241
|
+
str_equals,
|
|
242
|
+
str_starts_with,
|
|
243
|
+
str_index_of,
|
|
244
|
+
} from '@projectwallace/css-parser'
|
|
245
|
+
|
|
246
|
+
is_custom('--primary') // true
|
|
247
|
+
is_vendor_prefixed('-webkit-transform') // true
|
|
248
|
+
strip_vendor_prefix('-webkit-transform') // "transform"
|
|
249
|
+
str_equals('media', 'MEDIA') // true
|
|
250
|
+
str_starts_with('WEBKIT-transform', 'webkit') // true
|
|
251
|
+
str_index_of('background-COLOR', 'color') // 11
|
|
252
|
+
```
|
|
85
253
|
|
|
86
254
|
## Non-goals
|
|
87
255
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/arena.ts
|
|
2
|
-
|
|
2
|
+
const BYTES_PER_NODE = 32;
|
|
3
3
|
const STYLESHEET = 1;
|
|
4
4
|
const STYLE_RULE = 2;
|
|
5
5
|
const AT_RULE = 3;
|
|
@@ -66,9 +66,9 @@ var CSSDataArena = class CSSDataArena {
|
|
|
66
66
|
this.overflow_lengths = /* @__PURE__ */ new Map();
|
|
67
67
|
}
|
|
68
68
|
static capacity_for_source(source_length) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const size_in_kb = source_length / 1024;
|
|
70
|
+
const estimated_nodes = Math.ceil(size_in_kb * CSSDataArena.NODES_PER_KB);
|
|
71
|
+
const capacity = Math.ceil(estimated_nodes * CSSDataArena.CAPACITY_BUFFER);
|
|
72
72
|
return Math.max(16, capacity);
|
|
73
73
|
}
|
|
74
74
|
get_count() {
|
|
@@ -93,11 +93,16 @@ var CSSDataArena = class CSSDataArena {
|
|
|
93
93
|
return this.view.getUint32(this.node_offset(node_index) + 12, true);
|
|
94
94
|
}
|
|
95
95
|
get_length(node_index) {
|
|
96
|
+
const length = this.view.getUint16(this.node_offset(node_index) + 2, true);
|
|
97
|
+
if (length === 65535) return this.get_overflow_length(node_index);
|
|
98
|
+
return length;
|
|
99
|
+
}
|
|
100
|
+
get_overflow_length(node_index) {
|
|
96
101
|
if (this.has_flag(node_index, 4)) {
|
|
97
102
|
const overflow_length = this.overflow_lengths.get(node_index);
|
|
98
103
|
if (overflow_length !== void 0) return overflow_length;
|
|
99
104
|
}
|
|
100
|
-
return
|
|
105
|
+
return 65535;
|
|
101
106
|
}
|
|
102
107
|
get_content_start(node_index) {
|
|
103
108
|
return this.get_start_offset(node_index) + this.view.getUint16(this.node_offset(node_index) + 16, true);
|
|
@@ -130,11 +135,13 @@ var CSSDataArena = class CSSDataArena {
|
|
|
130
135
|
this.view.setUint8(this.node_offset(node_index) + 1, flags);
|
|
131
136
|
}
|
|
132
137
|
set_length(node_index, length) {
|
|
133
|
-
if (length > 65535)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
if (length > 65535) this.set_length_overflow(node_index, length);
|
|
139
|
+
else this.view.setUint16(this.node_offset(node_index) + 2, length, true);
|
|
140
|
+
}
|
|
141
|
+
set_length_overflow(node_index, length) {
|
|
142
|
+
this.view.setUint16(this.node_offset(node_index) + 2, 65535, true);
|
|
143
|
+
this.set_flag(node_index, 4);
|
|
144
|
+
this.overflow_lengths.set(node_index, length);
|
|
138
145
|
}
|
|
139
146
|
set_content_start_delta(node_index, delta) {
|
|
140
147
|
this.view.setUint16(this.node_offset(node_index) + 16, delta, true);
|
|
@@ -156,8 +163,8 @@ var CSSDataArena = class CSSDataArena {
|
|
|
156
163
|
}
|
|
157
164
|
grow() {
|
|
158
165
|
this.growth_count++;
|
|
159
|
-
|
|
160
|
-
|
|
166
|
+
const new_capacity = Math.ceil(this.capacity * CSSDataArena.GROWTH_FACTOR);
|
|
167
|
+
const new_buffer = /* @__PURE__ */ new ArrayBuffer(new_capacity * BYTES_PER_NODE);
|
|
161
168
|
new Uint8Array(new_buffer).set(new Uint8Array(this.buffer));
|
|
162
169
|
this.buffer = new_buffer;
|
|
163
170
|
this.view = new DataView(new_buffer);
|
|
@@ -172,7 +179,8 @@ var CSSDataArena = class CSSDataArena {
|
|
|
172
179
|
this.view.setUint32(offset + 12, start_offset, true);
|
|
173
180
|
this.view.setUint32(offset + 24, start_line, true);
|
|
174
181
|
this.view.setUint32(offset + 28, start_column, true);
|
|
175
|
-
this.
|
|
182
|
+
if (length > 65535) this.set_length_overflow(node_index, length);
|
|
183
|
+
else this.view.setUint16(offset + 2, length, true);
|
|
176
184
|
return node_index;
|
|
177
185
|
}
|
|
178
186
|
append_children(parent_index, children) {
|
|
@@ -184,8 +192,8 @@ var CSSDataArena = class CSSDataArena {
|
|
|
184
192
|
/** Shrink the buffer to the live node count, releasing wasted capacity. Call once after parsing; no-op if already tight. */
|
|
185
193
|
trim() {
|
|
186
194
|
if (this.count === this.capacity) return;
|
|
187
|
-
|
|
188
|
-
|
|
195
|
+
const byte_count = this.count * BYTES_PER_NODE;
|
|
196
|
+
const new_buffer = new ArrayBuffer(byte_count);
|
|
189
197
|
new Uint8Array(new_buffer).set(new Uint8Array(this.buffer, 0, byte_count));
|
|
190
198
|
this.buffer = new_buffer;
|
|
191
199
|
this.view = new DataView(new_buffer);
|
|
@@ -207,12 +215,12 @@ var CSSDataArena = class CSSDataArena {
|
|
|
207
215
|
return this.get_next_sibling(node_index) !== 0;
|
|
208
216
|
}
|
|
209
217
|
set_flag(node_index, flag) {
|
|
210
|
-
|
|
211
|
-
this.
|
|
218
|
+
const offset = node_index * BYTES_PER_NODE + 1;
|
|
219
|
+
this.view.setUint8(offset, this.view.getUint8(offset) | flag);
|
|
212
220
|
}
|
|
213
221
|
clear_flag(node_index, flag) {
|
|
214
|
-
|
|
215
|
-
this.
|
|
222
|
+
const offset = node_index * BYTES_PER_NODE + 1;
|
|
223
|
+
this.view.setUint8(offset, this.view.getUint8(offset) & ~flag);
|
|
216
224
|
}
|
|
217
225
|
has_flag(node_index, flag) {
|
|
218
226
|
return (this.get_flags(node_index) & flag) !== 0;
|
|
@@ -67,6 +67,7 @@ declare class CSSDataArena {
|
|
|
67
67
|
get_flags(node_index: number): number;
|
|
68
68
|
get_start_offset(node_index: number): number;
|
|
69
69
|
get_length(node_index: number): number;
|
|
70
|
+
private get_overflow_length;
|
|
70
71
|
get_content_start(node_index: number): number;
|
|
71
72
|
get_content_length(node_index: number): number;
|
|
72
73
|
get_first_child(node_index: number): number;
|
|
@@ -78,6 +79,7 @@ declare class CSSDataArena {
|
|
|
78
79
|
set_type(node_index: number, type: number): void;
|
|
79
80
|
set_flags(node_index: number, flags: number): void;
|
|
80
81
|
set_length(node_index: number, length: number): void;
|
|
82
|
+
private set_length_overflow;
|
|
81
83
|
set_content_start_delta(node_index: number, delta: number): void;
|
|
82
84
|
set_content_length(node_index: number, length: number): void;
|
|
83
85
|
set_first_child(node_index: number, childIndex: number): void;
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
|
//#region src/constants.d.ts
|
|
3
3
|
export declare const NODE_TYPES: {
|
|
4
4
|
readonly STYLESHEET: 1;
|
package/dist/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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";
|
|
2
2
|
//#region src/constants.ts
|
|
3
3
|
const NODE_TYPES = {
|
|
4
4
|
STYLESHEET: 1,
|