@wzyjs/utils 0.0.30 → 0.1.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.
Files changed (176) hide show
  1. package/dist/{browser/cjs/utils/src → cjs}/browser/element.d.ts +9 -9
  2. package/dist/cjs/browser/element.js +59 -0
  3. package/dist/{node/cjs/utils/src → cjs}/browser/index.d.ts +18 -18
  4. package/dist/cjs/browser/index.js +64 -0
  5. package/dist/{browser/cjs/utils/src → cjs}/browser/other.d.ts +1 -1
  6. package/dist/cjs/browser/other.js +35 -0
  7. package/dist/{browser/esm/utils/src → cjs}/browser/style.d.ts +10 -10
  8. package/dist/cjs/browser/style.js +81 -0
  9. package/dist/{browser/cjs/utils/src → cjs}/browser.d.ts +2 -2
  10. package/dist/cjs/browser.js +25 -0
  11. package/dist/{browser/esm/utils/src → cjs}/common/classs.d.ts +5 -5
  12. package/dist/cjs/common/classs.js +36 -0
  13. package/dist/{browser/cjs/utils/src → cjs}/common/dayjs.d.ts +4 -4
  14. package/dist/cjs/common/dayjs.js +57 -0
  15. package/dist/{node/cjs/utils/src → cjs}/common/index.d.ts +11 -11
  16. package/dist/cjs/common/index.js +99 -0
  17. package/dist/{browser/cjs/utils/src → cjs}/common/number.d.ts +3 -3
  18. package/dist/cjs/common/number.js +55 -0
  19. package/dist/{browser/esm/utils/src → cjs}/common/object.d.ts +10 -10
  20. package/dist/cjs/common/object.js +65 -0
  21. package/dist/{node/esm/utils/src → cjs}/common/other.d.ts +26 -26
  22. package/dist/cjs/common/other.js +129 -0
  23. package/dist/{browser/cjs/utils/src → cjs}/common/string.d.ts +16 -16
  24. package/dist/cjs/common/string.js +157 -0
  25. package/dist/{node/cjs/utils/src → cjs}/node/database/Collection.d.ts +22 -22
  26. package/dist/cjs/node/database/Collection.js +219 -0
  27. package/dist/{node/cjs/utils/src → cjs}/node/database/Database.d.ts +10 -10
  28. package/dist/cjs/node/database/Database.js +47 -0
  29. package/dist/{browser/esm/utils/src → cjs}/node/database/index.d.ts +2 -2
  30. package/dist/cjs/node/database/index.js +38 -0
  31. package/dist/{node/esm/utils/src → cjs}/node/database/types.d.ts +151 -151
  32. package/dist/cjs/node/database/types.js +51 -0
  33. package/dist/{browser/cjs/utils/src → cjs}/node/database/utils.d.ts +3 -3
  34. package/dist/cjs/node/database/utils.js +53 -0
  35. package/dist/{browser/cjs/utils/src → cjs}/node/index.d.ts +3 -3
  36. package/dist/cjs/node/index.js +27 -0
  37. package/dist/{node/cjs/utils/src → cjs}/node/jsonFile/index.d.ts +6 -6
  38. package/dist/cjs/node/jsonFile/index.js +51 -0
  39. package/dist/{browser/cjs/utils/src → cjs}/node/mail/index.d.ts +1 -1
  40. package/dist/cjs/node/mail/index.js +67 -0
  41. package/dist/{node/cjs/utils/src → cjs}/node.d.ts +2 -2
  42. package/dist/cjs/node.js +25 -0
  43. package/dist/{node/cjs/utils/src → esm}/browser/element.d.ts +9 -9
  44. package/dist/esm/browser/element.js +43 -0
  45. package/dist/{node/esm/utils/src → esm}/browser/index.d.ts +18 -18
  46. package/dist/esm/browser/index.js +15 -0
  47. package/dist/{node/cjs/utils/src → esm}/browser/other.d.ts +1 -1
  48. package/dist/esm/browser/other.js +28 -0
  49. package/dist/{browser/cjs/utils/src → esm}/browser/style.d.ts +10 -10
  50. package/dist/esm/browser/style.js +55 -0
  51. package/dist/{node/cjs/utils/src → esm}/browser.d.ts +2 -2
  52. package/dist/esm/browser.js +2 -0
  53. package/dist/{browser/cjs/utils/src → esm}/common/classs.d.ts +5 -5
  54. package/dist/esm/common/classs.js +33 -0
  55. package/dist/{browser/esm/utils/src → esm}/common/dayjs.d.ts +4 -4
  56. package/dist/{browser/esm → esm}/common/dayjs.js +10 -10
  57. package/dist/{node/esm/utils/src → esm}/common/index.d.ts +11 -11
  58. package/dist/{browser/cjs/utils/src/common/index.d.ts → esm/common/index.js} +12 -11
  59. package/dist/{browser/esm/utils/src → esm}/common/number.d.ts +3 -3
  60. package/dist/esm/common/number.js +31 -0
  61. package/dist/{node/cjs/utils/src → esm}/common/object.d.ts +10 -10
  62. package/dist/esm/common/object.js +84 -0
  63. package/dist/{browser/esm/utils/src → esm}/common/other.d.ts +26 -26
  64. package/dist/esm/common/other.js +173 -0
  65. package/dist/{browser/esm/utils/src → esm}/common/string.d.ts +16 -16
  66. package/dist/esm/common/string.js +140 -0
  67. package/dist/{browser/cjs/utils/src → esm}/node/database/Collection.d.ts +22 -22
  68. package/dist/esm/node/database/Collection.js +356 -0
  69. package/dist/{browser/cjs/utils/src → esm}/node/database/Database.d.ts +10 -10
  70. package/dist/esm/node/database/Database.js +36 -0
  71. package/dist/{node/cjs/utils/src → esm}/node/database/index.d.ts +2 -2
  72. package/dist/{browser/cjs/utils/src/node/database/index.d.ts → esm/node/database/index.js} +2 -2
  73. package/dist/{node/cjs/utils/src → esm}/node/database/types.d.ts +151 -151
  74. package/dist/esm/node/database/types.js +55 -0
  75. package/dist/{browser/esm/utils/src → esm}/node/database/utils.d.ts +3 -3
  76. package/dist/esm/node/database/utils.js +29 -0
  77. package/dist/{browser/esm/utils/src → esm}/node/index.d.ts +3 -3
  78. package/dist/esm/node/index.js +3 -0
  79. package/dist/{browser/cjs/utils/src → esm}/node/jsonFile/index.d.ts +6 -6
  80. package/dist/esm/node/jsonFile/index.js +43 -0
  81. package/dist/{browser/esm/utils/src → esm}/node/mail/index.d.ts +1 -1
  82. package/dist/esm/node/mail/index.js +48 -0
  83. package/dist/{browser/cjs/utils/src → esm}/node.d.ts +2 -2
  84. package/dist/esm/node.js +2 -0
  85. package/package.json +10 -23
  86. package/dist/browser/cjs/browser/element.js +0 -40
  87. package/dist/browser/cjs/browser/index.js +0 -20
  88. package/dist/browser/cjs/browser/other.js +0 -12
  89. package/dist/browser/cjs/browser/style.js +0 -49
  90. package/dist/browser/cjs/browser.js +0 -171
  91. package/dist/browser/cjs/common/classs.js +0 -14
  92. package/dist/browser/cjs/common/dayjs.js +0 -27
  93. package/dist/browser/cjs/common/number.js +0 -34
  94. package/dist/browser/cjs/common/object.js +0 -43
  95. package/dist/browser/cjs/common/other.js +0 -112
  96. package/dist/browser/cjs/common/string.js +0 -137
  97. package/dist/browser/cjs/types/index.d.ts +0 -27
  98. package/dist/browser/cjs/utils/src/browser/index.d.ts +0 -18
  99. package/dist/browser/cjs/utils/src/common/object.d.ts +0 -10
  100. package/dist/browser/cjs/utils/src/common/other.d.ts +0 -26
  101. package/dist/browser/cjs/utils/src/node/database/types.d.ts +0 -151
  102. package/dist/browser/esm/browser/element.js +0 -36
  103. package/dist/browser/esm/browser/index.js +0 -14
  104. package/dist/browser/esm/browser/other.js +0 -10
  105. package/dist/browser/esm/browser/style.js +0 -45
  106. package/dist/browser/esm/browser.js +0 -19
  107. package/dist/browser/esm/common/classs.js +0 -12
  108. package/dist/browser/esm/common/number.js +0 -30
  109. package/dist/browser/esm/common/object.js +0 -39
  110. package/dist/browser/esm/common/other.js +0 -106
  111. package/dist/browser/esm/common/string.js +0 -120
  112. package/dist/browser/esm/types/index.d.ts +0 -27
  113. package/dist/browser/esm/utils/src/browser/element.d.ts +0 -9
  114. package/dist/browser/esm/utils/src/browser/index.d.ts +0 -18
  115. package/dist/browser/esm/utils/src/browser/other.d.ts +0 -1
  116. package/dist/browser/esm/utils/src/browser.d.ts +0 -2
  117. package/dist/browser/esm/utils/src/common/index.d.ts +0 -11
  118. package/dist/browser/esm/utils/src/node/database/Collection.d.ts +0 -22
  119. package/dist/browser/esm/utils/src/node/database/Database.d.ts +0 -10
  120. package/dist/browser/esm/utils/src/node/database/types.d.ts +0 -151
  121. package/dist/browser/esm/utils/src/node/jsonFile/index.d.ts +0 -6
  122. package/dist/browser/esm/utils/src/node.d.ts +0 -2
  123. package/dist/node/cjs/common/classs.js +0 -14
  124. package/dist/node/cjs/common/dayjs.js +0 -27
  125. package/dist/node/cjs/common/number.js +0 -34
  126. package/dist/node/cjs/common/object.js +0 -43
  127. package/dist/node/cjs/common/other.js +0 -112
  128. package/dist/node/cjs/common/string.js +0 -137
  129. package/dist/node/cjs/node/database/Collection.js +0 -202
  130. package/dist/node/cjs/node/database/Database.js +0 -25
  131. package/dist/node/cjs/node/database/types.js +0 -25
  132. package/dist/node/cjs/node/database/utils.js +0 -30
  133. package/dist/node/cjs/node/jsonFile/index.js +0 -29
  134. package/dist/node/cjs/node/mail/index.js +0 -31
  135. package/dist/node/cjs/node.js +0 -157
  136. package/dist/node/cjs/types/index.d.ts +0 -27
  137. package/dist/node/cjs/utils/src/browser/style.d.ts +0 -10
  138. package/dist/node/cjs/utils/src/common/classs.d.ts +0 -5
  139. package/dist/node/cjs/utils/src/common/dayjs.d.ts +0 -4
  140. package/dist/node/cjs/utils/src/common/number.d.ts +0 -3
  141. package/dist/node/cjs/utils/src/common/other.d.ts +0 -26
  142. package/dist/node/cjs/utils/src/common/string.d.ts +0 -16
  143. package/dist/node/cjs/utils/src/node/database/utils.d.ts +0 -3
  144. package/dist/node/cjs/utils/src/node/index.d.ts +0 -3
  145. package/dist/node/cjs/utils/src/node/mail/index.d.ts +0 -1
  146. package/dist/node/esm/common/classs.js +0 -12
  147. package/dist/node/esm/common/dayjs.js +0 -18
  148. package/dist/node/esm/common/number.js +0 -30
  149. package/dist/node/esm/common/object.js +0 -39
  150. package/dist/node/esm/common/other.js +0 -106
  151. package/dist/node/esm/common/string.js +0 -120
  152. package/dist/node/esm/node/database/Collection.js +0 -200
  153. package/dist/node/esm/node/database/Database.js +0 -23
  154. package/dist/node/esm/node/database/types.js +0 -25
  155. package/dist/node/esm/node/database/utils.js +0 -27
  156. package/dist/node/esm/node/jsonFile/index.js +0 -27
  157. package/dist/node/esm/node/mail/index.js +0 -29
  158. package/dist/node/esm/node.js +0 -14
  159. package/dist/node/esm/types/index.d.ts +0 -27
  160. package/dist/node/esm/utils/src/browser/element.d.ts +0 -9
  161. package/dist/node/esm/utils/src/browser/other.d.ts +0 -1
  162. package/dist/node/esm/utils/src/browser/style.d.ts +0 -10
  163. package/dist/node/esm/utils/src/browser.d.ts +0 -2
  164. package/dist/node/esm/utils/src/common/classs.d.ts +0 -5
  165. package/dist/node/esm/utils/src/common/dayjs.d.ts +0 -4
  166. package/dist/node/esm/utils/src/common/number.d.ts +0 -3
  167. package/dist/node/esm/utils/src/common/object.d.ts +0 -10
  168. package/dist/node/esm/utils/src/common/string.d.ts +0 -16
  169. package/dist/node/esm/utils/src/node/database/Collection.d.ts +0 -22
  170. package/dist/node/esm/utils/src/node/database/Database.d.ts +0 -10
  171. package/dist/node/esm/utils/src/node/database/index.d.ts +0 -2
  172. package/dist/node/esm/utils/src/node/database/utils.d.ts +0 -3
  173. package/dist/node/esm/utils/src/node/index.d.ts +0 -3
  174. package/dist/node/esm/utils/src/node/jsonFile/index.d.ts +0 -6
  175. package/dist/node/esm/utils/src/node/mail/index.d.ts +0 -1
  176. package/dist/node/esm/utils/src/node.d.ts +0 -2
@@ -1,3 +1,3 @@
1
- import { Conditions } from './types';
2
- export declare const appendTime: <D>(data: D, type: 'create' | 'update') => D;
3
- export declare const defaultConditions: Conditions;
1
+ import { Conditions } from './types';
2
+ export declare const appendTime: <D>(data: D, type: 'create' | 'update') => D;
3
+ export declare const defaultConditions: Conditions;
@@ -0,0 +1,53 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/node/database/utils.ts
20
+ var utils_exports = {};
21
+ __export(utils_exports, {
22
+ appendTime: () => appendTime,
23
+ defaultConditions: () => defaultConditions
24
+ });
25
+ module.exports = __toCommonJS(utils_exports);
26
+ var appendTime = (data, type) => {
27
+ if (!data) {
28
+ return {};
29
+ }
30
+ return {
31
+ ...data,
32
+ [type + "At"]: Date.now()
33
+ };
34
+ };
35
+ var defaultConditions = {
36
+ order: {
37
+ field: "createAt",
38
+ type: "desc"
39
+ },
40
+ options: {
41
+ timeout: 1e4,
42
+ multiple: true
43
+ },
44
+ page: {
45
+ current: 1,
46
+ size: 10
47
+ }
48
+ };
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ appendTime,
52
+ defaultConditions
53
+ });
@@ -1,3 +1,3 @@
1
- export * from './database';
2
- export * from './jsonFile';
3
- export * from './mail';
1
+ export * from './database';
2
+ export * from './jsonFile';
3
+ export * from './mail';
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/node/index.ts
17
+ var node_exports = {};
18
+ module.exports = __toCommonJS(node_exports);
19
+ __reExport(node_exports, require("./database"), module.exports);
20
+ __reExport(node_exports, require("./jsonFile"), module.exports);
21
+ __reExport(node_exports, require("./mail"), module.exports);
22
+ // Annotate the CommonJS export names for ESM import in node:
23
+ 0 && (module.exports = {
24
+ ...require("./database"),
25
+ ...require("./jsonFile"),
26
+ ...require("./mail")
27
+ });
@@ -1,6 +1,6 @@
1
- export declare class JsonFile {
2
- filePath: string;
3
- constructor(filePath: string);
4
- get(key: string): Promise<unknown>;
5
- set(key: string, value: any): void;
6
- }
1
+ export declare class JsonFile {
2
+ filePath: string;
3
+ constructor(filePath: string);
4
+ get(key: string): Promise<unknown>;
5
+ set(key: string, value: any): void;
6
+ }
@@ -0,0 +1,51 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/node/jsonFile/index.ts
20
+ var jsonFile_exports = {};
21
+ __export(jsonFile_exports, {
22
+ JsonFile: () => JsonFile
23
+ });
24
+ module.exports = __toCommonJS(jsonFile_exports);
25
+ var fs = require("fs");
26
+ var path = require("path");
27
+ var JsonFile = class {
28
+ constructor(filePath) {
29
+ this.filePath = path.resolve(__dirname, filePath);
30
+ }
31
+ get(key) {
32
+ return new Promise((resolve) => {
33
+ fs.readFile(this.filePath, (err, data) => {
34
+ const json = data ? JSON.parse(data) : {};
35
+ resolve(json[key]);
36
+ });
37
+ });
38
+ }
39
+ set(key, value) {
40
+ fs.readFile(this.filePath, { encoding: "utf-8" }, (err, data) => {
41
+ const json = data ? JSON.parse(data || "{}") : {};
42
+ json[key] = value;
43
+ fs.writeFile(this.filePath, JSON.stringify(json), () => {
44
+ });
45
+ });
46
+ }
47
+ };
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ JsonFile
51
+ });
@@ -1 +1 @@
1
- export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;
1
+ export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;
@@ -0,0 +1,67 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/node/mail/index.ts
30
+ var mail_exports = {};
31
+ __export(mail_exports, {
32
+ sendMail: () => sendMail
33
+ });
34
+ module.exports = __toCommonJS(mail_exports);
35
+ var import_nodemailer = __toESM(require("nodemailer"));
36
+ var fromEmail = "15835196981@163.com";
37
+ var fromPass = "KPTVCFBMRXJVTCGW";
38
+ var transporter = import_nodemailer.default.createTransport({
39
+ host: "smtp.163.com",
40
+ port: 465,
41
+ secure: true,
42
+ auth: {
43
+ user: fromEmail,
44
+ pass: fromPass
45
+ }
46
+ });
47
+ var sendMail = async (toEmail, title, content) => {
48
+ try {
49
+ await transporter.sendMail({
50
+ from: fromEmail,
51
+ // 发件人邮箱
52
+ to: toEmail,
53
+ // 收件人邮箱
54
+ subject: title,
55
+ // 邮件主题
56
+ text: content
57
+ // 邮件正文
58
+ });
59
+ return title + " 邮件通知成功";
60
+ } catch (error) {
61
+ return title + "邮件通知失败" + JSON.stringify(error);
62
+ }
63
+ };
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ sendMail
67
+ });
@@ -1,2 +1,2 @@
1
- export * from './common';
2
- export * from './node/index';
1
+ export * from './common';
2
+ export * from './node/index';
@@ -0,0 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/node.ts
17
+ var node_exports = {};
18
+ module.exports = __toCommonJS(node_exports);
19
+ __reExport(node_exports, require("./common"), module.exports);
20
+ __reExport(node_exports, require("./node/index"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("./common"),
24
+ ...require("./node/index")
25
+ });
@@ -1,9 +1,9 @@
1
- export declare const scrollIntoView: (el: Element, option?: ScrollIntoViewOptions) => void;
2
- export declare const getElement: (el: string | Element) => {
3
- element: null;
4
- originalStyle: {};
5
- } | {
6
- element: Element;
7
- originalStyle: CSSStyleDeclaration;
8
- };
9
- export declare const isElementInViewport: (el: string | Element) => boolean | undefined;
1
+ export declare const scrollIntoView: (el: Element, option?: ScrollIntoViewOptions) => void;
2
+ export declare const getElement: (el: string | Element) => {
3
+ element: null;
4
+ originalStyle: {};
5
+ } | {
6
+ element: Element;
7
+ originalStyle: CSSStyleDeclaration;
8
+ };
9
+ export declare const isElementInViewport: (el: string | Element) => boolean | undefined;
@@ -0,0 +1,43 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ // 滚动到让指定元素显示出来的位置
8
+ export var scrollIntoView = function scrollIntoView(el, option) {
9
+ if (!el) {
10
+ return;
11
+ }
12
+ el.scrollIntoView(_objectSpread({
13
+ behavior: 'smooth',
14
+ block: 'start'
15
+ }, option));
16
+ };
17
+
18
+ // 获取指定元素 已经元素原始的样式
19
+ export var getElement = function getElement(el) {
20
+ var element = typeof el === 'string' ? document.querySelector(el) : el;
21
+ if (!element) {
22
+ return {
23
+ element: null,
24
+ originalStyle: {}
25
+ };
26
+ }
27
+ // 获取元素原始的样式
28
+ return {
29
+ element: element,
30
+ originalStyle: window.getComputedStyle(element)
31
+ };
32
+ };
33
+
34
+ // 判断元素是否在可见范围内
35
+ export var isElementInViewport = function isElementInViewport(el) {
36
+ var _getElement = getElement(el),
37
+ element = _getElement.element;
38
+ if (!element) {
39
+ return;
40
+ }
41
+ var rect = element.getBoundingClientRect();
42
+ return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
43
+ };
@@ -1,18 +1,18 @@
1
- import md5 from 'md5';
2
- import classnames from 'classnames';
3
- import copy from 'copy-to-clipboard';
4
- import anime from 'animejs';
5
- export { copy, classnames, md5, anime };
6
- export declare const localforage: {
7
- config: {
8
- (options: LocalForageOptions): boolean;
9
- (options: string): any;
10
- (): LocalForageOptions;
11
- };
12
- setItem: <T>(key: string, value: T, callback?: ((err: any, value: T) => void) | undefined) => Promise<T>;
13
- getItem: <T_1>(key: string, callback?: ((err: any, value: T_1 | null) => void) | undefined) => Promise<T_1 | null>;
14
- removeItem: (key: string, callback?: ((err: any) => void) | undefined) => Promise<void>;
15
- };
16
- export * from './style';
17
- export * from './element';
18
- export * from './other';
1
+ import md5 from 'md5';
2
+ import classnames from 'classnames';
3
+ import copy from 'copy-to-clipboard';
4
+ import anime from 'animejs';
5
+ export { copy, classnames, md5, anime };
6
+ export declare const localforage: {
7
+ config: {
8
+ (options: LocalForageOptions): boolean;
9
+ (options: string): any;
10
+ (): LocalForageOptions;
11
+ };
12
+ setItem: <T>(key: string, value: T, callback?: ((err: any, value: T) => void) | undefined) => Promise<T>;
13
+ getItem: <T_1>(key: string, callback?: ((err: any, value: T_1 | null) => void) | undefined) => Promise<T_1 | null>;
14
+ removeItem: (key: string, callback?: ((err: any) => void) | undefined) => Promise<void>;
15
+ };
16
+ export * from './style';
17
+ export * from './element';
18
+ export * from './other';
@@ -0,0 +1,15 @@
1
+ import md5 from 'md5';
2
+ import classnames from 'classnames';
3
+ import copy from 'copy-to-clipboard';
4
+ import { config, getItem, removeItem, setItem } from 'localforage';
5
+ import anime from 'animejs';
6
+ export { copy, classnames, md5, anime };
7
+ export var localforage = {
8
+ config: config,
9
+ setItem: setItem,
10
+ getItem: getItem,
11
+ removeItem: removeItem
12
+ };
13
+ export * from "./style";
14
+ export * from "./element";
15
+ export * from "./other";
@@ -1 +1 @@
1
- export declare const readClipboard: () => Promise<string>;
1
+ export declare const readClipboard: () => Promise<string>;
@@ -0,0 +1,28 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ export var readClipboard = /*#__PURE__*/function () {
6
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8
+ while (1) switch (_context.prev = _context.next) {
9
+ case 0:
10
+ _context.prev = 0;
11
+ _context.next = 3;
12
+ return navigator.clipboard.readText();
13
+ case 3:
14
+ return _context.abrupt("return", _context.sent);
15
+ case 6:
16
+ _context.prev = 6;
17
+ _context.t0 = _context["catch"](0);
18
+ return _context.abrupt("return", '');
19
+ case 9:
20
+ case "end":
21
+ return _context.stop();
22
+ }
23
+ }, _callee, null, [[0, 6]]);
24
+ }));
25
+ return function readClipboard() {
26
+ return _ref.apply(this, arguments);
27
+ };
28
+ }();
@@ -1,10 +1,10 @@
1
- export declare const hexToRgba: (hexColor: string, a?: number) => {
2
- nums: {
3
- red: number;
4
- green: number;
5
- blue: number;
6
- };
7
- text: string;
8
- };
9
- export declare const flashBackground: (el: string | Element, color: string, a?: number) => void;
10
- export declare const flashBorder: (el: string | Element, color: string, a?: number) => void;
1
+ export declare const hexToRgba: (hexColor: string, a?: number) => {
2
+ nums: {
3
+ red: number;
4
+ green: number;
5
+ blue: number;
6
+ };
7
+ text: string;
8
+ };
9
+ export declare const flashBackground: (el: string | Element, color: string, a?: number) => void;
10
+ export declare const flashBorder: (el: string | Element, color: string, a?: number) => void;
@@ -0,0 +1,55 @@
1
+ import anime from 'animejs';
2
+ import { getElement } from "./element";
3
+
4
+ // 颜色值转换
5
+ export var hexToRgba = function hexToRgba(hexColor) {
6
+ var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
7
+ var red = parseInt(hexColor.substr(1, 2), 16);
8
+ var green = parseInt(hexColor.substr(3, 2), 16);
9
+ var blue = parseInt(hexColor.substr(5, 2), 16);
10
+ return {
11
+ nums: {
12
+ red: red,
13
+ green: green,
14
+ blue: blue
15
+ },
16
+ text: "rgba(".concat(red, ", ").concat(green, ", ").concat(blue, ", ").concat(a, ")")
17
+ };
18
+ };
19
+
20
+ // 背景颜色闪动
21
+ export var flashBackground = function flashBackground(el, color) {
22
+ var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
23
+ var _getElement = getElement(el),
24
+ element = _getElement.element,
25
+ originalStyle = _getElement.originalStyle;
26
+ if (!element) {
27
+ return;
28
+ }
29
+ anime({
30
+ targets: element,
31
+ backgroundColor: [hexToRgba(color, a).text, originalStyle.backgroundColor],
32
+ duration: 1500,
33
+ easing: 'easeInOutSine',
34
+ direction: 'alternate',
35
+ loop: false
36
+ });
37
+ };
38
+
39
+ // 边框闪动
40
+ export var flashBorder = function flashBorder(el, color) {
41
+ var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
42
+ var _getElement2 = getElement(el),
43
+ element = _getElement2.element;
44
+ if (!element) {
45
+ return;
46
+ }
47
+ anime({
48
+ targets: element,
49
+ border: ["1px solid ".concat(hexToRgba(color, a).text), 'none'],
50
+ duration: 1500,
51
+ easing: 'easeInOutSine',
52
+ direction: 'alternate',
53
+ loop: false
54
+ });
55
+ };
@@ -1,2 +1,2 @@
1
- export * from './common';
2
- export * from './browser/index';
1
+ export * from './common';
2
+ export * from './browser/index';
@@ -0,0 +1,2 @@
1
+ export * from "./common";
2
+ export * from "./browser/index";
@@ -1,5 +1,5 @@
1
- export declare class CustomError extends Error {
2
- code?: number;
3
- data?: any;
4
- constructor(message: string, code?: number, data?: any);
5
- }
1
+ export declare class CustomError extends Error {
2
+ code?: number;
3
+ data?: any;
4
+ constructor(message: string, code?: number, data?: any);
5
+ }
@@ -0,0 +1,33 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
8
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
9
+ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
10
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
11
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
+ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
+ export var CustomError = /*#__PURE__*/function (_Error) {
19
+ _inherits(CustomError, _Error);
20
+ var _super = _createSuper(CustomError);
21
+ function CustomError(message, code, data) {
22
+ var _this;
23
+ _classCallCheck(this, CustomError);
24
+ _this = _super.call(this, message);
25
+ _defineProperty(_assertThisInitialized(_this), "code", void 0);
26
+ _defineProperty(_assertThisInitialized(_this), "data", void 0);
27
+ _this.code = code;
28
+ _this.data = data;
29
+ Error.captureStackTrace(_assertThisInitialized(_this), _this.constructor);
30
+ return _this;
31
+ }
32
+ return _createClass(CustomError);
33
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
@@ -1,4 +1,4 @@
1
- import dayjs from 'dayjs';
2
- import 'dayjs/locale/zh-cn';
3
- export { Dayjs } from 'dayjs';
4
- export default dayjs;
1
+ import dayjs from 'dayjs';
2
+ import 'dayjs/locale/zh-cn';
3
+ export { Dayjs } from 'dayjs';
4
+ export default dayjs;
@@ -1,18 +1,18 @@
1
1
  import dayjs from 'dayjs';
2
- export { Dayjs, default } from 'dayjs';
3
2
  import isBetween from 'dayjs/plugin/isBetween';
4
3
  import weekday from 'dayjs/plugin/weekday';
5
4
  import localeData from 'dayjs/plugin/localeData';
6
5
  import isoWeek from 'dayjs/plugin/isoWeek';
7
6
  import updateLocale from 'dayjs/plugin/updateLocale';
8
7
  import 'dayjs/locale/zh-cn';
9
-
10
- dayjs.extend(isBetween);
11
- dayjs.extend(weekday);
12
- dayjs.extend(localeData);
13
- dayjs.extend(isoWeek);
14
- dayjs.extend(updateLocale);
15
- dayjs.locale('zh-cn');
16
- dayjs.updateLocale('zh-cn', {
17
- weekStart: 1,
8
+ dayjs.extend(isBetween);
9
+ dayjs.extend(weekday);
10
+ dayjs.extend(localeData);
11
+ dayjs.extend(isoWeek);
12
+ dayjs.extend(updateLocale);
13
+ dayjs.locale('zh-cn');
14
+ dayjs.updateLocale('zh-cn', {
15
+ weekStart: 1
18
16
  });
17
+ export { Dayjs } from 'dayjs';
18
+ export default dayjs;