@whitesev/pops 2.4.4 → 2.4.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/README.md +117 -111
- package/dist/index.amd.js +687 -733
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +687 -733
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +687 -733
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +687 -733
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +687 -733
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +687 -733
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +9 -10
- package/dist/types/src/components/panel/types/components-common.d.ts +26 -26
- package/dist/types/src/components/panel/types/index.d.ts +2 -2
- package/dist/types/src/components/rightClickMenu/index.d.ts +3 -4
- package/dist/types/src/components/searchSuggestion/index.d.ts +2 -2
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +2 -2
- package/dist/types/src/handler/PopsHandler.d.ts +3 -3
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +141 -145
- package/dist/types/src/types/animation.d.ts +15 -15
- package/dist/types/src/types/button.d.ts +141 -141
- package/dist/types/src/types/components.d.ts +175 -178
- package/dist/types/src/types/event.d.ts +44 -44
- package/dist/types/src/types/global.d.ts +18 -13
- package/dist/types/src/types/icon.d.ts +28 -28
- package/dist/types/src/types/inst.d.ts +14 -14
- package/dist/types/src/types/main.d.ts +46 -49
- package/dist/types/src/types/mask.d.ts +36 -36
- package/dist/types/src/types/position.d.ts +46 -46
- package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +1 -1
- package/dist/types/src/utils/PopsUtils.d.ts +16 -16
- package/package.json +17 -8
|
@@ -14,27 +14,27 @@ import type { PopsPanelSliderDetails } from "../components/panel/types/component
|
|
|
14
14
|
import type { PopsPanelSwitchDetails } from "../components/panel/types/components-switch";
|
|
15
15
|
import type { PopsPanelTextAreaDetails } from "../components/panel/types/components-textarea";
|
|
16
16
|
import type { PopsPromptDetails } from "../components/prompt/types/index";
|
|
17
|
-
import { PopsRightClickMenuDetails } from "../components/rightClickMenu/types";
|
|
18
|
-
import { PopsToolTipDetails } from "../components/tooltip/types/index";
|
|
17
|
+
import type { PopsRightClickMenuDetails } from "../components/rightClickMenu/types";
|
|
18
|
+
import type { PopsToolTipDetails } from "../components/tooltip/types/index";
|
|
19
19
|
import type { PopsSearchSuggestionDetails } from "../components/searchSuggestion/types";
|
|
20
20
|
|
|
21
|
-
export interface PopsUtilsOwnObject<V
|
|
22
|
-
|
|
21
|
+
export interface PopsUtilsOwnObject<V> {
|
|
22
|
+
[key: string]: V | PopsUtilsOwnObject<V>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/** pops所有的类型配置 11个*/
|
|
26
26
|
export interface PopsDetails {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
alert: PopsAlertDetails;
|
|
28
|
+
confirm: PopsConfirmDetails;
|
|
29
|
+
prompt: PopsPromptDetails;
|
|
30
|
+
loading: PopsLoadingDetails;
|
|
31
|
+
iframe: PopsIframeDetails;
|
|
32
|
+
tooltip: PopsToolTipDetails;
|
|
33
|
+
drawer: PopsDrawerDetails;
|
|
34
|
+
folder: PopsFolderDetails;
|
|
35
|
+
panel: PopsPanelDetails;
|
|
36
|
+
rightClickMenu: PopsRightClickMenuDetails;
|
|
37
|
+
searchSuggestion: PopsSearchSuggestionDetails;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/** pops的类型 */
|
|
@@ -54,8 +54,8 @@ export type PopsSupportAnimDetailsType = keyof PopsSupportAnimDetails;
|
|
|
54
54
|
|
|
55
55
|
/** pops弹窗支持标题栏的配置 */
|
|
56
56
|
export type PopsSupportHeaderTitleDetails = Pick<
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
PopsDetails,
|
|
58
|
+
"alert" | "confirm" | "prompt" | "iframe" | "drawer" | "folder" | "panel"
|
|
59
59
|
>;
|
|
60
60
|
|
|
61
61
|
/** pops弹窗支持标题栏的类型 */
|
|
@@ -68,47 +68,44 @@ export type PopsSupportBottomBtnDetails = Pick<PopsDetails, "alert" | "confirm"
|
|
|
68
68
|
export type PopsSupportBottomBtnDetailsType = keyof PopsSupportHeaderTitleDetails;
|
|
69
69
|
|
|
70
70
|
/** pops支持中间内容的配置 */
|
|
71
|
-
export type PopsSupportContentDetails = Pick<
|
|
72
|
-
PopsDetails,
|
|
73
|
-
"alert" | "confirm" | "prompt" | "drawer" | "loading"
|
|
74
|
-
>;
|
|
71
|
+
export type PopsSupportContentDetails = Pick<PopsDetails, "alert" | "confirm" | "prompt" | "drawer" | "loading">;
|
|
75
72
|
|
|
76
73
|
/** pops支持中间内容的类型 */
|
|
77
74
|
export type PopsSupportContentDetailsType = keyof PopsSupportContentDetails;
|
|
78
75
|
|
|
79
76
|
/** panel的各种类型的配置项 */
|
|
80
77
|
export type PopsPanelFormsTotalDetails =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
| PopsPanelSwitchDetails
|
|
79
|
+
| PopsPanelSliderDetails
|
|
80
|
+
| PopsPanelInputDetails
|
|
81
|
+
| PopsPanelTextAreaDetails
|
|
82
|
+
| PopsPanelSelectDetails<any>
|
|
83
|
+
| PopsPanelButtonDetails
|
|
84
|
+
| PopsPanelDeepMenuDetails
|
|
85
|
+
| PopsPanelOwnDetails;
|
|
89
86
|
|
|
90
87
|
/**
|
|
91
88
|
* pops.xxx的调用返回值
|
|
92
89
|
*/
|
|
93
90
|
export interface PopsCallResult {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
91
|
+
/** 唯一标识id */
|
|
92
|
+
guid: string;
|
|
93
|
+
/** 影子元素 */
|
|
94
|
+
$shadowContainer: HTMLDivElement;
|
|
95
|
+
/** 影子元素的根节点 */
|
|
96
|
+
$shadowRoot: ShadowRoot | HTMLElement;
|
|
97
|
+
/** 元素 */
|
|
98
|
+
element: HTMLDivElement;
|
|
99
|
+
/** 动画层元素 */
|
|
100
|
+
animElement: HTMLDivElement;
|
|
101
|
+
/** pops元素 */
|
|
102
|
+
popsElement: HTMLDivElement;
|
|
103
|
+
/** 遮罩层元素 */
|
|
104
|
+
maskElement?: HTMLDivElement;
|
|
105
|
+
/** 关闭弹窗 */
|
|
106
|
+
close(): void;
|
|
107
|
+
/** 隐藏弹窗 */
|
|
108
|
+
hide(): void;
|
|
109
|
+
/** 显示弹窗 */
|
|
110
|
+
show(): void;
|
|
114
111
|
}
|
|
@@ -10,40 +10,40 @@ import type { PopsPromptDetails } from "../components/prompt/types/index";
|
|
|
10
10
|
* 遮罩层配置
|
|
11
11
|
*/
|
|
12
12
|
export interface PopsMaskDetails {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 是否启用遮罩层,默认false
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
enable?: boolean;
|
|
18
|
+
clickEvent?: {
|
|
19
|
+
/**
|
|
20
|
+
* 点击遮罩层是否触发关闭事件
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
toClose?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 点击遮罩层是否触发隐藏事件
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
toHide?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 遮罩层自定义的点击事件
|
|
32
|
+
* @param originalRun 当toClose为true,它是关闭弹窗,当toHide为true,它是隐藏弹窗
|
|
33
|
+
* @param config 配置信息
|
|
34
|
+
*/
|
|
35
|
+
clickCallBack?:
|
|
36
|
+
| ((
|
|
37
|
+
originalRun: () => void | Promise<void>,
|
|
38
|
+
config:
|
|
39
|
+
| PopsAlertDetails
|
|
40
|
+
| PopsDrawerDetails
|
|
41
|
+
| PopsIframeDetails
|
|
42
|
+
| PopsPromptDetails
|
|
43
|
+
| PopsFolderDetails
|
|
44
|
+
| PopsLoadingDetails
|
|
45
|
+
| PopsPanelDetails
|
|
46
|
+
) => void)
|
|
47
|
+
| undefined
|
|
48
|
+
| null;
|
|
49
49
|
}
|
|
@@ -2,59 +2,59 @@
|
|
|
2
2
|
* 弹窗位置
|
|
3
3
|
*/
|
|
4
4
|
export type PopsPosition =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
| "top_left"
|
|
6
|
+
| "top"
|
|
7
|
+
| "top_right"
|
|
8
|
+
| "center_left"
|
|
9
|
+
| "center"
|
|
10
|
+
| "center_right"
|
|
11
|
+
| "bottom_left"
|
|
12
|
+
| "bottom"
|
|
13
|
+
| "bottom_right";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* 按钮位置
|
|
17
17
|
*/
|
|
18
18
|
export type PopsJustifyContent =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
| "center"
|
|
20
|
+
| "end"
|
|
21
|
+
| "flex-end"
|
|
22
|
+
| "flex-start"
|
|
23
|
+
| "left"
|
|
24
|
+
| "normal"
|
|
25
|
+
| "right"
|
|
26
|
+
| "space-around"
|
|
27
|
+
| "space-between"
|
|
28
|
+
| "space-evenly"
|
|
29
|
+
| "start"
|
|
30
|
+
| "stretch"
|
|
31
|
+
| "inherit"
|
|
32
|
+
| "initial"
|
|
33
|
+
| "revert"
|
|
34
|
+
| "revert-layer"
|
|
35
|
+
| "unset";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* text-align
|
|
39
39
|
*/
|
|
40
40
|
export type PopsTextAlign =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
| "center"
|
|
42
|
+
| "end"
|
|
43
|
+
| "justify"
|
|
44
|
+
| "left"
|
|
45
|
+
| "right"
|
|
46
|
+
| "start"
|
|
47
|
+
| "-webkit-auto"
|
|
48
|
+
| "-moz-center-or-inherit"
|
|
49
|
+
| "-webkit-center"
|
|
50
|
+
| "-moz-center"
|
|
51
|
+
| "-webkit-left"
|
|
52
|
+
| "-moz-left"
|
|
53
|
+
| "-webkit-match-parent"
|
|
54
|
+
| "-webkit-right"
|
|
55
|
+
| "-moz-right"
|
|
56
|
+
| "inherit"
|
|
57
|
+
| "initial"
|
|
58
|
+
| "revert"
|
|
59
|
+
| "revert-layer"
|
|
60
|
+
| "unset";
|
|
@@ -166,7 +166,7 @@ declare class PopsDOMUtilsEvent {
|
|
|
166
166
|
* console.log("文档加载完毕")
|
|
167
167
|
* })
|
|
168
168
|
*/
|
|
169
|
-
ready<T extends
|
|
169
|
+
ready<T extends (...args: any[]) => any>(callback: T): void;
|
|
170
170
|
/**
|
|
171
171
|
* 主动触发事件
|
|
172
172
|
* @param element 需要触发的元素|元素数组|window
|
|
@@ -102,5 +102,5 @@ export declare const PopsInstanceUtils: {
|
|
|
102
102
|
* @param getAfterValueFun
|
|
103
103
|
* @param sortByDesc 排序是否降序,默认降序
|
|
104
104
|
*/
|
|
105
|
-
sortElementListByProperty<T
|
|
105
|
+
sortElementListByProperty<T, R>(getBeforeValueFun: (value: T) => R, getAfterValueFun: (value: T) => R, sortByDesc?: boolean): (after_obj: T, before_obj: T) => 1 | 0 | -1;
|
|
106
106
|
};
|
|
@@ -23,20 +23,20 @@ declare class PopsUtils {
|
|
|
23
23
|
*/
|
|
24
24
|
delete(target: any, propName: any): void;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
* JSON数据从源端替换到目标端中,如果目标端存在该数据则替换,不添加,返回结果为目标端替换完毕的结果
|
|
27
|
+
* @param target 目标数据
|
|
28
|
+
* @param source 源数据
|
|
29
|
+
* @param isAdd 是否可以追加键,默认false
|
|
30
|
+
* @example
|
|
31
|
+
* Utils.assign({"1":1,"2":{"3":3}}, {"2":{"3":4}});
|
|
32
|
+
* >
|
|
33
|
+
* {
|
|
34
|
+
"1": 1,
|
|
35
|
+
"2": {
|
|
36
|
+
"3": 4
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
*/
|
|
40
40
|
assign<T1, T2 extends object, T3 extends boolean>(target: T1, source: T2, isAdd?: T3): T3 extends true ? T1 & T2 : T1;
|
|
41
41
|
/**
|
|
42
42
|
* 生成uuid
|
|
@@ -121,7 +121,7 @@ declare class PopsUtils {
|
|
|
121
121
|
/**
|
|
122
122
|
* 自动使用 Worker 执行 setTimeout
|
|
123
123
|
*/
|
|
124
|
-
setTimeout(callback:
|
|
124
|
+
setTimeout(callback: (...args: any[]) => any, timeout?: number): number;
|
|
125
125
|
/**
|
|
126
126
|
* 配合 .setTimeout 使用
|
|
127
127
|
*/
|
|
@@ -129,7 +129,7 @@ declare class PopsUtils {
|
|
|
129
129
|
/**
|
|
130
130
|
* 自动使用 Worker 执行 setInterval
|
|
131
131
|
*/
|
|
132
|
-
setInterval(callback:
|
|
132
|
+
setInterval(callback: (...args: any[]) => any, timeout?: number): number;
|
|
133
133
|
/**
|
|
134
134
|
* 配合 .setInterval 使用
|
|
135
135
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whitesev/pops",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.6",
|
|
4
4
|
"description": "弹窗库",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/WhiteSevs/TamperMonkeyScript/tree/master/lib/pops#readme",
|
|
@@ -42,21 +42,30 @@
|
|
|
42
42
|
"worker-timers": "^8.0.23"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"@eslint/js": "^9.36.0",
|
|
45
46
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
47
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
46
48
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
47
49
|
"@rollup/plugin-typescript": "12.1.4",
|
|
50
|
+
"browserslist": "^4.26.2",
|
|
51
|
+
"caniuse-lite": "^1.0.30001743",
|
|
52
|
+
"eslint": "^9.36.0",
|
|
53
|
+
"eslint-config-prettier": "^10.1.8",
|
|
54
|
+
"eslint-plugin-compat": "^6.0.2",
|
|
55
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
56
|
+
"globals": "^16.4.0",
|
|
48
57
|
"rollup": "^4.45.0",
|
|
49
58
|
"rollup-plugin-clear": "^2.0.7",
|
|
50
59
|
"rollup-plugin-import-css": "^4.0.1",
|
|
51
60
|
"tslib": "^2.8.1",
|
|
52
|
-
"typescript": "^5.8.3"
|
|
61
|
+
"typescript": "^5.8.3",
|
|
62
|
+
"typescript-eslint": "^8.44.0"
|
|
53
63
|
},
|
|
54
64
|
"scripts": {
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"release": "npm publish"
|
|
65
|
+
"lint": "eslint .",
|
|
66
|
+
"lint:fix": "eslint . --fix",
|
|
67
|
+
"format": "prettier . --write",
|
|
68
|
+
"dev": "pnpm run format && pnpm run lint && rollup -c -w",
|
|
69
|
+
"build": "pnpm run format && pnpm run lint && rollup -c"
|
|
61
70
|
}
|
|
62
71
|
}
|