uom-types 3.1.1 → 4.0.0

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.
@@ -1,89 +0,0 @@
1
- import { x as Exactify, b as UnitClass, E as Exponent, a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, l as UnknownUnitMeta, e as UnitFrom } from './_units.mjs';
2
-
3
- type SiUnitKeys = "Second" | "Metre" | "Kilogram" | "Mole" | "Ampere" | "Candela" | "Kelvin" | "Radian";
4
- /**
5
- * The {@link UnitClass} that is the base of all {@link Unit}s defined by this library.
6
- *
7
- * @group Unit Classes
8
- */
9
- type BaseUnitClass<T extends Exactify<SiUnitConfig, T>> = UnitClass<T>;
10
- type SiUnitConfig = {
11
- [K in SiUnitKeys]?: Exponent;
12
- };
13
-
14
- /**
15
- * @group Unit Classes
16
- * @category Angle (Plane)
17
- */
18
- type PlaneAngleUnitClass = BaseUnitClass<{
19
- Radian: 1;
20
- }>;
21
- /**
22
- * @group Abstract Units
23
- * @category Angle (Plane)
24
- */
25
- type PlaneAngle = AbstractUnitFrom<PlaneAngleUnitClass>;
26
- /**
27
- * @group Unit Generators
28
- * @category Angle (Plane)
29
- */
30
- type PlaneAngleUnit<M extends UnitSubvalues> = PlaneAngleUnitFrom<UnitMeta<M>>;
31
- /**
32
- * @group Unit Generators
33
- * @category Angle (Plane)
34
- */
35
- type PlaneAngleUnitFrom<M extends UnknownUnitMeta> = UnitFrom<PlaneAngleUnitClass, M>;
36
- /**
37
- * A unit of {@link PlaneAngle}.
38
- *
39
- * One radian is equal to the angle subtended at the centre of a circle by an
40
- * arc equal in length to the radius.
41
- * The total plane angle about a point is 2π radian.
42
- *
43
- * @group Units
44
- * @category Base
45
- * @category Angle (Plane)
46
- * @symbol `rad`
47
- */
48
- type Radian = PlaneAngleUnit<{}>;
49
- /**
50
- * A unit of {@link PlaneAngle}.
51
- *
52
- * The total plane angle of a circle is 360 degrees.
53
- *
54
- * @group Units
55
- * @category Angle (Plane)
56
- * @symbol `°`
57
- */
58
- type Degree = PlaneAngleUnit<{
59
- scalar360: 1;
60
- scalar2π: -1;
61
- }>;
62
- /**
63
- * A unit of {@link PlaneAngle}.
64
- *
65
- * One gradian is equal to 100th of a right angle.
66
- * The total plane angle about a point is 400 gradian.
67
- *
68
- * @group Units
69
- * @category Angle (Plane)
70
- * @symbol `gon`
71
- */
72
- type Gradian = PlaneAngleUnit<{
73
- scalar400: 1;
74
- scalar2π: -1;
75
- }>;
76
- /**
77
- * A unit of {@link PlaneAngle}.
78
- *
79
- * One turn is equal to 1 full rotation about a point.
80
- *
81
- * @group Units
82
- * @category Angle (Plane)
83
- * @symbol `tr`
84
- */
85
- type Turn = PlaneAngleUnit<{
86
- scalar2π: -1;
87
- }>;
88
-
89
- export { BaseUnitClass as B, Degree as D, Gradian as G, PlaneAngleUnitClass as P, Radian as R, Turn as T, PlaneAngle as a, PlaneAngleUnit as b, PlaneAngleUnitFrom as c };
@@ -1,29 +0,0 @@
1
- import { a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, l as UnknownUnitMeta, e as UnitFrom } from './_units.cjs';
2
- import { B as BaseUnitClass } from './_angle-plane.cjs';
3
-
4
- /**
5
- * @group Unit Classes
6
- */
7
- type IdentityUnitClass = BaseUnitClass<{}>;
8
- /**
9
- * @group Abstract Units
10
- */
11
- type Identity = AbstractUnitFrom<IdentityUnitClass>;
12
- /**
13
- * @group Unit Generators
14
- */
15
- type IdentityUnit<M extends UnitSubvalues> = IdentityUnitFrom<UnitMeta<M>>;
16
- /**
17
- * @group Unit Generators
18
- */
19
- type IdentityUnitFrom<M extends UnknownUnitMeta> = UnitFrom<IdentityUnitClass, M>;
20
- /**
21
- * A {@link Unit} with no units.
22
- *
23
- * @group Units
24
- * @category Base
25
- * @symbol ``
26
- */
27
- type Unitless = IdentityUnit<{}>;
28
-
29
- export { IdentityUnitClass as I, Unitless as U, Identity as a, IdentityUnit as b, IdentityUnitFrom as c };
@@ -1,29 +0,0 @@
1
- import { a as AbstractUnitFrom, g as UnitSubvalues, f as UnitMeta, l as UnknownUnitMeta, e as UnitFrom } from './_units.mjs';
2
- import { B as BaseUnitClass } from './_angle-plane.mjs';
3
-
4
- /**
5
- * @group Unit Classes
6
- */
7
- type IdentityUnitClass = BaseUnitClass<{}>;
8
- /**
9
- * @group Abstract Units
10
- */
11
- type Identity = AbstractUnitFrom<IdentityUnitClass>;
12
- /**
13
- * @group Unit Generators
14
- */
15
- type IdentityUnit<M extends UnitSubvalues> = IdentityUnitFrom<UnitMeta<M>>;
16
- /**
17
- * @group Unit Generators
18
- */
19
- type IdentityUnitFrom<M extends UnknownUnitMeta> = UnitFrom<IdentityUnitClass, M>;
20
- /**
21
- * A {@link Unit} with no units.
22
- *
23
- * @group Units
24
- * @category Base
25
- * @symbol ``
26
- */
27
- type Unitless = IdentityUnit<{}>;
28
-
29
- export { IdentityUnitClass as I, Unitless as U, Identity as a, IdentityUnit as b, IdentityUnitFrom as c };
@@ -1,481 +0,0 @@
1
- import { i as UnknownUnit, h as UnknownAbstractUnit, k as UnknownUnitConversionRate, j as UnknownUnitClass, l as UnknownUnitMeta, P as Pow, b as UnitClass, v as PowUnitSubvalues, f as UnitMeta, I as Inverse, s as InverseUnitSubvalues, g as UnitSubvalues, e as UnitFrom, a as AbstractUnitFrom } from './_units.cjs';
2
- import { B as BaseUnitClass } from './_angle-plane.cjs';
3
-
4
- /**
5
- * Put the given {@link Unit} to the power of 2.
6
- *
7
- * @group Modifiers
8
- * @category General
9
- * @see {@link Pow}
10
- * @see {@link Cubic}
11
- */
12
- type Square<T extends UnknownUnit | UnknownAbstractUnit | UnknownUnitConversionRate | UnknownUnitClass | UnknownUnitMeta> = T extends number ? Pow<T, 2> : T extends UnknownUnitClass ? UnitClass<PowUnitSubvalues<T["__uom_types__value"], 2>> : T extends UnknownUnitMeta ? UnitMeta<PowUnitSubvalues<T["__uom_types__value"], 2>> : never;
13
- /**
14
- * Put the given {@link Unit} to the power of 3.
15
- *
16
- * @group Modifiers
17
- * @category General
18
- * @see {@link Pow}
19
- * @see {@link Square}
20
- */
21
- type Cubic<T extends UnknownUnit | UnknownAbstractUnit | UnknownUnitConversionRate | UnknownUnitClass | UnknownUnitMeta> = T extends number ? Pow<T, 3> : T extends UnknownUnitClass ? UnitClass<PowUnitSubvalues<T["__uom_types__value"], 3>> : T extends UnknownUnitMeta ? UnitMeta<PowUnitSubvalues<T["__uom_types__value"], 3>> : never;
22
-
23
- /**
24
- * Invert the {@link Unit}.
25
- *
26
- * @group Modifiers
27
- * @category General
28
- */
29
- type Reciprocal<T extends UnknownUnit | UnknownAbstractUnit | UnknownUnitConversionRate | UnknownUnitClass | UnknownUnitMeta> = T extends number ? Inverse<T> : T extends UnknownUnitClass ? UnitClass<InverseUnitSubvalues<T["__uom_types__value"]>> : T extends UnknownUnitMeta ? UnitMeta<InverseUnitSubvalues<T["__uom_types__value"]>> : never;
30
- /**
31
- * Invert the {@link UnitClass}.
32
- *
33
- * @deprecated Use {@link Reciprocal} instead.
34
- */
35
- type ReciprocalUnitClass<T extends UnknownUnitClass> = UnitClass<InverseUnitSubvalues<T["__uom_types__value"]>>;
36
-
37
- /**
38
- * @group Unit Classes
39
- * @category Kinematic
40
- */
41
- type FrequencyUnitClass = Reciprocal<DurationUnitClass>;
42
- /**
43
- * @group Abstract Units
44
- * @category Kinematic
45
- */
46
- type Frequency = Reciprocal<Duration>;
47
- /**
48
- * @group Unit Generators
49
- * @category Kinematic
50
- */
51
- type FrequencyUnit<M extends UnitSubvalues> = FrequencyUnitFrom<UnitMeta<M>>;
52
- /**
53
- * @group Unit Generators
54
- * @category Kinematic
55
- */
56
- type FrequencyUnitFrom<M extends UnknownUnitMeta> = UnitFrom<FrequencyUnitClass, M>;
57
- /**
58
- * A unit of {@link Frequency}.
59
- *
60
- * One hertz is equal to one cycle per second.
61
- *
62
- * @group Units
63
- * @category Derived
64
- * @category Kinematic
65
- * @symbol `Hz`
66
- */
67
- type Hertz = FrequencyUnit<{}>;
68
- /**
69
- * A unit of {@link Frequency}.
70
- *
71
- * @group Units
72
- * @category Kinematic
73
- * @symbol `s⁻¹`
74
- */
75
- type PerSecond = Hertz;
76
- /**
77
- * A unit of {@link Frequency}.
78
- *
79
- * @group Units
80
- * @category Kinematic
81
- * @symbol `min⁻¹`
82
- */
83
- type PerMinute = FrequencyUnit<{
84
- scalar60: -1;
85
- }>;
86
- /**
87
- * A unit of {@link Frequency}.
88
- *
89
- * @group Units
90
- * @category Kinematic
91
- * @symbol `hr⁻¹`
92
- */
93
- type PerHour = FrequencyUnit<{
94
- scalar60: -2;
95
- }>;
96
- /**
97
- * A unit of {@link Frequency}.
98
- *
99
- * @group Units
100
- * @category Kinematic
101
- * @symbol `day⁻¹`
102
- */
103
- type PerDay = FrequencyUnit<{
104
- scalar60: -2;
105
- scalar24: -1;
106
- }>;
107
- /**
108
- * A unit of {@link Frequency}.
109
- *
110
- * @group Units
111
- * @category Kinematic
112
- * @symbol `wk⁻¹`
113
- */
114
- type PerWeek = FrequencyUnit<{
115
- scalar60: -2;
116
- scalar24: -1;
117
- scalar7: -1;
118
- }>;
119
- /**
120
- * A unit of {@link Frequency}.
121
- *
122
- * @group Units
123
- * @category Kinematic
124
- * @symbol `yr⁻¹`
125
- */
126
- type PerYear = FrequencyUnit<{
127
- scalar60: -2;
128
- scalar24: -1;
129
- scalarDayInYear: -1;
130
- }>;
131
-
132
- /**
133
- * @group Unit Classes
134
- * @category Mechanical
135
- */
136
- type AreaUnitClass = BaseUnitClass<{
137
- Metre: 2;
138
- }>;
139
- /**
140
- * @group Abstract Units
141
- * @category Mechanical
142
- */
143
- type Area = AbstractUnitFrom<AreaUnitClass>;
144
- /**
145
- * @group Unit Generators
146
- * @category Mechanical
147
- */
148
- type AreaUnit<M extends UnitSubvalues> = AreaUnitFrom<UnitMeta<M>>;
149
- /**
150
- * @group Unit Generators
151
- * @category Mechanical
152
- */
153
- type AreaUnitFrom<M extends UnknownUnitMeta> = UnitFrom<AreaUnitClass, M>;
154
- /**
155
- * A unit of {@link Area} equal to 100 {@link Square}<{@link Metre}>.
156
- *
157
- * @group Units
158
- * @category Mechanical
159
- * @symbol `a`
160
- */
161
- type Are = AreaUnit<{
162
- scalar10: 2;
163
- }>;
164
- /**
165
- * A unit of {@link Area} equal to 10,000 {@link Square}<{@link Metre}>.
166
- *
167
- * @group Units
168
- * @category Mechanical
169
- * @symbol `ha`
170
- */
171
- type Hectare = AreaUnit<{
172
- scalar10: 4;
173
- }>;
174
-
175
- /**
176
- * @group Unit Classes
177
- * @category Mechanical
178
- */
179
- type EnergyUnitClass = BaseUnitClass<{
180
- Kilogram: 1;
181
- Metre: 2;
182
- Second: -2;
183
- }>;
184
- /**
185
- * @group Abstract Units
186
- * @category Mechanical
187
- */
188
- type Energy = AbstractUnitFrom<EnergyUnitClass>;
189
- /**
190
- * @group Unit Generators
191
- * @category Mechanical
192
- */
193
- type EnergyUnit<M extends UnitSubvalues> = EnergyUnitFrom<UnitMeta<M>>;
194
- /**
195
- * @group Unit Generators
196
- * @category Mechanical
197
- */
198
- type EnergyUnitFrom<M extends UnknownUnitMeta> = UnitFrom<EnergyUnitClass, M>;
199
- /**
200
- * A unit of {@link Energy}.
201
- *
202
- * One joule is the amount of work done when an applied force of 1 newton moves
203
- * through a distance of 1 metre in the direction of the force.
204
- *
205
- * @group Units
206
- * @category Derived
207
- * @category Mechanical
208
- * @symbol `J`
209
- */
210
- type Joule = EnergyUnit<{}>;
211
- /**
212
- * A unit of {@link Energy}.
213
- *
214
- * @group Units
215
- * @category Mechanical
216
- * @symbol `W⋅s`
217
- */
218
- type WattSecond = Joule;
219
- /**
220
- * A unit of {@link Energy}.
221
- *
222
- * @group Units
223
- * @category Mechanical
224
- * @symbol `W⋅min`
225
- */
226
- type WattMinute = EnergyUnit<{
227
- scalar60: 1;
228
- }>;
229
- /**
230
- * A unit of {@link Energy}.
231
- *
232
- * @group Units
233
- * @category Mechanical
234
- * @symbol `W⋅hr`
235
- */
236
- type WattHour = EnergyUnit<{
237
- scalar60: 2;
238
- }>;
239
-
240
- /**
241
- * @group Unit Classes
242
- * @category Mechanical
243
- */
244
- type LengthUnitClass = BaseUnitClass<{
245
- Metre: 1;
246
- }>;
247
- /**
248
- * @group Abstract Units
249
- * @category Mechanical
250
- */
251
- type Length = AbstractUnitFrom<LengthUnitClass>;
252
- /**
253
- * @group Unit Generators
254
- * @category Mechanical
255
- */
256
- type LengthUnit<M extends UnitSubvalues> = LengthUnitFrom<UnitMeta<M>>;
257
- /**
258
- * @group Unit Generators
259
- * @category Mechanical
260
- */
261
- type LengthUnitFrom<M extends UnknownUnitMeta> = UnitFrom<LengthUnitClass, M>;
262
- /**
263
- * A unit of {@link Length}.
264
- *
265
- * @group Units
266
- * @category Base
267
- * @category Mechanical
268
- * @symbol `m`
269
- */
270
- type Metre = LengthUnit<{}>;
271
-
272
- /**
273
- * @group Unit Classes
274
- * @category Mechanical
275
- */
276
- type MassUnitClass = BaseUnitClass<{
277
- Kilogram: 1;
278
- }>;
279
- /**
280
- * @group Abstract Units
281
- * @category Mechanical
282
- */
283
- type Mass = AbstractUnitFrom<MassUnitClass>;
284
- /**
285
- * @group Unit Generators
286
- * @category Mechanical
287
- */
288
- type MassUnit<M extends UnitSubvalues> = MassUnitFrom<UnitMeta<M>>;
289
- /**
290
- * @group Unit Generators
291
- * @category Mechanical
292
- */
293
- type MassUnitFrom<M extends UnknownUnitMeta> = UnitFrom<MassUnitClass, M>;
294
- /**
295
- * A unit of {@link Mass}.
296
- *
297
- * @group Units
298
- * @category Base
299
- * @category Mechanical
300
- * @symbol `g`
301
- */
302
- type Gram = MassUnit<{
303
- scalar10: -3;
304
- }>;
305
- /**
306
- * A unit of {@link Mass}.
307
- *
308
- * @group Units
309
- * @category Mechanical
310
- * @symbol `t`
311
- */
312
- type Tonne = MassUnit<{
313
- scalar10: 3;
314
- }>;
315
-
316
- /**
317
- * @group Unit Classes
318
- * @category Mechanical
319
- */
320
- type VolumeUnitClass = BaseUnitClass<{
321
- Metre: 3;
322
- }>;
323
- /**
324
- * @group Unit Classes
325
- * @category Mechanical
326
- */
327
- type Volume = AbstractUnitFrom<VolumeUnitClass>;
328
- /**
329
- * @group Unit Classes
330
- * @category Mechanical
331
- */
332
- type VolumeUnit<M extends UnitSubvalues> = VolumeUnitFrom<UnitMeta<M>>;
333
- /**
334
- * @group Unit Classes
335
- * @category Mechanical
336
- */
337
- type VolumeUnitFrom<M extends UnknownUnitMeta> = UnitFrom<VolumeUnitClass, M>;
338
- /**
339
- * A unit of volume.
340
- *
341
- * @group Units
342
- * @category Mechanical
343
- * @symbol `l`
344
- */
345
- type Litre = VolumeUnit<{
346
- scalar10: -3;
347
- }>;
348
-
349
- /**
350
- * @group Unit Classes
351
- * @category Thermodynamic
352
- */
353
- type TemperatureUnitClass = BaseUnitClass<{
354
- Kelvin: 1;
355
- }>;
356
- /**
357
- * @group Abstract Units
358
- * @category Thermodynamic
359
- */
360
- type Temperature = AbstractUnitFrom<TemperatureUnitClass>;
361
- /**
362
- * @group Unit Generators
363
- * @category Thermodynamic
364
- */
365
- type TemperatureUnit<M extends UnitSubvalues> = TemperatureUnitFrom<UnitMeta<M>>;
366
- /**
367
- * @group Unit Generators
368
- * @category Thermodynamic
369
- */
370
- type TemperatureUnitFrom<M extends UnknownUnitMeta> = UnitFrom<TemperatureUnitClass, M>;
371
- /**
372
- * A unit of {@link Temperature}.
373
- *
374
- * @group Units
375
- * @category Base
376
- * @category Thermodynamic
377
- * @symbol `K`
378
- */
379
- type Kelvin = TemperatureUnit<{}>;
380
- /**
381
- * A unit of {@link Temperature}.
382
- *
383
- * This is a unit of temperature such as the freezing point of water (at one atmosphere of pressure)
384
- * is 0 ℃, while the boiling point is 100 ℃.
385
- *
386
- * @group Units
387
- * @category Thermodynamic
388
- * @symbol `℃`
389
- */
390
- type Celsius = TemperatureUnit<{
391
- "offset273.15": 1;
392
- }>;
393
-
394
- /**
395
- * @group Unit Classes
396
- * @category Time
397
- */
398
- type DurationUnitClass = BaseUnitClass<{
399
- Second: 1;
400
- }>;
401
- /**
402
- * @group Abstract Units
403
- * @category Time
404
- */
405
- type Duration = AbstractUnitFrom<DurationUnitClass>;
406
- /**
407
- * @group Unit Generators
408
- * @category Time
409
- */
410
- type DurationUnit<M extends UnitSubvalues> = DurationUnitFrom<UnitMeta<M>>;
411
- /**
412
- * @group Unit Generators
413
- * @category Time
414
- */
415
- type DurationUnitFrom<M extends UnknownUnitMeta> = UnitFrom<DurationUnitClass, M>;
416
- /**
417
- * A unit of {@link Duration}.
418
- *
419
- * @group Units
420
- * @category Base
421
- * @category Time
422
- * @symbol `s`
423
- */
424
- type Second = DurationUnit<{}>;
425
- /**
426
- * A unit of {@link Duration}.
427
- *
428
- * @group Units
429
- * @category Time
430
- * @symbol `min`
431
- */
432
- type Minute = DurationUnit<{
433
- scalar60: 1;
434
- }>;
435
- /**
436
- * A unit of {@link Duration}.
437
- *
438
- * @group Units
439
- * @category Time
440
- * @symbol `hr`
441
- */
442
- type Hour = DurationUnit<{
443
- scalar60: 2;
444
- }>;
445
- /**
446
- * A unit of {@link Duration}.
447
- *
448
- * @group Units
449
- * @category Time
450
- * @symbol `day`
451
- */
452
- type Day = DurationUnit<{
453
- scalar60: 2;
454
- scalar24: 1;
455
- }>;
456
- /**
457
- * A unit of {@link Duration}.
458
- *
459
- * @group Units
460
- * @category Time
461
- * @symbol `wk`
462
- */
463
- type Week = DurationUnit<{
464
- scalar60: 2;
465
- scalar24: 1;
466
- scalar7: 1;
467
- }>;
468
- /**
469
- * A unit of {@link Duration}.
470
- *
471
- * @group Units
472
- * @category Time
473
- * @symbol `yr`
474
- */
475
- type Year = DurationUnit<{
476
- scalar60: 2;
477
- scalar24: 1;
478
- scalarDayInYear: 1;
479
- }>;
480
-
481
- export { Minute as $, AreaUnitClass as A, Tonne as B, Volume as C, VolumeUnit as D, EnergyUnitClass as E, FrequencyUnitClass as F, Gram as G, Hertz as H, VolumeUnitFrom as I, Joule as J, Litre as K, LengthUnitClass as L, Metre as M, TemperatureUnit as N, TemperatureUnitFrom as O, PerSecond as P, Kelvin as Q, Reciprocal as R, Celsius as S, TemperatureUnitClass as T, DurationUnitClass as U, VolumeUnitClass as V, WattSecond as W, Duration as X, DurationUnit as Y, DurationUnitFrom as Z, Second as _, Energy as a, Hour as a0, Day as a1, Week as a2, Year as a3, Square as a4, Cubic as a5, ReciprocalUnitClass as a6, EnergyUnit as b, EnergyUnitFrom as c, Temperature as d, Frequency as e, FrequencyUnit as f, FrequencyUnitFrom as g, PerMinute as h, PerHour as i, PerDay as j, PerWeek as k, PerYear as l, Area as m, AreaUnit as n, AreaUnitFrom as o, Are as p, Hectare as q, WattMinute as r, WattHour as s, Length as t, LengthUnit as u, LengthUnitFrom as v, MassUnitClass as w, Mass as x, MassUnit as y, MassUnitFrom as z };