@mingto/tools 1.0.685 → 1.0.686

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.
Files changed (3) hide show
  1. package/README.md +225 -110
  2. package/dist/index.js +89 -64
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,110 +1,225 @@
1
- # @mingto/tools
2
-
3
- 一套实用的 TypeScript 工具库,提供类型安全的函数来简化日常开发任务。
4
-
5
- ## 特性
6
-
7
- - 🎯 **类型安全**:完整的 TypeScript 类型定义支持
8
- - 🔧 **功能丰富**:涵盖字符串、数组、对象、数学运算、浏览器检测、文件处理等多个领域
9
- - 📦 **轻量高效**:按需导入,无冗余代码
10
- - 🌍 **国际化支持**:内置多语言切换功能
11
-
12
- ## 安装
13
-
14
- ```bash
15
- pnpm add @mingto/tools
16
- ```
17
-
18
- ## 功能概览
19
-
20
- ### 类型判断
21
-
22
- ```typescript
23
- import { isNumber, isString, isObject, isArray } from '@mingto/tools'
24
-
25
- isNumber(123) // true
26
- isString('hello') // true
27
- isObject({ a: 1 }) // true
28
- isArray([1, 2, 3]) // true
29
- ```
30
-
31
- ### 空值检查
32
-
33
- ```typescript
34
- import { checkEmpty, checkObjectEmpty, checkArrayEmpty } from '@mingto/tools'
35
-
36
- checkEmpty('') // true
37
- checkEmpty(null) // true
38
- checkEmpty({}) // true
39
- checkEmpty([]) // true
40
- checkEmpty('text') // false
41
- ```
42
-
43
- ### 数学运算
44
-
45
- ```typescript
46
- import { add, subtract, multiply, divide } from '@mingto/tools'
47
-
48
- add(0.1, 0.2) // 0.3 (精确计算,无浮点误差)
49
- subtract(0.3, 0.1) // 0.2
50
- multiply(0.1, 0.2) // 0.02
51
- divide(10, 3) // 3.333...
52
- ```
53
-
54
- ### 字符串处理
55
-
56
- ```typescript
57
- import { chunkString, objectToQueryString, queryStringToObject } from '@mingto/tools'
58
-
59
- chunkString('abcdef', 2) // ['ab', 'cd', 'ef']
60
- objectToQueryString({ a: 1, b: 'x y' }) // 'a=1&b=x%20y'
61
- queryStringToObject('a=1&b=x%20y') // { a: '1', b: 'x y' }
62
- ```
63
-
64
- ### 函数工具
65
-
66
- ```typescript
67
- import { throttle, debounce } from '@mingto/tools'
68
-
69
- const throttledFn = throttle(handleScroll, 500)
70
- const debouncedFn = debounce(handleResize, 300)
71
- ```
72
-
73
- ### 浏览器检测
74
-
75
- ```typescript
76
- import { isMobile, isPc, isIos, isAndroid } from '@mingto/tools'
77
-
78
- isMobile() // true / false
79
- isPc() // true / false
80
- isIos() // true / false
81
- isAndroid() // true / false
82
- ```
83
-
84
- ### 文件处理
85
-
86
- ```typescript
87
- import { getFileSuffix, getFileName, getFileTitle } from '@mingto/tools'
88
-
89
- getFileSuffix('/path/to/file.pdf') // 'pdf'
90
- getFileName('/path/to/file.pdf') // 'file.pdf'
91
- getFileTitle('/path/to/file.pdf') // 'file'
92
- ```
93
-
94
- ### 国际化
95
-
96
- ```typescript
97
- import tools from '@mingto/tools'
98
-
99
- tools.locale('zh-cn') // 设置中文简体
100
- tools.locale('en') // 设置英文
101
- tools.getLocale() // 获取当前语言
102
- ```
103
-
104
- ## 完整 API 文档
105
-
106
- 更多函数和详细用法请参考 [官方文档](https://mingto.github.io/mt-utils/tools/)
107
-
108
- ## 许可证
109
-
110
- MIT
1
+ # @mingto/tools
2
+
3
+ 明途公共 TypeScript 工具库,提供类型判断、浏览器工具、文件处理、数学计算、字符串处理、函数控制、下载、WebSocket、Worker、主题和国际化等能力。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @mingto/tools
9
+ ```
10
+
11
+ ## 使用方式
12
+
13
+ ```typescript
14
+ import { isString, add, getFileSuffix } from '@mingto/tools'
15
+
16
+ isString('hello')
17
+ add(0.1, 0.2)
18
+ getFileSuffix('/demo/file.pdf')
19
+ ```
20
+
21
+ 默认导出提供国际化语言设置能力:
22
+
23
+ ```typescript
24
+ import tools from '@mingto/tools'
25
+
26
+ tools.locale('zh-cn')
27
+ tools.getLocale()
28
+ ```
29
+
30
+ ## 模块清单
31
+
32
+ ### array
33
+
34
+ | API | 说明 |
35
+ |-----|------|
36
+ | `chunkArray` | 将数组按指定长度切分 |
37
+
38
+ ### browser
39
+
40
+ | API | 说明 |
41
+ |-----|------|
42
+ | `copyText` | 复制文本到剪贴板 |
43
+ | `createAudioPermission` | 创建音频播放权限辅助能力 |
44
+ | `getAbsoluteUrl` | 获取绝对 URL |
45
+ | `getBrowserFingerprint` | 获取浏览器指纹 |
46
+ | `isAndroid` | 判断 Android 环境 |
47
+ | `isIos` | 判断 iOS 环境 |
48
+ | `isMobile` | 判断移动端环境 |
49
+ | `isPc` | 判断 PC 环境 |
50
+
51
+ ### core
52
+
53
+ | API | 说明 |
54
+ |-----|------|
55
+ | `beParsedAsNumber` | 将值按数字解析 |
56
+ | `canBeParsedAsNumber` | 判断值是否可解析为数字 |
57
+ | `checkArrayEmpty` | 判断数组是否为空 |
58
+ | `checkEmpty` | 判断值是否为空 |
59
+ | `checkEmptyNotZero` | 判断值是否为空但保留数字 0 |
60
+ | `checkObjectEmpty` | 判断对象是否为空 |
61
+ | `isArray` | 判断数组 |
62
+ | `isBoolean` | 判断布尔值 |
63
+ | `isFunction` | 判断函数 |
64
+ | `isNullOrUndefined` | 判断 `null` 或 `undefined` |
65
+ | `isNumber` | 判断数字 |
66
+ | `isObject` | 判断对象 |
67
+ | `isString` | 判断字符串 |
68
+ | `isUndefined` | 判断 `undefined` |
69
+
70
+ ### file
71
+
72
+ | API | 说明 |
73
+ |-----|------|
74
+ | `batchDownloadFile` | 批量下载文件 |
75
+ | `getFileIcon` | 获取文件图标 |
76
+ | `getFileName` | 获取文件名 |
77
+ | `getFilePathNotQuery` | 获取去除 query 的文件路径 |
78
+ | `getFileQuery` | 获取文件路径 query |
79
+ | `getFileSuffix` | 获取文件后缀 |
80
+ | `getFileSuffixIcon` | 获取文件后缀图标 |
81
+ | `getFileTitle` | 获取文件标题 |
82
+ | `isCompressFilePath` | 判断压缩文件路径 |
83
+ | `isDocumentFilePath` | 判断文档文件路径 |
84
+ | `isFilePath` | 判断是否为文件路径 |
85
+ | `isImageFilePath` | 判断图片文件路径 |
86
+ | `isMarkdownFilePath` | 判断 Markdown 文件路径 |
87
+ | `isMusicFilePath` | 判断音频文件路径 |
88
+ | `isPptFilePath` | 判断 PPT 文件路径 |
89
+ | `isVideoFilePath` | 判断视频文件路径 |
90
+ | `singleDownloadFile` | 下载单个文件 |
91
+ | `singleDownloadFileBase64` | 下载 Base64 文件 |
92
+ | `updateFilePathQuery` | 更新文件路径 query |
93
+
94
+ 同时导出文件类型枚举与类型:
95
+
96
+ ```typescript
97
+ import type { FileSuffix, ImageFileSuffix } from '@mingto/tools'
98
+ import { FileSuffixEnum, ImageFileSuffixEnum } from '@mingto/tools'
99
+ ```
100
+
101
+ ### function
102
+
103
+ | API | 说明 |
104
+ |-----|------|
105
+ | `debounce` | 防抖函数 |
106
+ | `throttle` | 节流函数 |
107
+
108
+ ### math
109
+
110
+ | API | 说明 |
111
+ |-----|------|
112
+ | `add` | 精确加法 |
113
+ | `subtract` | 精确减法 |
114
+ | `multiply` | 精确乘法 |
115
+ | `divide` | 除法 |
116
+ | `getDecimalPlaces` | 获取小数位数 |
117
+ | `calcAspectRatio` | 计算宽高比 |
118
+
119
+ ### object
120
+
121
+ | API | 说明 |
122
+ |-----|------|
123
+ | `deepFreeze` | 深冻结对象 |
124
+ | `pickObject` | 从对象中选取指定字段 |
125
+
126
+ ### string
127
+
128
+ | API | 说明 |
129
+ |-----|------|
130
+ | `chunkString` | 将字符串按指定长度切分 |
131
+ | `objectToQueryString` | 对象转 query string |
132
+ | `queryStringToObject` | query string 转对象 |
133
+
134
+ ### supply
135
+
136
+ | API | 说明 |
137
+ |-----|------|
138
+ | `getUuid` | 获取 UUID |
139
+ | `timeDelay` | 延迟执行 |
140
+
141
+ ### theme
142
+
143
+ | API | 说明 |
144
+ |-----|------|
145
+ | `useTheme` | 主题相关工具 |
146
+
147
+ ### validator
148
+
149
+ | API | 说明 |
150
+ |-----|------|
151
+ | `isValidBase64` | 校验 Base64 字符串 |
152
+ | `isValidUrl` | 校验 URL |
153
+
154
+ ### web-socket
155
+
156
+ | API | 说明 |
157
+ |-----|------|
158
+ | `createWebSocket` | 创建 WebSocket 连接 |
159
+ | `isWebSocketSupported` | 判断当前环境是否支持 WebSocket |
160
+
161
+ ### wrker
162
+
163
+ | API | 说明 |
164
+ |-----|------|
165
+ | `createWorker` | 创建 Worker |
166
+ | `closeWorker` | 关闭 Worker |
167
+
168
+ ## 常用示例
169
+
170
+ ### 类型判断
171
+
172
+ ```typescript
173
+ import { isArray, isNumber, isObject, isString } from '@mingto/tools'
174
+
175
+ isArray([1, 2, 3])
176
+ isNumber(1)
177
+ isObject({ a: 1 })
178
+ isString('hello')
179
+ ```
180
+
181
+ ### 精确计算
182
+
183
+ ```typescript
184
+ import { add, divide, multiply, subtract } from '@mingto/tools'
185
+
186
+ add(0.1, 0.2)
187
+ subtract(0.3, 0.1)
188
+ multiply(0.1, 0.2)
189
+ divide(10, 2)
190
+ ```
191
+
192
+ ### 文件路径处理
193
+
194
+ ```typescript
195
+ import { getFileName, getFileSuffix, getFileTitle, isImageFilePath } from '@mingto/tools'
196
+
197
+ getFileName('/path/to/demo.png')
198
+ getFileTitle('/path/to/demo.png')
199
+ getFileSuffix('/path/to/demo.png')
200
+ isImageFilePath('/path/to/demo.png')
201
+ ```
202
+
203
+ ### 函数控制
204
+
205
+ ```typescript
206
+ import { debounce, throttle } from '@mingto/tools'
207
+
208
+ const onResize = debounce(() => {}, 300)
209
+ const onScroll = throttle(() => {}, 300)
210
+ ```
211
+
212
+ ### 国际化
213
+
214
+ 支持语言:`zh-cn`、`zh-tw`、`en`、`ms`、`ar`、`th`、`vi`。
215
+
216
+ ```typescript
217
+ import tools from '@mingto/tools'
218
+
219
+ tools.locale('en')
220
+ const locale = tools.getLocale()
221
+ ```
222
+
223
+ ## 许可证
224
+
225
+ ISC
package/dist/index.js CHANGED
@@ -2,7 +2,14 @@ import axios from "axios";
2
2
  import FileSaver from "file-saver";
3
3
  import JSZip from "jszip";
4
4
  //#region \0rolldown/runtime.js
5
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
5
+ var __esmMin = (fn, res, err) => () => {
6
+ if (err) throw err[0];
7
+ try {
8
+ return fn && (res = fn(fn = 0)), res;
9
+ } catch (e) {
10
+ throw err = [e], e;
11
+ }
12
+ };
6
13
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
7
14
  //#endregion
8
15
  //#region \0rollupPluginBabelHelpers.js
@@ -593,7 +600,8 @@ var require_environment_v8_version = /* @__PURE__ */ __commonJSMin(((exports, mo
593
600
  var Deno = globalThis.Deno;
594
601
  var versions = process && process.versions || Deno && Deno.version;
595
602
  var v8 = versions && versions.v8;
596
- var match, version;
603
+ var match;
604
+ var version;
597
605
  if (v8) {
598
606
  match = v8.split(".");
599
607
  version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
@@ -1002,7 +1010,9 @@ var require_internal_state = /* @__PURE__ */ __commonJSMin(((exports, module) =>
1002
1010
  var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
1003
1011
  var TypeError = globalThis.TypeError;
1004
1012
  var WeakMap = globalThis.WeakMap;
1005
- var set, get, has;
1013
+ var set;
1014
+ var get;
1015
+ var has;
1006
1016
  var enforce = function enforce(it) {
1007
1017
  return has(it) ? get(it) : set(it, {});
1008
1018
  };
@@ -3000,7 +3010,9 @@ var require_iterators_core = /* @__PURE__ */ __commonJSMin(((exports, module) =>
3000
3010
  var IS_PURE = require_is_pure();
3001
3011
  var ITERATOR = wellKnownSymbol("iterator");
3002
3012
  var BUGGY_SAFARI_ITERATORS = false;
3003
- var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
3013
+ var IteratorPrototype;
3014
+ var PrototypeOfArrayIteratorPrototype;
3015
+ var arrayIterator;
3004
3016
  if ([].keys) {
3005
3017
  arrayIterator = [].keys();
3006
3018
  if (!("next" in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
@@ -4212,7 +4224,9 @@ var require_array_buffer_view_core = /* @__PURE__ */ __commonJSMin(((exports, mo
4212
4224
  var TYPED_ARRAY_CONSTRUCTOR = "TypedArrayConstructor";
4213
4225
  var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(globalThis.opera) !== "Opera";
4214
4226
  var TYPED_ARRAY_TAG_REQUIRED = false;
4215
- var NAME, Constructor, Prototype;
4227
+ var NAME;
4228
+ var Constructor;
4229
+ var Prototype;
4216
4230
  var TypedArrayConstructorsList = {
4217
4231
  Int8Array: 1,
4218
4232
  Uint8Array: 1,
@@ -6421,7 +6435,10 @@ var require_task = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6421
6435
  var counter = 0;
6422
6436
  var queue = {};
6423
6437
  var ONREADYSTATECHANGE = "onreadystatechange";
6424
- var $location, defer, channel, port;
6438
+ var $location;
6439
+ var defer;
6440
+ var channel;
6441
+ var port;
6425
6442
  fails(function() {
6426
6443
  $location = globalThis.location;
6427
6444
  });
@@ -6555,7 +6572,11 @@ var require_microtask = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6555
6572
  var process = globalThis.process;
6556
6573
  var Promise = globalThis.Promise;
6557
6574
  var microtask = safeGetBuiltIn("queueMicrotask");
6558
- var notify, toggle, node, promise, then;
6575
+ var notify;
6576
+ var toggle;
6577
+ var node;
6578
+ var promise;
6579
+ var then;
6559
6580
  if (!microtask) {
6560
6581
  var queue = new Queue();
6561
6582
  var flush = function flush() {
@@ -6738,7 +6759,10 @@ var require_es_promise_constructor = /* @__PURE__ */ __commonJSMin((() => {
6738
6759
  var REJECTED = 2;
6739
6760
  var HANDLED = 1;
6740
6761
  var UNHANDLED = 2;
6741
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
6762
+ var Internal;
6763
+ var OwnPromiseCapability;
6764
+ var PromiseWrapper;
6765
+ var nativeThen;
6742
6766
  var isThenable = function isThenable(it) {
6743
6767
  var then;
6744
6768
  return isObject(it) && isCallable(then = it.then) ? then : false;
@@ -9288,7 +9312,7 @@ var require_es_typed_array_fill = /* @__PURE__ */ __commonJSMin((() => {
9288
9312
  return call($fill, this, actualValue, length > 1 ? arguments[1] : void 0, length > 2 ? arguments[2] : void 0);
9289
9313
  }, fails(function() {
9290
9314
  var count = 0;
9291
- new Int8Array(2).fill({ valueOf: function valueOf() {
9315
+ (/* @__PURE__ */ new Int8Array(2)).fill({ valueOf: function valueOf() {
9292
9316
  return count++;
9293
9317
  } });
9294
9318
  return count !== 1;
@@ -9525,7 +9549,7 @@ var require_es_typed_array_set = /* @__PURE__ */ __commonJSMin((() => {
9525
9549
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
9526
9550
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
9527
9551
  var WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS = !fails(function() {
9528
- var array = new Uint8ClampedArray(2);
9552
+ var array = /* @__PURE__ */ new Uint8ClampedArray(2);
9529
9553
  call($set, array, {
9530
9554
  length: 1,
9531
9555
  0: 3
@@ -9568,7 +9592,7 @@ var require_es_typed_array_slice = /* @__PURE__ */ __commonJSMin((() => {
9568
9592
  while (length > index) result[index] = list[index++];
9569
9593
  return result;
9570
9594
  }, fails(function() {
9571
- new Int8Array(1).slice();
9595
+ (/* @__PURE__ */ new Int8Array(1)).slice();
9572
9596
  }));
9573
9597
  }));
9574
9598
  //#endregion
@@ -14918,7 +14942,7 @@ function copyText(text) {
14918
14942
  //#endregion
14919
14943
  //#region src/browser/create-audio-permission.ts
14920
14944
  init__rollupPluginBabelHelpers();
14921
- var AudioPermissionError = /* @__PURE__ */ function(_Error) {
14945
+ var AudioPermissionError = /*#__PURE__*/ function(_Error) {
14922
14946
  function AudioPermissionError(name, message) {
14923
14947
  var _this;
14924
14948
  _classCallCheck(this, AudioPermissionError);
@@ -14936,7 +14960,7 @@ var AudioPermissionError = /* @__PURE__ */ function(_Error) {
14936
14960
  return new AudioPermissionError(name, message || codeMessageMap[name]);
14937
14961
  }
14938
14962
  }]);
14939
- }(/* @__PURE__ */ _wrapNativeSuper(Error));
14963
+ }(/*#__PURE__*/ _wrapNativeSuper(Error));
14940
14964
  /**
14941
14965
  * 音频播放权限管理类
14942
14966
  *
@@ -14980,7 +15004,7 @@ var AudioPermissionError = /* @__PURE__ */ function(_Error) {
14980
15004
  * 如果状态是 “running” 状态则可以播放音频,
14981
15005
  * 如果状态不是 “running” 状态则抛出异常。
14982
15006
  */
14983
- var AudioPlaybackPermission = /* @__PURE__ */ function() {
15007
+ var AudioPlaybackPermission = /*#__PURE__*/ function() {
14984
15008
  function AudioPlaybackPermission() {
14985
15009
  _classCallCheck(this, AudioPlaybackPermission);
14986
15010
  _defineProperty(this, "userInteracted", false);
@@ -15004,7 +15028,7 @@ var AudioPlaybackPermission = /* @__PURE__ */ function() {
15004
15028
  {
15005
15029
  key: "checkInitialAudioContextState",
15006
15030
  value: function() {
15007
- var _checkInitialAudioContextState = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee() {
15031
+ var _checkInitialAudioContextState = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee() {
15008
15032
  var testContext;
15009
15033
  return _regenerator().w(function(_context) {
15010
15034
  while (1) switch (_context.n) {
@@ -15059,7 +15083,7 @@ var AudioPlaybackPermission = /* @__PURE__ */ function() {
15059
15083
  {
15060
15084
  key: "requestPlaybackPermission",
15061
15085
  value: function() {
15062
- var _requestPlaybackPermission = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee2() {
15086
+ var _requestPlaybackPermission = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee2() {
15063
15087
  var audioContext, unknownError, _t;
15064
15088
  return _regenerator().w(function(_context2) {
15065
15089
  while (1) switch (_context2.p = _context2.n) {
@@ -15206,7 +15230,7 @@ var AudioPlaybackPermission = /* @__PURE__ */ function() {
15206
15230
  *
15207
15231
  *
15208
15232
  */
15209
- var MicrophonePermission = /* @__PURE__ */ function() {
15233
+ var MicrophonePermission = /*#__PURE__*/ function() {
15210
15234
  function MicrophonePermission() {
15211
15235
  _classCallCheck(this, MicrophonePermission);
15212
15236
  _defineProperty(this, "microphonePermissionGranted", false);
@@ -15222,7 +15246,7 @@ var MicrophonePermission = /* @__PURE__ */ function() {
15222
15246
  {
15223
15247
  key: "getUserMediaWithTimeout",
15224
15248
  value: function() {
15225
- var _getUserMediaWithTimeout = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee3(constraints) {
15249
+ var _getUserMediaWithTimeout = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee3(constraints) {
15226
15250
  var timeoutMs, _args3 = arguments;
15227
15251
  return _regenerator().w(function(_context3) {
15228
15252
  while (1) switch (_context3.n) {
@@ -15252,7 +15276,7 @@ var MicrophonePermission = /* @__PURE__ */ function() {
15252
15276
  {
15253
15277
  key: "requestMicrophonePermission",
15254
15278
  value: function() {
15255
- var _requestMicrophonePermission = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee4() {
15279
+ var _requestMicrophonePermission = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee4() {
15256
15280
  var result, stream, errorType, audioError, unknownError, _t4, _t5;
15257
15281
  return _regenerator().w(function(_context4) {
15258
15282
  while (1) switch (_context4.p = _context4.n) {
@@ -15378,7 +15402,7 @@ var MicrophonePermission = /* @__PURE__ */ function() {
15378
15402
  /**
15379
15403
  * 统一的音频权限管理类
15380
15404
  */
15381
- var AudioPermission = /* @__PURE__ */ function() {
15405
+ var AudioPermission = /*#__PURE__*/ function() {
15382
15406
  function AudioPermission() {
15383
15407
  _classCallCheck(this, AudioPermission);
15384
15408
  _defineProperty(this, "playbackPermission", void 0);
@@ -15393,7 +15417,7 @@ var AudioPermission = /* @__PURE__ */ function() {
15393
15417
  return _createClass(AudioPermission, [{
15394
15418
  key: "requestPlaybackPermission",
15395
15419
  value: function() {
15396
- var _requestPlaybackPermission2 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee5() {
15420
+ var _requestPlaybackPermission2 = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee5() {
15397
15421
  return _regenerator().w(function(_context5) {
15398
15422
  while (1) switch (_context5.n) {
15399
15423
  case 0: return _context5.a(2, this.playbackPermission.requestPlaybackPermission());
@@ -15408,7 +15432,7 @@ var AudioPermission = /* @__PURE__ */ function() {
15408
15432
  }, {
15409
15433
  key: "requestMicrophonePermission",
15410
15434
  value: function() {
15411
- var _requestMicrophonePermission2 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee6() {
15435
+ var _requestMicrophonePermission2 = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee6() {
15412
15436
  return _regenerator().w(function(_context6) {
15413
15437
  while (1) switch (_context6.n) {
15414
15438
  case 0: return _context6.a(2, this.microphonePermission.requestMicrophonePermission());
@@ -16046,7 +16070,7 @@ function batchDownloadFile(_x, _x2) {
16046
16070
  return _batchDownloadFile.apply(this, arguments);
16047
16071
  }
16048
16072
  function _batchDownloadFile() {
16049
- _batchDownloadFile = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee2(fileList, zipName) {
16073
+ _batchDownloadFile = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee2(fileList, zipName) {
16050
16074
  var zip, zipData, hasZip;
16051
16075
  return _regenerator().w(function(_context2) {
16052
16076
  while (1) switch (_context2.p = _context2.n) {
@@ -16067,8 +16091,8 @@ function _batchDownloadFile() {
16067
16091
  zip = new JSZip();
16068
16092
  _context2.p = 1;
16069
16093
  _context2.n = 2;
16070
- return Promise.all(fileList.map(/* @__PURE__ */ function() {
16071
- var _ref3 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee(_ref2) {
16094
+ return Promise.all(fileList.map(/*#__PURE__*/ function() {
16095
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee(_ref2) {
16072
16096
  var filePath, fileName, _yield$axios$get, data;
16073
16097
  return _regenerator().w(function(_context) {
16074
16098
  while (1) switch (_context.n) {
@@ -16144,7 +16168,7 @@ var word_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALAAAACwCAMAAA
16144
16168
  /**
16145
16169
  * 文件后缀与图标映射。
16146
16170
  */
16147
- var fileIconMap = new Map([
16171
+ var fileIconMap = /* @__PURE__ */ new Map([
16148
16172
  [FileSuffixEnum.DOC, word_default],
16149
16173
  [FileSuffixEnum.DOCX, word_default],
16150
16174
  [FileSuffixEnum.PPT, ppt_default],
@@ -16307,8 +16331,8 @@ function singleDownloadFile(_x, _x2, _x3) {
16307
16331
  return _singleDownloadFile.apply(this, arguments);
16308
16332
  }
16309
16333
  function _singleDownloadFile() {
16310
- _singleDownloadFile = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee(source, fileName, pathQuery) {
16311
- var base64Url, response, blob, downloadName, requestUrl, _response, link, _t, _t2;
16334
+ _singleDownloadFile = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee(source, fileName, pathQuery) {
16335
+ var base64Url, response, blob, downloadName, isPresigned, requestUrl, _response, link, _t, _t2;
16312
16336
  return _regenerator().w(function(_context) {
16313
16337
  while (1) switch (_context.p = _context.n) {
16314
16338
  case 0:
@@ -16350,7 +16374,10 @@ function _singleDownloadFile() {
16350
16374
  break;
16351
16375
  }
16352
16376
  downloadName = fileName || getFileName(source) || "download";
16353
- requestUrl = updateFilePathQuery(source, pathQuery || { "response-content-type": "application/octet-stream" });
16377
+ isPresigned = /[?&]Signature=/i.test(source);
16378
+ requestUrl = source;
16379
+ if (isPresigned) requestUrl = updateFilePathQuery(source, pathQuery || {});
16380
+ else requestUrl = updateFilePathQuery(source, pathQuery || { "response-content-type": "application/octet-stream" });
16354
16381
  _context.p = 7;
16355
16382
  _context.n = 8;
16356
16383
  return axios.get(requestUrl, { responseType: "blob" });
@@ -16391,7 +16418,7 @@ function downloadBase64File(_x, _x2) {
16391
16418
  return _downloadBase64File.apply(this, arguments);
16392
16419
  }
16393
16420
  function _downloadBase64File() {
16394
- _downloadBase64File = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee(base64Data, fileName) {
16421
+ _downloadBase64File = _asyncToGenerator(/*#__PURE__*/ _regenerator().m(function _callee(base64Data, fileName) {
16395
16422
  var response, blob;
16396
16423
  return _regenerator().w(function(_context) {
16397
16424
  while (1) switch (_context.n) {
@@ -16629,7 +16656,7 @@ function pickObject(obj, keys) {
16629
16656
  * @returns 返回一个随机生成的 UUID 字符串。
16630
16657
  */
16631
16658
  function getUuid() {
16632
- if (typeof window !== "undefined" && window.crypto) return window.crypto.getRandomValues(new Uint32Array(1))[0].toString(36);
16659
+ if (typeof window !== "undefined" && window.crypto) return window.crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0].toString(36);
16633
16660
  return Math.random().toString(36).substring(2);
16634
16661
  }
16635
16662
  //#endregion
@@ -16646,15 +16673,15 @@ function timeDelay(delay) {
16646
16673
  });
16647
16674
  }
16648
16675
  //#endregion
16649
- //#region ../../node_modules/.pnpm/@vue+shared@3.5.34/node_modules/@vue/shared/dist/shared.esm-bundler.js
16676
+ //#region ../../node_modules/.pnpm/@vue+shared@3.5.35/node_modules/@vue/shared/dist/shared.esm-bundler.js
16650
16677
  init__rollupPluginBabelHelpers();
16651
16678
  var _PatchFlagNames;
16652
16679
  /**
16653
- * @vue/shared v3.5.34
16680
+ * @vue/shared v3.5.35
16654
16681
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
16655
16682
  * @license MIT
16656
16683
  **/
16657
- /* @__NO_SIDE_EFFECTS__ */
16684
+ // @__NO_SIDE_EFFECTS__
16658
16685
  function makeMap(str) {
16659
16686
  var map = /* @__PURE__ */ Object.create(null);
16660
16687
  var _iterator = _createForOfIteratorHelper(str.split(",")), _step;
@@ -16788,9 +16815,9 @@ function normalizeClass(value) {
16788
16815
  return res.trim();
16789
16816
  }
16790
16817
  //#endregion
16791
- //#region ../../node_modules/.pnpm/@vue+reactivity@3.5.34/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
16818
+ //#region ../../node_modules/.pnpm/@vue+reactivity@3.5.35/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
16792
16819
  /**
16793
- * @vue/reactivity v3.5.34
16820
+ * @vue/reactivity v3.5.35
16794
16821
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
16795
16822
  * @license MIT
16796
16823
  **/
@@ -16807,7 +16834,7 @@ function getCurrentScope() {
16807
16834
  }
16808
16835
  var activeSub;
16809
16836
  var pausedQueueEffects = /* @__PURE__ */ new WeakSet();
16810
- var ReactiveEffect = /* @__PURE__ */ function() {
16837
+ var ReactiveEffect = /*#__PURE__*/ function() {
16811
16838
  function ReactiveEffect(fn) {
16812
16839
  _classCallCheck(this, ReactiveEffect);
16813
16840
  this.fn = fn;
@@ -17080,14 +17107,14 @@ function cleanupEffect(e) {
17080
17107
  }
17081
17108
  }
17082
17109
  var globalVersion = 0;
17083
- var Link = /* @__PURE__ */ _createClass(function Link(sub, dep) {
17110
+ var Link = /*#__PURE__*/ _createClass(function Link(sub, dep) {
17084
17111
  _classCallCheck(this, Link);
17085
17112
  this.sub = sub;
17086
17113
  this.dep = dep;
17087
17114
  this.version = dep.version;
17088
17115
  this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
17089
17116
  });
17090
- var Dep = /* @__PURE__ */ function() {
17117
+ var Dep = /*#__PURE__*/ function() {
17091
17118
  function Dep(computed) {
17092
17119
  _classCallCheck(this, Dep);
17093
17120
  this.computed = computed;
@@ -17451,7 +17478,7 @@ function hasOwnProperty(key) {
17451
17478
  track(obj, "has", key);
17452
17479
  return obj.hasOwnProperty(key);
17453
17480
  }
17454
- var BaseReactiveHandler = /* @__PURE__ */ function() {
17481
+ var BaseReactiveHandler = /*#__PURE__*/ function() {
17455
17482
  function BaseReactiveHandler() {
17456
17483
  var _isReadonly = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
17457
17484
  var _isShallow = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
@@ -17490,7 +17517,7 @@ var BaseReactiveHandler = /* @__PURE__ */ function() {
17490
17517
  }
17491
17518
  }]);
17492
17519
  }();
17493
- var MutableReactiveHandler = /* @__PURE__ */ function(_BaseReactiveHandler) {
17520
+ var MutableReactiveHandler = /*#__PURE__*/ function(_BaseReactiveHandler) {
17494
17521
  function MutableReactiveHandler() {
17495
17522
  var isShallow2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
17496
17523
  _classCallCheck(this, MutableReactiveHandler);
@@ -17553,7 +17580,7 @@ var MutableReactiveHandler = /* @__PURE__ */ function(_BaseReactiveHandler) {
17553
17580
  }
17554
17581
  ]);
17555
17582
  }(BaseReactiveHandler);
17556
- var ReadonlyReactiveHandler = /* @__PURE__ */ function(_BaseReactiveHandler2) {
17583
+ var ReadonlyReactiveHandler = /*#__PURE__*/ function(_BaseReactiveHandler2) {
17557
17584
  function ReadonlyReactiveHandler() {
17558
17585
  var isShallow2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
17559
17586
  _classCallCheck(this, ReadonlyReactiveHandler);
@@ -17754,19 +17781,16 @@ function targetTypeMap(rawType) {
17754
17781
  default: return 0;
17755
17782
  }
17756
17783
  }
17757
- function getTargetType(value) {
17758
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
17759
- }
17760
- /* @__NO_SIDE_EFFECTS__ */
17784
+ // @__NO_SIDE_EFFECTS__
17761
17785
  function reactive(target) {
17762
17786
  if (/* @__PURE__ */ isReadonly(target)) return target;
17763
17787
  return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
17764
17788
  }
17765
- /* @__NO_SIDE_EFFECTS__ */
17789
+ // @__NO_SIDE_EFFECTS__
17766
17790
  function readonly(target) {
17767
17791
  return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
17768
17792
  }
17769
- /* @__NO_SIDE_EFFECTS__ */
17793
+ // @__NO_SIDE_EFFECTS__
17770
17794
  function shallowReadonly(target) {
17771
17795
  return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
17772
17796
  }
@@ -17776,32 +17800,33 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
17776
17800
  return target;
17777
17801
  }
17778
17802
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) return target;
17779
- var targetType = getTargetType(target);
17780
- if (targetType === 0) return target;
17803
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
17781
17804
  var existingProxy = proxyMap.get(target);
17782
17805
  if (existingProxy) return existingProxy;
17806
+ var targetType = targetTypeMap(toRawType(target));
17807
+ if (targetType === 0) return target;
17783
17808
  var proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
17784
17809
  proxyMap.set(target, proxy);
17785
17810
  return proxy;
17786
17811
  }
17787
- /* @__NO_SIDE_EFFECTS__ */
17812
+ // @__NO_SIDE_EFFECTS__
17788
17813
  function isReactive(value) {
17789
17814
  if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
17790
17815
  return !!(value && value["__v_isReactive"]);
17791
17816
  }
17792
- /* @__NO_SIDE_EFFECTS__ */
17817
+ // @__NO_SIDE_EFFECTS__
17793
17818
  function isReadonly(value) {
17794
17819
  return !!(value && value["__v_isReadonly"]);
17795
17820
  }
17796
- /* @__NO_SIDE_EFFECTS__ */
17821
+ // @__NO_SIDE_EFFECTS__
17797
17822
  function isShallow(value) {
17798
17823
  return !!(value && value["__v_isShallow"]);
17799
17824
  }
17800
- /* @__NO_SIDE_EFFECTS__ */
17825
+ // @__NO_SIDE_EFFECTS__
17801
17826
  function isProxy(value) {
17802
17827
  return value ? !!value["__v_raw"] : false;
17803
17828
  }
17804
- /* @__NO_SIDE_EFFECTS__ */
17829
+ // @__NO_SIDE_EFFECTS__
17805
17830
  function toRaw(observed) {
17806
17831
  var raw = observed && observed["__v_raw"];
17807
17832
  return raw ? /* @__PURE__ */ toRaw(raw) : observed;
@@ -17816,11 +17841,11 @@ var toReactive = function toReactive(value) {
17816
17841
  var toReadonly = function toReadonly(value) {
17817
17842
  return isObject$1(value) ? /* @__PURE__ */ readonly(value) : value;
17818
17843
  };
17819
- /* @__NO_SIDE_EFFECTS__ */
17844
+ // @__NO_SIDE_EFFECTS__
17820
17845
  function isRef(r) {
17821
17846
  return r ? r["__v_isRef"] === true : false;
17822
17847
  }
17823
- /* @__NO_SIDE_EFFECTS__ */
17848
+ // @__NO_SIDE_EFFECTS__
17824
17849
  function ref(value) {
17825
17850
  return createRef(value, false);
17826
17851
  }
@@ -17828,7 +17853,7 @@ function createRef(rawValue, shallow) {
17828
17853
  if (/* @__PURE__ */ isRef(rawValue)) return rawValue;
17829
17854
  return new RefImpl(rawValue, shallow);
17830
17855
  }
17831
- var RefImpl = /* @__PURE__ */ function() {
17856
+ var RefImpl = /*#__PURE__*/ function() {
17832
17857
  function RefImpl(value, isShallow2) {
17833
17858
  _classCallCheck(this, RefImpl);
17834
17859
  this.dep = new Dep();
@@ -17886,7 +17911,7 @@ var shallowUnwrapHandlers = {
17886
17911
  function proxyRefs(objectWithRefs) {
17887
17912
  return /* @__PURE__ */ isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
17888
17913
  }
17889
- var ComputedRefImpl = /* @__PURE__ */ function() {
17914
+ var ComputedRefImpl = /*#__PURE__*/ function() {
17890
17915
  function ComputedRefImpl(fn, setter, isSSR) {
17891
17916
  _classCallCheck(this, ComputedRefImpl);
17892
17917
  this.fn = fn;
@@ -17957,7 +17982,7 @@ var ComputedRefImpl = /* @__PURE__ */ function() {
17957
17982
  }
17958
17983
  }]);
17959
17984
  }();
17960
- /* @__NO_SIDE_EFFECTS__ */
17985
+ // @__NO_SIDE_EFFECTS__
17961
17986
  function computed$1(getterOrOptions, debugOptions) {
17962
17987
  var isSSR = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
17963
17988
  var getter;
@@ -18165,9 +18190,9 @@ function traverse(value) {
18165
18190
  return value;
18166
18191
  }
18167
18192
  //#endregion
18168
- //#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.34/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
18193
+ //#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.35/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
18169
18194
  /**
18170
- * @vue/runtime-core v3.5.34
18195
+ * @vue/runtime-core v3.5.35
18171
18196
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
18172
18197
  * @license MIT
18173
18198
  **/
@@ -19584,9 +19609,9 @@ process.env.NODE_ENV;
19584
19609
  process.env.NODE_ENV;
19585
19610
  process.env.NODE_ENV;
19586
19611
  //#endregion
19587
- //#region ../../node_modules/.pnpm/vue@3.5.34_typescript@5.9.3/node_modules/vue/dist/vue.runtime.esm-bundler.js
19612
+ //#region ../../node_modules/.pnpm/vue@3.5.35_typescript@5.9.3/node_modules/vue/dist/vue.runtime.esm-bundler.js
19588
19613
  /**
19589
- * vue v3.5.34
19614
+ * vue v3.5.35
19590
19615
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
19591
19616
  * @license MIT
19592
19617
  **/
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mingto/tools",
3
3
  "type": "module",
4
- "version": "1.0.685",
4
+ "version": "1.0.686",
5
5
  "description": "明途公共工具库",
6
6
  "author": "hcc",
7
7
  "license": "ISC",