dozy 1.0.77 → 1.0.79

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
@@ -552,17 +552,35 @@ declare function isNowAroundUtcHour(targetHour: number): boolean;
552
552
  */
553
553
  declare function $purifyBase64(input: string | Null): string | null;
554
554
  /**
555
- * 基于“纯 base64”推断图片 mime 类型。
555
+ * 基于“纯 base64”推断文件 mime 类型。
556
556
  *
557
557
  * 说明:
558
- * - 自动支持:jpeg/png/gif/webp/bmp/tiff/avif/heic/x-icon。
558
+ * - 图片:jpeg/png/gif/webp/bmp/tiff/avif/heic/x-icon/svg+xml
559
+ * - 音频:mpeg(mp3)/wav/ogg/flac/aac/m4a。
560
+ * - 视频:mp4/webm/quicktime(mov)/x-msvideo(avi)/x-matroska(mkv)。
561
+ * - 文档:pdf/msword(doc)/vnd.ms-excel(xls)/vnd.ms-powerpoint(ppt)/
562
+ * vnd.openxmlformats-officedocument.*(docx/xlsx/pptx)。
563
+ * - 压缩包:zip/x-rar-compressed/x-7z-compressed/gzip/x-tar。
564
+ * - 其它:xml。
559
565
  * - 输入可为纯 base64 或 data URL,内部会先清洗。
560
- * - 无法识别时回退为 `image/png`。
566
+ * - 无法识别时回退为 `application/octet-stream`。
561
567
  *
562
568
  * 返回值约定:
563
569
  * - 一定返回非空 mime 字符串(不会返回 null/undefined/空串)。
564
570
  */
565
- declare function $inferMimeTypeFormPureBase64(pureBase64: string | Null): "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/tiff" | "image/avif" | "image/heic" | "image/x-icon";
571
+ declare function $inferMimeTypeFormPureBase64(pureBase64: string | Null): "application/xml" | "image/svg+xml" | "application/octet-stream" | "image/jpeg" | "image/png" | "image/gif" | "image/bmp" | "image/tiff" | "image/x-icon" | "image/webp" | "audio/wav" | "video/x-msvideo" | "image/avif" | "image/heic" | "video/quicktime" | "audio/mp4" | "video/mp4" | "video/webm" | "video/x-matroska" | "audio/ogg" | "audio/flac" | "audio/mpeg" | "audio/aac" | "application/pdf" | "application/x-cfb" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/zip" | "application/x-rar-compressed" | "application/x-7z-compressed" | "application/gzip" | "application/x-tar";
572
+ /**
573
+ * 基于“纯 base64”推断文件后缀。
574
+ *
575
+ * 说明:
576
+ * - 覆盖 `$inferMimeTypeFormPureBase64` 支持的全部类型。
577
+ * - 输入可为纯 base64 或 data URL,内部会先清洗。
578
+ * - 无法识别时回退为 `bin`。
579
+ *
580
+ * 返回值约定:
581
+ * - 一定返回非空后缀字符串(不含点号,不会返回 null/undefined/空串)。
582
+ */
583
+ declare function $inferExtensionFormPureBase64(pureBase64: string | Null): "xml" | "jpg" | "png" | "gif" | "bmp" | "svg" | "webp" | "mp3" | "wav" | "ogg" | "aac" | "flac" | "m4a" | "mp4" | "webm" | "mov" | "avi" | "mkv" | "avif" | "heic" | "tiff" | "ico" | "pdf" | "doc" | "docx" | "xlsx" | "pptx" | "zip" | "rar" | "7z" | "gz" | "tar" | "bin";
566
584
  /**
567
585
  * 将“纯 base64 或 data URL”统一转成标准 data URL。
568
586
  *
@@ -887,7 +905,7 @@ declare class StringObfuscator {
887
905
  }
888
906
 
889
907
  /**
890
- * StoreRepo - GitHub 仓库内容存储类
908
+ * RepoStore - GitHub 仓库内容存储类
891
909
  *
892
910
  * 基于 Octokit 实现的 GitHub 仓库文件操作类,支持文件的增删改查、JSON 序列化存储、
893
911
  * 目录列表等功能。所有操作都通过 GitHub REST API v3 的 Contents API 完成。
@@ -900,7 +918,7 @@ declare class StringObfuscator {
900
918
  *
901
919
  * @example
902
920
  * ```typescript
903
- * const repo = new StoreRepo('github-token', 'username', 'repo-name')
921
+ * const repo = new RepoStore('github-token', 'username', 'repo-name')
904
922
  *
905
923
  * // 存储 JSON 数据
906
924
  * await repo.putJson('data/config.json', { key: 'value' })
@@ -912,7 +930,7 @@ declare class StringObfuscator {
912
930
  * const files = await repo.list('data')
913
931
  * ```
914
932
  */
915
- declare class StoreRepo {
933
+ declare class RepoStore {
916
934
  /**
917
935
  * Octokit 实例,用于与 GitHub API 交互
918
936
  * @internal
@@ -951,7 +969,7 @@ declare class StoreRepo {
951
969
  *
952
970
  * @example
953
971
  * ```typescript
954
- * class EncryptedStoreRepo extends StoreRepo {
972
+ * class EncryptedRepoStore extends RepoStore {
955
973
  * _prind(content: string, en: boolean) {
956
974
  * return en ? encrypt(content) : decrypt(content)
957
975
  * }
@@ -974,7 +992,7 @@ declare class StoreRepo {
974
992
  *
975
993
  * @example
976
994
  * ```typescript
977
- * class PrefixedStoreRepo extends StoreRepo {
995
+ * class PrefixedRepoStore extends RepoStore {
978
996
  * path(path: string) {
979
997
  * return `data/${path}`
980
998
  * }
@@ -1055,7 +1073,7 @@ declare class StoreRepo {
1055
1073
  *
1056
1074
  * @example
1057
1075
  * ```typescript
1058
- * class CustomMsgStoreRepo extends StoreRepo {
1076
+ * class CustomMsgRepoStore extends RepoStore {
1059
1077
  * msg() {
1060
1078
  * return `Update at ${new Date().toISOString()}`
1061
1079
  * }
@@ -1252,7 +1270,7 @@ declare class StoreRepo {
1252
1270
  type: any;
1253
1271
  }[] | undefined>;
1254
1272
  /**
1255
- * 创建 StoreRepo 实例
1273
+ * 创建 RepoStore 实例
1256
1274
  *
1257
1275
  * @param x0 - GitHub Personal Access Token(个人访问令牌)
1258
1276
  * - 需要具有对目标仓库的读写权限
@@ -1268,14 +1286,14 @@ declare class StoreRepo {
1268
1286
  * @example
1269
1287
  * ```typescript
1270
1288
  * // 基本用法
1271
- * const repo = new StoreRepo(
1289
+ * const repo = new RepoStore(
1272
1290
  * 'ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // GitHub Token
1273
1291
  * 'myusername', // 所有者
1274
1292
  * 'my-repo' // 仓库名
1275
1293
  * )
1276
1294
  *
1277
1295
  * // 组织仓库
1278
- * const orgRepo = new StoreRepo(
1296
+ * const orgRepo = new RepoStore(
1279
1297
  * process.env.GITHUB_TOKEN,
1280
1298
  * 'my-organization',
1281
1299
  * 'org-repo'
@@ -1377,6 +1395,6 @@ declare function toRgbString(input: string | Color | any): string | undefined;
1377
1395
  */
1378
1396
  declare function toHslString(input: string | Color | any): string | undefined;
1379
1397
 
1380
- declare const DOZY = "1.0.77";
1398
+ declare const DOZY = "1.0.79";
1381
1399
 
1382
- 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, StoreRepo, 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 };
1400
+ 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, $inferExtensionFormPureBase64, $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, RepoStore, 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 };