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.
- package/README.md +67 -30
- package/dist/js/{index-CDFsvu80.js → index-QpKiGsEQ.js} +39026 -28023
- package/dist/js/index-QpKiGsEQ.js.map +1 -0
- package/dist/js/{index-JffnTUrv.js → index-nnTHNhwl.js} +38743 -27720
- package/dist/js/index-nnTHNhwl.js.map +1 -0
- package/package.json +4 -4
- package/dist/js/index-CDFsvu80.js.map +0 -1
- package/dist/js/index-DFdcksbe.js +0 -1165
- package/dist/js/index-DFdcksbe.js.map +0 -1
- package/dist/js/index-DXRIkWX1.js +0 -1148
- package/dist/js/index-DXRIkWX1.js.map +0 -1
- package/dist/js/index-JffnTUrv.js.map +0 -1
- package/dist/utils/http/request.d.ts +0 -280
- package/src/app.config.ts +0 -55
- package/src/app.scss +0 -508
- package/src/app.tsx +0 -44
- package/src/components/basic/Button/Button.styles.ts +0 -130
- package/src/components/basic/Button/Button.test.tsx +0 -154
- package/src/components/basic/Button/Button.tsx +0 -133
- package/src/components/basic/Button/Button.types.ts +0 -81
- package/src/components/basic/Button/index.tsx +0 -6
- package/src/components/basic/Divider/Divider.styles.ts +0 -488
- package/src/components/basic/Divider/Divider.test.tsx +0 -551
- package/src/components/basic/Divider/Divider.tsx +0 -392
- package/src/components/basic/Divider/Divider.types.ts +0 -261
- package/src/components/basic/Divider/index.tsx +0 -25
- package/src/components/basic/Icon/Icon.data.ts +0 -474
- package/src/components/basic/Icon/Icon.styles.ts +0 -359
- package/src/components/basic/Icon/Icon.test.tsx +0 -357
- package/src/components/basic/Icon/Icon.tsx +0 -167
- package/src/components/basic/Icon/Icon.types.ts +0 -210
- package/src/components/basic/Icon/IconManager.ts +0 -229
- package/src/components/basic/Icon/index.tsx +0 -22
- package/src/components/basic/Text/Text.styles.ts +0 -500
- package/src/components/basic/Text/Text.test.tsx +0 -299
- package/src/components/basic/Text/Text.tsx +0 -340
- package/src/components/basic/Text/Text.types.ts +0 -329
- package/src/components/basic/Text/index.tsx +0 -27
- package/src/components/basic/Typography/Typography.styles.ts +0 -347
- package/src/components/basic/Typography/Typography.tsx +0 -207
- package/src/components/basic/Typography/Typography.types.ts +0 -296
- package/src/components/basic/Typography/index.tsx +0 -14
- package/src/components/basic/Video/Video.styles.ts +0 -777
- package/src/components/basic/Video/Video.test.tsx +0 -490
- package/src/components/basic/Video/Video.tsx +0 -1468
- package/src/components/basic/Video/Video.types.ts +0 -500
- package/src/components/basic/Video/index.tsx +0 -26
- package/src/components/basic/index.tsx +0 -300
- package/src/components/common/ErrorBoundary.tsx +0 -87
- package/src/components/common/LazyComponent.tsx +0 -247
- package/src/components/common/ResponsiveContainer.tsx +0 -93
- package/src/components/common/ResponsiveGrid.tsx +0 -183
- package/src/components/common/SecurityProvider.tsx +0 -98
- package/src/components/common/ThemeProvider.tsx +0 -115
- package/src/components/common/VirtualList.tsx +0 -350
- package/src/components/common/__tests__/ErrorBoundary.test.tsx +0 -249
- package/src/components/common/index.tsx +0 -32
- package/src/components/display/Avatar/Avatar.styles.ts +0 -62
- package/src/components/display/Avatar/Avatar.test.tsx +0 -390
- package/src/components/display/Avatar/Avatar.tsx +0 -66
- package/src/components/display/Avatar/Avatar.types.ts +0 -40
- package/src/components/display/Avatar/index.ts +0 -3
- package/src/components/display/Badge/Badge.tsx +0 -29
- package/src/components/display/Badge/Badge.types.ts +0 -29
- package/src/components/display/Badge/index.ts +0 -2
- package/src/components/display/Calendar/Calendar.styles.ts +0 -255
- package/src/components/display/Calendar/Calendar.test.tsx +0 -42
- package/src/components/display/Calendar/Calendar.tsx +0 -358
- package/src/components/display/Calendar/Calendar.types.ts +0 -91
- package/src/components/display/Calendar/index.ts +0 -3
- package/src/components/display/Card/Card.styles.ts +0 -89
- package/src/components/display/Card/Card.test.tsx +0 -182
- package/src/components/display/Card/Card.tsx +0 -135
- package/src/components/display/Card/Card.types.ts +0 -55
- package/src/components/display/Card/index.ts +0 -3
- package/src/components/display/Carousel/Carousel.styles.ts +0 -206
- package/src/components/display/Carousel/Carousel.tsx +0 -290
- package/src/components/display/Carousel/Carousel.types.ts +0 -57
- package/src/components/display/Carousel/index.ts +0 -3
- package/src/components/display/List/List.styles.ts +0 -79
- package/src/components/display/List/List.tsx +0 -114
- package/src/components/display/List/List.types.ts +0 -68
- package/src/components/display/List/index.ts +0 -3
- package/src/components/display/Rate/Rate.styles.ts +0 -254
- package/src/components/display/Rate/Rate.tsx +0 -324
- package/src/components/display/Rate/Rate.types.ts +0 -112
- package/src/components/display/Rate/index.ts +0 -20
- package/src/components/display/Table/Table.styles.ts +0 -269
- package/src/components/display/Table/Table.test.tsx +0 -345
- package/src/components/display/Table/Table.tsx +0 -426
- package/src/components/display/Table/Table.types.ts +0 -256
- package/src/components/display/Table/index.tsx +0 -16
- package/src/components/display/Tag/Tag.styles.ts +0 -197
- package/src/components/display/Tag/Tag.test.tsx +0 -541
- package/src/components/display/Tag/Tag.tsx +0 -139
- package/src/components/display/Tag/Tag.types.ts +0 -49
- package/src/components/display/Tag/index.ts +0 -3
- package/src/components/display/Timeline/Timeline.styles.ts +0 -211
- package/src/components/display/Timeline/Timeline.tsx +0 -220
- package/src/components/display/Timeline/Timeline.types.ts +0 -56
- package/src/components/display/Timeline/index.ts +0 -3
- package/src/components/display/index.tsx +0 -147
- package/src/components/feedback/Loading/Loading.styles.ts +0 -117
- package/src/components/feedback/Loading/Loading.test.tsx +0 -534
- package/src/components/feedback/Loading/Loading.tsx +0 -132
- package/src/components/feedback/Loading/Loading.types.ts +0 -33
- package/src/components/feedback/Loading/index.ts +0 -6
- package/src/components/feedback/Message/Message.styles.ts +0 -41
- package/src/components/feedback/Message/Message.test.tsx +0 -234
- package/src/components/feedback/Message/Message.tsx +0 -96
- package/src/components/feedback/Message/Message.types.ts +0 -37
- package/src/components/feedback/Message/index.ts +0 -6
- package/src/components/feedback/Modal/Modal.styles.ts +0 -21
- package/src/components/feedback/Modal/Modal.test.tsx +0 -11
- package/src/components/feedback/Modal/Modal.tsx +0 -269
- package/src/components/feedback/Modal/Modal.types.ts +0 -151
- package/src/components/feedback/Modal/index.tsx +0 -11
- package/src/components/feedback/Notification/Notification.styles.ts +0 -453
- package/src/components/feedback/Notification/Notification.test.tsx +0 -401
- package/src/components/feedback/Notification/Notification.tsx +0 -347
- package/src/components/feedback/Notification/Notification.types.ts +0 -339
- package/src/components/feedback/Notification/NotificationManager.tsx +0 -405
- package/src/components/feedback/Notification/index.ts +0 -40
- package/src/components/feedback/Notification/index.tsx +0 -154
- package/src/components/feedback/Progress/Progress.styles.ts +0 -469
- package/src/components/feedback/Progress/Progress.test.simple.tsx +0 -14
- package/src/components/feedback/Progress/Progress.test.tsx +0 -312
- package/src/components/feedback/Progress/Progress.tsx +0 -488
- package/src/components/feedback/Progress/Progress.types.ts +0 -163
- package/src/components/feedback/Progress/index.ts +0 -3
- package/src/components/feedback/Progress/index.tsx +0 -38
- package/src/components/feedback/Progress/utils/animation.ts +0 -193
- package/src/components/feedback/Progress/utils/index.ts +0 -26
- package/src/components/feedback/Progress/utils/progress-calculator.ts +0 -199
- package/src/components/feedback/Result/Result.styles.ts +0 -139
- package/src/components/feedback/Result/Result.tsx +0 -221
- package/src/components/feedback/Result/Result.types.ts +0 -128
- package/src/components/feedback/Result/index.tsx +0 -3
- package/src/components/feedback/Toast/Toast.styles.ts +0 -17
- package/src/components/feedback/Toast/Toast.test.tsx +0 -10
- package/src/components/feedback/Toast/Toast.tsx +0 -384
- package/src/components/feedback/Toast/Toast.types.ts +0 -86
- package/src/components/feedback/Toast/index.tsx +0 -3
- package/src/components/feedback/Tooltip/Tooltip.examples.tsx +0 -435
- package/src/components/feedback/Tooltip/Tooltip.styles.ts +0 -340
- package/src/components/feedback/Tooltip/Tooltip.test.tsx +0 -446
- package/src/components/feedback/Tooltip/Tooltip.tsx +0 -302
- package/src/components/feedback/Tooltip/Tooltip.types.ts +0 -166
- package/src/components/feedback/Tooltip/index.ts +0 -3
- package/src/components/feedback/Tooltip/index.tsx +0 -246
- package/src/components/feedback/index.tsx +0 -176
- package/src/components/form/Cascader/Cascader.styles.ts +0 -526
- package/src/components/form/Cascader/Cascader.test.tsx +0 -77
- package/src/components/form/Cascader/Cascader.tsx +0 -581
- package/src/components/form/Cascader/Cascader.types.ts +0 -581
- package/src/components/form/Cascader/hooks/index.ts +0 -3
- package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +0 -19
- package/src/components/form/Cascader/hooks/useCascaderOptions.ts +0 -127
- package/src/components/form/Cascader/hooks/useCascaderState.ts +0 -139
- package/src/components/form/Cascader/index.ts +0 -25
- package/src/components/form/Cascader/utils/formatDisplayValue.ts +0 -19
- package/src/components/form/Cascader/utils/index.ts +0 -1
- package/src/components/form/Checkbox/Checkbox.styles.ts +0 -607
- package/src/components/form/Checkbox/Checkbox.test.tsx +0 -1140
- package/src/components/form/Checkbox/Checkbox.tsx +0 -489
- package/src/components/form/Checkbox/Checkbox.types.ts +0 -472
- package/src/components/form/Checkbox/CheckboxGroup.tsx +0 -444
- package/src/components/form/Checkbox/index.tsx +0 -27
- package/src/components/form/DatePicker/DatePicker.styles.ts +0 -393
- package/src/components/form/DatePicker/DatePicker.test.tsx +0 -407
- package/src/components/form/DatePicker/DatePicker.tsx +0 -376
- package/src/components/form/DatePicker/DatePicker.types.ts +0 -250
- package/src/components/form/DatePicker/index.tsx +0 -15
- package/src/components/form/Form/Form.styles.ts +0 -357
- package/src/components/form/Form/Form.test.tsx +0 -122
- package/src/components/form/Form/Form.tsx +0 -257
- package/src/components/form/Form/Form.types.ts +0 -422
- package/src/components/form/Form/index.tsx +0 -31
- package/src/components/form/Form/useFormLogic.ts +0 -497
- package/src/components/form/Input/Input.styles.ts +0 -445
- package/src/components/form/Input/Input.test.tsx +0 -494
- package/src/components/form/Input/Input.tsx +0 -305
- package/src/components/form/Input/Input.types.ts +0 -297
- package/src/components/form/Input/index.tsx +0 -26
- package/src/components/form/Input/useInputLogic.test.ts +0 -82
- package/src/components/form/Input/useInputLogic.ts +0 -260
- package/src/components/form/InputNumber/InputNumber.styles.ts +0 -716
- package/src/components/form/InputNumber/InputNumber.tsx +0 -402
- package/src/components/form/InputNumber/InputNumber.types.ts +0 -336
- package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +0 -24
- package/src/components/form/InputNumber/components/InputNumberControls.tsx +0 -33
- package/src/components/form/InputNumber/components/index.ts +0 -2
- package/src/components/form/InputNumber/hooks/index.ts +0 -4
- package/src/components/form/InputNumber/hooks/useInputNumberState.ts +0 -313
- package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +0 -148
- package/src/components/form/InputNumber/index.ts +0 -25
- package/src/components/form/Radio/Radio.styles.ts +0 -451
- package/src/components/form/Radio/Radio.test.tsx +0 -547
- package/src/components/form/Radio/Radio.tsx +0 -277
- package/src/components/form/Radio/Radio.types.ts +0 -414
- package/src/components/form/Radio/index.tsx +0 -21
- package/src/components/form/Select/Select.styles.ts +0 -518
- package/src/components/form/Select/Select.test.tsx +0 -648
- package/src/components/form/Select/Select.tsx +0 -474
- package/src/components/form/Select/Select.types.ts +0 -429
- package/src/components/form/Select/index.tsx +0 -30
- package/src/components/form/Slider/Slider.styles.ts +0 -139
- package/src/components/form/Slider/Slider.test.tsx +0 -553
- package/src/components/form/Slider/Slider.tsx +0 -312
- package/src/components/form/Slider/Slider.types.ts +0 -110
- package/src/components/form/Slider/index.tsx +0 -3
- package/src/components/form/Switch/Switch.styles.ts +0 -534
- package/src/components/form/Switch/Switch.test.tsx +0 -345
- package/src/components/form/Switch/Switch.tsx +0 -458
- package/src/components/form/Switch/Switch.types.ts +0 -386
- package/src/components/form/Switch/index.tsx +0 -26
- package/src/components/form/Textarea/Textarea.styles.ts +0 -592
- package/src/components/form/Textarea/Textarea.test.tsx +0 -1075
- package/src/components/form/Textarea/Textarea.tsx +0 -608
- package/src/components/form/Textarea/Textarea.types.ts +0 -374
- package/src/components/form/Textarea/index.tsx +0 -26
- package/src/components/form/TimePicker/TimePicker.styles.ts +0 -434
- package/src/components/form/TimePicker/TimePicker.test.tsx +0 -306
- package/src/components/form/TimePicker/TimePicker.tsx +0 -250
- package/src/components/form/TimePicker/TimePicker.types.ts +0 -385
- package/src/components/form/TimePicker/index.ts +0 -21
- package/src/components/form/Transfer/Transfer.styles.ts +0 -490
- package/src/components/form/Transfer/Transfer.test.tsx +0 -316
- package/src/components/form/Transfer/Transfer.tsx +0 -414
- package/src/components/form/Transfer/Transfer.types.ts +0 -565
- package/src/components/form/Transfer/components/TransferItem.tsx +0 -94
- package/src/components/form/Transfer/components/TransferList.tsx +0 -298
- package/src/components/form/Transfer/components/TransferOperations.tsx +0 -81
- package/src/components/form/Transfer/components/TransferPagination.tsx +0 -139
- package/src/components/form/Transfer/components/TransferSearch.tsx +0 -85
- package/src/components/form/Transfer/components/index.ts +0 -6
- package/src/components/form/Transfer/hooks/index.ts +0 -3
- package/src/components/form/Transfer/hooks/useTransferData.ts +0 -202
- package/src/components/form/Transfer/hooks/useTransferState.ts +0 -120
- package/src/components/form/Transfer/index.ts +0 -27
- package/src/components/form/Upload/Upload.styles.ts +0 -145
- package/src/components/form/Upload/Upload.test.tsx +0 -10
- package/src/components/form/Upload/Upload.tsx +0 -498
- package/src/components/form/Upload/Upload.types.ts +0 -200
- package/src/components/form/Upload/index.tsx +0 -12
- package/src/components/form/index.tsx +0 -152
- package/src/components/index.tsx +0 -145
- package/src/components/layout/Affix/Affix.styles.ts +0 -42
- package/src/components/layout/Affix/Affix.test.tsx +0 -10
- package/src/components/layout/Affix/Affix.tsx +0 -83
- package/src/components/layout/Affix/Affix.types.ts +0 -29
- package/src/components/layout/Affix/index.tsx +0 -3
- package/src/components/layout/Col/Col.styles.ts +0 -185
- package/src/components/layout/Col/Col.test.tsx +0 -537
- package/src/components/layout/Col/Col.tsx +0 -97
- package/src/components/layout/Col/Col.types.ts +0 -59
- package/src/components/layout/Col/index.tsx +0 -3
- package/src/components/layout/Container/Container.styles.ts +0 -163
- package/src/components/layout/Container/Container.test.tsx +0 -380
- package/src/components/layout/Container/Container.tsx +0 -123
- package/src/components/layout/Container/Container.types.ts +0 -63
- package/src/components/layout/Container/index.tsx +0 -3
- package/src/components/layout/Grid/Grid.styles.ts +0 -183
- package/src/components/layout/Grid/Grid.test.tsx +0 -637
- package/src/components/layout/Grid/Grid.tsx +0 -123
- package/src/components/layout/Grid/Grid.types.ts +0 -78
- package/src/components/layout/Grid/index.tsx +0 -3
- package/src/components/layout/Layout/Content.tsx +0 -30
- package/src/components/layout/Layout/Footer.tsx +0 -30
- package/src/components/layout/Layout/Header.tsx +0 -30
- package/src/components/layout/Layout/Layout.styles.ts +0 -84
- package/src/components/layout/Layout/Layout.test.tsx +0 -10
- package/src/components/layout/Layout/Layout.tsx +0 -28
- package/src/components/layout/Layout/Layout.types.ts +0 -58
- package/src/components/layout/Layout/Sider.tsx +0 -44
- package/src/components/layout/Layout/index.tsx +0 -22
- package/src/components/layout/Row/Row.styles.ts +0 -159
- package/src/components/layout/Row/Row.test.tsx +0 -467
- package/src/components/layout/Row/Row.tsx +0 -111
- package/src/components/layout/Row/Row.types.ts +0 -60
- package/src/components/layout/Row/index.tsx +0 -3
- package/src/components/layout/Space/Space.styles.ts +0 -255
- package/src/components/layout/Space/Space.test.tsx +0 -682
- package/src/components/layout/Space/Space.tsx +0 -203
- package/src/components/layout/Space/Space.types.ts +0 -92
- package/src/components/layout/Space/index.tsx +0 -12
- package/src/components/layout/index.tsx +0 -78
- package/src/components/navigation/Menu/Menu.constants.ts +0 -69
- package/src/components/navigation/Menu/Menu.stories.tsx +0 -107
- package/src/components/navigation/Menu/Menu.styles.ts +0 -767
- package/src/components/navigation/Menu/Menu.tsx +0 -352
- package/src/components/navigation/Menu/Menu.types.ts +0 -231
- package/src/components/navigation/Menu/Menu.utils.ts +0 -187
- package/src/components/navigation/Menu/MenuItem.tsx +0 -124
- package/src/components/navigation/Menu/SubMenu.tsx +0 -150
- package/src/components/navigation/Menu/index.tsx +0 -59
- package/src/components/navigation/NavBar/NavBar.styles.ts +0 -129
- package/src/components/navigation/NavBar/NavBar.test.tsx +0 -287
- package/src/components/navigation/NavBar/NavBar.tsx +0 -228
- package/src/components/navigation/NavBar/NavBar.types.ts +0 -54
- package/src/components/navigation/NavBar/index.tsx +0 -3
- package/src/components/navigation/Pagination/Pagination.styles.ts +0 -187
- package/src/components/navigation/Pagination/Pagination.test.tsx +0 -672
- package/src/components/navigation/Pagination/Pagination.tsx +0 -395
- package/src/components/navigation/Pagination/Pagination.types.ts +0 -87
- package/src/components/navigation/Pagination/index.ts +0 -24
- package/src/components/navigation/Pagination/index.tsx +0 -9
- package/src/components/navigation/Steps/Step.tsx +0 -36
- package/src/components/navigation/Steps/Steps.styles.ts +0 -169
- package/src/components/navigation/Steps/Steps.test.tsx +0 -14
- package/src/components/navigation/Steps/Steps.tsx +0 -112
- package/src/components/navigation/Steps/Steps.types.ts +0 -47
- package/src/components/navigation/Steps/index.tsx +0 -3
- package/src/components/navigation/Tabs/Tabs.styles.ts +0 -199
- package/src/components/navigation/Tabs/Tabs.test.tsx +0 -662
- package/src/components/navigation/Tabs/Tabs.tsx +0 -253
- package/src/components/navigation/Tabs/Tabs.types.ts +0 -115
- package/src/components/navigation/Tabs/index.tsx +0 -3
- package/src/components/navigation/index.tsx +0 -88
- package/src/constants/index.ts +0 -785
- package/src/hooks/index.ts +0 -60
- package/src/hooks/types.ts +0 -9
- package/src/hooks/useAsync.ts +0 -64
- package/src/hooks/useClickOutside.ts +0 -52
- package/src/hooks/useCounter.ts +0 -87
- package/src/hooks/useDebounce.ts +0 -150
- package/src/hooks/useDeepCompareEffect.ts +0 -88
- package/src/hooks/useEventHandling.ts +0 -444
- package/src/hooks/useEventListener.ts +0 -77
- package/src/hooks/useLifecycle.ts +0 -399
- package/src/hooks/useMediaQuery.ts +0 -75
- package/src/hooks/useMutation.ts +0 -233
- package/src/hooks/usePerformance.ts +0 -378
- package/src/hooks/usePerformanceMonitor.ts +0 -348
- package/src/hooks/usePlatform.ts +0 -64
- package/src/hooks/usePrevious.ts +0 -25
- package/src/hooks/useRequest.test.ts +0 -11
- package/src/hooks/useRequest.ts +0 -140
- package/src/hooks/useStateManagement.ts +0 -300
- package/src/hooks/useStorage.ts +0 -169
- package/src/hooks/useStyle.ts +0 -543
- package/src/hooks/useTheme.ts +0 -347
- package/src/hooks/useToggle.ts +0 -54
- package/src/hooks/useVirtualScroll.ts +0 -331
- package/src/index.ts +0 -323
- package/src/platform/index.ts +0 -1188
- package/src/providers/AppProvider.test.tsx +0 -63
- package/src/providers/AppProvider.tsx +0 -155
- package/src/providers/index.ts +0 -1
- package/src/theme/ThemeProvider.tsx +0 -279
- package/src/theme/ThemeProvider.types.ts +0 -26
- package/src/theme/animations.tsx +0 -660
- package/src/theme/defaults.ts +0 -188
- package/src/theme/design-system.ts +0 -562
- package/src/theme/design-tokens.ts +0 -1122
- package/src/theme/generated/dark-theme.scss +0 -120
- package/src/theme/generated/tokens.css +0 -441
- package/src/theme/generated/tokens.scss +0 -384
- package/src/theme/index.ts +0 -99
- package/src/theme/responsive.tsx +0 -195
- package/src/theme/styles/mixins.scss +0 -612
- package/src/theme/styles/variables.scss +0 -295
- package/src/theme/styles.ts +0 -403
- package/src/theme/tokens/colors.ts +0 -256
- package/src/theme/tokens/effects.ts +0 -260
- package/src/theme/tokens/index.ts +0 -217
- package/src/theme/tokens/spacing.ts +0 -137
- package/src/theme/tokens/typography.ts +0 -186
- package/src/theme/types.ts +0 -188
- package/src/theme/useThemeUtils.ts +0 -313
- package/src/theme/utils.ts +0 -501
- package/src/theme/variables.ts +0 -602
- package/src/types/accessibility.ts +0 -50
- package/src/types/button.ts +0 -560
- package/src/types/component-props.ts +0 -322
- package/src/types/env.d.ts +0 -20
- package/src/types/glob.d.ts +0 -4
- package/src/types/index.ts +0 -427
- package/src/types/modules.d.ts +0 -40
- package/src/types/standardized-components.ts +0 -550
- package/src/types/taro-adapter.d.ts +0 -174
- package/src/types/taro-components.d.ts +0 -73
- package/src/types/utils.ts +0 -400
- package/src/utils/__tests__/inputValidator.test.ts +0 -338
- package/src/utils/__tests__/responsiveUtils.test.ts +0 -311
- package/src/utils/__tests__/xssProtection.test.ts +0 -268
- package/src/utils/abort-controller.ts +0 -48
- package/src/utils/cache.ts +0 -79
- package/src/utils/createNamespace.ts +0 -24
- package/src/utils/environment.ts +0 -115
- package/src/utils/error-handler.ts +0 -88
- package/src/utils/errorLogger.ts +0 -193
- package/src/utils/formatUtils.ts +0 -412
- package/src/utils/http/error-codes.ts +0 -314
- package/src/utils/http/http-client.test.ts +0 -63
- package/src/utils/http/http-client.ts +0 -161
- package/src/utils/http/request-cache.ts +0 -127
- package/src/utils/http/request.ts +0 -954
- package/src/utils/http/taro-adapter.test.ts +0 -74
- package/src/utils/http/taro-adapter.ts +0 -24
- package/src/utils/http/types.ts +0 -414
- package/src/utils/http/web-adapter.ts +0 -33
- package/src/utils/index.ts +0 -112
- package/src/utils/inputValidator.ts +0 -264
- package/src/utils/performance/performance.ts +0 -839
- package/src/utils/responsiveUtils.ts +0 -348
- package/src/utils/rtl-support.ts +0 -354
- package/src/utils/security/api-security.ts +0 -394
- package/src/utils/security/xss-protection.ts +0 -69
- package/src/utils/securityHeaders.ts +0 -308
- package/src/utils/typeHelpers.ts +0 -16
- package/src/utils/types/dataProcessing.ts +0 -544
- package/src/utils/types/typeHelpers.ts +0 -197
- package/src/utils/xssProtection.ts +0 -468
package/src/theme/variables.ts
DELETED
|
@@ -1,602 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 优化的CSS变量系统
|
|
3
|
-
* 提供类型安全的CSS变量管理和继承机制
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { ThemeConfig } from './types';
|
|
7
|
-
|
|
8
|
-
// CSS变量类型定义
|
|
9
|
-
export interface CSSVariables {
|
|
10
|
-
// 颜色变量
|
|
11
|
-
colors: {
|
|
12
|
-
primary: string;
|
|
13
|
-
primaryLight: string;
|
|
14
|
-
primaryDark: string;
|
|
15
|
-
secondary: string;
|
|
16
|
-
success: string;
|
|
17
|
-
warning: string;
|
|
18
|
-
error: string;
|
|
19
|
-
info: string;
|
|
20
|
-
text: string;
|
|
21
|
-
textSecondary: string;
|
|
22
|
-
textDisabled: string;
|
|
23
|
-
textInverse: string;
|
|
24
|
-
background: string;
|
|
25
|
-
backgroundCard: string;
|
|
26
|
-
backgroundInput: string;
|
|
27
|
-
backgroundMask: string;
|
|
28
|
-
border: string;
|
|
29
|
-
borderLight: string;
|
|
30
|
-
borderFocus: string;
|
|
31
|
-
shadow: string;
|
|
32
|
-
shadowLight: string;
|
|
33
|
-
brand: string;
|
|
34
|
-
accent: string;
|
|
35
|
-
link: string;
|
|
36
|
-
divider: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// 间距变量
|
|
40
|
-
spacing: {
|
|
41
|
-
xs: string;
|
|
42
|
-
sm: string;
|
|
43
|
-
md: string;
|
|
44
|
-
lg: string;
|
|
45
|
-
xl: string;
|
|
46
|
-
xxl: string;
|
|
47
|
-
padding: string;
|
|
48
|
-
margin: string;
|
|
49
|
-
gap: string;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// 字体变量
|
|
53
|
-
typography: {
|
|
54
|
-
fontFamily: {
|
|
55
|
-
sans: string;
|
|
56
|
-
serif: string;
|
|
57
|
-
mono: string;
|
|
58
|
-
heading: string;
|
|
59
|
-
};
|
|
60
|
-
fontSize: {
|
|
61
|
-
xs: string;
|
|
62
|
-
sm: string;
|
|
63
|
-
base: string;
|
|
64
|
-
lg: string;
|
|
65
|
-
xl: string;
|
|
66
|
-
'2xl': string;
|
|
67
|
-
'3xl': string;
|
|
68
|
-
'4xl': string;
|
|
69
|
-
'5xl': string;
|
|
70
|
-
};
|
|
71
|
-
fontWeight: {
|
|
72
|
-
light: string;
|
|
73
|
-
normal: string;
|
|
74
|
-
medium: string;
|
|
75
|
-
semibold: string;
|
|
76
|
-
bold: string;
|
|
77
|
-
};
|
|
78
|
-
lineHeight: {
|
|
79
|
-
tight: string;
|
|
80
|
-
normal: string;
|
|
81
|
-
relaxed: string;
|
|
82
|
-
loose: string;
|
|
83
|
-
};
|
|
84
|
-
letterSpacing: {
|
|
85
|
-
tight: string;
|
|
86
|
-
normal: string;
|
|
87
|
-
wide: string;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// 边框变量
|
|
92
|
-
borderRadius: {
|
|
93
|
-
none: string;
|
|
94
|
-
sm: string;
|
|
95
|
-
md: string;
|
|
96
|
-
lg: string;
|
|
97
|
-
xl: string;
|
|
98
|
-
full: string;
|
|
99
|
-
circle: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// 阴影变量
|
|
103
|
-
shadow: {
|
|
104
|
-
none: string;
|
|
105
|
-
sm: string;
|
|
106
|
-
md: string;
|
|
107
|
-
lg: string;
|
|
108
|
-
xl: string;
|
|
109
|
-
'2xl': string;
|
|
110
|
-
inner: string;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// 动画变量
|
|
114
|
-
animation: {
|
|
115
|
-
duration: {
|
|
116
|
-
fast: string;
|
|
117
|
-
normal: string;
|
|
118
|
-
slow: string;
|
|
119
|
-
};
|
|
120
|
-
easing: {
|
|
121
|
-
linear: string;
|
|
122
|
-
ease: string;
|
|
123
|
-
easeIn: string;
|
|
124
|
-
easeOut: string;
|
|
125
|
-
easeInOut: string;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// 响应式断点
|
|
130
|
-
breakpoints: {
|
|
131
|
-
xs: string;
|
|
132
|
-
sm: string;
|
|
133
|
-
md: string;
|
|
134
|
-
lg: string;
|
|
135
|
-
xl: string;
|
|
136
|
-
xxl: string;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// Z-index变量
|
|
140
|
-
zIndex: {
|
|
141
|
-
dropdown: string;
|
|
142
|
-
sticky: string;
|
|
143
|
-
fixed: string;
|
|
144
|
-
modal: string;
|
|
145
|
-
popover: string;
|
|
146
|
-
tooltip: string;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// 过渡变量
|
|
150
|
-
transition: {
|
|
151
|
-
base: string;
|
|
152
|
-
fast: string;
|
|
153
|
-
slow: string;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// 变量继承配置
|
|
158
|
-
export interface VariableInheritance {
|
|
159
|
-
parent: string;
|
|
160
|
-
child: string;
|
|
161
|
-
transform?: (value: string) => string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// 变量组配置
|
|
165
|
-
export interface VariableGroup {
|
|
166
|
-
name: string;
|
|
167
|
-
prefix: string;
|
|
168
|
-
variables: string[];
|
|
169
|
-
inheritance?: VariableInheritance[];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// CSS变量生成器
|
|
173
|
-
export class CSSVariableGenerator {
|
|
174
|
-
private theme: ThemeConfig;
|
|
175
|
-
|
|
176
|
-
constructor(theme: ThemeConfig) {
|
|
177
|
-
this.theme = theme;
|
|
178
|
-
this.initializeVariableGroups();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// 初始化变量组
|
|
182
|
-
private initializeVariableGroups(): VariableGroup[] {
|
|
183
|
-
return [
|
|
184
|
-
{
|
|
185
|
-
name: 'colors',
|
|
186
|
-
prefix: 'color',
|
|
187
|
-
variables: [
|
|
188
|
-
'primary',
|
|
189
|
-
'primaryLight',
|
|
190
|
-
'primaryDark',
|
|
191
|
-
'secondary',
|
|
192
|
-
'success',
|
|
193
|
-
'warning',
|
|
194
|
-
'error',
|
|
195
|
-
'info',
|
|
196
|
-
'text',
|
|
197
|
-
'textSecondary',
|
|
198
|
-
'textDisabled',
|
|
199
|
-
'textInverse',
|
|
200
|
-
'background',
|
|
201
|
-
'backgroundCard',
|
|
202
|
-
'backgroundInput',
|
|
203
|
-
'backgroundMask',
|
|
204
|
-
'border',
|
|
205
|
-
'borderLight',
|
|
206
|
-
'borderFocus',
|
|
207
|
-
'shadow',
|
|
208
|
-
'shadowLight',
|
|
209
|
-
'brand',
|
|
210
|
-
'accent',
|
|
211
|
-
'link',
|
|
212
|
-
'divider',
|
|
213
|
-
],
|
|
214
|
-
inheritance: [
|
|
215
|
-
{
|
|
216
|
-
parent: 'primary',
|
|
217
|
-
child: 'primaryLight',
|
|
218
|
-
transform: (value) => this.lightenColor(value, 0.2),
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
parent: 'primary',
|
|
222
|
-
child: 'primaryDark',
|
|
223
|
-
transform: (value) => this.darkenColor(value, 0.2),
|
|
224
|
-
},
|
|
225
|
-
],
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: 'spacing',
|
|
229
|
-
prefix: 'spacing',
|
|
230
|
-
variables: ['xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'padding', 'margin', 'gap'],
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: 'typography',
|
|
234
|
-
prefix: 'font',
|
|
235
|
-
variables: ['family-sans', 'family-serif', 'family-mono', 'family-heading'],
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
name: 'fontSize',
|
|
239
|
-
prefix: 'text',
|
|
240
|
-
variables: ['xs', 'sm', 'base', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl'],
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
name: 'fontWeight',
|
|
244
|
-
prefix: 'weight',
|
|
245
|
-
variables: ['light', 'normal', 'medium', 'semibold', 'bold'],
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: 'lineHeight',
|
|
249
|
-
prefix: 'leading',
|
|
250
|
-
variables: ['tight', 'normal', 'relaxed', 'loose'],
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
name: 'letterSpacing',
|
|
254
|
-
prefix: 'tracking',
|
|
255
|
-
variables: ['tight', 'normal', 'wide'],
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
name: 'borderRadius',
|
|
259
|
-
prefix: 'radius',
|
|
260
|
-
variables: ['none', 'sm', 'md', 'lg', 'xl', 'full', 'circle'],
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: 'shadow',
|
|
264
|
-
prefix: 'shadow',
|
|
265
|
-
variables: ['none', 'sm', 'md', 'lg', 'xl', '2xl', 'inner'],
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
name: 'animation',
|
|
269
|
-
prefix: 'duration',
|
|
270
|
-
variables: ['fast', 'normal', 'slow'],
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: 'easing',
|
|
274
|
-
prefix: 'ease',
|
|
275
|
-
variables: ['linear', 'ease', 'easeIn', 'easeOut', 'easeInOut'],
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: 'breakpoints',
|
|
279
|
-
prefix: 'breakpoint',
|
|
280
|
-
variables: ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'],
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
name: 'zIndex',
|
|
284
|
-
prefix: 'z',
|
|
285
|
-
variables: ['dropdown', 'sticky', 'fixed', 'modal', 'popover', 'tooltip'],
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
name: 'transition',
|
|
289
|
-
prefix: 'transition',
|
|
290
|
-
variables: ['base', 'fast', 'slow'],
|
|
291
|
-
},
|
|
292
|
-
];
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// 生成CSS变量
|
|
296
|
-
public generateVariables(): CSSVariables {
|
|
297
|
-
const variables: Partial<CSSVariables> = {};
|
|
298
|
-
|
|
299
|
-
// 生成颜色变量
|
|
300
|
-
variables.colors = this.generateColorVariables();
|
|
301
|
-
|
|
302
|
-
// 生成间距变量
|
|
303
|
-
variables.spacing = this.generateSpacingVariables();
|
|
304
|
-
|
|
305
|
-
// 生成字体变量
|
|
306
|
-
variables.typography = this.generateTypographyVariables();
|
|
307
|
-
|
|
308
|
-
// 生成边框变量
|
|
309
|
-
variables.borderRadius = this.generateBorderRadiusVariables();
|
|
310
|
-
|
|
311
|
-
// 生成阴影变量
|
|
312
|
-
variables.shadow = this.generateShadowVariables();
|
|
313
|
-
|
|
314
|
-
// 生成动画变量
|
|
315
|
-
variables.animation = this.generateAnimationVariables();
|
|
316
|
-
|
|
317
|
-
// 生成断点变量
|
|
318
|
-
variables.breakpoints = this.generateBreakpointVariables();
|
|
319
|
-
|
|
320
|
-
// 生成Z-index变量
|
|
321
|
-
variables.zIndex = this.generateZIndexVariables();
|
|
322
|
-
|
|
323
|
-
// 生成过渡变量
|
|
324
|
-
variables.transition = this.generateTransitionVariables();
|
|
325
|
-
|
|
326
|
-
return variables as CSSVariables;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// 生成颜色变量
|
|
330
|
-
private generateColorVariables(): CSSVariables['colors'] {
|
|
331
|
-
const { colors } = this.theme;
|
|
332
|
-
|
|
333
|
-
return {
|
|
334
|
-
primary: colors.primary,
|
|
335
|
-
primaryLight: this.lightenColor(colors.primary, 0.2),
|
|
336
|
-
primaryDark: this.darkenColor(colors.primary, 0.2),
|
|
337
|
-
secondary: colors.secondary,
|
|
338
|
-
success: colors.success,
|
|
339
|
-
warning: colors.warning,
|
|
340
|
-
error: colors.error,
|
|
341
|
-
info: colors.info,
|
|
342
|
-
text: colors.text,
|
|
343
|
-
textSecondary: colors.textSecondary,
|
|
344
|
-
textDisabled: colors.textDisabled,
|
|
345
|
-
textInverse: colors.textInverse,
|
|
346
|
-
background: colors.background,
|
|
347
|
-
backgroundCard: colors.backgroundCard,
|
|
348
|
-
backgroundInput: colors.backgroundInput,
|
|
349
|
-
backgroundMask: colors.backgroundMask,
|
|
350
|
-
border: colors.border,
|
|
351
|
-
borderLight: colors.borderLight,
|
|
352
|
-
borderFocus: colors.borderFocus,
|
|
353
|
-
shadow: colors.shadow,
|
|
354
|
-
shadowLight: colors.shadowLight,
|
|
355
|
-
brand: colors.brand,
|
|
356
|
-
accent: colors.accent,
|
|
357
|
-
link: colors.link,
|
|
358
|
-
divider: colors.divider,
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// 生成间距变量
|
|
363
|
-
private generateSpacingVariables(): CSSVariables['spacing'] {
|
|
364
|
-
const { spacing } = this.theme;
|
|
365
|
-
|
|
366
|
-
return {
|
|
367
|
-
xs: `${spacing.xs}px`,
|
|
368
|
-
sm: `${spacing.sm}px`,
|
|
369
|
-
md: `${spacing.md}px`,
|
|
370
|
-
lg: `${spacing.lg}px`,
|
|
371
|
-
xl: `${spacing.xl}px`,
|
|
372
|
-
xxl: `${spacing.xxl}px`,
|
|
373
|
-
padding: `${spacing.padding}px`,
|
|
374
|
-
margin: `${spacing.margin}px`,
|
|
375
|
-
gap: `${spacing.gap}px`,
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// 生成字体变量
|
|
380
|
-
private generateTypographyVariables(): CSSVariables['typography'] {
|
|
381
|
-
const { typography } = this.theme;
|
|
382
|
-
|
|
383
|
-
return {
|
|
384
|
-
fontFamily: {
|
|
385
|
-
sans: typography.fontFamily.sans.join(', '),
|
|
386
|
-
serif: typography.fontFamily.serif.join(', '),
|
|
387
|
-
mono: typography.fontFamily.mono.join(', '),
|
|
388
|
-
heading: typography.fontFamily.heading.join(', '),
|
|
389
|
-
},
|
|
390
|
-
fontSize: {
|
|
391
|
-
xs: `${typography.fontSize.xs}px`,
|
|
392
|
-
sm: `${typography.fontSize.sm}px`,
|
|
393
|
-
base: `${typography.fontSize.base}px`,
|
|
394
|
-
lg: `${typography.fontSize.lg}px`,
|
|
395
|
-
xl: `${typography.fontSize.xl}px`,
|
|
396
|
-
'2xl': `${typography.fontSize['2xl']}px`,
|
|
397
|
-
'3xl': `${typography.fontSize['3xl']}px`,
|
|
398
|
-
'4xl': `${typography.fontSize['4xl']}px`,
|
|
399
|
-
'5xl': `${typography.fontSize['5xl']}px`,
|
|
400
|
-
},
|
|
401
|
-
fontWeight: {
|
|
402
|
-
light: typography.fontWeight.light.toString(),
|
|
403
|
-
normal: typography.fontWeight.normal.toString(),
|
|
404
|
-
medium: typography.fontWeight.medium.toString(),
|
|
405
|
-
semibold: typography.fontWeight.semibold.toString(),
|
|
406
|
-
bold: typography.fontWeight.bold.toString(),
|
|
407
|
-
},
|
|
408
|
-
lineHeight: {
|
|
409
|
-
tight: typography.lineHeight.tight.toString(),
|
|
410
|
-
normal: typography.lineHeight.normal.toString(),
|
|
411
|
-
relaxed: typography.lineHeight.relaxed.toString(),
|
|
412
|
-
loose: typography.lineHeight.loose.toString(),
|
|
413
|
-
},
|
|
414
|
-
letterSpacing: {
|
|
415
|
-
tight: typography.letterSpacing.tight,
|
|
416
|
-
normal: typography.letterSpacing.normal,
|
|
417
|
-
wide: typography.letterSpacing.wide,
|
|
418
|
-
},
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// 生成边框变量
|
|
423
|
-
private generateBorderRadiusVariables(): CSSVariables['borderRadius'] {
|
|
424
|
-
const { borderRadius } = this.theme;
|
|
425
|
-
|
|
426
|
-
return {
|
|
427
|
-
none: `${borderRadius.none}px`,
|
|
428
|
-
sm: `${borderRadius.sm}px`,
|
|
429
|
-
md: `${borderRadius.md}px`,
|
|
430
|
-
lg: `${borderRadius.lg}px`,
|
|
431
|
-
xl: `${borderRadius.xl}px`,
|
|
432
|
-
full: `${borderRadius.full}px`,
|
|
433
|
-
circle: `${borderRadius.circle}%`,
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// 生成阴影变量
|
|
438
|
-
private generateShadowVariables(): CSSVariables['shadow'] {
|
|
439
|
-
const { shadow } = this.theme;
|
|
440
|
-
|
|
441
|
-
return {
|
|
442
|
-
none: shadow.none,
|
|
443
|
-
sm: shadow.sm,
|
|
444
|
-
md: shadow.md,
|
|
445
|
-
lg: shadow.lg,
|
|
446
|
-
xl: shadow.xl,
|
|
447
|
-
'2xl': shadow['2xl'],
|
|
448
|
-
inner: shadow.inner,
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// 生成动画变量
|
|
453
|
-
private generateAnimationVariables(): CSSVariables['animation'] {
|
|
454
|
-
const { animation } = this.theme;
|
|
455
|
-
|
|
456
|
-
return {
|
|
457
|
-
duration: animation.duration,
|
|
458
|
-
easing: animation.easing,
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// 生成断点变量
|
|
463
|
-
private generateBreakpointVariables(): CSSVariables['breakpoints'] {
|
|
464
|
-
const { breakpoints } = this.theme.spacing;
|
|
465
|
-
|
|
466
|
-
return {
|
|
467
|
-
xs: `${breakpoints.xs}px`,
|
|
468
|
-
sm: `${breakpoints.sm}px`,
|
|
469
|
-
md: `${breakpoints.md}px`,
|
|
470
|
-
lg: `${breakpoints.lg}px`,
|
|
471
|
-
xl: `${breakpoints.xl}px`,
|
|
472
|
-
xxl: `${breakpoints.xxl}px`,
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
// 生成Z-index变量
|
|
477
|
-
private generateZIndexVariables(): CSSVariables['zIndex'] {
|
|
478
|
-
return {
|
|
479
|
-
dropdown: '1000',
|
|
480
|
-
sticky: '1020',
|
|
481
|
-
fixed: '1030',
|
|
482
|
-
modal: '1040',
|
|
483
|
-
popover: '1050',
|
|
484
|
-
tooltip: '1060',
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
// 生成过渡变量
|
|
489
|
-
private generateTransitionVariables(): CSSVariables['transition'] {
|
|
490
|
-
const { animation } = this.theme;
|
|
491
|
-
|
|
492
|
-
return {
|
|
493
|
-
base: `all ${animation.duration.normal} ${animation.easing.easeInOut}`,
|
|
494
|
-
fast: `all ${animation.duration.fast} ${animation.easing.easeInOut}`,
|
|
495
|
-
slow: `all ${animation.duration.slow} ${animation.easing.easeInOut}`,
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// 生成CSS变量字符串
|
|
500
|
-
public generateCSSString(): string {
|
|
501
|
-
const variables = this.generateVariables();
|
|
502
|
-
|
|
503
|
-
let css = ':root {\n';
|
|
504
|
-
|
|
505
|
-
// 递归生成变量
|
|
506
|
-
const generateSection = (obj: any, prefix: string = '') => {
|
|
507
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
508
|
-
if (typeof value === 'object' && value !== null) {
|
|
509
|
-
generateSection(value, `${prefix}${key}-`);
|
|
510
|
-
} else {
|
|
511
|
-
const variableName = `--${prefix}${key}`;
|
|
512
|
-
css += ` ${variableName}: ${value};\n`;
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
generateSection(variables);
|
|
518
|
-
css += '}\n';
|
|
519
|
-
|
|
520
|
-
// 生成暗色主题变量
|
|
521
|
-
css += '[data-theme="dark"] {\n';
|
|
522
|
-
const darkVariables = this.generateDarkThemeVariables();
|
|
523
|
-
Object.entries(darkVariables).forEach(([key, value]) => {
|
|
524
|
-
css += ` --${key}: ${value};\n`;
|
|
525
|
-
});
|
|
526
|
-
css += '}\n';
|
|
527
|
-
|
|
528
|
-
return css;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// 生成暗色主题变量
|
|
532
|
-
private generateDarkThemeVariables(): Record<string, string> {
|
|
533
|
-
const darkColors = this.generateColorVariables();
|
|
534
|
-
|
|
535
|
-
return {
|
|
536
|
-
'color-text': darkColors.text,
|
|
537
|
-
'color-text-secondary': darkColors.textSecondary,
|
|
538
|
-
'color-text-disabled': darkColors.textDisabled,
|
|
539
|
-
'color-text-inverse': darkColors.textInverse,
|
|
540
|
-
'color-background': darkColors.background,
|
|
541
|
-
'color-background-card': darkColors.backgroundCard,
|
|
542
|
-
'color-background-input': darkColors.backgroundInput,
|
|
543
|
-
'color-background-mask': darkColors.backgroundMask,
|
|
544
|
-
'color-border': darkColors.border,
|
|
545
|
-
'color-border-light': darkColors.borderLight,
|
|
546
|
-
'color-shadow': darkColors.shadow,
|
|
547
|
-
'color-shadow-light': darkColors.shadowLight,
|
|
548
|
-
'color-divider': darkColors.divider,
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
// 颜色处理工具方法
|
|
553
|
-
private lightenColor(hex: string, amount: number): string {
|
|
554
|
-
const rgb = this.hexToRgb(hex);
|
|
555
|
-
if (!rgb) return hex;
|
|
556
|
-
|
|
557
|
-
const r = Math.min(255, Math.floor(rgb.r + (255 - rgb.r) * amount));
|
|
558
|
-
const g = Math.min(255, Math.floor(rgb.g + (255 - rgb.g) * amount));
|
|
559
|
-
const b = Math.min(255, Math.floor(rgb.b + (255 - rgb.b) * amount));
|
|
560
|
-
|
|
561
|
-
return this.rgbToHex(r, g, b);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
private darkenColor(hex: string, amount: number): string {
|
|
565
|
-
const rgb = this.hexToRgb(hex);
|
|
566
|
-
if (!rgb) return hex;
|
|
567
|
-
|
|
568
|
-
const r = Math.max(0, Math.floor(rgb.r * (1 - amount)));
|
|
569
|
-
const g = Math.max(0, Math.floor(rgb.g * (1 - amount)));
|
|
570
|
-
const b = Math.max(0, Math.floor(rgb.b * (1 - amount)));
|
|
571
|
-
|
|
572
|
-
return this.rgbToHex(r, g, b);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
private hexToRgb(hex: string): { r: number; g: number; b: number } | null {
|
|
576
|
-
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
577
|
-
return result
|
|
578
|
-
? {
|
|
579
|
-
r: parseInt(result[1] || '0', 16),
|
|
580
|
-
g: parseInt(result[2] || '0', 16),
|
|
581
|
-
b: parseInt(result[3] || '0', 16),
|
|
582
|
-
}
|
|
583
|
-
: null;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
private rgbToHex(r: number, g: number, b: number): string {
|
|
587
|
-
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// 导出工具函数
|
|
592
|
-
export const createCSSVariables = (theme: ThemeConfig): CSSVariables => {
|
|
593
|
-
const generator = new CSSVariableGenerator(theme);
|
|
594
|
-
return generator.generateVariables();
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
export const generateCSSVariablesString = (theme: ThemeConfig): string => {
|
|
598
|
-
const generator = new CSSVariableGenerator(theme);
|
|
599
|
-
return generator.generateCSSString();
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
export default CSSVariableGenerator;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export interface AccessibilityState {
|
|
2
|
-
disabled?: boolean;
|
|
3
|
-
selected?: boolean;
|
|
4
|
-
checked?: boolean | 'mixed';
|
|
5
|
-
expanded?: boolean;
|
|
6
|
-
busy?: boolean;
|
|
7
|
-
pressed?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface AccessibilityValue {
|
|
11
|
-
min?: number;
|
|
12
|
-
max?: number;
|
|
13
|
-
now?: number;
|
|
14
|
-
text?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface AccessibilityProps {
|
|
18
|
-
accessible?: boolean;
|
|
19
|
-
accessibilityLabel?: string;
|
|
20
|
-
accessibilityRole?: string;
|
|
21
|
-
accessibilityHint?: string;
|
|
22
|
-
accessibilityState?: AccessibilityState;
|
|
23
|
-
accessibilityValue?: AccessibilityValue;
|
|
24
|
-
accessibilityId?: string;
|
|
25
|
-
accessibilityLiveRegion?: 'none' | 'polite' | 'assertive';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface AccessibilityActionEvent {
|
|
29
|
-
nativeEvent: {
|
|
30
|
-
actionName: string;
|
|
31
|
-
actionTarget?: string;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface AccessibilityEvents {
|
|
36
|
-
onAccessibilityAction?: (event: AccessibilityActionEvent) => void;
|
|
37
|
-
onAccessibilityFocus?: (event: any) => void;
|
|
38
|
-
onAccessibilityHintChange?: (event: any) => void;
|
|
39
|
-
onAccessibilityStateChange?: (event: any) => void;
|
|
40
|
-
onAccessibilityValueChange?: (event: any) => void;
|
|
41
|
-
onAccessibilityLabelChange?: (event: any) => void;
|
|
42
|
-
onAccessibilityRoleChange?: (event: any) => void;
|
|
43
|
-
onAccessibilityRequest?: (event: AccessibilityActionEvent) => void;
|
|
44
|
-
onAccessibilityDone?: (event: any) => void;
|
|
45
|
-
onAccessibilityCancel?: (event: any) => void;
|
|
46
|
-
onAccessibilityError?: (event: any) => void;
|
|
47
|
-
onAccessibilityWarning?: (event: any) => void;
|
|
48
|
-
onAccessibilityInfo?: (event: any) => void;
|
|
49
|
-
onAccessibilitySuccess?: (event: any) => void;
|
|
50
|
-
}
|