@oscarpalmer/atoms 0.191.0 → 0.193.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 -41
- package/dist/color/constants.mjs +102 -63
- package/dist/color/instance.mjs +36 -13
- package/dist/color/misc/alpha.mjs +9 -10
- package/dist/color/misc/format.mjs +4 -4
- package/dist/color/misc/get.mjs +18 -18
- package/dist/color/misc/is.mjs +22 -21
- package/dist/color/misc/state.d.mts +6 -5
- package/dist/color/misc/state.mjs +31 -26
- package/dist/color/models.d.mts +78 -1
- package/dist/color/space/hex.mjs +12 -12
- package/dist/color/space/hsl.mjs +16 -16
- package/dist/color/space/hwb.mjs +10 -10
- package/dist/color/space/rgb.mjs +16 -16
- package/dist/herald.d.mts +2 -3
- package/dist/index.d.mts +141 -67
- package/dist/index.mjs +552 -391
- package/dist/internal/subscription.d.mts +52 -0
- package/dist/internal/subscription.mjs +127 -0
- package/dist/models.d.mts +5 -1
- package/dist/queue.d.mts +25 -23
- package/dist/queue.mjs +27 -28
- package/package.json +1 -1
- package/src/beacon.ts +32 -117
- package/src/color/constants.ts +115 -78
- package/src/color/instance.ts +65 -12
- package/src/color/misc/alpha.ts +13 -21
- package/src/color/misc/format.ts +4 -4
- package/src/color/misc/get.ts +23 -40
- package/src/color/misc/is.ts +29 -39
- package/src/color/misc/state.ts +77 -41
- package/src/color/models.ts +94 -1
- package/src/color/space/hex.ts +18 -23
- package/src/color/space/hsl.ts +16 -24
- package/src/color/space/hwb.ts +10 -10
- package/src/color/space/rgb.ts +19 -16
- 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/queue.ts +92 -92
- 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/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";
|
|
@@ -18,7 +18,7 @@ function convertRgbToHex(rgb, alpha) {
|
|
|
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,20 +45,20 @@ 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
53
|
function getColorFromRgb(state, type) {
|
|
54
54
|
switch (type) {
|
|
55
|
-
case
|
|
55
|
+
case COLOR_TYPE.hex:
|
|
56
56
|
state.hex = rgbToHex(state.rgb);
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case COLOR_TYPE.hsl:
|
|
59
59
|
state.hsl = rgbToHsl(state.rgb);
|
|
60
60
|
break;
|
|
61
|
-
case
|
|
61
|
+
case COLOR_TYPE.hwb: state.hwb = rgbToHwb(state.rgb);
|
|
62
62
|
}
|
|
63
63
|
return state[type];
|
|
64
64
|
}
|
|
@@ -78,9 +78,9 @@ function getRgbValue(value) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
function getRgbValues(rgb) {
|
|
81
|
-
const blue = rgb.blue /
|
|
82
|
-
const green = rgb.green /
|
|
83
|
-
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;
|
|
84
84
|
const max = Math.max(blue, green, red);
|
|
85
85
|
const min = Math.min(blue, green, red);
|
|
86
86
|
return {
|
|
@@ -102,7 +102,7 @@ function getRgbValues(rgb) {
|
|
|
102
102
|
* @returns Hex color string
|
|
103
103
|
*/
|
|
104
104
|
function rgbToHex(rgb, alpha) {
|
|
105
|
-
return convertRgbToHex(isRgbLike(rgb) ? getRgbValue(rgb) : { ...
|
|
105
|
+
return convertRgbToHex(isRgbLike(rgb) ? getRgbValue(rgb) : { ...COLOR_DEFAULTS.rgb }, alpha ?? false);
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* Convert an _RGB(A)_ color to an _HSL_ color
|
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
|
/**
|
|
@@ -6111,6 +6108,75 @@ type Color = {
|
|
|
6111
6108
|
* @param value New _RGBA_ color
|
|
6112
6109
|
*/
|
|
6113
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;
|
|
6114
6180
|
/**
|
|
6115
6181
|
* Get the color as a hex string
|
|
6116
6182
|
*
|
|
@@ -6145,6 +6211,12 @@ type Color = {
|
|
|
6145
6211
|
* @returns Hex color string
|
|
6146
6212
|
*/
|
|
6147
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;
|
|
6148
6220
|
};
|
|
6149
6221
|
type ColorWithAlpha = {
|
|
6150
6222
|
/**
|
|
@@ -7564,7 +7636,7 @@ declare function toQuery(parameters: PlainObject): string;
|
|
|
7564
7636
|
/**
|
|
7565
7637
|
* A queue that can be used to manage (a)synchronous tasks with a specific key
|
|
7566
7638
|
*/
|
|
7567
|
-
type KeyedQueue<CallbackParameters extends Parameters<
|
|
7639
|
+
type KeyedQueue<Callback extends GenericCallback | GenericAsyncCallback, CallbackParameters extends unknown[] = Parameters<Callback>> = {
|
|
7568
7640
|
/**
|
|
7569
7641
|
* Get keys of all active queues
|
|
7570
7642
|
*/
|
|
@@ -7613,7 +7685,7 @@ type KeyedQueue<CallbackParameters extends Parameters<GenericAsyncCallback>, Cal
|
|
|
7613
7685
|
* @param signal Optional signal to abort the item
|
|
7614
7686
|
* @returns Queued item
|
|
7615
7687
|
*/
|
|
7616
|
-
add(key: string, parameters: Tail<CallbackParameters>, signal?: AbortSignal): Queued<
|
|
7688
|
+
add(key: string, parameters: Tail<CallbackParameters>, signal?: AbortSignal): Queued<ReturnType<Callback>>;
|
|
7617
7689
|
/**
|
|
7618
7690
|
* Clear all items for a specific key _(or all items for all keys, if no key is provided)_
|
|
7619
7691
|
*
|
|
@@ -7626,7 +7698,7 @@ type KeyedQueue<CallbackParameters extends Parameters<GenericAsyncCallback>, Cal
|
|
|
7626
7698
|
* @param key Key to get the queue for
|
|
7627
7699
|
* @returns Queue for the key, or `undefined` if it doesn't exist
|
|
7628
7700
|
*/
|
|
7629
|
-
get(key: string): Queue<Tail<CallbackParameters
|
|
7701
|
+
get(key: string): Queue<Callback, Tail<CallbackParameters>> | undefined;
|
|
7630
7702
|
/**
|
|
7631
7703
|
* Pause the queue for a specific key _(or all queues, if no key is provided)_
|
|
7632
7704
|
*
|
|
@@ -7662,7 +7734,7 @@ type KeyedQueue<CallbackParameters extends Parameters<GenericAsyncCallback>, Cal
|
|
|
7662
7734
|
/**
|
|
7663
7735
|
* A queue that can be used to manage (a)synchronous tasks
|
|
7664
7736
|
*/
|
|
7665
|
-
type Queue<CallbackParameters extends Parameters<
|
|
7737
|
+
type Queue<Callback extends GenericCallback | GenericAsyncCallback, CallbackParameters extends unknown[] = Parameters<Callback>> = {
|
|
7666
7738
|
/**
|
|
7667
7739
|
* Is the queue active?
|
|
7668
7740
|
*/
|
|
@@ -7702,7 +7774,7 @@ type Queue<CallbackParameters extends Parameters<GenericAsyncCallback>, Callback
|
|
|
7702
7774
|
* @param signal Optional signal to abort the item
|
|
7703
7775
|
* @returns Queued item
|
|
7704
7776
|
*/
|
|
7705
|
-
add(parameters: CallbackParameters, signal?: AbortSignal): Queued<
|
|
7777
|
+
add(parameters: CallbackParameters, signal?: AbortSignal): Queued<ReturnType<Callback>>;
|
|
7706
7778
|
/**
|
|
7707
7779
|
* Remove and reject all items in the queue
|
|
7708
7780
|
*/
|
|
@@ -7756,17 +7828,7 @@ type Queued<Value> = {
|
|
|
7756
7828
|
/**
|
|
7757
7829
|
* Queued promise
|
|
7758
7830
|
*/
|
|
7759
|
-
readonly promise: Promise<
|
|
7760
|
-
};
|
|
7761
|
-
type QueuedResult<Value> = {
|
|
7762
|
-
/**
|
|
7763
|
-
* Has the queue finished processing all items?
|
|
7764
|
-
*/
|
|
7765
|
-
finished: boolean;
|
|
7766
|
-
/**
|
|
7767
|
-
* Result for the queued promise
|
|
7768
|
-
*/
|
|
7769
|
-
value: Value extends Promise<infer Result> ? Result : Value;
|
|
7831
|
+
readonly promise: Promise<Value extends Promise<infer Result> ? Result : Value>;
|
|
7770
7832
|
};
|
|
7771
7833
|
type Tail<Values extends any[]> = Values extends [infer _, ...infer Rest] ? Rest : never;
|
|
7772
7834
|
/**
|
|
@@ -7775,17 +7837,29 @@ type Tail<Values extends any[]> = Values extends [infer _, ...infer Rest] ? Rest
|
|
|
7775
7837
|
* @param value Value to check
|
|
7776
7838
|
* @returns `true` if the value is a keyed queue, otherwise `false`
|
|
7777
7839
|
*/
|
|
7778
|
-
declare function isKeyedQueue(value: unknown): value is KeyedQueue<
|
|
7840
|
+
declare function isKeyedQueue(value: unknown): value is KeyedQueue<GenericAsyncCallback>;
|
|
7779
7841
|
/**
|
|
7780
7842
|
* Is the value a queue?
|
|
7781
7843
|
*
|
|
7782
7844
|
* @param value Value to check
|
|
7783
7845
|
* @returns `true` if the value is a queue, otherwise `false`
|
|
7784
7846
|
*/
|
|
7785
|
-
declare function isQueue(value: unknown): value is Queue<
|
|
7847
|
+
declare function isQueue(value: unknown): value is Queue<GenericCallback | GenericAsyncCallback>;
|
|
7786
7848
|
declare function isQueueInstance<Instance>(name: string, value: unknown): value is Instance;
|
|
7787
|
-
|
|
7788
|
-
|
|
7849
|
+
/**
|
|
7850
|
+
* Create a keyed queue for an asynchronous callback function, where each key has its own queue
|
|
7851
|
+
*
|
|
7852
|
+
* @param callback Callback function for queued items
|
|
7853
|
+
* @param options Queue options
|
|
7854
|
+
*/
|
|
7855
|
+
declare function keyedQueue<Callback extends (key: string, ...parameters: any[]) => Promise<void>>(callback: Callback, options?: QueueOptions): KeyedQueue<Callback, Parameters<Callback>>;
|
|
7856
|
+
/**
|
|
7857
|
+
* Create a keyed queue for an asynchronous callback function, where each key has its own queue
|
|
7858
|
+
*
|
|
7859
|
+
* @param callback Callback function for queued items
|
|
7860
|
+
* @param options Queue options
|
|
7861
|
+
*/
|
|
7862
|
+
declare function keyedQueue<Callback extends (key: string, ...parameters: any[]) => void>(callback: Callback, options?: QueueOptions): KeyedQueue<Callback, Parameters<Callback>>;
|
|
7789
7863
|
/**
|
|
7790
7864
|
* Create a queue for an asynchronous callback function
|
|
7791
7865
|
*
|
|
@@ -7793,7 +7867,7 @@ declare function keyedQueue<Callback extends (key: string, ...parameters: any[])
|
|
|
7793
7867
|
* @param options Queue options
|
|
7794
7868
|
* @returns Queue instance
|
|
7795
7869
|
*/
|
|
7796
|
-
declare function queue<Callback extends GenericAsyncCallback>(callback: Callback, options?: QueueOptions): Queue<
|
|
7870
|
+
declare function queue<Callback extends GenericAsyncCallback>(callback: Callback, options?: QueueOptions): Queue<Callback, Parameters<Callback>>;
|
|
7797
7871
|
/**
|
|
7798
7872
|
* Create a queue for a synchronous callback function
|
|
7799
7873
|
*
|
|
@@ -7801,7 +7875,7 @@ declare function queue<Callback extends GenericAsyncCallback>(callback: Callback
|
|
|
7801
7875
|
* @param options Queue options
|
|
7802
7876
|
* @returns Queue instance
|
|
7803
7877
|
*/
|
|
7804
|
-
declare function queue<Callback extends GenericCallback>(callback: Callback, options?: QueueOptions): Queue<
|
|
7878
|
+
declare function queue<Callback extends GenericCallback>(callback: Callback, options?: QueueOptions): Queue<Callback, Parameters<Callback>>;
|
|
7805
7879
|
declare namespace queue {
|
|
7806
7880
|
var keyed: typeof keyedQueue;
|
|
7807
7881
|
}
|
|
@@ -8436,4 +8510,4 @@ declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
8436
8510
|
get(value: Value, update?: boolean): Value | undefined;
|
|
8437
8511
|
}
|
|
8438
8512
|
//#endregion
|
|
8439
|
-
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,
|
|
8513
|
+
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, 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 };
|