@oscarpalmer/atoms 0.221.0 → 0.223.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/array/difference.d.mts +1 -3
- package/dist/array/difference.mjs +2 -3
- package/dist/array/exists.d.mts +1 -3
- package/dist/array/exists.mjs +11 -6
- package/dist/array/filter.d.mts +1 -3
- package/dist/array/filter.mjs +15 -6
- package/dist/array/find.d.mts +1 -3
- package/dist/array/find.mjs +9 -5
- package/dist/array/first.d.mts +1 -3
- package/dist/array/first.mjs +10 -5
- package/dist/array/flatten.d.mts +1 -3
- package/dist/array/flatten.mjs +1 -2
- package/dist/array/from.d.mts +1 -3
- package/dist/array/from.mjs +1 -2
- package/dist/array/group-by.d.mts +1 -3
- package/dist/array/group-by.mjs +1 -2
- package/dist/array/index.d.mts +4 -4
- package/dist/array/insert.d.mts +1 -3
- package/dist/array/insert.mjs +2 -3
- package/dist/array/intersection.d.mts +1 -3
- package/dist/array/intersection.mjs +2 -3
- package/dist/array/last.d.mts +1 -3
- package/dist/array/last.mjs +12 -5
- package/dist/array/move.d.mts +1 -3
- package/dist/array/move.mjs +1 -2
- package/dist/array/partition.d.mts +1 -3
- package/dist/array/partition.mjs +24 -5
- package/dist/array/push.d.mts +0 -2
- package/dist/array/push.mjs +2 -3
- package/dist/array/reverse.d.mts +1 -3
- package/dist/array/reverse.mjs +1 -2
- package/dist/array/select.d.mts +0 -2
- package/dist/array/select.mjs +40 -9
- package/dist/array/single.d.mts +1 -3
- package/dist/array/single.mjs +9 -7
- package/dist/array/slice.d.mts +1 -3
- package/dist/array/slice.mjs +1 -2
- package/dist/array/sort.d.mts +0 -2
- package/dist/array/sort.mjs +2 -3
- package/dist/array/splice.d.mts +1 -3
- package/dist/array/splice.mjs +2 -3
- package/dist/array/swap.d.mts +0 -2
- package/dist/array/swap.mjs +2 -3
- package/dist/array/to-map.d.mts +1 -3
- package/dist/array/to-map.mjs +1 -2
- package/dist/array/to-record.d.mts +1 -3
- package/dist/array/to-record.mjs +1 -2
- package/dist/array/to-set.d.mts +1 -3
- package/dist/array/to-set.mjs +1 -2
- package/dist/array/toggle.d.mts +1 -3
- package/dist/array/toggle.mjs +1 -2
- package/dist/array/union.d.mts +1 -3
- package/dist/array/union.mjs +2 -3
- package/dist/array/unique.d.mts +1 -3
- package/dist/array/unique.mjs +18 -5
- package/dist/array/update.d.mts +1 -3
- package/dist/array/update.mjs +1 -2
- package/dist/beacon.d.mts +3 -13
- package/dist/beacon.mjs +10 -21
- package/dist/color/constants.d.mts +1 -7
- package/dist/color/constants.mjs +3 -11
- package/dist/color/index.d.mts +0 -2
- package/dist/color/index.mjs +4 -5
- package/dist/color/instance.d.mts +1 -3
- package/dist/color/instance.mjs +5 -8
- package/dist/color/misc/alpha.d.mts +1 -3
- package/dist/color/misc/alpha.mjs +1 -2
- package/dist/color/misc/format.d.mts +1 -3
- package/dist/color/misc/format.mjs +1 -2
- package/dist/color/misc/get.d.mts +1 -3
- package/dist/color/misc/get.mjs +2 -3
- package/dist/color/misc/is.d.mts +1 -11
- package/dist/color/misc/is.mjs +4 -16
- package/dist/color/misc/state.d.mts +1 -3
- package/dist/color/misc/state.mjs +4 -5
- package/dist/color/space/hex.d.mts +1 -3
- package/dist/color/space/hex.mjs +2 -3
- package/dist/color/space/hsl.d.mts +1 -3
- package/dist/color/space/hsl.mjs +2 -3
- package/dist/color/space/hwb.d.mts +1 -3
- package/dist/color/space/hwb.mjs +3 -4
- package/dist/color/space/rgb.d.mts +1 -3
- package/dist/color/space/rgb.mjs +1 -2
- package/dist/function/limit.d.mts +1 -3
- package/dist/function/limit.mjs +2 -3
- package/dist/function/once.d.mts +1 -3
- package/dist/function/once.mjs +8 -9
- package/dist/function/retry.d.mts +1 -3
- package/dist/function/retry.mjs +11 -12
- package/dist/herald.d.mts +2 -2
- package/dist/herald.mjs +1 -1
- package/dist/index.d.mts +81 -359
- package/dist/index.mjs +514 -661
- package/dist/internal/aborter.d.mts +1 -3
- package/dist/internal/aborter.mjs +1 -2
- package/dist/internal/array/callbacks.d.mts +2 -4
- package/dist/internal/array/callbacks.mjs +1 -2
- package/dist/internal/array/chunk.d.mts +1 -3
- package/dist/internal/array/chunk.mjs +1 -2
- package/dist/internal/array/compact.d.mts +1 -3
- package/dist/internal/array/compact.mjs +1 -2
- package/dist/internal/array/find.d.mts +2 -8
- package/dist/internal/array/find.mjs +31 -124
- package/dist/internal/array/get.d.mts +1 -3
- package/dist/internal/array/get.mjs +1 -2
- package/dist/internal/array/group.d.mts +1 -3
- package/dist/internal/array/group.mjs +1 -2
- package/dist/internal/array/index-of.d.mts +1 -3
- package/dist/internal/array/index-of.mjs +10 -5
- package/dist/internal/array/insert.d.mts +1 -3
- package/dist/internal/array/insert.mjs +2 -3
- package/dist/internal/array/match.d.mts +2 -4
- package/dist/internal/array/match.mjs +2 -3
- package/dist/internal/array/overlap.d.mts +1 -3
- package/dist/internal/array/overlap.mjs +1 -2
- package/dist/internal/array/sets.d.mts +1 -3
- package/dist/internal/array/sets.mjs +5 -6
- package/dist/internal/array/shuffle.d.mts +1 -3
- package/dist/internal/array/shuffle.mjs +1 -2
- package/dist/internal/array/update.d.mts +1 -3
- package/dist/internal/array/update.mjs +1 -2
- package/dist/internal/defaults.d.mts +1 -3
- package/dist/internal/defaults.mjs +1 -2
- package/dist/internal/function/assert.d.mts +1 -3
- package/dist/internal/function/assert.mjs +1 -2
- package/dist/internal/function/limit.d.mts +2 -4
- package/dist/internal/function/limit.mjs +8 -9
- package/dist/internal/function/memoize.d.mts +1 -3
- package/dist/internal/function/memoize.mjs +4 -5
- package/dist/internal/function/misc.d.mts +1 -2
- package/dist/internal/function/misc.mjs +7 -3
- package/dist/internal/function/work.d.mts +1 -3
- package/dist/internal/function/work.mjs +5 -13
- package/dist/internal/herald.d.mts +2 -12
- package/dist/internal/herald.mjs +9 -33
- package/dist/internal/is.d.mts +1 -3
- package/dist/internal/is.mjs +1 -2
- package/dist/internal/math/aggregate.d.mts +1 -3
- package/dist/internal/math/aggregate.mjs +2 -3
- package/dist/internal/math/misc.d.mts +1 -3
- package/dist/internal/math/misc.mjs +1 -2
- package/dist/internal/number.d.mts +1 -3
- package/dist/internal/number.mjs +2 -3
- package/dist/internal/plan/index.d.mts +1 -3
- package/dist/internal/plan/index.mjs +2 -3
- package/dist/internal/plan/plan.generate.d.mts +1 -3
- package/dist/internal/plan/plan.generate.mjs +67 -22
- package/dist/internal/random.d.mts +1 -3
- package/dist/internal/random.mjs +1 -2
- package/dist/internal/result/attempt.d.mts +1 -3
- package/dist/internal/result/attempt.mjs +1 -2
- package/dist/internal/result/misc.d.mts +1 -3
- package/dist/internal/result/misc.mjs +1 -2
- package/dist/internal/sized/map.d.mts +4 -3
- package/dist/internal/sized/map.mjs +4 -2
- package/dist/internal/sized/misc.d.mts +1 -3
- package/dist/internal/sized/misc.mjs +1 -2
- package/dist/internal/string/case.d.mts +1 -3
- package/dist/internal/string/case.mjs +3 -4
- package/dist/internal/string/misc.d.mts +1 -3
- package/dist/internal/string/misc.mjs +1 -2
- package/dist/internal/subscription.d.mts +1 -3
- package/dist/internal/subscription.mjs +16 -29
- package/dist/internal/value/compare.d.mts +1 -3
- package/dist/internal/value/compare.mjs +2 -3
- package/dist/internal/value/equal.d.mts +1 -3
- package/dist/internal/value/equal.mjs +3 -4
- package/dist/internal/value/get.d.mts +1 -3
- package/dist/internal/value/get.mjs +1 -2
- package/dist/internal/value/handlers.d.mts +1 -3
- package/dist/internal/value/handlers.mjs +1 -2
- package/dist/internal/value/has.d.mts +1 -3
- package/dist/internal/value/has.mjs +1 -2
- package/dist/internal/value/misc.d.mts +1 -3
- package/dist/internal/value/misc.mjs +2 -3
- package/dist/internal/value/partial.d.mts +1 -3
- package/dist/internal/value/partial.mjs +1 -2
- package/dist/internal/value/set.d.mts +1 -3
- package/dist/internal/value/set.mjs +2 -3
- package/dist/is.d.mts +0 -2
- package/dist/is.mjs +2 -3
- package/dist/logger.d.mts +0 -2
- package/dist/logger.mjs +7 -7
- package/dist/math.d.mts +0 -2
- package/dist/math.mjs +2 -3
- package/dist/models/aborter.model.d.mts +1 -3
- package/dist/models/aborter.model.mjs +1 -2
- package/dist/models/array/array.match.model.d.mts +1 -3
- package/dist/models/array/array.match.model.mjs +1 -2
- package/dist/models/array/array.misc.model.d.mts +11 -2
- package/dist/models/array/array.misc.model.mjs +3 -3
- package/dist/models/array/array.sort.model.d.mts +1 -3
- package/dist/models/array/array.sort.model.mjs +1 -2
- package/dist/models/beacon.model.d.mts +4 -6
- package/dist/models/beacon.model.mjs +3 -10
- package/dist/models/color.model.d.mts +2 -4
- package/dist/models/function/assert.model.d.mts +1 -3
- package/dist/models/function/assert.model.mjs +1 -2
- package/dist/models/function/limiter.model.d.mts +2 -4
- package/dist/models/function/limiter.model.mjs +2 -4
- package/dist/models/function/memoize.model.d.mts +2 -4
- package/dist/models/function/memoize.model.mjs +1 -2
- package/dist/models/function/once.model.d.mts +0 -3
- package/dist/models/function/once.model.mjs +3 -5
- package/dist/models/function/retry.model.d.mts +1 -3
- package/dist/models/function/retry.model.mjs +1 -2
- package/dist/models/function/work.model.d.mts +2 -4
- package/dist/models/function/work.model.mjs +1 -2
- package/dist/models/herald.model.d.mts +8 -7
- package/dist/models/herald.model.mjs +3 -10
- package/dist/models/index.d.mts +0 -2
- package/dist/models/logger.model.d.mts +1 -4
- package/dist/models/logger.model.mjs +3 -5
- package/dist/models/math.model.d.mts +1 -3
- package/dist/models/math.model.mjs +1 -2
- package/dist/models/misc.model.d.mts +1 -3
- package/dist/models/misc.model.mjs +1 -2
- package/dist/models/plan.model.d.mts +35 -37
- package/dist/models/plan.model.mjs +1 -2
- package/dist/models/promise.model.d.mts +8 -10
- package/dist/models/promise.model.mjs +4 -5
- package/dist/models/query.model.d.mts +1 -3
- package/dist/models/query.model.mjs +1 -2
- package/dist/models/queue.model.d.mts +0 -3
- package/dist/models/queue.model.mjs +3 -5
- package/dist/models/random.model.d.mts +1 -3
- package/dist/models/random.model.mjs +1 -2
- package/dist/models/result.model.d.mts +0 -2
- package/dist/models/string/string.case.model.d.mts +1 -3
- package/dist/models/string/string.case.model.mjs +1 -2
- package/dist/models/string/string.fuzzy.model.d.mts +0 -3
- package/dist/models/string/string.fuzzy.model.mjs +3 -5
- package/dist/models/string/string.misc.model.d.mts +1 -3
- package/dist/models/string/string.misc.model.mjs +1 -2
- package/dist/models/string/string.normalize.model.d.mts +1 -3
- package/dist/models/string/string.normalize.model.mjs +1 -2
- package/dist/models/string/string.template.model.d.mts +1 -3
- package/dist/models/string/string.template.model.mjs +1 -2
- package/dist/models/subscription.model.d.mts +4 -23
- package/dist/models/subscription.model.mjs +3 -5
- package/dist/models/value/value.clone.model.d.mts +1 -3
- package/dist/models/value/value.clone.model.mjs +1 -2
- package/dist/models/value/value.diff.model.d.mts +1 -3
- package/dist/models/value/value.diff.model.mjs +1 -2
- package/dist/models/value/value.equal.model.d.mts +0 -2
- package/dist/models/value/value.equal.model.mjs +1 -2
- package/dist/models/value/value.handler.model.d.mts +1 -3
- package/dist/models/value/value.merge.model.d.mts +0 -2
- package/dist/models/value/value.merge.model.mjs +1 -2
- package/dist/models/value/value.misc.model.d.mts +0 -2
- package/dist/models/value/value.misc.model.mjs +1 -2
- package/dist/models/value/value.transform.model.d.mts +1 -3
- package/dist/models/value/value.transform.model.mjs +1 -2
- package/dist/plan/index.d.mts +1 -3
- package/dist/plan/index.mjs +2 -3
- package/dist/plan/is.d.mts +1 -3
- package/dist/plan/is.mjs +1 -2
- package/dist/plan/misc.d.mts +1 -3
- package/dist/plan/misc.mjs +2 -3
- package/dist/plan/models.d.mts +2 -2
- package/dist/plan/result.d.mts +8 -10
- package/dist/plan/result.mjs +2 -3
- package/dist/plan/run.d.mts +8 -10
- package/dist/plan/run.mjs +2 -3
- package/dist/plan/use.d.mts +1 -3
- package/dist/plan/use.mjs +14 -9
- package/dist/promise/delay.d.mts +1 -3
- package/dist/promise/delay.mjs +2 -3
- package/dist/promise/helpers.d.mts +1 -3
- package/dist/promise/helpers.mjs +2 -3
- package/dist/promise/index.d.mts +0 -2
- package/dist/promise/index.mjs +5 -6
- package/dist/promise/misc.d.mts +1 -3
- package/dist/promise/misc.mjs +2 -3
- package/dist/promise/models.d.mts +2 -2
- package/dist/promise/models.mjs +1 -1
- package/dist/promise/timed.d.mts +1 -3
- package/dist/promise/timed.mjs +4 -5
- package/dist/query.d.mts +1 -3
- package/dist/query.mjs +2 -3
- package/dist/queue.d.mts +0 -2
- package/dist/queue.mjs +11 -12
- package/dist/random.d.mts +0 -2
- package/dist/random.mjs +2 -3
- package/dist/result/match.d.mts +1 -3
- package/dist/result/match.mjs +1 -2
- package/dist/result/misc.d.mts +0 -2
- package/dist/result/misc.mjs +1 -2
- package/dist/result/work/flow.d.mts +1 -3
- package/dist/result/work/flow.mjs +5 -12
- package/dist/result/work/pipe.d.mts +0 -2
- package/dist/result/work/pipe.mjs +2 -3
- package/dist/sized/set.d.mts +4 -3
- package/dist/sized/set.mjs +4 -2
- package/dist/string/fuzzy.d.mts +0 -2
- package/dist/string/fuzzy.mjs +5 -7
- package/dist/string/index.d.mts +0 -2
- package/dist/string/index.mjs +2 -3
- package/dist/string/match.d.mts +1 -3
- package/dist/string/match.mjs +2 -3
- package/dist/string/normalize.d.mts +0 -2
- package/dist/string/normalize.mjs +3 -4
- package/dist/string/template.d.mts +0 -2
- package/dist/string/template.mjs +1 -2
- package/dist/subscription.d.mts +2 -2
- package/dist/value/clone.d.mts +1 -3
- package/dist/value/clone.mjs +2 -3
- package/dist/value/collection.d.mts +1 -3
- package/dist/value/collection.mjs +1 -2
- package/dist/value/diff.d.mts +0 -2
- package/dist/value/diff.mjs +1 -2
- package/dist/value/freeze.d.mts +1 -3
- package/dist/value/freeze.mjs +1 -2
- package/dist/value/handle.mjs +1 -1
- package/dist/value/merge.d.mts +0 -2
- package/dist/value/merge.mjs +1 -2
- package/dist/value/omit.d.mts +1 -3
- package/dist/value/omit.mjs +1 -2
- package/dist/value/pick.d.mts +1 -3
- package/dist/value/pick.mjs +1 -2
- package/dist/value/shake.d.mts +0 -2
- package/dist/value/shake.mjs +1 -2
- package/dist/value/smush.d.mts +0 -2
- package/dist/value/smush.mjs +2 -3
- package/dist/value/transform.d.mts +0 -2
- package/dist/value/transform.mjs +1 -2
- package/dist/value/unsmush.d.mts +0 -2
- package/dist/value/unsmush.mjs +1 -2
- package/package.json +6 -6
- package/dist/models/array/array.find.model.d.mts +0 -48
- package/dist/models/array/array.find.model.mjs +0 -8
package/dist/color/misc/is.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import "../../models/subscription.model.mjs";
|
|
2
|
-
import { isSubscription } from "../../internal/subscription.mjs";
|
|
3
1
|
import { between } from "../../internal/number.mjs";
|
|
4
|
-
import { COLOR_ALPHA, COLOR_EXPRESSION, COLOR_KEYS, COLOR_LENGTHS, COLOR_MAX } from "../constants.mjs";
|
|
5
|
-
|
|
2
|
+
import { COLOR_ALPHA, COLOR_EXPRESSION, COLOR_KEYS, COLOR_LENGTHS, COLOR_MAX, COLOR_SYMBOL } from "../constants.mjs";
|
|
3
|
+
// src/color/misc/is.ts
|
|
6
4
|
function hasKeys(value, keys) {
|
|
7
5
|
return typeof value === "object" && value !== null && keys.every((key) => key in value);
|
|
8
6
|
}
|
|
@@ -19,16 +17,7 @@ function isBytey(value) {
|
|
|
19
17
|
* @returns `true` if the value is a _Color_, otherwise `false`
|
|
20
18
|
*/
|
|
21
19
|
function isColor(value) {
|
|
22
|
-
return typeof value === "object" && value !== null &&
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Is the value a color subscription?
|
|
26
|
-
*
|
|
27
|
-
* @param value Value to check
|
|
28
|
-
* @returns `true` if the value is a color subscription, otherwise `false`
|
|
29
|
-
*/
|
|
30
|
-
function isColorSubscription(value) {
|
|
31
|
-
return isSubscription(value) && "$color" in value && value["$color"] === "subscription";
|
|
20
|
+
return typeof value === "object" && value !== null && COLOR_SYMBOL in value;
|
|
32
21
|
}
|
|
33
22
|
function isColorValue(value, properties) {
|
|
34
23
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -156,5 +145,4 @@ const validators = {
|
|
|
156
145
|
red: isBytey,
|
|
157
146
|
whiteness: isPercentage
|
|
158
147
|
};
|
|
159
|
-
|
|
160
|
-
export { isColor, isColorSubscription, isHexColor, isHslColor, isHslLike, isHslaColor, isHslaLike, isHwbColor, isHwbLike, isHwbaColor, isHwbaLike, isRgbColor, isRgbLike, isRgbaColor, isRgbaLike };
|
|
148
|
+
export { isColor, isHexColor, isHslColor, isHslLike, isHslaColor, isHslaLike, isHwbColor, isHwbLike, isHwbaColor, isHwbaLike, isRgbColor, isRgbLike, isRgbaColor, isRgbaLike };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ColorState, ColorType, HSLAColor, HSLColor, HWBAColor, HWBColor, InternalColor, RGBAColor, RGBColor } from "../../models/color.model.mjs";
|
|
2
|
-
//#region src/color/misc/state.d.ts
|
|
3
2
|
export declare function getColorFromState<Type extends ColorType>(state: ColorState, type: Type): NonNullable<ColorState[Type]>;
|
|
4
3
|
export declare function getColorState(value: unknown): ColorState;
|
|
5
4
|
export declare function getStateValue(instance: InternalColor, type: ColorType, alpha: boolean): string | HSLAColor | HSLColor | HWBAColor | HWBColor | RGBAColor | RGBColor;
|
|
6
|
-
export declare function setStateValue<Type extends ColorType>(instance: InternalColor, type: Type, value: ColorState[Type], alpha?: number | string): void;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function setStateValue<Type extends ColorType>(instance: InternalColor, type: Type, value: ColorState[Type], alpha?: number | string): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { COLOR_DEFAULTS, COLOR_KEYS, COLOR_LENGTHS, COLOR_MAX, COLOR_SYMBOL, COLOR_TYPE } from "../constants.mjs";
|
|
2
|
-
import { getAlpha } from "./alpha.mjs";
|
|
3
|
-
import { isColor } from "./is.mjs";
|
|
4
|
-
import { getColorFromRgb, getRgbValues } from "../space/rgb.mjs";
|
|
5
2
|
import { getColorFromHex, getNormalizedHex } from "../space/hex.mjs";
|
|
6
3
|
import { getColorFromHsl, getHslValues } from "../space/hsl.mjs";
|
|
7
4
|
import { getColorFromHwb, getHwbValues } from "../space/hwb.mjs";
|
|
8
|
-
|
|
5
|
+
import { getColorFromRgb, getRgbValues } from "../space/rgb.mjs";
|
|
6
|
+
import { getAlpha } from "./alpha.mjs";
|
|
7
|
+
import { isColor } from "./is.mjs";
|
|
8
|
+
// src/color/misc/state.ts
|
|
9
9
|
function getColorFromState(state, type) {
|
|
10
10
|
const { origin } = state;
|
|
11
11
|
if (type === origin) return state[origin];
|
|
@@ -85,5 +85,4 @@ const getters = {
|
|
|
85
85
|
hwb: getColorFromHwb,
|
|
86
86
|
rgb: getColorFromRgb
|
|
87
87
|
};
|
|
88
|
-
//#endregion
|
|
89
88
|
export { getColorFromState, getColorState, getStateValue, setStateValue };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ColorState, ColorType, HSLAColor, HSLColor, HWBAColor, HWBColor, InternalColor, RGBAColor, RGBColor } from "../../models/color.model.mjs";
|
|
2
|
-
//#region src/color/space/hex.d.ts
|
|
3
2
|
export declare function getColorFromHex<Type extends ColorType>(state: ColorState, type: Type): NonNullable<ColorState[Type]>;
|
|
4
3
|
export declare function getHexColor(this: InternalColor): string;
|
|
5
4
|
export declare function getHexaColor(this: InternalColor): string;
|
|
@@ -76,5 +75,4 @@ export declare function hexToRgb(value: string): RGBColor;
|
|
|
76
75
|
*/
|
|
77
76
|
export declare function hexToRgba(value: string): RGBAColor;
|
|
78
77
|
export declare function setHexValue(this: InternalColor, value: string): void;
|
|
79
|
-
export declare function setHexaValue(this: InternalColor, value: string): void;
|
|
80
|
-
//#endregion
|
|
78
|
+
export declare function setHexaValue(this: InternalColor, value: string): void;
|
package/dist/color/space/hex.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import { join } from "../../internal/string/misc.mjs";
|
|
|
2
2
|
import { COLOR_ALPHA, COLOR_DEFAULTS, COLOR_EXPRESSION, COLOR_LENGTHS, COLOR_MAX, COLOR_SYMBOL, COLOR_TYPE } from "../constants.mjs";
|
|
3
3
|
import { getHexValue, getPercentage } from "../misc/get.mjs";
|
|
4
4
|
import { isHexColor } from "../misc/is.mjs";
|
|
5
|
-
import { convertRgbToHsla, convertRgbToHwba } from "./rgb.mjs";
|
|
6
5
|
import { getStateValue, setStateValue } from "../misc/state.mjs";
|
|
7
|
-
|
|
6
|
+
import { convertRgbToHsla, convertRgbToHwba } from "./rgb.mjs";
|
|
7
|
+
// src/color/space/hex.ts
|
|
8
8
|
function convertHexToRgba(value) {
|
|
9
9
|
const normalized = getNormalizedHex(value, true);
|
|
10
10
|
const pairs = COLOR_EXPRESSION.hexLong.exec(normalized);
|
|
@@ -157,5 +157,4 @@ function setHexValueInState(instance, value, alpha) {
|
|
|
157
157
|
function setHexaValue(value) {
|
|
158
158
|
setHexValueInState(this, value, true);
|
|
159
159
|
}
|
|
160
|
-
//#endregion
|
|
161
160
|
export { getColorFromHex, getHexColor, getHexaColor, getNormalizedHex, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, setHexValue, setHexaValue };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ColorState, ColorType, HSLAColor, HSLColor, HWBAColor, HWBColor, InternalColor, RGBAColor, RGBColor } from "../../models/color.model.mjs";
|
|
2
|
-
//#region src/color/space/hsl.d.ts
|
|
3
2
|
export declare function getColorFromHsl<Type extends ColorType>(state: ColorState, type: Type): NonNullable<ColorState[Type]>;
|
|
4
3
|
export declare function getHslValue(this: InternalColor): HSLColor;
|
|
5
4
|
export declare function getHslaValue(this: InternalColor): HSLAColor;
|
|
@@ -55,5 +54,4 @@ export declare function hslToRgb(hsl: HSLAColor | HSLColor): RGBColor;
|
|
|
55
54
|
*/
|
|
56
55
|
export declare function hslToRgba(hsl: HSLAColor | HSLColor): RGBAColor;
|
|
57
56
|
export declare function setHslValue(this: InternalColor, value: unknown): void;
|
|
58
|
-
export declare function setHslaValue(this: InternalColor, value: unknown): void;
|
|
59
|
-
//#endregion
|
|
57
|
+
export declare function setHslaValue(this: InternalColor, value: unknown): void;
|
package/dist/color/space/hsl.mjs
CHANGED
|
@@ -3,9 +3,9 @@ import { COLOR_DEFAULTS, COLOR_MAX, COLOR_TYPE } from "../constants.mjs";
|
|
|
3
3
|
import { getAlphaValue } from "../misc/alpha.mjs";
|
|
4
4
|
import { getDegrees, getHexValue, getPercentage } from "../misc/get.mjs";
|
|
5
5
|
import { isHslLike } from "../misc/is.mjs";
|
|
6
|
-
import { convertRgbToHex } from "./rgb.mjs";
|
|
7
6
|
import { getStateValue, setStateValue } from "../misc/state.mjs";
|
|
8
|
-
|
|
7
|
+
import { convertRgbToHex } from "./rgb.mjs";
|
|
8
|
+
// src/color/space/hsl.ts
|
|
9
9
|
function convertHslToHwba(input) {
|
|
10
10
|
let { hue, lightness, saturation } = isHslLike(input) ? getHslValues(input) : { ...COLOR_DEFAULTS.hsl };
|
|
11
11
|
lightness /= COLOR_MAX.percent;
|
|
@@ -150,5 +150,4 @@ function setHSLValueInState(instance, value, alpha) {
|
|
|
150
150
|
function setHslaValue(value) {
|
|
151
151
|
setHSLValueInState(this, value, true);
|
|
152
152
|
}
|
|
153
|
-
//#endregion
|
|
154
153
|
export { getColorFromHsl, getHslValue, getHslValues, getHslaValue, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, setHslValue, setHslaValue };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ColorState, ColorType, HSLAColor, HSLColor, HWBAColor, HWBColor, InternalColor, RGBAColor, RGBColor } from "../../models/color.model.mjs";
|
|
2
|
-
//#region src/color/space/hwb.d.ts
|
|
3
2
|
export declare function convertHwbToHsl(input: HWBAColor | HWBColor): HSLAColor;
|
|
4
3
|
export declare function getColorFromHwb<Type extends ColorType>(state: ColorState, type: Type): NonNullable<ColorState[Type]>;
|
|
5
4
|
export declare function getHwbValue(this: InternalColor): HWBColor;
|
|
@@ -52,5 +51,4 @@ export declare function hwbToRgb(hwb: HWBAColor | HWBColor): RGBColor;
|
|
|
52
51
|
*/
|
|
53
52
|
export declare function hwbToRgba(hwb: HWBAColor | HWBColor): RGBAColor;
|
|
54
53
|
export declare function setHwbValue(this: InternalColor, value: unknown): void;
|
|
55
|
-
export declare function setHwbaValue(this: InternalColor, value: unknown): void;
|
|
56
|
-
//#endregion
|
|
54
|
+
export declare function setHwbaValue(this: InternalColor, value: unknown): void;
|
package/dist/color/space/hwb.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import { COLOR_DEFAULTS, COLOR_MAX, COLOR_TYPE } from "../constants.mjs";
|
|
|
3
3
|
import { getAlphaValue } from "../misc/alpha.mjs";
|
|
4
4
|
import { getDegrees, getPercentage } from "../misc/get.mjs";
|
|
5
5
|
import { isHwbLike } from "../misc/is.mjs";
|
|
6
|
-
import { rgbToHex } from "./rgb.mjs";
|
|
7
|
-
import { hslToRgb, hslToRgba } from "./hsl.mjs";
|
|
8
6
|
import { getStateValue, setStateValue } from "../misc/state.mjs";
|
|
9
|
-
|
|
7
|
+
import { hslToRgb, hslToRgba } from "./hsl.mjs";
|
|
8
|
+
import { rgbToHex } from "./rgb.mjs";
|
|
9
|
+
// src/color/space/hwb.ts
|
|
10
10
|
function convertHwbToHsl(input) {
|
|
11
11
|
let { blackness, hue, whiteness } = isHwbLike(input) ? getHwbValues(input) : COLOR_DEFAULTS.hwb;
|
|
12
12
|
blackness /= COLOR_MAX.percent;
|
|
@@ -129,5 +129,4 @@ function setHwbColorValueInState(instance, value, alpha) {
|
|
|
129
129
|
function setHwbaValue(value) {
|
|
130
130
|
setHwbColorValueInState(this, value, true);
|
|
131
131
|
}
|
|
132
|
-
//#endregion
|
|
133
132
|
export { convertHwbToHsl, getColorFromHwb, getHwbValue, getHwbValues, getHwbaValue, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, setHwbValue, setHwbaValue };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ColorState, ColorType, HSLAColor, HSLColor, HWBAColor, HWBColor, InternalColor, RGBAColor, RGBColor } from "../../models/color.model.mjs";
|
|
2
|
-
//#region src/color/space/rgb.d.ts
|
|
3
2
|
export declare function convertRgbToHex(rgb: RGBAColor | RGBColor, alpha: boolean): string;
|
|
4
3
|
export declare function convertRgbToHsla(value: unknown): HSLAColor;
|
|
5
4
|
export declare function convertRgbToHwba(value: unknown): HWBAColor;
|
|
@@ -62,5 +61,4 @@ export declare function rgbToHwb(rgb: RGBAColor | RGBColor): HWBColor;
|
|
|
62
61
|
*/
|
|
63
62
|
export declare function rgbToHwba(rgb: RGBAColor | RGBColor): HWBAColor;
|
|
64
63
|
export declare function setRgbValue(this: InternalColor, value: unknown): void;
|
|
65
|
-
export declare function setRgbaValue(this: InternalColor, value: unknown): void;
|
|
66
|
-
//#endregion
|
|
64
|
+
export declare function setRgbaValue(this: InternalColor, value: unknown): void;
|
package/dist/color/space/rgb.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { getAlpha, getAlphaValue } from "../misc/alpha.mjs";
|
|
|
5
5
|
import { getHexValue } from "../misc/get.mjs";
|
|
6
6
|
import { isRgbLike } from "../misc/is.mjs";
|
|
7
7
|
import { getStateValue, setStateValue } from "../misc/state.mjs";
|
|
8
|
-
|
|
8
|
+
// src/color/space/rgb.ts
|
|
9
9
|
function convertRgbToHex(rgb, alpha) {
|
|
10
10
|
const hex = `${join([
|
|
11
11
|
rgb.red,
|
|
@@ -196,5 +196,4 @@ function setRgbColorValueInState(instance, value, alpha) {
|
|
|
196
196
|
function setRgbaValue(value) {
|
|
197
197
|
setRgbColorValueInState(this, value, true);
|
|
198
198
|
}
|
|
199
|
-
//#endregion
|
|
200
199
|
export { convertRgbToHex, convertRgbToHsla, convertRgbToHwba, getColorFromRgb, getRgbColor, getRgbValues, getRgbaColor, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, setRgbValue, setRgbaValue };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GenericAsyncCallback, GenericCallback } from "../models/index.mjs";
|
|
2
1
|
import { AsyncLimiter, Limiter } from "../models/function/limiter.model.mjs";
|
|
3
|
-
|
|
2
|
+
import { GenericAsyncCallback, GenericCallback } from "../models/index.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* Debounce a function, ensuring it is only called after `time` milliseconds have passed
|
|
6
5
|
*
|
|
@@ -51,5 +50,4 @@ export declare namespace debounce {
|
|
|
51
50
|
export declare namespace throttle {
|
|
52
51
|
export var async: typeof asyncThrottle;
|
|
53
52
|
}
|
|
54
|
-
//#endregion
|
|
55
53
|
export type { AsyncLimiter, Limiter };
|
package/dist/function/limit.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LIMITER_DEBOUNCE, LIMITER_THROTTLE } from "../models/function/limiter.model.mjs";
|
|
2
1
|
import { getAsyncLimiter, getLimiter } from "../internal/function/limit.mjs";
|
|
3
|
-
|
|
2
|
+
import { LIMITER_DEBOUNCE, LIMITER_THROTTLE } from "../models/function/limiter.model.mjs";
|
|
3
|
+
// src/function/limit.ts
|
|
4
4
|
/**
|
|
5
5
|
* Debounce a function, ensuring it is only called after `time` milliseconds have passed
|
|
6
6
|
*
|
|
@@ -55,5 +55,4 @@ function throttle(callback, time) {
|
|
|
55
55
|
}
|
|
56
56
|
debounce.async = asyncDebounce;
|
|
57
57
|
throttle.async = asyncThrottle;
|
|
58
|
-
//#endregion
|
|
59
58
|
export { asyncDebounce, asyncThrottle, debounce, throttle };
|
package/dist/function/once.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GenericAsyncCallback, GenericCallback } from "../models/index.mjs";
|
|
2
1
|
import { AsyncOnce, Once } from "../models/function/once.model.mjs";
|
|
3
|
-
|
|
2
|
+
import { GenericAsyncCallback, GenericCallback } from "../models/index.mjs";
|
|
4
3
|
declare function AsyncOnce(this: any, callback: GenericAsyncCallback): void;
|
|
5
4
|
declare function Once(this: any, callback: GenericCallback): void;
|
|
6
5
|
/**
|
|
@@ -41,5 +40,4 @@ export declare namespace once {
|
|
|
41
40
|
export var is: typeof isOnce;
|
|
42
41
|
export var isAsync: typeof isAsyncOnce;
|
|
43
42
|
}
|
|
44
|
-
//#endregion
|
|
45
43
|
export type { AsyncOnce, Once };
|
package/dist/function/once.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert } from "../internal/function/assert.mjs";
|
|
2
|
-
import { ONCE_MESSAGE_CLEARED, ONCE_MESSAGE_EXPECTATION, ONCE_NAME_ASYNC, ONCE_NAME_SYNC,
|
|
3
|
-
|
|
2
|
+
import { ONCE_MESSAGE_CLEARED, ONCE_MESSAGE_EXPECTATION, ONCE_NAME_ASYNC, ONCE_NAME_SYNC, ONCE_SYMBOL } from "../models/function/once.model.mjs";
|
|
3
|
+
// src/function/once.ts
|
|
4
4
|
function AsyncOnce(callback) {
|
|
5
5
|
this[ONCE_SYMBOL] = {
|
|
6
6
|
callback,
|
|
@@ -9,10 +9,10 @@ function AsyncOnce(callback) {
|
|
|
9
9
|
error: false,
|
|
10
10
|
finished: false,
|
|
11
11
|
items: [],
|
|
12
|
+
type: ONCE_NAME_ASYNC,
|
|
12
13
|
value: void 0
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
AsyncOnce.prototype[ONCE_PROPERTY] = ONCE_NAME_ASYNC;
|
|
16
16
|
AsyncOnce.prototype.clear = clearOnce;
|
|
17
17
|
AsyncOnce.prototype.run = runOnceAsync;
|
|
18
18
|
Object.defineProperties(AsyncOnce.prototype, {
|
|
@@ -38,10 +38,10 @@ function Once(callback) {
|
|
|
38
38
|
callback,
|
|
39
39
|
called: false,
|
|
40
40
|
cleared: false,
|
|
41
|
+
type: ONCE_NAME_SYNC,
|
|
41
42
|
value: void 0
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
Once.prototype[ONCE_PROPERTY] = ONCE_NAME_SYNC;
|
|
45
45
|
Once.prototype.clear = clearOnce;
|
|
46
46
|
Once.prototype.run = runOnce;
|
|
47
47
|
Object.defineProperties(Once.prototype, {
|
|
@@ -104,7 +104,7 @@ function handleOnceResult(state, value, error) {
|
|
|
104
104
|
* @returns `true` if the value is an asynchronous once callback, otherwise `false`
|
|
105
105
|
*/
|
|
106
106
|
function isAsyncOnce(value) {
|
|
107
|
-
return isOnceInstance(
|
|
107
|
+
return isOnceInstance(ONCE_NAME_ASYNC, value);
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Is the value a once callback?
|
|
@@ -113,10 +113,10 @@ function isAsyncOnce(value) {
|
|
|
113
113
|
* @returns `true` if the value is a once callback, otherwise `false`
|
|
114
114
|
*/
|
|
115
115
|
function isOnce(value) {
|
|
116
|
-
return isOnceInstance(
|
|
116
|
+
return isOnceInstance(ONCE_NAME_SYNC, value);
|
|
117
117
|
}
|
|
118
|
-
function isOnceInstance(
|
|
119
|
-
return typeof value === "object" && value !== null &&
|
|
118
|
+
function isOnceInstance(type, value) {
|
|
119
|
+
return typeof value === "object" && value !== null && ONCE_SYMBOL in value && value[ONCE_SYMBOL].type === type;
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Create a function that can only be called once, returning the same value on subsequent calls
|
|
@@ -163,5 +163,4 @@ asyncOnce.is = isAsyncOnce;
|
|
|
163
163
|
once.async = asyncOnce;
|
|
164
164
|
once.is = isOnce;
|
|
165
165
|
once.isAsync = isAsyncOnce;
|
|
166
|
-
//#endregion
|
|
167
166
|
export { asyncOnce, isAsyncOnce, isOnce, once };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GenericAsyncCallback, GenericCallback } from "../models/index.mjs";
|
|
2
1
|
import { RetryError, RetryOptions } from "../models/function/retry.model.mjs";
|
|
3
|
-
|
|
2
|
+
import { GenericAsyncCallback, GenericCallback } from "../models/index.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* Retry a callback a specified number of times, with a delay between attempts
|
|
6
5
|
*
|
|
@@ -32,5 +31,4 @@ export declare function retry<Callback extends GenericCallback>(callback: Callba
|
|
|
32
31
|
export declare namespace retry {
|
|
33
32
|
export var async: typeof asyncRetry;
|
|
34
33
|
}
|
|
35
|
-
//#endregion
|
|
36
34
|
export { RetryError };
|
package/dist/function/retry.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { getNumberOrDefault } from "../internal/defaults.mjs";
|
|
2
|
+
import { getLimiter } from "../internal/function/limit.mjs";
|
|
1
3
|
import { isPlainObject } from "../internal/is.mjs";
|
|
2
4
|
import { asyncAttempt, attempt } from "../internal/result/attempt.mjs";
|
|
3
5
|
import { LIMITER_WAIT } from "../models/function/limiter.model.mjs";
|
|
4
|
-
import { getNumberOrDefault } from "../internal/defaults.mjs";
|
|
5
|
-
import { getLimiter } from "../internal/function/limit.mjs";
|
|
6
6
|
import { RETRY_MESSAGE_EXPECTATION, RETRY_MESSAGE_FAILED, RetryError } from "../models/function/retry.model.mjs";
|
|
7
|
-
|
|
7
|
+
// src/function/retry.ts
|
|
8
8
|
/**
|
|
9
9
|
* Retry a callback a specified number of times, with a delay between attempts
|
|
10
10
|
*
|
|
@@ -17,12 +17,12 @@ import { RETRY_MESSAGE_EXPECTATION, RETRY_MESSAGE_FAILED, RetryError } from "../
|
|
|
17
17
|
async function asyncRetry(callback, options) {
|
|
18
18
|
if (typeof callback !== "function") throw new TypeError(RETRY_MESSAGE_EXPECTATION);
|
|
19
19
|
async function handle() {
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
resolver(
|
|
20
|
+
const attempted = await asyncAttempt(async () => callback());
|
|
21
|
+
if (attempted.ok) {
|
|
22
|
+
resolver(attempted.value);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
if (attempts >= times || !when(
|
|
25
|
+
if (attempts >= times || !when(attempted.error)) rejector(new RetryError(RETRY_MESSAGE_FAILED, attempted.error));
|
|
26
26
|
else {
|
|
27
27
|
attempts += 1;
|
|
28
28
|
limiter.run();
|
|
@@ -59,10 +59,10 @@ function retry(callback, options) {
|
|
|
59
59
|
const { times, when } = createRetryOptions(options);
|
|
60
60
|
let last;
|
|
61
61
|
for (let index = 0; index <= times; index += 1) {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
if (index >= times || !when(
|
|
65
|
-
last =
|
|
62
|
+
const attempted = attempt(callback);
|
|
63
|
+
if (attempted.ok) return attempted.value;
|
|
64
|
+
if (index >= times || !when(attempted.error)) {
|
|
65
|
+
last = attempted.error;
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -72,5 +72,4 @@ function shouldRetry() {
|
|
|
72
72
|
return true;
|
|
73
73
|
}
|
|
74
74
|
retry.async = asyncRetry;
|
|
75
|
-
//#endregion
|
|
76
75
|
export { RetryError, retry };
|
package/dist/herald.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { herald, isHerald, isHeraldEvents } from "./internal/herald.mjs";
|
|
1
2
|
import { Herald, HeraldEvents, HeraldOptions } from "./models/herald.model.mjs";
|
|
2
|
-
|
|
3
|
-
export { type Herald, type HeraldEvents, type HeraldOptions, herald, isHerald, isHeraldEvents, isHeraldSubscription };
|
|
3
|
+
export { type Herald, type HeraldEvents, type HeraldOptions, herald, isHerald, isHeraldEvents };
|
package/dist/herald.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { herald, isHerald, isHeraldEvents
|
|
1
|
+
export { herald, isHerald, isHeraldEvents } from "./internal/herald.mjs";
|