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/src/web/state.ts
CHANGED
@@ -2,17 +2,19 @@ import type { UnistylesTheme } from '../types'
|
|
2
2
|
import type { UnistylesConfig } from '../specs/StyleSheet'
|
3
3
|
import type { AppBreakpoint, AppTheme, AppThemeName } from '../specs/types'
|
4
4
|
import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
|
5
|
-
import {
|
6
|
-
import { error, isServer, schemeToTheme } from './utils'
|
7
|
-
import { UnistylesListener } from './listener'
|
5
|
+
import { error, hyphenate, isServer, schemeToTheme } from './utils'
|
8
6
|
import { UnistyleDependency } from '../specs/NativePlatform'
|
9
7
|
import type { UnionToIntersection } from '../types'
|
8
|
+
import type { UnistylesServices } from './types'
|
10
9
|
|
11
10
|
type UnistylesSettings = Partial<UnionToIntersection<Required<UnistylesConfig>['settings']>>
|
12
11
|
|
13
|
-
class
|
12
|
+
export class UnistylesState {
|
13
|
+
isInitialized = false
|
14
14
|
themes = new Map<string, UnistylesTheme>()
|
15
|
+
cssThemes = new Map<string, UnistylesTheme>()
|
15
16
|
themeName?: AppThemeName
|
17
|
+
CSSVars = true
|
16
18
|
|
17
19
|
private matchingBreakpoints = new Map<string, boolean>()
|
18
20
|
|
@@ -28,8 +30,15 @@ class UnistylesStateBuilder {
|
|
28
30
|
|
29
31
|
hasAdaptiveThemes = false
|
30
32
|
|
33
|
+
constructor(private services: UnistylesServices) {}
|
34
|
+
|
31
35
|
init = (config: UnistylesConfig) => {
|
32
|
-
this.
|
36
|
+
if (this.isInitialized) {
|
37
|
+
return
|
38
|
+
}
|
39
|
+
|
40
|
+
this.isInitialized = true
|
41
|
+
this.initThemes(config.themes, config.settings?.CSSVars)
|
33
42
|
this.initBreakpoints(config.breakpoints)
|
34
43
|
|
35
44
|
if (config.settings) {
|
@@ -40,12 +49,40 @@ class UnistylesStateBuilder {
|
|
40
49
|
return
|
41
50
|
}
|
42
51
|
|
43
|
-
|
52
|
+
// Ensure we have a themeName before calling this
|
53
|
+
// classList.add throws a "SyntaxError" DOMException if one of the arguments is an empty string.
|
54
|
+
if (!this.hasAdaptiveThemes && this.CSSVars && this.themeName) {
|
55
|
+
document.querySelector(':root')?.classList.add(this.themeName)
|
56
|
+
}
|
57
|
+
|
58
|
+
this.services.listener.initListeners()
|
44
59
|
}
|
45
60
|
|
46
|
-
private initThemes = (themes = {} as UnistylesThemes) => {
|
61
|
+
private initThemes = (themes = {} as UnistylesThemes, CSSVars = true) => {
|
62
|
+
this.CSSVars = CSSVars
|
63
|
+
|
47
64
|
Object.entries(themes).forEach(([themeName, theme]) => {
|
48
65
|
this.themes.set(themeName, theme as AppTheme)
|
66
|
+
|
67
|
+
if (CSSVars) {
|
68
|
+
this.services.registry.css.addTheme(themeName, theme)
|
69
|
+
|
70
|
+
const convertTheme = (key: string, value: any, prev = '-'): [string, any] => {
|
71
|
+
if (typeof value === 'object' && value !== null) {
|
72
|
+
return [key, Object.fromEntries(Object.entries(value).map(([nestedKey, nestedValue]) => convertTheme(nestedKey, nestedValue, `${prev}-${key}`)))]
|
73
|
+
}
|
74
|
+
|
75
|
+
if (typeof value === 'string') {
|
76
|
+
return [key, `var(${prev}-${hyphenate(key)})`]
|
77
|
+
}
|
78
|
+
|
79
|
+
return [key, value]
|
80
|
+
}
|
81
|
+
|
82
|
+
this.cssThemes.set(themeName, Object.fromEntries(Object.entries(theme).map(([key, value]) => {
|
83
|
+
return convertTheme(key, value)
|
84
|
+
})) as UnistylesTheme)
|
85
|
+
}
|
49
86
|
})
|
50
87
|
}
|
51
88
|
|
@@ -62,7 +99,7 @@ class UnistylesStateBuilder {
|
|
62
99
|
throw error(`You're trying to enable adaptiveThemes, but you didn't register both 'light' and 'dark' themes.`)
|
63
100
|
}
|
64
101
|
|
65
|
-
this.themeName = schemeToTheme(
|
102
|
+
this.themeName = schemeToTheme(this.services.runtime.colorScheme) as AppThemeName
|
66
103
|
|
67
104
|
return
|
68
105
|
}
|
@@ -104,10 +141,8 @@ class UnistylesStateBuilder {
|
|
104
141
|
|
105
142
|
mediaQuery.addEventListener('change', event => {
|
106
143
|
this.matchingBreakpoints.set(breakpoint, event.matches)
|
107
|
-
|
144
|
+
this.services.listener.emitChange(UnistyleDependency.Breakpoints)
|
108
145
|
})
|
109
146
|
})
|
110
147
|
}
|
111
148
|
}
|
112
|
-
|
113
|
-
export const UnistylesState = new UnistylesStateBuilder()
|
package/src/web/types.ts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { UnistylesListener } from './listener'
|
2
|
+
import type{ UnistylesRegistry } from './registry'
|
3
|
+
import type{ UnistylesRuntime } from './runtime'
|
4
|
+
import type{ UnistylesShadowRegistry } from './shadowRegistry'
|
5
|
+
import type{ UnistylesState } from './state'
|
6
|
+
|
7
|
+
export type UnistylesServices = {
|
8
|
+
runtime: UnistylesRuntime,
|
9
|
+
registry: UnistylesRegistry,
|
10
|
+
shadowRegistry: UnistylesShadowRegistry,
|
11
|
+
state: UnistylesState,
|
12
|
+
listener: UnistylesListener
|
13
|
+
}
|
package/src/web/utils/common.ts
CHANGED
@@ -5,7 +5,7 @@ export const reduceObject = <TObj extends Record<string, any>, TReducer>(
|
|
5
5
|
|
6
6
|
export const keyInObject = <T extends Record<string, any>>(obj: T, key: PropertyKey): key is keyof T => key in obj
|
7
7
|
|
8
|
-
export const isServer = () => typeof window === 'undefined'
|
8
|
+
export const isServer = () => typeof window === 'undefined' || typeof document === 'undefined'
|
9
9
|
|
10
10
|
export const error = (message: string) => new Error(`Unistyles: ${message}`)
|
11
11
|
|
@@ -32,14 +32,38 @@ export const equal = <T>(a: T, b: T) => {
|
|
32
32
|
return keysA.every(key => Object.is(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key))
|
33
33
|
}
|
34
34
|
|
35
|
-
export const
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
export const hyphenate = (propertyName: string) => propertyName.replace(/[A-Z]/g, (m: string) => `-${m.toLowerCase()}`)
|
36
|
+
|
37
|
+
export const serialize = (obj: string | number | object): string => {
|
38
|
+
if (typeof obj !== 'object') {
|
39
|
+
return String(obj)
|
40
|
+
}
|
39
41
|
|
40
|
-
|
42
|
+
const sortedKeys = Object.keys(obj).sort()
|
43
|
+
const sortedKeyValuePairs = sortedKeys.map(key => `${key}:${serialize(obj[key as keyof typeof obj])}`)
|
41
44
|
|
42
|
-
return `
|
45
|
+
return `{${sortedKeyValuePairs.join(',')}}`
|
43
46
|
}
|
44
47
|
|
45
|
-
|
48
|
+
// Based on https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js
|
49
|
+
const cyrb53 = (data: string, seed = 0) => {
|
50
|
+
let h1 = 0xdeadbeef ^ seed
|
51
|
+
let h2 = 0x41c6ce57 ^ seed
|
52
|
+
|
53
|
+
for (let i = 0, ch: number; i < data.length; i++) {
|
54
|
+
ch = data.charCodeAt(i)
|
55
|
+
h1 = Math.imul(h1 ^ ch, 2654435761)
|
56
|
+
h2 = Math.imul(h2 ^ ch, 1597334677)
|
57
|
+
}
|
58
|
+
|
59
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909)
|
60
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909)
|
61
|
+
|
62
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0)
|
63
|
+
}
|
64
|
+
|
65
|
+
export const generateHash = (value: any) => {
|
66
|
+
const serialized = serialize(value)
|
67
|
+
|
68
|
+
return `unistyles-${cyrb53(serialized).toString(36)}`
|
69
|
+
}
|
@@ -2,8 +2,9 @@ import type { UnistyleDependency } from '../../specs/NativePlatform'
|
|
2
2
|
import { ColorScheme, Orientation } from '../../specs/types'
|
3
3
|
import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet'
|
4
4
|
import { isUnistylesMq, parseMq } from '../../mq'
|
5
|
-
import { UnistylesState } from '../state'
|
6
5
|
import { keyInObject, reduceObject } from './common'
|
6
|
+
import type { UnistylesBreakpoints } from '../../global'
|
7
|
+
import { UnistylesWeb } from '../index'
|
7
8
|
|
8
9
|
export const schemeToTheme = (scheme: ColorScheme) => {
|
9
10
|
switch (scheme) {
|
@@ -18,19 +19,43 @@ export const schemeToTheme = (scheme: ColorScheme) => {
|
|
18
19
|
export type UnistyleSecrets = {
|
19
20
|
__uni__stylesheet: StyleSheetWithSuperPowers<StyleSheet>,
|
20
21
|
__uni__key: string,
|
21
|
-
|
22
|
-
|
22
|
+
__uni__args?: Array<any>,
|
23
|
+
__uni_variants: Record<string, string | boolean | undefined>
|
23
24
|
}
|
24
25
|
|
25
26
|
export const assignSecrets = <T>(object: T, secrets: UnistyleSecrets) => {
|
26
|
-
|
27
|
-
|
27
|
+
const secretsId = Math.random().toString(36).slice(8)
|
28
|
+
|
29
|
+
// @ts-expect-error assign hidden secrets
|
30
|
+
object[`unistyles-${secretsId}`] = {}
|
31
|
+
// @ts-expect-error assign hidden secrets
|
32
|
+
Object.defineProperties(object[`unistyles-${secretsId}`], reduceObject(secrets, secret => ({
|
33
|
+
value: secret,
|
34
|
+
enumerable: false,
|
35
|
+
configurable: true
|
36
|
+
})))
|
28
37
|
|
29
38
|
return object
|
30
39
|
}
|
31
40
|
|
32
41
|
export const extractSecrets = (object: any) => {
|
33
|
-
|
42
|
+
if (!object) {
|
43
|
+
return undefined
|
44
|
+
}
|
45
|
+
|
46
|
+
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles-')) ?? []
|
47
|
+
|
48
|
+
if (!secrets) {
|
49
|
+
return undefined
|
50
|
+
}
|
51
|
+
|
52
|
+
const hiddenSecrets = Object.getOwnPropertyDescriptors(secrets)
|
53
|
+
|
54
|
+
if (Object.keys(hiddenSecrets).length === 0) {
|
55
|
+
return undefined
|
56
|
+
}
|
57
|
+
|
58
|
+
return reduceObject(hiddenSecrets, secret => secret.value)
|
34
59
|
}
|
35
60
|
|
36
61
|
export const removeInlineStyles = (values: UnistylesValues) => {
|
@@ -47,39 +72,35 @@ export const removeInlineStyles = (values: UnistylesValues) => {
|
|
47
72
|
|
48
73
|
export const isInDocument = (element: HTMLElement) => document.body.contains(element)
|
49
74
|
|
50
|
-
export const
|
51
|
-
const [_, px] = query.match(/(\d+)px/) ?? []
|
52
|
-
|
53
|
-
if (!px) {
|
54
|
-
return undefined
|
55
|
-
}
|
56
|
-
|
57
|
-
const value = Number(px)
|
58
|
-
|
59
|
-
return Number.isNaN(value)
|
60
|
-
? undefined
|
61
|
-
: value
|
62
|
-
}
|
63
|
-
|
64
|
-
export const getMediaQuery = (query: string) => {
|
75
|
+
export const getMediaQuery = (query: string, allBreakpoints: Array<string>) => {
|
65
76
|
if (Object.values(Orientation).includes(query as Orientation)) {
|
66
|
-
return
|
77
|
+
return `@media (orientation: ${query})`
|
67
78
|
}
|
68
79
|
|
69
80
|
if (isUnistylesMq(query)) {
|
70
81
|
const { minWidth, maxWidth, minHeight, maxHeight } = parseMq(query)
|
71
82
|
|
72
|
-
|
83
|
+
const queries = [
|
73
84
|
minWidth ? `(min-width: ${minWidth}px)` : undefined,
|
74
85
|
maxWidth ? `(max-width: ${maxWidth}px)` : undefined,
|
75
86
|
minHeight ? `(min-height: ${minHeight}px)` : undefined,
|
76
87
|
maxHeight ? `(max-height: ${maxHeight}px)` : undefined
|
77
88
|
].filter(Boolean).join(' and ')
|
89
|
+
return `@media ${queries}`
|
78
90
|
}
|
79
91
|
|
80
|
-
const
|
92
|
+
const breakpointValue = UnistylesWeb.runtime.breakpoints[query as keyof UnistylesBreakpoints] ?? 0
|
93
|
+
const nextBreakpoint = allBreakpoints
|
94
|
+
.filter((b): b is keyof UnistylesBreakpoints => b in UnistylesWeb.runtime.breakpoints)
|
95
|
+
.map(b => UnistylesWeb.runtime.breakpoints[b] as number)
|
96
|
+
.sort((a, b) => a - b)
|
97
|
+
.find(b => b > breakpointValue)
|
98
|
+
const queries = [
|
99
|
+
`(min-width: ${breakpointValue}px)`,
|
100
|
+
nextBreakpoint ? `(max-width: ${nextBreakpoint - 1}px)` : undefined,
|
101
|
+
].filter(Boolean).join(' and ')
|
81
102
|
|
82
|
-
|
103
|
+
return `@media ${queries}`
|
83
104
|
}
|
84
105
|
|
85
106
|
export const extractUnistyleDependencies = (value: any) => {
|
package/src/web/variants.ts
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
import type {
|
1
|
+
import type { UnistylesValues } from '../types'
|
2
2
|
import { deepMergeObjects } from '../utils'
|
3
|
+
import { keyInObject } from './utils'
|
3
4
|
|
4
5
|
type StylesWithVariants = {
|
5
|
-
variants: Record<string,
|
6
|
-
compoundVariants?: Array<Record<string,
|
6
|
+
variants: Record<string, string | boolean | undefined>,
|
7
|
+
compoundVariants?: Array<Record<string, string | boolean | undefined> & {
|
7
8
|
styles: Record<string, any>
|
8
9
|
}>
|
9
10
|
}
|
10
|
-
const hasVariants =
|
11
|
+
const hasVariants = (value: any): value is StylesWithVariants => {
|
12
|
+
return keyInObject(value, 'variants')
|
13
|
+
}
|
11
14
|
|
12
|
-
export const getVariants = (styles:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
.map(([key, { variants, compoundVariants = [] }]) => {
|
17
|
-
const variantStyles = Object.entries(variants).flatMap(([variant, styles]) => {
|
18
|
-
const selectedVariant = selectedVariants[variant]
|
19
|
-
const selectedVariantStyles = styles[selectedVariant] ?? styles.default
|
15
|
+
export const getVariants = (styles: UnistylesValues, selectedVariants: Record<string, any>) => {
|
16
|
+
if (!hasVariants(styles)) {
|
17
|
+
return {}
|
18
|
+
}
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
const variantStyles = Object.entries(styles.variants).flatMap(([variant, styles]) => {
|
21
|
+
const selectedVariant = selectedVariants[variant]
|
22
|
+
const selectedVariantStyles = styles[selectedVariant] ?? styles.default
|
24
23
|
|
25
|
-
|
26
|
-
|
24
|
+
if (!selectedVariantStyles) {
|
25
|
+
return []
|
26
|
+
}
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
return selectedVariantStyles
|
29
|
+
})
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
}
|
31
|
+
const compoundVariantStyles = styles.compoundVariants?.flatMap(compoundVariant => {
|
32
|
+
const { styles, ...conditions } = compoundVariant
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
if (Object.entries(conditions).some(([variant, value]) => String(selectedVariants[variant]) !== String(value))) {
|
35
|
+
return []
|
36
|
+
}
|
37
37
|
|
38
|
-
|
38
|
+
return styles
|
39
|
+
}) ?? []
|
39
40
|
|
40
|
-
|
41
|
-
})
|
41
|
+
return deepMergeObjects(...variantStyles, ...compoundVariantStyles)
|
42
42
|
}
|
package/cxx/core/HostStyle.cpp
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
#include "HostStyle.h"
|
2
|
-
|
3
|
-
using namespace margelo::nitro::unistyles::core;
|
4
|
-
using namespace margelo::nitro::unistyles::parser;
|
5
|
-
using namespace facebook;
|
6
|
-
|
7
|
-
std::vector<jsi::PropNameID> HostStyle::getPropertyNames(jsi::Runtime& rt) {
|
8
|
-
auto propertyNames = std::vector<jsi::PropNameID> {};
|
9
|
-
|
10
|
-
propertyNames.reserve(8);
|
11
|
-
|
12
|
-
for (const auto& pair : this->_styleSheet->unistyles) {
|
13
|
-
propertyNames.emplace_back(jsi::PropNameID::forUtf8(rt, pair.first));
|
14
|
-
}
|
15
|
-
|
16
|
-
return propertyNames;
|
17
|
-
}
|
18
|
-
|
19
|
-
jsi::Value HostStyle::get(jsi::Runtime& rt, const jsi::PropNameID& propNameId) {
|
20
|
-
auto propertyName = propNameId.utf8(rt);
|
21
|
-
|
22
|
-
if (propertyName == helpers::UNISTYLES_ID) {
|
23
|
-
return jsi::Value(this->_styleSheet->tag);
|
24
|
-
}
|
25
|
-
|
26
|
-
if (propertyName == helpers::ADD_VARIANTS_FN) {
|
27
|
-
return this->createAddVariantsProxyFunction(rt);
|
28
|
-
}
|
29
|
-
|
30
|
-
if (this->_styleSheet->unistyles.contains(propertyName)) {
|
31
|
-
if (this->_styleCache.contains(propertyName)) {
|
32
|
-
return jsi::Value(rt, this->_styleCache[propertyName]);
|
33
|
-
}
|
34
|
-
|
35
|
-
this->_styleCache[propertyName] = valueFromUnistyle(
|
36
|
-
rt,
|
37
|
-
this->_unistylesRuntime,
|
38
|
-
this->_styleSheet->unistyles[propertyName],
|
39
|
-
this->_variants
|
40
|
-
);
|
41
|
-
|
42
|
-
return jsi::Value(rt, this->_styleCache[propertyName]);
|
43
|
-
}
|
44
|
-
|
45
|
-
if (propertyName == helpers::STYLE_VARIANTS) {
|
46
|
-
return helpers::variantsToValue(rt, this->_variants);
|
47
|
-
}
|
48
|
-
|
49
|
-
return jsi::Value::undefined();
|
50
|
-
}
|
51
|
-
|
52
|
-
jsi::Function HostStyle::createAddVariantsProxyFunction(jsi::Runtime& rt) {
|
53
|
-
auto useVariantsFnName = jsi::PropNameID::forUtf8(rt, helpers::ADD_VARIANTS_FN);
|
54
|
-
|
55
|
-
return jsi::Function::createFromHostFunction(rt, useVariantsFnName, 1, [&](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count){
|
56
|
-
helpers::assertThat(rt, count == 1, "Unistyles: useVariants expected to be called with one argument.");
|
57
|
-
helpers::assertThat(rt, arguments[0].isObject(), "Unistyles: useVariants expected to be called with object.");
|
58
|
-
|
59
|
-
auto pairs = helpers::variantsToPairs(rt, arguments[0].asObject(rt));
|
60
|
-
|
61
|
-
if (this->hasVariantsSet && pairs == this->_variants) {
|
62
|
-
return jsi::Value::undefined();
|
63
|
-
}
|
64
|
-
|
65
|
-
// new variants or empty variants
|
66
|
-
this->hasVariantsSet = true;
|
67
|
-
this->_variants = pairs;
|
68
|
-
|
69
|
-
return jsi::Value::undefined();
|
70
|
-
});
|
71
|
-
}
|
72
|
-
|
73
|
-
void HostStyle::set(jsi::Runtime& rt, const jsi::PropNameID& propNameId, const jsi::Value& value) {}
|
package/cxx/core/HostStyle.h
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include <jsi/jsi.h>
|
4
|
-
#include "StyleSheet.h"
|
5
|
-
#include "Constants.h"
|
6
|
-
#include "Parser.h"
|
7
|
-
#include "UnistyleWrapper.h"
|
8
|
-
#include "HybridUnistylesRuntime.h"
|
9
|
-
|
10
|
-
namespace margelo::nitro::unistyles::core {
|
11
|
-
|
12
|
-
using Variants = std::vector<std::pair<std::string, std::string>>;
|
13
|
-
|
14
|
-
struct JSI_EXPORT HostStyle : public jsi::HostObject {
|
15
|
-
HostStyle(std::shared_ptr<StyleSheet> styleSheet, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime)
|
16
|
-
: _styleSheet{styleSheet}, _unistylesRuntime{unistylesRuntime} {};
|
17
|
-
|
18
|
-
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& rt);
|
19
|
-
jsi::Value get(jsi::Runtime& rt, const jsi::PropNameID& propNameId);
|
20
|
-
void set(jsi::Runtime& rt, const jsi::PropNameID& propNameId, const jsi::Value& value);
|
21
|
-
jsi::Function createAddVariantsProxyFunction(jsi::Runtime& rt);
|
22
|
-
|
23
|
-
private:
|
24
|
-
// to additionally distinguish between empty variants
|
25
|
-
// that are set at the beginning
|
26
|
-
bool hasVariantsSet = false;
|
27
|
-
|
28
|
-
std::shared_ptr<StyleSheet> _styleSheet;
|
29
|
-
std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
|
30
|
-
std::vector<std::pair<std::string, std::string>> _variants{};
|
31
|
-
std::unordered_map<std::string, jsi::Value> _styleCache{};
|
32
|
-
};
|
33
|
-
|
34
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Variants = void 0;
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
8
|
-
var _specs = require("../specs");
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
10
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
12
|
-
const Apply = ({
|
13
|
-
variants
|
14
|
-
}) => {
|
15
|
-
_specs.UnistylesShadowRegistry.selectVariants(variants);
|
16
|
-
(0, _react.useLayoutEffect)(() => {
|
17
|
-
_specs.UnistylesShadowRegistry.selectVariants(variants);
|
18
|
-
});
|
19
|
-
return null;
|
20
|
-
};
|
21
|
-
const Variants = ({
|
22
|
-
variants,
|
23
|
-
children
|
24
|
-
}) => {
|
25
|
-
const previousScopedVariants = _specs.UnistylesShadowRegistry.getVariants();
|
26
|
-
const mappedChildren = [/*#__PURE__*/(0, _jsxRuntime.jsx)(Apply, {
|
27
|
-
variants: variants
|
28
|
-
}, 'add'), children, /*#__PURE__*/(0, _jsxRuntime.jsx)(Apply, {
|
29
|
-
variants: previousScopedVariants
|
30
|
-
}, 'remove')];
|
31
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
|
32
|
-
children: mappedChildren
|
33
|
-
});
|
34
|
-
};
|
35
|
-
exports.Variants = Variants;
|
36
|
-
//# sourceMappingURL=Variants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Apply","variants","UnistylesShadowRegistry","selectVariants","useLayoutEffect","Variants","children","previousScopedVariants","getVariants","mappedChildren","jsx","Fragment","exports"],"sourceRoot":"../../../src","sources":["components/Variants.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAkD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAA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;EAAEK;AAAS,CAAC,KAAK;EAChH,MAAMC,sBAAsB,GAAGL,8BAAuB,CAACM,WAAW,CAAC,CAAC;EACpE,MAAMC,cAAc,GAAG,cACnB,IAAA9B,WAAA,CAAA+B,GAAA,EAACV,KAAK;IAAWC,QAAQ,EAAEA;EAAS,GAAzB,KAA2B,CAAC,EACvCK,QAAQ,eACR,IAAA3B,WAAA,CAAA+B,GAAA,EAACV,KAAK;IAAcC,QAAQ,EAAEM;EAAuB,GAA1C,QAA4C,CAAC,CAC3D;EAED,oBACI,IAAA5B,WAAA,CAAA+B,GAAA,EAACnC,MAAA,CAAAW,OAAK,CAACyB,QAAQ;IAAAL,QAAA,EACVG;EAAc,CACH,CAAC;AAEzB,CAAC;AAAAG,OAAA,CAAAP,QAAA,GAAAA,QAAA","ignoreList":[]}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.createUnistylesComponent = void 0;
|
7
|
-
var _withUnistyles = require("./withUnistyles");
|
8
|
-
const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
|
9
|
-
/**
|
10
|
-
* @deprecated Use withUnistyles instead
|
11
|
-
*/
|
12
|
-
const createUnistylesComponent = (Component, mappings) => {
|
13
|
-
return (0, _withUnistyles.withUnistyles)(Component, mappings);
|
14
|
-
};
|
15
|
-
exports.createUnistylesComponent = createUnistylesComponent;
|
16
|
-
//# sourceMappingURL=createUnistylesComponent.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_withUnistyles","require","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","withUnistyles","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEA,MAAMC,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAIzE;AACA;AACA;AACO,MAAMC,wBAAwB,GAAGA,CAAmGC,SAAgC,EAAEC,QAA+C,KAAK;EAC7N,OAAO,IAAAC,4BAAa,EAACF,SAAS,EAASC,QAAe,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAJ,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_specs","_NativePlatform","getMiniRuntime","UnistylesRuntime","miniRuntime","RTDependencyMap","breakpoint","UnistyleDependency","Breakpoints","colorScheme","ColorScheme","contentSizeCategory","ContentSizeCategory","hasAdaptiveThemes","AdaptiveThemes","insets","Insets","fontScale","FontScale","isLandscape","Orientation","isPortrait","navigationBar","NavigationBar","screen","Dimensions","statusBar","StatusBar","pixelRatio","PixelRatio","themeName","ThemeName","useDependencies","listener","scopedTheme","UnistylesShadowRegistry","getScopedTheme","dependencies","useState","Set","theme","setTheme","getTheme","_","runtimeChanged","useReducer","disposeRef","useRef","reinitListener","current","Array","from","updateTheme","updateRuntime","useEffect","size","mappingsCallback","callback","proxifiedTheme","Proxy","get","target","prop","add","Theme","proxifiedRuntime","addDependencies","newDependencies","dependenciesSize","forEach","dependency","exports"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/useDependencies.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AADA;;AAKA,MAAMG,cAAc,GAAGA,CAAA,KAA4B;EAC/C;EACA,OAAOC,uBAAgB,CAACC,WAAW;AACvC,CAAC;AAED,MAAMC,eAAe,GAAG;EACpBC,UAAU,EAAEC,kCAAkB,CAACC,WAAW;EAC1CC,WAAW,EAAEF,kCAAkB,CAACG,WAAW;EAC3CC,mBAAmB,EAAEJ,kCAAkB,CAACK,mBAAmB;EAC3DC,iBAAiB,EAAEN,kCAAkB,CAACO,cAAc;EACpDC,MAAM,EAAER,kCAAkB,CAACS,MAA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strict";
|
2
|
-
|
3
|
-
import React, { useLayoutEffect } from 'react';
|
4
|
-
import { UnistylesShadowRegistry } from '../specs';
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
-
const Apply = ({
|
7
|
-
variants
|
8
|
-
}) => {
|
9
|
-
UnistylesShadowRegistry.selectVariants(variants);
|
10
|
-
useLayoutEffect(() => {
|
11
|
-
UnistylesShadowRegistry.selectVariants(variants);
|
12
|
-
});
|
13
|
-
return null;
|
14
|
-
};
|
15
|
-
export const Variants = ({
|
16
|
-
variants,
|
17
|
-
children
|
18
|
-
}) => {
|
19
|
-
const previousScopedVariants = UnistylesShadowRegistry.getVariants();
|
20
|
-
const mappedChildren = [/*#__PURE__*/_jsx(Apply, {
|
21
|
-
variants: variants
|
22
|
-
}, 'add'), children, /*#__PURE__*/_jsx(Apply, {
|
23
|
-
variants: previousScopedVariants
|
24
|
-
}, 'remove')];
|
25
|
-
return /*#__PURE__*/_jsx(React.Fragment, {
|
26
|
-
children: mappedChildren
|
27
|
-
});
|
28
|
-
};
|
29
|
-
//# sourceMappingURL=Variants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","useLayoutEffect","UnistylesShadowRegistry","jsx","_jsx","Apply","variants","selectVariants","Variants","children","previousScopedVariants","getVariants","mappedChildren","Fragment"],"sourceRoot":"../../../src","sources":["components/Variants.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAC9C,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMlD,MAAMC,KAA4C,GAAGA,CAAC;EAAEC;AAAS,CAAC,KAAK;EACnEJ,uBAAuB,CAACK,cAAc,CAACD,QAAQ,CAAC;EAEhDL,eAAe,CAAC,MAAM;IAClBC,uBAAuB,CAACK,cAAc,CAACD,QAAQ,CAAC;EACpD,CAAC,CAAC;EAEF,OAAO,IAAI;AACf,CAAC;AACD,OAAO,MAAME,QAAwE,GAAGA,CAAC;EAAEF,QAAQ;EAAEG;AAAS,CAAC,KAAK;EAChH,MAAMC,sBAAsB,GAAGR,uBAAuB,CAACS,WAAW,CAAC,CAAC;EACpE,MAAMC,cAAc,GAAG,cACnBR,IAAA,CAACC,KAAK;IAAWC,QAAQ,EAAEA;EAAS,GAAzB,KAA2B,CAAC,EACvCG,QAAQ,eACRL,IAAA,CAACC,KAAK;IAAcC,QAAQ,EAAEI;EAAuB,GAA1C,QAA4C,CAAC,CAC3D;EAED,oBACIN,IAAA,CAACJ,KAAK,CAACa,QAAQ;IAAAJ,QAAA,EACVG;EAAc,CACH,CAAC;AAEzB,CAAC","ignoreList":[]}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
import { withUnistyles } from './withUnistyles';
|
4
|
-
const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
|
5
|
-
/**
|
6
|
-
* @deprecated Use withUnistyles instead
|
7
|
-
*/
|
8
|
-
export const createUnistylesComponent = (Component, mappings) => {
|
9
|
-
return withUnistyles(Component, mappings);
|
10
|
-
};
|
11
|
-
//# sourceMappingURL=createUnistylesComponent.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["withUnistyles","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;AAEA,SAASA,aAAa,QAAQ,iBAAiB;AAE/C,MAAMC,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAIzE;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAGA,CAAmGC,SAAgC,EAAEC,QAA+C,KAAK;EAC7N,OAAOJ,aAAa,CAACG,SAAS,EAASC,QAAe,CAAC;AAC3D,CAAC","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useReducer","useRef","useState","UnistylesRuntime","UnistylesShadowRegistry","UnistyleDependency","getMiniRuntime","miniRuntime","RTDependencyMap","breakpoint","Breakpoints","colorScheme","ColorScheme","contentSizeCategory","ContentSizeCategory","hasAdaptiveThemes","AdaptiveThemes","insets","Insets","fontScale","FontScale","isLandscape","Orientation","isPortrait","navigationBar","NavigationBar","screen","Dimensions","statusBar","StatusBar","pixelRatio","PixelRatio","themeName","ThemeName","useDependencies","listener","scopedTheme","getScopedTheme","dependencies","Set","theme","setTheme","getTheme","_","runtimeChanged","disposeRef","reinitListener","current","Array","from","updateTheme","updateRuntime","size","mappingsCallback","callback","proxifiedTheme","Proxy","get","target","prop","add","Theme","proxifiedRuntime","addDependencies","newDependencies","dependenciesSize","forEach","dependency"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/useDependencies.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/D,SAASC,gBAAgB,EAAEC,uBAAuB,QAAmC,aAAa;AAClG;AACA,SAASC,kBAAkB,QAAQ,4BAA4B;AAI/D,MAAMC,cAAc,GAAGA,CAAA,KAA4B;EAC/C;EACA,OAAOH,gBAAgB,CAACI,WAAW;AACvC,CAAC;AAED,MAAMC,eAAe,GAAG;EACpBC,UAAU,EAAEJ,kBAAkB,CAACK,WAAW;EAC1CC,WAAW,EAAEN,kBAAkB,CAACO,WAAW;EAC3CC,mBAAmB,EAAER,kBAAkB,CAACS,mBAAmB;EAC3DC,iBAAiB,EAAEV,kBAAkB,CAACW,cAAc;EACpDC,MAAM,EAAEZ,kBAAkB,CAACa,MAAM;EACjCC,SAAS,EAAEd,kBAAkB,CAACe,SAAS;EACvCC,WAAW,EAAEhB,kBAAkB,CAACiB,WAAW;EAC3CC,UAAU,EAAElB,kBAAkB,CAACiB,WAAW;EAC1CE,aAAa,EAAEnB,kBAAkB,CAACoB,aAAa;EAC/CC,MAAM,EAAErB,kBAAkB,CAACsB,UAAU;EACrCC,SAAS,EAAEvB,kBAAkB,CAACwB,SAAS;EAC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E;QACpCiB,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,KAAK;UACnBrB,YAAY,CAACsB,GAAG,CAACvD,kBAAkB,CAACwD,KAAK,CAAC;UAE1C,OAAOH,MAAM,CAACC,IAAI,CAAC;QACvB;MACJ,CAAC,CAAC;MACF,MAAMG,gBAAgB,GAAG,IAAIN,KAAK,CAAClD,cAAc,CAAC,CAAC,EAAE;QACjDmD,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,KAAK;UACnB,IAAIA,IAAI,IAAInD,eAAe,EAAE;YACzB8B,YAAY,CAACsB,GAAG,CAACpD,eAAe,CAACmD,IAAI,CAAiC,CAAC;UAC3E;UAEA,OAAOD,MAAM,CAACC,IAAI,CAAwB;QAC9C;MACJ,CAAC,CAAC;MAEF,OAAOL,QAAQ,CAACC,cAAc,EAAEO,gBAAgB,CAAC;IACrD,CAAC;IACDC,eAAe,EAAGC,eAA0C,IAAK;MAC7D,MAAMC,gBAAgB,GAAG3B,YAAY,CAACc,IAAI;MAE1CY,eAAe,CAACE,OAAO,CAACC,UAAU,IAAI;QAClC7B,YAAY,CAACsB,GAAG,CAACO,UAAU,CAAC;MAChC,CAAC,CAAC;MAEF,IAAIF,gBAAgB,KAAK3B,YAAY,CAACc,IAAI,EAAE;QACxC;MACJ;MAEAN,cAAc,CAAC,CAAC;IACpB;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Variants.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAA;AAG9C,KAAK,YAAY,GAAG;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;CAC1D,CAAA;AAWD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAanF,CAAA"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import type { ComponentType } from 'react';
|
2
|
-
import type { UnistylesTheme } from '../types';
|
3
|
-
declare const SUPPORTED_STYLE_PROPS: readonly ["style", "contentContainerStyle"];
|
4
|
-
type SupportedStyleProps = typeof SUPPORTED_STYLE_PROPS[number];
|
5
|
-
/**
|
6
|
-
* @deprecated Use withUnistyles instead
|
7
|
-
*/
|
8
|
-
export declare const createUnistylesComponent: <TProps extends Record<string, any>, TMappings extends Partial<Omit<TProps, SupportedStyleProps>>>(Component: ComponentType<TProps>, mappings?: (theme: UnistylesTheme) => TMappings) => import("react").ForwardRefExoticComponent<Omit<Omit<any, string | number | symbol> & Partial<Pick<any, string | number | symbol>> & {
|
9
|
-
uniProps?: import("./withUnistyles/types").Mappings<any> | undefined;
|
10
|
-
style?: import("../types").UnistylesValues;
|
11
|
-
contentContainerStyle?: import("../types").UnistylesValues;
|
12
|
-
}, "ref"> & import("react").RefAttributes<unknown>>;
|
13
|
-
export {};
|
14
|
-
//# sourceMappingURL=createUnistylesComponent.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createUnistylesComponent.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9C,QAAA,MAAM,qBAAqB,6CAA8C,CAAA;AAEzE,KAAK,mBAAmB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,SAAS,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,aAAa,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,cAAc,KAAK,SAAS;;;;mDAE3N,CAAA"}
|