sass-embedded-go 1.104.0-alpha0

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 (161) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/lib/index.js +100 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/index.mjs +215 -0
  6. package/lib/src/canonicalize-context.js +31 -0
  7. package/lib/src/canonicalize-context.js.map +1 -0
  8. package/lib/src/compile.js +51 -0
  9. package/lib/src/compile.js.map +1 -0
  10. package/lib/src/compiler/async.js +187 -0
  11. package/lib/src/compiler/async.js.map +1 -0
  12. package/lib/src/compiler/sync.js +204 -0
  13. package/lib/src/compiler/sync.js.map +1 -0
  14. package/lib/src/compiler/utils.js +210 -0
  15. package/lib/src/compiler/utils.js.map +1 -0
  16. package/lib/src/compiler-module.js +64 -0
  17. package/lib/src/compiler-module.js.map +1 -0
  18. package/lib/src/compiler-path.js +82 -0
  19. package/lib/src/compiler-path.js.map +1 -0
  20. package/lib/src/deprecations.js +121 -0
  21. package/lib/src/deprecations.js.map +1 -0
  22. package/lib/src/deprotofy-span.js +41 -0
  23. package/lib/src/deprotofy-span.js.map +1 -0
  24. package/lib/src/dispatcher.js +241 -0
  25. package/lib/src/dispatcher.js.map +1 -0
  26. package/lib/src/elf.js +114 -0
  27. package/lib/src/elf.js.map +1 -0
  28. package/lib/src/exception.js +23 -0
  29. package/lib/src/exception.js.map +1 -0
  30. package/lib/src/function-registry.js +127 -0
  31. package/lib/src/function-registry.js.map +1 -0
  32. package/lib/src/importer-registry.js +201 -0
  33. package/lib/src/importer-registry.js.map +1 -0
  34. package/lib/src/legacy/importer.js +296 -0
  35. package/lib/src/legacy/importer.js.map +1 -0
  36. package/lib/src/legacy/index.js +329 -0
  37. package/lib/src/legacy/index.js.map +1 -0
  38. package/lib/src/legacy/resolve-path.js +133 -0
  39. package/lib/src/legacy/resolve-path.js.map +1 -0
  40. package/lib/src/legacy/utils.js +58 -0
  41. package/lib/src/legacy/utils.js.map +1 -0
  42. package/lib/src/legacy/value/base.js +18 -0
  43. package/lib/src/legacy/value/base.js.map +1 -0
  44. package/lib/src/legacy/value/color.js +65 -0
  45. package/lib/src/legacy/value/color.js.map +1 -0
  46. package/lib/src/legacy/value/index.js +23 -0
  47. package/lib/src/legacy/value/index.js.map +1 -0
  48. package/lib/src/legacy/value/list.js +50 -0
  49. package/lib/src/legacy/value/list.js.map +1 -0
  50. package/lib/src/legacy/value/map.js +74 -0
  51. package/lib/src/legacy/value/map.js.map +1 -0
  52. package/lib/src/legacy/value/number.js +60 -0
  53. package/lib/src/legacy/value/number.js.map +1 -0
  54. package/lib/src/legacy/value/string.js +27 -0
  55. package/lib/src/legacy/value/string.js.map +1 -0
  56. package/lib/src/legacy/value/wrap.js +115 -0
  57. package/lib/src/legacy/value/wrap.js.map +1 -0
  58. package/lib/src/logger.js +10 -0
  59. package/lib/src/logger.js.map +1 -0
  60. package/lib/src/message-transformer.js +108 -0
  61. package/lib/src/message-transformer.js.map +1 -0
  62. package/lib/src/messages.js +6 -0
  63. package/lib/src/messages.js.map +1 -0
  64. package/lib/src/packet-transformer.js +171 -0
  65. package/lib/src/packet-transformer.js.map +1 -0
  66. package/lib/src/protofier.js +492 -0
  67. package/lib/src/protofier.js.map +1 -0
  68. package/lib/src/request-tracker.js +52 -0
  69. package/lib/src/request-tracker.js.map +1 -0
  70. package/lib/src/utils.js +177 -0
  71. package/lib/src/utils.js.map +1 -0
  72. package/lib/src/value/argument-list.js +66 -0
  73. package/lib/src/value/argument-list.js.map +1 -0
  74. package/lib/src/value/boolean.js +69 -0
  75. package/lib/src/value/boolean.js.map +1 -0
  76. package/lib/src/value/calculations.js +114 -0
  77. package/lib/src/value/calculations.js.map +1 -0
  78. package/lib/src/value/color.js +869 -0
  79. package/lib/src/value/color.js.map +1 -0
  80. package/lib/src/value/function.js +74 -0
  81. package/lib/src/value/function.js.map +1 -0
  82. package/lib/src/value/index.js +166 -0
  83. package/lib/src/value/index.js.map +1 -0
  84. package/lib/src/value/list.js +101 -0
  85. package/lib/src/value/list.js.map +1 -0
  86. package/lib/src/value/map.js +92 -0
  87. package/lib/src/value/map.js.map +1 -0
  88. package/lib/src/value/mixin.js +50 -0
  89. package/lib/src/value/mixin.js.map +1 -0
  90. package/lib/src/value/null.js +49 -0
  91. package/lib/src/value/null.js.map +1 -0
  92. package/lib/src/value/number.js +583 -0
  93. package/lib/src/value/number.js.map +1 -0
  94. package/lib/src/value/string.js +118 -0
  95. package/lib/src/value/string.js.map +1 -0
  96. package/lib/src/value/utils.js +124 -0
  97. package/lib/src/value/utils.js.map +1 -0
  98. package/lib/src/vendor/deprecations.js +216 -0
  99. package/lib/src/vendor/deprecations.js.map +1 -0
  100. package/lib/src/vendor/embedded_sass_pb.js +432 -0
  101. package/lib/src/vendor/embedded_sass_pb.js.map +1 -0
  102. package/lib/src/vendor/sass/README.md +162 -0
  103. package/lib/src/vendor/sass/compile.d.ts +342 -0
  104. package/lib/src/vendor/sass/deprecations.d.ts +312 -0
  105. package/lib/src/vendor/sass/exception.d.ts +41 -0
  106. package/lib/src/vendor/sass/importer.d.ts +471 -0
  107. package/lib/src/vendor/sass/index.d.ts +122 -0
  108. package/lib/src/vendor/sass/index.m.d.ts +122 -0
  109. package/lib/src/vendor/sass/legacy/exception.d.ts +55 -0
  110. package/lib/src/vendor/sass/legacy/function.d.ts +757 -0
  111. package/lib/src/vendor/sass/legacy/importer.d.ts +169 -0
  112. package/lib/src/vendor/sass/legacy/options.d.ts +700 -0
  113. package/lib/src/vendor/sass/legacy/plugin_this.d.ts +74 -0
  114. package/lib/src/vendor/sass/legacy/render.d.ts +144 -0
  115. package/lib/src/vendor/sass/logger/index.d.ts +115 -0
  116. package/lib/src/vendor/sass/logger/source_location.d.ts +21 -0
  117. package/lib/src/vendor/sass/logger/source_span.d.ts +34 -0
  118. package/lib/src/vendor/sass/options.d.ts +468 -0
  119. package/lib/src/vendor/sass/util/promise_or.d.ts +17 -0
  120. package/lib/src/vendor/sass/value/argument_list.d.ts +47 -0
  121. package/lib/src/vendor/sass/value/boolean.d.ts +29 -0
  122. package/lib/src/vendor/sass/value/calculation.d.ts +137 -0
  123. package/lib/src/vendor/sass/value/color.d.ts +567 -0
  124. package/lib/src/vendor/sass/value/function.d.ts +22 -0
  125. package/lib/src/vendor/sass/value/index.d.ts +219 -0
  126. package/lib/src/vendor/sass/value/list.d.ts +54 -0
  127. package/lib/src/vendor/sass/value/map.d.ts +41 -0
  128. package/lib/src/vendor/sass/value/mixin.d.ts +14 -0
  129. package/lib/src/vendor/sass/value/number.d.ts +305 -0
  130. package/lib/src/vendor/sass/value/string.d.ts +84 -0
  131. package/lib/src/version.js +28 -0
  132. package/lib/src/version.js.map +1 -0
  133. package/package.json +36 -0
  134. package/types/compile.d.ts +342 -0
  135. package/types/deprecations.d.ts +312 -0
  136. package/types/exception.d.ts +41 -0
  137. package/types/importer.d.ts +471 -0
  138. package/types/index.d.ts +122 -0
  139. package/types/index.m.d.ts +122 -0
  140. package/types/legacy/exception.d.ts +55 -0
  141. package/types/legacy/function.d.ts +757 -0
  142. package/types/legacy/importer.d.ts +169 -0
  143. package/types/legacy/options.d.ts +700 -0
  144. package/types/legacy/plugin_this.d.ts +74 -0
  145. package/types/legacy/render.d.ts +144 -0
  146. package/types/logger/index.d.ts +115 -0
  147. package/types/logger/source_location.d.ts +21 -0
  148. package/types/logger/source_span.d.ts +34 -0
  149. package/types/options.d.ts +468 -0
  150. package/types/util/promise_or.d.ts +17 -0
  151. package/types/value/argument_list.d.ts +47 -0
  152. package/types/value/boolean.d.ts +29 -0
  153. package/types/value/calculation.d.ts +137 -0
  154. package/types/value/color.d.ts +567 -0
  155. package/types/value/function.d.ts +22 -0
  156. package/types/value/index.d.ts +219 -0
  157. package/types/value/list.d.ts +54 -0
  158. package/types/value/map.d.ts +41 -0
  159. package/types/value/mixin.d.ts +14 -0
  160. package/types/value/number.d.ts +305 -0
  161. package/types/value/string.d.ts +84 -0
@@ -0,0 +1,567 @@
1
+ import {List} from 'immutable';
2
+
3
+ import {Value} from './index';
4
+
5
+ /** The HSL color space name. */
6
+ export type ColorSpaceHsl = 'hsl';
7
+
8
+ /** The HSL color space channel names. */
9
+ export type ChannelNameHsl = 'hue' | 'saturation' | 'lightness' | 'alpha';
10
+
11
+ /** The HWB color space name. */
12
+ export type ColorSpaceHwb = 'hwb';
13
+
14
+ /** The HWB color space channel names. */
15
+ export type ChannelNameHwb = 'hue' | 'whiteness' | 'blackness' | 'alpha';
16
+
17
+ /** The Lab / Oklab color space names. */
18
+ export type ColorSpaceLab = 'lab' | 'oklab';
19
+
20
+ /** The Lab / Oklab color space channel names. */
21
+ export type ChannelNameLab = 'lightness' | 'a' | 'b' | 'alpha';
22
+
23
+ /** The LCH / Oklch color space names. */
24
+ export type ColorSpaceLch = 'lch' | 'oklch';
25
+
26
+ /** The LCH / Oklch color space channel names. */
27
+ export type ChannelNameLch = 'lightness' | 'chroma' | 'hue' | 'alpha';
28
+
29
+ /** Names of color spaces with RGB channels. */
30
+ export type ColorSpaceRgb =
31
+ | 'a98-rgb'
32
+ | 'display-p3'
33
+ | 'display-p3-linear'
34
+ | 'prophoto-rgb'
35
+ | 'rec2020'
36
+ | 'rgb'
37
+ | 'srgb'
38
+ | 'srgb-linear';
39
+
40
+ /** RGB channel names. */
41
+ export type ChannelNameRgb = 'red' | 'green' | 'blue' | 'alpha';
42
+
43
+ /** Names of color spaces with XYZ channels. */
44
+ export type ColorSpaceXyz = 'xyz' | 'xyz-d50' | 'xyz-d65';
45
+
46
+ /** XYZ channel names. */
47
+ export type ChannelNameXyz = 'x' | 'y' | 'z' | 'alpha';
48
+
49
+ /** All supported color space channel names. */
50
+ export type ChannelName =
51
+ | ChannelNameHsl
52
+ | ChannelNameHwb
53
+ | ChannelNameLab
54
+ | ChannelNameLch
55
+ | ChannelNameRgb
56
+ | ChannelNameXyz;
57
+
58
+ /** All supported color space names. */
59
+ export type KnownColorSpace =
60
+ | ColorSpaceHsl
61
+ | ColorSpaceHwb
62
+ | ColorSpaceLab
63
+ | ColorSpaceLch
64
+ | ColorSpaceRgb
65
+ | ColorSpaceXyz;
66
+
67
+ /** Polar color space names (HSL, HWB, LCH, and Oklch spaces). */
68
+ export type PolarColorSpace = ColorSpaceHsl | ColorSpaceHwb | ColorSpaceLch;
69
+
70
+ /** Rectangular color space names (Lab, Oklab, RGB, and XYZ spaces). */
71
+ export type RectangularColorSpace = Exclude<KnownColorSpace, PolarColorSpace>;
72
+
73
+ /**
74
+ * Methods by which two hues are adjusted when interpolating between polar
75
+ * colors.
76
+ */
77
+ export type HueInterpolationMethod =
78
+ | 'decreasing'
79
+ | 'increasing'
80
+ | 'longer'
81
+ | 'shorter';
82
+
83
+ /**
84
+ * Methods by which colors in bounded spaces can be mapped to within their
85
+ * gamut.
86
+ *
87
+ * * `local-minde`: The algorithm specified in [the original Color Level 4
88
+ * candidate recommendation]. This maps in the Oklch color space, using the
89
+ * [deltaEOK] color difference formula and the [local-MINDE] improvement.
90
+ *
91
+ * * `clip`: Clamp each color channel that's outside the gamut to the minimum or
92
+ * maximum value for that channel. This algorithm will produce poor visual
93
+ * results, but it may be useful to match the behavior of other situations in
94
+ * which a color can be clipped.
95
+ *
96
+ * [the original Color Level 4 candidate recommendation]: https://www.w3.org/TR/2024/CRD-css-color-4-20240213/#css-gamut-mapping
97
+ * [deltaEOK]: https://www.w3.org/TR/2024/CRD-css-color-4-20240213/#color-difference-OK
98
+ * [local-MINDE]: https://www.w3.org/TR/2024/CRD-css-color-4-20240213/#GM-chroma-local-MINDE
99
+ */
100
+ export type GamutMapMethod = 'clip' | 'local-minde';
101
+
102
+ /**
103
+ * Sass's [color type](https://sass-lang.com/documentation/values/colors).
104
+ *
105
+ * No matter what representation was originally used to create this color, all
106
+ * of its channels are accessible.
107
+ *
108
+ * @category Custom Function
109
+ */
110
+ export class SassColor extends Value {
111
+ /**
112
+ * Creates an [RGB color].
113
+ *
114
+ * If `space` is missing, **only** `undefined` should be used to indicate that
115
+ * `alpha` isn't passed. If `null` is used instead, it will be treated as a
116
+ * [missing component]. See [breaking changes] for details.
117
+ *
118
+ * If `space` is defined and `null` is passed for any component, it will be
119
+ * treated as a [missing component].
120
+ *
121
+ * [RGB color]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb
122
+ * [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
123
+ * [breaking changes]: /documentation/breaking-changes/null-alpha
124
+ *
125
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
126
+ * and `1`.
127
+ */
128
+ constructor(options: {
129
+ red: number | null;
130
+ green: number | null;
131
+ blue: number | null;
132
+ alpha?: number | null;
133
+ space?: 'rgb';
134
+ });
135
+
136
+ /**
137
+ * Creates an [HSL color].
138
+ *
139
+ * If `space` is missing, **only** `undefined` should be used to indicate that
140
+ * `alpha` isn't passed. If `null` is used instead, it will be treated as a
141
+ * [missing component]. See [breaking changes] for details.
142
+ *
143
+ * If `space` is defined and `null` is passed for any component, it will be
144
+ * treated as a [missing component].
145
+ *
146
+ * [HSL color]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl
147
+ * [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
148
+ * [breaking changes]: /documentation/breaking-changes/null-alpha
149
+ *
150
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
151
+ * and `1`.
152
+ */
153
+ constructor(options: {
154
+ hue: number | null;
155
+ saturation: number | null;
156
+ lightness: number | null;
157
+ alpha?: number | null;
158
+ space?: ColorSpaceHsl;
159
+ });
160
+
161
+ /**
162
+ * Creates an [HWB color].
163
+ *
164
+ * If `space` is missing, **only** `undefined` should be used to indicate that
165
+ * `alpha` isn't passed. If `null` is used instead, it will be treated as a
166
+ * [missing component]. See [breaking changes] for details.
167
+ *
168
+ * If `space` is defined and `null` is passed for any component, it will be
169
+ * treated as a [missing component].
170
+ *
171
+ * [HWB color]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb
172
+ * [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
173
+ * [breaking changes]: /documentation/breaking-changes/null-alpha
174
+ *
175
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
176
+ * and `1`.
177
+ */
178
+ constructor(options: {
179
+ hue: number | null;
180
+ whiteness: number | null;
181
+ blackness: number | null;
182
+ alpha?: number | null;
183
+ space?: ColorSpaceHwb;
184
+ });
185
+
186
+ /**
187
+ * Creates a [Lab] or [Oklab] color.
188
+ *
189
+ * If `null` is passed for any component, it will be treated as a [missing
190
+ * component].
191
+ *
192
+ * [Lab]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab
193
+ * [Oklab]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklab
194
+ * [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
195
+ *
196
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
197
+ * and `1`.
198
+ */
199
+ constructor(options: {
200
+ lightness: number | null;
201
+ a: number | null;
202
+ b: number | null;
203
+ alpha?: number | null;
204
+ space: ColorSpaceLab;
205
+ });
206
+
207
+ /**
208
+ * Creates an [LCH] or [Oklch] color.
209
+ *
210
+ * If `null` is passed for any component, it will be treated as a [missing
211
+ * component].
212
+ *
213
+ * [LCH]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch
214
+ * [Oklch]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch
215
+ * [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
216
+ *
217
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
218
+ * and `1`.
219
+ */
220
+ constructor(options: {
221
+ lightness: number | null;
222
+ chroma: number | null;
223
+ hue: number | null;
224
+ alpha?: number | null;
225
+ space: ColorSpaceLch;
226
+ });
227
+
228
+ /**
229
+ * Creates a color in a predefined [RGB color space].
230
+ *
231
+ * If `null` is passed for any component, it will be treated as a [missing
232
+ * component].
233
+ *
234
+ * [RGB color space]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color#using_predefined_colorspaces_with_color
235
+ * [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
236
+ *
237
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
238
+ * and `1`.
239
+ */
240
+ constructor(options: {
241
+ red: number | null;
242
+ green: number | null;
243
+ blue: number | null;
244
+ alpha?: number | null;
245
+ space: Exclude<ColorSpaceRgb, 'rgb'>;
246
+ });
247
+
248
+ /**
249
+ * Creates a color in a predefined [XYZ color space].
250
+ *
251
+ * If `null` is passed for any component, it will be treated as a [missing
252
+ * component].
253
+ *
254
+ * [XYZ color space]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color#using_the_xyz_colorspace_with_color
255
+ * [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
256
+ *
257
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
258
+ * and `1`.
259
+ */
260
+ constructor(options: {
261
+ x: number | null;
262
+ y: number | null;
263
+ z: number | null;
264
+ alpha?: number | null;
265
+ space: ColorSpaceXyz;
266
+ });
267
+
268
+ /** The name of this color's space. */
269
+ get space(): KnownColorSpace;
270
+
271
+ /**
272
+ * Returns a new color that's the result of converting this color to the
273
+ * specified `space`.
274
+ */
275
+ toSpace(space: KnownColorSpace): SassColor;
276
+
277
+ /**
278
+ * A boolean indicating whether this color is in a legacy color space (`rgb`,
279
+ * `hsl`, or `hwb`).
280
+ */
281
+ get isLegacy(): boolean;
282
+
283
+ /**
284
+ * Returns a boolean indicating whether this color is in-gamut (as opposed to
285
+ * having one or more of its channels out of bounds) for the specified
286
+ * `space`, or its current color space if `space` is not specified.
287
+ */
288
+ isInGamut(space?: KnownColorSpace): boolean;
289
+
290
+ /**
291
+ * Returns a copy of this color, modified so it is in-gamut for the specified
292
+ * `space`—or the current color space if `space` is not specified—using
293
+ * `method` to map out-of-gamut colors into the desired gamut.
294
+ */
295
+ toGamut(options: {
296
+ space?: KnownColorSpace;
297
+ method: GamutMapMethod;
298
+ }): SassColor;
299
+
300
+ /**
301
+ * A list of this color's channel values (excluding alpha), with [missing
302
+ * channels] converted to `null`.
303
+ *
304
+ * [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
305
+ */
306
+ get channelsOrNull(): List<number | null>;
307
+
308
+ /**
309
+ * A list of this color's channel values (excluding alpha), with [missing
310
+ * channels] converted to `0`.
311
+ *
312
+ * [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
313
+ */
314
+ get channels(): List<number>;
315
+
316
+ /**
317
+ * Returns the value of a single specified `channel` of this color, with
318
+ * [missing channels] converted to `0`.
319
+ *
320
+ * [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
321
+ *
322
+ * @throws `Error` if `channel` is not `alpha` or a channel in this color's
323
+ * space.
324
+ */
325
+ channel(channel: ChannelName): number;
326
+
327
+ /**
328
+ * Returns the value of a single specified `channel` of this color after
329
+ * converting this color to the specified `space`, with [missing channels]
330
+ * converted to `0`.
331
+ *
332
+ * [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
333
+ *
334
+ * @throws `Error` if `channel` is not `alpha` or a channel in `space`.
335
+ */
336
+ channel(channel: ChannelNameHsl, options: {space: ColorSpaceHsl}): number;
337
+ channel(channel: ChannelNameHwb, options: {space: ColorSpaceHwb}): number;
338
+ channel(channel: ChannelNameLab, options: {space: ColorSpaceLab}): number;
339
+ channel(channel: ChannelNameLch, options: {space: ColorSpaceLch}): number;
340
+ channel(channel: ChannelNameRgb, options: {space: ColorSpaceRgb}): number;
341
+ channel(channel: ChannelNameXyz, options: {space: ColorSpaceXyz}): number;
342
+
343
+ /** This color's alpha channel, between `0` and `1`. */
344
+ get alpha(): number;
345
+
346
+ /**
347
+ * Returns a boolean indicating whether a given channel value is a [missing
348
+ * channel].
349
+ *
350
+ * [missing channel]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
351
+ */
352
+ isChannelMissing(channel: ChannelName): boolean;
353
+
354
+ /**
355
+ * Returns a boolean indicating whether a given `channel` is [powerless] in
356
+ * this color. This is a special state that's defined for individual color
357
+ * spaces, which indicates that a channel's value won't affect how a color is
358
+ * displayed.
359
+ *
360
+ * [powerless]: https://www.w3.org/TR/css-color-4/#powerless
361
+ */
362
+ isChannelPowerless(channel: ChannelName): boolean;
363
+ isChannelPowerless(
364
+ channel: ChannelNameHsl,
365
+ options?: {space: ColorSpaceHsl}
366
+ ): boolean;
367
+ isChannelPowerless(
368
+ channel: ChannelNameHwb,
369
+ options?: {space: ColorSpaceHwb}
370
+ ): boolean;
371
+ isChannelPowerless(
372
+ channel: ChannelNameLab,
373
+ options?: {space: ColorSpaceLab}
374
+ ): boolean;
375
+ isChannelPowerless(
376
+ channel: ChannelNameLch,
377
+ options?: {space: ColorSpaceLch}
378
+ ): boolean;
379
+ isChannelPowerless(
380
+ channel: ChannelNameRgb,
381
+ options?: {space: ColorSpaceRgb}
382
+ ): boolean;
383
+ isChannelPowerless(
384
+ channel: ChannelNameXyz,
385
+ options?: {space: ColorSpaceXyz}
386
+ ): boolean;
387
+
388
+ /**
389
+ * Returns a color partway between this color and `color2` according to
390
+ * `method`, as defined by the CSS Color 4 [color interpolation] procedure.
391
+ *
392
+ * [color interpolation]: https://www.w3.org/TR/css-color-4/#interpolation
393
+ *
394
+ * If `method` is missing and this color is in a rectangular color space (Lab,
395
+ * Oklab, RGB, and XYZ spaces), `method` defaults to the color space of this
396
+ * color. Otherwise, `method` defaults to a space separated list containing
397
+ * the color space of this color and the string "shorter".
398
+ *
399
+ * The `weight` is a number between 0 and 1 that indicates how much of this
400
+ * color should be in the resulting color. If omitted, it defaults to 0.5.
401
+ */
402
+ interpolate(
403
+ color2: SassColor,
404
+ options?: {
405
+ weight?: number;
406
+ method?: HueInterpolationMethod;
407
+ }
408
+ ): SassColor;
409
+
410
+ /**
411
+ * Returns a new color that's the result of changing one or more of this
412
+ * color's HSL channels.
413
+ *
414
+ * @throws `Error` if `space` is missing and this color is not in a legacy
415
+ * color space (`rgb`, `hsl`, or `hwb`).
416
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
417
+ * and `1`.
418
+ */
419
+ change(
420
+ options: {
421
+ [key in ChannelNameHsl]?: number | null;
422
+ } & {
423
+ space?: ColorSpaceHsl;
424
+ }
425
+ ): SassColor;
426
+
427
+ /**
428
+ * Returns a new color that's the result of changing one or more of this
429
+ * color's HWB channels.
430
+ *
431
+ * @throws `Error` if `space` is missing and this color is not in a legacy
432
+ * color space (`rgb`, `hsl`, or `hwb`).
433
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
434
+ * and `1`.
435
+ */
436
+ change(
437
+ options: {
438
+ [key in ChannelNameHwb]?: number | null;
439
+ } & {
440
+ space?: ColorSpaceHwb;
441
+ }
442
+ ): SassColor;
443
+
444
+ /**
445
+ * Returns a new color that's the result of changing one or more of this
446
+ * color's Lab channels.
447
+ *
448
+ * @throws `Error` if `space` is missing and this color is not in the Lab or
449
+ * Oklab color spaces.
450
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
451
+ * and `1`.
452
+ */
453
+ change(
454
+ options: {
455
+ [key in ChannelNameLab]?: number | null;
456
+ } & {
457
+ space?: ColorSpaceLab;
458
+ }
459
+ ): SassColor;
460
+
461
+ /**
462
+ * Returns a new color that's the result of changing one or more of this
463
+ * color's LCH channels.
464
+ *
465
+ * @throws `Error` if `space` is missing and this color is not in the LCH or
466
+ * Oklch color spaces.
467
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
468
+ * and `1`.
469
+ */
470
+ change(
471
+ options: {
472
+ [key in ChannelNameLch]?: number | null;
473
+ } & {
474
+ space?: ColorSpaceLch;
475
+ }
476
+ ): SassColor;
477
+
478
+ /**
479
+ * Returns a new color that's the result of changing one or more of this
480
+ * color's RGB channels.
481
+ *
482
+ * @throws `Error` if `space` is missing and this color is not in a legacy
483
+ * color space (`rgb`, `hsl`, or `hwb`).
484
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
485
+ * and `1`.
486
+ */
487
+ change(
488
+ options: {
489
+ [key in ChannelNameRgb]?: number | null;
490
+ } & {
491
+ space?: ColorSpaceRgb;
492
+ }
493
+ ): SassColor;
494
+
495
+ /**
496
+ * Returns a new color that's the result of changing one or more of this
497
+ * color's XYZ channels.
498
+ *
499
+ * @throws `Error` if `space` is missing and this color is not in an XYZ color
500
+ * space.
501
+ * @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
502
+ * and `1`.
503
+ */
504
+ change(
505
+ options: {
506
+ [key in ChannelNameXyz]?: number | null;
507
+ } & {
508
+ space?: ColorSpaceXyz;
509
+ }
510
+ ): SassColor;
511
+
512
+ /**
513
+ * This color's red channel in the RGB color space.
514
+ *
515
+ * @deprecated Use {@link channel} instead.
516
+ */
517
+ get red(): number;
518
+
519
+ /**
520
+ * This color's green channel in the RGB color space.
521
+ *
522
+ * @deprecated Use {@link channel} instead.
523
+ */
524
+ get green(): number;
525
+
526
+ /**
527
+ * This color's blue channel in the RGB color space.
528
+ *
529
+ * @deprecated Use {@link channel} instead.
530
+ */
531
+ get blue(): number;
532
+
533
+ /**
534
+ * This color's hue in the HSL color space.
535
+ *
536
+ * @deprecated Use {@link channel} instead.
537
+ */
538
+ get hue(): number;
539
+
540
+ /**
541
+ * This color's saturation in the HSL color space.
542
+ *
543
+ * @deprecated Use {@link channel} instead.
544
+ */
545
+ get saturation(): number;
546
+
547
+ /**
548
+ * This color's lightness in the HSL color space.
549
+ *
550
+ * @deprecated Use {@link channel} instead.
551
+ */
552
+ get lightness(): number;
553
+
554
+ /**
555
+ * This color's whiteness in the HWB color space.
556
+ *
557
+ * @deprecated Use {@link channel} instead.
558
+ */
559
+ get whiteness(): number;
560
+
561
+ /**
562
+ * This color's blackness in the HWB color space.
563
+ *
564
+ * @deprecated Use {@link channel} instead.
565
+ */
566
+ get blackness(): number;
567
+ }
@@ -0,0 +1,22 @@
1
+ import {Value} from './index';
2
+
3
+ /**
4
+ * Sass's [function type](https://sass-lang.com/documentation/values/functions).
5
+ *
6
+ * **Heads up!** Although first-class Sass functions can be processed by custom
7
+ * functions, there's no way to invoke them outside of a Sass stylesheet.
8
+ *
9
+ * @category Custom Function
10
+ */
11
+ export class SassFunction extends Value {
12
+ /**
13
+ * Creates a new first-class function that can be invoked using
14
+ * [`meta.call()`](https://sass-lang.com/documentation/modules/meta#call).
15
+ *
16
+ * @param signature - The function signature, like you'd write for the
17
+ * [`@function rule`](https://sass-lang.com/documentation/at-rules/function).
18
+ * @param callback - The callback that's invoked when this function is called,
19
+ * just like for a {@link CustomFunction}.
20
+ */
21
+ constructor(signature: string, callback: (args: Value[]) => Value);
22
+ }