@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.
Files changed (93) hide show
  1. package/class-name/index.js +5 -5
  2. package/constant/index.js +24 -2
  3. package/constant/platform.js +13 -12
  4. package/constant.js +24 -2
  5. package/content-disposition/index.js +3 -3
  6. package/date/convertTime.js +4 -4
  7. package/diff/index.js +7 -0
  8. package/diff/src/diff.d.ts +21 -0
  9. package/diff/src/diff.js +381 -0
  10. package/diff.js +7 -0
  11. package/filesize/types/constants.d.ts +81 -0
  12. package/filesize/types/filesize.d.ts +97 -0
  13. package/index.js +68 -58
  14. package/js-cookie/index.d.ts +116 -0
  15. package/js-cookie/index.js +4 -0
  16. package/js-cookie/src/api.js +56 -0
  17. package/js-cookie/src/assign.js +11 -0
  18. package/js-cookie/src/converter.js +14 -0
  19. package/jsCookie.js +4 -0
  20. package/lunar/lib/HolidayUtil.js +48 -49
  21. package/mitt/index.js +4 -0
  22. package/mitt/src/index.js +37 -0
  23. package/mitt.js +4 -0
  24. package/nzh/nzh.d.ts +74 -0
  25. package/package.json +1 -1
  26. package/pinyin/index.js +4 -0
  27. package/pinyin/simplified.js +4 -0
  28. package/pinyin/src/core.js +143 -0
  29. package/pinyin/src/simplified.js +8 -0
  30. package/pinyin/src/simplified_dict.js +410 -0
  31. package/pinyin/src/traditional.js +8 -0
  32. package/pinyin/src/traditional_dict.js +403 -0
  33. package/pinyin/traditional.js +4 -0
  34. package/pinyin.js +4 -0
  35. package/query-string/base.d.ts +717 -0
  36. package/query-string/base.js +268 -0
  37. package/query-string/index.d.ts +16 -0
  38. package/query-string/index.js +4 -0
  39. package/query-string/splitOnFirst.js +14 -0
  40. package/queryString.js +4 -0
  41. package/random/index.js +56 -35
  42. package/snapdom/src/api/preCache.js +51 -28
  43. package/snapdom/src/core/cache.js +1 -4
  44. package/snapdom/src/core/capture.js +45 -44
  45. package/snapdom/src/core/clone.js +82 -66
  46. package/snapdom/src/core/prepare.js +167 -45
  47. package/snapdom/src/modules/background.js +29 -19
  48. package/snapdom/src/modules/fonts.js +158 -111
  49. package/snapdom/src/modules/images.js +14 -9
  50. package/snapdom/src/modules/pseudo.js +52 -47
  51. package/snapdom/src/modules/styles.js +22 -22
  52. package/snapdom/src/modules/svgDefs.js +39 -20
  53. package/snapdom/src/utils/cssTools.js +58 -51
  54. package/snapdom/src/utils/helpers.js +197 -140
  55. package/snapdom/types/snapdom.d.ts +101 -0
  56. package/types/constant/index.d.ts +11 -0
  57. package/types/constant/platform.d.ts +1 -0
  58. package/types/diff/index.d.ts +2 -0
  59. package/types/diff/src/diff.d.ts +40 -0
  60. package/types/index.d.ts +6 -1
  61. package/types/js-cookie/index.d.ts +1 -0
  62. package/types/js-cookie/src/api.d.mts +2 -0
  63. package/types/js-cookie/src/assign.d.mts +1 -0
  64. package/types/js-cookie/src/converter.d.mts +5 -0
  65. package/types/mitt/index.d.ts +2 -0
  66. package/types/mitt/src/index.d.ts +29 -0
  67. package/types/pinyin/index.d.ts +1 -0
  68. package/types/pinyin/simplified.d.ts +1 -0
  69. package/types/pinyin/src/core.d.ts +3 -0
  70. package/types/pinyin/src/simplified.d.ts +4 -0
  71. package/types/pinyin/src/simplified_dict.d.ts +408 -0
  72. package/types/pinyin/src/traditional.d.ts +4 -0
  73. package/types/pinyin/src/traditional_dict.d.ts +401 -0
  74. package/types/pinyin/traditional.d.ts +1 -0
  75. package/types/query-string/base.d.ts +11 -0
  76. package/types/query-string/index.d.ts +2 -0
  77. package/types/query-string/splitOnFirst.d.ts +1 -0
  78. package/types/random/index.d.ts +14 -23
  79. package/types/snapdom/src/api/preCache.d.ts +2 -5
  80. package/types/snapdom/src/core/cache.d.ts +0 -3
  81. package/types/snapdom/src/core/clone.d.ts +1 -1
  82. package/types/snapdom/src/modules/background.d.ts +16 -6
  83. package/types/snapdom/src/modules/fonts.d.ts +5 -1
  84. package/types/snapdom/src/modules/pseudo.d.ts +1 -1
  85. package/types/snapdom/src/modules/styles.d.ts +1 -1
  86. package/types/snapdom/src/modules/svgDefs.d.ts +13 -13
  87. package/types/snapdom/src/utils/cssTools.d.ts +2 -10
  88. package/types/snapdom/src/utils/helpers.d.ts +13 -7
  89. package/types/turbo-stream/src/shared.d.ts +3 -3
  90. package/url-toolkit/src/url-toolkit.d.ts +22 -0
  91. package/event-emitter/index.js +0 -48
  92. package/eventEmitter.js +0 -4
  93. package/types/event-emitter/index.d.ts +0 -17
@@ -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,4 +0,0 @@
1
- import { default as o } from "./event-emitter/index.js";
2
- export {
3
- o as default
4
- };
@@ -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
- }