ranui 0.1.9 → 0.1.10-alpha.1

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 (171) hide show
  1. package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +12 -0
  2. package/dist/arrow-down-C9jBUUt3.js +30 -0
  3. package/dist/assets/image/failImage.d.ts +2 -0
  4. package/dist/button.js +7 -0
  5. package/dist/checkbox.js +7 -0
  6. package/dist/colorpicker.js +13 -0
  7. package/dist/{colz-746223ab.js → colz-CRDozfZA.js} +1 -5
  8. package/dist/components/button/index.d.ts +7 -3
  9. package/dist/components/checkbox/index.d.ts +27 -0
  10. package/dist/components/colorpicker/index.d.ts +122 -0
  11. package/dist/components/content/index.d.ts +15 -0
  12. package/dist/components/input/index.d.ts +65 -41
  13. package/dist/components/message/index.d.ts +2 -0
  14. package/dist/components/option/index.d.ts +2 -1
  15. package/dist/components/player/index.d.ts +31 -6
  16. package/dist/components/popover/index.d.ts +39 -0
  17. package/dist/components/preview/docx.d.ts +1 -1
  18. package/dist/components/preview/index.d.ts +2 -0
  19. package/dist/components/preview/pptx/process_pptx.d.ts +1 -1
  20. package/dist/components/progress/index.d.ts +11 -5
  21. package/dist/components/radar/index.d.ts +1 -1
  22. package/dist/components/scratch/index.d.ts +5 -1
  23. package/dist/components/select/index.d.ts +15 -7
  24. package/dist/content.js +6 -0
  25. package/dist/docx-ajDUtnbM.js +3665 -0
  26. package/dist/global-DOfcrQ2N.js +4 -0
  27. package/dist/icon.js +6 -0
  28. package/dist/iconShadowless.js +6 -0
  29. package/dist/image.js +4 -0
  30. package/dist/index-0fvHQjmN.js +298 -0
  31. package/dist/{index-1b73beee.js → index-BLepXisd.js} +55 -90
  32. package/dist/{index-e2e5d725.js → index-BOoNI-Al.js} +113 -305
  33. package/dist/{index-2d16a084.js → index-BPBRPxND.js} +8 -10
  34. package/dist/{index-e03d23e7.js → index-BpOERe9M.js} +1 -1
  35. package/dist/index-Bv6Z6rIe.js +498 -0
  36. package/dist/index-ByJ7zZdQ.js +65641 -0
  37. package/dist/{index-b7790662.js → index-C1x9Popy.js} +1 -1
  38. package/dist/index-CCNK5H8T.js +103 -0
  39. package/dist/{index-458debf7.js → index-CD09p_mF.js} +7 -31
  40. package/dist/{index-1048a998.js → index-CFnsLnrb.js} +68 -19
  41. package/dist/{index-4443363f.js → index-CJZp9lE4.js} +29 -50
  42. package/dist/{index-57492b9b.js → index-CSnBqUsQ.js} +48 -1
  43. package/dist/index-CWWI8SHO.js +206 -0
  44. package/dist/{index-7b8840f9.js → index-CZlEoE62.js} +220 -1010
  45. package/dist/index-CbyMC6Yz.js +59 -0
  46. package/dist/index-CiBVH-oH.js +258 -0
  47. package/dist/{index-3cf72afd.js → index-DUMmFdJ7.js} +9 -23
  48. package/dist/{index-01b17e26.js → index-Du-Biu-I.js} +1 -1
  49. package/dist/index-EnzWG8R0.js +521 -0
  50. package/dist/index-F2RO3OU4.js +501 -0
  51. package/dist/{index-7216d6b0.js → index-GavQwMDL.js} +11 -29
  52. package/dist/{index-0d5b9435.js → index-suip9eAw.js} +2 -2
  53. package/dist/index.d.ts +18 -14
  54. package/dist/index.js +23 -19
  55. package/dist/info-circle-fill-CFeVMdci.js +4 -0
  56. package/dist/input.js +6 -0
  57. package/dist/inputShadowless.js +6 -0
  58. package/dist/jszip.min-Ca6PjkYs.js +2674 -0
  59. package/dist/message.js +5 -0
  60. package/dist/modal.js +4 -0
  61. package/dist/{components/option/index.js → option.js} +3 -6
  62. package/dist/{pdf-bdb7818a.js → pdf-B2a6ll8f.js} +1 -1
  63. package/dist/player.js +8 -0
  64. package/dist/popover.js +6 -0
  65. package/dist/preview.js +7 -0
  66. package/dist/progress.js +7 -0
  67. package/dist/radar.js +6 -0
  68. package/dist/select.js +10 -0
  69. package/dist/selectShadowless.js +10 -0
  70. package/dist/{umd/components/image → shadowless/icon}/index.d.ts +1 -0
  71. package/dist/{umd/components → shadowless}/input/index.d.ts +33 -8
  72. package/dist/{umd/components → shadowless}/select/index.d.ts +16 -12
  73. package/dist/shadowless/shadowless/index.js +14 -0
  74. package/dist/shadowless.d.ts +3 -0
  75. package/dist/skeleton.js +4 -0
  76. package/dist/sprite-CH2zLtZy.js +141 -0
  77. package/dist/style.css +1 -1
  78. package/dist/tab.js +6 -0
  79. package/dist/tabpane.js +4 -0
  80. package/dist/tsconfig.json +29 -0
  81. package/dist/umd/index.umd.cjs +21 -32
  82. package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
  83. package/dist/umd/shadowless/style.css +1 -0
  84. package/dist/umd/style.css +1 -1
  85. package/dist/utils/color.d.ts +52 -0
  86. package/dist/utils/index.d.ts +9 -1
  87. package/dist/{index-7913ec46.js → utils-BMBEcoPj.js} +279 -162
  88. package/dist/vite.config.d.ts +1 -0
  89. package/package.json +61 -36
  90. package/readme.md +14 -14
  91. package/typings.d.ts +101 -0
  92. package/dist/components/button/index.js +0 -8
  93. package/dist/components/icon/index.js +0 -6
  94. package/dist/components/image/index.js +0 -4
  95. package/dist/components/input/index.js +0 -6
  96. package/dist/components/message/index.js +0 -4
  97. package/dist/components/modal/index.js +0 -4
  98. package/dist/components/player/index.js +0 -12
  99. package/dist/components/preview/index.js +0 -8
  100. package/dist/components/progress/index.js +0 -8
  101. package/dist/components/radar/index.js +0 -7
  102. package/dist/components/select/index.js +0 -11
  103. package/dist/components/skeleton/index.js +0 -4
  104. package/dist/components/tab/index.js +0 -7
  105. package/dist/components/tabpane/index.js +0 -4
  106. package/dist/docx-c5d02d8c.js +0 -21
  107. package/dist/index-73ce455b.js +0 -264
  108. package/dist/index-c14450a9.js +0 -662
  109. package/dist/info-circle-fill-90ec9aa9.js +0 -14
  110. package/dist/umd/build/config.d.ts +0 -3
  111. package/dist/umd/build/config.umd.d.ts +0 -2
  112. package/dist/umd/components/button/index.d.ts +0 -35
  113. package/dist/umd/components/form/index.d.ts +0 -2
  114. package/dist/umd/components/icon/index.d.ts +0 -2
  115. package/dist/umd/components/message/index.d.ts +0 -14
  116. package/dist/umd/components/modal/index.d.ts +0 -2
  117. package/dist/umd/components/option/index.d.ts +0 -2
  118. package/dist/umd/components/player/index.d.ts +0 -213
  119. package/dist/umd/components/preview/colz.d.ts +0 -72
  120. package/dist/umd/components/preview/docx.d.ts +0 -8
  121. package/dist/umd/components/preview/excel/excel.d.ts +0 -2
  122. package/dist/umd/components/preview/excel/index.d.ts +0 -1
  123. package/dist/umd/components/preview/excel/media.d.ts +0 -37
  124. package/dist/umd/components/preview/index.d.ts +0 -6
  125. package/dist/umd/components/preview/pdf.d.ts +0 -1
  126. package/dist/umd/components/preview/pptx/index.d.ts +0 -16
  127. package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
  128. package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
  129. package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
  130. package/dist/umd/components/progress/index.d.ts +0 -36
  131. package/dist/umd/components/radar/index.d.ts +0 -2
  132. package/dist/umd/components/scratch/index.d.ts +0 -19
  133. package/dist/umd/components/skeleton/index.d.ts +0 -2
  134. package/dist/umd/components/tab/index.d.ts +0 -408
  135. package/dist/umd/components/tabpane/index.d.ts +0 -352
  136. package/dist/umd/index.d.ts +0 -14
  137. package/dist/umd/playwright.config.d.ts +0 -9
  138. package/dist/umd/plugins/auto-import-file.d.ts +0 -0
  139. package/dist/umd/plugins/load-style.d.ts +0 -6
  140. package/dist/umd/plugins/load-svg.d.ts +0 -9
  141. package/dist/umd/tests/button.spec.d.ts +0 -1
  142. package/dist/umd/utils/image.d.ts +0 -32
  143. package/dist/umd/utils/index.d.ts +0 -64
  144. package/dist/umd/utils/math.d.ts +0 -26
  145. package/dist/umd/utils/tween.d.ts +0 -21
  146. package/dist/umd/vite.config.d.ts +0 -6
  147. package/dist/vendor-f71e6f68.js +0 -92126
  148. /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
  149. /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
  150. /package/dist/{umd/build/config.es.d.ts → build/config.sha.d.ts} +0 -0
  151. /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
  152. /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
  153. /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
  154. /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
  155. /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
  156. /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
  157. /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
  158. /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
  159. /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
  160. /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
  161. /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
  162. /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
  163. /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
  164. /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
  165. /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
  166. /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
  167. /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
  168. /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
  169. /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
  170. /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
  171. /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
@@ -0,0 +1,52 @@
1
+ export declare const hsv2hsl: (h: number, s: number, v: number) => {
2
+ h: number;
3
+ s: number;
4
+ l: number;
5
+ };
6
+ export declare const hex2alpha: (aa: string) => number;
7
+ export declare const hex2hsl: (hex: string) => {
8
+ h: number;
9
+ s: number;
10
+ l: number;
11
+ };
12
+ export declare const hex2hsv: (hex: string) => {
13
+ h: number;
14
+ s: number;
15
+ v: number;
16
+ };
17
+ export declare const hex2rgb: (hex: string) => {
18
+ r: number;
19
+ g: number;
20
+ b: number;
21
+ };
22
+ export declare const rgb2hsv: (r: number, g: number, b: number) => {
23
+ h: number;
24
+ s: number;
25
+ v: number;
26
+ };
27
+ export declare const hsl2hsv: (h: number, s: number, l: number) => {
28
+ h: number;
29
+ s: number;
30
+ v: number;
31
+ };
32
+ export declare const hsl2rgb: (h: number, s: number, l: number) => {
33
+ r: number;
34
+ g: number;
35
+ b: number;
36
+ };
37
+ export declare const hsv2rgb: (h: number, s: number, v: number) => {
38
+ r: number;
39
+ g: number;
40
+ b: number;
41
+ };
42
+ export declare const rgb2hex: (r: number, g: number, b: number) => string;
43
+ export declare const rgba: (r: number, g: number, b: number, a: number) => string;
44
+ export declare const rgba2hex: (r: number, g: number, b: number, a: number) => string;
45
+ export declare const rgba2rgb: (r: number, g: number, b: number, a: number) => {
46
+ r: number;
47
+ g: number;
48
+ b: number;
49
+ };
50
+ export declare const HEX_COLOR_REGEX: RegExp;
51
+ export declare const RGB_REGEX: RegExp;
52
+ export declare const RGBA_REGEX: RegExp;
@@ -21,7 +21,7 @@ export declare const loadScript: (src: string) => Promise<{
21
21
  export interface CustomErrorType {
22
22
  new (m: string): void;
23
23
  }
24
- export declare function createCustomError(msg: string): CustomErrorType;
24
+ export declare function createCustomError(msg?: string): CustomErrorType;
25
25
  export declare const vod: {
26
26
  FD: {
27
27
  label: string;
@@ -62,3 +62,11 @@ export declare const vod: {
62
62
  label: string;
63
63
  };
64
64
  };
65
+ export declare const HTMLElementSSR: () => {
66
+ new (): HTMLElement;
67
+ prototype: HTMLElement;
68
+ } | null;
69
+ export declare const createSignal: <T = unknown>(value: T, options?: {
70
+ subscriber?: Function[] | undefined;
71
+ equals?: boolean | ((prev: T | undefined, next: T) => boolean) | undefined;
72
+ } | undefined) => [() => T, (newValue: T) => void];
@@ -1,17 +1,279 @@
1
- import "./vendor-f71e6f68.js";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
3
  var __publicField = (obj, key, value) => {
5
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
5
  return value;
7
6
  };
7
+ const noop = () => {
8
+ };
9
+ function formatDuration(time) {
10
+ return time < 10 ? `0${time}` : time;
11
+ }
12
+ function timestampToTime(timestamp) {
13
+ let date = /* @__PURE__ */ new Date();
14
+ if (timestamp) {
15
+ date = new Date(timestamp);
16
+ }
17
+ date.format = (format = "YYYY-MM-DD HH:mm:ss") => {
18
+ const year = date.getFullYear();
19
+ const month = formatDuration(date.getMonth() + 1);
20
+ const day = formatDuration(date.getDate());
21
+ const hour = formatDuration(date.getHours());
22
+ const minute = formatDuration(date.getMinutes());
23
+ const second = formatDuration(date.getSeconds());
24
+ return format.replace(/Y+/gi, `${year}`).replace(/M+/g, `${month}`).replace(/D+/gi, `${day}`).replace(/H+/gi, `${hour}`).replace(/m+/g, `${minute}`).replace(/S+/gi, `${second}`);
25
+ };
26
+ return date;
27
+ }
28
+ const timeFormat = (time) => {
29
+ if (time === 0)
30
+ return "00:00";
31
+ if (!time)
32
+ return "";
33
+ const hour = Math.trunc(time / 3600);
34
+ const minute = Math.trunc(time % 3600 / 60);
35
+ const second = formatDuration(Math.trunc(time - hour * 3600 - minute * 60));
36
+ if (hour === 0) {
37
+ return `${formatDuration(minute)}:${second}`;
38
+ }
39
+ return `${formatDuration(hour)}:${formatDuration(minute)}:${second}`;
40
+ };
41
+ const getPixelRatio = (context) => {
42
+ const backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1;
43
+ return (window.devicePixelRatio || 1) / backingStore;
44
+ };
45
+ const currentDevice = () => {
46
+ if (typeof window !== "undefined") {
47
+ const ua = navigator.userAgent.toLowerCase();
48
+ if (/ipad|ipod/.test(ua))
49
+ return "ipad";
50
+ if (/android/.test(ua))
51
+ return "android";
52
+ if (/iphone/.test(ua))
53
+ return "iphone";
54
+ return "pc";
55
+ }
56
+ return "pc";
57
+ };
58
+ const isMobile = () => {
59
+ const ua = window.navigator.userAgent;
60
+ if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(ua)) {
61
+ return true;
62
+ }
63
+ return false;
64
+ };
65
+ const addClassToElement = (element, addClass) => {
66
+ if (typeof document === "undefined")
67
+ return void 0;
68
+ const classList = element.classList;
69
+ if (!classList.contains(addClass)) {
70
+ classList.add(addClass);
71
+ }
72
+ };
73
+ const removeClassToElement = (element, removeClass) => {
74
+ if (typeof document === "undefined")
75
+ return void 0;
76
+ const classList = element.classList;
77
+ if (classList.contains(removeClass)) {
78
+ classList.remove(removeClass);
79
+ }
80
+ };
81
+ const createDocumentFragment = (list) => {
82
+ if (typeof document === "undefined")
83
+ return void 0;
84
+ const Fragment = document.createDocumentFragment();
85
+ list.forEach((item) => Fragment.appendChild(item));
86
+ return Fragment;
87
+ };
88
+ const generateThrottle = () => {
89
+ let timer;
90
+ return function(fn, wait = 300) {
91
+ return function(...args) {
92
+ if (timer) {
93
+ clearTimeout(timer);
94
+ timer = void 0;
95
+ }
96
+ const context = this;
97
+ if (!timer) {
98
+ timer = setTimeout(() => {
99
+ fn.apply(context, args);
100
+ clearTimeout(timer);
101
+ timer = void 0;
102
+ }, wait);
103
+ }
104
+ };
105
+ };
106
+ };
107
+ const codes = /* @__PURE__ */ new Map([
108
+ [100, "Continue"],
109
+ [101, "Switching Protocols"],
110
+ [102, "Processing"],
111
+ [103, "Early Hints"],
112
+ [200, "OK"],
113
+ [201, "Created"],
114
+ [202, "Accepted"],
115
+ [203, "Non-Authoritative Information"],
116
+ [204, "No Content"],
117
+ [205, "Reset Content"],
118
+ [206, "Partial Content"],
119
+ [207, "Multi-Status"],
120
+ [208, "Already Reported"],
121
+ [226, "IM Used"],
122
+ [300, "Multiple Choices"],
123
+ [301, "Moved Permanently"],
124
+ [302, "Found"],
125
+ [303, "See Other"],
126
+ [304, "Not Modified"],
127
+ [305, "Use Proxy"],
128
+ [307, "Temporary Redirect"],
129
+ [308, "Permanent Redirect"],
130
+ [400, "Bad Request"],
131
+ [401, "Unauthorized"],
132
+ [402, "Payment Required"],
133
+ [403, "Forbidden"],
134
+ [404, "Not Found"],
135
+ [405, "Method Not Allowed"],
136
+ [406, "Not Acceptable"],
137
+ [407, "Proxy Authentication Required"],
138
+ [408, "Request Timeout"],
139
+ [409, "Conflict"],
140
+ [410, "Gone"],
141
+ [411, "Length Required"],
142
+ [412, "Precondition Failed"],
143
+ [413, "Payload Too Large"],
144
+ [414, "URI Too Long"],
145
+ [415, "Unsupported Media Type"],
146
+ [416, "Range Not Satisfiable"],
147
+ [417, "Expectation Failed"],
148
+ [418, "I'm a Teapot"],
149
+ [421, "Misdirected Request"],
150
+ [422, "Unprocessable Entity"],
151
+ [423, "Locked"],
152
+ [424, "Failed Dependency"],
153
+ [425, "Too Early"],
154
+ [426, "Upgrade Required"],
155
+ [428, "Precondition Required"],
156
+ [429, "Too Many Requests"],
157
+ [431, "Request Header Fields Too Large"],
158
+ [451, "Unavailable For Legal Reasons"],
159
+ [500, "Internal Server Error"],
160
+ [501, "Not Implemented"],
161
+ [502, "Bad Gateway"],
162
+ [503, "Service Unavailable"],
163
+ [504, "Gateway Timeout"],
164
+ [505, "HTTP Version Not Supported"],
165
+ [506, "Variant Also Negotiates"],
166
+ [507, "Insufficient Storage"],
167
+ [508, "Loop Detected"],
168
+ [509, "Bandwidth Limit Exceeded"],
169
+ [510, "Not Extended"],
170
+ [511, "Network Authentication Required"]
171
+ ]);
172
+ ({
173
+ // status code to message map
174
+ message: codes,
175
+ // status message (lower-case) to code map
176
+ code: createMessageToStatusCodeMap(codes),
177
+ // array of status codes
178
+ codes: createStatusCodeList(codes),
179
+ // status codes for redirects
180
+ redirect: {
181
+ 300: true,
182
+ 301: true,
183
+ 302: true,
184
+ 303: true,
185
+ 305: true,
186
+ 307: true,
187
+ 308: true
188
+ },
189
+ // status codes for empty bodies
190
+ empty: {
191
+ 204: true,
192
+ 205: true,
193
+ 304: true
194
+ },
195
+ // status codes for when you should retry the request
196
+ retry: {
197
+ 502: true,
198
+ 503: true,
199
+ 504: true
200
+ }
201
+ });
202
+ function createMessageToStatusCodeMap(codes2) {
203
+ const map = /* @__PURE__ */ new Map();
204
+ for (const [status2, message] of codes2) {
205
+ map.set(message.toLowerCase(), status2);
206
+ }
207
+ return map;
208
+ }
209
+ function createStatusCodeList(codes2) {
210
+ const codeList = [];
211
+ for (const [status2, _] of codes2) {
212
+ codeList.push(status2);
213
+ }
214
+ return codeList;
215
+ }
216
+ const perToNum = (str = "") => {
217
+ if (str.length === 0)
218
+ return 0;
219
+ if (str.endsWith("%")) {
220
+ const value = Number(str.replace("%", ""));
221
+ return value > 1 ? value / 100 : value;
222
+ } else {
223
+ return Number(str);
224
+ }
225
+ };
226
+ const range = (num, min = 0, max = 1) => {
227
+ return Math.min(max, Math.max(min, num));
228
+ };
229
+ const _Mathjs = class _Mathjs2 {
230
+ constructor() {
231
+ __publicField(this, "getDecimalLength", (n2) => {
232
+ const [_, decimal] = n2.toString().split(".");
233
+ return decimal ? decimal.length : 0;
234
+ });
235
+ __publicField(this, "amend", (n2, precision = 15) => parseFloat(Number(n2).toPrecision(precision)));
236
+ __publicField(this, "power", (a2, b2) => Math.pow(10, Math.max(this.getDecimalLength(a2), this.getDecimalLength(b2))));
237
+ }
238
+ };
239
+ __publicField(_Mathjs, "handleMethod", (l2, r2) => {
240
+ const mathjs2 = new _Mathjs();
241
+ const { power, amend } = mathjs2;
242
+ const pow = power(l2, r2);
243
+ const a2 = amend(l2 * pow);
244
+ const b2 = amend(r2 * pow);
245
+ return (type) => {
246
+ switch (type) {
247
+ case "+":
248
+ return (a2 + b2) / pow;
249
+ case "-":
250
+ return (a2 - b2) / pow;
251
+ case "*":
252
+ return a2 * b2 / (pow * pow);
253
+ case "/":
254
+ return a2 / b2;
255
+ }
256
+ };
257
+ });
258
+ __publicField(_Mathjs, "add", (a2, b2) => {
259
+ return _Mathjs.handleMethod(a2, b2)("+");
260
+ });
261
+ __publicField(_Mathjs, "divide", (a2, b2) => {
262
+ return _Mathjs.handleMethod(a2, b2)("/");
263
+ });
264
+ __publicField(_Mathjs, "multiply", (a2, b2) => {
265
+ return _Mathjs.handleMethod(a2, b2)("*");
266
+ });
267
+ __publicField(_Mathjs, "subtract", (a2, b2) => {
268
+ return _Mathjs.handleMethod(a2, b2)("-");
269
+ });
8
270
  const NEW_LISTENER = "NEW_LISTENER";
9
271
  class SyncHook {
10
272
  constructor() {
11
273
  __publicField(this, "_events");
12
- __publicField(this, "on", (eventName, eventItem) => {
274
+ __publicField(this, "tap", (eventName, eventItem) => {
13
275
  if (this._events[eventName] && eventName !== Symbol.for(NEW_LISTENER)) {
14
- this.emit(Symbol.for(NEW_LISTENER), eventName);
276
+ this.call(Symbol.for(NEW_LISTENER), eventName);
15
277
  }
16
278
  const callbacks = this._events[eventName] || [];
17
279
  if (typeof eventItem === "function") {
@@ -24,13 +286,20 @@ class SyncHook {
24
286
  }
25
287
  this._events[eventName] = callbacks;
26
288
  });
27
- __publicField(this, "emit", (eventName, ...args) => {
289
+ __publicField(this, "call", (eventName, ...args) => {
28
290
  const callbacks = this._events[eventName] || [];
29
291
  callbacks.forEach((item) => {
30
292
  const { callback } = item;
31
293
  callback(...args);
32
294
  });
33
295
  });
296
+ __publicField(this, "callSync", async (eventName, ...args) => {
297
+ const callbacks = this._events[eventName] || [];
298
+ for (const item of callbacks) {
299
+ const { callback } = item;
300
+ await callback(...args);
301
+ }
302
+ });
34
303
  __publicField(this, "once", (eventName, eventItem) => {
35
304
  let one;
36
305
  if (typeof eventItem === "function") {
@@ -53,7 +322,7 @@ class SyncHook {
53
322
  initialCallback: callback
54
323
  };
55
324
  }
56
- this.on(eventName, one);
325
+ this.tap(eventName, one);
57
326
  });
58
327
  __publicField(this, "off", (eventName, eventItem) => {
59
328
  const callbacks = this._events[eventName] || [];
@@ -70,170 +339,18 @@ class SyncHook {
70
339
  this._events = {};
71
340
  }
72
341
  }
73
- const str2Xml = (xmlStr, format = "text/xml") => {
74
- if (window.DOMParser)
75
- return new window.DOMParser().parseFromString(xmlStr, format).documentElement;
76
- if (typeof window.ActiveXObject !== "undefined" && new window.ActiveXObject("Microsoft.XMLDOM")) {
77
- const xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
78
- xmlDoc.async = "false";
79
- xmlDoc.loadXML(xmlStr);
80
- return xmlDoc;
81
- }
82
- return void 0;
83
- };
84
- function vnode$1(sel, data, children, text, elm) {
85
- const key = data === void 0 ? void 0 : data.key;
86
- return { sel, data, children, text, elm, key };
87
- }
88
- vnode$1("", {}, [], void 0, void 0);
89
- const generateThrottle = () => {
90
- let timer;
91
- return function(fn, wait = 300) {
92
- return function(...args) {
93
- if (timer) {
94
- clearTimeout(timer);
95
- timer = void 0;
96
- }
97
- const context = this;
98
- if (!timer) {
99
- timer = setTimeout(() => {
100
- fn.apply(context, args);
101
- clearTimeout(timer);
102
- timer = void 0;
103
- }, wait);
104
- }
105
- };
106
- };
107
- };
108
- const noop = () => {
109
- };
110
- const judgeDevice = () => {
111
- if (typeof window !== "undefined") {
112
- const ua = navigator.userAgent.toLowerCase();
113
- if (/ipad|ipod/.test(ua))
114
- return "ipad";
115
- if (/android/.test(ua))
116
- return "android";
117
- if (/iphone/.test(ua))
118
- return "iphone";
119
- return "pc";
120
- }
121
- return "pc";
122
- };
123
- const isMobile = () => {
124
- const ua = window.navigator.userAgent;
125
- if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(ua)) {
126
- return true;
127
- }
128
- return false;
129
- };
130
- function formatDuration(time) {
131
- return time < 10 ? `0${time}` : time;
132
- }
133
- function timestampToTime(timestamp) {
134
- let date = /* @__PURE__ */ new Date();
135
- if (timestamp) {
136
- date = new Date(timestamp);
137
- }
138
- date.format = (format = "YYYY-MM-DD HH:mm:ss") => {
139
- const year = date.getFullYear();
140
- const month = formatDuration(date.getMonth() + 1);
141
- const day = formatDuration(date.getDate());
142
- const hour = formatDuration(date.getHours());
143
- const minute = formatDuration(date.getMinutes());
144
- const second = formatDuration(date.getSeconds());
145
- return format.replace(/Y+/gi, `${year}`).replace(/M+/g, `${month}`).replace(/D+/gi, `${day}`).replace(/H+/gi, `${hour}`).replace(/m+/g, `${minute}`).replace(/S+/gi, `${second}`);
146
- };
147
- return date;
148
- }
149
- const getPixelRatio = (context) => {
150
- const backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1;
151
- return (window.devicePixelRatio || 1) / backingStore;
152
- };
153
- const addClassToElement = (element, addClass) => {
154
- if (typeof document === "undefined")
155
- return void 0;
156
- const classList = element.classList;
157
- if (!classList.contains(addClass)) {
158
- classList.add(addClass);
159
- }
160
- };
161
- const removeClassToElement = (element, removeClass) => {
162
- if (typeof document === "undefined")
163
- return void 0;
164
- const classList = element.classList;
165
- if (classList.contains(removeClass)) {
166
- classList.remove(removeClass);
167
- }
168
- };
169
- const timeFormat = (time) => {
170
- if (time === 0)
171
- return "00:00";
172
- if (!time)
173
- return "";
174
- const hour = Math.trunc(time / 3600);
175
- const minute = Math.trunc(time % 3600 / 60);
176
- const second = formatDuration(Math.trunc(time - hour * 3600 - minute * 60));
177
- if (hour === 0) {
178
- return `${formatDuration(minute)}:${second}`;
179
- }
180
- return `${formatDuration(hour)}:${formatDuration(minute)}:${second}`;
181
- };
182
- const perToNum = (str = "") => {
183
- if (str.length === 0)
184
- return 0;
185
- if (str.endsWith("%")) {
186
- const value = Number(str.replace("%", ""));
187
- return value > 1 ? value / 100 : value;
188
- } else {
189
- return Number(str);
190
- }
191
- };
192
- const range = (num, min = 0, max = 1) => {
193
- return Math.min(max, Math.max(min, num));
194
- };
195
- const createDocumentFragment = (list) => {
196
- if (typeof document === "undefined")
197
- return void 0;
198
- const Fragment = document.createDocumentFragment();
199
- list.forEach((item) => Fragment.appendChild(item));
200
- return Fragment;
201
- };
202
- const heap = new Array(128).fill(void 0);
203
- heap.push(void 0, null, true, false);
204
- heap.length;
205
- const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
206
- throw Error("TextDecoder not available");
207
- } };
208
- if (typeof TextDecoder !== "undefined") {
209
- cachedTextDecoder.decode();
210
- }
211
- const cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
212
- throw Error("TextEncoder not available");
213
- } };
214
- typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
215
- return cachedTextEncoder.encodeInto(arg, view);
216
- } : function(arg, view) {
217
- const buf = cachedTextEncoder.encode(arg);
218
- view.set(buf);
219
- return {
220
- read: arg.length,
221
- written: buf.length
222
- };
223
- };
224
342
  export {
225
343
  SyncHook as S,
226
344
  addClassToElement as a,
227
- generateThrottle as b,
228
- createDocumentFragment as c,
229
- timeFormat as d,
345
+ createDocumentFragment as b,
346
+ currentDevice as c,
347
+ generateThrottle as d,
230
348
  range as e,
349
+ timestampToTime as f,
231
350
  getPixelRatio as g,
232
351
  isMobile as i,
233
- judgeDevice as j,
234
352
  noop as n,
235
353
  perToNum as p,
236
354
  removeClassToElement as r,
237
- str2Xml as s,
238
- timestampToTime as t
355
+ timeFormat as t
239
356
  };
@@ -1,5 +1,6 @@
1
1
  import type { BuildOptions, UserConfig } from 'vite';
2
2
  export declare const umd: BuildOptions;
3
+ export declare const umdShadowless: BuildOptions;
3
4
  export declare const es: BuildOptions;
4
5
  export declare const viteConfig: UserConfig;
5
6
  declare const _default: UserConfig;