toolbox-x 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168,11 +168,17 @@ type CSSColor = keyof typeof CSS_COLORS;
168
168
  */
169
169
  declare class Color {
170
170
  #private;
171
+ /** {@link Hex6 Hex} color representation (without alpha). */
171
172
  readonly hex: Hex6;
173
+ /** {@link Hex8} color representation including alpha. */
172
174
  readonly hex8: Hex8;
175
+ /** {@link RGB} color representation (without alpha). */
173
176
  readonly rgb: RGB;
177
+ /** {@link RGBA} color representation including alpha. */
174
178
  readonly rgba: RGBA;
179
+ /** {@link HSL} color representation (without alpha). */
175
180
  readonly hsl: HSL;
181
+ /** {@link HSLA} color representation including alpha. */
176
182
  readonly hsla: HSLA;
177
183
  /**
178
184
  * * Creates a new `Color` instance with a random color and automatically converts the generated color to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
@@ -168,11 +168,17 @@ type CSSColor = keyof typeof CSS_COLORS;
168
168
  */
169
169
  declare class Color {
170
170
  #private;
171
+ /** {@link Hex6 Hex} color representation (without alpha). */
171
172
  readonly hex: Hex6;
173
+ /** {@link Hex8} color representation including alpha. */
172
174
  readonly hex8: Hex8;
175
+ /** {@link RGB} color representation (without alpha). */
173
176
  readonly rgb: RGB;
177
+ /** {@link RGBA} color representation including alpha. */
174
178
  readonly rgba: RGBA;
179
+ /** {@link HSL} color representation (without alpha). */
175
180
  readonly hsl: HSL;
181
+ /** {@link HSLA} color representation including alpha. */
176
182
  readonly hsla: HSLA;
177
183
  /**
178
184
  * * Creates a new `Color` instance with a random color and automatically converts the generated color to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { s as CSSColor } from "./Color-CVRcGmWe.cjs";
17
+ import { s as CSSColor } from "./Color-D6qMZgDm.mjs";
18
18
 
19
19
  //#region src/stylog/constants.d.ts
20
20
  /** Records of ANSI-16 colors with values */
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { s as CSSColor } from "./Color-CInCJvH7.mjs";
17
+ import { s as CSSColor } from "./Color-SUPeP6fO.cjs";
18
18
 
19
19
  //#region src/stylog/constants.d.ts
20
20
  /** Records of ANSI-16 colors with values */
package/dist/colors.cjs CHANGED
@@ -96,11 +96,17 @@ function generateRandomColor(options) {
96
96
  * @property `hsla` - {@link HSLA} color representation including alpha.
97
97
  */
98
98
  var Color = class Color {
99
+ /** {@link Hex6 Hex} color representation (without alpha). */
99
100
  hex;
101
+ /** {@link Hex8} color representation including alpha. */
100
102
  hex8;
103
+ /** {@link RGB} color representation (without alpha). */
101
104
  rgb;
105
+ /** {@link RGBA} color representation including alpha. */
102
106
  rgba;
107
+ /** {@link HSL} color representation (without alpha). */
103
108
  hsl;
109
+ /** {@link HSLA} color representation including alpha. */
104
110
  hsla;
105
111
  /**
106
112
  * * Creates a new `Color` instance and automatically converts the input color to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
@@ -313,9 +319,9 @@ var Color = class Color {
313
319
  */
314
320
  blendWith(other, weight = .5) {
315
321
  const w = Math.max(0, Math.min(1, weight));
316
- const converted = new Color(other);
322
+ const otherColor = new Color(other);
317
323
  const [r1, g1, b1, a1] = require_convert.extractAlphaColorValues(this.rgba);
318
- const [r2, g2, b2, a2] = require_convert.extractAlphaColorValues(converted.rgba);
324
+ const [r2, g2, b2, a2] = require_convert.extractAlphaColorValues(otherColor.rgba);
319
325
  const alpha = Math.round((a1 * (1 - w) + a2 * w) * 100) / 100;
320
326
  const _blendChannel = (c1, c2) => {
321
327
  return Math.round((c1 * a1 * (1 - w) + c2 * a2 * w) / alpha);
@@ -328,16 +334,16 @@ var Color = class Color {
328
334
  * @returns A number representing the contrast ratio (rounded to 2 decimal places).
329
335
  */
330
336
  contrastRatio(other) {
331
- const newColor = new Color(other);
332
- const luminance = (rgb) => {
337
+ const otherColor = new Color(other);
338
+ const _luminance = (rgb) => {
333
339
  const [r, g, b] = require_convert.extractSolidColorValues(rgb).map((v) => {
334
340
  const c = v / 255;
335
341
  return c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
336
342
  });
337
343
  return .2126 * r + .7152 * g + .0722 * b;
338
344
  };
339
- const lum1 = luminance(this.rgb);
340
- const lum2 = luminance(newColor.rgb);
345
+ const lum1 = _luminance(this.rgb);
346
+ const lum2 = _luminance(otherColor.rgb);
341
347
  const brighter = Math.max(lum1, lum2);
342
348
  const darker = Math.min(lum1, lum2);
343
349
  const ratio = (brighter + .05) / (darker + .05);
package/dist/colors.d.cts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { er as Percent } from "./object-DyVg8BFt.cjs";
18
- import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-CVRcGmWe.cjs";
18
+ import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-SUPeP6fO.cjs";
19
19
 
20
20
  //#region src/colors/convert.d.ts
21
21
  /**
package/dist/colors.d.mts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { er as Percent } from "./object-DyVg8BFt.mjs";
18
- import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-CInCJvH7.mjs";
18
+ import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-D6qMZgDm.mjs";
19
19
 
20
20
  //#region src/colors/convert.d.ts
21
21
  /**
package/dist/colors.mjs CHANGED
@@ -95,11 +95,17 @@ function generateRandomColor(options) {
95
95
  * @property `hsla` - {@link HSLA} color representation including alpha.
96
96
  */
97
97
  var Color = class Color {
98
+ /** {@link Hex6 Hex} color representation (without alpha). */
98
99
  hex;
100
+ /** {@link Hex8} color representation including alpha. */
99
101
  hex8;
102
+ /** {@link RGB} color representation (without alpha). */
100
103
  rgb;
104
+ /** {@link RGBA} color representation including alpha. */
101
105
  rgba;
106
+ /** {@link HSL} color representation (without alpha). */
102
107
  hsl;
108
+ /** {@link HSLA} color representation including alpha. */
103
109
  hsla;
104
110
  /**
105
111
  * * Creates a new `Color` instance and automatically converts the input color to all other supported formats: {@link Hex6 Hex}, {@link Hex8}, {@link RGB}, {@link RGBA}, {@link HSL}, and {@link HSLA}.
@@ -312,9 +318,9 @@ var Color = class Color {
312
318
  */
313
319
  blendWith(other, weight = .5) {
314
320
  const w = Math.max(0, Math.min(1, weight));
315
- const converted = new Color(other);
321
+ const otherColor = new Color(other);
316
322
  const [r1, g1, b1, a1] = extractAlphaColorValues(this.rgba);
317
- const [r2, g2, b2, a2] = extractAlphaColorValues(converted.rgba);
323
+ const [r2, g2, b2, a2] = extractAlphaColorValues(otherColor.rgba);
318
324
  const alpha = Math.round((a1 * (1 - w) + a2 * w) * 100) / 100;
319
325
  const _blendChannel = (c1, c2) => {
320
326
  return Math.round((c1 * a1 * (1 - w) + c2 * a2 * w) / alpha);
@@ -327,16 +333,16 @@ var Color = class Color {
327
333
  * @returns A number representing the contrast ratio (rounded to 2 decimal places).
328
334
  */
329
335
  contrastRatio(other) {
330
- const newColor = new Color(other);
331
- const luminance = (rgb) => {
336
+ const otherColor = new Color(other);
337
+ const _luminance = (rgb) => {
332
338
  const [r, g, b] = extractSolidColorValues(rgb).map((v) => {
333
339
  const c = v / 255;
334
340
  return c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
335
341
  });
336
342
  return .2126 * r + .7152 * g + .0722 * b;
337
343
  };
338
- const lum1 = luminance(this.rgb);
339
- const lum2 = luminance(newColor.rgb);
344
+ const lum1 = _luminance(this.rgb);
345
+ const lum2 = _luminance(otherColor.rgb);
340
346
  const brighter = Math.max(lum1, lum2);
341
347
  const darker = Math.min(lum1, lum2);
342
348
  const ratio = (brighter + .05) / (darker + .05);
package/dist/guards.d.cts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { $ as GenericFn, B as AsyncFunction, Dn as UTCOffset, Ft as DateLike, Z as FalsyPrimitive, _n as TimeWithUnit, at as NormalPrimitive, ct as Numeric, dt as Primitive, jt as ClockTime, nt as Maybe, pt as ValidArray, rt as MethodDescriptor, wt as $TimeZoneIdentifier, xn as TimeZoneIdNative, y as GenericObject } from "./object-DyVg8BFt.cjs";
18
- import { b as RGB, g as HSLA, h as HSL, s as CSSColor, v as Hex6, x as RGBA, y as Hex8 } from "./Color-CVRcGmWe.cjs";
18
+ import { b as RGB, g as HSLA, h as HSL, s as CSSColor, v as Hex6, x as RGBA, y as Hex8 } from "./Color-SUPeP6fO.cjs";
19
19
  import { S as isInvalidOrEmptyArray, f as isDeepEqual, v as isPrime } from "./index-D00Uqm9S.cjs";
20
20
  import { C as isURL, S as isPhoneNumber, _ as isEnvironment, a as isUUIDv4, b as isNode, c as isUUIDv7, d as isBase64, f as isBinaryString, g as isEmailArray, h as isEmail, i as isUUIDv3, l as isUUIDv8, m as isDateString, n as isUUIDv1, o as isUUIDv5, p as isBrowser, r as isUUIDv2, s as isUUIDv6, v as isHexString, w as isUUID, x as isNumericString, y as isIPAddress } from "./uuid-CMNRM9NO.cjs";
21
21
 
package/dist/guards.d.mts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { $ as GenericFn, B as AsyncFunction, Dn as UTCOffset, Ft as DateLike, Z as FalsyPrimitive, _n as TimeWithUnit, at as NormalPrimitive, ct as Numeric, dt as Primitive, jt as ClockTime, nt as Maybe, pt as ValidArray, rt as MethodDescriptor, wt as $TimeZoneIdentifier, xn as TimeZoneIdNative, y as GenericObject } from "./object-DyVg8BFt.mjs";
18
- import { b as RGB, g as HSLA, h as HSL, s as CSSColor, v as Hex6, x as RGBA, y as Hex8 } from "./Color-CInCJvH7.mjs";
18
+ import { b as RGB, g as HSLA, h as HSL, s as CSSColor, v as Hex6, x as RGBA, y as Hex8 } from "./Color-D6qMZgDm.mjs";
19
19
  import { S as isInvalidOrEmptyArray, f as isDeepEqual, v as isPrime } from "./index-BbBnKdBb.mjs";
20
20
  import { C as isURL, S as isPhoneNumber, _ as isEnvironment, a as isUUIDv4, b as isNode, c as isUUIDv7, d as isBase64, f as isBinaryString, g as isEmailArray, h as isEmail, i as isUUIDv3, l as isUUIDv8, m as isDateString, n as isUUIDv1, o as isUUIDv5, p as isBrowser, r as isUUIDv2, s as isUUIDv6, v as isHexString, w as isUUID, x as isNumericString, y as isIPAddress } from "./uuid-DvQsIl9p.mjs";
21
21
 
package/dist/stylog.d.cts CHANGED
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { _ as Hex } from "./Color-CVRcGmWe.cjs";
18
- import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "./Stylog-00MmV27Z.cjs";
17
+ import { _ as Hex } from "./Color-SUPeP6fO.cjs";
18
+ import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "./Stylog-DdPP_CJf.cjs";
19
19
 
20
20
  //#region src/stylog/utils.d.ts
21
21
  /**
package/dist/stylog.d.mts CHANGED
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { _ as Hex } from "./Color-CInCJvH7.mjs";
18
- import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "./Stylog-Bi1f4CR9.mjs";
17
+ import { _ as Hex } from "./Color-D6qMZgDm.mjs";
18
+ import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "./Stylog-B8sKWvn_.mjs";
19
19
 
20
20
  //#region src/stylog/utils.d.ts
21
21
  /**
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { C as RandomColorOptions, D as Triad, E as Tetrad, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, c as ColorInput, d as ColorTypeAlpha, f as ColorTypeSolid, g as HSLA, h as HSL, i as AlphaValue, l as ColorInputArray, m as ConvertedColors, n as $ColorType, o as Analogous, p as Colors, r as AlphaColors, s as CSSColor, u as ColorType, v as Hex6, w as SolidColors, x as RGBA, y as Hex8 } from "../Color-CVRcGmWe.cjs";
17
+ import { C as RandomColorOptions, D as Triad, E as Tetrad, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, c as ColorInput, d as ColorTypeAlpha, f as ColorTypeSolid, g as HSLA, h as HSL, i as AlphaValue, l as ColorInputArray, m as ConvertedColors, n as $ColorType, o as Analogous, p as Colors, r as AlphaColors, s as CSSColor, u as ColorType, v as Hex6, w as SolidColors, x as RGBA, y as Hex8 } from "../Color-SUPeP6fO.cjs";
18
18
  export { $ColorType, AlphaColors, AlphaValue, AlphaValues, Analogous, CSSColor, ColorInput, ColorInputArray, ColorType, ColorTypeAlpha, ColorTypeSolid, Colors, ConvertedColors, HSL, HSLA, Hex, Hex6, Hex8, RGB, RGBA, RandomColor, RandomColorOptions, SolidColors, SolidValues, Tetrad, Triad };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { C as RandomColorOptions, D as Triad, E as Tetrad, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, c as ColorInput, d as ColorTypeAlpha, f as ColorTypeSolid, g as HSLA, h as HSL, i as AlphaValue, l as ColorInputArray, m as ConvertedColors, n as $ColorType, o as Analogous, p as Colors, r as AlphaColors, s as CSSColor, u as ColorType, v as Hex6, w as SolidColors, x as RGBA, y as Hex8 } from "../Color-CInCJvH7.mjs";
17
+ import { C as RandomColorOptions, D as Triad, E as Tetrad, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, c as ColorInput, d as ColorTypeAlpha, f as ColorTypeSolid, g as HSLA, h as HSL, i as AlphaValue, l as ColorInputArray, m as ConvertedColors, n as $ColorType, o as Analogous, p as Colors, r as AlphaColors, s as CSSColor, u as ColorType, v as Hex6, w as SolidColors, x as RGBA, y as Hex8 } from "../Color-D6qMZgDm.mjs";
18
18
  export { $ColorType, AlphaColors, AlphaValue, AlphaValues, Analogous, CSSColor, ColorInput, ColorInputArray, ColorType, ColorTypeAlpha, ColorTypeSolid, Colors, ConvertedColors, HSL, HSLA, Hex, Hex6, Hex8, RGB, RGBA, RandomColor, RandomColorOptions, SolidColors, SolidValues, Tetrad, Triad };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { a as AnsiSequence, c as Styles, i as Ansi16Value, l as StylogChain, o as BGColor, r as Ansi16Color, s as CSS16Color, u as TextStyle } from "../Stylog-00MmV27Z.cjs";
17
+ import { a as AnsiSequence, c as Styles, i as Ansi16Value, l as StylogChain, o as BGColor, r as Ansi16Color, s as CSS16Color, u as TextStyle } from "../Stylog-DdPP_CJf.cjs";
18
18
  export { Ansi16Color, Ansi16Value, AnsiSequence, BGColor, CSS16Color, Styles, StylogChain, TextStyle };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { a as AnsiSequence, c as Styles, i as Ansi16Value, l as StylogChain, o as BGColor, r as Ansi16Color, s as CSS16Color, u as TextStyle } from "../Stylog-Bi1f4CR9.mjs";
17
+ import { a as AnsiSequence, c as Styles, i as Ansi16Value, l as StylogChain, o as BGColor, r as Ansi16Color, s as CSS16Color, u as TextStyle } from "../Stylog-B8sKWvn_.mjs";
18
18
  export { Ansi16Color, Ansi16Value, AnsiSequence, BGColor, CSS16Color, Styles, StylogChain, TextStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolbox-x",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.",
5
5
  "main": "./dist/index.cjs",
6
6
  "type": "module",