@unicom-cloud/utils 0.1.16 → 0.1.18
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/class-name/index.js +5 -5
- package/constant/index.js +24 -2
- package/constant/platform.js +13 -12
- package/constant.js +24 -2
- package/content-disposition/index.js +3 -3
- package/date/convertTime.js +4 -4
- package/diff/index.js +7 -0
- package/diff/src/diff.d.ts +21 -0
- package/diff/src/diff.js +381 -0
- package/diff.js +7 -0
- package/filesize/types/constants.d.ts +81 -0
- package/filesize/types/filesize.d.ts +97 -0
- package/index.js +68 -58
- package/js-cookie/index.d.ts +116 -0
- package/js-cookie/index.js +4 -0
- package/js-cookie/src/api.js +56 -0
- package/js-cookie/src/assign.js +11 -0
- package/js-cookie/src/converter.js +14 -0
- package/jsCookie.js +4 -0
- package/lunar/lib/HolidayUtil.js +48 -49
- package/mitt/index.js +4 -0
- package/mitt/src/index.js +37 -0
- package/mitt.js +4 -0
- package/nzh/nzh.d.ts +74 -0
- package/package.json +1 -1
- package/pinyin/index.js +4 -0
- package/pinyin/simplified.js +4 -0
- package/pinyin/src/core.js +143 -0
- package/pinyin/src/simplified.js +8 -0
- package/pinyin/src/simplified_dict.js +410 -0
- package/pinyin/src/traditional.js +8 -0
- package/pinyin/src/traditional_dict.js +403 -0
- package/pinyin/traditional.js +4 -0
- package/pinyin.js +4 -0
- package/query-string/base.d.ts +717 -0
- package/query-string/base.js +268 -0
- package/query-string/index.d.ts +16 -0
- package/query-string/index.js +4 -0
- package/query-string/splitOnFirst.js +14 -0
- package/queryString.js +4 -0
- package/random/index.js +56 -35
- package/snapdom/src/api/preCache.js +51 -28
- package/snapdom/src/core/cache.js +1 -4
- package/snapdom/src/core/capture.js +45 -44
- package/snapdom/src/core/clone.js +82 -66
- package/snapdom/src/core/prepare.js +167 -45
- package/snapdom/src/modules/background.js +29 -19
- package/snapdom/src/modules/fonts.js +158 -111
- package/snapdom/src/modules/images.js +14 -9
- package/snapdom/src/modules/pseudo.js +52 -47
- package/snapdom/src/modules/styles.js +22 -22
- package/snapdom/src/modules/svgDefs.js +39 -20
- package/snapdom/src/utils/cssTools.js +58 -51
- package/snapdom/src/utils/helpers.js +197 -140
- package/snapdom/types/snapdom.d.ts +101 -0
- package/types/constant/index.d.ts +11 -0
- package/types/constant/platform.d.ts +1 -0
- package/types/diff/index.d.ts +2 -0
- package/types/diff/src/diff.d.ts +40 -0
- package/types/index.d.ts +6 -1
- package/types/js-cookie/index.d.ts +1 -0
- package/types/js-cookie/src/api.d.mts +2 -0
- package/types/js-cookie/src/assign.d.mts +1 -0
- package/types/js-cookie/src/converter.d.mts +5 -0
- package/types/mitt/index.d.ts +2 -0
- package/types/mitt/src/index.d.ts +29 -0
- package/types/pinyin/index.d.ts +1 -0
- package/types/pinyin/simplified.d.ts +1 -0
- package/types/pinyin/src/core.d.ts +3 -0
- package/types/pinyin/src/simplified.d.ts +4 -0
- package/types/pinyin/src/simplified_dict.d.ts +408 -0
- package/types/pinyin/src/traditional.d.ts +4 -0
- package/types/pinyin/src/traditional_dict.d.ts +401 -0
- package/types/pinyin/traditional.d.ts +1 -0
- package/types/query-string/base.d.ts +11 -0
- package/types/query-string/index.d.ts +2 -0
- package/types/query-string/splitOnFirst.d.ts +1 -0
- package/types/random/index.d.ts +14 -23
- package/types/snapdom/src/api/preCache.d.ts +2 -5
- package/types/snapdom/src/core/cache.d.ts +0 -3
- package/types/snapdom/src/core/clone.d.ts +1 -1
- package/types/snapdom/src/modules/background.d.ts +16 -6
- package/types/snapdom/src/modules/fonts.d.ts +5 -1
- package/types/snapdom/src/modules/pseudo.d.ts +1 -1
- package/types/snapdom/src/modules/styles.d.ts +1 -1
- package/types/snapdom/src/modules/svgDefs.d.ts +13 -13
- package/types/snapdom/src/utils/cssTools.d.ts +2 -10
- package/types/snapdom/src/utils/helpers.d.ts +13 -7
- package/types/turbo-stream/src/shared.d.ts +3 -3
- package/url-toolkit/src/url-toolkit.d.ts +22 -0
- package/event-emitter/index.js +0 -48
- package/eventEmitter.js +0 -4
- package/types/event-emitter/index.d.ts +0 -17
package/event-emitter/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
class h {
|
|
2
|
-
constructor() {
|
|
3
|
-
if (!new.target) throw new Error("必须使用 new 命令生成实例");
|
|
4
|
-
this.addListener = this.addEventListener = this.on, this.removeListener = this.removeEventListener = this.off, this.removeAllListeners = this.removeAllEventListeners = this.offAll, this.dispatch = this.dispatchEvent = this.emit;
|
|
5
|
-
}
|
|
6
|
-
#t = /* @__PURE__ */ new Map();
|
|
7
|
-
once(t, e) {
|
|
8
|
-
if (!t || !e)
|
|
9
|
-
return;
|
|
10
|
-
this.off(t);
|
|
11
|
-
const s = (...i) => {
|
|
12
|
-
this.off(t, s), e(...i);
|
|
13
|
-
};
|
|
14
|
-
this.on(t, s);
|
|
15
|
-
}
|
|
16
|
-
on(t, e) {
|
|
17
|
-
if (!t || !e)
|
|
18
|
-
return;
|
|
19
|
-
const s = this.#t.get(t) || [];
|
|
20
|
-
s.push(e), this.#t.set(t, s);
|
|
21
|
-
}
|
|
22
|
-
off(t, e) {
|
|
23
|
-
if (!t)
|
|
24
|
-
return;
|
|
25
|
-
if (!e) {
|
|
26
|
-
this.#t.delete(t);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const s = this.#t.get(t);
|
|
30
|
-
if (!s)
|
|
31
|
-
return;
|
|
32
|
-
if (s.length === 0) {
|
|
33
|
-
this.#t.delete(t);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const i = s.indexOf(e);
|
|
37
|
-
i !== -1 && (s.splice(i, 1), this.#t.set(t, s), this.off(t, e));
|
|
38
|
-
}
|
|
39
|
-
offAll(t) {
|
|
40
|
-
t ? this.#t.get(t)?.forEach?.((e) => this.off(t, e)) : this.#t.clear();
|
|
41
|
-
}
|
|
42
|
-
emit(t, ...e) {
|
|
43
|
-
this.#t.get(t)?.forEach?.((s) => s?.(...e));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
h as default
|
|
48
|
-
};
|
package/eventEmitter.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default EventEmitter;
|
|
2
|
-
declare class EventEmitter {
|
|
3
|
-
addListener: (k: any, cb: any) => void;
|
|
4
|
-
addEventListener: (k: any, cb: any) => void;
|
|
5
|
-
removeListener: (k: any, cb: any) => void;
|
|
6
|
-
removeEventListener: (k: any, cb: any) => void;
|
|
7
|
-
removeAllListeners: (k: any) => void;
|
|
8
|
-
removeAllEventListeners: (k: any) => void;
|
|
9
|
-
dispatch: (k: any, ...a: any[]) => void;
|
|
10
|
-
dispatchEvent: (k: any, ...a: any[]) => void;
|
|
11
|
-
once(k: any, cb: any): void;
|
|
12
|
-
on(k: any, cb: any): void;
|
|
13
|
-
off(k: any, cb: any): void;
|
|
14
|
-
offAll(k: any): void;
|
|
15
|
-
emit(k: any, ...a: any[]): void;
|
|
16
|
-
#private;
|
|
17
|
-
}
|