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.
- package/LICENSE +100 -0
- package/README.md +273 -0
- package/dist/js/index-6NJ3A1Dn.js +26535 -0
- package/dist/js/index-6NJ3A1Dn.js.map +1 -0
- package/dist/js/index-DFdcksbe.js +1165 -0
- package/dist/js/index-DFdcksbe.js.map +1 -0
- package/dist/js/index-DXRIkWX1.js +1148 -0
- package/dist/js/index-DXRIkWX1.js.map +1 -0
- package/dist/js/index-DffLRSro.js +26519 -0
- package/dist/js/index-DffLRSro.js.map +1 -0
- package/package.json +119 -0
- package/src/app.config.ts +55 -0
- package/src/app.scss +508 -0
- package/src/app.tsx +44 -0
- package/src/components/basic/Button/Button.styles.ts +130 -0
- package/src/components/basic/Button/Button.test.tsx +154 -0
- package/src/components/basic/Button/Button.tsx +93 -0
- package/src/components/basic/Button/Button.types.ts +45 -0
- package/src/components/basic/Button/index.tsx +6 -0
- package/src/components/basic/Divider/Divider.styles.ts +488 -0
- package/src/components/basic/Divider/Divider.test.tsx +551 -0
- package/src/components/basic/Divider/Divider.tsx +361 -0
- package/src/components/basic/Divider/Divider.types.ts +261 -0
- package/src/components/basic/Divider/index.tsx +25 -0
- package/src/components/basic/Icon/Icon.styles.ts +359 -0
- package/src/components/basic/Icon/Icon.test.tsx +357 -0
- package/src/components/basic/Icon/Icon.tsx +154 -0
- package/src/components/basic/Icon/Icon.types.ts +210 -0
- package/src/components/basic/Icon/index.tsx +22 -0
- package/src/components/basic/Text/Text.styles.ts +500 -0
- package/src/components/basic/Text/Text.test.tsx +299 -0
- package/src/components/basic/Text/Text.tsx +340 -0
- package/src/components/basic/Text/Text.types.ts +319 -0
- package/src/components/basic/Text/index.tsx +27 -0
- package/src/components/basic/Typography/Typography.styles.ts +346 -0
- package/src/components/basic/Typography/Typography.tsx +205 -0
- package/src/components/basic/Typography/Typography.types.ts +296 -0
- package/src/components/basic/Typography/index.tsx +14 -0
- package/src/components/basic/index.tsx +302 -0
- package/src/components/common/ErrorBoundary.tsx +87 -0
- package/src/components/common/LazyComponent.tsx +246 -0
- package/src/components/common/ResponsiveContainer.tsx +93 -0
- package/src/components/common/ResponsiveGrid.tsx +183 -0
- package/src/components/common/SecurityProvider.tsx +110 -0
- package/src/components/common/ThemeProvider.tsx +128 -0
- package/src/components/common/VirtualList.tsx +368 -0
- package/src/components/common/__tests__/ErrorBoundary.test.tsx +249 -0
- package/src/components/common/index.tsx +7 -0
- package/src/components/display/Avatar/Avatar.styles.ts +62 -0
- package/src/components/display/Avatar/Avatar.test.tsx +390 -0
- package/src/components/display/Avatar/Avatar.tsx +79 -0
- package/src/components/display/Avatar/Avatar.types.ts +40 -0
- package/src/components/display/Avatar/index.ts +3 -0
- package/src/components/display/Badge/Badge.tsx +42 -0
- package/src/components/display/Badge/Badge.types.ts +29 -0
- package/src/components/display/Badge/index.ts +2 -0
- package/src/components/display/Calendar/Calendar.styles.ts +255 -0
- package/src/components/display/Calendar/Calendar.test.tsx +30 -0
- package/src/components/display/Calendar/Calendar.tsx +337 -0
- package/src/components/display/Calendar/Calendar.types.ts +91 -0
- package/src/components/display/Calendar/index.ts +3 -0
- package/src/components/display/Card/Card.styles.ts +89 -0
- package/src/components/display/Card/Card.test.tsx +180 -0
- package/src/components/display/Card/Card.tsx +135 -0
- package/src/components/display/Card/Card.types.ts +55 -0
- package/src/components/display/Card/index.ts +3 -0
- package/src/components/display/Carousel/Carousel.styles.ts +206 -0
- package/src/components/display/Carousel/Carousel.tsx +295 -0
- package/src/components/display/Carousel/Carousel.types.ts +57 -0
- package/src/components/display/Carousel/index.ts +3 -0
- package/src/components/display/List/List.styles.ts +79 -0
- package/src/components/display/List/List.tsx +115 -0
- package/src/components/display/List/List.types.ts +68 -0
- package/src/components/display/List/index.ts +3 -0
- package/src/components/display/Rate/Rate.styles.ts +266 -0
- package/src/components/display/Rate/Rate.tsx +332 -0
- package/src/components/display/Rate/Rate.types.ts +111 -0
- package/src/components/display/Rate/index.ts +28 -0
- package/src/components/display/Table/Table.styles.ts +269 -0
- package/src/components/display/Table/Table.test.tsx +343 -0
- package/src/components/display/Table/Table.tsx +430 -0
- package/src/components/display/Table/Table.types.ts +255 -0
- package/src/components/display/Table/index.tsx +16 -0
- package/src/components/display/Tag/Tag.styles.ts +197 -0
- package/src/components/display/Tag/Tag.test.tsx +541 -0
- package/src/components/display/Tag/Tag.tsx +156 -0
- package/src/components/display/Tag/Tag.types.ts +49 -0
- package/src/components/display/Tag/index.ts +3 -0
- package/src/components/display/Timeline/Timeline.styles.ts +211 -0
- package/src/components/display/Timeline/Timeline.tsx +239 -0
- package/src/components/display/Timeline/Timeline.types.ts +56 -0
- package/src/components/display/Timeline/index.ts +3 -0
- package/src/components/display/index.tsx +143 -0
- package/src/components/feedback/Loading/Loading.styles.ts +117 -0
- package/src/components/feedback/Loading/Loading.test.tsx +534 -0
- package/src/components/feedback/Loading/Loading.tsx +127 -0
- package/src/components/feedback/Loading/Loading.types.ts +33 -0
- package/src/components/feedback/Loading/index.ts +9 -0
- package/src/components/feedback/Message/Message.styles.ts +41 -0
- package/src/components/feedback/Message/Message.test.tsx +234 -0
- package/src/components/feedback/Message/Message.tsx +96 -0
- package/src/components/feedback/Message/Message.types.ts +37 -0
- package/src/components/feedback/Message/index.ts +9 -0
- package/src/components/feedback/Modal/Modal.styles.ts +21 -0
- package/src/components/feedback/Modal/Modal.test.tsx +11 -0
- package/src/components/feedback/Modal/Modal.tsx +291 -0
- package/src/components/feedback/Modal/Modal.types.ts +141 -0
- package/src/components/feedback/Modal/index.tsx +11 -0
- package/src/components/feedback/Notification/Notification.styles.ts +443 -0
- package/src/components/feedback/Notification/Notification.test.tsx +401 -0
- package/src/components/feedback/Notification/Notification.tsx +370 -0
- package/src/components/feedback/Notification/Notification.types.ts +336 -0
- package/src/components/feedback/Notification/NotificationManager.tsx +376 -0
- package/src/components/feedback/Notification/index.ts +33 -0
- package/src/components/feedback/Notification/index.tsx +164 -0
- package/src/components/feedback/Progress/Progress.styles.ts +460 -0
- package/src/components/feedback/Progress/Progress.test.simple.tsx +14 -0
- package/src/components/feedback/Progress/Progress.test.tsx +312 -0
- package/src/components/feedback/Progress/Progress.tsx +508 -0
- package/src/components/feedback/Progress/Progress.types.ts +163 -0
- package/src/components/feedback/Progress/index.ts +3 -0
- package/src/components/feedback/Progress/index.tsx +38 -0
- package/src/components/feedback/Progress/utils/animation.ts +204 -0
- package/src/components/feedback/Progress/utils/index.ts +26 -0
- package/src/components/feedback/Progress/utils/progress-calculator.ts +217 -0
- package/src/components/feedback/Result/Result.styles.ts +139 -0
- package/src/components/feedback/Result/Result.tsx +233 -0
- package/src/components/feedback/Result/Result.types.ts +128 -0
- package/src/components/feedback/Result/index.tsx +3 -0
- package/src/components/feedback/Toast/Toast.styles.ts +17 -0
- package/src/components/feedback/Toast/Toast.test.tsx +10 -0
- package/src/components/feedback/Toast/Toast.tsx +372 -0
- package/src/components/feedback/Toast/Toast.types.ts +86 -0
- package/src/components/feedback/Toast/index.tsx +3 -0
- package/src/components/feedback/Tooltip/Tooltip.examples.tsx +458 -0
- package/src/components/feedback/Tooltip/Tooltip.styles.ts +346 -0
- package/src/components/feedback/Tooltip/Tooltip.test.tsx +446 -0
- package/src/components/feedback/Tooltip/Tooltip.tsx +283 -0
- package/src/components/feedback/Tooltip/Tooltip.types.ts +172 -0
- package/src/components/feedback/Tooltip/index.ts +3 -0
- package/src/components/feedback/Tooltip/index.tsx +258 -0
- package/src/components/feedback/index.tsx +164 -0
- package/src/components/form/Cascader/Cascader.styles.ts +526 -0
- package/src/components/form/Cascader/Cascader.test.tsx +77 -0
- package/src/components/form/Cascader/Cascader.tsx +585 -0
- package/src/components/form/Cascader/Cascader.types.ts +582 -0
- package/src/components/form/Cascader/hooks/index.ts +3 -0
- package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +16 -0
- package/src/components/form/Cascader/hooks/useCascaderOptions.ts +109 -0
- package/src/components/form/Cascader/hooks/useCascaderState.ts +133 -0
- package/src/components/form/Cascader/index.ts +25 -0
- package/src/components/form/Cascader/utils/formatDisplayValue.ts +19 -0
- package/src/components/form/Cascader/utils/index.ts +1 -0
- package/src/components/form/Checkbox/Checkbox.styles.ts +608 -0
- package/src/components/form/Checkbox/Checkbox.test.tsx +1140 -0
- package/src/components/form/Checkbox/Checkbox.tsx +496 -0
- package/src/components/form/Checkbox/Checkbox.types.ts +472 -0
- package/src/components/form/Checkbox/CheckboxGroup.tsx +444 -0
- package/src/components/form/Checkbox/index.tsx +27 -0
- package/src/components/form/DatePicker/DatePicker.styles.ts +393 -0
- package/src/components/form/DatePicker/DatePicker.test.tsx +407 -0
- package/src/components/form/DatePicker/DatePicker.tsx +360 -0
- package/src/components/form/DatePicker/DatePicker.types.ts +247 -0
- package/src/components/form/DatePicker/index.tsx +15 -0
- package/src/components/form/Form/Form.styles.ts +357 -0
- package/src/components/form/Form/Form.test.tsx +122 -0
- package/src/components/form/Form/Form.tsx +695 -0
- package/src/components/form/Form/Form.types.ts +407 -0
- package/src/components/form/Form/index.tsx +31 -0
- package/src/components/form/Input/Input.enhanced.tsx +732 -0
- package/src/components/form/Input/Input.styles.ts +438 -0
- package/src/components/form/Input/Input.test.tsx +494 -0
- package/src/components/form/Input/Input.tsx +541 -0
- package/src/components/form/Input/Input.types.ts +285 -0
- package/src/components/form/Input/index.tsx +26 -0
- package/src/components/form/InputNumber/InputNumber.styles.ts +665 -0
- package/src/components/form/InputNumber/InputNumber.tsx +370 -0
- package/src/components/form/InputNumber/InputNumber.types.ts +318 -0
- package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +32 -0
- package/src/components/form/InputNumber/components/InputNumberControls.tsx +42 -0
- package/src/components/form/InputNumber/components/index.ts +2 -0
- package/src/components/form/InputNumber/hooks/index.ts +4 -0
- package/src/components/form/InputNumber/hooks/useInputNumberState.ts +315 -0
- package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +147 -0
- package/src/components/form/InputNumber/index.ts +25 -0
- package/src/components/form/Radio/Radio.styles.ts +458 -0
- package/src/components/form/Radio/Radio.test.tsx +547 -0
- package/src/components/form/Radio/Radio.tsx +283 -0
- package/src/components/form/Radio/Radio.types.ts +410 -0
- package/src/components/form/Radio/index.tsx +21 -0
- package/src/components/form/Select/Select.styles.ts +514 -0
- package/src/components/form/Select/Select.test.tsx +648 -0
- package/src/components/form/Select/Select.tsx +474 -0
- package/src/components/form/Select/Select.types.ts +428 -0
- package/src/components/form/Select/index.tsx +30 -0
- package/src/components/form/Slider/Slider.styles.ts +139 -0
- package/src/components/form/Slider/Slider.test.tsx +553 -0
- package/src/components/form/Slider/Slider.tsx +326 -0
- package/src/components/form/Slider/Slider.types.ts +108 -0
- package/src/components/form/Slider/index.tsx +10 -0
- package/src/components/form/Switch/Switch.styles.ts +540 -0
- package/src/components/form/Switch/Switch.test.tsx +345 -0
- package/src/components/form/Switch/Switch.tsx +464 -0
- package/src/components/form/Switch/Switch.types.ts +386 -0
- package/src/components/form/Switch/index.tsx +26 -0
- package/src/components/form/Textarea/Textarea.styles.ts +592 -0
- package/src/components/form/Textarea/Textarea.test.tsx +1075 -0
- package/src/components/form/Textarea/Textarea.tsx +602 -0
- package/src/components/form/Textarea/Textarea.types.ts +371 -0
- package/src/components/form/Textarea/index.tsx +26 -0
- package/src/components/form/TimePicker/TimePicker.styles.ts +438 -0
- package/src/components/form/TimePicker/TimePicker.test.tsx +306 -0
- package/src/components/form/TimePicker/TimePicker.tsx +228 -0
- package/src/components/form/TimePicker/TimePicker.types.ts +385 -0
- package/src/components/form/TimePicker/index.ts +21 -0
- package/src/components/form/Transfer/Transfer.styles.ts +502 -0
- package/src/components/form/Transfer/Transfer.test.tsx +316 -0
- package/src/components/form/Transfer/Transfer.tsx +402 -0
- package/src/components/form/Transfer/Transfer.types.ts +557 -0
- package/src/components/form/Transfer/components/TransferItem.tsx +101 -0
- package/src/components/form/Transfer/components/TransferList.tsx +285 -0
- package/src/components/form/Transfer/components/TransferOperations.tsx +84 -0
- package/src/components/form/Transfer/components/TransferPagination.tsx +135 -0
- package/src/components/form/Transfer/components/TransferSearch.tsx +88 -0
- package/src/components/form/Transfer/components/index.ts +6 -0
- package/src/components/form/Transfer/hooks/index.ts +3 -0
- package/src/components/form/Transfer/hooks/useTransferData.ts +192 -0
- package/src/components/form/Transfer/hooks/useTransferState.ts +114 -0
- package/src/components/form/Transfer/index.ts +33 -0
- package/src/components/form/Upload/Upload.styles.ts +145 -0
- package/src/components/form/Upload/Upload.test.tsx +10 -0
- package/src/components/form/Upload/Upload.tsx +451 -0
- package/src/components/form/Upload/Upload.types.ts +200 -0
- package/src/components/form/Upload/index.tsx +12 -0
- package/src/components/form/index.tsx +121 -0
- package/src/components/index.tsx +146 -0
- package/src/components/layout/Affix/Affix.styles.ts +37 -0
- package/src/components/layout/Affix/Affix.test.tsx +10 -0
- package/src/components/layout/Affix/Affix.tsx +91 -0
- package/src/components/layout/Affix/Affix.types.ts +29 -0
- package/src/components/layout/Affix/index.tsx +3 -0
- package/src/components/layout/Col/Col.styles.ts +185 -0
- package/src/components/layout/Col/Col.test.tsx +535 -0
- package/src/components/layout/Col/Col.tsx +115 -0
- package/src/components/layout/Col/Col.types.ts +59 -0
- package/src/components/layout/Col/index.tsx +3 -0
- package/src/components/layout/Container/Container.styles.ts +161 -0
- package/src/components/layout/Container/Container.test.tsx +380 -0
- package/src/components/layout/Container/Container.tsx +132 -0
- package/src/components/layout/Container/Container.types.ts +63 -0
- package/src/components/layout/Container/index.tsx +3 -0
- package/src/components/layout/Grid/Grid.styles.ts +183 -0
- package/src/components/layout/Grid/Grid.test.tsx +637 -0
- package/src/components/layout/Grid/Grid.tsx +173 -0
- package/src/components/layout/Grid/Grid.types.ts +78 -0
- package/src/components/layout/Grid/index.tsx +3 -0
- package/src/components/layout/Layout/Content.tsx +38 -0
- package/src/components/layout/Layout/Footer.tsx +38 -0
- package/src/components/layout/Layout/Header.tsx +38 -0
- package/src/components/layout/Layout/Layout.styles.ts +84 -0
- package/src/components/layout/Layout/Layout.test.tsx +10 -0
- package/src/components/layout/Layout/Layout.tsx +39 -0
- package/src/components/layout/Layout/Layout.types.ts +58 -0
- package/src/components/layout/Layout/Sider.tsx +56 -0
- package/src/components/layout/Layout/index.tsx +8 -0
- package/src/components/layout/Row/Row.styles.ts +159 -0
- package/src/components/layout/Row/Row.test.tsx +467 -0
- package/src/components/layout/Row/Row.tsx +139 -0
- package/src/components/layout/Row/Row.types.ts +60 -0
- package/src/components/layout/Row/index.tsx +3 -0
- package/src/components/layout/Space/Space.styles.ts +255 -0
- package/src/components/layout/Space/Space.test.tsx +682 -0
- package/src/components/layout/Space/Space.tsx +211 -0
- package/src/components/layout/Space/Space.types.ts +92 -0
- package/src/components/layout/Space/index.tsx +12 -0
- package/src/components/layout/index.tsx +68 -0
- package/src/components/navigation/Menu/Menu.styles.ts +779 -0
- package/src/components/navigation/Menu/Menu.tsx +355 -0
- package/src/components/navigation/Menu/Menu.types.ts +231 -0
- package/src/components/navigation/Menu/Menu.utils.ts +187 -0
- package/src/components/navigation/Menu/MenuItem.tsx +126 -0
- package/src/components/navigation/Menu/SubMenu.tsx +148 -0
- package/src/components/navigation/Menu/__tests__/Menu.test.tsx +687 -0
- package/src/components/navigation/Menu/index.tsx +124 -0
- package/src/components/navigation/NavBar/NavBar.styles.ts +129 -0
- package/src/components/navigation/NavBar/NavBar.test.tsx +287 -0
- package/src/components/navigation/NavBar/NavBar.tsx +231 -0
- package/src/components/navigation/NavBar/NavBar.types.ts +54 -0
- package/src/components/navigation/NavBar/index.tsx +3 -0
- package/src/components/navigation/Pagination/Pagination.styles.ts +187 -0
- package/src/components/navigation/Pagination/Pagination.test.tsx +673 -0
- package/src/components/navigation/Pagination/Pagination.tsx +395 -0
- package/src/components/navigation/Pagination/Pagination.types.ts +86 -0
- package/src/components/navigation/Pagination/index.ts +18 -0
- package/src/components/navigation/Pagination/index.tsx +9 -0
- package/src/components/navigation/Steps/Step.tsx +56 -0
- package/src/components/navigation/Steps/Steps.styles.ts +154 -0
- package/src/components/navigation/Steps/Steps.test.tsx +12 -0
- package/src/components/navigation/Steps/Steps.tsx +113 -0
- package/src/components/navigation/Steps/Steps.types.ts +47 -0
- package/src/components/navigation/Steps/index.tsx +3 -0
- package/src/components/navigation/Tabs/Tabs.styles.ts +199 -0
- package/src/components/navigation/Tabs/Tabs.test.tsx +661 -0
- package/src/components/navigation/Tabs/Tabs.tsx +253 -0
- package/src/components/navigation/Tabs/Tabs.types.ts +114 -0
- package/src/components/navigation/Tabs/index.tsx +3 -0
- package/src/components/navigation/Tree/Tree.styles.ts +553 -0
- package/src/components/navigation/Tree/Tree.test.basic.tsx +7 -0
- package/src/components/navigation/Tree/Tree.test.functional.tsx +496 -0
- package/src/components/navigation/Tree/Tree.test.import.check.tsx +6 -0
- package/src/components/navigation/Tree/Tree.test.import.tsx +6 -0
- package/src/components/navigation/Tree/Tree.test.minimal.tsx +5 -0
- package/src/components/navigation/Tree/Tree.test.simple.tsx +30 -0
- package/src/components/navigation/Tree/Tree.test.tsx +908 -0
- package/src/components/navigation/Tree/Tree.test.working.tsx +673 -0
- package/src/components/navigation/Tree/Tree.tsx +600 -0
- package/src/components/navigation/Tree/Tree.types.ts +909 -0
- package/src/components/navigation/Tree/Tree.utils.ts +452 -0
- package/src/components/navigation/Tree/index.ts +33 -0
- package/src/components/navigation/Tree/index.tsx +23 -0
- package/src/components/navigation/index.tsx +83 -0
- package/src/constants/index.ts +785 -0
- package/src/hooks/index.ts +110 -0
- package/src/hooks/types.ts +10 -0
- package/src/hooks/useAsync.ts +65 -0
- package/src/hooks/useEventHandling.ts +444 -0
- package/src/hooks/useLifecycle.ts +399 -0
- package/src/hooks/usePerformance.ts +441 -0
- package/src/hooks/usePerformanceMonitor.ts +348 -0
- package/src/hooks/usePlatform.ts +62 -0
- package/src/hooks/useRequest.test.ts +11 -0
- package/src/hooks/useRequest.ts +135 -0
- package/src/hooks/useStateManagement.ts +300 -0
- package/src/hooks/useStyle.ts +537 -0
- package/src/hooks/useTheme.ts +347 -0
- package/src/hooks/useVirtualScroll.ts +331 -0
- package/src/index.ts +298 -0
- package/src/platform/index.ts +1188 -0
- package/src/providers/AppProvider.test.tsx +63 -0
- package/src/providers/AppProvider.tsx +155 -0
- package/src/providers/index.ts +1 -0
- package/src/theme/ThemeProvider.tsx +283 -0
- package/src/theme/ThemeProvider.types.ts +26 -0
- package/src/theme/animations.tsx +660 -0
- package/src/theme/defaults.ts +188 -0
- package/src/theme/design-system.ts +562 -0
- package/src/theme/design-tokens.ts +1136 -0
- package/src/theme/generated/dark-theme.scss +120 -0
- package/src/theme/generated/tokens.css +441 -0
- package/src/theme/generated/tokens.scss +320 -0
- package/src/theme/index.ts +120 -0
- package/src/theme/responsive.tsx +193 -0
- package/src/theme/styles/mixins.scss +612 -0
- package/src/theme/styles/variables.scss +295 -0
- package/src/theme/styles.ts +403 -0
- package/src/theme/tokens/colors.ts +256 -0
- package/src/theme/tokens/effects.ts +260 -0
- package/src/theme/tokens/index.ts +217 -0
- package/src/theme/tokens/spacing.ts +137 -0
- package/src/theme/tokens/typography.ts +186 -0
- package/src/theme/types.ts +188 -0
- package/src/theme/useThemeUtils.ts +313 -0
- package/src/theme/utils.ts +501 -0
- package/src/theme/variables.ts +583 -0
- package/src/types/accessibility.ts +51 -0
- package/src/types/button.ts +562 -0
- package/src/types/component-props.ts +317 -0
- package/src/types/env.d.ts +20 -0
- package/src/types/index.ts +427 -0
- package/src/types/modules.d.ts +40 -0
- package/src/types/standardized-components.ts +544 -0
- package/src/types/taro-adapter.d.ts +174 -0
- package/src/types/taro-components.d.ts +73 -0
- package/src/types/utils.ts +410 -0
- package/src/utils/__tests__/inputValidator.test.ts +338 -0
- package/src/utils/__tests__/responsiveUtils.test.ts +310 -0
- package/src/utils/__tests__/xssProtection.test.ts +268 -0
- package/src/utils/cache.ts +83 -0
- package/src/utils/createNamespace.ts +24 -0
- package/src/utils/environment.ts +95 -0
- package/src/utils/error-handler.ts +88 -0
- package/src/utils/errorLogger.ts +197 -0
- package/src/utils/formatUtils.ts +444 -0
- package/src/utils/index.ts +115 -0
- package/src/utils/inputValidator.ts +261 -0
- package/src/utils/network/http-client.test.ts +18 -0
- package/src/utils/network/http-client.ts +151 -0
- package/src/utils/performance/performance.ts +850 -0
- package/src/utils/responsiveUtils.ts +357 -0
- package/src/utils/rtl-support.ts +344 -0
- package/src/utils/security/api-security.ts +386 -0
- package/src/utils/security/xss-protection.ts +69 -0
- package/src/utils/securityHeaders.ts +314 -0
- package/src/utils/typeHelpers.ts +16 -0
- package/src/utils/types/dataProcessing.ts +543 -0
- package/src/utils/types/typeHelpers.ts +187 -0
- package/src/utils/xssProtection.ts +420 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { PlatformDetector } from '../../../utils';
|
|
2
|
+
import type { TextProps, TextSize, TextWeight, TextColor, TextStatus } from './Text.types';
|
|
3
|
+
|
|
4
|
+
/** 样式工具类 */
|
|
5
|
+
export class TextStyles {
|
|
6
|
+
/** 获取平台前缀 */
|
|
7
|
+
private static getPlatformPrefix(): string {
|
|
8
|
+
const platformValue = PlatformDetector.getPlatform();
|
|
9
|
+
// For test environment, default to h5
|
|
10
|
+
if (process.env['NODE_ENV'] === 'test' || platformValue === 'unknown') {
|
|
11
|
+
return 'taro-uno-h5-text';
|
|
12
|
+
}
|
|
13
|
+
return `taro-uno-${platformValue}-text`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 尺寸映射 */
|
|
17
|
+
static readonly SIZE_MAP: Record<TextSize, { fontSize: number; _lineHeight: number }> = {
|
|
18
|
+
xs: { fontSize: 20, _lineHeight: 1.25 },
|
|
19
|
+
sm: { fontSize: 24, _lineHeight: 1.375 },
|
|
20
|
+
md: { fontSize: 28, _lineHeight: 1.5 },
|
|
21
|
+
lg: { fontSize: 32, _lineHeight: 1.625 },
|
|
22
|
+
xl: { fontSize: 36, _lineHeight: 1.75 },
|
|
23
|
+
'2xl': { fontSize: 40, _lineHeight: 1.875 },
|
|
24
|
+
'3xl': { fontSize: 48, _lineHeight: 2 },
|
|
25
|
+
'4xl': { fontSize: 56, _lineHeight: 2.125 },
|
|
26
|
+
'5xl': { fontSize: 64, _lineHeight: 2.25 },
|
|
27
|
+
'6xl': { fontSize: 72, _lineHeight: 2.375 },
|
|
28
|
+
'7xl': { fontSize: 80, _lineHeight: 2.5 },
|
|
29
|
+
'8xl': { fontSize: 96, _lineHeight: 2.625 },
|
|
30
|
+
'9xl': { fontSize: 112, _lineHeight: 2.75 },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** 权重映射 */
|
|
34
|
+
static readonly WEIGHT_MAP: Record<TextWeight, number> = {
|
|
35
|
+
thin: 100,
|
|
36
|
+
extralight: 200,
|
|
37
|
+
light: 300,
|
|
38
|
+
normal: 400,
|
|
39
|
+
medium: 500,
|
|
40
|
+
semibold: 600,
|
|
41
|
+
bold: 700,
|
|
42
|
+
extrabold: 800,
|
|
43
|
+
black: 900,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** 颜色映射 */
|
|
47
|
+
static readonly COLOR_MAP: Record<TextColor, string> = {
|
|
48
|
+
primary: '#0ea5e9',
|
|
49
|
+
secondary: '#6b7280',
|
|
50
|
+
success: '#22c55e',
|
|
51
|
+
warning: '#f59e0b',
|
|
52
|
+
error: '#ef4444',
|
|
53
|
+
info: '#3b82f6',
|
|
54
|
+
_disabled: '#9ca3af',
|
|
55
|
+
inherit: 'inherit',
|
|
56
|
+
current: 'currentColor',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** 状态映射 */
|
|
60
|
+
static readonly STATUS_MAP: Record<TextStatus, { opacity: number; cursor: string; pointerEvents: string }> = {
|
|
61
|
+
normal: { opacity: 1, cursor: 'default', pointerEvents: 'auto' },
|
|
62
|
+
active: { opacity: 0.8, cursor: 'pointer', pointerEvents: 'auto' },
|
|
63
|
+
disabled: { opacity: 0.5, cursor: 'not-allowed', pointerEvents: 'none' },
|
|
64
|
+
loading: { opacity: 0.7, cursor: 'not-allowed', pointerEvents: 'none' },
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** 行高映射 */
|
|
68
|
+
static readonly LINE_HEIGHT_MAP: Record<string, number> = {
|
|
69
|
+
none: 1,
|
|
70
|
+
tight: 1.25,
|
|
71
|
+
snug: 1.375,
|
|
72
|
+
normal: 1.5,
|
|
73
|
+
relaxed: 1.625,
|
|
74
|
+
loose: 1.75,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** 字母间距映射 */
|
|
78
|
+
static readonly LETTER_SPACING_MAP: Record<string, string> = {
|
|
79
|
+
tighter: '-0.05em',
|
|
80
|
+
tight: '-0.025em',
|
|
81
|
+
normal: '0',
|
|
82
|
+
wide: '0.025em',
|
|
83
|
+
wider: '0.05em',
|
|
84
|
+
widest: '0.1em',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/** 生成文本类名 */
|
|
88
|
+
static getClassName(props: Partial<TextProps>): string {
|
|
89
|
+
const prefix = this.getPlatformPrefix();
|
|
90
|
+
const {
|
|
91
|
+
size = 'md',
|
|
92
|
+
weight = 'normal',
|
|
93
|
+
color = 'inherit',
|
|
94
|
+
align = 'left',
|
|
95
|
+
decoration = 'none',
|
|
96
|
+
transform = 'none',
|
|
97
|
+
overflow = 'clip',
|
|
98
|
+
direction = 'ltr',
|
|
99
|
+
fontStyle = 'normal',
|
|
100
|
+
variant = 'normal',
|
|
101
|
+
status = 'normal',
|
|
102
|
+
type = 'body',
|
|
103
|
+
clickable = false,
|
|
104
|
+
loading = false,
|
|
105
|
+
disabled = false,
|
|
106
|
+
block = false,
|
|
107
|
+
inlineBlock = false,
|
|
108
|
+
selectable = false,
|
|
109
|
+
copyable = false,
|
|
110
|
+
animated = false,
|
|
111
|
+
underline = false,
|
|
112
|
+
strikethrough = false,
|
|
113
|
+
highlight = false,
|
|
114
|
+
ellipsis = false,
|
|
115
|
+
wrap = true,
|
|
116
|
+
breakWord = false,
|
|
117
|
+
className = '',
|
|
118
|
+
} = props;
|
|
119
|
+
|
|
120
|
+
const classes = [
|
|
121
|
+
prefix,
|
|
122
|
+
`${prefix}--${size}`,
|
|
123
|
+
`${prefix}--${weight}`,
|
|
124
|
+
`${prefix}--${color}`,
|
|
125
|
+
`${prefix}--${align}`,
|
|
126
|
+
`${prefix}--${decoration}`,
|
|
127
|
+
`${prefix}--${transform}`,
|
|
128
|
+
`${prefix}--${overflow}`,
|
|
129
|
+
`${prefix}--${direction}`,
|
|
130
|
+
`${prefix}--${fontStyle}`,
|
|
131
|
+
`${prefix}--${variant}`,
|
|
132
|
+
`${prefix}--${status}`,
|
|
133
|
+
`${prefix}--${type}`,
|
|
134
|
+
clickable && `${prefix}--clickable`,
|
|
135
|
+
loading && `${prefix}--loading`,
|
|
136
|
+
disabled && `${prefix}--disabled`,
|
|
137
|
+
block && `${prefix}--block`,
|
|
138
|
+
inlineBlock && `${prefix}--inline-block`,
|
|
139
|
+
selectable && `${prefix}--selectable`,
|
|
140
|
+
copyable && `${prefix}--copyable`,
|
|
141
|
+
animated && `${prefix}--animated`,
|
|
142
|
+
underline && `${prefix}--underline`,
|
|
143
|
+
strikethrough && `${prefix}--strikethrough`,
|
|
144
|
+
highlight && `${prefix}--highlight`,
|
|
145
|
+
ellipsis && `${prefix}--ellipsis`,
|
|
146
|
+
wrap && `${prefix}--wrap`,
|
|
147
|
+
breakWord && `${prefix}--break-word`,
|
|
148
|
+
className,
|
|
149
|
+
].filter(Boolean);
|
|
150
|
+
|
|
151
|
+
return classes.join(' ');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** 生成文本样式 */
|
|
155
|
+
static getStyle(props: Partial<TextProps>): React.CSSProperties {
|
|
156
|
+
const {
|
|
157
|
+
size = 'md',
|
|
158
|
+
weight = 'normal',
|
|
159
|
+
color = 'inherit',
|
|
160
|
+
align = 'left',
|
|
161
|
+
decoration = 'none',
|
|
162
|
+
transform = 'none',
|
|
163
|
+
overflow = 'clip',
|
|
164
|
+
direction = 'ltr',
|
|
165
|
+
fontStyle = 'normal',
|
|
166
|
+
variant = 'normal',
|
|
167
|
+
letterSpacing,
|
|
168
|
+
lineHeight,
|
|
169
|
+
status = 'normal',
|
|
170
|
+
loading = false,
|
|
171
|
+
disabled = false,
|
|
172
|
+
maxLines,
|
|
173
|
+
animated = false,
|
|
174
|
+
animationDuration = 300,
|
|
175
|
+
underline = false,
|
|
176
|
+
strikethrough = false,
|
|
177
|
+
highlight = false,
|
|
178
|
+
highlightColor = '#fef3c7',
|
|
179
|
+
ellipsis = false,
|
|
180
|
+
wrap = true,
|
|
181
|
+
breakWord = false,
|
|
182
|
+
textShadow,
|
|
183
|
+
textOutline,
|
|
184
|
+
gradient,
|
|
185
|
+
fontFamily,
|
|
186
|
+
wordSpacing,
|
|
187
|
+
textIndent,
|
|
188
|
+
whiteSpace,
|
|
189
|
+
verticalAlign,
|
|
190
|
+
writingMode,
|
|
191
|
+
textRendering,
|
|
192
|
+
style = {},
|
|
193
|
+
} = props;
|
|
194
|
+
|
|
195
|
+
const sizeStyles = this.SIZE_MAP[size];
|
|
196
|
+
const weightStyles = this.WEIGHT_MAP[weight];
|
|
197
|
+
const colorStyles = this.COLOR_MAP[color];
|
|
198
|
+
const statusStyles = this.STATUS_MAP[status];
|
|
199
|
+
|
|
200
|
+
// 处理字母间距
|
|
201
|
+
const _letterSpacingValue =
|
|
202
|
+
typeof letterSpacing === 'string' ? this.LETTER_SPACING_MAP[letterSpacing] : `${letterSpacing}px`;
|
|
203
|
+
|
|
204
|
+
// 处理行高
|
|
205
|
+
const _lineHeightValue = typeof lineHeight === 'string' ? this.LINE_HEIGHT_MAP[lineHeight] : lineHeight;
|
|
206
|
+
|
|
207
|
+
// 处理文本装饰
|
|
208
|
+
const textDecorationValue = [];
|
|
209
|
+
if (underline) textDecorationValue.push('underline');
|
|
210
|
+
if (strikethrough) textDecorationValue.push('line-through');
|
|
211
|
+
const finalDecoration = textDecorationValue.length > 0 ? textDecorationValue.join(' ') : decoration;
|
|
212
|
+
|
|
213
|
+
// 处理渐变背景
|
|
214
|
+
const backgroundStyle = gradient
|
|
215
|
+
? {
|
|
216
|
+
backgroundImage: `linear-gradient(${gradient.direction || 'to right'}, ${gradient.start}, ${gradient.end})`,
|
|
217
|
+
WebkitBackgroundClip: 'text',
|
|
218
|
+
WebkitTextFillColor: 'transparent',
|
|
219
|
+
backgroundClip: 'text',
|
|
220
|
+
textFillColor: 'transparent',
|
|
221
|
+
}
|
|
222
|
+
: {};
|
|
223
|
+
|
|
224
|
+
// 处理最大行数
|
|
225
|
+
const overflowStyle = maxLines
|
|
226
|
+
? {
|
|
227
|
+
display: '-webkit-box',
|
|
228
|
+
WebkitBoxOrient: 'vertical' as any,
|
|
229
|
+
WebkitLineClamp: maxLines,
|
|
230
|
+
overflow: 'hidden',
|
|
231
|
+
textOverflow: 'ellipsis',
|
|
232
|
+
}
|
|
233
|
+
: {};
|
|
234
|
+
|
|
235
|
+
// 处理省略号
|
|
236
|
+
const ellipsisStyle = ellipsis
|
|
237
|
+
? {
|
|
238
|
+
whiteSpace: 'nowrap',
|
|
239
|
+
overflow: 'hidden',
|
|
240
|
+
textOverflow: 'ellipsis',
|
|
241
|
+
}
|
|
242
|
+
: {};
|
|
243
|
+
|
|
244
|
+
// 处理换行
|
|
245
|
+
const wrapStyle = !wrap
|
|
246
|
+
? {
|
|
247
|
+
whiteSpace: 'nowrap',
|
|
248
|
+
}
|
|
249
|
+
: {};
|
|
250
|
+
|
|
251
|
+
// 处理断词
|
|
252
|
+
const breakWordStyle = breakWord
|
|
253
|
+
? {
|
|
254
|
+
wordBreak: 'break-word' as any,
|
|
255
|
+
overflowWrap: 'break-word' as any,
|
|
256
|
+
}
|
|
257
|
+
: {};
|
|
258
|
+
|
|
259
|
+
return {
|
|
260
|
+
...sizeStyles,
|
|
261
|
+
fontWeight: weightStyles,
|
|
262
|
+
color: colorStyles,
|
|
263
|
+
textAlign: align,
|
|
264
|
+
textDecoration: finalDecoration,
|
|
265
|
+
textTransform: transform,
|
|
266
|
+
textOverflow: overflow,
|
|
267
|
+
direction,
|
|
268
|
+
fontStyle,
|
|
269
|
+
fontVariant: variant,
|
|
270
|
+
letterSpacing: _letterSpacingValue,
|
|
271
|
+
lineHeight: _lineHeightValue,
|
|
272
|
+
opacity: (loading || disabled) ? statusStyles['opacity'] : 1,
|
|
273
|
+
cursor: (loading || disabled) ? statusStyles['cursor'] : 'default',
|
|
274
|
+
pointerEvents: ((loading || disabled) ? statusStyles['pointerEvents'] : 'auto') as any,
|
|
275
|
+
transition: animated ? `all ${animationDuration}ms ease-in-out` : 'none',
|
|
276
|
+
backgroundColor: highlight ? highlightColor : 'transparent',
|
|
277
|
+
textShadow,
|
|
278
|
+
WebkitTextStroke: textOutline ? `${textOutline}px currentColor` : undefined,
|
|
279
|
+
fontFamily: Array.isArray(fontFamily) ? fontFamily.join(', ') : fontFamily,
|
|
280
|
+
wordSpacing: typeof wordSpacing === 'number' ? `${wordSpacing}px` : wordSpacing,
|
|
281
|
+
textIndent: typeof textIndent === 'number' ? `${textIndent}px` : textIndent,
|
|
282
|
+
whiteSpace,
|
|
283
|
+
verticalAlign,
|
|
284
|
+
writingMode,
|
|
285
|
+
textRendering,
|
|
286
|
+
...backgroundStyle,
|
|
287
|
+
...overflowStyle,
|
|
288
|
+
...ellipsisStyle,
|
|
289
|
+
...wrapStyle,
|
|
290
|
+
...breakWordStyle,
|
|
291
|
+
...style,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** 生成链接样式 */
|
|
296
|
+
static getLinkStyle(props: {
|
|
297
|
+
color?: string;
|
|
298
|
+
underline?: boolean;
|
|
299
|
+
visited?: boolean;
|
|
300
|
+
active?: boolean;
|
|
301
|
+
hover?: boolean;
|
|
302
|
+
}): React.CSSProperties {
|
|
303
|
+
const { color = '#0ea5e9', underline = true, visited, active, hover } = props;
|
|
304
|
+
|
|
305
|
+
return {
|
|
306
|
+
color: visited ? '#7c3aed' : active ? '#0369a1' : hover ? '#0284c7' : color,
|
|
307
|
+
textDecoration: underline ? 'underline' : 'none',
|
|
308
|
+
cursor: 'pointer',
|
|
309
|
+
transition: 'color 0.2s ease-in-out',
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** 生成代码样式 */
|
|
314
|
+
static getCodeStyle(props: { variant?: 'inline' | 'block'; language?: string }): React.CSSProperties {
|
|
315
|
+
const { variant = 'inline' } = props;
|
|
316
|
+
|
|
317
|
+
const baseStyle: React.CSSProperties = {
|
|
318
|
+
fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
|
|
319
|
+
fontSize: '0.875em',
|
|
320
|
+
backgroundColor: '#f3f4f6',
|
|
321
|
+
padding: variant === 'inline' ? '0.125em 0.25em' : '0.5em',
|
|
322
|
+
borderRadius: '0.25em',
|
|
323
|
+
border: '1px solid #e5e7eb',
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
if (variant === 'block') {
|
|
327
|
+
return {
|
|
328
|
+
...baseStyle,
|
|
329
|
+
display: 'block',
|
|
330
|
+
padding: '1em',
|
|
331
|
+
overflowX: 'auto',
|
|
332
|
+
whiteSpace: 'pre',
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return baseStyle;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** 生成引用样式 */
|
|
340
|
+
static getQuoteStyle(props: {
|
|
341
|
+
variant?: 'solid' | 'dashed' | 'dotted';
|
|
342
|
+
position?: 'left' | 'right';
|
|
343
|
+
}): React.CSSProperties {
|
|
344
|
+
const { variant = 'solid', position = 'left' } = props;
|
|
345
|
+
|
|
346
|
+
return {
|
|
347
|
+
fontStyle: 'italic',
|
|
348
|
+
borderLeft: position === 'left' ? `4px ${variant} #e5e7eb` : 'none',
|
|
349
|
+
borderRight: position === 'right' ? `4px ${variant} #e5e7eb` : 'none',
|
|
350
|
+
paddingLeft: position === 'left' ? '1em' : '0',
|
|
351
|
+
paddingRight: position === 'right' ? '1em' : '0',
|
|
352
|
+
margin: '1em 0',
|
|
353
|
+
color: '#6b7280',
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** 生成标题样式 */
|
|
358
|
+
static getHeadingStyle(level: 1 | 2 | 3 | 4 | 5 | 6): React.CSSProperties {
|
|
359
|
+
const styles = {
|
|
360
|
+
1: { fontSize: '2.5em', fontWeight: 800, _lineHeight: 1.2, marginBottom: '0.5em' },
|
|
361
|
+
2: { fontSize: '2em', fontWeight: 700, _lineHeight: 1.3, marginBottom: '0.5em' },
|
|
362
|
+
3: { fontSize: '1.75em', fontWeight: 600, _lineHeight: 1.4, marginBottom: '0.5em' },
|
|
363
|
+
4: { fontSize: '1.5em', fontWeight: 600, _lineHeight: 1.5, marginBottom: '0.5em' },
|
|
364
|
+
5: { fontSize: '1.25em', fontWeight: 500, _lineHeight: 1.6, marginBottom: '0.5em' },
|
|
365
|
+
6: { fontSize: '1em', fontWeight: 500, _lineHeight: 1.7, marginBottom: '0.5em' },
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
return styles[level];
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** 生成加载动画样式 */
|
|
372
|
+
static getLoadingStyle(): React.CSSProperties {
|
|
373
|
+
return {
|
|
374
|
+
display: 'inline-block',
|
|
375
|
+
width: '1em',
|
|
376
|
+
height: '1em',
|
|
377
|
+
border: '2px solid transparent',
|
|
378
|
+
borderTopColor: 'currentColor',
|
|
379
|
+
borderRadius: '50%',
|
|
380
|
+
animation: 'spin 1s linear infinite',
|
|
381
|
+
verticalAlign: 'middle',
|
|
382
|
+
marginRight: '0.5em',
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** 生成CSS变量 */
|
|
387
|
+
static generateCSSVariables(): string {
|
|
388
|
+
return `
|
|
389
|
+
:root {
|
|
390
|
+
--text-primary-color: #0ea5e9;
|
|
391
|
+
--text-secondary-color: #6b7280;
|
|
392
|
+
--text-success-color: #22c55e;
|
|
393
|
+
--text-warning-color: #f59e0b;
|
|
394
|
+
--text-error-color: #ef4444;
|
|
395
|
+
--text-info-color: #3b82f6;
|
|
396
|
+
--text-_disabled-color: #9ca3af;
|
|
397
|
+
--text-_disabled-opacity: 0.5;
|
|
398
|
+
--text-_loading-opacity: 0.7;
|
|
399
|
+
--text-animation-duration: 300ms;
|
|
400
|
+
--text-highlight-color: #fef3c7;
|
|
401
|
+
--text-link-color: #0ea5e9;
|
|
402
|
+
--text-link-hover-color: #0284c7;
|
|
403
|
+
--text-link-visited-color: #7c3aed;
|
|
404
|
+
--text-code-background: #f3f4f6;
|
|
405
|
+
--text-code-border: #e5e7eb;
|
|
406
|
+
--text-quote-border: #e5e7eb;
|
|
407
|
+
--text-quote-color: #6b7280;
|
|
408
|
+
}
|
|
409
|
+
`;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/** 生成关键帧动画 */
|
|
413
|
+
static generateKeyframes(): string {
|
|
414
|
+
return `
|
|
415
|
+
@keyframes spin {
|
|
416
|
+
from {
|
|
417
|
+
transform: rotate(0deg);
|
|
418
|
+
}
|
|
419
|
+
to {
|
|
420
|
+
transform: rotate(360deg);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
@keyframes pulse {
|
|
425
|
+
0%, 100% {
|
|
426
|
+
opacity: 1;
|
|
427
|
+
}
|
|
428
|
+
50% {
|
|
429
|
+
opacity: 0.5;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
@keyframes fadeIn {
|
|
434
|
+
from {
|
|
435
|
+
opacity: 0;
|
|
436
|
+
transform: translateY(10px);
|
|
437
|
+
}
|
|
438
|
+
to {
|
|
439
|
+
opacity: 1;
|
|
440
|
+
transform: translateY(0);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
@keyframes slideIn {
|
|
445
|
+
from {
|
|
446
|
+
transform: translateX(-100%);
|
|
447
|
+
}
|
|
448
|
+
to {
|
|
449
|
+
transform: translateX(0);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
@keyframes typewriter {
|
|
454
|
+
from {
|
|
455
|
+
width: 0;
|
|
456
|
+
}
|
|
457
|
+
to {
|
|
458
|
+
width: 100%;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
@keyframes blink {
|
|
463
|
+
0%, 50% {
|
|
464
|
+
opacity: 1;
|
|
465
|
+
}
|
|
466
|
+
51%, 100% {
|
|
467
|
+
opacity: 0;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
`;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** 获取尺寸类名 */
|
|
474
|
+
static getSizeClassName(size: TextSize): string {
|
|
475
|
+
return `taro-uno-text--${size}`;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** 获取权重类名 */
|
|
479
|
+
static getWeightClassName(weight: TextWeight): string {
|
|
480
|
+
return `taro-uno-text--${weight}`;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/** 获取颜色类名 */
|
|
484
|
+
static getColorClassName(color: TextColor): string {
|
|
485
|
+
return `taro-uno-text--${color}`;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** 获取状态类名 */
|
|
489
|
+
static getStatusClassName(status: TextStatus): string {
|
|
490
|
+
return `taro-uno-text--${status}`;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** 获取类型类名 */
|
|
494
|
+
static getTypeClassName(type: string): string {
|
|
495
|
+
return `taro-uno-text--${type}`;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/** 导出样式工具 */
|
|
500
|
+
export const textStyles = TextStyles;
|