@histoire/vendors 0.15.8 → 0.16.5

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.
Files changed (88) hide show
  1. package/dist/client/b-floating-vue.js +2 -7
  2. package/dist/client/b-pinia.js +1970 -1953
  3. package/dist/client/b-vue-router.js +3574 -3550
  4. package/dist/client/b-vue-use.js +426 -360
  5. package/dist/client/b-vue.js +1 -1
  6. package/dist/client/node_modules/@babel/parser/package.json +6 -6
  7. package/dist/client/node_modules/@babel/parser/typings/babel-parser.d.ts +16 -2
  8. package/dist/client/node_modules/{sourcemap-codec → @jridgewell/sourcemap-codec}/dist/types/sourcemap-codec.d.ts +1 -0
  9. package/dist/client/node_modules/@jridgewell/sourcemap-codec/package.json +74 -0
  10. package/dist/client/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +992 -1202
  11. package/dist/client/node_modules/@vue/compiler-core/package.json +6 -6
  12. package/dist/client/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +42 -66
  13. package/dist/client/node_modules/@vue/compiler-dom/package.json +4 -4
  14. package/dist/client/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +473 -317
  15. package/dist/client/node_modules/@vue/compiler-sfc/package.json +16 -15
  16. package/dist/client/node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts +4 -6
  17. package/dist/client/node_modules/@vue/compiler-ssr/package.json +4 -4
  18. package/dist/client/node_modules/@vue/reactivity/dist/reactivity.d.ts +676 -351
  19. package/dist/client/node_modules/@vue/reactivity/package.json +3 -3
  20. package/dist/client/node_modules/@vue/reactivity-transform/dist/reactivity-transform.d.ts +34 -44
  21. package/dist/client/node_modules/@vue/reactivity-transform/package.json +8 -8
  22. package/dist/client/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +1742 -2015
  23. package/dist/client/node_modules/@vue/runtime-core/package.json +4 -4
  24. package/dist/client/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +1168 -1427
  25. package/dist/client/node_modules/@vue/runtime-dom/package.json +5 -5
  26. package/dist/client/node_modules/@vue/server-renderer/dist/server-renderer.d.ts +71 -101
  27. package/dist/client/node_modules/@vue/server-renderer/package.json +5 -5
  28. package/dist/client/node_modules/@vue/shared/dist/shared.d.ts +308 -363
  29. package/dist/client/node_modules/@vue/shared/package.json +2 -2
  30. package/dist/client/node_modules/@vueuse/core/index.d.ts +28 -13
  31. package/dist/client/node_modules/@vueuse/core/node_modules/vue-demi/package.json +3 -3
  32. package/dist/client/node_modules/@vueuse/core/package.json +3 -3
  33. package/dist/client/node_modules/@vueuse/metadata/package.json +1 -1
  34. package/dist/client/node_modules/@vueuse/shared/index.d.ts +18 -5
  35. package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/package.json +3 -3
  36. package/dist/client/node_modules/@vueuse/shared/package.json +1 -1
  37. package/dist/client/node_modules/csstype/index.d.ts +5009 -21819
  38. package/dist/client/node_modules/csstype/package.json +35 -25
  39. package/dist/client/node_modules/floating-vue/dist/components/Popper.d.ts +0 -7
  40. package/dist/client/node_modules/floating-vue/dist/components/Popper.vue.d.ts +0 -7
  41. package/dist/client/node_modules/floating-vue/dist/index.d.ts +0 -7
  42. package/dist/client/node_modules/floating-vue/package.json +3 -2
  43. package/dist/client/node_modules/magic-string/{index.d.ts → dist/magic-string.cjs.d.ts} +50 -7
  44. package/dist/client/node_modules/magic-string/package.json +34 -22
  45. package/dist/client/node_modules/nanoid/package.json +7 -1
  46. package/dist/client/node_modules/pinia/dist/pinia.d.ts +17 -5
  47. package/dist/client/node_modules/pinia/node_modules/vue-demi/package.json +3 -3
  48. package/dist/client/node_modules/pinia/package.json +7 -7
  49. package/dist/client/node_modules/postcss/lib/at-rule.d.ts +58 -49
  50. package/dist/client/node_modules/postcss/lib/comment.d.ts +43 -32
  51. package/dist/client/node_modules/postcss/lib/container.d.ts +224 -214
  52. package/dist/client/node_modules/postcss/lib/css-syntax-error.d.ts +111 -102
  53. package/dist/client/node_modules/postcss/lib/declaration.d.ts +85 -61
  54. package/dist/client/node_modules/postcss/lib/document.d.ts +27 -16
  55. package/dist/client/node_modules/postcss/lib/fromJSON.d.ts +6 -2
  56. package/dist/client/node_modules/postcss/lib/input.d.ts +99 -90
  57. package/dist/client/node_modules/postcss/lib/lazy-result.d.ts +69 -55
  58. package/dist/client/node_modules/postcss/lib/list.d.ts +53 -47
  59. package/dist/client/node_modules/postcss/lib/no-work-result.d.ts +24 -15
  60. package/dist/client/node_modules/postcss/lib/node.d.ts +339 -281
  61. package/dist/client/node_modules/postcss/lib/parse.d.ts +6 -2
  62. package/dist/client/node_modules/postcss/lib/postcss.d.ts +288 -320
  63. package/dist/client/node_modules/postcss/lib/previous-map.d.ts +23 -14
  64. package/dist/client/node_modules/postcss/lib/processor.d.ts +52 -39
  65. package/dist/client/node_modules/postcss/lib/result.d.ts +77 -67
  66. package/dist/client/node_modules/postcss/lib/root.d.ts +49 -36
  67. package/dist/client/node_modules/postcss/lib/rule.d.ts +54 -45
  68. package/dist/client/node_modules/postcss/lib/stringifier.d.ts +31 -22
  69. package/dist/client/node_modules/postcss/lib/stringify.d.ts +6 -2
  70. package/dist/client/node_modules/postcss/lib/warning.d.ts +72 -63
  71. package/dist/client/node_modules/postcss/package.json +7 -4
  72. package/dist/client/node_modules/vue/compiler-sfc/package.json +2 -3
  73. package/dist/client/node_modules/vue/dist/vue.d.ts +11 -9
  74. package/dist/client/node_modules/vue/jsx-runtime/index.d.ts +29 -0
  75. package/dist/client/node_modules/vue/jsx-runtime/package.json +5 -0
  76. package/dist/client/node_modules/vue/jsx.d.ts +26 -0
  77. package/dist/client/node_modules/vue/package.json +41 -15
  78. package/dist/client/node_modules/vue/ref-macros.d.ts +1 -1
  79. package/dist/client/node_modules/vue/server-renderer/package.json +2 -3
  80. package/dist/client/node_modules/vue-router/dist/vue-router.d.ts +2 -1
  81. package/dist/client/node_modules/vue-router/package.json +38 -36
  82. package/dist/client/vue.runtime.esm-bundler.js +10048 -10684
  83. package/package.json +13 -13
  84. package/rollup.config.mjs +1 -1
  85. package/tsconfig.json +1 -2
  86. package/dist/client/node_modules/source-map/package.json +0 -73
  87. package/dist/client/node_modules/source-map/source-map.d.ts +0 -98
  88. package/dist/client/node_modules/sourcemap-codec/package.json +0 -53
@@ -1,291 +1,296 @@
1
- import Declaration, { DeclarationProps } from './declaration.js'
1
+ import AtRule = require('./at-rule.js')
2
+
3
+ import { AtRuleProps } from './at-rule.js'
2
4
  import Comment, { CommentProps } from './comment.js'
3
- import { Stringifier, Syntax } from './postcss.js'
4
- import AtRule, { AtRuleProps } from './at-rule.js'
5
- import Rule, { RuleProps } from './rule.js'
6
- import Warning, { WarningOptions } from './warning.js'
5
+ import Container from './container.js'
7
6
  import CssSyntaxError from './css-syntax-error.js'
8
- import Result from './result.js'
7
+ import Declaration, { DeclarationProps } from './declaration.js'
8
+ import Document from './document.js'
9
9
  import Input from './input.js'
10
+ import { Stringifier, Syntax } from './postcss.js'
11
+ import Result from './result.js'
10
12
  import Root from './root.js'
11
- import Document from './document.js'
12
- import Container from './container.js'
13
-
14
- export type ChildNode = AtRule | Rule | Declaration | Comment
15
-
16
- export type AnyNode = AtRule | Rule | Declaration | Comment | Root | Document
17
-
18
- export type ChildProps =
19
- | AtRuleProps
20
- | RuleProps
21
- | DeclarationProps
22
- | CommentProps
23
-
24
- export interface Position {
25
- /**
26
- * Source offset in file. It starts from 0.
27
- */
28
- offset: number
29
-
30
- /**
31
- * Source line in file. In contrast to `offset` it starts from 1.
32
- */
33
- column: number
34
-
35
- /**
36
- * Source column in file.
37
- */
38
- line: number
39
- }
40
-
41
- export interface Range {
42
- /**
43
- * Start position, inclusive.
44
- */
45
- start: Position
46
-
47
- /**
48
- * End position, exclusive.
49
- */
50
- end: Position
51
- }
52
-
53
- export interface Source {
54
- /**
55
- * The file source of the node.
56
- */
57
- input: Input
58
- /**
59
- * The inclusive starting position of the node’s source.
60
- */
61
- start?: Position
62
- /**
63
- * The inclusive ending position of the node's source.
64
- */
65
- end?: Position
66
- }
67
-
68
- export interface NodeProps {
69
- source?: Source
70
- }
13
+ import Rule, { RuleProps } from './rule.js'
14
+ import Warning, { WarningOptions } from './warning.js'
71
15
 
72
- interface NodeErrorOptions {
73
- /**
74
- * Plugin name that created this error. PostCSS will set it automatically.
75
- */
76
- plugin?: string
77
- /**
78
- * A word inside a node's string, that should be highlighted as source
79
- * of error.
80
- */
81
- word?: string
82
- /**
83
- * An index inside a node's string that should be highlighted as source
84
- * of error.
85
- */
86
- index?: number
87
- /**
88
- * An ending index inside a node's string that should be highlighted as
89
- * source of error.
90
- */
91
- endIndex?: number
16
+ declare namespace Node {
17
+ export type ChildNode = AtRule.default | Comment | Declaration | Rule
18
+
19
+ export type AnyNode =
20
+ | AtRule.default
21
+ | Comment
22
+ | Declaration
23
+ | Document
24
+ | Root
25
+ | Rule
26
+
27
+ export type ChildProps =
28
+ | AtRuleProps
29
+ | CommentProps
30
+ | DeclarationProps
31
+ | RuleProps
32
+
33
+ export interface Position {
34
+ /**
35
+ * Source line in file. In contrast to `offset` it starts from 1.
36
+ */
37
+ column: number
38
+
39
+ /**
40
+ * Source column in file.
41
+ */
42
+ line: number
43
+
44
+ /**
45
+ * Source offset in file. It starts from 0.
46
+ */
47
+ offset: number
48
+ }
49
+
50
+ export interface Range {
51
+ /**
52
+ * End position, exclusive.
53
+ */
54
+ end: Position
55
+
56
+ /**
57
+ * Start position, inclusive.
58
+ */
59
+ start: Position
60
+ }
61
+
62
+ /**
63
+ * Source represents an interface for the {@link Node.source} property.
64
+ */
65
+ export interface Source {
66
+ /**
67
+ * The inclusive ending position for the source
68
+ * code of a node.
69
+ */
70
+ end?: Position
71
+
72
+ /**
73
+ * The source file from where a node has originated.
74
+ */
75
+ input: Input
76
+
77
+ /**
78
+ * The inclusive starting position for the source
79
+ * code of a node.
80
+ */
81
+ start?: Position
82
+ }
83
+
84
+ /**
85
+ * Interface represents an interface for an object received
86
+ * as parameter by Node class constructor.
87
+ */
88
+ export interface NodeProps {
89
+ source?: Source
90
+ }
91
+
92
+ export interface NodeErrorOptions {
93
+ /**
94
+ * An ending index inside a node's string that should be highlighted as
95
+ * source of error.
96
+ */
97
+ endIndex?: number
98
+ /**
99
+ * An index inside a node's string that should be highlighted as source
100
+ * of error.
101
+ */
102
+ index?: number
103
+ /**
104
+ * Plugin name that created this error. PostCSS will set it automatically.
105
+ */
106
+ plugin?: string
107
+ /**
108
+ * A word inside a node's string, that should be highlighted as source
109
+ * of error.
110
+ */
111
+ word?: string
112
+ }
113
+
114
+ // eslint-disable-next-line @typescript-eslint/no-shadow
115
+ class Node extends Node_ {}
116
+ export { Node as default }
92
117
  }
93
118
 
94
119
  /**
95
- * All node classes inherit the following common methods.
120
+ * It represents an abstract class that handles common
121
+ * methods for other CSS abstract syntax tree nodes.
96
122
  *
97
- * You should not extend this classes to create AST for selector or value
98
- * parser.
123
+ * Any node that represents CSS selector or value should
124
+ * not extend the `Node` class.
99
125
  */
100
- export default abstract class Node {
126
+ declare abstract class Node_ {
101
127
  /**
102
- * tring representing the node’s type. Possible values are `root`, `atrule`,
103
- * `rule`, `decl`, or `comment`.
128
+ * It represents parent of the current node.
104
129
  *
105
130
  * ```js
106
- * new Declaration({ prop: 'color', value: 'black' }).type //=> 'decl'
131
+ * root.nodes[0].parent === root //=> true
107
132
  * ```
108
133
  */
109
- type: string
134
+ parent: Container | Document | undefined
110
135
 
111
136
  /**
112
- * The node’s parent node.
137
+ * It represents unnecessary whitespace and characters present
138
+ * in the css source code.
139
+ *
140
+ * Information to generate byte-to-byte equal node string as it was
141
+ * in the origin input.
142
+ *
143
+ * The properties of the raws object are decided by parser,
144
+ * the default parser uses the following properties:
145
+ *
146
+ * * `before`: the space symbols before the node. It also stores `*`
147
+ * and `_` symbols before the declaration (IE hack).
148
+ * * `after`: the space symbols after the last child of the node
149
+ * to the end of the node.
150
+ * * `between`: the symbols between the property and value
151
+ * for declarations, selector and `{` for rules, or last parameter
152
+ * and `{` for at-rules.
153
+ * * `semicolon`: contains true if the last child has
154
+ * an (optional) semicolon.
155
+ * * `afterName`: the space between the at-rule name and its parameters.
156
+ * * `left`: the space symbols between `/*` and the comment’s text.
157
+ * * `right`: the space symbols between the comment’s text
158
+ * and <code>*&#47;</code>.
159
+ * - `important`: the content of the important statement,
160
+ * if it is not just `!important`.
161
+ *
162
+ * PostCSS filters out the comments inside selectors, declaration values
163
+ * and at-rule parameters but it stores the origin content in raws.
113
164
  *
114
165
  * ```js
115
- * root.nodes[0].parent === root
166
+ * const root = postcss.parse('a {\n color:black\n}')
167
+ * root.first.first.raws //=> { before: '\n ', between: ':' }
116
168
  * ```
117
169
  */
118
- parent: Document | Container | undefined
170
+ raws: any
119
171
 
120
172
  /**
121
- * The input source of the node.
173
+ * It represents information related to origin of a node and is required
174
+ * for generating source maps.
122
175
  *
123
- * The property is used in source map generation.
176
+ * The nodes that are created manually using the public APIs
177
+ * provided by PostCSS will have `source` undefined and
178
+ * will be absent in the source map.
124
179
  *
125
- * If you create a node manually (e.g., with `postcss.decl()`),
126
- * that node will not have a `source` property and will be absent
127
- * from the source map. For this reason, the plugin developer should
128
- * consider cloning nodes to create new ones (in which case the new node’s
129
- * source will reference the original, cloned node) or setting
130
- * the `source` property manually.
180
+ * For this reason, the plugin developer should consider
181
+ * duplicating nodes as the duplicate node will have the
182
+ * same source as the original node by default or assign
183
+ * source to a node created manually.
131
184
  *
132
185
  * ```js
133
- * decl.source.input.from //=> '/home/ai/a.sass'
186
+ * decl.source.input.from //=> '/home/ai/source.css'
134
187
  * decl.source.start //=> { line: 10, column: 2 }
135
188
  * decl.source.end //=> { line: 10, column: 12 }
136
189
  * ```
137
190
  *
138
191
  * ```js
139
- * // Bad
192
+ * // Incorrect method, source not specified!
140
193
  * const prefixed = postcss.decl({
141
194
  * prop: '-moz-' + decl.prop,
142
195
  * value: decl.value
143
196
  * })
144
197
  *
145
- * // Good
146
- * const prefixed = decl.clone({ prop: '-moz-' + decl.prop })
198
+ * // Correct method, source is inherited when duplicating.
199
+ * const prefixed = decl.clone({
200
+ * prop: '-moz-' + decl.prop
201
+ * })
147
202
  * ```
148
203
  *
149
204
  * ```js
150
205
  * if (atrule.name === 'add-link') {
151
- * const rule = postcss.rule({ selector: 'a', source: atrule.source })
152
- * atrule.parent.insertBefore(atrule, rule)
206
+ * const rule = postcss.rule({
207
+ * selector: 'a',
208
+ * source: atrule.source
209
+ * })
210
+ *
211
+ * atrule.parent.insertBefore(atrule, rule)
153
212
  * }
154
213
  * ```
155
214
  */
156
- source?: Source
215
+ source?: Node.Source
157
216
 
158
217
  /**
159
- * Information to generate byte-to-byte equal node string as it was
160
- * in the origin input.
161
- *
162
- * Every parser saves its own properties,
163
- * but the default CSS parser uses:
164
- *
165
- * * `before`: the space symbols before the node. It also stores `*`
166
- * and `_` symbols before the declaration (IE hack).
167
- * * `after`: the space symbols after the last child of the node
168
- * to the end of the node.
169
- * * `between`: the symbols between the property and value
170
- * for declarations, selector and `{` for rules, or last parameter
171
- * and `{` for at-rules.
172
- * * `semicolon`: contains true if the last child has
173
- * an (optional) semicolon.
174
- * * `afterName`: the space between the at-rule name and its parameters.
175
- * * `left`: the space symbols between `/*` and the comment’s text.
176
- * * `right`: the space symbols between the comment’s text
177
- * and <code>*&#47;</code>.
178
- * * `important`: the content of the important statement,
179
- * if it is not just `!important`.
218
+ * It represents type of a node in
219
+ * an abstract syntax tree.
180
220
  *
181
- * PostCSS cleans selectors, declaration values and at-rule parameters
182
- * from comments and extra spaces, but it stores origin content in raws
183
- * properties. As such, if you don’t change a declaration’s value,
184
- * PostCSS will use the raw value with comments.
221
+ * A type of node helps in identification of a node
222
+ * and perform operation based on it's type.
185
223
  *
186
224
  * ```js
187
- * const root = postcss.parse('a {\n color:black\n}')
188
- * root.first.first.raws //=> { before: '\n ', between: ':' }
225
+ * const declaration = new Declaration({
226
+ * prop: 'color',
227
+ * value: 'black'
228
+ * })
229
+ *
230
+ * declaration.type //=> 'decl'
189
231
  * ```
190
232
  */
191
- raws: any
233
+ type: string
192
234
 
193
- /**
194
- * @param defaults Value for node properties.
195
- */
196
235
  constructor(defaults?: object)
197
236
 
198
237
  /**
199
- * Returns a `CssSyntaxError` instance containing the original position
200
- * of the node in the source, showing line and column numbers and also
201
- * a small excerpt to facilitate debugging.
202
- *
203
- * If present, an input source map will be used to get the original position
204
- * of the source, even from a previous compilation step
205
- * (e.g., from Sass compilation).
238
+ * Insert new node after current node to current node’s parent.
206
239
  *
207
- * This method produces very useful error messages.
240
+ * Just alias for `node.parent.insertAfter(node, add)`.
208
241
  *
209
242
  * ```js
210
- * if (!variables[name]) {
211
- * throw decl.error(`Unknown variable ${name}`, { word: name })
212
- * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black
213
- * // color: $black
214
- * // a
215
- * // ^
216
- * // background: white
217
- * }
243
+ * decl.after('color: black')
218
244
  * ```
219
245
  *
220
- * @param message Error description.
221
- * @param opts Options.
222
- *
223
- * @return Error object to throw it.
246
+ * @param newNode New node.
247
+ * @return This node for methods chain.
224
248
  */
225
- error(message: string, options?: NodeErrorOptions): CssSyntaxError
249
+ after(newNode: Node | Node.ChildProps | Node[] | string): this
226
250
 
227
251
  /**
228
- * This method is provided as a convenience wrapper for `Result#warn`.
252
+ * It assigns properties to an existing node instance.
229
253
  *
230
254
  * ```js
231
- * Declaration: {
232
- * bad: (decl, { result }) => {
233
- * decl.warn(result, 'Deprecated property bad')
234
- * }
235
- * }
255
+ * decl.assign({ prop: 'word-wrap', value: 'break-word' })
236
256
  * ```
237
257
  *
238
- * @param result The `Result` instance that will receive the warning.
239
- * @param text Warning message.
240
- * @param opts Warning Options.
258
+ * @param overrides New properties to override the node.
241
259
  *
242
- * @return Created warning object.
260
+ * @return `this` for method chaining.
243
261
  */
244
- warn(result: Result, text: string, opts?: WarningOptions): Warning
262
+ assign(overrides: object): this
245
263
 
246
264
  /**
247
- * Removes the node from its parent and cleans the parent properties
248
- * from the node and its children.
249
- *
250
- * ```js
251
- * if (decl.prop.match(/^-webkit-/)) {
252
- * decl.remove()
253
- * }
254
- * ```
265
+ * Insert new node before current node to current node’s parent.
255
266
  *
256
- * @return Node to make calls chain.
257
- */
258
- remove(): this
259
-
260
- /**
261
- * Returns a CSS string representing the node.
267
+ * Just alias for `node.parent.insertBefore(node, add)`.
262
268
  *
263
269
  * ```js
264
- * new Rule({ selector: 'a' }).toString() //=> "a {}"
270
+ * decl.before('content: ""')
265
271
  * ```
266
272
  *
267
- * @param stringifier A syntax to use in string generation.
268
- * @return CSS string of this node.
273
+ * @param newNode New node.
274
+ * @return This node for methods chain.
269
275
  */
270
- toString(stringifier?: Stringifier | Syntax): string
276
+ before(newNode: Node | Node.ChildProps | Node[] | string): this
271
277
 
272
278
  /**
273
- * Assigns properties to the current node.
279
+ * Clear the code style properties for the node and its children.
274
280
  *
275
281
  * ```js
276
- * decl.assign({ prop: 'word-wrap', value: 'break-word' })
282
+ * node.raws.before //=> ' '
283
+ * node.cleanRaws()
284
+ * node.raws.before //=> undefined
277
285
  * ```
278
286
  *
279
- * @param overrides New properties to override the node.
280
- * @return Current node to methods chain.
287
+ * @param keepBetween Keep the `raws.between` symbols.
281
288
  */
282
- assign(overrides: object): this
289
+ cleanRaws(keepBetween?: boolean): void
283
290
 
284
291
  /**
285
- * Returns an exact clone of the node.
286
- *
287
- * The resulting cloned node and its (cloned) children will retain
288
- * code style properties.
292
+ * It creates clone of an existing node, which includes all the properties
293
+ * and their values, that includes `raws` but not `type`.
289
294
  *
290
295
  * ```js
291
296
  * decl.raws.before //=> "\n "
@@ -295,9 +300,19 @@ export default abstract class Node {
295
300
  * ```
296
301
  *
297
302
  * @param overrides New properties to override in the clone.
298
- * @return Clone of the node.
303
+ *
304
+ * @return Duplicate of the node instance.
305
+ */
306
+ clone(overrides?: object): Node
307
+
308
+ /**
309
+ * Shortcut to clone the node and insert the resulting cloned node
310
+ * after the current node.
311
+ *
312
+ * @param overrides New properties to override in the clone.
313
+ * @return New node.
299
314
  */
300
- clone(overrides?: object): this
315
+ cloneAfter(overrides?: object): Node
301
316
 
302
317
  /**
303
318
  * Shortcut to clone the node and insert the resulting cloned node
@@ -311,34 +326,43 @@ export default abstract class Node {
311
326
  *
312
327
  * @return New node
313
328
  */
314
- cloneBefore(overrides?: object): this
329
+ cloneBefore(overrides?: object): Node
315
330
 
316
331
  /**
317
- * Shortcut to clone the node and insert the resulting cloned node
318
- * after the current node.
332
+ * It creates an instance of the class `CssSyntaxError` and parameters passed
333
+ * to this method are assigned to the error instance.
319
334
  *
320
- * @param overrides New properties to override in the clone.
321
- * @return New node.
322
- */
323
- cloneAfter(overrides?: object): this
324
-
325
- /**
326
- * Inserts node(s) before the current node and removes the current node.
335
+ * The error instance will have description for the
336
+ * error, original position of the node in the
337
+ * source, showing line and column number.
338
+ *
339
+ * If any previous map is present, it would be used
340
+ * to get original position of the source.
341
+ *
342
+ * The Previous Map here is referred to the source map
343
+ * generated by previous compilation, example: Less,
344
+ * Stylus and Sass.
345
+ *
346
+ * This method returns the error instance instead of
347
+ * throwing it.
327
348
  *
328
349
  * ```js
329
- * AtRule: {
330
- * mixin: atrule => {
331
- * atrule.replaceWith(mixinRules[atrule.params])
332
- * }
350
+ * if (!variables[name]) {
351
+ * throw decl.error(`Unknown variable ${name}`, { word: name })
352
+ * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black
353
+ * // color: $black
354
+ * // a
355
+ * // ^
356
+ * // background: white
333
357
  * }
334
358
  * ```
335
359
  *
336
- * @param nodes Mode(s) to replace current one.
337
- * @return Current node to methods chain.
360
+ * @param message Description for the error instance.
361
+ * @param options Options for the error instance.
362
+ *
363
+ * @return Error instance is returned.
338
364
  */
339
- replaceWith(
340
- ...nodes: (ChildNode | ChildProps | ChildNode[] | ChildProps[])[]
341
- ): this
365
+ error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError
342
366
 
343
367
  /**
344
368
  * Returns the next child of the node’s parent.
@@ -355,7 +379,23 @@ export default abstract class Node {
355
379
  *
356
380
  * @return Next node.
357
381
  */
358
- next(): ChildNode | undefined
382
+ next(): Node.ChildNode | undefined
383
+
384
+ /**
385
+ * Get the position for a word or an index inside the node.
386
+ *
387
+ * @param opts Options.
388
+ * @return Position.
389
+ */
390
+ positionBy(opts?: Pick<WarningOptions, 'index' | 'word'>): Node.Position
391
+
392
+ /**
393
+ * Convert string index to line/column.
394
+ *
395
+ * @param index The symbol number in the node’s string.
396
+ * @return Symbol position in file.
397
+ */
398
+ positionInside(index: number): Node.Position
359
399
 
360
400
  /**
361
401
  * Returns the previous child of the node’s parent.
@@ -370,79 +410,85 @@ export default abstract class Node {
370
410
  *
371
411
  * @return Previous node.
372
412
  */
373
- prev(): ChildNode | undefined
413
+ prev(): Node.ChildNode | undefined
374
414
 
375
415
  /**
376
- * Insert new node before current node to current node’s parent.
377
- *
378
- * Just alias for `node.parent.insertBefore(node, add)`.
379
- *
380
- * ```js
381
- * decl.before('content: ""')
382
- * ```
416
+ * Get the range for a word or start and end index inside the node.
417
+ * The start index is inclusive; the end index is exclusive.
383
418
  *
384
- * @param newNode New node.
385
- * @return This node for methods chain.
419
+ * @param opts Options.
420
+ * @return Range.
386
421
  */
387
- before(newNode: Node | ChildProps | string | Node[]): this
422
+ rangeBy(
423
+ opts?: Pick<WarningOptions, 'endIndex' | 'index' | 'word'>
424
+ ): Node.Range
388
425
 
389
426
  /**
390
- * Insert new node after current node to current node’s parent.
391
- *
392
- * Just alias for `node.parent.insertAfter(node, add)`.
427
+ * Returns a `raws` value. If the node is missing
428
+ * the code style property (because the node was manually built or cloned),
429
+ * PostCSS will try to autodetect the code style property by looking
430
+ * at other nodes in the tree.
393
431
  *
394
432
  * ```js
395
- * decl.after('color: black')
433
+ * const root = postcss.parse('a { background: white }')
434
+ * root.nodes[0].append({ prop: 'color', value: 'black' })
435
+ * root.nodes[0].nodes[1].raws.before //=> undefined
436
+ * root.nodes[0].nodes[1].raw('before') //=> ' '
396
437
  * ```
397
438
  *
398
- * @param newNode New node.
399
- * @return This node for methods chain.
439
+ * @param prop Name of code style property.
440
+ * @param defaultType Name of default value, it can be missed
441
+ * if the value is the same as prop.
442
+ * @return {string} Code style value.
400
443
  */
401
- after(newNode: Node | ChildProps | string | Node[]): this
444
+ raw(prop: string, defaultType?: string): string
402
445
 
403
446
  /**
404
- * Finds the Root instance of the node’s tree.
447
+ * It removes the node from its parent and deletes its parent property.
405
448
  *
406
449
  * ```js
407
- * root.nodes[0].nodes[0].root() === root
450
+ * if (decl.prop.match(/^-webkit-/)) {
451
+ * decl.remove()
452
+ * }
408
453
  * ```
409
454
  *
410
- * @return Root parent.
455
+ * @return `this` for method chaining.
411
456
  */
412
- root(): Root
457
+ remove(): this
413
458
 
414
459
  /**
415
- * Returns a `Node#raws` value. If the node is missing
416
- * the code style property (because the node was manually built or cloned),
417
- * PostCSS will try to autodetect the code style property by looking
418
- * at other nodes in the tree.
460
+ * Inserts node(s) before the current node and removes the current node.
419
461
  *
420
462
  * ```js
421
- * const root = postcss.parse('a { background: white }')
422
- * root.nodes[0].append({ prop: 'color', value: 'black' })
423
- * root.nodes[0].nodes[1].raws.before //=> undefined
424
- * root.nodes[0].nodes[1].raw('before') //=> ' '
463
+ * AtRule: {
464
+ * mixin: atrule => {
465
+ * atrule.replaceWith(mixinRules[atrule.params])
466
+ * }
467
+ * }
425
468
  * ```
426
469
  *
427
- * @param prop Name of code style property.
428
- * @param defaultType Name of default value, it can be missed
429
- * if the value is the same as prop.
430
- * @return {string} Code style value.
470
+ * @param nodes Mode(s) to replace current one.
471
+ * @return Current node to methods chain.
431
472
  */
432
- raw(prop: string, defaultType?: string): string
473
+ replaceWith(
474
+ ...nodes: (
475
+ | Node.ChildNode
476
+ | Node.ChildNode[]
477
+ | Node.ChildProps
478
+ | Node.ChildProps[]
479
+ )[]
480
+ ): this
433
481
 
434
482
  /**
435
- * Clear the code style properties for the node and its children.
483
+ * Finds the Root instance of the node’s tree.
436
484
  *
437
485
  * ```js
438
- * node.raws.before //=> ' '
439
- * node.cleanRaws()
440
- * node.raws.before //=> undefined
486
+ * root.nodes[0].nodes[0].root() === root
441
487
  * ```
442
488
  *
443
- * @param keepBetween Keep the `raws.between` symbols.
489
+ * @return Root parent.
444
490
  */
445
- cleanRaws(keepBetween?: boolean): void
491
+ root(): Root
446
492
 
447
493
  /**
448
494
  * Fix circular links on `JSON.stringify()`.
@@ -452,27 +498,39 @@ export default abstract class Node {
452
498
  toJSON(): object
453
499
 
454
500
  /**
455
- * Convert string index to line/column.
501
+ * It compiles the node to browser readable cascading style sheets string
502
+ * depending on it's type.
456
503
  *
457
- * @param index The symbol number in the node’s string.
458
- * @return Symbol position in file.
459
- */
460
- positionInside(index: number): Position
461
-
462
- /**
463
- * Get the position for a word or an index inside the node.
504
+ * ```js
505
+ * new Rule({ selector: 'a' }).toString() //=> "a {}"
506
+ * ```
464
507
  *
465
- * @param opts Options.
466
- * @return Position.
508
+ * @param stringifier A syntax to use in string generation.
509
+ * @return CSS string of this node.
467
510
  */
468
- positionBy(opts?: Pick<WarningOptions, 'word' | 'index'>): Position
511
+ toString(stringifier?: Stringifier | Syntax): string
469
512
 
470
513
  /**
471
- * Get the range for a word or start and end index inside the node.
472
- * The start index is inclusive; the end index is exclusive.
514
+ * It is a wrapper for {@link Result#warn}, providing convenient
515
+ * way of generating warnings.
473
516
  *
474
- * @param opts Options.
475
- * @return Range.
517
+ * ```js
518
+ * Declaration: {
519
+ * bad: (decl, { result }) => {
520
+ * decl.warn(result, 'Deprecated property: bad')
521
+ * }
522
+ * }
523
+ * ```
524
+ *
525
+ * @param result The `Result` instance that will receive the warning.
526
+ * @param message Description for the warning.
527
+ * @param options Options for the warning.
528
+ *
529
+ * @return `Warning` instance is returned
476
530
  */
477
- rangeBy(opts?: Pick<WarningOptions, 'word' | 'index' | 'endIndex'>): Range
531
+ warn(result: Result, message: string, options?: WarningOptions): Warning
478
532
  }
533
+
534
+ declare class Node extends Node_ { }
535
+
536
+ export = Node