sass-embedded 1.0.0-beta.3 → 1.0.0-beta.8

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 (127) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/.gitignore +1 -0
  3. package/dist/lib/index.js +36 -2
  4. package/dist/lib/index.js.map +1 -1
  5. package/dist/lib/src/{embedded-compiler/compiler.js → async-compiler.js} +13 -13
  6. package/dist/lib/src/async-compiler.js.map +1 -0
  7. package/dist/lib/src/compile.js +187 -85
  8. package/dist/lib/src/compile.js.map +1 -1
  9. package/dist/lib/src/compiler-path.js +18 -0
  10. package/dist/lib/src/compiler-path.js.map +1 -0
  11. package/dist/lib/src/deprotofy-span.js +51 -0
  12. package/dist/lib/src/deprotofy-span.js.map +1 -0
  13. package/dist/lib/src/{embedded-protocol/dispatcher.js → dispatcher.js} +47 -41
  14. package/dist/lib/src/dispatcher.js.map +1 -0
  15. package/dist/lib/src/exception.js +20 -0
  16. package/dist/lib/src/exception.js.map +1 -0
  17. package/dist/lib/src/function-registry.js +92 -0
  18. package/dist/lib/src/function-registry.js.map +1 -0
  19. package/dist/lib/src/importer-registry.js +127 -0
  20. package/dist/lib/src/importer-registry.js.map +1 -0
  21. package/dist/lib/src/legacy.js +133 -0
  22. package/dist/lib/src/legacy.js.map +1 -0
  23. package/dist/lib/src/{embedded-protocol/message-transformer.js → message-transformer.js} +11 -10
  24. package/dist/lib/src/message-transformer.js.map +1 -0
  25. package/dist/lib/src/{embedded-compiler/packet-transformer.js → packet-transformer.js} +2 -1
  26. package/dist/lib/src/packet-transformer.js.map +1 -0
  27. package/dist/lib/src/protofier.js +272 -0
  28. package/dist/lib/src/protofier.js.map +1 -0
  29. package/dist/lib/src/{embedded-protocol/request-tracker.js → request-tracker.js} +1 -0
  30. package/dist/lib/src/request-tracker.js.map +1 -0
  31. package/dist/lib/src/sync-compiler.js +52 -0
  32. package/dist/lib/src/sync-compiler.js.map +1 -0
  33. package/dist/lib/src/{exception/span.js → sync-process/event.js} +2 -2
  34. package/dist/lib/src/sync-process/event.js.map +1 -0
  35. package/dist/lib/src/sync-process/index.js +122 -0
  36. package/dist/lib/src/sync-process/index.js.map +1 -0
  37. package/dist/lib/src/sync-process/sync-message-port.js +128 -0
  38. package/dist/lib/src/sync-process/sync-message-port.js.map +1 -0
  39. package/dist/lib/src/sync-process/worker.js +51 -0
  40. package/dist/lib/src/sync-process/worker.js.map +1 -0
  41. package/dist/lib/src/utils.js +88 -0
  42. package/dist/lib/src/utils.js.map +1 -1
  43. package/dist/lib/src/value/argument-list.js +31 -0
  44. package/dist/lib/src/value/argument-list.js.map +1 -0
  45. package/dist/lib/src/value/boolean.js +40 -0
  46. package/dist/lib/src/value/boolean.js.map +1 -0
  47. package/dist/lib/src/value/color.js +258 -0
  48. package/dist/lib/src/value/color.js.map +1 -0
  49. package/dist/lib/src/value/function.js +34 -0
  50. package/dist/lib/src/value/function.js.map +1 -0
  51. package/dist/lib/src/value/{value.js → index.js} +28 -17
  52. package/dist/lib/src/value/index.js.map +1 -0
  53. package/dist/lib/src/value/list.js +99 -0
  54. package/dist/lib/src/value/list.js.map +1 -0
  55. package/dist/lib/src/value/map.js +91 -0
  56. package/dist/lib/src/value/map.js.map +1 -0
  57. package/dist/lib/src/value/null.js +10 -6
  58. package/dist/lib/src/value/null.js.map +1 -1
  59. package/dist/lib/src/value/number.js +579 -0
  60. package/dist/lib/src/value/number.js.map +1 -0
  61. package/dist/lib/src/value/string.js +117 -0
  62. package/dist/lib/src/value/string.js.map +1 -0
  63. package/dist/lib/src/value/utils.js +120 -0
  64. package/dist/lib/src/value/utils.js.map +1 -0
  65. package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js +994 -8
  66. package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js.map +1 -1
  67. package/dist/package.json +63 -0
  68. package/dist/tool/utils.js +85 -91
  69. package/dist/tool/utils.js.map +1 -1
  70. package/dist/types/compile.d.ts +152 -0
  71. package/dist/types/exception.d.ts +41 -0
  72. package/dist/types/importer.d.ts +294 -0
  73. package/dist/types/index.d.ts +76 -0
  74. package/dist/types/legacy/exception.d.ts +54 -0
  75. package/dist/types/legacy/function.d.ts +700 -0
  76. package/dist/types/legacy/importer.d.ts +168 -0
  77. package/dist/types/legacy/options.d.ts +642 -0
  78. package/dist/types/legacy/plugin_this.d.ts +73 -0
  79. package/dist/types/legacy/render.d.ts +139 -0
  80. package/dist/types/logger/index.d.ts +94 -0
  81. package/dist/types/logger/source_location.d.ts +21 -0
  82. package/dist/types/logger/source_span.d.ts +34 -0
  83. package/dist/types/options.d.ts +408 -0
  84. package/dist/types/util/promise_or.d.ts +17 -0
  85. package/dist/types/value/argument_list.d.ts +47 -0
  86. package/dist/types/value/boolean.d.ts +29 -0
  87. package/dist/types/value/color.d.ts +107 -0
  88. package/dist/types/value/function.d.ts +22 -0
  89. package/dist/types/value/index.d.ts +173 -0
  90. package/dist/types/value/list.d.ts +54 -0
  91. package/dist/types/value/map.d.ts +41 -0
  92. package/dist/types/value/number.d.ts +305 -0
  93. package/dist/types/value/string.d.ts +84 -0
  94. package/download-compiler-for-end-user.js +1 -6
  95. package/package.json +23 -19
  96. package/dist/lib/index.d.ts +0 -1
  97. package/dist/lib/src/compile.d.ts +0 -20
  98. package/dist/lib/src/embedded-compiler/compiler.d.ts +0 -19
  99. package/dist/lib/src/embedded-compiler/compiler.js.map +0 -1
  100. package/dist/lib/src/embedded-compiler/packet-transformer.d.ts +0 -34
  101. package/dist/lib/src/embedded-compiler/packet-transformer.js.map +0 -1
  102. package/dist/lib/src/embedded-protocol/dispatcher.d.ts +0 -60
  103. package/dist/lib/src/embedded-protocol/dispatcher.js.map +0 -1
  104. package/dist/lib/src/embedded-protocol/message-transformer.d.ts +0 -47
  105. package/dist/lib/src/embedded-protocol/message-transformer.js.map +0 -1
  106. package/dist/lib/src/embedded-protocol/request-tracker.d.ts +0 -20
  107. package/dist/lib/src/embedded-protocol/request-tracker.js.map +0 -1
  108. package/dist/lib/src/embedded-protocol/utils.d.ts +0 -7
  109. package/dist/lib/src/embedded-protocol/utils.js +0 -52
  110. package/dist/lib/src/embedded-protocol/utils.js.map +0 -1
  111. package/dist/lib/src/exception/exception.d.ts +0 -19
  112. package/dist/lib/src/exception/exception.js +0 -36
  113. package/dist/lib/src/exception/exception.js.map +0 -1
  114. package/dist/lib/src/exception/location.d.ts +0 -11
  115. package/dist/lib/src/exception/location.js +0 -6
  116. package/dist/lib/src/exception/location.js.map +0 -1
  117. package/dist/lib/src/exception/span.d.ts +0 -29
  118. package/dist/lib/src/exception/span.js.map +0 -1
  119. package/dist/lib/src/node-sass/render.d.ts +0 -60
  120. package/dist/lib/src/node-sass/render.js +0 -126
  121. package/dist/lib/src/node-sass/render.js.map +0 -1
  122. package/dist/lib/src/utils.d.ts +0 -9
  123. package/dist/lib/src/value/null.d.ts +0 -11
  124. package/dist/lib/src/value/value.d.ts +0 -98
  125. package/dist/lib/src/value/value.js.map +0 -1
  126. package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.d.ts +0 -1
  127. package/dist/tool/utils.d.ts +0 -29
@@ -0,0 +1,700 @@
1
+ import {LegacyPluginThis} from './plugin_this';
2
+
3
+ /**
4
+ * A synchronous callback that implements a custom Sass function. This can be
5
+ * passed to [[LegacySharedOptions.functions]] for either [[render]] or
6
+ * [[renderSync]].
7
+ *
8
+ * If this throws an error, Sass will treat that as the function failing with
9
+ * that error message.
10
+ *
11
+ * ```js
12
+ * const result = sass.renderSync({
13
+ * file: 'style.scss',
14
+ * functions: {
15
+ * "sum($arg1, $arg2)": (arg1, arg2) => {
16
+ * if (!(arg1 instanceof sass.types.Number)) {
17
+ * throw new Error("$arg1: Expected a number");
18
+ * } else if (!(arg2 instanceof sass.types.Number)) {
19
+ * throw new Error("$arg2: Expected a number");
20
+ * }
21
+ * return new sass.types.Number(arg1.getValue() + arg2.getValue());
22
+ * }
23
+ * }
24
+ * });
25
+ * ```
26
+ *
27
+ * @param args - One argument for each argument that's declared in the signature
28
+ * that's passed to [[LegacySharedOptions.functions]]. If the signature [takes
29
+ * arbitrary arguments](https://sass-lang.com/documentation/at-rules/function#taking-arbitrary-arguments),
30
+ * they're passed as a single argument list in the last argument.
31
+ *
32
+ * @category Legacy
33
+ * @deprecated This only works with the legacy [[render]] and [[renderSync]]
34
+ * APIs. Use [[CustomFunction]] with [[compile]], [[compileString]],
35
+ * [[compileAsync]], and [[compileStringAsync]] instead.
36
+ */
37
+ export type LegacySyncFunction = (
38
+ this: LegacyPluginThis,
39
+ ...args: LegacyValue[]
40
+ ) => LegacyValue;
41
+
42
+ /**
43
+ * An asynchronous callback that implements a custom Sass function. This can be
44
+ * passed to [[LegacySharedOptions.functions]], but only for [[render]].
45
+ *
46
+ * An asynchronous function must return `undefined`. Its final argument will
47
+ * always be a callback, which it should call with the result of the function
48
+ * once it's done running.
49
+ *
50
+ * If this throws an error, Sass will treat that as the function failing with
51
+ * that error message.
52
+ *
53
+ * ```js
54
+ * sass.render({
55
+ * file: 'style.scss',
56
+ * functions: {
57
+ * "sum($arg1, $arg2)": (arg1, arg2, done) => {
58
+ * if (!(arg1 instanceof sass.types.Number)) {
59
+ * throw new Error("$arg1: Expected a number");
60
+ * } else if (!(arg2 instanceof sass.types.Number)) {
61
+ * throw new Error("$arg2: Expected a number");
62
+ * }
63
+ * done(new sass.types.Number(arg1.getValue() + arg2.getValue()));
64
+ * }
65
+ * }
66
+ * }, (result, error) => {
67
+ * // ...
68
+ * });
69
+ * ```
70
+ *
71
+ * This is passed one argument for each argument that's declared in the
72
+ * signature that's passed to [[LegacySharedOptions.functions]]. If the
73
+ * signature [takes arbitrary
74
+ * arguments](https://sass-lang.com/documentation/at-rules/function#taking-arbitrary-arguments),
75
+ * they're passed as a single argument list in the last argument before the
76
+ * callback.
77
+ *
78
+ * @category Legacy
79
+ * @deprecated This only works with the legacy [[render]] and [[renderSync]]
80
+ * APIs. Use [[CustomFunction]] with [[compile]], [[compileString]],
81
+ * [[compileAsync]], and [[compileStringAsync]] instead.
82
+ */
83
+ export type LegacyAsyncFunction =
84
+ | ((this: LegacyPluginThis, done: (result: LegacyValue) => void) => void)
85
+ | ((
86
+ this: LegacyPluginThis,
87
+ arg1: LegacyValue,
88
+ done: (result: LegacyValue) => void
89
+ ) => void)
90
+ | ((
91
+ this: LegacyPluginThis,
92
+ arg1: LegacyValue,
93
+ arg2: LegacyValue,
94
+ done: (result: LegacyValue) => void
95
+ ) => void)
96
+ | ((
97
+ this: LegacyPluginThis,
98
+ arg1: LegacyValue,
99
+ arg2: LegacyValue,
100
+ arg3: LegacyValue,
101
+ done: (result: LegacyValue) => void
102
+ ) => void)
103
+ | ((
104
+ this: LegacyPluginThis,
105
+ arg1: LegacyValue,
106
+ arg2: LegacyValue,
107
+ arg3: LegacyValue,
108
+ arg4: LegacyValue,
109
+ done: (result: LegacyValue) => void
110
+ ) => void)
111
+ | ((
112
+ this: LegacyPluginThis,
113
+ arg1: LegacyValue,
114
+ arg2: LegacyValue,
115
+ arg3: LegacyValue,
116
+ arg4: LegacyValue,
117
+ arg5: LegacyValue,
118
+ done: (result: LegacyValue) => void
119
+ ) => void)
120
+ | ((
121
+ this: LegacyPluginThis,
122
+ arg1: LegacyValue,
123
+ arg2: LegacyValue,
124
+ arg3: LegacyValue,
125
+ arg4: LegacyValue,
126
+ arg5: LegacyValue,
127
+ arg6: LegacyValue,
128
+ done: (result: LegacyValue) => void
129
+ ) => void)
130
+ | ((
131
+ this: LegacyPluginThis,
132
+ ...args: [...LegacyValue[], (result: LegacyValue) => void]
133
+ ) => void);
134
+
135
+ /**
136
+ * A callback that implements a custom Sass function. For [[renderSync]], this
137
+ * must be a [[LegacySyncFunction]] which returns its result directly; for
138
+ * [[render]], it may be either a [[LegacySyncFunction]] or a
139
+ * [[LegacyAsyncFunction]] which calls a callback with its result.
140
+ *
141
+ * See [[LegacySharedOptions.functions]] for more details.
142
+ *
143
+ * @category Legacy
144
+ * @deprecated This only works with the legacy [[render]] and [[renderSync]]
145
+ * APIs. Use [[CustomFunction]] with [[compile]], [[compileString]],
146
+ * [[compileAsync]], and [[compileStringAsync]] instead.
147
+ */
148
+ export type LegacyFunction<sync extends 'sync' | 'async'> = sync extends 'async'
149
+ ? LegacySyncFunction | LegacyAsyncFunction
150
+ : LegacySyncFunction;
151
+
152
+ /**
153
+ * A type representing all the possible values that may be passed to or returned
154
+ * from a [[LegacyFunction]].
155
+ *
156
+ * @category Legacy
157
+ * @deprecated This only works with the legacy [[render]] and [[renderSync]]
158
+ * APIs. Use [[Value]] with [[compile]], [[compileString]], [[compileAsync]],
159
+ * and [[compileStringAsync]] instead.
160
+ */
161
+ export type LegacyValue =
162
+ | types.Null
163
+ | types.Number
164
+ | types.String
165
+ | types.Boolean
166
+ | types.Color
167
+ | types.List
168
+ | types.Map;
169
+
170
+ /**
171
+ * The namespace for value types used in the legacy function API.
172
+ *
173
+ * @category Legacy
174
+ * @deprecated This only works with the legacy [[render]] and [[renderSync]]
175
+ * APIs. Use [[Value]] with [[compile]], [[compileString]], [[compileAsync]],
176
+ * and [[compileStringAsync]] instead.
177
+ */
178
+ export namespace types {
179
+ /**
180
+ * The class for Sass's singleton [`null`
181
+ * value](https://sass-lang.com/documentation/values/null). The value itself
182
+ * can be accessed through the [[NULL]] field.
183
+ */
184
+ export class Null {
185
+ /** Sass's singleton `null` value. */
186
+ static readonly NULL: Null;
187
+ }
188
+
189
+ /**
190
+ * Sass's [number type](https://sass-lang.com/documentation/values/numbers).
191
+ */
192
+ export class Number {
193
+ /**
194
+ * @param value - The numeric value of the number.
195
+ *
196
+ * @param unit - If passed, the number's unit.
197
+ *
198
+ * Complex units can be represented as
199
+ * `<unit>*<unit>*.../<unit>*<unit>*...`, with numerator units on the
200
+ * left-hand side of the `/` and denominator units on the right. A number
201
+ * with only numerator units may omit the `/` and the units after it, and a
202
+ * number with only denominator units may be represented
203
+ * with no units before the `/`.
204
+ *
205
+ * @example
206
+ *
207
+ * ```scss
208
+ * new sass.types.Number(0.5); // == 0.5
209
+ * new sass.types.Number(10, "px"); // == 10px
210
+ * new sass.types.Number(10, "px*px"); // == 10px * 1px
211
+ * new sass.types.Number(10, "px/s"); // == math.div(10px, 1s)
212
+ * new sass.types.Number(10, "px*px/s*s"); // == 10px * math.div(math.div(1px, 1s), 1s)
213
+ * ```
214
+ */
215
+ constructor(value: number, unit?: string);
216
+
217
+ /**
218
+ * Returns the value of the number, ignoring units.
219
+ *
220
+ * **Heads up!** This means that `96px` and `1in` will return different
221
+ * values, even though they represent the same length.
222
+ *
223
+ * @example
224
+ *
225
+ * ```js
226
+ * const number = new sass.types.Number(10, "px");
227
+ * number.getValue(); // 10
228
+ * ```
229
+ */
230
+ getValue(): number;
231
+
232
+ /**
233
+ * Destructively modifies this number by setting its numeric value to
234
+ * `value`, independent of its units.
235
+ *
236
+ * @deprecated Use [[constructor]] instead.
237
+ */
238
+ setValue(value: number): void;
239
+
240
+ /**
241
+ * Returns a string representation of this number's units. Complex units are
242
+ * returned in the same format that [[constructor]] accepts them.
243
+ *
244
+ * @example
245
+ *
246
+ * ```js
247
+ * // number is `10px`.
248
+ * number.getUnit(); // "px"
249
+ *
250
+ * // number is `math.div(10px, 1s)`.
251
+ * number.getUnit(); // "px/s"
252
+ * ```
253
+ */
254
+ getUnit(): string;
255
+
256
+ /**
257
+ * Destructively modifies this number by setting its units to `unit`,
258
+ * independent of its numeric value. Complex units are specified in the same
259
+ * format as [[constructor]].
260
+ *
261
+ * @deprecated Use [[constructor]] instead.
262
+ */
263
+ setUnit(unit: string): void;
264
+ }
265
+
266
+ /**
267
+ * Sass's [string type](https://sass-lang.com/documentation/values/strings).
268
+ *
269
+ * **Heads up!** This API currently provides no way of distinguishing between
270
+ * a [quoted](https://sass-lang.com/documentation/values/strings#quoted) and
271
+ * [unquoted](https://sass-lang.com/documentation/values/strings#unquoted)
272
+ * string.
273
+ */
274
+ export class String {
275
+ /**
276
+ * Creates an unquoted string with the given contents.
277
+ *
278
+ * **Heads up!** This API currently provides no way of creating a
279
+ * [quoted](https://sass-lang.com/documentation/values/strings#quoted)
280
+ * string.
281
+ */
282
+ constructor(value: string);
283
+
284
+ /**
285
+ * Returns the contents of the string. If the string contains escapes,
286
+ * those escapes are included literally if it’s
287
+ * [unquoted](https://sass-lang.com/documentation/values/strings#unquoted),
288
+ * while the values of the escapes are included if it’s
289
+ * [quoted](https://sass-lang.com/documentation/values/strings#quoted).
290
+ *
291
+ * @example
292
+ *
293
+ * ```
294
+ * // string is `Arial`.
295
+ * string.getValue(); // "Arial"
296
+ *
297
+ * // string is `"Helvetica Neue"`.
298
+ * string.getValue(); // "Helvetica Neue"
299
+ *
300
+ * // string is `\1F46D`.
301
+ * string.getValue(); // "\\1F46D"
302
+ *
303
+ * // string is `"\1F46D"`.
304
+ * string.getValue(); // "👭"
305
+ * ```
306
+ */
307
+ getValue(): string;
308
+
309
+ /**
310
+ * Destructively modifies this string by setting its numeric value to
311
+ * `value`.
312
+ *
313
+ * **Heads up!** Even if the string was originally quoted, this will cause
314
+ * it to become unquoted.
315
+ *
316
+ * @deprecated Use [[constructor]] instead.
317
+ */
318
+ setValue(value: string): void;
319
+ }
320
+
321
+ /**
322
+ * Sass's [boolean type](https://sass-lang.com/documentation/values/booleans).
323
+ *
324
+ * Custom functions should respect Sass’s notion of
325
+ * [truthiness](https://sass-lang.com/documentation/at-rules/control/if#truthiness-and-falsiness)
326
+ * by treating `false` and `null` as falsey and everything else as truthy.
327
+ *
328
+ * **Heads up!** Boolean values can't be constructed, they can only be
329
+ * accessed through the [[TRUE]] and [[FALSE]] constants.
330
+ */
331
+ export class Boolean<T extends boolean = boolean> {
332
+ /**
333
+ * Returns `true` if this is Sass's `true` value and `false` if this is
334
+ * Sass's `false` value.
335
+ *
336
+ * @example
337
+ *
338
+ * ```js
339
+ * // boolean is `true`.
340
+ * boolean.getValue(); // true
341
+ * boolean === sass.types.Boolean.TRUE; // true
342
+ *
343
+ * // boolean is `false`.
344
+ * boolean.getValue(); // false
345
+ * boolean === sass.types.Boolean.FALSE; // true
346
+ * ```
347
+ */
348
+ getValue(): T;
349
+
350
+ /** Sass's `true` value. */
351
+ static readonly TRUE: Boolean<true>;
352
+
353
+ /** Sass's `false` value. */
354
+ static readonly FALSE: Boolean<false>;
355
+ }
356
+
357
+ /**
358
+ * Sass's [color type](https://sass-lang.com/documentation/values/colors).
359
+ */
360
+ export class Color {
361
+ /**
362
+ * Creates a new Sass color with the given red, green, blue, and alpha
363
+ * channels. The red, green, and blue channels must be integers between 0
364
+ * and 255 (inclusive), and alpha must be between 0 and 1 (inclusive).
365
+ *
366
+ * @example
367
+ *
368
+ * ```js
369
+ * new sass.types.Color(107, 113, 127); // #6b717f
370
+ * new sass.types.Color(0, 0, 0, 0); // rgba(0, 0, 0, 0)
371
+ * ```
372
+ */
373
+ constructor(r: number, g: number, b: number, a?: number);
374
+
375
+ /**
376
+ * Creates a new Sass color with alpha, red, green, and blue channels taken
377
+ * from respective two-byte chunks of a hexidecimal number.
378
+ *
379
+ * @example
380
+ *
381
+ * ```js
382
+ * new sass.types.Color(0xff6b717f); // #6b717f
383
+ * new sass.types.Color(0x00000000); // rgba(0, 0, 0, 0)
384
+ * ```
385
+ */
386
+ constructor(argb: number);
387
+
388
+ /**
389
+ * Returns the red channel of the color as an integer from 0 to 255.
390
+ *
391
+ * @example
392
+ *
393
+ * ```js
394
+ * // color is `#6b717f`.
395
+ * color.getR(); // 107
396
+ *
397
+ * // color is `#b37399`.
398
+ * color.getR(); // 179
399
+ * ```
400
+ */
401
+ getR(): number;
402
+
403
+ /**
404
+ * Sets the red channel of the color. The value must be an integer between 0
405
+ * and 255 (inclusive).
406
+ *
407
+ * @deprecated Use [[constructor]] instead.
408
+ */
409
+ setR(value: number): void;
410
+
411
+ /**
412
+ * Returns the green channel of the color as an integer from 0 to 255.
413
+ *
414
+ * @example
415
+ *
416
+ * ```js
417
+ * // color is `#6b717f`.
418
+ * color.getG(); // 113
419
+ *
420
+ * // color is `#b37399`.
421
+ * color.getG(); // 115
422
+ * ```
423
+ */
424
+ getG(): number;
425
+
426
+ /**
427
+ * Sets the green channel of the color. The value must be an integer between
428
+ * 0 and 255 (inclusive).
429
+ *
430
+ * @deprecated Use [[constructor]] instead.
431
+ */
432
+ setG(value: number): void;
433
+
434
+ /**
435
+ * Returns the blue channel of the color as an integer from 0 to 255.
436
+ *
437
+ * @example
438
+ *
439
+ * ```js
440
+ * // color is `#6b717f`.
441
+ * color.getB(); // 127
442
+ *
443
+ * // color is `#b37399`.
444
+ * color.getB(); // 153
445
+ * ```
446
+ */
447
+ getB(): number;
448
+
449
+ /**
450
+ * Sets the blue channel of the color. The value must be an integer between
451
+ * 0 and 255 (inclusive).
452
+ *
453
+ * @deprecated Use [[constructor]] instead.
454
+ */
455
+ setB(value: number): void;
456
+
457
+ /**
458
+ * Returns the alpha channel of the color as a number from 0 to 1.
459
+ *
460
+ * @example
461
+ *
462
+ * ```js
463
+ * // color is `#6b717f`.
464
+ * color.getA(); // 1
465
+ *
466
+ * // color is `transparent`.
467
+ * color.getA(); // 0
468
+ * ```
469
+ */
470
+ getA(): number;
471
+
472
+ /**
473
+ * Sets the alpha channel of the color. The value must be between 0 and 1
474
+ * (inclusive).
475
+ *
476
+ * @deprecated Use [[constructor]] instead.
477
+ */
478
+ setA(value: number): void;
479
+ }
480
+
481
+ /**
482
+ * Sass's [list type](https://sass-lang.com/documentation/values/lists).
483
+ *
484
+ * **Heads up!** This list type’s methods use 0-based indexing, even though
485
+ * within Sass lists use 1-based indexing. These methods also don’t support
486
+ * using negative numbers to index backwards from the end of the list.
487
+ */
488
+ export class List {
489
+ /**
490
+ * Creates a new Sass list.
491
+ *
492
+ * **Heads up!** The initial values of the list elements are undefined.
493
+ * These elements must be set using [[setValue]] before accessing them or
494
+ * passing the list back to Sass.
495
+ *
496
+ * @example
497
+ *
498
+ * ```js
499
+ * const list = new sass.types.List(3);
500
+ * list.setValue(0, new sass.types.Number(10, "px"));
501
+ * list.setValue(1, new sass.types.Number(15, "px"));
502
+ * list.setValue(2, new sass.types.Number(32, "px"));
503
+ * list; // 10px, 15px, 32px
504
+ * ```
505
+ *
506
+ * @param length - The number of (initially undefined) elements in the list.
507
+ * @param commaSeparator - If `true`, the list is comma-separated; otherwise,
508
+ * it's space-separated. Defaults to `true`.
509
+ */
510
+ constructor(length: number, commaSeparator?: boolean);
511
+
512
+ /**
513
+ * Returns the element at `index`, or `undefined` if that value hasn't yet
514
+ * been set.
515
+ *
516
+ * @example
517
+ *
518
+ * ```js
519
+ * // list is `10px, 15px, 32px`
520
+ * list.getValue(0); // 10px
521
+ * list.getValue(2); // 32px
522
+ * ```
523
+ *
524
+ * @param index - A (0-based) index into this list.
525
+ * @throws `Error` if `index` is less than 0 or greater than or equal to the
526
+ * number of elements in this list.
527
+ */
528
+ getValue(index: number): LegacyValue | undefined;
529
+
530
+ /**
531
+ * Sets the element at `index` to `value`.
532
+ *
533
+ * @example
534
+ *
535
+ * ```js
536
+ * // list is `10px, 15px, 32px`
537
+ * list.setValue(1, new sass.types.Number(18, "px"));
538
+ * list; // 10px, 18px, 32px
539
+ * ```
540
+ *
541
+ * @param index - A (0-based) index into this list.
542
+ * @throws `Error` if `index` is less than 0 or greater than or equal to the
543
+ * number of elements in this list.
544
+ */
545
+ setValue(index: number, value: LegacyValue): void;
546
+
547
+ /**
548
+ * Returns `true` if this list is comma-separated and `false` otherwise.
549
+ *
550
+ * @example
551
+ *
552
+ * ```js
553
+ * // list is `10px, 15px, 32px`
554
+ * list.getSeparator(); // true
555
+ *
556
+ * // list is `1px solid`
557
+ * list.getSeparator(); // false
558
+ * ```
559
+ */
560
+ getSeparator(): boolean;
561
+
562
+ /**
563
+ * Sets whether the list is comma-separated.
564
+ *
565
+ * @param isComma - `true` to make the list comma-separated, `false` otherwise.
566
+ */
567
+ setSeparator(isComma: boolean): void;
568
+
569
+ /**
570
+ * Returns the number of elements in the list.
571
+ *
572
+ * @example
573
+ *
574
+ * ```js
575
+ * // list is `10px, 15px, 32px`
576
+ * list.getLength(); // 3
577
+ *
578
+ * // list is `1px solid`
579
+ * list.getLength(); // 2
580
+ * ```
581
+ */
582
+ getLength(): number;
583
+ }
584
+
585
+ /**
586
+ * Sass's [map type](https://sass-lang.com/documentation/values/maps).
587
+ *
588
+ * **Heads up!** This map type is represented as a list of key-value pairs
589
+ * rather than a mapping from keys to values. The only way to find the value
590
+ * associated with a given key is to iterate through the map checking for that
591
+ * key. Maps created through this API are still forbidden from having duplicate
592
+ * keys.
593
+ */
594
+ export class Map {
595
+ /**
596
+ * Creates a new Sass map.
597
+ *
598
+ * **Heads up!** The initial keys and values of the map are undefined. They
599
+ * must be set using [[setKey]] and [[setValue]] before accessing them or
600
+ * passing the map back to Sass.
601
+ *
602
+ * @example
603
+ *
604
+ * ```js
605
+ * const map = new sass.types.Map(2);
606
+ * map.setKey(0, new sass.types.String("width"));
607
+ * map.setValue(0, new sass.types.Number(300, "px"));
608
+ * map.setKey(1, new sass.types.String("height"));
609
+ * map.setValue(1, new sass.types.Number(100, "px"));
610
+ * map; // (width: 300px, height: 100px)
611
+ * ```
612
+ *
613
+ * @param length - The number of (initially undefined) key/value pairs in the map.
614
+ */
615
+ constructor(length: number);
616
+
617
+ /**
618
+ * Returns the value in the key/value pair at `index`.
619
+ *
620
+ * @example
621
+ *
622
+ * ```js
623
+ * // map is `(width: 300px, height: 100px)`
624
+ * map.getValue(0); // 300px
625
+ * map.getValue(1); // 100px
626
+ * ```
627
+ *
628
+ * @param index - A (0-based) index of a key/value pair in this map.
629
+ * @throws `Error` if `index` is less than 0 or greater than or equal to the
630
+ * number of pairs in this map.
631
+ */
632
+ getValue(index: number): LegacyValue;
633
+
634
+ /**
635
+ * Sets the value in the key/value pair at `index` to `value`.
636
+ *
637
+ * @example
638
+ *
639
+ * ```js
640
+ * // map is `("light": 200, "medium": 400, "bold": 600)`
641
+ * map.setValue(1, new sass.types.Number(300));
642
+ * map; // ("light": 200, "medium": 300, "bold": 600)
643
+ * ```
644
+ *
645
+ * @param index - A (0-based) index of a key/value pair in this map.
646
+ * @throws `Error` if `index` is less than 0 or greater than or equal to the
647
+ * number of pairs in this map.
648
+ */
649
+ setValue(index: number, value: LegacyValue): void;
650
+
651
+ /**
652
+ * Returns the key in the key/value pair at `index`.
653
+ *
654
+ * @example
655
+ *
656
+ * ```js
657
+ * // map is `(width: 300px, height: 100px)`
658
+ * map.getKey(0); // width
659
+ * map.getKey(1); // height
660
+ * ```
661
+ *
662
+ * @param index - A (0-based) index of a key/value pair in this map.
663
+ * @throws `Error` if `index` is less than 0 or greater than or equal to the
664
+ * number of pairs in this map.
665
+ */
666
+ getKey(index: number): LegacyValue;
667
+
668
+ /**
669
+ * Sets the value in the key/value pair at `index` to `value`.
670
+ *
671
+ * @example
672
+ *
673
+ * ```js
674
+ * // map is `("light": 200, "medium": 400, "bold": 600)`
675
+ * map.setValue(1, new sass.types.String("lighter"));
676
+ * map; // ("lighter": 200, "medium": 300, "bold": 600)
677
+ * ```
678
+ *
679
+ * @param index - A (0-based) index of a key/value pair in this map.
680
+ * @throws `Error` if `index` is less than 0 or greater than or equal to the
681
+ * number of pairs in this map.
682
+ */
683
+ setKey(index: number, key: LegacyValue): void;
684
+
685
+ /**
686
+ * Returns the number of key/value pairs in this map.
687
+ *
688
+ * @example
689
+ *
690
+ * ```js
691
+ * // map is `("light": 200, "medium": 400, "bold": 600)`
692
+ * map.getLength(); // 3
693
+ *
694
+ * // map is `(width: 300px, height: 100px)`
695
+ * map.getLength(); // 2
696
+ * ```
697
+ */
698
+ getLength(): number;
699
+ }
700
+ }