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
@@ -1,86 +1,53 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React, { forwardRef, useEffect
|
4
|
-
import { StyleSheet, UnistyleDependency } from '../../specs';
|
3
|
+
import React, { forwardRef, useEffect } from 'react';
|
5
4
|
import { deepMergeObjects } from '../../utils';
|
6
|
-
import {
|
7
|
-
import {
|
5
|
+
import { maybeWarnAboutMultipleUnistyles } from '../warn';
|
6
|
+
import { useProxifiedUnistyles } from '../useProxifiedUnistyles';
|
8
7
|
|
9
8
|
// @ts-expect-error
|
10
9
|
|
11
10
|
// @ts-expect-error
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
12
|
export const withUnistyles = (Component, mappings) => {
|
13
|
+
const getSecrets = (styleProps = {}) => {
|
14
|
+
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('unistyles-'));
|
15
|
+
return unistyleKey ? styleProps[unistyleKey] : {
|
16
|
+
uni__getStyles: () => styleProps,
|
17
|
+
uni__dependencies: []
|
18
|
+
};
|
19
|
+
};
|
14
20
|
return /*#__PURE__*/forwardRef((props, ref) => {
|
15
21
|
const narrowedProps = props;
|
16
|
-
const stylesRef = useRef({});
|
17
|
-
const isForcedRef = useRef(false);
|
18
22
|
const NativeComponent = Component;
|
19
|
-
if (!isForcedRef.current) {
|
20
|
-
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
21
|
-
if (narrowedProps?.[propName]) {
|
22
|
-
if (Array.isArray(narrowedProps[propName])) {
|
23
|
-
console.error(`🦄 Unistyles: withUnistyles requires ${propName} to be an object. Please check props for component: ${NativeComponent.displayName}`);
|
24
|
-
}
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
stylesRef.current = {
|
31
|
-
...stylesRef.current,
|
32
|
-
// @ts-expect-error - this is hidden from TS
|
33
|
-
[propName]: props[propName].__proto__?.getStyle?.() || props[propName]
|
34
|
-
};
|
35
|
-
}
|
36
|
-
});
|
37
|
-
}
|
24
|
+
// @ts-ignore we don't know the type of the component
|
25
|
+
maybeWarnAboutMultipleUnistyles(narrowedProps.style, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`);
|
26
|
+
// @ts-ignore we don't know the type of the component
|
27
|
+
maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`);
|
38
28
|
const {
|
39
|
-
|
29
|
+
proxifiedRuntime,
|
30
|
+
proxifiedTheme,
|
40
31
|
addDependencies
|
41
|
-
} =
|
42
|
-
dependencies,
|
43
|
-
updateTheme,
|
44
|
-
updateRuntime
|
45
|
-
}) => {
|
46
|
-
const listensToTheme = dependencies.includes(UnistyleDependency.Theme);
|
47
|
-
// @ts-expect-error - this is hidden from TS
|
48
|
-
const dispose = StyleSheet.addChangeListener(changedDependencies => {
|
49
|
-
if (listensToTheme && changedDependencies.includes(UnistyleDependency.Theme)) {
|
50
|
-
updateTheme();
|
51
|
-
}
|
52
|
-
if (changedDependencies.some(dependency => dependencies.includes(dependency))) {
|
53
|
-
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
54
|
-
if (narrowedProps?.[propName]) {
|
55
|
-
stylesRef.current = {
|
56
|
-
...stylesRef.current,
|
57
|
-
// @ts-expect-error - this is hidden from TS
|
58
|
-
[propName]: props[propName].__proto__?.getStyle?.() || props[propName]
|
59
|
-
};
|
60
|
-
isForcedRef.current = true;
|
61
|
-
}
|
62
|
-
});
|
63
|
-
updateRuntime();
|
64
|
-
}
|
65
|
-
});
|
66
|
-
return () => dispose();
|
67
|
-
});
|
32
|
+
} = useProxifiedUnistyles();
|
68
33
|
useEffect(() => {
|
69
|
-
const
|
70
|
-
const
|
71
|
-
addDependencies([...
|
34
|
+
const styleSecrets = getSecrets(narrowedProps.style);
|
35
|
+
const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle);
|
36
|
+
addDependencies(Array.from(new Set([...styleSecrets.uni__dependencies, ...contentContainerStyleSecrets.uni__dependencies])));
|
72
37
|
}, [narrowedProps.style, narrowedProps.contentContainerStyle]);
|
73
|
-
const
|
74
|
-
const unistyleProps = narrowedProps.uniProps ?
|
75
|
-
const
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
|
38
|
+
const mappingsProps = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {};
|
39
|
+
const unistyleProps = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {};
|
40
|
+
const styleSecrets = getSecrets(narrowedProps.style);
|
41
|
+
const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle);
|
42
|
+
const finalProps = {
|
43
|
+
...deepMergeObjects(mappingsProps, unistyleProps, props),
|
44
|
+
...(narrowedProps.style ? {
|
45
|
+
style: styleSecrets.uni__getStyles()
|
46
|
+
} : {}),
|
47
|
+
...(narrowedProps.contentContainerStyle ? {
|
48
|
+
contentContainerStyle: contentContainerStyleSecrets.uni__getStyles()
|
49
|
+
} : {})
|
50
|
+
};
|
84
51
|
return /*#__PURE__*/_jsx(NativeComponent, {
|
85
52
|
...finalProps,
|
86
53
|
ref: ref
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useEffect","
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","deepMergeObjects","maybeWarnAboutMultipleUnistyles","useProxifiedUnistyles","jsx","_jsx","withUnistyles","Component","mappings","getSecrets","styleProps","unistyleKey","Object","keys","find","key","startsWith","uni__getStyles","uni__dependencies","props","ref","narrowedProps","NativeComponent","style","displayName","name","contentContainerStyle","proxifiedRuntime","proxifiedTheme","addDependencies","styleSecrets","contentContainerStyleSecrets","Array","from","Set","mappingsProps","unistyleProps","uniProps","finalProps"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.native.tsx"],"mappings":"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","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs';
|
4
4
|
export { mq } from './mq';
|
5
|
-
export {
|
6
|
-
export { Display, Hide,
|
5
|
+
export { withUnistyles, useUnistyles } from './core';
|
6
|
+
export { Display, Hide, ScopedTheme } from './components';
|
7
|
+
export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server';
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","
|
1
|
+
{"version":3,"names":["StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","withUnistyles","useUnistyles","Display","Hide","ScopedTheme","useServerUnistyles","hydrateServerUnistyles","getServerUnistyles","resetServerUnistyles"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,SAAS;AAChF,SAASC,EAAE,QAAQ,MAAM;AAEzB,SAASC,aAAa,EAAEC,YAAY,QAAQ,QAAQ;AAEpD,SAASC,OAAO,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACzD,SAASC,kBAAkB,EAAEC,sBAAsB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU","ignoreList":[]}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import React from 'react';
|
4
|
+
import { StyleSheet } from 'react-native';
|
5
|
+
import { error, isServer } from '../web/utils';
|
6
|
+
import { UnistylesWeb } from '../web';
|
7
|
+
import { DefaultServerUnistylesSettings } from './types';
|
8
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
export const getServerUnistyles = ({
|
10
|
+
includeRNWStyles = true
|
11
|
+
} = DefaultServerUnistylesSettings) => {
|
12
|
+
if (!isServer()) {
|
13
|
+
throw error('Server styles should only be read on the server');
|
14
|
+
}
|
15
|
+
// @ts-ignore
|
16
|
+
const rnwStyle = includeRNWStyles ? StyleSheet?.getSheet().textContent ?? '' : null;
|
17
|
+
const css = UnistylesWeb.registry.css.getStyles();
|
18
|
+
const state = UnistylesWeb.registry.css.getState();
|
19
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
20
|
+
children: [rnwStyle && /*#__PURE__*/_jsx("style", {
|
21
|
+
id: "rnw-style",
|
22
|
+
children: rnwStyle
|
23
|
+
}), /*#__PURE__*/_jsx("style", {
|
24
|
+
id: "unistyles-web",
|
25
|
+
children: css
|
26
|
+
}), /*#__PURE__*/_jsx("script", {
|
27
|
+
id: "unistyles-script",
|
28
|
+
dangerouslySetInnerHTML: {
|
29
|
+
__html: `window.__UNISTYLES_STATE__ = ${JSON.stringify(state)}`
|
30
|
+
}
|
31
|
+
})]
|
32
|
+
});
|
33
|
+
};
|
34
|
+
//# sourceMappingURL=getServerUnistyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","error","isServer","UnistylesWeb","DefaultServerUnistylesSettings","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getServerUnistyles","includeRNWStyles","rnwStyle","getSheet","textContent","css","registry","getStyles","state","getState","children","id","dangerouslySetInnerHTML","__html","JSON","stringify"],"sourceRoot":"../../../src","sources":["server/getServerUnistyles.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,KAAK,EAAEC,QAAQ,QAAQ,cAAc;AAC9C,SAASC,YAAY,QAAQ,QAAQ;AACrC,SAASC,8BAA8B,QAAsC,SAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtF,OAAO,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,gBAAgB,GAAG;AAA8B,CAAC,GAAGR,8BAA8B,KAAK;EACzH,IAAI,CAACF,QAAQ,CAAC,CAAC,EAAE;IACb,MAAMD,KAAK,CAAC,iDAAiD,CAAC;EAClE;EACA;EACA,MAAMY,QAAuB,GAAGD,gBAAgB,GAAIZ,UAAU,EAAEc,QAAQ,CAAC,CAAC,CAACC,WAAW,IAAI,EAAE,GAAI,IAAI;EACpG,MAAMC,GAAG,GAAGb,YAAY,CAACc,QAAQ,CAACD,GAAG,CAACE,SAAS,CAAC,CAAC;EACjD,MAAMC,KAAK,GAAGhB,YAAY,CAACc,QAAQ,CAACD,GAAG,CAACI,QAAQ,CAAC,CAAC;EAClD,oBAAOV,KAAA,CAAAF,SAAA;IAAAa,QAAA,GACFR,QAAQ,iBAAIP,IAAA;MAAOgB,EAAE,EAAC,WAAW;MAAAD,QAAA,EAAER;IAAQ,CAAQ,CAAC,eACrDP,IAAA;MAAOgB,EAAE,EAAC,eAAe;MAAAD,QAAA,EAAEL;IAAG,CAAQ,CAAC,eAEvCV,IAAA;MAAQgB,EAAE,EAAC,kBAAkB;MAACC,uBAAuB,EAAE;QAAEC,MAAM,EAAE,gCAAgCC,IAAI,CAACC,SAAS,CAACP,KAAK,CAAC;MAAE;IAAE,CAAE,CAAC;EAAA,CAC/H,CAAC;AACP,CAAC","ignoreList":[]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { error, isServer } from '../web/utils';
|
4
|
+
import { UnistylesWeb } from '../web';
|
5
|
+
export const hydrateServerUnistyles = () => {
|
6
|
+
if (isServer()) {
|
7
|
+
throw error('Server styles should only be hydrated on the client');
|
8
|
+
}
|
9
|
+
UnistylesWeb.registry.css.hydrate(window.__UNISTYLES_STATE__);
|
10
|
+
document.querySelector('#unistyles-script')?.remove();
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=hydrateServerUnistyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["error","isServer","UnistylesWeb","hydrateServerUnistyles","registry","css","hydrate","window","__UNISTYLES_STATE__","document","querySelector","remove"],"sourceRoot":"../../../src","sources":["server/hydrateServerUnistyles.ts"],"mappings":";;AAAA,SAASA,KAAK,EAAEC,QAAQ,QAAQ,cAAc;AAC9C,SAASC,YAAY,QAAQ,QAAQ;AASrC,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACxC,IAAIF,QAAQ,CAAC,CAAC,EAAE;IACZ,MAAMD,KAAK,CAAC,qDAAqD,CAAC;EACtE;EACAE,YAAY,CAACE,QAAQ,CAACC,GAAG,CAACC,OAAO,CAACC,MAAM,CAACC,mBAAmB,CAAC;EAC7DC,QAAQ,CAACC,aAAa,CAAC,mBAAmB,CAAC,EAAEC,MAAM,CAAC,CAAC;AACzD,CAAC","ignoreList":[]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
export { useServerUnistyles } from './useServerUnistyles';
|
4
|
+
export { getServerUnistyles } from './getServerUnistyles';
|
5
|
+
export { resetServerUnistyles } from './resetServerUnistyles';
|
6
|
+
export { hydrateServerUnistyles } from './hydrateServerUnistyles';
|
7
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useServerUnistyles","getServerUnistyles","resetServerUnistyles","hydrateServerUnistyles"],"sourceRoot":"../../../src","sources":["server/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,sBAAsB,QAAQ,0BAA0B","ignoreList":[]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { error, isServer } from '../web/utils';
|
4
|
+
import { UnistylesWeb } from '../web';
|
5
|
+
export const resetServerUnistyles = () => {
|
6
|
+
if (!isServer()) {
|
7
|
+
throw error('Server styles should only be reset on the server');
|
8
|
+
}
|
9
|
+
UnistylesWeb.registry.reset();
|
10
|
+
};
|
11
|
+
//# sourceMappingURL=resetServerUnistyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["error","isServer","UnistylesWeb","resetServerUnistyles","registry","reset"],"sourceRoot":"../../../src","sources":["server/resetServerUnistyles.ts"],"mappings":";;AAAA,SAASA,KAAK,EAAEC,QAAQ,QAAQ,cAAc;AAC9C,SAASC,YAAY,QAAQ,QAAQ;AAErC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,IAAI,CAACF,QAAQ,CAAC,CAAC,EAAE;IACb,MAAMD,KAAK,CAAC,kDAAkD,CAAC;EACnE;EACAE,YAAY,CAACE,QAAQ,CAACC,KAAK,CAAC,CAAC;AACjC,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["DefaultServerUnistylesSettings"],"sourceRoot":"../../../src","sources":["server/types.ts"],"mappings":";;AAGA,OAAO,MAAMA,8BAA8B,GAAG,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { useRef } from 'react';
|
4
|
+
import { isServer } from '../web/utils';
|
5
|
+
import { DefaultServerUnistylesSettings } from './types';
|
6
|
+
import { getServerUnistyles } from './getServerUnistyles';
|
7
|
+
import { resetServerUnistyles } from './resetServerUnistyles';
|
8
|
+
import { hydrateServerUnistyles } from './hydrateServerUnistyles';
|
9
|
+
export const useServerUnistyles = (settings = DefaultServerUnistylesSettings) => {
|
10
|
+
const isServerInserted = useRef(false);
|
11
|
+
if (isServer() && !isServerInserted.current) {
|
12
|
+
isServerInserted.current = true;
|
13
|
+
const components = getServerUnistyles(settings);
|
14
|
+
resetServerUnistyles();
|
15
|
+
return components;
|
16
|
+
}
|
17
|
+
if (!isServer()) {
|
18
|
+
hydrateServerUnistyles();
|
19
|
+
}
|
20
|
+
return null;
|
21
|
+
};
|
22
|
+
//# sourceMappingURL=useServerUnistyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useRef","isServer","DefaultServerUnistylesSettings","getServerUnistyles","resetServerUnistyles","hydrateServerUnistyles","useServerUnistyles","settings","isServerInserted","current","components"],"sourceRoot":"../../../src","sources":["server/useServerUnistyles.tsx"],"mappings":";;AAAA,SAAgBA,MAAM,QAAQ,OAAO;AACrC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,8BAA8B,QAAsC,SAAS;AACtF,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,sBAAsB,QAAQ,0BAA0B;AAEjE,OAAO,MAAMC,kBAAkB,GAAGA,CAACC,QAAiC,GAAGL,8BAA8B,KAA6B;EAC9H,MAAMM,gBAAgB,GAAGR,MAAM,CAAC,KAAK,CAAC;EAEtC,IAAIC,QAAQ,CAAC,CAAC,IAAI,CAACO,gBAAgB,CAACC,OAAO,EAAE;IACzCD,gBAAgB,CAACC,OAAO,GAAG,IAAI;IAC/B,MAAMC,UAAU,GAAGP,kBAAkB,CAACI,QAAQ,CAAC;IAC/CH,oBAAoB,CAAC,CAAC;IACtB,OAAOM,UAAU;EACrB;EAEA,IAAI,CAACT,QAAQ,CAAC,CAAC,EAAE;IACbI,sBAAsB,CAAC,CAAC;EAC5B;EACA,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
@@ -11,13 +11,16 @@ const findShadowNodeForHandle = handle => {
|
|
11
11
|
};
|
12
12
|
HybridShadowRegistry.add = (handle, styles) => {
|
13
13
|
// virtualized nodes can be null
|
14
|
-
if (!handle || !styles
|
14
|
+
if (!handle || !styles) {
|
15
15
|
return;
|
16
16
|
}
|
17
|
+
const stylesArray = Array.isArray(styles) ? styles.flat() : [styles];
|
17
18
|
|
18
19
|
// filter Reanimated styles and styles that are undefined
|
19
|
-
const filteredStyles =
|
20
|
-
|
20
|
+
const filteredStyles = stylesArray.filter(style => !style?.initial?.updater).filter(style => style && Object.keys(style).length > 0).flat();
|
21
|
+
if (filteredStyles.length > 0) {
|
22
|
+
HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles);
|
23
|
+
}
|
21
24
|
};
|
22
25
|
HybridShadowRegistry.remove = handle => {
|
23
26
|
if (!handle) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","_viewRef","viewRef","current","_nativeRef","Error","elementType","add","styles","Array","isArray","filteredStyles","filter","style","initial","updater","
|
1
|
+
{"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","_viewRef","viewRef","current","_nativeRef","Error","elementType","add","styles","stylesArray","Array","isArray","flat","filteredStyles","filter","style","initial","updater","Object","keys","length","link","remove","unlink","UnistylesShadowRegistry"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAezD,MAAMC,oBAAoB,GAAGD,YAAY,CAACE,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACzED,MAAM,EAAEM,QAAQ,EAAEJ,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IAC3DD,MAAM,EAAEO,OAAO,EAAEC,OAAO,EAAEN,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACnED,MAAM,EAAES,UAAU,EAAEP,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEpE,IAAI,CAACA,IAAI,EAAE;IACP,MAAM,IAAIS,KAAK,CAAC,4EAA4EV,MAAM,EAAEE,wBAAwB,EAAES,WAAW,IAAI,SAAS,EAAE,CAAC;EAC7J;EAEA,OAAOV,IAAI;AACf,CAAC;AAEDJ,oBAAoB,CAACe,GAAG,GAAG,CAACZ,MAAM,EAAEa,MAAM,KAAK;EAC3C;EACA,IAAI,CAACb,MAAM,IAAI,CAACa,MAAM,EAAE;IACpB;EACJ;EAEA,MAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GACnCA,MAAM,CAACI,IAAI,CAAC,CAAC,GACb,CAACJ,MAAM,CAAC;;EAEd;EACA,MAAMK,cAAc,GAAGJ,WAAW,CAC7BK,MAAM,CAACC,KAAK,IAAI,CAACA,KAAK,EAAEC,OAAO,EAAEC,OAAO,CAAC,CACzCH,MAAM,CAACC,KAAK,IAAIA,KAAK,IAAIG,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,MAAM,GAAG,CAAC,CAAC,CACvDR,IAAI,CAAC,CAAC;EAEX,IAAIC,cAAc,CAACO,MAAM,GAAG,CAAC,EAAE;IAC3B5B,oBAAoB,CAAC6B,IAAI,CAAC3B,uBAAuB,CAACC,MAAM,CAAC,EAAEkB,cAAc,CAAC;EAC9E;AACJ,CAAC;AAEDrB,oBAAoB,CAAC8B,MAAM,GAAG3B,MAAM,IAAI;EACpC,IAAI,CAACA,MAAM,EAAE;IACT;EACJ;EAEAH,oBAAoB,CAAC+B,MAAM,CAAC7B,uBAAuB,CAACC,MAAM,CAAC,CAAC;AAChE,CAAC;AAQD,OAAO,MAAM6B,uBAAuB,GAAGhC,oBAA4D","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NitroModules","processColor","StyleSheet","NativeStyleSheet","HybridUnistylesStyleSheet","createHybridObject","absoluteFillObject","absoluteFill","flatten","compose","jsMethods","init"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,YAAY,EAAEC,UAAU,IAAIC,gBAAgB,QAAQ,cAAc;
|
1
|
+
{"version":3,"names":["NitroModules","processColor","StyleSheet","NativeStyleSheet","HybridUnistylesStyleSheet","createHybridObject","absoluteFillObject","absoluteFill","flatten","compose","jsMethods","init"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,YAAY,EAAEC,UAAU,IAAIC,gBAAgB,QAAQ,cAAc;AAsC3E,MAAMC,yBAAyB,GAAGJ,YAAY,CACzCK,kBAAkB,CAAsB,qBAAqB,CAAC;AAEnED,yBAAyB,CAACE,kBAAkB,GAAGH,gBAAgB,CAACG,kBAAkB;AAClFF,yBAAyB,CAACG,YAAY,GAAGJ,gBAAgB,CAACI,YAAY;AACtEH,yBAAyB,CAACI,OAAO,GAAGL,gBAAgB,CAACK,OAAO;AAC5DJ,yBAAyB,CAACK,OAAO,GAAGN,gBAAgB,CAACM,OAAO;AAC5DL,yBAAyB,CAACM,SAAS,GAAG;EAClCT;AACJ,CAAC;AAEDG,yBAAyB,CAACO,IAAI,CAAC,CAAC;AAIhC,OAAO,MAAMT,UAAU,GAAGE,yBAAsE","ignoreList":[]}
|
package/lib/module/utils.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
export const isDefined = value => value !== undefined && value !== null;
|
3
4
|
export const deepMergeObjects = (...sources) => {
|
4
5
|
const target = {};
|
5
|
-
sources.forEach(source => {
|
6
|
+
sources.filter(isDefined).forEach(source => {
|
6
7
|
Object.keys(source).forEach(key => {
|
7
8
|
const sourceValue = source[key];
|
8
9
|
const targetValue = target[key];
|
@@ -18,4 +19,18 @@ export const deepMergeObjects = (...sources) => {
|
|
18
19
|
});
|
19
20
|
return target;
|
20
21
|
};
|
22
|
+
export const copyComponentProperties = (Component, UnistylesComponent) => {
|
23
|
+
Object.entries(Component).forEach(([key, value]) => {
|
24
|
+
// Filter out the keys we don't want to copy
|
25
|
+
if (['$$typeof', 'render'].includes(key)) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
UnistylesComponent[key] = value;
|
29
|
+
});
|
30
|
+
|
31
|
+
// Those are not enumerable, so we need to copy them manually
|
32
|
+
UnistylesComponent.displayName = Component.displayName;
|
33
|
+
UnistylesComponent.name = Component.name;
|
34
|
+
return UnistylesComponent;
|
35
|
+
};
|
21
36
|
//# sourceMappingURL=utils.js.map
|
package/lib/module/utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","sources","target","forEach","source","Object","keys","key","sourceValue","targetValue"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;AAAA,OAAO,MAAMA,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,
|
1
|
+
{"version":3,"names":["isDefined","value","undefined","deepMergeObjects","sources","target","filter","forEach","source","Object","keys","key","sourceValue","targetValue","copyComponentProperties","Component","UnistylesComponent","entries","includes","displayName","name"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;AAAA,OAAO,MAAMA,SAAS,GAAOC,KAAQ,IAA8BA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI;AAExG,OAAO,MAAME,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,CACFE,MAAM,CAACN,SAAS,CAAC,CACjBO,OAAO,CAACC,MAAM,IAAI;IACfC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACD,OAAO,CAACI,GAAG,IAAI;MAC/B,MAAMC,WAAW,GAAGJ,MAAM,CAACG,GAAG,CAAC;MAC/B,MAAME,WAAW,GAAGR,MAAM,CAACM,GAAG,CAAC;MAE/B,IAAIF,MAAM,CAACG,WAAW,CAAC,KAAKA,WAAW,IAAIH,MAAM,CAACI,WAAW,CAAC,KAAKA,WAAW,EAAE;QAC5E;QACAR,MAAM,CAACM,GAAG,CAAC,GAAGR,gBAAgB,CAACU,WAAW,EAAED,WAAW,CAAC;QAExD;MACJ;;MAEA;MACAP,MAAM,CAACM,GAAG,CAAC,GAAGC,WAAW;IACjC,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAOP,MAAM;AACjB,CAAC;AAED,OAAO,MAAMS,uBAAuB,GAAGA,CAACC,SAAc,EAAEC,kBAAuB,KAAK;EAChFP,MAAM,CAACQ,OAAO,CAACF,SAAS,CAAC,CAACR,OAAO,CAAC,CAAC,CAACI,GAAG,EAAEV,KAAK,CAAC,KAAK;IAChD;IACA,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAACiB,QAAQ,CAACP,GAAG,CAAC,EAAE;MACtC;IACJ;IAEAK,kBAAkB,CAACL,GAAG,CAAC,GAAGV,KAAK;EACnC,CAAC,CAAC;;EAEF;EACAe,kBAAkB,CAACG,WAAW,GAAGJ,SAAS,CAACI,WAAW;EACtDH,kBAAkB,CAACI,IAAI,GAAGL,SAAS,CAACK,IAAI;EAExC,OAAOJ,kBAAkB;AAC7B,CAAC","ignoreList":[]}
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { hyphenate } from '../../utils';
|
4
4
|
import { getObjectStyle } from './objectStyle';
|
5
5
|
import { normalizeColor, normalizeNumericValue } from '../utils';
|
6
|
-
import { UnistylesRuntime } from '../../runtime';
|
7
6
|
import { isUnistylesMq } from '../../../mq';
|
7
|
+
import { UnistylesWeb } from '../../index';
|
8
8
|
const getDropShadowStyle = dropShadow => {
|
9
9
|
const {
|
10
10
|
offsetX = 0,
|
@@ -21,7 +21,7 @@ export const getFilterStyle = filters => {
|
|
21
21
|
if (typeof dropShadowValue !== 'object') {
|
22
22
|
return [];
|
23
23
|
}
|
24
|
-
const breakpoints = Object.keys(dropShadowValue).filter(key => Object.keys(
|
24
|
+
const breakpoints = Object.keys(dropShadowValue).filter(key => Object.keys(UnistylesWeb.runtime.breakpoints).includes(key) || isUnistylesMq(key));
|
25
25
|
const breakpointsDropShadow = Object.fromEntries(breakpoints.map(breakpoint => [breakpoint, getDropShadowStyle(dropShadowValue[breakpoint])]));
|
26
26
|
if (breakpoints.length === 0) {
|
27
27
|
return [{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["hyphenate","getObjectStyle","normalizeColor","normalizeNumericValue","
|
1
|
+
{"version":3,"names":["hyphenate","getObjectStyle","normalizeColor","normalizeNumericValue","isUnistylesMq","UnistylesWeb","getDropShadowStyle","dropShadow","offsetX","offsetY","standardDeviation","color","String","getFilterStyle","filters","restFilters","filter","Object","keys","dropShadowValue","find","breakpoints","key","runtime","includes","breakpointsDropShadow","fromEntries","map","breakpoint","length","value"],"sourceRoot":"../../../../../src","sources":["web/convert/object/filter.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AAChE,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,YAAY,QAAQ,aAAa;AAE1C,MAAMC,kBAAkB,GAAIC,UAA2B,IAAK;EACxD,MAAM;IAAEC,OAAO,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC,iBAAiB,GAAG,CAAC;IAAEC,KAAK,GAAG;EAAO,CAAC,GAAGJ,UAAU;EAEtF,OAAO,GAAGL,cAAc,CAACU,MAAM,CAACD,KAAK,CAAC,CAAC,IAAIR,qBAAqB,CAACK,OAAO,CAAC,IAAIL,qBAAqB,CAACM,OAAO,CAAC,IAAIN,qBAAqB,CAACO,iBAAiB,CAAC,EAAE;AAC7J,CAAC;AAED,OAAO,MAAMG,cAAc,GAAIC,OAAuB,IAAK;EACvD,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,CAACA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC;EACrF,MAAMT,UAAU,GAAG,CAAC,MAAM;IACtB,MAAMY,eAAe,GAAGL,OAAO,CAACM,IAAI,CAACJ,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,EAAET,UAAiC;IAE1H,IAAI,OAAOY,eAAe,KAAK,QAAQ,EAAE;MACrC,OAAO,EAAE;IACb;IAEA,MAAME,WAAW,GAAGJ,MAAM,CAACC,IAAI,CAACC,eAAe,CAAC,CAACH,MAAM,CAACM,GAAG,IAAIL,MAAM,CAACC,IAAI,CAACb,YAAY,CAACkB,OAAO,CAACF,WAAW,CAAC,CAACG,QAAQ,CAACF,GAAG,CAAC,IAAIlB,aAAa,CAACkB,GAAG,CAAC,CAAC;IACjJ,MAAMG,qBAAqB,GAAGR,MAAM,CAACS,WAAW,CAACL,WAAW,CAACM,GAAG,CAACC,UAAU,IAAI,CAACA,UAAU,EAAEtB,kBAAkB,CAACa,eAAe,CAACS,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9I,IAAIP,WAAW,CAACQ,MAAM,KAAK,CAAC,EAAE;MAC1B,OAAO,CAAC;QACJtB,UAAU,EAAED,kBAAkB,CAACa,eAAkC;MACrE,CAAC,CAAC;IACN;IAEA,OAAO,CAAC;MACJZ,UAAU,EAAEkB;IAChB,CAAC,CAAC;EACN,CAAC,EAAE,CAAC;EAEJ,OAAOxB,cAAc,CAAC,CAAC,GAAGc,WAAW,EAAE,GAAGR,UAAU,CAAC,EAAE,QAAQ,EAAE,CAACe,GAAG,EAAEQ,KAAK,KAAK,GAAG9B,SAAS,CAACsB,GAAG,CAAC,IAAInB,qBAAqB,CAAC2B,KAAwB,CAAC,GAAG,CAAC;AAC7J,CAAC","ignoreList":[]}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import { keyInObject } from '../utils';
|
4
|
-
const SKIP_STYLES = ['borderCurve', 'elevation', 'textAlignVertical', 'includeFontPadding', 'overlayColor', 'tintColor'];
|
5
|
-
const CSS_NUMBER_KEYS = ['animationIterationCount', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'columns', 'counterIncrement', 'counterReset', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'fontWeight', 'gridArea', 'gridColumn', 'gridColumnEnd', 'gridColumnSpan', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowSpan', 'gridRowStart', 'line-clamp', 'line-height', 'opacity', 'order', 'orphans', 'tabSize', 'widows', 'zIndex', 'zoom', 'fillOpacity', 'floodOpacity', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth'];
|
4
|
+
const SKIP_STYLES = new Set(['borderCurve', 'elevation', 'textAlignVertical', 'includeFontPadding', 'overlayColor', 'tintColor']);
|
5
|
+
const CSS_NUMBER_KEYS = new Set(['animationIterationCount', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'columns', 'counterIncrement', 'counterReset', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'fontWeight', 'gridArea', 'gridColumn', 'gridColumnEnd', 'gridColumnSpan', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowSpan', 'gridRowStart', 'line-clamp', 'line-height', 'opacity', 'order', 'orphans', 'tabSize', 'widows', 'zIndex', 'zoom', 'fillOpacity', 'floodOpacity', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'aspectRatio']);
|
6
6
|
const convertMap = {
|
7
7
|
marginHorizontal: value => ({
|
8
8
|
marginInline: value
|
@@ -70,12 +70,12 @@ const convertMap = {
|
|
70
70
|
};
|
71
71
|
const convertNumber = (key, value) => {
|
72
72
|
if (typeof value === 'number') {
|
73
|
-
return CSS_NUMBER_KEYS.
|
73
|
+
return CSS_NUMBER_KEYS.has(key) ? value : `${value}px`;
|
74
74
|
}
|
75
75
|
return value;
|
76
76
|
};
|
77
77
|
export const getStyle = (key, value) => {
|
78
|
-
if (SKIP_STYLES.
|
78
|
+
if (SKIP_STYLES.has(key)) {
|
79
79
|
return {};
|
80
80
|
}
|
81
81
|
if (keyInObject(convertMap, key)) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["keyInObject","SKIP_STYLES","CSS_NUMBER_KEYS","convertMap","marginHorizontal","value","marginInline","marginVertical","marginBlock","paddingHorizontal","paddingInline","paddingVertical","paddingBlock","writingDirection","direction","borderBottomEndRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomLeftRadius","borderEndColor","borderInlineEndColor","borderStartColor","borderInlineStartColor","borderTopEndRadius","borderTopRightRadius","borderTopStartRadius","borderTopLeftRadius","borderEndWidth","borderInlineEndWidth","borderStartWidth","borderInlineStartWidth","end","right","start","left","marginEnd","marginRight","marginStart","marginLeft","paddingEnd","paddingRight","paddingStart","paddingLeft","transformMatrix","transform","join","resizeMode","backgroundSize","convertNumber","key","
|
1
|
+
{"version":3,"names":["keyInObject","SKIP_STYLES","Set","CSS_NUMBER_KEYS","convertMap","marginHorizontal","value","marginInline","marginVertical","marginBlock","paddingHorizontal","paddingInline","paddingVertical","paddingBlock","writingDirection","direction","borderBottomEndRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomLeftRadius","borderEndColor","borderInlineEndColor","borderStartColor","borderInlineStartColor","borderTopEndRadius","borderTopRightRadius","borderTopStartRadius","borderTopLeftRadius","borderEndWidth","borderInlineEndWidth","borderStartWidth","borderInlineStartWidth","end","right","start","left","marginEnd","marginRight","marginStart","marginLeft","paddingEnd","paddingRight","paddingStart","paddingLeft","transformMatrix","transform","join","resizeMode","backgroundSize","convertNumber","key","has","getStyle"],"sourceRoot":"../../../../src","sources":["web/convert/style.ts"],"mappings":"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","ignoreList":[]}
|
package/lib/module/web/create.js
CHANGED
@@ -1,28 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
import { UnistylesWeb } from './index';
|
3
4
|
import { assignSecrets, error, removeInlineStyles } from './utils';
|
4
|
-
import { UnistylesRuntime } from './runtime';
|
5
|
-
const useVariants = ['useVariants', () => {}];
|
6
5
|
export const create = (stylesheet, id) => {
|
7
6
|
if (!id) {
|
8
7
|
throw error('Unistyles is not initialized correctly. Please add babel plugin to your babel config.');
|
9
8
|
}
|
10
|
-
const computedStylesheet =
|
11
|
-
const addSecrets = (value, key, args) => assignSecrets(value, {
|
9
|
+
const computedStylesheet = UnistylesWeb.registry.getComputedStylesheet(stylesheet);
|
10
|
+
const addSecrets = (value, key, args = undefined, variants = {}) => assignSecrets(value, {
|
12
11
|
__uni__key: key,
|
13
12
|
__uni__stylesheet: stylesheet,
|
14
13
|
__uni__args: args,
|
15
|
-
|
14
|
+
__uni_variants: variants
|
16
15
|
});
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
const createStyleSheetStyles = variants => {
|
17
|
+
const stylesEntries = Object.entries(computedStylesheet).map(([key, value]) => {
|
18
|
+
if (typeof value === 'function') {
|
19
|
+
return [key, (...args) => {
|
20
|
+
const result = removeInlineStyles(value(...args));
|
21
|
+
return addSecrets(result, key, args, variants);
|
22
|
+
}];
|
23
|
+
}
|
24
|
+
return [key, addSecrets(removeInlineStyles(value), key, undefined, variants)];
|
25
|
+
});
|
26
|
+
return Object.fromEntries(stylesEntries.concat([useVariants]));
|
27
|
+
};
|
28
|
+
const useVariants = ['useVariants', variants => {
|
29
|
+
return createStyleSheetStyles(variants);
|
30
|
+
}];
|
31
|
+
return createStyleSheetStyles();
|
27
32
|
};
|
28
33
|
//# sourceMappingURL=create.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["assignSecrets","error","removeInlineStyles","
|
1
|
+
{"version":3,"names":["UnistylesWeb","assignSecrets","error","removeInlineStyles","create","stylesheet","id","computedStylesheet","registry","getComputedStylesheet","addSecrets","value","key","args","undefined","variants","__uni__key","__uni__stylesheet","__uni__args","__uni_variants","createStyleSheetStyles","stylesEntries","Object","entries","map","result","fromEntries","concat","useVariants"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;AACA,SAASA,YAAY,QAAQ,SAAS;AACtC,SAASC,aAAa,EAAEC,KAAK,EAAEC,kBAAkB,QAAQ,SAAS;AAIlE,OAAO,MAAMC,MAAM,GAAGA,CAACC,UAAiD,EAAEC,EAAW,KAAK;EACtF,IAAI,CAACA,EAAE,EAAE;IACL,MAAMJ,KAAK,CAAC,uFAAuF,CAAC;EACxG;EAEA,MAAMK,kBAAkB,GAAGP,YAAY,CAACQ,QAAQ,CAACC,qBAAqB,CAACJ,UAAU,CAAC;EAClF,MAAMK,UAAU,GAAGA,CAACC,KAAU,EAAEC,GAAW,EAAEC,IAAI,GAAGC,SAAmC,EAAEC,QAAQ,GAAG,CAAC,CAAa,KAAKd,aAAa,CAACU,KAAK,EAAE;IACxIK,UAAU,EAAEJ,GAAG;IACfK,iBAAiB,EAAEZ,UAAU;IAC7Ba,WAAW,EAAEL,IAAI;IACjBM,cAAc,EAAEJ;EACpB,CAAC,CAAC;EAEF,MAAMK,sBAAsB,GAAIL,QAAmB,IAAK;IACpD,MAAMM,aAAa,GAAGC,MAAM,CAACC,OAAO,CAAChB,kBAAkB,CAAC,CAACiB,GAAG,CAAC,CAAC,CAACZ,GAAG,EAAED,KAAK,CAAC,KAAK;MAC3E,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;QAC7B,OAAO,CAACC,GAAG,EAAE,CAAC,GAAGC,IAAgB,KAAK;UAClC,MAAMY,MAAM,GAAGtB,kBAAkB,CAACQ,KAAK,CAAC,GAAGE,IAAI,CAAC,CAAC;UAEjD,OAAOH,UAAU,CAACe,MAAM,EAAEb,GAAG,EAAEC,IAAI,EAAEE,QAAQ,CAAC;QAClD,CAAC,CAAC;MACN;MAEA,OAAO,CAACH,GAAG,EAAEF,UAAU,CAACP,kBAAkB,CAACQ,KAAK,CAAC,EAAEC,GAAG,EAAEE,SAAS,EAAEC,QAAQ,CAAC,CAAC;IACjF,CAAC,CAAC;IAEF,OAAOO,MAAM,CAACI,WAAW,CAACL,aAAa,CAACM,MAAM,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC;EAClE,CAAC;EAED,MAAMA,WAAW,GAAG,CAAC,aAAa,EAAGb,QAAkB,IAAK;IACxD,OAAOK,sBAAsB,CAACL,QAAQ,CAAC;EAC3C,CAAC,CAAC;EAEF,OAAOK,sBAAsB,CAAC,CAAC;AACnC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { getMediaQuery } from '../utils';
|
4
|
+
export const convertToCSS = (hash, value, state) => {
|
5
|
+
Object.entries(value).forEach(([styleKey, styleValue]) => {
|
6
|
+
if (styleKey[0] === '_') {
|
7
|
+
const pseudoClassName = styleKey.replace('_', `${hash}:`);
|
8
|
+
Object.entries(styleValue).forEach(([pseudoStyleKey, pseudoStyleValue]) => {
|
9
|
+
if (typeof pseudoStyleValue === 'object' && pseudoStyleValue !== null) {
|
10
|
+
const allBreakpoints = Object.keys(pseudoStyleValue);
|
11
|
+
Object.entries(pseudoStyleValue).forEach(([breakpointStyleKey, breakpointStyleValue]) => {
|
12
|
+
const mediaQuery = getMediaQuery(pseudoStyleKey, allBreakpoints);
|
13
|
+
state.set({
|
14
|
+
mediaQuery,
|
15
|
+
className: pseudoClassName,
|
16
|
+
propertyKey: breakpointStyleKey,
|
17
|
+
value: breakpointStyleValue
|
18
|
+
});
|
19
|
+
});
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
state.set({
|
23
|
+
className: pseudoClassName,
|
24
|
+
propertyKey: pseudoStyleKey,
|
25
|
+
value: pseudoStyleValue
|
26
|
+
});
|
27
|
+
});
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
if (typeof styleValue === 'object') {
|
31
|
+
const allBreakpoints = Object.keys(styleValue);
|
32
|
+
Object.entries(styleValue).forEach(([breakpointStyleKey, breakpointStyleValue]) => {
|
33
|
+
const mediaQuery = getMediaQuery(styleKey, allBreakpoints);
|
34
|
+
state.set({
|
35
|
+
mediaQuery,
|
36
|
+
className: hash,
|
37
|
+
propertyKey: breakpointStyleKey,
|
38
|
+
value: breakpointStyleValue
|
39
|
+
});
|
40
|
+
});
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
state.set({
|
44
|
+
className: hash,
|
45
|
+
propertyKey: styleKey,
|
46
|
+
value: styleValue
|
47
|
+
});
|
48
|
+
});
|
49
|
+
};
|
50
|
+
//# sourceMappingURL=core.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["getMediaQuery","convertToCSS","hash","value","state","Object","entries","forEach","styleKey","styleValue","pseudoClassName","replace","pseudoStyleKey","pseudoStyleValue","allBreakpoints","keys","breakpointStyleKey","breakpointStyleValue","mediaQuery","set","className","propertyKey"],"sourceRoot":"../../../../src","sources":["web/css/core.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,UAAU;AAGxC,OAAO,MAAMC,YAAY,GAAGA,CAACC,IAAY,EAAEC,KAA0B,EAAEC,KAAe,KAAK;EACvFC,MAAM,CAACC,OAAO,CAACH,KAAK,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,QAAQ,EAAEC,UAAU,CAAC,KAAK;IACtD,IAAID,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;MACrB,MAAME,eAAe,GAAGF,QAAQ,CAACG,OAAO,CAAC,GAAG,EAAE,GAAGT,IAAI,GAAG,CAAC;MAEzDG,MAAM,CAACC,OAAO,CAACG,UAAU,CAAC,CAACF,OAAO,CAAC,CAAC,CAACK,cAAc,EAAEC,gBAAgB,CAAC,KAAK;QACvE,IAAI,OAAOA,gBAAgB,KAAK,QAAQ,IAAIA,gBAAgB,KAAK,IAAI,EAAE;UACnE,MAAMC,cAAc,GAAGT,MAAM,CAACU,IAAI,CAACF,gBAAgB,CAAC;UACpDR,MAAM,CAACC,OAAO,CAACO,gBAAgB,CAAC,CAACN,OAAO,CAAC,CAAC,CAACS,kBAAkB,EAAEC,oBAAoB,CAAC,KAAK;YACrF,MAAMC,UAAU,GAAGlB,aAAa,CAACY,cAAc,EAAEE,cAAc,CAAC;YAEhEV,KAAK,CAACe,GAAG,CAAC;cACND,UAAU;cACVE,SAAS,EAAEV,eAAe;cAC1BW,WAAW,EAAEL,kBAAkB;cAC/Bb,KAAK,EAAEc;YACX,CAAC,CAAC;UACN,CAAC,CAAC;UAEF;QACJ;QAEAb,KAAK,CAACe,GAAG,CAAC;UACNC,SAAS,EAAEV,eAAe;UAC1BW,WAAW,EAAET,cAAc;UAC3BT,KAAK,EAAEU;QACX,CAAC,CAAC;MACN,CAAC,CAAC;MAEF;IACJ;IAEA,IAAI,OAAOJ,UAAU,KAAK,QAAQ,EAAE;MAChC,MAAMK,cAAc,GAAGT,MAAM,CAACU,IAAI,CAACN,UAAU,CAAC;MAC9CJ,MAAM,CAACC,OAAO,CAACG,UAAU,CAAC,CAACF,OAAO,CAAC,CAAC,CAACS,kBAAkB,EAAEC,oBAAoB,CAAC,KAAK;QAC/E,MAAMC,UAAU,GAAGlB,aAAa,CAACQ,QAAQ,EAAEM,cAAc,CAAC;QAE1DV,KAAK,CAACe,GAAG,CAAC;UACND,UAAU;UACVE,SAAS,EAAElB,IAAI;UACfmB,WAAW,EAAEL,kBAAkB;UAC/Bb,KAAK,EAAEc;QACX,CAAC,CAAC;MACN,CAAC,CAAC;MAEF;IACJ;IAEAb,KAAK,CAACe,GAAG,CAAC;MACNC,SAAS,EAAElB,IAAI;MACfmB,WAAW,EAAEb,QAAQ;MACrBL,KAAK,EAAEM;IACX,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["web/css/index.ts"],"mappings":";;AAAA,cAAc,SAAS","ignoreList":[]}
|