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
package/README.md
CHANGED
@@ -47,6 +47,9 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
47
47
|
<a href="https://galaxies.dev">
|
48
48
|
<img src="https://avatars.githubusercontent.com/u/118431096?s=200&v=4" height="70px" width="70px" alt="galaxies-dev" />
|
49
49
|
</a>
|
50
|
+
<a href="https://github.com/FTCHD">
|
51
|
+
<img src="https://avatars.githubusercontent.com/u/144691102?v=4" height="70px" width="70px" alt="FTCHD" />
|
52
|
+
</a>
|
50
53
|
<a href="https://github.com/mobily">
|
51
54
|
<img src="https://avatars.githubusercontent.com/u/1467712?v=4" height="70px" width="70px" alt="mobily" />
|
52
55
|
</a>
|
@@ -59,12 +62,18 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
59
62
|
<a href="https://github.com/happyfloat">
|
60
63
|
<img src="https://avatars.githubusercontent.com/u/186333704?s=200&v=4" height="70px" width="70px" alt="happyfloat" />
|
61
64
|
</a>
|
62
|
-
<a href="https://github.com/hyoban">
|
63
|
-
<img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="70px" width="70px" alt="hyoban" />
|
64
|
-
</a>
|
65
65
|
<a href="https://github.com/oscklm">
|
66
66
|
<img src="https://avatars.githubusercontent.com/u/22825865?v=4" height="70px" width="70px" alt="oscklm" />
|
67
67
|
</a>
|
68
|
+
<a href="https://github.com/guillaumehcht">
|
69
|
+
<img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="70px" width="70px" alt="guillaumehcht" />
|
70
|
+
</a>
|
71
|
+
<a href="https://github.com/FilipiRafael">
|
72
|
+
<img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="70px" width="70px" alt="FilipiRafael" />
|
73
|
+
</a>
|
74
|
+
<a href="https://github.com/4cc3ssX">
|
75
|
+
<img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="70px" width="70px" alt="4cc3ssX" />
|
76
|
+
</a>
|
68
77
|
|
69
78
|
## Past sponsors
|
70
79
|
|
@@ -86,6 +95,12 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
86
95
|
<a href="https://github.com/abanobboles">
|
87
96
|
<img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="70px" width="70px" alt="abanobboles" />
|
88
97
|
</a>
|
98
|
+
<a href="https://github.com/hyoban">
|
99
|
+
<img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="70px" width="70px" alt="hyoban" />
|
100
|
+
</a>
|
101
|
+
<a href="https://github.com/giovannilondero">
|
102
|
+
<img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="70px" width="70px" alt="giovannilondero" />
|
103
|
+
</a>
|
89
104
|
|
90
105
|
## Sponsor my work
|
91
106
|
|
@@ -35,9 +35,9 @@ void UnistylesModule::registerNatives() {
|
|
35
35
|
jni::local_ref<BindingsInstallerHolder::javaobject> UnistylesModule::getBindingsInstaller(jni::alias_ref<UnistylesModule::javaobject> jobj) {
|
36
36
|
auto& runtimeExecutor = jobj->cthis()->_runtimeExecutor;
|
37
37
|
auto& uiManager = jobj->cthis()->_uiManager;
|
38
|
-
auto& nativePlatform =
|
38
|
+
auto& nativePlatform = jobj->cthis()->_nativePlatform;
|
39
39
|
|
40
|
-
return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, uiManager, nativePlatform](jsi::Runtime& rt) {
|
40
|
+
return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, &uiManager, &nativePlatform](jsi::Runtime& rt) {
|
41
41
|
// function is called on: first init and every live reload
|
42
42
|
// check if this is live reload, if so let's replace UnistylesRuntime with new runtime
|
43
43
|
auto hasUnistylesRuntime = HybridObjectRegistry::hasHybridObject("UnistylesRuntime");
|
@@ -36,7 +36,7 @@ struct UnistylesModule : public jni::HybridClass<UnistylesModule> {
|
|
36
36
|
private:
|
37
37
|
std::shared_ptr<UIManager> _uiManager;
|
38
38
|
RuntimeExecutor _runtimeExecutor;
|
39
|
-
|
39
|
+
std::shared_ptr<HybridNativePlatformSpec> _nativePlatform;
|
40
40
|
};
|
41
41
|
|
42
42
|
}
|
@@ -32,9 +32,8 @@ class NativePlatformAndroid(private val reactContext: ReactApplicationContext):
|
|
32
32
|
reactContext.addLifecycleEventListener(this)
|
33
33
|
}
|
34
34
|
|
35
|
-
fun
|
35
|
+
fun onDestroy() {
|
36
36
|
reactContext.removeLifecycleEventListener(this)
|
37
|
-
_listener.invalidate()
|
38
37
|
}
|
39
38
|
|
40
39
|
override fun onHostResume() {
|
@@ -23,6 +23,10 @@ class NativePlatformInsets(
|
|
23
23
|
private val _imeListeners: MutableList<CxxImeListener> = mutableListOf()
|
24
24
|
private var _insets: Insets = Insets(0.0, 0.0, 0.0, 0.0, 0.0)
|
25
25
|
|
26
|
+
fun onDestroy() {
|
27
|
+
this.removeImeListeners()
|
28
|
+
}
|
29
|
+
|
26
30
|
fun getInsets(): Insets {
|
27
31
|
val density = reactContext.resources.displayMetrics.density
|
28
32
|
|
@@ -31,7 +31,8 @@ class NativePlatformListener(
|
|
31
31
|
reactContext.registerReceiver(configurationChangeReceiver, IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED))
|
32
32
|
}
|
33
33
|
|
34
|
-
fun
|
34
|
+
fun onDestroy() {
|
35
|
+
this.removePlatformListeners()
|
35
36
|
reactContext.unregisterReceiver(configurationChangeReceiver)
|
36
37
|
}
|
37
38
|
|
@@ -26,10 +26,6 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
|
|
26
26
|
mHybridData = initializeHybridData(reactContext)
|
27
27
|
}
|
28
28
|
|
29
|
-
override fun invalidate() {
|
30
|
-
_nativePlatform.invalidate()
|
31
|
-
}
|
32
|
-
|
33
29
|
private fun initializeHybridData(reactContext: ReactApplicationContext): HybridData {
|
34
30
|
val runtimeExecutor = reactContext.catalystInstance?.runtimeExecutor
|
35
31
|
?: throw IllegalStateException("Unistyles: React Native runtime executor is not available. Please follow installation guides.")
|
@@ -1,12 +1,12 @@
|
|
1
1
|
package com.unistyles
|
2
2
|
|
3
|
-
import com.facebook.react.
|
3
|
+
import com.facebook.react.BaseReactPackage
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
6
6
|
import com.facebook.react.module.model.ReactModuleInfo
|
7
7
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
8
8
|
|
9
|
-
class UnistylesPackage:
|
9
|
+
class UnistylesPackage: BaseReactPackage() {
|
10
10
|
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
11
11
|
return if (name == UnistylesModule.NAME) {
|
12
12
|
UnistylesModule(reactContext)
|
@@ -20,10 +20,10 @@ class UnistylesPackage: TurboReactPackage() {
|
|
20
20
|
mapOf(UnistylesModule.NAME to ReactModuleInfo(
|
21
21
|
UnistylesModule.NAME,
|
22
22
|
UnistylesModule.NAME,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
true,
|
24
|
+
true,
|
25
|
+
true,
|
26
|
+
true
|
27
27
|
))
|
28
28
|
}
|
29
29
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/ActivityIndicator.js",
|
3
|
-
"module": "../../../lib/module/components/native/ActivityIndicator.js"
|
3
|
+
"module": "../../../lib/module/components/native/ActivityIndicator.js",
|
4
|
+
"react-native": "../../../src/components/native/ActivityIndicator.tsx"
|
4
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/ImageBackground.js",
|
3
|
-
"module": "../../../lib/module/components/native/ImageBackground.js"
|
3
|
+
"module": "../../../lib/module/components/native/ImageBackground.js",
|
4
|
+
"react-native": "../../../src/components/native/ImageBackground.native.tsx"
|
4
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/KeyboardAvoidingView.js",
|
3
|
-
"module": "../../../lib/module/components/native/KeyboardAvoidingView.js"
|
3
|
+
"module": "../../../lib/module/components/native/KeyboardAvoidingView.js",
|
4
|
+
"react-native": "../../../src/components/native/KeyboardAvoidingView.tsx"
|
4
5
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/Pressable.js",
|
3
3
|
"module": "../../../lib/module/components/native/Pressable.js",
|
4
|
-
"react-native": "../../../
|
4
|
+
"react-native": "../../../src/components/native/Pressable.native.tsx"
|
5
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/RefreshControl.js",
|
3
|
-
"module": "../../../lib/module/components/native/RefreshControl.js"
|
3
|
+
"module": "../../../lib/module/components/native/RefreshControl.js",
|
4
|
+
"react-native": "../../../src/components/native/RefreshControl.tsx"
|
4
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/ScrollView.js",
|
3
|
-
"module": "../../../lib/module/components/native/ScrollView.js"
|
3
|
+
"module": "../../../lib/module/components/native/ScrollView.js",
|
4
|
+
"react-native": "../../../src/components/native/ScrollView.tsx"
|
4
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/SectionList.js",
|
3
|
-
"module": "../../../lib/module/components/native/SectionList.js"
|
3
|
+
"module": "../../../lib/module/components/native/SectionList.js",
|
4
|
+
"react-native": "../../../src/components/native/SectionList.tsx"
|
4
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/TouchableHighlight.js",
|
3
|
-
"module": "../../../lib/module/components/native/TouchableHighlight.js"
|
3
|
+
"module": "../../../lib/module/components/native/TouchableHighlight.js",
|
4
|
+
"react-native": "../../../src/components/native/TouchableHighlight.tsx"
|
4
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/TouchableOpacity.js",
|
3
|
-
"module": "../../../lib/module/components/native/TouchableOpacity.js"
|
3
|
+
"module": "../../../lib/module/components/native/TouchableOpacity.js",
|
4
|
+
"react-native": "../../../src/components/native/TouchableOpacity.tsx"
|
4
5
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/VirtualizedList.js",
|
3
|
-
"module": "../../../lib/module/components/native/VirtualizedList.js"
|
3
|
+
"module": "../../../lib/module/components/native/VirtualizedList.js",
|
4
|
+
"react-native": "../../../src/components/native/VirtualizedList.tsx"
|
4
5
|
}
|
package/cxx/common/Constants.h
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
namespace margelo::nitro::unistyles::helpers {
|
4
4
|
|
5
|
-
static const std::string
|
5
|
+
static const std::string STYLESHEET_ID = "__stylesheetID";
|
6
|
+
static const std::string UNISTYLE_ID = "__unistyleID";
|
6
7
|
static const std::string ADD_VARIANTS_FN = "useVariants";
|
7
8
|
static const std::string STYLE_DEPENDENCIES = "uni__dependencies";
|
8
|
-
static const std::string
|
9
|
+
static const std::string STYLESHEET_VARIANTS = "__stylesheetVariants";
|
9
10
|
static const std::string WEB_STYLE_KEY = "_web";
|
10
11
|
static const std::string EXOTIC_STYLE_KEY = "_exotic";
|
11
|
-
static const std::string NAME_STYLE_KEY = "__unistyles_name";
|
12
|
-
static const std::string SECRETS = "__uni__secrets";
|
13
12
|
static const std::string ARGUMENTS = "__uni__args";
|
13
|
+
static const std::string GET_STYLES = "uni__getStyles";
|
14
14
|
|
15
15
|
}
|
package/cxx/common/Helpers.h
CHANGED
@@ -147,7 +147,7 @@ inline jsi::Object variantsToValue(jsi::Runtime& rt, Variants& variants) {
|
|
147
147
|
return rawVariants;
|
148
148
|
}
|
149
149
|
|
150
|
-
inline std::vector<folly::dynamic> parseDynamicFunctionArguments(jsi::Runtime& rt, jsi::Array
|
150
|
+
inline std::vector<folly::dynamic> parseDynamicFunctionArguments(jsi::Runtime& rt, jsi::Array& arguments) {
|
151
151
|
std::vector<folly::dynamic> parsedArgument{};
|
152
152
|
size_t count = arguments.size(rt);
|
153
153
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#include "HashGenerator.h"
|
2
|
+
#include <sstream>
|
3
|
+
#include <iomanip>
|
4
|
+
#include <functional>
|
5
|
+
|
6
|
+
namespace margelo::nitro::unistyles::helpers {
|
7
|
+
|
8
|
+
std::atomic<unsigned int> HashGenerator::count(0);
|
9
|
+
|
10
|
+
std::string HashGenerator::generateHash(const std::string& input) {
|
11
|
+
std::hash<std::string> stringHasher;
|
12
|
+
uint64_t inputHash = stringHasher(input);
|
13
|
+
|
14
|
+
unsigned int counterValue = count.fetch_add(1, std::memory_order_relaxed);
|
15
|
+
uint64_t combinedHash = inputHash ^ (static_cast<uint64_t>(counterValue) << 32);
|
16
|
+
|
17
|
+
std::stringstream ss;
|
18
|
+
ss << std::hex << std::setfill('0') << std::setw(8) << (combinedHash & 0xFFFFFFFF);
|
19
|
+
|
20
|
+
return "unistyles-" + ss.str();
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#include "HostUnistyle.h"
|
2
|
+
|
3
|
+
using namespace margelo::nitro::unistyles::core;
|
4
|
+
using namespace facebook;
|
5
|
+
|
6
|
+
std::vector<jsi::PropNameID> HostUnistyle::getPropertyNames(jsi::Runtime& rt) {
|
7
|
+
auto propertyNames = std::vector<jsi::PropNameID> {};
|
8
|
+
|
9
|
+
propertyNames.reserve(8);
|
10
|
+
|
11
|
+
for (const auto& pair : this->_stylesheet->unistyles) {
|
12
|
+
propertyNames.emplace_back(jsi::PropNameID::forUtf8(rt, pair.first));
|
13
|
+
}
|
14
|
+
|
15
|
+
propertyNames.emplace_back(jsi::PropNameID::forUtf8(rt, helpers::ADD_VARIANTS_FN.c_str()));
|
16
|
+
|
17
|
+
return propertyNames;
|
18
|
+
}
|
19
|
+
|
20
|
+
jsi::Value HostUnistyle::get(jsi::Runtime& rt, const jsi::PropNameID& propNameId) {
|
21
|
+
auto propertyName = propNameId.utf8(rt);
|
22
|
+
|
23
|
+
if (propertyName == helpers::STYLESHEET_ID.c_str()) {
|
24
|
+
return jsi::Value(this->_stylesheet->tag);
|
25
|
+
}
|
26
|
+
|
27
|
+
if (propertyName == helpers::STYLESHEET_VARIANTS.c_str()) {
|
28
|
+
return helpers::variantsToValue(rt, this->_variants);
|
29
|
+
}
|
30
|
+
|
31
|
+
if (propertyName == helpers::ADD_VARIANTS_FN.c_str()) {
|
32
|
+
return this->createAddVariantsProxyFunction(rt);
|
33
|
+
}
|
34
|
+
|
35
|
+
if (!this->_stylesheet->unistyles.contains(propertyName)) {
|
36
|
+
return jsi::Value::undefined();
|
37
|
+
}
|
38
|
+
|
39
|
+
auto& unistyle = this->_stylesheet->unistyles[propertyName];
|
40
|
+
|
41
|
+
// check if Unistyles recomputed new style in the background
|
42
|
+
// ()when no node was mounted), if so we need to simply rebuild unistyle to get fresh data
|
43
|
+
if (unistyle->isDirty) {
|
44
|
+
auto parser = parser::Parser(this->_unistylesRuntime);
|
45
|
+
|
46
|
+
parser.rebuildUnistyle(rt, unistyle, this->_variants, std::nullopt);
|
47
|
+
}
|
48
|
+
|
49
|
+
return valueFromUnistyle(rt, this->_unistylesRuntime, this->_stylesheet->unistyles[propertyName], this->_variants);
|
50
|
+
}
|
51
|
+
|
52
|
+
void HostUnistyle::set(jsi::Runtime& rt, const jsi::PropNameID& propNameId, const jsi::Value& value) {}
|
53
|
+
|
54
|
+
jsi::Function HostUnistyle::createAddVariantsProxyFunction(jsi::Runtime& rt) {
|
55
|
+
auto useVariantsFnName = jsi::PropNameID::forUtf8(rt, helpers::ADD_VARIANTS_FN);
|
56
|
+
|
57
|
+
return jsi::Function::createFromHostFunction(rt, useVariantsFnName, 1, [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count){
|
58
|
+
helpers::assertThat(rt, count == 1, "Unistyles: useVariants expected to be called with one argument.");
|
59
|
+
helpers::assertThat(rt, arguments[0].isObject(), "Unistyles: useVariants expected to be called with object.");
|
60
|
+
|
61
|
+
Variants variants = helpers::variantsToPairs(rt, arguments[0].asObject(rt));
|
62
|
+
parser::Parser parser = parser::Parser(this->_unistylesRuntime);
|
63
|
+
|
64
|
+
helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants](const std::string& name, jsi::Value& value){
|
65
|
+
if (name == helpers::ADD_VARIANTS_FN || !this->_stylesheet->unistyles.contains(name)) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
|
69
|
+
auto unistyle = this->_stylesheet->unistyles[name];
|
70
|
+
|
71
|
+
if (unistyle->dependsOn(UnistyleDependency::VARIANTS)) {
|
72
|
+
parser.rebuildUnistyle(rt, unistyle, variants, std::nullopt);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
|
76
|
+
this->_variants = variants;
|
77
|
+
|
78
|
+
auto style = std::make_shared<core::HostUnistyle>(this->_stylesheet, this->_unistylesRuntime, variants);
|
79
|
+
auto styleHostObject = jsi::Object::createFromHostObject(rt, style);
|
80
|
+
|
81
|
+
return styleHostObject;
|
82
|
+
});
|
83
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <jsi/jsi.h>
|
4
|
+
#include "Parser.h"
|
5
|
+
#include "UnistyleWrapper.h"
|
6
|
+
|
7
|
+
namespace margelo::nitro::unistyles::core {
|
8
|
+
|
9
|
+
using Variants = std::vector<std::pair<std::string, std::string>>;
|
10
|
+
|
11
|
+
struct JSI_EXPORT HostUnistyle : public jsi::HostObject {
|
12
|
+
HostUnistyle(std::shared_ptr<StyleSheet> stylesheet, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, Variants& variants)
|
13
|
+
: _stylesheet(stylesheet), _unistylesRuntime{unistylesRuntime}, _variants{std::move(variants)} {};
|
14
|
+
|
15
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& rt);
|
16
|
+
jsi::Value get(jsi::Runtime& rt, const jsi::PropNameID& propNameId);
|
17
|
+
void set(jsi::Runtime& rt, const jsi::PropNameID& propNameId, const jsi::Value& value);
|
18
|
+
|
19
|
+
jsi::Function createAddVariantsProxyFunction(jsi::Runtime& rt);
|
20
|
+
|
21
|
+
private:
|
22
|
+
Variants _variants;
|
23
|
+
std::shared_ptr<StyleSheet> _stylesheet;
|
24
|
+
std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
|
25
|
+
};
|
26
|
+
|
27
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <jsi/jsi.h>
|
4
|
+
#include "Helpers.h"
|
5
|
+
#include "Parser.h"
|
6
|
+
#include "HostUnistyle.h"
|
7
|
+
#include "UnistyleWrapper.h"
|
8
|
+
|
9
|
+
namespace margelo::nitro::unistyles::core {
|
10
|
+
|
11
|
+
inline jsi::Object toRNStyle(jsi::Runtime& rt, std::shared_ptr<StyleSheet> stylesheet, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, Variants&& variants) {
|
12
|
+
auto style = std::make_shared<core::HostUnistyle>(stylesheet, unistylesRuntime, variants);
|
13
|
+
auto styleHostObject = jsi::Object::createFromHostObject(rt, style);
|
14
|
+
|
15
|
+
return styleHostObject;
|
16
|
+
}
|
17
|
+
|
18
|
+
}
|
package/cxx/core/Unistyle.h
CHANGED
@@ -19,8 +19,8 @@ enum class UnistyleType {
|
|
19
19
|
struct Unistyle {
|
20
20
|
using Shared = std::shared_ptr<Unistyle>;
|
21
21
|
|
22
|
-
Unistyle(UnistyleType type, std::string styleKey, jsi::Object& rawObject, std::shared_ptr<StyleSheet> styleSheet)
|
23
|
-
: styleKey{styleKey}, type{type}, rawValue{std::move(rawObject)}, parent{styleSheet} {}
|
22
|
+
Unistyle(std::string hash, UnistyleType type, std::string styleKey, jsi::Object& rawObject, std::shared_ptr<StyleSheet> styleSheet)
|
23
|
+
: unid{hash}, styleKey{styleKey}, type{type}, rawValue{std::move(rawObject)}, parent{styleSheet} {}
|
24
24
|
virtual ~Unistyle() = default;
|
25
25
|
|
26
26
|
Unistyle(const Unistyle&) = delete;
|
@@ -28,11 +28,16 @@ struct Unistyle {
|
|
28
28
|
|
29
29
|
UnistyleType type;
|
30
30
|
std::string styleKey;
|
31
|
+
std::string unid;
|
31
32
|
jsi::Object rawValue;
|
32
33
|
std::optional<jsi::Object> parsedStyle;
|
33
34
|
std::vector<UnistyleDependency> dependencies{};
|
34
35
|
std::shared_ptr<StyleSheet> parent;
|
35
36
|
|
37
|
+
// defines if given unattached unistyle was modified
|
38
|
+
// and should be recomputed when mounting new node
|
39
|
+
bool isDirty = false;
|
40
|
+
|
36
41
|
inline void addDependency(UnistyleDependency dependency) {
|
37
42
|
// we can't add dependencies if unistyle is sealed
|
38
43
|
if (this->_isSealed) {
|
@@ -49,6 +54,10 @@ struct Unistyle {
|
|
49
54
|
inline bool dependsOn(UnistyleDependency dependency) {
|
50
55
|
return std::find(this->dependencies.begin(), this->dependencies.end(), dependency) != this->dependencies.end();
|
51
56
|
}
|
57
|
+
|
58
|
+
inline bool isSealed() {
|
59
|
+
return this->_isSealed;
|
60
|
+
}
|
52
61
|
|
53
62
|
inline void seal() {
|
54
63
|
this->_isSealed = true;
|
@@ -65,8 +74,8 @@ struct UnistyleDynamicFunction: public Unistyle {
|
|
65
74
|
// unprocessedValue <- object generated after calling proxy and user's original function
|
66
75
|
// parsedStyle <- parsed with Unistyle's parser
|
67
76
|
|
68
|
-
UnistyleDynamicFunction(UnistyleType type, std::string styleKey, jsi::Object& rawObject, std::shared_ptr<StyleSheet> styleSheet)
|
69
|
-
: Unistyle(type, styleKey, rawObject, styleSheet) {}
|
77
|
+
UnistyleDynamicFunction(std::string hash, UnistyleType type, std::string styleKey, jsi::Object& rawObject, std::shared_ptr<StyleSheet> styleSheet)
|
78
|
+
: Unistyle(hash, type, styleKey, rawObject, styleSheet) {}
|
70
79
|
|
71
80
|
UnistyleDynamicFunction(const UnistyleDynamicFunction&) = delete;
|
72
81
|
UnistyleDynamicFunction(UnistyleDynamicFunction&& other) = delete;
|