nhb-toolbox 4.28.53 → 4.28.56

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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  All notable changes to the package will be documented here.
6
6
 
7
+ ## [4.28.56] - 2026-01-05
8
+
9
+ - **Resolved** an *issue affecting the conversion of Gregorian date strings to Bangla dates*.
10
+
11
+ ## [4.28.54] - 2026-01-02
12
+
13
+ - **Optimized** `Color.applyOpacity` and **updated** its behavior to return a *new* `Color` instance instead of mutating the original.
14
+
7
15
  ## [4.28.53] - 2026-01-01
8
16
 
9
17
  - **Optimized** *internal utilities* to enhance **runtime performance** and **editor IntelliSense**.
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Color = void 0;
4
+ exports.Colour = exports.Color = void 0;
5
+ const primitives_1 = require("../guards/primitives");
5
6
  const convert_1 = require("./convert");
6
7
  const css_colors_1 = require("./css-colors");
8
+ const guards_1 = require("./guards");
7
9
  const helpers_1 = require("./helpers");
8
10
  const random_1 = require("./random");
9
11
  const utils_1 = require("./utils");
@@ -28,39 +30,38 @@ class Color {
28
30
  else {
29
31
  const colors = this.#convertColorToOthers(color?.trim());
30
32
  if ('hex8' in colors) {
31
- const rgbaValues = (0, utils_1.extractAlphaColorValues)(colors.rgba);
32
- const hslaValues = (0, utils_1.extractAlphaColorValues)(colors.hsla);
33
+ const [r, g, b] = (0, utils_1.extractAlphaColorValues)(colors.rgba);
34
+ const [h, s, l] = (0, utils_1.extractAlphaColorValues)(colors.hsla);
33
35
  this.hex = colors.hex8.toUpperCase().slice(0, 7);
34
36
  this.hex8 = colors.hex8.toUpperCase();
35
- this.rgb = `rgb(${rgbaValues[0]}, ${rgbaValues[1]}, ${rgbaValues[2]})`;
37
+ this.rgb = `rgb(${r}, ${g}, ${b})`;
36
38
  this.rgba = colors.rgba;
37
- this.hsl = `hsl(${hslaValues[0]}, ${hslaValues[1]}%, ${hslaValues[2]}%)`;
39
+ this.hsl = `hsl(${h}, ${s}%, ${l}%)`;
38
40
  this.hsla = colors.hsla;
39
41
  }
40
42
  else {
41
- const rgbValues = (0, utils_1.extractSolidColorValues)(colors.rgb);
42
- const hslValues = (0, utils_1.extractSolidColorValues)(colors.hsl);
43
+ const [r, g, b] = (0, utils_1.extractSolidColorValues)(colors.rgb);
44
+ const [h, s, l] = (0, utils_1.extractSolidColorValues)(colors.hsl);
43
45
  this.hex = colors.hex.toUpperCase();
44
- this.hex8 =
45
- `${colors.hex.toUpperCase()}${(0, helpers_1._convertOpacityToHex)(100)}`;
46
+ this.hex8 = `${colors.hex.toUpperCase()}${(0, helpers_1._percentToHex)(100)}`;
46
47
  this.rgb = colors.rgb;
47
- this.rgba = `rgba(${rgbValues[0]}, ${rgbValues[1]}, ${rgbValues[2]}, 1)`;
48
+ this.rgba = `rgba(${r}, ${g}, ${b}, 1)`;
48
49
  this.hsl = colors.hsl;
49
- this.hsla = `hsla(${hslValues[0]}, ${hslValues[1]}%, ${hslValues[2]}%, 1)`;
50
+ this.hsla = `hsla(${h}, ${s}%, ${l}%, 1)`;
50
51
  }
51
52
  }
52
53
  }
53
54
  else {
54
55
  const hsl = (0, random_1.generateRandomHSLColor)();
55
56
  const { hex, rgb } = (0, convert_1.convertColorCode)(hsl);
56
- const rgbValues = (0, utils_1.extractSolidColorValues)(rgb);
57
- const hslValues = (0, utils_1.extractSolidColorValues)(hsl);
57
+ const [r, g, b] = (0, utils_1.extractSolidColorValues)(rgb);
58
+ const [h, s, l] = (0, utils_1.extractSolidColorValues)(hsl);
58
59
  this.hex = hex.toUpperCase();
59
- this.hex8 = `${hex.toUpperCase()}${(0, helpers_1._convertOpacityToHex)(100)}`;
60
+ this.hex8 = `${hex.toUpperCase()}${(0, helpers_1._percentToHex)(100)}`;
60
61
  this.rgb = rgb;
61
- this.rgba = `rgba(${rgbValues[0]}, ${rgbValues[1]}, ${rgbValues[2]}, 1)`;
62
+ this.rgba = `rgba(${r}, ${g}, ${b}, 1)`;
62
63
  this.hsl = hsl;
63
- this.hsla = `hsla(${hslValues[0]}, ${hslValues[1]}%, ${hslValues[2]}%, 1)`;
64
+ this.hsla = `hsla(${h}, ${s}%, ${l}%, 1)`;
64
65
  }
65
66
  }
66
67
  *[Symbol.iterator]() {
@@ -72,19 +73,8 @@ class Color {
72
73
  yield this.hsla;
73
74
  }
74
75
  applyOpacity(opacity) {
75
- const validOpacity = Math.min(100, Math.max(0, opacity));
76
- const alphaHex = (0, helpers_1._convertOpacityToHex)(opacity);
77
- const alphaDecimal = validOpacity / 100;
78
- const rgbValues = (0, utils_1.extractSolidColorValues)(this.rgb);
79
- const hslValues = (0, utils_1.extractSolidColorValues)(this.hsl);
80
- return _a.#fromParts({
81
- hex: this.hex.slice(0, 7).toUpperCase(),
82
- hex8: `${this.hex.slice(0, 7)}${alphaHex}`.toUpperCase(),
83
- rgb: `rgb(${rgbValues[0]}, ${rgbValues[1]}, ${rgbValues[2]})`,
84
- rgba: `rgba(${rgbValues[0]}, ${rgbValues[1]}, ${rgbValues[2]}, ${alphaDecimal})`,
85
- hsl: `hsl(${hslValues[0]}, ${hslValues[1]}%, ${hslValues[2]}%)`,
86
- hsla: `hsla(${hslValues[0]}, ${hslValues[1]}%, ${hslValues[2]}%, ${alphaDecimal})`,
87
- });
76
+ const hex8 = `${this.hex.slice(0, 7)}${(0, helpers_1._percentToHex)(opacity)}`.toUpperCase();
77
+ return new _a(hex8);
88
78
  }
89
79
  applyDarkness(percent) {
90
80
  const [h, s, l, a] = (0, utils_1.extractAlphaColorValues)(this.hsla);
@@ -190,25 +180,19 @@ class Color {
190
180
  return /^#[0-9A-Fa-f]{8}$/.test(color?.trim());
191
181
  }
192
182
  static isRGB(color) {
193
- return (0, helpers_1._isRGB)(color);
183
+ return (0, guards_1.isRGB)(color);
194
184
  }
195
185
  static isRGBA(color) {
196
- return (0, helpers_1._isRGBA)(color);
186
+ return (0, guards_1.isRGBA)(color);
197
187
  }
198
188
  static isHSL(color) {
199
- return (0, helpers_1._isHSL)(color);
189
+ return (0, guards_1.isHSL)(color);
200
190
  }
201
191
  static isHSLA(color) {
202
- return (0, helpers_1._isHSLA)(color);
192
+ return (0, guards_1.isHSLA)(color);
203
193
  }
204
194
  static isCSSColor(color) {
205
- return (!_a.isHex6(color) &&
206
- !_a.isHex8(color) &&
207
- !(0, helpers_1._isRGB)(color) &&
208
- !(0, helpers_1._isRGBA)(color) &&
209
- !(0, helpers_1._isHSL)(color) &&
210
- !(0, helpers_1._isHSLA)(color) &&
211
- color in css_colors_1.CSS_COLORS);
195
+ return (0, primitives_1.isNonEmptyString)(color) && color in css_colors_1.CSS_COLORS;
212
196
  }
213
197
  #convertColorToOthers(color) {
214
198
  if (_a.isHex6(color)) {
@@ -239,16 +223,7 @@ class Color {
239
223
  cause: 'Unrecognized Color Format',
240
224
  });
241
225
  }
242
- static #fromParts(parts) {
243
- const color = Object.create(_a.prototype);
244
- color.hex = parts.hex;
245
- color.hex8 = parts.hex8;
246
- color.rgb = parts.rgb;
247
- color.rgba = parts.rgba;
248
- color.hsl = parts.hsl;
249
- color.hsla = parts.hsla;
250
- return color;
251
- }
252
226
  }
253
227
  exports.Color = Color;
228
+ exports.Colour = Color;
254
229
  _a = Color;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertHex8ToHsla = exports.convertHslaToHex8 = exports.convertHex8ToRgba = exports.convertRgbaToHsla = exports.convertHslaToRgba = exports.convertRgbaToHex8 = exports.convertRgbToRgba = exports.convertHexToRgb = exports.convertRgbToHex = exports.convertHexToHsl = exports.convertHslToHex = exports.convertRgbToHsl = exports.convertHslToRgb = void 0;
4
4
  exports.convertColorCode = convertColorCode;
5
+ const guards_1 = require("./guards");
5
6
  const helpers_1 = require("./helpers");
6
7
  const utils_1 = require("./utils");
7
8
  const convertHslToRgb = (h, s, l) => {
@@ -112,8 +113,8 @@ const convertRgbaToHex8 = (r, g, b, a = 1) => {
112
113
  newAlpha = 1;
113
114
  console.warn(`Alpha value must be between 0-1, ${a} converted to 1!`);
114
115
  }
116
+ const alphaHex = (0, helpers_1._percentToHex)(Math.round(newAlpha * 100));
115
117
  const hex = (0, exports.convertRgbToHex)(r, g, b);
116
- const alphaHex = (0, helpers_1._convertOpacityToHex)(Math.round(newAlpha * 100));
117
118
  return `${hex}${alphaHex}`;
118
119
  };
119
120
  exports.convertRgbaToHex8 = convertRgbaToHex8;
@@ -124,8 +125,8 @@ const convertHslaToRgba = (h, s, l, a = 1) => {
124
125
  console.warn(`Alpha value must be between 0-1, ${a} converted to 1!`);
125
126
  }
126
127
  const rgb = (0, exports.convertHslToRgb)(h, s, l);
127
- const rgbNumbers = (0, utils_1.extractSolidColorValues)(rgb);
128
- return (0, exports.convertRgbToRgba)(rgbNumbers[0], rgbNumbers[1], rgbNumbers[2], parseFloat(newAlpha.toFixed(1)));
128
+ const [r, g, b] = (0, utils_1.extractSolidColorValues)(rgb);
129
+ return (0, exports.convertRgbToRgba)(r, g, b, parseFloat(newAlpha.toFixed(1)));
129
130
  };
130
131
  exports.convertHslaToRgba = convertHslaToRgba;
131
132
  const convertRgbaToHsla = (r, g, b, a = 1) => {
@@ -135,8 +136,8 @@ const convertRgbaToHsla = (r, g, b, a = 1) => {
135
136
  console.warn(`Alpha value must be between 0-1, ${a} converted to 1!`);
136
137
  }
137
138
  const hsl = (0, exports.convertRgbToHsl)(r, g, b);
138
- const hslNumbers = (0, utils_1.extractSolidColorValues)(hsl);
139
- return `hsla(${hslNumbers[0]}, ${hslNumbers[1]}%, ${hslNumbers[2]}%, ${parseFloat(newAlpha.toFixed(1))})`;
139
+ const [h, s, l] = (0, utils_1.extractSolidColorValues)(hsl);
140
+ return `hsla(${h}, ${s}%, ${l}%, ${parseFloat(newAlpha.toFixed(1))})`;
140
141
  };
141
142
  exports.convertRgbaToHsla = convertRgbaToHsla;
142
143
  const convertHex8ToRgba = (hex8) => {
@@ -154,8 +155,8 @@ const convertHslaToHex8 = (h, s, l, a = 1) => {
154
155
  newAlpha = 1;
155
156
  console.warn(`Alpha value must be between 0-1, ${a} converted to 1!`);
156
157
  }
158
+ const alphaHex = (0, helpers_1._percentToHex)(Math.round(newAlpha * 100));
157
159
  const hex = (0, exports.convertHslToHex)(h, s, l);
158
- const alphaHex = (0, helpers_1._convertOpacityToHex)(Math.round(newAlpha * 100));
159
160
  return `${hex}${alphaHex}`;
160
161
  };
161
162
  exports.convertHslaToHex8 = convertHslaToHex8;
@@ -166,40 +167,40 @@ const convertHex8ToHsla = (hex8) => {
166
167
  exports.convertHex8ToHsla = convertHex8ToHsla;
167
168
  function convertColorCode(color) {
168
169
  const trimmedColor = color?.trim();
169
- if ((0, helpers_1._isHex6)(trimmedColor)) {
170
+ if ((0, guards_1.isHex6)(trimmedColor)) {
170
171
  return {
171
172
  rgb: (0, exports.convertHexToRgb)(trimmedColor),
172
173
  hsl: (0, exports.convertHexToHsl)(trimmedColor),
173
174
  };
174
175
  }
175
- if ((0, helpers_1._isRGB)(trimmedColor)) {
176
+ if ((0, guards_1.isRGB)(trimmedColor)) {
176
177
  const rgbValues = (0, utils_1.extractSolidColorValues)(trimmedColor);
177
178
  return {
178
179
  hex: (0, exports.convertRgbToHex)(...rgbValues),
179
180
  hsl: (0, exports.convertRgbToHsl)(...rgbValues),
180
181
  };
181
182
  }
182
- if ((0, helpers_1._isHSL)(trimmedColor)) {
183
+ if ((0, guards_1.isHSL)(trimmedColor)) {
183
184
  const hslValues = (0, utils_1.extractSolidColorValues)(trimmedColor);
184
185
  return {
185
186
  hex: (0, exports.convertHslToHex)(...hslValues),
186
187
  rgb: (0, exports.convertHslToRgb)(...hslValues),
187
188
  };
188
189
  }
189
- if ((0, helpers_1._isHex8)(trimmedColor)) {
190
+ if ((0, guards_1.isHex8)(trimmedColor)) {
190
191
  return {
191
192
  rgba: (0, exports.convertHex8ToRgba)(trimmedColor),
192
193
  hsla: (0, exports.convertHex8ToHsla)(trimmedColor),
193
194
  };
194
195
  }
195
- if ((0, helpers_1._isRGBA)(trimmedColor)) {
196
+ if ((0, guards_1.isRGBA)(trimmedColor)) {
196
197
  const rgbaValues = (0, utils_1.extractAlphaColorValues)(trimmedColor);
197
198
  return {
198
199
  hex8: (0, exports.convertRgbaToHex8)(...rgbaValues),
199
200
  hsla: (0, exports.convertRgbaToHsla)(...rgbaValues),
200
201
  };
201
202
  }
202
- if ((0, helpers_1._isHSLA)(trimmedColor)) {
203
+ if ((0, guards_1.isHSLA)(trimmedColor)) {
203
204
  const hslaValues = (0, utils_1.extractAlphaColorValues)(trimmedColor);
204
205
  return {
205
206
  hex8: (0, exports.convertHslaToHex8)(...hslaValues),
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isHex6 = isHex6;
4
+ exports.isHex8 = isHex8;
5
+ exports.isRGB = isRGB;
6
+ exports.isRGBA = isRGBA;
7
+ exports.isHSL = isHSL;
8
+ exports.isHSLA = isHSLA;
9
+ const helpers_1 = require("./helpers");
10
+ function isHex6(color) {
11
+ return /^#[0-9A-Fa-f]{6}$/.test(color?.trim());
12
+ }
13
+ function isHex8(color) {
14
+ return /^#[0-9A-Fa-f]{8}$/.test(color?.trim());
15
+ }
16
+ function isRGB(color) {
17
+ const match = color
18
+ ?.trim()
19
+ ?.match(/^rgb\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?)\s*\)$/);
20
+ if (!match)
21
+ return false;
22
+ const [r, g, b] = match.slice(1).map(Number);
23
+ return (0, helpers_1._isValidRGBComponent)(r) && (0, helpers_1._isValidRGBComponent)(g) && (0, helpers_1._isValidRGBComponent)(b);
24
+ }
25
+ function isRGBA(color) {
26
+ const match = color
27
+ ?.trim()
28
+ ?.match(/^rgba\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?),\s*(0|1|0?\.\d+)\s*\)$/);
29
+ if (!match)
30
+ return false;
31
+ const [r, g, b, a] = match.slice(1).map(Number);
32
+ return ((0, helpers_1._isValidRGBComponent)(r) &&
33
+ (0, helpers_1._isValidRGBComponent)(g) &&
34
+ (0, helpers_1._isValidRGBComponent)(b) &&
35
+ (0, helpers_1._isValidAlpha)(a));
36
+ }
37
+ function isHSL(color) {
38
+ const match = color
39
+ ?.trim()
40
+ ?.match(/^hsl\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?)%,\s*(\d{1,3}(?:\.\d+)?)%\s*\)$/);
41
+ if (!match)
42
+ return false;
43
+ const [h, s, l] = match.slice(1).map(Number);
44
+ return (0, helpers_1._isValidHue)(h) && (0, helpers_1._isValidPercentage)(s) && (0, helpers_1._isValidPercentage)(l);
45
+ }
46
+ function isHSLA(color) {
47
+ const match = color
48
+ ?.trim()
49
+ .match(/^hsla\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?)%,\s*(\d{1,3}(?:\.\d+)?)%,\s*(0|1|0?\.\d+)\s*\)$/);
50
+ if (!match)
51
+ return false;
52
+ const [h, s, l, a] = match.slice(1).map(Number);
53
+ return (0, helpers_1._isValidHue)(h) && (0, helpers_1._isValidPercentage)(s) && (0, helpers_1._isValidPercentage)(l) && (0, helpers_1._isValidAlpha)(a);
54
+ }
@@ -1,22 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._isSimilarToLast = exports._generateRandomHSL = exports._applyOpacity = exports._convertOpacityToHex = void 0;
4
- exports._isHex6 = _isHex6;
5
- exports._isHex8 = _isHex8;
6
- exports._isRGB = _isRGB;
7
- exports._isRGBA = _isRGBA;
8
- exports._isHSL = _isHSL;
9
- exports._isHSLA = _isHSLA;
3
+ exports._isSimilarToLast = exports._generateRandomHSL = exports._applyOpacity = exports._percentToHex = void 0;
10
4
  exports._isValidAlpha = _isValidAlpha;
11
5
  exports._isValidRGBComponent = _isValidRGBComponent;
12
6
  exports._isValidHue = _isValidHue;
13
7
  exports._isValidPercentage = _isValidPercentage;
14
- const _convertOpacityToHex = (opacity) => {
15
- const validOpacity = Math.min(100, Math.max(0, opacity));
8
+ const _percentToHex = (percent) => {
9
+ const validOpacity = Math.min(100, Math.max(0, percent));
16
10
  const alpha = Math.round((validOpacity / 100) * 255);
17
11
  return alpha.toString(16).padStart(2, '0').toUpperCase();
18
12
  };
19
- exports._convertOpacityToHex = _convertOpacityToHex;
13
+ exports._percentToHex = _percentToHex;
20
14
  const _applyOpacity = (color, opacity) => {
21
15
  return color?.slice(0, 7).concat(opacity);
22
16
  };
@@ -47,51 +41,6 @@ const _isSimilarToLast = (recentColors, newColor) => {
47
41
  return hueDifference < 48 && saturationDifference < 24 && lightnessDifference < 16;
48
42
  };
49
43
  exports._isSimilarToLast = _isSimilarToLast;
50
- function _isHex6(color) {
51
- return /^#[0-9A-Fa-f]{6}$/.test(color?.trim());
52
- }
53
- function _isHex8(color) {
54
- return /^#[0-9A-Fa-f]{8}$/.test(color?.trim());
55
- }
56
- function _isRGB(color) {
57
- const match = color
58
- ?.trim()
59
- ?.match(/^rgb\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?)\s*\)$/);
60
- if (!match)
61
- return false;
62
- const [r, g, b] = match.slice(1).map(Number);
63
- return _isValidRGBComponent(r) && _isValidRGBComponent(g) && _isValidRGBComponent(b);
64
- }
65
- function _isRGBA(color) {
66
- const match = color
67
- ?.trim()
68
- ?.match(/^rgba\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?),\s*(0|1|0?\.\d+)\s*\)$/);
69
- if (!match)
70
- return false;
71
- const [r, g, b, a] = match.slice(1).map(Number);
72
- return (_isValidRGBComponent(r) &&
73
- _isValidRGBComponent(g) &&
74
- _isValidRGBComponent(b) &&
75
- _isValidAlpha(a));
76
- }
77
- function _isHSL(color) {
78
- const match = color
79
- ?.trim()
80
- ?.match(/^hsl\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?)%,\s*(\d{1,3}(?:\.\d+)?)%\s*\)$/);
81
- if (!match)
82
- return false;
83
- const [h, s, l] = match.slice(1).map(Number);
84
- return _isValidHue(h) && _isValidPercentage(s) && _isValidPercentage(l);
85
- }
86
- function _isHSLA(color) {
87
- const match = color
88
- ?.trim()
89
- .match(/^hsla\(\s*(\d{1,3}(?:\.\d+)?),\s*(\d{1,3}(?:\.\d+)?)%,\s*(\d{1,3}(?:\.\d+)?)%,\s*(0|1|0?\.\d+)\s*\)$/);
90
- if (!match)
91
- return false;
92
- const [h, s, l, a] = match.slice(1).map(Number);
93
- return _isValidHue(h) && _isValidPercentage(s) && _isValidPercentage(l) && _isValidAlpha(a);
94
- }
95
44
  function _isValidAlpha(value) {
96
45
  return value >= 0 && value <= 1 && !isNaN(value);
97
46
  }
@@ -5,7 +5,7 @@ const constants_1 = require("./constants");
5
5
  const helpers_1 = require("./helpers");
6
6
  function getColorForInitial(input = '', opacity = 100) {
7
7
  let initial;
8
- const hexOpacity = (0, helpers_1._convertOpacityToHex)(opacity);
8
+ const hexOpacity = (0, helpers_1._percentToHex)(opacity);
9
9
  const NUMBERS = '0123456789';
10
10
  const DEFAULT = '#010514';
11
11
  if (!input)
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractAlphaColorValues = exports.extractSolidColorValues = void 0;
4
- const helpers_1 = require("./helpers");
4
+ const guards_1 = require("./guards");
5
5
  const extractSolidColorValues = (color) => {
6
- if ((0, helpers_1._isHSL)(color) || (0, helpers_1._isRGB)(color)) {
6
+ if ((0, guards_1.isHSL)(color) || (0, guards_1.isRGB)(color)) {
7
7
  return (color?.trim()?.match(/[\d.]+%?/g) || [])?.map((value) => parseFloat(value));
8
8
  }
9
9
  return [0, 0, 0];
10
10
  };
11
11
  exports.extractSolidColorValues = extractSolidColorValues;
12
12
  const extractAlphaColorValues = (color) => {
13
- if ((0, helpers_1._isHSLA)(color) || (0, helpers_1._isRGBA)(color)) {
13
+ if ((0, guards_1.isHSLA)(color) || (0, guards_1.isRGBA)(color)) {
14
14
  return (color?.trim()?.match(/[\d.]+%?/g) || [])?.map((value) => parseFloat(value));
15
15
  }
16
16
  return [0, 0, 0, 0];
@@ -212,7 +212,7 @@ class BanglaCalendar {
212
212
  return (0, helpers_1._formatDateCore)(format || 'ddd, DD mmmm (SS), YYYY বঙ্গাব্দ', dateComponents);
213
213
  }
214
214
  #processGregYear(bnYear, bnMonth) {
215
- const baseGregYear = bnYear ?? this.year.en + constants_1.BN_YEAR_OFFSET;
215
+ const baseGregYear = (bnYear ?? this.year.en) + constants_1.BN_YEAR_OFFSET;
216
216
  const gregYear = (bnMonth ?? this.month.en) > 10 ? baseGregYear + 1 : baseGregYear;
217
217
  return { baseGregYear, gregYear };
218
218
  }
package/dist/cjs/index.js CHANGED
@@ -189,16 +189,16 @@ Object.defineProperty(exports, "convertRgbaToHsla", { enumerable: true, get: fun
189
189
  Object.defineProperty(exports, "convertRgbToHex", { enumerable: true, get: function () { return convert_3.convertRgbToHex; } });
190
190
  Object.defineProperty(exports, "convertRgbToHsl", { enumerable: true, get: function () { return convert_3.convertRgbToHsl; } });
191
191
  Object.defineProperty(exports, "convertRgbToRgba", { enumerable: true, get: function () { return convert_3.convertRgbToRgba; } });
192
- var helpers_1 = require("./colors/helpers");
193
- Object.defineProperty(exports, "isHex6", { enumerable: true, get: function () { return helpers_1._isHex6; } });
194
- Object.defineProperty(exports, "isHex8", { enumerable: true, get: function () { return helpers_1._isHex8; } });
195
- Object.defineProperty(exports, "isHSL", { enumerable: true, get: function () { return helpers_1._isHSL; } });
196
- Object.defineProperty(exports, "isHSLA", { enumerable: true, get: function () { return helpers_1._isHSLA; } });
197
- Object.defineProperty(exports, "isRGB", { enumerable: true, get: function () { return helpers_1._isRGB; } });
198
- Object.defineProperty(exports, "isRGBA", { enumerable: true, get: function () { return helpers_1._isRGBA; } });
192
+ var guards_3 = require("./colors/guards");
193
+ Object.defineProperty(exports, "isHex6", { enumerable: true, get: function () { return guards_3.isHex6; } });
194
+ Object.defineProperty(exports, "isHex8", { enumerable: true, get: function () { return guards_3.isHex8; } });
195
+ Object.defineProperty(exports, "isHSL", { enumerable: true, get: function () { return guards_3.isHSL; } });
196
+ Object.defineProperty(exports, "isHSLA", { enumerable: true, get: function () { return guards_3.isHSLA; } });
197
+ Object.defineProperty(exports, "isRGB", { enumerable: true, get: function () { return guards_3.isRGB; } });
198
+ Object.defineProperty(exports, "isRGBA", { enumerable: true, get: function () { return guards_3.isRGBA; } });
199
199
  var Color_1 = require("./colors/Color");
200
200
  Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return Color_1.Color; } });
201
- Object.defineProperty(exports, "Colour", { enumerable: true, get: function () { return Color_1.Color; } });
201
+ Object.defineProperty(exports, "Colour", { enumerable: true, get: function () { return Color_1.Colour; } });
202
202
  var utils_1 = require("./colors/utils");
203
203
  Object.defineProperty(exports, "extractAlphaColorValues", { enumerable: true, get: function () { return utils_1.extractAlphaColorValues; } });
204
204
  Object.defineProperty(exports, "extractSolidColorValues", { enumerable: true, get: function () { return utils_1.extractSolidColorValues; } });
@@ -209,17 +209,17 @@ Object.defineProperty(exports, "greet", { enumerable: true, get: function () { r
209
209
  var parse_1 = require("./date/parse");
210
210
  Object.defineProperty(exports, "parseMs", { enumerable: true, get: function () { return parse_1.parseMSec; } });
211
211
  Object.defineProperty(exports, "parseMSec", { enumerable: true, get: function () { return parse_1.parseMSec; } });
212
- var guards_3 = require("./date/guards");
213
- Object.defineProperty(exports, "isDateLike", { enumerable: true, get: function () { return guards_3.isDateLike; } });
214
- Object.defineProperty(exports, "isLeapYear", { enumerable: true, get: function () { return guards_3.isLeapYear; } });
215
- Object.defineProperty(exports, "isNativeTimeZoneId", { enumerable: true, get: function () { return guards_3.isNativeTimeZoneId; } });
216
- Object.defineProperty(exports, "isTimeWithUnit", { enumerable: true, get: function () { return guards_3.isTimeWithUnit; } });
217
- Object.defineProperty(exports, "isValidTime", { enumerable: true, get: function () { return guards_3.isValidTime; } });
218
- Object.defineProperty(exports, "isValidTimeString", { enumerable: true, get: function () { return guards_3.isValidTime; } });
219
- Object.defineProperty(exports, "isValidTimeZoneId", { enumerable: true, get: function () { return guards_3.isValidTimeZoneId; } });
220
- Object.defineProperty(exports, "isValidUTC", { enumerable: true, get: function () { return guards_3.isValidUTCOffset; } });
221
- Object.defineProperty(exports, "isValidUTCOffSet", { enumerable: true, get: function () { return guards_3.isValidUTCOffset; } });
222
- Object.defineProperty(exports, "isValidUTCOffset", { enumerable: true, get: function () { return guards_3.isValidUTCOffset; } });
212
+ var guards_4 = require("./date/guards");
213
+ Object.defineProperty(exports, "isDateLike", { enumerable: true, get: function () { return guards_4.isDateLike; } });
214
+ Object.defineProperty(exports, "isLeapYear", { enumerable: true, get: function () { return guards_4.isLeapYear; } });
215
+ Object.defineProperty(exports, "isNativeTimeZoneId", { enumerable: true, get: function () { return guards_4.isNativeTimeZoneId; } });
216
+ Object.defineProperty(exports, "isTimeWithUnit", { enumerable: true, get: function () { return guards_4.isTimeWithUnit; } });
217
+ Object.defineProperty(exports, "isValidTime", { enumerable: true, get: function () { return guards_4.isValidTime; } });
218
+ Object.defineProperty(exports, "isValidTimeString", { enumerable: true, get: function () { return guards_4.isValidTime; } });
219
+ Object.defineProperty(exports, "isValidTimeZoneId", { enumerable: true, get: function () { return guards_4.isValidTimeZoneId; } });
220
+ Object.defineProperty(exports, "isValidUTC", { enumerable: true, get: function () { return guards_4.isValidUTCOffset; } });
221
+ Object.defineProperty(exports, "isValidUTCOffSet", { enumerable: true, get: function () { return guards_4.isValidUTCOffset; } });
222
+ Object.defineProperty(exports, "isValidUTCOffset", { enumerable: true, get: function () { return guards_4.isValidUTCOffset; } });
223
223
  var BanglaCalendar_1 = require("./date/BanglaCalendar");
224
224
  Object.defineProperty(exports, "BanglaCalendar", { enumerable: true, get: function () { return BanglaCalendar_1.BanglaCalendar; } });
225
225
  Object.defineProperty(exports, "BnCalendar", { enumerable: true, get: function () { return BanglaCalendar_1.BnCalendar; } });
@@ -309,15 +309,15 @@ Object.defineProperty(exports, "createFormData", { enumerable: true, get: functi
309
309
  var transform_2 = require("./form/transform");
310
310
  Object.defineProperty(exports, "parseFormData", { enumerable: true, get: function () { return transform_2.parseFormData; } });
311
311
  Object.defineProperty(exports, "serializeForm", { enumerable: true, get: function () { return transform_2.serializeForm; } });
312
- var guards_4 = require("./form/guards");
313
- Object.defineProperty(exports, "isCustomFile", { enumerable: true, get: function () { return guards_4.isCustomFile; } });
314
- Object.defineProperty(exports, "isCustomFileArray", { enumerable: true, get: function () { return guards_4.isCustomFileArray; } });
315
- Object.defineProperty(exports, "isFileArray", { enumerable: true, get: function () { return guards_4.isFileArray; } });
316
- Object.defineProperty(exports, "isFileList", { enumerable: true, get: function () { return guards_4.isFileList; } });
317
- Object.defineProperty(exports, "isFileOrBlob", { enumerable: true, get: function () { return guards_4.isFileOrBlob; } });
318
- Object.defineProperty(exports, "isFileUpload", { enumerable: true, get: function () { return guards_4.isFileUpload; } });
319
- Object.defineProperty(exports, "isOriginFileObj", { enumerable: true, get: function () { return guards_4.isOriginFileObj; } });
320
- Object.defineProperty(exports, "isValidFormData", { enumerable: true, get: function () { return guards_4.isValidFormData; } });
312
+ var guards_5 = require("./form/guards");
313
+ Object.defineProperty(exports, "isCustomFile", { enumerable: true, get: function () { return guards_5.isCustomFile; } });
314
+ Object.defineProperty(exports, "isCustomFileArray", { enumerable: true, get: function () { return guards_5.isCustomFileArray; } });
315
+ Object.defineProperty(exports, "isFileArray", { enumerable: true, get: function () { return guards_5.isFileArray; } });
316
+ Object.defineProperty(exports, "isFileList", { enumerable: true, get: function () { return guards_5.isFileList; } });
317
+ Object.defineProperty(exports, "isFileOrBlob", { enumerable: true, get: function () { return guards_5.isFileOrBlob; } });
318
+ Object.defineProperty(exports, "isFileUpload", { enumerable: true, get: function () { return guards_5.isFileUpload; } });
319
+ Object.defineProperty(exports, "isOriginFileObj", { enumerable: true, get: function () { return guards_5.isOriginFileObj; } });
320
+ Object.defineProperty(exports, "isValidFormData", { enumerable: true, get: function () { return guards_5.isValidFormData; } });
321
321
  var basics_4 = require("./object/basics");
322
322
  Object.defineProperty(exports, "cloneObject", { enumerable: true, get: function () { return basics_4.cloneObject; } });
323
323
  Object.defineProperty(exports, "countObjectFields", { enumerable: true, get: function () { return basics_4.countObjectFields; } });
@@ -10,6 +10,7 @@ exports.isBGColor = isBGColor;
10
10
  exports.isTextStyle = isTextStyle;
11
11
  const convert_1 = require("../colors/convert");
12
12
  const css_colors_1 = require("../colors/css-colors");
13
+ const guards_1 = require("../colors/guards");
13
14
  const helpers_1 = require("../colors/helpers");
14
15
  const primitives_1 = require("../guards/primitives");
15
16
  const specials_1 = require("../guards/specials");
@@ -147,14 +148,14 @@ class LogStyler {
147
148
  }
148
149
  #isValidHexOrRGB(color) {
149
150
  const pure = color?.replace('bg-', '');
150
- return (0, helpers_1._isHex6)(pure) || (0, helpers_1._isRGB)(pure);
151
+ return (0, guards_1.isHex6)(pure) || (0, guards_1.isRGB)(pure);
151
152
  }
152
153
  #sanitizeHex(code) {
153
154
  return code?.trim()?.startsWith('#') ? code?.trim() : `#${code?.trim()}`;
154
155
  }
155
156
  #handleHex(code, isBg = false) {
156
157
  const sanitized = this.#sanitizeHex(code);
157
- if (!(0, helpers_1._isHex6)(sanitized)) {
158
+ if (!(0, guards_1.isHex6)(sanitized)) {
158
159
  return this.#applyStyles();
159
160
  }
160
161
  const ansi = hexToAnsi(sanitized, isBg);
@@ -3,8 +3,8 @@ import type { Maybe, OwnKeys } from '../types/index';
3
3
  import type { FindOptions } from './types';
4
4
  type KeySelector<T> = Extract<OwnKeys<T>, string | number> | ((item: T) => string | number);
5
5
  /**
6
- * The `Finder` class performs optimized searching on arrays.
7
- * It supports binary search, fuzzy search, and smart caching with TTL.
6
+ * @class `Finder` performs optimized searching on arrays.
7
+ * - It supports binary search, fuzzy search, and smart caching with TTL.
8
8
  */
9
9
  export declare class Finder<T extends GenericObject> {
10
10
  #private;