@penner/smart-primitive 0.0.1 → 0.1.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.
- package/README.md +215 -180
- package/dist/SmartPrimitive.d.ts +87 -37
- package/dist/SmartPrimitive.d.ts.map +1 -1
- package/dist/SmartPrimitive.test-d.d.ts.map +1 -0
- package/dist/SmartPrimitiveConfig.test-d.d.ts +2 -0
- package/dist/SmartPrimitiveConfig.test-d.d.ts.map +1 -0
- package/dist/convert.cjs.js +2 -0
- package/dist/convert.cjs.js.map +1 -0
- package/dist/convert.d.ts +136 -0
- package/dist/convert.d.ts.map +1 -0
- package/dist/convert.es.js +51 -0
- package/dist/convert.es.js.map +1 -0
- package/dist/convert.test-d.d.ts +2 -0
- package/dist/convert.test-d.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +65 -2
- package/dist/index.es.js.map +1 -1
- package/dist/strings/css.d.ts +143 -0
- package/dist/strings/css.d.ts.map +1 -0
- package/dist/strings/data.d.ts +140 -0
- package/dist/strings/data.d.ts.map +1 -0
- package/dist/strings/index.cjs.js +2 -0
- package/dist/strings/index.cjs.js.map +1 -0
- package/dist/strings/index.d.ts +14 -0
- package/dist/strings/index.d.ts.map +1 -0
- package/dist/strings/index.es.js +2 -0
- package/dist/strings/index.es.js.map +1 -0
- package/dist/strings/web.d.ts +55 -0
- package/dist/strings/web.d.ts.map +1 -0
- package/dist/trait-utils.d.ts +107 -0
- package/dist/trait-utils.d.ts.map +1 -0
- package/dist/traits.d.ts +14 -0
- package/dist/traits.d.ts.map +1 -0
- package/dist/traits.examples.d.ts +7 -0
- package/dist/traits.examples.d.ts.map +1 -0
- package/dist/traits.test-d.d.ts +5 -0
- package/dist/traits.test-d.d.ts.map +1 -0
- package/dist/units/angle.d.ts +43 -0
- package/dist/units/angle.d.ts.map +1 -0
- package/dist/units/angle.test-d.d.ts +2 -0
- package/dist/units/angle.test-d.d.ts.map +1 -0
- package/dist/units/color.d.ts +35 -0
- package/dist/units/color.d.ts.map +1 -0
- package/dist/units/color.test-d.d.ts +2 -0
- package/dist/units/color.test-d.d.ts.map +1 -0
- package/dist/units/index.cjs.js +2 -0
- package/dist/units/index.cjs.js.map +1 -0
- package/dist/units/index.d.ts +19 -0
- package/dist/units/index.d.ts.map +1 -0
- package/dist/units/index.es.js +86 -0
- package/dist/units/index.es.js.map +1 -0
- package/dist/units/integer.d.ts +12 -0
- package/dist/units/integer.d.ts.map +1 -0
- package/dist/units/integer.test-d.d.ts +2 -0
- package/dist/units/integer.test-d.d.ts.map +1 -0
- package/dist/units/length.d.ts +101 -0
- package/dist/units/length.d.ts.map +1 -0
- package/dist/units/length.test-d.d.ts +2 -0
- package/dist/units/length.test-d.d.ts.map +1 -0
- package/dist/units/normalized.d.ts +111 -0
- package/dist/units/normalized.d.ts.map +1 -0
- package/dist/units/normalized.test-d.d.ts +2 -0
- package/dist/units/normalized.test-d.d.ts.map +1 -0
- package/dist/units/temperature.d.ts +16 -0
- package/dist/units/temperature.d.ts.map +1 -0
- package/dist/units/temperature.test-d.d.ts +2 -0
- package/dist/units/temperature.test-d.d.ts.map +1 -0
- package/dist/units/time.d.ts +38 -0
- package/dist/units/time.d.ts.map +1 -0
- package/dist/units/time.test-d.d.ts +2 -0
- package/dist/units/time.test-d.d.ts.map +1 -0
- package/dist/units/velocity.d.ts +78 -0
- package/dist/units/velocity.d.ts.map +1 -0
- package/dist/units/velocity.test-d.d.ts +2 -0
- package/dist/units/velocity.test-d.d.ts.map +1 -0
- package/package.json +39 -21
- package/dist/__tests__/SmartPrimitive.test-d.d.ts.map +0 -1
- /package/dist/{__tests__/SmartPrimitive.test-d.d.ts → SmartPrimitive.test-d.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traits.examples.d.ts","sourceRoot":"","sources":["../src/traits.examples.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traits.test-d.d.ts","sourceRoot":"","sources":["../src/traits.test-d.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { WithUnit, WithRange, WithPeriodic, WithKind } from '../trait-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Angle in degrees [0, 360), periodic.
|
|
4
|
+
* All angle types share the 'angle' kind.
|
|
5
|
+
*/
|
|
6
|
+
export type Degrees = WithUnit<'deg'> & WithRange<0, 360> & WithPeriodic & WithKind<'angle'>;
|
|
7
|
+
/**
|
|
8
|
+
* Angle in radians [0, 2π), periodic.
|
|
9
|
+
* All angle types share the 'angle' kind.
|
|
10
|
+
*/
|
|
11
|
+
export type Radians = WithUnit<'rad'> & WithRange<0, 6.283185307179586> & WithPeriodic & WithKind<'angle'>;
|
|
12
|
+
/**
|
|
13
|
+
* Angle in turns/rotations [0, 1), periodic.
|
|
14
|
+
* All angle types share the 'angle' kind.
|
|
15
|
+
*/
|
|
16
|
+
export type Turns = WithUnit<'turn'> & WithRange<0, 1> & WithPeriodic & WithKind<'angle'>;
|
|
17
|
+
/** Degrees → Radians */
|
|
18
|
+
export declare const degreesToRadians: (deg: Degrees) => Radians;
|
|
19
|
+
/** Radians → Degrees */
|
|
20
|
+
export declare const radiansToDegrees: (rad: Radians) => Degrees;
|
|
21
|
+
/** Degrees → Turns */
|
|
22
|
+
export declare const degreesToTurns: (deg: Degrees) => Turns;
|
|
23
|
+
/** Turns → Degrees */
|
|
24
|
+
export declare const turnsToDegrees: (t: Turns) => Degrees;
|
|
25
|
+
/** Radians → Turns */
|
|
26
|
+
export declare const radiansToTurns: (rad: Radians) => Turns;
|
|
27
|
+
/** Turns → Radians */
|
|
28
|
+
export declare const turnsToRadians: (t: Turns) => Radians;
|
|
29
|
+
/**
|
|
30
|
+
* Normalize an angle in degrees to the range [0, 360).
|
|
31
|
+
*/
|
|
32
|
+
export declare function normalizeDegrees(deg: Degrees): Degrees;
|
|
33
|
+
/**
|
|
34
|
+
* Normalize an angle in radians to the range [0, 2π).
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeRadians(rad: Radians): Radians;
|
|
37
|
+
/**
|
|
38
|
+
* Normalize an angle in turns to the range [0, 1).
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeTurns(t: Turns): Turns;
|
|
41
|
+
/** Any angle unit */
|
|
42
|
+
export type AngleUnit = Degrees | Radians | Turns;
|
|
43
|
+
//# sourceMappingURL=angle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angle.d.ts","sourceRoot":"","sources":["../../src/units/angle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAMxB;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GACnC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GACjB,YAAY,GACZ,QAAQ,CAAC,OAAO,CAAC,CAAC;AAEpB;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GACnC,SAAS,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAC/B,YAAY,GACZ,QAAQ,CAAC,OAAO,CAAC,CAAC;AAEpB;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,GAClC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACf,YAAY,GACZ,QAAQ,CAAC,OAAO,CAAC,CAAC;AAmBpB,wBAAwB;AACxB,eAAO,MAAM,gBAAgB,GAAI,KAAK,OAAO,KAAG,OAA4B,CAAC;AAE7E,wBAAwB;AACxB,eAAO,MAAM,gBAAgB,GAAI,KAAK,OAAO,KAAG,OAA4B,CAAC;AAE7E,sBAAsB;AACtB,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,KAAG,KAAkB,CAAC;AAEjE,sBAAsB;AACtB,eAAO,MAAM,cAAc,GAAI,GAAG,KAAK,KAAG,OAAkB,CAAC;AAE7D,sBAAsB;AACtB,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,KAAG,KAAkB,CAAC;AAEjE,sBAAsB;AACtB,eAAO,MAAM,cAAc,GAAI,GAAG,KAAK,KAAG,OAAkB,CAAC;AAM7D;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,CAE9C;AAMD,qBAAqB;AACrB,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angle.test-d.d.ts","sourceRoot":"","sources":["../../src/units/angle.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WithRange, WithClamped, WithKind } from '../trait-utils';
|
|
2
|
+
/**
|
|
3
|
+
* A color channel value in the range [0, 255].
|
|
4
|
+
* Used for RGB and alpha channels in byte-based color representations
|
|
5
|
+
* (Canvas ImageData, PNG/JPEG files, etc.).
|
|
6
|
+
*/
|
|
7
|
+
export type ColorByte = WithRange<0, 255> & WithClamped & WithKind<'color-byte'>;
|
|
8
|
+
/**
|
|
9
|
+
* RGB color tuple with named elements.
|
|
10
|
+
* Each component is a byte value [0, 255].
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const red: RGBTuple = [255, 0, 0];
|
|
15
|
+
* const [r, g, b] = red;
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export type RGBTuple = [r: ColorByte, g: ColorByte, b: ColorByte];
|
|
19
|
+
/**
|
|
20
|
+
* RGBA color tuple with named elements.
|
|
21
|
+
* Each component is a byte value [0, 255].
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const semiTransparentRed: RGBATuple = [255, 0, 0, 128];
|
|
26
|
+
* const [r, g, b, a] = semiTransparentRed;
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type RGBATuple = [
|
|
30
|
+
r: ColorByte,
|
|
31
|
+
g: ColorByte,
|
|
32
|
+
b: ColorByte,
|
|
33
|
+
a: ColorByte
|
|
34
|
+
];
|
|
35
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/units/color.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMvE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GACvC,WAAW,GACX,QAAQ,CAAC,YAAY,CAAC,CAAC;AAEzB;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.test-d.d.ts","sourceRoot":"","sources":["../../src/units/color.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=e=>e*1e3,t=e=>e/1e3,i=e=>e*60,r=e=>e/60,c=e=>e*60,l=e=>e/60,T=e=>e*100,a=e=>e/100,m=e=>e*10,u=e=>e/10,d=e=>e*2.54,h=e=>e/2.54,p=e=>s=>s/e,P=e=>s=>s*e,g=(e=16)=>s=>s/e,M=(e=16)=>s=>s*e,x=e=>s=>s/e*100,z=e=>s=>s/100*e,f=e=>s=>s/e*100,y=e=>s=>s/100*e,R=e=>e*72,S=e=>e/72,v=e=>e*96,D=e=>e/96,I=180/Math.PI,C=Math.PI/180,o=2*Math.PI,N=e=>e*C,V=e=>e*I,E=e=>e/360,A=e=>e*360,w=e=>e/o,F=e=>e*o;function _(e){return(e%360+360)%360}function b(e){return(e%o+o)%o}function G(e){return(e%1+1)%1}const H=e=>e*100,j=e=>e/100,O=e=>e*100,U=e=>e/100;function k(e){return e!==e||e<=0?0:e>=1?1:e}function q(e){return Math.max(-1,Math.min(1,e))}function B(e){return Math.max(0,Math.min(100,e))}function J(e){return Math.max(0,Math.min(1,e))}const K=e=>e*9/5+32,L=e=>(e-32)*5/9;function Q(e,s){return e/s}function W(e,s){return e*s}function X(e){return e/1e3}function Y(e){return e*1e3}exports.applyVelocity=W;exports.celsiusToFahrenheit=K;exports.centimetersToInches=h;exports.centimetersToMeters=a;exports.centimetersToMillimeters=m;exports.clampAlpha=J;exports.clampNormalized=k;exports.clampPercentage=B;exports.clampSignedNormalized=q;exports.degreesToRadians=N;exports.degreesToTurns=E;exports.emsToPixels=P;exports.fahrenheitToCelsius=L;exports.hoursToMinutes=c;exports.inchesToCentimeters=d;exports.inchesToPixels=v;exports.inchesToPoints=R;exports.metersToCentimeters=T;exports.millimetersToCentimeters=u;exports.millisecondsToSeconds=t;exports.minutesToHours=l;exports.minutesToSeconds=i;exports.normalizeDegrees=_;exports.normalizeRadians=b;exports.normalizeTurns=G;exports.normalizedProgressToPercent=O;exports.normalizedToPercentage=H;exports.percentToNormalizedProgress=U;exports.percentageToNormalized=j;exports.pixelsToEms=p;exports.pixelsToInches=D;exports.pixelsToRems=g;exports.pixelsToVh=f;exports.pixelsToVw=x;exports.pointsToInches=S;exports.radiansToDegrees=V;exports.radiansToTurns=w;exports.remsToPixels=M;exports.secondsToMilliseconds=n;exports.secondsToMinutes=r;exports.turnsToDegrees=A;exports.turnsToRadians=F;exports.velocityFromValues=Q;exports.velocityMillisecondsToSeconds=Y;exports.velocitySecondsToMilliseconds=X;exports.vhToPixels=y;exports.vwToPixels=z;
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/units/time.ts","../../src/units/length.ts","../../src/units/angle.ts","../../src/units/normalized.ts","../../src/units/temperature.ts","../../src/units/velocity.ts"],"sourcesContent":["/**\n * ⏱️ Time Units\n *\n * Trait-based types for time-based values with type-safe conversions.\n */\n\nimport type { WithUnit, WithKind } from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n TIME TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Time in seconds.\n * All time types share the 'time' kind.\n */\nexport type Seconds = WithUnit<'s'> & WithKind<'time'>;\n\n/**\n * Time in milliseconds.\n * All time types share the 'time' kind.\n */\nexport type Milliseconds = WithUnit<'ms'> & WithKind<'time'>;\n\n/**\n * Time in minutes.\n * All time types share the 'time' kind.\n */\nexport type Minutes = WithUnit<'min'> & WithKind<'time'>;\n\n/**\n * Time in hours.\n * All time types share the 'time' kind.\n */\nexport type Hours = WithUnit<'h'> & WithKind<'time'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Seconds → Milliseconds (1s = 1000ms) */\nexport const secondsToMilliseconds = (s: Seconds): Milliseconds =>\n (s * 1000) as Milliseconds;\n\n/** Milliseconds → Seconds */\nexport const millisecondsToSeconds = (ms: Milliseconds): Seconds =>\n (ms / 1000) as Seconds;\n\n/** Minutes → Seconds (1min = 60s) */\nexport const minutesToSeconds = (m: Minutes): Seconds => m * 60;\n\n/** Seconds → Minutes */\nexport const secondsToMinutes = (s: Seconds): Minutes => s / 60;\n\n/** Hours → Minutes (1h = 60min) */\nexport const hoursToMinutes = (h: Hours): Minutes => h * 60;\n\n/** Minutes → Hours */\nexport const minutesToHours = (m: Minutes): Hours => m / 60;\n\n/* ═══════════════════════════════════════════════════════════════\n TYPE FAMILIES: Useful unions for function parameters\n ═══════════════════════════════════════════════════════════════ */\n\n/** Any time unit */\nexport type TimeUnit = Seconds | Milliseconds | Minutes | Hours;\n\n/** Common animation time units (seconds or milliseconds) */\nexport type AnimationTimeUnit = Seconds | Milliseconds;\n","/**\n * 📏 Length Units\n *\n * Trait-based types for length/distance values with type-safe conversions.\n */\n\nimport type { WithUnit, WithKind } from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n LENGTH TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Length in pixels (CSS px).\n * All length types share the 'length' kind.\n */\nexport type Pixels = WithUnit<'px'> & WithKind<'length'>;\n\n/**\n * Length in em units (relative to font-size).\n * All length types share the 'length' kind.\n */\nexport type Ems = WithUnit<'em'> & WithKind<'length'>;\n\n/**\n * Length in rem units (relative to root font-size).\n * All length types share the 'length' kind.\n */\nexport type Rems = WithUnit<'rem'> & WithKind<'length'>;\n\n/**\n * Length in viewport width units.\n * All length types share the 'length' kind.\n */\nexport type Vw = WithUnit<'vw'> & WithKind<'length'>;\n\n/**\n * Length in viewport height units.\n * All length types share the 'length' kind.\n */\nexport type Vh = WithUnit<'vh'> & WithKind<'length'>;\n\n/**\n * Length in percent.\n * All length types share the 'length' kind.\n */\nexport type Percent = WithUnit<'%'> & WithKind<'length'>;\n\n/**\n * Length in points (1pt = 1/72 inch).\n * All length types share the 'length' kind.\n */\nexport type Points = WithUnit<'pt'> & WithKind<'length'>;\n\n/**\n * Length in inches.\n * All length types share the 'length' kind.\n */\nexport type Inches = WithUnit<'in'> & WithKind<'length'>;\n\n/**\n * Length in centimeters.\n * All length types share the 'length' kind.\n */\nexport type Centimeters = WithUnit<'cm'> & WithKind<'length'>;\n\n/**\n * Length in millimeters.\n * All length types share the 'length' kind.\n */\nexport type Millimeters = WithUnit<'mm'> & WithKind<'length'>;\n\n/**\n * Length in meters.\n * All length types share the 'length' kind.\n */\nexport type Meters = WithUnit<'m'> & WithKind<'length'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS - Metric\n ═══════════════════════════════════════════════════════════════ */\n\n/** Meters → Centimeters (1m = 100cm) */\nexport const metersToCentimeters = (m: Meters): Centimeters => m * 100;\n\n/** Centimeters → Meters */\nexport const centimetersToMeters = (cm: Centimeters): Meters => cm / 100;\n\n/** Centimeters → Millimeters (1cm = 10mm) */\nexport const centimetersToMillimeters = (cm: Centimeters): Millimeters =>\n cm * 10;\n\n/** Millimeters → Centimeters */\nexport const millimetersToCentimeters = (mm: Millimeters): Centimeters =>\n mm / 10;\n\n/** Inches → Centimeters (1in = 2.54cm) */\nexport const inchesToCentimeters = (i: Inches): Centimeters => i * 2.54;\n\n/** Centimeters → Inches */\nexport const centimetersToInches = (cm: Centimeters): Inches => cm / 2.54;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS - CSS (context-dependent)\n ═══════════════════════════════════════════════════════════════ */\n\n/** Pixels → Ems for a given font-size */\nexport const pixelsToEms =\n (fontSize: number) =>\n (px: Pixels): Ems =>\n px / fontSize;\n\n/** Ems → Pixels for a given font-size */\nexport const emsToPixels =\n (fontSize: number) =>\n (em: Ems): Pixels =>\n em * fontSize;\n\n/** Pixels → Rems for a given root font-size */\nexport const pixelsToRems =\n (rootFontSize = 16) =>\n (px: Pixels): Rems =>\n px / rootFontSize;\n\n/** Rems → Pixels for a given root font-size */\nexport const remsToPixels =\n (rootFontSize = 16) =>\n (rem: Rems): Pixels =>\n rem * rootFontSize;\n\n/** Pixels → Vw for a given viewport width */\nexport const pixelsToVw =\n (viewportWidth: number) =>\n (px: Pixels): Vw =>\n (px / viewportWidth) * 100;\n\n/** Vw → Pixels for a given viewport width */\nexport const vwToPixels =\n (viewportWidth: number) =>\n (vwVal: Vw): Pixels =>\n (vwVal / 100) * viewportWidth;\n\n/** Pixels → Vh for a given viewport height */\nexport const pixelsToVh =\n (viewportHeight: number) =>\n (px: Pixels): Vh =>\n (px / viewportHeight) * 100;\n\n/** Vh → Pixels for a given viewport height */\nexport const vhToPixels =\n (viewportHeight: number) =>\n (vhVal: Vh): Pixels =>\n (vhVal / 100) * viewportHeight;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS - Print\n ═══════════════════════════════════════════════════════════════ */\n\n/** Inches → Points (1in = 72pt) */\nexport const inchesToPoints = (i: Inches): Points => i * 72;\n\n/** Points → Inches */\nexport const pointsToInches = (pt: Points): Inches => pt / 72;\n\n/** Inches → Pixels at 96 DPI (CSS standard) */\nexport const inchesToPixels = (i: Inches): Pixels => i * 96;\n\n/** Pixels → Inches at 96 DPI (CSS standard) */\nexport const pixelsToInches = (px: Pixels): Inches => px / 96;\n\n/* ═══════════════════════════════════════════════════════════════\n TYPE FAMILIES: Useful unions for function parameters\n ═══════════════════════════════════════════════════════════════ */\n\n/** Any length unit */\nexport type LengthUnit =\n | Pixels\n | Ems\n | Rems\n | Vw\n | Vh\n | Percent\n | Points\n | Inches\n | Centimeters\n | Millimeters\n | Meters;\n\n/** CSS absolute length units */\nexport type CSSAbsoluteLengthUnit =\n | Pixels\n | Points\n | Inches\n | Centimeters\n | Millimeters;\n\n/** CSS relative length units */\nexport type CSSRelativeLengthUnit = Ems | Rems | Vw | Vh | Percent;\n\n/** Metric length units */\nexport type MetricLengthUnit = Meters | Centimeters | Millimeters;\n","/**\n * 📐 Angle Units\n *\n * Trait-based types for angular measurements with type-safe conversions.\n */\n\nimport type {\n WithUnit,\n WithRange,\n WithPeriodic,\n WithKind,\n} from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n ANGLE TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Angle in degrees [0, 360), periodic.\n * All angle types share the 'angle' kind.\n */\nexport type Degrees = WithUnit<'deg'> &\n WithRange<0, 360> &\n WithPeriodic &\n WithKind<'angle'>;\n\n/**\n * Angle in radians [0, 2π), periodic.\n * All angle types share the 'angle' kind.\n */\nexport type Radians = WithUnit<'rad'> &\n WithRange<0, 6.283185307179586> &\n WithPeriodic &\n WithKind<'angle'>;\n\n/**\n * Angle in turns/rotations [0, 1), periodic.\n * All angle types share the 'angle' kind.\n */\nexport type Turns = WithUnit<'turn'> &\n WithRange<0, 1> &\n WithPeriodic &\n WithKind<'angle'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONSTANTS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Degrees per radian */\nconst DEG_PER_RAD = 180 / Math.PI;\n\n/** Radians per degree */\nconst RAD_PER_DEG = Math.PI / 180;\n\n/** 2π constant */\nconst TAU = 2 * Math.PI;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Degrees → Radians */\nexport const degreesToRadians = (deg: Degrees): Radians => deg * RAD_PER_DEG;\n\n/** Radians → Degrees */\nexport const radiansToDegrees = (rad: Radians): Degrees => rad * DEG_PER_RAD;\n\n/** Degrees → Turns */\nexport const degreesToTurns = (deg: Degrees): Turns => deg / 360;\n\n/** Turns → Degrees */\nexport const turnsToDegrees = (t: Turns): Degrees => t * 360;\n\n/** Radians → Turns */\nexport const radiansToTurns = (rad: Radians): Turns => rad / TAU;\n\n/** Turns → Radians */\nexport const turnsToRadians = (t: Turns): Radians => t * TAU;\n\n/* ═══════════════════════════════════════════════════════════════\n ANGLE UTILITIES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Normalize an angle in degrees to the range [0, 360).\n */\nexport function normalizeDegrees(deg: Degrees): Degrees {\n return ((deg % 360) + 360) % 360;\n}\n\n/**\n * Normalize an angle in radians to the range [0, 2π).\n */\nexport function normalizeRadians(rad: Radians): Radians {\n return ((rad % TAU) + TAU) % TAU;\n}\n\n/**\n * Normalize an angle in turns to the range [0, 1).\n */\nexport function normalizeTurns(t: Turns): Turns {\n return ((t % 1) + 1) % 1;\n}\n\n/* ═══════════════════════════════════════════════════════════════\n TYPE FAMILIES: Useful unions for function parameters\n ═══════════════════════════════════════════════════════════════ */\n\n/** Any angle unit */\nexport type AngleUnit = Degrees | Radians | Turns;\n","/**\n * 📊 Normalized & Percentage Units\n *\n * Trait-based types for normalized values (0-1) and percentages (0-100).\n */\n\nimport type {\n WithRange,\n WithUnit,\n WithKind,\n WithClamped,\n} from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n NORMALIZED TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * A value normalized to the range [0, 1], unclamped.\n * Can exceed these bounds.\n */\nexport type Normalized = WithRange<0, 1>;\n\n/**\n * A clamped normalized value in the range [0, 1].\n * Constrained to not exceed these bounds.\n */\nexport type ClampedNormalized = Normalized & WithClamped;\n\n/**\n * A value normalized to the range [-1, 1], unclamped.\n * Can exceed these bounds.\n */\nexport type SignedNormalized = WithRange<-1, 1>;\n\n/**\n * A percentage value based on the range [0, 100], unclamped.\n */\nexport type Percentage = WithRange<0, 100> & WithUnit<'percent'>;\n\n/**\n * An alpha/opacity value in the range [0, 1].\n */\nexport type Alpha = WithRange<0, 1> & WithKind<'opacity'>;\n\n/**\n * A ratio value (typically positive).\n */\nexport type Ratio = number;\n\n/**\n * A factor/multiplier value (could be positive or negative).\n */\nexport type Factor = number;\n\n/* ═══════════════════════════════════════════════════════════════\n ANIMATION-SPECIFIC NORMALIZED TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Normalized time [0, 1] within an animation segment.\n * Used as the input to easing functions (horizontal/time axis).\n * STRICTLY BOUNDED to [0, 1] - cannot overshoot.\n *\n * @example\n * ```ts\n * const joinTime: NormalizedTime = 0.6;\n * const bezierX1: NormalizedTime = 0.42; // Bezier X coordinates use time\n * ```\n */\nexport type NormalizedTime = ClampedNormalized & WithKind<'time'>;\n\n/**\n * Normalized progress [0, 1] of an animation.\n * Used as the output of easing functions (vertical/progress axis).\n * CAN OVERSHOOT [0, 1] during back/elastic effects (e.g., 1.2 or -0.1).\n *\n * The \"normalized\" refers to the scale (0-1 reference), not the bounds.\n *\n * @example\n * ```ts\n * const position: NormalizedProgress = 1.2; // Can overshoot\n * const bezierY1: NormalizedProgress = 1.5; // Bezier Y coordinates use progress\n * const restitution: NormalizedProgress = 0.8; // Ratios also use progress\n * ```\n */\nexport type NormalizedProgress = Normalized & WithKind<'progress'>;\n\n/**\n * Progress expressed as a percentage [0, 100].\n * Used for API parameters and user-facing values.\n *\n * @example\n * ```ts\n * const decay: PercentProgress = 90; // 90% decay\n * const overshoot: PercentProgress = 30; // 30% overshoot\n * ```\n */\nexport type PercentProgress = Percentage & WithKind<'progress'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Normalized → Percentage (0-1 → 0-100) */\nexport const normalizedToPercentage = (n: Normalized): Percentage => n * 100;\n\n/** Percentage → Normalized (0-100 → 0-1) */\nexport const percentageToNormalized = (p: Percentage): Normalized => p / 100;\n\n/** NormalizedProgress → PercentProgress (0-1 → 0-100) */\nexport const normalizedProgressToPercent = (\n n: NormalizedProgress,\n): PercentProgress => n * 100;\n\n/** PercentProgress → NormalizedProgress (0-100 → 0-1) */\nexport const percentToNormalizedProgress = (\n p: PercentProgress,\n): NormalizedProgress => p / 100;\n\n/* ═══════════════════════════════════════════════════════════════\n UTILITY FUNCTIONS\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Clamp a normalized value to [0, 1].\n * NaN is clamped to 0.\n * Preserves branded traits from the input type.\n *\n * @example\n * clampNormalized(0.5) // 0.5 — in range, unchanged\n * clampNormalized(1.5) // 1 — above 1\n * clampNormalized(-0.5) // 0 — below 0\n * clampNormalized(NaN) // 0 — NaN clamped to 0\n *\n * // Branded traits (e.g. from Smart Primitive) are preserved in the output type:\n *\n * // input is NormalizedProgress, different from NormalizedTime\n * const p: NormalizedProgress = 1.2;\n *\n * // output is NormalizedProgress & ClampedNormalized, not just number & ClampedNormalized\n * const clamped = clampNormalized(p);\n */\nexport function clampNormalized<T extends number>(n: T): T & ClampedNormalized {\n if (n !== n || n <= 0) return 0 as T & ClampedNormalized;\n if (n >= 1) return 1 as T & ClampedNormalized;\n return n as T & ClampedNormalized;\n}\n\n/**\n * Clamp a normalized value to [-1, 1].\n */\nexport function clampSignedNormalized(n: SignedNormalized): SignedNormalized {\n return Math.max(-1, Math.min(1, n));\n}\n\n/**\n * Clamp a percentage value to [0, 100].\n */\nexport function clampPercentage(p: Percentage): Percentage {\n return Math.max(0, Math.min(100, p));\n}\n\n/**\n * Clamp an alpha value to [0, 1].\n */\nexport function clampAlpha(a: Alpha): Alpha {\n return Math.max(0, Math.min(1, a));\n}\n","/**\n * 🌡️ Temperature Units\n *\n * Trait-based types for temperature values with type-safe conversions.\n */\n\nimport type { WithUnit, WithKind } from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n TEMPERATURE TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Temperature in Celsius.\n * All temperature types share the 'temperature' kind.\n */\nexport type Celsius = WithUnit<'celsius'> & WithKind<'temperature'>;\n\n/**\n * Temperature in Fahrenheit.\n * All temperature types share the 'temperature' kind.\n */\nexport type Fahrenheit = WithUnit<'fahrenheit'> & WithKind<'temperature'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Celsius → Fahrenheit */\nexport const celsiusToFahrenheit = (c: Celsius): Fahrenheit => (c * 9) / 5 + 32;\n\n/** Fahrenheit → Celsius */\nexport const fahrenheitToCelsius = (f: Fahrenheit): Celsius =>\n ((f - 32) * 5) / 9;\n","/**\n * 🚀 Velocity Units\n *\n * Dynamic trait-based types for rates of change (distance/time).\n * Includes a generic Velocity type that computes compound units from component types.\n */\n\nimport type { WithUnit, WithKind, UnitOf, KindOf } from '../trait-utils';\nimport type { Pixels } from './length';\nimport type { Seconds, Milliseconds } from './time';\nimport type { Degrees, Radians, Turns } from './angle';\n\n/* ═══════════════════════════════════════════════════════════════\n VELOCITY TYPE SYSTEM\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * A velocity type that dynamically combines distance and time types.\n * Extracts units from both types and creates a compound unit.\n *\n * The kind is determined by the distance type's kind:\n * - 'angle' kind → 'angular-velocity'\n * - other kinds → 'velocity'\n *\n * @example\n * ```ts\n * type PixelsPerSecond = Velocity<Pixels, Seconds>;\n * // Result: number & WithUnit<'px/s'> & WithKind<'velocity'>\n *\n * type DegreesPerSecond = Velocity<Degrees, Seconds>;\n * // Result: number & WithUnit<'deg/s'> & WithKind<'angular-velocity'>\n * ```\n */\nexport type Velocity<TDistance, TTime> =\n WithUnit<`${UnitOf<TDistance>}/${UnitOf<TTime>}`> &\n (KindOf<TDistance> extends 'angle'\n ? WithKind<'angular-velocity'>\n : WithKind<'velocity'>);\n\n/* ═══════════════════════════════════════════════════════════════\n COMMON VELOCITY TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n// Linear velocity\nexport type PixelsPerSecond = Velocity<Pixels, Seconds>;\nexport type PixelsPerMillisecond = Velocity<Pixels, Milliseconds>;\n\n// Angular velocity\nexport type DegreesPerSecond = Velocity<Degrees, Seconds>;\nexport type DegreesPerMillisecond = Velocity<Degrees, Milliseconds>;\nexport type RadiansPerSecond = Velocity<Radians, Seconds>;\nexport type RadiansPerMillisecond = Velocity<Radians, Milliseconds>;\nexport type TurnsPerSecond = Velocity<Turns, Seconds>;\nexport type TurnsPerMillisecond = Velocity<Turns, Milliseconds>;\n\n// Normalized velocity (for animations/easing)\n// Note: Import is lazy to avoid circular dependency\nimport type { NormalizedProgress, NormalizedTime } from './normalized';\n\n/**\n * Velocity of normalized progress with respect to normalized time.\n * Used for easing function derivatives (dProgress/dTime).\n *\n * @example\n * ```ts\n * const velocity: NormalizedVelocity = 2.5; // Progress changes 2.5 per time unit\n * ```\n */\nexport type NormalizedVelocity = Velocity<NormalizedProgress, NormalizedTime>;\n\n/* ═══════════════════════════════════════════════════════════════\n VELOCITY OPERATIONS\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Calculate velocity from distance and time values.\n *\n * @example\n * ```ts\n * const distance: Pixels = 100;\n * const time: Seconds = 2;\n * const speed = velocityFromValues(distance, time); // 50 px/s\n * ```\n */\nexport function velocityFromValues<TDistance, TTime>(\n distance: TDistance,\n time: TTime,\n): Velocity<TDistance, TTime> {\n return (distance as any) / (time as any);\n}\n\n/**\n * Apply velocity over time to get distance.\n *\n * @example\n * ```ts\n * const speed: PixelsPerSecond = 100;\n * const time: Seconds = 2;\n * const distance = applyVelocity(speed, time); // 200 Pixels\n * ```\n */\nexport function applyVelocity<TDistance, TTime>(\n velocity: Velocity<TDistance, TTime>,\n time: TTime,\n): TDistance {\n return ((velocity as any) * (time as any)) as TDistance;\n}\n\n/**\n * Convert velocity from per-second to per-millisecond.\n *\n * @example\n * ```ts\n * const pxPerSec: PixelsPerSecond = 1000;\n * const pxPerMs = velocitySecondsToMilliseconds(pxPerSec); // 1 px/ms\n * ```\n */\nexport function velocitySecondsToMilliseconds<TDistance>(\n velocity: Velocity<TDistance, Seconds>,\n): Velocity<TDistance, Milliseconds> {\n return ((velocity as any) / 1000) as Velocity<TDistance, Milliseconds>;\n}\n\n/**\n * Convert velocity from per-millisecond to per-second.\n */\nexport function velocityMillisecondsToSeconds<TDistance>(\n velocity: Velocity<TDistance, Milliseconds>,\n): Velocity<TDistance, Seconds> {\n return velocity * 1000;\n}\n"],"names":["secondsToMilliseconds","s","millisecondsToSeconds","ms","minutesToSeconds","m","secondsToMinutes","hoursToMinutes","h","minutesToHours","metersToCentimeters","centimetersToMeters","cm","centimetersToMillimeters","millimetersToCentimeters","mm","inchesToCentimeters","i","centimetersToInches","pixelsToEms","fontSize","px","emsToPixels","em","pixelsToRems","rootFontSize","remsToPixels","rem","pixelsToVw","viewportWidth","vwToPixels","vwVal","pixelsToVh","viewportHeight","vhToPixels","vhVal","inchesToPoints","pointsToInches","pt","inchesToPixels","pixelsToInches","DEG_PER_RAD","RAD_PER_DEG","TAU","degreesToRadians","deg","radiansToDegrees","rad","degreesToTurns","turnsToDegrees","t","radiansToTurns","turnsToRadians","normalizeDegrees","normalizeRadians","normalizeTurns","normalizedToPercentage","n","percentageToNormalized","p","normalizedProgressToPercent","percentToNormalizedProgress","clampNormalized","clampSignedNormalized","clampPercentage","clampAlpha","a","celsiusToFahrenheit","c","fahrenheitToCelsius","f","velocityFromValues","distance","time","applyVelocity","velocity","velocitySecondsToMilliseconds","velocityMillisecondsToSeconds"],"mappings":"gFAyCO,MAAMA,EAAyBC,GACnCA,EAAI,IAGMC,EAAyBC,GACnCA,EAAK,IAGKC,EAAoBC,GAAwBA,EAAI,GAGhDC,EAAoBL,GAAwBA,EAAI,GAGhDM,EAAkBC,GAAsBA,EAAI,GAG5CC,EAAkBJ,GAAsBA,EAAI,GCyB5CK,EAAuBL,GAA2BA,EAAI,IAGtDM,EAAuBC,GAA4BA,EAAK,IAGxDC,EAA4BD,GACvCA,EAAK,GAGME,EAA4BC,GACvCA,EAAK,GAGMC,EAAuBC,GAA2BA,EAAI,KAGtDC,EAAuBN,GAA4BA,EAAK,KAOxDO,EACVC,GACAC,GACCA,EAAKD,EAGIE,EACVF,GACAG,GACCA,EAAKH,EAGII,EACX,CAACC,EAAe,KACfJ,GACCA,EAAKI,EAGIC,EACX,CAACD,EAAe,KACfE,GACCA,EAAMF,EAGGG,EACVC,GACAR,GACEA,EAAKQ,EAAiB,IAGdC,EACVD,GACAE,GACEA,EAAQ,IAAOF,EAGPG,EACVC,GACAZ,GACEA,EAAKY,EAAkB,IAGfC,EACVD,GACAE,GACEA,EAAQ,IAAOF,EAOPG,EAAkBnB,GAAsBA,EAAI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AC9B,CAYO,SAASC,EACdC,EACAF,EACW,CACX,OAASE,EAAoBF,CAC/B,CAWO,SAASG,EACdD,EACmC,CACnC,OAASA,EAAmB,GAC9B,CAKO,SAASE,EACdF,EAC8B,CAC9B,OAAOA,EAAW,GACpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 📦 Units Index
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all unit types, constructors, and converters from category modules.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { Pixels, Seconds, degrees, degreesToRadians } from '@penner/smart-primitive';
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export * from './time';
|
|
12
|
+
export * from './length';
|
|
13
|
+
export * from './angle';
|
|
14
|
+
export * from './normalized';
|
|
15
|
+
export * from './temperature';
|
|
16
|
+
export * from './velocity';
|
|
17
|
+
export * from './color';
|
|
18
|
+
export * from './integer';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/units/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const c = (e) => e * 1e3, i = (e) => e / 1e3, r = (e) => e * 60, l = (e) => e / 60, a = (e) => e * 60, T = (e) => e / 60, u = (e) => e * 100, m = (e) => e / 100, d = (e) => e * 10, h = (e) => e / 10, p = (e) => e * 2.54, M = (e) => e / 2.54, P = (e) => (n) => n / e, f = (e) => (n) => n * e, x = (e = 16) => (n) => n / e, g = (e = 16) => (n) => n * e, z = (e) => (n) => n / e * 100, R = (e) => (n) => n / 100 * e, D = (e) => (n) => n / e * 100, I = (e) => (n) => n / 100 * e, v = (e) => e * 72, y = (e) => e / 72, E = (e) => e * 96, S = (e) => e / 96, s = 180 / Math.PI, t = Math.PI / 180, o = 2 * Math.PI, A = (e) => e * t, C = (e) => e * s, N = (e) => e / 360, V = (e) => e * 360, _ = (e) => e / o, w = (e) => e * o;
|
|
2
|
+
function F(e) {
|
|
3
|
+
return (e % 360 + 360) % 360;
|
|
4
|
+
}
|
|
5
|
+
function G(e) {
|
|
6
|
+
return (e % o + o) % o;
|
|
7
|
+
}
|
|
8
|
+
function H(e) {
|
|
9
|
+
return (e % 1 + 1) % 1;
|
|
10
|
+
}
|
|
11
|
+
const U = (e) => e * 100, b = (e) => e / 100, j = (e) => e * 100, k = (e) => e / 100;
|
|
12
|
+
function q(e) {
|
|
13
|
+
return e !== e || e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
14
|
+
}
|
|
15
|
+
function B(e) {
|
|
16
|
+
return Math.max(-1, Math.min(1, e));
|
|
17
|
+
}
|
|
18
|
+
function J(e) {
|
|
19
|
+
return Math.max(0, Math.min(100, e));
|
|
20
|
+
}
|
|
21
|
+
function K(e) {
|
|
22
|
+
return Math.max(0, Math.min(1, e));
|
|
23
|
+
}
|
|
24
|
+
const L = (e) => e * 9 / 5 + 32, O = (e) => (e - 32) * 5 / 9;
|
|
25
|
+
function Q(e, n) {
|
|
26
|
+
return e / n;
|
|
27
|
+
}
|
|
28
|
+
function W(e, n) {
|
|
29
|
+
return e * n;
|
|
30
|
+
}
|
|
31
|
+
function X(e) {
|
|
32
|
+
return e / 1e3;
|
|
33
|
+
}
|
|
34
|
+
function Y(e) {
|
|
35
|
+
return e * 1e3;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
W as applyVelocity,
|
|
39
|
+
L as celsiusToFahrenheit,
|
|
40
|
+
M as centimetersToInches,
|
|
41
|
+
m as centimetersToMeters,
|
|
42
|
+
d as centimetersToMillimeters,
|
|
43
|
+
K as clampAlpha,
|
|
44
|
+
q as clampNormalized,
|
|
45
|
+
J as clampPercentage,
|
|
46
|
+
B as clampSignedNormalized,
|
|
47
|
+
A as degreesToRadians,
|
|
48
|
+
N as degreesToTurns,
|
|
49
|
+
f as emsToPixels,
|
|
50
|
+
O as fahrenheitToCelsius,
|
|
51
|
+
a as hoursToMinutes,
|
|
52
|
+
p as inchesToCentimeters,
|
|
53
|
+
E as inchesToPixels,
|
|
54
|
+
v as inchesToPoints,
|
|
55
|
+
u as metersToCentimeters,
|
|
56
|
+
h as millimetersToCentimeters,
|
|
57
|
+
i as millisecondsToSeconds,
|
|
58
|
+
T as minutesToHours,
|
|
59
|
+
r as minutesToSeconds,
|
|
60
|
+
F as normalizeDegrees,
|
|
61
|
+
G as normalizeRadians,
|
|
62
|
+
H as normalizeTurns,
|
|
63
|
+
j as normalizedProgressToPercent,
|
|
64
|
+
U as normalizedToPercentage,
|
|
65
|
+
k as percentToNormalizedProgress,
|
|
66
|
+
b as percentageToNormalized,
|
|
67
|
+
P as pixelsToEms,
|
|
68
|
+
S as pixelsToInches,
|
|
69
|
+
x as pixelsToRems,
|
|
70
|
+
D as pixelsToVh,
|
|
71
|
+
z as pixelsToVw,
|
|
72
|
+
y as pointsToInches,
|
|
73
|
+
C as radiansToDegrees,
|
|
74
|
+
_ as radiansToTurns,
|
|
75
|
+
g as remsToPixels,
|
|
76
|
+
c as secondsToMilliseconds,
|
|
77
|
+
l as secondsToMinutes,
|
|
78
|
+
V as turnsToDegrees,
|
|
79
|
+
w as turnsToRadians,
|
|
80
|
+
Q as velocityFromValues,
|
|
81
|
+
Y as velocityMillisecondsToSeconds,
|
|
82
|
+
X as velocitySecondsToMilliseconds,
|
|
83
|
+
I as vhToPixels,
|
|
84
|
+
R as vwToPixels
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../src/units/time.ts","../../src/units/length.ts","../../src/units/angle.ts","../../src/units/normalized.ts","../../src/units/temperature.ts","../../src/units/velocity.ts"],"sourcesContent":["/**\n * ⏱️ Time Units\n *\n * Trait-based types for time-based values with type-safe conversions.\n */\n\nimport type { WithUnit, WithKind } from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n TIME TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Time in seconds.\n * All time types share the 'time' kind.\n */\nexport type Seconds = WithUnit<'s'> & WithKind<'time'>;\n\n/**\n * Time in milliseconds.\n * All time types share the 'time' kind.\n */\nexport type Milliseconds = WithUnit<'ms'> & WithKind<'time'>;\n\n/**\n * Time in minutes.\n * All time types share the 'time' kind.\n */\nexport type Minutes = WithUnit<'min'> & WithKind<'time'>;\n\n/**\n * Time in hours.\n * All time types share the 'time' kind.\n */\nexport type Hours = WithUnit<'h'> & WithKind<'time'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Seconds → Milliseconds (1s = 1000ms) */\nexport const secondsToMilliseconds = (s: Seconds): Milliseconds =>\n (s * 1000) as Milliseconds;\n\n/** Milliseconds → Seconds */\nexport const millisecondsToSeconds = (ms: Milliseconds): Seconds =>\n (ms / 1000) as Seconds;\n\n/** Minutes → Seconds (1min = 60s) */\nexport const minutesToSeconds = (m: Minutes): Seconds => m * 60;\n\n/** Seconds → Minutes */\nexport const secondsToMinutes = (s: Seconds): Minutes => s / 60;\n\n/** Hours → Minutes (1h = 60min) */\nexport const hoursToMinutes = (h: Hours): Minutes => h * 60;\n\n/** Minutes → Hours */\nexport const minutesToHours = (m: Minutes): Hours => m / 60;\n\n/* ═══════════════════════════════════════════════════════════════\n TYPE FAMILIES: Useful unions for function parameters\n ═══════════════════════════════════════════════════════════════ */\n\n/** Any time unit */\nexport type TimeUnit = Seconds | Milliseconds | Minutes | Hours;\n\n/** Common animation time units (seconds or milliseconds) */\nexport type AnimationTimeUnit = Seconds | Milliseconds;\n","/**\n * 📏 Length Units\n *\n * Trait-based types for length/distance values with type-safe conversions.\n */\n\nimport type { WithUnit, WithKind } from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n LENGTH TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Length in pixels (CSS px).\n * All length types share the 'length' kind.\n */\nexport type Pixels = WithUnit<'px'> & WithKind<'length'>;\n\n/**\n * Length in em units (relative to font-size).\n * All length types share the 'length' kind.\n */\nexport type Ems = WithUnit<'em'> & WithKind<'length'>;\n\n/**\n * Length in rem units (relative to root font-size).\n * All length types share the 'length' kind.\n */\nexport type Rems = WithUnit<'rem'> & WithKind<'length'>;\n\n/**\n * Length in viewport width units.\n * All length types share the 'length' kind.\n */\nexport type Vw = WithUnit<'vw'> & WithKind<'length'>;\n\n/**\n * Length in viewport height units.\n * All length types share the 'length' kind.\n */\nexport type Vh = WithUnit<'vh'> & WithKind<'length'>;\n\n/**\n * Length in percent.\n * All length types share the 'length' kind.\n */\nexport type Percent = WithUnit<'%'> & WithKind<'length'>;\n\n/**\n * Length in points (1pt = 1/72 inch).\n * All length types share the 'length' kind.\n */\nexport type Points = WithUnit<'pt'> & WithKind<'length'>;\n\n/**\n * Length in inches.\n * All length types share the 'length' kind.\n */\nexport type Inches = WithUnit<'in'> & WithKind<'length'>;\n\n/**\n * Length in centimeters.\n * All length types share the 'length' kind.\n */\nexport type Centimeters = WithUnit<'cm'> & WithKind<'length'>;\n\n/**\n * Length in millimeters.\n * All length types share the 'length' kind.\n */\nexport type Millimeters = WithUnit<'mm'> & WithKind<'length'>;\n\n/**\n * Length in meters.\n * All length types share the 'length' kind.\n */\nexport type Meters = WithUnit<'m'> & WithKind<'length'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS - Metric\n ═══════════════════════════════════════════════════════════════ */\n\n/** Meters → Centimeters (1m = 100cm) */\nexport const metersToCentimeters = (m: Meters): Centimeters => m * 100;\n\n/** Centimeters → Meters */\nexport const centimetersToMeters = (cm: Centimeters): Meters => cm / 100;\n\n/** Centimeters → Millimeters (1cm = 10mm) */\nexport const centimetersToMillimeters = (cm: Centimeters): Millimeters =>\n cm * 10;\n\n/** Millimeters → Centimeters */\nexport const millimetersToCentimeters = (mm: Millimeters): Centimeters =>\n mm / 10;\n\n/** Inches → Centimeters (1in = 2.54cm) */\nexport const inchesToCentimeters = (i: Inches): Centimeters => i * 2.54;\n\n/** Centimeters → Inches */\nexport const centimetersToInches = (cm: Centimeters): Inches => cm / 2.54;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS - CSS (context-dependent)\n ═══════════════════════════════════════════════════════════════ */\n\n/** Pixels → Ems for a given font-size */\nexport const pixelsToEms =\n (fontSize: number) =>\n (px: Pixels): Ems =>\n px / fontSize;\n\n/** Ems → Pixels for a given font-size */\nexport const emsToPixels =\n (fontSize: number) =>\n (em: Ems): Pixels =>\n em * fontSize;\n\n/** Pixels → Rems for a given root font-size */\nexport const pixelsToRems =\n (rootFontSize = 16) =>\n (px: Pixels): Rems =>\n px / rootFontSize;\n\n/** Rems → Pixels for a given root font-size */\nexport const remsToPixels =\n (rootFontSize = 16) =>\n (rem: Rems): Pixels =>\n rem * rootFontSize;\n\n/** Pixels → Vw for a given viewport width */\nexport const pixelsToVw =\n (viewportWidth: number) =>\n (px: Pixels): Vw =>\n (px / viewportWidth) * 100;\n\n/** Vw → Pixels for a given viewport width */\nexport const vwToPixels =\n (viewportWidth: number) =>\n (vwVal: Vw): Pixels =>\n (vwVal / 100) * viewportWidth;\n\n/** Pixels → Vh for a given viewport height */\nexport const pixelsToVh =\n (viewportHeight: number) =>\n (px: Pixels): Vh =>\n (px / viewportHeight) * 100;\n\n/** Vh → Pixels for a given viewport height */\nexport const vhToPixels =\n (viewportHeight: number) =>\n (vhVal: Vh): Pixels =>\n (vhVal / 100) * viewportHeight;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS - Print\n ═══════════════════════════════════════════════════════════════ */\n\n/** Inches → Points (1in = 72pt) */\nexport const inchesToPoints = (i: Inches): Points => i * 72;\n\n/** Points → Inches */\nexport const pointsToInches = (pt: Points): Inches => pt / 72;\n\n/** Inches → Pixels at 96 DPI (CSS standard) */\nexport const inchesToPixels = (i: Inches): Pixels => i * 96;\n\n/** Pixels → Inches at 96 DPI (CSS standard) */\nexport const pixelsToInches = (px: Pixels): Inches => px / 96;\n\n/* ═══════════════════════════════════════════════════════════════\n TYPE FAMILIES: Useful unions for function parameters\n ═══════════════════════════════════════════════════════════════ */\n\n/** Any length unit */\nexport type LengthUnit =\n | Pixels\n | Ems\n | Rems\n | Vw\n | Vh\n | Percent\n | Points\n | Inches\n | Centimeters\n | Millimeters\n | Meters;\n\n/** CSS absolute length units */\nexport type CSSAbsoluteLengthUnit =\n | Pixels\n | Points\n | Inches\n | Centimeters\n | Millimeters;\n\n/** CSS relative length units */\nexport type CSSRelativeLengthUnit = Ems | Rems | Vw | Vh | Percent;\n\n/** Metric length units */\nexport type MetricLengthUnit = Meters | Centimeters | Millimeters;\n","/**\n * 📐 Angle Units\n *\n * Trait-based types for angular measurements with type-safe conversions.\n */\n\nimport type {\n WithUnit,\n WithRange,\n WithPeriodic,\n WithKind,\n} from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n ANGLE TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Angle in degrees [0, 360), periodic.\n * All angle types share the 'angle' kind.\n */\nexport type Degrees = WithUnit<'deg'> &\n WithRange<0, 360> &\n WithPeriodic &\n WithKind<'angle'>;\n\n/**\n * Angle in radians [0, 2π), periodic.\n * All angle types share the 'angle' kind.\n */\nexport type Radians = WithUnit<'rad'> &\n WithRange<0, 6.283185307179586> &\n WithPeriodic &\n WithKind<'angle'>;\n\n/**\n * Angle in turns/rotations [0, 1), periodic.\n * All angle types share the 'angle' kind.\n */\nexport type Turns = WithUnit<'turn'> &\n WithRange<0, 1> &\n WithPeriodic &\n WithKind<'angle'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONSTANTS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Degrees per radian */\nconst DEG_PER_RAD = 180 / Math.PI;\n\n/** Radians per degree */\nconst RAD_PER_DEG = Math.PI / 180;\n\n/** 2π constant */\nconst TAU = 2 * Math.PI;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Degrees → Radians */\nexport const degreesToRadians = (deg: Degrees): Radians => deg * RAD_PER_DEG;\n\n/** Radians → Degrees */\nexport const radiansToDegrees = (rad: Radians): Degrees => rad * DEG_PER_RAD;\n\n/** Degrees → Turns */\nexport const degreesToTurns = (deg: Degrees): Turns => deg / 360;\n\n/** Turns → Degrees */\nexport const turnsToDegrees = (t: Turns): Degrees => t * 360;\n\n/** Radians → Turns */\nexport const radiansToTurns = (rad: Radians): Turns => rad / TAU;\n\n/** Turns → Radians */\nexport const turnsToRadians = (t: Turns): Radians => t * TAU;\n\n/* ═══════════════════════════════════════════════════════════════\n ANGLE UTILITIES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Normalize an angle in degrees to the range [0, 360).\n */\nexport function normalizeDegrees(deg: Degrees): Degrees {\n return ((deg % 360) + 360) % 360;\n}\n\n/**\n * Normalize an angle in radians to the range [0, 2π).\n */\nexport function normalizeRadians(rad: Radians): Radians {\n return ((rad % TAU) + TAU) % TAU;\n}\n\n/**\n * Normalize an angle in turns to the range [0, 1).\n */\nexport function normalizeTurns(t: Turns): Turns {\n return ((t % 1) + 1) % 1;\n}\n\n/* ═══════════════════════════════════════════════════════════════\n TYPE FAMILIES: Useful unions for function parameters\n ═══════════════════════════════════════════════════════════════ */\n\n/** Any angle unit */\nexport type AngleUnit = Degrees | Radians | Turns;\n","/**\n * 📊 Normalized & Percentage Units\n *\n * Trait-based types for normalized values (0-1) and percentages (0-100).\n */\n\nimport type {\n WithRange,\n WithUnit,\n WithKind,\n WithClamped,\n} from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n NORMALIZED TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * A value normalized to the range [0, 1], unclamped.\n * Can exceed these bounds.\n */\nexport type Normalized = WithRange<0, 1>;\n\n/**\n * A clamped normalized value in the range [0, 1].\n * Constrained to not exceed these bounds.\n */\nexport type ClampedNormalized = Normalized & WithClamped;\n\n/**\n * A value normalized to the range [-1, 1], unclamped.\n * Can exceed these bounds.\n */\nexport type SignedNormalized = WithRange<-1, 1>;\n\n/**\n * A percentage value based on the range [0, 100], unclamped.\n */\nexport type Percentage = WithRange<0, 100> & WithUnit<'percent'>;\n\n/**\n * An alpha/opacity value in the range [0, 1].\n */\nexport type Alpha = WithRange<0, 1> & WithKind<'opacity'>;\n\n/**\n * A ratio value (typically positive).\n */\nexport type Ratio = number;\n\n/**\n * A factor/multiplier value (could be positive or negative).\n */\nexport type Factor = number;\n\n/* ═══════════════════════════════════════════════════════════════\n ANIMATION-SPECIFIC NORMALIZED TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Normalized time [0, 1] within an animation segment.\n * Used as the input to easing functions (horizontal/time axis).\n * STRICTLY BOUNDED to [0, 1] - cannot overshoot.\n *\n * @example\n * ```ts\n * const joinTime: NormalizedTime = 0.6;\n * const bezierX1: NormalizedTime = 0.42; // Bezier X coordinates use time\n * ```\n */\nexport type NormalizedTime = ClampedNormalized & WithKind<'time'>;\n\n/**\n * Normalized progress [0, 1] of an animation.\n * Used as the output of easing functions (vertical/progress axis).\n * CAN OVERSHOOT [0, 1] during back/elastic effects (e.g., 1.2 or -0.1).\n *\n * The \"normalized\" refers to the scale (0-1 reference), not the bounds.\n *\n * @example\n * ```ts\n * const position: NormalizedProgress = 1.2; // Can overshoot\n * const bezierY1: NormalizedProgress = 1.5; // Bezier Y coordinates use progress\n * const restitution: NormalizedProgress = 0.8; // Ratios also use progress\n * ```\n */\nexport type NormalizedProgress = Normalized & WithKind<'progress'>;\n\n/**\n * Progress expressed as a percentage [0, 100].\n * Used for API parameters and user-facing values.\n *\n * @example\n * ```ts\n * const decay: PercentProgress = 90; // 90% decay\n * const overshoot: PercentProgress = 30; // 30% overshoot\n * ```\n */\nexport type PercentProgress = Percentage & WithKind<'progress'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Normalized → Percentage (0-1 → 0-100) */\nexport const normalizedToPercentage = (n: Normalized): Percentage => n * 100;\n\n/** Percentage → Normalized (0-100 → 0-1) */\nexport const percentageToNormalized = (p: Percentage): Normalized => p / 100;\n\n/** NormalizedProgress → PercentProgress (0-1 → 0-100) */\nexport const normalizedProgressToPercent = (\n n: NormalizedProgress,\n): PercentProgress => n * 100;\n\n/** PercentProgress → NormalizedProgress (0-100 → 0-1) */\nexport const percentToNormalizedProgress = (\n p: PercentProgress,\n): NormalizedProgress => p / 100;\n\n/* ═══════════════════════════════════════════════════════════════\n UTILITY FUNCTIONS\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Clamp a normalized value to [0, 1].\n * NaN is clamped to 0.\n * Preserves branded traits from the input type.\n *\n * @example\n * clampNormalized(0.5) // 0.5 — in range, unchanged\n * clampNormalized(1.5) // 1 — above 1\n * clampNormalized(-0.5) // 0 — below 0\n * clampNormalized(NaN) // 0 — NaN clamped to 0\n *\n * // Branded traits (e.g. from Smart Primitive) are preserved in the output type:\n *\n * // input is NormalizedProgress, different from NormalizedTime\n * const p: NormalizedProgress = 1.2;\n *\n * // output is NormalizedProgress & ClampedNormalized, not just number & ClampedNormalized\n * const clamped = clampNormalized(p);\n */\nexport function clampNormalized<T extends number>(n: T): T & ClampedNormalized {\n if (n !== n || n <= 0) return 0 as T & ClampedNormalized;\n if (n >= 1) return 1 as T & ClampedNormalized;\n return n as T & ClampedNormalized;\n}\n\n/**\n * Clamp a normalized value to [-1, 1].\n */\nexport function clampSignedNormalized(n: SignedNormalized): SignedNormalized {\n return Math.max(-1, Math.min(1, n));\n}\n\n/**\n * Clamp a percentage value to [0, 100].\n */\nexport function clampPercentage(p: Percentage): Percentage {\n return Math.max(0, Math.min(100, p));\n}\n\n/**\n * Clamp an alpha value to [0, 1].\n */\nexport function clampAlpha(a: Alpha): Alpha {\n return Math.max(0, Math.min(1, a));\n}\n","/**\n * 🌡️ Temperature Units\n *\n * Trait-based types for temperature values with type-safe conversions.\n */\n\nimport type { WithUnit, WithKind } from '../trait-utils';\n\n/* ═══════════════════════════════════════════════════════════════\n TEMPERATURE TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Temperature in Celsius.\n * All temperature types share the 'temperature' kind.\n */\nexport type Celsius = WithUnit<'celsius'> & WithKind<'temperature'>;\n\n/**\n * Temperature in Fahrenheit.\n * All temperature types share the 'temperature' kind.\n */\nexport type Fahrenheit = WithUnit<'fahrenheit'> & WithKind<'temperature'>;\n\n/* ═══════════════════════════════════════════════════════════════\n CONVERTERS\n ═══════════════════════════════════════════════════════════════ */\n\n/** Celsius → Fahrenheit */\nexport const celsiusToFahrenheit = (c: Celsius): Fahrenheit => (c * 9) / 5 + 32;\n\n/** Fahrenheit → Celsius */\nexport const fahrenheitToCelsius = (f: Fahrenheit): Celsius =>\n ((f - 32) * 5) / 9;\n","/**\n * 🚀 Velocity Units\n *\n * Dynamic trait-based types for rates of change (distance/time).\n * Includes a generic Velocity type that computes compound units from component types.\n */\n\nimport type { WithUnit, WithKind, UnitOf, KindOf } from '../trait-utils';\nimport type { Pixels } from './length';\nimport type { Seconds, Milliseconds } from './time';\nimport type { Degrees, Radians, Turns } from './angle';\n\n/* ═══════════════════════════════════════════════════════════════\n VELOCITY TYPE SYSTEM\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * A velocity type that dynamically combines distance and time types.\n * Extracts units from both types and creates a compound unit.\n *\n * The kind is determined by the distance type's kind:\n * - 'angle' kind → 'angular-velocity'\n * - other kinds → 'velocity'\n *\n * @example\n * ```ts\n * type PixelsPerSecond = Velocity<Pixels, Seconds>;\n * // Result: number & WithUnit<'px/s'> & WithKind<'velocity'>\n *\n * type DegreesPerSecond = Velocity<Degrees, Seconds>;\n * // Result: number & WithUnit<'deg/s'> & WithKind<'angular-velocity'>\n * ```\n */\nexport type Velocity<TDistance, TTime> =\n WithUnit<`${UnitOf<TDistance>}/${UnitOf<TTime>}`> &\n (KindOf<TDistance> extends 'angle'\n ? WithKind<'angular-velocity'>\n : WithKind<'velocity'>);\n\n/* ═══════════════════════════════════════════════════════════════\n COMMON VELOCITY TYPES\n ═══════════════════════════════════════════════════════════════ */\n\n// Linear velocity\nexport type PixelsPerSecond = Velocity<Pixels, Seconds>;\nexport type PixelsPerMillisecond = Velocity<Pixels, Milliseconds>;\n\n// Angular velocity\nexport type DegreesPerSecond = Velocity<Degrees, Seconds>;\nexport type DegreesPerMillisecond = Velocity<Degrees, Milliseconds>;\nexport type RadiansPerSecond = Velocity<Radians, Seconds>;\nexport type RadiansPerMillisecond = Velocity<Radians, Milliseconds>;\nexport type TurnsPerSecond = Velocity<Turns, Seconds>;\nexport type TurnsPerMillisecond = Velocity<Turns, Milliseconds>;\n\n// Normalized velocity (for animations/easing)\n// Note: Import is lazy to avoid circular dependency\nimport type { NormalizedProgress, NormalizedTime } from './normalized';\n\n/**\n * Velocity of normalized progress with respect to normalized time.\n * Used for easing function derivatives (dProgress/dTime).\n *\n * @example\n * ```ts\n * const velocity: NormalizedVelocity = 2.5; // Progress changes 2.5 per time unit\n * ```\n */\nexport type NormalizedVelocity = Velocity<NormalizedProgress, NormalizedTime>;\n\n/* ═══════════════════════════════════════════════════════════════\n VELOCITY OPERATIONS\n ═══════════════════════════════════════════════════════════════ */\n\n/**\n * Calculate velocity from distance and time values.\n *\n * @example\n * ```ts\n * const distance: Pixels = 100;\n * const time: Seconds = 2;\n * const speed = velocityFromValues(distance, time); // 50 px/s\n * ```\n */\nexport function velocityFromValues<TDistance, TTime>(\n distance: TDistance,\n time: TTime,\n): Velocity<TDistance, TTime> {\n return (distance as any) / (time as any);\n}\n\n/**\n * Apply velocity over time to get distance.\n *\n * @example\n * ```ts\n * const speed: PixelsPerSecond = 100;\n * const time: Seconds = 2;\n * const distance = applyVelocity(speed, time); // 200 Pixels\n * ```\n */\nexport function applyVelocity<TDistance, TTime>(\n velocity: Velocity<TDistance, TTime>,\n time: TTime,\n): TDistance {\n return ((velocity as any) * (time as any)) as TDistance;\n}\n\n/**\n * Convert velocity from per-second to per-millisecond.\n *\n * @example\n * ```ts\n * const pxPerSec: PixelsPerSecond = 1000;\n * const pxPerMs = velocitySecondsToMilliseconds(pxPerSec); // 1 px/ms\n * ```\n */\nexport function velocitySecondsToMilliseconds<TDistance>(\n velocity: Velocity<TDistance, Seconds>,\n): Velocity<TDistance, Milliseconds> {\n return ((velocity as any) / 1000) as Velocity<TDistance, Milliseconds>;\n}\n\n/**\n * Convert velocity from per-millisecond to per-second.\n */\nexport function velocityMillisecondsToSeconds<TDistance>(\n velocity: Velocity<TDistance, Milliseconds>,\n): Velocity<TDistance, Seconds> {\n return velocity * 1000;\n}\n"],"names":["secondsToMilliseconds","s","millisecondsToSeconds","ms","minutesToSeconds","m","secondsToMinutes","hoursToMinutes","h","minutesToHours","metersToCentimeters","centimetersToMeters","cm","centimetersToMillimeters","millimetersToCentimeters","mm","inchesToCentimeters","i","centimetersToInches","pixelsToEms","fontSize","px","emsToPixels","em","pixelsToRems","rootFontSize","remsToPixels","rem","pixelsToVw","viewportWidth","vwToPixels","vwVal","pixelsToVh","viewportHeight","vhToPixels","vhVal","inchesToPoints","pointsToInches","pt","inchesToPixels","pixelsToInches","DEG_PER_RAD","RAD_PER_DEG","TAU","degreesToRadians","deg","radiansToDegrees","rad","degreesToTurns","turnsToDegrees","t","radiansToTurns","turnsToRadians","normalizeDegrees","normalizeRadians","normalizeTurns","normalizedToPercentage","n","percentageToNormalized","p","normalizedProgressToPercent","percentToNormalizedProgress","clampNormalized","clampSignedNormalized","clampPercentage","clampAlpha","a","celsiusToFahrenheit","c","fahrenheitToCelsius","f","velocityFromValues","distance","time","applyVelocity","velocity","velocitySecondsToMilliseconds","velocityMillisecondsToSeconds"],"mappings":"AAyCO,MAAMA,IAAwB,CAACC,MACnCA,IAAI,KAGMC,IAAwB,CAACC,MACnCA,IAAK,KAGKC,IAAmB,CAACC,MAAwBA,IAAI,IAGhDC,IAAmB,CAACL,MAAwBA,IAAI,IAGhDM,IAAiB,CAACC,MAAsBA,IAAI,IAG5CC,IAAiB,CAACJ,MAAsBA,IAAI,ICyB5CK,IAAsB,CAACL,MAA2BA,IAAI,KAGtDM,IAAsB,CAACC,MAA4BA,IAAK,KAGxDC,IAA2B,CAACD,MACvCA,IAAK,IAGME,IAA2B,CAACC,MACvCA,IAAK,IAGMC,IAAsB,CAACC,MAA2BA,IAAI,MAGtDC,IAAsB,CAACN,MAA4BA,IAAK,MAOxDO,IACX,CAACC,MACD,CAACC,MACCA,IAAKD,GAGIE,IACX,CAACF,MACD,CAACG,MACCA,IAAKH,GAGII,IACX,CAACC,IAAe,OAChB,CAACJ,MACCA,IAAKI,GAGIC,IACX,CAACD,IAAe,OAChB,CAACE,MACCA,IAAMF,GAGGG,IACX,CAACC,MACD,CAACR,MACEA,IAAKQ,IAAiB,KAGdC,IACX,CAACD,MACD,CAACE,MACEA,IAAQ,MAAOF,GAGPG,IACX,CAACC,MACD,CAACZ,MACEA,IAAKY,IAAkB,KAGfC,IACX,CAACD,MACD,CAACE,MACEA,IAAQ,MAAOF,GAOPG,IAAiB,CAACnB,MAAsBA,IAAI,IAG5CoB,IAAiB,CAACC,MAAuBA,IAAK,IAG9CC,IAAiB,CAACtB,MAAsBA,IAAI,IAG5CuB,IAAiB,CAACnB,MAAuBA,IAAK,ICvHrDoB,IAAc,MAAM,KAAK,IAGzBC,IAAc,KAAK,KAAK,KAGxBC,IAAM,IAAI,KAAK,IAORC,IAAmB,CAACC,MAA0BA,IAAMH,GAGpDI,IAAmB,CAACC,MAA0BA,IAAMN,GAGpDO,IAAiB,CAACH,MAAwBA,IAAM,KAGh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ils';
|
|
2
|
+
/**
|
|
3
|
+
* A non-negative integer used as a zero-based index into a collection.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const extremumIndex: Index = 0;
|
|
8
|
+
* const items = extrema[extremumIndex];
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export type Index = WithInteger & WithKind<'index'>;
|
|
12
|
+
//# sourceMappingURL=integer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integer.d.ts","sourceRoot":"","sources":["../../src/units/integer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,MAAM,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integer.test-d.d.ts","sourceRoot":"","sources":["../../src/units/integer.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { WithUnit, WithKind } from '../trait-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Length in pixels (CSS px).
|
|
4
|
+
* All length types share the 'length' kind.
|
|
5
|
+
*/
|
|
6
|
+
export type Pixels = WithUnit<'px'> & WithKind<'length'>;
|
|
7
|
+
/**
|
|
8
|
+
* Length in em units (relative to font-size).
|
|
9
|
+
* All length types share the 'length' kind.
|
|
10
|
+
*/
|
|
11
|
+
export type Ems = WithUnit<'em'> & WithKind<'length'>;
|
|
12
|
+
/**
|
|
13
|
+
* Length in rem units (relative to root font-size).
|
|
14
|
+
* All length types share the 'length' kind.
|
|
15
|
+
*/
|
|
16
|
+
export type Rems = WithUnit<'rem'> & WithKind<'length'>;
|
|
17
|
+
/**
|
|
18
|
+
* Length in viewport width units.
|
|
19
|
+
* All length types share the 'length' kind.
|
|
20
|
+
*/
|
|
21
|
+
export type Vw = WithUnit<'vw'> & WithKind<'length'>;
|
|
22
|
+
/**
|
|
23
|
+
* Length in viewport height units.
|
|
24
|
+
* All length types share the 'length' kind.
|
|
25
|
+
*/
|
|
26
|
+
export type Vh = WithUnit<'vh'> & WithKind<'length'>;
|
|
27
|
+
/**
|
|
28
|
+
* Length in percent.
|
|
29
|
+
* All length types share the 'length' kind.
|
|
30
|
+
*/
|
|
31
|
+
export type Percent = WithUnit<'%'> & WithKind<'length'>;
|
|
32
|
+
/**
|
|
33
|
+
* Length in points (1pt = 1/72 inch).
|
|
34
|
+
* All length types share the 'length' kind.
|
|
35
|
+
*/
|
|
36
|
+
export type Points = WithUnit<'pt'> & WithKind<'length'>;
|
|
37
|
+
/**
|
|
38
|
+
* Length in inches.
|
|
39
|
+
* All length types share the 'length' kind.
|
|
40
|
+
*/
|
|
41
|
+
export type Inches = WithUnit<'in'> & WithKind<'length'>;
|
|
42
|
+
/**
|
|
43
|
+
* Length in centimeters.
|
|
44
|
+
* All length types share the 'length' kind.
|
|
45
|
+
*/
|
|
46
|
+
export type Centimeters = WithUnit<'cm'> & WithKind<'length'>;
|
|
47
|
+
/**
|
|
48
|
+
* Length in millimeters.
|
|
49
|
+
* All length types share the 'length' kind.
|
|
50
|
+
*/
|
|
51
|
+
export type Millimeters = WithUnit<'mm'> & WithKind<'length'>;
|
|
52
|
+
/**
|
|
53
|
+
* Length in meters.
|
|
54
|
+
* All length types share the 'length' kind.
|
|
55
|
+
*/
|
|
56
|
+
export type Meters = WithUnit<'m'> & WithKind<'length'>;
|
|
57
|
+
/** Meters → Centimeters (1m = 100cm) */
|
|
58
|
+
export declare const metersToCentimeters: (m: Meters) => Centimeters;
|
|
59
|
+
/** Centimeters → Meters */
|
|
60
|
+
export declare const centimetersToMeters: (cm: Centimeters) => Meters;
|
|
61
|
+
/** Centimeters → Millimeters (1cm = 10mm) */
|
|
62
|
+
export declare const centimetersToMillimeters: (cm: Centimeters) => Millimeters;
|
|
63
|
+
/** Millimeters → Centimeters */
|
|
64
|
+
export declare const millimetersToCentimeters: (mm: Millimeters) => Centimeters;
|
|
65
|
+
/** Inches → Centimeters (1in = 2.54cm) */
|
|
66
|
+
export declare const inchesToCentimeters: (i: Inches) => Centimeters;
|
|
67
|
+
/** Centimeters → Inches */
|
|
68
|
+
export declare const centimetersToInches: (cm: Centimeters) => Inches;
|
|
69
|
+
/** Pixels → Ems for a given font-size */
|
|
70
|
+
export declare const pixelsToEms: (fontSize: number) => (px: Pixels) => Ems;
|
|
71
|
+
/** Ems → Pixels for a given font-size */
|
|
72
|
+
export declare const emsToPixels: (fontSize: number) => (em: Ems) => Pixels;
|
|
73
|
+
/** Pixels → Rems for a given root font-size */
|
|
74
|
+
export declare const pixelsToRems: (rootFontSize?: number) => (px: Pixels) => Rems;
|
|
75
|
+
/** Rems → Pixels for a given root font-size */
|
|
76
|
+
export declare const remsToPixels: (rootFontSize?: number) => (rem: Rems) => Pixels;
|
|
77
|
+
/** Pixels → Vw for a given viewport width */
|
|
78
|
+
export declare const pixelsToVw: (viewportWidth: number) => (px: Pixels) => Vw;
|
|
79
|
+
/** Vw → Pixels for a given viewport width */
|
|
80
|
+
export declare const vwToPixels: (viewportWidth: number) => (vwVal: Vw) => Pixels;
|
|
81
|
+
/** Pixels → Vh for a given viewport height */
|
|
82
|
+
export declare const pixelsToVh: (viewportHeight: number) => (px: Pixels) => Vh;
|
|
83
|
+
/** Vh → Pixels for a given viewport height */
|
|
84
|
+
export declare const vhToPixels: (viewportHeight: number) => (vhVal: Vh) => Pixels;
|
|
85
|
+
/** Inches → Points (1in = 72pt) */
|
|
86
|
+
export declare const inchesToPoints: (i: Inches) => Points;
|
|
87
|
+
/** Points → Inches */
|
|
88
|
+
export declare const pointsToInches: (pt: Points) => Inches;
|
|
89
|
+
/** Inches → Pixels at 96 DPI (CSS standard) */
|
|
90
|
+
export declare const inchesToPixels: (i: Inches) => Pixels;
|
|
91
|
+
/** Pixels → Inches at 96 DPI (CSS standard) */
|
|
92
|
+
export declare const pixelsToInches: (px: Pixels) => Inches;
|
|
93
|
+
/** Any length unit */
|
|
94
|
+
export type LengthUnit = Pixels | Ems | Rems | Vw | Vh | Percent | Points | Inches | Centimeters | Millimeters | Meters;
|
|
95
|
+
/** CSS absolute length units */
|
|
96
|
+
export type CSSAbsoluteLengthUnit = Pixels | Points | Inches | Centimeters | Millimeters;
|
|
97
|
+
/** CSS relative length units */
|
|
98
|
+
export type CSSRelativeLengthUnit = Ems | Rems | Vw | Vh | Percent;
|
|
99
|
+
/** Metric length units */
|
|
100
|
+
export type MetricLengthUnit = Meters | Centimeters | Millimeters;
|
|
101
|
+
//# sourceMappingURL=length.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["../../src/units/length.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMzD;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,G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