taro-uno-ui 0.9.0-beta

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 (397) hide show
  1. package/LICENSE +100 -0
  2. package/README.md +273 -0
  3. package/dist/js/index-6NJ3A1Dn.js +26535 -0
  4. package/dist/js/index-6NJ3A1Dn.js.map +1 -0
  5. package/dist/js/index-DFdcksbe.js +1165 -0
  6. package/dist/js/index-DFdcksbe.js.map +1 -0
  7. package/dist/js/index-DXRIkWX1.js +1148 -0
  8. package/dist/js/index-DXRIkWX1.js.map +1 -0
  9. package/dist/js/index-DffLRSro.js +26519 -0
  10. package/dist/js/index-DffLRSro.js.map +1 -0
  11. package/package.json +119 -0
  12. package/src/app.config.ts +55 -0
  13. package/src/app.scss +508 -0
  14. package/src/app.tsx +44 -0
  15. package/src/components/basic/Button/Button.styles.ts +130 -0
  16. package/src/components/basic/Button/Button.test.tsx +154 -0
  17. package/src/components/basic/Button/Button.tsx +93 -0
  18. package/src/components/basic/Button/Button.types.ts +45 -0
  19. package/src/components/basic/Button/index.tsx +6 -0
  20. package/src/components/basic/Divider/Divider.styles.ts +488 -0
  21. package/src/components/basic/Divider/Divider.test.tsx +551 -0
  22. package/src/components/basic/Divider/Divider.tsx +361 -0
  23. package/src/components/basic/Divider/Divider.types.ts +261 -0
  24. package/src/components/basic/Divider/index.tsx +25 -0
  25. package/src/components/basic/Icon/Icon.styles.ts +359 -0
  26. package/src/components/basic/Icon/Icon.test.tsx +357 -0
  27. package/src/components/basic/Icon/Icon.tsx +154 -0
  28. package/src/components/basic/Icon/Icon.types.ts +210 -0
  29. package/src/components/basic/Icon/index.tsx +22 -0
  30. package/src/components/basic/Text/Text.styles.ts +500 -0
  31. package/src/components/basic/Text/Text.test.tsx +299 -0
  32. package/src/components/basic/Text/Text.tsx +340 -0
  33. package/src/components/basic/Text/Text.types.ts +319 -0
  34. package/src/components/basic/Text/index.tsx +27 -0
  35. package/src/components/basic/Typography/Typography.styles.ts +346 -0
  36. package/src/components/basic/Typography/Typography.tsx +205 -0
  37. package/src/components/basic/Typography/Typography.types.ts +296 -0
  38. package/src/components/basic/Typography/index.tsx +14 -0
  39. package/src/components/basic/index.tsx +302 -0
  40. package/src/components/common/ErrorBoundary.tsx +87 -0
  41. package/src/components/common/LazyComponent.tsx +246 -0
  42. package/src/components/common/ResponsiveContainer.tsx +93 -0
  43. package/src/components/common/ResponsiveGrid.tsx +183 -0
  44. package/src/components/common/SecurityProvider.tsx +110 -0
  45. package/src/components/common/ThemeProvider.tsx +128 -0
  46. package/src/components/common/VirtualList.tsx +368 -0
  47. package/src/components/common/__tests__/ErrorBoundary.test.tsx +249 -0
  48. package/src/components/common/index.tsx +7 -0
  49. package/src/components/display/Avatar/Avatar.styles.ts +62 -0
  50. package/src/components/display/Avatar/Avatar.test.tsx +390 -0
  51. package/src/components/display/Avatar/Avatar.tsx +79 -0
  52. package/src/components/display/Avatar/Avatar.types.ts +40 -0
  53. package/src/components/display/Avatar/index.ts +3 -0
  54. package/src/components/display/Badge/Badge.tsx +42 -0
  55. package/src/components/display/Badge/Badge.types.ts +29 -0
  56. package/src/components/display/Badge/index.ts +2 -0
  57. package/src/components/display/Calendar/Calendar.styles.ts +255 -0
  58. package/src/components/display/Calendar/Calendar.test.tsx +30 -0
  59. package/src/components/display/Calendar/Calendar.tsx +337 -0
  60. package/src/components/display/Calendar/Calendar.types.ts +91 -0
  61. package/src/components/display/Calendar/index.ts +3 -0
  62. package/src/components/display/Card/Card.styles.ts +89 -0
  63. package/src/components/display/Card/Card.test.tsx +180 -0
  64. package/src/components/display/Card/Card.tsx +135 -0
  65. package/src/components/display/Card/Card.types.ts +55 -0
  66. package/src/components/display/Card/index.ts +3 -0
  67. package/src/components/display/Carousel/Carousel.styles.ts +206 -0
  68. package/src/components/display/Carousel/Carousel.tsx +295 -0
  69. package/src/components/display/Carousel/Carousel.types.ts +57 -0
  70. package/src/components/display/Carousel/index.ts +3 -0
  71. package/src/components/display/List/List.styles.ts +79 -0
  72. package/src/components/display/List/List.tsx +115 -0
  73. package/src/components/display/List/List.types.ts +68 -0
  74. package/src/components/display/List/index.ts +3 -0
  75. package/src/components/display/Rate/Rate.styles.ts +266 -0
  76. package/src/components/display/Rate/Rate.tsx +332 -0
  77. package/src/components/display/Rate/Rate.types.ts +111 -0
  78. package/src/components/display/Rate/index.ts +28 -0
  79. package/src/components/display/Table/Table.styles.ts +269 -0
  80. package/src/components/display/Table/Table.test.tsx +343 -0
  81. package/src/components/display/Table/Table.tsx +430 -0
  82. package/src/components/display/Table/Table.types.ts +255 -0
  83. package/src/components/display/Table/index.tsx +16 -0
  84. package/src/components/display/Tag/Tag.styles.ts +197 -0
  85. package/src/components/display/Tag/Tag.test.tsx +541 -0
  86. package/src/components/display/Tag/Tag.tsx +156 -0
  87. package/src/components/display/Tag/Tag.types.ts +49 -0
  88. package/src/components/display/Tag/index.ts +3 -0
  89. package/src/components/display/Timeline/Timeline.styles.ts +211 -0
  90. package/src/components/display/Timeline/Timeline.tsx +239 -0
  91. package/src/components/display/Timeline/Timeline.types.ts +56 -0
  92. package/src/components/display/Timeline/index.ts +3 -0
  93. package/src/components/display/index.tsx +143 -0
  94. package/src/components/feedback/Loading/Loading.styles.ts +117 -0
  95. package/src/components/feedback/Loading/Loading.test.tsx +534 -0
  96. package/src/components/feedback/Loading/Loading.tsx +127 -0
  97. package/src/components/feedback/Loading/Loading.types.ts +33 -0
  98. package/src/components/feedback/Loading/index.ts +9 -0
  99. package/src/components/feedback/Message/Message.styles.ts +41 -0
  100. package/src/components/feedback/Message/Message.test.tsx +234 -0
  101. package/src/components/feedback/Message/Message.tsx +96 -0
  102. package/src/components/feedback/Message/Message.types.ts +37 -0
  103. package/src/components/feedback/Message/index.ts +9 -0
  104. package/src/components/feedback/Modal/Modal.styles.ts +21 -0
  105. package/src/components/feedback/Modal/Modal.test.tsx +11 -0
  106. package/src/components/feedback/Modal/Modal.tsx +291 -0
  107. package/src/components/feedback/Modal/Modal.types.ts +141 -0
  108. package/src/components/feedback/Modal/index.tsx +11 -0
  109. package/src/components/feedback/Notification/Notification.styles.ts +443 -0
  110. package/src/components/feedback/Notification/Notification.test.tsx +401 -0
  111. package/src/components/feedback/Notification/Notification.tsx +370 -0
  112. package/src/components/feedback/Notification/Notification.types.ts +336 -0
  113. package/src/components/feedback/Notification/NotificationManager.tsx +376 -0
  114. package/src/components/feedback/Notification/index.ts +33 -0
  115. package/src/components/feedback/Notification/index.tsx +164 -0
  116. package/src/components/feedback/Progress/Progress.styles.ts +460 -0
  117. package/src/components/feedback/Progress/Progress.test.simple.tsx +14 -0
  118. package/src/components/feedback/Progress/Progress.test.tsx +312 -0
  119. package/src/components/feedback/Progress/Progress.tsx +508 -0
  120. package/src/components/feedback/Progress/Progress.types.ts +163 -0
  121. package/src/components/feedback/Progress/index.ts +3 -0
  122. package/src/components/feedback/Progress/index.tsx +38 -0
  123. package/src/components/feedback/Progress/utils/animation.ts +204 -0
  124. package/src/components/feedback/Progress/utils/index.ts +26 -0
  125. package/src/components/feedback/Progress/utils/progress-calculator.ts +217 -0
  126. package/src/components/feedback/Result/Result.styles.ts +139 -0
  127. package/src/components/feedback/Result/Result.tsx +233 -0
  128. package/src/components/feedback/Result/Result.types.ts +128 -0
  129. package/src/components/feedback/Result/index.tsx +3 -0
  130. package/src/components/feedback/Toast/Toast.styles.ts +17 -0
  131. package/src/components/feedback/Toast/Toast.test.tsx +10 -0
  132. package/src/components/feedback/Toast/Toast.tsx +372 -0
  133. package/src/components/feedback/Toast/Toast.types.ts +86 -0
  134. package/src/components/feedback/Toast/index.tsx +3 -0
  135. package/src/components/feedback/Tooltip/Tooltip.examples.tsx +458 -0
  136. package/src/components/feedback/Tooltip/Tooltip.styles.ts +346 -0
  137. package/src/components/feedback/Tooltip/Tooltip.test.tsx +446 -0
  138. package/src/components/feedback/Tooltip/Tooltip.tsx +283 -0
  139. package/src/components/feedback/Tooltip/Tooltip.types.ts +172 -0
  140. package/src/components/feedback/Tooltip/index.ts +3 -0
  141. package/src/components/feedback/Tooltip/index.tsx +258 -0
  142. package/src/components/feedback/index.tsx +164 -0
  143. package/src/components/form/Cascader/Cascader.styles.ts +526 -0
  144. package/src/components/form/Cascader/Cascader.test.tsx +77 -0
  145. package/src/components/form/Cascader/Cascader.tsx +585 -0
  146. package/src/components/form/Cascader/Cascader.types.ts +582 -0
  147. package/src/components/form/Cascader/hooks/index.ts +3 -0
  148. package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +16 -0
  149. package/src/components/form/Cascader/hooks/useCascaderOptions.ts +109 -0
  150. package/src/components/form/Cascader/hooks/useCascaderState.ts +133 -0
  151. package/src/components/form/Cascader/index.ts +25 -0
  152. package/src/components/form/Cascader/utils/formatDisplayValue.ts +19 -0
  153. package/src/components/form/Cascader/utils/index.ts +1 -0
  154. package/src/components/form/Checkbox/Checkbox.styles.ts +608 -0
  155. package/src/components/form/Checkbox/Checkbox.test.tsx +1140 -0
  156. package/src/components/form/Checkbox/Checkbox.tsx +496 -0
  157. package/src/components/form/Checkbox/Checkbox.types.ts +472 -0
  158. package/src/components/form/Checkbox/CheckboxGroup.tsx +444 -0
  159. package/src/components/form/Checkbox/index.tsx +27 -0
  160. package/src/components/form/DatePicker/DatePicker.styles.ts +393 -0
  161. package/src/components/form/DatePicker/DatePicker.test.tsx +407 -0
  162. package/src/components/form/DatePicker/DatePicker.tsx +360 -0
  163. package/src/components/form/DatePicker/DatePicker.types.ts +247 -0
  164. package/src/components/form/DatePicker/index.tsx +15 -0
  165. package/src/components/form/Form/Form.styles.ts +357 -0
  166. package/src/components/form/Form/Form.test.tsx +122 -0
  167. package/src/components/form/Form/Form.tsx +695 -0
  168. package/src/components/form/Form/Form.types.ts +407 -0
  169. package/src/components/form/Form/index.tsx +31 -0
  170. package/src/components/form/Input/Input.enhanced.tsx +732 -0
  171. package/src/components/form/Input/Input.styles.ts +438 -0
  172. package/src/components/form/Input/Input.test.tsx +494 -0
  173. package/src/components/form/Input/Input.tsx +541 -0
  174. package/src/components/form/Input/Input.types.ts +285 -0
  175. package/src/components/form/Input/index.tsx +26 -0
  176. package/src/components/form/InputNumber/InputNumber.styles.ts +665 -0
  177. package/src/components/form/InputNumber/InputNumber.tsx +370 -0
  178. package/src/components/form/InputNumber/InputNumber.types.ts +318 -0
  179. package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +32 -0
  180. package/src/components/form/InputNumber/components/InputNumberControls.tsx +42 -0
  181. package/src/components/form/InputNumber/components/index.ts +2 -0
  182. package/src/components/form/InputNumber/hooks/index.ts +4 -0
  183. package/src/components/form/InputNumber/hooks/useInputNumberState.ts +315 -0
  184. package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +147 -0
  185. package/src/components/form/InputNumber/index.ts +25 -0
  186. package/src/components/form/Radio/Radio.styles.ts +458 -0
  187. package/src/components/form/Radio/Radio.test.tsx +547 -0
  188. package/src/components/form/Radio/Radio.tsx +283 -0
  189. package/src/components/form/Radio/Radio.types.ts +410 -0
  190. package/src/components/form/Radio/index.tsx +21 -0
  191. package/src/components/form/Select/Select.styles.ts +514 -0
  192. package/src/components/form/Select/Select.test.tsx +648 -0
  193. package/src/components/form/Select/Select.tsx +474 -0
  194. package/src/components/form/Select/Select.types.ts +428 -0
  195. package/src/components/form/Select/index.tsx +30 -0
  196. package/src/components/form/Slider/Slider.styles.ts +139 -0
  197. package/src/components/form/Slider/Slider.test.tsx +553 -0
  198. package/src/components/form/Slider/Slider.tsx +326 -0
  199. package/src/components/form/Slider/Slider.types.ts +108 -0
  200. package/src/components/form/Slider/index.tsx +10 -0
  201. package/src/components/form/Switch/Switch.styles.ts +540 -0
  202. package/src/components/form/Switch/Switch.test.tsx +345 -0
  203. package/src/components/form/Switch/Switch.tsx +464 -0
  204. package/src/components/form/Switch/Switch.types.ts +386 -0
  205. package/src/components/form/Switch/index.tsx +26 -0
  206. package/src/components/form/Textarea/Textarea.styles.ts +592 -0
  207. package/src/components/form/Textarea/Textarea.test.tsx +1075 -0
  208. package/src/components/form/Textarea/Textarea.tsx +602 -0
  209. package/src/components/form/Textarea/Textarea.types.ts +371 -0
  210. package/src/components/form/Textarea/index.tsx +26 -0
  211. package/src/components/form/TimePicker/TimePicker.styles.ts +438 -0
  212. package/src/components/form/TimePicker/TimePicker.test.tsx +306 -0
  213. package/src/components/form/TimePicker/TimePicker.tsx +228 -0
  214. package/src/components/form/TimePicker/TimePicker.types.ts +385 -0
  215. package/src/components/form/TimePicker/index.ts +21 -0
  216. package/src/components/form/Transfer/Transfer.styles.ts +502 -0
  217. package/src/components/form/Transfer/Transfer.test.tsx +316 -0
  218. package/src/components/form/Transfer/Transfer.tsx +402 -0
  219. package/src/components/form/Transfer/Transfer.types.ts +557 -0
  220. package/src/components/form/Transfer/components/TransferItem.tsx +101 -0
  221. package/src/components/form/Transfer/components/TransferList.tsx +285 -0
  222. package/src/components/form/Transfer/components/TransferOperations.tsx +84 -0
  223. package/src/components/form/Transfer/components/TransferPagination.tsx +135 -0
  224. package/src/components/form/Transfer/components/TransferSearch.tsx +88 -0
  225. package/src/components/form/Transfer/components/index.ts +6 -0
  226. package/src/components/form/Transfer/hooks/index.ts +3 -0
  227. package/src/components/form/Transfer/hooks/useTransferData.ts +192 -0
  228. package/src/components/form/Transfer/hooks/useTransferState.ts +114 -0
  229. package/src/components/form/Transfer/index.ts +33 -0
  230. package/src/components/form/Upload/Upload.styles.ts +145 -0
  231. package/src/components/form/Upload/Upload.test.tsx +10 -0
  232. package/src/components/form/Upload/Upload.tsx +451 -0
  233. package/src/components/form/Upload/Upload.types.ts +200 -0
  234. package/src/components/form/Upload/index.tsx +12 -0
  235. package/src/components/form/index.tsx +121 -0
  236. package/src/components/index.tsx +146 -0
  237. package/src/components/layout/Affix/Affix.styles.ts +37 -0
  238. package/src/components/layout/Affix/Affix.test.tsx +10 -0
  239. package/src/components/layout/Affix/Affix.tsx +91 -0
  240. package/src/components/layout/Affix/Affix.types.ts +29 -0
  241. package/src/components/layout/Affix/index.tsx +3 -0
  242. package/src/components/layout/Col/Col.styles.ts +185 -0
  243. package/src/components/layout/Col/Col.test.tsx +535 -0
  244. package/src/components/layout/Col/Col.tsx +115 -0
  245. package/src/components/layout/Col/Col.types.ts +59 -0
  246. package/src/components/layout/Col/index.tsx +3 -0
  247. package/src/components/layout/Container/Container.styles.ts +161 -0
  248. package/src/components/layout/Container/Container.test.tsx +380 -0
  249. package/src/components/layout/Container/Container.tsx +132 -0
  250. package/src/components/layout/Container/Container.types.ts +63 -0
  251. package/src/components/layout/Container/index.tsx +3 -0
  252. package/src/components/layout/Grid/Grid.styles.ts +183 -0
  253. package/src/components/layout/Grid/Grid.test.tsx +637 -0
  254. package/src/components/layout/Grid/Grid.tsx +173 -0
  255. package/src/components/layout/Grid/Grid.types.ts +78 -0
  256. package/src/components/layout/Grid/index.tsx +3 -0
  257. package/src/components/layout/Layout/Content.tsx +38 -0
  258. package/src/components/layout/Layout/Footer.tsx +38 -0
  259. package/src/components/layout/Layout/Header.tsx +38 -0
  260. package/src/components/layout/Layout/Layout.styles.ts +84 -0
  261. package/src/components/layout/Layout/Layout.test.tsx +10 -0
  262. package/src/components/layout/Layout/Layout.tsx +39 -0
  263. package/src/components/layout/Layout/Layout.types.ts +58 -0
  264. package/src/components/layout/Layout/Sider.tsx +56 -0
  265. package/src/components/layout/Layout/index.tsx +8 -0
  266. package/src/components/layout/Row/Row.styles.ts +159 -0
  267. package/src/components/layout/Row/Row.test.tsx +467 -0
  268. package/src/components/layout/Row/Row.tsx +139 -0
  269. package/src/components/layout/Row/Row.types.ts +60 -0
  270. package/src/components/layout/Row/index.tsx +3 -0
  271. package/src/components/layout/Space/Space.styles.ts +255 -0
  272. package/src/components/layout/Space/Space.test.tsx +682 -0
  273. package/src/components/layout/Space/Space.tsx +211 -0
  274. package/src/components/layout/Space/Space.types.ts +92 -0
  275. package/src/components/layout/Space/index.tsx +12 -0
  276. package/src/components/layout/index.tsx +68 -0
  277. package/src/components/navigation/Menu/Menu.styles.ts +779 -0
  278. package/src/components/navigation/Menu/Menu.tsx +355 -0
  279. package/src/components/navigation/Menu/Menu.types.ts +231 -0
  280. package/src/components/navigation/Menu/Menu.utils.ts +187 -0
  281. package/src/components/navigation/Menu/MenuItem.tsx +126 -0
  282. package/src/components/navigation/Menu/SubMenu.tsx +148 -0
  283. package/src/components/navigation/Menu/__tests__/Menu.test.tsx +687 -0
  284. package/src/components/navigation/Menu/index.tsx +124 -0
  285. package/src/components/navigation/NavBar/NavBar.styles.ts +129 -0
  286. package/src/components/navigation/NavBar/NavBar.test.tsx +287 -0
  287. package/src/components/navigation/NavBar/NavBar.tsx +231 -0
  288. package/src/components/navigation/NavBar/NavBar.types.ts +54 -0
  289. package/src/components/navigation/NavBar/index.tsx +3 -0
  290. package/src/components/navigation/Pagination/Pagination.styles.ts +187 -0
  291. package/src/components/navigation/Pagination/Pagination.test.tsx +673 -0
  292. package/src/components/navigation/Pagination/Pagination.tsx +395 -0
  293. package/src/components/navigation/Pagination/Pagination.types.ts +86 -0
  294. package/src/components/navigation/Pagination/index.ts +18 -0
  295. package/src/components/navigation/Pagination/index.tsx +9 -0
  296. package/src/components/navigation/Steps/Step.tsx +56 -0
  297. package/src/components/navigation/Steps/Steps.styles.ts +154 -0
  298. package/src/components/navigation/Steps/Steps.test.tsx +12 -0
  299. package/src/components/navigation/Steps/Steps.tsx +113 -0
  300. package/src/components/navigation/Steps/Steps.types.ts +47 -0
  301. package/src/components/navigation/Steps/index.tsx +3 -0
  302. package/src/components/navigation/Tabs/Tabs.styles.ts +199 -0
  303. package/src/components/navigation/Tabs/Tabs.test.tsx +661 -0
  304. package/src/components/navigation/Tabs/Tabs.tsx +253 -0
  305. package/src/components/navigation/Tabs/Tabs.types.ts +114 -0
  306. package/src/components/navigation/Tabs/index.tsx +3 -0
  307. package/src/components/navigation/Tree/Tree.styles.ts +553 -0
  308. package/src/components/navigation/Tree/Tree.test.basic.tsx +7 -0
  309. package/src/components/navigation/Tree/Tree.test.functional.tsx +496 -0
  310. package/src/components/navigation/Tree/Tree.test.import.check.tsx +6 -0
  311. package/src/components/navigation/Tree/Tree.test.import.tsx +6 -0
  312. package/src/components/navigation/Tree/Tree.test.minimal.tsx +5 -0
  313. package/src/components/navigation/Tree/Tree.test.simple.tsx +30 -0
  314. package/src/components/navigation/Tree/Tree.test.tsx +908 -0
  315. package/src/components/navigation/Tree/Tree.test.working.tsx +673 -0
  316. package/src/components/navigation/Tree/Tree.tsx +600 -0
  317. package/src/components/navigation/Tree/Tree.types.ts +909 -0
  318. package/src/components/navigation/Tree/Tree.utils.ts +452 -0
  319. package/src/components/navigation/Tree/index.ts +33 -0
  320. package/src/components/navigation/Tree/index.tsx +23 -0
  321. package/src/components/navigation/index.tsx +83 -0
  322. package/src/constants/index.ts +785 -0
  323. package/src/hooks/index.ts +110 -0
  324. package/src/hooks/types.ts +10 -0
  325. package/src/hooks/useAsync.ts +65 -0
  326. package/src/hooks/useEventHandling.ts +444 -0
  327. package/src/hooks/useLifecycle.ts +399 -0
  328. package/src/hooks/usePerformance.ts +441 -0
  329. package/src/hooks/usePerformanceMonitor.ts +348 -0
  330. package/src/hooks/usePlatform.ts +62 -0
  331. package/src/hooks/useRequest.test.ts +11 -0
  332. package/src/hooks/useRequest.ts +135 -0
  333. package/src/hooks/useStateManagement.ts +300 -0
  334. package/src/hooks/useStyle.ts +537 -0
  335. package/src/hooks/useTheme.ts +347 -0
  336. package/src/hooks/useVirtualScroll.ts +331 -0
  337. package/src/index.ts +298 -0
  338. package/src/platform/index.ts +1188 -0
  339. package/src/providers/AppProvider.test.tsx +63 -0
  340. package/src/providers/AppProvider.tsx +155 -0
  341. package/src/providers/index.ts +1 -0
  342. package/src/theme/ThemeProvider.tsx +283 -0
  343. package/src/theme/ThemeProvider.types.ts +26 -0
  344. package/src/theme/animations.tsx +660 -0
  345. package/src/theme/defaults.ts +188 -0
  346. package/src/theme/design-system.ts +562 -0
  347. package/src/theme/design-tokens.ts +1136 -0
  348. package/src/theme/generated/dark-theme.scss +120 -0
  349. package/src/theme/generated/tokens.css +441 -0
  350. package/src/theme/generated/tokens.scss +320 -0
  351. package/src/theme/index.ts +120 -0
  352. package/src/theme/responsive.tsx +193 -0
  353. package/src/theme/styles/mixins.scss +612 -0
  354. package/src/theme/styles/variables.scss +295 -0
  355. package/src/theme/styles.ts +403 -0
  356. package/src/theme/tokens/colors.ts +256 -0
  357. package/src/theme/tokens/effects.ts +260 -0
  358. package/src/theme/tokens/index.ts +217 -0
  359. package/src/theme/tokens/spacing.ts +137 -0
  360. package/src/theme/tokens/typography.ts +186 -0
  361. package/src/theme/types.ts +188 -0
  362. package/src/theme/useThemeUtils.ts +313 -0
  363. package/src/theme/utils.ts +501 -0
  364. package/src/theme/variables.ts +583 -0
  365. package/src/types/accessibility.ts +51 -0
  366. package/src/types/button.ts +562 -0
  367. package/src/types/component-props.ts +317 -0
  368. package/src/types/env.d.ts +20 -0
  369. package/src/types/index.ts +427 -0
  370. package/src/types/modules.d.ts +40 -0
  371. package/src/types/standardized-components.ts +544 -0
  372. package/src/types/taro-adapter.d.ts +174 -0
  373. package/src/types/taro-components.d.ts +73 -0
  374. package/src/types/utils.ts +410 -0
  375. package/src/utils/__tests__/inputValidator.test.ts +338 -0
  376. package/src/utils/__tests__/responsiveUtils.test.ts +310 -0
  377. package/src/utils/__tests__/xssProtection.test.ts +268 -0
  378. package/src/utils/cache.ts +83 -0
  379. package/src/utils/createNamespace.ts +24 -0
  380. package/src/utils/environment.ts +95 -0
  381. package/src/utils/error-handler.ts +88 -0
  382. package/src/utils/errorLogger.ts +197 -0
  383. package/src/utils/formatUtils.ts +444 -0
  384. package/src/utils/index.ts +115 -0
  385. package/src/utils/inputValidator.ts +261 -0
  386. package/src/utils/network/http-client.test.ts +18 -0
  387. package/src/utils/network/http-client.ts +151 -0
  388. package/src/utils/performance/performance.ts +850 -0
  389. package/src/utils/responsiveUtils.ts +357 -0
  390. package/src/utils/rtl-support.ts +344 -0
  391. package/src/utils/security/api-security.ts +386 -0
  392. package/src/utils/security/xss-protection.ts +69 -0
  393. package/src/utils/securityHeaders.ts +314 -0
  394. package/src/utils/typeHelpers.ts +16 -0
  395. package/src/utils/types/dataProcessing.ts +543 -0
  396. package/src/utils/types/typeHelpers.ts +187 -0
  397. package/src/utils/xssProtection.ts +420 -0
@@ -0,0 +1,785 @@
1
+ /**
2
+ * Taro-Uno UI 组件库常量定义
3
+ * 包含组件、主题、平台、错误码等常量
4
+ */
5
+
6
+ import type { Platform, Size, Variant, Status, ThemeMode, AnimationType, AnimationDirection } from '../types';
7
+
8
+ // ==================== 组件常量 ====================
9
+
10
+ /** 组件尺寸常量 */
11
+ export const COMPONENT_SIZES: Record<Size, string> = {
12
+ small: 'small',
13
+ medium: 'medium',
14
+ large: 'large',
15
+ default: 'default',
16
+ };
17
+
18
+ /** 组件变体常量 */
19
+ export const COMPONENT_VARIANTS: Record<Variant, string> = {
20
+ default: 'default',
21
+ primary: 'primary',
22
+ secondary: 'secondary',
23
+ success: 'success',
24
+ warning: 'warning',
25
+ danger: 'danger',
26
+ info: 'info',
27
+ };
28
+
29
+ /** 组件状态常量 */
30
+ export const COMPONENT_STATUSES: Record<Status, string> = {
31
+ default: 'default',
32
+ loading: 'loading',
33
+ disabled: 'disabled',
34
+ error: 'error',
35
+ success: 'success',
36
+ };
37
+
38
+ /** 组件前缀常量 */
39
+ export const COMPONENT_PREFIX = 'taro-uno';
40
+
41
+ /** 组件类名前缀 */
42
+ export const CLASS_PREFIX = 'tu';
43
+
44
+ /** 数据属性前缀 */
45
+ export const DATA_PREFIX = 'data-tu';
46
+
47
+ /** 测试ID前缀 */
48
+ export const TEST_ID_PREFIX = 'tu-';
49
+
50
+ // ==================== 主题常量 ====================
51
+
52
+ /** 主题模式常量 */
53
+ export const THEME_MODES: Record<ThemeMode, string> = {
54
+ light: 'light',
55
+ dark: 'dark',
56
+ auto: 'auto',
57
+ };
58
+
59
+ /** 默认主题颜色 */
60
+ export const DEFAULT_THEME_COLORS = {
61
+ primary: '#1890ff',
62
+ secondary: '#52c41a',
63
+ success: '#52c41a',
64
+ warning: '#faad14',
65
+ error: '#f5222d',
66
+ info: '#1890ff',
67
+ background: '#ffffff',
68
+ surface: '#fafafa',
69
+ text: '#000000',
70
+ textSecondary: '#666666',
71
+ border: '#d9d9d9',
72
+ divider: '#f0f0f0',
73
+ };
74
+
75
+ /** 深色主题颜色 */
76
+ export const DARK_THEME_COLORS = {
77
+ primary: '#177ddc',
78
+ secondary: '#49aa19',
79
+ success: '#49aa19',
80
+ warning: '#d48806',
81
+ error: '#a61d24',
82
+ info: '#177ddc',
83
+ background: '#141414',
84
+ surface: '#1f1f1f',
85
+ text: '#ffffff',
86
+ textSecondary: '#bfbfbf',
87
+ border: '#434343',
88
+ divider: '#303030',
89
+ };
90
+
91
+ /** 默认间距配置 */
92
+ export const DEFAULT_SPACING = {
93
+ xs: 4,
94
+ sm: 8,
95
+ md: 16,
96
+ lg: 24,
97
+ xl: 32,
98
+ xxl: 48,
99
+ };
100
+
101
+ /** 默认字体配置 */
102
+ export const DEFAULT_TYPOGRAPHY = {
103
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
104
+ fontSize: {
105
+ xs: 12,
106
+ sm: 14,
107
+ base: 16,
108
+ lg: 18,
109
+ xl: 20,
110
+ '2xl': 24,
111
+ '3xl': 30,
112
+ '4xl': 36,
113
+ },
114
+ fontWeight: {
115
+ normal: 400,
116
+ medium: 500,
117
+ bold: 700,
118
+ },
119
+ lineHeight: {
120
+ tight: 1.25,
121
+ normal: 1.5,
122
+ relaxed: 1.75,
123
+ },
124
+ };
125
+
126
+ /** 默认圆角配置 */
127
+ export const DEFAULT_RADIUS = {
128
+ none: 0,
129
+ sm: 4,
130
+ md: 8,
131
+ lg: 16,
132
+ full: 9999,
133
+ };
134
+
135
+ /** 断点配置 */
136
+ export const BREAKPOINTS = {
137
+ xs: 0,
138
+ sm: 576,
139
+ md: 768,
140
+ lg: 992,
141
+ xl: 1200,
142
+ xxl: 1600,
143
+ };
144
+
145
+ // ==================== 平台常量 ====================
146
+
147
+ /** 平台名称映射 */
148
+ export const PLATFORM_NAMES: Record<Platform, string> = {
149
+ weapp: '微信小程序',
150
+ alipay: '支付宝小程序',
151
+ swan: '百度小程序',
152
+ tt: '字节跳动小程序',
153
+ qq: 'QQ小程序',
154
+ h5: 'H5',
155
+ rn: 'React Native',
156
+ jd: '京东小程序',
157
+ };
158
+
159
+ /** 平台特性支持 */
160
+ export const PLATFORM_FEATURES: Record<
161
+ Platform,
162
+ {
163
+ supportsStorage: boolean;
164
+ supportsNetwork: boolean;
165
+ supportsLocation: boolean;
166
+ supportsCamera: boolean;
167
+ supportsPayment: boolean;
168
+ supportsShare: boolean;
169
+ supportsBiometrics: boolean;
170
+ }
171
+ > = {
172
+ weapp: {
173
+ supportsStorage: true,
174
+ supportsNetwork: true,
175
+ supportsLocation: true,
176
+ supportsCamera: true,
177
+ supportsPayment: true,
178
+ supportsShare: true,
179
+ supportsBiometrics: true,
180
+ },
181
+ alipay: {
182
+ supportsStorage: true,
183
+ supportsNetwork: true,
184
+ supportsLocation: true,
185
+ supportsCamera: true,
186
+ supportsPayment: true,
187
+ supportsShare: true,
188
+ supportsBiometrics: true,
189
+ },
190
+ swan: {
191
+ supportsStorage: true,
192
+ supportsNetwork: true,
193
+ supportsLocation: true,
194
+ supportsCamera: true,
195
+ supportsPayment: true,
196
+ supportsShare: true,
197
+ supportsBiometrics: false,
198
+ },
199
+ tt: {
200
+ supportsStorage: true,
201
+ supportsNetwork: true,
202
+ supportsLocation: true,
203
+ supportsCamera: true,
204
+ supportsPayment: true,
205
+ supportsShare: true,
206
+ supportsBiometrics: false,
207
+ },
208
+ qq: {
209
+ supportsStorage: true,
210
+ supportsNetwork: true,
211
+ supportsLocation: true,
212
+ supportsCamera: true,
213
+ supportsPayment: true,
214
+ supportsShare: true,
215
+ supportsBiometrics: false,
216
+ },
217
+ h5: {
218
+ supportsStorage: true,
219
+ supportsNetwork: true,
220
+ supportsLocation: true,
221
+ supportsCamera: true,
222
+ supportsPayment: true,
223
+ supportsShare: true,
224
+ supportsBiometrics: false,
225
+ },
226
+ rn: {
227
+ supportsStorage: true,
228
+ supportsNetwork: true,
229
+ supportsLocation: true,
230
+ supportsCamera: true,
231
+ supportsPayment: true,
232
+ supportsShare: true,
233
+ supportsBiometrics: true,
234
+ },
235
+ jd: {
236
+ supportsStorage: true,
237
+ supportsNetwork: true,
238
+ supportsLocation: true,
239
+ supportsCamera: true,
240
+ supportsPayment: true,
241
+ supportsShare: true,
242
+ supportsBiometrics: false,
243
+ },
244
+ };
245
+
246
+ /** 平台API映射 */
247
+ export const PLATFORM_APIS: Record<
248
+ Platform,
249
+ {
250
+ request: string;
251
+ storage: {
252
+ set: string;
253
+ get: string;
254
+ remove: string;
255
+ clear: string;
256
+ };
257
+ location: {
258
+ get: string;
259
+ open: string;
260
+ };
261
+ camera: {
262
+ take: string;
263
+ choose: string;
264
+ };
265
+ }
266
+ > = {
267
+ weapp: {
268
+ request: 'wx.request',
269
+ storage: {
270
+ set: 'wx.setStorage',
271
+ get: 'wx.getStorage',
272
+ remove: 'wx.removeStorage',
273
+ clear: 'wx.clearStorage',
274
+ },
275
+ location: {
276
+ get: 'wx.getLocation',
277
+ open: 'wx.openLocation',
278
+ },
279
+ camera: {
280
+ take: 'wx.cameraTake',
281
+ choose: 'wx.chooseImage',
282
+ },
283
+ },
284
+ alipay: {
285
+ request: 'my.request',
286
+ storage: {
287
+ set: 'my.setStorage',
288
+ get: 'my.getStorage',
289
+ remove: 'my.removeStorage',
290
+ clear: 'my.clearStorage',
291
+ },
292
+ location: {
293
+ get: 'my.getLocation',
294
+ open: 'my.openLocation',
295
+ },
296
+ camera: {
297
+ take: 'my.cameraTake',
298
+ choose: 'my.chooseImage',
299
+ },
300
+ },
301
+ swan: {
302
+ request: 'swan.request',
303
+ storage: {
304
+ set: 'swan.setStorage',
305
+ get: 'swan.getStorage',
306
+ remove: 'swan.removeStorage',
307
+ clear: 'swan.clearStorage',
308
+ },
309
+ location: {
310
+ get: 'swan.getLocation',
311
+ open: 'swan.openLocation',
312
+ },
313
+ camera: {
314
+ take: 'swan.cameraTake',
315
+ choose: 'swan.chooseImage',
316
+ },
317
+ },
318
+ tt: {
319
+ request: 'tt.request',
320
+ storage: {
321
+ set: 'tt.setStorage',
322
+ get: 'tt.getStorage',
323
+ remove: 'tt.removeStorage',
324
+ clear: 'tt.clearStorage',
325
+ },
326
+ location: {
327
+ get: 'tt.getLocation',
328
+ open: 'tt.openLocation',
329
+ },
330
+ camera: {
331
+ take: 'tt.cameraTake',
332
+ choose: 'tt.chooseImage',
333
+ },
334
+ },
335
+ qq: {
336
+ request: 'qq.request',
337
+ storage: {
338
+ set: 'qq.setStorage',
339
+ get: 'qq.getStorage',
340
+ remove: 'qq.removeStorage',
341
+ clear: 'qq.clearStorage',
342
+ },
343
+ location: {
344
+ get: 'qq.getLocation',
345
+ open: 'qq.openLocation',
346
+ },
347
+ camera: {
348
+ take: 'qq.cameraTake',
349
+ choose: 'qq.chooseImage',
350
+ },
351
+ },
352
+ h5: {
353
+ request: 'fetch',
354
+ storage: {
355
+ set: 'localStorage.setItem',
356
+ get: 'localStorage.getItem',
357
+ remove: 'localStorage.removeItem',
358
+ clear: 'localStorage.clear',
359
+ },
360
+ location: {
361
+ get: 'navigator.geolocation.getCurrentPosition',
362
+ open: 'window.open',
363
+ },
364
+ camera: {
365
+ take: 'navigator.mediaDevices.getUserMedia',
366
+ choose: 'input[type=file].click()',
367
+ },
368
+ },
369
+ rn: {
370
+ request: 'fetch',
371
+ storage: {
372
+ set: 'AsyncStorage.setItem',
373
+ get: 'AsyncStorage.getItem',
374
+ remove: 'AsyncStorage.removeItem',
375
+ clear: 'AsyncStorage.clear',
376
+ },
377
+ location: {
378
+ get: 'Geolocation.getCurrentPosition',
379
+ open: 'Linking.openURL',
380
+ },
381
+ camera: {
382
+ take: 'Camera.takePictureAsync',
383
+ choose: 'ImagePicker.launchImageLibrary',
384
+ },
385
+ },
386
+ jd: {
387
+ request: 'jd.request',
388
+ storage: {
389
+ set: 'jd.setStorage',
390
+ get: 'jd.getStorage',
391
+ remove: 'jd.removeStorage',
392
+ clear: 'jd.clearStorage',
393
+ },
394
+ location: {
395
+ get: 'jd.getLocation',
396
+ open: 'jd.openLocation',
397
+ },
398
+ camera: {
399
+ take: 'jd.cameraTake',
400
+ choose: 'jd.chooseImage',
401
+ },
402
+ },
403
+ };
404
+
405
+ // ==================== 动画常量 ====================
406
+
407
+ /** 动画类型常量 */
408
+ export const ANIMATION_TYPES: Record<AnimationType, string> = {
409
+ fade: 'fade',
410
+ slide: 'slide',
411
+ scale: 'scale',
412
+ rotate: 'rotate',
413
+ bounce: 'bounce',
414
+ };
415
+
416
+ /** 动画方向常量 */
417
+ export const ANIMATION_DIRECTIONS: Record<AnimationDirection, string> = {
418
+ up: 'up',
419
+ down: 'down',
420
+ left: 'left',
421
+ right: 'right',
422
+ in: 'in',
423
+ out: 'out',
424
+ };
425
+
426
+ /** 动画时长配置 */
427
+ export const ANIMATION_DURATIONS = {
428
+ fast: 150,
429
+ normal: 300,
430
+ slow: 500,
431
+ slower: 800,
432
+ };
433
+
434
+ /** 动画缓动函数 */
435
+ export const ANIMATION_EASING = {
436
+ linear: 'linear',
437
+ ease: 'ease',
438
+ easeIn: 'ease-in',
439
+ easeOut: 'ease-out',
440
+ easeInOut: 'ease-in-out',
441
+ bounce: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
442
+ };
443
+
444
+ // ==================== 事件常量 ====================
445
+
446
+ /** 事件名称常量 */
447
+ export const EVENT_NAMES = {
448
+ click: 'click',
449
+ tap: 'tap',
450
+ touchStart: 'touchstart',
451
+ touchMove: 'touchmove',
452
+ touchEnd: 'touchend',
453
+ touchCancel: 'touchcancel',
454
+ input: 'input',
455
+ change: 'change',
456
+ focus: 'focus',
457
+ blur: 'blur',
458
+ submit: 'submit',
459
+ reset: 'reset',
460
+ scroll: 'scroll',
461
+ resize: 'resize',
462
+ load: 'load',
463
+ error: 'error',
464
+ };
465
+
466
+ /** 键盘按键常量 */
467
+ export const KEY_CODES = {
468
+ enter: 13,
469
+ escape: 27,
470
+ space: 32,
471
+ arrowUp: 38,
472
+ arrowDown: 40,
473
+ arrowLeft: 37,
474
+ arrowRight: 39,
475
+ tab: 9,
476
+ backspace: 8,
477
+ delete: 46,
478
+ home: 36,
479
+ end: 35,
480
+ pageUp: 33,
481
+ pageDown: 34,
482
+ };
483
+
484
+ // ==================== 网络请求常量 ====================
485
+
486
+ /** 请求方法常量 */
487
+ export const REQUEST_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'] as const;
488
+
489
+ /** HTTP状态码常量 */
490
+ export const HTTP_STATUS_CODES = {
491
+ OK: 200,
492
+ CREATED: 201,
493
+ ACCEPTED: 202,
494
+ NO_CONTENT: 204,
495
+ BAD_REQUEST: 400,
496
+ UNAUTHORIZED: 401,
497
+ FORBIDDEN: 403,
498
+ NOT_FOUND: 404,
499
+ METHOD_NOT_ALLOWED: 405,
500
+ CONFLICT: 409,
501
+ UNPROCESSABLE_ENTITY: 422,
502
+ INTERNAL_SERVER_ERROR: 500,
503
+ NOT_IMPLEMENTED: 501,
504
+ BAD_GATEWAY: 502,
505
+ SERVICE_UNAVAILABLE: 503,
506
+ GATEWAY_TIMEOUT: 504,
507
+ };
508
+
509
+ /** 请求超时时间 */
510
+ export const REQUEST_TIMEOUTS = {
511
+ short: 5000,
512
+ normal: 10000,
513
+ long: 30000,
514
+ veryLong: 60000,
515
+ };
516
+
517
+ /** 内容类型常量 */
518
+ export const CONTENT_TYPES = {
519
+ json: 'application/json',
520
+ form: 'application/x-www-form-urlencoded',
521
+ multipart: 'multipart/form-data',
522
+ text: 'text/plain',
523
+ html: 'text/html',
524
+ xml: 'application/xml',
525
+ };
526
+
527
+ // ==================== 错误码常量 ====================
528
+
529
+ /** 错误码常量 */
530
+ export const ERROR_CODES = {
531
+ // 通用错误码 (1000-1999)
532
+ UNKNOWN_ERROR: 1000,
533
+ INVALID_PARAMS: 1001,
534
+ NETWORK_ERROR: 1002,
535
+ TIMEOUT_ERROR: 1003,
536
+ PERMISSION_DENIED: 1004,
537
+ NOT_FOUND: 1005,
538
+ INTERNAL_ERROR: 1006,
539
+
540
+ // 平台相关错误码 (2000-2999)
541
+ PLATFORM_NOT_SUPPORTED: 2000,
542
+ API_NOT_AVAILABLE: 2001,
543
+ VERSION_TOO_LOW: 2002,
544
+
545
+ // 组件相关错误码 (3000-3999)
546
+ COMPONENT_NOT_FOUND: 3000,
547
+ INVALID_COMPONENT_CONFIG: 3001,
548
+ COMPONENT_RENDER_ERROR: 3002,
549
+
550
+ // 主题相关错误码 (4000-4999)
551
+ THEME_NOT_FOUND: 4000,
552
+ INVALID_THEME_CONFIG: 4001,
553
+ COLOR_FORMAT_ERROR: 4002,
554
+
555
+ // 表单相关错误码 (5000-5999)
556
+ FORM_VALIDATION_ERROR: 5000,
557
+ FIELD_REQUIRED: 5001,
558
+ INVALID_FORMAT: 5002,
559
+ VALUE_OUT_OF_RANGE: 5003,
560
+
561
+ // 存储相关错误码 (6000-6999)
562
+ STORAGE_QUOTA_EXCEEDED: 6000,
563
+ STORAGE_NOT_AVAILABLE: 6001,
564
+ STORAGE_KEY_NOT_FOUND: 6002,
565
+
566
+ // 网络相关错误码 (7000-7999)
567
+ REQUEST_FAILED: 7000,
568
+ RESPONSE_PARSE_ERROR: 7001,
569
+ UPLOAD_FAILED: 7002,
570
+ DOWNLOAD_FAILED: 7003,
571
+
572
+ // 权限相关错误码 (8000-8999)
573
+ LOCATION_PERMISSION_DENIED: 8000,
574
+ CAMERA_PERMISSION_DENIED: 8001,
575
+ STORAGE_PERMISSION_DENIED: 8002,
576
+ MICROPHONE_PERMISSION_DENIED: 8003,
577
+
578
+ // 业务相关错误码 (9000-9999)
579
+ USER_NOT_FOUND: 9000,
580
+ USER_ALREADY_EXISTS: 9001,
581
+ INVALID_CREDENTIALS: 9002,
582
+ ACCOUNT_LOCKED: 9003,
583
+ INSUFFICIENT_BALANCE: 9004,
584
+ };
585
+
586
+ /** 错误消息映射 */
587
+ export const ERROR_MESSAGES: Record<number, string> = {
588
+ [ERROR_CODES.UNKNOWN_ERROR]: '未知错误',
589
+ [ERROR_CODES.INVALID_PARAMS]: '参数错误',
590
+ [ERROR_CODES.NETWORK_ERROR]: '网络错误',
591
+ [ERROR_CODES.TIMEOUT_ERROR]: '请求超时',
592
+ [ERROR_CODES.PERMISSION_DENIED]: '权限不足',
593
+ [ERROR_CODES.NOT_FOUND]: '资源不存在',
594
+ [ERROR_CODES.INTERNAL_ERROR]: '内部错误',
595
+ [ERROR_CODES.PLATFORM_NOT_SUPPORTED]: '平台不支持',
596
+ [ERROR_CODES.API_NOT_AVAILABLE]: 'API不可用',
597
+ [ERROR_CODES.VERSION_TOO_LOW]: '版本过低',
598
+ [ERROR_CODES.COMPONENT_NOT_FOUND]: '组件不存在',
599
+ [ERROR_CODES.INVALID_COMPONENT_CONFIG]: '组件配置错误',
600
+ [ERROR_CODES.COMPONENT_RENDER_ERROR]: '组件渲染错误',
601
+ [ERROR_CODES.THEME_NOT_FOUND]: '主题不存在',
602
+ [ERROR_CODES.INVALID_THEME_CONFIG]: '主题配置错误',
603
+ [ERROR_CODES.COLOR_FORMAT_ERROR]: '颜色格式错误',
604
+ [ERROR_CODES.FORM_VALIDATION_ERROR]: '表单验证错误',
605
+ [ERROR_CODES.FIELD_REQUIRED]: '字段必填',
606
+ [ERROR_CODES.INVALID_FORMAT]: '格式错误',
607
+ [ERROR_CODES.VALUE_OUT_OF_RANGE]: '值超出范围',
608
+ [ERROR_CODES.STORAGE_QUOTA_EXCEEDED]: '存储空间不足',
609
+ [ERROR_CODES.STORAGE_NOT_AVAILABLE]: '存储不可用',
610
+ [ERROR_CODES.STORAGE_KEY_NOT_FOUND]: '存储键不存在',
611
+ [ERROR_CODES.REQUEST_FAILED]: '请求失败',
612
+ [ERROR_CODES.RESPONSE_PARSE_ERROR]: '响应解析错误',
613
+ [ERROR_CODES.UPLOAD_FAILED]: '上传失败',
614
+ [ERROR_CODES.DOWNLOAD_FAILED]: '下载失败',
615
+ [ERROR_CODES.LOCATION_PERMISSION_DENIED]: '位置权限被拒绝',
616
+ [ERROR_CODES.CAMERA_PERMISSION_DENIED]: '相机权限被拒绝',
617
+ [ERROR_CODES.STORAGE_PERMISSION_DENIED]: '存储权限被拒绝',
618
+ [ERROR_CODES.MICROPHONE_PERMISSION_DENIED]: '麦克风权限被拒绝',
619
+ [ERROR_CODES.USER_NOT_FOUND]: '用户不存在',
620
+ [ERROR_CODES.USER_ALREADY_EXISTS]: '用户已存在',
621
+ [ERROR_CODES.INVALID_CREDENTIALS]: '凭证无效',
622
+ [ERROR_CODES.ACCOUNT_LOCKED]: '账户已锁定',
623
+ [ERROR_CODES.INSUFFICIENT_BALANCE]: '余额不足',
624
+ };
625
+
626
+ // ==================== 正则表达式常量 ====================
627
+
628
+ /** 常用正则表达式 */
629
+ export const REGEX_PATTERNS = {
630
+ // 邮箱
631
+ email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
632
+
633
+ // 手机号
634
+ phone: /^1[3-9]\d{9}$/,
635
+
636
+ // 身份证号
637
+ idCard: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
638
+
639
+ // URL
640
+ url: /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/,
641
+
642
+ // IP地址
643
+ ipAddress: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
644
+
645
+ // 端口号
646
+ port: /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/,
647
+
648
+ // 中文
649
+ chinese: /^[\u4e00-\u9fa5]+$/,
650
+
651
+ // 英文
652
+ english: /^[a-zA-Z]+$/,
653
+
654
+ // 字母数字
655
+ alphanumeric: /^[a-zA-Z0-9]+$/,
656
+
657
+ // 数字
658
+ number: /^[0-9]+$/,
659
+
660
+ // 整数
661
+ integer: /^-?[0-9]+$/,
662
+
663
+ // 浮点数
664
+ float: /^-?[0-9]+(\.[0-9]+)?$/,
665
+
666
+ // 密码强度
667
+ strongPassword: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
668
+
669
+ // 日期格式 YYYY-MM-DD
670
+ date: /^\d{4}-\d{2}-\d{2}$/,
671
+
672
+ // 时间格式 HH:mm:ss
673
+ time: /^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/,
674
+
675
+ // 颜色值
676
+ color: /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,
677
+
678
+ // 邮政编码
679
+ zipCode: /^[1-9]\d{5}$/,
680
+
681
+ // 车牌号
682
+ licensePlate:
683
+ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/,
684
+ };
685
+
686
+ // ==================== 缓存键常量 ====================
687
+
688
+ /** 缓存键常量 */
689
+ export const CACHE_KEYS = {
690
+ // 用户相关
691
+ userInfo: 'user_info',
692
+ userToken: 'user_token',
693
+ userSettings: 'user_settings',
694
+
695
+ // 主题相关
696
+ themeMode: 'theme_mode',
697
+ themeConfig: 'theme_config',
698
+
699
+ // 应用相关
700
+ appConfig: 'app_config',
701
+ appSettings: 'app_settings',
702
+ lastUpdateTime: 'last_update_time',
703
+
704
+ // 缓存相关
705
+ cacheVersion: 'cache_version',
706
+ cacheTimestamp: 'cache_timestamp',
707
+ };
708
+
709
+ // ==================== Z-Index 层级常量 ====================
710
+
711
+ /** Z-Index 层级配置 */
712
+ export const Z_INDEX = {
713
+ modal: 1000,
714
+ dropdown: 900,
715
+ tooltip: 800,
716
+ notification: 700,
717
+ header: 600,
718
+ sidebar: 500,
719
+ content: 400,
720
+ footer: 300,
721
+ background: 200,
722
+ hidden: -1,
723
+ };
724
+
725
+ // ==================== 响应式断点常量 ====================
726
+
727
+ /** 响应式断点配置 */
728
+ export const RESPONSIVE_BREAKPOINTS = {
729
+ xs: 0,
730
+ sm: 576,
731
+ md: 768,
732
+ lg: 992,
733
+ xl: 1200,
734
+ xxl: 1400,
735
+ };
736
+
737
+ /** 响应式类名前缀 */
738
+ export const RESPONSIVE_PREFIXES = {
739
+ xs: 'xs',
740
+ sm: 'sm',
741
+ md: 'md',
742
+ lg: 'lg',
743
+ xl: 'xl',
744
+ xxl: 'xxl',
745
+ };
746
+
747
+ // ==================== 导出所有常量 ====================
748
+
749
+ /** 导出所有常量组 */
750
+ export const CONSTANTS = {
751
+ COMPONENT_SIZES,
752
+ COMPONENT_VARIANTS,
753
+ COMPONENT_STATUSES,
754
+ COMPONENT_PREFIX,
755
+ CLASS_PREFIX,
756
+ DATA_PREFIX,
757
+ TEST_ID_PREFIX,
758
+ THEME_MODES,
759
+ DEFAULT_THEME_COLORS,
760
+ DARK_THEME_COLORS,
761
+ DEFAULT_SPACING,
762
+ DEFAULT_TYPOGRAPHY,
763
+ DEFAULT_RADIUS,
764
+ BREAKPOINTS,
765
+ PLATFORM_NAMES,
766
+ PLATFORM_FEATURES,
767
+ PLATFORM_APIS,
768
+ ANIMATION_TYPES,
769
+ ANIMATION_DIRECTIONS,
770
+ ANIMATION_DURATIONS,
771
+ ANIMATION_EASING,
772
+ EVENT_NAMES,
773
+ KEY_CODES,
774
+ REQUEST_METHODS,
775
+ HTTP_STATUS_CODES,
776
+ REQUEST_TIMEOUTS,
777
+ CONTENT_TYPES,
778
+ ERROR_CODES,
779
+ ERROR_MESSAGES,
780
+ REGEX_PATTERNS,
781
+ CACHE_KEYS,
782
+ Z_INDEX,
783
+ RESPONSIVE_BREAKPOINTS,
784
+ RESPONSIVE_PREFIXES,
785
+ };