react-native-unistyles 3.0.0-alpha.9 → 3.0.0-beta.2
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/LICENSE +1 -1
- package/README.md +30 -41
- package/Unistyles.podspec +8 -2
- package/android/CMakeLists.txt +22 -45
- package/android/build.gradle +22 -5
- package/android/src/main/cxx/NativeUnistylesModule.cpp +71 -0
- package/android/src/main/cxx/NativeUnistylesModule.h +42 -0
- package/android/src/main/cxx/cpp-adapter.cpp +8 -86
- package/android/src/main/java/com/unistyles/Equatable.kt +61 -0
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +294 -0
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +152 -0
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +59 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +51 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +16 -14
- package/cxx/NativePlatform.h +11 -0
- package/cxx/common/Constants.h +5 -0
- package/cxx/common/Helpers.h +59 -6
- package/cxx/core/HostStyle.cpp +14 -4
- package/cxx/core/HostStyle.h +6 -1
- package/cxx/core/StyleSheet.h +0 -1
- package/cxx/core/Unistyle.h +8 -5
- package/cxx/core/UnistyleData.h +4 -3
- package/cxx/core/UnistyleWrapper.h +102 -7
- package/cxx/core/UnistylesCommitHook.cpp +14 -18
- package/cxx/core/UnistylesCommitHook.h +6 -11
- package/cxx/core/UnistylesCommitShadowNode.h +13 -0
- package/cxx/core/UnistylesMountHook.cpp +28 -0
- package/cxx/core/UnistylesMountHook.h +27 -0
- package/cxx/core/UnistylesRegistry.cpp +104 -51
- package/cxx/core/UnistylesRegistry.h +17 -11
- package/cxx/core/UnistylesState.cpp +29 -8
- package/cxx/core/UnistylesState.h +5 -2
- package/cxx/hybridObjects/HybridNavigationBar.cpp +0 -4
- package/cxx/hybridObjects/HybridNavigationBar.h +3 -4
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +114 -13
- package/cxx/hybridObjects/HybridShadowRegistry.h +21 -2
- package/cxx/hybridObjects/HybridStatusBar.cpp +0 -4
- package/cxx/hybridObjects/HybridStatusBar.h +3 -4
- package/cxx/hybridObjects/HybridStyleSheet.cpp +145 -19
- package/cxx/hybridObjects/HybridStyleSheet.h +27 -5
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +82 -11
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +17 -3
- package/cxx/parser/Parser.cpp +363 -70
- package/cxx/parser/Parser.h +10 -6
- package/cxx/shadowTree/ShadowLeafUpdate.h +3 -1
- package/cxx/shadowTree/ShadowTrafficController.h +71 -0
- package/cxx/shadowTree/ShadowTreeManager.cpp +28 -19
- package/cxx/shadowTree/ShadowTreeManager.h +3 -2
- package/ios/Equatable.swift +2 -1
- package/ios/Extensions.swift +3 -1
- package/ios/NativePlatform+ios.swift +34 -9
- package/ios/NativePlatform+keyboard.swift +83 -0
- package/ios/NativePlatformListener+ios.swift +36 -24
- package/ios/Unistyles.h +1 -0
- package/ios/UnistylesModuleOnLoad.h +8 -2
- package/ios/UnistylesModuleOnLoad.mm +11 -3
- package/lib/commonjs/components/Display.js +18 -0
- package/lib/commonjs/components/Display.js.map +1 -0
- package/lib/commonjs/components/Hide.js +18 -0
- package/lib/commonjs/components/Hide.js.map +1 -0
- package/lib/commonjs/components/ScopedTheme.js +36 -0
- package/lib/commonjs/components/ScopedTheme.js.map +1 -0
- package/lib/commonjs/components/Variants.js +33 -0
- package/lib/commonjs/components/Variants.js.map +1 -0
- package/lib/commonjs/components/index.js +34 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/components/native/ActivityIndicator.js +10 -0
- package/lib/commonjs/components/native/ActivityIndicator.js.map +1 -0
- package/lib/commonjs/components/native/FlatList.js +10 -0
- package/lib/commonjs/components/native/FlatList.js.map +1 -0
- package/lib/commonjs/components/native/Image.js +10 -0
- package/lib/commonjs/components/native/Image.js.map +1 -0
- package/lib/commonjs/components/native/ImageBackground.js +10 -0
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -0
- package/lib/commonjs/components/native/KeyboardAvoidingView.js +10 -0
- package/lib/commonjs/components/native/KeyboardAvoidingView.js.map +1 -0
- package/lib/commonjs/components/native/Pressable.js +75 -0
- package/lib/commonjs/components/native/Pressable.js.map +1 -0
- package/lib/commonjs/components/native/Pressable.native.js +48 -0
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -0
- package/lib/commonjs/components/native/RefreshControl.js +10 -0
- package/lib/commonjs/components/native/RefreshControl.js.map +1 -0
- package/lib/commonjs/components/native/ScrollView.js +10 -0
- package/lib/commonjs/components/native/ScrollView.js.map +1 -0
- package/lib/commonjs/components/native/SectionList.js +10 -0
- package/lib/commonjs/components/native/SectionList.js.map +1 -0
- package/lib/commonjs/components/native/Switch.js +10 -0
- package/lib/commonjs/components/native/Switch.js.map +1 -0
- package/lib/commonjs/components/native/Text.js +10 -0
- package/lib/commonjs/components/native/Text.js.map +1 -0
- package/lib/commonjs/components/native/TextInput.js +10 -0
- package/lib/commonjs/components/native/TextInput.js.map +1 -0
- package/lib/commonjs/components/native/TouchableHighlight.js +10 -0
- package/lib/commonjs/components/native/TouchableHighlight.js.map +1 -0
- package/lib/commonjs/components/native/TouchableOpacity.js +10 -0
- package/lib/commonjs/components/native/TouchableOpacity.js.map +1 -0
- package/lib/commonjs/components/native/View.js +10 -0
- package/lib/commonjs/components/native/View.js.map +1 -0
- package/lib/commonjs/components/native/VirtualizedList.js +10 -0
- package/lib/commonjs/components/native/VirtualizedList.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.js +16 -0
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -0
- package/lib/commonjs/core/createUnistylesElement.js +16 -0
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -0
- package/lib/commonjs/core/createUnistylesImageBackground.js +27 -0
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -0
- package/lib/commonjs/core/index.js +41 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/core/passForwardRef.js +27 -0
- package/lib/commonjs/core/passForwardRef.js.map +1 -0
- package/lib/commonjs/core/withUnistyles/index.js +13 -0
- package/lib/commonjs/core/withUnistyles/index.js.map +1 -0
- package/lib/commonjs/core/withUnistyles/types.js +8 -0
- package/lib/commonjs/core/withUnistyles/types.js.map +1 -0
- package/lib/commonjs/core/withUnistyles/useDependencies.js +81 -0
- package/lib/commonjs/core/withUnistyles/useDependencies.js.map +1 -0
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +88 -0
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -0
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +96 -0
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -0
- package/lib/commonjs/hooks/index.js +13 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useMedia.js +43 -0
- package/lib/commonjs/hooks/useMedia.js.map +1 -0
- package/lib/commonjs/hooks/useMedia.native.js +60 -0
- package/lib/commonjs/hooks/useMedia.native.js.map +1 -0
- package/lib/commonjs/index.js +45 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +31 -18
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +1 -0
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js +0 -15
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +12 -9
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js +0 -5
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js +1 -0
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +0 -2
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.js +17 -36
- package/lib/commonjs/specs/index.js.map +1 -1
- package/lib/commonjs/specs/index.native.js +54 -0
- package/lib/commonjs/specs/index.native.js.map +1 -0
- package/lib/commonjs/types/stylesheet.js.map +1 -1
- package/lib/commonjs/utils.js +26 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/web/convert/index.js +27 -24
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +59 -0
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/object/filter.js +42 -0
- package/lib/commonjs/web/convert/object/filter.js.map +1 -0
- package/lib/commonjs/web/convert/object/index.js +39 -0
- package/lib/commonjs/web/convert/object/index.js.map +1 -0
- package/lib/commonjs/web/convert/object/objectStyle.js +56 -0
- package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -0
- package/lib/commonjs/web/convert/object/transform.js +27 -0
- package/lib/commonjs/web/convert/object/transform.js.map +1 -0
- package/lib/commonjs/web/convert/pseudo.js +10 -0
- package/lib/commonjs/web/convert/pseudo.js.map +1 -0
- package/lib/commonjs/web/convert/{boxShadow.js → shadow/boxShadow.js} +22 -37
- package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js +38 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/index.js +28 -0
- package/lib/commonjs/web/convert/shadow/index.js.map +1 -0
- package/lib/commonjs/web/convert/{textShadow.js → shadow/textShadow.js} +21 -35
- package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +11 -7
- package/lib/commonjs/web/convert/style.js.map +1 -1
- package/lib/commonjs/web/convert/types.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js +8 -4
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/create.js +21 -74
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/index.js +18 -7
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/listener.js +61 -0
- package/lib/commonjs/web/listener.js.map +1 -0
- package/lib/commonjs/web/mock.js +2 -12
- package/lib/commonjs/web/mock.js.map +1 -1
- package/lib/commonjs/web/registry.js +161 -19
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +25 -14
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +150 -0
- package/lib/commonjs/web/shadowRegistry.js.map +1 -0
- package/lib/commonjs/web/state.js +31 -72
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +39 -0
- package/lib/commonjs/web/utils/common.js.map +1 -0
- package/lib/commonjs/web/utils/index.js +28 -0
- package/lib/commonjs/web/utils/index.js.map +1 -0
- package/lib/commonjs/web/utils/unistyle.js +77 -0
- package/lib/commonjs/web/utils/unistyle.js.map +1 -0
- package/lib/commonjs/web/{variants/getVariants.js → variants.js} +2 -2
- package/lib/commonjs/web/variants.js.map +1 -0
- package/lib/module/components/Display.js +13 -0
- package/lib/module/components/Display.js.map +1 -0
- package/lib/module/components/Hide.js +13 -0
- package/lib/module/components/Hide.js.map +1 -0
- package/lib/module/components/ScopedTheme.js +29 -0
- package/lib/module/components/ScopedTheme.js.map +1 -0
- package/lib/module/components/Variants.js +26 -0
- package/lib/module/components/Variants.js.map +1 -0
- package/lib/module/components/index.js +7 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/components/native/ActivityIndicator.js +6 -0
- package/lib/module/components/native/ActivityIndicator.js.map +1 -0
- package/lib/module/components/native/FlatList.js +6 -0
- package/lib/module/components/native/FlatList.js.map +1 -0
- package/lib/module/components/native/Image.js +6 -0
- package/lib/module/components/native/Image.js.map +1 -0
- package/lib/module/components/native/ImageBackground.js +6 -0
- package/lib/module/components/native/ImageBackground.js.map +1 -0
- package/lib/module/components/native/KeyboardAvoidingView.js +6 -0
- package/lib/module/components/native/KeyboardAvoidingView.js.map +1 -0
- package/lib/module/components/native/Pressable.js +69 -0
- package/lib/module/components/native/Pressable.js.map +1 -0
- package/lib/module/components/native/Pressable.native.js +42 -0
- package/lib/module/components/native/Pressable.native.js.map +1 -0
- package/lib/module/components/native/RefreshControl.js +6 -0
- package/lib/module/components/native/RefreshControl.js.map +1 -0
- package/lib/module/components/native/ScrollView.js +6 -0
- package/lib/module/components/native/ScrollView.js.map +1 -0
- package/lib/module/components/native/SectionList.js +6 -0
- package/lib/module/components/native/SectionList.js.map +1 -0
- package/lib/module/components/native/Switch.js +6 -0
- package/lib/module/components/native/Switch.js.map +1 -0
- package/lib/module/components/native/Text.js +6 -0
- package/lib/module/components/native/Text.js.map +1 -0
- package/lib/module/components/native/TextInput.js +6 -0
- package/lib/module/components/native/TextInput.js.map +1 -0
- package/lib/module/components/native/TouchableHighlight.js +6 -0
- package/lib/module/components/native/TouchableHighlight.js.map +1 -0
- package/lib/module/components/native/TouchableOpacity.js +6 -0
- package/lib/module/components/native/TouchableOpacity.js.map +1 -0
- package/lib/module/components/native/View.js +6 -0
- package/lib/module/components/native/View.js.map +1 -0
- package/lib/module/components/native/VirtualizedList.js +6 -0
- package/lib/module/components/native/VirtualizedList.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.js +11 -0
- package/lib/module/core/createUnistylesComponent.js.map +1 -0
- package/lib/module/core/createUnistylesElement.js +10 -0
- package/lib/module/core/createUnistylesElement.js.map +1 -0
- package/lib/module/core/createUnistylesImageBackground.js +21 -0
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -0
- package/lib/module/core/index.js +8 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/core/passForwardRef.js +22 -0
- package/lib/module/core/passForwardRef.js.map +1 -0
- package/lib/module/core/withUnistyles/index.js +4 -0
- package/lib/module/core/withUnistyles/index.js.map +1 -0
- package/lib/module/core/withUnistyles/types.js +4 -0
- package/lib/module/core/withUnistyles/types.js.map +1 -0
- package/lib/module/core/withUnistyles/useDependencies.js +75 -0
- package/lib/module/core/withUnistyles/useDependencies.js.map +1 -0
- package/lib/module/core/withUnistyles/withUnistyles.js +81 -0
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -0
- package/lib/module/core/withUnistyles/withUnistyles.native.js +89 -0
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -0
- package/lib/module/hooks/index.js +4 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useMedia.js +38 -0
- package/lib/module/hooks/useMedia.js.map +1 -0
- package/lib/module/hooks/useMedia.native.js +55 -0
- package/lib/module/hooks/useMedia.native.js.map +1 -0
- package/lib/module/index.js +2 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +27 -17
- package/lib/module/mq.js.map +1 -1
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +1 -0
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/module/specs/NavigtionBar/index.js +0 -10
- package/lib/module/specs/NavigtionBar/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +12 -9
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js +1 -6
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js +1 -0
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +0 -2
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.js +2 -7
- package/lib/module/specs/index.js.map +1 -1
- package/lib/module/specs/index.native.js +11 -0
- package/lib/module/specs/index.native.js.map +1 -0
- package/lib/module/types/stylesheet.js.map +1 -1
- package/lib/module/utils.js +21 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/web/convert/index.js +23 -20
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +54 -0
- package/lib/module/web/convert/object/boxShadow.js.map +1 -0
- package/lib/module/web/convert/object/filter.js +37 -0
- package/lib/module/web/convert/object/filter.js.map +1 -0
- package/lib/module/web/convert/object/index.js +6 -0
- package/lib/module/web/convert/object/index.js.map +1 -0
- package/lib/module/web/convert/object/objectStyle.js +51 -0
- package/lib/module/web/convert/object/objectStyle.js.map +1 -0
- package/lib/module/web/convert/object/transform.js +22 -0
- package/lib/module/web/convert/object/transform.js.map +1 -0
- package/lib/module/web/convert/pseudo.js +5 -0
- package/lib/module/web/convert/pseudo.js.map +1 -0
- package/lib/module/web/convert/shadow/boxShadow.js +57 -0
- package/lib/module/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js +33 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/module/web/convert/shadow/index.js +5 -0
- package/lib/module/web/convert/shadow/index.js.map +1 -0
- package/lib/module/web/convert/shadow/textShadow.js +54 -0
- package/lib/module/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/module/web/convert/style.js +11 -7
- package/lib/module/web/convert/style.js.map +1 -1
- package/lib/module/web/convert/types.js.map +1 -1
- package/lib/module/web/convert/utils.js +5 -3
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/create.js +22 -75
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/index.js +10 -4
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/listener.js +57 -0
- package/lib/module/web/listener.js.map +1 -0
- package/lib/module/web/mock.js +1 -11
- package/lib/module/web/mock.js.map +1 -1
- package/lib/module/web/registry.js +162 -20
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +25 -14
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +146 -0
- package/lib/module/web/shadowRegistry.js.map +1 -0
- package/lib/module/web/state.js +32 -73
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/utils/common.js +28 -0
- package/lib/module/web/utils/common.js.map +1 -0
- package/lib/module/web/utils/index.js +5 -0
- package/lib/module/web/utils/index.js.map +1 -0
- package/lib/module/web/utils/unistyle.js +65 -0
- package/lib/module/web/utils/unistyle.js.map +1 -0
- package/lib/module/web/{variants/getVariants.js → variants.js} +2 -2
- package/lib/module/web/variants.js.map +1 -0
- package/lib/typescript/src/components/Display.d.ts +7 -0
- package/lib/typescript/src/components/Display.d.ts.map +1 -0
- package/lib/typescript/src/components/Hide.d.ts +7 -0
- package/lib/typescript/src/components/Hide.d.ts.map +1 -0
- package/lib/typescript/src/components/ScopedTheme.d.ts +8 -0
- package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -0
- package/lib/typescript/src/components/Variants.d.ts +7 -0
- package/lib/typescript/src/components/Variants.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +5 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts +2 -0
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -0
- package/lib/typescript/src/components/native/FlatList.d.ts +2 -0
- package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Image.d.ts +2 -0
- package/lib/typescript/src/components/native/Image.d.ts.map +1 -0
- package/lib/typescript/src/components/native/ImageBackground.d.ts +3 -0
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -0
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +2 -0
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Pressable.d.ts +15 -0
- package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Pressable.native.d.ts +6 -0
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/RefreshControl.d.ts +2 -0
- package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -0
- package/lib/typescript/src/components/native/ScrollView.d.ts +2 -0
- package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -0
- package/lib/typescript/src/components/native/SectionList.d.ts +2 -0
- package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Switch.d.ts +2 -0
- package/lib/typescript/src/components/native/Switch.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Text.d.ts +2 -0
- package/lib/typescript/src/components/native/Text.d.ts.map +1 -0
- package/lib/typescript/src/components/native/TextInput.d.ts +2 -0
- package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -0
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts +2 -0
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -0
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts +2 -0
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -0
- package/lib/typescript/src/components/native/View.d.ts +2 -0
- package/lib/typescript/src/components/native/View.d.ts.map +1 -0
- package/lib/typescript/src/components/native/VirtualizedList.d.ts +2 -0
- package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +14 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesElement.d.ts +3 -0
- package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts +4 -0
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +6 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/core/passForwardRef.d.ts +3 -0
- package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -0
- package/lib/typescript/src/core/withUnistyles/index.d.ts +2 -0
- package/lib/typescript/src/core/withUnistyles/index.d.ts.map +1 -0
- package/lib/typescript/src/core/withUnistyles/types.d.ts +6 -0
- package/lib/typescript/src/core/withUnistyles/types.d.ts.map +1 -0
- package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts +13 -0
- package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts.map +1 -0
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +11 -0
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +8 -0
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +2 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMedia.d.ts +6 -0
- package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMedia.native.d.ts +6 -0
- package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mq.d.ts +8 -0
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +8 -6
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts +0 -1
- package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts +1 -10
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +9 -4
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +21 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts +0 -1
- package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts +2 -4
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +3 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +5 -3
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +4 -2
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.d.ts +3 -9
- package/lib/typescript/src/specs/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.native.d.ts +12 -0
- package/lib/typescript/src/specs/index.native.d.ts.map +1 -0
- package/lib/typescript/src/types/breakpoints.d.ts +11 -11
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +2 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +2 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +6 -4
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/types/variants.d.ts +4 -1
- package/lib/typescript/src/types/variants.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +2 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/index.d.ts +1 -2
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts +9 -0
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/index.d.ts +4 -0
- package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts +5 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/pseudo.d.ts +6 -0
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts +8 -0
- package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts +2 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts +3 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/textShadow.d.ts +8 -0
- package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/style.d.ts +1 -2
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/types.d.ts +7 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +8 -4
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +1 -2447
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +10 -2448
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/{listener/listener.d.ts → listener.d.ts} +5 -2
- package/lib/typescript/src/web/listener.d.ts.map +1 -0
- package/lib/typescript/src/web/mock.d.ts +0 -9
- package/lib/typescript/src/web/mock.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +17 -6
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +6 -5
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +25 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -0
- package/lib/typescript/src/web/state.d.ts +3 -9
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts +8 -0
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/index.d.ts +3 -0
- package/lib/typescript/src/web/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts +18 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -0
- package/lib/typescript/src/web/{variants/getVariants.d.ts → variants.d.ts} +2 -2
- package/lib/typescript/src/web/variants.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JColorScheme.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +57 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +35 -34
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +15 -6
- package/nitrogen/generated/android/c++/JOrientation.hpp +2 -2
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +5 -2
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +9 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/ColorScheme.kt +5 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/{Func_void_std__vector_UnistyleDependency_.kt → Func_void_UnistylesNativeMiniRuntime.kt} +6 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +25 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Orientation.kt +5 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +6 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +3 -1
- package/nitrogen/generated/android/unistyles+autolinking.cmake +13 -1
- package/nitrogen/generated/android/unistyles+autolinking.gradle +2 -0
- package/nitrogen/generated/android/{UnistylesOnLoad.cpp → unistylesOnLoad.cpp} +6 -4
- package/nitrogen/generated/android/{UnistylesOnLoad.hpp → unistylesOnLoad.hpp} +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +6 -4
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +25 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +73 -38
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +4 -30
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +8 -8
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +4 -16
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +156 -115
- package/nitrogen/generated/ios/swift/UnistyleDependency.swift +4 -0
- package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +16 -5
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +2 -2
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +2 -2
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +6 -3
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +0 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +3 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +5 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +0 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +3 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +2 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +10 -4
- package/nitrogen/generated/shared/c++/Orientation.hpp +2 -2
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +2 -1
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +10 -9
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +9 -8
- package/package.json +25 -38
- package/plugin/common.js +30 -7
- package/plugin/import.js +69 -6
- package/plugin/index.js +142 -33
- package/plugin/ref.js +0 -200
- package/plugin/style.js +130 -9
- package/plugin/stylesheet.js +35 -13
- package/plugin/variants.js +54 -1
- package/src/components/Display.tsx +12 -0
- package/src/components/Hide.tsx +12 -0
- package/src/components/ScopedTheme.tsx +32 -0
- package/src/components/Variants.tsx +29 -0
- package/src/components/index.ts +4 -0
- package/src/components/native/ActivityIndicator.tsx +4 -0
- package/src/components/native/FlatList.tsx +4 -0
- package/src/components/native/Image.tsx +4 -0
- package/src/components/native/ImageBackground.tsx +4 -0
- package/src/components/native/KeyboardAvoidingView.tsx +4 -0
- package/src/components/native/Pressable.native.tsx +55 -0
- package/src/components/native/Pressable.tsx +98 -0
- package/src/components/native/RefreshControl.tsx +4 -0
- package/src/components/native/ScrollView.tsx +4 -0
- package/src/components/native/SectionList.tsx +4 -0
- package/src/components/native/Switch.tsx +4 -0
- package/src/components/native/Text.tsx +4 -0
- package/src/components/native/TextInput.tsx +4 -0
- package/src/components/native/TouchableHighlight.tsx +4 -0
- package/src/components/native/TouchableOpacity.tsx +4 -0
- package/src/components/native/View.tsx +4 -0
- package/src/components/native/VirtualizedList.tsx +4 -0
- package/src/core/createUnistylesComponent.tsx +14 -0
- package/src/core/createUnistylesElement.tsx +9 -0
- package/src/core/createUnistylesImageBackground.tsx +24 -0
- package/src/core/index.ts +5 -0
- package/src/core/passForwardRef.ts +29 -0
- package/src/core/withUnistyles/index.ts +1 -0
- package/src/core/withUnistyles/types.ts +7 -0
- package/src/core/withUnistyles/useDependencies.ts +93 -0
- package/src/core/withUnistyles/withUnistyles.native.tsx +96 -0
- package/src/core/withUnistyles/withUnistyles.tsx +90 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useMedia.native.ts +65 -0
- package/src/hooks/useMedia.ts +47 -0
- package/src/index.ts +3 -12
- package/src/mq.ts +33 -15
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +8 -6
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +0 -1
- package/src/specs/NavigtionBar/index.ts +1 -25
- package/src/specs/ShadowRegistry/index.ts +26 -12
- package/src/specs/ShadowRegistry/types.ts +24 -3
- package/src/specs/StatusBar/UnistylesStatusBar.nitro.ts +0 -1
- package/src/specs/StatusBar/index.ts +2 -12
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +4 -1
- package/src/specs/StyleSheet/index.ts +7 -3
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -2
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +2 -2
- package/src/specs/UnistylesRuntime/index.ts +4 -3
- package/src/specs/index.native.ts +27 -0
- package/src/specs/index.ts +3 -23
- package/src/types/breakpoints.ts +25 -13
- package/src/types/common.ts +2 -0
- package/src/types/index.ts +2 -2
- package/src/types/stylesheet.ts +7 -5
- package/src/types/variants.ts +7 -1
- package/src/utils.ts +22 -0
- package/src/web/convert/index.ts +24 -24
- package/src/web/convert/object/boxShadow.ts +55 -0
- package/src/web/convert/object/filter.ts +39 -0
- package/src/web/convert/object/index.ts +3 -0
- package/src/web/convert/object/objectStyle.ts +69 -0
- package/src/web/convert/object/transform.ts +24 -0
- package/src/web/convert/pseudo.ts +137 -0
- package/src/web/convert/shadow/boxShadow.ts +50 -0
- package/src/web/convert/shadow/getShadowBreakpoints.ts +34 -0
- package/src/web/convert/shadow/index.ts +2 -0
- package/src/web/convert/shadow/textShadow.ts +48 -0
- package/src/web/convert/style.ts +61 -10
- package/src/web/convert/types.ts +8 -1
- package/src/web/convert/utils.ts +13 -7
- package/src/web/create.ts +22 -88
- package/src/web/index.ts +12 -6
- package/src/web/listener.ts +65 -0
- package/src/web/mock.ts +1 -12
- package/src/web/registry.ts +211 -28
- package/src/web/runtime.ts +31 -18
- package/src/web/shadowRegistry.ts +163 -0
- package/src/web/state.ts +52 -87
- package/src/web/utils/common.ts +45 -0
- package/src/web/utils/index.ts +2 -0
- package/src/web/utils/unistyle.ts +93 -0
- package/src/web/{variants/getVariants.ts → variants.ts} +2 -2
- package/android/src/main/cxx/helpers.cpp +0 -105
- package/android/src/main/cxx/helpers.h +0 -16
- package/android/src/main/cxx/platform.cpp +0 -170
- package/android/src/main/cxx/platform.h +0 -20
- package/lib/commonjs/specs/index.web.js +0 -24
- package/lib/commonjs/specs/index.web.js.map +0 -1
- package/lib/commonjs/web/convert/boxShadow.js.map +0 -1
- package/lib/commonjs/web/convert/breakpoint.js +0 -25
- package/lib/commonjs/web/convert/breakpoint.js.map +0 -1
- package/lib/commonjs/web/convert/shadow.js +0 -68
- package/lib/commonjs/web/convert/shadow.js.map +0 -1
- package/lib/commonjs/web/convert/textShadow.js.map +0 -1
- package/lib/commonjs/web/convert/transform.js +0 -72
- package/lib/commonjs/web/convert/transform.js.map +0 -1
- package/lib/commonjs/web/listener/index.js +0 -13
- package/lib/commonjs/web/listener/index.js.map +0 -1
- package/lib/commonjs/web/listener/listener.js +0 -36
- package/lib/commonjs/web/listener/listener.js.map +0 -1
- package/lib/commonjs/web/mq.js +0 -23
- package/lib/commonjs/web/mq.js.map +0 -1
- package/lib/commonjs/web/pseudo.js +0 -11
- package/lib/commonjs/web/pseudo.js.map +0 -1
- package/lib/commonjs/web/utils.js +0 -78
- package/lib/commonjs/web/utils.js.map +0 -1
- package/lib/commonjs/web/variants/getVariants.js.map +0 -1
- package/lib/commonjs/web/variants/index.js +0 -28
- package/lib/commonjs/web/variants/index.js.map +0 -1
- package/lib/commonjs/web/variants/useVariants.js +0 -75
- package/lib/commonjs/web/variants/useVariants.js.map +0 -1
- package/lib/module/specs/index.web.js +0 -5
- package/lib/module/specs/index.web.js.map +0 -1
- package/lib/module/web/convert/boxShadow.js +0 -72
- package/lib/module/web/convert/boxShadow.js.map +0 -1
- package/lib/module/web/convert/breakpoint.js +0 -20
- package/lib/module/web/convert/breakpoint.js.map +0 -1
- package/lib/module/web/convert/shadow.js +0 -63
- package/lib/module/web/convert/shadow.js.map +0 -1
- package/lib/module/web/convert/textShadow.js +0 -68
- package/lib/module/web/convert/textShadow.js.map +0 -1
- package/lib/module/web/convert/transform.js +0 -67
- package/lib/module/web/convert/transform.js.map +0 -1
- package/lib/module/web/listener/index.js +0 -4
- package/lib/module/web/listener/index.js.map +0 -1
- package/lib/module/web/listener/listener.js +0 -31
- package/lib/module/web/listener/listener.js.map +0 -1
- package/lib/module/web/mq.js +0 -17
- package/lib/module/web/mq.js.map +0 -1
- package/lib/module/web/pseudo.js +0 -6
- package/lib/module/web/pseudo.js.map +0 -1
- package/lib/module/web/utils.js +0 -65
- package/lib/module/web/utils.js.map +0 -1
- package/lib/module/web/variants/getVariants.js.map +0 -1
- package/lib/module/web/variants/index.js +0 -5
- package/lib/module/web/variants/index.js.map +0 -1
- package/lib/module/web/variants/useVariants.js +0 -70
- package/lib/module/web/variants/useVariants.js.map +0 -1
- package/lib/typescript/example/App.d.ts +0 -4
- package/lib/typescript/example/App.d.ts.map +0 -1
- package/lib/typescript/example/Typography.d.ts +0 -11
- package/lib/typescript/example/Typography.d.ts.map +0 -1
- package/lib/typescript/example/unistyles.d.ts +0 -63
- package/lib/typescript/example/unistyles.d.ts.map +0 -1
- package/lib/typescript/expo-example/App.d.ts +0 -4
- package/lib/typescript/expo-example/App.d.ts.map +0 -1
- package/lib/typescript/expo-example/unistyles.d.ts +0 -63
- package/lib/typescript/expo-example/unistyles.d.ts.map +0 -1
- package/lib/typescript/src/specs/index.web.d.ts +0 -4
- package/lib/typescript/src/specs/index.web.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts +0 -3
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/breakpoint.d.ts +0 -3
- package/lib/typescript/src/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/shadow.d.ts +0 -2
- package/lib/typescript/src/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/textShadow.d.ts +0 -3
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/transform.d.ts +0 -5
- package/lib/typescript/src/web/convert/transform.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/index.d.ts +0 -2
- package/lib/typescript/src/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/src/web/mq.d.ts +0 -4
- package/lib/typescript/src/web/mq.d.ts.map +0 -1
- package/lib/typescript/src/web/pseudo.d.ts +0 -4
- package/lib/typescript/src/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/src/web/utils.d.ts +0 -20
- package/lib/typescript/src/web/utils.d.ts.map +0 -1
- package/lib/typescript/src/web/variants/getVariants.d.ts.map +0 -1
- package/lib/typescript/src/web/variants/index.d.ts +0 -3
- package/lib/typescript/src/web/variants/index.d.ts.map +0 -1
- package/lib/typescript/src/web/variants/useVariants.d.ts +0 -3
- package/lib/typescript/src/web/variants/useVariants.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +0 -60
- package/plugin/__tests__/dependencies.spec.js +0 -438
- package/plugin/__tests__/ref.spec.js +0 -1170
- package/plugin/__tests__/stylesheet.spec.js +0 -489
- package/src/specs/index.web.ts +0 -5
- package/src/web/convert/boxShadow.ts +0 -72
- package/src/web/convert/breakpoint.ts +0 -21
- package/src/web/convert/shadow.ts +0 -68
- package/src/web/convert/textShadow.ts +0 -69
- package/src/web/convert/transform.ts +0 -89
- package/src/web/listener/index.ts +0 -1
- package/src/web/listener/listener.ts +0 -33
- package/src/web/mq.ts +0 -19
- package/src/web/pseudo.ts +0 -11
- package/src/web/utils.ts +0 -95
- package/src/web/variants/index.ts +0 -2
- package/src/web/variants/useVariants.ts +0 -79
- /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
@@ -0,0 +1,146 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { UnistylesListener } from './listener';
|
4
|
+
import { UnistylesRegistry } from './registry';
|
5
|
+
import { deepMergeObjects } from '../utils';
|
6
|
+
import { equal, extractSecrets, extractUnistyleDependencies, isInDocument, keyInObject } from './utils';
|
7
|
+
import { getVariants } from './variants';
|
8
|
+
class UnistylesShadowRegistryBuilder {
|
9
|
+
// MOCKS
|
10
|
+
name = 'UnistylesShadowRegistry';
|
11
|
+
__type = 'web';
|
12
|
+
equals = () => true;
|
13
|
+
toString = () => 'UnistylesShadowRegistry';
|
14
|
+
dispose = () => {};
|
15
|
+
// END MOCKS
|
16
|
+
|
17
|
+
resultsMap = new Map();
|
18
|
+
classNamesMap = new Map();
|
19
|
+
selectedVariants = new Map();
|
20
|
+
scopedTheme = undefined;
|
21
|
+
disposeMap = new Map();
|
22
|
+
add = (ref, styles) => {
|
23
|
+
// Styles are not provided
|
24
|
+
if (!styles || !Array.isArray(styles)) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
// Ref is unmounted
|
29
|
+
if (ref === null) {
|
30
|
+
styles.flat().forEach(style => {
|
31
|
+
extractSecrets(style)?.__uni__refs.forEach(ref => {
|
32
|
+
if (isInDocument(ref)) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
const oldResult = this.resultsMap.get(ref);
|
36
|
+
this.resultsMap.delete(ref);
|
37
|
+
this.classNamesMap.delete(ref);
|
38
|
+
this.disposeMap.get(ref)?.();
|
39
|
+
this.disposeMap.delete(ref);
|
40
|
+
if (oldResult) {
|
41
|
+
UnistylesRegistry.remove(oldResult);
|
42
|
+
}
|
43
|
+
});
|
44
|
+
});
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
|
48
|
+
// Ref is not an HTMLElement
|
49
|
+
if (!(ref instanceof HTMLElement)) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
const getParsedStyles = () => {
|
53
|
+
return styles.flat().flatMap(unistyleStyle => {
|
54
|
+
if (!unistyleStyle) {
|
55
|
+
return [];
|
56
|
+
}
|
57
|
+
const secrets = extractSecrets(unistyleStyle);
|
58
|
+
|
59
|
+
// Regular style
|
60
|
+
if (!secrets) {
|
61
|
+
Object.keys(unistyleStyle).forEach(key => {
|
62
|
+
if (keyInObject(ref.style, key)) {
|
63
|
+
// @ts-expect-error - Styles won't have read only properties
|
64
|
+
ref.style[key] = '';
|
65
|
+
}
|
66
|
+
});
|
67
|
+
return unistyleStyle;
|
68
|
+
}
|
69
|
+
const {
|
70
|
+
__uni__key,
|
71
|
+
__uni__stylesheet,
|
72
|
+
__uni__args = [],
|
73
|
+
__uni__refs
|
74
|
+
} = secrets;
|
75
|
+
const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet, scopedTheme);
|
76
|
+
const style = newComputedStylesheet[__uni__key];
|
77
|
+
const args = __uni__args;
|
78
|
+
const result = typeof style === 'function' ? style(...args) : style;
|
79
|
+
const {
|
80
|
+
variantsResult
|
81
|
+
} = Object.fromEntries(getVariants({
|
82
|
+
variantsResult: result
|
83
|
+
}, variants));
|
84
|
+
const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
|
85
|
+
const dependencies = extractUnistyleDependencies(resultWithVariants);
|
86
|
+
if (typeof __uni__stylesheet === 'function') {
|
87
|
+
// Add dependencies from dynamic styles to stylesheet
|
88
|
+
UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
|
89
|
+
}
|
90
|
+
__uni__refs.add(ref);
|
91
|
+
return resultWithVariants;
|
92
|
+
});
|
93
|
+
};
|
94
|
+
|
95
|
+
// Copy scoped theme to not use referenced value
|
96
|
+
const variants = this.getVariants();
|
97
|
+
const scopedTheme = this.scopedTheme;
|
98
|
+
const parsedStyles = getParsedStyles();
|
99
|
+
const combinedStyles = deepMergeObjects(...parsedStyles);
|
100
|
+
const oldStyles = this.resultsMap.get(ref);
|
101
|
+
if (equal(combinedStyles, oldStyles)) {
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
const oldClassNames = this.classNamesMap.get(ref);
|
105
|
+
|
106
|
+
// Remove old styles
|
107
|
+
if (oldStyles) {
|
108
|
+
UnistylesRegistry.remove(oldStyles);
|
109
|
+
}
|
110
|
+
|
111
|
+
// Remove old classnames from the ref
|
112
|
+
oldClassNames?.forEach(className => ref.classList.remove(className));
|
113
|
+
this.resultsMap.set(ref, combinedStyles);
|
114
|
+
const {
|
115
|
+
hash
|
116
|
+
} = UnistylesRegistry.add(combinedStyles);
|
117
|
+
const injectedClassNames = combinedStyles?._web?._classNames ?? [];
|
118
|
+
const newClassNames = (Array.isArray(injectedClassNames) ? injectedClassNames : [injectedClassNames]).concat(hash);
|
119
|
+
const dependencies = Array.from(new Set(parsedStyles.flatMap(style => extractUnistyleDependencies(style))));
|
120
|
+
this.disposeMap.get(ref)?.();
|
121
|
+
this.disposeMap.set(ref, UnistylesListener.addListeners(dependencies, () => {
|
122
|
+
UnistylesRegistry.applyStyles(hash, deepMergeObjects(...getParsedStyles()));
|
123
|
+
}));
|
124
|
+
this.classNamesMap.set(ref, newClassNames);
|
125
|
+
// Add new classnames to the ref
|
126
|
+
ref.classList.add(...newClassNames);
|
127
|
+
return newClassNames;
|
128
|
+
};
|
129
|
+
selectVariants = variants => {
|
130
|
+
if (!variants) {
|
131
|
+
this.selectedVariants.clear();
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
Object.entries(variants).forEach(([key, value]) => {
|
135
|
+
this.selectedVariants.set(key, value);
|
136
|
+
});
|
137
|
+
};
|
138
|
+
setScopedTheme = theme => {
|
139
|
+
this.scopedTheme = theme;
|
140
|
+
};
|
141
|
+
getScopedTheme = () => this.scopedTheme;
|
142
|
+
getVariants = () => Object.fromEntries(this.selectedVariants.entries());
|
143
|
+
remove = () => {};
|
144
|
+
}
|
145
|
+
export const UnistylesShadowRegistry = new UnistylesShadowRegistryBuilder();
|
146
|
+
//# sourceMappingURL=shadowRegistry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["UnistylesListener","UnistylesRegistry","deepMergeObjects","equal","extractSecrets","extractUnistyleDependencies","isInDocument","keyInObject","getVariants","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","classNamesMap","selectedVariants","scopedTheme","undefined","disposeMap","add","ref","styles","Array","isArray","flat","forEach","style","__uni__refs","oldResult","get","delete","remove","HTMLElement","getParsedStyles","flatMap","unistyleStyle","secrets","Object","keys","key","__uni__key","__uni__stylesheet","__uni__args","newComputedStylesheet","getComputedStylesheet","args","result","variantsResult","fromEntries","variants","resultWithVariants","dependencies","addDependenciesToStylesheet","parsedStyles","combinedStyles","oldStyles","oldClassNames","className","classList","set","hash","injectedClassNames","_web","_classNames","newClassNames","concat","from","Set","addListeners","applyStyles","selectVariants","clear","entries","value","setScopedTheme","theme","getScopedTheme","UnistylesShadowRegistry"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AACA,SAASA,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,KAAK,EAAEC,cAAc,EAAEC,2BAA2B,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AACvG,SAASC,WAAW,QAAQ,YAAY;AAIxC,MAAMC,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAAA,KAAM,yBAAyB;EAC1CC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;;EAEQC,UAAU,GAAG,IAAIC,GAAG,CAA+B,CAAC;EACpDC,aAAa,GAAG,IAAID,GAAG,CAA6B,CAAC;EACrDE,gBAAgB,GAAG,IAAIF,GAAG,CAAuC,CAAC;EAClEG,WAAW,GAA+BC,SAAS;EACnDC,UAAU,GAAG,IAAIL,GAAG,CAA4B,CAAC;EAEzDM,GAAG,GAAGA,CAACC,GAAQ,EAAEC,MAAoB,KAAK;IACtC;IACA,IAAI,CAACA,MAAM,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;MACnC;IACJ;;IAEA;IACA,IAAID,GAAG,KAAK,IAAI,EAAE;MACdC,MAAM,CAACG,IAAI,CAAC,CAAC,CAACC,OAAO,CAACC,KAAK,IAAI;QAC3BzB,cAAc,CAACyB,KAAK,CAAC,EAAEC,WAAW,CAACF,OAAO,CAACL,GAAG,IAAI;UAC9C,IAAIjB,YAAY,CAACiB,GAAG,CAAC,E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AAC,CAAC;MAE7B;IACJ;IAEAlC,MAAM,CAACmC,OAAO,CAACvB,QAAQ,CAAC,CAACxB,OAAO,CAAC,CAAC,CAACc,GAAG,EAAEkC,KAAK,CAAC,KAAK;MAC/C,IAAI,CAAC1D,gBAAgB,CAAC4C,GAAG,CAACpB,GAAG,EAAEkC,KAAK,CAAC;IACzC,CAAC,CAAC;EACN,CAAC;EAEDC,cAAc,GAAIC,KAAsB,IAAK;IACzC,IAAI,CAAC3D,WAAW,GAAG2D,KAAK;EAC5B,CAAC;EAEDC,cAAc,GAAGA,CAAA,KAAM,IAAI,CAAC5D,WAAW;EAEvCX,WAAW,GAAGA,CAAA,KAAMgC,MAAM,CAACW,WAAW,CAAC,IAAI,CAACjC,gBAAgB,CAACyD,OAAO,CAAC,CAAC,CAAC;EAEvEzC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEA,OAAO,MAAM8C,uBAAuB,GAAG,IAAIvE,8BAA8B,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/web/state.js
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import { createElement, createRef } from 'react';
|
4
3
|
import { UnistylesRuntime } from './runtime';
|
5
|
-
import { isServer, schemeToTheme } from './utils';
|
4
|
+
import { error, isServer, schemeToTheme } from './utils';
|
6
5
|
import { UnistylesListener } from './listener';
|
7
6
|
import { UnistyleDependency } from '../specs/NativePlatform';
|
8
7
|
class UnistylesStateBuilder {
|
9
|
-
isSSR = isServer();
|
10
|
-
tags = [];
|
11
8
|
themes = new Map();
|
9
|
+
matchingBreakpoints = new Map();
|
10
|
+
get breakpoint() {
|
11
|
+
const [currentBreakpoint] = Array.from(this.matchingBreakpoints).reverse().find(([_key, value]) => value) ?? [];
|
12
|
+
return currentBreakpoint;
|
13
|
+
}
|
12
14
|
hasAdaptiveThemes = false;
|
13
15
|
init = config => {
|
14
16
|
this.initThemes(config.themes);
|
15
17
|
this.initBreakpoints(config.breakpoints);
|
16
|
-
|
17
|
-
|
18
|
+
if (config.settings) {
|
19
|
+
this.initSettings(config.settings);
|
20
|
+
}
|
21
|
+
if (isServer()) {
|
18
22
|
return;
|
19
23
|
}
|
20
24
|
UnistylesListener.initListeners();
|
@@ -26,92 +30,47 @@ class UnistylesStateBuilder {
|
|
26
30
|
};
|
27
31
|
initSettings = settings => {
|
28
32
|
this.hasAdaptiveThemes = settings?.adaptiveThemes ?? false;
|
29
|
-
|
30
|
-
|
31
|
-
// Single theme + no settings
|
32
|
-
if (!settings?.adaptiveThemes && !settings?.initialTheme && themeNames.length === 1) {
|
33
|
-
this.themeName = themeNames[0];
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
|
37
|
-
// No settings
|
38
|
-
if (!settings?.adaptiveThemes && !settings?.initialTheme) {
|
39
|
-
throw new Error('🦄 You need to specify either "initialTheme" or "adaptiveThemes" in your config');
|
33
|
+
if (settings.initialTheme && settings.adaptiveThemes) {
|
34
|
+
throw error('You\'re trying to set initial theme and enable adaptiveThemes, but these options are mutually exclusive.');
|
40
35
|
}
|
41
36
|
|
42
37
|
// Adaptive themes
|
43
38
|
if (settings.adaptiveThemes) {
|
39
|
+
if (!this.themes.get('light') || !this.themes.get('dark')) {
|
40
|
+
throw error(`You're trying to enable adaptiveThemes, but you didn't register both 'light' and 'dark' themes.`);
|
41
|
+
}
|
44
42
|
this.themeName = schemeToTheme(UnistylesRuntime.colorScheme);
|
45
43
|
return;
|
46
44
|
}
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
if (settings.initialTheme) {
|
46
|
+
const initialTheme = typeof settings.initialTheme === 'function' ? settings.initialTheme() : settings.initialTheme;
|
47
|
+
if (!this.themes.get(initialTheme)) {
|
48
|
+
throw error(`You're trying to select theme "${initialTheme}" but it wasn't registered.`);
|
49
|
+
}
|
50
|
+
this.themeName = initialTheme;
|
51
|
+
}
|
50
52
|
};
|
51
53
|
initBreakpoints = (breakpoints = {}) => {
|
52
|
-
const breakpointsMap = new Map();
|
53
54
|
this.breakpoints = breakpoints;
|
54
|
-
Object.entries(breakpoints)
|
55
|
+
const breakpointsEntries = Object.entries(breakpoints);
|
56
|
+
if (breakpointsEntries.length === 0) {
|
57
|
+
throw error('StyleSheet.configure\'s breakpoints can\'t be empty.');
|
58
|
+
}
|
59
|
+
if (breakpointsEntries?.[0]?.[1] !== 0) {
|
60
|
+
throw error('StyleSheet.configure\'s first breakpoint must start from 0.');
|
61
|
+
}
|
62
|
+
breakpointsEntries.sort(([, a], [, b]) => a - b).forEach(([breakpoint, value]) => {
|
55
63
|
if (isServer()) {
|
56
64
|
return;
|
57
65
|
}
|
58
66
|
const mediaQuery = window.matchMedia(`(min-width: ${value}px)`);
|
59
|
-
|
60
|
-
if (mediaQuery.matches) {
|
61
|
-
this.breakpoint = breakpoint;
|
62
|
-
}
|
67
|
+
this.matchingBreakpoints.set(breakpoint, mediaQuery.matches);
|
63
68
|
mediaQuery.addEventListener('change', event => {
|
64
|
-
|
65
|
-
const [currentBreakpoint] = Array.from(breakpointsMap).find(([, mq]) => mq.matches) ?? [];
|
66
|
-
if (currentBreakpoint) {
|
67
|
-
this.breakpoint = currentBreakpoint;
|
68
|
-
UnistylesListener.emitChange(UnistyleDependency.Breakpoints);
|
69
|
-
}
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
this.breakpoint = breakpoint;
|
69
|
+
this.matchingBreakpoints.set(breakpoint, event.matches);
|
73
70
|
UnistylesListener.emitChange(UnistyleDependency.Breakpoints);
|
74
71
|
});
|
75
72
|
});
|
76
73
|
};
|
77
|
-
createTag() {
|
78
|
-
if (!this.isSSR) {
|
79
|
-
const tag = document.createElement('style');
|
80
|
-
document.head.appendChild(tag);
|
81
|
-
return tag;
|
82
|
-
}
|
83
|
-
const tagRef = new Proxy(/*#__PURE__*/createRef(), {
|
84
|
-
set: (target, prop, value) => {
|
85
|
-
// When ref is assigned
|
86
|
-
if ('textContent' in value) {
|
87
|
-
value.textContent = tag.textContent;
|
88
|
-
}
|
89
|
-
return Reflect.set(target, prop, value);
|
90
|
-
}
|
91
|
-
});
|
92
|
-
const tagElement = /*#__PURE__*/createElement('style', {
|
93
|
-
ref: tagRef,
|
94
|
-
key: this.tags.length
|
95
|
-
}, '');
|
96
|
-
const tag = new Proxy({
|
97
|
-
textContent: ''
|
98
|
-
}, {
|
99
|
-
set: (target, prop, value) => {
|
100
|
-
if (prop !== 'textContent') {
|
101
|
-
return false;
|
102
|
-
}
|
103
|
-
|
104
|
-
// When css is updated
|
105
|
-
target.textContent = value;
|
106
|
-
if (tagRef.current) {
|
107
|
-
tagRef.current.textContent = value;
|
108
|
-
}
|
109
|
-
return true;
|
110
|
-
}
|
111
|
-
});
|
112
|
-
this.tags.push(tagElement);
|
113
|
-
return tag;
|
114
|
-
}
|
115
74
|
}
|
116
75
|
export const UnistylesState = new UnistylesStateBuilder();
|
117
76
|
//# sourceMappingURL=state.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["UnistylesRuntime","error","isServer","schemeToTheme","UnistylesListener","UnistyleDependency","UnistylesStateBuilder","themes","Map","matchingBreakpoints","breakpoint","currentBreakpoint","Array","from","reverse","find","_key","value","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","settings","initSettings","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","initialTheme","get","colorScheme","breakpointsEntries","length","sort","a","b","mediaQuery","window","matchMedia","matches","addEventListener","event","emitChange","Breakpoints","UnistylesState"],"sourceRoot":"../../../src","sources":["web/state.ts"],"mappings":";;AAIA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,KAAK,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AACxD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,kBAAkB,QAAQ,yBAAyB;AAK5D,MAAMC,qBAAqB,CAAC;EACxBC,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAGlCC,mBAAmB,GAAG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A,MAAMwC,UAAU,GAAGC,MAAM,CAACC,UAAU,CAAC,eAAe3B,KAAK,KAAK,CAAC;MAC/D,IAAI,CAACR,mBAAmB,CAACuB,GAAG,CAACtB,UAAU,EAAEgC,UAAU,CAACG,OAAO,CAAC;MAE5DH,UAAU,CAACI,gBAAgB,CAAC,QAAQ,EAAEC,KAAK,IAAI;QAC3C,IAAI,CAACtC,mBAAmB,CAACuB,GAAG,CAACtB,UAAU,EAAEqC,KAAK,CAACF,OAAO,CAAC;QACvDzC,iBAAiB,CAAC4C,UAAU,CAAC3C,kBAAkB,CAAC4C,WAAW,CAAC;MAChE,CAAC,CAAC;IACN,CAAC,CAAC;EACV,CAAC;AACL;AAEA,OAAO,MAAMC,cAAc,GAAG,IAAI5C,qBAAqB,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
export const reduceObject = (obj, reducer) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, reducer(value, key)]));
|
4
|
+
export const keyInObject = (obj, key) => key in obj;
|
5
|
+
export const isServer = () => typeof window === 'undefined';
|
6
|
+
export const error = message => new Error(`Unistyles: ${message}`);
|
7
|
+
export const equal = (a, b) => {
|
8
|
+
if (Object.is(a, b)) {
|
9
|
+
return true;
|
10
|
+
}
|
11
|
+
if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) {
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
const keysA = Object.keys(a);
|
15
|
+
if (keysA.length !== Object.keys(b).length) {
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
return keysA.every(key => Object.is(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key));
|
19
|
+
};
|
20
|
+
export const generateHash = value => {
|
21
|
+
const str = JSON.stringify(value);
|
22
|
+
let hasher = 5381;
|
23
|
+
let length = str.length;
|
24
|
+
while (length--) hasher = hasher * 33 ^ str.charCodeAt(length);
|
25
|
+
return `unistyles-${(hasher >>> 0).toString(36)}`;
|
26
|
+
};
|
27
|
+
export const hyphenate = propertyName => propertyName.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
|
28
|
+
//# sourceMappingURL=common.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","keyInObject","isServer","window","error","message","Error","equal","a","b","is","keysA","keys","length","every","prototype","hasOwnProperty","call","generateHash","str","JSON","stringify","hasher","charCodeAt","toString","hyphenate","propertyName","replace","m","toLowerCase"],"sourceRoot":"../../../../src","sources":["web/utils/common.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAGA,CACxBC,GAAS,EACTC,OAA+D,KAC9DC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACJ,GAAG,CAAC,CAACK,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK,CAACD,GAAG,EAAEL,OAAO,CAACM,KAAK,EAAsBD,GAAG,CAAC,CAAC,CAAC,CAAoC;AAErJ,OAAO,MAAME,WAAW,GAAGA,CAAgCR,GAAM,EAAEM,GAAgB,KAAqBA,GAAG,IAAIN,GAAG;AAElH,OAAO,MAAMS,QAAQ,GAAGA,CAAA,KAAM,OAAOC,MAAM,KAAK,WAAW;AAE3D,OAAO,MAAMC,KAAK,GAAIC,OAAe,IAAK,IAAIC,KAAK,CAAC,cAAcD,OAAO,EAAE,CAAC;AAE5E,OAAO,MAAME,KAAK,GAAGA,CAAIC,CAAI,EAAEC,CAAI,KAAK;EACpC,IAAId,MAAM,CAACe,EAAE,CAACF,CAAC,EAAEC,CAAC,CAAC,EAAE;IACjB,OAAO,IAAI;EACf;EAEA,IACI,OAAOD,CAAC,KAAK,QAAQ,IAClBA,CAAC,KAAK,IAAI,IACV,OAAOC,CAAC,KAAK,QAAQ,IACrBA,CAAC,KAAK,IAAI,EACf;IACE,OAAO,KAAK;EAChB;EAEA,MAAME,KAAK,GAAGhB,MAAM,CAACiB,IAAI,CAACJ,CAAC,CAAmB;EAE9C,IAAIG,KAAK,CAACE,MAAM,KAAKlB,MAAM,CAACiB,IAAI,CAACH,CAAC,CAAC,CAACI,MAAM,EAAE;IACxC,OAAO,KAAK;EAChB;EAEA,OAAOF,KAAK,CAACG,KAAK,CAACf,GAAG,IAAIJ,MAAM,CAACe,EAAE,CAACF,CAAC,CAACT,GAAG,CAAC,EAAEU,CAAC,CAACV,GAAG,CAAC,CAAC,IAAIJ,MAAM,CAACoB,SAAS,CAACC,cAAc,CAACC,IAAI,CAACR,CAAC,EAAEV,GAAG,CAAC,CAAC;AACxG,CAAC;AAED,OAAO,MAAMmB,YAAY,GAAIlB,KAAU,IAAK;EACxC,MAAMmB,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACrB,KAAK,CAAC;EACjC,IAAIsB,MAAM,GAAG,IAAI;EACjB,IAAIT,MAAM,GAAGM,GAAG,CAACN,MAAM;EAEvB,OAAOA,MAAM,EAAE,EAAES,MAAM,GAAIA,MAAM,GAAG,EAAE,GAAIH,GAAG,CAACI,UAAU,CAACV,MAAM,CAAC;EAEhE,OAAO,aAAa,CAACS,MAAM,KAAK,CAAC,EAAEE,QAAQ,CAAC,EAAE,CAAC,EAAE;AACrD,CAAC;AAED,OAAO,MAAMC,SAAS,GAAIC,YAAoB,IAAKA,YAAY,CAACC,OAAO,CAAC,QAAQ,EAAGC,CAAS,IAAK,IAAIA,CAAC,CAACC,WAAW,CAAC,CAAC,EAAE,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["web/utils/index.ts"],"mappings":";;AAAA,cAAc,UAAU;AACxB,cAAc,YAAY","ignoreList":[]}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { ColorScheme, Orientation } from '../../specs/types';
|
4
|
+
import { isUnistylesMq, parseMq } from '../../mq';
|
5
|
+
import { UnistylesState } from '../state';
|
6
|
+
import { keyInObject, reduceObject } from './common';
|
7
|
+
export const schemeToTheme = scheme => {
|
8
|
+
switch (scheme) {
|
9
|
+
case ColorScheme.Dark:
|
10
|
+
return 'dark';
|
11
|
+
case ColorScheme.Light:
|
12
|
+
default:
|
13
|
+
return 'light';
|
14
|
+
}
|
15
|
+
};
|
16
|
+
export const assignSecrets = (object, secrets) => {
|
17
|
+
// @ts-expect-error - assign secrets to object
|
18
|
+
object.__uni__secrets__ = secrets;
|
19
|
+
return object;
|
20
|
+
};
|
21
|
+
export const extractSecrets = object => {
|
22
|
+
return keyInObject(object, '__uni__secrets__') ? object.__uni__secrets__ : undefined;
|
23
|
+
};
|
24
|
+
export const removeInlineStyles = values => {
|
25
|
+
const returnValue = {};
|
26
|
+
Object.defineProperties(returnValue, reduceObject(values, value => ({
|
27
|
+
value,
|
28
|
+
enumerable: false,
|
29
|
+
configurable: true
|
30
|
+
})));
|
31
|
+
return returnValue;
|
32
|
+
};
|
33
|
+
export const isInDocument = element => document.body.contains(element);
|
34
|
+
export const extractMediaQueryValue = query => {
|
35
|
+
const [_, px] = query.match(/(\d+)px/) ?? [];
|
36
|
+
if (!px) {
|
37
|
+
return undefined;
|
38
|
+
}
|
39
|
+
const value = Number(px);
|
40
|
+
return Number.isNaN(value) ? undefined : value;
|
41
|
+
};
|
42
|
+
export const getMediaQuery = query => {
|
43
|
+
if (Object.values(Orientation).includes(query)) {
|
44
|
+
return `(orientation: ${query})`;
|
45
|
+
}
|
46
|
+
if (isUnistylesMq(query)) {
|
47
|
+
const {
|
48
|
+
minWidth,
|
49
|
+
maxWidth,
|
50
|
+
minHeight,
|
51
|
+
maxHeight
|
52
|
+
} = parseMq(query);
|
53
|
+
return [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 ');
|
54
|
+
}
|
55
|
+
const minWidth = UnistylesState.breakpoints && keyInObject(UnistylesState.breakpoints, query) ? UnistylesState.breakpoints[query] : undefined;
|
56
|
+
return `(min-width: ${minWidth ?? 0}px)`;
|
57
|
+
};
|
58
|
+
export const extractUnistyleDependencies = value => {
|
59
|
+
if (!value) {
|
60
|
+
return [];
|
61
|
+
}
|
62
|
+
const dependencies = keyInObject(value, 'uni__dependencies') ? value.uni__dependencies : [];
|
63
|
+
return Array.isArray(dependencies) ? dependencies : [];
|
64
|
+
};
|
65
|
+
//# sourceMappingURL=unistyle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["ColorScheme","Orientation","isUnistylesMq","parseMq","UnistylesState","keyInObject","reduceObject","schemeToTheme","scheme","Dark","Light","assignSecrets","object","secrets","__uni__secrets__","extractSecrets","undefined","removeInlineStyles","values","returnValue","Object","defineProperties","value","enumerable","configurable","isInDocument","element","document","body","contains","extractMediaQueryValue","query","_","px","match","Number","isNaN","getMediaQuery","includes","minWidth","maxWidth","minHeight","maxHeight","filter","Boolean","join","breakpoints","extractUnistyleDependencies","dependencies","uni__dependencies","Array","isArray"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,mBAAmB;AAE5D,SAASC,aAAa,EAAEC,OAAO,QAAQ,UAAU;AACjD,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,WAAW,EAAEC,YAAY,QAAQ,UAAU;AAEpD,OAAO,MAAMC,aAAa,GAAIC,MAAmB,IAAK;EAClD,QAAQA,MAAM;IACV,KAAKR,WAAW,CAACS,IAAI;MACjB,OAAO,MAAM;IACjB,KAAKT,WAAW,CAACU,KAAK;IACtB;MACI,OAAO,OAAO;EACtB;AACJ,CAAC;AASD,OAAO,MAAMC,aAAa,GAAGA,CAAIC,MAAS,EAAEC,OAAwB,KAAK;EACrE;EACAD,MAAM,CAACE,gBAAgB,GAAGD,OAAO;EAEjC,OAAOD,MAAM;AACjB,CAAC;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Q,GAAG,eAAeA,QAAQ,KAAK,GAAGvB,SAAS,EACnDwB,QAAQ,GAAG,eAAeA,QAAQ,KAAK,GAAGxB,SAAS,EACnDyB,SAAS,GAAG,gBAAgBA,SAAS,KAAK,GAAGzB,SAAS,EACtD0B,SAAS,GAAG,gBAAgBA,SAAS,KAAK,GAAG1B,SAAS,CACzD,CAAC2B,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EACnC;EAEA,MAAMN,QAAQ,GAAGnC,cAAc,CAAC0C,WAAW,IAAIzC,WAAW,CAACD,cAAc,CAAC0C,WAAW,EAAEf,KAAK,CAAC,GAAG3B,cAAc,CAAC0C,WAAW,CAACf,KAAK,CAAC,GAAGf,SAAS;EAE7I,OAAO,eAAeuB,QAAQ,IAAI,CAAC,KAAK;AAC5C,CAAC;AAED,OAAO,MAAMQ,2BAA2B,GAAIzB,KAAU,IAAK;EACvD,IAAI,CAACA,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EAEA,MAAM0B,YAAuC,GAAG3C,WAAW,CAACiB,KAAK,EAAE,mBAAmB,CAAC,GAAGA,KAAK,CAAC2B,iBAAiB,GAAG,EAAE;EAEtH,OAAOC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,GAAGA,YAAY,GAAG,EAAE;AAC1D,CAAC","ignoreList":[]}
|
@@ -11,7 +11,7 @@ export const getVariants = (styles, selectedVariants) => {
|
|
11
11
|
}]) => {
|
12
12
|
const variantStyles = Object.entries(variants).flatMap(([variant, styles]) => {
|
13
13
|
const selectedVariant = selectedVariants[variant];
|
14
|
-
const selectedVariantStyles = styles[selectedVariant] ?? styles
|
14
|
+
const selectedVariantStyles = styles[selectedVariant] ?? styles.default;
|
15
15
|
if (!selectedVariantStyles) {
|
16
16
|
return [];
|
17
17
|
}
|
@@ -31,4 +31,4 @@ export const getVariants = (styles, selectedVariants) => {
|
|
31
31
|
return [key, mergedVariantStyles];
|
32
32
|
});
|
33
33
|
};
|
34
|
-
//# sourceMappingURL=
|
34
|
+
//# sourceMappingURL=variants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["deepMergeObjects","hasVariants","value","getVariants","styles","selectedVariants","Object","entries","filter","_key","variants","keys","some","variant","map","key","compoundVariants","variantStyles","flatMap","selectedVariant","selectedVariantStyles","default","compoundVariantStyles","compoundVariant","conditions","String","mergedVariantStyles"],"sourceRoot":"../../../src","sources":["web/variants.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,UAAU;AAQ3C,MAAMC,WAAW,GAAsBC,KAAkB,IAAgD,UAAU,IAAIA,KAAK,CAAC,CAAC,CAAC;AAE/H,OAAO,MAAMC,WAAW,GAAGA,CAACC,MAAyC,EAAEC,gBAAqC,KAAK;EAC7G,OAAOC,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CACxBI,MAAM,CAACP,WAAW,CAAC,CACnBO,MAAM,CAAC,CAAC,CAACC,IAAI,EAAE;IAAEC;EAAS,CAAC,CAAC,KAAKJ,MAAM,CAACK,IAAI,CAACD,QAAQ,CAAC,CAACE,IAAI,CAACC,OAAO,IAAIA,OAAO,IAAIH,QAAQ,CAAC,CAAC,CAC5FI,GAAG,CAAC,CAAC,CAACC,GAAG,EAAE;IAAEL,QAAQ;IAAEM,gBAAgB,GAAG;EAAG,CAAC,CAAC,KAAK;IACjD,MAAMC,aAAa,GAAGX,MAAM,CAACC,OAAO,CAACG,QAAQ,CAAC,CAACQ,OAAO,CAAC,CAAC,CAACL,OAAO,EAAET,MAAM,CAAC,KAAK;MAC1E,MAAMe,eAAe,GAAGd,gBAAgB,CAACQ,OAAO,CAAC;MACjD,MAAMO,qBAAqB,GAAGhB,MAAM,CAACe,eAAe,CAAC,IAAIf,MAAM,CAACiB,OAAO;MAEvE,IAAI,CAACD,qBAAqB,EAAE;QACxB,OAAO,EAAE;MACb;MAEA,OAAOA,qBAAqB;IAChC,CAAC,CAAC;IAEF,MAAME,qBAAqB,GAAGN,gBAAgB,CAACE,OAAO,CAACK,eAAe,IAAI;MACtE,MAAM;QAAEnB,MAAM;QAAE,GAAGoB;MAAW,CAAC,GAAGD,eAAe;MAEjD,IAAIjB,MAAM,CAACC,OAAO,CAACiB,UAAU,CAAC,CAACZ,IAAI,CAAC,CAAC,CAACC,OAAO,EAAEX,KAAK,CAAC,KAAKuB,MAAM,CAACpB,gBAAgB,CAACQ,OAAO,CAAC,CAAC,KAAKY,MAAM,CAACvB,KAAK,CAAC,CAAC,EAAE;QAC5G,OAAO,EAAE;MACb;MAEA,OAAOE,MAAM;IACjB,CAAC,CAAC;IAEF,MAAMsB,mBAAmB,GAAG1B,gBAAgB,CAAC,GAAGiB,aAAa,EAAE,GAAGK,qBAAqB,CAAC;IAExF,OAAO,CAACP,GAAG,EAAEW,mBAAmB,CAAC;EACrC,CAAC,CAAC;AACV,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Display.d.ts","sourceRoot":"","sources":["../../../../src/components/Display.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAGrD,KAAK,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAAA;AAEtD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAMzD,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Hide.d.ts","sourceRoot":"","sources":["../../../../src/components/Hide.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAGrD,KAAK,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAAA;AAEnD,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAMnD,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { UnistylesThemes } from '../global';
|
3
|
+
type ThemeProps = {
|
4
|
+
name: keyof UnistylesThemes;
|
5
|
+
};
|
6
|
+
export declare const ScopedTheme: React.FunctionComponent<React.PropsWithChildren<ThemeProps>>;
|
7
|
+
export {};
|
8
|
+
//# sourceMappingURL=ScopedTheme.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ScopedTheme.d.ts","sourceRoot":"","sources":["../../../../src/components/ScopedTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAGhD,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,MAAM,eAAe,CAAA;CAC9B,CAAA;AAYD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAapF,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Variants.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAA;AAG9C,KAAK,YAAY,GAAG;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;CAC1D,CAAA;AAWD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAYnF,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ActivityIndicator.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/ActivityIndicator.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,mFAAkD,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/FlatList.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,mFAAyC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Image.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,mFAAsC,CAAA"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { ImageBackground as NativeImageBackground } from 'react-native';
|
2
|
+
export declare const ImageBackground: import("react").ForwardRefExoticComponent<import("react-native").ImageBackgroundProps & import("react").RefAttributes<NativeImageBackground>>;
|
3
|
+
//# sourceMappingURL=ImageBackground.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ImageBackground.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/ImageBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAGvE,eAAO,MAAM,eAAe,+IAAwD,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"KeyboardAvoidingView.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/KeyboardAvoidingView.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,mFAAqD,CAAA"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { PressableProps as Props, View, ViewStyle } from 'react-native';
|
3
|
+
type Variants = Record<string, string | boolean | undefined>;
|
4
|
+
type WebPressableState = {
|
5
|
+
pressed: boolean;
|
6
|
+
hovered: boolean;
|
7
|
+
focused: boolean;
|
8
|
+
};
|
9
|
+
type WebPressableStyle = ((state: WebPressableState) => ViewStyle) | ViewStyle;
|
10
|
+
export declare const Pressable: React.ForwardRefExoticComponent<Props & {
|
11
|
+
variants?: Variants;
|
12
|
+
style?: WebPressableStyle;
|
13
|
+
} & React.RefAttributes<View>>;
|
14
|
+
export {};
|
15
|
+
//# sourceMappingURL=Pressable.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG5E,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;AAC5D,KAAK,iBAAiB,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,EAAE,iBAAiB,KAAK,SAAS,CAAC,GAAG,SAAS,CAAA;AA8C9E,eAAO,MAAM,SAAS;eA3CP,QAAQ;YACX,iBAAiB;8BAiF3B,CAAA"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { PressableProps as Props, View } from 'react-native';
|
3
|
+
export declare const Pressable: React.ForwardRefExoticComponent<Props & {
|
4
|
+
variants?: Record<string, string | boolean>;
|
5
|
+
} & React.RefAttributes<View>>;
|
6
|
+
//# sourceMappingURL=Pressable.native.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Pressable.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Pressable.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAQjE,eAAO,MAAM,SAAS;eAHP,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;8BA+C7C,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RefreshControl.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/RefreshControl.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,mFAA+C,CAAA"}
|