postcss 8.3.9 → 8.4.31
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 +7 -23
- package/lib/at-rule.d.ts +58 -49
- package/lib/comment.d.ts +43 -32
- package/lib/container.d.ts +233 -223
- package/lib/container.js +251 -244
- package/lib/css-syntax-error.d.ts +117 -61
- package/lib/css-syntax-error.js +10 -3
- package/lib/declaration.d.ts +85 -61
- package/lib/document.d.ts +27 -16
- package/lib/fromJSON.d.ts +6 -2
- package/lib/input.d.ts +118 -54
- package/lib/input.js +87 -55
- package/lib/lazy-result.d.ts +82 -67
- package/lib/lazy-result.js +234 -232
- package/lib/list.d.ts +53 -47
- package/lib/list.js +16 -14
- package/lib/map-generator.js +231 -172
- package/lib/no-work-result.d.ts +46 -0
- package/lib/no-work-result.js +135 -0
- package/lib/node.d.ts +345 -253
- package/lib/node.js +200 -139
- package/lib/parse.d.ts +6 -2
- package/lib/parser.js +354 -309
- package/lib/postcss.d.mts +72 -0
- package/lib/postcss.d.ts +288 -319
- package/lib/postcss.js +18 -12
- package/lib/postcss.mjs +1 -0
- package/lib/previous-map.d.ts +23 -14
- package/lib/previous-map.js +37 -40
- package/lib/processor.d.ts +55 -41
- package/lib/processor.js +20 -27
- package/lib/result.d.ts +87 -76
- package/lib/root.d.ts +49 -36
- package/lib/root.js +12 -10
- package/lib/rule.d.ts +54 -45
- package/lib/stringifier.d.ts +46 -0
- package/lib/stringifier.js +140 -138
- package/lib/stringify.d.ts +6 -2
- package/lib/terminal-highlight.js +11 -11
- package/lib/tokenize.js +2 -2
- package/lib/warn-once.js +1 -0
- package/lib/warning.d.ts +79 -36
- package/lib/warning.js +6 -4
- package/package.json +20 -10
package/lib/lazy-result.js
CHANGED
@@ -11,37 +11,37 @@ let parse = require('./parse')
|
|
11
11
|
let Root = require('./root')
|
12
12
|
|
13
13
|
const TYPE_TO_CLASS_NAME = {
|
14
|
-
document: 'Document',
|
15
|
-
root: 'Root',
|
16
14
|
atrule: 'AtRule',
|
17
|
-
|
15
|
+
comment: 'Comment',
|
18
16
|
decl: 'Declaration',
|
19
|
-
|
17
|
+
document: 'Document',
|
18
|
+
root: 'Root',
|
19
|
+
rule: 'Rule'
|
20
20
|
}
|
21
21
|
|
22
22
|
const PLUGIN_PROPS = {
|
23
|
-
postcssPlugin: true,
|
24
|
-
prepare: true,
|
25
|
-
Once: true,
|
26
|
-
Document: true,
|
27
|
-
Root: true,
|
28
|
-
Declaration: true,
|
29
|
-
Rule: true,
|
30
23
|
AtRule: true,
|
31
|
-
Comment: true,
|
32
|
-
DeclarationExit: true,
|
33
|
-
RuleExit: true,
|
34
24
|
AtRuleExit: true,
|
25
|
+
Comment: true,
|
35
26
|
CommentExit: true,
|
36
|
-
|
27
|
+
Declaration: true,
|
28
|
+
DeclarationExit: true,
|
29
|
+
Document: true,
|
37
30
|
DocumentExit: true,
|
38
|
-
|
31
|
+
Once: true,
|
32
|
+
OnceExit: true,
|
33
|
+
postcssPlugin: true,
|
34
|
+
prepare: true,
|
35
|
+
Root: true,
|
36
|
+
RootExit: true,
|
37
|
+
Rule: true,
|
38
|
+
RuleExit: true
|
39
39
|
}
|
40
40
|
|
41
41
|
const NOT_VISITORS = {
|
42
|
+
Once: true,
|
42
43
|
postcssPlugin: true,
|
43
|
-
prepare: true
|
44
|
-
Once: true
|
44
|
+
prepare: true
|
45
45
|
}
|
46
46
|
|
47
47
|
const CHILDREN = 0
|
@@ -87,12 +87,12 @@ function toStack(node) {
|
|
87
87
|
}
|
88
88
|
|
89
89
|
return {
|
90
|
-
node,
|
91
|
-
events,
|
92
90
|
eventIndex: 0,
|
93
|
-
|
91
|
+
events,
|
92
|
+
iterator: 0,
|
93
|
+
node,
|
94
94
|
visitorIndex: 0,
|
95
|
-
|
95
|
+
visitors: []
|
96
96
|
}
|
97
97
|
}
|
98
98
|
|
@@ -137,13 +137,13 @@ class LazyResult {
|
|
137
137
|
}
|
138
138
|
|
139
139
|
if (root && !root[my]) {
|
140
|
-
|
140
|
+
/* c8 ignore next 2 */
|
141
141
|
Container.rebuild(root)
|
142
142
|
}
|
143
143
|
}
|
144
144
|
|
145
145
|
this.result = new Result(processor, root, opts)
|
146
|
-
this.helpers = { ...postcss, result: this.result
|
146
|
+
this.helpers = { ...postcss, postcss, result: this.result }
|
147
147
|
this.plugins = this.processor.plugins.map(plugin => {
|
148
148
|
if (typeof plugin === 'object' && plugin.prepare) {
|
149
149
|
return { ...plugin, ...plugin.prepare(this.result) }
|
@@ -153,67 +153,6 @@ class LazyResult {
|
|
153
153
|
})
|
154
154
|
}
|
155
155
|
|
156
|
-
get [Symbol.toStringTag]() {
|
157
|
-
return 'LazyResult'
|
158
|
-
}
|
159
|
-
|
160
|
-
get processor() {
|
161
|
-
return this.result.processor
|
162
|
-
}
|
163
|
-
|
164
|
-
get opts() {
|
165
|
-
return this.result.opts
|
166
|
-
}
|
167
|
-
|
168
|
-
get css() {
|
169
|
-
return this.stringify().css
|
170
|
-
}
|
171
|
-
|
172
|
-
get content() {
|
173
|
-
return this.stringify().content
|
174
|
-
}
|
175
|
-
|
176
|
-
get map() {
|
177
|
-
return this.stringify().map
|
178
|
-
}
|
179
|
-
|
180
|
-
get root() {
|
181
|
-
return this.sync().root
|
182
|
-
}
|
183
|
-
|
184
|
-
get messages() {
|
185
|
-
return this.sync().messages
|
186
|
-
}
|
187
|
-
|
188
|
-
warnings() {
|
189
|
-
return this.sync().warnings()
|
190
|
-
}
|
191
|
-
|
192
|
-
toString() {
|
193
|
-
return this.css
|
194
|
-
}
|
195
|
-
|
196
|
-
then(onFulfilled, onRejected) {
|
197
|
-
if (process.env.NODE_ENV !== 'production') {
|
198
|
-
if (!('from' in this.opts)) {
|
199
|
-
warnOnce(
|
200
|
-
'Without `from` option PostCSS could generate wrong source map ' +
|
201
|
-
'and will not find Browserslist config. Set it to CSS file path ' +
|
202
|
-
'or to `undefined` to prevent this warning.'
|
203
|
-
)
|
204
|
-
}
|
205
|
-
}
|
206
|
-
return this.async().then(onFulfilled, onRejected)
|
207
|
-
}
|
208
|
-
|
209
|
-
catch(onRejected) {
|
210
|
-
return this.async().catch(onRejected)
|
211
|
-
}
|
212
|
-
|
213
|
-
finally(onFinally) {
|
214
|
-
return this.async().then(onFinally, onFinally)
|
215
|
-
}
|
216
|
-
|
217
156
|
async() {
|
218
157
|
if (this.error) return Promise.reject(this.error)
|
219
158
|
if (this.processed) return Promise.resolve(this.result)
|
@@ -223,124 +162,12 @@ class LazyResult {
|
|
223
162
|
return this.processing
|
224
163
|
}
|
225
164
|
|
226
|
-
|
227
|
-
|
228
|
-
if (this.processed) return this.result
|
229
|
-
this.processed = true
|
230
|
-
|
231
|
-
if (this.processing) {
|
232
|
-
throw this.getAsyncError()
|
233
|
-
}
|
234
|
-
|
235
|
-
for (let plugin of this.plugins) {
|
236
|
-
let promise = this.runOnRoot(plugin)
|
237
|
-
if (isPromise(promise)) {
|
238
|
-
throw this.getAsyncError()
|
239
|
-
}
|
240
|
-
}
|
241
|
-
|
242
|
-
this.prepareVisitors()
|
243
|
-
if (this.hasListener) {
|
244
|
-
let root = this.result.root
|
245
|
-
while (!root[isClean]) {
|
246
|
-
root[isClean] = true
|
247
|
-
this.walkSync(root)
|
248
|
-
}
|
249
|
-
if (this.listeners.OnceExit) {
|
250
|
-
if (root.type === 'document') {
|
251
|
-
for (let subRoot of root.nodes) {
|
252
|
-
this.visitSync(this.listeners.OnceExit, subRoot)
|
253
|
-
}
|
254
|
-
} else {
|
255
|
-
this.visitSync(this.listeners.OnceExit, root)
|
256
|
-
}
|
257
|
-
}
|
258
|
-
}
|
259
|
-
|
260
|
-
return this.result
|
261
|
-
}
|
262
|
-
|
263
|
-
stringify() {
|
264
|
-
if (this.error) throw this.error
|
265
|
-
if (this.stringified) return this.result
|
266
|
-
this.stringified = true
|
267
|
-
|
268
|
-
this.sync()
|
269
|
-
|
270
|
-
let opts = this.result.opts
|
271
|
-
let str = stringify
|
272
|
-
if (opts.syntax) str = opts.syntax.stringify
|
273
|
-
if (opts.stringifier) str = opts.stringifier
|
274
|
-
if (str.stringify) str = str.stringify
|
275
|
-
|
276
|
-
let map = new MapGenerator(str, this.result.root, this.result.opts)
|
277
|
-
let data = map.generate()
|
278
|
-
this.result.css = data[0]
|
279
|
-
this.result.map = data[1]
|
280
|
-
|
281
|
-
return this.result
|
282
|
-
}
|
283
|
-
|
284
|
-
walkSync(node) {
|
285
|
-
node[isClean] = true
|
286
|
-
let events = getEvents(node)
|
287
|
-
for (let event of events) {
|
288
|
-
if (event === CHILDREN) {
|
289
|
-
if (node.nodes) {
|
290
|
-
node.each(child => {
|
291
|
-
if (!child[isClean]) this.walkSync(child)
|
292
|
-
})
|
293
|
-
}
|
294
|
-
} else {
|
295
|
-
let visitors = this.listeners[event]
|
296
|
-
if (visitors) {
|
297
|
-
if (this.visitSync(visitors, node.toProxy())) return
|
298
|
-
}
|
299
|
-
}
|
300
|
-
}
|
301
|
-
}
|
302
|
-
|
303
|
-
visitSync(visitors, node) {
|
304
|
-
for (let [plugin, visitor] of visitors) {
|
305
|
-
this.result.lastPlugin = plugin
|
306
|
-
let promise
|
307
|
-
try {
|
308
|
-
promise = visitor(node, this.helpers)
|
309
|
-
} catch (e) {
|
310
|
-
throw this.handleError(e, node.proxyOf)
|
311
|
-
}
|
312
|
-
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
|
313
|
-
return true
|
314
|
-
}
|
315
|
-
if (isPromise(promise)) {
|
316
|
-
throw this.getAsyncError()
|
317
|
-
}
|
318
|
-
}
|
165
|
+
catch(onRejected) {
|
166
|
+
return this.async().catch(onRejected)
|
319
167
|
}
|
320
168
|
|
321
|
-
|
322
|
-
this.
|
323
|
-
try {
|
324
|
-
if (typeof plugin === 'object' && plugin.Once) {
|
325
|
-
if (this.result.root.type === 'document') {
|
326
|
-
let roots = this.result.root.nodes.map(root =>
|
327
|
-
plugin.Once(root, this.helpers)
|
328
|
-
)
|
329
|
-
|
330
|
-
if (isPromise(roots[0])) {
|
331
|
-
return Promise.all(roots)
|
332
|
-
}
|
333
|
-
|
334
|
-
return roots
|
335
|
-
}
|
336
|
-
|
337
|
-
return plugin.Once(this.result.root, this.helpers)
|
338
|
-
} else if (typeof plugin === 'function') {
|
339
|
-
return plugin(this.result.root, this.result)
|
340
|
-
}
|
341
|
-
} catch (error) {
|
342
|
-
throw this.handleError(error)
|
343
|
-
}
|
169
|
+
finally(onFinally) {
|
170
|
+
return this.async().then(onFinally, onFinally)
|
344
171
|
}
|
345
172
|
|
346
173
|
getAsyncError() {
|
@@ -364,6 +191,7 @@ class LazyResult {
|
|
364
191
|
let b = runtimeVer.split('.')
|
365
192
|
|
366
193
|
if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
|
194
|
+
// eslint-disable-next-line no-console
|
367
195
|
console.error(
|
368
196
|
'Unknown error from PostCSS plugin. Your current PostCSS ' +
|
369
197
|
'version is ' +
|
@@ -378,12 +206,51 @@ class LazyResult {
|
|
378
206
|
}
|
379
207
|
}
|
380
208
|
} catch (err) {
|
381
|
-
|
209
|
+
/* c8 ignore next 3 */
|
210
|
+
// eslint-disable-next-line no-console
|
382
211
|
if (console && console.error) console.error(err)
|
383
212
|
}
|
384
213
|
return error
|
385
214
|
}
|
386
215
|
|
216
|
+
prepareVisitors() {
|
217
|
+
this.listeners = {}
|
218
|
+
let add = (plugin, type, cb) => {
|
219
|
+
if (!this.listeners[type]) this.listeners[type] = []
|
220
|
+
this.listeners[type].push([plugin, cb])
|
221
|
+
}
|
222
|
+
for (let plugin of this.plugins) {
|
223
|
+
if (typeof plugin === 'object') {
|
224
|
+
for (let event in plugin) {
|
225
|
+
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
226
|
+
throw new Error(
|
227
|
+
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
|
228
|
+
`Try to update PostCSS (${this.processor.version} now).`
|
229
|
+
)
|
230
|
+
}
|
231
|
+
if (!NOT_VISITORS[event]) {
|
232
|
+
if (typeof plugin[event] === 'object') {
|
233
|
+
for (let filter in plugin[event]) {
|
234
|
+
if (filter === '*') {
|
235
|
+
add(plugin, event, plugin[event][filter])
|
236
|
+
} else {
|
237
|
+
add(
|
238
|
+
plugin,
|
239
|
+
event + '-' + filter.toLowerCase(),
|
240
|
+
plugin[event][filter]
|
241
|
+
)
|
242
|
+
}
|
243
|
+
}
|
244
|
+
} else if (typeof plugin[event] === 'function') {
|
245
|
+
add(plugin, event, plugin[event])
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
this.hasListener = Object.keys(this.listeners).length > 0
|
252
|
+
}
|
253
|
+
|
387
254
|
async runAsync() {
|
388
255
|
this.plugin = 0
|
389
256
|
for (let i = 0; i < this.plugins.length; i++) {
|
@@ -441,42 +308,122 @@ class LazyResult {
|
|
441
308
|
return this.stringify()
|
442
309
|
}
|
443
310
|
|
444
|
-
|
445
|
-
this.
|
446
|
-
|
447
|
-
if (
|
448
|
-
|
311
|
+
runOnRoot(plugin) {
|
312
|
+
this.result.lastPlugin = plugin
|
313
|
+
try {
|
314
|
+
if (typeof plugin === 'object' && plugin.Once) {
|
315
|
+
if (this.result.root.type === 'document') {
|
316
|
+
let roots = this.result.root.nodes.map(root =>
|
317
|
+
plugin.Once(root, this.helpers)
|
318
|
+
)
|
319
|
+
|
320
|
+
if (isPromise(roots[0])) {
|
321
|
+
return Promise.all(roots)
|
322
|
+
}
|
323
|
+
|
324
|
+
return roots
|
325
|
+
}
|
326
|
+
|
327
|
+
return plugin.Once(this.result.root, this.helpers)
|
328
|
+
} else if (typeof plugin === 'function') {
|
329
|
+
return plugin(this.result.root, this.result)
|
330
|
+
}
|
331
|
+
} catch (error) {
|
332
|
+
throw this.handleError(error)
|
449
333
|
}
|
334
|
+
}
|
335
|
+
|
336
|
+
stringify() {
|
337
|
+
if (this.error) throw this.error
|
338
|
+
if (this.stringified) return this.result
|
339
|
+
this.stringified = true
|
340
|
+
|
341
|
+
this.sync()
|
342
|
+
|
343
|
+
let opts = this.result.opts
|
344
|
+
let str = stringify
|
345
|
+
if (opts.syntax) str = opts.syntax.stringify
|
346
|
+
if (opts.stringifier) str = opts.stringifier
|
347
|
+
if (str.stringify) str = str.stringify
|
348
|
+
|
349
|
+
let map = new MapGenerator(str, this.result.root, this.result.opts)
|
350
|
+
let data = map.generate()
|
351
|
+
this.result.css = data[0]
|
352
|
+
this.result.map = data[1]
|
353
|
+
|
354
|
+
return this.result
|
355
|
+
}
|
356
|
+
|
357
|
+
sync() {
|
358
|
+
if (this.error) throw this.error
|
359
|
+
if (this.processed) return this.result
|
360
|
+
this.processed = true
|
361
|
+
|
362
|
+
if (this.processing) {
|
363
|
+
throw this.getAsyncError()
|
364
|
+
}
|
365
|
+
|
450
366
|
for (let plugin of this.plugins) {
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
plugin[event][filter]
|
469
|
-
)
|
470
|
-
}
|
471
|
-
}
|
472
|
-
} else if (typeof plugin[event] === 'function') {
|
473
|
-
add(plugin, event, plugin[event])
|
474
|
-
}
|
367
|
+
let promise = this.runOnRoot(plugin)
|
368
|
+
if (isPromise(promise)) {
|
369
|
+
throw this.getAsyncError()
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
373
|
+
this.prepareVisitors()
|
374
|
+
if (this.hasListener) {
|
375
|
+
let root = this.result.root
|
376
|
+
while (!root[isClean]) {
|
377
|
+
root[isClean] = true
|
378
|
+
this.walkSync(root)
|
379
|
+
}
|
380
|
+
if (this.listeners.OnceExit) {
|
381
|
+
if (root.type === 'document') {
|
382
|
+
for (let subRoot of root.nodes) {
|
383
|
+
this.visitSync(this.listeners.OnceExit, subRoot)
|
475
384
|
}
|
385
|
+
} else {
|
386
|
+
this.visitSync(this.listeners.OnceExit, root)
|
476
387
|
}
|
477
388
|
}
|
478
389
|
}
|
479
|
-
|
390
|
+
|
391
|
+
return this.result
|
392
|
+
}
|
393
|
+
|
394
|
+
then(onFulfilled, onRejected) {
|
395
|
+
if (process.env.NODE_ENV !== 'production') {
|
396
|
+
if (!('from' in this.opts)) {
|
397
|
+
warnOnce(
|
398
|
+
'Without `from` option PostCSS could generate wrong source map ' +
|
399
|
+
'and will not find Browserslist config. Set it to CSS file path ' +
|
400
|
+
'or to `undefined` to prevent this warning.'
|
401
|
+
)
|
402
|
+
}
|
403
|
+
}
|
404
|
+
return this.async().then(onFulfilled, onRejected)
|
405
|
+
}
|
406
|
+
|
407
|
+
toString() {
|
408
|
+
return this.css
|
409
|
+
}
|
410
|
+
|
411
|
+
visitSync(visitors, node) {
|
412
|
+
for (let [plugin, visitor] of visitors) {
|
413
|
+
this.result.lastPlugin = plugin
|
414
|
+
let promise
|
415
|
+
try {
|
416
|
+
promise = visitor(node, this.helpers)
|
417
|
+
} catch (e) {
|
418
|
+
throw this.handleError(e, node.proxyOf)
|
419
|
+
}
|
420
|
+
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
|
421
|
+
return true
|
422
|
+
}
|
423
|
+
if (isPromise(promise)) {
|
424
|
+
throw this.getAsyncError()
|
425
|
+
}
|
426
|
+
}
|
480
427
|
}
|
481
428
|
|
482
429
|
visitTick(stack) {
|
@@ -535,6 +482,61 @@ class LazyResult {
|
|
535
482
|
}
|
536
483
|
stack.pop()
|
537
484
|
}
|
485
|
+
|
486
|
+
walkSync(node) {
|
487
|
+
node[isClean] = true
|
488
|
+
let events = getEvents(node)
|
489
|
+
for (let event of events) {
|
490
|
+
if (event === CHILDREN) {
|
491
|
+
if (node.nodes) {
|
492
|
+
node.each(child => {
|
493
|
+
if (!child[isClean]) this.walkSync(child)
|
494
|
+
})
|
495
|
+
}
|
496
|
+
} else {
|
497
|
+
let visitors = this.listeners[event]
|
498
|
+
if (visitors) {
|
499
|
+
if (this.visitSync(visitors, node.toProxy())) return
|
500
|
+
}
|
501
|
+
}
|
502
|
+
}
|
503
|
+
}
|
504
|
+
|
505
|
+
warnings() {
|
506
|
+
return this.sync().warnings()
|
507
|
+
}
|
508
|
+
|
509
|
+
get content() {
|
510
|
+
return this.stringify().content
|
511
|
+
}
|
512
|
+
|
513
|
+
get css() {
|
514
|
+
return this.stringify().css
|
515
|
+
}
|
516
|
+
|
517
|
+
get map() {
|
518
|
+
return this.stringify().map
|
519
|
+
}
|
520
|
+
|
521
|
+
get messages() {
|
522
|
+
return this.sync().messages
|
523
|
+
}
|
524
|
+
|
525
|
+
get opts() {
|
526
|
+
return this.result.opts
|
527
|
+
}
|
528
|
+
|
529
|
+
get processor() {
|
530
|
+
return this.result.processor
|
531
|
+
}
|
532
|
+
|
533
|
+
get root() {
|
534
|
+
return this.sync().root
|
535
|
+
}
|
536
|
+
|
537
|
+
get [Symbol.toStringTag]() {
|
538
|
+
return 'LazyResult'
|
539
|
+
}
|
538
540
|
}
|
539
541
|
|
540
542
|
LazyResult.registerPostcss = dependant => {
|
package/lib/list.d.ts
CHANGED
@@ -1,51 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
* Safely splits space-separated values (such as those for `background`,
|
19
|
-
* `border-radius`, and other shorthand properties).
|
20
|
-
*
|
21
|
-
* ```js
|
22
|
-
* Once (root, { list }) {
|
23
|
-
* list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
|
24
|
-
* }
|
25
|
-
* ```
|
26
|
-
*
|
27
|
-
* @param str Space-separated values.
|
28
|
-
* @return Split values.
|
29
|
-
*/
|
30
|
-
space(str: string): string[]
|
1
|
+
declare namespace list {
|
2
|
+
type List = {
|
3
|
+
/**
|
4
|
+
* Safely splits comma-separated values (such as those for `transition-*`
|
5
|
+
* and `background` properties).
|
6
|
+
*
|
7
|
+
* ```js
|
8
|
+
* Once (root, { list }) {
|
9
|
+
* list.comma('black, linear-gradient(white, black)')
|
10
|
+
* //=> ['black', 'linear-gradient(white, black)']
|
11
|
+
* }
|
12
|
+
* ```
|
13
|
+
*
|
14
|
+
* @param str Comma-separated values.
|
15
|
+
* @return Split values.
|
16
|
+
*/
|
17
|
+
comma(str: string): string[]
|
31
18
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
19
|
+
default: List
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Safely splits space-separated values (such as those for `background`,
|
23
|
+
* `border-radius`, and other shorthand properties).
|
24
|
+
*
|
25
|
+
* ```js
|
26
|
+
* Once (root, { list }) {
|
27
|
+
* list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
|
28
|
+
* }
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* @param str Space-separated values.
|
32
|
+
* @return Split values.
|
33
|
+
*/
|
34
|
+
space(str: string): string[]
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Safely splits values.
|
38
|
+
*
|
39
|
+
* ```js
|
40
|
+
* Once (root, { list }) {
|
41
|
+
* list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
|
42
|
+
* }
|
43
|
+
* ```
|
44
|
+
*
|
45
|
+
* @param string separated values.
|
46
|
+
* @param separators array of separators.
|
47
|
+
* @param last boolean indicator.
|
48
|
+
* @return Split values.
|
49
|
+
*/
|
50
|
+
split(string: string, separators: string[], last: boolean): string[]
|
51
|
+
}
|
47
52
|
}
|
48
53
|
|
49
|
-
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
55
|
+
declare const list: list.List
|
50
56
|
|
51
|
-
export
|
57
|
+
export = list
|