@mingto/tools 1.0.675
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/README.md +1615 -0
- package/dist/array/chunk-array.d.ts +11 -0
- package/dist/array/index.d.ts +2 -0
- package/dist/browser/copy-text.d.ts +8 -0
- package/dist/browser/create-audio-permission.d.ts +186 -0
- package/dist/browser/get-absolute-url.d.ts +7 -0
- package/dist/browser/get-browser-fingerprint.d.ts +10 -0
- package/dist/browser/index.d.ts +9 -0
- package/dist/browser/is-android.d.ts +8 -0
- package/dist/browser/is-ios.d.ts +8 -0
- package/dist/browser/is-mobile.d.ts +8 -0
- package/dist/browser/is-pc.d.ts +8 -0
- package/dist/constant/image.d.ts +2 -0
- package/dist/constant/index.d.ts +1 -0
- package/dist/core/__test__/can-be-parsed-as-number.test.d.ts +1 -0
- package/dist/core/be-parsed-as-number.d.ts +8 -0
- package/dist/core/can-be-parsed-as-number.d.ts +8 -0
- package/dist/core/check-array-empty.d.ts +8 -0
- package/dist/core/check-empty-not-zero.d.ts +8 -0
- package/dist/core/check-empty.d.ts +8 -0
- package/dist/core/check-object-empty.d.ts +8 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/is-array.d.ts +8 -0
- package/dist/core/is-boolean.d.ts +8 -0
- package/dist/core/is-function.d.ts +8 -0
- package/dist/core/is-null-or-undefined.d.ts +7 -0
- package/dist/core/is-number.d.ts +8 -0
- package/dist/core/is-object.d.ts +9 -0
- package/dist/core/is-string.d.ts +8 -0
- package/dist/core/is-undefined.d.ts +8 -0
- package/dist/file/__test__/get-file-suffix.test.d.ts +1 -0
- package/dist/file/__test__/is-file-path.test.d.ts +1 -0
- package/dist/file/batch-download-file.d.ts +12 -0
- package/dist/file/extends/enum.d.ts +81 -0
- package/dist/file/extends/regex.d.ts +2 -0
- package/dist/file/get-file-icon.d.ts +8 -0
- package/dist/file/get-file-name.d.ts +8 -0
- package/dist/file/get-file-path-not-query.d.ts +8 -0
- package/dist/file/get-file-query.d.ts +8 -0
- package/dist/file/get-file-suffix-icon.d.ts +9 -0
- package/dist/file/get-file-suffix.d.ts +9 -0
- package/dist/file/get-file-title.d.ts +8 -0
- package/dist/file/index.d.ts +22 -0
- package/dist/file/is-compress-file-path.d.ts +8 -0
- package/dist/file/is-document-file-path.d.ts +8 -0
- package/dist/file/is-file-path.d.ts +8 -0
- package/dist/file/is-image-file-path.d.ts +8 -0
- package/dist/file/is-music-file-path.d.ts +8 -0
- package/dist/file/is-ppt-file-path.d.ts +8 -0
- package/dist/file/is-video-file-path.d.ts +8 -0
- package/dist/file/single-download-file-base64.d.ts +8 -0
- package/dist/file/single-download-file.d.ts +12 -0
- package/dist/file/types/index.d.ts +9 -0
- package/dist/file/update-file-path-query.d.ts +8 -0
- package/dist/function/debounce.d.ts +23 -0
- package/dist/function/index.d.ts +3 -0
- package/dist/function/throttle.d.ts +23 -0
- package/dist/i18n/index.d.ts +32 -0
- package/dist/i18n/locales/ar.d.ts +18 -0
- package/dist/i18n/locales/en.d.ts +18 -0
- package/dist/i18n/locales/ms.d.ts +18 -0
- package/dist/i18n/locales/th.d.ts +18 -0
- package/dist/i18n/locales/vi.d.ts +13 -0
- package/dist/i18n/locales/zh-cn.d.ts +18 -0
- package/dist/i18n/locales/zh-tw.d.ts +18 -0
- package/dist/i18n/setup.d.ts +4 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +16971 -0
- package/dist/math/__test__/add.test.d.ts +1 -0
- package/dist/math/__test__/divide.test.d.ts +1 -0
- package/dist/math/__test__/get-decimal-places.test.d.ts +1 -0
- package/dist/math/__test__/multiply.test.d.ts +1 -0
- package/dist/math/__test__/subtract.test.d.ts +1 -0
- package/dist/math/add.d.ts +9 -0
- package/dist/math/calc-aspect-ratio.d.ts +9 -0
- package/dist/math/divide.d.ts +9 -0
- package/dist/math/get-decimal-places.d.ts +8 -0
- package/dist/math/index.d.ts +7 -0
- package/dist/math/multiply.d.ts +9 -0
- package/dist/math/subtract.d.ts +9 -0
- package/dist/object/deep-freeze.d.ts +9 -0
- package/dist/object/index.d.ts +3 -0
- package/dist/object/pick-object.d.ts +9 -0
- package/dist/string/__test__/chunk-string.test.d.ts +1 -0
- package/dist/string/chunk-string.d.ts +10 -0
- package/dist/string/index.d.ts +4 -0
- package/dist/string/object-to-query-string.d.ts +10 -0
- package/dist/string/query-string-to-object.d.ts +8 -0
- package/dist/supply/get-uuid.d.ts +7 -0
- package/dist/supply/index.d.ts +3 -0
- package/dist/supply/time-delay.d.ts +7 -0
- package/dist/supply/type-writer.d.ts +18 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/use-theme.d.ts +23 -0
- package/dist/validator/index.d.ts +3 -0
- package/dist/validator/is-valid-base64.d.ts +6 -0
- package/dist/validator/is-valid-url.d.ts +7 -0
- package/dist/validator/test/is-valid-url.test.d.ts +1 -0
- package/dist/web-socket/create-web-socket.d.ts +9 -0
- package/dist/web-socket/index.d.ts +3 -0
- package/dist/web-socket/is-web-socket-supported.d.ts +9 -0
- package/dist/wrker/close-worker.d.ts +9 -0
- package/dist/wrker/create-worker.d.ts +11 -0
- package/dist/wrker/index.d.ts +3 -0
- package/package.json +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as add } from './add';
|
|
2
|
+
import { default as calcAspectRatio } from './calc-aspect-ratio';
|
|
3
|
+
import { default as divide } from './divide';
|
|
4
|
+
import { default as getDecimalPlaces } from './get-decimal-places';
|
|
5
|
+
import { default as multiply } from './multiply';
|
|
6
|
+
import { default as subtract } from './subtract';
|
|
7
|
+
export { add, calcAspectRatio, divide, getDecimalPlaces, multiply, subtract };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 从给定对象中挑选指定的属性,并返回一个包含这些属性的新对象。
|
|
3
|
+
*
|
|
4
|
+
* @param obj -源对象,从中挑选属性。
|
|
5
|
+
* @param keys -需要挑选的属性键名数组。
|
|
6
|
+
* @returns 包含指定属性的新对象。
|
|
7
|
+
*/
|
|
8
|
+
declare function pickObject<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
9
|
+
export default pickObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将输入字符串按照指定的块大小分割成多个子字符串。
|
|
3
|
+
* 该函数会根据指定的块大小(`chunkSize`)将输入字符串(`str`)分割成多个子字符串,并将这些子字符串存储在一个数组中返回。
|
|
4
|
+
*
|
|
5
|
+
* @param str - 需要分割的原始字符串。
|
|
6
|
+
* @param chunkSize - 每个块的大小,默认为整个字符串的长度。
|
|
7
|
+
* @returns 一个包含分割后的子字符串的数组。
|
|
8
|
+
*/
|
|
9
|
+
declare function chunkString(str: string, chunkSize?: number): string[];
|
|
10
|
+
export default chunkString;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as chunkString } from './chunk-string';
|
|
2
|
+
import { default as objectToQueryString } from './object-to-query-string';
|
|
3
|
+
import { default as queryStringToObject } from './query-string-to-object';
|
|
4
|
+
export { chunkString, objectToQueryString, queryStringToObject };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将对象转换为 URL 查询字符串。
|
|
3
|
+
* 该函数会遍历对象的键值对,将每个键和值进行 URL 编码,然后以 "key=value" 的形式拼接成字符串,并用 "&" 符号连接。
|
|
4
|
+
*
|
|
5
|
+
* @param obj - 需要转换的对象,对象的键为字符串,值为任意类型。
|
|
6
|
+
* @returns 转换后的 URL 查询字符串。
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
declare function objectToQueryString(obj: Record<string, any>): string;
|
|
10
|
+
export default objectToQueryString;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 流式打字机
|
|
3
|
+
* @param speed 打字速度
|
|
4
|
+
*/
|
|
5
|
+
declare class TypeWriter {
|
|
6
|
+
private speed;
|
|
7
|
+
private state;
|
|
8
|
+
private onEndCallback;
|
|
9
|
+
private onChangeCallback;
|
|
10
|
+
constructor(speed?: number);
|
|
11
|
+
private processQueue;
|
|
12
|
+
private init;
|
|
13
|
+
append(text: string): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
onEnd(callback: (text?: string) => void): void;
|
|
16
|
+
onChange(callback: (text?: string) => void): void;
|
|
17
|
+
}
|
|
18
|
+
export default TypeWriter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-theme';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 主题类型定义
|
|
4
|
+
*/
|
|
5
|
+
export type Theme = 'light' | 'dark';
|
|
6
|
+
/**
|
|
7
|
+
* 主题切换 Hook
|
|
8
|
+
* @returns {object} 主题相关的方法和状态
|
|
9
|
+
*/
|
|
10
|
+
export declare function useTheme(): {
|
|
11
|
+
theme: Ref<Theme>;
|
|
12
|
+
isDark: ComputedRef<boolean>;
|
|
13
|
+
isLight: ComputedRef<boolean>;
|
|
14
|
+
setTheme: (theme?: Theme) => void;
|
|
15
|
+
getTheme: () => Theme;
|
|
16
|
+
setLight: () => void;
|
|
17
|
+
setDark: () => void;
|
|
18
|
+
toggleTheme: () => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 监听系统主题变化
|
|
22
|
+
* @returns {(() => void) | undefined} 清理函数或undefined
|
|
23
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查当前浏览器是否支持 WebSocket。
|
|
3
|
+
* 此函数检查 'WebSocket' 和 'MozWebSocket' 是否存在于全局 `window` 对象中,
|
|
4
|
+
* 以确定浏览器是否支持 WebSocket。
|
|
5
|
+
*
|
|
6
|
+
* @returns 如果浏览器支持 WebSocket,则返回 `true`;否则返回 `false`。
|
|
7
|
+
*/
|
|
8
|
+
declare function isWebSocketSupported(): boolean;
|
|
9
|
+
export default isWebSocketSupported;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建并返回一个新的 Web Worker 实例。
|
|
3
|
+
* 这个函数接受一个函数,将其转换为字符串,并创建一个 Blob 对象。
|
|
4
|
+
* 然后,它创建一个指向该 Blob 的 URL,并用这个 URL 来创建一个新的 Worker。
|
|
5
|
+
* 最后,释放 URL 对象以供浏览器回收内存。
|
|
6
|
+
*
|
|
7
|
+
* @param fun - 要在 Worker 中执行的 JavaScript 函数。
|
|
8
|
+
* @returns 返回新创建的 Worker 实例。
|
|
9
|
+
*/
|
|
10
|
+
declare function createWorker(fun: (...args: any) => any): Worker;
|
|
11
|
+
export default createWorker;
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mingto/tools",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.675",
|
|
5
|
+
"description": "明途公共工具库",
|
|
6
|
+
"author": "hcc",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"ts",
|
|
10
|
+
"tools"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "vite build"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"axios": "^1.7.9",
|
|
25
|
+
"file-saver": "^2.0.5",
|
|
26
|
+
"jszip": "^3.10.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/file-saver": "^2.0.7"
|
|
30
|
+
}
|
|
31
|
+
}
|