@tempots/std 0.28.0 → 0.28.1
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/color-channel.cjs +1 -0
- package/color-channel.d.ts +118 -0
- package/color-channel.js +75 -0
- package/color-gamut.cjs +1 -0
- package/color-gamut.d.ts +59 -0
- package/color-gamut.js +72 -0
- package/index.cjs +1 -1
- package/index.d.ts +2 -0
- package/index.js +289 -277
- package/package.json +15 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./number.cjs"),e=require("./color-D7FAmkht.cjs"),t=(a,l)=>a[l],h=a=>{const{space:l,...r}=a;return r},n=a=>{switch(a.space){case"rgb":return[a.r,a.g,a.b,a.alpha];case"rgb8":return[a.r,a.g,a.b,a.alpha];case"hsl":return[a.h,a.s,a.l,a.alpha];case"hsv":return[a.h,a.s,a.v,a.alpha];case"hwb":return[a.h,a.w,a.b,a.alpha];case"lab":return[a.l,a.a,a.b,a.alpha];case"lch":return[a.l,a.c,a.h,a.alpha];case"oklab":return[a.l,a.a,a.b,a.alpha];case"oklch":return[a.l,a.c,a.h,a.alpha]}},o=(a,l)=>{switch(a.space){case"rgb":{const r={...a,...l};return e.rgba(r.r,r.g,r.b,r.alpha)}case"rgb8":{const r={...a,...l};return e.rgb8a(r.r,r.g,r.b,r.alpha)}case"hsl":{const r={...a,...l};return e.hsla(r.h,r.s,r.l,r.alpha)}case"hsv":{const r={...a,...l};return e.hsva(r.h,r.s,r.v,r.alpha)}case"hwb":{const r={...a,...l};return e.hwba(r.h,r.w,r.b,r.alpha)}case"lab":{const r={...a,...l};return e.laba(r.l,r.a,r.b,r.alpha)}case"lch":{const r={...a,...l};return e.lcha(r.l,r.c,r.h,r.alpha)}case"oklab":{const r={...a,...l};return e.oklaba(r.l,r.a,r.b,r.alpha)}case"oklch":{const r={...a,...l};return e.oklcha(r.l,r.c,r.h,r.alpha)}}},p=(a,l)=>({...a,alpha:s.clamp(l,0,1)}),b=a=>a.alpha>=1,u=a=>a.alpha<=0;exports.getChannel=t;exports.getChannels=h;exports.getChannelsAsArray=n;exports.isOpaque=b;exports.isTransparent=u;exports.withAlpha=p;exports.withColor=o;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Color } from './color';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the channel names of a color type, excluding the `space`
|
|
4
|
+
* discriminant.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type ChannelOf<C extends Color> = Exclude<keyof C, 'space'>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the value of a single channel from a color.
|
|
11
|
+
*
|
|
12
|
+
* The `channel` parameter is type-safe — only channels that exist on the
|
|
13
|
+
* specific color type are accepted.
|
|
14
|
+
*
|
|
15
|
+
* @param c - The color to read from.
|
|
16
|
+
* @param channel - The channel name.
|
|
17
|
+
* @returns The channel value.
|
|
18
|
+
* @public
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* getChannel(rgb8a(255, 0, 0), 'r') // 255
|
|
22
|
+
* getChannel(hsla(120, 50, 75), 'h') // 120
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const getChannel: <C extends Color>(c: C, channel: ChannelOf<C>) => number;
|
|
26
|
+
/**
|
|
27
|
+
* Returns all channels of a color as a plain object, excluding the `space`
|
|
28
|
+
* discriminant.
|
|
29
|
+
*
|
|
30
|
+
* @param c - The color to extract channels from.
|
|
31
|
+
* @returns An object mapping channel names to values.
|
|
32
|
+
* @public
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* getChannels(rgb8a(255, 0, 0))
|
|
36
|
+
* // { r: 255, g: 0, b: 0, alpha: 1 }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const getChannels: <C extends Color>(c: C) => Omit<C, "space">;
|
|
40
|
+
/**
|
|
41
|
+
* Returns all channel values of a color as a number array.
|
|
42
|
+
*
|
|
43
|
+
* The order is consistent per color space: color-specific channels first,
|
|
44
|
+
* then alpha. For example, RGB8 returns `[r, g, b, alpha]`, HSL returns
|
|
45
|
+
* `[h, s, l, alpha]`.
|
|
46
|
+
*
|
|
47
|
+
* @param c - The color to extract values from.
|
|
48
|
+
* @returns An array of channel values.
|
|
49
|
+
* @public
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* getChannelsAsArray(rgb8a(255, 0, 0)) // [255, 0, 0, 1]
|
|
53
|
+
* getChannelsAsArray(hsla(120, 50, 75, 0.5)) // [120, 50, 75, 0.5]
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const getChannelsAsArray: (c: Color) => number[];
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new color with one or more channels replaced, applying
|
|
59
|
+
* clamping and hue wrapping via the color's constructor.
|
|
60
|
+
*
|
|
61
|
+
* Returns the same color type as the input.
|
|
62
|
+
*
|
|
63
|
+
* @param c - The source color.
|
|
64
|
+
* @param changes - An object with the channels to change.
|
|
65
|
+
* @returns A new color with the changes applied.
|
|
66
|
+
* @public
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* withColor(rgb8a(255, 0, 0), { g: 255 })
|
|
70
|
+
* // rgb8a(255, 255, 0)
|
|
71
|
+
*
|
|
72
|
+
* withColor(hsla(0, 100, 50), { h: 120 })
|
|
73
|
+
* // hsla(120, 100, 50)
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare const withColor: <C extends Color>(c: C, changes: Partial<Omit<C, "space">>) => C;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new color with the alpha channel set to the given value.
|
|
79
|
+
*
|
|
80
|
+
* This is a shortcut for `withColor(c, { alpha })`.
|
|
81
|
+
*
|
|
82
|
+
* @param c - The source color.
|
|
83
|
+
* @param alpha - The new alpha value (0–1).
|
|
84
|
+
* @returns A new color with the updated alpha.
|
|
85
|
+
* @public
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* withAlpha(rgb8a(255, 0, 0), 0.5) // rgb8a(255, 0, 0, 0.5)
|
|
89
|
+
* withAlpha(hsla(120, 100, 50), 0) // hsla(120, 100, 50, 0)
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare const withAlpha: <C extends Color>(c: C, alpha: number) => C;
|
|
93
|
+
/**
|
|
94
|
+
* Returns `true` if the color is fully opaque (alpha >= 1).
|
|
95
|
+
*
|
|
96
|
+
* @param c - The color to check.
|
|
97
|
+
* @returns `true` if opaque.
|
|
98
|
+
* @public
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* isOpaque(rgb8a(255, 0, 0)) // true
|
|
102
|
+
* isOpaque(rgb8a(255, 0, 0, 0.5)) // false
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare const isOpaque: (c: Color) => boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Returns `true` if the color is fully transparent (alpha <= 0).
|
|
108
|
+
*
|
|
109
|
+
* @param c - The color to check.
|
|
110
|
+
* @returns `true` if transparent.
|
|
111
|
+
* @public
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* isTransparent(rgb8a(255, 0, 0, 0)) // true
|
|
115
|
+
* isTransparent(rgb8a(255, 0, 0, 0.5)) // false
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export declare const isTransparent: (c: Color) => boolean;
|
package/color-channel.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { clamp as l } from "./number.js";
|
|
2
|
+
import { R as h, O as t, L as e, I as n, w as o, s as p, o as b, a4 as u, af as m } from "./color-SZxckS9U.js";
|
|
3
|
+
const k = (a, r) => a[r], g = (a) => {
|
|
4
|
+
const { space: r, ...s } = a;
|
|
5
|
+
return s;
|
|
6
|
+
}, v = (a) => {
|
|
7
|
+
switch (a.space) {
|
|
8
|
+
case "rgb":
|
|
9
|
+
return [a.r, a.g, a.b, a.alpha];
|
|
10
|
+
case "rgb8":
|
|
11
|
+
return [a.r, a.g, a.b, a.alpha];
|
|
12
|
+
case "hsl":
|
|
13
|
+
return [a.h, a.s, a.l, a.alpha];
|
|
14
|
+
case "hsv":
|
|
15
|
+
return [a.h, a.s, a.v, a.alpha];
|
|
16
|
+
case "hwb":
|
|
17
|
+
return [a.h, a.w, a.b, a.alpha];
|
|
18
|
+
case "lab":
|
|
19
|
+
return [a.l, a.a, a.b, a.alpha];
|
|
20
|
+
case "lch":
|
|
21
|
+
return [a.l, a.c, a.h, a.alpha];
|
|
22
|
+
case "oklab":
|
|
23
|
+
return [a.l, a.a, a.b, a.alpha];
|
|
24
|
+
case "oklch":
|
|
25
|
+
return [a.l, a.c, a.h, a.alpha];
|
|
26
|
+
}
|
|
27
|
+
}, C = (a, r) => {
|
|
28
|
+
switch (a.space) {
|
|
29
|
+
case "rgb": {
|
|
30
|
+
const s = { ...a, ...r };
|
|
31
|
+
return m(s.r, s.g, s.b, s.alpha);
|
|
32
|
+
}
|
|
33
|
+
case "rgb8": {
|
|
34
|
+
const s = { ...a, ...r };
|
|
35
|
+
return u(s.r, s.g, s.b, s.alpha);
|
|
36
|
+
}
|
|
37
|
+
case "hsl": {
|
|
38
|
+
const s = { ...a, ...r };
|
|
39
|
+
return b(s.h, s.s, s.l, s.alpha);
|
|
40
|
+
}
|
|
41
|
+
case "hsv": {
|
|
42
|
+
const s = { ...a, ...r };
|
|
43
|
+
return p(s.h, s.s, s.v, s.alpha);
|
|
44
|
+
}
|
|
45
|
+
case "hwb": {
|
|
46
|
+
const s = { ...a, ...r };
|
|
47
|
+
return o(s.h, s.w, s.b, s.alpha);
|
|
48
|
+
}
|
|
49
|
+
case "lab": {
|
|
50
|
+
const s = { ...a, ...r };
|
|
51
|
+
return n(s.l, s.a, s.b, s.alpha);
|
|
52
|
+
}
|
|
53
|
+
case "lch": {
|
|
54
|
+
const s = { ...a, ...r };
|
|
55
|
+
return e(s.l, s.c, s.h, s.alpha);
|
|
56
|
+
}
|
|
57
|
+
case "oklab": {
|
|
58
|
+
const s = { ...a, ...r };
|
|
59
|
+
return t(s.l, s.a, s.b, s.alpha);
|
|
60
|
+
}
|
|
61
|
+
case "oklch": {
|
|
62
|
+
const s = { ...a, ...r };
|
|
63
|
+
return h(s.l, s.c, s.h, s.alpha);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, f = (a, r) => ({ ...a, alpha: l(r, 0, 1) }), A = (a) => a.alpha >= 1, O = (a) => a.alpha <= 0;
|
|
67
|
+
export {
|
|
68
|
+
k as getChannel,
|
|
69
|
+
g as getChannels,
|
|
70
|
+
v as getChannelsAsArray,
|
|
71
|
+
A as isOpaque,
|
|
72
|
+
O as isTransparent,
|
|
73
|
+
f as withAlpha,
|
|
74
|
+
C as withColor
|
|
75
|
+
};
|
package/color-gamut.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./color-D7FAmkht.cjs"),e=o=>o<=.0031308?o*12.92:1.055*Math.pow(o,1/2.4)-.055,i=(o,t,n)=>[3.2404542*o-1.5371385*t-.4985314*n,-.969266*o+1.8760108*t+.041556*n,.0556434*o-.2040259*t+1.0572252*n],k=.95047,d=1,f=1.08883,T=6/29,M=3*T**2,p=(o,t,n)=>{const r=c=>c>T?c**3:M*(c-.13793103448275862),l=(o+16)/116,s=t/500+l,a=l-n/200;return[k*r(s),d*r(l),f*r(a)]},m=(o,t,n)=>{const r=o+.3963377774*t+.2158037573*n,l=o-.1055613458*t-.0638541728*n,s=o-.0894841775*t-1.291485548*n,a=r*r*r,c=l*l*l,h=s*s*s;return[4.0767416621*a-3.3077115913*c+.2309699292*h,-1.2684380046*a+2.6097574011*c-.3413193965*h,-.0041960863*a-.7034186147*c+1.707614701*h]},_=(o,t,n)=>{const r=n*Math.PI/180;return[o,t*Math.cos(r),t*Math.sin(r)]},G=(o,t,n)=>{const r=n*Math.PI/180;return[o,t*Math.cos(r),t*Math.sin(r)]},S=o=>{switch(o.space){case"rgb":return[o.r,o.g,o.b,o.alpha];case"rgb8":return[o.r/255,o.g/255,o.b/255,o.alpha];case"oklab":{const[t,n,r]=m(o.l,o.a,o.b);return[e(t),e(n),e(r),o.alpha]}case"oklch":{const[t,n,r]=_(o.l,o.c,o.h),[l,s,a]=m(t,n,r);return[e(l),e(s),e(a),o.alpha]}case"lab":{const[t,n,r]=p(o.l,o.a,o.b),[l,s,a]=i(t,n,r);return[e(l),e(s),e(a),o.alpha]}case"lch":{const[t,n,r]=G(o.l,o.c,o.h),[l,s,a]=p(t,n,r),[c,h,g]=i(l,s,a);return[e(c),e(h),e(g),o.alpha]}default:{const t=b.convertColor(o,"rgb8");return[t.r/255,t.g/255,t.b/255,t.alpha]}}},u=(o,t=.002)=>{const[n,r,l]=S(o);return n>=-t&&n<=1+t&&r>=-t&&r<=1+t&&l>=-t&&l<=1+t},v=o=>{if(u(o))return o;const t=o.space,n=b.convertColor(o,"rgb8"),r=b.rgb8a(n.r,n.g,n.b,n.alpha);return b.convertColor(r,t)},y=o=>{if(u(o))return o;const t=o.space,n=b.convertColor(o,"oklch");let r=0,l=n.c;const s=1e-4;for(let c=0;c<50&&l-r>s;c++){const h=(r+l)/2,g=b.oklcha(n.l,h,n.h,n.alpha);u(g)?r=h:l=h}const a=b.oklcha(n.l,r,n.h,n.alpha);return b.convertColor(a,t)};exports.clampToGamut=v;exports.clampToGamutOklch=y;exports.isInGamut=u;
|
package/color-gamut.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Color } from './color';
|
|
2
|
+
/**
|
|
3
|
+
* Tests whether a color is within the sRGB gamut.
|
|
4
|
+
*
|
|
5
|
+
* Colors in HSL, HSV, HWB, RGB, and RGB8 spaces are always in gamut by
|
|
6
|
+
* definition. Colors in LAB, LCH, OKLAB, and OKLCH may fall outside sRGB
|
|
7
|
+
* if their chroma is too high.
|
|
8
|
+
*
|
|
9
|
+
* @param c - The color to test.
|
|
10
|
+
* @param tolerance - How far outside 0–1 is still considered in-gamut.
|
|
11
|
+
* Defaults to 0.002 to account for floating-point imprecision.
|
|
12
|
+
* @returns `true` if the color is representable in sRGB.
|
|
13
|
+
* @public
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* isInGamut(rgb8a(255, 0, 0)) // true
|
|
17
|
+
* isInGamut(oklcha(0.5, 0.4, 150)) // likely false (very high chroma)
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const isInGamut: (c: Color, tolerance?: number) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Clamps a color to the sRGB gamut by clamping RGB channel values.
|
|
23
|
+
*
|
|
24
|
+
* If the color is already in gamut, it is returned unchanged. Otherwise,
|
|
25
|
+
* it is converted to RGB8 (which clamps channels to 0–255) and converted
|
|
26
|
+
* back to the original color space.
|
|
27
|
+
*
|
|
28
|
+
* For perceptually better results on wide-gamut colors, use
|
|
29
|
+
* {@link clampToGamutOklch} which preserves lightness and hue.
|
|
30
|
+
*
|
|
31
|
+
* @param c - The color to clamp.
|
|
32
|
+
* @returns A color within the sRGB gamut in the original color space.
|
|
33
|
+
* @public
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* clampToGamut(rgb8a(255, 0, 0)) // unchanged
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const clampToGamut: (c: Color) => Color;
|
|
40
|
+
/**
|
|
41
|
+
* Clamps a color to the sRGB gamut by reducing chroma in OKLCH space
|
|
42
|
+
* while preserving lightness and hue.
|
|
43
|
+
*
|
|
44
|
+
* This produces more perceptually pleasing results than simple RGB
|
|
45
|
+
* clamping, as it finds the most saturated version of the color that
|
|
46
|
+
* still fits within sRGB.
|
|
47
|
+
*
|
|
48
|
+
* Uses binary search to find the maximum in-gamut chroma.
|
|
49
|
+
*
|
|
50
|
+
* @param c - The color to clamp.
|
|
51
|
+
* @returns A color within the sRGB gamut in the original color space.
|
|
52
|
+
* @public
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* clampToGamutOklch(oklcha(0.5, 0.4, 150))
|
|
56
|
+
* // Same lightness and hue, reduced chroma to fit sRGB
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare const clampToGamutOklch: (c: Color) => Color;
|
package/color-gamut.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { m as b, a4 as k, R as u } from "./color-SZxckS9U.js";
|
|
2
|
+
const e = (t) => t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055, i = (t, o, n) => [
|
|
3
|
+
3.2404542 * t - 1.5371385 * o - 0.4985314 * n,
|
|
4
|
+
-0.969266 * t + 1.8760108 * o + 0.041556 * n,
|
|
5
|
+
0.0556434 * t - 0.2040259 * o + 1.0572252 * n
|
|
6
|
+
], d = 0.95047, _ = 1, M = 1.08883, T = 6 / 29, D = 3 * T ** 2, m = (t, o, n) => {
|
|
7
|
+
const s = (c) => c > T ? c ** 3 : D * (c - 0.13793103448275862), a = (t + 16) / 116, r = o / 500 + a, l = a - n / 200;
|
|
8
|
+
return [d * s(r), _ * s(a), M * s(l)];
|
|
9
|
+
}, f = (t, o, n) => {
|
|
10
|
+
const s = t + 0.3963377774 * o + 0.2158037573 * n, a = t - 0.1055613458 * o - 0.0638541728 * n, r = t - 0.0894841775 * o - 1.291485548 * n, l = s * s * s, c = a * a * a, h = r * r * r;
|
|
11
|
+
return [
|
|
12
|
+
4.0767416621 * l - 3.3077115913 * c + 0.2309699292 * h,
|
|
13
|
+
-1.2684380046 * l + 2.6097574011 * c - 0.3413193965 * h,
|
|
14
|
+
-0.0041960863 * l - 0.7034186147 * c + 1.707614701 * h
|
|
15
|
+
];
|
|
16
|
+
}, I = (t, o, n) => {
|
|
17
|
+
const s = n * Math.PI / 180;
|
|
18
|
+
return [t, o * Math.cos(s), o * Math.sin(s)];
|
|
19
|
+
}, S = (t, o, n) => {
|
|
20
|
+
const s = n * Math.PI / 180;
|
|
21
|
+
return [t, o * Math.cos(s), o * Math.sin(s)];
|
|
22
|
+
}, x = (t) => {
|
|
23
|
+
switch (t.space) {
|
|
24
|
+
case "rgb":
|
|
25
|
+
return [t.r, t.g, t.b, t.alpha];
|
|
26
|
+
case "rgb8":
|
|
27
|
+
return [t.r / 255, t.g / 255, t.b / 255, t.alpha];
|
|
28
|
+
case "oklab": {
|
|
29
|
+
const [o, n, s] = f(t.l, t.a, t.b);
|
|
30
|
+
return [e(o), e(n), e(s), t.alpha];
|
|
31
|
+
}
|
|
32
|
+
case "oklch": {
|
|
33
|
+
const [o, n, s] = I(t.l, t.c, t.h), [a, r, l] = f(o, n, s);
|
|
34
|
+
return [e(a), e(r), e(l), t.alpha];
|
|
35
|
+
}
|
|
36
|
+
case "lab": {
|
|
37
|
+
const [o, n, s] = m(t.l, t.a, t.b), [a, r, l] = i(o, n, s);
|
|
38
|
+
return [e(a), e(r), e(l), t.alpha];
|
|
39
|
+
}
|
|
40
|
+
case "lch": {
|
|
41
|
+
const [o, n, s] = S(t.l, t.c, t.h), [a, r, l] = m(o, n, s), [c, h, g] = i(a, r, l);
|
|
42
|
+
return [e(c), e(h), e(g), t.alpha];
|
|
43
|
+
}
|
|
44
|
+
default: {
|
|
45
|
+
const o = b(t, "rgb8");
|
|
46
|
+
return [o.r / 255, o.g / 255, o.b / 255, o.alpha];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, p = (t, o = 2e-3) => {
|
|
50
|
+
const [n, s, a] = x(t);
|
|
51
|
+
return n >= -o && n <= 1 + o && s >= -o && s <= 1 + o && a >= -o && a <= 1 + o;
|
|
52
|
+
}, z = (t) => {
|
|
53
|
+
if (p(t)) return t;
|
|
54
|
+
const o = t.space, n = b(t, "rgb8"), s = k(n.r, n.g, n.b, n.alpha);
|
|
55
|
+
return b(s, o);
|
|
56
|
+
}, G = (t) => {
|
|
57
|
+
if (p(t)) return t;
|
|
58
|
+
const o = t.space, n = b(t, "oklch");
|
|
59
|
+
let s = 0, a = n.c;
|
|
60
|
+
const r = 1e-4;
|
|
61
|
+
for (let c = 0; c < 50 && a - s > r; c++) {
|
|
62
|
+
const h = (s + a) / 2, g = u(n.l, h, n.h, n.alpha);
|
|
63
|
+
p(g) ? s = h : a = h;
|
|
64
|
+
}
|
|
65
|
+
const l = u(n.l, s, n.h, n.alpha);
|
|
66
|
+
return b(l, o);
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
z as clampToGamut,
|
|
70
|
+
G as clampToGamutOklch,
|
|
71
|
+
p as isInGamut
|
|
72
|
+
};
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./array.cjs"),v=require("./async-result.cjs"),i=require("./bigint.cjs"),u=require("./boolean.cjs"),a=require("./color-D7FAmkht.cjs"),H=require("./color-named.cjs"),g=require("./color-adjust.cjs"),S=require("./color-contrast.cjs"),A=require("./color-distance.cjs"),y=require("./color-harmony.cjs"),T=require("./color-mix.cjs"),C=require("./color-utils.cjs"),t=require("./date.cjs"),P=require("./deferred.cjs"),f=require("./equal.cjs"),b=require("./function.cjs"),c=require("./iterator.cjs"),h=require("./json.cjs"),m=require("./map.cjs"),s=require("./number.cjs"),o=require("./object.cjs"),k=require("./promise.cjs"),p=require("./random.cjs"),I=require("./regexp.cjs"),O=require("./result-DBJ3htTg.cjs"),n=require("./set.cjs"),e=require("./string.cjs"),d=require("./timer.cjs"),l=require("./url.cjs");exports.applyArrayDiffOperations=r.applyArrayDiffOperations;exports.areArraysEqual=r.areArraysEqual;exports.arrayDiffOperations=r.arrayDiffOperations;exports.arrayHasValues=r.arrayHasValues;exports.arrayHead=r.arrayHead;exports.arrayTail=r.arrayTail;exports.buildArray=r.buildArray;exports.chunk=r.chunk;exports.compareArrays=r.compareArrays;exports.fillArray=r.fillArray;exports.filterMapArray=r.filterMapArray;exports.filterNullsFromArray=r.filterNullsFromArray;exports.groupBy=r.groupBy;exports.isArrayEmpty=r.isArrayEmpty;exports.joinArrayWithConjunction=r.joinArrayWithConjunction;exports.partition=r.partition;exports.range=r.range;exports.rankArray=r.rankArray;exports.removeAllFromArray=r.removeAllFromArray;exports.removeAllFromArrayByPredicate=r.removeAllFromArrayByPredicate;exports.removeOneFromArray=r.removeOneFromArray;exports.removeOneFromArrayByPredicate=r.removeOneFromArrayByPredicate;exports.uniqueByPrimitive=r.uniqueByPrimitive;exports.AsyncResult=v.AsyncResult;exports.biAbs=i.biAbs;exports.biCeilDiv=i.biCeilDiv;exports.biCompare=i.biCompare;exports.biFloorDiv=i.biFloorDiv;exports.biGcd=i.biGcd;exports.biIsEven=i.biIsEven;exports.biIsNegative=i.biIsNegative;exports.biIsOdd=i.biIsOdd;exports.biIsOne=i.biIsOne;exports.biIsPositive=i.biIsPositive;exports.biIsPrime=i.biIsPrime;exports.biIsZero=i.biIsZero;exports.biLcm=i.biLcm;exports.biMax=i.biMax;exports.biMin=i.biMin;exports.biNextPrime=i.biNextPrime;exports.biPow=i.biPow;exports.biPrevPrime=i.biPrevPrime;exports.booleanToInt=u.booleanToInt;exports.canParseBoolean=u.canParseBoolean;exports.compareBooleans=u.compareBooleans;exports.parseBoolean=u.parseBoolean;exports.xorBoolean=u.xorBoolean;exports.canParseColor=a.canParseColor;exports.canParseHex=a.canParseHex;exports.canParseHsl=a.canParseHsl;exports.canParseHsv=a.canParseHsv;exports.canParseHwb=a.canParseHwb;exports.canParseLab=a.canParseLab;exports.canParseLch=a.canParseLch;exports.canParseNamedColor=a.canParseNamedColor;exports.canParseOklab=a.canParseOklab;exports.canParseOklch=a.canParseOklch;exports.canParseRgb=a.canParseRgb;exports.colorToString=a.colorToString;exports.convertColor=a.convertColor;exports.detectColorSpace=a.detectColorSpace;exports.hsla=a.hsla;exports.hslaToHslString=a.hslaToHslString;exports.hslaToHsva=a.hslaToHsva;exports.hslaToRgb8a=a.hslaToRgb8a;exports.hsva=a.hsva;exports.hsvaToHsla=a.hsvaToHsla;exports.hsvaToHsvString=a.hsvaToHsvString;exports.hsvaToRgb8a=a.hsvaToRgb8a;exports.hwba=a.hwba;exports.hwbaToHwbString=a.hwbaToHwbString;exports.hwbaToRgb8a=a.hwbaToRgb8a;exports.isHsla=a.isHsla;exports.isHsva=a.isHsva;exports.isHwba=a.isHwba;exports.isLaba=a.isLaba;exports.isLcha=a.isLcha;exports.isOklaba=a.isOklaba;exports.isOklcha=a.isOklcha;exports.isRgb8a=a.isRgb8a;exports.isRgba=a.isRgba;exports.laba=a.laba;exports.labaToLabString=a.labaToLabString;exports.labaToRgb8a=a.labaToRgb8a;exports.lcha=a.lcha;exports.lchaToLchString=a.lchaToLchString;exports.lchaToRgb8a=a.lchaToRgb8a;exports.oklaba=a.oklaba;exports.oklabaToOklabString=a.oklabaToOklabString;exports.oklabaToRgb8a=a.oklabaToRgb8a;exports.oklcha=a.oklcha;exports.oklchaToOklchString=a.oklchaToOklchString;exports.oklchaToRgb8a=a.oklchaToRgb8a;exports.parseAlpha=a.parseAlpha;exports.parseColor=a.parseColor;exports.parseHex=a.parseHex;exports.parseHsl=a.parseHsl;exports.parseHsv=a.parseHsv;exports.parseHwb=a.parseHwb;exports.parseLab=a.parseLab;exports.parseLch=a.parseLch;exports.parseNamedColor=a.parseNamedColor;exports.parseOklab=a.parseOklab;exports.parseOklch=a.parseOklch;exports.parseRgb=a.parseRgb;exports.rgb8a=a.rgb8a;exports.rgb8aToHexString=a.rgb8aToHexString;exports.rgb8aToHsla=a.rgb8aToHsla;exports.rgb8aToHsva=a.rgb8aToHsva;exports.rgb8aToHwba=a.rgb8aToHwba;exports.rgb8aToLaba=a.rgb8aToLaba;exports.rgb8aToLcha=a.rgb8aToLcha;exports.rgb8aToOklaba=a.rgb8aToOklaba;exports.rgb8aToOklcha=a.rgb8aToOklcha;exports.rgb8aToRgbString=a.rgb8aToRgbString;exports.rgb8aToRgba=a.rgb8aToRgba;exports.rgba=a.rgba;exports.rgbaToRgb8a=a.rgbaToRgb8a;exports.NAMED_COLORS=H.NAMED_COLORS;exports.darken=g.darken;exports.desaturate=g.desaturate;exports.grayscale=g.grayscale;exports.invert=g.invert;exports.lighten=g.lighten;exports.opacify=g.opacify;exports.saturate=g.saturate;exports.transparentize=g.transparentize;exports.contrastColor=S.contrastColor;exports.contrastRatio=S.contrastRatio;exports.luminance=S.luminance;exports.meetsContrast=S.meetsContrast;exports.colorDistance=A.colorDistance;exports.colorDistanceSimple=A.colorDistanceSimple;exports.analogous=y.analogous;exports.complement=y.complement;exports.splitComplementary=y.splitComplementary;exports.tetradic=y.tetradic;exports.triadic=y.triadic;exports.interpolateColors=T.interpolateColors;exports.mixColors=T.mixColors;exports.closestNamedColor=C.closestNamedColor;exports.equalColors=C.equalColors;exports.randomColor=C.randomColor;exports.addDays=t.addDays;exports.addHours=t.addHours;exports.addMinutes=t.addMinutes;exports.compareDates=t.compareDates;exports.diffInDays=t.diffInDays;exports.diffInHours=t.diffInHours;exports.endOfDay=t.endOfDay;exports.endOfWeek=t.endOfWeek;exports.isSameDay=t.isSameDay;exports.isSameHour=t.isSameHour;exports.isSameMinute=t.isSameMinute;exports.isSameMonth=t.isSameMonth;exports.isSameSecond=t.isSameSecond;exports.isSameWeek=t.isSameWeek;exports.isSameYear=t.isSameYear;exports.isValidDate=t.isValidDate;exports.isWeekend=t.isWeekend;exports.startOfDay=t.startOfDay;exports.startOfWeek=t.startOfWeek;exports.deferred=P.deferred;exports.deepEqual=f.deepEqual;exports.looseEqual=f.looseEqual;exports.strictEqual=f.strictEqual;exports.compose=b.compose;exports.curryLeft=b.curryLeft;exports.flip=b.flip;exports.identity=b.identity;exports.memoize=b.memoize;exports.negate=b.negate;exports.once=b.once;exports.partial=b.partial;exports.pipe=b.pipe;exports.chain=c.chain;exports.every=c.every;exports.filter=c.filter;exports.find=c.find;exports.map=c.map;exports.reduce=c.reduce;exports.skip=c.skip;exports.some=c.some;exports.take=c.take;exports.toArray=c.toArray;exports.isJSON=h.isJSON;exports.isJSONArray=h.isJSONArray;exports.isJSONObject=h.isJSONObject;exports.isJSONPrimitive=h.isJSONPrimitive;exports.parseJSON=h.parseJSON;exports.mapEntries=m.mapEntries;exports.mapFilter=m.mapFilter;exports.mapFromEntries=m.mapFromEntries;exports.mapGroupBy=m.mapGroupBy;exports.mapIsEmpty=m.mapIsEmpty;exports.mapKeys=m.mapKeys;exports.mapMap=m.mapMap;exports.mapMerge=m.mapMerge;exports.mapToObject=m.mapToObject;exports.mapValues=m.mapValues;exports.EPSILON=s.EPSILON;exports.angleDifference=s.angleDifference;exports.ceilTo=s.ceilTo;exports.clamp=s.clamp;exports.clampInt=s.clampInt;exports.clampSym=s.clampSym;exports.compareNumbers=s.compareNumbers;exports.floorTo=s.floorTo;exports.interpolate=s.interpolate;exports.interpolateAngle=s.interpolateAngle;exports.interpolateAngleCCW=s.interpolateAngleCCW;exports.interpolateAngleCW=s.interpolateAngleCW;exports.interpolateWidestAngle=s.interpolateWidestAngle;exports.nearEqual=s.nearEqual;exports.nearEqualAngles=s.nearEqualAngles;exports.nearZero=s.nearZero;exports.root=s.root;exports.roundTo=s.roundTo;exports.snapToGrid=s.snapToGrid;exports.toHex=s.toHex;exports.widestAngleDifference=s.widestAngleDifference;exports.wrap=s.wrap;exports.wrapCircular=s.wrapCircular;exports.deepClone=o.deepClone;exports.isEmptyObject=o.isEmptyObject;exports.isObject=o.isObject;exports.mergeObjects=o.mergeObjects;exports.objectEntries=o.objectEntries;exports.objectFromEntries=o.objectFromEntries;exports.objectKeys=o.objectKeys;exports.objectValues=o.objectValues;exports.omit=o.omit;exports.pick=o.pick;exports.removeObjectFields=o.removeObjectFields;exports.sameObjectKeys=o.sameObjectKeys;exports.sleep=k.sleep;exports.randomBytes=p.randomBytes;exports.randomChoice=p.randomChoice;exports.randomChoices=p.randomChoices;exports.randomFloat=p.randomFloat;exports.randomHex=p.randomHex;exports.randomInt=p.randomInt;exports.randomUuid=p.randomUuid;exports.seedRandom=p.seedRandom;exports.shuffle=p.shuffle;exports.shuffled=p.shuffled;exports.mapRegExp=I.mapRegExp;exports.Result=O.Result;exports.Validation=O.Validation;exports.setDifference=n.setDifference;exports.setFilter=n.setFilter;exports.setFromArray=n.setFromArray;exports.setIntersection=n.setIntersection;exports.setIsEmpty=n.setIsEmpty;exports.setIsSubset=n.setIsSubset;exports.setIsSuperset=n.setIsSuperset;exports.setMap=n.setMap;exports.setSymmetricDifference=n.setSymmetricDifference;exports.setToArray=n.setToArray;exports.setUnion=n.setUnion;exports.canonicalizeNewlines=e.canonicalizeNewlines;exports.capitalize=e.capitalize;exports.capitalizeWords=e.capitalizeWords;exports.chunkString=e.chunkString;exports.collapseText=e.collapseText;exports.compareCaseInsensitive=e.compareCaseInsensitive;exports.compareStrings=e.compareStrings;exports.containsAllText=e.containsAllText;exports.containsAllTextCaseInsensitive=e.containsAllTextCaseInsensitive;exports.containsAnyText=e.containsAnyText;exports.containsAnyTextCaseInsensitive=e.containsAnyTextCaseInsensitive;exports.countStringOccurrences=e.countStringOccurrences;exports.dasherize=e.dasherize;exports.decodeBase64=e.decodeBase64;exports.deleteFirstFromString=e.deleteFirstFromString;exports.deleteStringAfter=e.deleteStringAfter;exports.deleteStringBefore=e.deleteStringBefore;exports.deleteSubstring=e.deleteSubstring;exports.ellipsis=e.ellipsis;exports.ellipsisMiddle=e.ellipsisMiddle;exports.encodeBase64=e.encodeBase64;exports.filterCharcodes=e.filterCharcodes;exports.filterChars=e.filterChars;exports.humanize=e.humanize;exports.ifEmptyString=e.ifEmptyString;exports.isAlpha=e.isAlpha;exports.isAlphaNum=e.isAlphaNum;exports.isBreakingWhitespace=e.isBreakingWhitespace;exports.isDigitsOnly=e.isDigitsOnly;exports.isEmptyString=e.isEmptyString;exports.isLowerCase=e.isLowerCase;exports.isSpaceAt=e.isSpaceAt;exports.isUpperCase=e.isUpperCase;exports.jsQuote=e.jsQuote;exports.lowerCaseFirst=e.lowerCaseFirst;exports.lpad=e.lpad;exports.mapChars=e.mapChars;exports.quote=e.quote;exports.randomStringSequence=e.randomStringSequence;exports.randomStringSequenceBase64=e.randomStringSequenceBase64;exports.randomSubString=e.randomSubString;exports.reverseString=e.reverseString;exports.rpad=e.rpad;exports.smartQuote=e.smartQuote;exports.splitStringOnFirst=e.splitStringOnFirst;exports.splitStringOnLast=e.splitStringOnLast;exports.splitStringOnce=e.splitStringOnce;exports.stringEndsWithAny=e.stringEndsWithAny;exports.stringHasContent=e.stringHasContent;exports.stringHashCode=e.stringHashCode;exports.stringStartsWithAny=e.stringStartsWithAny;exports.stringToCharcodes=e.stringToCharcodes;exports.stringsDifferAtIndex=e.stringsDifferAtIndex;exports.substringAfter=e.substringAfter;exports.substringAfterLast=e.substringAfterLast;exports.substringBefore=e.substringBefore;exports.substringBeforeLast=e.substringBeforeLast;exports.surroundString=e.surroundString;exports.textContainsCaseInsensitive=e.textContainsCaseInsensitive;exports.textEndsWithAnyCaseInsensitive=e.textEndsWithAnyCaseInsensitive;exports.textEndsWithCaseInsensitive=e.textEndsWithCaseInsensitive;exports.textStartsWithAnyCaseInsensitive=e.textStartsWithAnyCaseInsensitive;exports.textStartsWithCaseInsensitive=e.textStartsWithCaseInsensitive;exports.textToLines=e.textToLines;exports.trimChars=e.trimChars;exports.trimCharsLeft=e.trimCharsLeft;exports.trimCharsRight=e.trimCharsRight;exports.trimStringSlice=e.trimStringSlice;exports.underscore=e.underscore;exports.upperCaseFirst=e.upperCaseFirst;exports.wrapColumns=e.wrapColumns;exports.wrapLine=e.wrapLine;exports.debounce=d.debounce;exports.delayed=d.delayed;exports.delayedAnimationFrame=d.delayedAnimationFrame;exports.interval=d.interval;exports.intervalAnimationFrame=d.intervalAnimationFrame;exports.throttle=d.throttle;exports.buildUrl=l.buildUrl;exports.getBaseName=l.getBaseName;exports.getFileExtension=l.getFileExtension;exports.getFileName=l.getFileName;exports.getQueryParams=l.getQueryParams;exports.isValidUrl=l.isValidUrl;exports.joinPaths=l.joinPaths;exports.normalizePath=l.normalizePath;exports.parseUrl=l.parseUrl;exports.removeQueryParam=l.removeQueryParam;exports.setQueryParam=l.setQueryParam;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./array.cjs"),k=require("./async-result.cjs"),i=require("./bigint.cjs"),h=require("./boolean.cjs"),a=require("./color-D7FAmkht.cjs"),P=require("./color-named.cjs"),g=require("./color-adjust.cjs"),d=require("./color-channel.cjs"),C=require("./color-contrast.cjs"),O=require("./color-distance.cjs"),A=require("./color-gamut.cjs"),y=require("./color-harmony.cjs"),v=require("./color-mix.cjs"),f=require("./color-utils.cjs"),t=require("./date.cjs"),q=require("./deferred.cjs"),T=require("./equal.cjs"),b=require("./function.cjs"),c=require("./iterator.cjs"),S=require("./json.cjs"),m=require("./map.cjs"),s=require("./number.cjs"),n=require("./object.cjs"),I=require("./promise.cjs"),p=require("./random.cjs"),x=require("./regexp.cjs"),H=require("./result-DBJ3htTg.cjs"),o=require("./set.cjs"),e=require("./string.cjs"),u=require("./timer.cjs"),l=require("./url.cjs");exports.applyArrayDiffOperations=r.applyArrayDiffOperations;exports.areArraysEqual=r.areArraysEqual;exports.arrayDiffOperations=r.arrayDiffOperations;exports.arrayHasValues=r.arrayHasValues;exports.arrayHead=r.arrayHead;exports.arrayTail=r.arrayTail;exports.buildArray=r.buildArray;exports.chunk=r.chunk;exports.compareArrays=r.compareArrays;exports.fillArray=r.fillArray;exports.filterMapArray=r.filterMapArray;exports.filterNullsFromArray=r.filterNullsFromArray;exports.groupBy=r.groupBy;exports.isArrayEmpty=r.isArrayEmpty;exports.joinArrayWithConjunction=r.joinArrayWithConjunction;exports.partition=r.partition;exports.range=r.range;exports.rankArray=r.rankArray;exports.removeAllFromArray=r.removeAllFromArray;exports.removeAllFromArrayByPredicate=r.removeAllFromArrayByPredicate;exports.removeOneFromArray=r.removeOneFromArray;exports.removeOneFromArrayByPredicate=r.removeOneFromArrayByPredicate;exports.uniqueByPrimitive=r.uniqueByPrimitive;exports.AsyncResult=k.AsyncResult;exports.biAbs=i.biAbs;exports.biCeilDiv=i.biCeilDiv;exports.biCompare=i.biCompare;exports.biFloorDiv=i.biFloorDiv;exports.biGcd=i.biGcd;exports.biIsEven=i.biIsEven;exports.biIsNegative=i.biIsNegative;exports.biIsOdd=i.biIsOdd;exports.biIsOne=i.biIsOne;exports.biIsPositive=i.biIsPositive;exports.biIsPrime=i.biIsPrime;exports.biIsZero=i.biIsZero;exports.biLcm=i.biLcm;exports.biMax=i.biMax;exports.biMin=i.biMin;exports.biNextPrime=i.biNextPrime;exports.biPow=i.biPow;exports.biPrevPrime=i.biPrevPrime;exports.booleanToInt=h.booleanToInt;exports.canParseBoolean=h.canParseBoolean;exports.compareBooleans=h.compareBooleans;exports.parseBoolean=h.parseBoolean;exports.xorBoolean=h.xorBoolean;exports.canParseColor=a.canParseColor;exports.canParseHex=a.canParseHex;exports.canParseHsl=a.canParseHsl;exports.canParseHsv=a.canParseHsv;exports.canParseHwb=a.canParseHwb;exports.canParseLab=a.canParseLab;exports.canParseLch=a.canParseLch;exports.canParseNamedColor=a.canParseNamedColor;exports.canParseOklab=a.canParseOklab;exports.canParseOklch=a.canParseOklch;exports.canParseRgb=a.canParseRgb;exports.colorToString=a.colorToString;exports.convertColor=a.convertColor;exports.detectColorSpace=a.detectColorSpace;exports.hsla=a.hsla;exports.hslaToHslString=a.hslaToHslString;exports.hslaToHsva=a.hslaToHsva;exports.hslaToRgb8a=a.hslaToRgb8a;exports.hsva=a.hsva;exports.hsvaToHsla=a.hsvaToHsla;exports.hsvaToHsvString=a.hsvaToHsvString;exports.hsvaToRgb8a=a.hsvaToRgb8a;exports.hwba=a.hwba;exports.hwbaToHwbString=a.hwbaToHwbString;exports.hwbaToRgb8a=a.hwbaToRgb8a;exports.isHsla=a.isHsla;exports.isHsva=a.isHsva;exports.isHwba=a.isHwba;exports.isLaba=a.isLaba;exports.isLcha=a.isLcha;exports.isOklaba=a.isOklaba;exports.isOklcha=a.isOklcha;exports.isRgb8a=a.isRgb8a;exports.isRgba=a.isRgba;exports.laba=a.laba;exports.labaToLabString=a.labaToLabString;exports.labaToRgb8a=a.labaToRgb8a;exports.lcha=a.lcha;exports.lchaToLchString=a.lchaToLchString;exports.lchaToRgb8a=a.lchaToRgb8a;exports.oklaba=a.oklaba;exports.oklabaToOklabString=a.oklabaToOklabString;exports.oklabaToRgb8a=a.oklabaToRgb8a;exports.oklcha=a.oklcha;exports.oklchaToOklchString=a.oklchaToOklchString;exports.oklchaToRgb8a=a.oklchaToRgb8a;exports.parseAlpha=a.parseAlpha;exports.parseColor=a.parseColor;exports.parseHex=a.parseHex;exports.parseHsl=a.parseHsl;exports.parseHsv=a.parseHsv;exports.parseHwb=a.parseHwb;exports.parseLab=a.parseLab;exports.parseLch=a.parseLch;exports.parseNamedColor=a.parseNamedColor;exports.parseOklab=a.parseOklab;exports.parseOklch=a.parseOklch;exports.parseRgb=a.parseRgb;exports.rgb8a=a.rgb8a;exports.rgb8aToHexString=a.rgb8aToHexString;exports.rgb8aToHsla=a.rgb8aToHsla;exports.rgb8aToHsva=a.rgb8aToHsva;exports.rgb8aToHwba=a.rgb8aToHwba;exports.rgb8aToLaba=a.rgb8aToLaba;exports.rgb8aToLcha=a.rgb8aToLcha;exports.rgb8aToOklaba=a.rgb8aToOklaba;exports.rgb8aToOklcha=a.rgb8aToOklcha;exports.rgb8aToRgbString=a.rgb8aToRgbString;exports.rgb8aToRgba=a.rgb8aToRgba;exports.rgba=a.rgba;exports.rgbaToRgb8a=a.rgbaToRgb8a;exports.NAMED_COLORS=P.NAMED_COLORS;exports.darken=g.darken;exports.desaturate=g.desaturate;exports.grayscale=g.grayscale;exports.invert=g.invert;exports.lighten=g.lighten;exports.opacify=g.opacify;exports.saturate=g.saturate;exports.transparentize=g.transparentize;exports.getChannel=d.getChannel;exports.getChannels=d.getChannels;exports.getChannelsAsArray=d.getChannelsAsArray;exports.isOpaque=d.isOpaque;exports.isTransparent=d.isTransparent;exports.withAlpha=d.withAlpha;exports.withColor=d.withColor;exports.contrastColor=C.contrastColor;exports.contrastRatio=C.contrastRatio;exports.luminance=C.luminance;exports.meetsContrast=C.meetsContrast;exports.colorDistance=O.colorDistance;exports.colorDistanceSimple=O.colorDistanceSimple;exports.clampToGamut=A.clampToGamut;exports.clampToGamutOklch=A.clampToGamutOklch;exports.isInGamut=A.isInGamut;exports.analogous=y.analogous;exports.complement=y.complement;exports.splitComplementary=y.splitComplementary;exports.tetradic=y.tetradic;exports.triadic=y.triadic;exports.interpolateColors=v.interpolateColors;exports.mixColors=v.mixColors;exports.closestNamedColor=f.closestNamedColor;exports.equalColors=f.equalColors;exports.randomColor=f.randomColor;exports.addDays=t.addDays;exports.addHours=t.addHours;exports.addMinutes=t.addMinutes;exports.compareDates=t.compareDates;exports.diffInDays=t.diffInDays;exports.diffInHours=t.diffInHours;exports.endOfDay=t.endOfDay;exports.endOfWeek=t.endOfWeek;exports.isSameDay=t.isSameDay;exports.isSameHour=t.isSameHour;exports.isSameMinute=t.isSameMinute;exports.isSameMonth=t.isSameMonth;exports.isSameSecond=t.isSameSecond;exports.isSameWeek=t.isSameWeek;exports.isSameYear=t.isSameYear;exports.isValidDate=t.isValidDate;exports.isWeekend=t.isWeekend;exports.startOfDay=t.startOfDay;exports.startOfWeek=t.startOfWeek;exports.deferred=q.deferred;exports.deepEqual=T.deepEqual;exports.looseEqual=T.looseEqual;exports.strictEqual=T.strictEqual;exports.compose=b.compose;exports.curryLeft=b.curryLeft;exports.flip=b.flip;exports.identity=b.identity;exports.memoize=b.memoize;exports.negate=b.negate;exports.once=b.once;exports.partial=b.partial;exports.pipe=b.pipe;exports.chain=c.chain;exports.every=c.every;exports.filter=c.filter;exports.find=c.find;exports.map=c.map;exports.reduce=c.reduce;exports.skip=c.skip;exports.some=c.some;exports.take=c.take;exports.toArray=c.toArray;exports.isJSON=S.isJSON;exports.isJSONArray=S.isJSONArray;exports.isJSONObject=S.isJSONObject;exports.isJSONPrimitive=S.isJSONPrimitive;exports.parseJSON=S.parseJSON;exports.mapEntries=m.mapEntries;exports.mapFilter=m.mapFilter;exports.mapFromEntries=m.mapFromEntries;exports.mapGroupBy=m.mapGroupBy;exports.mapIsEmpty=m.mapIsEmpty;exports.mapKeys=m.mapKeys;exports.mapMap=m.mapMap;exports.mapMerge=m.mapMerge;exports.mapToObject=m.mapToObject;exports.mapValues=m.mapValues;exports.EPSILON=s.EPSILON;exports.angleDifference=s.angleDifference;exports.ceilTo=s.ceilTo;exports.clamp=s.clamp;exports.clampInt=s.clampInt;exports.clampSym=s.clampSym;exports.compareNumbers=s.compareNumbers;exports.floorTo=s.floorTo;exports.interpolate=s.interpolate;exports.interpolateAngle=s.interpolateAngle;exports.interpolateAngleCCW=s.interpolateAngleCCW;exports.interpolateAngleCW=s.interpolateAngleCW;exports.interpolateWidestAngle=s.interpolateWidestAngle;exports.nearEqual=s.nearEqual;exports.nearEqualAngles=s.nearEqualAngles;exports.nearZero=s.nearZero;exports.root=s.root;exports.roundTo=s.roundTo;exports.snapToGrid=s.snapToGrid;exports.toHex=s.toHex;exports.widestAngleDifference=s.widestAngleDifference;exports.wrap=s.wrap;exports.wrapCircular=s.wrapCircular;exports.deepClone=n.deepClone;exports.isEmptyObject=n.isEmptyObject;exports.isObject=n.isObject;exports.mergeObjects=n.mergeObjects;exports.objectEntries=n.objectEntries;exports.objectFromEntries=n.objectFromEntries;exports.objectKeys=n.objectKeys;exports.objectValues=n.objectValues;exports.omit=n.omit;exports.pick=n.pick;exports.removeObjectFields=n.removeObjectFields;exports.sameObjectKeys=n.sameObjectKeys;exports.sleep=I.sleep;exports.randomBytes=p.randomBytes;exports.randomChoice=p.randomChoice;exports.randomChoices=p.randomChoices;exports.randomFloat=p.randomFloat;exports.randomHex=p.randomHex;exports.randomInt=p.randomInt;exports.randomUuid=p.randomUuid;exports.seedRandom=p.seedRandom;exports.shuffle=p.shuffle;exports.shuffled=p.shuffled;exports.mapRegExp=x.mapRegExp;exports.Result=H.Result;exports.Validation=H.Validation;exports.setDifference=o.setDifference;exports.setFilter=o.setFilter;exports.setFromArray=o.setFromArray;exports.setIntersection=o.setIntersection;exports.setIsEmpty=o.setIsEmpty;exports.setIsSubset=o.setIsSubset;exports.setIsSuperset=o.setIsSuperset;exports.setMap=o.setMap;exports.setSymmetricDifference=o.setSymmetricDifference;exports.setToArray=o.setToArray;exports.setUnion=o.setUnion;exports.canonicalizeNewlines=e.canonicalizeNewlines;exports.capitalize=e.capitalize;exports.capitalizeWords=e.capitalizeWords;exports.chunkString=e.chunkString;exports.collapseText=e.collapseText;exports.compareCaseInsensitive=e.compareCaseInsensitive;exports.compareStrings=e.compareStrings;exports.containsAllText=e.containsAllText;exports.containsAllTextCaseInsensitive=e.containsAllTextCaseInsensitive;exports.containsAnyText=e.containsAnyText;exports.containsAnyTextCaseInsensitive=e.containsAnyTextCaseInsensitive;exports.countStringOccurrences=e.countStringOccurrences;exports.dasherize=e.dasherize;exports.decodeBase64=e.decodeBase64;exports.deleteFirstFromString=e.deleteFirstFromString;exports.deleteStringAfter=e.deleteStringAfter;exports.deleteStringBefore=e.deleteStringBefore;exports.deleteSubstring=e.deleteSubstring;exports.ellipsis=e.ellipsis;exports.ellipsisMiddle=e.ellipsisMiddle;exports.encodeBase64=e.encodeBase64;exports.filterCharcodes=e.filterCharcodes;exports.filterChars=e.filterChars;exports.humanize=e.humanize;exports.ifEmptyString=e.ifEmptyString;exports.isAlpha=e.isAlpha;exports.isAlphaNum=e.isAlphaNum;exports.isBreakingWhitespace=e.isBreakingWhitespace;exports.isDigitsOnly=e.isDigitsOnly;exports.isEmptyString=e.isEmptyString;exports.isLowerCase=e.isLowerCase;exports.isSpaceAt=e.isSpaceAt;exports.isUpperCase=e.isUpperCase;exports.jsQuote=e.jsQuote;exports.lowerCaseFirst=e.lowerCaseFirst;exports.lpad=e.lpad;exports.mapChars=e.mapChars;exports.quote=e.quote;exports.randomStringSequence=e.randomStringSequence;exports.randomStringSequenceBase64=e.randomStringSequenceBase64;exports.randomSubString=e.randomSubString;exports.reverseString=e.reverseString;exports.rpad=e.rpad;exports.smartQuote=e.smartQuote;exports.splitStringOnFirst=e.splitStringOnFirst;exports.splitStringOnLast=e.splitStringOnLast;exports.splitStringOnce=e.splitStringOnce;exports.stringEndsWithAny=e.stringEndsWithAny;exports.stringHasContent=e.stringHasContent;exports.stringHashCode=e.stringHashCode;exports.stringStartsWithAny=e.stringStartsWithAny;exports.stringToCharcodes=e.stringToCharcodes;exports.stringsDifferAtIndex=e.stringsDifferAtIndex;exports.substringAfter=e.substringAfter;exports.substringAfterLast=e.substringAfterLast;exports.substringBefore=e.substringBefore;exports.substringBeforeLast=e.substringBeforeLast;exports.surroundString=e.surroundString;exports.textContainsCaseInsensitive=e.textContainsCaseInsensitive;exports.textEndsWithAnyCaseInsensitive=e.textEndsWithAnyCaseInsensitive;exports.textEndsWithCaseInsensitive=e.textEndsWithCaseInsensitive;exports.textStartsWithAnyCaseInsensitive=e.textStartsWithAnyCaseInsensitive;exports.textStartsWithCaseInsensitive=e.textStartsWithCaseInsensitive;exports.textToLines=e.textToLines;exports.trimChars=e.trimChars;exports.trimCharsLeft=e.trimCharsLeft;exports.trimCharsRight=e.trimCharsRight;exports.trimStringSlice=e.trimStringSlice;exports.underscore=e.underscore;exports.upperCaseFirst=e.upperCaseFirst;exports.wrapColumns=e.wrapColumns;exports.wrapLine=e.wrapLine;exports.debounce=u.debounce;exports.delayed=u.delayed;exports.delayedAnimationFrame=u.delayedAnimationFrame;exports.interval=u.interval;exports.intervalAnimationFrame=u.intervalAnimationFrame;exports.throttle=u.throttle;exports.buildUrl=l.buildUrl;exports.getBaseName=l.getBaseName;exports.getFileExtension=l.getFileExtension;exports.getFileName=l.getFileName;exports.getQueryParams=l.getQueryParams;exports.isValidUrl=l.isValidUrl;exports.joinPaths=l.joinPaths;exports.normalizePath=l.normalizePath;exports.parseUrl=l.parseUrl;exports.removeQueryParam=l.removeQueryParam;exports.setQueryParam=l.setQueryParam;
|
package/index.d.ts
CHANGED
|
@@ -10,8 +10,10 @@ export * from './color-lab';
|
|
|
10
10
|
export * from './color-named';
|
|
11
11
|
export * from './color-oklab';
|
|
12
12
|
export * from './color-adjust';
|
|
13
|
+
export * from './color-channel';
|
|
13
14
|
export * from './color-contrast';
|
|
14
15
|
export * from './color-distance';
|
|
16
|
+
export * from './color-gamut';
|
|
15
17
|
export * from './color-harmony';
|
|
16
18
|
export * from './color-mix';
|
|
17
19
|
export * from './color-rgb';
|
package/index.js
CHANGED
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
import { applyArrayDiffOperations as r, areArraysEqual as s, arrayDiffOperations as t, arrayHasValues as o, arrayHead as i, arrayTail as n, buildArray as l, chunk as m, compareArrays as p, fillArray as c, filterMapArray as b, filterNullsFromArray as g, groupBy as d, isArrayEmpty as f, joinArrayWithConjunction as u, partition as
|
|
2
|
-
import { AsyncResult as
|
|
3
|
-
import { biAbs as
|
|
4
|
-
import { booleanToInt as
|
|
5
|
-
import { c as $, a as aa, b as ea, d as ra, e as sa, f as ta, g as oa, h as ia, i as na, j as la, k as ma, l as pa, m as ca, n as ba, o as ga, p as da, q as fa, r as ua, s as
|
|
6
|
-
import { NAMED_COLORS as
|
|
7
|
-
import { darken as Se, desaturate as xe, grayscale as Ce, invert as Ae, lighten as Te, opacify as Oe, saturate as ve, transparentize as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
1
|
+
import { applyArrayDiffOperations as r, areArraysEqual as s, arrayDiffOperations as t, arrayHasValues as o, arrayHead as i, arrayTail as n, buildArray as l, chunk as m, compareArrays as p, fillArray as c, filterMapArray as b, filterNullsFromArray as g, groupBy as d, isArrayEmpty as f, joinArrayWithConjunction as u, partition as h, range as y, rankArray as S, removeAllFromArray as x, removeAllFromArrayByPredicate as C, removeOneFromArray as A, removeOneFromArrayByPredicate as T, uniqueByPrimitive as O } from "./array.js";
|
|
2
|
+
import { AsyncResult as k } from "./async-result.js";
|
|
3
|
+
import { biAbs as I, biCeilDiv as P, biCompare as E, biFloorDiv as F, biGcd as R, biIsEven as L, biIsNegative as D, biIsOdd as w, biIsOne as B, biIsPositive as N, biIsPrime as W, biIsZero as j, biLcm as q, biMax as M, biMin as z, biNextPrime as V, biPow as G, biPrevPrime as U } from "./bigint.js";
|
|
4
|
+
import { booleanToInt as Q, canParseBoolean as K, compareBooleans as Z, parseBoolean as Y, xorBoolean as _ } from "./boolean.js";
|
|
5
|
+
import { c as $, a as aa, b as ea, d as ra, e as sa, f as ta, g as oa, h as ia, i as na, j as la, k as ma, l as pa, m as ca, n as ba, o as ga, p as da, q as fa, r as ua, s as ha, t as ya, u as Sa, v as xa, w as Ca, x as Aa, y as Ta, z as Oa, A as va, B as ka, C as Ha, D as Ia, E as Pa, F as Ea, G as Fa, H as Ra, I as La, J as Da, K as wa, L as Ba, M as Na, N as Wa, O as ja, P as qa, Q as Ma, R as za, S as Va, T as Ga, U as Ua, V as Ja, W as Qa, X as Ka, Y as Za, Z as Ya, _ as _a, $ as Xa, a0 as $a, a1 as ae, a2 as ee, a3 as re, a4 as se, a5 as te, a6 as oe, a7 as ie, a8 as ne, a9 as le, aa as me, ab as pe, ac as ce, ad as be, ae as ge, af as de, ag as fe } from "./color-SZxckS9U.js";
|
|
6
|
+
import { NAMED_COLORS as he } from "./color-named.js";
|
|
7
|
+
import { darken as Se, desaturate as xe, grayscale as Ce, invert as Ae, lighten as Te, opacify as Oe, saturate as ve, transparentize as ke } from "./color-adjust.js";
|
|
8
|
+
import { getChannel as Ie, getChannels as Pe, getChannelsAsArray as Ee, isOpaque as Fe, isTransparent as Re, withAlpha as Le, withColor as De } from "./color-channel.js";
|
|
9
|
+
import { contrastColor as Be, contrastRatio as Ne, luminance as We, meetsContrast as je } from "./color-contrast.js";
|
|
10
|
+
import { colorDistance as Me, colorDistanceSimple as ze } from "./color-distance.js";
|
|
11
|
+
import { clampToGamut as Ge, clampToGamutOklch as Ue, isInGamut as Je } from "./color-gamut.js";
|
|
12
|
+
import { analogous as Ke, complement as Ze, splitComplementary as Ye, tetradic as _e, triadic as Xe } from "./color-harmony.js";
|
|
13
|
+
import { interpolateColors as ar, mixColors as er } from "./color-mix.js";
|
|
14
|
+
import { closestNamedColor as sr, equalColors as tr, randomColor as or } from "./color-utils.js";
|
|
15
|
+
import { addDays as nr, addHours as lr, addMinutes as mr, compareDates as pr, diffInDays as cr, diffInHours as br, endOfDay as gr, endOfWeek as dr, isSameDay as fr, isSameHour as ur, isSameMinute as hr, isSameMonth as yr, isSameSecond as Sr, isSameWeek as xr, isSameYear as Cr, isValidDate as Ar, isWeekend as Tr, startOfDay as Or, startOfWeek as vr } from "./date.js";
|
|
16
|
+
import { deferred as Hr } from "./deferred.js";
|
|
17
|
+
import { deepEqual as Pr, looseEqual as Er, strictEqual as Fr } from "./equal.js";
|
|
18
|
+
import { compose as Lr, curryLeft as Dr, flip as wr, identity as Br, memoize as Nr, negate as Wr, once as jr, partial as qr, pipe as Mr } from "./function.js";
|
|
19
|
+
import { chain as Vr, every as Gr, filter as Ur, find as Jr, map as Qr, reduce as Kr, skip as Zr, some as Yr, take as _r, toArray as Xr } from "./iterator.js";
|
|
20
|
+
import { isJSON as as, isJSONArray as es, isJSONObject as rs, isJSONPrimitive as ss, parseJSON as ts } from "./json.js";
|
|
21
|
+
import { mapEntries as is, mapFilter as ns, mapFromEntries as ls, mapGroupBy as ms, mapIsEmpty as ps, mapKeys as cs, mapMap as bs, mapMerge as gs, mapToObject as ds, mapValues as fs } from "./map.js";
|
|
22
|
+
import { EPSILON as hs, angleDifference as ys, ceilTo as Ss, clamp as xs, clampInt as Cs, clampSym as As, compareNumbers as Ts, floorTo as Os, interpolate as vs, interpolateAngle as ks, interpolateAngleCCW as Hs, interpolateAngleCW as Is, interpolateWidestAngle as Ps, nearEqual as Es, nearEqualAngles as Fs, nearZero as Rs, root as Ls, roundTo as Ds, snapToGrid as ws, toHex as Bs, widestAngleDifference as Ns, wrap as Ws, wrapCircular as js } from "./number.js";
|
|
23
|
+
import { deepClone as Ms, isEmptyObject as zs, isObject as Vs, mergeObjects as Gs, objectEntries as Us, objectFromEntries as Js, objectKeys as Qs, objectValues as Ks, omit as Zs, pick as Ys, removeObjectFields as _s, sameObjectKeys as Xs } from "./object.js";
|
|
24
|
+
import { sleep as at } from "./promise.js";
|
|
25
|
+
import { randomBytes as rt, randomChoice as st, randomChoices as tt, randomFloat as ot, randomHex as it, randomInt as nt, randomUuid as lt, seedRandom as mt, shuffle as pt, shuffled as ct } from "./random.js";
|
|
26
|
+
import { mapRegExp as gt } from "./regexp.js";
|
|
27
|
+
import { R as ft, V as ut } from "./result-BYto972d.js";
|
|
28
|
+
import { setDifference as yt, setFilter as St, setFromArray as xt, setIntersection as Ct, setIsEmpty as At, setIsSubset as Tt, setIsSuperset as Ot, setMap as vt, setSymmetricDifference as kt, setToArray as Ht, setUnion as It } from "./set.js";
|
|
29
|
+
import { canonicalizeNewlines as Et, capitalize as Ft, capitalizeWords as Rt, chunkString as Lt, collapseText as Dt, compareCaseInsensitive as wt, compareStrings as Bt, containsAllText as Nt, containsAllTextCaseInsensitive as Wt, containsAnyText as jt, containsAnyTextCaseInsensitive as qt, countStringOccurrences as Mt, dasherize as zt, decodeBase64 as Vt, deleteFirstFromString as Gt, deleteStringAfter as Ut, deleteStringBefore as Jt, deleteSubstring as Qt, ellipsis as Kt, ellipsisMiddle as Zt, encodeBase64 as Yt, filterCharcodes as _t, filterChars as Xt, humanize as $t, ifEmptyString as ao, isAlpha as eo, isAlphaNum as ro, isBreakingWhitespace as so, isDigitsOnly as to, isEmptyString as oo, isLowerCase as io, isSpaceAt as no, isUpperCase as lo, jsQuote as mo, lowerCaseFirst as po, lpad as co, mapChars as bo, quote as go, randomStringSequence as fo, randomStringSequenceBase64 as uo, randomSubString as ho, reverseString as yo, rpad as So, smartQuote as xo, splitStringOnFirst as Co, splitStringOnLast as Ao, splitStringOnce as To, stringEndsWithAny as Oo, stringHasContent as vo, stringHashCode as ko, stringStartsWithAny as Ho, stringToCharcodes as Io, stringsDifferAtIndex as Po, substringAfter as Eo, substringAfterLast as Fo, substringBefore as Ro, substringBeforeLast as Lo, surroundString as Do, textContainsCaseInsensitive as wo, textEndsWithAnyCaseInsensitive as Bo, textEndsWithCaseInsensitive as No, textStartsWithAnyCaseInsensitive as Wo, textStartsWithCaseInsensitive as jo, textToLines as qo, trimChars as Mo, trimCharsLeft as zo, trimCharsRight as Vo, trimStringSlice as Go, underscore as Uo, upperCaseFirst as Jo, wrapColumns as Qo, wrapLine as Ko } from "./string.js";
|
|
30
|
+
import { debounce as Yo, delayed as _o, delayedAnimationFrame as Xo, interval as $o, intervalAnimationFrame as ai, throttle as ei } from "./timer.js";
|
|
31
|
+
import { buildUrl as si, getBaseName as ti, getFileExtension as oi, getFileName as ii, getQueryParams as ni, isValidUrl as li, joinPaths as mi, normalizePath as pi, parseUrl as ci, removeQueryParam as bi, setQueryParam as gi } from "./url.js";
|
|
30
32
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
k as AsyncResult,
|
|
34
|
+
hs as EPSILON,
|
|
35
|
+
he as NAMED_COLORS,
|
|
36
|
+
ft as Result,
|
|
37
|
+
ut as Validation,
|
|
38
|
+
nr as addDays,
|
|
39
|
+
lr as addHours,
|
|
40
|
+
mr as addMinutes,
|
|
41
|
+
Ke as analogous,
|
|
42
|
+
ys as angleDifference,
|
|
41
43
|
r as applyArrayDiffOperations,
|
|
42
44
|
s as areArraysEqual,
|
|
43
45
|
t as arrayDiffOperations,
|
|
44
46
|
o as arrayHasValues,
|
|
45
47
|
i as arrayHead,
|
|
46
48
|
n as arrayTail,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
I as biAbs,
|
|
50
|
+
P as biCeilDiv,
|
|
49
51
|
E as biCompare,
|
|
50
52
|
F as biFloorDiv,
|
|
51
53
|
R as biGcd,
|
|
52
54
|
L as biIsEven,
|
|
53
55
|
D as biIsNegative,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
w as biIsOdd,
|
|
57
|
+
B as biIsOne,
|
|
58
|
+
N as biIsPositive,
|
|
57
59
|
W as biIsPrime,
|
|
58
60
|
j as biIsZero,
|
|
59
61
|
q as biLcm,
|
|
60
62
|
M as biMax,
|
|
61
63
|
z as biMin,
|
|
62
64
|
V as biNextPrime,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
G as biPow,
|
|
66
|
+
U as biPrevPrime,
|
|
67
|
+
Q as booleanToInt,
|
|
66
68
|
l as buildArray,
|
|
67
|
-
|
|
69
|
+
si as buildUrl,
|
|
68
70
|
K as canParseBoolean,
|
|
69
71
|
$ as canParseColor,
|
|
70
72
|
aa as canParseHex,
|
|
@@ -77,224 +79,232 @@ export {
|
|
|
77
79
|
na as canParseOklab,
|
|
78
80
|
la as canParseOklch,
|
|
79
81
|
ma as canParseRgb,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
Et as canonicalizeNewlines,
|
|
83
|
+
Ft as capitalize,
|
|
84
|
+
Rt as capitalizeWords,
|
|
85
|
+
Ss as ceilTo,
|
|
86
|
+
Vr as chain,
|
|
85
87
|
m as chunk,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
Lt as chunkString,
|
|
89
|
+
xs as clamp,
|
|
90
|
+
Cs as clampInt,
|
|
91
|
+
As as clampSym,
|
|
92
|
+
Ge as clampToGamut,
|
|
93
|
+
Ue as clampToGamutOklch,
|
|
94
|
+
sr as closestNamedColor,
|
|
95
|
+
Dt as collapseText,
|
|
96
|
+
Me as colorDistance,
|
|
97
|
+
ze as colorDistanceSimple,
|
|
94
98
|
pa as colorToString,
|
|
95
99
|
p as compareArrays,
|
|
96
100
|
Z as compareBooleans,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
wt as compareCaseInsensitive,
|
|
102
|
+
pr as compareDates,
|
|
103
|
+
Ts as compareNumbers,
|
|
104
|
+
Bt as compareStrings,
|
|
105
|
+
Ze as complement,
|
|
106
|
+
Lr as compose,
|
|
107
|
+
Nt as containsAllText,
|
|
108
|
+
Wt as containsAllTextCaseInsensitive,
|
|
109
|
+
jt as containsAnyText,
|
|
110
|
+
qt as containsAnyTextCaseInsensitive,
|
|
111
|
+
Be as contrastColor,
|
|
112
|
+
Ne as contrastRatio,
|
|
109
113
|
ca as convertColor,
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
Mt as countStringOccurrences,
|
|
115
|
+
Dr as curryLeft,
|
|
112
116
|
Se as darken,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
zt as dasherize,
|
|
118
|
+
Yo as debounce,
|
|
119
|
+
Vt as decodeBase64,
|
|
120
|
+
Ms as deepClone,
|
|
121
|
+
Pr as deepEqual,
|
|
122
|
+
Hr as deferred,
|
|
123
|
+
_o as delayed,
|
|
124
|
+
Xo as delayedAnimationFrame,
|
|
125
|
+
Gt as deleteFirstFromString,
|
|
126
|
+
Ut as deleteStringAfter,
|
|
127
|
+
Jt as deleteStringBefore,
|
|
128
|
+
Qt as deleteSubstring,
|
|
125
129
|
xe as desaturate,
|
|
126
130
|
ba as detectColorSpace,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
cr as diffInDays,
|
|
132
|
+
br as diffInHours,
|
|
133
|
+
Kt as ellipsis,
|
|
134
|
+
Zt as ellipsisMiddle,
|
|
135
|
+
Yt as encodeBase64,
|
|
136
|
+
gr as endOfDay,
|
|
137
|
+
dr as endOfWeek,
|
|
138
|
+
tr as equalColors,
|
|
139
|
+
Gr as every,
|
|
136
140
|
c as fillArray,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
Ur as filter,
|
|
142
|
+
_t as filterCharcodes,
|
|
143
|
+
Xt as filterChars,
|
|
140
144
|
b as filterMapArray,
|
|
141
145
|
g as filterNullsFromArray,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
Jr as find,
|
|
147
|
+
wr as flip,
|
|
148
|
+
Os as floorTo,
|
|
149
|
+
ti as getBaseName,
|
|
150
|
+
Ie as getChannel,
|
|
151
|
+
Pe as getChannels,
|
|
152
|
+
Ee as getChannelsAsArray,
|
|
153
|
+
oi as getFileExtension,
|
|
154
|
+
ii as getFileName,
|
|
155
|
+
ni as getQueryParams,
|
|
149
156
|
Ce as grayscale,
|
|
150
157
|
d as groupBy,
|
|
151
158
|
ga as hsla,
|
|
152
159
|
da as hslaToHslString,
|
|
153
160
|
fa as hslaToHsva,
|
|
154
161
|
ua as hslaToRgb8a,
|
|
155
|
-
|
|
156
|
-
|
|
162
|
+
ha as hsva,
|
|
163
|
+
ya as hsvaToHsla,
|
|
157
164
|
Sa as hsvaToHsvString,
|
|
158
165
|
xa as hsvaToRgb8a,
|
|
159
|
-
|
|
166
|
+
$t as humanize,
|
|
160
167
|
Ca as hwba,
|
|
161
168
|
Aa as hwbaToHwbString,
|
|
162
169
|
Ta as hwbaToRgb8a,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
Br as identity,
|
|
171
|
+
ao as ifEmptyString,
|
|
172
|
+
vs as interpolate,
|
|
173
|
+
ks as interpolateAngle,
|
|
174
|
+
Hs as interpolateAngleCCW,
|
|
175
|
+
Is as interpolateAngleCW,
|
|
176
|
+
ar as interpolateColors,
|
|
177
|
+
Ps as interpolateWidestAngle,
|
|
178
|
+
$o as interval,
|
|
179
|
+
ai as intervalAnimationFrame,
|
|
173
180
|
Ae as invert,
|
|
174
|
-
|
|
175
|
-
|
|
181
|
+
eo as isAlpha,
|
|
182
|
+
ro as isAlphaNum,
|
|
176
183
|
f as isArrayEmpty,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
so as isBreakingWhitespace,
|
|
185
|
+
to as isDigitsOnly,
|
|
186
|
+
zs as isEmptyObject,
|
|
187
|
+
oo as isEmptyString,
|
|
181
188
|
Oa as isHsla,
|
|
182
189
|
va as isHsva,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
ka as isHwba,
|
|
191
|
+
Je as isInGamut,
|
|
192
|
+
as as isJSON,
|
|
193
|
+
es as isJSONArray,
|
|
194
|
+
rs as isJSONObject,
|
|
195
|
+
ss as isJSONPrimitive,
|
|
196
|
+
Ha as isLaba,
|
|
197
|
+
Ia as isLcha,
|
|
198
|
+
io as isLowerCase,
|
|
199
|
+
Vs as isObject,
|
|
200
|
+
Pa as isOklaba,
|
|
193
201
|
Ea as isOklcha,
|
|
202
|
+
Fe as isOpaque,
|
|
194
203
|
Fa as isRgb8a,
|
|
195
204
|
Ra as isRgba,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
fr as isSameDay,
|
|
206
|
+
ur as isSameHour,
|
|
207
|
+
hr as isSameMinute,
|
|
208
|
+
yr as isSameMonth,
|
|
209
|
+
Sr as isSameSecond,
|
|
210
|
+
xr as isSameWeek,
|
|
211
|
+
Cr as isSameYear,
|
|
212
|
+
no as isSpaceAt,
|
|
213
|
+
Re as isTransparent,
|
|
214
|
+
lo as isUpperCase,
|
|
215
|
+
Ar as isValidDate,
|
|
216
|
+
li as isValidUrl,
|
|
217
|
+
Tr as isWeekend,
|
|
208
218
|
u as joinArrayWithConjunction,
|
|
209
|
-
|
|
210
|
-
|
|
219
|
+
mi as joinPaths,
|
|
220
|
+
mo as jsQuote,
|
|
211
221
|
La as laba,
|
|
212
222
|
Da as labaToLabString,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
223
|
+
wa as labaToRgb8a,
|
|
224
|
+
Ba as lcha,
|
|
225
|
+
Na as lchaToLchString,
|
|
216
226
|
Wa as lchaToRgb8a,
|
|
217
227
|
Te as lighten,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
228
|
+
Er as looseEqual,
|
|
229
|
+
po as lowerCaseFirst,
|
|
230
|
+
co as lpad,
|
|
231
|
+
We as luminance,
|
|
232
|
+
Qr as map,
|
|
233
|
+
bo as mapChars,
|
|
234
|
+
is as mapEntries,
|
|
235
|
+
ns as mapFilter,
|
|
236
|
+
ls as mapFromEntries,
|
|
237
|
+
ms as mapGroupBy,
|
|
238
|
+
ps as mapIsEmpty,
|
|
239
|
+
cs as mapKeys,
|
|
240
|
+
bs as mapMap,
|
|
241
|
+
gs as mapMerge,
|
|
242
|
+
gt as mapRegExp,
|
|
243
|
+
ds as mapToObject,
|
|
244
|
+
fs as mapValues,
|
|
245
|
+
je as meetsContrast,
|
|
246
|
+
Nr as memoize,
|
|
247
|
+
Gs as mergeObjects,
|
|
248
|
+
er as mixColors,
|
|
249
|
+
Es as nearEqual,
|
|
250
|
+
Fs as nearEqualAngles,
|
|
251
|
+
Rs as nearZero,
|
|
252
|
+
Wr as negate,
|
|
253
|
+
pi as normalizePath,
|
|
254
|
+
Us as objectEntries,
|
|
255
|
+
Js as objectFromEntries,
|
|
256
|
+
Qs as objectKeys,
|
|
257
|
+
Ks as objectValues,
|
|
248
258
|
ja as oklaba,
|
|
249
259
|
qa as oklabaToOklabString,
|
|
250
260
|
Ma as oklabaToRgb8a,
|
|
251
261
|
za as oklcha,
|
|
252
262
|
Va as oklchaToOklchString,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
263
|
+
Ga as oklchaToRgb8a,
|
|
264
|
+
Zs as omit,
|
|
265
|
+
jr as once,
|
|
256
266
|
Oe as opacify,
|
|
257
|
-
|
|
267
|
+
Ua as parseAlpha,
|
|
258
268
|
Y as parseBoolean,
|
|
259
|
-
|
|
260
|
-
|
|
269
|
+
Ja as parseColor,
|
|
270
|
+
Qa as parseHex,
|
|
261
271
|
Ka as parseHsl,
|
|
262
272
|
Za as parseHsv,
|
|
263
273
|
Ya as parseHwb,
|
|
264
|
-
|
|
274
|
+
ts as parseJSON,
|
|
265
275
|
_a as parseLab,
|
|
266
276
|
Xa as parseLch,
|
|
267
277
|
$a as parseNamedColor,
|
|
268
278
|
ae as parseOklab,
|
|
269
279
|
ee as parseOklch,
|
|
270
280
|
re as parseRgb,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
281
|
+
ci as parseUrl,
|
|
282
|
+
qr as partial,
|
|
283
|
+
h as partition,
|
|
284
|
+
Ys as pick,
|
|
285
|
+
Mr as pipe,
|
|
286
|
+
go as quote,
|
|
287
|
+
rt as randomBytes,
|
|
288
|
+
st as randomChoice,
|
|
289
|
+
tt as randomChoices,
|
|
290
|
+
or as randomColor,
|
|
291
|
+
ot as randomFloat,
|
|
292
|
+
it as randomHex,
|
|
293
|
+
nt as randomInt,
|
|
294
|
+
fo as randomStringSequence,
|
|
295
|
+
uo as randomStringSequenceBase64,
|
|
296
|
+
ho as randomSubString,
|
|
297
|
+
lt as randomUuid,
|
|
298
|
+
y as range,
|
|
289
299
|
S as rankArray,
|
|
290
|
-
|
|
300
|
+
Kr as reduce,
|
|
291
301
|
x as removeAllFromArray,
|
|
292
302
|
C as removeAllFromArrayByPredicate,
|
|
293
|
-
|
|
303
|
+
_s as removeObjectFields,
|
|
294
304
|
A as removeOneFromArray,
|
|
295
305
|
T as removeOneFromArrayByPredicate,
|
|
296
|
-
|
|
297
|
-
|
|
306
|
+
bi as removeQueryParam,
|
|
307
|
+
yo as reverseString,
|
|
298
308
|
se as rgb8a,
|
|
299
309
|
te as rgb8aToHexString,
|
|
300
310
|
oe as rgb8aToHsla,
|
|
@@ -308,73 +318,75 @@ export {
|
|
|
308
318
|
ge as rgb8aToRgba,
|
|
309
319
|
de as rgba,
|
|
310
320
|
fe as rgbaToRgb8a,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
321
|
+
Ls as root,
|
|
322
|
+
Ds as roundTo,
|
|
323
|
+
So as rpad,
|
|
324
|
+
Xs as sameObjectKeys,
|
|
315
325
|
ve as saturate,
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
326
|
+
mt as seedRandom,
|
|
327
|
+
yt as setDifference,
|
|
328
|
+
St as setFilter,
|
|
329
|
+
xt as setFromArray,
|
|
330
|
+
Ct as setIntersection,
|
|
331
|
+
At as setIsEmpty,
|
|
332
|
+
Tt as setIsSubset,
|
|
333
|
+
Ot as setIsSuperset,
|
|
334
|
+
vt as setMap,
|
|
335
|
+
gi as setQueryParam,
|
|
336
|
+
kt as setSymmetricDifference,
|
|
337
|
+
Ht as setToArray,
|
|
338
|
+
It as setUnion,
|
|
339
|
+
pt as shuffle,
|
|
340
|
+
ct as shuffled,
|
|
341
|
+
Zr as skip,
|
|
342
|
+
at as sleep,
|
|
343
|
+
xo as smartQuote,
|
|
344
|
+
ws as snapToGrid,
|
|
345
|
+
Yr as some,
|
|
346
|
+
Ye as splitComplementary,
|
|
347
|
+
Co as splitStringOnFirst,
|
|
348
|
+
Ao as splitStringOnLast,
|
|
349
|
+
To as splitStringOnce,
|
|
350
|
+
Or as startOfDay,
|
|
351
|
+
vr as startOfWeek,
|
|
352
|
+
Fr as strictEqual,
|
|
353
|
+
Oo as stringEndsWithAny,
|
|
354
|
+
vo as stringHasContent,
|
|
355
|
+
ko as stringHashCode,
|
|
356
|
+
Ho as stringStartsWithAny,
|
|
357
|
+
Io as stringToCharcodes,
|
|
358
|
+
Po as stringsDifferAtIndex,
|
|
359
|
+
Eo as substringAfter,
|
|
360
|
+
Fo as substringAfterLast,
|
|
361
|
+
Ro as substringBefore,
|
|
362
|
+
Lo as substringBeforeLast,
|
|
363
|
+
Do as surroundString,
|
|
364
|
+
_r as take,
|
|
365
|
+
_e as tetradic,
|
|
366
|
+
wo as textContainsCaseInsensitive,
|
|
367
|
+
Bo as textEndsWithAnyCaseInsensitive,
|
|
368
|
+
No as textEndsWithCaseInsensitive,
|
|
369
|
+
Wo as textStartsWithAnyCaseInsensitive,
|
|
370
|
+
jo as textStartsWithCaseInsensitive,
|
|
371
|
+
qo as textToLines,
|
|
372
|
+
ei as throttle,
|
|
373
|
+
Xr as toArray,
|
|
374
|
+
Bs as toHex,
|
|
375
|
+
ke as transparentize,
|
|
376
|
+
Xe as triadic,
|
|
377
|
+
Mo as trimChars,
|
|
378
|
+
zo as trimCharsLeft,
|
|
379
|
+
Vo as trimCharsRight,
|
|
380
|
+
Go as trimStringSlice,
|
|
381
|
+
Uo as underscore,
|
|
372
382
|
O as uniqueByPrimitive,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
383
|
+
Jo as upperCaseFirst,
|
|
384
|
+
Ns as widestAngleDifference,
|
|
385
|
+
Le as withAlpha,
|
|
386
|
+
De as withColor,
|
|
387
|
+
Ws as wrap,
|
|
388
|
+
js as wrapCircular,
|
|
389
|
+
Qo as wrapColumns,
|
|
390
|
+
Ko as wrapLine,
|
|
379
391
|
_ as xorBoolean
|
|
380
392
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/std",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"priority": 8,
|
|
5
5
|
"description": "Std library for TypeScript. Natural complement to the Tempo libraries.",
|
|
6
6
|
"keywords": [
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
"import": "./color-adjust.js",
|
|
46
46
|
"require": "./color-adjust.cjs"
|
|
47
47
|
},
|
|
48
|
+
"./color-channel": {
|
|
49
|
+
"import": "./color-channel.js",
|
|
50
|
+
"require": "./color-channel.cjs"
|
|
51
|
+
},
|
|
48
52
|
"./color-contrast": {
|
|
49
53
|
"import": "./color-contrast.js",
|
|
50
54
|
"require": "./color-contrast.cjs"
|
|
@@ -53,6 +57,10 @@
|
|
|
53
57
|
"import": "./color-distance.js",
|
|
54
58
|
"require": "./color-distance.cjs"
|
|
55
59
|
},
|
|
60
|
+
"./color-gamut": {
|
|
61
|
+
"import": "./color-gamut.js",
|
|
62
|
+
"require": "./color-gamut.cjs"
|
|
63
|
+
},
|
|
56
64
|
"./color-harmony": {
|
|
57
65
|
"import": "./color-harmony.js",
|
|
58
66
|
"require": "./color-harmony.cjs"
|
|
@@ -207,12 +215,18 @@
|
|
|
207
215
|
"color-adjust": [
|
|
208
216
|
"./color-adjust.d.ts"
|
|
209
217
|
],
|
|
218
|
+
"color-channel": [
|
|
219
|
+
"./color-channel.d.ts"
|
|
220
|
+
],
|
|
210
221
|
"color-contrast": [
|
|
211
222
|
"./color-contrast.d.ts"
|
|
212
223
|
],
|
|
213
224
|
"color-distance": [
|
|
214
225
|
"./color-distance.d.ts"
|
|
215
226
|
],
|
|
227
|
+
"color-gamut": [
|
|
228
|
+
"./color-gamut.d.ts"
|
|
229
|
+
],
|
|
216
230
|
"color-harmony": [
|
|
217
231
|
"./color-harmony.d.ts"
|
|
218
232
|
],
|