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,583 @@
1
+ "use strict";
2
+ // Copyright 2021 Google Inc. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SassNumber = void 0;
7
+ const immutable_1 = require("immutable");
8
+ const utils_1 = require("../utils");
9
+ const index_1 = require("./index");
10
+ const utils_2 = require("./utils");
11
+ // Conversion rates for each unit.
12
+ const conversions = {
13
+ // Length
14
+ in: {
15
+ in: 1,
16
+ cm: 1 / 2.54,
17
+ pc: 1 / 6,
18
+ mm: 1 / 25.4,
19
+ q: 1 / 101.6,
20
+ pt: 1 / 72,
21
+ px: 1 / 96,
22
+ },
23
+ cm: {
24
+ in: 2.54,
25
+ cm: 1,
26
+ pc: 2.54 / 6,
27
+ mm: 1 / 10,
28
+ q: 1 / 40,
29
+ pt: 2.54 / 72,
30
+ px: 2.54 / 96,
31
+ },
32
+ pc: {
33
+ in: 6,
34
+ cm: 6 / 2.54,
35
+ pc: 1,
36
+ mm: 6 / 25.4,
37
+ q: 6 / 101.6,
38
+ pt: 1 / 12,
39
+ px: 1 / 16,
40
+ },
41
+ mm: {
42
+ in: 25.4,
43
+ cm: 10,
44
+ pc: 25.4 / 6,
45
+ mm: 1,
46
+ q: 1 / 4,
47
+ pt: 25.4 / 72,
48
+ px: 25.4 / 96,
49
+ },
50
+ q: {
51
+ in: 101.6,
52
+ cm: 40,
53
+ pc: 101.6 / 6,
54
+ mm: 4,
55
+ q: 1,
56
+ pt: 101.6 / 72,
57
+ px: 101.6 / 96,
58
+ },
59
+ pt: {
60
+ in: 72,
61
+ cm: 72 / 2.54,
62
+ pc: 12,
63
+ mm: 72 / 25.4,
64
+ q: 72 / 101.6,
65
+ pt: 1,
66
+ px: 3 / 4,
67
+ },
68
+ px: {
69
+ in: 96,
70
+ cm: 96 / 2.54,
71
+ pc: 16,
72
+ mm: 96 / 25.4,
73
+ q: 96 / 101.6,
74
+ pt: 4 / 3,
75
+ px: 1,
76
+ },
77
+ // Rotation
78
+ deg: {
79
+ deg: 1,
80
+ grad: 9 / 10,
81
+ rad: 180 / Math.PI,
82
+ turn: 360,
83
+ },
84
+ grad: {
85
+ deg: 10 / 9,
86
+ grad: 1,
87
+ rad: 200 / Math.PI,
88
+ turn: 400,
89
+ },
90
+ rad: {
91
+ deg: Math.PI / 180,
92
+ grad: Math.PI / 200,
93
+ rad: 1,
94
+ turn: 2 * Math.PI,
95
+ },
96
+ turn: {
97
+ deg: 1 / 360,
98
+ grad: 1 / 400,
99
+ rad: 1 / (2 * Math.PI),
100
+ turn: 1,
101
+ },
102
+ // Time
103
+ s: {
104
+ s: 1,
105
+ ms: 1 / 1000,
106
+ },
107
+ ms: {
108
+ s: 1000,
109
+ ms: 1,
110
+ },
111
+ // Frequency
112
+ Hz: { Hz: 1, kHz: 1000 },
113
+ kHz: { Hz: 1 / 1000, kHz: 1 },
114
+ // Pixel density
115
+ dpi: {
116
+ dpi: 1,
117
+ dpcm: 2.54,
118
+ dppx: 96,
119
+ },
120
+ dpcm: {
121
+ dpi: 1 / 2.54,
122
+ dpcm: 1,
123
+ dppx: 96 / 2.54,
124
+ },
125
+ dppx: {
126
+ dpi: 1 / 96,
127
+ dpcm: 2.54 / 96,
128
+ dppx: 1,
129
+ },
130
+ };
131
+ // A map from each human-readable type of unit to the units that belong to that
132
+ // type.
133
+ const unitsByType = {
134
+ length: ['in', 'cm', 'pc', 'mm', 'q', 'pt', 'px'],
135
+ angle: ['deg', 'grad', 'rad', 'turn'],
136
+ time: ['s', 'ms'],
137
+ frequency: ['Hz', 'kHz'],
138
+ 'pixel density': ['dpi', 'dpcm', 'dppx'],
139
+ };
140
+ // A map from each unit to its human-readable type.
141
+ const typesByUnit = {};
142
+ for (const [type, units] of Object.entries(unitsByType)) {
143
+ for (const unit of units) {
144
+ typesByUnit[unit] = type;
145
+ }
146
+ }
147
+ /** A SassScript number. */
148
+ class SassNumber extends index_1.Value {
149
+ valueInternal;
150
+ numeratorUnitsInternal;
151
+ denominatorUnitsInternal;
152
+ constructor(value, unitOrOptions) {
153
+ super();
154
+ if (typeof unitOrOptions === 'string') {
155
+ this.valueInternal = value;
156
+ this.numeratorUnitsInternal =
157
+ unitOrOptions === undefined ? (0, immutable_1.List)([]) : (0, immutable_1.List)([unitOrOptions]);
158
+ this.denominatorUnitsInternal = (0, immutable_1.List)([]);
159
+ return;
160
+ }
161
+ let numerators = (0, utils_1.asImmutableList)(unitOrOptions?.numeratorUnits ?? []);
162
+ const unsimplifiedDenominators = unitOrOptions?.denominatorUnits ?? [];
163
+ const denominators = [];
164
+ for (const denominator of unsimplifiedDenominators) {
165
+ let simplifiedAway = false;
166
+ for (const [i, numerator] of numerators.entries()) {
167
+ const factor = conversionFactor(denominator, numerator);
168
+ if (factor === null)
169
+ continue;
170
+ value /= factor;
171
+ numerators = numerators.delete(i);
172
+ simplifiedAway = true;
173
+ break;
174
+ }
175
+ if (!simplifiedAway)
176
+ denominators.push(denominator);
177
+ }
178
+ this.valueInternal = value;
179
+ this.numeratorUnitsInternal = numerators;
180
+ this.denominatorUnitsInternal = (0, immutable_1.List)(denominators);
181
+ }
182
+ /** `this`'s value. */
183
+ get value() {
184
+ return this.valueInternal;
185
+ }
186
+ /** Whether `value` is an integer. */
187
+ get isInt() {
188
+ return (0, utils_2.fuzzyIsInt)(this.value);
189
+ }
190
+ /**
191
+ * If `value` is an integer according to `isInt`, returns `value` rounded to
192
+ * that integer.
193
+ *
194
+ * Otherwise, returns null.
195
+ */
196
+ get asInt() {
197
+ return (0, utils_2.fuzzyAsInt)(this.value);
198
+ }
199
+ /** `this`'s numerator units. */
200
+ get numeratorUnits() {
201
+ return this.numeratorUnitsInternal;
202
+ }
203
+ /** `this`'s denominator units. */
204
+ get denominatorUnits() {
205
+ return this.denominatorUnitsInternal;
206
+ }
207
+ /** Whether `this` has any units. */
208
+ get hasUnits() {
209
+ return !(this.numeratorUnits.isEmpty() && this.denominatorUnits.isEmpty());
210
+ }
211
+ assertNumber() {
212
+ return this;
213
+ }
214
+ /**
215
+ * If `value` is an integer according to `isInt`, returns it as an integer.
216
+ *
217
+ * Otherwise, throws an error.
218
+ *
219
+ * If `this` came from a function argument, `name` is the argument name
220
+ * (without the `$`) and is used for error reporting.
221
+ */
222
+ assertInt(name) {
223
+ const int = (0, utils_2.fuzzyAsInt)(this.value);
224
+ if (int === null) {
225
+ throw (0, utils_1.valueError)(`${this} is not an int`, name);
226
+ }
227
+ return int;
228
+ }
229
+ /**
230
+ * If `value` is within `min` and `max`, returns `value`, or if it
231
+ * `fuzzyEquals` `min` or `max`, returns `value` clamped to that value.
232
+ *
233
+ * Otherwise, throws an error.
234
+ *
235
+ * If `this` came from a function argument, `name` is the argument name
236
+ * (without the `$`) and is used for error reporting.
237
+ */
238
+ assertInRange(min, max, name) {
239
+ const clamped = (0, utils_2.fuzzyInRange)(this.value, min, max);
240
+ if (clamped === null) {
241
+ throw (0, utils_1.valueError)(`${this} must be between ${min} and ${max}`, name);
242
+ }
243
+ return clamped;
244
+ }
245
+ /**
246
+ * If `this` has no units, returns `this`.
247
+ *
248
+ * Otherwise, throws an error.
249
+ *
250
+ * If `this` came from a function argument, `name` is the argument name
251
+ * (without the `$`) and is used for error reporting.
252
+ */
253
+ assertNoUnits(name) {
254
+ if (this.hasUnits) {
255
+ throw (0, utils_1.valueError)(`Expected ${this} to have no units`, name);
256
+ }
257
+ return this;
258
+ }
259
+ /**
260
+ * If `this` has `unit` as its only unit (and as a numerator), returns `this`.
261
+ *
262
+ * Otherwise, throws an error.
263
+ *
264
+ * If `this` came from a function argument, `name` is the argument name
265
+ * (without the `$`) and is used for error reporting.
266
+ */
267
+ assertUnit(unit, name) {
268
+ if (!this.hasUnit(unit)) {
269
+ throw (0, utils_1.valueError)(`Expected ${this} to have no unit ${unit}`, name);
270
+ }
271
+ return this;
272
+ }
273
+ /** Whether `this` has `unit` as its only unit (and as a numerator). */
274
+ hasUnit(unit) {
275
+ return (this.denominatorUnits.isEmpty() &&
276
+ this.numeratorUnits.size === 1 &&
277
+ this.numeratorUnits.get(0) === unit);
278
+ }
279
+ /** Whether `this` is compatible with `unit`. */
280
+ compatibleWithUnit(unit) {
281
+ if (!this.denominatorUnits.isEmpty())
282
+ return false;
283
+ if (this.numeratorUnits.size > 1)
284
+ return false;
285
+ const numerator = this.numeratorUnits.get(0);
286
+ return typesByUnit[numerator]
287
+ ? typesByUnit[numerator] === typesByUnit[unit]
288
+ : numerator === unit;
289
+ }
290
+ /**
291
+ * Returns a copy of `this`, converted to the units represented by
292
+ * `newNumerators` and `newDenominators`.
293
+ *
294
+ * Throws an error if `this`'s units are incompatible with `newNumerators` and
295
+ * `newDenominators`. Also throws an error if `this` is unitless and either
296
+ * `newNumerators` or `newDenominators` are not empty, or vice-versa.
297
+ *
298
+ * If `this` came from a function argument, `name` is the argument name
299
+ * (without the `$`) and is used for error reporting.
300
+ */
301
+ convert(newNumerators, newDenominators, name) {
302
+ return new SassNumber(this.convertValue(newNumerators, newDenominators, name), { numeratorUnits: newNumerators, denominatorUnits: newDenominators });
303
+ }
304
+ /**
305
+ * Returns `value`, converted to the units represented by `newNumerators` and
306
+ * `newDenominators`.
307
+ *
308
+ * Throws an error if `this`'s units are incompatible with `newNumerators` and
309
+ * `newDenominators`. Also throws an error if `this` is unitless and either
310
+ * `newNumerators` or `newDenominators` are not empty, or vice-versa.
311
+ *
312
+ * If `this` came from a function argument, `name` is the argument name
313
+ * (without the `$`) and is used for error reporting.
314
+ */
315
+ convertValue(newNumerators, newDenominators, name) {
316
+ return this.convertOrCoerce({
317
+ coerceUnitless: false,
318
+ newNumeratorUnits: (0, utils_1.asImmutableList)(newNumerators),
319
+ newDenominatorUnits: (0, utils_1.asImmutableList)(newDenominators),
320
+ name,
321
+ });
322
+ }
323
+ /**
324
+ * Returns a copy of `this`, converted to the same units as `other`.
325
+ *
326
+ * Throws an error if `this`'s units are incompatible with `other`'s units, or
327
+ * if either number is unitless but the other is not.
328
+ *
329
+ * If `this` came from a function argument, `name` is the argument name
330
+ * and `otherName` is the argument name for `other` (both without the `$`).
331
+ * They are used for error reporting.
332
+ */
333
+ convertToMatch(other, name, otherName) {
334
+ return new SassNumber(this.convertValueToMatch(other, name, otherName), {
335
+ numeratorUnits: other.numeratorUnits,
336
+ denominatorUnits: other.denominatorUnits,
337
+ });
338
+ }
339
+ /**
340
+ * Returns `value`, converted to the same units as `other`.
341
+ *
342
+ * Throws an error if `this`'s units are incompatible with `other`'s units, or
343
+ * if either number is unitless but the other is not.
344
+ *
345
+ * If `this` came from a function argument, `name` is the argument name
346
+ * and `otherName` is the argument name for `other` (both without the `$`).
347
+ * They are used for error reporting.
348
+ */
349
+ convertValueToMatch(other, name, otherName) {
350
+ return this.convertOrCoerce({
351
+ coerceUnitless: false,
352
+ other,
353
+ name,
354
+ otherName,
355
+ });
356
+ }
357
+ /**
358
+ * Returns a copy of `this`, converted to the units represented by
359
+ * `newNumerators` and `newDenominators`.
360
+ *
361
+ * Does *not* throw an error if this number is unitless and either
362
+ * `newNumerators` or `newDenominators` are not empty, or vice-versa. Instead,
363
+ * it treats all unitless numbers as convertible to and from all units
364
+ * without changing the value.
365
+ *
366
+ * Throws an error if `this`'s units are incompatible with `newNumerators` and
367
+ * `newDenominators`.
368
+ *
369
+ * If `this` came from a function argument, `name` is the argument name
370
+ * (without the `$`) and is used for error reporting.
371
+ */
372
+ coerce(newNumerators, newDenominators, name) {
373
+ return new SassNumber(this.coerceValue(newNumerators, newDenominators, name), { numeratorUnits: newNumerators, denominatorUnits: newDenominators });
374
+ }
375
+ /**
376
+ * Returns `value`, converted to the units represented by `newNumerators` and
377
+ * `newDenominators`.
378
+ *
379
+ * Does *not* throw an error if this number is unitless and either
380
+ * `newNumerators` or `newDenominators` are not empty, or vice-versa. Instead,
381
+ * it treats all unitless numbers as convertible to and from all units
382
+ * without changing the value.
383
+ *
384
+ * Throws an error if `this`'s units are incompatible with `newNumerators` and
385
+ * `newDenominators`.
386
+ *
387
+ * If `this` came from a function argument, `name` is the argument name
388
+ * (without the `$`) and is used for error reporting.
389
+ */
390
+ coerceValue(newNumerators, newDenominators, name) {
391
+ return this.convertOrCoerce({
392
+ coerceUnitless: true,
393
+ newNumeratorUnits: (0, utils_1.asImmutableList)(newNumerators),
394
+ newDenominatorUnits: (0, utils_1.asImmutableList)(newDenominators),
395
+ name,
396
+ });
397
+ }
398
+ /**
399
+ * Returns a copy of `this`, converted to the same units as `other`.
400
+ *
401
+ * Does *not* throw an error if `this` is unitless and `other` is not, or
402
+ * vice-versa. Instead, it treats all unitless numbers as convertible to and
403
+ * from all units without changing the value.
404
+ *
405
+ * Throws an error if `this`'s units are incompatible with `other`'s units.
406
+ *
407
+ * If `this` came from a function argument, `name` is the argument name
408
+ * and `otherName` is the argument name for `other` (both without the `$`).
409
+ * They are used for error reporting.
410
+ */
411
+ coerceToMatch(other, name, otherName) {
412
+ return new SassNumber(this.coerceValueToMatch(other, name, otherName), {
413
+ numeratorUnits: other.numeratorUnits,
414
+ denominatorUnits: other.denominatorUnits,
415
+ });
416
+ }
417
+ /**
418
+ * Returns `value`, converted to the same units as `other`.
419
+ *
420
+ * Does *not* throw an error if `this` is unitless and `other` is not, or
421
+ * vice-versa. Instead, it treats all unitless numbers as convertible to and
422
+ * from all units without changing the value.
423
+ *
424
+ * Throws an error if `this`'s units are incompatible with `other`'s units.
425
+ *
426
+ * If `this` came from a function argument, `name` is the argument name
427
+ * and `otherName` is the argument name for `other` (both without the `$`).
428
+ * They are used for error reporting.
429
+ */
430
+ coerceValueToMatch(other, name, otherName) {
431
+ return this.convertOrCoerce({
432
+ coerceUnitless: true,
433
+ other,
434
+ name,
435
+ otherName,
436
+ });
437
+ }
438
+ equals(other) {
439
+ if (!(other instanceof SassNumber))
440
+ return false;
441
+ try {
442
+ return (0, utils_2.fuzzyEquals)(this.value, other.convertValueToMatch(this));
443
+ }
444
+ catch {
445
+ return false;
446
+ }
447
+ }
448
+ hashCode() {
449
+ const canonicalNumerators = canonicalizeUnits(this.numeratorUnits);
450
+ const canonicalDenominators = canonicalizeUnits(this.denominatorUnits);
451
+ const canonicalValue = this.convertValue(canonicalNumerators, canonicalDenominators);
452
+ return ((0, utils_2.fuzzyHashCode)(canonicalValue) ^
453
+ (0, immutable_1.hash)(canonicalNumerators) ^
454
+ (0, immutable_1.hash)(canonicalDenominators));
455
+ }
456
+ toString() {
457
+ return `${this.value}${unitString(this.numeratorUnits, this.denominatorUnits)}`;
458
+ }
459
+ // Returns the value of converting `number` to new units.
460
+ //
461
+ // The units may be specified as lists of units (`newNumeratorUnits` and
462
+ // `newDenominatorUnits`), or by providng a SassNumber `other` that contains the
463
+ // desired units.
464
+ //
465
+ // Throws an error if `number` is not compatible with the new units. Coercing a
466
+ // unitful number to unitless (or vice-versa) throws an error unless
467
+ // specifically enabled with `coerceUnitless`.
468
+ convertOrCoerce(params) {
469
+ const newNumerators = 'other' in params
470
+ ? params.other.numeratorUnits
471
+ : params.newNumeratorUnits;
472
+ const newDenominators = 'other' in params
473
+ ? params.other.denominatorUnits
474
+ : params.newDenominatorUnits;
475
+ const compatibilityError = () => {
476
+ if ('other' in params) {
477
+ let message = `${this} and`;
478
+ if (params.otherName) {
479
+ message += ` $${params.otherName}:`;
480
+ }
481
+ message += ` ${params.other} have incompatible units`;
482
+ if (!this.hasUnits || !otherHasUnits) {
483
+ message += " (one has units and the other doesn't)";
484
+ }
485
+ return (0, utils_1.valueError)(message, params.name);
486
+ }
487
+ if (!otherHasUnits) {
488
+ return (0, utils_1.valueError)(`Expected ${this} to have no units`, params.name);
489
+ }
490
+ // For single numerators, throw a detailed error with info about which unit
491
+ // types would have been acceptable.
492
+ if (newNumerators.size === 1 && newDenominators.isEmpty()) {
493
+ const type = typesByUnit[newNumerators.get(0)];
494
+ if (type) {
495
+ return (0, utils_1.valueError)(`Expected ${this} to have a single ${type} unit (${unitsByType[type].join(', ')})`, params.name);
496
+ }
497
+ }
498
+ const unitSize = newNumerators.size + newDenominators.size;
499
+ return (0, utils_1.valueError)(`Expected $this to have ${unitSize === 0
500
+ ? 'no units'
501
+ : `unit${unitSize > 1 ? 's' : ''} ${unitString(newNumerators, newDenominators)}`}`, params.name);
502
+ };
503
+ const otherHasUnits = !newNumerators.isEmpty() || !newDenominators.isEmpty();
504
+ if ((this.hasUnits && !otherHasUnits) ||
505
+ (!this.hasUnits && otherHasUnits)) {
506
+ if (params.coerceUnitless)
507
+ return this.value;
508
+ throw compatibilityError();
509
+ }
510
+ if (this.numeratorUnits.equals(newNumerators) &&
511
+ this.denominatorUnits.equals(newDenominators)) {
512
+ return this.value;
513
+ }
514
+ let value = this.value;
515
+ let oldNumerators = this.numeratorUnits;
516
+ for (const newNumerator of newNumerators) {
517
+ const idx = oldNumerators.findIndex(oldNumerator => {
518
+ const factor = conversionFactor(oldNumerator, newNumerator);
519
+ if (factor === null)
520
+ return false;
521
+ value *= factor;
522
+ return true;
523
+ });
524
+ if (idx < 0)
525
+ throw compatibilityError();
526
+ oldNumerators = oldNumerators.delete(idx);
527
+ }
528
+ let oldDenominators = this.denominatorUnits;
529
+ for (const newDenominator of newDenominators) {
530
+ const idx = oldDenominators.findIndex(oldDenominator => {
531
+ const factor = conversionFactor(oldDenominator, newDenominator);
532
+ if (factor === null)
533
+ return false;
534
+ value /= factor;
535
+ return true;
536
+ });
537
+ if (idx < 0)
538
+ throw compatibilityError();
539
+ oldDenominators = oldDenominators.delete(idx);
540
+ }
541
+ if (!oldNumerators.isEmpty() || !oldDenominators.isEmpty()) {
542
+ throw compatibilityError();
543
+ }
544
+ return value;
545
+ }
546
+ }
547
+ exports.SassNumber = SassNumber;
548
+ // Returns the conversion factor needed to convert from `fromUnit` to `toUnit`.
549
+ // Returns null if no such factor exists.
550
+ function conversionFactor(fromUnit, toUnit) {
551
+ if (fromUnit === toUnit)
552
+ return 1;
553
+ const factors = conversions[toUnit];
554
+ if (!factors)
555
+ return null;
556
+ return factors[fromUnit] ?? null;
557
+ }
558
+ // Returns a human-readable string representation of `numerators` and
559
+ // `denominators`.
560
+ function unitString(numerators, denominators) {
561
+ if (numerators.isEmpty() && denominators.isEmpty()) {
562
+ return '';
563
+ }
564
+ if (denominators.isEmpty()) {
565
+ return numerators.join('*');
566
+ }
567
+ if (numerators.isEmpty()) {
568
+ return denominators.size === 1
569
+ ? `${denominators.get(0)}^-1`
570
+ : `(${denominators.join('*')})^-1`;
571
+ }
572
+ return `${numerators.join('*')}/${denominators.join('*')}`;
573
+ }
574
+ // Converts the `units` list into an equivalent canonical list.
575
+ function canonicalizeUnits(units) {
576
+ return units
577
+ .map(unit => {
578
+ const type = typesByUnit[unit];
579
+ return type ? unitsByType[type][0] : unit;
580
+ })
581
+ .sort();
582
+ }
583
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../lib/src/value/number.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAAqC;AAErC,oCAAqD;AACrD,mCAA8B;AAC9B,mCAMiB;AAEjB,kCAAkC;AAClC,MAAM,WAAW,GAA2C;IAC1D,SAAS;IACT,EAAE,EAAE;QACF,EAAE,EAAE,CAAC;QACL,EAAE,EAAE,CAAC,GAAG,IAAI;QACZ,EAAE,EAAE,CAAC,GAAG,CAAC;QACT,EAAE,EAAE,CAAC,GAAG,IAAI;QACZ,CAAC,EAAE,CAAC,GAAG,KAAK;QACZ,EAAE,EAAE,CAAC,GAAG,EAAE;QACV,EAAE,EAAE,CAAC,GAAG,EAAE;KACX;IACD,EAAE,EAAE;QACF,EAAE,EAAE,IAAI;QACR,EAAE,EAAE,CAAC;QACL,EAAE,EAAE,IAAI,GAAG,CAAC;QACZ,EAAE,EAAE,CAAC,GAAG,EAAE;QACV,CAAC,EAAE,CAAC,GAAG,EAAE;QACT,EAAE,EAAE,IAAI,GAAG,EAAE;QACb,EAAE,EAAE,IAAI,GAAG,EAAE;KACd;IACD,EAAE,EAAE;QACF,EAAE,EA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