dozy 1.0.70 → 1.0.72

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/index.d.ts CHANGED
@@ -447,6 +447,48 @@ declare const shanghaiDateFormatter: Intl.DateTimeFormat;
447
447
  * @returns 返回格式化后的日期字符串。
448
448
  */
449
449
  declare function $formatDate(dateInput: string | number | Date): string;
450
+ /**
451
+ * 格式化数值为字符串,先放大再保留指定小数位数,并添加千分位分隔符。
452
+ *
453
+ * 行为说明:
454
+ * - 先将数值乘以 10^bits 进行放大。
455
+ * - 然后使用 `toFixed(bits)` 保留指定位数的小数。
456
+ * - 最后通过 `$formatWithCommas` 添加千分位逗号分隔符。
457
+ * - 当输入不是有效数字时返回 `'-'`。
458
+ *
459
+ * @param points 要格式化的数值。
460
+ * @param bits 放大倍数的指数,同时也是小数位数,默认为 `2`。
461
+ * @returns 返回格式化后的字符串(含千分位);输入无效时返回 `'-'`。
462
+ *
463
+ * @example
464
+ * $formatPoints(1.23, 2) // 返回 "123.00"
465
+ * $formatPoints(12.34, 2) // 返回 "1,234.00"
466
+ * $formatPoints(0.5, 3) // 返回 "500.000"
467
+ */
468
+ declare function $formatPoints(points: number, bits?: number): string;
469
+ /**
470
+ * 格式化数值为带符号和颜色的显示元组,并添加千分位分隔符。
471
+ *
472
+ * 行为说明:
473
+ * - 先将数值乘以 10^bits 进行放大,然后使用 `toFixed(bits)` 格式化。
474
+ * - 通过 `$formatWithCommas` 添加千分位逗号分隔符。
475
+ * - 根据数值正负自动添加符号前缀并分配对应颜色。
476
+ * - 正数:前缀 `'+'`,颜色 `'#0a0'`(绿色)。
477
+ * - 负数:前缀 `'-'`,颜色 `'#a00'`(红色)。
478
+ * - 零或其他:无前缀,颜色 `'#333'`(深灰色)。
479
+ * - 当输入不是有效数字时返回 `['+?', '#333']`。
480
+ *
481
+ * @param points 要格式化的数值。
482
+ * @param bits 放大倍数的指数,同时也是小数位数,默认为 `2`。
483
+ * @returns 返回包含显示文本(含千分位)和颜色的元组 `[display, color]`。
484
+ *
485
+ * @example
486
+ * $formatPointsWithChange(1.23, 2) // 返回 ["+123.00", "#0a0"]
487
+ * $formatPointsWithChange(12.34, 2) // 返回 ["+1,234.00", "#0a0"]
488
+ * $formatPointsWithChange(-0.5, 2) // 返回 ["-50.00", "#a00"]
489
+ * $formatPointsWithChange(0, 2) // 返回 ["0.00", "#333"]
490
+ */
491
+ declare function $formatPointsWithChange(points: number, bits?: number): [display: string, color: string];
450
492
  /**
451
493
  * 将错误转换成一个始终包含 `msg` 字段的对象。
452
494
  *
@@ -935,6 +977,6 @@ declare function toRgbString(input: string | Color | any): string | undefined;
935
977
  */
936
978
  declare function toHslString(input: string | Color | any): string | undefined;
937
979
 
938
- declare const DOZY = "1.0.70";
980
+ declare const DOZY = "1.0.72";
939
981
 
940
- export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $entries, $escapeHTML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $if, $inRange, $inRange2, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, type Any, type Atoa, type Coord, type Coord3, DOZY, type DozyConfig, type DozyConfigItem, type FileType, Gens, type Hel, type IOpt, type Items, type Null, type Nullable, RainbowGen, type ScaleComputer, type ScaleIniter, StringObfuscator, type UNumber, __GensDirectives, _res, boxShadow, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, registerCustomColor, s, shanghaiDateFormatter, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$setPathTarget, xtrim };
982
+ export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $entries, $escapeHTML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatPoints, $formatPointsWithChange, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $if, $inRange, $inRange2, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, type Any, type Atoa, type Coord, type Coord3, DOZY, type DozyConfig, type DozyConfigItem, type FileType, Gens, type Hel, type IOpt, type Items, type Null, type Nullable, RainbowGen, type ScaleComputer, type ScaleIniter, StringObfuscator, type UNumber, __GensDirectives, _res, boxShadow, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, registerCustomColor, s, shanghaiDateFormatter, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$setPathTarget, xtrim };