toolbox-x 2.0.13 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Color-B2SgCGbm.d.mts → Color-CInCJvH7.d.mts} +98 -14
- package/dist/{Color-asKZqwDF.d.cts → Color-CVRcGmWe.d.cts} +98 -14
- package/dist/{Stylog-CRNMQ_uV.d.cts → Stylog-00MmV27Z.d.cts} +1 -1
- package/dist/{Stylog-Cvzo5z86.d.mts → Stylog-Bi1f4CR9.d.mts} +1 -1
- package/dist/{array-D8VGEDBI.d.mts → array-CbAKXvhH.d.mts} +3 -1
- package/dist/{array-ChT6TxQ7.d.cts → array-EVkwcL_k.d.cts} +3 -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 +130 -24
- package/dist/colors.d.cts +2 -2
- package/dist/colors.d.mts +2 -2
- package/dist/colors.mjs +130 -24
- 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 +12 -11
- package/dist/dom.d.cts +2 -2
- package/dist/dom.d.mts +2 -2
- package/dist/dom.mjs +7 -6
- package/dist/{form-CHFqlgPr.d.cts → form-DA-YShnM.d.cts} +3 -2
- package/dist/{form-crhNgN40.d.mts → form-DIYoIS0E.d.mts} +3 -2
- 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 +2 -2
- package/dist/guards.d.mts +2 -2
- package/dist/guards.mjs +5 -4
- package/dist/hash.cjs +8 -8
- package/dist/hash.mjs +8 -8
- package/dist/{index-C9x0f9jU.d.mts → index-BbBnKdBb.d.mts} +1 -1
- package/dist/{index-BgomIbws.d.cts → index-D00Uqm9S.d.cts} +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.d.cts +4 -5
- package/dist/index.d.mts +4 -5
- 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/array.d.cts +2 -2
- package/dist/types/array.d.mts +2 -2
- package/dist/types/colors.d.cts +1 -1
- package/dist/types/colors.d.mts +1 -1
- package/dist/types/form.d.cts +1 -1
- package/dist/types/form.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
|
|
@@ -157,6 +158,18 @@ var Color = class Color {
|
|
|
157
158
|
yield this.hsla;
|
|
158
159
|
}
|
|
159
160
|
/**
|
|
161
|
+
* Allows the color to be used in string and number contexts.
|
|
162
|
+
* @param hint The hint to determine the conversion type.
|
|
163
|
+
*/
|
|
164
|
+
[Symbol.toPrimitive](hint) {
|
|
165
|
+
if (hint === "string") return this.hex8;
|
|
166
|
+
else if (hint === "number") {
|
|
167
|
+
const hex = this.hex8.endsWith("FF") ? this.hex : this.hex8;
|
|
168
|
+
return parseInt(hex.replace("#", "0x"), 16);
|
|
169
|
+
}
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
160
173
|
* @private Convert `Hex6` color format to `Hex8` by applying `100%` opacity.
|
|
161
174
|
* @param hex `Hex6` color to convert to `Hex8`.
|
|
162
175
|
*/
|
|
@@ -180,11 +193,12 @@ var Color = class Color {
|
|
|
180
193
|
return `hsla(${h}, ${s}%, ${l}%, 1)`;
|
|
181
194
|
}
|
|
182
195
|
/**
|
|
183
|
-
* @instance
|
|
196
|
+
* @instance Sets the opacity of this color to the given **absolute** percentage and returns a new instance.
|
|
184
197
|
*
|
|
185
198
|
* @remarks
|
|
199
|
+
* - This is an **absolute setter**: passing `50` means "set opacity to exactly 50%", regardless of the current opacity.
|
|
186
200
|
* - 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}):
|
|
201
|
+
* - For alpha colors ({@link Hex8}/{@link RGBA}/{@link HSLA}): Replaces the existing alpha channel.
|
|
188
202
|
*
|
|
189
203
|
* @param opacity - A number between `0-100` representing the opacity percentage.
|
|
190
204
|
* @returns A new instance of `Color` containing all color formats with the applied opacity.
|
|
@@ -203,40 +217,81 @@ var Color = class Color {
|
|
|
203
217
|
return new Color(`${this.hex.slice(0, 7)}${percentToHex(opacity)}`.toUpperCase());
|
|
204
218
|
}
|
|
205
219
|
/**
|
|
206
|
-
* @instance Darkens the color by
|
|
207
|
-
*
|
|
208
|
-
* @
|
|
220
|
+
* @instance Darkens the color by **subtracting** the given percentage points from the current lightness in HSL space.
|
|
221
|
+
*
|
|
222
|
+
* @remarks
|
|
223
|
+
* - This is a **relative adjustment**: passing `20` means "reduce lightness by 20 percentage points" from its current value.
|
|
224
|
+
* - Lightness is clamped to `0%` at minimum.
|
|
225
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
226
|
+
*
|
|
227
|
+
* @param percent - The percentage points to subtract from lightness (`0–100`).
|
|
228
|
+
* @returns A new `Color` instance with the reduced lightness.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* const blue = new Color("#0000ff"); // hsl(240, 100%, 50%)
|
|
232
|
+
* const darkerBlue = blue.applyDarkness(20);
|
|
233
|
+
* console.log(darkerBlue.hsl); // hsl(240, 100%, 30%)
|
|
209
234
|
*/
|
|
210
235
|
applyDarkness(percent) {
|
|
211
236
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
212
237
|
return new Color(`hsl(${h}, ${s}%, ${Math.max(0, l - percent)}%)`).applyOpacity(a * 100);
|
|
213
238
|
}
|
|
214
239
|
/**
|
|
215
|
-
* @instance Lightens the color by
|
|
216
|
-
*
|
|
217
|
-
* @
|
|
240
|
+
* @instance Lightens the color by **adding** the given percentage points to the current lightness in HSL space.
|
|
241
|
+
*
|
|
242
|
+
* @remarks
|
|
243
|
+
* - This is a **relative adjustment**: passing `30` means "increase lightness by 30 percentage points" from its current value.
|
|
244
|
+
* - Lightness is clamped to `100%` at maximum.
|
|
245
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
246
|
+
*
|
|
247
|
+
* @param percent - The percentage points to add to lightness (`0–100`).
|
|
248
|
+
* @returns A new `Color` instance with the increased lightness.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* const green = new Color("#008000"); // hsl(120, 100%, 25.1%)
|
|
252
|
+
* const lighterGreen = green.applyBrightness(30);
|
|
253
|
+
* console.log(lighterGreen.hsl); // hsl(120, 100%, 55.1%)
|
|
218
254
|
*/
|
|
219
255
|
applyBrightness(percent) {
|
|
220
256
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
221
257
|
return new Color(`hsl(${h}, ${s}%, ${Math.min(100, l + percent)}%)`).applyOpacity(a * 100);
|
|
222
258
|
}
|
|
223
259
|
/**
|
|
224
|
-
* @instance
|
|
225
|
-
*
|
|
226
|
-
* @
|
|
260
|
+
* @instance Desaturates the color by **subtracting** the given percentage points from the current saturation in HSL space.
|
|
261
|
+
*
|
|
262
|
+
* @remarks
|
|
263
|
+
* - This is a **relative adjustment**: passing `50` means "reduce saturation by 50 percentage points" from its current value.
|
|
264
|
+
* - Saturation is clamped to `0%` at minimum (fully desaturated / grayscale).
|
|
265
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
266
|
+
*
|
|
267
|
+
* @param percent - The percentage points to subtract from saturation (`0–100`).
|
|
268
|
+
* @returns A new `Color` instance with the reduced saturation.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* const pink = new Color("#ff69b4"); // hsl(330, 100%, 70.59%)
|
|
272
|
+
* const dullPink = pink.applyDullness(50);
|
|
273
|
+
* console.log(dullPink.hsl); // hsl(330, 50%, 70.59%)
|
|
227
274
|
*/
|
|
228
275
|
applyDullness(percent) {
|
|
229
276
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
230
277
|
return new Color(`hsl(${h}, ${Math.max(0, s - percent)}%, ${l}%)`).applyOpacity(a * 100);
|
|
231
278
|
}
|
|
232
279
|
/**
|
|
233
|
-
* @instance Softens the color toward white by reducing saturation and increasing lightness
|
|
280
|
+
* @instance Softens the color toward white by **proportionally** reducing saturation and increasing lightness.
|
|
234
281
|
*
|
|
235
282
|
* @remarks
|
|
236
|
-
* This
|
|
283
|
+
* - This is a **proportional blend**: passing `40` means "move 40% of the *remaining distance* toward pure white".
|
|
284
|
+
* - Unlike {@link applyBrightness} or {@link applyDullness}, the effect scales relative to the current distance from white, producing a natural pastel/tint effect.
|
|
285
|
+
* - This creates a soft UI-like white shade effect (similar to some UI libraries' light color scale).
|
|
286
|
+
* - The original alpha (opacity) is preserved in the returned color.
|
|
237
287
|
*
|
|
238
288
|
* @param percent - Value from `0` to `100` representing how far to push the color toward white.
|
|
239
289
|
* @returns A new `Color` instance shifted toward white.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* const purple = new Color("#800080"); // hsl(300, 100%, 25.1%)
|
|
293
|
+
* const softPurple = purple.applyWhiteShade(40);
|
|
294
|
+
* console.log(softPurple.hsl); // hsl(300, 60%, 55.06%)
|
|
240
295
|
*/
|
|
241
296
|
applyWhiteShade(percent) {
|
|
242
297
|
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
@@ -257,14 +312,14 @@ var Color = class Color {
|
|
|
257
312
|
*/
|
|
258
313
|
blendWith(other, weight = .5) {
|
|
259
314
|
const w = Math.max(0, Math.min(1, weight));
|
|
260
|
-
const converted =
|
|
261
|
-
const [r1,
|
|
262
|
-
const [r2,
|
|
315
|
+
const converted = new Color(other);
|
|
316
|
+
const [r1, g1, b1, a1] = extractAlphaColorValues(this.rgba);
|
|
317
|
+
const [r2, g2, b2, a2] = extractAlphaColorValues(converted.rgba);
|
|
263
318
|
const alpha = Math.round((a1 * (1 - w) + a2 * w) * 100) / 100;
|
|
264
|
-
const
|
|
319
|
+
const _blendChannel = (c1, c2) => {
|
|
265
320
|
return Math.round((c1 * a1 * (1 - w) + c2 * a2 * w) / alpha);
|
|
266
321
|
};
|
|
267
|
-
return new Color(`rgba(${
|
|
322
|
+
return new Color(`rgba(${_blendChannel(r1, r2)}, ${_blendChannel(g1, g2)}, ${_blendChannel(b1, b2)}, ${alpha})`);
|
|
268
323
|
}
|
|
269
324
|
/**
|
|
270
325
|
* @instance Calculates the contrast ratio between this color and another color (WCAG).
|
|
@@ -272,11 +327,11 @@ var Color = class Color {
|
|
|
272
327
|
* @returns A number representing the contrast ratio (rounded to 2 decimal places).
|
|
273
328
|
*/
|
|
274
329
|
contrastRatio(other) {
|
|
275
|
-
const newColor =
|
|
330
|
+
const newColor = new Color(other);
|
|
276
331
|
const luminance = (rgb) => {
|
|
277
332
|
const [r, g, b] = extractSolidColorValues(rgb).map((v) => {
|
|
278
333
|
const c = v / 255;
|
|
279
|
-
return c <= .03928 ? c / 12.92 :
|
|
334
|
+
return c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
|
|
280
335
|
});
|
|
281
336
|
return .2126 * r + .7152 * g + .0722 * b;
|
|
282
337
|
};
|
|
@@ -352,6 +407,35 @@ var Color = class Color {
|
|
|
352
407
|
].map((c) => c.applyOpacity(a * 100));
|
|
353
408
|
}
|
|
354
409
|
/**
|
|
410
|
+
* @instance Generates a color palette of evenly distributed hues based on the current color's saturation, lightness, and alpha.
|
|
411
|
+
*
|
|
412
|
+
* @remarks
|
|
413
|
+
* - Colors are spaced evenly around the color wheel (`360° / count` apart), starting from the current hue.
|
|
414
|
+
* - Saturation, lightness, and alpha from the source color are preserved across all generated colors.
|
|
415
|
+
*
|
|
416
|
+
* @typeParam N - A literal number type representing the palette size.
|
|
417
|
+
* @param count - The number of colors to generate in the palette (must be a positive integer ≥ `1`). Default: `7`.
|
|
418
|
+
* @param step - The step value (degree) to be added to the hue of the previous color. Default: `360 / count`.
|
|
419
|
+
* @returns Array of `Color` instances with the specified count.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* const red = new Color("#ff0000");
|
|
423
|
+
* const palette = red.generatePalette(4);
|
|
424
|
+
* console.log(palette.map((color) => color.hex));
|
|
425
|
+
* // ['#FF0000', '#80FF00', '#00FFFF', '#8000FF']
|
|
426
|
+
*/
|
|
427
|
+
generatePalette(count, step) {
|
|
428
|
+
const [h, s, l, a] = extractAlphaColorValues(this.hsla);
|
|
429
|
+
const clampedCount = clampNumber(count ?? 7, 1, 360);
|
|
430
|
+
const calculatedStep = step ? clampNumber(step, 1, 360) : 360 / clampedCount;
|
|
431
|
+
const colors = [];
|
|
432
|
+
for (let i = 0; i < clampedCount; i++) {
|
|
433
|
+
const color = new Color(`hsl(${(h + calculatedStep * i) % 360}, ${s}%, ${l}%)`).applyOpacity(a * 100);
|
|
434
|
+
colors.push(color);
|
|
435
|
+
}
|
|
436
|
+
return colors;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
355
439
|
* @instance Gets the `WCAG` accessibility rating between this and another color.
|
|
356
440
|
* @param other - The other color to test contrast against.
|
|
357
441
|
* @returns `'Fail'`, `'AA'`, or `'AAA'` based on `WCAG 2.1` contrast standards.
|
|
@@ -373,6 +457,28 @@ var Color = class Color {
|
|
|
373
457
|
return (r * 299 + g * 587 + b * 114) / 1e3 > Math.min(255, Math.max(0, threshold));
|
|
374
458
|
}
|
|
375
459
|
/**
|
|
460
|
+
* @instance Convert the color to string.
|
|
461
|
+
* @returns The `Hex8` representation of the color.
|
|
462
|
+
*
|
|
463
|
+
* @remarks
|
|
464
|
+
* - Called by `String()`, `Object.prototype.toString()` or in template literals.
|
|
465
|
+
* - Uses the same implementation as `toJSON()`.
|
|
466
|
+
*/
|
|
467
|
+
toString() {
|
|
468
|
+
return this.hex8;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* @instance Convert the color to JSON.
|
|
472
|
+
* @returns The `Hex8` representation of the color.
|
|
473
|
+
*
|
|
474
|
+
* @remarks
|
|
475
|
+
* - Called by `JSON.stringify()`.
|
|
476
|
+
* - It uses the same implementation as `toString()`.
|
|
477
|
+
*/
|
|
478
|
+
toJSON() {
|
|
479
|
+
return this.hex8;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
376
482
|
* @static Checks if a color is in {@link Hex6} format.
|
|
377
483
|
*
|
|
378
484
|
* @param color Color to check.
|
|
@@ -524,10 +630,10 @@ function getColorForInitial(input = "", opacity = 100) {
|
|
|
524
630
|
return _applyOpacity(DEFAULT, hexOpacity);
|
|
525
631
|
} else if (Array.isArray(input)) {
|
|
526
632
|
if (input?.length < 1) return [...ALPHABET_COLOR_PALETTE, ...NUMBER_COLOR_PALETTE].map((color) => _applyOpacity(color, hexOpacity));
|
|
527
|
-
return input.
|
|
633
|
+
return input.flatMap((el) => {
|
|
528
634
|
if (Array.isArray(el)) return getColorForInitial(el, opacity);
|
|
529
635
|
return getColorForInitial(el, opacity);
|
|
530
|
-
})
|
|
636
|
+
});
|
|
531
637
|
}
|
|
532
638
|
return _applyOpacity(DEFAULT, hexOpacity);
|
|
533
639
|
}
|
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;
|
|
@@ -253,13 +254,13 @@ const createFormData = (data, configs) => {
|
|
|
253
254
|
const _addToFormData = (key, value) => {
|
|
254
255
|
const transformedKey = _transformKey(key);
|
|
255
256
|
if (_compareKeyPaths(transformedKey, ignoreKeys)) return;
|
|
256
|
-
if (require_query.isCustomFileArray(value))
|
|
257
|
+
if (require_query.isCustomFileArray(value)) for (const file of value) formData.append(transformedKey, file?.originFileObj);
|
|
257
258
|
else if (require_query.isFileUpload(value)) {
|
|
258
|
-
if (value?.fileList) value
|
|
259
|
+
if (value?.fileList) for (const file of value.fileList) formData.append(transformedKey, file?.originFileObj);
|
|
259
260
|
else if (value?.file) if (require_query.isCustomFile(value?.file)) formData.append(transformedKey, value?.file?.originFileObj);
|
|
260
261
|
else formData.append(transformedKey, value?.file);
|
|
261
262
|
} else if (require_query.isFileOrBlob(value)) formData.append(transformedKey, value);
|
|
262
|
-
else if (require_query.isFileList(value)) for (let i = 0; i < value?.length; i++) formData.append(transformedKey, value
|
|
263
|
+
else if (require_query.isFileList(value)) for (let i = 0; i < value?.length; i++) formData.append(transformedKey, value?.item(i));
|
|
263
264
|
else if (Array.isArray(value)) {
|
|
264
265
|
if (require_query.isFileArray(value)) if (_shouldBreakArray(key)) value?.forEach((item, index) => {
|
|
265
266
|
_addToFormData(`${transformedKey}[${index}]`, item);
|
|
@@ -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.d.cts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { J as Deserializer, ft as Serializer, y as GenericObject } from "./object-DyVg8BFt.cjs";
|
|
18
18
|
import { a as updateQueryParam, i as parseQueryStringLiteral, n as getQueryParams, r as parseQueryString, t as generateQueryParams } from "./query-BLsaWi3q.cjs";
|
|
19
|
-
import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "./form-
|
|
19
|
+
import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "./form-DA-YShnM.cjs";
|
|
20
20
|
|
|
21
21
|
//#region src/dom/storage.d.ts
|
|
22
22
|
/**
|
|
@@ -166,6 +166,6 @@ declare function serializeForm<T extends boolean = false>(form: HTMLFormElement,
|
|
|
166
166
|
* @param parsePrimitives - Whether to parse string values into primitive types (e.g., boolean, number, array, object). Defaults to `true`.
|
|
167
167
|
* @returns The parsed form data as an object.
|
|
168
168
|
*/
|
|
169
|
-
declare function parseFormData<
|
|
169
|
+
declare function parseFormData<D extends FormData | string, P extends boolean = true>(data: D, parsePrimitives?: P): ParsedFormData<D, P>;
|
|
170
170
|
//#endregion
|
|
171
171
|
export { createFormData as convertToFormData, createFormData, copyToClipboard, generateQueryParams as createQueryParams, generateQueryParams as formatQueryParams, generateQueryParams, getFromLocalStorage, getFromSessionStorage, getQueryParams, parseQueryString as getQueryStringAsObject, parseQueryString, parseQueryString as queryStringToObject, isCustomFile, isCustomFileArray, isFileArray, isFileList, isFileOrBlob, isFileUpload, isOriginFileObj, isValidFormData, parseQueryStringLiteral as literalQueryStringToObject, parseQueryStringLiteral, parseFormData, removeFromLocalStorage, removeFromSessionStorage, saveToLocalStorage, saveToSessionStorage, serializeForm, smoothScrollTo, toggleFullScreen, updateQueryParam };
|
package/dist/dom.d.mts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { J as Deserializer, ft as Serializer, y as GenericObject } from "./object-DyVg8BFt.mjs";
|
|
18
18
|
import { a as updateQueryParam, i as parseQueryStringLiteral, n as getQueryParams, r as parseQueryString, t as generateQueryParams } from "./query-Bi_ofCBp.mjs";
|
|
19
|
-
import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "./form-
|
|
19
|
+
import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "./form-DIYoIS0E.mjs";
|
|
20
20
|
|
|
21
21
|
//#region src/dom/storage.d.ts
|
|
22
22
|
/**
|
|
@@ -166,6 +166,6 @@ declare function serializeForm<T extends boolean = false>(form: HTMLFormElement,
|
|
|
166
166
|
* @param parsePrimitives - Whether to parse string values into primitive types (e.g., boolean, number, array, object). Defaults to `true`.
|
|
167
167
|
* @returns The parsed form data as an object.
|
|
168
168
|
*/
|
|
169
|
-
declare function parseFormData<
|
|
169
|
+
declare function parseFormData<D extends FormData | string, P extends boolean = true>(data: D, parsePrimitives?: P): ParsedFormData<D, P>;
|
|
170
170
|
//#endregion
|
|
171
171
|
export { createFormData as convertToFormData, createFormData, copyToClipboard, generateQueryParams as createQueryParams, generateQueryParams as formatQueryParams, generateQueryParams, getFromLocalStorage, getFromSessionStorage, getQueryParams, parseQueryString as getQueryStringAsObject, parseQueryString, parseQueryString as queryStringToObject, isCustomFile, isCustomFileArray, isFileArray, isFileList, isFileOrBlob, isFileUpload, isOriginFileObj, isValidFormData, parseQueryStringLiteral as literalQueryStringToObject, parseQueryStringLiteral, parseFormData, removeFromLocalStorage, removeFromSessionStorage, saveToLocalStorage, saveToSessionStorage, serializeForm, smoothScrollTo, toggleFullScreen, updateQueryParam };
|
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
|
/**
|
|
@@ -252,13 +253,13 @@ const createFormData = (data, configs) => {
|
|
|
252
253
|
const _addToFormData = (key, value) => {
|
|
253
254
|
const transformedKey = _transformKey(key);
|
|
254
255
|
if (_compareKeyPaths(transformedKey, ignoreKeys)) return;
|
|
255
|
-
if (isCustomFileArray(value))
|
|
256
|
+
if (isCustomFileArray(value)) for (const file of value) formData.append(transformedKey, file?.originFileObj);
|
|
256
257
|
else if (isFileUpload(value)) {
|
|
257
|
-
if (value?.fileList) value
|
|
258
|
+
if (value?.fileList) for (const file of value.fileList) formData.append(transformedKey, file?.originFileObj);
|
|
258
259
|
else if (value?.file) if (isCustomFile(value?.file)) formData.append(transformedKey, value?.file?.originFileObj);
|
|
259
260
|
else formData.append(transformedKey, value?.file);
|
|
260
261
|
} else if (isFileOrBlob(value)) formData.append(transformedKey, value);
|
|
261
|
-
else if (isFileList(value)) for (let i = 0; i < value?.length; i++) formData.append(transformedKey, value
|
|
262
|
+
else if (isFileList(value)) for (let i = 0; i < value?.length; i++) formData.append(transformedKey, value?.item(i));
|
|
262
263
|
else if (Array.isArray(value)) {
|
|
263
264
|
if (isFileArray(value)) if (_shouldBreakArray(key)) value?.forEach((item, index) => {
|
|
264
265
|
_addToFormData(`${transformedKey}[${index}]`, item);
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { S as KeyForObject, T as NestedKeyString, ai as RequireExactly, u as DotNotationKey, x as KeyForArray } from "./object-DyVg8BFt.cjs";
|
|
17
|
+
import { S as KeyForObject, T as NestedKeyString, ai as RequireExactly, at as NormalPrimitive, u as DotNotationKey, x as KeyForArray } from "./object-DyVg8BFt.cjs";
|
|
18
18
|
import { F as QueryString } from "./string-EMT7czsU.cjs";
|
|
19
|
+
import { f as TypeOrArray } from "./array-EVkwcL_k.cjs";
|
|
19
20
|
|
|
20
21
|
//#region src/types/form.d.ts
|
|
21
22
|
/** - Configuration options to control FormData generation behavior. */
|
|
@@ -111,6 +112,6 @@ interface FileError extends Error {
|
|
|
111
112
|
/** THe return type of `serializeForm` wither as object or query string. */
|
|
112
113
|
type SerializedForm<T extends boolean> = T extends false ? Record<string, string | string[]> : QueryString;
|
|
113
114
|
/** * Represents the parsed form data. */
|
|
114
|
-
type ParsedFormData<T> = T extends string ? Record<string,
|
|
115
|
+
type ParsedFormData<T extends FormData | string, P extends boolean> = T extends string ? Record<string, P extends true ? TypeOrArray<NormalPrimitive> : TypeOrArray<string>> : Record<string, P extends true ? TypeOrArray<NormalPrimitive | File> : TypeOrArray<string | File>>;
|
|
115
116
|
//#endregion
|
|
116
117
|
export { OriginFileObj as a, FormDataConfigs as i, FileError as n, ParsedFormData as o, FileUpload as r, SerializedForm as s, CustomFile as t };
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { S as KeyForObject, T as NestedKeyString, ai as RequireExactly, u as DotNotationKey, x as KeyForArray } from "./object-DyVg8BFt.mjs";
|
|
17
|
+
import { S as KeyForObject, T as NestedKeyString, ai as RequireExactly, at as NormalPrimitive, u as DotNotationKey, x as KeyForArray } from "./object-DyVg8BFt.mjs";
|
|
18
18
|
import { F as QueryString } from "./string-GQsmDdYa.mjs";
|
|
19
|
+
import { f as TypeOrArray } from "./array-CbAKXvhH.mjs";
|
|
19
20
|
|
|
20
21
|
//#region src/types/form.d.ts
|
|
21
22
|
/** - Configuration options to control FormData generation behavior. */
|
|
@@ -111,6 +112,6 @@ interface FileError extends Error {
|
|
|
111
112
|
/** THe return type of `serializeForm` wither as object or query string. */
|
|
112
113
|
type SerializedForm<T extends boolean> = T extends false ? Record<string, string | string[]> : QueryString;
|
|
113
114
|
/** * Represents the parsed form data. */
|
|
114
|
-
type ParsedFormData<T> = T extends string ? Record<string,
|
|
115
|
+
type ParsedFormData<T extends FormData | string, P extends boolean> = T extends string ? Record<string, P extends true ? TypeOrArray<NormalPrimitive> : TypeOrArray<string>> : Record<string, P extends true ? TypeOrArray<NormalPrimitive | File> : TypeOrArray<string | File>>;
|
|
115
116
|
//#endregion
|
|
116
117
|
export { OriginFileObj as a, FormDataConfigs as i, FileError as n, ParsedFormData as o, FileUpload as r, SerializedForm as s, CustomFile as t };
|
|
@@ -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) {
|