@niibase/uniwind 1.6.4 → 1.8.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 +71 -0
- package/dist/cli/index.cjs +91 -0
- package/dist/cli/index.mjs +84 -0
- package/dist/common/{css → bundler/artifacts/css}/index.js +1 -4
- package/dist/common/{css → bundler/artifacts/css}/themes.js +4 -1
- package/dist/common/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +1 -2
- package/dist/common/bundler/cli/index.js +76 -0
- package/dist/common/bundler/config.js +75 -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 +61 -0
- package/dist/common/bundler/css-processor/var.js +20 -0
- package/dist/common/{css-visitor → bundler/css-visitor}/rule-visitor.js +7 -7
- package/dist/common/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
- package/dist/common/bundler/logger.js +44 -0
- package/dist/common/bundler/types.js +1 -0
- package/dist/common/common/consts.js +26 -2
- package/dist/common/components/web/rnw.js +2 -2
- package/dist/common/core/config/config.common.js +9 -9
- package/dist/common/core/config/config.js +2 -2
- package/dist/common/core/config/config.native.js +4 -8
- package/dist/common/core/listener.js +10 -10
- package/dist/common/core/native/native-utils.js +1 -8
- package/dist/common/core/native/parsers/textShadow.js +6 -18
- package/dist/common/core/native/parsers/transforms.js +1 -5
- package/dist/common/core/native/runtime.js +7 -3
- package/dist/common/core/native/store.js +22 -69
- 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/getVariableValue.native.js +4 -1
- package/dist/common/hooks/useCSSVariable/useCSSVariable.js +6 -2
- package/dist/common/hooks/useUniwind.js +2 -2
- package/dist/metro/index.cjs +40 -34
- package/dist/metro/index.d.ts +2 -0
- package/dist/metro/index.mjs +28 -22
- package/dist/metro/{metro-transformer.cjs → transformer.cjs} +316 -200
- package/dist/metro/{metro-transformer.mjs → transformer.mjs} +254 -138
- 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 +4 -1
- package/dist/module/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +3 -4
- package/dist/module/bundler/cli/index.d.ts +2 -0
- package/dist/module/bundler/cli/index.js +81 -0
- package/dist/module/bundler/config.d.ts +17 -0
- package/dist/module/bundler/config.js +77 -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 +23 -0
- package/dist/{shared/uniwind.PtWWxxnh.mjs → module/bundler/css-processor/utils.js} +12 -18
- 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 +7 -7
- 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 +12 -0
- package/dist/module/bundler/logger.js +37 -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/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 +3 -3
- 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/Text.d.ts +4 -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 +6 -7
- package/dist/module/core/config/config.common.js +2 -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 +2 -6
- package/dist/module/core/listener.d.ts +1 -1
- package/dist/module/core/listener.js +1 -1
- package/dist/module/core/native/native-utils.d.ts +0 -1
- package/dist/module/core/native/native-utils.js +0 -6
- package/dist/module/core/native/parsers/textShadow.js +6 -18
- package/dist/module/core/native/parsers/transforms.js +1 -5
- package/dist/module/core/native/runtime.js +5 -1
- package/dist/module/core/native/store.d.ts +3 -3
- package/dist/module/core/native/store.js +22 -65
- package/dist/module/core/types.d.ts +12 -7
- 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/getVariableValue.native.js +4 -1
- package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +1 -1
- package/dist/module/hooks/useCSSVariable/useCSSVariable.js +5 -1
- 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.BEqYiPBB.cjs} +319 -217
- package/dist/shared/uniwind.CFAAUZ2t.mjs +3 -0
- package/dist/shared/uniwind.DJ5M1Q4q.cjs +5 -0
- package/dist/shared/{uniwind.BGiqYvxb.mjs → uniwind.DgC4MT51.mjs} +312 -214
- package/dist/vite/index.cjs +82 -59
- package/dist/vite/index.mjs +80 -58
- package/package.json +37 -21
- package/src/{metro → bundler/adapters/metro}/index.d.ts +2 -0
- package/src/bundler/adapters/metro/index.ts +1 -0
- package/src/bundler/adapters/metro/metro.ts +67 -0
- package/src/{metro/metro-css-patches.ts → bundler/adapters/metro/patches.ts} +3 -2
- package/src/{metro → bundler/adapters/metro}/resolvers.ts +8 -8
- package/src/bundler/adapters/metro/transformer.ts +85 -0
- package/src/bundler/adapters/vite/vite.ts +148 -0
- 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 +7 -2
- package/src/{utils/buildDtsFile.ts → bundler/artifacts/dts.ts} +3 -4
- package/src/bundler/cli/index.ts +105 -0
- package/src/bundler/config.ts +94 -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 +36 -17
- package/src/{metro/processor → bundler/css-processor}/animation.ts +4 -4
- package/src/{metro/processor → bundler/css-processor}/color.ts +5 -4
- package/src/{metro/processor → bundler/css-processor}/css.ts +19 -11
- 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 +20 -18
- package/src/{metro/processor → bundler/css-processor}/rn.ts +96 -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 +2 -2
- package/src/{metro/utils/common.ts → bundler/css-processor/utils.ts} +2 -5
- package/src/{metro/processor → bundler/css-processor}/var.ts +2 -2
- package/src/{css-visitor → bundler/css-visitor}/function-visitor.ts +1 -1
- package/src/{css-visitor → bundler/css-visitor}/rule-visitor.ts +8 -7
- package/src/{css-visitor → bundler/css-visitor}/visitor.ts +4 -3
- package/src/{metro → bundler}/logger.ts +4 -0
- 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/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 +11 -9
- package/src/core/config/config.native.ts +4 -8
- package/src/core/config/config.ts +2 -2
- package/src/core/listener.ts +1 -1
- package/src/core/native/native-utils.ts +0 -9
- package/src/core/native/parsers/textShadow.ts +6 -18
- package/src/core/native/parsers/transforms.ts +1 -5
- package/src/core/native/runtime.ts +6 -1
- package/src/core/native/store.ts +26 -69
- package/src/core/types.ts +13 -7
- 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 +6 -3
- package/src/hooks/useCSSVariable/useCSSVariable.ts +8 -2
- 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/metro/withUniwindConfig.ts +0 -61
- package/src/types.ts +0 -23
- package/src/utils/stringifyThemes.ts +0 -1
- package/src/vite/index.d.ts +0 -9
- package/src/vite/vite.ts +0 -113
- /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/{css-visitor → bundler/css-visitor}/index.ts +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Logger = void 0;
|
|
7
|
+
const red = "\x1B[91m";
|
|
8
|
+
const yellow = "\x1B[33m";
|
|
9
|
+
const blue = "\x1B[36m";
|
|
10
|
+
const reset = "\x1B[0m";
|
|
11
|
+
class Logger {
|
|
12
|
+
constructor(name) {
|
|
13
|
+
this.name = name;
|
|
14
|
+
}
|
|
15
|
+
static debug = false;
|
|
16
|
+
static log(message, meta = "") {
|
|
17
|
+
if (!Logger.debug) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
console.log(`${blue}Uniwind ${meta}- ${message}${reset}`);
|
|
21
|
+
}
|
|
22
|
+
static info(message) {
|
|
23
|
+
console.log(`${blue}[Uniwind] ${message}${reset}`);
|
|
24
|
+
}
|
|
25
|
+
static error(message, meta = "") {
|
|
26
|
+
console.log(`${red}Uniwind Error ${meta}- ${message}${reset}`);
|
|
27
|
+
}
|
|
28
|
+
static warn(message, meta = "") {
|
|
29
|
+
if (!Logger.debug) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.log(`${yellow}Uniwind Warning ${meta}- ${message}${reset}`);
|
|
33
|
+
}
|
|
34
|
+
log(message) {
|
|
35
|
+
Logger.log(message, `[${this.name} Processor] `);
|
|
36
|
+
}
|
|
37
|
+
error(message) {
|
|
38
|
+
Logger.error(message, `[${this.name} Processor] `);
|
|
39
|
+
}
|
|
40
|
+
warn(message) {
|
|
41
|
+
Logger.warn(message, `[${this.name} Processor] `);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Logger = Logger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.UNIWIND_THEME_VARIABLES = exports.UNIWIND_PLATFORM_VARIABLES = exports.Platform = void 0;
|
|
6
|
+
exports.UNIWIND_THEME_VARIABLES = exports.UNIWIND_PLATFORM_VARIABLES = exports.StyleDependency = exports.Platform = exports.Orientation = exports.DEFAULT_SCREEN_WIDTH = exports.DEFAULT_SCREEN_HEIGHT = exports.ColorScheme = void 0;
|
|
7
7
|
var Platform = exports.Platform = /* @__PURE__ */(Platform2 => {
|
|
8
8
|
Platform2["Android"] = "android";
|
|
9
9
|
Platform2["iOS"] = "ios";
|
|
@@ -15,4 +15,28 @@ var Platform = exports.Platform = /* @__PURE__ */(Platform2 => {
|
|
|
15
15
|
return Platform2;
|
|
16
16
|
})(Platform || {});
|
|
17
17
|
const UNIWIND_PLATFORM_VARIABLES = exports.UNIWIND_PLATFORM_VARIABLES = "__uniwind-platform-";
|
|
18
|
-
const UNIWIND_THEME_VARIABLES = exports.UNIWIND_THEME_VARIABLES = "__uniwind-theme-";
|
|
18
|
+
const UNIWIND_THEME_VARIABLES = exports.UNIWIND_THEME_VARIABLES = "__uniwind-theme-";
|
|
19
|
+
var StyleDependency = exports.StyleDependency = /* @__PURE__ */(StyleDependency2 => {
|
|
20
|
+
StyleDependency2[StyleDependency2["ColorScheme"] = 1] = "ColorScheme";
|
|
21
|
+
StyleDependency2[StyleDependency2["Theme"] = 2] = "Theme";
|
|
22
|
+
StyleDependency2[StyleDependency2["Dimensions"] = 3] = "Dimensions";
|
|
23
|
+
StyleDependency2[StyleDependency2["Orientation"] = 4] = "Orientation";
|
|
24
|
+
StyleDependency2[StyleDependency2["Insets"] = 5] = "Insets";
|
|
25
|
+
StyleDependency2[StyleDependency2["FontScale"] = 6] = "FontScale";
|
|
26
|
+
StyleDependency2[StyleDependency2["Rtl"] = 7] = "Rtl";
|
|
27
|
+
StyleDependency2[StyleDependency2["AdaptiveThemes"] = 8] = "AdaptiveThemes";
|
|
28
|
+
StyleDependency2[StyleDependency2["Variables"] = 9] = "Variables";
|
|
29
|
+
return StyleDependency2;
|
|
30
|
+
})(StyleDependency || {});
|
|
31
|
+
var Orientation = exports.Orientation = /* @__PURE__ */(Orientation2 => {
|
|
32
|
+
Orientation2["Portrait"] = "portrait";
|
|
33
|
+
Orientation2["Landscape"] = "landscape";
|
|
34
|
+
return Orientation2;
|
|
35
|
+
})(Orientation || {});
|
|
36
|
+
var ColorScheme = exports.ColorScheme = /* @__PURE__ */(ColorScheme2 => {
|
|
37
|
+
ColorScheme2["Light"] = "light";
|
|
38
|
+
ColorScheme2["Dark"] = "dark";
|
|
39
|
+
return ColorScheme2;
|
|
40
|
+
})(ColorScheme || {});
|
|
41
|
+
const DEFAULT_SCREEN_WIDTH = exports.DEFAULT_SCREEN_WIDTH = 375;
|
|
42
|
+
const DEFAULT_SCREEN_HEIGHT = exports.DEFAULT_SCREEN_HEIGHT = 680;
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.toRNWClassName = void 0;
|
|
7
|
+
var _consts = require("../../common/consts");
|
|
7
8
|
var _core = require("../../core");
|
|
8
9
|
var _listener = require("../../core/listener");
|
|
9
|
-
var _types = require("../../types");
|
|
10
10
|
require("./metro-injected");
|
|
11
11
|
const addClassNameToRoot = () => {
|
|
12
12
|
if (typeof document === "undefined") {
|
|
@@ -18,7 +18,7 @@ const addClassNameToRoot = () => {
|
|
|
18
18
|
};
|
|
19
19
|
_listener.UniwindListener.subscribe(() => {
|
|
20
20
|
addClassNameToRoot();
|
|
21
|
-
}, [
|
|
21
|
+
}, [_consts.StyleDependency.Theme]);
|
|
22
22
|
addClassNameToRoot();
|
|
23
23
|
const toRNWClassName = className => className !== void 0 ? {
|
|
24
24
|
$$css: true,
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.UniwindConfigBuilder = exports.Uniwind = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var
|
|
9
|
+
var _consts = require("../../common/consts");
|
|
10
|
+
var _hoc = require("../../hoc");
|
|
10
11
|
var _useCSSVariable = require("../../hooks/useCSSVariable/useCSSVariable");
|
|
11
|
-
var _types = require("../../types");
|
|
12
12
|
var _listener = require("../listener");
|
|
13
13
|
const SYSTEM_THEME = "system";
|
|
14
14
|
const RN_VERSION = _reactNative.Platform.constants?.reactNativeVersion?.minor ?? 0;
|
|
@@ -19,12 +19,12 @@ class UniwindConfigBuilder {
|
|
|
19
19
|
#currentTheme = this.colorScheme;
|
|
20
20
|
constructor() {
|
|
21
21
|
_reactNative.Appearance.addChangeListener(event => {
|
|
22
|
-
const colorScheme = event.colorScheme === "unspecified" ?
|
|
22
|
+
const colorScheme = event.colorScheme === "unspecified" ? _consts.ColorScheme.Light : event.colorScheme ?? _consts.ColorScheme.Light;
|
|
23
23
|
const prevTheme = this.#currentTheme;
|
|
24
24
|
if (this.#hasAdaptiveThemes && prevTheme !== colorScheme) {
|
|
25
25
|
this.#currentTheme = colorScheme;
|
|
26
26
|
this.onThemeChange();
|
|
27
|
-
_listener.UniwindListener.notify([
|
|
27
|
+
_listener.UniwindListener.notify([_consts.StyleDependency.Theme]);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -40,15 +40,15 @@ class UniwindConfigBuilder {
|
|
|
40
40
|
get colorScheme() {
|
|
41
41
|
const colorScheme = _reactNative.Appearance.getColorScheme();
|
|
42
42
|
if (colorScheme === "unspecified") {
|
|
43
|
-
return
|
|
43
|
+
return _consts.ColorScheme.Light;
|
|
44
44
|
}
|
|
45
|
-
return colorScheme ??
|
|
45
|
+
return colorScheme ?? _consts.ColorScheme.Light;
|
|
46
46
|
}
|
|
47
47
|
Wrapper({
|
|
48
48
|
as,
|
|
49
49
|
...props
|
|
50
50
|
}) {
|
|
51
|
-
const StyledComponent = (0, _react.useMemo)(() => (0,
|
|
51
|
+
const StyledComponent = (0, _react.useMemo)(() => (0, _hoc.withUniwind)(as), [as]);
|
|
52
52
|
return (0, _react.createElement)(StyledComponent, props);
|
|
53
53
|
}
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
@@ -78,10 +78,10 @@ class UniwindConfigBuilder {
|
|
|
78
78
|
} finally {
|
|
79
79
|
if (prevTheme !== this.#currentTheme) {
|
|
80
80
|
this.onThemeChange();
|
|
81
|
-
_listener.UniwindListener.notify([
|
|
81
|
+
_listener.UniwindListener.notify([_consts.StyleDependency.Theme]);
|
|
82
82
|
}
|
|
83
83
|
if (prevHasAdaptiveThemes !== this.#hasAdaptiveThemes) {
|
|
84
|
-
_listener.UniwindListener.notify([
|
|
84
|
+
_listener.UniwindListener.notify([_consts.StyleDependency.AdaptiveThemes]);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Uniwind = void 0;
|
|
7
|
+
var _consts = require("../../common/consts");
|
|
7
8
|
var _utils = require("../../common/utils");
|
|
8
|
-
var _types = require("../../types");
|
|
9
9
|
var _listener = require("../listener");
|
|
10
10
|
var _logger = require("../logger");
|
|
11
11
|
var _web = require("../web");
|
|
@@ -35,7 +35,7 @@ class UniwindConfigBuilder extends _config.UniwindConfigBuilder {
|
|
|
35
35
|
rule.style.setProperty(varName, existingRules[rule.theme] ?? null);
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
|
-
_listener.UniwindListener.notify([
|
|
38
|
+
_listener.UniwindListener.notify([_consts.StyleDependency.Variables]);
|
|
39
39
|
}
|
|
40
40
|
__reinit(generateStyleSheetCallback, themes) {
|
|
41
41
|
const oldThemes = this.themes;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Uniwind = void 0;
|
|
7
7
|
var _culori = require("culori");
|
|
8
|
-
var
|
|
8
|
+
var _consts = require("../../common/consts");
|
|
9
9
|
var _listener = require("../listener");
|
|
10
10
|
var _logger = require("../logger");
|
|
11
11
|
var _native = require("../native");
|
|
@@ -31,20 +31,16 @@ class UniwindConfigBuilder extends _config.UniwindConfigBuilder {
|
|
|
31
31
|
return varValue;
|
|
32
32
|
};
|
|
33
33
|
_native.UniwindStore.vars[theme] ??= {};
|
|
34
|
-
|
|
35
|
-
configurable: true,
|
|
36
|
-
enumerable: true,
|
|
37
|
-
get: getValue
|
|
38
|
-
});
|
|
34
|
+
_native.UniwindStore.vars[theme][varName] = getValue;
|
|
39
35
|
});
|
|
40
|
-
_listener.UniwindListener.notify([
|
|
36
|
+
_listener.UniwindListener.notify([_consts.StyleDependency.Variables]);
|
|
41
37
|
}
|
|
42
38
|
updateInsets(insets) {
|
|
43
39
|
_native.UniwindStore.runtime.insets.bottom = insets.bottom ?? 0;
|
|
44
40
|
_native.UniwindStore.runtime.insets.top = insets.top ?? 0;
|
|
45
41
|
_native.UniwindStore.runtime.insets.left = insets.left ?? 0;
|
|
46
42
|
_native.UniwindStore.runtime.insets.right = insets.right ?? 0;
|
|
47
|
-
_listener.UniwindListener.notify([
|
|
43
|
+
_listener.UniwindListener.notify([_consts.StyleDependency.Insets]);
|
|
48
44
|
}
|
|
49
45
|
__reinit(generateStyleSheetCallback, themes) {
|
|
50
46
|
super.__reinit(generateStyleSheetCallback, themes);
|
|
@@ -4,18 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.UniwindListener = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _consts = require("../common/consts");
|
|
8
8
|
class UniwindListenerBuilder {
|
|
9
9
|
listeners = {
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
10
|
+
[_consts.StyleDependency.ColorScheme]: /* @__PURE__ */new Set(),
|
|
11
|
+
[_consts.StyleDependency.Theme]: /* @__PURE__ */new Set(),
|
|
12
|
+
[_consts.StyleDependency.Dimensions]: /* @__PURE__ */new Set(),
|
|
13
|
+
[_consts.StyleDependency.Orientation]: /* @__PURE__ */new Set(),
|
|
14
|
+
[_consts.StyleDependency.Insets]: /* @__PURE__ */new Set(),
|
|
15
|
+
[_consts.StyleDependency.FontScale]: /* @__PURE__ */new Set(),
|
|
16
|
+
[_consts.StyleDependency.Rtl]: /* @__PURE__ */new Set(),
|
|
17
|
+
[_consts.StyleDependency.AdaptiveThemes]: /* @__PURE__ */new Set(),
|
|
18
|
+
[_consts.StyleDependency.Variables]: /* @__PURE__ */new Set()
|
|
19
19
|
};
|
|
20
20
|
notify(dependencies) {
|
|
21
21
|
dependencies.forEach(dep => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.colorMix =
|
|
6
|
+
exports.colorMix = void 0;
|
|
7
7
|
exports.lightDark = lightDark;
|
|
8
8
|
exports.parseColor = void 0;
|
|
9
9
|
var _culori = require("culori");
|
|
@@ -28,13 +28,6 @@ function lightDark(light, dark) {
|
|
|
28
28
|
}
|
|
29
29
|
return light;
|
|
30
30
|
}
|
|
31
|
-
const cloneWithAccessors = obj => {
|
|
32
|
-
const proto = Object.getPrototypeOf(obj);
|
|
33
|
-
const clone = Object.create(proto);
|
|
34
|
-
Object.defineProperties(clone, Object.getOwnPropertyDescriptors(obj));
|
|
35
|
-
return clone;
|
|
36
|
-
};
|
|
37
|
-
exports.cloneWithAccessors = cloneWithAccessors;
|
|
38
31
|
const parseColor = (type, color) => {
|
|
39
32
|
try {
|
|
40
33
|
const parsedColor = (0, _culori.parse)(`${type}(${color})`);
|
|
@@ -13,27 +13,15 @@ const parseTextShadowMutation = styles => {
|
|
|
13
13
|
const offsets = tokens.filter(token => token !== color);
|
|
14
14
|
const [offsetX, offsetY, radius] = offsets;
|
|
15
15
|
if (offsetX !== void 0 && offsetY !== void 0) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
width: Number(offsetX),
|
|
21
|
-
height: Number(offsetY)
|
|
22
|
-
}
|
|
23
|
-
});
|
|
16
|
+
styles.textShadowOffset = {
|
|
17
|
+
width: Number(offsetX),
|
|
18
|
+
height: Number(offsetY)
|
|
19
|
+
};
|
|
24
20
|
delete styles.textShadow;
|
|
25
21
|
}
|
|
26
22
|
if (radius !== void 0) {
|
|
27
|
-
|
|
28
|
-
configurable: true,
|
|
29
|
-
enumerable: true,
|
|
30
|
-
value: Number(radius)
|
|
31
|
-
});
|
|
23
|
+
styles.textShadowRadius = Number(radius);
|
|
32
24
|
}
|
|
33
|
-
|
|
34
|
-
configurable: true,
|
|
35
|
-
enumerable: true,
|
|
36
|
-
value: color
|
|
37
|
-
});
|
|
25
|
+
styles.textShadowColor = color;
|
|
38
26
|
};
|
|
39
27
|
exports.parseTextShadowMutation = parseTextShadowMutation;
|
|
@@ -37,11 +37,7 @@ const parseTransformsMutation = (styles, preserve = false) => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (transformsResult.length > 0) {
|
|
40
|
-
|
|
41
|
-
configurable: true,
|
|
42
|
-
enumerable: true,
|
|
43
|
-
value: transformsResult
|
|
44
|
-
});
|
|
40
|
+
styles.transform = transformsResult;
|
|
45
41
|
}
|
|
46
42
|
};
|
|
47
43
|
exports.parseTransformsMutation = parseTransformsMutation;
|
|
@@ -7,10 +7,10 @@ exports.UniwindRuntime = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
9
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
10
|
-
var
|
|
10
|
+
var _consts = require("../../common/consts");
|
|
11
11
|
var _nativeUtils = require("./native-utils");
|
|
12
12
|
const window = _reactNative.Dimensions.get("window");
|
|
13
|
-
const initialColorScheme = _reactNative.Appearance.getColorScheme() ??
|
|
13
|
+
const initialColorScheme = _reactNative.Appearance.getColorScheme() ?? _consts.ColorScheme.Light;
|
|
14
14
|
const UniwindRuntime = exports.UniwindRuntime = {
|
|
15
15
|
screen: {
|
|
16
16
|
width: window.width,
|
|
@@ -18,7 +18,7 @@ const UniwindRuntime = exports.UniwindRuntime = {
|
|
|
18
18
|
},
|
|
19
19
|
colorScheme: initialColorScheme,
|
|
20
20
|
currentThemeName: initialColorScheme,
|
|
21
|
-
orientation: window.width > window.height ?
|
|
21
|
+
orientation: window.width > window.height ? _consts.Orientation.Landscape : _consts.Orientation.Portrait,
|
|
22
22
|
fontScale: value => value * _reactNative.PixelRatio.getFontScale(),
|
|
23
23
|
hairlineWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
24
24
|
rtl: _reactNative.I18nManager.isRTL,
|
|
@@ -44,6 +44,10 @@ const UniwindRuntime = exports.UniwindRuntime = {
|
|
|
44
44
|
android,
|
|
45
45
|
default: ios
|
|
46
46
|
});
|
|
47
|
+
},
|
|
48
|
+
makeResponsive(value, base = _consts.DEFAULT_SCREEN_WIDTH, useHeight = false) {
|
|
49
|
+
const dimension = useHeight ? this.screen.height : this.screen.width;
|
|
50
|
+
return Math.round(value * dimension / base);
|
|
47
51
|
}
|
|
48
52
|
};
|
|
49
53
|
UniwindRuntime.lightDark = _nativeUtils.lightDark.bind(UniwindRuntime);
|
|
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.UniwindStore = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _consts = require("../../common/consts");
|
|
9
|
-
var _types = require("../../types");
|
|
10
9
|
var _listener = require("../listener");
|
|
11
|
-
var _nativeUtils = require("./native-utils");
|
|
12
10
|
var _parsers = require("./parsers");
|
|
13
11
|
var _runtime = require("./runtime");
|
|
14
12
|
const emptyState = {
|
|
@@ -52,18 +50,18 @@ class UniwindStoreBuilder {
|
|
|
52
50
|
const commonPlatformVars = scopedVars[`${_consts.UNIWIND_PLATFORM_VARIABLES}${commonPlatform}`];
|
|
53
51
|
const platformVars = scopedVars[`${_consts.UNIWIND_PLATFORM_VARIABLES}${platform}`];
|
|
54
52
|
if (commonPlatformVars) {
|
|
55
|
-
Object.
|
|
53
|
+
Object.assign(vars, commonPlatformVars);
|
|
56
54
|
}
|
|
57
55
|
if (platformVars) {
|
|
58
|
-
Object.
|
|
56
|
+
Object.assign(vars, platformVars);
|
|
59
57
|
}
|
|
60
58
|
this.keyframes = keyframes;
|
|
61
59
|
this.stylesheet = stylesheet;
|
|
62
60
|
this.vars = Object.fromEntries(themes.map(theme => {
|
|
63
|
-
const clonedVars =
|
|
61
|
+
const clonedVars = Object.create(vars);
|
|
64
62
|
const themeVars = scopedVars[`${_consts.UNIWIND_THEME_VARIABLES}${theme}`];
|
|
65
63
|
if (themeVars) {
|
|
66
|
-
Object.
|
|
64
|
+
Object.assign(clonedVars, themeVars);
|
|
67
65
|
}
|
|
68
66
|
return [theme, clonedVars];
|
|
69
67
|
}));
|
|
@@ -73,7 +71,7 @@ class UniwindStoreBuilder {
|
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
73
|
resolveStyles(classNames, componentProps, state, uniwindContext) {
|
|
76
|
-
const
|
|
74
|
+
const resultGetters = {};
|
|
77
75
|
const theme = uniwindContext.scopedTheme ?? this.runtime.currentThemeName;
|
|
78
76
|
let vars = this.vars[theme];
|
|
79
77
|
const originalVars = vars;
|
|
@@ -89,7 +87,7 @@ class UniwindStoreBuilder {
|
|
|
89
87
|
for (const style of this.stylesheet[className]) {
|
|
90
88
|
if (style.dependencies) {
|
|
91
89
|
style.dependencies.forEach(dep => {
|
|
92
|
-
if (dep ===
|
|
90
|
+
if (dep === _consts.StyleDependency.Theme && isScopedTheme) {
|
|
93
91
|
return;
|
|
94
92
|
}
|
|
95
93
|
dependencies.add(dep);
|
|
@@ -109,95 +107,50 @@ class UniwindStoreBuilder {
|
|
|
109
107
|
}
|
|
110
108
|
if (property[0] === "-") {
|
|
111
109
|
if (vars === originalVars) {
|
|
112
|
-
vars =
|
|
110
|
+
vars = Object.create(originalVars);
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
configurable: true,
|
|
116
|
-
enumerable: true,
|
|
117
|
-
get: valueGetter
|
|
118
|
-
});
|
|
112
|
+
vars[property] = valueGetter;
|
|
119
113
|
} else {
|
|
120
|
-
|
|
121
|
-
configurable: true,
|
|
122
|
-
enumerable: true,
|
|
123
|
-
get: () => valueGetter.call(vars)
|
|
124
|
-
});
|
|
114
|
+
resultGetters[property] = valueGetter;
|
|
125
115
|
}
|
|
126
116
|
bestBreakpoints.set(property, style);
|
|
127
117
|
}
|
|
128
118
|
}
|
|
129
119
|
}
|
|
120
|
+
const result = Object.fromEntries(Object.entries(resultGetters).map(([property, valueGetter]) => [property, valueGetter(vars)]));
|
|
130
121
|
if (result.lineHeight !== void 0 && result.lineHeight < 6) {
|
|
131
|
-
|
|
132
|
-
value: result.fontSize * result.lineHeight,
|
|
133
|
-
configurable: true,
|
|
134
|
-
enumerable: true
|
|
135
|
-
});
|
|
122
|
+
result.lineHeight *= result.fontSize;
|
|
136
123
|
}
|
|
137
124
|
if (result.boxShadow !== void 0) {
|
|
138
|
-
|
|
139
|
-
value: (0, _parsers.parseBoxShadow)(result.boxShadow),
|
|
140
|
-
configurable: true,
|
|
141
|
-
enumerable: true
|
|
142
|
-
});
|
|
125
|
+
result.boxShadow = (0, _parsers.parseBoxShadow)(result.boxShadow);
|
|
143
126
|
}
|
|
144
127
|
if (result.visibility === "hidden") {
|
|
145
|
-
|
|
146
|
-
value: "none",
|
|
147
|
-
configurable: true,
|
|
148
|
-
enumerable: true
|
|
149
|
-
});
|
|
128
|
+
result.display = "none";
|
|
150
129
|
}
|
|
151
130
|
if (result.borderStyle !== void 0 && result.borderColor === void 0) {
|
|
152
|
-
|
|
153
|
-
value: "#000000",
|
|
154
|
-
configurable: true,
|
|
155
|
-
enumerable: true
|
|
156
|
-
});
|
|
131
|
+
result.borderColor = "#000000";
|
|
157
132
|
}
|
|
158
133
|
if (result.outlineStyle !== void 0 && result.outlineColor === void 0) {
|
|
159
|
-
|
|
160
|
-
value: "#000000",
|
|
161
|
-
configurable: true,
|
|
162
|
-
enumerable: true
|
|
163
|
-
});
|
|
134
|
+
result.outlineColor = "#000000";
|
|
164
135
|
}
|
|
165
136
|
if (result.fontVariant !== void 0) {
|
|
166
|
-
|
|
167
|
-
value: (0, _parsers.parseFontVariant)(result.fontVariant),
|
|
168
|
-
configurable: true,
|
|
169
|
-
enumerable: true
|
|
170
|
-
});
|
|
137
|
+
result.fontVariant = (0, _parsers.parseFontVariant)(result.fontVariant);
|
|
171
138
|
}
|
|
172
139
|
(0, _parsers.parseTransformsMutation)(result);
|
|
173
140
|
(0, _parsers.parseTransitionsMutation)(result);
|
|
174
141
|
if (typeof result.animationName === "string") {
|
|
175
|
-
|
|
176
|
-
value: this.keyframes[result.animationName] ?? [],
|
|
177
|
-
configurable: true,
|
|
178
|
-
enumerable: true
|
|
179
|
-
});
|
|
142
|
+
result.animationName = this.keyframes[result.animationName] ?? [];
|
|
180
143
|
} else if (Array.isArray(result.animationName)) {
|
|
181
|
-
|
|
182
|
-
value: result.animationName.map(animationName => this.keyframes[animationName] ?? void 0).filter(Boolean),
|
|
183
|
-
configurable: true,
|
|
184
|
-
enumerable: true
|
|
185
|
-
});
|
|
144
|
+
result.animationName = result.animationName.map(animationName => this.keyframes[animationName] ?? void 0).filter(Boolean);
|
|
186
145
|
}
|
|
187
146
|
if (result.experimental_backgroundImage !== void 0) {
|
|
188
|
-
|
|
189
|
-
value: (0, _parsers.resolveGradient)(result.experimental_backgroundImage),
|
|
190
|
-
configurable: true,
|
|
191
|
-
enumerable: true
|
|
192
|
-
});
|
|
147
|
+
result.experimental_backgroundImage = (0, _parsers.resolveGradient)(result.experimental_backgroundImage);
|
|
193
148
|
}
|
|
194
149
|
if (result.textShadow !== void 0) {
|
|
195
150
|
(0, _parsers.parseTextShadowMutation)(result);
|
|
196
151
|
}
|
|
197
152
|
return {
|
|
198
|
-
styles:
|
|
199
|
-
...result
|
|
200
|
-
},
|
|
153
|
+
styles: result,
|
|
201
154
|
dependencies: Array.from(dependencies),
|
|
202
155
|
dependencySum,
|
|
203
156
|
hasDataAttributes
|
|
@@ -239,12 +192,12 @@ const UniwindStore = exports.UniwindStore = new UniwindStoreBuilder();
|
|
|
239
192
|
_reactNative.Dimensions.addEventListener("change", ({
|
|
240
193
|
window
|
|
241
194
|
}) => {
|
|
242
|
-
const newOrientation = window.width > window.height ?
|
|
195
|
+
const newOrientation = window.width > window.height ? _consts.Orientation.Landscape : _consts.Orientation.Portrait;
|
|
243
196
|
const orientationChanged = UniwindStore.runtime.orientation !== newOrientation;
|
|
244
197
|
UniwindStore.runtime.screen = {
|
|
245
198
|
width: window.width,
|
|
246
199
|
height: window.height
|
|
247
200
|
};
|
|
248
201
|
UniwindStore.runtime.orientation = newOrientation;
|
|
249
|
-
_listener.UniwindListener.notify([...(orientationChanged ? [
|
|
202
|
+
_listener.UniwindListener.notify([...(orientationChanged ? [_consts.StyleDependency.Orientation] : []), _consts.StyleDependency.Dimensions]);
|
|
250
203
|
});
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CSSListener = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _consts = require("../../common/consts");
|
|
8
8
|
var _listener = require("../listener");
|
|
9
9
|
class CSSListenerBuilder {
|
|
10
10
|
activeRules = /* @__PURE__ */new Set();
|
|
@@ -54,7 +54,7 @@ class CSSListenerBuilder {
|
|
|
54
54
|
listeners?.add(listener);
|
|
55
55
|
disposables.push(() => listeners?.delete(listener));
|
|
56
56
|
});
|
|
57
|
-
const disposeThemeListener = _listener.UniwindListener.subscribe(listener, [
|
|
57
|
+
const disposeThemeListener = _listener.UniwindListener.subscribe(listener, [_consts.StyleDependency.Theme, _consts.StyleDependency.Variables]);
|
|
58
58
|
return () => {
|
|
59
59
|
disposables.forEach(disposable => disposable());
|
|
60
60
|
disposeThemeListener();
|
|
@@ -13,9 +13,9 @@ var _logger = require("../core/logger");
|
|
|
13
13
|
var _web = require("../core/web");
|
|
14
14
|
var _withUniwindUtils = require("./withUniwindUtils");
|
|
15
15
|
let warnedOnce = false;
|
|
16
|
-
const withUniwind = (
|
|
16
|
+
const withUniwind = (Component, options) => options ? withManualUniwind(Component, options) : withAutoUniwind(Component);
|
|
17
17
|
exports.withUniwind = withUniwind;
|
|
18
|
-
const withAutoUniwind =
|
|
18
|
+
const withAutoUniwind = Component => props => {
|
|
19
19
|
const uniwindContext = (0, _context.useUniwindContext)();
|
|
20
20
|
const {
|
|
21
21
|
classNames,
|
|
@@ -60,13 +60,13 @@ const withAutoUniwind = Component2 => props => {
|
|
|
60
60
|
const dispose = _web.CSSListener.subscribeToClassName(classNames, rerender);
|
|
61
61
|
return dispose;
|
|
62
62
|
}, [classNames]);
|
|
63
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(
|
|
63
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component, {
|
|
64
64
|
...props,
|
|
65
65
|
...generatedProps,
|
|
66
66
|
dataSet: (0, _generateDataSet.generateDataSet)(props)
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
const withManualUniwind = (
|
|
69
|
+
const withManualUniwind = (Component, options) => props => {
|
|
70
70
|
const uniwindContext = (0, _context.useUniwindContext)();
|
|
71
71
|
const {
|
|
72
72
|
generatedProps,
|
|
@@ -100,7 +100,7 @@ const withManualUniwind = (Component2, options) => props => {
|
|
|
100
100
|
const dispose = _web.CSSListener.subscribeToClassName(classNames, rerender);
|
|
101
101
|
return dispose;
|
|
102
102
|
}, [classNames]);
|
|
103
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(
|
|
103
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component, {
|
|
104
104
|
...props,
|
|
105
105
|
...generatedProps,
|
|
106
106
|
dataSet: (0, _generateDataSet.generateDataSet)(props)
|
|
@@ -13,9 +13,9 @@ var _logger = require("../core/logger");
|
|
|
13
13
|
var _native = require("../core/native");
|
|
14
14
|
var _withUniwindUtils = require("./withUniwindUtils");
|
|
15
15
|
let warnedOnce = false;
|
|
16
|
-
const withUniwind = (
|
|
16
|
+
const withUniwind = (Component, options) => options ? withManualUniwind(Component, options) : withAutoUniwind(Component);
|
|
17
17
|
exports.withUniwind = withUniwind;
|
|
18
|
-
const withAutoUniwind =
|
|
18
|
+
const withAutoUniwind = Component => props => {
|
|
19
19
|
const uniwindContext = (0, _context.useUniwindContext)();
|
|
20
20
|
const {
|
|
21
21
|
dependencies,
|
|
@@ -68,12 +68,12 @@ const withAutoUniwind = Component2 => props => {
|
|
|
68
68
|
const dispose = _listener.UniwindListener.subscribe(rerender, Array.from(new Set(dependencies)));
|
|
69
69
|
return dispose;
|
|
70
70
|
}, [dependencySum]);
|
|
71
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(
|
|
71
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component, {
|
|
72
72
|
...props,
|
|
73
73
|
...generatedProps
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
-
const withManualUniwind = (
|
|
76
|
+
const withManualUniwind = (Component, options) => props => {
|
|
77
77
|
const uniwindContext = (0, _context.useUniwindContext)();
|
|
78
78
|
const {
|
|
79
79
|
generatedProps,
|
|
@@ -124,7 +124,7 @@ const withManualUniwind = (Component2, options) => props => {
|
|
|
124
124
|
const dispose = _listener.UniwindListener.subscribe(rerender, Array.from(new Set(dependencies)));
|
|
125
125
|
return dispose;
|
|
126
126
|
}, [dependencySum]);
|
|
127
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(
|
|
127
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Component, {
|
|
128
128
|
...props,
|
|
129
129
|
...generatedProps
|
|
130
130
|
});
|
|
@@ -5,5 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getVariableValue = void 0;
|
|
7
7
|
var _native = require("../../core/native");
|
|
8
|
-
const getVariableValue = (name, uniwindContext) =>
|
|
8
|
+
const getVariableValue = (name, uniwindContext) => {
|
|
9
|
+
const vars = _native.UniwindStore.vars[uniwindContext.scopedTheme ?? _native.UniwindRuntime.currentThemeName];
|
|
10
|
+
return vars?.[name]?.(vars);
|
|
11
|
+
};
|
|
9
12
|
exports.getVariableValue = getVariableValue;
|