@niibase/uniwind 1.6.3 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/dist/common/{css → bundler/artifacts/css}/index.js +1 -4
- package/dist/common/{css → bundler/artifacts/css}/themes.js +1 -1
- package/dist/common/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +1 -2
- package/dist/common/bundler/config.js +69 -0
- package/dist/common/bundler/css-compiler/compileCSS.js +18 -0
- package/dist/common/bundler/css-compiler/compileNativeCSS.js +19 -0
- package/dist/common/bundler/css-compiler/compileTailwind.js +27 -0
- package/dist/common/bundler/css-compiler/compileWebCSS.js +15 -0
- package/dist/common/{vite → bundler/css-compiler}/index.js +4 -4
- package/dist/common/bundler/css-processor/addMetaToStylesTemplate.js +130 -0
- package/dist/common/bundler/css-processor/animation.js +112 -0
- package/dist/common/bundler/css-processor/color.js +66 -0
- package/dist/common/bundler/css-processor/css.js +510 -0
- package/dist/common/bundler/css-processor/functions.js +145 -0
- package/dist/common/bundler/css-processor/index.js +38 -0
- package/dist/common/bundler/css-processor/mq.js +87 -0
- package/dist/common/bundler/css-processor/processor.js +353 -0
- package/dist/common/bundler/css-processor/rn.js +356 -0
- package/dist/common/bundler/css-processor/serialize.js +86 -0
- package/dist/common/bundler/css-processor/types.js +1 -0
- package/dist/common/bundler/css-processor/units.js +55 -0
- package/dist/common/bundler/css-processor/utils.js +63 -0
- package/dist/common/bundler/css-processor/var.js +20 -0
- package/dist/common/{css-visitor → bundler/css-visitor}/rule-visitor.js +5 -5
- package/dist/common/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
- package/dist/common/bundler/logger.js +41 -0
- package/dist/common/bundler/types.js +1 -0
- package/dist/common/common/consts.js +26 -2
- package/dist/common/components/index.js +0 -3
- package/dist/common/components/web/rnw.js +2 -2
- package/dist/common/core/config/config.common.js +15 -9
- package/dist/common/core/config/config.js +2 -2
- package/dist/common/core/config/config.native.js +3 -3
- package/dist/common/core/listener.js +10 -10
- package/dist/common/core/native/runtime.js +7 -3
- package/dist/common/core/native/store.js +3 -4
- package/dist/common/core/web/cssListener.js +2 -2
- package/dist/common/hoc/withUniwind.js +5 -5
- package/dist/common/hoc/withUniwind.native.js +5 -5
- package/dist/common/hooks/useCSSVariable/index.js +7 -11
- package/dist/common/hooks/useCSSVariable/useCSSVariable.js +26 -18
- package/dist/common/hooks/useUniwind.js +2 -2
- package/dist/metro/index.cjs +14 -24
- package/dist/metro/index.d.ts +2 -0
- package/dist/metro/index.mjs +7 -17
- package/dist/metro/{metro-transformer.cjs → transformer.cjs} +306 -173
- package/dist/metro/{metro-transformer.mjs → transformer.mjs} +249 -116
- package/dist/module/{css → bundler/artifacts/css}/index.d.ts +1 -1
- package/dist/module/{css → bundler/artifacts/css}/index.js +1 -4
- package/dist/module/{css → bundler/artifacts/css}/themes.js +1 -1
- package/dist/module/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +3 -4
- package/dist/module/bundler/config.d.ts +16 -0
- package/dist/module/bundler/config.js +69 -0
- package/dist/module/bundler/css-compiler/compileCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileCSS.js +11 -0
- package/dist/module/bundler/css-compiler/compileNativeCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileNativeCSS.js +33 -0
- package/dist/module/bundler/css-compiler/compileTailwind.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileTailwind.js +22 -0
- package/dist/module/bundler/css-compiler/compileWebCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileWebCSS.js +8 -0
- package/dist/module/bundler/css-compiler/index.d.ts +1 -0
- package/dist/module/bundler/css-compiler/index.js +1 -0
- package/dist/module/bundler/css-processor/addMetaToStylesTemplate.d.ts +3 -0
- package/dist/module/bundler/css-processor/addMetaToStylesTemplate.js +136 -0
- package/dist/module/bundler/css-processor/animation.d.ts +6 -0
- package/dist/module/bundler/css-processor/animation.js +112 -0
- package/dist/module/bundler/css-processor/color.d.ts +12 -0
- package/dist/module/bundler/css-processor/color.js +63 -0
- package/dist/module/bundler/css-processor/css.d.ts +23 -0
- package/dist/module/bundler/css-processor/css.js +566 -0
- package/dist/module/bundler/css-processor/functions.d.ts +12 -0
- package/dist/module/bundler/css-processor/functions.js +190 -0
- package/dist/module/bundler/css-processor/index.d.ts +3 -0
- package/dist/module/bundler/css-processor/index.js +3 -0
- package/dist/module/bundler/css-processor/mq.d.ts +12 -0
- package/dist/module/bundler/css-processor/mq.js +78 -0
- package/dist/module/bundler/css-processor/processor.d.ts +36 -0
- package/dist/module/bundler/css-processor/processor.js +336 -0
- package/dist/module/bundler/css-processor/rn.d.ts +10 -0
- package/dist/module/bundler/css-processor/rn.js +400 -0
- package/dist/module/bundler/css-processor/serialize.d.ts +2 -0
- package/dist/module/bundler/css-processor/serialize.js +101 -0
- package/dist/module/bundler/css-processor/types.d.ts +28 -0
- package/dist/module/bundler/css-processor/types.js +0 -0
- package/dist/module/bundler/css-processor/units.d.ts +10 -0
- package/dist/module/bundler/css-processor/units.js +48 -0
- package/dist/module/bundler/css-processor/utils.d.ts +24 -0
- package/dist/{shared/uniwind.PtWWxxnh.mjs → module/bundler/css-processor/utils.js} +11 -15
- package/dist/module/bundler/css-processor/var.d.ts +7 -0
- package/dist/module/bundler/css-processor/var.js +13 -0
- package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.d.ts +1 -1
- package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.d.ts +4 -3
- package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.js +5 -5
- package/dist/module/{css-visitor → bundler/css-visitor}/visitor.d.ts +3 -3
- package/dist/module/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
- package/dist/module/bundler/logger.d.ts +11 -0
- package/dist/module/bundler/logger.js +34 -0
- package/dist/module/bundler/types.d.ts +15 -0
- package/dist/module/bundler/types.js +0 -0
- package/dist/module/common/consts.d.ts +21 -0
- package/dist/module/common/consts.js +24 -0
- package/dist/module/components/ScopedTheme/ScopedTheme.native.d.ts +1 -1
- package/dist/module/components/index.js +0 -3
- package/dist/module/components/native/Pressable.d.ts +1 -1
- package/dist/module/components/native/TouchableHighlight.d.ts +1 -1
- package/dist/module/components/native/TouchableOpacity.d.ts +1 -1
- package/dist/module/components/native/useAccentColor.d.ts +1 -1
- package/dist/module/components/native/useStyle.d.ts +2 -2
- package/dist/module/components/react-native-gesture-handler/native/BaseButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/BorderlessButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/DrawerLayoutAndroid.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/FlatList.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Pressable.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/PureNativeButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RawButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RectButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RefreshControl.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/ScrollView.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Switch.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/TextInput.d.ts +1 -1
- package/dist/module/components/web/Pressable.d.ts +1 -1
- package/dist/module/components/web/TouchableHighlight.d.ts +1 -1
- package/dist/module/components/web/TouchableOpacity.d.ts +1 -1
- package/dist/module/components/web/rnw.js +1 -1
- package/dist/module/core/config/config.common.d.ts +7 -6
- package/dist/module/core/config/config.common.js +6 -2
- package/dist/module/core/config/config.d.ts +1 -1
- package/dist/module/core/config/config.js +1 -1
- package/dist/module/core/config/config.native.d.ts +2 -2
- package/dist/module/core/config/config.native.js +1 -1
- package/dist/module/core/listener.d.ts +1 -1
- package/dist/module/core/listener.js +1 -1
- package/dist/module/core/native/runtime.js +5 -1
- package/dist/module/core/native/store.d.ts +2 -2
- package/dist/module/core/native/store.js +1 -2
- package/dist/module/core/types.d.ts +6 -3
- package/dist/module/core/web/cssListener.js +1 -1
- package/dist/module/core/web/getWebStyles.d.ts +1 -1
- package/dist/module/hoc/types.d.ts +2 -2
- package/dist/module/hoc/withUniwind.d.ts +1 -1
- package/dist/module/hoc/withUniwind.js +5 -5
- package/dist/module/hoc/withUniwind.native.d.ts +1 -1
- package/dist/module/hoc/withUniwind.native.js +5 -5
- package/dist/module/hooks/useCSSVariable/getVariableValue.native.d.ts +1 -1
- package/dist/module/hooks/useCSSVariable/index.d.ts +1 -1
- package/dist/module/hooks/useCSSVariable/index.js +1 -1
- package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +4 -2
- package/dist/module/hooks/useCSSVariable/useCSSVariable.js +23 -16
- package/dist/module/hooks/useResolveClassNames.d.ts +1 -1
- package/dist/module/hooks/useUniwind.d.ts +1 -1
- package/dist/module/hooks/useUniwind.js +1 -1
- package/dist/module/index.d.ts +1 -2
- package/dist/shared/{uniwind.r2i22V6d.cjs → uniwind.CFiAZ3D-.cjs} +307 -217
- package/dist/shared/{uniwind.BGiqYvxb.mjs → uniwind.u-s1XVU8.mjs} +299 -214
- package/dist/vite/index.cjs +12 -22
- package/dist/vite/index.mjs +9 -19
- package/package.json +1 -1
- package/src/{metro → bundler/adapters/metro}/index.d.ts +2 -0
- package/src/bundler/adapters/metro/index.ts +1 -0
- package/src/{metro/withUniwindConfig.ts → bundler/adapters/metro/metro.ts} +7 -22
- package/src/{metro/metro-css-patches.ts → bundler/adapters/metro/patches.ts} +2 -1
- package/src/{metro → bundler/adapters/metro}/resolvers.ts +8 -8
- package/src/bundler/adapters/metro/transformer.ts +85 -0
- package/src/{vite → bundler/adapters/vite}/vite.ts +10 -28
- package/src/{css → bundler/artifacts/css}/extraUtilities.ts +1 -1
- package/src/{css → bundler/artifacts/css}/index.ts +1 -5
- package/src/{css → bundler/artifacts/css}/themes.ts +1 -1
- package/src/{utils/buildDtsFile.ts → bundler/artifacts/dts.ts} +3 -4
- package/src/bundler/config.ts +84 -0
- package/src/bundler/css-compiler/compileCSS.ts +15 -0
- package/src/bundler/css-compiler/compileNativeCSS.ts +41 -0
- package/src/bundler/css-compiler/compileTailwind.ts +25 -0
- package/src/bundler/css-compiler/compileWebCSS.ts +10 -0
- package/src/bundler/css-compiler/index.ts +1 -0
- package/src/{metro → bundler/css-processor}/addMetaToStylesTemplate.ts +33 -14
- package/src/{metro/processor → bundler/css-processor}/animation.ts +4 -4
- package/src/{metro/processor → bundler/css-processor}/color.ts +4 -3
- package/src/{metro/processor → bundler/css-processor}/css.ts +17 -9
- package/src/{metro/processor → bundler/css-processor}/functions.ts +2 -2
- package/src/bundler/css-processor/index.ts +3 -0
- package/src/{metro/processor → bundler/css-processor}/mq.ts +4 -4
- package/src/{metro/processor → bundler/css-processor}/processor.ts +13 -11
- package/src/{metro/processor → bundler/css-processor}/rn.ts +115 -3
- package/src/{metro/utils → bundler/css-processor}/serialize.ts +2 -2
- package/src/{metro → bundler/css-processor}/types.ts +3 -17
- package/src/{metro/processor → bundler/css-processor}/units.ts +1 -1
- package/src/{metro/processor → bundler/css-processor}/var.ts +1 -1
- package/src/{css-visitor → bundler/css-visitor}/function-visitor.ts +1 -1
- package/src/{css-visitor → bundler/css-visitor}/rule-visitor.ts +6 -5
- package/src/{css-visitor → bundler/css-visitor}/visitor.ts +4 -3
- package/src/bundler/types.ts +17 -0
- package/src/common/consts.ts +25 -0
- package/src/components/ScopedTheme/ScopedTheme.native.tsx +1 -1
- package/src/components/index.ts +0 -3
- package/src/components/native/ActivityIndicator.tsx +2 -1
- package/src/components/native/Button.tsx +2 -1
- package/src/components/native/FlatList.tsx +2 -1
- package/src/components/native/Image.tsx +2 -1
- package/src/components/native/ImageBackground.tsx +2 -1
- package/src/components/native/InputAccessoryView.tsx +3 -2
- package/src/components/native/KeyboardAvoidingView.tsx +2 -1
- package/src/components/native/Modal.tsx +2 -1
- package/src/components/native/Pressable.tsx +1 -1
- package/src/components/native/RefreshControl.tsx +2 -1
- package/src/components/native/SafeAreaView.tsx +2 -1
- package/src/components/native/ScrollView.tsx +2 -1
- package/src/components/native/SectionList.tsx +2 -1
- package/src/components/native/Switch.tsx +3 -2
- package/src/components/native/Text.tsx +3 -2
- package/src/components/native/TextInput.tsx +3 -2
- package/src/components/native/TouchableHighlight.tsx +3 -2
- package/src/components/native/TouchableNativeFeedback.tsx +3 -2
- package/src/components/native/TouchableOpacity.tsx +3 -2
- package/src/components/native/TouchableWithoutFeedback.tsx +3 -2
- package/src/components/native/View.tsx +2 -1
- package/src/components/native/VirtualizedList.tsx +2 -1
- package/src/components/native/useAccentColor.ts +1 -1
- package/src/components/native/useStyle.ts +2 -2
- package/src/components/react-native-gesture-handler/native/BaseButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/BorderlessButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/DrawerLayoutAndroid.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/FlatList.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/GestureHandlerRootView.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/Pressable.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/PureNativeButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RawButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RectButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/ScrollView.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/Switch.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/Text.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TextInput.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableNativeFeedback.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableOpacity.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableWithoutFeedback.tsx +2 -2
- package/src/components/web/ActivityIndicator.tsx +2 -1
- package/src/components/web/Button.tsx +2 -1
- package/src/components/web/FlatList.tsx +2 -1
- package/src/components/web/Image.tsx +2 -1
- package/src/components/web/ImageBackground.tsx +2 -1
- package/src/components/web/KeyboardAvoidingView.tsx +2 -1
- package/src/components/web/Modal.tsx +2 -1
- package/src/components/web/Pressable.tsx +2 -1
- package/src/components/web/RefreshControl.tsx +2 -1
- package/src/components/web/SafeAreaView.tsx +2 -1
- package/src/components/web/ScrollView.tsx +2 -1
- package/src/components/web/SectionList.tsx +2 -1
- package/src/components/web/Switch.tsx +2 -1
- package/src/components/web/Text.tsx +2 -1
- package/src/components/web/TextInput.tsx +2 -1
- package/src/components/web/TouchableHighlight.tsx +2 -1
- package/src/components/web/TouchableOpacity.tsx +2 -1
- package/src/components/web/TouchableWithoutFeedback.tsx +2 -1
- package/src/components/web/View.tsx +2 -1
- package/src/components/web/VirtualizedList.tsx +2 -1
- package/src/components/web/rnw.ts +1 -1
- package/src/core/config/config.common.ts +15 -8
- package/src/core/config/config.native.ts +3 -3
- package/src/core/config/config.ts +2 -2
- package/src/core/listener.ts +1 -1
- package/src/core/native/runtime.ts +7 -2
- package/src/core/native/store.ts +3 -4
- package/src/core/types.ts +6 -3
- package/src/core/web/cssListener.ts +1 -1
- package/src/core/web/getWebStyles.ts +1 -1
- package/src/hoc/types.ts +2 -2
- package/src/hoc/withUniwind.native.tsx +4 -3
- package/src/hoc/withUniwind.tsx +3 -2
- package/src/hooks/useCSSVariable/getVariableValue.native.ts +1 -1
- package/src/hooks/useCSSVariable/index.ts +1 -1
- package/src/hooks/useCSSVariable/useCSSVariable.ts +34 -25
- package/src/hooks/useResolveClassNames.ts +1 -1
- package/src/hooks/useUniwind.ts +2 -2
- package/src/index.ts +1 -2
- package/dist/common/types.js +0 -28
- package/dist/common/utils/stringifyThemes.js +0 -8
- package/dist/common/vite/vite.js +0 -95
- package/dist/module/types.d.ts +0 -21
- package/dist/module/types.js +0 -22
- package/dist/module/utils/stringifyThemes.d.ts +0 -1
- package/dist/module/utils/stringifyThemes.js +0 -1
- package/dist/module/vite/index.d.ts +0 -9
- package/dist/module/vite/index.js +0 -1
- package/dist/module/vite/vite.d.ts +0 -8
- package/dist/module/vite/vite.js +0 -98
- package/dist/shared/uniwind.B5q8hBGv.cjs +0 -18
- package/dist/shared/uniwind.Cv73KtI-.cjs +0 -86
- package/dist/shared/uniwind.JSWK3vHl.mjs +0 -14
- package/src/metro/compileVirtual.ts +0 -85
- package/src/metro/index.ts +0 -1
- package/src/metro/injectThemes.ts +0 -23
- package/src/metro/metro-transformer.ts +0 -116
- package/src/metro/processor/index.ts +0 -1
- package/src/metro/utils/index.ts +0 -2
- package/src/types.ts +0 -23
- package/src/utils/stringifyThemes.ts +0 -1
- package/src/vite/index.d.ts +0 -9
- /package/dist/common/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/insets.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/overwrite.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/variants.js +0 -0
- /package/dist/common/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
- /package/dist/common/{css-visitor → bundler/css-visitor}/index.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/insets.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/insets.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/overwrite.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/overwrite.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/themes.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/variants.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/variants.js +0 -0
- /package/dist/module/{utils/buildDtsFile.d.ts → bundler/artifacts/dts.d.ts} +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/index.d.ts +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/index.js +0 -0
- /package/{dist/common → src/bundler/adapters}/vite/index.d.ts +0 -0
- /package/src/{vite → bundler/adapters/vite}/index.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/insets.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/overwrite.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/variants.ts +0 -0
- /package/src/{metro/utils/common.ts → bundler/css-processor/utils.ts} +0 -0
- /package/src/{css-visitor → bundler/css-visitor}/index.ts +0 -0
- /package/src/{metro → bundler}/logger.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { TouchableHighlightProps } from 'react-native'
|
|
3
|
+
import { TouchableHighlight as RNTouchableHighlight } from 'react-native'
|
|
4
|
+
import type { ComponentState } from '../../core/types'
|
|
4
5
|
import { copyComponentProperties } from '../utils'
|
|
5
6
|
import { useAccentColor } from './useAccentColor'
|
|
6
7
|
import { useStyle } from './useStyle'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { TouchableNativeFeedbackProps } from 'react-native'
|
|
3
|
+
import { TouchableNativeFeedback as RNTouchableNativeFeedback } from 'react-native'
|
|
4
|
+
import type { ComponentState } from '../../core/types'
|
|
4
5
|
import { copyComponentProperties } from '../utils'
|
|
5
6
|
import { useStyle } from './useStyle'
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { TouchableOpacityProps } from 'react-native'
|
|
3
|
+
import { TouchableOpacity as RNTouchableOpacity } from 'react-native'
|
|
4
|
+
import type { ComponentState } from '../../core/types'
|
|
4
5
|
import { copyComponentProperties } from '../utils'
|
|
5
6
|
import { useStyle } from './useStyle'
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { TouchableWithoutFeedbackProps } from 'react-native'
|
|
3
|
+
import { TouchableWithoutFeedback as RNTouchableWithoutFeedback } from 'react-native'
|
|
4
|
+
import type { ComponentState } from '../../core/types'
|
|
4
5
|
import { copyComponentProperties } from '../utils'
|
|
5
6
|
import { useStyle } from './useStyle'
|
|
6
7
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VirtualizedListProps } from 'react-native'
|
|
2
|
+
import { VirtualizedList as RNVirtualizedList } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { useAccentColor } from './useAccentColor'
|
|
4
5
|
import { useStyle } from './useStyle'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable prefer-arrow/prefer-arrow-functions */
|
|
2
|
-
import { ComponentType, useLayoutEffect, useReducer } from 'react'
|
|
2
|
+
import { type ComponentType, useLayoutEffect, useReducer } from 'react'
|
|
3
3
|
import { createAnimatedComponent } from 'react-native-reanimated'
|
|
4
4
|
import { useUniwindContext } from '../../core/context'
|
|
5
5
|
import { UniwindListener } from '../../core/listener'
|
|
6
6
|
import { UniwindStore } from '../../core/native'
|
|
7
|
-
import { ComponentState, RNStyle } from '../../core/types'
|
|
7
|
+
import type { ComponentState, RNStyle } from '../../core/types'
|
|
8
8
|
import { weakFamily } from '../../core/weak-map'
|
|
9
9
|
|
|
10
10
|
export function useStyle(className?: string, componentProps?: Record<string, any>, state?: ComponentState): RNStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseButton as RNGHBaseButton, BaseButtonProps } from 'react-native-gesture-handler'
|
|
1
|
+
import { BaseButton as RNGHBaseButton, type BaseButtonProps } from 'react-native-gesture-handler'
|
|
2
2
|
import { useStyle } from '../../native/useStyle'
|
|
3
3
|
import { copyComponentProperties } from '../../utils'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BorderlessButton as RNGHBorderlessButton, BorderlessButtonProps } from 'react-native-gesture-handler'
|
|
1
|
+
import { BorderlessButton as RNGHBorderlessButton, type BorderlessButtonProps } from 'react-native-gesture-handler'
|
|
2
2
|
import { useStyle } from '../../native/useStyle'
|
|
3
3
|
import { copyComponentProperties } from '../../utils'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DrawerLayoutAndroidProps } from 'react-native'
|
|
1
|
+
import type { DrawerLayoutAndroidProps } from 'react-native'
|
|
2
2
|
import { DrawerLayoutAndroid as RNGHDrawerLayoutAndroid } from 'react-native-gesture-handler'
|
|
3
3
|
import { useStyle } from '../../native/useStyle'
|
|
4
4
|
import { copyComponentProperties } from '../../utils'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FlatListProps } from 'react-native'
|
|
1
|
+
import type { FlatListProps } from 'react-native'
|
|
2
2
|
import { FlatList as RNGHFlatList } from 'react-native-gesture-handler'
|
|
3
3
|
import { useAccentColor } from '../../native/useAccentColor'
|
|
4
4
|
import { useStyle } from '../../native/useStyle'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GestureHandlerRootView as RNGestureHandlerRootView } from 'react-native-gesture-handler'
|
|
2
|
-
import { GestureHandlerRootViewProps } from 'react-native-gesture-handler/lib/typescript/components/GestureHandlerRootView'
|
|
2
|
+
import type { GestureHandlerRootViewProps } from 'react-native-gesture-handler/lib/typescript/components/GestureHandlerRootView'
|
|
3
3
|
import { useStyle } from '../../native/useStyle'
|
|
4
4
|
import { copyComponentProperties } from '../../utils'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { Pressable as RNGHPressable, PressableProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { Pressable as RNGHPressable, type PressableProps } from 'react-native-gesture-handler'
|
|
3
3
|
import { useStyle } from '../../native/useStyle'
|
|
4
4
|
import { copyComponentProperties } from '../../utils'
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PureNativeButton as RNGHPureNativeButton, RawButtonProps } from 'react-native-gesture-handler'
|
|
1
|
+
import { PureNativeButton as RNGHPureNativeButton, type RawButtonProps } from 'react-native-gesture-handler'
|
|
2
2
|
import { useStyle } from '../../native/useStyle'
|
|
3
3
|
import { copyComponentProperties } from '../../utils'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RawButton as RNGHRawButton, RawButtonProps } from 'react-native-gesture-handler'
|
|
1
|
+
import { RawButton as RNGHRawButton, type RawButtonProps } from 'react-native-gesture-handler'
|
|
2
2
|
import { useStyle } from '../../native/useStyle'
|
|
3
3
|
import { copyComponentProperties } from '../../utils'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RectButton as RNGHRectButton, RectButtonProps } from 'react-native-gesture-handler'
|
|
1
|
+
import { RectButton as RNGHRectButton, type RectButtonProps } from 'react-native-gesture-handler'
|
|
2
2
|
import { useStyle } from '../../native/useStyle'
|
|
3
3
|
import { copyComponentProperties } from '../../utils'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefreshControlProps } from 'react-native'
|
|
1
|
+
import type { RefreshControlProps } from 'react-native'
|
|
2
2
|
import { RefreshControl as RNGHRefreshControl } from 'react-native-gesture-handler'
|
|
3
3
|
import { useAccentColor } from '../../native/useAccentColor'
|
|
4
4
|
import { useStyle } from '../../native/useStyle'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScrollViewProps } from 'react-native'
|
|
1
|
+
import type { ScrollViewProps } from 'react-native'
|
|
2
2
|
import { ScrollView as RNGHScrollView } from 'react-native-gesture-handler'
|
|
3
3
|
import { useStyle } from '../../native/useStyle'
|
|
4
4
|
import { copyComponentProperties } from '../../utils'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SwitchProps } from 'react-native'
|
|
1
|
+
import type { SwitchProps } from 'react-native'
|
|
2
2
|
import { Switch as RNGHSwitch } from 'react-native-gesture-handler'
|
|
3
|
-
import { ComponentState } from '../../../core/types'
|
|
3
|
+
import type { ComponentState } from '../../../core/types'
|
|
4
4
|
import { useStyle } from '../../native/useStyle'
|
|
5
5
|
import { copyComponentProperties } from '../../utils'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { TextProps } from 'react-native'
|
|
2
|
+
import type { TextProps } from 'react-native'
|
|
3
3
|
import { Text as RNGHText } from 'react-native-gesture-handler'
|
|
4
|
-
import { ComponentState } from '../../../core/types'
|
|
4
|
+
import type { ComponentState } from '../../../core/types'
|
|
5
5
|
import { useAccentColor } from '../../native/useAccentColor'
|
|
6
6
|
import { useStyle } from '../../native/useStyle'
|
|
7
7
|
import { copyComponentProperties } from '../../utils'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { TextInputProps } from 'react-native'
|
|
2
|
+
import type { TextInputProps } from 'react-native'
|
|
3
3
|
import { TextInput as RNGHTextInput } from 'react-native-gesture-handler'
|
|
4
|
-
import { ComponentState } from '../../../core/types'
|
|
4
|
+
import type { ComponentState } from '../../../core/types'
|
|
5
5
|
import { useAccentColor } from '../../native/useAccentColor'
|
|
6
6
|
import { useStyle } from '../../native/useStyle'
|
|
7
7
|
import { copyComponentProperties } from '../../utils'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { TouchableNativeFeedbackProps } from 'react-native'
|
|
2
|
+
import type { TouchableNativeFeedbackProps } from 'react-native'
|
|
3
3
|
import { TouchableNativeFeedback as RNGHTouchableNativeFeedback } from 'react-native-gesture-handler'
|
|
4
|
-
import { ComponentState } from '../../../core/types'
|
|
4
|
+
import type { ComponentState } from '../../../core/types'
|
|
5
5
|
import { useStyle } from '../../native/useStyle'
|
|
6
6
|
import { copyComponentProperties } from '../../utils'
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { TouchableOpacity as RNGHTouchableOpacity, TouchableOpacityProps } from 'react-native-gesture-handler'
|
|
3
|
-
import { ComponentState } from '../../../core/types'
|
|
2
|
+
import { TouchableOpacity as RNGHTouchableOpacity, type TouchableOpacityProps } from 'react-native-gesture-handler'
|
|
3
|
+
import type { ComponentState } from '../../../core/types'
|
|
4
4
|
import { useStyle } from '../../native/useStyle'
|
|
5
5
|
import { copyComponentProperties } from '../../utils'
|
|
6
6
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
TouchableWithoutFeedback as RNGHTouchableWithoutFeedback,
|
|
4
|
-
TouchableWithoutFeedbackProps,
|
|
4
|
+
type TouchableWithoutFeedbackProps,
|
|
5
5
|
} from 'react-native-gesture-handler'
|
|
6
|
-
import { ComponentState } from '../../../core/types'
|
|
6
|
+
import type { ComponentState } from '../../../core/types'
|
|
7
7
|
import { useStyle } from '../../native/useStyle'
|
|
8
8
|
import { copyComponentProperties } from '../../utils'
|
|
9
9
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ActivityIndicatorProps } from 'react-native'
|
|
2
|
+
import { ActivityIndicator as RNActivityIndicator } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ButtonProps } from 'react-native'
|
|
2
|
+
import { Button as RNButton } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { useUniwindAccent } from './useUniwindAccent'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FlatListProps } from 'react-native'
|
|
2
|
+
import { FlatList as RNFlatList } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ImageProps } from 'react-native'
|
|
2
|
+
import { Image as RNImage } from 'react-native'
|
|
2
3
|
import { useResolveClassNames } from '../../hooks'
|
|
3
4
|
import { copyComponentProperties } from '../utils'
|
|
4
5
|
import { generateDataSet } from './generateDataSet'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ImageBackgroundProps } from 'react-native'
|
|
2
|
+
import { ImageBackground as RNImageBackground } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { KeyboardAvoidingViewProps } from 'react-native'
|
|
2
|
+
import { KeyboardAvoidingView as RNKeyboardAvoidingView } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ModalProps } from 'react-native'
|
|
2
|
+
import { Modal as RNModal } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PressableProps } from 'react-native'
|
|
2
|
+
import { Pressable as RNPressable } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RefreshControlProps } from 'react-native'
|
|
2
|
+
import { RefreshControl as RNRefreshControl } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ViewProps } from 'react-native'
|
|
2
|
+
import { SafeAreaView as RNSafeAreaView } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ScrollViewProps } from 'react-native'
|
|
2
|
+
import { ScrollView as RNScrollView } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SectionListProps } from 'react-native'
|
|
2
|
+
import { SectionList as RNSectionList } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SwitchProps } from 'react-native'
|
|
2
|
+
import { Switch as RNSwitch } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TextProps } from 'react-native'
|
|
2
|
+
import { Text as RNText } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TextInputProps } from 'react-native'
|
|
2
|
+
import { TextInput as RNTextInput } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TouchableHighlightProps } from 'react-native'
|
|
2
|
+
import { TouchableHighlight as RNTouchableHighlight } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TouchableOpacityProps } from 'react-native'
|
|
2
|
+
import { TouchableOpacity as RNTouchableOpacity } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TouchableWithoutFeedbackProps } from 'react-native'
|
|
2
|
+
import { TouchableWithoutFeedback as RNTouchableWithoutFeedback } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ViewProps } from 'react-native'
|
|
2
|
+
import { View as RNView } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VirtualizedListProps } from 'react-native'
|
|
2
|
+
import { VirtualizedList as RNVirtualizedList } from 'react-native'
|
|
2
3
|
import { copyComponentProperties } from '../utils'
|
|
3
4
|
import { generateDataSet } from './generateDataSet'
|
|
4
5
|
import { toRNWClassName } from './rnw'
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { createElement, useMemo } from 'react'
|
|
2
|
+
import type { Insets } from 'react-native'
|
|
3
|
+
import { Appearance, Platform } from 'react-native'
|
|
4
|
+
import { ColorScheme, StyleDependency } from '../../common/consts'
|
|
5
|
+
import { withUniwind } from '../../hoc'
|
|
6
|
+
import type { ApplyUniwind } from '../../hoc/types'
|
|
7
|
+
import type { GetCSSVariable } from '../../hooks/useCSSVariable/useCSSVariable'
|
|
8
|
+
import { getCSSVariable } from '../../hooks/useCSSVariable/useCSSVariable'
|
|
6
9
|
import { UniwindListener } from '../listener'
|
|
7
|
-
import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
|
|
10
|
+
import type { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
|
|
8
11
|
|
|
9
12
|
const SYSTEM_THEME = 'system' as const
|
|
10
13
|
// Platform.constants is not defined in RNW
|
|
@@ -53,9 +56,9 @@ export class UniwindConfigBuilder {
|
|
|
53
56
|
return colorScheme ?? ColorScheme.Light
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
Wrapper<T extends ElementType>({ as, ...props }: {
|
|
59
|
+
Wrapper<T extends React.ElementType>({ as, ...props }: {
|
|
57
60
|
as: T
|
|
58
|
-
} & ApplyUniwind<Omit<ComponentPropsWithRef<T>, 'as'>>) {
|
|
61
|
+
} & ApplyUniwind<Omit<React.ComponentPropsWithRef<T>, 'as'>>) {
|
|
59
62
|
const StyledComponent = useMemo(() => withUniwind(as as any), [as])
|
|
60
63
|
return createElement(StyledComponent, props)
|
|
61
64
|
}
|
|
@@ -116,6 +119,10 @@ export class UniwindConfigBuilder {
|
|
|
116
119
|
// noop
|
|
117
120
|
}
|
|
118
121
|
|
|
122
|
+
getCSSVariable = ((variableName: string | Array<string>) => {
|
|
123
|
+
return getCSSVariable(variableName, { scopedTheme: null })
|
|
124
|
+
}) as GetCSSVariable
|
|
125
|
+
|
|
119
126
|
protected __reinit(_: GenerateStyleSheetsCallback, themes: Array<string>) {
|
|
120
127
|
this._themes = themes
|
|
121
128
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { formatHex, formatHex8, parse } from 'culori'
|
|
2
|
-
import { Insets } from 'react-native'
|
|
3
|
-
import { StyleDependency } from '../../
|
|
2
|
+
import type { Insets } from 'react-native'
|
|
3
|
+
import { StyleDependency } from '../../common/consts'
|
|
4
4
|
import { UniwindListener } from '../listener'
|
|
5
5
|
import { Logger } from '../logger'
|
|
6
6
|
import { UniwindStore } from '../native'
|
|
7
|
-
import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
|
|
7
|
+
import type { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
|
|
8
8
|
import { UniwindConfigBuilder as UniwindConfigBuilderBase } from './config.common'
|
|
9
9
|
|
|
10
10
|
class UniwindConfigBuilder extends UniwindConfigBuilderBase {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { StyleDependency } from '../../common/consts'
|
|
1
2
|
import { arrayEquals } from '../../common/utils'
|
|
2
|
-
import { StyleDependency } from '../../types'
|
|
3
3
|
import { UniwindListener } from '../listener'
|
|
4
4
|
import { Logger } from '../logger'
|
|
5
|
-
import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
|
|
5
|
+
import type { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
|
|
6
6
|
import { getWebVariable } from '../web'
|
|
7
7
|
import { UniwindConfigBuilder as UniwindConfigBuilderBase } from './config.common'
|
|
8
8
|
|
package/src/core/listener.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Appearance, Dimensions, I18nManager, PixelRatio, Platform, StyleSheet } from 'react-native'
|
|
2
2
|
import { cubicBezier, linear, steps } from 'react-native-reanimated'
|
|
3
3
|
import { initialWindowMetrics } from 'react-native-safe-area-context'
|
|
4
|
-
import { ColorScheme, Orientation } from '../../
|
|
4
|
+
import { ColorScheme, DEFAULT_SCREEN_WIDTH, Orientation } from '../../common/consts'
|
|
5
5
|
import type { UniwindRuntime as UniwindRuntimeType } from '../types'
|
|
6
6
|
import { colorMix, lightDark, parseColor } from './native-utils'
|
|
7
7
|
|
|
@@ -28,9 +28,14 @@ export const UniwindRuntime = {
|
|
|
28
28
|
lightDark: () => '',
|
|
29
29
|
parseColor,
|
|
30
30
|
platformSelect: (android: string, ios: string, other?: string) => {
|
|
31
|
-
// eslint-disable-next-line no-extra-boolean-
|
|
31
|
+
// eslint-disable-next-line no-extra-boolean-casts
|
|
32
32
|
return Platform.select(Boolean(other) ? { android, ios, default: other } : { android, default: ios })
|
|
33
33
|
},
|
|
34
|
+
makeResponsive(value: number, base: number = DEFAULT_SCREEN_WIDTH, useHeight: boolean = false) {
|
|
35
|
+
const dimension = useHeight ? this.screen.height : this.screen.width
|
|
36
|
+
|
|
37
|
+
return Math.round(value * dimension / base)
|
|
38
|
+
},
|
|
34
39
|
} as UniwindRuntimeType
|
|
35
40
|
|
|
36
41
|
UniwindRuntime.lightDark = lightDark.bind(UniwindRuntime)
|
package/src/core/native/store.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Dimensions, Platform } from 'react-native'
|
|
2
|
-
import { CSSAnimationKeyframes } from 'react-native-reanimated'
|
|
3
|
-
import { Platform as UniwindPlatform, UNIWIND_PLATFORM_VARIABLES, UNIWIND_THEME_VARIABLES } from '../../common/consts'
|
|
4
|
-
import { Orientation, StyleDependency } from '../../types'
|
|
2
|
+
import type { CSSAnimationKeyframes } from 'react-native-reanimated'
|
|
3
|
+
import { Orientation, Platform as UniwindPlatform, StyleDependency, UNIWIND_PLATFORM_VARIABLES, UNIWIND_THEME_VARIABLES } from '../../common/consts'
|
|
5
4
|
import { UniwindListener } from '../listener'
|
|
6
|
-
import { ComponentState, GenerateStyleSheetsCallback, RNStyle, Style, StyleSheets, ThemeName, UniwindContextType } from '../types'
|
|
5
|
+
import type { ComponentState, GenerateStyleSheetsCallback, RNStyle, Style, StyleSheets, ThemeName, UniwindContextType } from '../types'
|
|
7
6
|
import { cloneWithAccessors } from './native-utils'
|
|
8
7
|
import {
|
|
9
8
|
parseBoxShadow,
|
package/src/core/types.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native'
|
|
3
|
-
import { CSSAnimationKeyframes } from 'react-native-reanimated'
|
|
4
|
-
import { ControlPoint, CubicBezierEasing, LinearEasing, StepsEasing, StepsModifier } from 'react-native-reanimated/lib/typescript/css/easing'
|
|
5
|
-
import { ColorScheme, Orientation, StyleDependency
|
|
3
|
+
import type { CSSAnimationKeyframes } from 'react-native-reanimated'
|
|
4
|
+
import type { ControlPoint, CubicBezierEasing, LinearEasing, StepsEasing, StepsModifier } from 'react-native-reanimated/lib/typescript/css/easing'
|
|
5
|
+
import type { ColorScheme, Orientation, StyleDependency } from '../common/consts'
|
|
6
6
|
import type { UniwindContext } from './context'
|
|
7
7
|
|
|
8
8
|
export type Style = {
|
|
@@ -33,6 +33,8 @@ export type GenerateStyleSheetsCallback = (rt: UniwindRuntime) => {
|
|
|
33
33
|
scopedVars: Partial<Record<string, Record<string, unknown>>>
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export interface UniwindConfig {}
|
|
37
|
+
|
|
36
38
|
type UserThemes = UniwindConfig extends { themes: infer T extends readonly string[] } ? T
|
|
37
39
|
: readonly string[]
|
|
38
40
|
|
|
@@ -63,6 +65,7 @@ export type UniwindRuntime = {
|
|
|
63
65
|
lightDark: (light: string, dark: string) => string
|
|
64
66
|
parseColor: (type: string, color: string) => string
|
|
65
67
|
platformSelect: (android: string, ios: string, other?: string) => string
|
|
68
|
+
makeResponsive: (value: number, base: number, useHeight?: boolean) => number
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
export type RNStyle = ViewStyle & TextStyle & ImageStyle & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generateDataSet } from '../../components/web/generateDataSet'
|
|
2
|
-
import { RNStyle, UniwindContextType } from '../types'
|
|
2
|
+
import type { RNStyle, UniwindContextType } from '../types'
|
|
3
3
|
import { CSSListener } from './cssListener'
|
|
4
4
|
import { parseCSSValue } from './parseCSSValue'
|
|
5
5
|
|
package/src/hoc/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps, ComponentPropsWithRef } from 'react'
|
|
2
|
-
import { RNStyle } from '../core/types'
|
|
1
|
+
import type { ComponentProps, ComponentPropsWithRef } from 'react'
|
|
2
|
+
import type { RNStyle } from '../core/types'
|
|
3
3
|
|
|
4
4
|
export type AnyObject = Record<PropertyKey, any>
|
|
5
5
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ComponentProps
|
|
1
|
+
import type { ComponentProps } from 'react'
|
|
2
|
+
import { useLayoutEffect, useReducer } from 'react'
|
|
3
|
+
import type { StyleDependency } from '../common/consts'
|
|
2
4
|
import { isDefined } from '../common/utils'
|
|
3
5
|
import { useUniwindContext } from '../core/context'
|
|
4
6
|
import { UniwindListener } from '../core/listener'
|
|
5
7
|
import { Logger } from '../core/logger'
|
|
6
8
|
import { UniwindStore } from '../core/native'
|
|
7
|
-
import {
|
|
8
|
-
import { AnyObject, Component, OptionMapping, WithUniwind } from './types'
|
|
9
|
+
import type { AnyObject, Component, OptionMapping, WithUniwind } from './types'
|
|
9
10
|
import { classToColor, classToStyle, isClassProperty, isColorClassProperty, isStyleProperty } from './withUniwindUtils'
|
|
10
11
|
|
|
11
12
|
let warnedOnce = false
|