react-native-unistyles 3.0.0-beta.3 → 3.0.0-beta.5
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 +6 -3
- package/android/src/main/cxx/NativeUnistylesModule.cpp +1 -1
- package/android/src/main/cxx/NativeUnistylesModule.h +1 -1
- package/components/native/ActivityIndicator/package.json +2 -1
- 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/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 +9 -4
- package/cxx/core/UnistyleWrapper.h +92 -47
- package/cxx/core/UnistylesRegistry.cpp +19 -11
- package/cxx/core/UnistylesRegistry.h +2 -4
- package/cxx/hybridObjects/HybridNavigationBar.cpp +3 -3
- package/cxx/hybridObjects/HybridNavigationBar.h +2 -2
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +32 -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 +25 -8
- 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 +17 -24
- package/cxx/parser/Parser.h +2 -1
- package/ios/NativePlatform+ios.swift +5 -7
- package/ios/NativePlatform.swift +2 -2
- package/ios/UnistylesModuleOnLoad.mm +2 -1
- 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/ImageBackground.js +45 -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/Pressable.js +26 -51
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +14 -11
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js +29 -5
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +40 -0
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -0
- package/lib/commonjs/core/createUnistylesImageBackground.js +36 -14
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/getClassname.js +25 -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 +38 -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 +4 -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 +28 -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/ImageBackground.js +45 -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/Pressable.js +27 -52
- package/lib/module/components/native/Pressable.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +15 -12
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js +29 -5
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +33 -0
- package/lib/module/core/createUnistylesElement.native.js.map +1 -0
- package/lib/module/core/createUnistylesImageBackground.js +34 -13
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/getClassname.js +20 -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 +32 -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 +2 -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 +27 -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 +3 -1
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
- package/lib/typescript/src/components/native/FlatList.d.ts +3 -1
- package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Image.d.ts +3 -1
- package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.d.ts +8 -2
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.native.d.ts +3 -0
- package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +3 -1
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
- 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 +3 -1
- package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ScrollView.d.ts +3 -1
- package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/SectionList.d.ts +3 -1
- package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Switch.d.ts +3 -1
- package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Text.d.ts +3 -1
- package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TextInput.d.ts +3 -1
- package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts +3 -1
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts +3 -1
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
- package/lib/typescript/src/components/native/View.d.ts +3 -1
- package/lib/typescript/src/components/native/View.d.ts.map +1 -1
- package/lib/typescript/src/components/native/VirtualizedList.d.ts +3 -1
- package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.d.ts +6 -1
- package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts +3 -0
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -0
- 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 +4 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +1 -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 +21 -12
- package/plugin/import.js +1 -21
- package/plugin/index.d.ts +41 -0
- package/plugin/index.js +44 -76
- package/plugin/stylesheet.js +17 -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/ImageBackground.native.tsx +4 -0
- package/src/components/native/ImageBackground.tsx +54 -2
- package/src/components/native/Pressable.native.tsx +16 -17
- package/src/components/native/Pressable.tsx +35 -69
- package/src/core/createUnistylesElement.native.tsx +36 -0
- package/src/core/createUnistylesElement.tsx +42 -8
- package/src/core/createUnistylesImageBackground.tsx +40 -19
- package/src/core/getClassname.native.ts +1 -0
- package/src/core/getClassname.ts +13 -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 +20 -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 +5 -1
- package/src/utils.ts +15 -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 +40 -25
- package/src/web/variants.ts +27 -27
- package/cxx/core/HostStyle.cpp +0 -73
- package/cxx/core/HostStyle.h +0 -34
- package/lib/commonjs/components/Variants.js +0 -36
- package/lib/commonjs/components/Variants.js.map +0 -1
- package/lib/commonjs/core/createUnistylesComponent.js +0 -16
- package/lib/commonjs/core/createUnistylesComponent.js.map +0 -1
- package/lib/commonjs/core/withUnistyles/useDependencies.js.map +0 -1
- package/lib/module/components/Variants.js +0 -29
- package/lib/module/components/Variants.js.map +0 -1
- package/lib/module/core/createUnistylesComponent.js +0 -11
- package/lib/module/core/createUnistylesComponent.js.map +0 -1
- package/lib/module/core/withUnistyles/useDependencies.js.map +0 -1
- package/lib/typescript/src/components/Variants.d.ts +0 -7
- package/lib/typescript/src/components/Variants.d.ts.map +0 -1
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +0 -14
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +0 -1
- package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts +0 -13
- package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts.map +0 -1
- package/nitrogen/generated/android/unistylesOnLoad.kt +0 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +0 -314
- package/plugin/style.js +0 -168
- package/src/components/Variants.tsx +0 -30
- package/src/core/createUnistylesComponent.tsx +0 -14
@@ -3,11 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.schemeToTheme = exports.removeInlineStyles = exports.isInDocument = exports.getMediaQuery = exports.extractUnistyleDependencies = exports.extractSecrets = exports.
|
6
|
+
exports.schemeToTheme = exports.removeInlineStyles = exports.isInDocument = exports.getMediaQuery = exports.extractUnistyleDependencies = exports.extractSecrets = exports.assignSecrets = void 0;
|
7
7
|
var _types = require("../../specs/types");
|
8
8
|
var _mq = require("../../mq");
|
9
|
-
var _state = require("../state");
|
10
9
|
var _common = require("./common");
|
10
|
+
var _index = require("../index");
|
11
11
|
const schemeToTheme = scheme => {
|
12
12
|
switch (scheme) {
|
13
13
|
case _types.ColorScheme.Dark:
|
@@ -19,13 +19,28 @@ const schemeToTheme = scheme => {
|
|
19
19
|
};
|
20
20
|
exports.schemeToTheme = schemeToTheme;
|
21
21
|
const assignSecrets = (object, secrets) => {
|
22
|
-
|
23
|
-
|
22
|
+
const secretsId = Math.random().toString(36).slice(8);
|
23
|
+
|
24
|
+
// @ts-expect-error assign hidden secrets
|
25
|
+
object[`unistyles-${secretsId}`] = {};
|
26
|
+
// @ts-expect-error assign hidden secrets
|
27
|
+
Object.defineProperties(object[`unistyles-${secretsId}`], (0, _common.reduceObject)(secrets, secret => ({
|
28
|
+
value: secret,
|
29
|
+
enumerable: false,
|
30
|
+
configurable: true
|
31
|
+
})));
|
24
32
|
return object;
|
25
33
|
};
|
26
34
|
exports.assignSecrets = assignSecrets;
|
27
35
|
const extractSecrets = object => {
|
28
|
-
|
36
|
+
if (!object) {
|
37
|
+
return undefined;
|
38
|
+
}
|
39
|
+
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles-')) ?? [];
|
40
|
+
if (!secrets) {
|
41
|
+
return undefined;
|
42
|
+
}
|
43
|
+
return (0, _common.reduceObject)(Object.getOwnPropertyDescriptors(secrets), secret => secret.value);
|
29
44
|
};
|
30
45
|
exports.extractSecrets = extractSecrets;
|
31
46
|
const removeInlineStyles = values => {
|
@@ -40,18 +55,9 @@ const removeInlineStyles = values => {
|
|
40
55
|
exports.removeInlineStyles = removeInlineStyles;
|
41
56
|
const isInDocument = element => document.body.contains(element);
|
42
57
|
exports.isInDocument = isInDocument;
|
43
|
-
const
|
44
|
-
const [_, px] = query.match(/(\d+)px/) ?? [];
|
45
|
-
if (!px) {
|
46
|
-
return undefined;
|
47
|
-
}
|
48
|
-
const value = Number(px);
|
49
|
-
return Number.isNaN(value) ? undefined : value;
|
50
|
-
};
|
51
|
-
exports.extractMediaQueryValue = extractMediaQueryValue;
|
52
|
-
const getMediaQuery = query => {
|
58
|
+
const getMediaQuery = (query, allBreakpoints) => {
|
53
59
|
if (Object.values(_types.Orientation).includes(query)) {
|
54
|
-
return
|
60
|
+
return `@media (orientation: ${query})`;
|
55
61
|
}
|
56
62
|
if ((0, _mq.isUnistylesMq)(query)) {
|
57
63
|
const {
|
@@ -60,10 +66,13 @@ const getMediaQuery = query => {
|
|
60
66
|
minHeight,
|
61
67
|
maxHeight
|
62
68
|
} = (0, _mq.parseMq)(query);
|
63
|
-
|
69
|
+
const queries = [minWidth ? `(min-width: ${minWidth}px)` : undefined, maxWidth ? `(max-width: ${maxWidth}px)` : undefined, minHeight ? `(min-height: ${minHeight}px)` : undefined, maxHeight ? `(max-height: ${maxHeight}px)` : undefined].filter(Boolean).join(' and ');
|
70
|
+
return `@media ${queries}`;
|
64
71
|
}
|
65
|
-
const
|
66
|
-
|
72
|
+
const breakpointValue = _index.UnistylesWeb.runtime.breakpoints[query] ?? 0;
|
73
|
+
const nextBreakpoint = allBreakpoints.filter(b => b in _index.UnistylesWeb.runtime.breakpoints).map(b => _index.UnistylesWeb.runtime.breakpoints[b]).sort((a, b) => a - b).find(b => b > breakpointValue);
|
74
|
+
const queries = [`(min-width: ${breakpointValue}px)`, nextBreakpoint ? `(max-width: ${nextBreakpoint - 1}px)` : undefined].filter(Boolean).join(' and ');
|
75
|
+
return `@media ${queries}`;
|
67
76
|
};
|
68
77
|
exports.getMediaQuery = getMediaQuery;
|
69
78
|
const extractUnistyleDependencies = value => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_mq","
|
1
|
+
{"version":3,"names":["_types","require","_mq","_common","_index","schemeToTheme","scheme","ColorScheme","Dark","Light","exports","assignSecrets","object","secrets","secretsId","Math","random","toString","slice","Object","defineProperties","reduceObject","secret","value","enumerable","configurable","extractSecrets","undefined","entries","find","key","startsWith","getOwnPropertyDescriptors","removeInlineStyles","values","returnValue","isInDocument","element","document","body","contains","getMediaQuery","query","allBreakpoints","Orientation","includes","isUnistylesMq","minWidth","maxWidth","minHeight","maxHeight","parseMq","queries","filter","Boolean","join","breakpointValue","UnistylesWeb","runtime","breakpoints","nextBreakpoint","b","map","sort","a","extractUnistyleDependencies","dependencies","keyInObject","uni__dependencies","Array","isArray"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":"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","ignoreList":[]}
|
@@ -5,35 +5,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getVariants = void 0;
|
7
7
|
var _utils = require("../utils");
|
8
|
-
|
8
|
+
var _utils2 = require("./utils");
|
9
|
+
const hasVariants = value => {
|
10
|
+
return (0, _utils2.keyInObject)(value, 'variants');
|
11
|
+
};
|
9
12
|
const getVariants = (styles, selectedVariants) => {
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
return [];
|
21
|
-
}
|
22
|
-
return selectedVariantStyles;
|
23
|
-
});
|
24
|
-
const compoundVariantStyles = compoundVariants.flatMap(compoundVariant => {
|
25
|
-
const {
|
26
|
-
styles,
|
27
|
-
...conditions
|
28
|
-
} = compoundVariant;
|
29
|
-
if (Object.entries(conditions).some(([variant, value]) => String(selectedVariants[variant]) !== String(value))) {
|
30
|
-
return [];
|
31
|
-
}
|
32
|
-
return styles;
|
33
|
-
});
|
34
|
-
const mergedVariantStyles = (0, _utils.deepMergeObjects)(...variantStyles, ...compoundVariantStyles);
|
35
|
-
return [key, mergedVariantStyles];
|
13
|
+
if (!hasVariants(styles)) {
|
14
|
+
return {};
|
15
|
+
}
|
16
|
+
const variantStyles = Object.entries(styles.variants).flatMap(([variant, styles]) => {
|
17
|
+
const selectedVariant = selectedVariants[variant];
|
18
|
+
const selectedVariantStyles = styles[selectedVariant] ?? styles.default;
|
19
|
+
if (!selectedVariantStyles) {
|
20
|
+
return [];
|
21
|
+
}
|
22
|
+
return selectedVariantStyles;
|
36
23
|
});
|
24
|
+
const compoundVariantStyles = styles.compoundVariants?.flatMap(compoundVariant => {
|
25
|
+
const {
|
26
|
+
styles,
|
27
|
+
...conditions
|
28
|
+
} = compoundVariant;
|
29
|
+
if (Object.entries(conditions).some(([variant, value]) => String(selectedVariants[variant]) !== String(value))) {
|
30
|
+
return [];
|
31
|
+
}
|
32
|
+
return styles;
|
33
|
+
}) ?? [];
|
34
|
+
return (0, _utils.deepMergeObjects)(...variantStyles, ...compoundVariantStyles);
|
37
35
|
};
|
38
36
|
exports.getVariants = getVariants;
|
39
37
|
//# sourceMappingURL=variants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","hasVariants","value","getVariants","styles","selectedVariants","
|
1
|
+
{"version":3,"names":["_utils","require","_utils2","hasVariants","value","keyInObject","getVariants","styles","selectedVariants","variantStyles","Object","entries","variants","flatMap","variant","selectedVariant","selectedVariantStyles","default","compoundVariantStyles","compoundVariants","compoundVariant","conditions","some","String","deepMergeObjects","exports"],"sourceRoot":"../../../src","sources":["web/variants.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,MAAME,WAAW,GAAIC,KAAU,IAAkC;EAC7D,OAAO,IAAAC,mBAAW,EAACD,KAAK,EAAE,UAAU,CAAC;AACzC,CAAC;AAEM,MAAME,WAAW,GAAGA,CAACC,MAAuB,EAAEC,gBAAqC,KAAK;EAC3F,IAAI,CAACL,WAAW,CAACI,MAAM,CAAC,EAAE;IACtB,OAAO,CAAC,CAAC;EACb;EAEA,MAAME,aAAa,GAAGC,MAAM,CAACC,OAAO,CAACJ,MAAM,CAACK,QAAQ,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,OAAO,EAAEP,MAAM,CAAC,KAAK;IACjF,MAAMQ,eAAe,GAAGP,gBAAgB,CAACM,OAAO,CAAC;IACjD,MAAME,qBAAqB,GAAGT,MAAM,CAACQ,eAAe,CAAC,IAAIR,MAAM,CAACU,OAAO;IAEvE,IAAI,CAACD,qBAAqB,EAAE;MACxB,OAAO,EAAE;IACb;IAEA,OAAOA,qBAAqB;EAChC,CAAC,CAAC;EAEF,MAAME,qBAAqB,GAAGX,MAAM,CAACY,gBAAgB,EAAEN,OAAO,CAACO,eAAe,IAAI;IAC9E,MAAM;MAAEb,MAAM;MAAE,GAAGc;IAAW,CAAC,GAAGD,eAAe;IAEjD,IAAIV,MAAM,CAACC,OAAO,CAACU,UAAU,CAAC,CAACC,IAAI,CAAC,CAAC,CAACR,OAAO,EAAEV,KAAK,CAAC,KAAKmB,MAAM,CAACf,gBAAgB,CAACM,OAAO,CAAC,CAAC,KAAKS,MAAM,CAACnB,KAAK,CAAC,CAAC,EAAE;MAC5G,OAAO,EAAE;IACb;IAEA,OAAOG,MAAM;EACjB,CAAC,CAAC,IAAI,EAAE;EAER,OAAO,IAAAiB,uBAAgB,EAAC,GAAGf,aAAa,EAAE,GAAGS,qBAAqB,CAAC;AACvE,CAAC;AAAAO,OAAA,CAAAnB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useLayoutEffect","UnistylesShadowRegistry","jsx","_jsx","Apply","name","setScopedTheme","ScopedTheme","children","previousScopedTheme","getScopedTheme","mappedChildren","Fragment"],"sourceRoot":"../../../src","sources":["components/ScopedTheme.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAE9C,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMlD,MAAMC,KAAK,GAAGA,CAAC;EAAEC;AAAuC,CAAC,KAAK;EAC1DJ,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAE5CL,eAAe,CAAC,MAAM;IAClBC,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAChD,CAAC,CAAC;EAEF,OAAO,IAAI;AACf,CAAC;AAED,OAAO,MAAME,WAAyE,GAAGA,CAAC;EAAEF,IAAI;EAAEG;AAAS,CAAC,KAAK;EAC7G,MAAMC,mBAAmB,GAAGR,uBAAuB,CAACS,cAAc,CAAC,CAAC;EACpE,MAAMC,cAAc,GAAG,cACnBR,IAAA,CAACC,KAAK;IAAYC,IAAI,EAAEA;EAAK,GAAjBA,IAAmB,CAAC,EAChCG,QAAQ,eACRL,IAAA,CAACC,KAAK;IAAeC,IAAI,EAAEI;
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","UnistylesShadowRegistry","jsx","_jsx","Apply","name","setScopedTheme","ScopedTheme","children","previousScopedTheme","getScopedTheme","mappedChildren","Fragment"],"sourceRoot":"../../../src","sources":["components/ScopedTheme.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAE9C,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMlD,MAAMC,KAAK,GAAGA,CAAC;EAAEC;AAAuC,CAAC,KAAK;EAC1DJ,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAE5CL,eAAe,CAAC,MAAM;IAClBC,uBAAuB,CAACK,cAAc,CAACD,IAAI,CAAC;EAChD,CAAC,CAAC;EAEF,OAAO,IAAI;AACf,CAAC;AAED,OAAO,MAAME,WAAyE,GAAGA,CAAC;EAAEF,IAAI;EAAEG;AAAS,CAAC,KAAK;EAC7G,MAAMC,mBAAmB,GAAGR,uBAAuB,CAACS,cAAc,CAAC,CAAC;EACpE,MAAMC,cAAc,GAAG,cACnBR,IAAA,CAACC,KAAK;IAAYC,IAAI,EAAEA;EAAK,GAAjBA,IAAmB,CAAC,EAChCG,QAAQ,eACRL,IAAA,CAACC,KAAK;IAAeC,IAAI,EAAEI;EAAyD,GAAzE,SAA2E,CAAC,CAC1F;EAED,oBACIN,IAAA,CAACJ,KAAK,CAACa,QAAQ;IAAAJ,QAAA,EACVG;EAAc,CACH,CAAC;AAEzB,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Hide","Display","
|
1
|
+
{"version":3,"names":["Hide","Display","ScopedTheme"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,QAAQ,eAAe","ignoreList":[]}
|
@@ -1,6 +1,49 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
import React from 'react';
|
3
4
|
import { ImageBackground as NativeImageBackground } from 'react-native';
|
4
|
-
import {
|
5
|
-
|
5
|
+
import { forwardRef } from 'react';
|
6
|
+
import { getClassName } from '../../core';
|
7
|
+
import { isServer } from '../../web/utils';
|
8
|
+
import { UnistylesShadowRegistry } from '../../web';
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
export const ImageBackground = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
11
|
+
let storedRef = null;
|
12
|
+
let storedImageRef = null;
|
13
|
+
const styleClassNames = getClassName(props.style);
|
14
|
+
const imageClassNames = getClassName(props.imageStyle);
|
15
|
+
return (
|
16
|
+
/*#__PURE__*/
|
17
|
+
// @ts-expect-error - RN types are not compatible with RNW styles
|
18
|
+
_jsx(NativeImageBackground, {
|
19
|
+
...props,
|
20
|
+
style: styleClassNames,
|
21
|
+
imageStyle: imageClassNames,
|
22
|
+
ref: isServer() ? undefined : ref => {
|
23
|
+
if (!ref) {
|
24
|
+
// @ts-expect-error hidden from TS
|
25
|
+
UnistylesShadowRegistry.remove(storedRef, styleClassNames?.hash);
|
26
|
+
}
|
27
|
+
storedRef = ref;
|
28
|
+
// @ts-expect-error hidden from TS
|
29
|
+
UnistylesShadowRegistry.add(ref, styleClassNames?.hash);
|
30
|
+
if (typeof forwardedRef === 'function') {
|
31
|
+
return forwardedRef(ref);
|
32
|
+
}
|
33
|
+
if (forwardedRef) {
|
34
|
+
forwardedRef.current = ref;
|
35
|
+
}
|
36
|
+
},
|
37
|
+
imageRef: isServer() ? undefined : ref => {
|
38
|
+
if (!ref) {
|
39
|
+
// @ts-expect-error hidden from TS
|
40
|
+
UnistylesShadowRegistry.remove(storedImageRef, imageClassNames?.hash);
|
41
|
+
}
|
42
|
+
storedImageRef = ref;
|
43
|
+
// @ts-expect-error hidden from TS
|
44
|
+
UnistylesShadowRegistry.add(ref, imageClassNames?.hash);
|
45
|
+
}
|
46
|
+
})
|
47
|
+
);
|
48
|
+
});
|
6
49
|
//# sourceMappingURL=ImageBackground.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ImageBackground","NativeImageBackground","
|
1
|
+
{"version":3,"names":["React","ImageBackground","NativeImageBackground","forwardRef","getClassName","isServer","UnistylesShadowRegistry","jsx","_jsx","props","forwardedRef","storedRef","storedImageRef","styleClassNames","style","imageClassNames","imageStyle","ref","undefined","remove","hash","add","current","imageRef"],"sourceRoot":"../../../../src","sources":["components/native/ImageBackground.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,IAAIC,qBAAqB,QAAQ,cAAc;AACvE,SAASC,UAAU,QAAQ,OAAO;AAElC,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,uBAAuB,QAAQ,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOnD,OAAO,MAAMP,eAAe,gBAAGE,UAAU,CAAiB,CAACM,KAAK,EAAEC,YAAY,KAAK;EAC/E,IAAIC,SAAuC,GAAG,IAAI;EAClD,IAAIC,cAA4C,GAAG,IAAI;EACvD,MAAMC,eAAe,GAAGT,YAAY,CAACK,KAAK,CAACK,KAAK,CAAC;EACjD,MAAMC,eAAe,GAAGX,YAAY,CAACK,KAAK,CAACO,UAAU,CAAC;EAEtD;IAAA;IACI;IACAR,IAAA,CAACN,qBAAqB;MAAA,GACdO,KAAK;MACTK,KAAK,EAAED,eAAgB;MACvBG,UAAU,EAAED,eAAgB;MAC5BE,GAAG,EAAEZ,QAAQ,CAAC,CAAC,GAAGa,SAAS,GAAGD,GAAG,IAAI;QACjC,IAAI,CAACA,GAAG,EAAE;UACN;UACAX,uBAAuB,CAACa,MAAM,CAACR,SAAS,EAAEE,eAAe,EAAEO,IAAI,CAAC;QACpE;QAEAT,SAAS,GAAGM,GAAG;QACf;QACAX,uBAAuB,CAACe,GAAG,CAACJ,GAAG,EAAEJ,eAAe,EAAEO,IAAI,CAAC;QAEvD,IAAI,OAAOV,YAAY,KAAK,UAAU,EAAE;UACpC,OAAOA,YAAY,CAACO,GAAG,CAAC;QAC5B;QAEA,IAAIP,YAAY,EAAE;UACdA,YAAY,CAACY,OAAO,GAAGL,GAAG;QAC9B;MACJ,CAAE;MACFM,QAAQ,EAAElB,QAAQ,CAAC,CAAC,GAAGa,SAAS,GAAGD,GAAG,IAAI;QACtC,IAAI,CAACA,GAAG,EAAE;UACN;UACAX,uBAAuB,CAACa,MAAM,CAACP,cAAc,EAAEG,eAAe,EAAEK,IAAI,CAAC;QACzE;QAEAR,cAAc,GAAGK,GAAG;QACpB;QACAX,uBAAuB,CAACe,GAAG,CAACJ,GAAG,EAAEF,eAAe,EAAEK,IAAI,CAAC;MAC3D;IAAE,CACL;EAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { ImageBackground as NativeImageBackground } from 'react-native';
|
4
|
+
import { createUnistylesImageBackground } from '../../core';
|
5
|
+
export const ImageBackground = createUnistylesImageBackground(NativeImageBackground);
|
6
|
+
//# sourceMappingURL=ImageBackground.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["ImageBackground","NativeImageBackground","createUnistylesImageBackground"],"sourceRoot":"../../../../src","sources":["components/native/ImageBackground.native.tsx"],"mappings":";;AAAA,SAASA,eAAe,IAAIC,qBAAqB,QAAQ,cAAc;AACvE,SAASC,8BAA8B,QAAQ,YAAY;AAE3D,OAAO,MAAMF,eAAe,GAAGE,8BAA8B,CAACD,qBAAqB,CAAC","ignoreList":[]}
|
@@ -1,68 +1,43 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React, { forwardRef
|
3
|
+
import React, { forwardRef } from 'react';
|
4
4
|
import { Pressable as NativePressableReactNative } from 'react-native';
|
5
5
|
import { UnistylesShadowRegistry } from '../../specs';
|
6
|
+
import { getClassName } from '../../core';
|
7
|
+
import { isServer } from '../../web/utils';
|
6
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
-
const initialState = {
|
8
|
-
pressed: false,
|
9
|
-
hovered: false,
|
10
|
-
focused: false
|
11
|
-
};
|
12
|
-
const extractStyleResult = style => {
|
13
|
-
return typeof style === 'function' ? [style()] : Array.isArray(style) ? style.map(style => typeof style === 'function' ? style() : style) : [style];
|
14
|
-
};
|
15
|
-
const updateStyles = ({
|
16
|
-
ref,
|
17
|
-
style,
|
18
|
-
state,
|
19
|
-
scopedTheme,
|
20
|
-
variants
|
21
|
-
}) => {
|
22
|
-
const styleResult = typeof style === 'function' ? style(state) : style;
|
23
|
-
const extractedResult = extractStyleResult(styleResult);
|
24
|
-
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
25
|
-
const previousVariants = UnistylesShadowRegistry.getVariants();
|
26
|
-
UnistylesShadowRegistry.selectVariants(variants);
|
27
|
-
UnistylesShadowRegistry.setScopedTheme(scopedTheme);
|
28
|
-
UnistylesShadowRegistry.add(ref, extractedResult);
|
29
|
-
UnistylesShadowRegistry.setScopedTheme(previousScopedTheme);
|
30
|
-
UnistylesShadowRegistry.selectVariants(previousVariants);
|
31
|
-
};
|
32
9
|
export const Pressable = /*#__PURE__*/forwardRef(({
|
33
10
|
style,
|
34
11
|
...props
|
35
|
-
},
|
36
|
-
const storedRef = useRef(null);
|
12
|
+
}, forwardedRef) => {
|
37
13
|
const scopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
38
|
-
|
14
|
+
let storedRef = null;
|
15
|
+
let classNames = undefined;
|
39
16
|
return /*#__PURE__*/_jsx(NativePressableReactNative, {
|
40
17
|
...props,
|
41
|
-
|
42
|
-
|
43
|
-
|
18
|
+
ref: isServer() ? undefined : ref => {
|
19
|
+
storedRef = ref;
|
20
|
+
// @ts-expect-error hidden from TS
|
21
|
+
UnistylesShadowRegistry.add(storedRef, classNames?.hash);
|
22
|
+
if (typeof forwardedRef === 'function') {
|
23
|
+
return forwardedRef(ref);
|
44
24
|
}
|
45
|
-
|
46
|
-
|
47
|
-
style: style,
|
48
|
-
variants,
|
49
|
-
scopedTheme,
|
50
|
-
state: state
|
51
|
-
});
|
52
|
-
return {};
|
53
|
-
},
|
54
|
-
ref: ref => {
|
55
|
-
storedRef.current = ref;
|
56
|
-
updateStyles({
|
57
|
-
ref,
|
58
|
-
style: style,
|
59
|
-
variants,
|
60
|
-
scopedTheme,
|
61
|
-
state: initialState
|
62
|
-
});
|
63
|
-
if (typeof passedRef === 'object' && passedRef !== null) {
|
64
|
-
passedRef.current = ref;
|
25
|
+
if (forwardedRef) {
|
26
|
+
forwardedRef.current = ref;
|
65
27
|
}
|
28
|
+
},
|
29
|
+
style: state => {
|
30
|
+
const styleResult = typeof style === 'function' ? style(state) : style;
|
31
|
+
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
32
|
+
UnistylesShadowRegistry.setScopedTheme(scopedTheme);
|
33
|
+
|
34
|
+
// @ts-expect-error hidden from TS
|
35
|
+
UnistylesShadowRegistry.remove(storedRef, classNames?.hash);
|
36
|
+
classNames = getClassName(styleResult);
|
37
|
+
// @ts-expect-error hidden from TS
|
38
|
+
UnistylesShadowRegistry.add(storedRef, classNames?.hash);
|
39
|
+
UnistylesShadowRegistry.setScopedTheme(previousScopedTheme);
|
40
|
+
return classNames;
|
66
41
|
}
|
67
42
|
});
|
68
43
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","
|
1
|
+
{"version":3,"names":["React","forwardRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","getClassName","isServer","jsx","_jsx","style","props","forwardedRef","scopedTheme","getScopedTheme","storedRef","classNames","undefined","ref","add","hash","current","state","styleResult","previousScopedTheme","setScopedTheme","remove"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,aAAa;AAErD,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,QAAQ,QAAQ,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAgB1C,OAAO,MAAMN,SAAS,gBAAGD,UAAU,CAAuB,CAAC;EAAEQ,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,KAAK;EAC7F,MAAMC,WAAW,GAAGR,uBAAuB,CAACS,cAAc,CAAC,CAAC;EAC5D,IAAIC,SAA6B,GAAG,IAAI;EACxC,IAAIC,UAAuD,GAAGC,SAAS;EAEvE,oBACIR,IAAA,CAACL,0BAA0B;IAAA,GACnBO,KAAK;IACTO,GAAG,EAAEX,QAAQ,CAAC,CAAC,GAAGU,SAAS,GAAGC,GAAG,IAAI;MACjCH,SAAS,GAAGG,GAA6B;MACzC;MACAb,uBAAuB,CAACc,GAAG,CAACJ,SAAS,EAAEC,UAAU,EAAEI,IAAI,CAAC;MAExD,IAAI,OAAOR,YAAY,KAAK,UAAU,EAAE;QACpC,OAAOA,YAAY,CAACM,GAAG,CAAC;MAC5B;MAEA,IAAIN,YAAY,EAAE;QACdA,YAAY,CAACS,OAAO,GAAGH,GAAG;MAC9B;IACJ,CAAE;IACFR,KAAK,EAAEY,KAAK,IAAI;MACZ,MAAMC,WAAW,GAAG,OAAOb,KAAK,KAAK,UAAU,GACzCA,KAAK,CAACY,KAA0B,CAAC,GACjCZ,KAAK;MACX,MAAMc,mBAAmB,GAAGnB,uBAAuB,CAACS,cAAc,CAAC,CAAC;MAEpET,uBAAuB,CAACoB,cAAc,CAACZ,WAAW,CAAC;;MAEnD;MACAR,uBAAuB,CAACqB,MAAM,CAACX,SAAS,EAAEC,UAAU,EAAEI,IAAI,CAAC;MAC3DJ,UAAU,GAAGV,YAAY,CAACiB,WAA8B,CAAC;MACzD;MACAlB,uBAAuB,CAACc,GAAG,CAACJ,SAAS,EAAEC,UAAU,EAAEI,IAAI,CAAC;MAExDf,uBAAuB,CAACoB,cAAc,CAACD,mBAAmB,CAAC;MAE3D,OAAOR,UAAU;IACrB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React, { forwardRef, useRef } from 'react';
|
3
|
+
import React, { forwardRef, useEffect, useRef } from 'react';
|
4
4
|
import { Pressable as NativePressableReactNative } from 'react-native';
|
5
5
|
import { UnistylesShadowRegistry } from '../../specs';
|
6
6
|
import { passForwardedRef } from '../../core';
|
@@ -11,33 +11,36 @@ export const Pressable = /*#__PURE__*/forwardRef(({
|
|
11
11
|
...props
|
12
12
|
}, forwardedRef) => {
|
13
13
|
const storedRef = useRef();
|
14
|
+
useEffect(() => {
|
15
|
+
return () => {
|
16
|
+
if (storedRef.current) {
|
17
|
+
// @ts-expect-error - this is hidden from TS
|
18
|
+
UnistylesShadowRegistry.remove(storedRef.current);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
}, []);
|
14
22
|
return /*#__PURE__*/_jsx(NativePressableReactNative, {
|
15
23
|
...props,
|
16
24
|
ref: ref => {
|
17
25
|
const unistyles = typeof style === 'function' ? style({
|
18
26
|
pressed: false
|
19
27
|
}) : style;
|
20
|
-
const styles = Array.isArray(unistyles) ? unistyles : [unistyles];
|
21
28
|
|
22
|
-
// @ts-expect-error
|
23
|
-
UnistylesShadowRegistry.add(ref,
|
24
|
-
|
29
|
+
// @ts-expect-error web types are not compatible with RN styles
|
30
|
+
UnistylesShadowRegistry.add(ref, unistyles);
|
31
|
+
if (ref) {
|
32
|
+
storedRef.current = ref;
|
33
|
+
}
|
25
34
|
return passForwardedRef(props, ref, forwardedRef);
|
26
35
|
},
|
27
36
|
style: state => {
|
28
37
|
const unistyles = typeof style === 'function' ? style(state) : style;
|
29
|
-
const styles = Array.isArray(unistyles) ? unistyles : [unistyles];
|
30
38
|
if (!storedRef.current) {
|
31
39
|
return unistyles;
|
32
40
|
}
|
33
|
-
if (state.pressed) {
|
34
|
-
UnistylesShadowRegistry.selectVariants(variants);
|
35
|
-
}
|
36
41
|
|
37
42
|
// @ts-expect-error - this is hidden from TS
|
38
|
-
UnistylesShadowRegistry.
|
39
|
-
// @ts-expect-error - this is hidden from TS
|
40
|
-
UnistylesShadowRegistry.add(storedRef.current, styles);
|
43
|
+
UnistylesShadowRegistry.add(storedRef.current, unistyles);
|
41
44
|
return unistyles;
|
42
45
|
}
|
43
46
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","passForwardedRef","jsx","_jsx","variants","style","props","forwardedRef","storedRef","
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","passForwardedRef","jsx","_jsx","variants","style","props","forwardedRef","storedRef","current","remove","ref","unistyles","pressed","add","state"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,aAAa;AACrD,SAASC,gBAAgB,QAAQ,YAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAM7C,OAAO,MAAML,SAAS,gBAAGH,UAAU,CAAuB,CAAC;EAAES,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,KAAK;EACvG,MAAMC,SAAS,GAAGX,MAAM,CAAc,CAAC;EAEvCD,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACT,IAAIY,SAAS,CAACC,OAAO,EAAE;QACnB;QACAT,uBAAuB,CAACU,MAAM,CAACF,SAAS,CAACC,OAAO,CAAC;MACrD;IACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBACIN,IAAA,CAACJ,0BAA0B;IAAA,GACnBO,KAAK;IACTK,GAAG,EAAEA,GAAG,IAAI;MACR,MAAMC,SAAS,GAAG,OAAOP,KAAK,KAAK,UAAU,GACvCA,KAAK,CAAC;QAAEQ,OAAO,EAAE;MAAM,CAAC,CAAC,GACzBR,KAAK;;MAEX;MACAL,uBAAuB,CAACc,GAAG,CAACH,GAAG,EAAEC,SAAS,CAAC;MAE3C,IAAID,GAAG,EAAE;QACLH,SAAS,CAACC,OAAO,GAAGE,GAAG;MAC3B;MAEA,OAAOV,gBAAgB,CAACK,KAAK,EAAEK,GAAG,EAAEJ,YAAY,CAAC;IACrD,CAAE;IACFF,KAAK,EAAEU,KAAK,IAAI;MACZ,MAAMH,SAAS,GAAG,OAAOP,KAAK,KAAK,UAAU,GACvCA,KAAK,CAACU,KAAK,CAAC,GACZV,KAAK;MAEX,IAAI,CAACG,SAAS,CAACC,OAAO,EAAE;QACpB,OAAOG,SAAS;MACpB;;MAEA;MACAZ,uBAAuB,CAACc,GAAG,CAACN,SAAS,CAACC,OAAO,EAAEG,SAAS,CAAC;MAEzD,OAAOA,SAAS;IACpB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -1,10 +1,34 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import React from 'react';
|
4
|
-
import {
|
4
|
+
import { getClassName } from './getClassname';
|
5
|
+
import { isServer } from '../web/utils';
|
6
|
+
import { UnistylesShadowRegistry } from '../web';
|
7
|
+
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
5
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
-
export const createUnistylesElement = Component => /*#__PURE__*/React.forwardRef((props, forwardedRef) =>
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
export const createUnistylesElement = Component => /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
10
|
+
let storedRef = null;
|
11
|
+
const classNames = getClassName(props.style);
|
12
|
+
return /*#__PURE__*/_jsx(Component, {
|
13
|
+
...props,
|
14
|
+
style: classNames,
|
15
|
+
ref: isServer() ? undefined : ref => {
|
16
|
+
// @ts-ignore we don't know the type of the component
|
17
|
+
maybeWarnAboutMultipleUnistyles(props.style, Component.displayName);
|
18
|
+
if (!ref) {
|
19
|
+
// @ts-expect-error hidden from TS
|
20
|
+
UnistylesShadowRegistry.remove(storedRef, classNames?.hash);
|
21
|
+
}
|
22
|
+
storedRef = ref;
|
23
|
+
// @ts-expect-error hidden from TS
|
24
|
+
UnistylesShadowRegistry.add(ref, classNames?.hash);
|
25
|
+
if (typeof forwardedRef === 'function') {
|
26
|
+
return forwardedRef(ref);
|
27
|
+
}
|
28
|
+
if (forwardedRef) {
|
29
|
+
forwardedRef.current = ref;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
});
|
33
|
+
});
|
10
34
|
//# sourceMappingURL=createUnistylesElement.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","
|
1
|
+
{"version":3,"names":["React","getClassName","isServer","UnistylesShadowRegistry","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesElement","Component","forwardRef","props","forwardedRef","storedRef","classNames","style","ref","undefined","displayName","remove","hash","add","current"],"sourceRoot":"../../../src","sources":["core/createUnistylesElement.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,uBAAuB,QAAQ,QAAQ;AAChD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMxD,OAAO,MAAMC,sBAAsB,GAAIC,SAAc,iBAAKR,KAAK,CAACS,UAAU,CAA0B,CAACC,KAAK,EAAEC,YAAY,KAAK;EACzH,IAAIC,SAA6B,GAAG,IAAI;EACxC,MAAMC,UAAU,GAAGZ,YAAY,CAACS,KAAK,CAACI,KAAK,CAAC;EAE5C,oBACIR,IAAA,CAACE,SAAS;IAAA,GACFE,KAAK;IACTI,KAAK,EAAED,UAAW;IAClBE,GAAG,EAAEb,QAAQ,CAAC,CAAC,GAAGc,SAAS,GAAID,GAAuB,IAAK;MACvD;MACAX,+BAA+B,CAACM,KAAK,CAACI,KAAK,EAAEN,SAAS,CAACS,WAAW,CAAC;MAEnE,IAAI,CAACF,GAAG,EAAE;QACN;QACAZ,uBAAuB,CAACe,MAAM,CAACN,SAAS,EAAEC,UAAU,EAAEM,IAAI,CAAC;MAC/D;MAEAP,SAAS,GAAGG,GAAG;MACf;MACAZ,uBAAuB,CAACiB,GAAG,CAACL,GAAG,EAAEF,UAAU,EAAEM,IAAI,CAAC;MAElD,IAAI,OAAOR,YAAY,KAAK,UAAU,EAAE;QACpC,OAAOA,YAAY,CAACI,GAAG,CAAC;MAC5B;MAEA,IAAIJ,YAAY,EAAE;QACdA,YAAY,CAACU,OAAO,GAAGN,GAAG;MAC9B;IACJ;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import React, { useEffect, useRef } from 'react';
|
4
|
+
import { UnistylesShadowRegistry } from '../specs';
|
5
|
+
import { passForwardedRef } from './passForwardRef';
|
6
|
+
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
export const createUnistylesElement = Component => /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
9
|
+
const storedRef = useRef(null);
|
10
|
+
useEffect(() => {
|
11
|
+
return () => {
|
12
|
+
if (storedRef.current) {
|
13
|
+
// @ts-ignore
|
14
|
+
UnistylesShadowRegistry.remove(storedRef.current);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
}, []);
|
18
|
+
return /*#__PURE__*/_jsx(Component, {
|
19
|
+
...props,
|
20
|
+
ref: ref => {
|
21
|
+
if (ref) {
|
22
|
+
storedRef.current = Component.name === 'KeyboardAvoidingView'
|
23
|
+
// @ts-ignore this is special case for KeyboardAvoidingView
|
24
|
+
? ref.viewRef.current : ref;
|
25
|
+
}
|
26
|
+
passForwardedRef(props, ref, forwardedRef);
|
27
|
+
|
28
|
+
// @ts-ignore we don't know the type of the component
|
29
|
+
maybeWarnAboutMultipleUnistyles(props.style, Component.displayName);
|
30
|
+
}
|
31
|
+
});
|
32
|
+
});
|
33
|
+
//# sourceMappingURL=createUnistylesElement.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","UnistylesShadowRegistry","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesElement","Component","forwardRef","props","forwardedRef","storedRef","current","remove","ref","name","viewRef","style","displayName"],"sourceRoot":"../../../src","sources":["core/createUnistylesElement.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,MAAMC,sBAAsB,GAAIC,SAAc,iBAAKT,KAAK,CAACU,UAAU,CAAC,CAACC,KAAK,EAAEC,YAAY,KAAK;EAChG,MAAMC,SAAS,GAAGX,MAAM,CAAU,IAAI,CAAC;EAEvCD,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACT,IAAIY,SAAS,CAACC,OAAO,EAAE;QACnB;QACAX,uBAAuB,CAACY,MAAM,CAACF,SAAS,CAACC,OAAO,CAAC;MACrD;IACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBACIP,IAAA,CAACE,SAAS;IAAA,GACFE,KAAK;IACTK,GAAG,EAAGA,GAAY,IAAK;MACnB,IAAIA,GAAG,EAAE;QACLH,SAAS,CAACC,OAAO,GAAGL,SAAS,CAACQ,IAAI,KAAK;QACnC;QAAA,EACED,GAAG,CAACE,OAAO,CAACJ,OAAO,GACnBE,GAAG;MACb;MAEAZ,gBAAgB,CAACO,KAAK,EAAEK,GAAG,EAAEJ,YAAY,CAAC;;MAE1C;MACAP,+BAA+B,CAACM,KAAK,CAACQ,KAAK,EAAEV,SAAS,CAACW,WAAW,CAAC;IACvE;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -1,21 +1,42 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React from 'react';
|
3
|
+
import React, { useEffect, useRef } from 'react';
|
4
4
|
import { UnistylesShadowRegistry } from '../specs';
|
5
5
|
import { passForwardedRef } from './passForwardRef';
|
6
|
+
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
-
export const createUnistylesImageBackground = Component => /*#__PURE__*/React.forwardRef((props, forwardedRef) =>
|
8
|
-
|
9
|
-
|
10
|
-
imageRef: ref => {
|
11
|
-
const style = Array.isArray(props.imageStyle) ? props.imageStyle : [props.imageStyle];
|
12
|
-
|
13
|
-
// @ts-expect-error - This is hidden from TS
|
14
|
-
UnistylesShadowRegistry.add(ref, style);
|
8
|
+
export const createUnistylesImageBackground = Component => /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
9
|
+
const storedImageRef = useRef(null);
|
10
|
+
useEffect(() => {
|
15
11
|
return () => {
|
16
|
-
|
17
|
-
|
12
|
+
if (storedImageRef.current) {
|
13
|
+
// @ts-ignore
|
14
|
+
UnistylesShadowRegistry.remove(storedImageRef.current);
|
15
|
+
}
|
18
16
|
};
|
19
|
-
}
|
20
|
-
|
17
|
+
}, []);
|
18
|
+
|
19
|
+
// @ts-expect-error we don't know the type of the component
|
20
|
+
maybeWarnAboutMultipleUnistyles(props.style, 'ImageBackground');
|
21
|
+
// @ts-ignore we don't know the type of the component
|
22
|
+
maybeWarnAboutMultipleUnistyles(props.imageStyle, 'ImageBackground');
|
23
|
+
return /*#__PURE__*/_jsx(Component, {
|
24
|
+
...props,
|
25
|
+
ref: ref => {
|
26
|
+
passForwardedRef(props, ref, forwardedRef);
|
27
|
+
return () => {
|
28
|
+
// @ts-ignore
|
29
|
+
UnistylesShadowRegistry.remove(ref);
|
30
|
+
};
|
31
|
+
},
|
32
|
+
imageRef: ref => {
|
33
|
+
if (ref) {
|
34
|
+
storedImageRef.current = ref;
|
35
|
+
}
|
36
|
+
|
37
|
+
// @ts-expect-error web types are not compatible with RN styles
|
38
|
+
UnistylesShadowRegistry.add(ref, props.imageStyle);
|
39
|
+
}
|
40
|
+
});
|
41
|
+
});
|
21
42
|
//# sourceMappingURL=createUnistylesImageBackground.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","UnistylesShadowRegistry","passForwardedRef","jsx","_jsx","createUnistylesImageBackground","Component","forwardRef","props","forwardedRef","
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","UnistylesShadowRegistry","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesImageBackground","Component","forwardRef","props","forwardedRef","storedImageRef","current","remove","style","imageStyle","ref","imageRef","add"],"sourceRoot":"../../../src","sources":["core/createUnistylesImageBackground.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEhD,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,MAAMC,8BAA8B,GAAIC,SAAiC,iBAAKT,KAAK,CAACU,UAAU,CAAwC,CAACC,KAAK,EAAEC,YAAY,KAAK;EAClK,MAAMC,cAAc,GAAGX,MAAM,CAAe,IAAI,CAAC;EAEjDD,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACT,IAAIY,cAAc,CAACC,OAAO,EAAE;QACxB;QACAX,uBAAuB,CAACY,MAAM,CAACF,cAAc,CAACC,OAAO,CAAC;MAC1D;IACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;;EAEN;EACAT,+BAA+B,CAACM,KAAK,CAACK,KAAK,EAAE,iBAAiB,CAAC;EAC/D;EACAX,+BAA+B,CAACM,KAAK,CAACM,UAAU,EAAE,iBAAiB,CAAC;EAEpE,oBACIV,IAAA,CAACE,SAAS;IAAA,GACFE,KAAK;IACTO,GAAG,EAAEA,GAAG,IAAI;MACRd,gBAAgB,CAACO,KAAK,EAAEO,GAAG,EAAEN,YAAY,CAAC;MAE1C,OAAO,MAAM;QACT;QACAT,uBAAuB,CAACY,MAAM,CAACG,GAAG,CAAC;MACvC,CAAC;IACL,CAAE;IACFC,QAAQ,EAAED,GAAG,IAAI;MACb,IAAIA,GAAG,EAAE;QACLL,cAAc,CAACC,OAAO,GAAGI,GAAG;MAChC;;MAEA;MACAf,uBAAuB,CAACiB,GAAG,CAACF,GAAG,EAAEP,KAAK,CAACM,UAAU,CAAC;IACtD;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|