@whitesev/pops 2.0.10 → 2.0.11

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 (55) hide show
  1. package/dist/index.amd.js +1632 -1570
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +1632 -1570
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +1632 -1570
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +1632 -1570
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +1632 -1570
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +1632 -1570
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +50 -30
  14. package/dist/types/src/PopsAnimation.d.ts +14 -0
  15. package/dist/types/src/PopsCSS.d.ts +34 -0
  16. package/dist/types/src/PopsIcon.d.ts +25 -0
  17. package/dist/types/src/PopsLayer.d.ts +3 -0
  18. package/dist/types/src/components/panel/buttonType.d.ts +2 -2
  19. package/dist/types/src/components/rightClickMenu/index.d.ts +1 -2
  20. package/dist/types/src/components/rightClickMenu/indexType.d.ts +2 -2
  21. package/dist/types/src/types/button.d.ts +3 -3
  22. package/dist/types/src/types/icon.d.ts +1 -1
  23. package/dist/types/src/utils/PopsDOMUtils.d.ts +12 -0
  24. package/dist/types/src/utils/PopsInstanceUtils.d.ts +0 -6
  25. package/dist/types/src/utils/PopsUtils.d.ts +5 -6
  26. package/package.json +1 -1
  27. package/src/Pops.ts +12 -152
  28. package/src/PopsAnimation.ts +32 -0
  29. package/src/PopsCSS.ts +51 -0
  30. package/src/PopsIcon.ts +93 -0
  31. package/src/PopsLayer.ts +17 -0
  32. package/src/components/alert/index.ts +8 -8
  33. package/src/components/confirm/index.ts +8 -8
  34. package/src/components/drawer/index.ts +8 -8
  35. package/src/components/folder/index.ts +15 -15
  36. package/src/components/iframe/index.ts +9 -12
  37. package/src/components/loading/index.ts +5 -5
  38. package/src/components/panel/PanelHandleContentDetails.ts +28 -25
  39. package/src/components/panel/buttonType.ts +2 -2
  40. package/src/components/panel/config.ts +4 -0
  41. package/src/components/panel/index.css +33 -0
  42. package/src/components/panel/index.ts +9 -9
  43. package/src/components/prompt/index.ts +8 -8
  44. package/src/components/rightClickMenu/config.ts +7 -7
  45. package/src/components/rightClickMenu/index.ts +9 -10
  46. package/src/components/rightClickMenu/indexType.ts +2 -2
  47. package/src/components/searchSuggestion/index.ts +5 -5
  48. package/src/components/tooltip/index.ts +5 -5
  49. package/src/handler/PopsElementHandler.ts +17 -17
  50. package/src/handler/PopsHandler.ts +22 -19
  51. package/src/types/button.d.ts +3 -3
  52. package/src/types/icon.d.ts +1 -1
  53. package/src/utils/PopsDOMUtils.ts +34 -1
  54. package/src/utils/PopsInstanceUtils.ts +13 -31
  55. package/src/utils/PopsUtils.ts +7 -16
@@ -1,7 +1,5 @@
1
- import { PopsLayerMode } from "./types/main";
2
1
  import type { PopsAlertDetails } from "./components/alert/indexType";
3
2
  import type { PopsConfirmDetails } from "./components/confirm/indexType";
4
- import type { PopsLayerCommonConfig } from "./types/layer";
5
3
  import type { PopsPromptDetails } from "./components/prompt/indexType";
6
4
  import type { PopsLoadingDetails } from "./components/loading/indexType";
7
5
  import type { PopsIframeDetails } from "./components/iframe/indexType";
@@ -10,7 +8,6 @@ import type { PopsDrawerDetails } from "./components/drawer/indexType";
10
8
  import type { PopsFolderDetails } from "./components/folder/indexType";
11
9
  import type { PopsPanelDetails } from "./components/panel/indexType";
12
10
  import type { PopsRightClickMenuDetails } from "./components/rightClickMenu/indexType";
13
- import type { PopsIcon } from "./types/icon";
14
11
  import type { PopsSearchSuggestionDetails } from "./components/searchSuggestion/indexType";
15
12
  declare class Pops {
16
13
  /** 配置 */
@@ -18,49 +15,71 @@ declare class Pops {
18
15
  /** 版本号 */
19
16
  version: string;
20
17
  cssText: {
21
- /** 主CSS */
22
18
  index: string;
23
- /** 九宫格位置CSS */
24
19
  ninePalaceGridPosition: string;
25
- /** 滚动条CSS */
26
20
  scrollbar: string;
27
- /** 按钮CSS */
28
21
  button: string;
29
- /** 通用的CSS */
30
22
  common: string;
31
- /** 动画 */
32
23
  anim: string;
33
- /** pops.alert */
34
24
  alertCSS: string;
35
- /** pops.cponfirm */
36
25
  confirmCSS: string;
37
- /** pops.prompt */
38
26
  promptCSS: string;
39
- /** pops.loading */
40
27
  loadingCSS: string;
41
- /** pops.iframe */
42
28
  iframeCSS: string;
43
- /** pops.tooltip */
44
29
  tooltipCSS: string;
45
- /** pops.drawer */
46
30
  drawerCSS: string;
47
- /** pops.folder */
48
31
  folderCSS: string;
49
- /** pops.folder */
50
32
  panelCSS: string;
51
- /** pops.rightClickMenu */
52
33
  rightClickMenu: string;
53
34
  };
54
35
  /** icon图标的svg代码 */
55
- iconSVG: { [key in PopsIcon]: string; };
36
+ iconSVG: {
37
+ loading: string;
38
+ min: string;
39
+ max: string;
40
+ mise: string;
41
+ close: string;
42
+ edit: string;
43
+ share: string;
44
+ delete: string;
45
+ search: string;
46
+ upload: string;
47
+ next: string;
48
+ prev: string;
49
+ eleme: string;
50
+ elemePlus: string;
51
+ chromeFilled: string;
52
+ cpu: string;
53
+ videoPlay: string;
54
+ videoPause: string;
55
+ headset: string;
56
+ monitor: string;
57
+ documentCopy: string;
58
+ picture: string;
59
+ circleClose: string;
60
+ view: string;
61
+ hide: string;
62
+ keyboard: string;
63
+ arrowRight: string;
64
+ arrowLeft: string;
65
+ };
56
66
  /** 当前已配置的动画@keyframes名字映射(初始化时生成) */
57
67
  animation: {
58
68
  [key: string]: CSSKeyframesRule;
59
69
  };
60
- /** 是否初始化 */
61
- isInit: boolean;
62
70
  /** 存储已创建的元素 */
63
- layer: { [key in PopsLayerMode]: PopsLayerCommonConfig[]; };
71
+ layer: {
72
+ iframe: import("./types/layer").PopsLayerCommonConfig[];
73
+ loading: import("./types/layer").PopsLayerCommonConfig[];
74
+ folder: import("./types/layer").PopsLayerCommonConfig[];
75
+ alert: import("./types/layer").PopsLayerCommonConfig[];
76
+ confirm: import("./types/layer").PopsLayerCommonConfig[];
77
+ prompt: import("./types/layer").PopsLayerCommonConfig[];
78
+ drawer: import("./types/layer").PopsLayerCommonConfig[];
79
+ panel: import("./types/layer").PopsLayerCommonConfig[];
80
+ tooltip: import("./types/layer").PopsLayerCommonConfig[];
81
+ rightClickMenu: import("./types/layer").PopsLayerCommonConfig[];
82
+ };
64
83
  /** 禁止滚动 */
65
84
  forbiddenScroll: {
66
85
  event(event: Event): boolean;
@@ -72,13 +91,13 @@ declare class Pops {
72
91
  delete(target: any, propName: any): void;
73
92
  assign<T1, T2 extends object, T3 extends boolean>(target: T1, source: T2, isAdd?: T3 | undefined): T3 extends true ? T1 & T2 : T1;
74
93
  getRandomGUID(): string;
75
- parseTextToDOM<R extends HTMLElement>(elementString: string): R;
76
94
  contains(target: any): boolean;
77
95
  contains(context: any, target?: any): boolean;
78
96
  formatTime(text?: string | number | Date, formatType?: string): string;
79
97
  formatTime(text?: string | number | Date, formatType?: "yyyy-MM-dd HH:mm:ss" | "yyyy/MM/dd HH:mm:ss" | "yyyy_MM_dd_HH_mm_ss" | "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2" | "yyyy\u5E74MM\u6708dd\u65E5 hh:mm:ss" | "yyyy\u5E74MM\u6708dd\u65E5 HH:mm:ss" | "yyyy-MM-dd" | "yyyyMMdd" | "HH:mm:ss"): string;
80
98
  formatByteToSize<T extends boolean>(byteSize: number | string, addType?: T | undefined): T extends true ? string : number;
81
99
  AnyTouch: () => typeof import("any-touch").default;
100
+ isPhone(userAgent?: string): boolean;
82
101
  setTimeout(callback: Function, timeout?: number): number;
83
102
  clearTimeout(timeId: number | undefined): void;
84
103
  setInterval(callback: Function, timeout?: number): number;
@@ -105,6 +124,7 @@ declare class Pops {
105
124
  createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, property?: ({ [P in keyof HTMLElementTagNameMap[K]]?: HTMLElementTagNameMap[K][P] extends string | boolean | number ? HTMLElementTagNameMap[K][P] : never; } & {
106
125
  [key: string]: any;
107
126
  }) | string, attributes?: import("./types/PopsDOMUtilsEventType").PopsDOMUtilsCreateElementAttributesMap): HTMLElementTagNameMap[K];
127
+ parseTextToDOM<R extends HTMLElement>(elementString: string): R;
108
128
  getTextBoundingRect(input: HTMLInputElement | HTMLTextAreaElement, selectionStart: number | string, selectionEnd: number | string, debug: boolean): DOMRect;
109
129
  cssHide(ele: Element | null, isImportant?: boolean): void;
110
130
  cssShow(ele: Element | null): void;
@@ -120,6 +140,7 @@ declare class Pops {
120
140
  getStyleValue(element: HTMLElement | CSSStyleDeclaration, styleName: string): number;
121
141
  before(element: HTMLElement | Element | string, content: HTMLElement | string): void;
122
142
  after(element: HTMLElement | Element | string, content: HTMLElement | string): void;
143
+ getKeyFrames(sheet: CSSStyleSheet): {};
123
144
  on(element: import("./types/PopsDOMUtilsEventType").PopsDOMUtilsElementEventType, eventType: string | string[], callback: (event: Event) => void, option?: boolean | AddEventListenerOptions): void;
124
145
  on<T extends import("./types/PopsDOMUtilsEventType").PopsDOMUtils_EventType>(element: import("./types/PopsDOMUtilsEventType").PopsDOMUtilsElementEventType, eventType: T | T[], callback: (event: import("./types/PopsDOMUtilsEventType").PopsDOMUtils_Event[T]) => void, option?: boolean | AddEventListenerOptions): void;
125
146
  on<T extends Event>(element: import("./types/PopsDOMUtilsEventType").PopsDOMUtilsElementEventType, eventType: string, callback: (event: T) => void, option?: boolean | AddEventListenerOptions): void;
@@ -158,11 +179,10 @@ declare class Pops {
158
179
  isOverMaxZIndex: boolean;
159
180
  };
160
181
  getMaxZIndex(deviation?: number): number;
161
- getKeyFrames(sheet: CSSStyleSheet): {};
162
- removeInstance(moreLayerConfigList: PopsLayerCommonConfig[][], guid: string, isAll?: boolean): PopsLayerCommonConfig[][];
163
- hide(popsType: PopsLayerMode, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): Promise<void>;
164
- show(popsType: PopsLayerMode, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement?: HTMLElement): Promise<void>;
165
- close(popsType: string, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
182
+ removeInstance(moreLayerConfigList: import("./types/layer").PopsLayerCommonConfig[][], guid: string, isAll?: boolean): import("./types/layer").PopsLayerCommonConfig[][];
183
+ hide(popsType: import("./types/main").PopsLayerMode, layerConfigList: import("./types/layer").PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): Promise<void>;
184
+ show(popsType: import("./types/main").PopsLayerMode, layerConfigList: import("./types/layer").PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement?: HTMLElement): Promise<void>;
185
+ close(popsType: string, layerConfigList: import("./types/layer").PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): Promise<void>;
166
186
  drag(moveElement: HTMLElement, options: {
167
187
  dragElement: HTMLElement;
168
188
  limit: boolean;
@@ -21000,7 +21020,7 @@ declare class Pops {
21000
21020
  };
21001
21021
  targetSelector: string | null;
21002
21022
  data: {
21003
- icon: PopsIcon | string;
21023
+ icon: import("./types/icon").PopsIconType | string;
21004
21024
  iconIsLoading: boolean;
21005
21025
  text: string | (() => string);
21006
21026
  callback: (clickEvent: PointerEvent, contextMenuEvent: PointerEvent, liElement: HTMLLIElement) => boolean | void | Promise<boolean | void>;
@@ -0,0 +1,14 @@
1
+ export declare const PopsAnimation: {
2
+ $data: {
3
+ [key: string]: CSSKeyframesRule;
4
+ };
5
+ $flag: {
6
+ /** 是否初始化 */
7
+ isInit: boolean;
8
+ };
9
+ init(): void;
10
+ /**
11
+ * 判断是否存在某个动画名
12
+ */
13
+ hasAnim(name: string): boolean;
14
+ };
@@ -0,0 +1,34 @@
1
+ export declare const PopsCSS: {
2
+ /** 主CSS */
3
+ index: string;
4
+ /** 九宫格位置CSS */
5
+ ninePalaceGridPosition: string;
6
+ /** 滚动条CSS */
7
+ scrollbar: string;
8
+ /** 按钮CSS */
9
+ button: string;
10
+ /** 通用的CSS */
11
+ common: string;
12
+ /** 动画 */
13
+ anim: string;
14
+ /** pops.alert */
15
+ alertCSS: string;
16
+ /** pops.cponfirm */
17
+ confirmCSS: string;
18
+ /** pops.prompt */
19
+ promptCSS: string;
20
+ /** pops.loading */
21
+ loadingCSS: string;
22
+ /** pops.iframe */
23
+ iframeCSS: string;
24
+ /** pops.tooltip */
25
+ tooltipCSS: string;
26
+ /** pops.drawer */
27
+ drawerCSS: string;
28
+ /** pops.folder */
29
+ folderCSS: string;
30
+ /** pops.folder */
31
+ panelCSS: string;
32
+ /** pops.rightClickMenu */
33
+ rightClickMenu: string;
34
+ };
@@ -0,0 +1,25 @@
1
+ import type { PopsIconType } from "./types/icon";
2
+ export declare const PopsIcon: {
3
+ $data: { [key in PopsIconType]: string; };
4
+ /**
5
+ * 判断是否存在某个icon
6
+ * @param iconName 图标名
7
+ */
8
+ hasIcon(iconName: string): boolean;
9
+ /**
10
+ * 获取icon
11
+ * @param iconName 图标名
12
+ */
13
+ getIcon(iconName: string): string | null;
14
+ /**
15
+ * 删除图标
16
+ * @param iconName 图标名
17
+ */
18
+ deleteIcon(iconName: string): boolean;
19
+ /**
20
+ * 设置图标
21
+ * @param iconName 图标名
22
+ * @param iconHTML 图标html
23
+ */
24
+ setIcon(iconName: string, iconHTML: string): void;
25
+ };
@@ -0,0 +1,3 @@
1
+ import type { PopsLayerCommonConfig } from "./types/layer";
2
+ import type { PopsLayerMode } from "./types/main";
3
+ export declare const PopsLayer: { [key in PopsLayerMode]: PopsLayerCommonConfig[]; };
@@ -1,6 +1,6 @@
1
1
  import type { PopsPanelCommonDetails } from "./commonType";
2
2
  import type { PopsButtonStyleType } from "../../types/button";
3
- import type { PopsIcon } from "../../types/icon";
3
+ import type { PopsIconType } from "../../types/icon";
4
4
  /**
5
5
  * pops.panel的 button
6
6
  */
@@ -48,7 +48,7 @@ export interface PopsPanelButtonDetails extends PopsPanelCommonDetails<PopsPanel
48
48
  /**
49
49
  * 按钮的图标,已配置的svg请看pops.config.iconSVG,或者自定义的图标svg代码
50
50
  */
51
- buttonIcon?: PopsIcon;
51
+ buttonIcon?: PopsIconType;
52
52
  /**
53
53
  * 按钮的图标在右边
54
54
  */
@@ -1,4 +1,3 @@
1
- import type { PopsIcon } from "../../types/icon";
2
1
  import type { PopsRightClickMenuDetails } from "./indexType";
3
2
  export declare const PopsRightClickMenu: {
4
3
  init(details: PopsRightClickMenuDetails): {
@@ -20639,7 +20638,7 @@ export declare const PopsRightClickMenu: {
20639
20638
  };
20640
20639
  targetSelector: string | null;
20641
20640
  data: {
20642
- icon: PopsIcon | string;
20641
+ icon: import("../../types/icon").PopsIconType | string;
20643
20642
  iconIsLoading: boolean;
20644
20643
  text: string | (() => string);
20645
20644
  callback: (clickEvent: PointerEvent, contextMenuEvent: PointerEvent, liElement: HTMLLIElement) => boolean | void | Promise<boolean | void>;
@@ -1,5 +1,5 @@
1
1
  import type { PopsCommonConfig } from "../../types/components";
2
- import type { PopsIcon } from "../../types/icon";
2
+ import type { PopsIconType } from "../../types/icon";
3
3
  /**
4
4
  * pops.rightClickMenu的右键菜单配置
5
5
  */
@@ -7,7 +7,7 @@ export interface PopsRightClickMenuDataDetails {
7
7
  /**
8
8
  * svg图标
9
9
  */
10
- icon: PopsIcon | string;
10
+ icon: PopsIconType | string;
11
11
  /**
12
12
  * 图标是否旋转
13
13
  */
@@ -1,5 +1,5 @@
1
1
  import { PopsEventDetails, PopsHandlerEventDetails } from "./event";
2
- import type { PopsIcon } from "./icon";
2
+ import type { PopsIconType } from "./icon";
3
3
 
4
4
  /**
5
5
  * 按钮类型
@@ -79,7 +79,7 @@ export interface PopsButtonDetails<T = {}> {
79
79
  /**
80
80
  * 图标按钮,如果名字为内置的,则使用内置的,否则为自定义的svg
81
81
  */
82
- icon: PopsIcon;
82
+ icon: PopsIconType;
83
83
  /**
84
84
  * 图标按钮是否放在右边
85
85
  */
@@ -125,7 +125,7 @@ export interface PopsButtonDetailsAnyType<T = {}> {
125
125
  /**
126
126
  * 图标按钮,如果名字为内置的,则使用内置的,否则为自定义的svg
127
127
  */
128
- icon: PopsIcon;
128
+ icon: PopsIconType;
129
129
  /**
130
130
  * 图标按钮是否放在右边
131
131
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 按钮svg图标
3
3
  */
4
- export type PopsIcon =
4
+ export type PopsIconType =
5
5
  | "min"
6
6
  | "mise"
7
7
  | "max"
@@ -520,6 +520,12 @@ declare class PopsDOMUtils extends PopsDOMUtilsEvent {
520
520
  }) | string,
521
521
  /** 自定义属性 */
522
522
  attributes?: PopsDOMUtilsCreateElementAttributesMap): HTMLElementTagNameMap[K];
523
+ /**
524
+ * 字符串转HTMLElement
525
+ * @param elementString
526
+ * @returns
527
+ */
528
+ parseTextToDOM<R extends HTMLElement>(elementString: string): R;
523
529
  /**
524
530
  * 获取文字的位置信息
525
531
  * @param input 输入框
@@ -635,6 +641,12 @@ declare class PopsDOMUtils extends PopsDOMUtilsEvent {
635
641
  * DOMUtils.after("a.xx","'<b class="xx"></b>")
636
642
  * */
637
643
  after(element: HTMLElement | Element | string, content: HTMLElement | string): void;
644
+ /**
645
+ * 获取CSS Rule
646
+ * @param sheet
647
+ * @returns
648
+ */
649
+ getKeyFrames(sheet: CSSStyleSheet): {};
638
650
  }
639
651
  declare const popsDOMUtils: PopsDOMUtils;
640
652
  export { popsDOMUtils };
@@ -42,12 +42,6 @@ export declare const PopsInstanceUtils: {
42
42
  * > 1001
43
43
  **/
44
44
  getMaxZIndex(deviation?: number): number;
45
- /**
46
- * 获取CSS Rule
47
- * @param sheet
48
- * @returns
49
- */
50
- getKeyFrames(sheet: CSSStyleSheet): {};
51
45
  /**
52
46
  * 删除配置中对应的对象
53
47
  * @param moreLayerConfigList 配置实例列表
@@ -42,12 +42,6 @@ declare class PopsUtils {
42
42
  * 生成uuid
43
43
  */
44
44
  getRandomGUID(): string;
45
- /**
46
- * 字符串转HTMLElement
47
- * @param elementString
48
- * @returns
49
- */
50
- parseTextToDOM<R extends HTMLElement>(elementString: string): R;
51
45
  /**
52
46
  * 判断元素/页面中是否包含该元素
53
47
  * @param target 需要判断的元素
@@ -119,6 +113,11 @@ declare class PopsUtils {
119
113
  **/
120
114
  formatByteToSize<T extends boolean>(byteSize: number | string, addType?: T): T extends true ? string : number;
121
115
  AnyTouch: () => typeof AnyTouch;
116
+ /**
117
+ * 通过navigator.userAgent判断是否是手机访问
118
+ * @param userAgent
119
+ */
120
+ isPhone(userAgent?: string): boolean;
122
121
  /**
123
122
  * 自动使用 Worker 执行 setTimeout
124
123
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "弹窗库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/src/Pops.ts CHANGED
@@ -1,57 +1,11 @@
1
1
  import { popsDOMUtils } from "./utils/PopsDOMUtils";
2
2
  import { PopsInstanceUtils } from "./utils/PopsInstanceUtils";
3
3
  import { popsUtils } from "./utils/PopsUtils";
4
- import indexCSS from "./css/index.css";
5
- import ninePalaceGridPositionCSS from "./css/ninePalaceGridPosition.css";
6
- import scrollbarCSS from "./css/scrollbar.css";
7
- import buttonCSS from "./css/button.css";
8
- import commonCSS from "./css/common.css";
9
- import animCSS from "./css/animation.css";
10
- import alertCSS from "./components/alert/index.css";
11
- import confirmCSS from "./components/confirm/index.css";
12
- import promptCSS from "./components/prompt/index.css";
13
- import loadingCSS from "./components/loading/index.css";
14
- import iframeCSS from "./components/iframe/index.css";
15
- import tooltipCSS from "./components/tooltip/index.css";
16
- import drawerCSS from "./components/drawer/index.css";
17
- import folderCSS from "./components/folder/index.css";
18
- import panelCSS from "./components/panel/index.css";
19
- import rightClickMenuCSS from "./components/rightClickMenu/index.css";
20
- import SVG_min from "./svg/min.svg";
21
- import SVG_mise from "./svg/mise.svg";
22
- import SVG_max from "./svg/max.svg";
23
- import SVG_close from "./svg/close.svg";
24
- import SVG_edit from "./svg/edit.svg";
25
- import SVG_share from "./svg/share.svg";
26
- import SVG_delete from "./svg/delete.svg";
27
- import SVG_search from "./svg/search.svg";
28
- import SVG_upload from "./svg/upload.svg";
29
- import SVG_loading from "./svg/loading.svg";
30
- import SVG_next from "./svg/next.svg";
31
- import SVG_prev from "./svg/prev.svg";
32
- import SVG_eleme from "./svg/eleme.svg";
33
- import SVG_elemePlus from "./svg/elemePlus.svg";
34
- import SVG_chromeFilled from "./svg/chromeFilled.svg";
35
- import SVG_cpu from "./svg/cpu.svg";
36
- import SVG_videoPlay from "./svg/videoPlay.svg";
37
- import SVG_videoPause from "./svg/videoPause.svg";
38
- import SVG_headset from "./svg/headset.svg";
39
- import SVG_monitor from "./svg/monitor.svg";
40
- import SVG_documentCopy from "./svg/documentCopy.svg";
41
- import SVG_picture from "./svg/picture.svg";
42
- import SVG_circleClose from "./svg/circleClose.svg";
43
- import SVG_view from "./svg/view.svg";
44
- import SVG_hide from "./svg/hide.svg";
45
- import SVG_keyboard from "./svg/keyboard.svg";
46
- import SVG_arrowRight from "./svg/arrowRight.svg";
47
- import SVG_arrowLeft from "./svg/arrowLeft.svg";
48
4
  import { PopsCore } from "./Core";
49
- import { PopsLayerMode } from "./types/main";
50
5
  import { PopsAlert } from "./components/alert";
51
6
  import type { PopsAlertDetails } from "./components/alert/indexType";
52
7
  import { PopsConfirm } from "./components/confirm";
53
8
  import type { PopsConfirmDetails } from "./components/confirm/indexType";
54
- import type { PopsLayerCommonConfig } from "./types/layer";
55
9
  import type { PopsPromptDetails } from "./components/prompt/indexType";
56
10
  import { PopsPrompt } from "./components/prompt";
57
11
  import type { PopsLoadingDetails } from "./components/loading/indexType";
@@ -67,108 +21,29 @@ import type { PopsPanelDetails } from "./components/panel/indexType";
67
21
  import { PopsPanel } from "./components/panel";
68
22
  import { PopsRightClickMenu } from "./components/rightClickMenu";
69
23
  import type { PopsRightClickMenuDetails } from "./components/rightClickMenu/indexType";
70
- import type { PopsIcon } from "./types/icon";
71
24
  import type { PopsSearchSuggestionDetails } from "./components/searchSuggestion/indexType";
72
25
  import { PopsSearchSuggestion } from "./components/searchSuggestion";
73
26
  import { PopsMathFloatUtils } from "./utils/PopsMathUtils";
74
27
  import { PanelHandleContentDetails } from "./components/panel/PanelHandleContentDetails";
75
28
  import { GlobalConfig } from "./GlobalConfig";
76
29
  import { PopsTooltip } from "./components/tooltip";
77
- import { PopsSafeUtils } from "./utils/PopsSafeUtils";
30
+ import { PopsCSS } from "./PopsCSS";
31
+ import { PopsIcon } from "./PopsIcon";
32
+ import { PopsLayer } from "./PopsLayer";
33
+ import { PopsAnimation } from "./PopsAnimation";
78
34
 
79
35
  class Pops {
80
36
  /** 配置 */
81
37
  config = {
82
38
  /** 版本号 */
83
- version: "2025.5.26",
84
- cssText: {
85
- /** 主CSS */
86
- index: indexCSS,
87
- /** 九宫格位置CSS */
88
- ninePalaceGridPosition: ninePalaceGridPositionCSS,
89
- /** 滚动条CSS */
90
- scrollbar: scrollbarCSS,
91
- /** 按钮CSS */
92
- button: buttonCSS,
93
- /** 通用的CSS */
94
- common: commonCSS,
95
- /** 动画 */
96
- anim: animCSS,
97
- /** pops.alert */
98
- alertCSS: alertCSS,
99
- /** pops.cponfirm */
100
- confirmCSS: confirmCSS,
101
- /** pops.prompt */
102
- promptCSS: promptCSS,
103
- /** pops.loading */
104
- loadingCSS: loadingCSS,
105
- /** pops.iframe */
106
- iframeCSS: iframeCSS,
107
- /** pops.tooltip */
108
- tooltipCSS: tooltipCSS,
109
- /** pops.drawer */
110
- drawerCSS: drawerCSS,
111
- /** pops.folder */
112
- folderCSS: folderCSS,
113
- /** pops.folder */
114
- panelCSS: panelCSS,
115
- /** pops.rightClickMenu */
116
- rightClickMenu: rightClickMenuCSS,
117
- },
39
+ version: "2025.6.4",
40
+ cssText: PopsCSS,
118
41
  /** icon图标的svg代码 */
119
- iconSVG: {
120
- min: SVG_min,
121
- mise: SVG_mise,
122
- max: SVG_max,
123
- close: SVG_close,
124
- edit: SVG_edit,
125
- share: SVG_share,
126
- delete: SVG_delete,
127
- search: SVG_search,
128
- upload: SVG_upload,
129
- loading: SVG_loading,
130
- next: SVG_next,
131
- prev: SVG_prev,
132
- eleme: SVG_eleme,
133
- elemePlus: SVG_elemePlus,
134
- chromeFilled: SVG_chromeFilled,
135
- cpu: SVG_cpu,
136
- videoPlay: SVG_videoPlay,
137
- videoPause: SVG_videoPause,
138
- headset: SVG_headset,
139
- monitor: SVG_monitor,
140
- documentCopy: SVG_documentCopy,
141
- picture: SVG_picture,
142
- circleClose: SVG_circleClose,
143
- view: SVG_view,
144
- hide: SVG_hide,
145
- keyboard: SVG_keyboard,
146
- arrowRight: SVG_arrowRight,
147
- arrowLeft: SVG_arrowLeft,
148
- } as {
149
- [key in PopsIcon]: string;
150
- },
42
+ iconSVG: PopsIcon.$data,
151
43
  /** 当前已配置的动画@keyframes名字映射(初始化时生成) */
152
- animation: {} as {
153
- [key: string]: CSSKeyframesRule;
154
- },
155
- /** 是否初始化 */
156
- isInit: false,
44
+ animation: PopsAnimation.$data,
157
45
  /** 存储已创建的元素 */
158
- layer: {
159
- alert: [],
160
- confirm: [],
161
- prompt: [],
162
- loading: [],
163
- iframe: [],
164
- tooltip: [],
165
- drawer: [],
166
- folder: [],
167
- panel: [],
168
- rightClickMenu: [],
169
- } as {
170
- [key in PopsLayerMode]: PopsLayerCommonConfig[];
171
- },
46
+ layer: PopsLayer,
172
47
  /** 禁止滚动 */
173
48
  forbiddenScroll: {
174
49
  event(event: Event) {
@@ -186,22 +61,7 @@ class Pops {
186
61
  /** pops.panel中用于处理各个类型的工具 */
187
62
  panelHandleContentUtils: PanelHandleContentDetails,
188
63
  };
189
- init() {
190
- if (!this.config.isInit) {
191
- /* 处理获取当前所有的动画名 */
192
- this.config.isInit = true;
193
- let animationStyle = document.createElement("style");
194
- PopsSafeUtils.setSafeHTML(animationStyle, this.config.cssText.anim);
195
- popsDOMUtils.appendHead(animationStyle);
196
- this.config.animation = null as any;
197
- this.config.animation = PopsInstanceUtils.getKeyFrames(
198
- animationStyle.sheet!
199
- );
200
- popsUtils.setTimeout(() => {
201
- animationStyle.remove();
202
- }, 50);
203
- }
204
- }
64
+ init() {}
205
65
  /**
206
66
  * 释放原有的pops控制权
207
67
  * @example
@@ -224,8 +84,8 @@ class Pops {
224
84
  * 通过navigator.userAgent判断是否是手机访问
225
85
  * @param userAgent
226
86
  */
227
- isPhone(userAgent = PopsCore.globalThis.navigator.userAgent): boolean {
228
- return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
87
+ isPhone(userAgent?: string) {
88
+ return popsUtils.isPhone(userAgent);
229
89
  }
230
90
  /**
231
91
  * 为所有弹窗设置全局属性
@@ -0,0 +1,32 @@
1
+ import { PopsCSS } from "./PopsCSS";
2
+ import { popsDOMUtils } from "./utils/PopsDOMUtils";
3
+ import { PopsSafeUtils } from "./utils/PopsSafeUtils";
4
+ import { popsUtils } from "./utils/PopsUtils";
5
+
6
+ export const PopsAnimation = {
7
+ $data: {} as { [key: string]: CSSKeyframesRule },
8
+ $flag: {
9
+ /** 是否初始化 */
10
+ isInit: false,
11
+ },
12
+ init() {
13
+ if (!this.$flag.isInit) {
14
+ this.$flag.isInit = true;
15
+ /* 处理获取当前所有的动画名 */
16
+ let animationStyle = document.createElement("style");
17
+ PopsSafeUtils.setSafeHTML(animationStyle, PopsCSS.anim);
18
+ popsDOMUtils.appendHead(animationStyle);
19
+ this.$data = null as any;
20
+ this.$data = popsDOMUtils.getKeyFrames(animationStyle.sheet!);
21
+ popsUtils.setTimeout(() => {
22
+ animationStyle.remove();
23
+ }, 50);
24
+ }
25
+ },
26
+ /**
27
+ * 判断是否存在某个动画名
28
+ */
29
+ hasAnim(name: string) {
30
+ return this.$data.hasOwnProperty(name);
31
+ },
32
+ };