zcw-shared 1.21.0 → 1.23.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 (474) hide show
  1. package/dist/functions/algorithm/binarySearch.d.ts +3 -0
  2. package/dist/functions/algorithm/binarySearch.js +58 -0
  3. package/dist/functions/algorithm/binarySearch.js.map +1 -0
  4. package/dist/functions/algorithm/canJump.d.ts +2 -0
  5. package/dist/functions/algorithm/canJump.js +27 -0
  6. package/dist/functions/algorithm/canJump.js.map +1 -0
  7. package/dist/functions/algorithm/climbStairs.d.ts +2 -0
  8. package/dist/functions/algorithm/climbStairs.js +27 -0
  9. package/dist/functions/algorithm/climbStairs.js.map +1 -0
  10. package/dist/functions/algorithm/coinChange.d.ts +2 -0
  11. package/dist/functions/algorithm/coinChange.js +25 -0
  12. package/dist/functions/algorithm/coinChange.js.map +1 -0
  13. package/dist/functions/algorithm/combinationSum.d.ts +1 -0
  14. package/dist/functions/algorithm/combinationSum.js +24 -0
  15. package/dist/functions/algorithm/combinationSum.js.map +1 -0
  16. package/dist/functions/algorithm/editDistance.d.ts +2 -0
  17. package/dist/functions/algorithm/editDistance.js +96 -0
  18. package/dist/functions/algorithm/editDistance.js.map +1 -0
  19. package/dist/functions/algorithm/generateParenthesis.d.ts +1 -0
  20. package/dist/functions/algorithm/generateParenthesis.js +18 -0
  21. package/dist/functions/algorithm/generateParenthesis.js.map +1 -0
  22. package/dist/functions/algorithm/kmp.d.ts +2 -0
  23. package/dist/functions/algorithm/kmp.js +58 -0
  24. package/dist/functions/algorithm/kmp.js.map +1 -0
  25. package/dist/functions/algorithm/knapsack01.d.ts +2 -0
  26. package/dist/functions/algorithm/knapsack01.js +34 -0
  27. package/dist/functions/algorithm/knapsack01.js.map +1 -0
  28. package/dist/functions/algorithm/lengthOfLongestSubstring.d.ts +2 -0
  29. package/dist/functions/algorithm/lengthOfLongestSubstring.js +33 -0
  30. package/dist/functions/algorithm/lengthOfLongestSubstring.js.map +1 -0
  31. package/dist/functions/algorithm/longestCommonSubsequence.d.ts +2 -0
  32. package/dist/functions/algorithm/longestCommonSubsequence.js +37 -0
  33. package/dist/functions/algorithm/longestCommonSubsequence.js.map +1 -0
  34. package/dist/functions/algorithm/longestIncreasingSubsequence.d.ts +2 -0
  35. package/dist/functions/algorithm/longestIncreasingSubsequence.js +49 -0
  36. package/dist/functions/algorithm/longestIncreasingSubsequence.js.map +1 -0
  37. package/dist/functions/algorithm/maxArea.d.ts +1 -0
  38. package/dist/functions/algorithm/maxArea.js +19 -0
  39. package/dist/functions/algorithm/maxArea.js.map +1 -0
  40. package/dist/functions/algorithm/maxProfit.d.ts +2 -0
  41. package/dist/functions/algorithm/maxProfit.js +23 -0
  42. package/dist/functions/algorithm/maxProfit.js.map +1 -0
  43. package/dist/functions/algorithm/meetingRooms.d.ts +6 -0
  44. package/dist/functions/algorithm/meetingRooms.js +31 -0
  45. package/dist/functions/algorithm/meetingRooms.js.map +1 -0
  46. package/dist/functions/algorithm/mergeSort.d.ts +2 -0
  47. package/dist/functions/algorithm/mergeSort.js +72 -0
  48. package/dist/functions/algorithm/mergeSort.js.map +1 -0
  49. package/dist/functions/algorithm/minPathSum.d.ts +2 -0
  50. package/dist/functions/algorithm/minPathSum.js +39 -0
  51. package/dist/functions/algorithm/minPathSum.js.map +1 -0
  52. package/dist/functions/algorithm/minWindow.d.ts +1 -0
  53. package/dist/functions/algorithm/minWindow.js +40 -0
  54. package/dist/functions/algorithm/minWindow.js.map +1 -0
  55. package/dist/functions/algorithm/nQueens.d.ts +1 -0
  56. package/dist/functions/algorithm/nQueens.js +30 -0
  57. package/dist/functions/algorithm/nQueens.js.map +1 -0
  58. package/dist/functions/algorithm/numIslands.d.ts +2 -0
  59. package/dist/functions/algorithm/numIslands.js +59 -0
  60. package/dist/functions/algorithm/numIslands.js.map +1 -0
  61. package/dist/functions/algorithm/permutations.d.ts +1 -0
  62. package/dist/functions/algorithm/permutations.js +22 -0
  63. package/dist/functions/algorithm/permutations.js.map +1 -0
  64. package/dist/functions/algorithm/quickSort.d.ts +3 -0
  65. package/dist/functions/algorithm/quickSort.js +68 -0
  66. package/dist/functions/algorithm/quickSort.js.map +1 -0
  67. package/dist/functions/algorithm/rabinKarp.d.ts +1 -0
  68. package/dist/functions/algorithm/rabinKarp.js +40 -0
  69. package/dist/functions/algorithm/rabinKarp.js.map +1 -0
  70. package/dist/functions/algorithm/taskScheduler.d.ts +1 -0
  71. package/dist/functions/algorithm/taskScheduler.js +15 -0
  72. package/dist/functions/algorithm/taskScheduler.js.map +1 -0
  73. package/dist/functions/algorithm/threeSum.d.ts +2 -0
  74. package/dist/functions/algorithm/threeSum.js +56 -0
  75. package/dist/functions/algorithm/threeSum.js.map +1 -0
  76. package/dist/functions/algorithm/topologicalSort.d.ts +6 -0
  77. package/dist/functions/algorithm/topologicalSort.js +68 -0
  78. package/dist/functions/algorithm/topologicalSort.js.map +1 -0
  79. package/dist/functions/algorithm/trap.d.ts +2 -0
  80. package/dist/functions/algorithm/trap.js +51 -0
  81. package/dist/functions/algorithm/trap.js.map +1 -0
  82. package/dist/functions/algorithm/visualizeGarbageCollection.d.ts +44 -0
  83. package/dist/functions/algorithm/visualizeGarbageCollection.js +263 -0
  84. package/dist/functions/algorithm/visualizeGarbageCollection.js.map +1 -0
  85. package/dist/functions/array-object/chunk.d.ts +1 -0
  86. package/dist/functions/array-object/chunk.js +11 -0
  87. package/dist/functions/array-object/chunk.js.map +1 -0
  88. package/dist/functions/array-object/evolve.d.ts +3 -0
  89. package/dist/functions/array-object/evolve.js +15 -0
  90. package/dist/functions/array-object/evolve.js.map +1 -0
  91. package/dist/functions/array-object/flattenObject.d.ts +5 -0
  92. package/dist/functions/array-object/flattenObject.js +102 -0
  93. package/dist/functions/array-object/flattenObject.js.map +1 -0
  94. package/dist/functions/array-object/groupBy.d.ts +1 -0
  95. package/dist/functions/array-object/groupBy.js +14 -0
  96. package/dist/functions/array-object/groupBy.js.map +1 -0
  97. package/dist/functions/array-object/omit.d.ts +1 -0
  98. package/dist/functions/array-object/omit.js +8 -0
  99. package/dist/functions/array-object/omit.js.map +1 -0
  100. package/dist/functions/array-object/pick.d.ts +1 -0
  101. package/dist/functions/array-object/pick.js +10 -0
  102. package/dist/functions/array-object/pick.js.map +1 -0
  103. package/dist/functions/array-object/shuffle.d.ts +1 -0
  104. package/dist/functions/array-object/shuffle.js +9 -0
  105. package/dist/functions/array-object/shuffle.js.map +1 -0
  106. package/dist/functions/array-object/sortBy.d.ts +1 -0
  107. package/dist/functions/array-object/sortBy.js +13 -0
  108. package/dist/functions/array-object/sortBy.js.map +1 -0
  109. package/dist/functions/async/cachedAsync.d.ts +27 -0
  110. package/dist/functions/async/cachedAsync.js +123 -0
  111. package/dist/functions/async/cachedAsync.js.map +1 -0
  112. package/dist/functions/async/promiseLimit.d.ts +10 -0
  113. package/dist/functions/async/promiseLimit.js +125 -0
  114. package/dist/functions/async/promiseLimit.js.map +1 -0
  115. package/dist/functions/async/retryWithBackoff.d.ts +12 -0
  116. package/dist/functions/async/retryWithBackoff.js +29 -0
  117. package/dist/functions/async/retryWithBackoff.js.map +1 -0
  118. package/dist/functions/browser/detectBrowser.d.ts +39 -0
  119. package/dist/functions/browser/detectBrowser.js +193 -0
  120. package/dist/functions/browser/detectBrowser.js.map +1 -0
  121. package/dist/functions/browser/detectOS.d.ts +5 -0
  122. package/dist/functions/browser/detectOS.js +20 -0
  123. package/dist/functions/browser/detectOS.js.map +1 -0
  124. package/dist/functions/browser/isMobile.d.ts +6 -0
  125. package/dist/functions/browser/isMobile.js +5 -0
  126. package/dist/functions/browser/isMobile.js.map +1 -0
  127. package/dist/functions/data-structures/AVLTree.d.ts +19 -0
  128. package/dist/functions/data-structures/AVLTree.js +197 -0
  129. package/dist/functions/data-structures/AVLTree.js.map +1 -0
  130. package/dist/functions/data-structures/BinarySearchTree.d.ts +19 -0
  131. package/dist/functions/data-structures/BinarySearchTree.js +150 -0
  132. package/dist/functions/data-structures/BinarySearchTree.js.map +1 -0
  133. package/dist/functions/data-structures/Graph.d.ts +19 -0
  134. package/dist/functions/data-structures/Graph.js +190 -0
  135. package/dist/functions/data-structures/Graph.js.map +1 -0
  136. package/dist/functions/data-structures/HashMap.d.ts +13 -0
  137. package/dist/functions/data-structures/HashMap.js +128 -0
  138. package/dist/functions/data-structures/HashMap.js.map +1 -0
  139. package/dist/functions/data-structures/LRUCache.d.ts +41 -0
  140. package/dist/functions/data-structures/LRUCache.js +182 -0
  141. package/dist/functions/data-structures/LRUCache.js.map +1 -0
  142. package/dist/functions/data-structures/Trie.d.ts +16 -0
  143. package/dist/functions/data-structures/Trie.js +127 -0
  144. package/dist/functions/data-structures/Trie.js.map +1 -0
  145. package/dist/functions/data-structures/UnionFind.d.ts +8 -0
  146. package/dist/functions/data-structures/UnionFind.js +53 -0
  147. package/dist/functions/data-structures/UnionFind.js.map +1 -0
  148. package/dist/functions/date/dateRange.d.ts +1 -0
  149. package/dist/functions/date/dateRange.js +18 -0
  150. package/dist/functions/date/dateRange.js.map +1 -0
  151. package/dist/functions/date/formatDate.d.ts +1 -0
  152. package/dist/functions/date/formatDate.js +21 -0
  153. package/dist/functions/date/formatDate.js.map +1 -0
  154. package/dist/functions/date/timeAgo.d.ts +1 -0
  155. package/dist/functions/date/timeAgo.js +49 -0
  156. package/dist/functions/date/timeAgo.js.map +1 -0
  157. package/dist/functions/dom/createThrottledEventListener.d.ts +11 -0
  158. package/dist/functions/dom/createThrottledEventListener.js +51 -0
  159. package/dist/functions/dom/createThrottledEventListener.js.map +1 -0
  160. package/dist/functions/file/formatFileSize.d.ts +1 -0
  161. package/dist/functions/file/formatFileSize.js +16 -0
  162. package/dist/functions/file/formatFileSize.js.map +1 -0
  163. package/dist/functions/file/getFileExtension.d.ts +5 -0
  164. package/dist/functions/file/getFileExtension.js +18 -0
  165. package/dist/functions/file/getFileExtension.js.map +1 -0
  166. package/dist/functions/functional/cond.d.ts +1 -0
  167. package/dist/functions/functional/cond.js +15 -0
  168. package/dist/functions/functional/cond.js.map +1 -0
  169. package/dist/functions/functional/curryAdvanced.d.ts +8 -0
  170. package/dist/functions/functional/curryAdvanced.js +87 -0
  171. package/dist/functions/functional/curryAdvanced.js.map +1 -0
  172. package/dist/functions/functional/flow.d.ts +1 -0
  173. package/dist/functions/functional/flow.js +14 -0
  174. package/dist/functions/functional/flow.js.map +1 -0
  175. package/dist/functions/functional/partial.d.ts +1 -0
  176. package/dist/functions/functional/partial.js +13 -0
  177. package/dist/functions/functional/partial.js.map +1 -0
  178. package/dist/functions/functional/tap.d.ts +1 -0
  179. package/dist/functions/functional/tap.js +14 -0
  180. package/dist/functions/functional/tap.js.map +1 -0
  181. package/dist/functions/functional/until.d.ts +1 -0
  182. package/dist/functions/functional/until.js +10 -0
  183. package/dist/functions/functional/until.js.map +1 -0
  184. package/dist/functions/math/average.d.ts +1 -0
  185. package/dist/functions/math/average.js +8 -0
  186. package/dist/functions/math/average.js.map +1 -0
  187. package/dist/functions/math/median.d.ts +1 -0
  188. package/dist/functions/math/median.js +14 -0
  189. package/dist/functions/math/median.js.map +1 -0
  190. package/dist/functions/math/percentile.d.ts +1 -0
  191. package/dist/functions/math/percentile.js +18 -0
  192. package/dist/functions/math/percentile.js.map +1 -0
  193. package/dist/functions/math/sum.d.ts +1 -0
  194. package/dist/functions/math/sum.js +4 -0
  195. package/dist/functions/math/sum.js.map +1 -0
  196. package/dist/functions/number/clamp.d.ts +1 -0
  197. package/dist/functions/number/clamp.js +7 -0
  198. package/dist/functions/number/clamp.js.map +1 -0
  199. package/dist/functions/number/formatNumber.d.ts +8 -0
  200. package/dist/functions/number/formatNumber.js +16 -0
  201. package/dist/functions/number/formatNumber.js.map +1 -0
  202. package/dist/functions/number/random.d.ts +4 -0
  203. package/dist/functions/number/random.js +9 -0
  204. package/dist/functions/number/random.js.map +1 -0
  205. package/dist/functions/number/range.d.ts +1 -0
  206. package/dist/functions/number/range.js +18 -0
  207. package/dist/functions/number/range.js.map +1 -0
  208. package/dist/functions/patterns/EventEmitter.d.ts +32 -0
  209. package/dist/functions/patterns/EventEmitter.js +108 -0
  210. package/dist/functions/patterns/EventEmitter.js.map +1 -0
  211. package/dist/functions/patterns/adapter.d.ts +8 -0
  212. package/dist/functions/patterns/adapter.js +14 -0
  213. package/dist/functions/patterns/adapter.js.map +1 -0
  214. package/dist/functions/patterns/builder.d.ts +9 -0
  215. package/dist/functions/patterns/builder.js +28 -0
  216. package/dist/functions/patterns/builder.js.map +1 -0
  217. package/dist/functions/patterns/chainOfResponsibility.d.ts +9 -0
  218. package/dist/functions/patterns/chainOfResponsibility.js +19 -0
  219. package/dist/functions/patterns/chainOfResponsibility.js.map +1 -0
  220. package/dist/functions/patterns/command.d.ts +15 -0
  221. package/dist/functions/patterns/command.js +49 -0
  222. package/dist/functions/patterns/command.js.map +1 -0
  223. package/dist/functions/patterns/decorator.d.ts +10 -0
  224. package/dist/functions/patterns/decorator.js +72 -0
  225. package/dist/functions/patterns/decorator.js.map +1 -0
  226. package/dist/functions/patterns/factory.d.ts +8 -0
  227. package/dist/functions/patterns/factory.js +25 -0
  228. package/dist/functions/patterns/factory.js.map +1 -0
  229. package/dist/functions/patterns/observer.d.ts +19 -0
  230. package/dist/functions/patterns/observer.js +89 -0
  231. package/dist/functions/patterns/observer.js.map +1 -0
  232. package/dist/functions/patterns/prototype.d.ts +4 -0
  233. package/dist/functions/patterns/prototype.js +30 -0
  234. package/dist/functions/patterns/prototype.js.map +1 -0
  235. package/dist/functions/patterns/proxy.d.ts +8 -0
  236. package/dist/functions/patterns/proxy.js +41 -0
  237. package/dist/functions/patterns/proxy.js.map +1 -0
  238. package/dist/functions/patterns/singleton.d.ts +11 -0
  239. package/dist/functions/patterns/singleton.js +32 -0
  240. package/dist/functions/patterns/singleton.js.map +1 -0
  241. package/dist/functions/patterns/strategy.d.ts +12 -0
  242. package/dist/functions/patterns/strategy.js +34 -0
  243. package/dist/functions/patterns/strategy.js.map +1 -0
  244. package/dist/functions/patterns/templateMethod.d.ts +8 -0
  245. package/dist/functions/patterns/templateMethod.js +19 -0
  246. package/dist/functions/patterns/templateMethod.js.map +1 -0
  247. package/dist/functions/patterns/usePluginSystem.d.ts +11 -0
  248. package/dist/functions/patterns/usePluginSystem.js +34 -0
  249. package/dist/functions/patterns/usePluginSystem.js.map +1 -0
  250. package/dist/functions/performance/once.d.ts +1 -0
  251. package/dist/functions/performance/once.js +13 -0
  252. package/dist/functions/performance/once.js.map +1 -0
  253. package/dist/functions/performance/useCache.d.ts +18 -0
  254. package/dist/functions/performance/useCache.js +82 -0
  255. package/dist/functions/performance/useCache.js.map +1 -0
  256. package/dist/functions/principles/MyPromise.d.ts +32 -0
  257. package/dist/functions/principles/MyPromise.js +254 -0
  258. package/dist/functions/principles/MyPromise.js.map +1 -0
  259. package/dist/functions/promise/sleep.d.ts +5 -0
  260. package/dist/functions/promise/sleep.js +6 -0
  261. package/dist/functions/promise/sleep.js.map +1 -0
  262. package/dist/functions/promise/timeout.d.ts +6 -0
  263. package/dist/functions/promise/timeout.js +12 -0
  264. package/dist/functions/promise/timeout.js.map +1 -0
  265. package/dist/functions/storage/useLocalStorage.d.ts +8 -0
  266. package/dist/functions/storage/useLocalStorage.js +101 -0
  267. package/dist/functions/storage/useLocalStorage.js.map +1 -0
  268. package/dist/functions/storage/useSessionStorage.d.ts +8 -0
  269. package/dist/functions/storage/useSessionStorage.js +101 -0
  270. package/dist/functions/storage/useSessionStorage.js.map +1 -0
  271. package/dist/functions/storage/useStorage.d.ts +13 -0
  272. package/dist/functions/storage/useStorage.js +62 -0
  273. package/dist/functions/storage/useStorage.js.map +1 -0
  274. package/dist/functions/storage/useStorageWithIndexedDB.d.ts +8 -0
  275. package/dist/functions/storage/useStorageWithIndexedDB.js +132 -0
  276. package/dist/functions/storage/useStorageWithIndexedDB.js.map +1 -0
  277. package/dist/functions/string/testRegex.d.ts +20 -0
  278. package/dist/functions/string/testRegex.js +300 -0
  279. package/dist/functions/string/testRegex.js.map +1 -0
  280. package/dist/functions/string/visualizeRegexSteps.d.ts +39 -0
  281. package/dist/functions/string/visualizeRegexSteps.js +446 -0
  282. package/dist/functions/string/visualizeRegexSteps.js.map +1 -0
  283. package/dist/functions/tencent-cloud/upload.cos.d.ts +20 -0
  284. package/dist/functions/tencent-cloud/upload.cos.js +127 -0
  285. package/dist/functions/tencent-cloud/upload.cos.js.map +1 -0
  286. package/dist/functions/tree/buildTree.d.ts +7 -0
  287. package/dist/functions/tree/buildTree.js +27 -0
  288. package/dist/functions/tree/buildTree.js.map +1 -0
  289. package/dist/functions/tree/filterTree.d.ts +4 -0
  290. package/dist/functions/tree/filterTree.js +21 -0
  291. package/dist/functions/tree/filterTree.js.map +1 -0
  292. package/dist/functions/tree/findNode.d.ts +4 -0
  293. package/dist/functions/tree/findNode.js +21 -0
  294. package/dist/functions/tree/findNode.js.map +1 -0
  295. package/dist/functions/tree/flattenTree.d.ts +6 -0
  296. package/dist/functions/tree/flattenTree.js +21 -0
  297. package/dist/functions/tree/flattenTree.js.map +1 -0
  298. package/dist/functions/url/buildQueryString.d.ts +5 -0
  299. package/dist/functions/url/buildQueryString.js +15 -0
  300. package/dist/functions/url/buildQueryString.js.map +1 -0
  301. package/dist/functions/url/parseUrl.d.ts +11 -0
  302. package/dist/functions/url/parseUrl.js +34 -0
  303. package/dist/functions/url/parseUrl.js.map +1 -0
  304. package/dist/functions/utils/cachedAsync.d.ts +27 -0
  305. package/dist/functions/utils/cachedAsync.js +123 -0
  306. package/dist/functions/utils/cachedAsync.js.map +1 -0
  307. package/dist/functions/utils/errorManager.d.ts +63 -0
  308. package/dist/functions/utils/errorManager.js +199 -0
  309. package/dist/functions/utils/errorManager.js.map +1 -0
  310. package/dist/functions/utils/useAltool.d.ts +39 -0
  311. package/dist/functions/utils/useAltool.js +350 -0
  312. package/dist/functions/utils/useAltool.js.map +1 -0
  313. package/dist/functions/utils/vueDiff.d.ts +38 -0
  314. package/dist/functions/utils/vueDiff.js +333 -0
  315. package/dist/functions/utils/vueDiff.js.map +1 -0
  316. package/dist/functions/validation/isEmail.d.ts +1 -0
  317. package/dist/functions/validation/isEmail.js +8 -0
  318. package/dist/functions/validation/isEmail.js.map +1 -0
  319. package/dist/functions/validation/isIdCard.d.ts +1 -0
  320. package/dist/functions/validation/isIdCard.js +49 -0
  321. package/dist/functions/validation/isIdCard.js.map +1 -0
  322. package/dist/functions/validation/isIpAddress.d.ts +1 -0
  323. package/dist/functions/validation/isIpAddress.js +15 -0
  324. package/dist/functions/validation/isIpAddress.js.map +1 -0
  325. package/dist/functions/validation/isPhone.d.ts +1 -0
  326. package/dist/functions/validation/isPhone.js +12 -0
  327. package/dist/functions/validation/isPhone.js.map +1 -0
  328. package/dist/functions/validation/isUrl.d.ts +5 -0
  329. package/dist/functions/validation/isUrl.js +33 -0
  330. package/dist/functions/validation/isUrl.js.map +1 -0
  331. package/dist/reactive/createReactive.d.ts +10 -0
  332. package/dist/reactive/createReactive.js +50 -0
  333. package/dist/reactive/createReactive.js.map +1 -0
  334. package/dist/reactive/createReactiveErrorManager.d.ts +63 -0
  335. package/dist/reactive/createReactiveErrorManager.js +199 -0
  336. package/dist/reactive/createReactiveErrorManager.js.map +1 -0
  337. package/dist/reactive/createReactiveI18n.d.ts +27 -0
  338. package/dist/reactive/createReactiveI18n.js +119 -0
  339. package/dist/reactive/createReactiveI18n.js.map +1 -0
  340. package/dist/reactive/createReactivePermission.d.ts +40 -0
  341. package/dist/reactive/createReactivePermission.js +189 -0
  342. package/dist/reactive/createReactivePermission.js.map +1 -0
  343. package/dist/reactive/createReactivePinia.d.ts +52 -0
  344. package/dist/reactive/createReactivePinia.js +183 -0
  345. package/dist/reactive/createReactivePinia.js.map +1 -0
  346. package/dist/reactive/useReactiveCookie.d.ts +19 -0
  347. package/dist/reactive/useReactiveCookie.js +84 -0
  348. package/dist/reactive/useReactiveCookie.js.map +1 -0
  349. package/dist/reactive/useReactiveSSE.d.ts +46 -0
  350. package/dist/reactive/useReactiveSSE.js +212 -0
  351. package/dist/reactive/useReactiveSSE.js.map +1 -0
  352. package/dist/reactive/useReactiveWebsocket.d.ts +50 -0
  353. package/dist/reactive/useReactiveWebsocket.js +250 -0
  354. package/dist/reactive/useReactiveWebsocket.js.map +1 -0
  355. package/dist/vue-hooks/browser/useBattery.d.ts +16 -0
  356. package/dist/vue-hooks/browser/useBattery.js +70 -0
  357. package/dist/vue-hooks/browser/useBattery.js.map +1 -0
  358. package/dist/vue-hooks/browser/useBluetooth.d.ts +25 -0
  359. package/dist/vue-hooks/browser/useBluetooth.js +72 -0
  360. package/dist/vue-hooks/browser/useBluetooth.js.map +1 -0
  361. package/dist/vue-hooks/browser/useCamera.d.ts +21 -0
  362. package/dist/vue-hooks/browser/useCamera.js +52 -0
  363. package/dist/vue-hooks/browser/useCamera.js.map +1 -0
  364. package/dist/vue-hooks/browser/useClipboard.d.ts +18 -0
  365. package/dist/vue-hooks/browser/useClipboard.js +33 -0
  366. package/dist/vue-hooks/browser/useClipboard.js.map +1 -0
  367. package/dist/vue-hooks/browser/useFullscreen.d.ts +20 -0
  368. package/dist/vue-hooks/browser/useFullscreen.js +73 -0
  369. package/dist/vue-hooks/browser/useFullscreen.js.map +1 -0
  370. package/dist/vue-hooks/browser/useGamepad.d.ts +25 -0
  371. package/dist/vue-hooks/browser/useGamepad.js +69 -0
  372. package/dist/vue-hooks/browser/useGamepad.js.map +1 -0
  373. package/dist/vue-hooks/browser/useGeolocation.d.ts +24 -0
  374. package/dist/vue-hooks/browser/useGeolocation.js +85 -0
  375. package/dist/vue-hooks/browser/useGeolocation.js.map +1 -0
  376. package/dist/vue-hooks/browser/useMediaSession.d.ts +19 -0
  377. package/dist/vue-hooks/browser/useMediaSession.js +71 -0
  378. package/dist/vue-hooks/browser/useMediaSession.js.map +1 -0
  379. package/dist/vue-hooks/browser/useMicrophone.d.ts +23 -0
  380. package/dist/vue-hooks/browser/useMicrophone.js +66 -0
  381. package/dist/vue-hooks/browser/useMicrophone.js.map +1 -0
  382. package/dist/vue-hooks/browser/useNetwork.d.ts +23 -0
  383. package/dist/vue-hooks/browser/useNetwork.js +57 -0
  384. package/dist/vue-hooks/browser/useNetwork.js.map +1 -0
  385. package/dist/vue-hooks/browser/useOrientation.d.ts +22 -0
  386. package/dist/vue-hooks/browser/useOrientation.js +54 -0
  387. package/dist/vue-hooks/browser/useOrientation.js.map +1 -0
  388. package/dist/vue-hooks/browser/usePageVisibility.d.ts +15 -0
  389. package/dist/vue-hooks/browser/usePageVisibility.js +25 -0
  390. package/dist/vue-hooks/browser/usePageVisibility.js.map +1 -0
  391. package/dist/vue-hooks/browser/useScreenOrientation.d.ts +24 -0
  392. package/dist/vue-hooks/browser/useScreenOrientation.js +67 -0
  393. package/dist/vue-hooks/browser/useScreenOrientation.js.map +1 -0
  394. package/dist/vue-hooks/browser/useScreenWakeLock.d.ts +15 -0
  395. package/dist/vue-hooks/browser/useScreenWakeLock.js +57 -0
  396. package/dist/vue-hooks/browser/useScreenWakeLock.js.map +1 -0
  397. package/dist/vue-hooks/browser/useShare.d.ts +21 -0
  398. package/dist/vue-hooks/browser/useShare.js +39 -0
  399. package/dist/vue-hooks/browser/useShare.js.map +1 -0
  400. package/dist/vue-hooks/browser/useVibration.d.ts +17 -0
  401. package/dist/vue-hooks/browser/useVibration.js +40 -0
  402. package/dist/vue-hooks/browser/useVibration.js.map +1 -0
  403. package/dist/vue-hooks/dom/useClickOutside.d.ts +9 -0
  404. package/dist/vue-hooks/dom/useClickOutside.js +16 -0
  405. package/dist/vue-hooks/dom/useClickOutside.js.map +1 -0
  406. package/dist/vue-hooks/dom/useDraggable.d.ts +33 -0
  407. package/dist/vue-hooks/dom/useDraggable.js +163 -0
  408. package/dist/vue-hooks/dom/useDraggable.js.map +1 -0
  409. package/dist/vue-hooks/dom/useEventListener.d.ts +11 -0
  410. package/dist/vue-hooks/dom/useEventListener.js +18 -0
  411. package/dist/vue-hooks/dom/useEventListener.js.map +1 -0
  412. package/dist/vue-hooks/dom/useResizable.d.ts +50 -0
  413. package/dist/vue-hooks/dom/useResizable.js +178 -0
  414. package/dist/vue-hooks/dom/useResizable.js.map +1 -0
  415. package/dist/vue-hooks/history/useDebouncedRefHistory.d.ts +17 -0
  416. package/dist/vue-hooks/history/useDebouncedRefHistory.js +46 -0
  417. package/dist/vue-hooks/history/useDebouncedRefHistory.js.map +1 -0
  418. package/dist/vue-hooks/history/useManualRefHistory.d.ts +26 -0
  419. package/dist/vue-hooks/history/useManualRefHistory.js +80 -0
  420. package/dist/vue-hooks/history/useManualRefHistory.js.map +1 -0
  421. package/dist/vue-hooks/history/useRefHistory.d.ts +15 -0
  422. package/dist/vue-hooks/history/useRefHistory.js +41 -0
  423. package/dist/vue-hooks/history/useRefHistory.js.map +1 -0
  424. package/dist/vue-hooks/state/createGlobalState.d.ts +2 -0
  425. package/dist/vue-hooks/state/createGlobalState.js +11 -0
  426. package/dist/vue-hooks/state/createGlobalState.js.map +1 -0
  427. package/dist/vue-hooks/state/createInjectionState.d.ts +10 -0
  428. package/dist/vue-hooks/state/createInjectionState.js +20 -0
  429. package/dist/vue-hooks/state/createInjectionState.js.map +1 -0
  430. package/dist/vue-hooks/state/createSharedComposable.d.ts +2 -0
  431. package/dist/vue-hooks/state/createSharedComposable.js +13 -0
  432. package/dist/vue-hooks/state/createSharedComposable.js.map +1 -0
  433. package/dist/vue-hooks/state/injectLocal.d.ts +8 -0
  434. package/dist/vue-hooks/state/injectLocal.js +12 -0
  435. package/dist/vue-hooks/state/injectLocal.js.map +1 -0
  436. package/dist/vue-hooks/state/provideLocal.d.ts +7 -0
  437. package/dist/vue-hooks/state/provideLocal.js +7 -0
  438. package/dist/vue-hooks/state/provideLocal.js.map +1 -0
  439. package/dist/vue-hooks/state/useAsyncState.d.ts +27 -0
  440. package/dist/vue-hooks/state/useAsyncState.js +46 -0
  441. package/dist/vue-hooks/state/useAsyncState.js.map +1 -0
  442. package/dist/vue-hooks/state/useCounter.d.ts +17 -0
  443. package/dist/vue-hooks/state/useCounter.js +44 -0
  444. package/dist/vue-hooks/state/useCounter.js.map +1 -0
  445. package/dist/vue-hooks/state/useToggle.d.ts +13 -0
  446. package/dist/vue-hooks/state/useToggle.js +23 -0
  447. package/dist/vue-hooks/state/useToggle.js.map +1 -0
  448. package/dist/vue-hooks/time/useInterval.d.ts +16 -0
  449. package/dist/vue-hooks/time/useInterval.js +33 -0
  450. package/dist/vue-hooks/time/useInterval.js.map +1 -0
  451. package/dist/vue-hooks/time/useTimeout.d.ts +17 -0
  452. package/dist/vue-hooks/time/useTimeout.js +40 -0
  453. package/dist/vue-hooks/time/useTimeout.js.map +1 -0
  454. package/dist/vue-hooks/worker/useWebWorker.d.ts +25 -0
  455. package/dist/vue-hooks/worker/useWebWorker.js +207 -0
  456. package/dist/vue-hooks/worker/useWebWorker.js.map +1 -0
  457. package/dist/vue-hooks/worker/useWorkerFunction.d.ts +26 -0
  458. package/dist/vue-hooks/worker/useWorkerFunction.js +191 -0
  459. package/dist/vue-hooks/worker/useWorkerFunction.js.map +1 -0
  460. package/dist/vue-hooks/worker/useWorkerPool.d.ts +33 -0
  461. package/dist/vue-hooks/worker/useWorkerPool.js +247 -0
  462. package/dist/vue-hooks/worker/useWorkerPool.js.map +1 -0
  463. package/package.json +178 -65
  464. package/references/browser.d.ts +16 -0
  465. package/references/device.d.ts +340 -0
  466. package/references/dom.d.ts +31 -6
  467. package/references/eventsource.d.ts +121 -0
  468. package/references/node.d.ts +2 -0
  469. package/references/tencent-cloud.d.ts +38 -0
  470. package/references/websocket.d.ts +121 -0
  471. package/types/algorithm-visual.d.ts +79 -0
  472. package/types/algorithm.d.ts +85 -0
  473. package/types/tencent-cloud.d.ts +29 -0
  474. package/types/vue.d.ts +22 -0
@@ -0,0 +1,340 @@
1
+ /**
2
+ * 设备 API 类型定义
3
+ * 包含浏览器端设备相关的 Web API 接口
4
+ */
5
+
6
+ // 蓝牙相关类型
7
+ export interface BluetoothDevice {
8
+ id: string
9
+ name?: string
10
+ gatt?: BluetoothRemoteGATTServer
11
+ watchAdvertisements(): Promise<void>
12
+ unwatchAdvertisements(): void
13
+ addEventListener(type: string, listener: EventListener): void
14
+ removeEventListener(type: string, listener: EventListener): void
15
+ }
16
+
17
+ export interface BluetoothRemoteGATTServer {
18
+ device: BluetoothDevice
19
+ connected: boolean
20
+ connect(): Promise<BluetoothRemoteGATTServer>
21
+ disconnect(): void
22
+ getPrimaryService(service: string): Promise<BluetoothRemoteGATTService>
23
+ getPrimaryServices(service?: string): Promise<BluetoothRemoteGATTService[]>
24
+ }
25
+
26
+ export interface BluetoothRemoteGATTService {
27
+ device: BluetoothDevice
28
+ uuid: string
29
+ isPrimary: boolean
30
+ getCharacteristic(characteristic: string): Promise<BluetoothRemoteGATTCharacteristic>
31
+ getCharacteristics(characteristic?: string): Promise<BluetoothRemoteGATTCharacteristic[]>
32
+ }
33
+
34
+ export interface BluetoothRemoteGATTCharacteristic {
35
+ service: BluetoothRemoteGATTService
36
+ uuid: string
37
+ value?: DataView
38
+ readValue(): Promise<DataView>
39
+ writeValue(value: BufferSource): Promise<void>
40
+ startNotifications(): Promise<BluetoothRemoteGATTCharacteristic>
41
+ stopNotifications(): Promise<BluetoothRemoteGATTCharacteristic>
42
+ addEventListener(type: string, listener: EventListener): void
43
+ removeEventListener(type: string, listener: EventListener): void
44
+ }
45
+
46
+ export interface Bluetooth {
47
+ requestDevice(options?: {
48
+ filters?: Array<{ name?: string; namePrefix?: string; services?: string[] }>
49
+ optionalServices?: string[]
50
+ acceptAllDevices?: boolean
51
+ }): Promise<BluetoothDevice>
52
+ getAvailability(): Promise<boolean>
53
+ addEventListener(type: string, listener: EventListener): void
54
+ removeEventListener(type: string, listener: EventListener): void
55
+ }
56
+
57
+ // 地理位置相关类型
58
+ export interface GeolocationPosition {
59
+ coords: {
60
+ latitude: number
61
+ longitude: number
62
+ altitude: number | null
63
+ accuracy: number
64
+ altitudeAccuracy: number | null
65
+ heading: number | null
66
+ speed: number | null
67
+ }
68
+ timestamp: number
69
+ }
70
+
71
+ export interface GeolocationPositionError {
72
+ code: number
73
+ message: string
74
+ PERMISSION_DENIED: 1
75
+ POSITION_UNAVAILABLE: 2
76
+ TIMEOUT: 3
77
+ }
78
+
79
+ export interface Geolocation {
80
+ getCurrentPosition(
81
+ successCallback: (position: GeolocationPosition) => void,
82
+ errorCallback?: (error: GeolocationPositionError) => void,
83
+ options?: {
84
+ enableHighAccuracy?: boolean
85
+ timeout?: number
86
+ maximumAge?: number
87
+ }
88
+ ): void
89
+ watchPosition(
90
+ successCallback: (position: GeolocationPosition) => void,
91
+ errorCallback?: (error: GeolocationPositionError) => void,
92
+ options?: {
93
+ enableHighAccuracy?: boolean
94
+ timeout?: number
95
+ maximumAge?: number
96
+ }
97
+ ): number
98
+ clearWatch(watchId: number): void
99
+ }
100
+
101
+ // 媒体设备相关类型
102
+ export interface MediaStream {
103
+ id: string
104
+ active: boolean
105
+ getTracks(): MediaStreamTrack[]
106
+ getVideoTracks(): MediaStreamTrack[]
107
+ getAudioTracks(): MediaStreamTrack[]
108
+ addTrack(track: MediaStreamTrack): void
109
+ removeTrack(track: MediaStreamTrack): void
110
+ addEventListener(type: string, listener: EventListener): void
111
+ removeEventListener(type: string, listener: EventListener): void
112
+ }
113
+
114
+ export interface MediaStreamTrack {
115
+ id: string
116
+ kind: 'audio' | 'video'
117
+ label: string
118
+ enabled: boolean
119
+ muted: boolean
120
+ readyState: 'live' | 'ended'
121
+ stop(): void
122
+ getSettings(): MediaTrackSettings
123
+ getCapabilities(): MediaTrackCapabilities
124
+ addEventListener(type: string, listener: EventListener): void
125
+ removeEventListener(type: string, listener: EventListener): void
126
+ }
127
+
128
+ export interface MediaTrackSettings {
129
+ width?: number
130
+ height?: number
131
+ aspectRatio?: number
132
+ frameRate?: number
133
+ facingMode?: string
134
+ deviceId?: string
135
+ sampleRate?: number
136
+ sampleSize?: number
137
+ echoCancellation?: boolean
138
+ noiseSuppression?: boolean
139
+ autoGainControl?: boolean
140
+ }
141
+
142
+ export interface MediaTrackCapabilities {
143
+ width?: { min: number; max: number }
144
+ height?: { min: number; max: number }
145
+ aspectRatio?: { min: number; max: number }
146
+ frameRate?: { min: number; max: number }
147
+ facingMode?: string[]
148
+ deviceId?: string
149
+ }
150
+
151
+ export interface MediaDevices {
152
+ getUserMedia(constraints?: {
153
+ video?: boolean | { facingMode?: string; width?: number; height?: number }
154
+ audio?: boolean | { echoCancellation?: boolean; noiseSuppression?: boolean }
155
+ }): Promise<MediaStream>
156
+ enumerateDevices(): Promise<MediaDeviceInfo[]>
157
+ getSupportedConstraints(): MediaTrackSupportedConstraints
158
+ addEventListener(type: string, listener: EventListener): void
159
+ removeEventListener(type: string, listener: EventListener): void
160
+ }
161
+
162
+ export interface MediaDeviceInfo {
163
+ deviceId: string
164
+ kind: 'audioinput' | 'audiooutput' | 'videoinput'
165
+ label: string
166
+ groupId: string
167
+ }
168
+
169
+ export interface MediaTrackSupportedConstraints {
170
+ width?: boolean
171
+ height?: boolean
172
+ aspectRatio?: boolean
173
+ frameRate?: boolean
174
+ facingMode?: boolean
175
+ volume?: boolean
176
+ sampleRate?: boolean
177
+ sampleSize?: boolean
178
+ echoCancellation?: boolean
179
+ noiseSuppression?: boolean
180
+ autoGainControl?: boolean
181
+ }
182
+
183
+ export interface MediaStreamConstraints {
184
+ video?: boolean | { facingMode?: string; width?: number; height?: number }
185
+ audio?: boolean | { echoCancellation?: boolean; noiseSuppression?: boolean; autoGainControl?: boolean }
186
+ }
187
+
188
+ // 电池相关类型
189
+ export interface BatteryManager {
190
+ charging: boolean
191
+ chargingTime: number
192
+ dischargingTime: number
193
+ level: number
194
+ addEventListener(type: string, listener: EventListener): void
195
+ removeEventListener(type: string, listener: EventListener): void
196
+ }
197
+
198
+ export interface Navigator {
199
+ getBattery(): Promise<BatteryManager>
200
+ }
201
+
202
+ // 网络相关类型
203
+ export interface NetworkInformation {
204
+ type?: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown'
205
+ effectiveType?: 'slow-2g' | '2g' | '3g' | '4g'
206
+ downlink?: number
207
+ downlinkMax?: number
208
+ rtt?: number
209
+ saveData?: boolean
210
+ addEventListener(type: string, listener: EventListener): void
211
+ removeEventListener(type: string, listener: EventListener): void
212
+ }
213
+
214
+ export interface NavigatorConnection extends Navigator {
215
+ connection?: NetworkInformation
216
+ }
217
+
218
+ // 设备方向相关类型
219
+ export interface DeviceOrientationEvent {
220
+ alpha: number | null
221
+ beta: number | null
222
+ gamma: number | null
223
+ absolute: boolean
224
+ }
225
+
226
+ export interface DeviceMotionEvent {
227
+ acceleration: {
228
+ x: number | null
229
+ y: number | null
230
+ z: number | null
231
+ } | null
232
+ accelerationIncludingGravity: {
233
+ x: number | null
234
+ y: number | null
235
+ z: number | null
236
+ } | null
237
+ rotationRate: {
238
+ alpha: number | null
239
+ beta: number | null
240
+ gamma: number | null
241
+ } | null
242
+ interval: number
243
+ }
244
+
245
+ // 震动相关类型
246
+ export interface NavigatorVibration extends Navigator {
247
+ vibrate(pattern: number | number[]): boolean
248
+ }
249
+
250
+ // 屏幕相关类型
251
+ export interface ScreenOrientation {
252
+ type: 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary'
253
+ angle: number
254
+ lock(orientation: OrientationLockType): Promise<void>
255
+ unlock(): void
256
+ addEventListener(type: string, listener: EventListener): void
257
+ removeEventListener(type: string, listener: EventListener): void
258
+ }
259
+
260
+ export type OrientationLockType =
261
+ | 'any'
262
+ | 'natural'
263
+ | 'landscape'
264
+ | 'portrait'
265
+ | 'portrait-primary'
266
+ | 'portrait-secondary'
267
+ | 'landscape-primary'
268
+ | 'landscape-secondary'
269
+
270
+ export interface Screen {
271
+ orientation?: ScreenOrientation
272
+ }
273
+
274
+ // 游戏手柄相关类型
275
+ export interface GamepadButton {
276
+ pressed: boolean
277
+ touched: boolean
278
+ value: number
279
+ }
280
+
281
+ export interface Gamepad {
282
+ id: string
283
+ index: number
284
+ connected: boolean
285
+ timestamp: number
286
+ mapping: 'standard' | ''
287
+ axes: readonly number[]
288
+ buttons: readonly GamepadButton[]
289
+ hapticActuators?: readonly GamepadHapticActuator[]
290
+ vibrationActuator?: GamepadHapticActuator
291
+ }
292
+
293
+ export interface GamepadHapticActuator {
294
+ type: 'vibration' | 'dual-rumble'
295
+ playEffect(
296
+ type: 'dual-rumble',
297
+ params: {
298
+ duration?: number
299
+ startDelay?: number
300
+ strongMagnitude?: number
301
+ weakMagnitude?: number
302
+ }
303
+ ): Promise<'complete' | 'preempted'>
304
+ reset(): Promise<'complete' | 'preempted'>
305
+ }
306
+
307
+ // Wake Lock 相关类型
308
+ export interface WakeLockSentinel {
309
+ readonly type: 'screen'
310
+ readonly released: boolean
311
+ release(): Promise<void>
312
+ addEventListener(type: 'release', listener: () => void): void
313
+ removeEventListener(type: 'release', listener: () => void): void
314
+ }
315
+
316
+ export interface WakeLock {
317
+ request(type: 'screen'): Promise<WakeLockSentinel>
318
+ }
319
+
320
+ // Media Session 相关类型
321
+ export interface MediaMetadataInit {
322
+ title?: string
323
+ artist?: string
324
+ album?: string
325
+ artwork?: Array<{
326
+ src: string
327
+ sizes?: string
328
+ type?: string
329
+ }>
330
+ }
331
+
332
+ export interface MediaSession {
333
+ metadata: any
334
+ playbackState: 'none' | 'paused' | 'playing'
335
+ setActionHandler(
336
+ action: 'play' | 'pause' | 'stop' | 'seekbackward' | 'seekforward' | 'previoustrack' | 'nexttrack' | 'seekto',
337
+ handler: ((details?: any) => void) | null
338
+ ): void
339
+ }
340
+
@@ -1,8 +1,31 @@
1
1
  // DOM 相关类型声明
2
2
  import type { Blob } from './blob.d'
3
3
 
4
+ // 事件监听器类型
5
+ export type EventListener = (event: Event) => void
6
+
7
+ // 事件监听选项
8
+ export interface AddEventListenerOptions {
9
+ capture?: boolean
10
+ once?: boolean
11
+ passive?: boolean
12
+ }
13
+
14
+ export interface EventListenerOptions {
15
+ capture?: boolean
16
+ }
17
+
18
+ // Node 接口
19
+ export interface Node {
20
+ nodeType: number
21
+ nodeName: string
22
+ parentNode: Node | null
23
+ childNodes: Node[]
24
+ contains(other: Node | null): boolean
25
+ }
26
+
4
27
  // DOM 元素接口 - 按继承关系组织
5
- export interface Element {
28
+ export interface Element extends Node {
6
29
  parentNode?: Element | null
7
30
  }
8
31
 
@@ -17,14 +40,15 @@ export interface HTMLElement extends Element {
17
40
  right: number
18
41
  bottom: number
19
42
  }
20
- addEventListener(event: string, handler: (e: any) => void, options?: any): void
21
- removeEventListener(event: string, handler: (e: any) => void, options?: any): void
43
+ addEventListener(event: string, handler: EventListener, options?: boolean | AddEventListenerOptions): void
44
+ removeEventListener(event: string, handler: EventListener, options?: boolean | EventListenerOptions): void
22
45
  clientWidth: number
23
46
  clientHeight: number
24
47
  offsetLeft: number
25
48
  offsetTop: number
26
49
  offsetWidth: number
27
50
  offsetHeight: number
51
+ contains(other: Node | null): boolean
28
52
  }
29
53
 
30
54
  export interface HTMLImageElement extends HTMLElement {
@@ -69,7 +93,7 @@ export interface HTMLCanvasElement extends HTMLElement {
69
93
  toBlob(callback: (blob: Blob | null) => void, type?: string, quality?: number): void
70
94
  }
71
95
 
72
- export interface Document {
96
+ export interface Document extends Node {
73
97
  createElement(tagName: 'canvas'): HTMLCanvasElement
74
98
  createElement(tagName: 'script'): HTMLScriptElement
75
99
  createElement(tagName: 'link'): HTMLLinkElement
@@ -84,8 +108,9 @@ export interface Document {
84
108
  appendChild(element: HTMLElement): HTMLElement
85
109
  }
86
110
  body: HTMLElement
87
- addEventListener(event: string, handler: (e: any) => void, options?: any): void
88
- removeEventListener(event: string, handler: (e: any) => void, options?: any): void
111
+ cookie: string
112
+ addEventListener(event: string, handler: EventListener, options?: boolean | AddEventListenerOptions): void
113
+ removeEventListener(event: string, handler: EventListener, options?: boolean | EventListenerOptions): void
89
114
  }
90
115
 
91
116
  // DOM 事件相关
@@ -0,0 +1,121 @@
1
+ // EventSource (Server-Sent Events) 类型声明
2
+
3
+ /**
4
+ * EventSource 连接状态
5
+ */
6
+ export enum EventSourceReadyState {
7
+ CONNECTING = 0,
8
+ OPEN = 1,
9
+ CLOSED = 2
10
+ }
11
+
12
+ /**
13
+ * EventSource 事件接口
14
+ */
15
+ export interface EventSourceEventMap {
16
+ open: Event
17
+ message: MessageEvent
18
+ error: Event
19
+ }
20
+
21
+ /**
22
+ * EventSource 消息事件
23
+ */
24
+ export interface MessageEvent extends Event {
25
+ readonly data: string
26
+ readonly lastEventId: string
27
+ readonly origin: string
28
+ }
29
+
30
+ /**
31
+ * EventSource 配置选项
32
+ */
33
+ export interface EventSourceInit {
34
+ withCredentials?: boolean
35
+ }
36
+
37
+ /**
38
+ * EventSource 构造函数类型
39
+ */
40
+ export interface EventSourceConstructor {
41
+ new (url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource
42
+ readonly CONNECTING: 0
43
+ readonly OPEN: 1
44
+ readonly CLOSED: 2
45
+ }
46
+
47
+ /**
48
+ * EventSource 实例接口
49
+ */
50
+ export interface EventSource {
51
+ readonly url: string
52
+ readonly readyState: number
53
+ readonly withCredentials: boolean
54
+
55
+ // 事件监听器
56
+ onopen: ((this: EventSource, ev: Event) => any) | null
57
+ onmessage: ((this: EventSource, ev: MessageEvent) => any) | null
58
+ onerror: ((this: EventSource, ev: Event) => any) | null
59
+
60
+ // 方法
61
+ close(): void
62
+ addEventListener<K extends keyof EventSourceEventMap>(
63
+ type: K,
64
+ listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
65
+ options?: boolean | AddEventListenerOptions
66
+ ): void
67
+ addEventListener(
68
+ type: string,
69
+ listener: (this: EventSource, ev: MessageEvent) => any,
70
+ options?: boolean | AddEventListenerOptions
71
+ ): void
72
+ removeEventListener<K extends keyof EventSourceEventMap>(
73
+ type: K,
74
+ listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
75
+ options?: boolean | EventListenerOptions
76
+ ): void
77
+ removeEventListener(
78
+ type: string,
79
+ listener: (this: EventSource, ev: MessageEvent) => any,
80
+ options?: boolean | EventListenerOptions
81
+ ): void
82
+ }
83
+
84
+ /**
85
+ * 事件监听器选项
86
+ */
87
+ export interface AddEventListenerOptions {
88
+ capture?: boolean
89
+ once?: boolean
90
+ passive?: boolean
91
+ signal?: AbortSignal
92
+ }
93
+
94
+ export interface EventListenerOptions {
95
+ capture?: boolean
96
+ }
97
+
98
+ /**
99
+ * 中止信号
100
+ */
101
+ export interface AbortSignal {
102
+ readonly aborted: boolean
103
+ onabort: ((this: AbortSignal, ev: Event) => any) | null
104
+ }
105
+
106
+ /**
107
+ * 事件基础接口
108
+ */
109
+ export interface Event {
110
+ readonly type: string
111
+ readonly target: any
112
+ readonly currentTarget: any
113
+ readonly bubbles: boolean
114
+ readonly cancelable: boolean
115
+ readonly defaultPrevented: boolean
116
+ readonly timeStamp: number
117
+ preventDefault(): void
118
+ stopPropagation(): void
119
+ stopImmediatePropagation(): void
120
+ }
121
+
@@ -84,6 +84,8 @@ export interface Path {
84
84
  dirname(path: string): string
85
85
  basename(path: string, ext?: string): string
86
86
  extname(path: string): string
87
+ relative(from: string, to: string): string
88
+ normalize(path: string): string
87
89
  sep: string
88
90
  posix: {
89
91
  join(...paths: string[]): string
@@ -62,4 +62,42 @@ export interface TencentCloudSystemDependencies {
62
62
  process: Process
63
63
  console: Console
64
64
  getSecret: (type: string) => TencentCloudSecret
65
+ }
66
+
67
+ // COS 上传进度回调参数
68
+ export interface COSUploadProgressData {
69
+ percent: number
70
+ loaded: number
71
+ total: number
72
+ }
73
+
74
+ // COS 上传文件参数
75
+ export interface COSPutObjectParams {
76
+ Bucket: string
77
+ Region: string
78
+ Key: string
79
+ Body: Buffer | string
80
+ onProgress?: (progressData: COSUploadProgressData) => void
81
+ }
82
+
83
+ // COS 上传结果
84
+ export interface COSPutObjectResult {
85
+ statusCode: number
86
+ headers: Record<string, string>
87
+ }
88
+
89
+ // COS SDK 接口
90
+ export interface COSSDK {
91
+ putObject(params: COSPutObjectParams, callback?: (err: Error | null, data: COSPutObjectResult) => void): void
92
+ }
93
+
94
+ // COS 构造函数参数
95
+ export interface COSConstructorParams {
96
+ SecretId: string
97
+ SecretKey: string
98
+ }
99
+
100
+ // COS 构造函数接口
101
+ export interface COSConstructor {
102
+ new (params: COSConstructorParams): COSSDK
65
103
  }
@@ -0,0 +1,121 @@
1
+ // WebSocket 类型声明
2
+
3
+ /**
4
+ * WebSocket 连接状态
5
+ */
6
+ export enum WebSocketReadyState {
7
+ CONNECTING = 0,
8
+ OPEN = 1,
9
+ CLOSING = 2,
10
+ CLOSED = 3
11
+ }
12
+
13
+ /**
14
+ * WebSocket 事件接口
15
+ */
16
+ export interface WebSocketEventMap {
17
+ close: CloseEvent
18
+ error: Event
19
+ message: MessageEvent
20
+ open: Event
21
+ }
22
+
23
+ /**
24
+ * WebSocket 关闭事件
25
+ */
26
+ export interface CloseEvent extends Event {
27
+ readonly code: number
28
+ readonly reason: string
29
+ readonly wasClean: boolean
30
+ }
31
+
32
+ /**
33
+ * WebSocket 消息事件
34
+ */
35
+ export interface MessageEvent extends Event {
36
+ readonly data: any
37
+ readonly origin: string
38
+ readonly lastEventId: string
39
+ }
40
+
41
+ /**
42
+ * WebSocket 构造函数类型
43
+ */
44
+ export interface WebSocketConstructor {
45
+ new (url: string | URL, protocols?: string | string[]): WebSocket
46
+ readonly CONNECTING: 0
47
+ readonly OPEN: 1
48
+ readonly CLOSING: 2
49
+ readonly CLOSED: 3
50
+ }
51
+
52
+ /**
53
+ * WebSocket 实例接口
54
+ */
55
+ export interface WebSocket {
56
+ readonly url: string
57
+ readonly readyState: number
58
+ readonly bufferedAmount: number
59
+ readonly extensions: string
60
+ readonly protocol: string
61
+ binaryType: 'blob' | 'arraybuffer'
62
+
63
+ // 事件监听器
64
+ onopen: ((this: WebSocket, ev: Event) => any) | null
65
+ onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null
66
+ onerror: ((this: WebSocket, ev: Event) => any) | null
67
+ onclose: ((this: WebSocket, ev: CloseEvent) => any) | null
68
+
69
+ // 方法
70
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void
71
+ close(code?: number, reason?: string): void
72
+ addEventListener<K extends keyof WebSocketEventMap>(
73
+ type: K,
74
+ listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
75
+ options?: boolean | AddEventListenerOptions
76
+ ): void
77
+ removeEventListener<K extends keyof WebSocketEventMap>(
78
+ type: K,
79
+ listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
80
+ options?: boolean | EventListenerOptions
81
+ ): void
82
+ }
83
+
84
+ /**
85
+ * 事件监听器选项
86
+ */
87
+ export interface AddEventListenerOptions {
88
+ capture?: boolean
89
+ once?: boolean
90
+ passive?: boolean
91
+ signal?: AbortSignal
92
+ }
93
+
94
+ export interface EventListenerOptions {
95
+ capture?: boolean
96
+ }
97
+
98
+ /**
99
+ * 中止信号
100
+ */
101
+ export interface AbortSignal {
102
+ readonly aborted: boolean
103
+ onabort: ((this: AbortSignal, ev: Event) => any) | null
104
+ }
105
+
106
+ /**
107
+ * 事件基础接口
108
+ */
109
+ export interface Event {
110
+ readonly type: string
111
+ readonly target: any
112
+ readonly currentTarget: any
113
+ readonly bubbles: boolean
114
+ readonly cancelable: boolean
115
+ readonly defaultPrevented: boolean
116
+ readonly timeStamp: number
117
+ preventDefault(): void
118
+ stopPropagation(): void
119
+ stopImmediatePropagation(): void
120
+ }
121
+