@pisell/utils 1.0.72 → 1.0.73

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 (202) hide show
  1. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
  2. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
  3. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
  4. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
  5. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
  6. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +11 -0
  7. package/es/arrayUtils.d.ts +4 -1
  8. package/es/arrayUtils.js +15 -24
  9. package/es/common/stateHelper.d.ts +6 -2
  10. package/es/common/stateHelper.js +22 -24
  11. package/es/common/types.d.ts +13 -10
  12. package/es/componentStorage.d.ts +27 -25
  13. package/es/componentStorage.js +94 -130
  14. package/es/constants/index.js +7 -9
  15. package/es/date.d.ts +6 -3
  16. package/es/date.js +36 -53
  17. package/es/document.d.ts +6 -3
  18. package/es/document.js +43 -67
  19. package/es/escPosPrinter/EscPosPrinter.js +353 -490
  20. package/es/escPosPrinter/index.d.ts +9 -9
  21. package/es/escPosPrinter/index.js +37 -52
  22. package/es/format.d.ts +29 -0
  23. package/es/format.js +90 -116
  24. package/es/image.d.ts +13 -10
  25. package/es/image.js +48 -60
  26. package/es/index.d.ts +38 -23
  27. package/es/index.js +39 -34
  28. package/es/jsBridge/index.d.ts +26 -0
  29. package/es/jsBridge/index.js +57 -56
  30. package/es/jsBridge/regDeviceApi.js +107 -149
  31. package/es/jsBridge/types.d.ts +129 -0
  32. package/es/locales.d.ts +12 -0
  33. package/es/locales.js +77 -96
  34. package/es/log.d.ts +11 -6
  35. package/es/log.js +37 -59
  36. package/es/miniRedux.d.ts +23 -0
  37. package/es/miniRedux.js +42 -78
  38. package/es/number-input/hooks/useNumberInputState.d.ts +6 -2
  39. package/es/number-input/hooks/useNumberInputState.js +71 -128
  40. package/es/number-input/types.d.ts +88 -88
  41. package/es/number-input/utils/formatter.d.ts +13 -10
  42. package/es/number-input/utils/formatter.js +51 -77
  43. package/es/number-input/utils/validation.d.ts +7 -2
  44. package/es/number-input/utils/validation.js +51 -66
  45. package/es/otherUtils.d.ts +12 -9
  46. package/es/otherUtils.js +71 -129
  47. package/es/platform.d.ts +17 -9
  48. package/es/platform.js +78 -85
  49. package/es/select/hooks/useDebouncedSearch.d.ts +4 -1
  50. package/es/select/hooks/useDebouncedSearch.js +39 -53
  51. package/es/select/hooks/useSelectState.d.ts +7 -7
  52. package/es/select/hooks/useSelectState.js +56 -113
  53. package/es/select/index.d.ts +7 -8
  54. package/es/select/types.d.ts +211 -211
  55. package/es/select/utils/filterOptions.d.ts +7 -6
  56. package/es/select/utils/filterOptions.js +26 -31
  57. package/es/select/utils/helpers.d.ts +10 -9
  58. package/es/select/utils/helpers.js +42 -52
  59. package/es/select/utils/index.d.ts +4 -7
  60. package/es/select/utils/sortOptions.d.ts +6 -5
  61. package/es/select/utils/sortOptions.js +19 -31
  62. package/es/select/utils/tagAggregation.d.ts +6 -6
  63. package/es/select/utils/tagAggregation.js +34 -47
  64. package/es/text-input/hooks/useTextInputState.d.ts +6 -2
  65. package/es/text-input/hooks/useTextInputState.js +69 -126
  66. package/es/text-input/types.d.ts +48 -48
  67. package/es/text-input/utils/validation.d.ts +7 -2
  68. package/es/text-input/utils/validation.js +50 -70
  69. package/es/typeUtils.d.ts +11 -8
  70. package/es/typeUtils.js +61 -84
  71. package/es/walletValidity.d.ts +36 -34
  72. package/es/walletValidity.js +332 -456
  73. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
  74. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
  75. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
  76. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
  77. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
  78. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +16 -0
  79. package/lib/_virtual/_rolldown/runtime.js +23 -0
  80. package/lib/arrayUtils.d.ts +4 -1
  81. package/lib/arrayUtils.js +14 -39
  82. package/lib/common/stateHelper.d.ts +6 -2
  83. package/lib/common/stateHelper.js +21 -32
  84. package/lib/common/types.d.ts +13 -10
  85. package/lib/componentStorage.d.ts +27 -25
  86. package/lib/componentStorage.js +96 -126
  87. package/lib/constants/index.js +7 -36
  88. package/lib/date.d.ts +6 -3
  89. package/lib/date.js +43 -65
  90. package/lib/document.d.ts +6 -3
  91. package/lib/document.js +46 -62
  92. package/lib/escPosPrinter/EscPosPrinter.js +327 -403
  93. package/lib/escPosPrinter/index.d.ts +9 -9
  94. package/lib/escPosPrinter/index.js +38 -84
  95. package/lib/format.d.ts +29 -0
  96. package/lib/format.js +91 -99
  97. package/lib/image.d.ts +13 -10
  98. package/lib/image.js +48 -74
  99. package/lib/index.d.ts +38 -23
  100. package/lib/index.js +115 -78
  101. package/lib/jsBridge/index.d.ts +26 -0
  102. package/lib/jsBridge/index.js +58 -77
  103. package/lib/jsBridge/regDeviceApi.js +106 -153
  104. package/lib/jsBridge/types.d.ts +129 -0
  105. package/lib/locales.d.ts +12 -0
  106. package/lib/locales.js +79 -90
  107. package/lib/log.d.ts +11 -6
  108. package/lib/log.js +37 -61
  109. package/lib/miniRedux.d.ts +23 -0
  110. package/lib/miniRedux.js +43 -92
  111. package/lib/number-input/hooks/useNumberInputState.d.ts +6 -2
  112. package/lib/number-input/hooks/useNumberInputState.js +71 -81
  113. package/lib/number-input/types.d.ts +88 -88
  114. package/lib/number-input/utils/formatter.d.ts +13 -10
  115. package/lib/number-input/utils/formatter.js +52 -49
  116. package/lib/number-input/utils/validation.d.ts +7 -2
  117. package/lib/number-input/utils/validation.js +50 -52
  118. package/lib/otherUtils.d.ts +12 -9
  119. package/lib/otherUtils.js +86 -98
  120. package/lib/platform.d.ts +17 -9
  121. package/lib/platform.js +85 -122
  122. package/lib/select/hooks/useDebouncedSearch.d.ts +4 -1
  123. package/lib/select/hooks/useDebouncedSearch.js +40 -41
  124. package/lib/select/hooks/useSelectState.d.ts +7 -7
  125. package/lib/select/hooks/useSelectState.js +58 -93
  126. package/lib/select/index.d.ts +7 -8
  127. package/lib/select/types.d.ts +211 -211
  128. package/lib/select/utils/filterOptions.d.ts +7 -6
  129. package/lib/select/utils/filterOptions.js +26 -37
  130. package/lib/select/utils/helpers.d.ts +10 -9
  131. package/lib/select/utils/helpers.js +45 -41
  132. package/lib/select/utils/index.d.ts +4 -7
  133. package/lib/select/utils/sortOptions.d.ts +6 -5
  134. package/lib/select/utils/sortOptions.js +18 -39
  135. package/lib/select/utils/tagAggregation.d.ts +6 -6
  136. package/lib/select/utils/tagAggregation.js +33 -41
  137. package/lib/text-input/hooks/useTextInputState.d.ts +6 -2
  138. package/lib/text-input/hooks/useTextInputState.js +69 -79
  139. package/lib/text-input/types.d.ts +48 -48
  140. package/lib/text-input/utils/validation.d.ts +7 -2
  141. package/lib/text-input/utils/validation.js +49 -58
  142. package/lib/typeUtils.d.ts +11 -8
  143. package/lib/typeUtils.js +68 -73
  144. package/lib/walletValidity.d.ts +36 -34
  145. package/lib/walletValidity.js +345 -317
  146. package/package.json +1 -2
  147. package/es/common/index.d.ts +0 -5
  148. package/es/common/index.js +0 -5
  149. package/es/common/types.js +0 -1
  150. package/es/constants/index.d.ts +0 -7
  151. package/es/firebase/config/index.d.ts +0 -13
  152. package/es/firebase/config/index.js +0 -54
  153. package/es/firebase/index.d.ts +0 -28
  154. package/es/firebase/index.js +0 -232
  155. package/es/jsBridge/types.js +0 -1
  156. package/es/number-input/hooks/index.d.ts +0 -4
  157. package/es/number-input/hooks/index.js +0 -5
  158. package/es/number-input/index.d.ts +0 -14
  159. package/es/number-input/index.js +0 -21
  160. package/es/number-input/types.js +0 -1
  161. package/es/number-input/utils/index.d.ts +0 -7
  162. package/es/number-input/utils/index.js +0 -8
  163. package/es/select/hooks/index.d.ts +0 -5
  164. package/es/select/hooks/index.js +0 -6
  165. package/es/select/index.js +0 -13
  166. package/es/select/types.js +0 -1
  167. package/es/select/utils/index.js +0 -8
  168. package/es/text-input/hooks/index.d.ts +0 -4
  169. package/es/text-input/hooks/index.js +0 -5
  170. package/es/text-input/index.d.ts +0 -14
  171. package/es/text-input/index.js +0 -20
  172. package/es/text-input/types.js +0 -1
  173. package/es/text-input/utils/index.d.ts +0 -5
  174. package/es/text-input/utils/index.js +0 -7
  175. package/lib/common/index.d.ts +0 -5
  176. package/lib/common/index.js +0 -29
  177. package/lib/common/types.js +0 -17
  178. package/lib/constants/index.d.ts +0 -7
  179. package/lib/firebase/config/index.d.ts +0 -13
  180. package/lib/firebase/config/index.js +0 -79
  181. package/lib/firebase/index.d.ts +0 -28
  182. package/lib/firebase/index.js +0 -180
  183. package/lib/jsBridge/types.js +0 -17
  184. package/lib/number-input/hooks/index.d.ts +0 -4
  185. package/lib/number-input/hooks/index.js +0 -29
  186. package/lib/number-input/index.d.ts +0 -14
  187. package/lib/number-input/index.js +0 -41
  188. package/lib/number-input/types.js +0 -17
  189. package/lib/number-input/utils/index.d.ts +0 -7
  190. package/lib/number-input/utils/index.js +0 -39
  191. package/lib/select/hooks/index.d.ts +0 -5
  192. package/lib/select/hooks/index.js +0 -34
  193. package/lib/select/index.js +0 -53
  194. package/lib/select/types.js +0 -17
  195. package/lib/select/utils/index.js +0 -48
  196. package/lib/text-input/hooks/index.d.ts +0 -4
  197. package/lib/text-input/hooks/index.js +0 -29
  198. package/lib/text-input/index.d.ts +0 -14
  199. package/lib/text-input/index.js +0 -35
  200. package/lib/text-input/types.js +0 -17
  201. package/lib/text-input/utils/index.d.ts +0 -5
  202. package/lib/text-input/utils/index.js +0 -32
@@ -1,36 +1,7 @@
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/constants/index.ts
20
- var constants_exports = {};
21
- __export(constants_exports, {
22
- webHookApi: () => webHookApi
23
- });
24
- module.exports = __toCommonJS(constants_exports);
25
- var webHookApi = {
26
- warning_log: {
27
- // 非生产环境共用一个url
28
- test: "https://open.feishu.cn/open-apis/bot/v2/hook/985186a7-d939-4daf-9f30-3a3cc9c47d97",
29
- // 生产环境
30
- prod: "https://open.feishu.cn/open-apis/bot/v2/hook/887dfff9-2ccc-4513-87ff-a05d8cef953e"
31
- }
32
- };
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- webHookApi
36
- });
1
+ //#region src/constants/index.ts
2
+ const webHookApi = { warning_log: {
3
+ test: "https://open.feishu.cn/open-apis/bot/v2/hook/985186a7-d939-4daf-9f30-3a3cc9c47d97",
4
+ prod: "https://open.feishu.cn/open-apis/bot/v2/hook/887dfff9-2ccc-4513-87ff-a05d8cef953e"
5
+ } };
6
+ //#endregion
7
+ exports.webHookApi = webHookApi;
package/lib/date.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ //#region src/date.d.ts
1
2
  /**
2
3
  * @title: 格式化日期
3
4
  * @description:
@@ -7,7 +8,7 @@
7
8
  * @Author: zhiwei.Wang
8
9
  * @Date: 2023-07-21 10:49
9
10
  */
10
- export declare const formatDate: (date: string | Date, format?: string) => string;
11
+ declare const formatDate: (date: string | Date, format?: string) => string;
11
12
  /**
12
13
  * @title: excel日期 转 js日期
13
14
  * @description:
@@ -16,7 +17,7 @@ export declare const formatDate: (date: string | Date, format?: string) => strin
16
17
  * @Author: zhiwei.Wang
17
18
  * @Date: 2023-07-21 10:49
18
19
  */
19
- export declare const excelDateToJSDate: (excelDate: number) => string;
20
+ declare const excelDateToJSDate: (excelDate: number) => string;
20
21
  /**
21
22
  * @title: js日期 转 excel日期
22
23
  * @description:
@@ -25,4 +26,6 @@ export declare const excelDateToJSDate: (excelDate: number) => string;
25
26
  * @Author: zhiwei.Wang
26
27
  * @Date: 2023-07-21 10:49
27
28
  */
28
- export declare const jsDateToExcelDate: (jsDate: string) => number;
29
+ declare const jsDateToExcelDate: (jsDate: string) => number;
30
+ //#endregion
31
+ export { excelDateToJSDate, formatDate, jsDateToExcelDate };
package/lib/date.js CHANGED
@@ -1,68 +1,46 @@
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 });
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ let dayjs = require("dayjs");
3
+ dayjs = require_runtime.__toESM(dayjs);
4
+ //#region src/date.ts
5
+ const formatMaps = ["D MMM YYYY, hh:mma", "YYYY-MM-DD"];
6
+ /**
7
+ * @title: 格式化日期
8
+ * @description:
9
+ * @param {string} date
10
+ * @param {string} format
11
+ * @return {*}
12
+ * @Author: zhiwei.Wang
13
+ * @Date: 2023-07-21 10:49
14
+ */
15
+ const formatDate = (date, format) => {
16
+ let _format = format || formatMaps[0];
17
+ if (!date) return date;
18
+ return (0, dayjs.default)(date).format(_format);
10
19
  };
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;
20
+ /**
21
+ * @title: excel日期 转 js日期
22
+ * @description:
23
+ * @param {number} excelDate
24
+ * @return {*}
25
+ * @Author: zhiwei.Wang
26
+ * @Date: 2023-07-21 10:49
27
+ */
28
+ const excelDateToJSDate = (excelDate) => {
29
+ const dateOffset = (excelDate - 25569) * 864e5;
30
+ return formatDate(new Date(dateOffset), formatMaps[1]);
18
31
  };
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/date.ts
30
- var date_exports = {};
31
- __export(date_exports, {
32
- excelDateToJSDate: () => excelDateToJSDate,
33
- formatDate: () => formatDate,
34
- jsDateToExcelDate: () => jsDateToExcelDate
35
- });
36
- module.exports = __toCommonJS(date_exports);
37
- var import_dayjs = __toESM(require("dayjs"));
38
- var formatMaps = [
39
- // 19 Jul 2023, 09:00am
40
- "D MMM YYYY, hh:mma",
41
- // 2023-07-19
42
- "YYYY-MM-DD"
43
- ];
44
- var formatDate = (date, format) => {
45
- let _format = format || formatMaps[0];
46
- if (!date) {
47
- return date;
48
- }
49
- return (0, import_dayjs.default)(date).format(_format);
32
+ /**
33
+ * @title: js日期 转 excel日期
34
+ * @description:
35
+ * @param {string} jsDate
36
+ * @return {*}
37
+ * @Author: zhiwei.Wang
38
+ * @Date: 2023-07-21 10:49
39
+ */
40
+ const jsDateToExcelDate = (jsDate) => {
41
+ return (new Date(jsDate) - new Date(Date.UTC(1900, 0, 1))) / 864e5 + 25569;
50
42
  };
51
- var excelDateToJSDate = (excelDate) => {
52
- const dateOffset = (excelDate - 25569) * 864e5;
53
- const jsDate = formatDate(new Date(dateOffset), formatMaps[1]);
54
- return jsDate;
55
- };
56
- var jsDateToExcelDate = (jsDate) => {
57
- const _jsDate = new Date(jsDate);
58
- const excelStartDate = new Date(Date.UTC(1900, 0, 1));
59
- const dateOffset = _jsDate - excelStartDate;
60
- const excelDate = dateOffset / 864e5 + 25569;
61
- return excelDate;
62
- };
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- excelDateToJSDate,
66
- formatDate,
67
- jsDateToExcelDate
68
- });
43
+ //#endregion
44
+ exports.excelDateToJSDate = excelDateToJSDate;
45
+ exports.formatDate = formatDate;
46
+ exports.jsDateToExcelDate = jsDateToExcelDate;
package/lib/document.d.ts CHANGED
@@ -1,13 +1,16 @@
1
+ //#region src/document.d.ts
1
2
  /**
2
3
  * @Title: 设置主题
3
4
  * @Describe: 传入字符串键值对
4
5
  * @Author: Wzw
5
6
  */
6
- export declare const setTheme: (themes: {
7
- [key: string]: string;
7
+ declare const setTheme: (themes: {
8
+ [key: string]: string;
8
9
  }) => void;
9
10
  /**
10
11
  * 复制到剪切板
11
12
  * @param text
12
13
  */
13
- export declare const copyToClipboard: (text: string) => Promise<void>;
14
+ declare const copyToClipboard: (text: string) => Promise<void>;
15
+ //#endregion
16
+ export { copyToClipboard, setTheme };
package/lib/document.js CHANGED
@@ -1,64 +1,48 @@
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 });
1
+ const require_asyncToGenerator = require("./_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
2
+ //#region src/document.ts
3
+ /**
4
+ * @Title: 设置主题
5
+ * @Describe: 传入字符串键值对
6
+ * @Author: Wzw
7
+ */
8
+ const setTheme = (themes) => {
9
+ try {
10
+ let _themes = Object.entries(themes);
11
+ for (let item of _themes) document.documentElement.style.setProperty(item[0], item[1]);
12
+ } catch (err) {
13
+ console.error(err);
14
+ }
8
15
  };
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
+ const httpCopyToClipboard = (text) => {
17
+ const textArea = document.createElement("textarea");
18
+ textArea.value = text;
19
+ textArea.style.position = "fixed";
20
+ textArea.style.top = "-10000px";
21
+ textArea.style.left = "-10000px";
22
+ document.body.appendChild(textArea);
23
+ textArea.focus();
24
+ textArea.select();
25
+ document.execCommand("copy");
26
+ document.body.removeChild(textArea);
16
27
  };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/document.ts
20
- var document_exports = {};
21
- __export(document_exports, {
22
- copyToClipboard: () => copyToClipboard,
23
- setTheme: () => setTheme
24
- });
25
- module.exports = __toCommonJS(document_exports);
26
- var setTheme = (themes) => {
27
- try {
28
- let _themes = Object.entries(themes);
29
- for (let item of _themes) {
30
- document.documentElement.style.setProperty(item[0], item[1]);
31
- }
32
- } catch (err) {
33
- console.error(err);
34
- }
35
- };
36
- var httpCopyToClipboard = (text) => {
37
- const textArea = document.createElement("textarea");
38
- textArea.value = text;
39
- textArea.style.position = "fixed";
40
- textArea.style.top = "-10000px";
41
- textArea.style.left = "-10000px";
42
- document.body.appendChild(textArea);
43
- textArea.focus();
44
- textArea.select();
45
- document.execCommand("copy");
46
- document.body.removeChild(textArea);
47
- };
48
- var copyToClipboard = async (text) => {
49
- if (navigator.clipboard) {
50
- try {
51
- return await navigator.clipboard.writeText(text);
52
- } catch (error) {
53
- console.error(error);
54
- return httpCopyToClipboard(text);
55
- }
56
- } else {
57
- return httpCopyToClipboard(text);
58
- }
59
- };
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- copyToClipboard,
63
- setTheme
64
- });
28
+ /**
29
+ * 复制到剪切板
30
+ * @param text
31
+ */
32
+ const copyToClipboard = function() {
33
+ var _ref = require_asyncToGenerator._asyncToGenerator(function* (text) {
34
+ if (navigator.clipboard) try {
35
+ return yield navigator.clipboard.writeText(text);
36
+ } catch (error) {
37
+ console.error(error);
38
+ return httpCopyToClipboard(text);
39
+ }
40
+ else return httpCopyToClipboard(text);
41
+ });
42
+ return function copyToClipboard(_x) {
43
+ return _ref.apply(this, arguments);
44
+ };
45
+ }();
46
+ //#endregion
47
+ exports.copyToClipboard = copyToClipboard;
48
+ exports.setTheme = setTheme;