@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.
Files changed (57) hide show
  1. package/dist/beacon.d.mts +6 -44
  2. package/dist/beacon.mjs +20 -67
  3. package/dist/color/constants.d.mts +82 -35
  4. package/dist/color/constants.mjs +106 -61
  5. package/dist/color/index.d.mts +3 -3
  6. package/dist/color/index.mjs +2 -2
  7. package/dist/color/instance.mjs +60 -35
  8. package/dist/color/misc/alpha.d.mts +1 -1
  9. package/dist/color/misc/alpha.mjs +12 -10
  10. package/dist/color/misc/format.d.mts +7 -0
  11. package/dist/color/misc/format.mjs +20 -0
  12. package/dist/color/misc/get.mjs +25 -25
  13. package/dist/color/misc/is.d.mts +0 -36
  14. package/dist/color/misc/is.mjs +22 -57
  15. package/dist/color/misc/state.d.mts +8 -6
  16. package/dist/color/misc/state.mjs +79 -88
  17. package/dist/color/models.d.mts +106 -6
  18. package/dist/color/space/hex.d.mts +3 -2
  19. package/dist/color/space/hex.mjs +22 -10
  20. package/dist/color/space/hsl.d.mts +3 -2
  21. package/dist/color/space/hsl.mjs +26 -14
  22. package/dist/color/space/hwb.d.mts +3 -2
  23. package/dist/color/space/hwb.mjs +20 -8
  24. package/dist/color/space/rgb.d.mts +3 -2
  25. package/dist/color/space/rgb.mjs +27 -15
  26. package/dist/herald.d.mts +2 -3
  27. package/dist/index.d.mts +139 -73
  28. package/dist/index.mjs +653 -477
  29. package/dist/internal/subscription.d.mts +52 -0
  30. package/dist/internal/subscription.mjs +127 -0
  31. package/dist/models.d.mts +5 -1
  32. package/package.json +4 -4
  33. package/src/beacon.ts +32 -117
  34. package/src/color/constants.ts +115 -66
  35. package/src/color/index.ts +26 -8
  36. package/src/color/instance.ts +113 -45
  37. package/src/color/misc/alpha.ts +18 -20
  38. package/src/color/misc/format.ts +29 -0
  39. package/src/color/misc/get.ts +31 -41
  40. package/src/color/misc/is.ts +31 -71
  41. package/src/color/misc/state.ts +165 -141
  42. package/src/color/models.ts +126 -5
  43. package/src/color/space/hex.ts +46 -18
  44. package/src/color/space/hsl.ts +44 -14
  45. package/src/color/space/hwb.ts +38 -8
  46. package/src/color/space/rgb.ts +48 -15
  47. package/src/herald.ts +1 -3
  48. package/src/index.ts +1 -0
  49. package/src/internal/subscription.ts +264 -0
  50. package/src/models.ts +5 -0
  51. package/src/string/fuzzy.ts +1 -1
  52. package/src/value/freeze.ts +2 -2
  53. package/src/value/shake.ts +1 -1
  54. package/src/value/transform.ts +1 -1
  55. package/dist/color/misc/index.d.mts +0 -7
  56. package/dist/color/misc/index.mjs +0 -15
  57. package/src/color/misc/index.ts +0 -29
package/dist/beacon.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Subscription } from "./internal/subscription.mjs";
1
2
  //#region src/beacon.d.ts
2
3
  /**
3
4
  * A beacon is a lighthouse, holding an observable value that can be subscribed to and emitted from
@@ -7,10 +8,6 @@ type Beacon<Value> = {
7
8
  * Is the beacon active?
8
9
  */
9
10
  get active(): boolean;
10
- /**
11
- * Is the beacon closed?
12
- */
13
- get closed(): boolean;
14
11
  /**
15
12
  * The observable that can be subscribed to
16
13
  */
@@ -20,9 +17,9 @@ type Beacon<Value> = {
20
17
  */
21
18
  get value(): Value;
22
19
  /**
23
- * Close the beacon
20
+ * Deactivate the beacon
24
21
  */
25
- close(): void;
22
+ deactivate(): void;
26
23
  /**
27
24
  * Emit a new value
28
25
  *
@@ -42,9 +39,6 @@ type Beacon<Value> = {
42
39
  */
43
40
  finish(): void;
44
41
  };
45
- /**
46
- * Options for Beacon
47
- */
48
42
  type BeaconOptions<Value> = {
49
43
  /**
50
44
  * Method for comparing values for equality
@@ -62,13 +56,9 @@ type Observable<Value> = {
62
56
  */
63
57
  get active(): boolean;
64
58
  /**
65
- * Is the observable closed?
66
- */
67
- get closed(): boolean;
68
- /**
69
- * Close the observable
59
+ * Deactivate the observable
70
60
  */
71
- close(): void;
61
+ deactivate(): void;
72
62
  /**
73
63
  * Subscribe to value changes
74
64
  *
@@ -86,9 +76,6 @@ type Observable<Value> = {
86
76
  */
87
77
  subscribe(observer: Observer<Value>): Subscription;
88
78
  };
89
- /**
90
- * An observer receives notifications from an observable
91
- */
92
79
  type Observer<Value> = {
93
80
  /**
94
81
  * Callback for when the observable is completed
@@ -103,24 +90,6 @@ type Observer<Value> = {
103
90
  */
104
91
  next?: (value: Value) => void;
105
92
  };
106
- type Subscription = {
107
- /**
108
- * Is the subscription active?
109
- */
110
- get active(): boolean;
111
- /**
112
- * Is the subscription closed?
113
- */
114
- get closed(): boolean;
115
- /**
116
- * Close the subscription
117
- */
118
- close(): void;
119
- /**
120
- * Unsubscribe from its observable
121
- */
122
- unsubscribe(): void;
123
- };
124
93
  /**
125
94
  * Create a new beacon
126
95
  *
@@ -143,12 +112,5 @@ declare function isBeacon<Value = unknown>(value: unknown): value is Beacon<Valu
143
112
  * @returns `true` if the value is an observable, otherwise `false`
144
113
  */
145
114
  declare function isObservable<Value = unknown>(value: unknown): value is Observable<Value>;
146
- /**
147
- * Is the value a subscription?
148
- *
149
- * @param value Value to check
150
- * @returns `true` if the value is a subscription, otherwise `false`
151
- */
152
- declare function isSubscription(value: unknown): value is Subscription;
153
115
  //#endregion
154
- export { Beacon, BeaconOptions, Observable, Subscription, beacon, isBeacon, isObservable, isSubscription };
116
+ export { Beacon, BeaconOptions, Observable, beacon, isBeacon, isObservable };
package/dist/beacon.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { noop } from "./internal/function/misc.mjs";
2
2
  import { isPlainObject } from "./internal/is.mjs";
3
+ import { clearSubscriptions, getSubscription, getSubscriptions } from "./internal/subscription.mjs";
3
4
  //#region src/beacon.ts
4
5
  /**
5
6
  * Create a new beacon
@@ -13,11 +14,11 @@ function beacon(value, options) {
13
14
  value,
14
15
  active: true,
15
16
  observable: void 0,
16
- observers: /* @__PURE__ */ new Map(),
17
- options: getBeaconOptions(options)
17
+ options: getBeaconOptions(options),
18
+ subscriptions: getSubscriptions()
18
19
  };
19
20
  const instance = {
20
- close: () => {
21
+ deactivate: () => {
21
22
  finishBeacon(state, false);
22
23
  },
23
24
  emit: (value, finish) => {
@@ -39,10 +40,6 @@ function beacon(value, options) {
39
40
  enumerable: true,
40
41
  get: () => state.active
41
42
  },
42
- closed: {
43
- enumerable: true,
44
- get: () => !state.active
45
- },
46
43
  observable: {
47
44
  enumerable: true,
48
45
  get: () => {
@@ -61,15 +58,9 @@ function beacon(value, options) {
61
58
  function finishBeacon(state, emit) {
62
59
  if (!state.active) return;
63
60
  state.active = false;
64
- const entries = [...state.observers.entries()];
65
- const { length } = entries;
66
- for (let index = 0; index < length; index += 1) {
67
- const [subscription, observer] = entries[index];
68
- if (emit) observer.complete?.();
69
- subscription.close();
70
- }
71
- state.observable?.close();
72
- state.observers.clear();
61
+ for (const [, observer] of state.subscriptions.values.to.any) if (emit) observer.complete?.();
62
+ clearSubscriptions(state.subscriptions);
63
+ state.observable?.deactivate();
73
64
  state.observable = void 0;
74
65
  }
75
66
  function getBeaconOptions(input) {
@@ -115,29 +106,24 @@ function isBeaconInstance(name, value) {
115
106
  function isObservable(value) {
116
107
  return isBeaconInstance(NAME_OBSERVABLE, value);
117
108
  }
118
- /**
119
- * Is the value a subscription?
120
- *
121
- * @param value Value to check
122
- * @returns `true` if the value is a subscription, otherwise `false`
123
- */
124
- function isSubscription(value) {
125
- return isBeaconInstance(NAME_SUBSCRIPTION, value);
126
- }
127
109
  function observe(beacon) {
128
110
  const state = {
129
111
  beacon,
130
112
  active: beacon.active
131
113
  };
132
114
  const instance = {
133
- close: () => {
115
+ deactivate: () => {
134
116
  state.active = false;
135
117
  },
136
118
  subscribe(first, second, third) {
137
119
  if (!beacon.active || !state.active) throw new Error(MESSAGE_OBSERVABLE);
138
120
  const observer = getObserver(first, second, third);
139
- const subscription = subscribe(state);
140
- beacon.observers.set(subscription, observer);
121
+ const subscription = getSubscription({
122
+ isActive: () => beacon.active && state.active,
123
+ property: beaconSubscription,
124
+ subscriptions: beacon.subscriptions,
125
+ value: observer
126
+ });
141
127
  observer.next?.(beacon.value);
142
128
  return subscription;
143
129
  }
@@ -150,42 +136,6 @@ function observe(beacon) {
150
136
  active: {
151
137
  enumerable: true,
152
138
  get: () => beacon.active && state.active
153
- },
154
- closed: {
155
- enumerable: true,
156
- get: () => !beacon.active || !state.active
157
- }
158
- });
159
- return Object.freeze(instance);
160
- }
161
- function subscribe(observable) {
162
- function unsubscribe() {
163
- if (active) {
164
- active = false;
165
- observable.beacon.observers.delete(instance);
166
- }
167
- }
168
- let active = true;
169
- const instance = {
170
- close: () => {
171
- unsubscribe();
172
- },
173
- unsubscribe: () => {
174
- unsubscribe();
175
- }
176
- };
177
- Object.defineProperties(instance, {
178
- [KEY_BEACON]: {
179
- enumerable: false,
180
- value: NAME_SUBSCRIPTION
181
- },
182
- active: {
183
- enumerable: true,
184
- get: () => observable.beacon.active && observable.active && active
185
- },
186
- closed: {
187
- enumerable: true,
188
- get: () => !observable.beacon.active || !observable.active || !active
189
139
  }
190
140
  });
191
141
  return Object.freeze(instance);
@@ -196,7 +146,7 @@ function update(type, state, value, finish) {
196
146
  if (state.options.equal(state.value, value)) return;
197
147
  state.value = value;
198
148
  }
199
- for (const [, observer] of state.observers) observer[type]?.(value);
149
+ for (const [, observer] of state.subscriptions.values.to.any) observer[type]?.(value);
200
150
  if (finish === true) finishBeacon(state, true);
201
151
  }
202
152
  const KEY_BEACON = "$beacon";
@@ -204,8 +154,11 @@ const MESSAGE_BEACON = "Cannot retrieve observable from a closed beacon";
204
154
  const MESSAGE_OBSERVABLE = "Cannot subscribe to a closed observable";
205
155
  const NAME_BEACON = "beacon";
206
156
  const NAME_OBSERVABLE = "observable";
207
- const NAME_SUBSCRIPTION = "subscription";
208
157
  const TYPE_ERROR = "error";
209
158
  const TYPE_NEXT = "next";
159
+ const beaconSubscription = {
160
+ key: KEY_BEACON,
161
+ value: "subscription"
162
+ };
210
163
  //#endregion
211
- export { beacon, isBeacon, isObservable, isSubscription };
164
+ export { beacon, isBeacon, isObservable };
@@ -1,37 +1,84 @@
1
- import { Alpha, HSLAColor, HSLColor, HWBAColor, HWBColor, RGBAColor, RGBColor } from "./models.mjs";
1
+ import { ColorTypeExtended, HSLAColor, HSLColor, HWBAColor, HWBColor, RGBAColor, RGBColor } from "./models.mjs";
2
2
  //#region src/color/constants.d.ts
3
- declare const ALPHA_FULL_HEX_SHORT = "f";
4
- declare const ALPHA_FULL_HEX_LONG = "ff";
5
- declare const ALPHA_NONE_HEX = "00";
6
- declare const ALPHA_NONE_VALUE = 0;
7
- declare const DEFAULT_ALPHA: Alpha;
8
- declare const DEFAULT_HSL: HSLColor;
9
- declare const DEFAULT_HWB: HWBColor;
10
- declare const DEFAULT_RGB: RGBColor;
11
- declare const EXPRESSION_HEX_LONG: RegExp;
12
- declare const EXPRESSION_HEX_SHORT: RegExp;
13
- declare const EXPRESSION_PREFIX: RegExp;
14
- declare const HEX_BLACK = "000000";
15
- declare const HEX_WHITE = "ffffff";
16
- declare const LENGTH_LONG = 6;
17
- declare const LENGTH_SHORT = 3;
18
- declare const KEYS_HSL: Array<keyof HSLColor>;
19
- declare const KEYS_HSLA: Array<keyof HSLAColor>;
20
- declare const KEYS_HWB: Array<keyof HWBColor>;
21
- declare const KEYS_HWBA: Array<keyof HWBAColor>;
22
- declare const KEYS_RGB: Array<keyof RGBColor>;
23
- declare const KEYS_RGBA: Array<keyof RGBAColor>;
24
- declare const MAX_DEGREE = 360;
25
- declare const MAX_HEX = 255;
26
- declare const MAX_PERCENT = 100;
27
- declare const SRGB_LUMINANCE_BLUE = 0.0722;
28
- declare const SRGB_LUMINANCE_EXPONENT = 2.4;
29
- declare const SRGB_LUMINANCE_GREEN = 0.7152;
30
- declare const SRGB_LUMINANCE_MINIMUM = 0.03928;
31
- declare const SRGB_LUMINANCE_MODIFIER = 1.055;
32
- declare const SRGB_LUMINANCE_MULTIPLIER = 12.92;
33
- declare const SRGB_LUMINANCE_OFFSET = 0.055;
34
- declare const SRGB_LUMINANCE_RED = 0.2126;
35
- declare const SRGB_LUMINANCE_THRESHOLD = 0.625;
3
+ type ColorTypes = {
4
+ all: Set<'alpha' | ColorTypeExtended>;
5
+ hex: 'hex';
6
+ hexa: 'hexa';
7
+ hsl: 'hsl';
8
+ hsla: 'hsla';
9
+ hwb: 'hwb';
10
+ hwba: 'hwba';
11
+ rgb: 'rgb';
12
+ rgba: 'rgba';
13
+ };
14
+ declare const COLOR_ALPHA: {
15
+ fullHexShort: string;
16
+ fullHexLong: string;
17
+ name: string;
18
+ noneHex: string;
19
+ noneValue: number;
20
+ };
21
+ declare const COLOR_DEFAULTS: {
22
+ alpha: {
23
+ hex: string;
24
+ value: number;
25
+ };
26
+ hexBlack: string;
27
+ hexWhite: string;
28
+ hsl: {
29
+ hue: number;
30
+ saturation: number;
31
+ lightness: number;
32
+ };
33
+ hwb: {
34
+ hue: number;
35
+ whiteness: number;
36
+ blackness: number;
37
+ };
38
+ rgb: {
39
+ blue: number;
40
+ green: number;
41
+ red: number;
42
+ };
43
+ };
44
+ declare const COLOR_EXPRESSION: {
45
+ alphaHex: RegExp;
46
+ hexLong: RegExp;
47
+ hexShort: RegExp;
48
+ prefix: RegExp;
49
+ };
50
+ declare const COLOR_LENGTHS: {
51
+ hexLong: number;
52
+ hexShort: number;
53
+ };
54
+ declare const COLOR_KEYS: {
55
+ hsl: Array<keyof HSLColor>;
56
+ hsla: Array<keyof HSLAColor>;
57
+ hwb: Array<keyof HWBColor>;
58
+ hwba: Array<keyof HWBAColor>;
59
+ rgb: Array<keyof RGBColor>;
60
+ rgba: Array<keyof RGBAColor>;
61
+ };
62
+ declare const COLOR_MAX: {
63
+ degree: number;
64
+ hex: number;
65
+ percent: number;
66
+ };
67
+ declare const COLOR_PROPERTY: {
68
+ name: string;
69
+ subscription: string;
70
+ };
71
+ declare const COLOR_TYPE: ColorTypes;
72
+ declare const COLOR_SRGB: {
73
+ luminanceBlue: number;
74
+ luminanceExponent: number;
75
+ luminanceGreen: number;
76
+ luminanceMinimum: number;
77
+ luminanceModifier: number;
78
+ luminanceMultiplier: number;
79
+ luminanceOffset: number;
80
+ luminanceRed: number;
81
+ luminanceThreshold: number;
82
+ };
36
83
  //#endregion
37
- export { ALPHA_FULL_HEX_LONG, ALPHA_FULL_HEX_SHORT, ALPHA_NONE_HEX, ALPHA_NONE_VALUE, DEFAULT_ALPHA, DEFAULT_HSL, DEFAULT_HWB, DEFAULT_RGB, EXPRESSION_HEX_LONG, EXPRESSION_HEX_SHORT, EXPRESSION_PREFIX, HEX_BLACK, HEX_WHITE, KEYS_HSL, KEYS_HSLA, KEYS_HWB, KEYS_HWBA, KEYS_RGB, KEYS_RGBA, LENGTH_LONG, LENGTH_SHORT, MAX_DEGREE, MAX_HEX, MAX_PERCENT, SRGB_LUMINANCE_BLUE, SRGB_LUMINANCE_EXPONENT, SRGB_LUMINANCE_GREEN, SRGB_LUMINANCE_MINIMUM, SRGB_LUMINANCE_MODIFIER, SRGB_LUMINANCE_MULTIPLIER, SRGB_LUMINANCE_OFFSET, SRGB_LUMINANCE_RED, SRGB_LUMINANCE_THRESHOLD };
84
+ export { COLOR_ALPHA, COLOR_DEFAULTS, COLOR_EXPRESSION, COLOR_KEYS, COLOR_LENGTHS, COLOR_MAX, COLOR_PROPERTY, COLOR_SRGB, COLOR_TYPE };
@@ -1,63 +1,108 @@
1
1
  //#region src/color/constants.ts
2
- const ALPHA_FULL_HEX_SHORT = "f";
3
- const ALPHA_FULL_HEX_LONG = `ff`;
4
- const ALPHA_NONE_HEX = "00";
5
- const ALPHA_NONE_VALUE = 0;
6
- const DEFAULT_ALPHA = {
7
- hex: ALPHA_FULL_HEX_LONG,
8
- value: 100
9
- };
10
- const DEFAULT_HSL = {
11
- hue: 0,
12
- saturation: 0,
13
- lightness: 0
14
- };
15
- const DEFAULT_HWB = {
16
- hue: 0,
17
- whiteness: 0,
18
- blackness: 100
19
- };
20
- const DEFAULT_RGB = {
21
- blue: 0,
22
- green: 0,
23
- red: 0
24
- };
25
- const EXPRESSION_HEX_LONG = /^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?$/i;
26
- const EXPRESSION_HEX_SHORT = /^#?([a-f0-9]{3,4})$/i;
27
- const EXPRESSION_PREFIX = /^#/;
28
- const HEX_BLACK = "000000";
29
- const HEX_WHITE = "ffffff";
30
- const LENGTH_LONG = 6;
31
- const LENGTH_SHORT = 3;
32
- const KEYS_HSL = [
33
- "hue",
34
- "saturation",
35
- "lightness"
36
- ];
37
- const KEYS_HSLA = [...KEYS_HSL, "alpha"];
38
- const KEYS_HWB = [
39
- "hue",
40
- "whiteness",
41
- "blackness"
42
- ];
43
- const KEYS_HWBA = [...KEYS_HWB, "alpha"];
44
- const KEYS_RGB = [
45
- "red",
46
- "green",
47
- "blue"
48
- ];
49
- const KEYS_RGBA = [...KEYS_RGB, "alpha"];
50
- const MAX_DEGREE = 360;
51
- const MAX_HEX = 255;
52
- const MAX_PERCENT = 100;
53
- const SRGB_LUMINANCE_BLUE = .0722;
54
- const SRGB_LUMINANCE_EXPONENT = 2.4;
55
- const SRGB_LUMINANCE_GREEN = .7152;
56
- const SRGB_LUMINANCE_MINIMUM = .03928;
57
- const SRGB_LUMINANCE_MODIFIER = 1.055;
58
- const SRGB_LUMINANCE_MULTIPLIER = 12.92;
59
- const SRGB_LUMINANCE_OFFSET = .055;
60
- const SRGB_LUMINANCE_RED = .2126;
61
- const SRGB_LUMINANCE_THRESHOLD = .625;
2
+ const COLOR_ALPHA = {
3
+ fullHexShort: "f",
4
+ fullHexLong: "ff",
5
+ name: "alpha",
6
+ noneHex: "00",
7
+ noneValue: 0
8
+ };
9
+ const COLOR_DEFAULTS = {
10
+ alpha: {
11
+ hex: COLOR_ALPHA.fullHexLong,
12
+ value: 100
13
+ },
14
+ hexBlack: "000000",
15
+ hexWhite: "ffffff",
16
+ hsl: {
17
+ hue: 0,
18
+ saturation: 0,
19
+ lightness: 0
20
+ },
21
+ hwb: {
22
+ hue: 0,
23
+ whiteness: 0,
24
+ blackness: 100
25
+ },
26
+ rgb: {
27
+ blue: 0,
28
+ green: 0,
29
+ red: 0
30
+ }
31
+ };
32
+ const COLOR_EXPRESSION = {
33
+ alphaHex: /^([a-f0-9]{1,2})$/i,
34
+ hexLong: /^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?$/i,
35
+ hexShort: /^#?([a-f0-9]{3,4})$/i,
36
+ prefix: /^#/
37
+ };
38
+ const COLOR_LENGTHS = {
39
+ hexLong: 6,
40
+ hexShort: 3
41
+ };
42
+ const COLOR_KEYS = {
43
+ hsl: [
44
+ "hue",
45
+ "saturation",
46
+ "lightness"
47
+ ],
48
+ hsla: [],
49
+ hwb: [
50
+ "hue",
51
+ "whiteness",
52
+ "blackness"
53
+ ],
54
+ hwba: [],
55
+ rgb: [
56
+ "red",
57
+ "green",
58
+ "blue"
59
+ ],
60
+ rgba: []
61
+ };
62
+ COLOR_KEYS.hsla = [...COLOR_KEYS.hsl, COLOR_ALPHA.name];
63
+ COLOR_KEYS.hwba = [...COLOR_KEYS.hwb, COLOR_ALPHA.name];
64
+ COLOR_KEYS.rgba = [...COLOR_KEYS.rgb, COLOR_ALPHA.name];
65
+ const COLOR_MAX = {
66
+ degree: 360,
67
+ hex: 255,
68
+ percent: 100
69
+ };
70
+ const COLOR_PROPERTY = {
71
+ name: "$color",
72
+ subscription: "subscription"
73
+ };
74
+ const COLOR_TYPE = {
75
+ all: void 0,
76
+ hex: "hex",
77
+ hexa: "hexa",
78
+ hsl: "hsl",
79
+ hsla: "hsla",
80
+ hwb: "hwb",
81
+ hwba: "hwba",
82
+ rgb: "rgb",
83
+ rgba: "rgba"
84
+ };
85
+ COLOR_TYPE.all = /* @__PURE__ */ new Set([
86
+ COLOR_ALPHA.name,
87
+ COLOR_TYPE.hex,
88
+ COLOR_TYPE.hexa,
89
+ COLOR_TYPE.hsl,
90
+ COLOR_TYPE.hsla,
91
+ COLOR_TYPE.hwb,
92
+ COLOR_TYPE.hwba,
93
+ COLOR_TYPE.rgb,
94
+ COLOR_TYPE.rgba
95
+ ]);
96
+ const COLOR_SRGB = {
97
+ luminanceBlue: .0722,
98
+ luminanceExponent: 2.4,
99
+ luminanceGreen: .7152,
100
+ luminanceMinimum: .03928,
101
+ luminanceModifier: 1.055,
102
+ luminanceMultiplier: 12.92,
103
+ luminanceOffset: .055,
104
+ luminanceRed: .2126,
105
+ luminanceThreshold: .625
106
+ };
62
107
  //#endregion
63
- export { ALPHA_FULL_HEX_LONG, ALPHA_FULL_HEX_SHORT, ALPHA_NONE_HEX, ALPHA_NONE_VALUE, DEFAULT_ALPHA, DEFAULT_HSL, DEFAULT_HWB, DEFAULT_RGB, EXPRESSION_HEX_LONG, EXPRESSION_HEX_SHORT, EXPRESSION_PREFIX, HEX_BLACK, HEX_WHITE, KEYS_HSL, KEYS_HSLA, KEYS_HWB, KEYS_HWBA, KEYS_RGB, KEYS_RGBA, LENGTH_LONG, LENGTH_SHORT, MAX_DEGREE, MAX_HEX, MAX_PERCENT, SRGB_LUMINANCE_BLUE, SRGB_LUMINANCE_EXPONENT, SRGB_LUMINANCE_GREEN, SRGB_LUMINANCE_MINIMUM, SRGB_LUMINANCE_MODIFIER, SRGB_LUMINANCE_MULTIPLIER, SRGB_LUMINANCE_OFFSET, SRGB_LUMINANCE_RED, SRGB_LUMINANCE_THRESHOLD };
108
+ export { COLOR_ALPHA, COLOR_DEFAULTS, COLOR_EXPRESSION, COLOR_KEYS, COLOR_LENGTHS, COLOR_MAX, COLOR_PROPERTY, COLOR_SRGB, COLOR_TYPE };
@@ -1,6 +1,6 @@
1
- import { Color, HSLAColor, HSLColor, HWBAColor, HWBColor, RGBAColor, RGBColor } from "./models.mjs";
1
+ import { Color, ColorType, ColorTypeExtended, ColorValue, ColorValueExtended, HSLAColor, HSLColor, HWBAColor, HWBColor, RGBAColor, RGBColor } from "./models.mjs";
2
2
  import { getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getRgbColor, getRgbaColor } from "./misc/get.mjs";
3
- import { isColor, isHexColor, isHslColor, isHslLike, isHslaColor, isHwbColor, isHwbLike, isHwbaColor, isHwbaLike, isRgbColor, isRgbLike, isRgbaColor } from "./misc/is.mjs";
3
+ import { isColor, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isRgbColor, isRgbaColor } from "./misc/is.mjs";
4
4
  import { getNormalizedHex, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba } from "./space/hex.mjs";
5
5
  import { hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba } from "./space/hsl.mjs";
6
6
  import { hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba } from "./space/hwb.mjs";
@@ -17,4 +17,4 @@ import { rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba } from "./space/rgb.
17
17
  */
18
18
  declare function getColor(value: unknown): Color;
19
19
  //#endregion
20
- export { type Color, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, type RGBAColor, type RGBColor, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getRgbColor, getRgbaColor, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, isColor, isHexColor, isHslColor, isHslLike, isHslaColor, isHwbColor, isHwbLike, isHwbaColor, isHwbaLike, isRgbColor, isRgbLike, isRgbaColor, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };
20
+ export { type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, type RGBAColor, type RGBColor, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getRgbColor, getRgbaColor, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, isColor, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isRgbColor, isRgbaColor, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };
@@ -1,5 +1,5 @@
1
1
  import { getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getRgbColor, getRgbaColor } from "./misc/get.mjs";
2
- import { isColor, isHexColor, isHslColor, isHslLike, isHslaColor, isHwbColor, isHwbLike, isHwbaColor, isHwbaLike, isRgbColor, isRgbLike, isRgbaColor } from "./misc/is.mjs";
2
+ import { isColor, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isRgbColor, isRgbaColor } from "./misc/is.mjs";
3
3
  import { rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba } from "./space/rgb.mjs";
4
4
  import { getNormalizedHex, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba } from "./space/hex.mjs";
5
5
  import { hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba } from "./space/hsl.mjs";
@@ -19,4 +19,4 @@ function getColor(value) {
19
19
  return isColor(value) ? value : color(value);
20
20
  }
21
21
  //#endregion
22
- export { getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getRgbColor, getRgbaColor, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, isColor, isHexColor, isHslColor, isHslLike, isHslaColor, isHwbColor, isHwbLike, isHwbaColor, isHwbaLike, isRgbColor, isRgbLike, isRgbaColor, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };
22
+ export { getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getRgbColor, getRgbaColor, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, isColor, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isRgbColor, isRgbaColor, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba };