@whitesev/utils 1.3.5 → 1.3.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 +12 -1
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +12 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +12 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +12 -1
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +12 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Utils.d.ts +12 -0
- package/dist/src/UtilsCore.d.ts +1 -1
- package/package.json +1 -1
- package/src/Utils.ts +21 -1
- package/src/UtilsCore.ts +1 -2
package/dist/src/Utils.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { Log } from "./Log";
|
|
|
11
11
|
import { Progress } from "./Progress";
|
|
12
12
|
import { UtilsDictionary } from "./Dictionary";
|
|
13
13
|
import type { DOMUtils_EventType } from "./Event";
|
|
14
|
+
import type { UtilsCoreOption } from "./UtilsCore";
|
|
14
15
|
export declare var unsafeWindow: Window & typeof globalThis;
|
|
15
16
|
export type JSTypeMap = {
|
|
16
17
|
string: string;
|
|
@@ -110,6 +111,10 @@ export declare interface Vue2Context extends AnyObject {
|
|
|
110
111
|
mode: string;
|
|
111
112
|
resolveHooks: ((...args: any[]) => any)[];
|
|
112
113
|
currentRoute: AnyObject;
|
|
114
|
+
/**
|
|
115
|
+
* 传空就移除上一个监听
|
|
116
|
+
*/
|
|
117
|
+
afterEach: ((to: Vue2Context["$route"], from: Vue2Context["$route"]) => void) | null;
|
|
113
118
|
};
|
|
114
119
|
$ssrContext: AnyObject;
|
|
115
120
|
$watch: (key: string | string[], handler: (this: any, newVal: any, oldVal: any) => void, options?: {
|
|
@@ -118,6 +123,7 @@ export declare interface Vue2Context extends AnyObject {
|
|
|
118
123
|
}) => void;
|
|
119
124
|
}
|
|
120
125
|
declare class Utils {
|
|
126
|
+
constructor(option?: UtilsCoreOption);
|
|
121
127
|
/** 版本号 */
|
|
122
128
|
version: string;
|
|
123
129
|
/**
|
|
@@ -1792,6 +1798,12 @@ declare class Utils {
|
|
|
1792
1798
|
* > 111;
|
|
1793
1799
|
*/
|
|
1794
1800
|
watchObject(target: AnyObject, propertyName: string, getCallBack: (value: any) => void, setCallBack: (value: any) => void): void;
|
|
1801
|
+
/**
|
|
1802
|
+
* 创建一个新的Utils实例
|
|
1803
|
+
* @param option
|
|
1804
|
+
* @returns
|
|
1805
|
+
*/
|
|
1806
|
+
createUtils(option?: UtilsCoreOption): Utils;
|
|
1795
1807
|
}
|
|
1796
1808
|
declare let utils: Utils;
|
|
1797
1809
|
export { utils as Utils };
|
package/dist/src/UtilsCore.d.ts
CHANGED
package/package.json
CHANGED
package/src/Utils.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { Progress } from "./Progress";
|
|
|
14
14
|
import { TryCatch } from "./TryCatch";
|
|
15
15
|
import { UtilsDictionary } from "./Dictionary";
|
|
16
16
|
import type { DOMUtils_EventType } from "./Event";
|
|
17
|
+
import type { UtilsCoreOption } from "./UtilsCore";
|
|
17
18
|
|
|
18
19
|
export declare var unsafeWindow: Window & typeof globalThis;
|
|
19
20
|
|
|
@@ -121,6 +122,13 @@ export declare interface Vue2Context extends AnyObject {
|
|
|
121
122
|
mode: string;
|
|
122
123
|
resolveHooks: ((...args: any[]) => any)[];
|
|
123
124
|
currentRoute: AnyObject;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 传空就移除上一个监听
|
|
128
|
+
*/
|
|
129
|
+
afterEach:
|
|
130
|
+
| ((to: Vue2Context["$route"], from: Vue2Context["$route"]) => void)
|
|
131
|
+
| null;
|
|
124
132
|
};
|
|
125
133
|
$ssrContext: AnyObject;
|
|
126
134
|
|
|
@@ -135,8 +143,11 @@ export declare interface Vue2Context extends AnyObject {
|
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
class Utils {
|
|
146
|
+
constructor(option?: UtilsCoreOption) {
|
|
147
|
+
UtilsCore.init(option);
|
|
148
|
+
}
|
|
138
149
|
/** 版本号 */
|
|
139
|
-
version = "2024.5
|
|
150
|
+
version = "2024.6.5";
|
|
140
151
|
|
|
141
152
|
/**
|
|
142
153
|
* 在页面中增加style元素,如果html节点存在子节点,添加子节点第一个,反之,添加到html节点的子节点最后一个
|
|
@@ -4875,6 +4886,15 @@ class Utils {
|
|
|
4875
4886
|
});
|
|
4876
4887
|
}
|
|
4877
4888
|
}
|
|
4889
|
+
|
|
4890
|
+
/**
|
|
4891
|
+
* 创建一个新的Utils实例
|
|
4892
|
+
* @param option
|
|
4893
|
+
* @returns
|
|
4894
|
+
*/
|
|
4895
|
+
createUtils(option?: UtilsCoreOption) {
|
|
4896
|
+
return new Utils(option);
|
|
4897
|
+
}
|
|
4878
4898
|
}
|
|
4879
4899
|
|
|
4880
4900
|
let utils = new Utils();
|
package/src/UtilsCore.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare interface UtilsCoreOption {
|
|
1
|
+
export declare interface UtilsCoreOption {
|
|
2
2
|
document: Document;
|
|
3
3
|
window: Window;
|
|
4
4
|
globalThis: typeof globalThis;
|
|
@@ -6,7 +6,6 @@ declare interface UtilsCoreOption {
|
|
|
6
6
|
top: Window;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
const UtilsCoreDefaultEnv: UtilsCoreOption = {
|
|
11
10
|
document: document,
|
|
12
11
|
window: window,
|