toolbox-x 2.0.14 → 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.
- package/dist/{Color-B2SgCGbm.d.mts → Color-D6qMZgDm.d.mts} +104 -14
- package/dist/{Color-asKZqwDF.d.cts → Color-SUPeP6fO.d.cts} +104 -14
- package/dist/{Stylog-CRNMQ_uV.d.cts → Stylog-B8sKWvn_.d.mts} +1 -1
- package/dist/{Stylog-Cvzo5z86.d.mts → Stylog-DdPP_CJf.d.cts} +1 -1
- package/dist/{basics-Dald7J6c.mjs → basics-20lm69yy.mjs} +5 -98
- package/dist/{basics-Bb5ovcvz.cjs → basics-byj0VH1c.cjs} +5 -140
- package/dist/colors.cjs +139 -27
- package/dist/colors.d.cts +2 -2
- package/dist/colors.d.mts +2 -2
- package/dist/colors.mjs +139 -27
- package/dist/constants.cjs +14 -14
- package/dist/constants.mjs +1 -1
- package/dist/{convert-Cqy2Llek.cjs → convert-BjKz_hhr.cjs} +6 -2
- package/dist/{convert-lXdkXPJR.mjs → convert-DRZXcjcS.mjs} +6 -2
- package/dist/date.cjs +6 -6
- package/dist/date.mjs +4 -4
- package/dist/dom.cjs +9 -8
- package/dist/dom.mjs +4 -3
- package/dist/{guards-D8Iz6EEy.cjs → guards-BSwFQX1M.cjs} +3 -3
- package/dist/{guards-DziDBD0p.mjs → guards-CNG9gnvL.mjs} +1 -1
- package/dist/guards-CqbVT4L5.cjs +156 -0
- package/dist/{guards-DGN95D2h.cjs → guards-CrfVwk0-.cjs} +1 -1
- package/dist/guards-DKGBsd6x.mjs +115 -0
- package/dist/{guards-D1et4U32.mjs → guards-Dc9MB9on.mjs} +3 -3
- package/dist/guards.cjs +37 -36
- package/dist/guards.d.cts +1 -1
- package/dist/guards.d.mts +1 -1
- package/dist/guards.mjs +5 -4
- package/dist/hash.cjs +8 -8
- package/dist/hash.mjs +8 -8
- package/dist/index.cjs +12 -12
- package/dist/index.d.cts +2 -3
- package/dist/index.d.mts +2 -3
- package/dist/index.mjs +12 -12
- package/dist/{parse-DUJ0YThn.mjs → parse-TuFyLeVH.mjs} +3 -3
- package/dist/{parse-CbVVRoFY.cjs → parse-jh637S25.cjs} +4 -4
- package/dist/pluralizer.cjs +1 -1
- package/dist/pluralizer.mjs +1 -1
- package/dist/{query-B4Lrr5Vt.mjs → query-BomnyWh3.mjs} +5 -5
- package/dist/{query-BUBCpo-q.cjs → query-sWSi-d7u.cjs} +10 -10
- package/dist/{specials-dkYP1Nh2.cjs → specials-DU8u108m.cjs} +1 -1
- package/dist/{specials-Hq5Ncd6y.mjs → specials-krf7zsqI.mjs} +1 -1
- package/dist/stylog.cjs +3 -3
- package/dist/stylog.d.cts +2 -2
- package/dist/stylog.d.mts +2 -2
- package/dist/stylog.mjs +3 -3
- package/dist/types/colors.d.cts +1 -1
- package/dist/types/colors.d.mts +1 -1
- package/dist/types/stylog.d.cts +1 -1
- package/dist/types/stylog.d.mts +1 -1
- package/dist/{utilities-DPscNbS1.mjs → utilities-BSv8VbnM.mjs} +1 -1
- package/dist/{utilities-CWV1GPGY.cjs → utilities-BVpk3LKy.cjs} +1 -1
- package/package.json +6 -6
package/dist/colors.mjs
CHANGED
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
import { a as isNonEmptyString, c as isNumber, d as isString } from "./primitives-Djsevc69.mjs";
|
|
18
18
|
import { t as CSS_COLORS } from "./css-colors-B-y4TmeC.mjs";
|
|
19
|
-
import { c as _applyOpacity, l as _generateRandomHSL, n as isHSL, o as isRGB, r as isHSLA, s as isRGBA, u as _isSimilarToLast } from "./guards-
|
|
20
|
-
import { _ as extractSolidColorValues, a as convertHexToRgb, c as convertHslaToHex8, d as convertRgbToHsl, f as convertRgbToRgba, g as extractAlphaColorValues, h as applyOpacityToHex, i as convertHexToHsl, l as convertHslaToRgba, m as convertRgbaToHsla, n as convertHex8ToHsla, o as convertHslToHex, p as convertRgbaToHex8, r as convertHex8ToRgba, s as convertHslToRgb, t as convertColorCode, u as convertRgbToHex, v as percentToHex } from "./convert-
|
|
19
|
+
import { c as _applyOpacity, l as _generateRandomHSL, n as isHSL, o as isRGB, r as isHSLA, s as isRGBA, u as _isSimilarToLast } from "./guards-CNG9gnvL.mjs";
|
|
20
|
+
import { _ as extractSolidColorValues, a as convertHexToRgb, c as convertHslaToHex8, d as convertRgbToHsl, f as convertRgbToRgba, g as extractAlphaColorValues, h as applyOpacityToHex, i as convertHexToHsl, l as convertHslaToRgba, m as convertRgbaToHsla, n as convertHex8ToHsla, o as convertHslToHex, p as convertRgbaToHex8, r as convertHex8ToRgba, s as convertHslToRgb, t as convertColorCode, u as convertRgbToHex, v as percentToHex } from "./convert-DRZXcjcS.mjs";
|
|
21
|
+
import { t as clampNumber } from "./utilities-BSv8VbnM.mjs";
|
|
21
22
|
import { n as NUMBER_COLOR_PALETTE, t as ALPHABET_COLOR_PALETTE } from "./constants-DCZL77t-.mjs";
|
|
22
23
|
|
|
23
24
|
//#region src/colors/random.ts
|
|
@@ -94,11 +95,17 @@ function generateRandomColor(options) {
|
|
|
94
95
|
* @property `hsla` - {@link HSLA} color representation including alpha.
|
|
95
96
|
*/
|
|
96
97
|
var Color = class Color {
|
|
98
|
+
/** {@link Hex6 Hex} color representation (without alpha). */
|
|
97
99
|
hex;
|
|
100
|
+
/** {@link Hex8} color representation including alpha. */
|
|
98
101
|
hex8;
|
|
102
|
+
/** {@link RGB} color representation (without alpha). */
|
|
99
103
|
rgb;
|
|
104
|
+
/** {@link RGBA} color representation including alpha. */
|
|
100
105
|
rgba;
|
|
106
|
+
/** {@link HSL} color representation (without alpha). */
|
|
101
107
|
hsl;
|
|
108
|
+
/** {@link HSLA} color representation including alpha. */
|
|
102
109
|
hsla;
|
|
103
110
|
/**
|
|
104
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}.
|
|
@@ -157,6 +164,18 @@ var Color = class Color {
|
|
|
157
164
|
yield this.hsla;
|
|
158
165
|
}
|
|
159
166
|
/**
|
|
167
|
+
* Allows the color to be used in string and number contexts.
|
|
168
|
+
* @param hint The hint to determine the conversion type.
|
|
169
|
+
*/
|
|
170
|
+
[Symbol.toPrimitive](hint) {
|
|
171
|
+
if (hint === "string") return this.hex8;
|
|
172
|
+
else if (hint === "number") {
|
|
173
|
+
const hex = this.hex8.endsWith("FF") ? this.hex : this.hex8;
|
|
174
|
+
return parseInt(hex.replace("#", "0x"), 16);
|
|
175
|
+
}
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
160
179
|
* @private Convert `Hex6` color format to `Hex8` by applying `100%` opacity.
|
|
161
180
|
* @param hex `Hex6` color to convert to `Hex8`.
|
|
162
181
|
*/
|
|
@@ -180,11 +199,12 @@ var Color = class Color {
|
|
|
180
199
|
return `hsla(${h}, ${s}%, ${l}%, 1)`;
|
|
181
200
|
}
|
|
182
201
|
/**
|
|
183
|
-
* @instance
|
|
202
|
+
* @instance Sets the opacity of this color to the given **absolute** percentage and returns a new instance.
|
|
184
203
|
*
|
|
185
204
|
* @remarks
|
|
205
|
+
* - This is an **absolute setter**: passing `50` means "set opacity to exactly 50%", regardless of the current opacity.
|
|
186
206
|
* - For solid colors ({@link Hex6}/{@link RGB}/{@link HSL}): Adds an alpha channel with the specified opacity.
|
|
187
|
-
* - For alpha colors ({@link Hex8}/{@link RGBA}/{@link HSLA}):
|
|
207
|
+
* - For alpha colors ({@link Hex8}/{@link RGBA}/{@link HSLA}): Replaces the existing alpha channel.
|
|
188
208
|
*
|
|
189
209
|
* @param opacity - A number between `0-100` representing the opacity percentage.
|
|
190
210
|
* @returns A new instance of `Color` containing all color formats with the applied opacity.
|
|
@@ -203,40 +223,81 @@ var Color = class Color {
|
|
|
203
223
|
return new Color(`${this.hex.slice(0, 7)}${percentToHex(opacity)}`.toUpperCase());
|
|
204
224
|
}
|
|
205
225
|
/**
|
|
206
|
-
* @instance Darkens the color by
|
|
207
|
-
*
|
|
208
|
-
* @
|
|
226
|
+
* @instance Darkens the color by **subtracting** the given percentage points from the current lightness in HSL space.
|
|
227
|
+
*
|
|
228
|
+
* @remarks
|
|
229
|
+
* - This is a **relative adjustment**: passing `20` means "reduce lightness by 20 percentage points" from its current value.
|
|
230
|
+
* - Lightness is clamped to `0%` at minimum.
|
|
231
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
232
|
+
*
|
|
233
|
+
* @param percent - The percentage points to subtract from lightness (`0–100`).
|
|
234
|
+
* @returns A new `Color` instance with the reduced lightness.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* const blue = new Color("#0000ff"); // hsl(240, 100%, 50%)
|
|
238
|
+
* const darkerBlue = blue.applyDarkness(20);
|
|
239
|
+
* console.log(darkerBlue.hsl); // hsl(240, 100%, 30%)
|
|
209
240
|
*/
|
|
210
241
|
applyDarkness(percent) {
|
|
211
242
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
212
243
|
return new Color(`hsl(${h}, ${s}%, ${Math.max(0, l - percent)}%)`).applyOpacity(a * 100);
|
|
213
244
|
}
|
|
214
245
|
/**
|
|
215
|
-
* @instance Lightens the color by
|
|
216
|
-
*
|
|
217
|
-
* @
|
|
246
|
+
* @instance Lightens the color by **adding** the given percentage points to the current lightness in HSL space.
|
|
247
|
+
*
|
|
248
|
+
* @remarks
|
|
249
|
+
* - This is a **relative adjustment**: passing `30` means "increase lightness by 30 percentage points" from its current value.
|
|
250
|
+
* - Lightness is clamped to `100%` at maximum.
|
|
251
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
252
|
+
*
|
|
253
|
+
* @param percent - The percentage points to add to lightness (`0–100`).
|
|
254
|
+
* @returns A new `Color` instance with the increased lightness.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* const green = new Color("#008000"); // hsl(120, 100%, 25.1%)
|
|
258
|
+
* const lighterGreen = green.applyBrightness(30);
|
|
259
|
+
* console.log(lighterGreen.hsl); // hsl(120, 100%, 55.1%)
|
|
218
260
|
*/
|
|
219
261
|
applyBrightness(percent) {
|
|
220
262
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
221
263
|
return new Color(`hsl(${h}, ${s}%, ${Math.min(100, l + percent)}%)`).applyOpacity(a * 100);
|
|
222
264
|
}
|
|
223
265
|
/**
|
|
224
|
-
* @instance
|
|
225
|
-
*
|
|
226
|
-
* @
|
|
266
|
+
* @instance Desaturates the color by **subtracting** the given percentage points from the current saturation in HSL space.
|
|
267
|
+
*
|
|
268
|
+
* @remarks
|
|
269
|
+
* - This is a **relative adjustment**: passing `50` means "reduce saturation by 50 percentage points" from its current value.
|
|
270
|
+
* - Saturation is clamped to `0%` at minimum (fully desaturated / grayscale).
|
|
271
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
272
|
+
*
|
|
273
|
+
* @param percent - The percentage points to subtract from saturation (`0–100`).
|
|
274
|
+
* @returns A new `Color` instance with the reduced saturation.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* const pink = new Color("#ff69b4"); // hsl(330, 100%, 70.59%)
|
|
278
|
+
* const dullPink = pink.applyDullness(50);
|
|
279
|
+
* console.log(dullPink.hsl); // hsl(330, 50%, 70.59%)
|
|
227
280
|
*/
|
|
228
281
|
applyDullness(percent) {
|
|
229
282
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
230
283
|
return new Color(`hsl(${h}, ${Math.max(0, s - percent)}%, ${l}%)`).applyOpacity(a * 100);
|
|
231
284
|
}
|
|
232
285
|
/**
|
|
233
|
-
* @instance Softens the color toward white by reducing saturation and increasing lightness
|
|
286
|
+
* @instance Softens the color toward white by **proportionally** reducing saturation and increasing lightness.
|
|
234
287
|
*
|
|
235
288
|
* @remarks
|
|
236
|
-
* This
|
|
289
|
+
* - This is a **proportional blend**: passing `40` means "move 40% of the *remaining distance* toward pure white".
|
|
290
|
+
* - Unlike {@link applyBrightness} or {@link applyDullness}, the effect scales relative to the current distance from white, producing a natural pastel/tint effect.
|
|
291
|
+
* - This creates a soft UI-like white shade effect (similar to some UI libraries' light color scale).
|
|
292
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
237
293
|
*
|
|
238
294
|
* @param percent - Value from `0` to `100` representing how far to push the color toward white.
|
|
239
295
|
* @returns A new `Color` instance shifted toward white.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* const purple = new Color("#800080"); // hsl(300, 100%, 25.1%)
|
|
299
|
+
* const softPurple = purple.applyWhiteShade(40);
|
|
300
|
+
* console.log(softPurple.hsl); // hsl(300, 60%, 55.06%)
|
|
240
301
|
*/
|
|
241
302
|
applyWhiteShade(percent) {
|
|
242
303
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
@@ -257,14 +318,14 @@ var Color = class Color {
|
|
|
257
318
|
*/
|
|
258
319
|
blendWith(other, weight = .5) {
|
|
259
320
|
const w = Math.max(0, Math.min(1, weight));
|
|
260
|
-
const
|
|
261
|
-
const [r1,
|
|
262
|
-
const [r2,
|
|
321
|
+
const otherColor = new Color(other);
|
|
322
|
+
const [r1, g1, b1, a1] = extractAlphaColorValues(this.rgba);
|
|
323
|
+
const [r2, g2, b2, a2] = extractAlphaColorValues(otherColor.rgba);
|
|
263
324
|
const alpha = Math.round((a1 * (1 - w) + a2 * w) * 100) / 100;
|
|
264
|
-
const
|
|
325
|
+
const _blendChannel = (c1, c2) => {
|
|
265
326
|
return Math.round((c1 * a1 * (1 - w) + c2 * a2 * w) / alpha);
|
|
266
327
|
};
|
|
267
|
-
return new Color(`rgba(${
|
|
328
|
+
return new Color(`rgba(${_blendChannel(r1, r2)}, ${_blendChannel(g1, g2)}, ${_blendChannel(b1, b2)}, ${alpha})`);
|
|
268
329
|
}
|
|
269
330
|
/**
|
|
270
331
|
* @instance Calculates the contrast ratio between this color and another color (WCAG).
|
|
@@ -272,16 +333,16 @@ var Color = class Color {
|
|
|
272
333
|
* @returns A number representing the contrast ratio (rounded to 2 decimal places).
|
|
273
334
|
*/
|
|
274
335
|
contrastRatio(other) {
|
|
275
|
-
const
|
|
276
|
-
const
|
|
336
|
+
const otherColor = new Color(other);
|
|
337
|
+
const _luminance = (rgb) => {
|
|
277
338
|
const [r, g, b] = extractSolidColorValues(rgb).map((v) => {
|
|
278
339
|
const c = v / 255;
|
|
279
|
-
return c <= .03928 ? c / 12.92 :
|
|
340
|
+
return c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
|
|
280
341
|
});
|
|
281
342
|
return .2126 * r + .7152 * g + .0722 * b;
|
|
282
343
|
};
|
|
283
|
-
const lum1 =
|
|
284
|
-
const lum2 =
|
|
344
|
+
const lum1 = _luminance(this.rgb);
|
|
345
|
+
const lum2 = _luminance(otherColor.rgb);
|
|
285
346
|
const brighter = Math.max(lum1, lum2);
|
|
286
347
|
const darker = Math.min(lum1, lum2);
|
|
287
348
|
const ratio = (brighter + .05) / (darker + .05);
|
|
@@ -352,6 +413,35 @@ var Color = class Color {
|
|
|
352
413
|
].map((c) => c.applyOpacity(a * 100));
|
|
353
414
|
}
|
|
354
415
|
/**
|
|
416
|
+
* @instance Generates a color palette of evenly distributed hues based on the current color's saturation, lightness, and alpha.
|
|
417
|
+
*
|
|
418
|
+
* @remarks
|
|
419
|
+
* - Colors are spaced evenly around the color wheel (`360° / count` apart), starting from the current hue.
|
|
420
|
+
* - Saturation, lightness, and alpha from the source color are preserved across all generated colors.
|
|
421
|
+
*
|
|
422
|
+
* @typeParam N - A literal number type representing the palette size.
|
|
423
|
+
* @param count - The number of colors to generate in the palette (must be a positive integer ≥ `1`). Default: `7`.
|
|
424
|
+
* @param step - The step value (degree) to be added to the hue of the previous color. Default: `360 / count`.
|
|
425
|
+
* @returns Array of `Color` instances with the specified count.
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* const red = new Color("#ff0000");
|
|
429
|
+
* const palette = red.generatePalette(4);
|
|
430
|
+
* console.log(palette.map((color) => color.hex));
|
|
431
|
+
* // ['#FF0000', '#80FF00', '#00FFFF', '#8000FF']
|
|
432
|
+
*/
|
|
433
|
+
generatePalette(count, step) {
|
|
434
|
+
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
435
|
+
const clampedCount = clampNumber(count ?? 7, 1, 360);
|
|
436
|
+
const calculatedStep = step ? clampNumber(step, 1, 360) : 360 / clampedCount;
|
|
437
|
+
const colors = [];
|
|
438
|
+
for (let i = 0; i < clampedCount; i++) {
|
|
439
|
+
const color = new Color(`hsl(${(h + calculatedStep * i) % 360}, ${s}%, ${l}%)`).applyOpacity(a * 100);
|
|
440
|
+
colors.push(color);
|
|
441
|
+
}
|
|
442
|
+
return colors;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
355
445
|
* @instance Gets the `WCAG` accessibility rating between this and another color.
|
|
356
446
|
* @param other - The other color to test contrast against.
|
|
357
447
|
* @returns `'Fail'`, `'AA'`, or `'AAA'` based on `WCAG 2.1` contrast standards.
|
|
@@ -373,6 +463,28 @@ var Color = class Color {
|
|
|
373
463
|
return (r * 299 + g * 587 + b * 114) / 1e3 > Math.min(255, Math.max(0, threshold));
|
|
374
464
|
}
|
|
375
465
|
/**
|
|
466
|
+
* @instance Convert the color to string.
|
|
467
|
+
* @returns The `Hex8` representation of the color.
|
|
468
|
+
*
|
|
469
|
+
* @remarks
|
|
470
|
+
* - Called by `String()`, `Object.prototype.toString()` or in template literals.
|
|
471
|
+
* - Uses the same implementation as `toJSON()`.
|
|
472
|
+
*/
|
|
473
|
+
toString() {
|
|
474
|
+
return this.hex8;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* @instance Convert the color to JSON.
|
|
478
|
+
* @returns The `Hex8` representation of the color.
|
|
479
|
+
*
|
|
480
|
+
* @remarks
|
|
481
|
+
* - Called by `JSON.stringify()`.
|
|
482
|
+
* - It uses the same implementation as `toString()`.
|
|
483
|
+
*/
|
|
484
|
+
toJSON() {
|
|
485
|
+
return this.hex8;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
376
488
|
* @static Checks if a color is in {@link Hex6} format.
|
|
377
489
|
*
|
|
378
490
|
* @param color Color to check.
|
|
@@ -524,10 +636,10 @@ function getColorForInitial(input = "", opacity = 100) {
|
|
|
524
636
|
return _applyOpacity(DEFAULT, hexOpacity);
|
|
525
637
|
} else if (Array.isArray(input)) {
|
|
526
638
|
if (input?.length < 1) return [...ALPHABET_COLOR_PALETTE, ...NUMBER_COLOR_PALETTE].map((color) => _applyOpacity(color, hexOpacity));
|
|
527
|
-
return input.
|
|
639
|
+
return input.flatMap((el) => {
|
|
528
640
|
if (Array.isArray(el)) return getColorForInitial(el, opacity);
|
|
529
641
|
return getColorForInitial(el, opacity);
|
|
530
|
-
})
|
|
642
|
+
});
|
|
531
643
|
}
|
|
532
644
|
return _applyOpacity(DEFAULT, hexOpacity);
|
|
533
645
|
}
|
package/dist/constants.cjs
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_constants = require('./constants-D_HkIg02.cjs');
|
|
19
19
|
const require_css_colors = require('./css-colors-DC7oZ46Y.cjs');
|
|
20
|
-
const require_constants$1 = require('./constants-
|
|
21
|
-
const require_constants$2 = require('./constants-
|
|
20
|
+
const require_constants$1 = require('./constants-B3nc8psr.cjs');
|
|
21
|
+
const require_constants$2 = require('./constants-BOs8tjzp.cjs');
|
|
22
|
+
const require_constants$3 = require('./constants-CgFaV72Z.cjs');
|
|
22
23
|
const require_timezone = require('./timezone-CSz7R0L6.cjs');
|
|
23
|
-
const require_constants$3 = require('./constants-B3nc8psr.cjs');
|
|
24
24
|
const require_constants$4 = require('./constants-DIBRCBIP.cjs');
|
|
25
25
|
const require_countries = require('./countries-C0x58zVg.cjs');
|
|
26
26
|
const require_constants$5 = require('./constants-ZnFGKd7G.cjs');
|
|
@@ -376,17 +376,17 @@ const SEASON_PRESETS = /* @__PURE__ */ Object.freeze({
|
|
|
376
376
|
});
|
|
377
377
|
|
|
378
378
|
//#endregion
|
|
379
|
-
exports.ALPHABET_COLOR_PALETTE = require_constants$
|
|
379
|
+
exports.ALPHABET_COLOR_PALETTE = require_constants$2.ALPHABET_COLOR_PALETTE;
|
|
380
380
|
exports.AUSTRALIA_SEASONS = AUSTRALIA_SEASONS;
|
|
381
381
|
exports.BANGLADESH_SEASONS = BANGLADESH_SEASONS;
|
|
382
382
|
exports.CATEGORIZED_UNITS = require_constants$4.UNITS;
|
|
383
383
|
exports.COUNTRIES = require_countries.COUNTRIES;
|
|
384
384
|
exports.CSS_COLORS = require_css_colors.CSS_COLORS;
|
|
385
|
-
exports.CURRENCY_CODES = require_constants$
|
|
386
|
-
exports.CURRENCY_LOCALES = require_constants$
|
|
385
|
+
exports.CURRENCY_CODES = require_constants$1.CURRENCY_CODES;
|
|
386
|
+
exports.CURRENCY_LOCALES = require_constants$1.CURRENCY_LOCALES;
|
|
387
387
|
exports.ETHIOPIA_SEASONS = ETHIOPIA_SEASONS;
|
|
388
|
-
exports.FRANKFURTER_CURRENCIES = require_constants$
|
|
389
|
-
exports.GENERAL_UNITS = require_constants$
|
|
388
|
+
exports.FRANKFURTER_CURRENCIES = require_constants$1.FRANKFURTER_CURRENCIES;
|
|
389
|
+
exports.GENERAL_UNITS = require_constants$1.UNITS;
|
|
390
390
|
exports.HTTP_CODES = require_constants$5.HTTP_STATUS_CODES;
|
|
391
391
|
exports.HTTP_STATUS = require_constants$5.HTTP_STATUS_CODES;
|
|
392
392
|
exports.HTTP_STATUS_CODES = require_constants$5.HTTP_STATUS_CODES;
|
|
@@ -395,11 +395,11 @@ exports.INDIA_IMD_SEASONS = INDIA_IMD_SEASONS;
|
|
|
395
395
|
exports.INDIA_TAMIL_SEASONS = INDIA_TAMIL_SEASONS;
|
|
396
396
|
exports.INDIA_VEDIC_SEASONS = INDIA_VEDIC_SEASONS;
|
|
397
397
|
exports.JAPAN_SEASONS = JAPAN_SEASONS;
|
|
398
|
-
exports.LOCALE_CODES = require_constants$
|
|
398
|
+
exports.LOCALE_CODES = require_constants$1.LOCALE_CODES;
|
|
399
399
|
exports.LOWERCASED_WORDS = require_constants.LOWERCASE;
|
|
400
|
-
exports.MONTHS = require_constants$
|
|
400
|
+
exports.MONTHS = require_constants$3.MONTHS;
|
|
401
401
|
exports.NATIVE_TZ_IDS = require_timezone.NATIVE_TZ_IDS;
|
|
402
|
-
exports.NUMBER_COLOR_PALETTE = require_constants$
|
|
402
|
+
exports.NUMBER_COLOR_PALETTE = require_constants$2.NUMBER_COLOR_PALETTE;
|
|
403
403
|
exports.PHILIPPINES_SEASONS = PHILIPPINES_SEASONS;
|
|
404
404
|
exports.SEASON_PRESETS = SEASON_PRESETS;
|
|
405
405
|
exports.STATUS_CODES = require_constants$5.HTTP_STATUS_CODES;
|
|
@@ -409,7 +409,7 @@ exports.TIME_ZONE_IDS = require_timezone.TIME_ZONE_IDS;
|
|
|
409
409
|
exports.TIME_ZONE_LABELS = require_timezone.TIME_ZONE_LABELS;
|
|
410
410
|
exports.TZ_ABBREVIATIONS = require_timezone.TIME_ZONES;
|
|
411
411
|
exports.US_ACADEMIC_SEASONS = US_ACADEMIC_SEASONS;
|
|
412
|
-
exports.VEDIC_ZODIAC_SIGNS = require_constants$
|
|
413
|
-
exports.WEEK_DAYS = require_constants$
|
|
412
|
+
exports.VEDIC_ZODIAC_SIGNS = require_constants$3.VEDIC_ZODIAC_SIGNS;
|
|
413
|
+
exports.WEEK_DAYS = require_constants$3.DAYS;
|
|
414
414
|
exports.WESTERN_SEASONS = DEFAULT_SEASONS;
|
|
415
|
-
exports.WESTERN_ZODIAC_SIGNS = require_constants$
|
|
415
|
+
exports.WESTERN_ZODIAC_SIGNS = require_constants$3.WESTERN_ZODIAC_SIGNS;
|
package/dist/constants.mjs
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
import { t as LOWERCASE } from "./constants-B0zJiNqH.mjs";
|
|
18
18
|
import { t as CSS_COLORS } from "./css-colors-B-y4TmeC.mjs";
|
|
19
|
+
import { a as LOCALE_CODES, i as FRANKFURTER_CURRENCIES, n as CURRENCY_CODES, p as UNITS$1, r as CURRENCY_LOCALES } from "./constants-ZyfpysiQ.mjs";
|
|
19
20
|
import { n as NUMBER_COLOR_PALETTE, t as ALPHABET_COLOR_PALETTE } from "./constants-DCZL77t-.mjs";
|
|
20
21
|
import { c as WESTERN_ZODIAC_SIGNS, n as DAYS, r as MONTHS, s as VEDIC_ZODIAC_SIGNS } from "./constants-GZL_CT1W.mjs";
|
|
21
22
|
import { a as TIME_ZONE_IDS, i as TIME_ZONES_NATIVE, n as NATIVE_TZ_IDS, o as TIME_ZONE_LABELS, r as TIME_ZONES, t as IANA_TZ_IDS } from "./timezone-avZ4TvDx.mjs";
|
|
22
|
-
import { a as LOCALE_CODES, i as FRANKFURTER_CURRENCIES, n as CURRENCY_CODES, p as UNITS$1, r as CURRENCY_LOCALES } from "./constants-ZyfpysiQ.mjs";
|
|
23
23
|
import { r as UNITS } from "./constants-ByLTHWQm.mjs";
|
|
24
24
|
import { t as COUNTRIES } from "./countries-CMxHxKiK.mjs";
|
|
25
25
|
import { t as HTTP_STATUS_CODES } from "./constants-BLAcLxOu.mjs";
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
18
|
-
const require_guards = require('./guards-
|
|
18
|
+
const require_guards = require('./guards-CrfVwk0-.cjs');
|
|
19
19
|
|
|
20
20
|
//#region src/colors/utils.ts
|
|
21
21
|
/**
|
|
@@ -160,7 +160,11 @@ const convertRgbToHsl = (r, g, b) => {
|
|
|
160
160
|
* @returns A string representing the color in Hex format (e.g., `#FF0000`).
|
|
161
161
|
*/
|
|
162
162
|
const convertHslToHex = (h, s, l) => {
|
|
163
|
-
const rgb = convertHslToRgb(h, s, l).match(/\d+/g)
|
|
163
|
+
const rgb = convertHslToRgb(h, s, l).match(/\d+/g)?.map(Number) ?? [
|
|
164
|
+
0,
|
|
165
|
+
0,
|
|
166
|
+
0
|
|
167
|
+
];
|
|
164
168
|
return convertRgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
165
169
|
};
|
|
166
170
|
/**
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { a as isNonEmptyString, c as isNumber } from "./primitives-Djsevc69.mjs";
|
|
18
|
-
import { a as isHex8, c as _applyOpacity, d as _isValidAlpha, i as isHex6, n as isHSL, o as isRGB, r as isHSLA, s as isRGBA } from "./guards-
|
|
18
|
+
import { a as isHex8, c as _applyOpacity, d as _isValidAlpha, i as isHex6, n as isHSL, o as isRGB, r as isHSLA, s as isRGBA } from "./guards-CNG9gnvL.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/colors/utils.ts
|
|
21
21
|
/**
|
|
@@ -160,7 +160,11 @@ const convertRgbToHsl = (r, g, b) => {
|
|
|
160
160
|
* @returns A string representing the color in Hex format (e.g., `#FF0000`).
|
|
161
161
|
*/
|
|
162
162
|
const convertHslToHex = (h, s, l) => {
|
|
163
|
-
const rgb = convertHslToRgb(h, s, l).match(/\d+/g)
|
|
163
|
+
const rgb = convertHslToRgb(h, s, l).match(/\d+/g)?.map(Number) ?? [
|
|
164
|
+
0,
|
|
165
|
+
0,
|
|
166
|
+
0
|
|
167
|
+
];
|
|
164
168
|
return convertRgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
165
169
|
};
|
|
166
170
|
/**
|
package/dist/date.cjs
CHANGED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
19
|
+
const require_specials = require('./specials-DU8u108m.cjs');
|
|
20
|
+
const require_utilities = require('./utilities-BVpk3LKy.cjs');
|
|
19
21
|
const require_constants = require('./constants-CgFaV72Z.cjs');
|
|
20
22
|
const require_timezone = require('./timezone-CSz7R0L6.cjs');
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const require_parse = require('./parse-CbVVRoFY.cjs');
|
|
24
|
-
const require_basics = require('./basics-Bb5ovcvz.cjs');
|
|
23
|
+
const require_parse = require('./parse-jh637S25.cjs');
|
|
24
|
+
const require_guards = require('./guards-CqbVT4L5.cjs');
|
|
25
25
|
|
|
26
26
|
//#region src/date/calculation.ts
|
|
27
27
|
/**
|
|
@@ -180,7 +180,7 @@ const TZ_MAP = /* @__PURE__ */ new Map();
|
|
|
180
180
|
* @returns An array of matching IANA time-zone identifiers, or an empty array if the offset is invalid.
|
|
181
181
|
*/
|
|
182
182
|
function getTimeZoneIds(offset) {
|
|
183
|
-
if (!
|
|
183
|
+
if (!require_guards.isValidUTCOffset(offset)) return [];
|
|
184
184
|
if (TZ_MAP.has(offset)) return TZ_MAP.get(offset) ?? [];
|
|
185
185
|
for (const zone of require_timezone.NATIVE_TZ_IDS) {
|
|
186
186
|
const off = require_parse._gmtToUtcOffset(require_parse._resolveNativeTzName(zone, "longOffset"));
|
|
@@ -351,7 +351,7 @@ function getGreeting(configs) {
|
|
|
351
351
|
const { morningEnds = "11:59", noonEnds = "12:59", afternoonEnds = "17:59", eveningEnds = "23:59", midnightEnds = "02:59", currentTime, appendToMsg = "", prependToMsg = "", morningMessage = "Good Morning!", noonMessage = "Good Noon!", afternoonMessage = "Good Afternoon!", eveningMessage = "Good Evening!", midnightMessage = "Hello, Night Owl!", defaultMessage = "Greetings!" } = configs || {};
|
|
352
352
|
let hour;
|
|
353
353
|
let minute;
|
|
354
|
-
if (currentTime &&
|
|
354
|
+
if (currentTime && require_guards.isValidTime(currentTime)) [hour, minute] = extractHourMinute(currentTime);
|
|
355
355
|
else {
|
|
356
356
|
hour = getCurrentDateTime().getHours();
|
|
357
357
|
minute = getCurrentDateTime().getMinutes();
|
package/dist/date.mjs
CHANGED
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { c as isNumber, m as isUndefined } from "./primitives-Djsevc69.mjs";
|
|
18
|
+
import { E as isObjectWithKeys, T as isObject } from "./specials-krf7zsqI.mjs";
|
|
19
|
+
import { a as normalizeNumber } from "./utilities-BSv8VbnM.mjs";
|
|
18
20
|
import { a as RELATIVE_TIME_DIVISIONS, t as DATE_UNIT_SETTERS } from "./constants-GZL_CT1W.mjs";
|
|
19
21
|
import { n as NATIVE_TZ_IDS } from "./timezone-avZ4TvDx.mjs";
|
|
20
|
-
import {
|
|
21
|
-
import { a as
|
|
22
|
-
import { a as _normalizeOffset, i as _gmtToUtcOffset, n as _dateArgsToDate, o as _resolveNativeTzName, r as _formatDate, t as parseMSec } from "./parse-DUJ0YThn.mjs";
|
|
23
|
-
import { Q as isValidTime, et as isValidUTCOffset } from "./basics-Dald7J6c.mjs";
|
|
22
|
+
import { a as _normalizeOffset, i as _gmtToUtcOffset, n as _dateArgsToDate, o as _resolveNativeTzName, r as _formatDate, t as parseMSec } from "./parse-TuFyLeVH.mjs";
|
|
23
|
+
import { a as isValidTime, s as isValidUTCOffset } from "./guards-DKGBsd6x.mjs";
|
|
24
24
|
|
|
25
25
|
//#region src/date/calculation.ts
|
|
26
26
|
/**
|
package/dist/dom.cjs
CHANGED
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
19
|
-
const require_specials = require('./specials-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
19
|
+
const require_specials = require('./specials-DU8u108m.cjs');
|
|
20
|
+
const require_guards = require('./guards-CqbVT4L5.cjs');
|
|
21
|
+
const require_basics = require('./basics-byj0VH1c.cjs');
|
|
22
|
+
const require_query = require('./query-sWSi-d7u.cjs');
|
|
22
23
|
|
|
23
24
|
//#region src/dom/storage.ts
|
|
24
25
|
/**
|
|
@@ -229,8 +230,8 @@ const createFormData = (data, configs) => {
|
|
|
229
230
|
const transformedKey = _transformKey(key);
|
|
230
231
|
const fullKey = parentKey ? `${parentKey}.${transformedKey}` : transformedKey;
|
|
231
232
|
if (_compareKeyPaths(fullKey, ignoreKeys)) return acc;
|
|
232
|
-
if (value != null && value !== "" || _isRequiredKey(fullKey) || require_primitives.isNonEmptyString(value) || require_specials.isValidArray(value) || require_specials.isNotEmptyObject(value)) if (
|
|
233
|
-
else if (require_specials.isNotEmptyObject(value)) if (
|
|
233
|
+
if (value != null && value !== "" || _isRequiredKey(fullKey) || require_primitives.isNonEmptyString(value) || require_specials.isValidArray(value) || require_specials.isNotEmptyObject(value)) if (require_guards.isDateLike(value)) acc[transformedKey] = value;
|
|
234
|
+
else if (require_specials.isNotEmptyObject(value)) if (require_guards.isDateLike(value)) acc[transformedKey] = value;
|
|
234
235
|
else {
|
|
235
236
|
const cleaned = _cleanObject(value, fullKey);
|
|
236
237
|
if (_isRequiredKey(fullKey) || require_specials.isNotEmptyObject(cleaned)) acc[transformedKey] = cleaned;
|
|
@@ -272,7 +273,7 @@ const createFormData = (data, configs) => {
|
|
|
272
273
|
});
|
|
273
274
|
else formData.append(transformedKey, JSON.stringify(value));
|
|
274
275
|
else if (_isRequiredKey(key)) formData.append(transformedKey, JSON.stringify(value));
|
|
275
|
-
} else if (
|
|
276
|
+
} else if (require_guards.isDateLike(value)) formData.append(transformedKey, _parseDateLike(value));
|
|
276
277
|
else if (require_specials.isNotEmptyObject(value)) if (_shouldStringify(key) && !_shouldDotNotate(key)) {
|
|
277
278
|
const cleanedValue = _cleanObject(value, key);
|
|
278
279
|
if (require_specials.isNotEmptyObject(cleanedValue) || _isRequiredKey(key)) formData.append(transformedKey, JSON.stringify(cleanedValue));
|
|
@@ -294,10 +295,10 @@ const createFormData = (data, configs) => {
|
|
|
294
295
|
if (_compareKeyPaths(fullKey, ignoreKeys)) return;
|
|
295
296
|
if (configs?.trimStrings && require_primitives.isNonEmptyString(value)) value = require_basics.trimString(value);
|
|
296
297
|
if (_shouldDotNotate(fullKey)) _addToFormData(fullKey, value);
|
|
297
|
-
else if (require_specials.isNotEmptyObject(value) && !_shouldStringify(fullKey)) if (
|
|
298
|
+
else if (require_specials.isNotEmptyObject(value) && !_shouldStringify(fullKey)) if (require_guards.isDateLike(value)) _addToFormData(key, _parseDateLike(value));
|
|
298
299
|
else _processObject(value, key);
|
|
299
300
|
else if (require_query.isFileOrBlob(value)) _addToFormData(key, value);
|
|
300
|
-
else if (
|
|
301
|
+
else if (require_guards.isDateLike(value)) _addToFormData(key, _parseDateLike(value));
|
|
301
302
|
else if (require_specials.isEmptyObject(value)) {
|
|
302
303
|
if (_isRequiredKey(fullKey)) _addToFormData(key, JSON.stringify(value));
|
|
303
304
|
} else _addToFormData(key, value);
|
package/dist/dom.mjs
CHANGED
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { a as isNonEmptyString, d as isString } from "./primitives-Djsevc69.mjs";
|
|
18
|
-
import { j as isValidArray, v as isEmptyObject, w as isNotEmptyObject } from "./specials-
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { j as isValidArray, v as isEmptyObject, w as isNotEmptyObject } from "./specials-krf7zsqI.mjs";
|
|
19
|
+
import { t as isDateLike } from "./guards-DKGBsd6x.mjs";
|
|
20
|
+
import { n as trimString } from "./basics-20lm69yy.mjs";
|
|
21
|
+
import { C as isValidFormData, S as isOriginFileObj, _ as isCustomFileArray, a as updateQueryParam, b as isFileOrBlob, g as isCustomFile, i as parseQueryStringLiteral, m as parseObjectValues, n as getQueryParams, r as parseQueryString, t as generateQueryParams, v as isFileArray, x as isFileUpload, y as isFileList } from "./query-BomnyWh3.mjs";
|
|
21
22
|
|
|
22
23
|
//#region src/dom/storage.ts
|
|
23
24
|
/**
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
18
|
-
const require_specials = require('./specials-
|
|
19
|
-
const require_utilities = require('./utilities-
|
|
20
|
-
const require_basics = require('./basics-
|
|
18
|
+
const require_specials = require('./specials-DU8u108m.cjs');
|
|
19
|
+
const require_utilities = require('./utilities-BVpk3LKy.cjs');
|
|
20
|
+
const require_basics = require('./basics-byj0VH1c.cjs');
|
|
21
21
|
|
|
22
22
|
//#region src/object/basics.ts
|
|
23
23
|
/**
|
|
@@ -65,7 +65,7 @@ const _isSimilarToLast = (recentColors, newColor) => {
|
|
|
65
65
|
* @returns `true` if it's a valid alpha value, `false` if not.
|
|
66
66
|
*/
|
|
67
67
|
function _isValidAlpha(value) {
|
|
68
|
-
return value >= 0 && value <= 1 && !isNaN(value);
|
|
68
|
+
return value >= 0 && value <= 1 && !Number.isNaN(value);
|
|
69
69
|
}
|
|
70
70
|
/** @private Validates RGB component (0–255). */
|
|
71
71
|
function _isValidRGBComponent(value) {
|