@whitesev/domutils 1.2.0 → 1.3.0
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 +155 -115
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +155 -115
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +155 -115
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +155 -115
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +155 -115
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +155 -115
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/DOMUtils.d.ts +3 -3
- package/dist/types/src/DOMUtilsCommonUtils.d.ts +2 -0
- package/dist/types/src/DOMUtilsEvent.d.ts +4 -2
- package/dist/types/src/WindowApi.d.ts +22 -0
- package/package.json +1 -1
- package/src/DOMUtils.ts +152 -66
- package/src/DOMUtilsCommonUtils.ts +9 -5
- package/src/DOMUtilsEvent.ts +44 -22
- package/src/WindowApi.ts +44 -0
- package/dist/types/src/DOMUtilsCore.d.ts +0 -15
- package/src/DOMUtilsCore.ts +0 -45
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DOMUtilsCoreOption } from "./DOMUtilsCore";
|
|
2
1
|
import { type DOMUtilsCreateElementAttributesMap, DOMUtilsEvent } from "./DOMUtilsEvent";
|
|
3
2
|
import { ParseHTMLReturnType } from "./types/global";
|
|
3
|
+
import { type UtilsWindowApiOption } from "./WindowApi";
|
|
4
4
|
declare class DOMUtils extends DOMUtilsEvent {
|
|
5
|
-
constructor(option?:
|
|
5
|
+
constructor(option?: UtilsWindowApiOption);
|
|
6
6
|
/** 版本号 */
|
|
7
7
|
version: string;
|
|
8
8
|
/**
|
|
@@ -589,7 +589,7 @@ declare class DOMUtils extends DOMUtilsEvent {
|
|
|
589
589
|
* @param option
|
|
590
590
|
* @returns
|
|
591
591
|
*/
|
|
592
|
-
createDOMUtils(option?:
|
|
592
|
+
createDOMUtils(option?: UtilsWindowApiOption): DOMUtils;
|
|
593
593
|
/**
|
|
594
594
|
* 获取文字的位置信息
|
|
595
595
|
* @param $input 输入框
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UtilsWindowApiOption } from "./WindowApi";
|
|
1
2
|
export type DOMUtilsEventObject<T extends Node> = Event & {
|
|
2
3
|
target: T;
|
|
3
4
|
};
|
|
@@ -199,7 +200,9 @@ export declare interface DOMUtilsEventListenerOptionsAttribute {
|
|
|
199
200
|
selector?: string;
|
|
200
201
|
}
|
|
201
202
|
export declare type DOMUtilsElementEventType = HTMLElement | string | NodeList | (HTMLElement | Window | Document | Element | typeof globalThis)[] | Window | Document | Element | null | typeof globalThis | ShadowRoot | EventTarget | ChildNode | Node;
|
|
202
|
-
declare class DOMUtilsEvent {
|
|
203
|
+
export declare class DOMUtilsEvent {
|
|
204
|
+
windowApi: UtilsWindowApiOption;
|
|
205
|
+
constructor(windowApiOption?: UtilsWindowApiOption);
|
|
203
206
|
/**
|
|
204
207
|
* 绑定事件
|
|
205
208
|
* @param element 需要绑定的元素|元素数组|window
|
|
@@ -506,4 +509,3 @@ declare class DOMUtilsEvent {
|
|
|
506
509
|
*/
|
|
507
510
|
keypress(target: HTMLElement | Window | typeof globalThis | string, handler: (event: DOMUtils_Event["keypress"]) => void, option?: boolean | AddEventListenerOptions): void;
|
|
508
511
|
}
|
|
509
|
-
export { DOMUtilsEvent };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 配置类型
|
|
3
|
+
*/
|
|
4
|
+
export type UtilsWindowApiOption = {
|
|
5
|
+
document: Document;
|
|
6
|
+
window: Window & typeof globalThis;
|
|
7
|
+
globalThis: typeof globalThis | Window;
|
|
8
|
+
self: Window & typeof globalThis;
|
|
9
|
+
top: Window;
|
|
10
|
+
};
|
|
11
|
+
export declare class WindowApi {
|
|
12
|
+
/** 默认的配置 */
|
|
13
|
+
private defaultApi;
|
|
14
|
+
/** 使用的配置 */
|
|
15
|
+
private api;
|
|
16
|
+
constructor(option?: UtilsWindowApiOption);
|
|
17
|
+
get document(): Document;
|
|
18
|
+
get window(): Window & typeof globalThis;
|
|
19
|
+
get globalThis(): typeof globalThis | Window;
|
|
20
|
+
get self(): Window & typeof globalThis;
|
|
21
|
+
get top(): Window;
|
|
22
|
+
}
|