@whitesev/utils 2.9.5 → 2.9.6
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.amd.js +16 -9
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +16 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +16 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +16 -9
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +16 -9
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +16 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/UtilsGMCookie.d.ts +3 -2
- package/dist/types/src/UtilsGMMenu.d.ts +4 -4
- package/package.json +3 -3
- package/src/ColorConversion.ts +6 -0
- package/src/UtilsGMCookie.ts +3 -2
- package/src/UtilsGMMenu.ts +7 -7
|
@@ -24,7 +24,7 @@ export declare class UtilsGMCookie {
|
|
|
24
24
|
};
|
|
25
25
|
list(option: UtilsGMCookieListOptions | object, callback?: (data: UtilsGMCookieResult[], error?: Error) => void): void;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* 获取多组Cookie
|
|
28
28
|
* @param option 配置
|
|
29
29
|
**/
|
|
30
30
|
getList(option: UtilsGMCookieListOptions | object): UtilsGMCookieResult[];
|
|
@@ -41,7 +41,8 @@ export declare class UtilsGMCookie {
|
|
|
41
41
|
*/
|
|
42
42
|
delete(option: UtilsGMCookieDeleteOptions, callback?: (error?: Error) => void): void;
|
|
43
43
|
/**
|
|
44
|
-
* 解析cookie
|
|
44
|
+
* 解析cookie字符串,按`;`分割
|
|
45
|
+
*
|
|
45
46
|
* 例如:document.cookie
|
|
46
47
|
* @param cookieStr
|
|
47
48
|
*/
|
|
@@ -73,7 +73,7 @@ export declare class GMMenu {
|
|
|
73
73
|
* 根据键值获取callback函数
|
|
74
74
|
* @param menuKey 菜单-键key
|
|
75
75
|
*/
|
|
76
|
-
getCallBack(menuKey: string): ((
|
|
76
|
+
getCallBack(menuKey: string): ((data: import("./types/UtilsGMMenu").UtilsGMMenuClickCallBackData) => void) | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* 获取当enable为true时默认显示在菜单中前面的emoji图标
|
|
79
79
|
*/
|
|
@@ -101,17 +101,17 @@ export declare class GMMenu {
|
|
|
101
101
|
setEnable(menuKey: string, value: boolean): void;
|
|
102
102
|
/**
|
|
103
103
|
* 设置当enable为true时默认显示在菜单中前面的emoji图标
|
|
104
|
-
* @param emojiString
|
|
104
|
+
* @param emojiString emoji字符串
|
|
105
105
|
*/
|
|
106
106
|
setEnableTrueEmoji(emojiString: string): void;
|
|
107
107
|
/**
|
|
108
108
|
* 设置当enable为false时默认显示在菜单中前面的emoji图标
|
|
109
|
-
* @param emojiString
|
|
109
|
+
* @param emojiString emoji字符串
|
|
110
110
|
*/
|
|
111
111
|
setEnableFalseEmoji(emojiString: string): void;
|
|
112
112
|
/**
|
|
113
113
|
* 设置本地存储的菜单外部的键名
|
|
114
|
-
* @param keyName
|
|
114
|
+
* @param keyName 键名
|
|
115
115
|
*/
|
|
116
116
|
setLocalStorageKeyName(keyName: string): void;
|
|
117
117
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@whitesev/utils",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "一个常用的工具库",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@eslint/js": "^9.38.0",
|
|
43
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
43
|
+
"@rollup/plugin-commonjs": "^28.0.9",
|
|
44
44
|
"@rollup/plugin-json": "^6.1.0",
|
|
45
45
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
46
46
|
"@rollup/plugin-terser": "^0.4.4",
|
|
47
|
-
"@rollup/plugin-typescript": "^12.
|
|
47
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
48
48
|
"browserslist": "^4.27.0",
|
|
49
49
|
"caniuse-lite": "^1.0.30001751",
|
|
50
50
|
"eslint": "^9.38.0",
|
package/src/ColorConversion.ts
CHANGED
|
@@ -80,6 +80,9 @@ export class ColorConversion {
|
|
|
80
80
|
if (typeof level !== "number") {
|
|
81
81
|
level = Number(level);
|
|
82
82
|
}
|
|
83
|
+
if (isNaN(level)) {
|
|
84
|
+
throw new TypeError(`输入错误的level:${level}`);
|
|
85
|
+
}
|
|
83
86
|
const rgbc = this.hexToRgb(color);
|
|
84
87
|
for (let index = 0; index < 3; index++) {
|
|
85
88
|
const rgbcItemValue = rgbc[index];
|
|
@@ -101,6 +104,9 @@ export class ColorConversion {
|
|
|
101
104
|
if (typeof level !== "number") {
|
|
102
105
|
level = Number(level);
|
|
103
106
|
}
|
|
107
|
+
if (isNaN(level)) {
|
|
108
|
+
throw new TypeError(`输入错误的level:${level}`);
|
|
109
|
+
}
|
|
104
110
|
const rgbc = this.hexToRgb(color);
|
|
105
111
|
for (let index = 0; index < 3; index++) {
|
|
106
112
|
const rgbcItemValue = Number(rgbc[index]);
|
package/src/UtilsGMCookie.ts
CHANGED
|
@@ -134,7 +134,7 @@ export class UtilsGMCookie {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
*
|
|
137
|
+
* 获取多组Cookie
|
|
138
138
|
* @param option 配置
|
|
139
139
|
**/
|
|
140
140
|
getList(option: UtilsGMCookieListOptions | object): UtilsGMCookieResult[] {
|
|
@@ -246,7 +246,8 @@ export class UtilsGMCookie {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
249
|
-
* 解析cookie
|
|
249
|
+
* 解析cookie字符串,按`;`分割
|
|
250
|
+
*
|
|
250
251
|
* 例如:document.cookie
|
|
251
252
|
* @param cookieStr
|
|
252
253
|
*/
|
package/src/UtilsGMMenu.ts
CHANGED
|
@@ -370,7 +370,7 @@ export class GMMenu {
|
|
|
370
370
|
* 根据键值获取callback函数
|
|
371
371
|
* @param menuKey 菜单-键key
|
|
372
372
|
*/
|
|
373
|
-
getCallBack(menuKey: string)
|
|
373
|
+
getCallBack(menuKey: string) {
|
|
374
374
|
return this.MenuHandle.getMenuHandledOption(menuKey)?.callback;
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
@@ -410,31 +410,31 @@ export class GMMenu {
|
|
|
410
410
|
}
|
|
411
411
|
/**
|
|
412
412
|
* 设置当enable为true时默认显示在菜单中前面的emoji图标
|
|
413
|
-
* @param emojiString
|
|
413
|
+
* @param emojiString emoji字符串
|
|
414
414
|
*/
|
|
415
415
|
setEnableTrueEmoji(emojiString: string) {
|
|
416
416
|
if (typeof emojiString !== "string") {
|
|
417
|
-
throw new
|
|
417
|
+
throw new TypeError("参数emojiString必须是string类型");
|
|
418
418
|
}
|
|
419
419
|
this.MenuHandle.$emoji.success = emojiString;
|
|
420
420
|
}
|
|
421
421
|
/**
|
|
422
422
|
* 设置当enable为false时默认显示在菜单中前面的emoji图标
|
|
423
|
-
* @param emojiString
|
|
423
|
+
* @param emojiString emoji字符串
|
|
424
424
|
*/
|
|
425
425
|
setEnableFalseEmoji(emojiString: string) {
|
|
426
426
|
if (typeof emojiString !== "string") {
|
|
427
|
-
throw new
|
|
427
|
+
throw new TypeError("参数emojiString必须是string类型");
|
|
428
428
|
}
|
|
429
429
|
this.MenuHandle.$emoji.error = emojiString;
|
|
430
430
|
}
|
|
431
431
|
/**
|
|
432
432
|
* 设置本地存储的菜单外部的键名
|
|
433
|
-
* @param keyName
|
|
433
|
+
* @param keyName 键名
|
|
434
434
|
*/
|
|
435
435
|
setLocalStorageKeyName(keyName: string) {
|
|
436
436
|
if (typeof keyName !== "string") {
|
|
437
|
-
throw new
|
|
437
|
+
throw new TypeError("参数keyName必须是string类型");
|
|
438
438
|
}
|
|
439
439
|
this.MenuHandle.$data.key = keyName;
|
|
440
440
|
}
|