taro-uno-ui 1.0.1 → 1.0.2

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 (414) hide show
  1. package/README.md +67 -30
  2. package/dist/js/{index-CDFsvu80.js → index-QpKiGsEQ.js} +39026 -28023
  3. package/dist/js/index-QpKiGsEQ.js.map +1 -0
  4. package/dist/js/{index-JffnTUrv.js → index-nnTHNhwl.js} +38743 -27720
  5. package/dist/js/index-nnTHNhwl.js.map +1 -0
  6. package/package.json +4 -4
  7. package/dist/js/index-CDFsvu80.js.map +0 -1
  8. package/dist/js/index-DFdcksbe.js +0 -1165
  9. package/dist/js/index-DFdcksbe.js.map +0 -1
  10. package/dist/js/index-DXRIkWX1.js +0 -1148
  11. package/dist/js/index-DXRIkWX1.js.map +0 -1
  12. package/dist/js/index-JffnTUrv.js.map +0 -1
  13. package/dist/utils/http/request.d.ts +0 -280
  14. package/src/app.config.ts +0 -55
  15. package/src/app.scss +0 -508
  16. package/src/app.tsx +0 -44
  17. package/src/components/basic/Button/Button.styles.ts +0 -130
  18. package/src/components/basic/Button/Button.test.tsx +0 -154
  19. package/src/components/basic/Button/Button.tsx +0 -133
  20. package/src/components/basic/Button/Button.types.ts +0 -81
  21. package/src/components/basic/Button/index.tsx +0 -6
  22. package/src/components/basic/Divider/Divider.styles.ts +0 -488
  23. package/src/components/basic/Divider/Divider.test.tsx +0 -551
  24. package/src/components/basic/Divider/Divider.tsx +0 -392
  25. package/src/components/basic/Divider/Divider.types.ts +0 -261
  26. package/src/components/basic/Divider/index.tsx +0 -25
  27. package/src/components/basic/Icon/Icon.data.ts +0 -474
  28. package/src/components/basic/Icon/Icon.styles.ts +0 -359
  29. package/src/components/basic/Icon/Icon.test.tsx +0 -357
  30. package/src/components/basic/Icon/Icon.tsx +0 -167
  31. package/src/components/basic/Icon/Icon.types.ts +0 -210
  32. package/src/components/basic/Icon/IconManager.ts +0 -229
  33. package/src/components/basic/Icon/index.tsx +0 -22
  34. package/src/components/basic/Text/Text.styles.ts +0 -500
  35. package/src/components/basic/Text/Text.test.tsx +0 -299
  36. package/src/components/basic/Text/Text.tsx +0 -340
  37. package/src/components/basic/Text/Text.types.ts +0 -329
  38. package/src/components/basic/Text/index.tsx +0 -27
  39. package/src/components/basic/Typography/Typography.styles.ts +0 -347
  40. package/src/components/basic/Typography/Typography.tsx +0 -207
  41. package/src/components/basic/Typography/Typography.types.ts +0 -296
  42. package/src/components/basic/Typography/index.tsx +0 -14
  43. package/src/components/basic/Video/Video.styles.ts +0 -777
  44. package/src/components/basic/Video/Video.test.tsx +0 -490
  45. package/src/components/basic/Video/Video.tsx +0 -1468
  46. package/src/components/basic/Video/Video.types.ts +0 -500
  47. package/src/components/basic/Video/index.tsx +0 -26
  48. package/src/components/basic/index.tsx +0 -300
  49. package/src/components/common/ErrorBoundary.tsx +0 -87
  50. package/src/components/common/LazyComponent.tsx +0 -247
  51. package/src/components/common/ResponsiveContainer.tsx +0 -93
  52. package/src/components/common/ResponsiveGrid.tsx +0 -183
  53. package/src/components/common/SecurityProvider.tsx +0 -98
  54. package/src/components/common/ThemeProvider.tsx +0 -115
  55. package/src/components/common/VirtualList.tsx +0 -350
  56. package/src/components/common/__tests__/ErrorBoundary.test.tsx +0 -249
  57. package/src/components/common/index.tsx +0 -32
  58. package/src/components/display/Avatar/Avatar.styles.ts +0 -62
  59. package/src/components/display/Avatar/Avatar.test.tsx +0 -390
  60. package/src/components/display/Avatar/Avatar.tsx +0 -66
  61. package/src/components/display/Avatar/Avatar.types.ts +0 -40
  62. package/src/components/display/Avatar/index.ts +0 -3
  63. package/src/components/display/Badge/Badge.tsx +0 -29
  64. package/src/components/display/Badge/Badge.types.ts +0 -29
  65. package/src/components/display/Badge/index.ts +0 -2
  66. package/src/components/display/Calendar/Calendar.styles.ts +0 -255
  67. package/src/components/display/Calendar/Calendar.test.tsx +0 -42
  68. package/src/components/display/Calendar/Calendar.tsx +0 -358
  69. package/src/components/display/Calendar/Calendar.types.ts +0 -91
  70. package/src/components/display/Calendar/index.ts +0 -3
  71. package/src/components/display/Card/Card.styles.ts +0 -89
  72. package/src/components/display/Card/Card.test.tsx +0 -182
  73. package/src/components/display/Card/Card.tsx +0 -135
  74. package/src/components/display/Card/Card.types.ts +0 -55
  75. package/src/components/display/Card/index.ts +0 -3
  76. package/src/components/display/Carousel/Carousel.styles.ts +0 -206
  77. package/src/components/display/Carousel/Carousel.tsx +0 -290
  78. package/src/components/display/Carousel/Carousel.types.ts +0 -57
  79. package/src/components/display/Carousel/index.ts +0 -3
  80. package/src/components/display/List/List.styles.ts +0 -79
  81. package/src/components/display/List/List.tsx +0 -114
  82. package/src/components/display/List/List.types.ts +0 -68
  83. package/src/components/display/List/index.ts +0 -3
  84. package/src/components/display/Rate/Rate.styles.ts +0 -254
  85. package/src/components/display/Rate/Rate.tsx +0 -324
  86. package/src/components/display/Rate/Rate.types.ts +0 -112
  87. package/src/components/display/Rate/index.ts +0 -20
  88. package/src/components/display/Table/Table.styles.ts +0 -269
  89. package/src/components/display/Table/Table.test.tsx +0 -345
  90. package/src/components/display/Table/Table.tsx +0 -426
  91. package/src/components/display/Table/Table.types.ts +0 -256
  92. package/src/components/display/Table/index.tsx +0 -16
  93. package/src/components/display/Tag/Tag.styles.ts +0 -197
  94. package/src/components/display/Tag/Tag.test.tsx +0 -541
  95. package/src/components/display/Tag/Tag.tsx +0 -139
  96. package/src/components/display/Tag/Tag.types.ts +0 -49
  97. package/src/components/display/Tag/index.ts +0 -3
  98. package/src/components/display/Timeline/Timeline.styles.ts +0 -211
  99. package/src/components/display/Timeline/Timeline.tsx +0 -220
  100. package/src/components/display/Timeline/Timeline.types.ts +0 -56
  101. package/src/components/display/Timeline/index.ts +0 -3
  102. package/src/components/display/index.tsx +0 -147
  103. package/src/components/feedback/Loading/Loading.styles.ts +0 -117
  104. package/src/components/feedback/Loading/Loading.test.tsx +0 -534
  105. package/src/components/feedback/Loading/Loading.tsx +0 -132
  106. package/src/components/feedback/Loading/Loading.types.ts +0 -33
  107. package/src/components/feedback/Loading/index.ts +0 -6
  108. package/src/components/feedback/Message/Message.styles.ts +0 -41
  109. package/src/components/feedback/Message/Message.test.tsx +0 -234
  110. package/src/components/feedback/Message/Message.tsx +0 -96
  111. package/src/components/feedback/Message/Message.types.ts +0 -37
  112. package/src/components/feedback/Message/index.ts +0 -6
  113. package/src/components/feedback/Modal/Modal.styles.ts +0 -21
  114. package/src/components/feedback/Modal/Modal.test.tsx +0 -11
  115. package/src/components/feedback/Modal/Modal.tsx +0 -269
  116. package/src/components/feedback/Modal/Modal.types.ts +0 -151
  117. package/src/components/feedback/Modal/index.tsx +0 -11
  118. package/src/components/feedback/Notification/Notification.styles.ts +0 -453
  119. package/src/components/feedback/Notification/Notification.test.tsx +0 -401
  120. package/src/components/feedback/Notification/Notification.tsx +0 -347
  121. package/src/components/feedback/Notification/Notification.types.ts +0 -339
  122. package/src/components/feedback/Notification/NotificationManager.tsx +0 -405
  123. package/src/components/feedback/Notification/index.ts +0 -40
  124. package/src/components/feedback/Notification/index.tsx +0 -154
  125. package/src/components/feedback/Progress/Progress.styles.ts +0 -469
  126. package/src/components/feedback/Progress/Progress.test.simple.tsx +0 -14
  127. package/src/components/feedback/Progress/Progress.test.tsx +0 -312
  128. package/src/components/feedback/Progress/Progress.tsx +0 -488
  129. package/src/components/feedback/Progress/Progress.types.ts +0 -163
  130. package/src/components/feedback/Progress/index.ts +0 -3
  131. package/src/components/feedback/Progress/index.tsx +0 -38
  132. package/src/components/feedback/Progress/utils/animation.ts +0 -193
  133. package/src/components/feedback/Progress/utils/index.ts +0 -26
  134. package/src/components/feedback/Progress/utils/progress-calculator.ts +0 -199
  135. package/src/components/feedback/Result/Result.styles.ts +0 -139
  136. package/src/components/feedback/Result/Result.tsx +0 -221
  137. package/src/components/feedback/Result/Result.types.ts +0 -128
  138. package/src/components/feedback/Result/index.tsx +0 -3
  139. package/src/components/feedback/Toast/Toast.styles.ts +0 -17
  140. package/src/components/feedback/Toast/Toast.test.tsx +0 -10
  141. package/src/components/feedback/Toast/Toast.tsx +0 -384
  142. package/src/components/feedback/Toast/Toast.types.ts +0 -86
  143. package/src/components/feedback/Toast/index.tsx +0 -3
  144. package/src/components/feedback/Tooltip/Tooltip.examples.tsx +0 -435
  145. package/src/components/feedback/Tooltip/Tooltip.styles.ts +0 -340
  146. package/src/components/feedback/Tooltip/Tooltip.test.tsx +0 -446
  147. package/src/components/feedback/Tooltip/Tooltip.tsx +0 -302
  148. package/src/components/feedback/Tooltip/Tooltip.types.ts +0 -166
  149. package/src/components/feedback/Tooltip/index.ts +0 -3
  150. package/src/components/feedback/Tooltip/index.tsx +0 -246
  151. package/src/components/feedback/index.tsx +0 -176
  152. package/src/components/form/Cascader/Cascader.styles.ts +0 -526
  153. package/src/components/form/Cascader/Cascader.test.tsx +0 -77
  154. package/src/components/form/Cascader/Cascader.tsx +0 -581
  155. package/src/components/form/Cascader/Cascader.types.ts +0 -581
  156. package/src/components/form/Cascader/hooks/index.ts +0 -3
  157. package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +0 -19
  158. package/src/components/form/Cascader/hooks/useCascaderOptions.ts +0 -127
  159. package/src/components/form/Cascader/hooks/useCascaderState.ts +0 -139
  160. package/src/components/form/Cascader/index.ts +0 -25
  161. package/src/components/form/Cascader/utils/formatDisplayValue.ts +0 -19
  162. package/src/components/form/Cascader/utils/index.ts +0 -1
  163. package/src/components/form/Checkbox/Checkbox.styles.ts +0 -607
  164. package/src/components/form/Checkbox/Checkbox.test.tsx +0 -1140
  165. package/src/components/form/Checkbox/Checkbox.tsx +0 -489
  166. package/src/components/form/Checkbox/Checkbox.types.ts +0 -472
  167. package/src/components/form/Checkbox/CheckboxGroup.tsx +0 -444
  168. package/src/components/form/Checkbox/index.tsx +0 -27
  169. package/src/components/form/DatePicker/DatePicker.styles.ts +0 -393
  170. package/src/components/form/DatePicker/DatePicker.test.tsx +0 -407
  171. package/src/components/form/DatePicker/DatePicker.tsx +0 -376
  172. package/src/components/form/DatePicker/DatePicker.types.ts +0 -250
  173. package/src/components/form/DatePicker/index.tsx +0 -15
  174. package/src/components/form/Form/Form.styles.ts +0 -357
  175. package/src/components/form/Form/Form.test.tsx +0 -122
  176. package/src/components/form/Form/Form.tsx +0 -257
  177. package/src/components/form/Form/Form.types.ts +0 -422
  178. package/src/components/form/Form/index.tsx +0 -31
  179. package/src/components/form/Form/useFormLogic.ts +0 -497
  180. package/src/components/form/Input/Input.styles.ts +0 -445
  181. package/src/components/form/Input/Input.test.tsx +0 -494
  182. package/src/components/form/Input/Input.tsx +0 -305
  183. package/src/components/form/Input/Input.types.ts +0 -297
  184. package/src/components/form/Input/index.tsx +0 -26
  185. package/src/components/form/Input/useInputLogic.test.ts +0 -82
  186. package/src/components/form/Input/useInputLogic.ts +0 -260
  187. package/src/components/form/InputNumber/InputNumber.styles.ts +0 -716
  188. package/src/components/form/InputNumber/InputNumber.tsx +0 -402
  189. package/src/components/form/InputNumber/InputNumber.types.ts +0 -336
  190. package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +0 -24
  191. package/src/components/form/InputNumber/components/InputNumberControls.tsx +0 -33
  192. package/src/components/form/InputNumber/components/index.ts +0 -2
  193. package/src/components/form/InputNumber/hooks/index.ts +0 -4
  194. package/src/components/form/InputNumber/hooks/useInputNumberState.ts +0 -313
  195. package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +0 -148
  196. package/src/components/form/InputNumber/index.ts +0 -25
  197. package/src/components/form/Radio/Radio.styles.ts +0 -451
  198. package/src/components/form/Radio/Radio.test.tsx +0 -547
  199. package/src/components/form/Radio/Radio.tsx +0 -277
  200. package/src/components/form/Radio/Radio.types.ts +0 -414
  201. package/src/components/form/Radio/index.tsx +0 -21
  202. package/src/components/form/Select/Select.styles.ts +0 -518
  203. package/src/components/form/Select/Select.test.tsx +0 -648
  204. package/src/components/form/Select/Select.tsx +0 -474
  205. package/src/components/form/Select/Select.types.ts +0 -429
  206. package/src/components/form/Select/index.tsx +0 -30
  207. package/src/components/form/Slider/Slider.styles.ts +0 -139
  208. package/src/components/form/Slider/Slider.test.tsx +0 -553
  209. package/src/components/form/Slider/Slider.tsx +0 -312
  210. package/src/components/form/Slider/Slider.types.ts +0 -110
  211. package/src/components/form/Slider/index.tsx +0 -3
  212. package/src/components/form/Switch/Switch.styles.ts +0 -534
  213. package/src/components/form/Switch/Switch.test.tsx +0 -345
  214. package/src/components/form/Switch/Switch.tsx +0 -458
  215. package/src/components/form/Switch/Switch.types.ts +0 -386
  216. package/src/components/form/Switch/index.tsx +0 -26
  217. package/src/components/form/Textarea/Textarea.styles.ts +0 -592
  218. package/src/components/form/Textarea/Textarea.test.tsx +0 -1075
  219. package/src/components/form/Textarea/Textarea.tsx +0 -608
  220. package/src/components/form/Textarea/Textarea.types.ts +0 -374
  221. package/src/components/form/Textarea/index.tsx +0 -26
  222. package/src/components/form/TimePicker/TimePicker.styles.ts +0 -434
  223. package/src/components/form/TimePicker/TimePicker.test.tsx +0 -306
  224. package/src/components/form/TimePicker/TimePicker.tsx +0 -250
  225. package/src/components/form/TimePicker/TimePicker.types.ts +0 -385
  226. package/src/components/form/TimePicker/index.ts +0 -21
  227. package/src/components/form/Transfer/Transfer.styles.ts +0 -490
  228. package/src/components/form/Transfer/Transfer.test.tsx +0 -316
  229. package/src/components/form/Transfer/Transfer.tsx +0 -414
  230. package/src/components/form/Transfer/Transfer.types.ts +0 -565
  231. package/src/components/form/Transfer/components/TransferItem.tsx +0 -94
  232. package/src/components/form/Transfer/components/TransferList.tsx +0 -298
  233. package/src/components/form/Transfer/components/TransferOperations.tsx +0 -81
  234. package/src/components/form/Transfer/components/TransferPagination.tsx +0 -139
  235. package/src/components/form/Transfer/components/TransferSearch.tsx +0 -85
  236. package/src/components/form/Transfer/components/index.ts +0 -6
  237. package/src/components/form/Transfer/hooks/index.ts +0 -3
  238. package/src/components/form/Transfer/hooks/useTransferData.ts +0 -202
  239. package/src/components/form/Transfer/hooks/useTransferState.ts +0 -120
  240. package/src/components/form/Transfer/index.ts +0 -27
  241. package/src/components/form/Upload/Upload.styles.ts +0 -145
  242. package/src/components/form/Upload/Upload.test.tsx +0 -10
  243. package/src/components/form/Upload/Upload.tsx +0 -498
  244. package/src/components/form/Upload/Upload.types.ts +0 -200
  245. package/src/components/form/Upload/index.tsx +0 -12
  246. package/src/components/form/index.tsx +0 -152
  247. package/src/components/index.tsx +0 -145
  248. package/src/components/layout/Affix/Affix.styles.ts +0 -42
  249. package/src/components/layout/Affix/Affix.test.tsx +0 -10
  250. package/src/components/layout/Affix/Affix.tsx +0 -83
  251. package/src/components/layout/Affix/Affix.types.ts +0 -29
  252. package/src/components/layout/Affix/index.tsx +0 -3
  253. package/src/components/layout/Col/Col.styles.ts +0 -185
  254. package/src/components/layout/Col/Col.test.tsx +0 -537
  255. package/src/components/layout/Col/Col.tsx +0 -97
  256. package/src/components/layout/Col/Col.types.ts +0 -59
  257. package/src/components/layout/Col/index.tsx +0 -3
  258. package/src/components/layout/Container/Container.styles.ts +0 -163
  259. package/src/components/layout/Container/Container.test.tsx +0 -380
  260. package/src/components/layout/Container/Container.tsx +0 -123
  261. package/src/components/layout/Container/Container.types.ts +0 -63
  262. package/src/components/layout/Container/index.tsx +0 -3
  263. package/src/components/layout/Grid/Grid.styles.ts +0 -183
  264. package/src/components/layout/Grid/Grid.test.tsx +0 -637
  265. package/src/components/layout/Grid/Grid.tsx +0 -123
  266. package/src/components/layout/Grid/Grid.types.ts +0 -78
  267. package/src/components/layout/Grid/index.tsx +0 -3
  268. package/src/components/layout/Layout/Content.tsx +0 -30
  269. package/src/components/layout/Layout/Footer.tsx +0 -30
  270. package/src/components/layout/Layout/Header.tsx +0 -30
  271. package/src/components/layout/Layout/Layout.styles.ts +0 -84
  272. package/src/components/layout/Layout/Layout.test.tsx +0 -10
  273. package/src/components/layout/Layout/Layout.tsx +0 -28
  274. package/src/components/layout/Layout/Layout.types.ts +0 -58
  275. package/src/components/layout/Layout/Sider.tsx +0 -44
  276. package/src/components/layout/Layout/index.tsx +0 -22
  277. package/src/components/layout/Row/Row.styles.ts +0 -159
  278. package/src/components/layout/Row/Row.test.tsx +0 -467
  279. package/src/components/layout/Row/Row.tsx +0 -111
  280. package/src/components/layout/Row/Row.types.ts +0 -60
  281. package/src/components/layout/Row/index.tsx +0 -3
  282. package/src/components/layout/Space/Space.styles.ts +0 -255
  283. package/src/components/layout/Space/Space.test.tsx +0 -682
  284. package/src/components/layout/Space/Space.tsx +0 -203
  285. package/src/components/layout/Space/Space.types.ts +0 -92
  286. package/src/components/layout/Space/index.tsx +0 -12
  287. package/src/components/layout/index.tsx +0 -78
  288. package/src/components/navigation/Menu/Menu.constants.ts +0 -69
  289. package/src/components/navigation/Menu/Menu.stories.tsx +0 -107
  290. package/src/components/navigation/Menu/Menu.styles.ts +0 -767
  291. package/src/components/navigation/Menu/Menu.tsx +0 -352
  292. package/src/components/navigation/Menu/Menu.types.ts +0 -231
  293. package/src/components/navigation/Menu/Menu.utils.ts +0 -187
  294. package/src/components/navigation/Menu/MenuItem.tsx +0 -124
  295. package/src/components/navigation/Menu/SubMenu.tsx +0 -150
  296. package/src/components/navigation/Menu/index.tsx +0 -59
  297. package/src/components/navigation/NavBar/NavBar.styles.ts +0 -129
  298. package/src/components/navigation/NavBar/NavBar.test.tsx +0 -287
  299. package/src/components/navigation/NavBar/NavBar.tsx +0 -228
  300. package/src/components/navigation/NavBar/NavBar.types.ts +0 -54
  301. package/src/components/navigation/NavBar/index.tsx +0 -3
  302. package/src/components/navigation/Pagination/Pagination.styles.ts +0 -187
  303. package/src/components/navigation/Pagination/Pagination.test.tsx +0 -672
  304. package/src/components/navigation/Pagination/Pagination.tsx +0 -395
  305. package/src/components/navigation/Pagination/Pagination.types.ts +0 -87
  306. package/src/components/navigation/Pagination/index.ts +0 -24
  307. package/src/components/navigation/Pagination/index.tsx +0 -9
  308. package/src/components/navigation/Steps/Step.tsx +0 -36
  309. package/src/components/navigation/Steps/Steps.styles.ts +0 -169
  310. package/src/components/navigation/Steps/Steps.test.tsx +0 -14
  311. package/src/components/navigation/Steps/Steps.tsx +0 -112
  312. package/src/components/navigation/Steps/Steps.types.ts +0 -47
  313. package/src/components/navigation/Steps/index.tsx +0 -3
  314. package/src/components/navigation/Tabs/Tabs.styles.ts +0 -199
  315. package/src/components/navigation/Tabs/Tabs.test.tsx +0 -662
  316. package/src/components/navigation/Tabs/Tabs.tsx +0 -253
  317. package/src/components/navigation/Tabs/Tabs.types.ts +0 -115
  318. package/src/components/navigation/Tabs/index.tsx +0 -3
  319. package/src/components/navigation/index.tsx +0 -88
  320. package/src/constants/index.ts +0 -785
  321. package/src/hooks/index.ts +0 -60
  322. package/src/hooks/types.ts +0 -9
  323. package/src/hooks/useAsync.ts +0 -64
  324. package/src/hooks/useClickOutside.ts +0 -52
  325. package/src/hooks/useCounter.ts +0 -87
  326. package/src/hooks/useDebounce.ts +0 -150
  327. package/src/hooks/useDeepCompareEffect.ts +0 -88
  328. package/src/hooks/useEventHandling.ts +0 -444
  329. package/src/hooks/useEventListener.ts +0 -77
  330. package/src/hooks/useLifecycle.ts +0 -399
  331. package/src/hooks/useMediaQuery.ts +0 -75
  332. package/src/hooks/useMutation.ts +0 -233
  333. package/src/hooks/usePerformance.ts +0 -378
  334. package/src/hooks/usePerformanceMonitor.ts +0 -348
  335. package/src/hooks/usePlatform.ts +0 -64
  336. package/src/hooks/usePrevious.ts +0 -25
  337. package/src/hooks/useRequest.test.ts +0 -11
  338. package/src/hooks/useRequest.ts +0 -140
  339. package/src/hooks/useStateManagement.ts +0 -300
  340. package/src/hooks/useStorage.ts +0 -169
  341. package/src/hooks/useStyle.ts +0 -543
  342. package/src/hooks/useTheme.ts +0 -347
  343. package/src/hooks/useToggle.ts +0 -54
  344. package/src/hooks/useVirtualScroll.ts +0 -331
  345. package/src/index.ts +0 -323
  346. package/src/platform/index.ts +0 -1188
  347. package/src/providers/AppProvider.test.tsx +0 -63
  348. package/src/providers/AppProvider.tsx +0 -155
  349. package/src/providers/index.ts +0 -1
  350. package/src/theme/ThemeProvider.tsx +0 -279
  351. package/src/theme/ThemeProvider.types.ts +0 -26
  352. package/src/theme/animations.tsx +0 -660
  353. package/src/theme/defaults.ts +0 -188
  354. package/src/theme/design-system.ts +0 -562
  355. package/src/theme/design-tokens.ts +0 -1122
  356. package/src/theme/generated/dark-theme.scss +0 -120
  357. package/src/theme/generated/tokens.css +0 -441
  358. package/src/theme/generated/tokens.scss +0 -384
  359. package/src/theme/index.ts +0 -99
  360. package/src/theme/responsive.tsx +0 -195
  361. package/src/theme/styles/mixins.scss +0 -612
  362. package/src/theme/styles/variables.scss +0 -295
  363. package/src/theme/styles.ts +0 -403
  364. package/src/theme/tokens/colors.ts +0 -256
  365. package/src/theme/tokens/effects.ts +0 -260
  366. package/src/theme/tokens/index.ts +0 -217
  367. package/src/theme/tokens/spacing.ts +0 -137
  368. package/src/theme/tokens/typography.ts +0 -186
  369. package/src/theme/types.ts +0 -188
  370. package/src/theme/useThemeUtils.ts +0 -313
  371. package/src/theme/utils.ts +0 -501
  372. package/src/theme/variables.ts +0 -602
  373. package/src/types/accessibility.ts +0 -50
  374. package/src/types/button.ts +0 -560
  375. package/src/types/component-props.ts +0 -322
  376. package/src/types/env.d.ts +0 -20
  377. package/src/types/glob.d.ts +0 -4
  378. package/src/types/index.ts +0 -427
  379. package/src/types/modules.d.ts +0 -40
  380. package/src/types/standardized-components.ts +0 -550
  381. package/src/types/taro-adapter.d.ts +0 -174
  382. package/src/types/taro-components.d.ts +0 -73
  383. package/src/types/utils.ts +0 -400
  384. package/src/utils/__tests__/inputValidator.test.ts +0 -338
  385. package/src/utils/__tests__/responsiveUtils.test.ts +0 -311
  386. package/src/utils/__tests__/xssProtection.test.ts +0 -268
  387. package/src/utils/abort-controller.ts +0 -48
  388. package/src/utils/cache.ts +0 -79
  389. package/src/utils/createNamespace.ts +0 -24
  390. package/src/utils/environment.ts +0 -115
  391. package/src/utils/error-handler.ts +0 -88
  392. package/src/utils/errorLogger.ts +0 -193
  393. package/src/utils/formatUtils.ts +0 -412
  394. package/src/utils/http/error-codes.ts +0 -314
  395. package/src/utils/http/http-client.test.ts +0 -63
  396. package/src/utils/http/http-client.ts +0 -161
  397. package/src/utils/http/request-cache.ts +0 -127
  398. package/src/utils/http/request.ts +0 -954
  399. package/src/utils/http/taro-adapter.test.ts +0 -74
  400. package/src/utils/http/taro-adapter.ts +0 -24
  401. package/src/utils/http/types.ts +0 -414
  402. package/src/utils/http/web-adapter.ts +0 -33
  403. package/src/utils/index.ts +0 -112
  404. package/src/utils/inputValidator.ts +0 -264
  405. package/src/utils/performance/performance.ts +0 -839
  406. package/src/utils/responsiveUtils.ts +0 -348
  407. package/src/utils/rtl-support.ts +0 -354
  408. package/src/utils/security/api-security.ts +0 -394
  409. package/src/utils/security/xss-protection.ts +0 -69
  410. package/src/utils/securityHeaders.ts +0 -308
  411. package/src/utils/typeHelpers.ts +0 -16
  412. package/src/utils/types/dataProcessing.ts +0 -544
  413. package/src/utils/types/typeHelpers.ts +0 -197
  414. package/src/utils/xssProtection.ts +0 -468
@@ -1,1148 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import * as Taro from "@tarojs/taro";
5
- const PLATFORM_NAMES = {
6
- weapp: "微信小程序",
7
- alipay: "支付宝小程序",
8
- swan: "百度小程序",
9
- tt: "字节跳动小程序",
10
- qq: "QQ小程序",
11
- h5: "H5",
12
- rn: "React Native",
13
- jd: "京东小程序"
14
- };
15
- const PLATFORM_FEATURES = {
16
- weapp: {
17
- supportsStorage: true,
18
- supportsNetwork: true,
19
- supportsLocation: true,
20
- supportsCamera: true,
21
- supportsPayment: true,
22
- supportsShare: true,
23
- supportsBiometrics: true
24
- },
25
- alipay: {
26
- supportsStorage: true,
27
- supportsNetwork: true,
28
- supportsLocation: true,
29
- supportsCamera: true,
30
- supportsPayment: true,
31
- supportsShare: true,
32
- supportsBiometrics: true
33
- },
34
- swan: {
35
- supportsStorage: true,
36
- supportsNetwork: true,
37
- supportsLocation: true,
38
- supportsCamera: true,
39
- supportsPayment: true,
40
- supportsShare: true,
41
- supportsBiometrics: false
42
- },
43
- tt: {
44
- supportsStorage: true,
45
- supportsNetwork: true,
46
- supportsLocation: true,
47
- supportsCamera: true,
48
- supportsPayment: true,
49
- supportsShare: true,
50
- supportsBiometrics: false
51
- },
52
- qq: {
53
- supportsStorage: true,
54
- supportsNetwork: true,
55
- supportsLocation: true,
56
- supportsCamera: true,
57
- supportsPayment: true,
58
- supportsShare: true,
59
- supportsBiometrics: false
60
- },
61
- h5: {
62
- supportsStorage: true,
63
- supportsNetwork: true,
64
- supportsLocation: true,
65
- supportsCamera: true,
66
- supportsPayment: true,
67
- supportsShare: true,
68
- supportsBiometrics: false
69
- },
70
- rn: {
71
- supportsStorage: true,
72
- supportsNetwork: true,
73
- supportsLocation: true,
74
- supportsCamera: true,
75
- supportsPayment: true,
76
- supportsShare: true,
77
- supportsBiometrics: true
78
- },
79
- jd: {
80
- supportsStorage: true,
81
- supportsNetwork: true,
82
- supportsLocation: true,
83
- supportsCamera: true,
84
- supportsPayment: true,
85
- supportsShare: true,
86
- supportsBiometrics: false
87
- }
88
- };
89
- const PLATFORM_APIS = {
90
- weapp: {
91
- request: "wx.request",
92
- storage: {
93
- set: "wx.setStorage",
94
- get: "wx.getStorage",
95
- remove: "wx.removeStorage",
96
- clear: "wx.clearStorage"
97
- },
98
- location: {
99
- get: "wx.getLocation",
100
- open: "wx.openLocation"
101
- },
102
- camera: {
103
- take: "wx.cameraTake",
104
- choose: "wx.chooseImage"
105
- }
106
- },
107
- alipay: {
108
- request: "my.request",
109
- storage: {
110
- set: "my.setStorage",
111
- get: "my.getStorage",
112
- remove: "my.removeStorage",
113
- clear: "my.clearStorage"
114
- },
115
- location: {
116
- get: "my.getLocation",
117
- open: "my.openLocation"
118
- },
119
- camera: {
120
- take: "my.cameraTake",
121
- choose: "my.chooseImage"
122
- }
123
- },
124
- swan: {
125
- request: "swan.request",
126
- storage: {
127
- set: "swan.setStorage",
128
- get: "swan.getStorage",
129
- remove: "swan.removeStorage",
130
- clear: "swan.clearStorage"
131
- },
132
- location: {
133
- get: "swan.getLocation",
134
- open: "swan.openLocation"
135
- },
136
- camera: {
137
- take: "swan.cameraTake",
138
- choose: "swan.chooseImage"
139
- }
140
- },
141
- tt: {
142
- request: "tt.request",
143
- storage: {
144
- set: "tt.setStorage",
145
- get: "tt.getStorage",
146
- remove: "tt.removeStorage",
147
- clear: "tt.clearStorage"
148
- },
149
- location: {
150
- get: "tt.getLocation",
151
- open: "tt.openLocation"
152
- },
153
- camera: {
154
- take: "tt.cameraTake",
155
- choose: "tt.chooseImage"
156
- }
157
- },
158
- qq: {
159
- request: "qq.request",
160
- storage: {
161
- set: "qq.setStorage",
162
- get: "qq.getStorage",
163
- remove: "qq.removeStorage",
164
- clear: "qq.clearStorage"
165
- },
166
- location: {
167
- get: "qq.getLocation",
168
- open: "qq.openLocation"
169
- },
170
- camera: {
171
- take: "qq.cameraTake",
172
- choose: "qq.chooseImage"
173
- }
174
- },
175
- h5: {
176
- request: "fetch",
177
- storage: {
178
- set: "localStorage.setItem",
179
- get: "localStorage.getItem",
180
- remove: "localStorage.removeItem",
181
- clear: "localStorage.clear"
182
- },
183
- location: {
184
- get: "navigator.geolocation.getCurrentPosition",
185
- open: "window.open"
186
- },
187
- camera: {
188
- take: "navigator.mediaDevices.getUserMedia",
189
- choose: "input[type=file].click()"
190
- }
191
- },
192
- rn: {
193
- request: "fetch",
194
- storage: {
195
- set: "AsyncStorage.setItem",
196
- get: "AsyncStorage.getItem",
197
- remove: "AsyncStorage.removeItem",
198
- clear: "AsyncStorage.clear"
199
- },
200
- location: {
201
- get: "Geolocation.getCurrentPosition",
202
- open: "Linking.openURL"
203
- },
204
- camera: {
205
- take: "Camera.takePictureAsync",
206
- choose: "ImagePicker.launchImageLibrary"
207
- }
208
- },
209
- jd: {
210
- request: "jd.request",
211
- storage: {
212
- set: "jd.setStorage",
213
- get: "jd.getStorage",
214
- remove: "jd.removeStorage",
215
- clear: "jd.clearStorage"
216
- },
217
- location: {
218
- get: "jd.getLocation",
219
- open: "jd.openLocation"
220
- },
221
- camera: {
222
- take: "jd.cameraTake",
223
- choose: "jd.chooseImage"
224
- }
225
- }
226
- };
227
- class WeappAdapter {
228
- constructor() {
229
- __publicField(this, "storage", {
230
- async set(key, value) {
231
- return new Promise((resolve, reject) => {
232
- Taro.setStorage({
233
- key,
234
- data: value,
235
- success: () => resolve(),
236
- fail: reject
237
- });
238
- });
239
- },
240
- async get(key) {
241
- return new Promise((resolve, reject) => {
242
- Taro.getStorage({
243
- key,
244
- success: (res) => resolve(res.data),
245
- fail: reject
246
- });
247
- });
248
- },
249
- async remove(key) {
250
- return new Promise((resolve, reject) => {
251
- Taro.removeStorage({
252
- key,
253
- success: () => resolve(),
254
- fail: reject
255
- });
256
- });
257
- },
258
- async clear() {
259
- return new Promise((resolve, reject) => {
260
- Taro.clearStorage({
261
- success: () => resolve(),
262
- fail: reject
263
- });
264
- });
265
- },
266
- async getInfo() {
267
- return new Promise((resolve, reject) => {
268
- Taro.getStorageInfo({
269
- success: (res) => resolve({
270
- currentSize: res.currentSize,
271
- limitSize: res.limitSize
272
- }),
273
- fail: reject
274
- });
275
- });
276
- }
277
- });
278
- __publicField(this, "location", {
279
- async getCurrentPosition() {
280
- return new Promise((resolve, reject) => {
281
- Taro.getLocation({
282
- success: resolve,
283
- fail: reject
284
- });
285
- });
286
- },
287
- async openLocation(options) {
288
- return new Promise((resolve, reject) => {
289
- Taro.openLocation({
290
- ...options,
291
- success: () => resolve(),
292
- fail: reject
293
- });
294
- });
295
- },
296
- async chooseLocation() {
297
- return new Promise((resolve, reject) => {
298
- Taro.chooseLocation({
299
- success: resolve,
300
- fail: reject
301
- });
302
- });
303
- }
304
- });
305
- __publicField(this, "camera", {
306
- async takePhoto(options) {
307
- return new Promise((resolve, reject) => {
308
- Taro.cameraTakePhoto({
309
- ...options,
310
- success: resolve,
311
- fail: reject
312
- });
313
- });
314
- },
315
- async chooseImage(options) {
316
- return new Promise((resolve, reject) => {
317
- Taro.chooseImage({
318
- ...options,
319
- success: resolve,
320
- fail: reject
321
- });
322
- });
323
- },
324
- async chooseVideo(options) {
325
- return new Promise((resolve, reject) => {
326
- Taro.chooseVideo({
327
- ...options,
328
- success: resolve,
329
- fail: reject
330
- });
331
- });
332
- }
333
- });
334
- __publicField(this, "payment", {
335
- async requestPayment(options) {
336
- return new Promise((resolve, reject) => {
337
- Taro.requestPayment({
338
- ...options,
339
- success: () => resolve(),
340
- fail: reject
341
- });
342
- });
343
- }
344
- });
345
- __publicField(this, "share", {
346
- async shareAppMessage(options) {
347
- return new Promise((resolve, reject) => {
348
- Taro.shareAppMessage({
349
- ...options,
350
- success: () => resolve(),
351
- fail: reject
352
- });
353
- });
354
- },
355
- async shareToTimeline(options) {
356
- return new Promise((resolve, reject) => {
357
- Taro.shareToTimeline({
358
- ...options,
359
- success: () => resolve(),
360
- fail: reject
361
- });
362
- });
363
- }
364
- });
365
- __publicField(this, "biometrics", {
366
- async checkIsAvailable() {
367
- return new Promise((resolve) => {
368
- Taro.checkIsSoterEnrolledInDevice({
369
- checkAuthMode: "fingerPrint",
370
- success: (res) => resolve(res.isEnrolled),
371
- fail: () => resolve(false)
372
- });
373
- });
374
- },
375
- async startVerify(options) {
376
- return new Promise((resolve, reject) => {
377
- Taro.startSoterAuthentication({
378
- ...options,
379
- success: resolve,
380
- fail: reject
381
- });
382
- });
383
- }
384
- });
385
- __publicField(this, "system", {
386
- async getSystemInfo() {
387
- return Promise.resolve(Taro.getSystemInfoSync());
388
- },
389
- async getNetworkType() {
390
- return new Promise((resolve, reject) => {
391
- Taro.getNetworkType({
392
- success: resolve,
393
- fail: reject
394
- });
395
- });
396
- },
397
- async getBatteryInfo() {
398
- return new Promise((resolve, reject) => {
399
- Taro.getBatteryInfo({
400
- success: resolve,
401
- fail: reject
402
- });
403
- });
404
- },
405
- async getScreenBrightness() {
406
- return new Promise((resolve, reject) => {
407
- Taro.getScreenBrightness({
408
- success: (res) => resolve(res.value),
409
- fail: reject
410
- });
411
- });
412
- },
413
- async setScreenBrightness(value) {
414
- return new Promise((resolve, reject) => {
415
- Taro.setScreenBrightness({
416
- value,
417
- success: () => resolve(),
418
- fail: reject
419
- });
420
- });
421
- },
422
- async keepScreenOn(keepScreenOn) {
423
- return new Promise((resolve, reject) => {
424
- Taro.setKeepScreenOn({
425
- keepScreenOn,
426
- success: () => resolve(),
427
- fail: reject
428
- });
429
- });
430
- },
431
- async vibrate() {
432
- return new Promise((resolve, reject) => {
433
- Taro.vibrate({
434
- success: () => resolve(),
435
- fail: reject
436
- });
437
- });
438
- }
439
- });
440
- __publicField(this, "clipboard", {
441
- async set(text) {
442
- return new Promise((resolve, reject) => {
443
- Taro.setClipboardData({
444
- data: text,
445
- success: () => resolve(),
446
- fail: reject
447
- });
448
- });
449
- },
450
- async get() {
451
- return new Promise((resolve, reject) => {
452
- Taro.getClipboardData({
453
- success: (res) => resolve(res.data),
454
- fail: reject
455
- });
456
- });
457
- }
458
- });
459
- __publicField(this, "scan", {
460
- async scanCode(options) {
461
- return new Promise((resolve, reject) => {
462
- Taro.scanCode({
463
- ...options,
464
- success: resolve,
465
- fail: reject
466
- });
467
- });
468
- }
469
- });
470
- __publicField(this, "file", {
471
- async saveFile(options) {
472
- return new Promise((resolve, reject) => {
473
- Taro.saveFile({
474
- ...options,
475
- success: resolve,
476
- fail: reject
477
- });
478
- });
479
- },
480
- async getFileInfo(options) {
481
- return new Promise((resolve, reject) => {
482
- Taro.getFileInfo({
483
- ...options,
484
- success: resolve,
485
- fail: reject
486
- });
487
- });
488
- },
489
- async getSavedFileList() {
490
- return new Promise((resolve, reject) => {
491
- Taro.getSavedFileList({
492
- success: resolve,
493
- fail: reject
494
- });
495
- });
496
- },
497
- async removeSavedFile(options) {
498
- return new Promise((resolve, reject) => {
499
- Taro.removeSavedFile({
500
- ...options,
501
- success: () => resolve(),
502
- fail: reject
503
- });
504
- });
505
- }
506
- });
507
- }
508
- getPlatformInfo() {
509
- const system = Taro.getSystemInfoSync();
510
- const accountInfo = Taro.getAccountInfoSync();
511
- return {
512
- platform: "weapp",
513
- isMiniProgram: true,
514
- isH5: false,
515
- isRN: false,
516
- system,
517
- SDKVersion: accountInfo.miniProgram.sdkVersion || accountInfo.miniProgram.version,
518
- version: accountInfo.miniProgram.version
519
- };
520
- }
521
- async request(config) {
522
- return new Promise((resolve, reject) => {
523
- Taro.request({
524
- url: config.url,
525
- method: config.method || "GET",
526
- header: config.header,
527
- data: config.data,
528
- timeout: config.timeout,
529
- success: (res) => {
530
- resolve({
531
- data: res.data,
532
- statusCode: res.statusCode,
533
- statusMessage: res.errMsg,
534
- header: res.header
535
- });
536
- },
537
- fail: (err) => {
538
- const error = {
539
- message: err.errMsg || "Request failed",
540
- code: err.errCode,
541
- detail: err
542
- };
543
- reject(error);
544
- }
545
- });
546
- });
547
- }
548
- }
549
- class H5Adapter {
550
- constructor() {
551
- __publicField(this, "storage", {
552
- async set(key, value) {
553
- localStorage.setItem(key, JSON.stringify(value));
554
- },
555
- async get(key) {
556
- const value = localStorage.getItem(key);
557
- return value ? JSON.parse(value) : null;
558
- },
559
- async remove(key) {
560
- localStorage.removeItem(key);
561
- },
562
- async clear() {
563
- localStorage.clear();
564
- },
565
- async getInfo() {
566
- let size = 0;
567
- for (let i = 0; i < localStorage.length; i++) {
568
- const key = localStorage.key(i);
569
- if (key) {
570
- size += (key + localStorage.getItem(key)).length;
571
- }
572
- }
573
- return {
574
- currentSize: size,
575
- limitSize: 5 * 1024 * 1024
576
- // 5MB 估算
577
- };
578
- }
579
- });
580
- __publicField(this, "location", {
581
- async getCurrentPosition() {
582
- return new Promise((resolve, reject) => {
583
- if (!navigator.geolocation) {
584
- reject(new Error("Geolocation is not supported"));
585
- return;
586
- }
587
- navigator.geolocation.getCurrentPosition(
588
- (position) => {
589
- resolve({
590
- latitude: position.coords.latitude || 0,
591
- longitude: position.coords.longitude || 0,
592
- accuracy: position.coords.accuracy || 0,
593
- altitude: position.coords.altitude || 0,
594
- verticalAccuracy: position.coords.altitudeAccuracy || 0,
595
- horizontalAccuracy: position.coords.accuracy || 0,
596
- speed: position.coords.speed || 0,
597
- errMsg: "getLocation:ok"
598
- });
599
- },
600
- (error) => {
601
- reject(error);
602
- }
603
- );
604
- });
605
- },
606
- async openLocation(options) {
607
- const url = `https://maps.google.com/maps?q=${options.latitude},${options.longitude}`;
608
- window.open(url, "_blank");
609
- },
610
- async chooseLocation() {
611
- throw new Error("chooseLocation is not supported in H5 environment");
612
- }
613
- });
614
- __publicField(this, "camera", {
615
- async takePhoto() {
616
- throw new Error("takePhoto is not supported in H5 environment");
617
- },
618
- async chooseImage(options) {
619
- return new Promise((resolve, reject) => {
620
- const input = document.createElement("input");
621
- input.type = "file";
622
- input.accept = "image/*";
623
- if ((options == null ? void 0 : options.count) && options.count > 1) {
624
- input.multiple = true;
625
- }
626
- input.onchange = (event) => {
627
- const files = Array.from(event.target.files || []);
628
- const tempFilePaths = files.map((file) => URL.createObjectURL(file));
629
- resolve({
630
- tempFilePaths,
631
- tempFiles: files.map((file) => ({
632
- path: URL.createObjectURL(file),
633
- size: file.size,
634
- type: file.type,
635
- originalFileObj: file
636
- })),
637
- errMsg: "chooseImage:ok"
638
- });
639
- };
640
- input.onerror = () => {
641
- reject(new Error("Failed to choose image"));
642
- };
643
- input.click();
644
- });
645
- },
646
- async chooseVideo() {
647
- return new Promise((resolve, reject) => {
648
- const input = document.createElement("input");
649
- input.type = "file";
650
- input.accept = "video/*";
651
- input.onchange = (event) => {
652
- var _a;
653
- const file = (_a = event.target.files) == null ? void 0 : _a[0];
654
- if (!file) {
655
- reject(new Error("No file selected"));
656
- return;
657
- }
658
- resolve({
659
- tempFilePath: URL.createObjectURL(file),
660
- duration: 0,
661
- // 需要额外的逻辑获取视频时长
662
- size: file.size,
663
- height: 0,
664
- // 需要额外的逻辑获取视频尺寸
665
- width: 0,
666
- errMsg: "chooseVideo:ok"
667
- });
668
- };
669
- input.onerror = () => {
670
- reject(new Error("Failed to choose video"));
671
- };
672
- input.click();
673
- });
674
- }
675
- });
676
- __publicField(this, "payment", {
677
- async requestPayment() {
678
- throw new Error("Payment is not supported in H5 environment");
679
- }
680
- });
681
- __publicField(this, "share", {
682
- async shareAppMessage() {
683
- if (navigator.share) {
684
- await navigator.share({
685
- title: document.title,
686
- url: window.location.href
687
- });
688
- } else {
689
- throw new Error("Web Share API is not supported");
690
- }
691
- },
692
- async shareToTimeline() {
693
- throw new Error("shareToTimeline is not supported in H5 environment");
694
- }
695
- });
696
- __publicField(this, "biometrics", {
697
- async checkIsAvailable() {
698
- return false;
699
- },
700
- async startVerify() {
701
- throw new Error("Biometric authentication is not supported in H5 environment");
702
- }
703
- });
704
- __publicField(this, "system", {
705
- async getSystemInfo() {
706
- return Promise.resolve(Taro.getSystemInfoSync());
707
- },
708
- async getNetworkType() {
709
- const connection = navigator.connection;
710
- let networkType = "unknown";
711
- if (connection) {
712
- if (connection.effectiveType) {
713
- networkType = connection.effectiveType;
714
- }
715
- }
716
- return {
717
- networkType,
718
- errMsg: "getNetworkType:ok"
719
- };
720
- },
721
- async getBatteryInfo() {
722
- throw new Error("Battery API is not supported");
723
- },
724
- async getScreenBrightness() {
725
- return 1;
726
- },
727
- async setScreenBrightness() {
728
- },
729
- async keepScreenOn() {
730
- },
731
- async vibrate() {
732
- if (navigator.vibrate) {
733
- navigator.vibrate(200);
734
- }
735
- }
736
- });
737
- __publicField(this, "clipboard", {
738
- async set(text) {
739
- if (navigator.clipboard) {
740
- await navigator.clipboard.writeText(text);
741
- } else {
742
- const textArea = document.createElement("textarea");
743
- textArea.value = text;
744
- document.body.appendChild(textArea);
745
- textArea.select();
746
- document.execCommand("copy");
747
- document.body.removeChild(textArea);
748
- }
749
- },
750
- async get() {
751
- if (navigator.clipboard) {
752
- return await navigator.clipboard.readText();
753
- } else {
754
- return "";
755
- }
756
- }
757
- });
758
- __publicField(this, "scan", {
759
- async scanCode() {
760
- throw new Error("scanCode is not supported in H5 environment");
761
- }
762
- });
763
- __publicField(this, "file", {
764
- async saveFile() {
765
- throw new Error("saveFile is not supported in H5 environment");
766
- },
767
- async getFileInfo() {
768
- throw new Error("getFileInfo is not supported in H5 environment");
769
- },
770
- async getSavedFileList() {
771
- throw new Error("getSavedFileList is not supported in H5 environment");
772
- },
773
- async removeSavedFile() {
774
- throw new Error("removeSavedFile is not supported in H5 environment");
775
- }
776
- });
777
- }
778
- getPlatformInfo() {
779
- const system = Taro.getSystemInfoSync();
780
- return {
781
- platform: "h5",
782
- isMiniProgram: false,
783
- isH5: true,
784
- isRN: false,
785
- system
786
- };
787
- }
788
- /** Headers对象转普通对象 */
789
- headersToObject(headers) {
790
- const result = {};
791
- headers.forEach((value, key) => {
792
- result[key] = value;
793
- });
794
- return result;
795
- }
796
- async request(config) {
797
- const url = new URL(config.url, window.location.origin);
798
- if (config.params) {
799
- Object.entries(config.params).forEach(([key, value]) => {
800
- url.searchParams.append(key, String(value));
801
- });
802
- }
803
- const options = {
804
- method: config.method || "GET",
805
- headers: {
806
- "Content-Type": "application/json",
807
- ...config.header
808
- }
809
- };
810
- if (config.data && ["POST", "PUT", "PATCH"].includes(config.method || "GET")) {
811
- options.body = JSON.stringify(config.data);
812
- }
813
- try {
814
- const response = await fetch(url.toString(), options);
815
- const data = await response.json();
816
- return {
817
- data,
818
- statusCode: response.status,
819
- statusMessage: response.statusText,
820
- header: this.headersToObject(response.headers)
821
- };
822
- } catch (error) {
823
- const requestError = {
824
- message: error instanceof Error ? error.message : "Network error",
825
- detail: error
826
- };
827
- throw requestError;
828
- }
829
- }
830
- }
831
- class RNAdapter {
832
- constructor() {
833
- // React Native的存储实现需要使用AsyncStorage
834
- __publicField(this, "storage", {
835
- async set(_key, _value) {
836
- throw new Error("AsyncStorage not implemented");
837
- },
838
- async get(_key) {
839
- throw new Error("AsyncStorage not implemented");
840
- },
841
- async remove(_key) {
842
- throw new Error("AsyncStorage not implemented");
843
- },
844
- async clear() {
845
- throw new Error("AsyncStorage not implemented");
846
- },
847
- async getInfo() {
848
- throw new Error("Storage info not available in React Native");
849
- }
850
- });
851
- // 其他React Native平台的实现...
852
- // 由于React Native的API实现较为复杂,这里只提供基础框架
853
- __publicField(this, "location", {
854
- async getCurrentPosition() {
855
- throw new Error("Location service not implemented");
856
- },
857
- async openLocation() {
858
- throw new Error("openLocation not implemented");
859
- },
860
- async chooseLocation() {
861
- throw new Error("chooseLocation not implemented");
862
- }
863
- });
864
- __publicField(this, "camera", {
865
- async takePhoto() {
866
- throw new Error("Camera service not implemented");
867
- },
868
- async chooseImage() {
869
- throw new Error("chooseImage not implemented");
870
- },
871
- async chooseVideo() {
872
- throw new Error("chooseVideo not implemented");
873
- }
874
- });
875
- __publicField(this, "payment", {
876
- async requestPayment() {
877
- throw new Error("Payment service not implemented");
878
- }
879
- });
880
- __publicField(this, "share", {
881
- async shareAppMessage() {
882
- throw new Error("Share service not implemented");
883
- },
884
- async shareToTimeline() {
885
- throw new Error("Share service not implemented");
886
- }
887
- });
888
- __publicField(this, "biometrics", {
889
- async checkIsAvailable() {
890
- throw new Error("Biometric service not implemented");
891
- },
892
- async startVerify() {
893
- throw new Error("Biometric service not implemented");
894
- }
895
- });
896
- __publicField(this, "system", {
897
- async getSystemInfo() {
898
- return Promise.resolve(Taro.getSystemInfoSync());
899
- },
900
- async getNetworkType() {
901
- throw new Error("Network type service not implemented");
902
- },
903
- async getBatteryInfo() {
904
- throw new Error("Battery service not implemented");
905
- },
906
- async getScreenBrightness() {
907
- throw new Error("Screen brightness service not implemented");
908
- },
909
- async setScreenBrightness() {
910
- throw new Error("Screen brightness service not implemented");
911
- },
912
- async keepScreenOn() {
913
- throw new Error("Keep screen on service not implemented");
914
- },
915
- async vibrate() {
916
- throw new Error("Vibrate service not implemented");
917
- }
918
- });
919
- __publicField(this, "clipboard", {
920
- async set(_text) {
921
- throw new Error("Clipboard service not implemented");
922
- },
923
- async get() {
924
- throw new Error("Clipboard service not implemented");
925
- }
926
- });
927
- __publicField(this, "scan", {
928
- async scanCode() {
929
- throw new Error("Scan service not implemented");
930
- }
931
- });
932
- __publicField(this, "file", {
933
- async saveFile() {
934
- throw new Error("File service not implemented");
935
- },
936
- async getFileInfo() {
937
- throw new Error("File service not implemented");
938
- },
939
- async getSavedFileList() {
940
- throw new Error("File service not implemented");
941
- },
942
- async removeSavedFile() {
943
- throw new Error("File service not implemented");
944
- }
945
- });
946
- }
947
- getPlatformInfo() {
948
- const system = Taro.getSystemInfoSync();
949
- return {
950
- platform: "rn",
951
- isMiniProgram: false,
952
- isH5: false,
953
- isRN: true,
954
- system
955
- };
956
- }
957
- /** Headers对象转普通对象 */
958
- headersToObject(headers) {
959
- const result = {};
960
- headers.forEach((value, key) => {
961
- result[key] = value;
962
- });
963
- return result;
964
- }
965
- async request(config) {
966
- const url = new URL(config.url);
967
- if (config.params) {
968
- Object.entries(config.params).forEach(([key, value]) => {
969
- url.searchParams.append(key, String(value));
970
- });
971
- }
972
- const options = {
973
- method: config.method || "GET",
974
- headers: {
975
- "Content-Type": "application/json",
976
- ...config.header
977
- }
978
- };
979
- if (config.data && ["POST", "PUT", "PATCH"].includes(config.method || "GET")) {
980
- options.body = JSON.stringify(config.data);
981
- }
982
- try {
983
- const response = await fetch(url.toString(), options);
984
- const data = await response.json();
985
- return {
986
- data,
987
- statusCode: response.status,
988
- statusMessage: response.statusText,
989
- header: this.headersToObject(response.headers)
990
- };
991
- } catch (error) {
992
- const requestError = {
993
- message: error instanceof Error ? error.message : "Network error",
994
- detail: error
995
- };
996
- throw requestError;
997
- }
998
- }
999
- }
1000
- const _PlatformManager = class _PlatformManager {
1001
- constructor() {
1002
- __publicField(this, "adapter");
1003
- __publicField(this, "platformInfo");
1004
- const platform = this.detectPlatform();
1005
- this.adapter = this.createAdapter(platform);
1006
- this.platformInfo = this.adapter.getPlatformInfo();
1007
- }
1008
- /** 获取单例实例 */
1009
- static getInstance() {
1010
- if (!_PlatformManager.instance) {
1011
- _PlatformManager.instance = new _PlatformManager();
1012
- }
1013
- return _PlatformManager.instance;
1014
- }
1015
- /** 检测当前平台 */
1016
- detectPlatform() {
1017
- if (typeof window !== "undefined" && window.wx && window.wx.getSystemInfo) {
1018
- return "weapp";
1019
- } else if (typeof window !== "undefined" && window.my && window.my.getSystemInfo) {
1020
- return "alipay";
1021
- } else if (typeof window !== "undefined" && window.swan && window.swan.getSystemInfo) {
1022
- return "swan";
1023
- } else if (typeof window !== "undefined" && window.tt && window.tt.getSystemInfo) {
1024
- return "tt";
1025
- } else if (typeof window !== "undefined" && window.qq && window.qq.getSystemInfo) {
1026
- return "qq";
1027
- } else if (typeof window !== "undefined" && window.jd && window.jd.getSystemInfo) {
1028
- return "jd";
1029
- } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
1030
- return "rn";
1031
- } else {
1032
- return "h5";
1033
- }
1034
- }
1035
- /** 创建平台适配器 */
1036
- createAdapter(platform) {
1037
- switch (platform) {
1038
- case "weapp":
1039
- return new WeappAdapter();
1040
- case "alipay":
1041
- return new WeappAdapter();
1042
- case "swan":
1043
- return new WeappAdapter();
1044
- case "tt":
1045
- return new WeappAdapter();
1046
- case "qq":
1047
- return new WeappAdapter();
1048
- case "jd":
1049
- return new WeappAdapter();
1050
- case "h5":
1051
- return new H5Adapter();
1052
- case "rn":
1053
- return new RNAdapter();
1054
- default:
1055
- return new H5Adapter();
1056
- }
1057
- }
1058
- /** 获取平台适配器 */
1059
- getAdapter() {
1060
- return this.adapter;
1061
- }
1062
- /** 获取平台信息 */
1063
- getPlatformInfo() {
1064
- return this.platformInfo;
1065
- }
1066
- /** 获取当前平台 */
1067
- getPlatform() {
1068
- return this.platformInfo.platform;
1069
- }
1070
- /** 判断是否为指定平台 */
1071
- isPlatform(targetPlatform) {
1072
- return this.platformInfo.platform === targetPlatform;
1073
- }
1074
- /** 判断是否为小程序环境 */
1075
- isMiniProgram() {
1076
- return this.platformInfo.isMiniProgram;
1077
- }
1078
- /** 判断是否为H5环境 */
1079
- isH5() {
1080
- return this.platformInfo.isH5;
1081
- }
1082
- /** 判断是否为React Native环境 */
1083
- isRN() {
1084
- return this.platformInfo.isRN;
1085
- }
1086
- /** 检查功能支持 */
1087
- isFeatureSupported(feature) {
1088
- var _a;
1089
- const platform = this.platformInfo.platform;
1090
- return ((_a = PLATFORM_FEATURES[platform]) == null ? void 0 : _a[feature]) || false;
1091
- }
1092
- /** 获取平台API映射 */
1093
- getPlatformAPIs() {
1094
- const platform = this.platformInfo.platform;
1095
- return PLATFORM_APIS[platform] || PLATFORM_APIS.h5;
1096
- }
1097
- /** 获取平台名称 */
1098
- getPlatformName() {
1099
- const platform = this.platformInfo.platform;
1100
- return PLATFORM_NAMES[platform] || "Unknown";
1101
- }
1102
- /** 重置平台管理器(主要用于测试) */
1103
- reset() {
1104
- _PlatformManager.instance = new _PlatformManager();
1105
- }
1106
- };
1107
- __publicField(_PlatformManager, "instance");
1108
- let PlatformManager = _PlatformManager;
1109
- const platformManager = PlatformManager.getInstance();
1110
- const platformAdapter = platformManager.getAdapter();
1111
- const platformUtils = {
1112
- getPlatform: () => platformManager.getPlatform(),
1113
- getPlatformInfo: () => platformManager.getPlatformInfo(),
1114
- isPlatform: (platform) => platformManager.isPlatform(platform),
1115
- isMiniProgram: () => platformManager.isMiniProgram(),
1116
- isH5: () => platformManager.isH5(),
1117
- isRN: () => platformManager.isRN(),
1118
- isFeatureSupported: (feature) => platformManager.isFeatureSupported(feature),
1119
- getPlatformAPIs: () => platformManager.getPlatformAPIs(),
1120
- getPlatformName: () => platformManager.getPlatformName()
1121
- };
1122
- const {
1123
- getPlatform,
1124
- getPlatformInfo,
1125
- isPlatform,
1126
- isMiniProgram,
1127
- isH5,
1128
- isRN,
1129
- isFeatureSupported,
1130
- getPlatformAPIs,
1131
- getPlatformName
1132
- } = platformUtils;
1133
- export {
1134
- PlatformManager,
1135
- getPlatform,
1136
- getPlatformAPIs,
1137
- getPlatformInfo,
1138
- getPlatformName,
1139
- isFeatureSupported,
1140
- isH5,
1141
- isMiniProgram,
1142
- isPlatform,
1143
- isRN,
1144
- platformAdapter,
1145
- platformManager,
1146
- platformUtils
1147
- };
1148
- //# sourceMappingURL=index-DXRIkWX1.js.map