@oscarpalmer/atoms 0.190.0 → 0.192.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/dist/beacon.d.mts +6 -44
- package/dist/beacon.mjs +20 -67
- package/dist/color/constants.d.mts +82 -35
- package/dist/color/constants.mjs +106 -61
- package/dist/color/index.d.mts +3 -3
- package/dist/color/index.mjs +2 -2
- package/dist/color/instance.mjs +60 -35
- package/dist/color/misc/alpha.d.mts +1 -1
- package/dist/color/misc/alpha.mjs +12 -10
- package/dist/color/misc/format.d.mts +7 -0
- package/dist/color/misc/format.mjs +20 -0
- package/dist/color/misc/get.mjs +25 -25
- package/dist/color/misc/is.d.mts +0 -36
- package/dist/color/misc/is.mjs +22 -57
- package/dist/color/misc/state.d.mts +8 -6
- package/dist/color/misc/state.mjs +79 -88
- package/dist/color/models.d.mts +106 -6
- package/dist/color/space/hex.d.mts +3 -2
- package/dist/color/space/hex.mjs +22 -10
- package/dist/color/space/hsl.d.mts +3 -2
- package/dist/color/space/hsl.mjs +26 -14
- package/dist/color/space/hwb.d.mts +3 -2
- package/dist/color/space/hwb.mjs +20 -8
- package/dist/color/space/rgb.d.mts +3 -2
- package/dist/color/space/rgb.mjs +27 -15
- package/dist/herald.d.mts +2 -3
- package/dist/index.d.mts +139 -73
- package/dist/index.mjs +653 -477
- package/dist/internal/subscription.d.mts +52 -0
- package/dist/internal/subscription.mjs +127 -0
- package/dist/models.d.mts +5 -1
- package/package.json +4 -4
- package/src/beacon.ts +32 -117
- package/src/color/constants.ts +115 -66
- package/src/color/index.ts +26 -8
- package/src/color/instance.ts +113 -45
- package/src/color/misc/alpha.ts +18 -20
- package/src/color/misc/format.ts +29 -0
- package/src/color/misc/get.ts +31 -41
- package/src/color/misc/is.ts +31 -71
- package/src/color/misc/state.ts +165 -141
- package/src/color/models.ts +126 -5
- package/src/color/space/hex.ts +46 -18
- package/src/color/space/hsl.ts +44 -14
- package/src/color/space/hwb.ts +38 -8
- package/src/color/space/rgb.ts +48 -15
- package/src/herald.ts +1 -3
- package/src/index.ts +1 -0
- package/src/internal/subscription.ts +264 -0
- package/src/models.ts +5 -0
- package/src/string/fuzzy.ts +1 -1
- package/src/value/freeze.ts +2 -2
- package/src/value/shake.ts +1 -1
- package/src/value/transform.ts +1 -1
- package/dist/color/misc/index.d.mts +0 -7
- package/dist/color/misc/index.mjs +0 -15
- package/src/color/misc/index.ts +0 -29
package/dist/color/space/rgb.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join } from "../../internal/string.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { COLOR_DEFAULTS, COLOR_MAX, COLOR_TYPE } from "../constants.mjs";
|
|
3
3
|
import { getAlpha, getAlphaValue } from "../misc/alpha.mjs";
|
|
4
4
|
import { getHexValue } from "../misc/get.mjs";
|
|
5
5
|
import { isRgbLike } from "../misc/is.mjs";
|
|
@@ -14,11 +14,11 @@ function convertRgbToHex(rgb, alpha) {
|
|
|
14
14
|
return hexString.length === 1 ? `0${hexString}` : hexString;
|
|
15
15
|
}))}`;
|
|
16
16
|
let a = "";
|
|
17
|
-
if (typeof alpha === "boolean" && alpha) a = getAlpha(rgb.alpha).hex;
|
|
17
|
+
if (typeof alpha === "boolean" && alpha) a = getAlpha(rgb.alpha, false).hex;
|
|
18
18
|
return `${hex}${a}`;
|
|
19
19
|
}
|
|
20
20
|
function convertRgbToHsla(value) {
|
|
21
|
-
const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...
|
|
21
|
+
const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...COLOR_DEFAULTS.rgb });
|
|
22
22
|
const { delta, max, min } = values;
|
|
23
23
|
const lightness = (min + max) / 2;
|
|
24
24
|
let hue = 0;
|
|
@@ -30,13 +30,13 @@ function convertRgbToHsla(value) {
|
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
hue,
|
|
33
|
-
saturation: saturation *
|
|
34
|
-
lightness: lightness *
|
|
35
|
-
alpha: getAlphaValue(value?.alpha ??
|
|
33
|
+
saturation: saturation * COLOR_MAX.percent,
|
|
34
|
+
lightness: lightness * COLOR_MAX.percent,
|
|
35
|
+
alpha: getAlphaValue(value?.alpha ?? COLOR_MAX.percent)
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
function convertRgbToHwba(value) {
|
|
39
|
-
const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...
|
|
39
|
+
const values = getRgbValues(isRgbLike(value) ? getRgbValue(value) : { ...COLOR_DEFAULTS.rgb });
|
|
40
40
|
const { delta, max, min } = values;
|
|
41
41
|
let hue = 0;
|
|
42
42
|
if (delta !== 0) {
|
|
@@ -45,11 +45,23 @@ function convertRgbToHwba(value) {
|
|
|
45
45
|
}
|
|
46
46
|
return {
|
|
47
47
|
hue,
|
|
48
|
-
whiteness: min *
|
|
49
|
-
blackness: (1 - max) *
|
|
50
|
-
alpha: getAlphaValue(value?.alpha ??
|
|
48
|
+
whiteness: min * COLOR_MAX.percent,
|
|
49
|
+
blackness: (1 - max) * COLOR_MAX.percent,
|
|
50
|
+
alpha: getAlphaValue(value?.alpha ?? COLOR_MAX.percent)
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
function getColorFromRgb(state, type) {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case COLOR_TYPE.hex:
|
|
56
|
+
state.hex = rgbToHex(state.rgb);
|
|
57
|
+
break;
|
|
58
|
+
case COLOR_TYPE.hsl:
|
|
59
|
+
state.hsl = rgbToHsl(state.rgb);
|
|
60
|
+
break;
|
|
61
|
+
case COLOR_TYPE.hwb: state.hwb = rgbToHwb(state.rgb);
|
|
62
|
+
}
|
|
63
|
+
return state[type];
|
|
64
|
+
}
|
|
53
65
|
function getRgbHue(values) {
|
|
54
66
|
const { blue, delta, green, max, red } = values;
|
|
55
67
|
switch (max) {
|
|
@@ -66,9 +78,9 @@ function getRgbValue(value) {
|
|
|
66
78
|
};
|
|
67
79
|
}
|
|
68
80
|
function getRgbValues(rgb) {
|
|
69
|
-
const blue = rgb.blue /
|
|
70
|
-
const green = rgb.green /
|
|
71
|
-
const red = rgb.red /
|
|
81
|
+
const blue = rgb.blue / COLOR_MAX.hex;
|
|
82
|
+
const green = rgb.green / COLOR_MAX.hex;
|
|
83
|
+
const red = rgb.red / COLOR_MAX.hex;
|
|
72
84
|
const max = Math.max(blue, green, red);
|
|
73
85
|
const min = Math.min(blue, green, red);
|
|
74
86
|
return {
|
|
@@ -90,7 +102,7 @@ function getRgbValues(rgb) {
|
|
|
90
102
|
* @returns Hex color string
|
|
91
103
|
*/
|
|
92
104
|
function rgbToHex(rgb, alpha) {
|
|
93
|
-
return convertRgbToHex(isRgbLike(rgb) ? getRgbValue(rgb) : { ...
|
|
105
|
+
return convertRgbToHex(isRgbLike(rgb) ? getRgbValue(rgb) : { ...COLOR_DEFAULTS.rgb }, alpha ?? false);
|
|
94
106
|
}
|
|
95
107
|
/**
|
|
96
108
|
* Convert an _RGB(A)_ color to an _HSL_ color
|
|
@@ -155,4 +167,4 @@ function rgbToHwba(rgb) {
|
|
|
155
167
|
return convertRgbToHwba(rgb);
|
|
156
168
|
}
|
|
157
169
|
//#endregion
|
|
158
|
-
export { convertRgbToHex, convertRgbToHsla, convertRgbToHwba, getRgbValue, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };
|
|
170
|
+
export { convertRgbToHex, convertRgbToHsla, convertRgbToHwba, getColorFromRgb, getRgbValue, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };
|
package/dist/herald.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GenericCallback } from "./models.mjs";
|
|
1
|
+
import { GenericCallback, Unsubscriber } from "./models.mjs";
|
|
2
2
|
//#region src/herald.d.ts
|
|
3
3
|
type Events<Map extends Record<string, GenericCallback>> = {
|
|
4
4
|
/**
|
|
@@ -47,7 +47,6 @@ type Herald<Map extends Record<string, GenericCallback>> = {
|
|
|
47
47
|
*/
|
|
48
48
|
unsubscribe<Event extends keyof Map>(event: Event, callback?: Map[Event]): void;
|
|
49
49
|
};
|
|
50
|
-
type Unsubscriber = () => void;
|
|
51
50
|
/**
|
|
52
51
|
* Create a _Herald_ for announcing named events
|
|
53
52
|
*
|
|
@@ -70,4 +69,4 @@ declare function isEvents<Map extends Record<string, GenericCallback> = Record<s
|
|
|
70
69
|
*/
|
|
71
70
|
declare function isHerald<Events extends Record<string, GenericCallback> = Record<string, GenericCallback>>(value: unknown): value is Herald<Events>;
|
|
72
71
|
//#endregion
|
|
73
|
-
export { Events, Herald,
|
|
72
|
+
export { Events, Herald, herald, isEvents, isHerald };
|
package/dist/index.d.mts
CHANGED
|
@@ -156,6 +156,10 @@ type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint
|
|
|
156
156
|
* Thanks, type-fest!
|
|
157
157
|
*/
|
|
158
158
|
type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
|
|
159
|
+
/**
|
|
160
|
+
* A function that unsubscribes from a subscription
|
|
161
|
+
*/
|
|
162
|
+
type Unsubscriber = () => void;
|
|
159
163
|
//#endregion
|
|
160
164
|
//#region src/array/filter.d.ts
|
|
161
165
|
/**
|
|
@@ -4547,7 +4551,6 @@ type Herald<Map extends Record<string, GenericCallback>> = {
|
|
|
4547
4551
|
*/
|
|
4548
4552
|
unsubscribe<Event extends keyof Map>(event: Event, callback?: Map[Event]): void;
|
|
4549
4553
|
};
|
|
4550
|
-
type Unsubscriber = () => void;
|
|
4551
4554
|
/**
|
|
4552
4555
|
* Create a _Herald_ for announcing named events
|
|
4553
4556
|
*
|
|
@@ -4611,6 +4614,25 @@ declare function tryEncode(value: boolean | number | string): unknown;
|
|
|
4611
4614
|
*/
|
|
4612
4615
|
declare function words(value: string): string[];
|
|
4613
4616
|
//#endregion
|
|
4617
|
+
//#region src/internal/subscription.d.ts
|
|
4618
|
+
type Subscription = {
|
|
4619
|
+
/**
|
|
4620
|
+
* Is the subscription active?
|
|
4621
|
+
*/
|
|
4622
|
+
get active(): boolean;
|
|
4623
|
+
/**
|
|
4624
|
+
* Unsubscribe from changes
|
|
4625
|
+
*/
|
|
4626
|
+
unsubscribe(): void;
|
|
4627
|
+
};
|
|
4628
|
+
/**
|
|
4629
|
+
* Is the value a subscription?
|
|
4630
|
+
*
|
|
4631
|
+
* @param value Value to check
|
|
4632
|
+
* @returns `true` if the value is a subscription, otherwise `false`
|
|
4633
|
+
*/
|
|
4634
|
+
declare function isSubscription(value: unknown): value is Subscription;
|
|
4635
|
+
//#endregion
|
|
4614
4636
|
//#region src/internal/value/compare.d.ts
|
|
4615
4637
|
type Comparator<Value = any> = (first: Value, second: Value) => number;
|
|
4616
4638
|
/**
|
|
@@ -5838,10 +5860,6 @@ type Beacon<Value> = {
|
|
|
5838
5860
|
* Is the beacon active?
|
|
5839
5861
|
*/
|
|
5840
5862
|
get active(): boolean;
|
|
5841
|
-
/**
|
|
5842
|
-
* Is the beacon closed?
|
|
5843
|
-
*/
|
|
5844
|
-
get closed(): boolean;
|
|
5845
5863
|
/**
|
|
5846
5864
|
* The observable that can be subscribed to
|
|
5847
5865
|
*/
|
|
@@ -5851,9 +5869,9 @@ type Beacon<Value> = {
|
|
|
5851
5869
|
*/
|
|
5852
5870
|
get value(): Value;
|
|
5853
5871
|
/**
|
|
5854
|
-
*
|
|
5872
|
+
* Deactivate the beacon
|
|
5855
5873
|
*/
|
|
5856
|
-
|
|
5874
|
+
deactivate(): void;
|
|
5857
5875
|
/**
|
|
5858
5876
|
* Emit a new value
|
|
5859
5877
|
*
|
|
@@ -5873,9 +5891,6 @@ type Beacon<Value> = {
|
|
|
5873
5891
|
*/
|
|
5874
5892
|
finish(): void;
|
|
5875
5893
|
};
|
|
5876
|
-
/**
|
|
5877
|
-
* Options for Beacon
|
|
5878
|
-
*/
|
|
5879
5894
|
type BeaconOptions<Value> = {
|
|
5880
5895
|
/**
|
|
5881
5896
|
* Method for comparing values for equality
|
|
@@ -5893,13 +5908,9 @@ type Observable<Value> = {
|
|
|
5893
5908
|
*/
|
|
5894
5909
|
get active(): boolean;
|
|
5895
5910
|
/**
|
|
5896
|
-
*
|
|
5911
|
+
* Deactivate the observable
|
|
5897
5912
|
*/
|
|
5898
|
-
|
|
5899
|
-
/**
|
|
5900
|
-
* Close the observable
|
|
5901
|
-
*/
|
|
5902
|
-
close(): void;
|
|
5913
|
+
deactivate(): void;
|
|
5903
5914
|
/**
|
|
5904
5915
|
* Subscribe to value changes
|
|
5905
5916
|
*
|
|
@@ -5917,9 +5928,6 @@ type Observable<Value> = {
|
|
|
5917
5928
|
*/
|
|
5918
5929
|
subscribe(observer: Observer<Value>): Subscription;
|
|
5919
5930
|
};
|
|
5920
|
-
/**
|
|
5921
|
-
* An observer receives notifications from an observable
|
|
5922
|
-
*/
|
|
5923
5931
|
type Observer<Value> = {
|
|
5924
5932
|
/**
|
|
5925
5933
|
* Callback for when the observable is completed
|
|
@@ -5934,24 +5942,6 @@ type Observer<Value> = {
|
|
|
5934
5942
|
*/
|
|
5935
5943
|
next?: (value: Value) => void;
|
|
5936
5944
|
};
|
|
5937
|
-
type Subscription = {
|
|
5938
|
-
/**
|
|
5939
|
-
* Is the subscription active?
|
|
5940
|
-
*/
|
|
5941
|
-
get active(): boolean;
|
|
5942
|
-
/**
|
|
5943
|
-
* Is the subscription closed?
|
|
5944
|
-
*/
|
|
5945
|
-
get closed(): boolean;
|
|
5946
|
-
/**
|
|
5947
|
-
* Close the subscription
|
|
5948
|
-
*/
|
|
5949
|
-
close(): void;
|
|
5950
|
-
/**
|
|
5951
|
-
* Unsubscribe from its observable
|
|
5952
|
-
*/
|
|
5953
|
-
unsubscribe(): void;
|
|
5954
|
-
};
|
|
5955
5945
|
/**
|
|
5956
5946
|
* Create a new beacon
|
|
5957
5947
|
*
|
|
@@ -5974,13 +5964,20 @@ declare function isBeacon<Value = unknown>(value: unknown): value is Beacon<Valu
|
|
|
5974
5964
|
* @returns `true` if the value is an observable, otherwise `false`
|
|
5975
5965
|
*/
|
|
5976
5966
|
declare function isObservable<Value = unknown>(value: unknown): value is Observable<Value>;
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5967
|
+
//#endregion
|
|
5968
|
+
//#region src/color/constants.d.ts
|
|
5969
|
+
type ColorTypes = {
|
|
5970
|
+
all: Set<'alpha' | ColorTypeExtended>;
|
|
5971
|
+
hex: 'hex';
|
|
5972
|
+
hexa: 'hexa';
|
|
5973
|
+
hsl: 'hsl';
|
|
5974
|
+
hsla: 'hsla';
|
|
5975
|
+
hwb: 'hwb';
|
|
5976
|
+
hwba: 'hwba';
|
|
5977
|
+
rgb: 'rgb';
|
|
5978
|
+
rgba: 'rgba';
|
|
5979
|
+
};
|
|
5980
|
+
declare const COLOR_TYPE: ColorTypes;
|
|
5984
5981
|
//#endregion
|
|
5985
5982
|
//#region src/color/models.d.ts
|
|
5986
5983
|
/**
|
|
@@ -6081,6 +6078,12 @@ type Color = {
|
|
|
6081
6078
|
* @param value New _HWBA_ color
|
|
6082
6079
|
*/
|
|
6083
6080
|
set hwba(value: HWBAColor);
|
|
6081
|
+
/**
|
|
6082
|
+
* Last color format that was set on the color
|
|
6083
|
+
*
|
|
6084
|
+
* @returns Color type
|
|
6085
|
+
*/
|
|
6086
|
+
get origin(): ColorType;
|
|
6084
6087
|
/**
|
|
6085
6088
|
* Get the color as an _RGB_ color
|
|
6086
6089
|
*
|
|
@@ -6105,6 +6108,75 @@ type Color = {
|
|
|
6105
6108
|
* @param value New _RGBA_ color
|
|
6106
6109
|
*/
|
|
6107
6110
|
set rgba(value: RGBAColor);
|
|
6111
|
+
/**
|
|
6112
|
+
* Subscribe to alpha channel _(opacity)_ changes of the color
|
|
6113
|
+
*
|
|
6114
|
+
* @param key Color property to subscribe to
|
|
6115
|
+
* @param callback Callback function for changes
|
|
6116
|
+
*/
|
|
6117
|
+
subscribe(key: 'alpha', callback: (value: number) => void): Subscription;
|
|
6118
|
+
/**
|
|
6119
|
+
* Subscribe to hex color changes of the color
|
|
6120
|
+
*
|
|
6121
|
+
* @param key Color type to subscribe to
|
|
6122
|
+
* @param callback Callback function for changes
|
|
6123
|
+
*/
|
|
6124
|
+
subscribe(key: typeof COLOR_TYPE.hex, callback: (value: string) => void): Subscription;
|
|
6125
|
+
/**
|
|
6126
|
+
* Subscribe to hex color changes of the color with alpha channel _(opacity)_
|
|
6127
|
+
*
|
|
6128
|
+
* @param key Color type to subscribe to
|
|
6129
|
+
* @param callback Callback function for changes
|
|
6130
|
+
*/
|
|
6131
|
+
subscribe(key: typeof COLOR_TYPE.hexa, callback: (value: string) => void): Subscription;
|
|
6132
|
+
/**
|
|
6133
|
+
* Subscribe to _HSL_ color changes of the color
|
|
6134
|
+
*
|
|
6135
|
+
* @param key Color type to subscribe to
|
|
6136
|
+
* @param callback Callback function for changes
|
|
6137
|
+
*/
|
|
6138
|
+
subscribe(key: typeof COLOR_TYPE.hsl, callback: (value: HSLColor) => void): Subscription;
|
|
6139
|
+
/**
|
|
6140
|
+
* Subscribe to _HSL(A)_ color changes of the color
|
|
6141
|
+
*
|
|
6142
|
+
* @param key Color type to subscribe to
|
|
6143
|
+
* @param callback Callback function for changes
|
|
6144
|
+
*/
|
|
6145
|
+
subscribe(key: typeof COLOR_TYPE.hsla, callback: (value: HSLAColor) => void): Subscription;
|
|
6146
|
+
/**
|
|
6147
|
+
* Subscribe to _HWB_ color changes of the color
|
|
6148
|
+
*
|
|
6149
|
+
* @param key Color type to subscribe to
|
|
6150
|
+
* @param callback Callback function for changes
|
|
6151
|
+
*/
|
|
6152
|
+
subscribe(key: typeof COLOR_TYPE.hwb, callback: (value: HWBColor) => void): Subscription;
|
|
6153
|
+
/**
|
|
6154
|
+
* Subscribe to _HWB(A)_ color changes of the color
|
|
6155
|
+
*
|
|
6156
|
+
* @param key Color type to subscribe to
|
|
6157
|
+
* @param callback Callback function for changes
|
|
6158
|
+
*/
|
|
6159
|
+
subscribe(key: typeof COLOR_TYPE.hwba, callback: (value: HWBAColor) => void): Subscription;
|
|
6160
|
+
/**
|
|
6161
|
+
* Subscribe to _RGB_ color changes of the color
|
|
6162
|
+
*
|
|
6163
|
+
* @param key Color type to subscribe to
|
|
6164
|
+
* @param callback Callback function for changes
|
|
6165
|
+
*/
|
|
6166
|
+
subscribe(key: typeof COLOR_TYPE.rgb, callback: (value: RGBColor) => void): Subscription;
|
|
6167
|
+
/**
|
|
6168
|
+
* Subscribe to _RGBA_ color changes of the color
|
|
6169
|
+
*
|
|
6170
|
+
* @param key Color type to subscribe to
|
|
6171
|
+
* @param callback Callback function for changes
|
|
6172
|
+
*/
|
|
6173
|
+
subscribe(key: typeof COLOR_TYPE.rgba, callback: (value: RGBAColor) => void): Subscription;
|
|
6174
|
+
/**
|
|
6175
|
+
* Subscribe to any color changes of the color
|
|
6176
|
+
*
|
|
6177
|
+
* @param callback Callback function for changes
|
|
6178
|
+
*/
|
|
6179
|
+
subscribe(callback: (value: Color) => void): Subscription;
|
|
6108
6180
|
/**
|
|
6109
6181
|
* Get the color as a hex string
|
|
6110
6182
|
*
|
|
@@ -6139,6 +6211,12 @@ type Color = {
|
|
|
6139
6211
|
* @returns Hex color string
|
|
6140
6212
|
*/
|
|
6141
6213
|
toString(): string;
|
|
6214
|
+
/**
|
|
6215
|
+
* Unsubscribe from all color changes of the color
|
|
6216
|
+
*
|
|
6217
|
+
* _(To unsubscribe from a specific color change, use the `unsubscribe()` method on the `Subscription` returned by the individual `subscribe()` method)_
|
|
6218
|
+
*/
|
|
6219
|
+
unsubscribe(): void;
|
|
6142
6220
|
};
|
|
6143
6221
|
type ColorWithAlpha = {
|
|
6144
6222
|
/**
|
|
@@ -6203,6 +6281,22 @@ type RGBColor = {
|
|
|
6203
6281
|
*/
|
|
6204
6282
|
red: number;
|
|
6205
6283
|
};
|
|
6284
|
+
/**
|
|
6285
|
+
* Base color types
|
|
6286
|
+
*/
|
|
6287
|
+
type ColorType = 'hex' | 'hsl' | 'hwb' | 'rgb';
|
|
6288
|
+
/**
|
|
6289
|
+
* Extended color types
|
|
6290
|
+
*/
|
|
6291
|
+
type ColorTypeExtended = ColorType | 'hsla' | 'hwba' | 'rgba';
|
|
6292
|
+
/**
|
|
6293
|
+
* Base color values
|
|
6294
|
+
*/
|
|
6295
|
+
type ColorValue = string | HSLColor | HWBColor | RGBColor;
|
|
6296
|
+
/**
|
|
6297
|
+
* Extended color values
|
|
6298
|
+
*/
|
|
6299
|
+
type ColorValueExtended = ColorValue | HSLAColor | HWBAColor | RGBAColor;
|
|
6206
6300
|
//#endregion
|
|
6207
6301
|
//#region src/color/misc/get.d.ts
|
|
6208
6302
|
/**
|
|
@@ -6345,13 +6439,6 @@ declare function isHslaColor(value: unknown): value is HSLAColor;
|
|
|
6345
6439
|
* @returns `true` if the value is an _HSL_ color, otherwise `false`
|
|
6346
6440
|
*/
|
|
6347
6441
|
declare function isHslColor(value: unknown): value is HSLColor;
|
|
6348
|
-
/**
|
|
6349
|
-
* Is the value like an _HSL_ color?
|
|
6350
|
-
*
|
|
6351
|
-
* @param value Value to check
|
|
6352
|
-
* @returns `true` if the value is like an _HSL_ color, otherwise `false`
|
|
6353
|
-
*/
|
|
6354
|
-
declare function isHslLike(value: unknown): value is Record<keyof HSLColor, unknown>;
|
|
6355
6442
|
/**
|
|
6356
6443
|
* Is the value an _HWBA_ color?
|
|
6357
6444
|
*
|
|
@@ -6359,13 +6446,6 @@ declare function isHslLike(value: unknown): value is Record<keyof HSLColor, unkn
|
|
|
6359
6446
|
* @returns `true` if the value is an _HWBA_ color, otherwise `false`
|
|
6360
6447
|
*/
|
|
6361
6448
|
declare function isHwbaColor(value: unknown): value is HWBAColor;
|
|
6362
|
-
/**
|
|
6363
|
-
* Is the value like an _HWBA_ color?
|
|
6364
|
-
*
|
|
6365
|
-
* @param value Value to check
|
|
6366
|
-
* @returns `true` if the value is like an _HWBA_ color, otherwise `false`
|
|
6367
|
-
*/
|
|
6368
|
-
declare function isHwbaLike(value: unknown): value is Record<keyof HWBAColor, unknown>;
|
|
6369
6449
|
/**
|
|
6370
6450
|
* Is the value an _HWB_ color?
|
|
6371
6451
|
*
|
|
@@ -6373,13 +6453,6 @@ declare function isHwbaLike(value: unknown): value is Record<keyof HWBAColor, un
|
|
|
6373
6453
|
* @returns `true` if the value is an _HWB_ color, otherwise `false`
|
|
6374
6454
|
*/
|
|
6375
6455
|
declare function isHwbColor(value: unknown): value is HWBColor;
|
|
6376
|
-
/**
|
|
6377
|
-
* Is the value like an _HWB_ color?
|
|
6378
|
-
*
|
|
6379
|
-
* @param value Value to check
|
|
6380
|
-
* @returns `true` if the value is like an _HWB_ color, otherwise `false`
|
|
6381
|
-
*/
|
|
6382
|
-
declare function isHwbLike(value: unknown): value is Record<keyof HWBColor, unknown>;
|
|
6383
6456
|
/**
|
|
6384
6457
|
* Is the value an _RGBA_ color?
|
|
6385
6458
|
*
|
|
@@ -6394,13 +6467,6 @@ declare function isRgbaColor(value: unknown): value is RGBAColor;
|
|
|
6394
6467
|
* @returns `true` if the value is an _RGB_ color, otherwise `false`
|
|
6395
6468
|
*/
|
|
6396
6469
|
declare function isRgbColor(value: unknown): value is RGBColor;
|
|
6397
|
-
/**
|
|
6398
|
-
* Is the value like an _RGB_ color?
|
|
6399
|
-
*
|
|
6400
|
-
* @param value Value to check
|
|
6401
|
-
* @returns `true` if the value is like an _RGB_ color, otherwise `false`
|
|
6402
|
-
*/
|
|
6403
|
-
declare function isRgbLike(value: unknown): value is Record<keyof RGBColor, unknown>;
|
|
6404
6470
|
//#endregion
|
|
6405
6471
|
//#region src/color/space/hex.d.ts
|
|
6406
6472
|
/**
|
|
@@ -8442,4 +8508,4 @@ declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
8442
8508
|
get(value: Value, update?: boolean): Value | undefined;
|
|
8443
8509
|
}
|
|
8444
8510
|
//#endregion
|
|
8445
|
-
export { AnyResult, ArrayComparison, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayValueSorter, AssertProperty, Asserter, AssignOptions, Assigner, AsyncCancelableCallback, AttemptFlow, AttemptFlowPromise, Beacon, BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, Err, EventPosition, Events, ExtendedErr, ExtendedResult, Flow, FlowPromise, Frozen, FulfilledPromise, Fuzzy, FuzzyConfiguration, FuzzyOptions, FuzzyResult, FuzzySearchOptions, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, Herald, Key$1 as Key, KeyedQueue, KeyedValue, Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NormalizeOptions, Normalizer, NumericalKeys, NumericalValues, Observable, Ok, OnceAsyncCallback, OnceCallback, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PlainObject, Primitive, PromiseData, PromiseHandlers, PromiseOptions, PromiseParameters, PromiseStrategy, PromiseTimeoutError, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues, Queue, QueueError, QueueOptions, Queued, QueuedResult, type RGBAColor, type RGBColor, RejectedPromise, RequiredKeys, Result, ResultMatch, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, type Shaken, Simplify, SizedMap, SizedSet, type Smushed, SortDirection, Sorter, Subscription, TemplateOptions, type TimedLogger, ToString, Transformer, TypedArray, UnionToIntersection, type Unsmushed, Unsubscriber, UnwrapValue, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, filter, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isBeacon, isColor, isConstructor, isEmpty, isError, isEvents, isFrozen, isFulfilled, isHerald, isHexColor, isHslColor,
|
|
8511
|
+
export { AnyResult, ArrayComparison, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayValueSorter, AssertProperty, Asserter, AssignOptions, Assigner, AsyncCancelableCallback, AttemptFlow, AttemptFlowPromise, Beacon, BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, Err, EventPosition, Events, ExtendedErr, ExtendedResult, Flow, FlowPromise, Frozen, FulfilledPromise, Fuzzy, FuzzyConfiguration, FuzzyOptions, FuzzyResult, FuzzySearchOptions, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, Herald, Key$1 as Key, KeyedQueue, KeyedValue, Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NormalizeOptions, Normalizer, NumericalKeys, NumericalValues, Observable, Ok, OnceAsyncCallback, OnceCallback, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PlainObject, Primitive, PromiseData, PromiseHandlers, PromiseOptions, PromiseParameters, PromiseStrategy, PromiseTimeoutError, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues, Queue, QueueError, QueueOptions, Queued, QueuedResult, type RGBAColor, type RGBColor, RejectedPromise, RequiredKeys, Result, ResultMatch, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, type Shaken, Simplify, SizedMap, SizedSet, type Smushed, SortDirection, Sorter, type Subscription, TemplateOptions, type TimedLogger, ToString, Transformer, TypedArray, UnionToIntersection, type Unsmushed, Unsubscriber, UnwrapValue, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, filter, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isBeacon, isColor, isConstructor, isEmpty, isError, isEvents, isFrozen, isFulfilled, isHerald, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isInstanceOf, isKey, isKeyedQueue, isLogger, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isObservable, isOk, isPlainObject, isPrimitive, isQueue, isQueueInstance, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isSubscription, isTimedLogger, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, round, select, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|