sass-embedded 1.0.0-beta.1 → 1.0.0-beta.7

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