react-native-unistyles 3.0.0-beta.4 → 3.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/android/src/main/cxx/NativeUnistylesModule.cpp +2 -2
- package/android/src/main/cxx/NativeUnistylesModule.h +1 -1
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +1 -2
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +4 -0
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +2 -1
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +0 -4
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +6 -6
- package/components/native/ActivityIndicator/package.json +2 -1
- package/components/native/Animated/package.json +5 -0
- package/components/native/FlatList/package.json +2 -1
- package/components/native/Image/package.json +2 -1
- package/components/native/ImageBackground/package.json +2 -1
- package/components/native/KeyboardAvoidingView/package.json +2 -1
- package/components/native/NativeText/package.json +5 -0
- package/components/native/NativeView/package.json +5 -0
- package/components/native/Pressable/package.json +1 -1
- package/components/native/RefreshControl/package.json +2 -1
- package/components/native/ScrollView/package.json +2 -1
- package/components/native/SectionList/package.json +2 -1
- package/components/native/Switch/package.json +2 -1
- package/components/native/Text/package.json +2 -1
- package/components/native/TextInput/package.json +2 -1
- package/components/native/TouchableHighlight/package.json +2 -1
- package/components/native/TouchableOpacity/package.json +2 -1
- package/components/native/View/package.json +2 -1
- package/components/native/VirtualizedList/package.json +2 -1
- package/cxx/common/Constants.h +4 -4
- package/cxx/common/Helpers.h +1 -1
- package/cxx/core/HashGenerator.cpp +23 -0
- package/cxx/core/HashGenerator.h +13 -0
- package/cxx/core/HostUnistyle.cpp +83 -0
- package/cxx/core/HostUnistyle.h +27 -0
- package/cxx/core/RNStyle.h +18 -0
- package/cxx/core/Unistyle.h +13 -4
- package/cxx/core/UnistyleWrapper.h +92 -47
- package/cxx/core/UnistylesRegistry.cpp +40 -11
- package/cxx/core/UnistylesRegistry.h +5 -4
- package/cxx/hybridObjects/HybridNavigationBar.cpp +3 -3
- package/cxx/hybridObjects/HybridNavigationBar.h +2 -2
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +39 -45
- package/cxx/hybridObjects/HybridShadowRegistry.h +0 -10
- package/cxx/hybridObjects/HybridStatusBar.cpp +3 -3
- package/cxx/hybridObjects/HybridStatusBar.h +2 -2
- package/cxx/hybridObjects/HybridStyleSheet.cpp +52 -10
- package/cxx/hybridObjects/HybridStyleSheet.h +2 -1
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +15 -15
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -2
- package/cxx/parser/Parser.cpp +26 -27
- package/cxx/parser/Parser.h +2 -1
- package/ios/NativePlatform+ios.swift +21 -11
- package/ios/NativePlatform.swift +2 -2
- package/ios/UnistylesModuleOnLoad.h +4 -4
- package/ios/UnistylesModuleOnLoad.mm +5 -8
- package/lib/commonjs/components/ScopedTheme.js.map +1 -1
- package/lib/commonjs/components/index.js +0 -7
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/native/Animated.js +23 -0
- package/lib/commonjs/components/native/Animated.js.map +1 -0
- package/lib/commonjs/components/native/ImageBackground.js +47 -1
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/ImageBackground.native.js +10 -0
- package/lib/commonjs/components/native/ImageBackground.native.js.map +1 -0
- package/lib/commonjs/components/native/NativeText.js +13 -0
- package/lib/commonjs/components/native/NativeText.js.map +1 -0
- package/lib/commonjs/components/native/NativeText.native.js +18 -0
- package/lib/commonjs/components/native/NativeText.native.js.map +1 -0
- package/lib/commonjs/components/native/NativeView.js +9 -0
- package/lib/commonjs/components/native/NativeView.js.map +1 -0
- package/lib/commonjs/components/native/NativeView.native.js +20 -0
- package/lib/commonjs/components/native/NativeView.native.js.map +1 -0
- package/lib/commonjs/components/native/Pressable.js +26 -51
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +25 -9
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js +33 -5
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +54 -0
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -0
- package/lib/commonjs/core/createUnistylesImageBackground.js +41 -15
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/getClassname.js +23 -0
- package/lib/commonjs/core/getClassname.js.map +1 -0
- package/lib/commonjs/core/getClassname.native.js +9 -0
- package/lib/commonjs/core/getClassname.native.js.map +1 -0
- package/lib/commonjs/core/index.js +14 -7
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/passForwardRef.js +2 -2
- package/lib/commonjs/core/passForwardRef.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/index.js +13 -0
- package/lib/commonjs/core/useProxifiedUnistyles/index.js.map +1 -0
- package/lib/commonjs/core/useProxifiedUnistyles/listener.js +22 -0
- package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -0
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js +26 -0
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js.map +1 -0
- package/lib/commonjs/core/useProxifiedUnistyles/types.js +6 -0
- package/lib/commonjs/core/useProxifiedUnistyles/types.js.map +1 -0
- package/lib/commonjs/core/{withUnistyles/useDependencies.js → useProxifiedUnistyles/useProxifiedUnistyles.js} +22 -22
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -0
- package/lib/commonjs/core/useUnistyles.js +19 -0
- package/lib/commonjs/core/useUnistyles.js.map +1 -0
- package/lib/commonjs/core/warn.js +16 -0
- package/lib/commonjs/core/warn.js.map +1 -0
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +19 -55
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +32 -65
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/index.js +23 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/server/getServerUnistyles.js +40 -0
- package/lib/commonjs/server/getServerUnistyles.js.map +1 -0
- package/lib/commonjs/server/hydrateServerUnistyles.js +17 -0
- package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -0
- package/lib/commonjs/server/index.js +34 -0
- package/lib/commonjs/server/index.js.map +1 -0
- package/lib/commonjs/server/resetServerUnistyles.js +16 -0
- package/lib/commonjs/server/resetServerUnistyles.js.map +1 -0
- package/lib/commonjs/server/types.js +8 -0
- package/lib/commonjs/server/types.js.map +1 -0
- package/lib/commonjs/server/useServerUnistyles.js +27 -0
- package/lib/commonjs/server/useServerUnistyles.js.map +1 -0
- package/lib/commonjs/specs/ShadowRegistry/index.js +6 -3
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/utils.js +19 -2
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/convert/object/filter.js +2 -2
- package/lib/commonjs/web/convert/object/filter.js.map +1 -1
- package/lib/commonjs/web/convert/style.js +4 -4
- package/lib/commonjs/web/convert/style.js.map +1 -1
- package/lib/commonjs/web/create.js +20 -15
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/css/core.js +55 -0
- package/lib/commonjs/web/css/core.js.map +1 -0
- package/lib/commonjs/web/css/index.js +17 -0
- package/lib/commonjs/web/css/index.js.map +1 -0
- package/lib/commonjs/web/css/state.js +155 -0
- package/lib/commonjs/web/css/state.js.map +1 -0
- package/lib/commonjs/web/css/utils.js +47 -0
- package/lib/commonjs/web/css/utils.js.map +1 -0
- package/lib/commonjs/web/index.js +14 -18
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/listener.js +9 -7
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/registry.js +44 -123
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +28 -21
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/services.js +28 -0
- package/lib/commonjs/web/services.js.map +1 -0
- package/lib/commonjs/web/shadowRegistry.js +46 -93
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +39 -9
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/types.js +6 -0
- package/lib/commonjs/web/types.js.map +1 -0
- package/lib/commonjs/web/utils/common.js +29 -9
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +32 -19
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/commonjs/web/variants.js +25 -27
- package/lib/commonjs/web/variants.js.map +1 -1
- package/lib/module/components/ScopedTheme.js.map +1 -1
- package/lib/module/components/index.js +0 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/native/Animated.js +19 -0
- package/lib/module/components/native/Animated.js.map +1 -0
- package/lib/module/components/native/ImageBackground.js +47 -2
- package/lib/module/components/native/ImageBackground.js.map +1 -1
- package/lib/module/components/native/ImageBackground.native.js +6 -0
- package/lib/module/components/native/ImageBackground.native.js.map +1 -0
- package/lib/module/components/native/NativeText.js +4 -0
- package/lib/module/components/native/NativeText.js.map +1 -0
- package/lib/module/components/native/NativeText.native.js +15 -0
- package/lib/module/components/native/NativeText.native.js.map +1 -0
- package/lib/module/components/native/NativeView.js +5 -0
- package/lib/module/components/native/NativeView.js.map +1 -0
- package/lib/module/components/native/NativeView.native.js +17 -0
- package/lib/module/components/native/NativeView.native.js.map +1 -0
- package/lib/module/components/native/Pressable.js +27 -52
- package/lib/module/components/native/Pressable.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +26 -10
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js +33 -5
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +47 -0
- package/lib/module/core/createUnistylesElement.native.js.map +1 -0
- package/lib/module/core/createUnistylesImageBackground.js +39 -14
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/getClassname.js +18 -0
- package/lib/module/core/getClassname.js.map +1 -0
- package/lib/module/core/getClassname.native.js +4 -0
- package/lib/module/core/getClassname.native.js.map +1 -0
- package/lib/module/core/index.js +2 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/passForwardRef.js +2 -2
- package/lib/module/core/passForwardRef.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/index.js +4 -0
- package/lib/module/core/useProxifiedUnistyles/index.js.map +1 -0
- package/lib/module/core/useProxifiedUnistyles/listener.js +17 -0
- package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -0
- package/lib/module/core/useProxifiedUnistyles/listener.native.js +21 -0
- package/lib/module/core/useProxifiedUnistyles/listener.native.js.map +1 -0
- package/lib/module/core/useProxifiedUnistyles/types.js +4 -0
- package/lib/module/core/useProxifiedUnistyles/types.js.map +1 -0
- package/lib/module/core/{withUnistyles/useDependencies.js → useProxifiedUnistyles/useProxifiedUnistyles.js} +19 -19
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -0
- package/lib/module/core/useUnistyles.js +14 -0
- package/lib/module/core/useUnistyles.js.map +1 -0
- package/lib/module/core/warn.js +11 -0
- package/lib/module/core/warn.js.map +1 -0
- package/lib/module/core/withUnistyles/withUnistyles.js +19 -55
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +33 -66
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/server/getServerUnistyles.js +34 -0
- package/lib/module/server/getServerUnistyles.js.map +1 -0
- package/lib/module/server/hydrateServerUnistyles.js +12 -0
- package/lib/module/server/hydrateServerUnistyles.js.map +1 -0
- package/lib/module/server/index.js +7 -0
- package/lib/module/server/index.js.map +1 -0
- package/lib/module/server/resetServerUnistyles.js +11 -0
- package/lib/module/server/resetServerUnistyles.js.map +1 -0
- package/lib/module/server/types.js +4 -0
- package/lib/module/server/types.js.map +1 -0
- package/lib/module/server/useServerUnistyles.js +22 -0
- package/lib/module/server/useServerUnistyles.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/index.js +6 -3
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/utils.js +16 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/convert/object/filter.js +2 -2
- package/lib/module/web/convert/object/filter.js.map +1 -1
- package/lib/module/web/convert/style.js +4 -4
- package/lib/module/web/convert/style.js.map +1 -1
- package/lib/module/web/create.js +20 -15
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/css/core.js +50 -0
- package/lib/module/web/css/core.js.map +1 -0
- package/lib/module/web/css/index.js +4 -0
- package/lib/module/web/css/index.js.map +1 -0
- package/lib/module/web/css/state.js +150 -0
- package/lib/module/web/css/state.js.map +1 -0
- package/lib/module/web/css/utils.js +41 -0
- package/lib/module/web/css/utils.js.map +1 -0
- package/lib/module/web/index.js +10 -5
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/listener.js +8 -7
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/registry.js +44 -124
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +27 -21
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/services.js +23 -0
- package/lib/module/web/services.js.map +1 -0
- package/lib/module/web/shadowRegistry.js +46 -94
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +39 -10
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/types.js +4 -0
- package/lib/module/web/types.js.map +1 -0
- package/lib/module/web/utils/common.js +26 -7
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +31 -17
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web/variants.js +25 -27
- package/lib/module/web/variants.js.map +1 -1
- package/lib/typescript/src/components/index.d.ts +0 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts +1 -1
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Animated.d.ts +39 -0
- package/lib/typescript/src/components/native/Animated.d.ts.map +1 -0
- package/lib/typescript/src/components/native/FlatList.d.ts +1 -1
- package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Image.d.ts +1 -1
- package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.d.ts +1 -2
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.native.d.ts +2 -0
- package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +1 -1
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/NativeText.d.ts +2 -0
- package/lib/typescript/src/components/native/NativeText.d.ts.map +1 -0
- package/lib/typescript/src/components/native/NativeText.native.d.ts +2 -0
- package/lib/typescript/src/components/native/NativeText.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/NativeView.d.ts +3 -0
- package/lib/typescript/src/components/native/NativeView.d.ts.map +1 -0
- package/lib/typescript/src/components/native/NativeView.native.d.ts +3 -0
- package/lib/typescript/src/components/native/NativeView.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Pressable.d.ts +3 -2
- package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/components/native/RefreshControl.d.ts +1 -1
- package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ScrollView.d.ts +1 -1
- package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/SectionList.d.ts +1 -1
- package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Switch.d.ts +1 -1
- package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Text.d.ts +1 -1
- package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TextInput.d.ts +1 -1
- package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts +1 -1
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts +1 -1
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
- package/lib/typescript/src/components/native/View.d.ts +1 -1
- package/lib/typescript/src/components/native/View.d.ts.map +1 -1
- package/lib/typescript/src/components/native/VirtualizedList.d.ts +1 -1
- package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.d.ts +1 -2
- package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts +2 -0
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts +2 -3
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/core/getClassname.d.ts +7 -0
- package/lib/typescript/src/core/getClassname.d.ts.map +1 -0
- package/lib/typescript/src/core/getClassname.native.d.ts +2 -0
- package/lib/typescript/src/core/getClassname.native.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -1
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/index.d.ts +2 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/index.d.ts.map +1 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts +3 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts +3 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts +7 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts.map +1 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +8 -0
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/useUnistyles.d.ts +6 -0
- package/lib/typescript/src/core/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/warn.d.ts +3 -0
- package/lib/typescript/src/core/warn.d.ts.map +1 -0
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +0 -3
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/server/getServerUnistyles.d.ts +4 -0
- package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/server/hydrateServerUnistyles.d.ts +8 -0
- package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/server/index.d.ts +5 -0
- package/lib/typescript/src/server/index.d.ts.map +1 -0
- package/lib/typescript/src/server/resetServerUnistyles.d.ts +2 -0
- package/lib/typescript/src/server/resetServerUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/server/types.d.ts +5 -0
- package/lib/typescript/src/server/types.d.ts.map +1 -0
- package/lib/typescript/src/server/useServerUnistyles.d.ts +4 -0
- package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +0 -3
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +5 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +2 -0
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/css/core.d.ts +3 -0
- package/lib/typescript/src/web/css/core.d.ts.map +1 -0
- package/lib/typescript/src/web/css/index.d.ts +2 -0
- package/lib/typescript/src/web/css/index.d.ts.map +1 -0
- package/lib/typescript/src/web/css/state.d.ts +30 -0
- package/lib/typescript/src/web/css/state.d.ts.map +1 -0
- package/lib/typescript/src/web/css/utils.d.ts +4 -0
- package/lib/typescript/src/web/css/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/index.d.ts +7 -1
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts +4 -3
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +11 -8
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +6 -4
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/services.d.ts +15 -0
- package/lib/typescript/src/web/services.d.ts.map +1 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts +10 -13
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts +7 -3
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/types.d.ts +13 -0
- package/lib/typescript/src/web/types.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/common.d.ts +2 -1
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts +5 -4
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/lib/typescript/src/web/variants.d.ts +2 -2
- package/lib/typescript/src/web/variants.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JColorScheme.hpp +2 -1
- package/nitrogen/generated/android/c++/JDimensions.hpp +2 -1
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +36 -10
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +53 -19
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +5 -5
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JInsets.hpp +2 -1
- package/nitrogen/generated/android/c++/JOrientation.hpp +2 -1
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +2 -1
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/ColorScheme.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +10 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +43 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +43 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +10 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +13 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Orientation.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +19 -14
- package/nitrogen/generated/android/unistyles+autolinking.cmake +4 -1
- package/nitrogen/generated/android/unistyles+autolinking.gradle +1 -1
- package/nitrogen/generated/android/unistylesOnLoad.cpp +7 -3
- package/nitrogen/generated/android/unistylesOnLoad.hpp +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +21 -6
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +105 -27
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +5 -3
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +92 -33
- package/nitrogen/generated/ios/swift/ColorScheme.swift +1 -1
- package/nitrogen/generated/ios/swift/Dimensions.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +36 -23
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +327 -0
- package/nitrogen/generated/ios/swift/Insets.swift +1 -1
- package/nitrogen/generated/ios/swift/Orientation.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistyleDependency.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Insets.hpp +1 -1
- package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +2 -2
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -1
- package/package.json +23 -14
- package/plugin/consts.js +63 -0
- package/plugin/exotic.js +54 -0
- package/plugin/import.js +1 -21
- package/plugin/index.d.ts +89 -0
- package/plugin/index.js +58 -96
- package/plugin/stylesheet.js +28 -1
- package/plugin/variants.js +49 -75
- package/src/components/ScopedTheme.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/components/native/Animated.tsx +17 -0
- package/src/components/native/ImageBackground.native.tsx +4 -0
- package/src/components/native/ImageBackground.tsx +57 -2
- package/src/components/native/NativeText.native.tsx +12 -0
- package/src/components/native/NativeText.tsx +1 -0
- package/src/components/native/NativeView.native.tsx +13 -0
- package/src/components/native/NativeView.tsx +3 -0
- package/src/components/native/Pressable.native.tsx +32 -15
- package/src/components/native/Pressable.tsx +35 -69
- package/src/core/createUnistylesElement.native.tsx +51 -0
- package/src/core/createUnistylesElement.tsx +47 -8
- package/src/core/createUnistylesImageBackground.tsx +44 -18
- package/src/core/getClassname.native.ts +1 -0
- package/src/core/getClassname.ts +14 -0
- package/src/core/index.ts +2 -1
- package/src/core/passForwardRef.ts +1 -2
- package/src/core/useProxifiedUnistyles/index.ts +1 -0
- package/src/core/useProxifiedUnistyles/listener.native.ts +18 -0
- package/src/core/useProxifiedUnistyles/listener.ts +13 -0
- package/src/core/useProxifiedUnistyles/types.ts +7 -0
- package/src/core/{withUnistyles/useDependencies.ts → useProxifiedUnistyles/useProxifiedUnistyles.ts} +19 -26
- package/src/core/useUnistyles.ts +11 -0
- package/src/core/warn.ts +13 -0
- package/src/core/withUnistyles/withUnistyles.native.tsx +39 -68
- package/src/core/withUnistyles/withUnistyles.tsx +19 -56
- package/src/index.ts +3 -2
- package/src/server/getServerUnistyles.tsx +21 -0
- package/src/server/hydrateServerUnistyles.ts +17 -0
- package/src/server/index.ts +5 -0
- package/src/server/resetServerUnistyles.ts +9 -0
- package/src/server/types.ts +4 -0
- package/src/server/useServerUnistyles.tsx +22 -0
- package/src/specs/ShadowRegistry/index.ts +12 -9
- package/src/specs/StyleSheet/index.ts +6 -1
- package/src/utils.ts +32 -11
- package/src/web/convert/object/filter.ts +2 -2
- package/src/web/convert/style.ts +8 -7
- package/src/web/create.ts +23 -18
- package/src/web/css/core.ts +58 -0
- package/src/web/css/index.ts +1 -0
- package/src/web/css/state.ts +191 -0
- package/src/web/css/utils.ts +54 -0
- package/src/web/index.ts +18 -5
- package/src/web/listener.ts +8 -8
- package/src/web/registry.ts +47 -152
- package/src/web/runtime.ts +32 -22
- package/src/web/services.ts +28 -0
- package/src/web/shadowRegistry.ts +46 -104
- package/src/web/state.ts +46 -11
- package/src/web/types.ts +13 -0
- package/src/web/utils/common.ts +32 -8
- package/src/web/utils/unistyle.ts +46 -25
- package/src/web/variants.ts +27 -27
- package/cxx/core/HostStyle.cpp +0 -73
- package/cxx/core/HostStyle.h +0 -34
- package/lib/commonjs/components/Variants.js +0 -36
- package/lib/commonjs/components/Variants.js.map +0 -1
- package/lib/commonjs/core/createUnistylesComponent.js +0 -16
- package/lib/commonjs/core/createUnistylesComponent.js.map +0 -1
- package/lib/commonjs/core/withUnistyles/useDependencies.js.map +0 -1
- package/lib/module/components/Variants.js +0 -29
- package/lib/module/components/Variants.js.map +0 -1
- package/lib/module/core/createUnistylesComponent.js +0 -11
- package/lib/module/core/createUnistylesComponent.js.map +0 -1
- package/lib/module/core/withUnistyles/useDependencies.js.map +0 -1
- package/lib/typescript/src/components/Variants.d.ts +0 -7
- package/lib/typescript/src/components/Variants.d.ts.map +0 -1
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +0 -14
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +0 -1
- package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts +0 -13
- package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts.map +0 -1
- package/nitrogen/generated/android/unistylesOnLoad.kt +0 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +0 -314
- package/plugin/style.js +0 -168
- package/src/components/Variants.tsx +0 -30
- package/src/core/createUnistylesComponent.tsx +0 -14
@@ -3,11 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.schemeToTheme = exports.removeInlineStyles = exports.isInDocument = exports.getMediaQuery = exports.extractUnistyleDependencies = exports.extractSecrets = exports.
|
6
|
+
exports.schemeToTheme = exports.removeInlineStyles = exports.isInDocument = exports.getMediaQuery = exports.extractUnistyleDependencies = exports.extractSecrets = exports.assignSecrets = void 0;
|
7
7
|
var _types = require("../../specs/types");
|
8
8
|
var _mq = require("../../mq");
|
9
|
-
var _state = require("../state");
|
10
9
|
var _common = require("./common");
|
10
|
+
var _index = require("../index");
|
11
11
|
const schemeToTheme = scheme => {
|
12
12
|
switch (scheme) {
|
13
13
|
case _types.ColorScheme.Dark:
|
@@ -19,13 +19,32 @@ const schemeToTheme = scheme => {
|
|
19
19
|
};
|
20
20
|
exports.schemeToTheme = schemeToTheme;
|
21
21
|
const assignSecrets = (object, secrets) => {
|
22
|
-
|
23
|
-
|
22
|
+
const secretsId = Math.random().toString(36).slice(8);
|
23
|
+
|
24
|
+
// @ts-expect-error assign hidden secrets
|
25
|
+
object[`unistyles-${secretsId}`] = {};
|
26
|
+
// @ts-expect-error assign hidden secrets
|
27
|
+
Object.defineProperties(object[`unistyles-${secretsId}`], (0, _common.reduceObject)(secrets, secret => ({
|
28
|
+
value: secret,
|
29
|
+
enumerable: false,
|
30
|
+
configurable: true
|
31
|
+
})));
|
24
32
|
return object;
|
25
33
|
};
|
26
34
|
exports.assignSecrets = assignSecrets;
|
27
35
|
const extractSecrets = object => {
|
28
|
-
|
36
|
+
if (!object) {
|
37
|
+
return undefined;
|
38
|
+
}
|
39
|
+
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles-')) ?? [];
|
40
|
+
if (!secrets) {
|
41
|
+
return undefined;
|
42
|
+
}
|
43
|
+
const hiddenSecrets = Object.getOwnPropertyDescriptors(secrets);
|
44
|
+
if (Object.keys(hiddenSecrets).length === 0) {
|
45
|
+
return undefined;
|
46
|
+
}
|
47
|
+
return (0, _common.reduceObject)(hiddenSecrets, secret => secret.value);
|
29
48
|
};
|
30
49
|
exports.extractSecrets = extractSecrets;
|
31
50
|
const removeInlineStyles = values => {
|
@@ -40,18 +59,9 @@ const removeInlineStyles = values => {
|
|
40
59
|
exports.removeInlineStyles = removeInlineStyles;
|
41
60
|
const isInDocument = element => document.body.contains(element);
|
42
61
|
exports.isInDocument = isInDocument;
|
43
|
-
const
|
44
|
-
const [_, px] = query.match(/(\d+)px/) ?? [];
|
45
|
-
if (!px) {
|
46
|
-
return undefined;
|
47
|
-
}
|
48
|
-
const value = Number(px);
|
49
|
-
return Number.isNaN(value) ? undefined : value;
|
50
|
-
};
|
51
|
-
exports.extractMediaQueryValue = extractMediaQueryValue;
|
52
|
-
const getMediaQuery = query => {
|
62
|
+
const getMediaQuery = (query, allBreakpoints) => {
|
53
63
|
if (Object.values(_types.Orientation).includes(query)) {
|
54
|
-
return
|
64
|
+
return `@media (orientation: ${query})`;
|
55
65
|
}
|
56
66
|
if ((0, _mq.isUnistylesMq)(query)) {
|
57
67
|
const {
|
@@ -60,10 +70,13 @@ const getMediaQuery = query => {
|
|
60
70
|
minHeight,
|
61
71
|
maxHeight
|
62
72
|
} = (0, _mq.parseMq)(query);
|
63
|
-
|
73
|
+
const queries = [minWidth ? `(min-width: ${minWidth}px)` : undefined, maxWidth ? `(max-width: ${maxWidth}px)` : undefined, minHeight ? `(min-height: ${minHeight}px)` : undefined, maxHeight ? `(max-height: ${maxHeight}px)` : undefined].filter(Boolean).join(' and ');
|
74
|
+
return `@media ${queries}`;
|
64
75
|
}
|
65
|
-
const
|
66
|
-
|
76
|
+
const breakpointValue = _index.UnistylesWeb.runtime.breakpoints[query] ?? 0;
|
77
|
+
const nextBreakpoint = allBreakpoints.filter(b => b in _index.UnistylesWeb.runtime.breakpoints).map(b => _index.UnistylesWeb.runtime.breakpoints[b]).sort((a, b) => a - b).find(b => b > breakpointValue);
|
78
|
+
const queries = [`(min-width: ${breakpointValue}px)`, nextBreakpoint ? `(max-width: ${nextBreakpoint - 1}px)` : undefined].filter(Boolean).join(' and ');
|
79
|
+
return `@media ${queries}`;
|
67
80
|
};
|
68
81
|
exports.getMediaQuery = getMediaQuery;
|
69
82
|
const extractUnistyleDependencies = value => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_mq","
|
1
|
+
{"version":3,"names":["_types","require","_mq","_common","_index","schemeToTheme","scheme","ColorScheme","Dark","Light","exports","assignSecrets","object","secrets","secretsId","Math","random","toString","slice","Object","defineProperties","reduceObject","secret","value","enumerable","configurable","extractSecrets","undefined","entries","find","key","startsWith","hiddenSecrets","getOwnPropertyDescriptors","keys","length","removeInlineStyles","values","returnValue","isInDocument","element","document","body","contains","getMediaQuery","query","allBreakpoints","Orientation","includes","isUnistylesMq","minWidth","maxWidth","minHeight","maxHeight","parseMq","queries","filter","Boolean","join","breakpointValue","UnistylesWeb","runtime","breakpoints","nextBreakpoint","b","map","sort","a","extractUnistyleDependencies","dependencies","keyInObject","uni__dependencies","Array","isArray"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":"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","ignoreList":[]}
|
@@ -5,35 +5,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getVariants = void 0;
|
7
7
|
var _utils = require("../utils");
|
8
|
-
|
8
|
+
var _utils2 = require("./utils");
|
9
|
+
const hasVariants = value => {
|
10
|
+
return (0, _utils2.keyInObject)(value, 'variants');
|
11
|
+
};
|
9
12
|
const getVariants = (styles, selectedVariants) => {
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
return [];
|
21
|
-
}
|
22
|
-
return selectedVariantStyles;
|
23
|
-
});
|
24
|
-
const compoundVariantStyles = compoundVariants.flatMap(compoundVariant => {
|
25
|
-
const {
|
26
|
-
styles,
|
27
|
-
...conditions
|
28
|
-
} = compoundVariant;
|
29
|
-
if (Object.entries(conditions).some(([variant, value]) => String(selectedVariants[variant]) !== String(value))) {
|
30
|
-
return [];
|
31
|
-
}
|
32
|
-
return styles;
|
33
|
-
});
|
34
|
-
const mergedVariantStyles = (0, _utils.deepMergeObjects)(...variantStyles, ...compoundVariantStyles);
|
35
|
-
return [key, mergedVariantStyles];
|
13
|
+
if (!hasVariants(styles)) {
|
14
|
+
return {};
|
15
|
+
}
|
16
|
+
const variantStyles = Object.entries(styles.variants).flatMap(([variant, styles]) => {
|
17
|
+
const selectedVariant = selectedVariants[variant];
|
18
|
+
const selectedVariantStyles = styles[selectedVariant] ?? styles.default;
|
19
|
+
if (!selectedVariantStyles) {
|
20
|
+
return [];
|
21
|
+
}
|
22
|
+
return selectedVariantStyles;
|
36
23
|
});
|
24
|
+
const compoundVariantStyles = styles.compoundVariants?.flatMap(compoundVariant => {
|
25
|
+
const {
|
26
|
+
styles,
|
27
|
+
...conditions
|
28
|
+
} = compoundVariant;
|
29
|
+
if (Object.entries(conditions).some(([variant, value]) => String(selectedVariants[variant]) !== String(value))) {
|
30
|
+
return [];
|
31
|
+
}
|
32
|
+
return styles;
|
33
|
+
}) ?? [];
|
34
|
+
return (0, _utils.deepMergeObjects)(...variantStyles, ...compoundVariantStyles);
|
37
35
|
};
|
38
36
|
exports.getVariants = getVariants;
|
39
37
|
//# sourceMappingURL=variants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","hasVariants","value","getVariants","styles","selectedVariants","
|
1
|
+
{"version":3,"names":["_utils","require","_utils2","hasVariants","value","keyInObject","getVariants","styles","selectedVariants","variantStyles","Object","entries","variants","flatMap","variant","selectedVariant","selectedVariantStyles","default","compoundVariantStyles","compoundVariants","compoundVariant","conditions","some","String","deepMergeObjects","exports"],"sourceRoot":"../../../src","sources":["web/variants.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,MAAME,WAAW,GAAIC,KAAU,IAAkC;EAC7D,OAAO,IAAAC,mBAAW,EAACD,KAAK,EAAE,UAAU,CAAC;AACzC,CAAC;AAEM,MAAME,WAAW,GAAGA,CAACC,MAAuB,EAAEC,gBAAqC,KAAK;EAC3F,IAAI,CAACL,WAAW,CAACI,MAAM,CAAC,EAAE;IACtB,OAAO,CAAC,CAAC;EACb;EAEA,MAAME,aAAa,GAAGC,MAAM,CAACC,OAAO,CAACJ,MAAM,CAACK,QAAQ,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,OAAO,EAAEP,MAAM,CAAC,KAAK;IACjF,MAAMQ,eAAe,GAAGP,gBAAgB,CAACM,OAAO,CAAC;IACjD,MAAME,qBAAqB,GAAGT,MAAM,CAACQ,eAAe,CAAC,IAAIR,MAAM,CAACU,OAAO;IAEvE,IAAI,CAACD,qBAAqB,EAAE;MACxB,OAAO,EAAE;IACb;IAEA,OAAOA,qBAAqB;EAChC,CAAC,CAAC;EAEF,MAAME,qBAAqB,GAAGX,MAAM,CAACY,gBAAgB,EAAEN,OAAO,CAACO,eAAe,IAAI;IAC9E,MAAM;MAAEb,MAAM;MAAE,GAAGc;IAAW,CAAC,GAAGD,eAAe;IAEjD,IAAIV,MAAM,CAACC,OAAO,CAACU,UAAU,CAAC,CAACC,IAAI,CAAC,CAAC,CAACR,OAAO,EAAEV,KAAK,CAAC,KAAKmB,MAAM,CAACf,gBAAgB,CAACM,OAAO,CAAC,CAAC,KAAKS,MAAM,CAACnB,KAAK,CAAC,CAAC,EAAE;MAC5G,OAAO,EAAE;IACb;IAEA,OAAOG,MAAM;EACjB,CAAC,CAAC,IAAI,EAAE;EAER,OAAO,IAAAiB,uBAAgB,EAAC,GAAGf,aAAa,EAAE,GAAGS,qBAAqB,CAAC;AACvE,CAAC;AAAAO,OAAA,CAAAnB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useLayoutEffect","UnistylesShadowRegistry","jsx","_jsx","Apply","name","setScopedTheme","ScopedTheme","children","previousScopedTheme","getScopedTheme","mappedChildren","Fragment"],"sourceRoot":"../../../src","sources":["components/ScopedTheme.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAE9C,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMlD,MAAMC,KAAK,GAAGA,CAAC;EAAEC;AAAuC,CAAC,KAAK;EAC1DJ,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAE5CL,eAAe,CAAC,MAAM;IAClBC,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAChD,CAAC,CAAC;EAEF,OAAO,IAAI;AACf,CAAC;AAED,OAAO,MAAME,WAAyE,GAAGA,CAAC;EAAEF,IAAI;EAAEG;AAAS,CAAC,KAAK;EAC7G,MAAMC,mBAAmB,GAAGR,uBAAuB,CAACS,cAAc,CAAC,CAAC;EACpE,MAAMC,cAAc,GAAG,cACnBR,IAAA,CAACC,KAAK;IAAYC,IAAI,EAAEA;EAAK,GAAjBA,IAAmB,CAAC,EAChCG,QAAQ,eACRL,IAAA,CAACC,KAAK;IAAeC,IAAI,EAAEI;
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","UnistylesShadowRegistry","jsx","_jsx","Apply","name","setScopedTheme","ScopedTheme","children","previousScopedTheme","getScopedTheme","mappedChildren","Fragment"],"sourceRoot":"../../../src","sources":["components/ScopedTheme.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAE9C,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMlD,MAAMC,KAAK,GAAGA,CAAC;EAAEC;AAAuC,CAAC,KAAK;EAC1DJ,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAE5CL,eAAe,CAAC,MAAM;IAClBC,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAChD,CAAC,CAAC;EAEF,OAAO,IAAI;AACf,CAAC;AAED,OAAO,MAAME,WAAyE,GAAGA,CAAC;EAAEF,IAAI;EAAEG;AAAS,CAAC,KAAK;EAC7G,MAAMC,mBAAmB,GAAGR,uBAAuB,CAACS,cAAc,CAAC,CAAC;EACpE,MAAMC,cAAc,GAAG,cACnBR,IAAA,CAACC,KAAK;IAAYC,IAAI,EAAEA;EAAK,GAAjBA,IAAmB,CAAC,EAChCG,QAAQ,eACRL,IAAA,CAACC,KAAK;IAAeC,IAAI,EAAEI;EAAyD,GAAzE,SAA2E,CAAC,CAC1F;EAED,oBACIN,IAAA,CAACJ,KAAK,CAACa,QAAQ;IAAAJ,QAAA,EACVG;EAAc,CACH,CAAC;AAEzB,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Hide","Display","
|
1
|
+
{"version":3,"names":["Hide","Display","ScopedTheme"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,QAAQ,eAAe","ignoreList":[]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { Animated as RNAnimated } from 'react-native';
|
4
|
+
import { View } from './View';
|
5
|
+
import { Text } from './Text';
|
6
|
+
import { FlatList } from './FlatList';
|
7
|
+
import { Image } from './Image';
|
8
|
+
import { ScrollView } from './ScrollView';
|
9
|
+
import { SectionList } from './SectionList';
|
10
|
+
export const Animated = {
|
11
|
+
...RNAnimated,
|
12
|
+
View: RNAnimated.createAnimatedComponent(View),
|
13
|
+
Text: RNAnimated.createAnimatedComponent(Text),
|
14
|
+
FlatList: RNAnimated.createAnimatedComponent(FlatList),
|
15
|
+
Image: RNAnimated.createAnimatedComponent(Image),
|
16
|
+
ScrollView: RNAnimated.createAnimatedComponent(ScrollView),
|
17
|
+
SectionList: RNAnimated.createAnimatedComponent(SectionList)
|
18
|
+
};
|
19
|
+
//# sourceMappingURL=Animated.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Animated","RNAnimated","View","Text","FlatList","Image","ScrollView","SectionList","createAnimatedComponent"],"sourceRoot":"../../../../src","sources":["components/native/Animated.tsx"],"mappings":";;AAAA,SAASA,QAAQ,IAAIC,UAAU,QAAQ,cAAc;AACrD,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMP,QAAQ,GAAG;EACpB,GAAGC,UAAU;EACbC,IAAI,EAAED,UAAU,CAACO,uBAAuB,CAACN,IAAI,CAAC;EAC9CC,IAAI,EAAEF,UAAU,CAACO,uBAAuB,CAACL,IAAI,CAAC;EAC9CC,QAAQ,EAAEH,UAAU,CAACO,uBAAuB,CAACJ,QAAQ,CAAC;EACtDC,KAAK,EAAEJ,UAAU,CAACO,uBAAuB,CAACH,KAAK,CAAC;EAChDC,UAAU,EAAEL,UAAU,CAACO,uBAAuB,CAACF,UAAU,CAAC;EAC1DC,WAAW,EAAEN,UAAU,CAACO,uBAAuB,CAACD,WAAW;AAC/D,CAAC","ignoreList":[]}
|
@@ -1,6 +1,51 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
import React from 'react';
|
3
4
|
import { ImageBackground as NativeImageBackground } from 'react-native';
|
4
|
-
import {
|
5
|
-
|
5
|
+
import { forwardRef } from 'react';
|
6
|
+
import { getClassName } from '../../core';
|
7
|
+
import { isServer } from '../../web/utils';
|
8
|
+
import { UnistylesShadowRegistry } from '../../web';
|
9
|
+
import { copyComponentProperties } from '../../utils';
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
|
+
const UnistylesImageBackground = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
12
|
+
let storedRef = null;
|
13
|
+
let storedImageRef = null;
|
14
|
+
const styleClassNames = getClassName(props.style);
|
15
|
+
const imageClassNames = getClassName(props.imageStyle);
|
16
|
+
return (
|
17
|
+
/*#__PURE__*/
|
18
|
+
// @ts-expect-error - RN types are not compatible with RNW styles
|
19
|
+
_jsx(NativeImageBackground, {
|
20
|
+
...props,
|
21
|
+
style: styleClassNames,
|
22
|
+
imageStyle: imageClassNames,
|
23
|
+
ref: isServer() ? undefined : ref => {
|
24
|
+
if (!ref) {
|
25
|
+
// @ts-expect-error hidden from TS
|
26
|
+
UnistylesShadowRegistry.remove(storedRef, styleClassNames?.hash);
|
27
|
+
}
|
28
|
+
storedRef = ref;
|
29
|
+
// @ts-expect-error hidden from TS
|
30
|
+
UnistylesShadowRegistry.add(ref, styleClassNames?.hash);
|
31
|
+
if (typeof forwardedRef === 'function') {
|
32
|
+
return forwardedRef(ref);
|
33
|
+
}
|
34
|
+
if (forwardedRef) {
|
35
|
+
forwardedRef.current = ref;
|
36
|
+
}
|
37
|
+
},
|
38
|
+
imageRef: isServer() ? undefined : ref => {
|
39
|
+
if (!ref) {
|
40
|
+
// @ts-expect-error hidden from TS
|
41
|
+
UnistylesShadowRegistry.remove(storedImageRef, imageClassNames?.hash);
|
42
|
+
}
|
43
|
+
storedImageRef = ref;
|
44
|
+
// @ts-expect-error hidden from TS
|
45
|
+
UnistylesShadowRegistry.add(ref, imageClassNames?.hash);
|
46
|
+
}
|
47
|
+
})
|
48
|
+
);
|
49
|
+
});
|
50
|
+
export const ImageBackground = copyComponentProperties(NativeImageBackground, UnistylesImageBackground);
|
6
51
|
//# sourceMappingURL=ImageBackground.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ImageBackground","NativeImageBackground","
|
1
|
+
{"version":3,"names":["React","ImageBackground","NativeImageBackground","forwardRef","getClassName","isServer","UnistylesShadowRegistry","copyComponentProperties","jsx","_jsx","UnistylesImageBackground","props","forwardedRef","storedRef","storedImageRef","styleClassNames","style","imageClassNames","imageStyle","ref","undefined","remove","hash","add","current","imageRef"],"sourceRoot":"../../../../src","sources":["components/native/ImageBackground.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,IAAIC,qBAAqB,QAAQ,cAAc;AACvE,SAASC,UAAU,QAAQ,OAAO;AAElC,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,uBAAuB,QAAQ,WAAW;AACnD,SAASC,uBAAuB,QAAQ,aAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOrD,MAAMC,wBAAwB,gBAAGP,UAAU,CAAiB,CAACQ,KAAK,EAAEC,YAAY,KAAK;EACjF,IAAIC,SAAuC,GAAG,IAAI;EAClD,IAAIC,cAA4C,GAAG,IAAI;EACvD,MAAMC,eAAe,GAAGX,YAAY,CAACO,KAAK,CAACK,KAAK,CAAC;EACjD,MAAMC,eAAe,GAAGb,YAAY,CAACO,KAAK,CAACO,UAAU,CAAC;EAEtD;IAAA;IACI;IACAT,IAAA,CAACP,qBAAqB;MAAA,GACdS,KAAK;MACTK,KAAK,EAAED,eAAgB;MACvBG,UAAU,EAAED,eAAgB;MAC5BE,GAAG,EAAEd,QAAQ,CAAC,CAAC,GAAGe,SAAS,GAAGD,GAAG,IAAI;QACjC,IAAI,CAACA,GAAG,EAAE;UACN;UACAb,uBAAuB,CAACe,MAAM,CAACR,SAAS,EAAEE,eAAe,EAAEO,IAAI,CAAC;QACpE;QAEAT,SAAS,GAAGM,GAAG;QACf;QACAb,uBAAuB,CAACiB,GAAG,CAACJ,GAAG,EAAEJ,eAAe,EAAEO,IAAI,CAAC;QAEvD,IAAI,OAAOV,YAAY,KAAK,UAAU,EAAE;UACpC,OAAOA,YAAY,CAACO,GAAG,CAAC;QAC5B;QAEA,IAAIP,YAAY,EAAE;UACdA,YAAY,CAACY,OAAO,GAAGL,GAAG;QAC9B;MACJ,CAAE;MACFM,QAAQ,EAAEpB,QAAQ,CAAC,CAAC,GAAGe,SAAS,GAAGD,GAAG,IAAI;QACtC,IAAI,CAACA,GAAG,EAAE;UACN;UACAb,uBAAuB,CAACe,MAAM,CAACP,cAAc,EAAEG,eAAe,EAAEK,IAAI,CAAC;QACzE;QAEAR,cAAc,GAAGK,GAAG;QACpB;QACAb,uBAAuB,CAACiB,GAAG,CAACJ,GAAG,EAAEF,eAAe,EAAEK,IAAI,CAAC;MAC3D;IAAE,CACL;EAAC;AAEV,CAAC,CAAC;AAEF,OAAO,MAAMrB,eAAe,GAAGM,uBAAuB,CAACL,qBAAqB,EAAEQ,wBAAwB,CAAC","ignoreList":[]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { ImageBackground as NativeImageBackground } from 'react-native';
|
4
|
+
import { createUnistylesImageBackground } from '../../core';
|
5
|
+
export const ImageBackground = createUnistylesImageBackground(NativeImageBackground);
|
6
|
+
//# sourceMappingURL=ImageBackground.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["ImageBackground","NativeImageBackground","createUnistylesImageBackground"],"sourceRoot":"../../../../src","sources":["components/native/ImageBackground.native.tsx"],"mappings":";;AAAA,SAASA,eAAe,IAAIC,qBAAqB,QAAQ,cAAc;AACvE,SAASC,8BAA8B,QAAQ,YAAY;AAE3D,OAAO,MAAMF,eAAe,GAAGE,8BAA8B,CAACD,qBAAqB,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Text"],"sourceRoot":"../../../../src","sources":["components/native/NativeText.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,QAAQ","ignoreList":[]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { createElement, forwardRef } from 'react';
|
4
|
+
import { createUnistylesElement } from '../../core';
|
5
|
+
|
6
|
+
// credits to @hirbod
|
7
|
+
const LeanText = /*#__PURE__*/forwardRef((props, ref) => {
|
8
|
+
return /*#__PURE__*/createElement('RCTText', {
|
9
|
+
...props,
|
10
|
+
ref
|
11
|
+
});
|
12
|
+
});
|
13
|
+
LeanText.displayName = 'RCTText';
|
14
|
+
export const NativeText = createUnistylesElement(LeanText);
|
15
|
+
//# sourceMappingURL=NativeText.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createElement","forwardRef","createUnistylesElement","LeanText","props","ref","displayName","NativeText"],"sourceRoot":"../../../../src","sources":["components/native/NativeText.native.tsx"],"mappings":";;AACA,SAA6BA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACrE,SAASC,sBAAsB,QAAQ,YAAY;;AAEnD;AACA,MAAMC,QAAQ,gBAAGF,UAAU,CAAC,CAACG,KAAK,EAAEC,GAAG,KAAK;EACxC,oBAAOL,aAAa,CAAC,SAAS,EAAE;IAAE,GAAGI,KAAK;IAAEC;EAAI,CAAC,CAAC;AACtD,CAAC,CAA6B;AAE9BF,QAAQ,CAACG,WAAW,GAAG,SAAS;AAEhC,OAAO,MAAMC,UAAU,GAAGL,sBAAsB,CAACC,QAAQ,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["View"],"sourceRoot":"../../../../src","sources":["components/native/NativeView.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,QAAQ;AAE7B,eAAeA,IAAI","ignoreList":[]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { createElement, forwardRef } from 'react';
|
4
|
+
import { createUnistylesElement } from '../../core';
|
5
|
+
|
6
|
+
// credits to @hirbod
|
7
|
+
const LeanView = /*#__PURE__*/forwardRef((props, ref) => {
|
8
|
+
return /*#__PURE__*/createElement('RCTView', {
|
9
|
+
...props,
|
10
|
+
ref
|
11
|
+
});
|
12
|
+
});
|
13
|
+
LeanView.displayName = 'RCTView';
|
14
|
+
|
15
|
+
// this will match default export from react-native
|
16
|
+
export default createUnistylesElement(LeanView);
|
17
|
+
//# sourceMappingURL=NativeView.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createElement","forwardRef","createUnistylesElement","LeanView","props","ref","displayName"],"sourceRoot":"../../../../src","sources":["components/native/NativeView.native.tsx"],"mappings":";;AACA,SAA6BA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACrE,SAASC,sBAAsB,QAAQ,YAAY;;AAEnD;AACA,MAAMC,QAAQ,gBAAGF,UAAU,CAAC,CAACG,KAAK,EAAEC,GAAG,KAAK;EACxC,oBAAOL,aAAa,CAAC,SAAS,EAAE;IAAE,GAAGI,KAAK;IAAEC;EAAI,CAAC,CAAC;AACtD,CAAC,CAA6B;AAE9BF,QAAQ,CAACG,WAAW,GAAG,SAAS;;AAEhC;AACA,eAAeJ,sBAAsB,CAACC,QAAQ,CAAC","ignoreList":[]}
|
@@ -1,68 +1,43 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React, { forwardRef
|
3
|
+
import React, { forwardRef } from 'react';
|
4
4
|
import { Pressable as NativePressableReactNative } from 'react-native';
|
5
5
|
import { UnistylesShadowRegistry } from '../../specs';
|
6
|
+
import { getClassName } from '../../core';
|
7
|
+
import { isServer } from '../../web/utils';
|
6
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
-
const initialState = {
|
8
|
-
pressed: false,
|
9
|
-
hovered: false,
|
10
|
-
focused: false
|
11
|
-
};
|
12
|
-
const extractStyleResult = style => {
|
13
|
-
return typeof style === 'function' ? [style()] : Array.isArray(style) ? style.map(style => typeof style === 'function' ? style() : style) : [style];
|
14
|
-
};
|
15
|
-
const updateStyles = ({
|
16
|
-
ref,
|
17
|
-
style,
|
18
|
-
state,
|
19
|
-
scopedTheme,
|
20
|
-
variants
|
21
|
-
}) => {
|
22
|
-
const styleResult = typeof style === 'function' ? style(state) : style;
|
23
|
-
const extractedResult = extractStyleResult(styleResult);
|
24
|
-
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
25
|
-
const previousVariants = UnistylesShadowRegistry.getVariants();
|
26
|
-
UnistylesShadowRegistry.selectVariants(variants);
|
27
|
-
UnistylesShadowRegistry.setScopedTheme(scopedTheme);
|
28
|
-
UnistylesShadowRegistry.add(ref, extractedResult);
|
29
|
-
UnistylesShadowRegistry.setScopedTheme(previousScopedTheme);
|
30
|
-
UnistylesShadowRegistry.selectVariants(previousVariants);
|
31
|
-
};
|
32
9
|
export const Pressable = /*#__PURE__*/forwardRef(({
|
33
10
|
style,
|
34
11
|
...props
|
35
|
-
},
|
36
|
-
const storedRef = useRef(null);
|
12
|
+
}, forwardedRef) => {
|
37
13
|
const scopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
38
|
-
|
14
|
+
let storedRef = null;
|
15
|
+
let classNames = undefined;
|
39
16
|
return /*#__PURE__*/_jsx(NativePressableReactNative, {
|
40
17
|
...props,
|
41
|
-
|
42
|
-
|
43
|
-
|
18
|
+
ref: isServer() ? undefined : ref => {
|
19
|
+
storedRef = ref;
|
20
|
+
// @ts-expect-error hidden from TS
|
21
|
+
UnistylesShadowRegistry.add(storedRef, classNames?.hash);
|
22
|
+
if (typeof forwardedRef === 'function') {
|
23
|
+
return forwardedRef(ref);
|
44
24
|
}
|
45
|
-
|
46
|
-
|
47
|
-
style: style,
|
48
|
-
variants,
|
49
|
-
scopedTheme,
|
50
|
-
state: state
|
51
|
-
});
|
52
|
-
return {};
|
53
|
-
},
|
54
|
-
ref: ref => {
|
55
|
-
storedRef.current = ref;
|
56
|
-
updateStyles({
|
57
|
-
ref,
|
58
|
-
style: style,
|
59
|
-
variants,
|
60
|
-
scopedTheme,
|
61
|
-
state: initialState
|
62
|
-
});
|
63
|
-
if (typeof passedRef === 'object' && passedRef !== null) {
|
64
|
-
passedRef.current = ref;
|
25
|
+
if (forwardedRef) {
|
26
|
+
forwardedRef.current = ref;
|
65
27
|
}
|
28
|
+
},
|
29
|
+
style: state => {
|
30
|
+
const styleResult = typeof style === 'function' ? style(state) : style;
|
31
|
+
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
32
|
+
UnistylesShadowRegistry.setScopedTheme(scopedTheme);
|
33
|
+
|
34
|
+
// @ts-expect-error hidden from TS
|
35
|
+
UnistylesShadowRegistry.remove(storedRef, classNames?.hash);
|
36
|
+
classNames = getClassName(styleResult);
|
37
|
+
// @ts-expect-error hidden from TS
|
38
|
+
UnistylesShadowRegistry.add(storedRef, classNames?.hash);
|
39
|
+
UnistylesShadowRegistry.setScopedTheme(previousScopedTheme);
|
40
|
+
return classNames;
|
66
41
|
}
|
67
42
|
});
|
68
43
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","
|
1
|
+
{"version":3,"names":["React","forwardRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","getClassName","isServer","jsx","_jsx","style","props","forwardedRef","scopedTheme","getScopedTheme","storedRef","classNames","undefined","ref","add","hash","current","state","styleResult","previousScopedTheme","setScopedTheme","remove"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,aAAa;AAErD,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,QAAQ,QAAQ,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAgB1C,OAAO,MAAMN,SAAS,gBAAGD,UAAU,CAAuB,CAAC;EAAEQ,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,KAAK;EAC7F,MAAMC,WAAW,GAAGR,uBAAuB,CAACS,cAAc,CAAC,CAAC;EAC5D,IAAIC,SAA6B,GAAG,IAAI;EACxC,IAAIC,UAAuD,GAAGC,SAAS;EAEvE,oBACIR,IAAA,CAACL,0BAA0B;IAAA,GACnBO,KAAK;IACTO,GAAG,EAAEX,QAAQ,CAAC,CAAC,GAAGU,SAAS,GAAGC,GAAG,IAAI;MACjCH,SAAS,GAAGG,GAA6B;MACzC;MACAb,uBAAuB,CAACc,GAAG,CAACJ,SAAS,EAAEC,UAAU,EAAEI,IAAI,CAAC;MAExD,IAAI,OAAOR,YAAY,KAAK,UAAU,EAAE;QACpC,OAAOA,YAAY,CAACM,GAAG,CAAC;MAC5B;MAEA,IAAIN,YAAY,EAAE;QACdA,YAAY,CAACS,OAAO,GAAGH,GAAG;MAC9B;IACJ,CAAE;IACFR,KAAK,EAAEY,KAAK,IAAI;MACZ,MAAMC,WAAW,GAAG,OAAOb,KAAK,KAAK,UAAU,GACzCA,KAAK,CAACY,KAA0B,CAAC,GACjCZ,KAAK;MACX,MAAMc,mBAAmB,GAAGnB,uBAAuB,CAACS,cAAc,CAAC,CAAC;MAEpET,uBAAuB,CAACoB,cAAc,CAACZ,WAAW,CAAC;;MAEnD;MACAR,uBAAuB,CAACqB,MAAM,CAACX,SAAS,EAAEC,UAAU,EAAEI,IAAI,CAAC;MAC3DJ,UAAU,GAAGV,YAAY,CAACiB,WAA8B,CAAC;MACzD;MACAlB,uBAAuB,CAACc,GAAG,CAACJ,SAAS,EAAEC,UAAU,EAAEI,IAAI,CAAC;MAExDf,uBAAuB,CAACoB,cAAc,CAACD,mBAAmB,CAAC;MAE3D,OAAOR,UAAU;IACrB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -1,43 +1,59 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React, { forwardRef, useRef } from 'react';
|
3
|
+
import React, { forwardRef, useLayoutEffect, useRef } from 'react';
|
4
4
|
import { Pressable as NativePressableReactNative } from 'react-native';
|
5
5
|
import { UnistylesShadowRegistry } from '../../specs';
|
6
6
|
import { passForwardedRef } from '../../core';
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
const getStyles = (styleProps = {}) => {
|
9
|
+
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('unistyles-'));
|
10
|
+
if (!unistyleKey) {
|
11
|
+
return styleProps;
|
12
|
+
}
|
13
|
+
return {
|
14
|
+
// styles without C++ state
|
15
|
+
...styleProps[unistyleKey].uni__getStyles(),
|
16
|
+
[unistyleKey]: styleProps[unistyleKey].uni__getStyles()
|
17
|
+
};
|
18
|
+
};
|
8
19
|
export const Pressable = /*#__PURE__*/forwardRef(({
|
9
20
|
variants,
|
10
21
|
style,
|
11
22
|
...props
|
12
23
|
}, forwardedRef) => {
|
13
24
|
const storedRef = useRef();
|
25
|
+
useLayoutEffect(() => {
|
26
|
+
return () => {
|
27
|
+
if (storedRef.current) {
|
28
|
+
// @ts-expect-error - this is hidden from TS
|
29
|
+
UnistylesShadowRegistry.remove(storedRef.current);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
}, []);
|
14
33
|
return /*#__PURE__*/_jsx(NativePressableReactNative, {
|
15
34
|
...props,
|
16
35
|
ref: ref => {
|
17
36
|
const unistyles = typeof style === 'function' ? style({
|
18
37
|
pressed: false
|
19
38
|
}) : style;
|
20
|
-
const styles = Array.isArray(unistyles) ? unistyles : [unistyles];
|
21
39
|
|
22
40
|
// @ts-expect-error - this is hidden from TS
|
23
|
-
UnistylesShadowRegistry.add(ref,
|
24
|
-
|
41
|
+
UnistylesShadowRegistry.add(ref, unistyles);
|
42
|
+
if (ref) {
|
43
|
+
storedRef.current = ref;
|
44
|
+
}
|
25
45
|
return passForwardedRef(props, ref, forwardedRef);
|
26
46
|
},
|
27
47
|
style: state => {
|
28
|
-
const unistyles = typeof style === 'function' ? style(state) : style;
|
29
|
-
const styles = Array.isArray(unistyles) ? unistyles : [unistyles];
|
48
|
+
const unistyles = typeof style === 'function' ? style(state) : getStyles(style);
|
30
49
|
if (!storedRef.current) {
|
31
50
|
return unistyles;
|
32
51
|
}
|
33
|
-
if (state.pressed) {
|
34
|
-
UnistylesShadowRegistry.selectVariants(variants);
|
35
|
-
}
|
36
52
|
|
37
53
|
// @ts-expect-error - this is hidden from TS
|
38
54
|
UnistylesShadowRegistry.remove(storedRef.current);
|
39
55
|
// @ts-expect-error - this is hidden from TS
|
40
|
-
UnistylesShadowRegistry.add(storedRef.current,
|
56
|
+
UnistylesShadowRegistry.add(storedRef.current, unistyles);
|
41
57
|
return unistyles;
|
42
58
|
}
|
43
59
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","passForwardedRef","jsx","_jsx","
|
1
|
+
{"version":3,"names":["React","forwardRef","useLayoutEffect","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","passForwardedRef","jsx","_jsx","getStyles","styleProps","unistyleKey","Object","keys","find","key","startsWith","uni__getStyles","variants","style","props","forwardedRef","storedRef","current","remove","ref","unistyles","pressed","add","state"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAClE,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,aAAa;AACrD,SAASC,gBAAgB,QAAQ,YAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAM7C,MAAMC,SAAS,GAAGA,CAACC,UAA+B,GAAG,CAAC,CAAC,KAAK;EACxD,MAAMC,WAAW,GAAGC,MAAM,CACrBC,IAAI,CAACH,UAAU,CAAC,CAChBI,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,UAAU,CAAC,YAAY,CAAC,CAAC;EAE9C,IAAI,CAACL,WAAW,EAAE;IACd,OAAOD,UAAU;EACrB;EAEA,OAAO;IACH;IACA,GAAGA,UAAU,CAACC,WAAW,CAAC,CAACM,cAAc,CAAC,CAAC;IAC3C,CAACN,WAAW,GAAGD,UAAU,CAACC,WAAW,CAAC,CAACM,cAAc,CAAC;EAC1D,CAAC;AACL,CAAC;AAED,OAAO,MAAMd,SAAS,gBAAGH,UAAU,CAAuB,CAAC;EAAEkB,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,KAAK;EACvG,MAAMC,SAAS,GAAGpB,MAAM,CAAc,CAAC;EAEvCD,eAAe,CAAC,MAAM;IAClB,OAAO,MAAM;MACT,IAAIqB,SAAS,CAACC,OAAO,EAAE;QACnB;QACAlB,uBAAuB,CAACmB,MAAM,CAACF,SAAS,CAACC,OAAO,CAAC;MACrD;IACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBACIf,IAAA,CAACJ,0BAA0B;IAAA,GACnBgB,KAAK;IACTK,GAAG,EAAEA,GAAG,IAAI;MACR,MAAMC,SAAS,GAAG,OAAOP,KAAK,KAAK,UAAU,GACvCA,KAAK,CAAC;QAAEQ,OAAO,EAAE;MAAM,CAAC,CAAC,GACzBR,KAAK;;MAEX;MACAd,uBAAuB,CAACuB,GAAG,CAACH,GAAG,EAAEC,SAAS,CAAC;MAE3C,IAAID,GAAG,EAAE;QACLH,SAAS,CAACC,OAAO,GAAGE,GAAG;MAC3B;MAEA,OAAOnB,gBAAgB,CAACc,KAAK,EAAEK,GAAG,EAAEJ,YAAY,CAAC;IACrD,CAAE;IACFF,KAAK,EAAEU,KAAK,IAAI;MACZ,MAAMH,SAAS,GAAG,OAAOP,KAAK,KAAK,UAAU,GACvCA,KAAK,CAACU,KAAK,CAAC,GACZpB,SAAS,CAACU,KAAuC,CAAC;MAExD,IAAI,CAACG,SAAS,CAACC,OAAO,EAAE;QACpB,OAAOG,SAAS;MACpB;;MAEA;MACArB,uBAAuB,CAACmB,MAAM,CAACF,SAAS,CAACC,OAAO,CAAC;MACjD;MACAlB,uBAAuB,CAACuB,GAAG,CAACN,SAAS,CAACC,OAAO,EAAEG,SAAS,CAAC;MAEzD,OAAOA,SAAS;IACpB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -1,10 +1,38 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import React from 'react';
|
4
|
-
import {
|
4
|
+
import { getClassName } from './getClassname';
|
5
|
+
import { isServer } from '../web/utils';
|
6
|
+
import { UnistylesShadowRegistry } from '../web';
|
7
|
+
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
8
|
+
import { copyComponentProperties } from '../utils';
|
5
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
-
export const createUnistylesElement = Component =>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
+
export const createUnistylesElement = Component => {
|
11
|
+
const UnistylesComponent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
12
|
+
let storedRef = null;
|
13
|
+
const classNames = getClassName(props.style);
|
14
|
+
return /*#__PURE__*/_jsx(Component, {
|
15
|
+
...props,
|
16
|
+
style: classNames,
|
17
|
+
ref: isServer() ? undefined : ref => {
|
18
|
+
// @ts-ignore we don't know the type of the component
|
19
|
+
maybeWarnAboutMultipleUnistyles(props.style, Component.displayName);
|
20
|
+
if (!ref) {
|
21
|
+
// @ts-expect-error hidden from TS
|
22
|
+
UnistylesShadowRegistry.remove(storedRef, classNames?.hash);
|
23
|
+
}
|
24
|
+
storedRef = ref;
|
25
|
+
// @ts-expect-error hidden from TS
|
26
|
+
UnistylesShadowRegistry.add(ref, classNames?.hash);
|
27
|
+
if (typeof forwardedRef === 'function') {
|
28
|
+
return forwardedRef(ref);
|
29
|
+
}
|
30
|
+
if (forwardedRef) {
|
31
|
+
forwardedRef.current = ref;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
});
|
35
|
+
});
|
36
|
+
return copyComponentProperties(Component, UnistylesComponent);
|
37
|
+
};
|
10
38
|
//# sourceMappingURL=createUnistylesElement.js.map
|