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
@@ -21,6 +21,7 @@ struct UnistyleWrapper: public jsi::NativeState {
|
|
21
21
|
|
22
22
|
inline static Unistyle::Shared unistyleFromStaticStyleSheet(jsi::Runtime& rt, jsi::Object& value) {
|
23
23
|
auto exoticUnistyle = std::make_shared<Unistyle>(
|
24
|
+
helpers::HashGenerator::generateHash(helpers::EXOTIC_STYLE_KEY),
|
24
25
|
UnistyleType::Object,
|
25
26
|
helpers::EXOTIC_STYLE_KEY,
|
26
27
|
value,
|
@@ -32,56 +33,63 @@ inline static Unistyle::Shared unistyleFromStaticStyleSheet(jsi::Runtime& rt, js
|
|
32
33
|
return exoticUnistyle;
|
33
34
|
}
|
34
35
|
|
35
|
-
inline static std::vector<
|
36
|
-
|
37
|
-
|
38
|
-
// return wrapped RN/inline style
|
39
|
-
if (!hasUnistyleName) {
|
40
|
-
return {unistyleFromStaticStyleSheet(rt, value)};
|
41
|
-
}
|
36
|
+
inline static std::vector<std::string> getUnistylesHashKeys(jsi::Runtime& rt, jsi::Object& object) {
|
37
|
+
std::vector<std::string> matchingKeys{};
|
38
|
+
const std::string prefix = "unistyles-";
|
42
39
|
|
43
|
-
|
40
|
+
auto propertyNames = object.getPropertyNames(rt);
|
41
|
+
size_t length = propertyNames.length(rt);
|
44
42
|
|
45
|
-
|
46
|
-
|
43
|
+
for (size_t i = 0; i < length; i++) {
|
44
|
+
auto propertyName = propertyNames.getValueAtIndex(rt, i).getString(rt);
|
45
|
+
std::string key = propertyName.utf8(rt);
|
47
46
|
|
48
|
-
|
47
|
+
if (key.compare(0, prefix.length(), prefix) == 0) {
|
48
|
+
matchingKeys.push_back(key);
|
49
|
+
}
|
50
|
+
}
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
style={[styles.container, styles.otherProp]}
|
52
|
+
return matchingKeys;
|
53
|
+
}
|
53
54
|
|
54
|
-
|
55
|
+
inline static std::vector<Unistyle::Shared> unistylesFromHashKeys(jsi::Runtime& rt, jsi::Object& object, std::vector<std::string> keys) {
|
56
|
+
std::vector<Unistyle::Shared> unistyles{};
|
57
|
+
auto& registry = UnistylesRegistry::get();
|
55
58
|
|
56
|
-
|
59
|
+
for (auto& key: keys) {
|
60
|
+
unistyles.emplace_back(registry.getUnistyleById(rt, key));
|
61
|
+
}
|
57
62
|
|
58
|
-
|
63
|
+
return unistyles;
|
59
64
|
}
|
60
65
|
|
61
|
-
inline static jsi::Object
|
62
|
-
|
63
|
-
std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime,
|
64
|
-
Unistyle::Shared unistyle,
|
65
|
-
std::optional<Variants> variants,
|
66
|
-
std::optional<jsi::Array> arguments
|
67
|
-
) {
|
68
|
-
// add prototype metadata for createUnistylesComponent
|
69
|
-
auto proto = jsi::Object(rt);
|
70
|
-
auto hostFn = jsi::Function::createFromHostFunction(rt, jsi::PropNameID::forUtf8(rt, "getStyle"), 0, [unistyle, unistylesRuntime](jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count){
|
71
|
-
auto variants = helpers::variantsToPairs(rt, thisValue.asObject(rt).getProperty(rt, "variants").asObject(rt));
|
72
|
-
auto arguments = helpers::parseDynamicFunctionArguments(rt, thisValue.asObject(rt).getProperty(rt, "arguments").asObject(rt).asArray(rt));
|
73
|
-
|
74
|
-
parser::Parser(unistylesRuntime).rebuildUnistyle(rt, unistyle->parent, unistyle, variants, std::make_optional<std::vector<folly::dynamic>>(arguments));
|
66
|
+
inline static std::vector<Unistyle::Shared> unistylesFromNonExistentNativeState(jsi::Runtime& rt, jsi::Object& value) {
|
67
|
+
auto unistyleHashKeys = getUnistylesHashKeys(rt, value);
|
75
68
|
|
76
|
-
|
69
|
+
// return wrapped RN/inline style
|
70
|
+
if (unistyleHashKeys.empty()) {
|
71
|
+
return {unistyleFromStaticStyleSheet(rt, value)};
|
72
|
+
}
|
73
|
+
|
74
|
+
// last chance to fallback and get unistyle based on hash
|
75
|
+
auto unistyles = unistylesFromHashKeys(rt, value, unistyleHashKeys);
|
76
|
+
auto areValid = std::all_of(unistyles.begin(), unistyles.end(), [](Unistyle::Shared unistyle){
|
77
|
+
return unistyle != nullptr;
|
77
78
|
});
|
78
79
|
|
79
|
-
|
80
|
-
|
81
|
-
proto.setProperty(rt, "variants", variants.has_value() ? helpers::pairsToVariantsValue(rt, variants.value()) : jsi::Object(rt));
|
82
|
-
proto.setProperty(rt, helpers::STYLE_DEPENDENCIES.c_str(), helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
|
80
|
+
if (!areValid) {
|
81
|
+
throw jsi::JSError(rt, R"(Unistyles: Style is not bound!
|
83
82
|
|
84
|
-
|
83
|
+
You likely altered unistyle hash key and we're not able to recover C++ state attached to this node.)");
|
84
|
+
}
|
85
|
+
|
86
|
+
// someone merged unistyles, and will be warned in JS
|
87
|
+
// the best we can do is to return first unistyle
|
88
|
+
if (unistyles.size() > 1) {
|
89
|
+
return {unistyles.at(0)};
|
90
|
+
}
|
91
|
+
|
92
|
+
return unistyles;
|
85
93
|
}
|
86
94
|
|
87
95
|
inline static std::vector<Unistyle::Shared> unistyleFromValue(jsi::Runtime& rt, const jsi::Value& value) {
|
@@ -116,28 +124,65 @@ inline static std::vector<Unistyle::Shared> unistyleFromValue(jsi::Runtime& rt,
|
|
116
124
|
return unistyles;
|
117
125
|
}
|
118
126
|
|
119
|
-
inline static jsi::Value
|
127
|
+
inline static jsi::Value objectFromUnistyle(jsi::Runtime& rt, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, Unistyle::Shared unistyle, Variants& variants, std::optional<jsi::Array> arguments) {
|
120
128
|
auto wrappedUnistyle = std::make_shared<UnistyleWrapper>(unistyle);
|
129
|
+
auto unistyleID = jsi::PropNameID::forUtf8(rt, unistyle->unid);
|
121
130
|
|
122
|
-
|
123
|
-
jsi::Object obj = jsi::Object(rt);
|
131
|
+
jsi::Object obj = jsi::Object(rt);
|
124
132
|
|
125
|
-
|
126
|
-
obj.setProperty(rt, helpers::NAME_STYLE_KEY.c_str(), jsi::String::createFromUtf8(rt, unistyle->styleKey));
|
133
|
+
obj.setNativeState(rt, std::move(wrappedUnistyle));
|
127
134
|
|
128
|
-
|
129
|
-
helpers::mergeJSIObjects(rt, obj, unistyle->parsedStyle.value());
|
135
|
+
auto secrets = jsi::Object(rt);
|
130
136
|
|
131
|
-
|
137
|
+
auto parsedArguments = arguments.has_value()
|
138
|
+
? helpers::parseDynamicFunctionArguments(rt, arguments.value())
|
139
|
+
: std::optional<std::vector<folly::dynamic>>{};
|
140
|
+
|
141
|
+
if (arguments.has_value()) {
|
142
|
+
// this is required for HybridShadowRegistry::link
|
143
|
+
helpers::defineHiddenProperty(rt, secrets, helpers::ARGUMENTS.c_str(), arguments.value());
|
144
|
+
}
|
145
|
+
|
146
|
+
// this is required for HybridShadowRegistry::link
|
147
|
+
helpers::defineHiddenProperty(rt, secrets, helpers::STYLESHEET_VARIANTS.c_str(), helpers::variantsToValue(rt, variants));
|
148
|
+
|
149
|
+
// this is required for withUnistyles
|
150
|
+
helpers::defineHiddenProperty(rt, secrets, helpers::STYLE_DEPENDENCIES.c_str(), helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
|
151
|
+
|
152
|
+
// this is required for withUnistyles
|
153
|
+
auto hostFn = jsi::Function::createFromHostFunction(
|
154
|
+
rt,
|
155
|
+
jsi::PropNameID::forUtf8(rt, helpers::GET_STYLES.c_str()),
|
156
|
+
0,
|
157
|
+
[unistyle, unistylesRuntime, variants, parsedArguments](jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count
|
158
|
+
) {
|
159
|
+
parser::Parser(unistylesRuntime).rebuildUnistyle(rt, unistyle, variants, parsedArguments);
|
160
|
+
|
161
|
+
return jsi::Value(rt, unistyle->parsedStyle.value()).asObject(rt);
|
162
|
+
});
|
163
|
+
|
164
|
+
helpers::defineHiddenProperty(rt, secrets, helpers::GET_STYLES.c_str(), std::move(hostFn));
|
132
165
|
|
133
|
-
|
166
|
+
obj.setProperty(rt, unistyleID, secrets);
|
167
|
+
|
168
|
+
helpers::mergeJSIObjects(rt, obj, unistyle->parsedStyle.value());
|
169
|
+
|
170
|
+
return obj;
|
171
|
+
}
|
172
|
+
|
173
|
+
inline static jsi::Value valueFromUnistyle(jsi::Runtime& rt, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, Unistyle::Shared unistyle, Variants& variants) {
|
174
|
+
if (unistyle->type == UnistyleType::Object) {
|
175
|
+
return objectFromUnistyle(rt, unistylesRuntime, unistyle, variants, std::nullopt);
|
134
176
|
}
|
135
177
|
|
178
|
+
auto wrappedUnistyle = std::make_shared<UnistyleWrapper>(unistyle);
|
179
|
+
auto unistyleID = jsi::PropNameID::forUtf8(rt, unistyle->unid);
|
180
|
+
|
136
181
|
auto unistyleFn = std::dynamic_pointer_cast<UnistyleDynamicFunction>(unistyle);
|
137
182
|
auto hostFn = jsi::Value(rt, unistyleFn->proxiedFunction.value()).asObject(rt).asFunction(rt);
|
138
183
|
|
139
184
|
hostFn.setNativeState(rt, std::move(wrappedUnistyle));
|
140
|
-
hostFn.setProperty(rt,
|
185
|
+
hostFn.setProperty(rt, unistyleID, jsi::Object(rt));
|
141
186
|
|
142
187
|
return std::move(hostFn);
|
143
188
|
}
|
@@ -75,7 +75,7 @@ void core::UnistylesRegistry::linkShadowNodeWithUnistyle(
|
|
75
75
|
) {
|
76
76
|
shadow::ShadowLeafUpdates updates;
|
77
77
|
auto parser = parser::Parser(nullptr);
|
78
|
-
|
78
|
+
|
79
79
|
std::for_each(unistylesData.begin(), unistylesData.end(), [this, &rt, shadowNodeFamily](std::shared_ptr<UnistyleData> unistyleData){
|
80
80
|
this->_shadowRegistry[&rt][shadowNodeFamily].emplace_back(unistyleData);
|
81
81
|
});
|
@@ -86,6 +86,27 @@ void core::UnistylesRegistry::linkShadowNodeWithUnistyle(
|
|
86
86
|
this->trafficController.resumeUnistylesTraffic();
|
87
87
|
}
|
88
88
|
|
89
|
+
void core::UnistylesRegistry::removeDuplicatedUnistyles(jsi::Runtime& rt, const ShadowNodeFamily *shadowNodeFamily, std::vector<core::Unistyle::Shared>& unistyles) {
|
90
|
+
auto targetFamilyUnistyles = this->_shadowRegistry[&rt][shadowNodeFamily];
|
91
|
+
|
92
|
+
unistyles.erase(
|
93
|
+
std::remove_if(
|
94
|
+
unistyles.begin(),
|
95
|
+
unistyles.end(),
|
96
|
+
[&targetFamilyUnistyles](const core::Unistyle::Shared& unistyle) {
|
97
|
+
return std::any_of(
|
98
|
+
targetFamilyUnistyles.begin(),
|
99
|
+
targetFamilyUnistyles.end(),
|
100
|
+
[&unistyle](const std::shared_ptr<core::UnistyleData>& data) {
|
101
|
+
return data->unistyle == unistyle;
|
102
|
+
}
|
103
|
+
);
|
104
|
+
}
|
105
|
+
),
|
106
|
+
unistyles.end()
|
107
|
+
);
|
108
|
+
}
|
109
|
+
|
89
110
|
void core::UnistylesRegistry::unlinkShadowNodeWithUnistyles(jsi::Runtime& rt, const ShadowNodeFamily* shadowNodeFamily) {
|
90
111
|
this->_shadowRegistry[&rt].erase(shadowNodeFamily);
|
91
112
|
this->trafficController.removeShadowNode(shadowNodeFamily);
|
@@ -159,7 +180,7 @@ std::vector<std::shared_ptr<core::StyleSheet>> core::UnistylesRegistry::getStyle
|
|
159
180
|
UnistyleDependency::THEME);
|
160
181
|
auto themeDidChange = themeDidChangeIt != unistylesDependencies.end();
|
161
182
|
auto runtimeDidChange = (themeDidChange && unistylesDependencies.size() > 1) || unistylesDependencies.size() > 0;
|
162
|
-
|
183
|
+
|
163
184
|
// if nothing changed, skip further lookup
|
164
185
|
if (!themeDidChange && !runtimeDidChange) {
|
165
186
|
return stylesheetsToRefresh;
|
@@ -173,7 +194,7 @@ std::vector<std::shared_ptr<core::StyleSheet>> core::UnistylesRegistry::getStyle
|
|
173
194
|
if (styleSheet->type == StyleSheetType::ThemableWithMiniRuntime) {
|
174
195
|
for (const auto& unistylePair: styleSheet->unistyles) {
|
175
196
|
auto& [_, unistyle] = unistylePair;
|
176
|
-
|
197
|
+
|
177
198
|
bool hasAnyOfDependencies = std::any_of(
|
178
199
|
unistyle->dependencies.begin(),
|
179
200
|
unistyle->dependencies.end(),
|
@@ -181,10 +202,10 @@ std::vector<std::shared_ptr<core::StyleSheet>> core::UnistylesRegistry::getStyle
|
|
181
202
|
return std::find(unistylesDependencies.begin(), unistylesDependencies.end(), dep) != unistylesDependencies.end();
|
182
203
|
}
|
183
204
|
);
|
184
|
-
|
205
|
+
|
185
206
|
if (hasAnyOfDependencies) {
|
186
207
|
stylesheetsToRefresh.emplace_back(styleSheet);
|
187
|
-
|
208
|
+
|
188
209
|
return;
|
189
210
|
}
|
190
211
|
}
|
@@ -198,18 +219,26 @@ std::vector<std::shared_ptr<core::StyleSheet>> core::UnistylesRegistry::getStyle
|
|
198
219
|
return stylesheetsToRefresh;
|
199
220
|
}
|
200
221
|
|
201
|
-
|
202
|
-
|
222
|
+
core::Unistyle::Shared core::UnistylesRegistry::getUnistyleById(jsi::Runtime& rt, std::string unistyleID) {
|
223
|
+
for (auto& pair: this->_styleSheetRegistry[&rt]) {
|
224
|
+
auto [_, stylesheet] = pair;
|
225
|
+
|
226
|
+
for (auto unistylePair: stylesheet->unistyles) {
|
227
|
+
auto [_, unistyle] = unistylePair;
|
228
|
+
|
229
|
+
if (unistyle->unid == unistyleID) {
|
230
|
+
return unistyle;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
return nullptr;
|
203
236
|
}
|
204
237
|
|
205
238
|
const std::optional<std::string> core::UnistylesRegistry::getScopedTheme() {
|
206
239
|
return this->_scopedTheme;
|
207
240
|
}
|
208
241
|
|
209
|
-
void core::UnistylesRegistry::setScopedVariants(core::Variants&& variants) {
|
210
|
-
this->_scopedVariants = std::move(variants);
|
211
|
-
}
|
212
|
-
|
213
242
|
void core::UnistylesRegistry::setScopedTheme(std::optional<std::string> themeName) {
|
214
243
|
this->_scopedTheme = std::move(themeName);
|
215
244
|
}
|
@@ -27,6 +27,8 @@ struct UnistylesRegistry: public StyleSheetRegistry {
|
|
27
27
|
|
28
28
|
UnistylesRegistry(const UnistylesRegistry&) = delete;
|
29
29
|
UnistylesRegistry(const UnistylesRegistry&&) = delete;
|
30
|
+
|
31
|
+
bool shouldUsePointsForBreakpoints = false;
|
30
32
|
|
31
33
|
void registerTheme(jsi::Runtime& rt, std::string name, jsi::Value& theme);
|
32
34
|
void registerBreakpoints(jsi::Runtime& rt, std::vector<std::pair<std::string, double>>& sortedBreakpoints);
|
@@ -43,15 +45,14 @@ struct UnistylesRegistry: public StyleSheetRegistry {
|
|
43
45
|
DependencyMap buildDependencyMap(jsi::Runtime& rt, std::vector<UnistyleDependency>& deps);
|
44
46
|
void shadowLeafUpdateFromUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle, jsi::Value& maybePressableId);
|
45
47
|
shadow::ShadowTrafficController trafficController{};
|
46
|
-
const core::Variants& getScopedVariants();
|
47
48
|
const std::optional<std::string> getScopedTheme();
|
48
|
-
void
|
49
|
+
void removeDuplicatedUnistyles(jsi::Runtime& rt, const ShadowNodeFamily* shadowNodeFamily, std::vector<core::Unistyle::Shared>& unistyles);
|
49
50
|
void setScopedTheme(std::optional<std::string> themeName);
|
51
|
+
core::Unistyle::Shared getUnistyleById(jsi::Runtime& rt, std::string unistyleID);
|
50
52
|
|
51
53
|
private:
|
52
54
|
UnistylesRegistry() = default;
|
53
|
-
|
54
|
-
core::Variants _scopedVariants{};
|
55
|
+
|
55
56
|
std::optional<std::string> _scopedTheme{};
|
56
57
|
std::unordered_map<jsi::Runtime*, UnistylesState> _states{};
|
57
58
|
std::unordered_map<jsi::Runtime*, std::unordered_map<int, std::shared_ptr<core::StyleSheet>>> _styleSheetRegistry{};
|
@@ -1,13 +1,13 @@
|
|
1
1
|
#include "HybridNavigationBar.h"
|
2
2
|
|
3
3
|
void HybridNavigationBar::setHidden(bool isHidden) {
|
4
|
-
this->_nativePlatform
|
4
|
+
this->_nativePlatform->setNavigationBarHidden(isHidden);
|
5
5
|
};
|
6
6
|
|
7
7
|
double HybridNavigationBar::getWidth() {
|
8
|
-
return this->_nativePlatform
|
8
|
+
return this->_nativePlatform->getNavigationBarDimensions().width;
|
9
9
|
}
|
10
10
|
|
11
11
|
double HybridNavigationBar::getHeight() {
|
12
|
-
return this->_nativePlatform
|
12
|
+
return this->_nativePlatform->getNavigationBarDimensions().height;
|
13
13
|
}
|
@@ -7,12 +7,12 @@
|
|
7
7
|
using namespace margelo::nitro::unistyles;
|
8
8
|
|
9
9
|
struct HybridNavigationBar: public HybridUnistylesNavigationBarSpec {
|
10
|
-
HybridNavigationBar(
|
10
|
+
HybridNavigationBar(std::shared_ptr<HybridNativePlatformSpec> nativePlatform): HybridObject(TAG), _nativePlatform{nativePlatform} {}
|
11
11
|
|
12
12
|
void setHidden(bool isHidden) override;
|
13
13
|
double getWidth() override;
|
14
14
|
double getHeight() override;
|
15
15
|
|
16
16
|
private:
|
17
|
-
|
17
|
+
std::shared_ptr<HybridNativePlatformSpec> _nativePlatform;
|
18
18
|
};
|
@@ -7,30 +7,38 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
|
|
7
7
|
helpers::assertThat(rt, count == 2, "Unistyles: Invalid babel transform 'ShadowRegistry link' expected 2 arguments.");
|
8
8
|
|
9
9
|
ShadowNode::Shared shadowNodeWrapper = shadowNodeFromValue(rt, args[0]);
|
10
|
+
|
10
11
|
std::vector<core::Unistyle::Shared> unistyleWrappers = core::unistyleFromValue(rt, args[1]);
|
11
12
|
std::vector<std::vector<folly::dynamic>> arguments;
|
12
13
|
auto& registry = core::UnistylesRegistry::get();
|
13
14
|
|
14
|
-
for
|
15
|
-
|
16
|
-
auto rawStyle = args[1].asObject(rt).asArray(rt).getValueAtIndex(rt, i);
|
17
|
-
|
18
|
-
helpers::assertThat(rt, rawStyle.isObject(), "Unistyles: Dynamic function is not bound!");
|
19
|
-
|
20
|
-
auto maybeSecrets = rawStyle.getObject(rt).getProperty(rt, helpers::SECRETS.c_str());
|
15
|
+
// this is special case for Animated, and prevents appending same unistyles to node
|
16
|
+
registry.removeDuplicatedUnistyles(rt, &shadowNodeWrapper->getFamily(), unistyleWrappers);
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
arguments.push_back(helpers::parseDynamicFunctionArguments(rt, secrets.asObject(rt).asArray(rt)));
|
18
|
+
if (unistyleWrappers.empty()) {
|
19
|
+
return jsi::Value::undefined();
|
20
|
+
}
|
27
21
|
|
28
|
-
|
22
|
+
for (size_t i = 0; i < unistyleWrappers.size(); i++) {
|
23
|
+
if (unistyleWrappers[i]->type == core::UnistyleType::DynamicFunction) {
|
24
|
+
try {
|
25
|
+
auto rawStyle = args[1].asObject(rt).asArray(rt).getValueAtIndex(rt, i);
|
26
|
+
auto rawStyleObj = rawStyle.getObject(rt);
|
27
|
+
auto unistyleHashKeys = core::getUnistylesHashKeys(rt, rawStyleObj);
|
28
|
+
auto secrets = rawStyleObj.getProperty(rt, unistyleHashKeys.at(0).c_str()).asObject(rt);
|
29
|
+
auto secretArguments = secrets.getProperty(rt, helpers::ARGUMENTS.c_str()).asObject(rt).asArray(rt);
|
30
|
+
|
31
|
+
arguments.push_back(helpers::parseDynamicFunctionArguments(rt, secretArguments));
|
32
|
+
|
33
|
+
continue;
|
34
|
+
} catch (...) {
|
35
|
+
arguments.push_back({});
|
36
|
+
}
|
29
37
|
}
|
30
38
|
|
31
39
|
arguments.push_back({});
|
32
40
|
}
|
33
|
-
|
41
|
+
|
34
42
|
auto scopedTheme = registry.getScopedTheme();
|
35
43
|
|
36
44
|
// check if scope theme exists
|
@@ -47,9 +55,23 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
|
|
47
55
|
// create unistyleData based on wrappers
|
48
56
|
for (size_t i = 0; i < unistyleWrappers.size(); i++) {
|
49
57
|
core::Unistyle::Shared& unistyle = unistyleWrappers[i];
|
58
|
+
auto rawStyle = args[1].asObject(rt).asArray(rt).getValueAtIndex(rt, i);
|
59
|
+
auto rawStyleObj = rawStyle.getObject(rt);
|
60
|
+
auto unistyleHashKeys = core::getUnistylesHashKeys(rt, rawStyleObj);
|
61
|
+
core::Variants variants{};
|
62
|
+
|
63
|
+
if (unistyleHashKeys.size() == 1) {
|
64
|
+
auto secrets = rawStyleObj.getProperty(rt, unistyleHashKeys.at(0).c_str()).asObject(rt);
|
65
|
+
auto hasVariants = secrets.hasProperty(rt, helpers::STYLESHEET_VARIANTS.c_str());
|
66
|
+
|
67
|
+
if (hasVariants) {
|
68
|
+
variants = helpers::variantsToPairs(rt, secrets.getProperty(rt, helpers::STYLESHEET_VARIANTS.c_str()).asObject(rt));
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
50
72
|
std::shared_ptr<core::UnistyleData> unistyleData = std::make_shared<core::UnistyleData>(
|
51
73
|
unistyle,
|
52
|
-
|
74
|
+
variants,
|
53
75
|
arguments[i],
|
54
76
|
scopedTheme
|
55
77
|
);
|
@@ -62,9 +84,6 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
|
|
62
84
|
|
63
85
|
// if so we need to force update
|
64
86
|
parser.rebuildUnistyleWithScopedTheme(rt, parsedStyleSheet, unistyleData);
|
65
|
-
} else {
|
66
|
-
// for other styles, not scoped to theme we need to compute variants value
|
67
|
-
parser.rebuildUnistyleWithVariants(rt, unistyleData);
|
68
87
|
}
|
69
88
|
|
70
89
|
unistylesData.emplace_back(unistyleData);
|
@@ -91,25 +110,9 @@ jsi::Value HybridShadowRegistry::unlink(jsi::Runtime &rt, const jsi::Value &this
|
|
91
110
|
return jsi::Value::undefined();
|
92
111
|
}
|
93
112
|
|
94
|
-
jsi::Value HybridShadowRegistry::selectVariants(jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
95
|
-
helpers::assertThat(rt, count == 1, "Unistyles: Invalid babel transform 'ShadowRegistry selectVariants' expected 1 arguments.");
|
96
|
-
|
97
|
-
auto& registry = core::UnistylesRegistry::get();
|
98
|
-
|
99
|
-
if (args[0].isUndefined()) {
|
100
|
-
registry.setScopedVariants({});
|
101
|
-
}
|
102
|
-
|
103
|
-
if (args[0].isObject()) {
|
104
|
-
registry.setScopedVariants(helpers::variantsToPairs(rt, args[0].asObject(rt)));
|
105
|
-
}
|
106
|
-
|
107
|
-
return jsi::Value::undefined();
|
108
|
-
}
|
109
|
-
|
110
113
|
jsi::Value HybridShadowRegistry::setScopedTheme(jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
111
114
|
helpers::assertThat(rt, count == 1, "Unistyles: setScopedTheme expected 1 argument.");
|
112
|
-
|
115
|
+
|
113
116
|
auto& registry = core::UnistylesRegistry::get();
|
114
117
|
|
115
118
|
if (args[0].isUndefined()) {
|
@@ -127,17 +130,8 @@ jsi::Value HybridShadowRegistry::setScopedTheme(jsi::Runtime &rt, const jsi::Val
|
|
127
130
|
jsi::Value HybridShadowRegistry::getScopedTheme(jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
128
131
|
auto& registry = core::UnistylesRegistry::get();
|
129
132
|
auto maybeScopedTheme = registry.getScopedTheme();
|
130
|
-
|
133
|
+
|
131
134
|
return maybeScopedTheme.has_value()
|
132
135
|
? jsi::String::createFromUtf8(rt, maybeScopedTheme.value())
|
133
136
|
: jsi::Value::undefined();
|
134
137
|
}
|
135
|
-
|
136
|
-
jsi::Value HybridShadowRegistry::getVariants(jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
137
|
-
auto& registry = core::UnistylesRegistry::get();
|
138
|
-
auto maybeScopedVariants = registry.getScopedVariants();
|
139
|
-
|
140
|
-
return maybeScopedVariants.size() > 0
|
141
|
-
? helpers::variantsToValue(rt, maybeScopedVariants)
|
142
|
-
: jsi::Value::undefined();
|
143
|
-
}
|
@@ -20,10 +20,6 @@ struct HybridShadowRegistry: public HybridUnistylesShadowRegistrySpec {
|
|
20
20
|
const jsi::Value& thisValue,
|
21
21
|
const jsi::Value* args,
|
22
22
|
size_t count);
|
23
|
-
jsi::Value selectVariants(jsi::Runtime& rt,
|
24
|
-
const jsi::Value& thisValue,
|
25
|
-
const jsi::Value* args,
|
26
|
-
size_t count);
|
27
23
|
jsi::Value setScopedTheme(jsi::Runtime& rt,
|
28
24
|
const jsi::Value& thisValue,
|
29
25
|
const jsi::Value* args,
|
@@ -32,10 +28,6 @@ struct HybridShadowRegistry: public HybridUnistylesShadowRegistrySpec {
|
|
32
28
|
const jsi::Value& thisValue,
|
33
29
|
const jsi::Value* args,
|
34
30
|
size_t count);
|
35
|
-
jsi::Value getVariants(jsi::Runtime& rt,
|
36
|
-
const jsi::Value& thisValue,
|
37
|
-
const jsi::Value* args,
|
38
|
-
size_t count);
|
39
31
|
|
40
32
|
void loadHybridMethods() override {
|
41
33
|
HybridUnistylesShadowRegistrySpec::loadHybridMethods();
|
@@ -43,10 +35,8 @@ struct HybridShadowRegistry: public HybridUnistylesShadowRegistrySpec {
|
|
43
35
|
registerHybrids(this, [](Prototype& prototype) {
|
44
36
|
prototype.registerRawHybridMethod("link", 2, &HybridShadowRegistry::link);
|
45
37
|
prototype.registerRawHybridMethod("unlink", 1, &HybridShadowRegistry::unlink);
|
46
|
-
prototype.registerRawHybridMethod("selectVariants", 1, &HybridShadowRegistry::selectVariants);
|
47
38
|
prototype.registerRawHybridMethod("setScopedTheme", 1, &HybridShadowRegistry::setScopedTheme);
|
48
39
|
prototype.registerRawHybridMethod("getScopedTheme", 0, &HybridShadowRegistry::getScopedTheme);
|
49
|
-
prototype.registerRawHybridMethod("getVariants", 0, &HybridShadowRegistry::getVariants);
|
50
40
|
});
|
51
41
|
};
|
52
42
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
#include "HybridStatusBar.h"
|
2
2
|
|
3
3
|
double HybridStatusBar::getWidth() {
|
4
|
-
return this->_nativePlatform
|
4
|
+
return this->_nativePlatform->getStatusBarDimensions().width;
|
5
5
|
}
|
6
6
|
|
7
7
|
double HybridStatusBar::getHeight() {
|
8
|
-
return this->_nativePlatform
|
8
|
+
return this->_nativePlatform->getStatusBarDimensions().height;
|
9
9
|
}
|
10
10
|
|
11
11
|
void HybridStatusBar::setHidden(bool isHidden) {
|
12
|
-
|
12
|
+
this->_nativePlatform->setStatusBarHidden(isHidden);
|
13
13
|
}
|
@@ -7,12 +7,12 @@
|
|
7
7
|
using namespace margelo::nitro::unistyles;
|
8
8
|
|
9
9
|
struct HybridStatusBar: public HybridUnistylesStatusBarSpec {
|
10
|
-
HybridStatusBar(
|
10
|
+
HybridStatusBar(std::shared_ptr<HybridNativePlatformSpec> nativePlatform): HybridObject(TAG), _nativePlatform{nativePlatform} {}
|
11
11
|
|
12
12
|
double getWidth() override;
|
13
13
|
double getHeight() override;
|
14
14
|
void setHidden(bool isHidden) override;
|
15
15
|
|
16
16
|
private:
|
17
|
-
|
17
|
+
std::shared_ptr<HybridNativePlatformSpec> _nativePlatform;
|
18
18
|
};
|