ranuts 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (216) hide show
  1. package/LICENSE +21 -0
  2. package/dist/build/build.es.d.ts +2 -0
  3. package/dist/build/build.umd.d.ts +2 -0
  4. package/dist/build/build.umd.ml.d.ts +2 -0
  5. package/dist/build/build.umd.node.d.ts +2 -0
  6. package/dist/build/build.umd.react.d.ts +2 -0
  7. package/dist/build/build.umd.utils.d.ts +2 -0
  8. package/dist/build/build.umd.wasm.d.ts +2 -0
  9. package/dist/examples/clone-deep-example.d.ts +1 -0
  10. package/dist/examples/is-equal-example.d.ts +1 -0
  11. package/dist/index.d.ts +9 -16
  12. package/dist/index.js +147 -1116
  13. package/dist/mimeType-CrLryRe7.js +81821 -0
  14. package/dist/plugins/vite-plugins-banner.d.ts +2 -0
  15. package/dist/reactify-Z-V9Vblb.js +83 -0
  16. package/dist/src/arithmetic/index.d.ts +186 -0
  17. package/dist/src/cache/expires.d.ts +1 -0
  18. package/dist/src/ml/index.d.ts +2 -0
  19. package/dist/src/ml/index.js +1243 -0
  20. package/dist/src/ml/ocr.d.ts +11 -0
  21. package/dist/src/node/appendFile.d.ts +7 -0
  22. package/dist/src/node/body.d.ts +9 -0
  23. package/dist/src/node/color.d.ts +7 -0
  24. package/dist/src/node/command.d.ts +8 -0
  25. package/dist/src/node/ctx2req.d.ts +5 -0
  26. package/dist/src/node/fileInfo.d.ts +7 -0
  27. package/dist/src/node/fs.d.ts +7 -0
  28. package/dist/src/node/get.d.ts +10 -0
  29. package/dist/src/node/getIPAdress.d.ts +1 -0
  30. package/dist/src/node/index.d.ts +25 -0
  31. package/dist/src/node/index.js +54 -0
  32. package/dist/src/node/isColorSupported.d.ts +2 -0
  33. package/dist/src/node/paresUrl.d.ts +19 -0
  34. package/dist/src/node/readDir.d.ts +6 -0
  35. package/dist/src/node/readFile.d.ts +9 -0
  36. package/dist/src/node/router.d.ts +42 -0
  37. package/dist/src/node/send.d.ts +7 -0
  38. package/dist/src/node/server.d.ts +18 -0
  39. package/dist/src/node/startTask.d.ts +2 -0
  40. package/dist/src/node/stream.d.ts +15 -0
  41. package/dist/src/node/taskEnd.d.ts +2 -0
  42. package/dist/src/node/traverse.d.ts +17 -0
  43. package/dist/src/node/watchFile.d.ts +8 -0
  44. package/dist/src/node/websocket.d.ts +57 -0
  45. package/dist/src/node/writeFile.d.ts +8 -0
  46. package/dist/src/node/ws.d.ts +8 -0
  47. package/dist/src/optimize/index.d.ts +36 -0
  48. package/dist/src/optimize/promise.d.ts +0 -0
  49. package/dist/src/ran/commit.d.ts +0 -0
  50. package/dist/src/ran/dom.d.ts +0 -0
  51. package/dist/src/ran/hooks.d.ts +0 -0
  52. package/dist/src/ran/index.d.ts +20 -0
  53. package/dist/src/ran/min.d.ts +32 -0
  54. package/dist/src/ran/reconcile.d.ts +0 -0
  55. package/dist/src/ran/schedule.d.ts +0 -0
  56. package/dist/src/react/index.d.ts +2 -0
  57. package/dist/src/react/index.js +4 -0
  58. package/dist/src/react/reactify.d.ts +2 -0
  59. package/dist/src/sort/bubble.d.ts +7 -0
  60. package/dist/src/sort/bucket.d.ts +7 -0
  61. package/dist/src/sort/count.d.ts +7 -0
  62. package/dist/src/sort/heap.d.ts +7 -0
  63. package/dist/src/sort/index.d.ts +0 -0
  64. package/dist/src/sort/insert.d.ts +7 -0
  65. package/dist/src/sort/merge.d.ts +7 -0
  66. package/dist/src/sort/quick.d.ts +7 -0
  67. package/dist/src/sort/radix.d.ts +7 -0
  68. package/dist/src/sort/randomArray.d.ts +9 -0
  69. package/dist/src/sort/select.d.ts +7 -0
  70. package/dist/src/sort/shell.d.ts +7 -0
  71. package/dist/src/utils/audioRecorder.d.ts +16 -0
  72. package/dist/src/utils/behavior.d.ts +15 -0
  73. package/dist/src/utils/bom.d.ts +220 -0
  74. package/dist/src/utils/color.d.ts +71 -0
  75. package/dist/src/utils/compose.d.ts +10 -0
  76. package/dist/src/utils/console.d.ts +1 -0
  77. package/dist/src/utils/debounce.d.ts +7 -0
  78. package/dist/src/utils/device.d.ts +25 -0
  79. package/dist/src/utils/dom.d.ts +105 -0
  80. package/dist/src/utils/error.d.ts +1 -0
  81. package/dist/src/utils/img.d.ts +16 -0
  82. package/dist/src/utils/index.d.ts +35 -0
  83. package/dist/src/utils/index.js +4504 -0
  84. package/dist/src/utils/memoize.d.ts +7 -0
  85. package/dist/src/utils/mimeType.d.ts +3 -0
  86. package/dist/src/utils/monitor.d.ts +38 -0
  87. package/dist/src/utils/network.d.ts +39 -0
  88. package/dist/src/utils/noop.d.ts +2 -0
  89. package/dist/src/utils/number.d.ts +45 -0
  90. package/dist/src/utils/obj.d.ts +83 -0
  91. package/dist/src/utils/performance.d.ts +21 -0
  92. package/dist/src/utils/queue.d.ts +33 -0
  93. package/dist/src/utils/report.d.ts +8 -0
  94. package/dist/src/utils/request.d.ts +17 -0
  95. package/dist/src/utils/script.d.ts +7 -0
  96. package/dist/src/utils/signal.d.ts +6 -0
  97. package/dist/src/utils/storage.d.ts +2 -0
  98. package/dist/src/utils/str.d.ts +72 -0
  99. package/dist/src/utils/subscribe.d.ts +46 -0
  100. package/dist/src/utils/throttle.d.ts +15 -0
  101. package/dist/src/utils/time.d.ts +20 -0
  102. package/dist/src/utils/totp/sha/common.d.ts +151 -0
  103. package/dist/src/utils/totp/sha/converters.d.ts +88 -0
  104. package/dist/src/utils/totp/sha/custom_types.d.ts +60 -0
  105. package/dist/src/utils/totp/sha/primitives_32.d.ts +98 -0
  106. package/dist/src/utils/totp/sha/primitives_64.d.ts +116 -0
  107. package/dist/src/utils/totp/sha/sha.d.ts +103 -0
  108. package/dist/src/utils/totp/sha/sha1.d.ts +18 -0
  109. package/dist/src/utils/totp/sha/sha256.d.ts +20 -0
  110. package/dist/src/utils/totp/sha/sha3.d.ts +53 -0
  111. package/dist/src/utils/totp/sha/sha512.d.ts +21 -0
  112. package/dist/src/utils/totp/totp.d.ts +23 -0
  113. package/dist/src/utils/visual/application.d.ts +14 -0
  114. package/dist/src/utils/visual/demo/index.d.ts +1 -0
  115. package/dist/src/utils/visual/demo/sankey.d.ts +2 -0
  116. package/dist/src/utils/visual/enums.d.ts +27 -0
  117. package/dist/src/utils/visual/event/boundary.d.ts +22 -0
  118. package/dist/src/utils/visual/event/event.d.ts +14 -0
  119. package/dist/src/utils/visual/event/index.d.ts +6 -0
  120. package/dist/src/utils/visual/event/types.d.ts +32 -0
  121. package/dist/src/utils/visual/graphics/graphics.d.ts +81 -0
  122. package/dist/src/utils/visual/graphics/graphicsData.d.ts +13 -0
  123. package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +35 -0
  124. package/dist/src/utils/visual/graphics/index.d.ts +4 -0
  125. package/dist/src/utils/visual/index.d.ts +7 -0
  126. package/dist/src/utils/visual/math/bezier.d.ts +2 -0
  127. package/dist/src/utils/visual/math/enums.d.ts +3 -0
  128. package/dist/src/utils/visual/math/index.d.ts +5 -0
  129. package/dist/src/utils/visual/math/matrix.d.ts +113 -0
  130. package/dist/src/utils/visual/math/transform.d.ts +29 -0
  131. package/dist/src/utils/visual/render/batchRenderer.d.ts +72 -0
  132. package/dist/src/utils/visual/render/canvasRenderer.d.ts +10 -0
  133. package/dist/src/utils/visual/render/index.d.ts +3 -0
  134. package/dist/src/utils/visual/render/render.d.ts +15 -0
  135. package/dist/src/utils/visual/render/utils/batch/index.d.ts +90 -0
  136. package/dist/src/utils/visual/render/utils/float.d.ts +63 -0
  137. package/dist/src/utils/visual/render/utils/index.d.ts +3 -0
  138. package/dist/src/utils/visual/render/utils/verticy.d.ts +13 -0
  139. package/dist/src/utils/visual/render/utils/webgl/batchPool.d.ts +28 -0
  140. package/dist/src/utils/visual/render/utils/webgl/initShader.d.ts +2 -0
  141. package/dist/src/utils/visual/render/utils/webgl/shaders.d.ts +2 -0
  142. package/dist/src/utils/visual/render/utils/webgpu/shaders.d.ts +8 -0
  143. package/dist/src/utils/visual/render/webGPURenderer.d.ts +49 -0
  144. package/dist/src/utils/visual/render/webGlRenderer.d.ts +17 -0
  145. package/dist/src/utils/visual/shape/circle.d.ts +11 -0
  146. package/dist/src/utils/visual/shape/ellipse.d.ts +12 -0
  147. package/dist/src/utils/visual/shape/index.d.ts +7 -0
  148. package/dist/src/utils/visual/shape/polygon.d.ts +11 -0
  149. package/dist/src/utils/visual/shape/rectangle.d.ts +12 -0
  150. package/dist/src/utils/visual/shape/roundedRectangle.d.ts +13 -0
  151. package/dist/src/utils/visual/shape/shape.d.ts +6 -0
  152. package/dist/src/utils/visual/style/fill.d.ts +8 -0
  153. package/dist/src/utils/visual/style/index.d.ts +3 -0
  154. package/dist/src/utils/visual/style/line.d.ts +10 -0
  155. package/dist/src/utils/visual/types.d.ts +17 -0
  156. package/dist/src/utils/visual/vertex/container.d.ts +73 -0
  157. package/dist/src/utils/visual/vertex/index.d.ts +5 -0
  158. package/dist/src/utils/visual/vertex/point.d.ts +18 -0
  159. package/dist/src/utils/visual/vertex/vertex.d.ts +36 -0
  160. package/dist/src/vnode/chainDom.d.ts +47 -0
  161. package/dist/src/vnode/h.d.ts +6 -0
  162. package/dist/src/vnode/hooks.d.ts +23 -0
  163. package/dist/src/vnode/htmlDomApi.d.ts +33 -0
  164. package/dist/src/vnode/init.d.ts +2 -0
  165. package/dist/src/vnode/is.d.ts +5 -0
  166. package/dist/src/vnode/modules/attributes.d.ts +8 -0
  167. package/dist/src/vnode/modules/class.d.ts +8 -0
  168. package/dist/src/vnode/modules/index.d.ts +3 -0
  169. package/dist/src/vnode/modules/listeners.d.ts +12 -0
  170. package/dist/src/vnode/modules/props.d.ts +8 -0
  171. package/dist/src/vnode/modules/style.d.ts +14 -0
  172. package/dist/src/vnode/vnode.d.ts +31 -0
  173. package/dist/src/wasm/index.d.ts +2 -0
  174. package/dist/src/wasm/index.js +346 -0
  175. package/dist/src/wasm/word.d.ts +17 -0
  176. package/dist/src/wicket/bridge.d.ts +4 -0
  177. package/dist/src/wicket/index.d.ts +29 -0
  178. package/dist/test/arithmetic.test.d.ts +1 -0
  179. package/dist/test/cloneDeep.test.d.ts +1 -0
  180. package/dist/test/encodeUrl.test.d.ts +1 -0
  181. package/dist/test/escapeHtml.test.d.ts +1 -0
  182. package/dist/test/is-equal.test.d.ts +1 -0
  183. package/dist/test/mimeType.test.d.ts +1 -0
  184. package/dist/test/server.test.d.ts +1 -0
  185. package/dist/test/sort.test.d.ts +1 -0
  186. package/dist/test/status.test.d.ts +1 -0
  187. package/dist/test/totp.test.d.ts +1 -0
  188. package/dist/test/utils/compose.test.d.ts +1 -0
  189. package/dist/test/utils/mergeObj.test.d.ts +1 -0
  190. package/dist/test/utils/ocr.test.d.ts +1 -0
  191. package/dist/test/visual/math.test.d.ts +1 -0
  192. package/dist/test/vnode/index.d.ts +1 -0
  193. package/dist/test/vnode/server.d.ts +2 -0
  194. package/dist/test/vnode/vnode.d.ts +1 -0
  195. package/dist/test/websocket.test.d.ts +1 -0
  196. package/dist/test/writeFile.test.d.ts +1 -0
  197. package/dist/tsconfig.json +25 -0
  198. package/dist/umd/index.umd.cjs +1 -0
  199. package/dist/umd/ml/ml.umd.cjs +1 -0
  200. package/dist/umd/node/node.umd.cjs +1 -0
  201. package/dist/umd/react/react.umd.cjs +1 -0
  202. package/dist/umd/utils/utils.umd.cjs +1 -0
  203. package/dist/umd/wasm/wasm.umd.cjs +1 -0
  204. package/dist/vite.config.d.ts +11 -0
  205. package/dist/ws-ioQsn2UB.js +703 -0
  206. package/package.json +55 -21
  207. package/readme.md +90 -0
  208. package/typings.d.ts +28 -0
  209. package/assets/img/sort/bubble.gif +0 -0
  210. package/assets/img/sort/complexity.png +0 -0
  211. package/assets/img/sort/select.gif +0 -0
  212. package/assets/img/sort/sort.png +0 -0
  213. package/assets/img/tree/balanceTree.png +0 -0
  214. package/dist/index.js.map +0 -1
  215. package/dist/index.umd.cjs +0 -2
  216. package/dist/index.umd.cjs.map +0 -1
@@ -0,0 +1,15 @@
1
+ export declare const handleClick: (hooks?: (event: MouseEvent) => void) => void;
2
+ /**
3
+ * @description: 获取地区经纬度(会弹出提示让用户授权)
4
+ * @return {*}
5
+ */
6
+ export declare const getRegionalLatitudeAndLongitude: () => Promise<GeolocationPosition>;
7
+ export declare const webglVendor: () => {
8
+ vendor: string;
9
+ renderer: string;
10
+ } | null;
11
+ export declare const canvasVendor: () => string | null;
12
+ /**
13
+ * @description: 音频指纹,1.生成音频信息流 (三角波),对其进行 FFT 变换,计算 SHA 值作为指纹。2.生成音频信息流(正弦波),进行动态压缩处理,计算 MD5 值。
14
+ */
15
+ export declare const audioVendor: () => Promise<string>;
@@ -0,0 +1,220 @@
1
+ /**
2
+ * @description: 覆盖浏览器的后退事件
3
+ * @param {*} callback
4
+ * @return {*}
5
+ */
6
+ export declare const retain: (callback?: () => void) => void;
7
+ /**
8
+ * @description: 获取指定的 cookie
9
+ * @param {string} objName
10
+ * @return {*}
11
+ */
12
+ export declare const getCookie: (objName: string) => string;
13
+ export interface RequestUrlToArraybufferOption {
14
+ responseType: XMLHttpRequestResponseType;
15
+ method: string;
16
+ withCredentials: boolean;
17
+ headers: Record<string, string>;
18
+ body: string;
19
+ onProgress?: Function;
20
+ }
21
+ export interface requestUrlToArraybufferReturn extends BaseReturn {
22
+ data: Blob;
23
+ }
24
+ export interface BaseReturn {
25
+ success: boolean;
26
+ message?: string;
27
+ }
28
+ /**
29
+ * @description: url 转 arrayBuffer
30
+ * @param {string} src
31
+ * @param {RequestUrlToArraybufferOption} options
32
+ * @return {*}
33
+ */
34
+ export declare const requestUrlToBuffer: (src: string, options: Partial<RequestUrlToArraybufferOption>) => Promise<requestUrlToArraybufferReturn>;
35
+ export interface Context {
36
+ backingStorePixelRatio: number;
37
+ webkitBackingStorePixelRatio: number;
38
+ mozBackingStorePixelRatio: number;
39
+ msBackingStorePixelRatio: number;
40
+ oBackingStorePixelRatio: number;
41
+ }
42
+ /**
43
+ * @description: 获取分辨率
44
+ * @param {CanvasRenderingContext2D} context
45
+ * @return {*}
46
+ */
47
+ export declare const getPixelRatio: (context: CanvasRenderingContext2D & Partial<Context>) => number;
48
+ export declare const createObjectURL: (src: Blob | ArrayBuffer | Response) => Promise<string>;
49
+ /**
50
+ * @description: 计算每毫秒的帧率,每秒的帧率需要乘 1000
51
+ * @return {*}
52
+ */
53
+ export declare const getFrame: (n?: number) => Promise<number>;
54
+ /**
55
+ * @description: Gets the current environment configuration
56
+ * @return {string}
57
+ */
58
+ export declare const getHost: (env?: string) => string | undefined;
59
+ /**
60
+ * @description: 将 url 上的字符串转换成对象
61
+ * @param {string} url
62
+ * @param {*} string
63
+ * @return {*}
64
+ */
65
+ export declare const getAllQueryString: (url?: string) => Record<string, string>;
66
+ /**
67
+ * @description: 将 url 上的字符串转换成对象
68
+ * @param {string} url
69
+ * @param {*} string
70
+ * @return {*}
71
+ */
72
+ export declare const getQuery: (url?: string) => Record<string, string>;
73
+ /**
74
+ * @description: 将一个对象转换成 querystring,拼接到 url 后面
75
+ * @return {*}
76
+ */
77
+ export declare function appendUrl(url: string, params?: Record<string, string>): string;
78
+ /**
79
+ * @description: 移除拖拽事件的阴影
80
+ * @param {DragEvent} event
81
+ * @return {*}
82
+ */
83
+ export declare const removeGhosting: (event: DragEvent) => void;
84
+ export declare function getCookieByName(name: string): string;
85
+ interface ClientRatio {
86
+ width: number;
87
+ height: number;
88
+ }
89
+ /**
90
+ * 跨浏览器获取可视窗口大小
91
+ */
92
+ export declare const getWindow: () => ClientRatio;
93
+ /**
94
+ * @description: 返回当前网络状态,当前吞吐量,是否切换网络
95
+ */
96
+ export declare const connection: () => number | undefined;
97
+ /**
98
+ * Encode a URL to a percent-encoded form, excluding already-encoded sequences.
99
+ *
100
+ * This function will take an already-encoded URL and encode all the non-URL
101
+ * code points. This function will not encode the "%" character unless it is
102
+ * not part of a valid sequence (`%20` will be left as-is, but `%foo` will
103
+ * be encoded as `%25foo`).
104
+ *
105
+ * This encode is meant to be "safe" and does not throw errors. It will try as
106
+ * hard as it can to properly encode the given URL, including replacing any raw,
107
+ * unpaired surrogate pairs with the Unicode replacement character prior to
108
+ * encoding.
109
+ *
110
+ * @param {string} url
111
+ * @return {string}
112
+ * @public
113
+ */
114
+ export declare function encodeUrl(url: string): string;
115
+ interface Options {
116
+ url?: string;
117
+ duration?: number;
118
+ count?: number;
119
+ }
120
+ interface ReturnType {
121
+ ping: number;
122
+ jitter: number;
123
+ }
124
+ /**
125
+ * @description: 图片请求
126
+ * @param {string} url
127
+ * @return {Promise<ImageLoadError | number>}
128
+ */
129
+ export declare const imageRequest: (url?: string) => Promise<number>;
130
+ /**
131
+ * @description: 间隔一定时间,执行指定的函数
132
+ * @param {HandlerFunction} handler
133
+ * @param {array} params
134
+ */
135
+ export declare const durationHandler: <T, U>(handler: (...args: T[]) => U, ...params: T[]) => ((a: number) => Promise<U>);
136
+ /**
137
+ * @description: 通过请求来测试当前网络的 ping 值
138
+ * @param {*} options
139
+ */
140
+ export declare const networkSpeed: (options: Options) => Promise<ReturnType>;
141
+ export declare const isSafari: () => boolean | undefined | string;
142
+ export interface MessageHandler<T = unknown, R = unknown> {
143
+ (payload: T): Promise<R> | R;
144
+ }
145
+ export interface MessageData<T = unknown> {
146
+ type: string;
147
+ payload: T;
148
+ id?: string;
149
+ isResponse?: boolean;
150
+ isError?: boolean;
151
+ }
152
+ export interface PendingRequest<R = unknown> {
153
+ resolve: (value: R) => void;
154
+ reject: (error: unknown) => void;
155
+ }
156
+ /**
157
+ * Bridge 注册事件,供 client 消费
158
+ */
159
+ export declare class PostMessageBridge {
160
+ private targetWindow;
161
+ private targetOrigin;
162
+ private messageHandlers;
163
+ private pendingRequests;
164
+ constructor(targetWindow: Window, targetOrigin?: string);
165
+ private handleMessage;
166
+ on: <T = unknown, R = unknown>(type: string, handler: MessageHandler<T, R>) => void;
167
+ off: (type: string) => void;
168
+ send: <T = unknown, R = unknown>(type: string, payload: T) => Promise<R>;
169
+ broadcast: <T = unknown>(data: {
170
+ type: string;
171
+ payload: T;
172
+ }) => void;
173
+ destroy: () => void;
174
+ }
175
+ export interface BridgeManagerOptions {
176
+ id?: string;
177
+ targetOrigin: string;
178
+ targetWindow: Window;
179
+ }
180
+ export declare class BridgeManager {
181
+ private static instance;
182
+ private bridges;
183
+ private constructor();
184
+ static getInstance(): BridgeManager;
185
+ connectClient: ({ id, targetOrigin, targetWindow, }: BridgeManagerOptions) => {
186
+ bridge: PostMessageBridge;
187
+ id: string;
188
+ };
189
+ getClient: (id: string) => PostMessageBridge | undefined;
190
+ removeClient: (id: string) => void;
191
+ broadcast: <T = unknown>(payload: {
192
+ type: string;
193
+ payload: T;
194
+ }) => void;
195
+ sendTo: <T = unknown, R = unknown>(id: string, type: string, payload: T) => Promise<R>;
196
+ }
197
+ export declare const bridgeManager: BridgeManager;
198
+ export interface BroadcastPayload {
199
+ type: string;
200
+ payload: unknown;
201
+ }
202
+ export interface CallToPayload<T = unknown> {
203
+ id: string;
204
+ type: string;
205
+ payload: T;
206
+ }
207
+ export declare const Client: {
208
+ connect: ({ id, targetWindow, targetOrigin }: BridgeManagerOptions) => {
209
+ bridge: PostMessageBridge;
210
+ id: string;
211
+ };
212
+ remove: (id: string) => void;
213
+ /** 广播消息到所有 Platform */
214
+ broadcast: (payload: BroadcastPayload) => void;
215
+ /** 发送消息到指定 Platform */
216
+ call: <T = unknown, R = unknown>({ id, type, payload }: CallToPayload<T>) => Promise<R>;
217
+ /** 广播消息到所有所有可以接收消息的窗口 (为了安全考虑,不建议使用) */
218
+ broadcastToAll: (payload: BroadcastPayload) => void;
219
+ };
220
+ export {};
@@ -0,0 +1,71 @@
1
+ export declare const FMT: Record<string, Array<string>>;
2
+ type ColorVal = (string | number)[];
3
+ export declare class Rgb {
4
+ r: string | number;
5
+ g: string | number;
6
+ b: string | number;
7
+ constructor(col: Array<string | number>);
8
+ toString(): string;
9
+ }
10
+ export declare class Rgba extends Rgb {
11
+ a: string | number;
12
+ constructor(col: Array<string | number>);
13
+ toString(): string;
14
+ }
15
+ export declare class Hsl {
16
+ h: string | number;
17
+ s: string | number;
18
+ l: string | number;
19
+ constructor(col: Array<string | number>);
20
+ toString(): string;
21
+ }
22
+ export declare class Hsla extends Hsl {
23
+ a: string | number;
24
+ constructor(col: Array<string | number>);
25
+ toString(): string;
26
+ }
27
+ export declare class Color {
28
+ r: string | number;
29
+ g: string | number;
30
+ b: string | number;
31
+ a: string | number;
32
+ rgb: Rgb;
33
+ rgba: Rgba;
34
+ hex: string;
35
+ hsl: Hsl;
36
+ hsla: Hsla;
37
+ h: string | number;
38
+ s: string | number;
39
+ l: string | number;
40
+ constructor(r: string | number | Array<string | number>, g?: string | number, b?: string | number, a?: string | number);
41
+ setHue(newHue: string | number): void;
42
+ setSat(newSat: string | number): void;
43
+ setLum(newLum: number): void;
44
+ setAlpha(newAlpha: string | number): void;
45
+ updateFromHsl(): void;
46
+ }
47
+ export declare const randomColor: () => Color;
48
+ export declare const hexToRgb: (hex: string) => RegExpExecArray | null | Array<number>;
49
+ export declare const componentToHex: (c: string | number) => string;
50
+ export declare const rgbToHex: (r: string | number | Array<string | number>, g?: string | number, b?: string | number) => string;
51
+ export declare const rgbToHsl: (r: number | number[], g?: number, b?: number) => Array<number>;
52
+ export declare const hue2rgb: (p: number, q: number, t: number) => number;
53
+ export declare const hslToRgb: (h: number | string | number[], s: number | string, l: number | string) => Array<number>;
54
+ export declare const rgbToHsb: (r: number, g: number, b: number) => number[];
55
+ export declare const hsbToRgb: (h: number, s: number, v: number) => number[];
56
+ export declare const hsvToRgb: (h: number, s: number, v: number) => number[];
57
+ export declare const hsbToHsl: (h: any, s: any, b: any) => number[];
58
+ export declare const hsvToHsl: (h: any, s: any, b: any) => number[];
59
+ export declare class ColorScheme {
60
+ palette: Color[];
61
+ constructor(colorVal: (string | number)[], angleArray: number[]);
62
+ createFromColors(colorVal: (string | number)[]): Color[];
63
+ createFromAngles(colorVal: string | number | (string | number)[], angleArray: number[]): Color[];
64
+ static Compl(colorVal: ColorVal): ColorScheme;
65
+ static Triad(colorVal: ColorVal): ColorScheme;
66
+ static Tetrad(colorVal: ColorVal): ColorScheme;
67
+ static Analog(colorVal: ColorVal): ColorScheme;
68
+ static Split(colorVal: ColorVal): ColorScheme;
69
+ static Accent(colorVal: ColorVal): ColorScheme;
70
+ }
71
+ export {};
@@ -0,0 +1,10 @@
1
+ export type Next = () => Promise<never> | Promise<void>;
2
+ type Middleware<T> = (context: T, next: Next) => any;
3
+ type ComposedMiddleware<T> = (context: T, next?: Next) => Promise<void>;
4
+ /**
5
+ * @description: 将异步函数转化为同步的方式进行执行
6
+ * @param {Array} middleware
7
+ * @return {*}
8
+ */
9
+ export declare function compose<T>(middleware: Array<Middleware<T>>): ComposedMiddleware<T>;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare const handleConsole: (hooks?: (...args: unknown[]) => void) => void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @description: 防抖
3
+ * @param {any} fn
4
+ * @param {*} ms
5
+ * @return {*}
6
+ */
7
+ export declare const debounce: (fn: any, ms?: number) => any;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @description: 判断当前设备
3
+ * @param {*} function
4
+ * @return {*}
5
+ */
6
+ export declare enum DEVICE {
7
+ IPAD = "ipad",
8
+ ANDROID = "android",
9
+ IPhONE = "iphone",
10
+ PC = "pc"
11
+ }
12
+ export type CurrentDevice = 'ipad' | 'android' | 'iphone' | 'pc';
13
+ export declare const currentDevice: () => CurrentDevice;
14
+ export declare const isClient: boolean;
15
+ /**
16
+ * @description: 判断是否是微信浏览器的函数
17
+ * @param {*} boolean
18
+ * @return {*}
19
+ */
20
+ export declare const isWeiXin: () => boolean;
21
+ /**
22
+ * 是否是移动端
23
+ */
24
+ export declare const isMobile: () => boolean;
25
+ export declare const isBangDevice: () => boolean;
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @description: 给指定的元素添加指定的 class
3
+ * @param {Element} element
4
+ * @param {string} addClass
5
+ */
6
+ export declare const addClassToElement: (element: Element, addClass: string) => void;
7
+ /**
8
+ * @description: 给指定的元素移除指定的 class
9
+ * @param {Element} element
10
+ * @param {string} removeClass
11
+ */
12
+ export declare const removeClassToElement: (element: Element, removeClass: string) => void;
13
+ /**
14
+ * @description: 创建一个 Fragment
15
+ * @param {Element} list
16
+ * @return {*}
17
+ */
18
+ export declare const createDocumentFragment: (list: Element[]) => DocumentFragment | undefined;
19
+ export declare function escapeHtml(string?: string | number | null): string;
20
+ /**
21
+ * @description: 根据 UI 稿宽度设置 rem
22
+ * @param {*} void
23
+ * @return {*}
24
+ */
25
+ export declare const setFontSize2html: (designWidth?: number) => void;
26
+ /**
27
+ * @description: 链式调用的 dom 操作
28
+ * (tag) (key value) (children)
29
+ * @return {HTMLElement}
30
+ */
31
+ export declare class Chain {
32
+ listener: Map<string, Map<string, EventListener>>;
33
+ element: HTMLElement;
34
+ constructor(tagName: string, options?: ElementCreationOptions);
35
+ /**
36
+ * @description: 创建元素
37
+ * @param {string} tagName
38
+ * @param {ElementCreationOptions} options
39
+ * @return {Chain}
40
+ */
41
+ create: (tagName: string, options?: ElementCreationOptions) => HTMLElement;
42
+ /**
43
+ * @description: 设置当前元素的属性
44
+ * @param {string} name
45
+ * @param {string} value
46
+ * @return {Chain}
47
+ */
48
+ setAttribute: (name: string, value: string) => Chain;
49
+ /**
50
+ * @description: 移除当前元素的属性
51
+ * @param {string} name
52
+ * @return {Chain}
53
+ */
54
+ removeAttribute: (name: string) => Chain;
55
+ /**
56
+ * @description: 当前元素添加子元素
57
+ * @param {HTMLElement} child
58
+ * @return {ChainElement}
59
+ */
60
+ append: (child: HTMLElement) => Chain;
61
+ /**
62
+ * @description: 当前元素移除子元素
63
+ * @param {HTMLElement} child
64
+ * @return {Chain}
65
+ */
66
+ remove: (child: HTMLElement) => Chain;
67
+ /**
68
+ * @description: 给当前元素设置文本内容
69
+ * @param {string} text
70
+ * @return {Chain}
71
+ */
72
+ setTextContent: (text: string) => Chain;
73
+ /**
74
+ * @description: 给当前元素设置样式
75
+ * @param {string} name
76
+ * @param {string} value
77
+ * @return {Chain}
78
+ */
79
+ setStyle: (name: string, value: string) => Chain;
80
+ private addElementByType;
81
+ /**
82
+ * @description: 给当前元素添加子元素
83
+ * @return {Chain}
84
+ */
85
+ addChild: (child: Chain | Chain[]) => Chain;
86
+ /**
87
+ * @description: 给当前元素添加事件监听
88
+ * @param {string} type
89
+ * @param {EventListener} listener
90
+ * @return {Chain}
91
+ */
92
+ listen: <K extends keyof HTMLElementEventMap>(type: K, listener: EventListener, options?: boolean | AddEventListenerOptions) => Chain;
93
+ /**
94
+ * @description: 移除当前元素的事件监听
95
+ * @param {string} type
96
+ * @return {Chain}
97
+ */
98
+ clearListener: <K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions) => Chain;
99
+ /**
100
+ * @description: 移除当前元素的所有事件监听
101
+ * @return {Chain}
102
+ */
103
+ clearAllListener: () => Chain;
104
+ }
105
+ export declare const create: (tagName: string, options?: ElementCreationOptions) => Chain;
@@ -0,0 +1 @@
1
+ export declare const handleError: (hooks?: (error: Error | PromiseRejectionEvent | ErrorEvent) => void) => void;
@@ -0,0 +1,16 @@
1
+ import type { BaseReturn } from '@/utils/bom';
2
+ /**
3
+ * @description: 校验图片尺寸
4
+ * @param {File} file
5
+ * @return {*}
6
+ */
7
+ export declare const isImageSize: (file: File, width?: number, height?: number) => Promise<boolean>;
8
+ export interface convertImageToBase64Return extends BaseReturn {
9
+ data: string | ArrayBuffer | null;
10
+ }
11
+ /**
12
+ * @description: 图片转 base64
13
+ * @param {File} file
14
+ * @return {*}
15
+ */
16
+ export declare const convertImageToBase64: (file: File) => Promise<convertImageToBase64Return>;
@@ -0,0 +1,35 @@
1
+ import { SyncHook } from './subscribe';
2
+ import { Mathjs, addNumSym, mathjs, perToNum, range, transformNumber } from './number';
3
+ import { MessageCodec, changeHumpToLowerCase, checkEncoding, clearBr, clearStr, getMatchingSentences, getRandomString, isString, md5, randomString, str2Xml, strParse, toString, transformText } from './str';
4
+ import type { TransformText } from './str';
5
+ import { BridgeManager, Client, PostMessageBridge, appendUrl, bridgeManager, connection, createObjectURL, durationHandler, encodeUrl, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getPixelRatio, getQuery, getWindow, imageRequest, isSafari, networkSpeed, removeGhosting, requestUrlToBuffer, retain } from './bom';
6
+ import type { BridgeManagerOptions, BroadcastPayload, CallToPayload, MessageData, MessageHandler, PendingRequest } from './bom';
7
+ import { cloneDeep, filterObj, formatJson, isEqual, merge, mergeExports, querystring, replaceOld, setAttributeByGlobal } from './obj';
8
+ import { AudioRecorder } from '@/utils/audioRecorder';
9
+ import { createSignal, subscribers } from '@/utils/signal';
10
+ import { audioVendor, canvasVendor, webglVendor } from '@/utils/behavior';
11
+ import { TOTP } from '@/utils/totp/totp';
12
+ import { localStorageGetItem, localStorageSetItem } from '@/utils/storage';
13
+ import { Color, ColorScheme, FMT, Hsl, Hsla, Rgb, Rgba, componentToHex, hexToRgb, hsbToRgb, hslToRgb, hsvToHsl, hsvToRgb, hue2rgb, randomColor, rgbToHex, rgbToHsb, rgbToHsl } from '@/utils/color';
14
+ import { compose } from '@/utils/compose';
15
+ import { handleConsole } from '@/utils/console';
16
+ import { debounce } from '@/utils/debounce';
17
+ import { currentDevice, isBangDevice, isClient, isMobile, isWeiXin } from '@/utils/device';
18
+ import type { CurrentDevice } from '@/utils/device';
19
+ import { Chain, addClassToElement, create, createDocumentFragment, escapeHtml, removeClassToElement, setFontSize2html } from '@/utils/dom';
20
+ import { handleError } from '@/utils/error';
21
+ import { convertImageToBase64, isImageSize } from '@/utils/img';
22
+ import { memoize } from '@/utils/memoize';
23
+ import { MimeType, getMime, setMime } from '@/utils/mimeType';
24
+ import { Monitor } from '@/utils/monitor';
25
+ import { getStatus, status } from '@/utils/network';
26
+ import { noop } from '@/utils/noop';
27
+ import { getPerformance } from '@/utils/performance';
28
+ import { QuestQueue } from '@/utils/queue';
29
+ import { createData, report } from '@/utils/report';
30
+ import { handleFetchHook } from '@/utils/request';
31
+ import { scriptOnLoad } from '@/utils/script';
32
+ import { generateThrottle, throttle } from '@/utils/throttle';
33
+ import { performanceTime, timeFormat, timestampToTime } from '@/utils/time';
34
+ export { performanceTime, timeFormat, timestampToTime, generateThrottle, throttle, SyncHook, changeHumpToLowerCase, clearBr, clearStr, isString, randomString, str2Xml, strParse, scriptOnLoad, handleFetchHook, createData, report, QuestQueue, noop, getPerformance, querystring, formatJson, filterObj, merge, replaceOld, mergeExports, perToNum, range, Mathjs, mathjs, getStatus, status, Monitor, MimeType, setMime, getMime, memoize, isImageSize, convertImageToBase64, handleError, addClassToElement, removeClassToElement, createDocumentFragment, escapeHtml, isClient, isWeiXin, isMobile, debounce, currentDevice, handleConsole, compose, Color, FMT, Hsl, Hsla, Rgb, Rgba, randomColor, hexToRgb, componentToHex, rgbToHex, rgbToHsl, hue2rgb, hslToRgb, rgbToHsb, hsbToRgb, hsvToRgb, hsvToHsl, ColorScheme, AudioRecorder, webglVendor, canvasVendor, audioVendor, retain, getCookie, requestUrlToBuffer, getPixelRatio, createObjectURL, getFrame, getHost, getAllQueryString, appendUrl, removeGhosting, getCookieByName, getWindow, connection, encodeUrl, imageRequest, durationHandler, networkSpeed, TOTP, isBangDevice, localStorageGetItem, localStorageSetItem, setAttributeByGlobal, setFontSize2html, Chain, create, isEqual, cloneDeep, createSignal, subscribers, getMatchingSentences, transformNumber, toString, addNumSym, getQuery, checkEncoding, transformText, isSafari, md5, getRandomString, bridgeManager, Client, BridgeManager, PostMessageBridge, MessageCodec, };
35
+ export type { CurrentDevice, TransformText, MessageHandler, MessageData, PendingRequest, BridgeManagerOptions, BroadcastPayload, CallToPayload, };