react-native-unistyles 2.10.0 → 3.0.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/{react-native-unistyles.podspec → Unistyles.podspec} +10 -3
- package/android/CMakeLists.txt +35 -17
- package/android/build.gradle +4 -2
- package/android/src/main/cxx/cpp-adapter.cpp +82 -65
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +19 -9
- package/cxx/common/Breakpoints.h +43 -0
- package/cxx/common/Constants.h +10 -0
- package/cxx/common/Helpers.h +93 -0
- package/cxx/core/HostStyle.cpp +57 -0
- package/cxx/core/HostStyle.h +25 -0
- package/cxx/core/MediaQueries.cpp +87 -0
- package/cxx/core/MediaQueries.h +47 -0
- package/cxx/core/StyleSheet.h +32 -0
- package/cxx/core/StyleSheetRegistry.cpp +45 -0
- package/cxx/core/StyleSheetRegistry.h +26 -0
- package/cxx/core/Unistyle.h +81 -0
- package/cxx/core/UnistyleWrapper.cpp +5 -0
- package/cxx/core/UnistyleWrapper.h +50 -0
- package/cxx/core/UnistylesCommitHook.cpp +53 -0
- package/cxx/core/UnistylesCommitHook.h +27 -0
- package/cxx/core/UnistylesCommitShadowNode.h +26 -0
- package/cxx/core/UnistylesRegistry.cpp +176 -0
- package/cxx/core/UnistylesRegistry.h +59 -0
- package/cxx/core/UnistylesState.cpp +95 -0
- package/cxx/core/UnistylesState.h +50 -0
- package/cxx/hybridObjects/HybridNavigationBar.cpp +17 -0
- package/cxx/hybridObjects/HybridNavigationBar.h +19 -0
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +26 -0
- package/cxx/hybridObjects/HybridShadowRegistry.h +33 -0
- package/cxx/hybridObjects/HybridStatusBar.cpp +17 -0
- package/cxx/hybridObjects/HybridStatusBar.h +19 -0
- package/cxx/hybridObjects/HybridStyleSheet.cpp +245 -0
- package/cxx/hybridObjects/HybridStyleSheet.h +61 -0
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +199 -0
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +70 -0
- package/cxx/parser/Parser.cpp +714 -0
- package/cxx/parser/Parser.h +55 -0
- package/cxx/shadowTree/ShadowLeafUpdate.h +13 -0
- package/cxx/shadowTree/ShadowTreeManager.cpp +124 -0
- package/cxx/shadowTree/ShadowTreeManager.h +23 -0
- package/ios/Equatable.swift +64 -0
- package/ios/Extensions.swift +11 -0
- package/ios/NativePlatform+ios.swift +291 -0
- package/ios/NativePlatform.swift +17 -0
- package/ios/NativePlatformListener+ios.swift +41 -0
- package/ios/Unistyles.h +3 -0
- package/ios/UnistylesModuleOnLoad.h +11 -0
- package/ios/UnistylesModuleOnLoad.mm +51 -0
- package/lib/commonjs/common.js +1 -58
- package/lib/commonjs/common.js.map +1 -1
- package/lib/commonjs/index.js +27 -66
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/{utils/mq.js → mq.js} +12 -2
- package/lib/commonjs/mq.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +25 -0
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -0
- package/lib/commonjs/specs/NativePlatform/index.js +13 -0
- package/lib/commonjs/specs/NativePlatform/index.js.map +1 -0
- package/lib/commonjs/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +6 -0
- package/lib/commonjs/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +1 -0
- package/lib/commonjs/specs/NavigtionBar/index.js +17 -0
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -0
- package/lib/commonjs/{types/plugin.js → specs/ShadowRegistry/ShadowRegistry.nitro.js} +1 -1
- package/lib/commonjs/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -0
- package/lib/commonjs/specs/ShadowRegistry/index.js +30 -0
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -0
- package/lib/commonjs/specs/ShadowRegistry/types.js +2 -0
- package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -0
- package/lib/commonjs/{types/normalizer.js → specs/StatusBar/UnistylesStatusBar.nitro.js} +1 -1
- package/lib/commonjs/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -0
- package/lib/commonjs/specs/StatusBar/index.js +33 -0
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -0
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +6 -0
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -0
- package/lib/commonjs/specs/StyleSheet/index.js +18 -0
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -0
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +8 -0
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -0
- package/lib/commonjs/specs/TurboUnistyles/index.js +4 -0
- package/lib/commonjs/specs/TurboUnistyles/index.js.map +1 -0
- package/lib/commonjs/{types/unistyles.js → specs/UnistylesRuntime/UnistylesRuntime.nitro.js} +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -0
- package/lib/commonjs/specs/UnistylesRuntime/index.js +26 -0
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -0
- package/lib/commonjs/specs/index.js +47 -0
- package/lib/commonjs/specs/index.js.map +1 -0
- package/lib/commonjs/specs/index.web.js +24 -0
- package/lib/commonjs/specs/index.web.js.map +1 -0
- package/lib/commonjs/specs/types.js +24 -0
- package/lib/commonjs/specs/types.js.map +1 -0
- package/lib/commonjs/types/accessibility.js +37 -0
- package/lib/commonjs/types/accessibility.js.map +1 -0
- package/lib/commonjs/types/index.js +16 -30
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/stylesheet.js +3 -0
- package/lib/commonjs/types/stylesheet.js.map +1 -1
- package/lib/commonjs/types/variants.js +4 -0
- package/lib/module/common.js +2 -56
- package/lib/module/common.js.map +1 -1
- package/lib/module/global.js +1 -1
- package/lib/module/index.js +12 -29
- package/lib/module/index.js.map +1 -1
- package/lib/module/{utils/mq.js → mq.js} +14 -2
- package/lib/module/mq.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +23 -0
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -0
- package/lib/module/specs/NativePlatform/index.js +4 -0
- package/lib/module/specs/NativePlatform/index.js.map +1 -0
- package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +4 -0
- package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +1 -0
- package/lib/module/specs/NavigtionBar/index.js +12 -0
- package/lib/module/specs/NavigtionBar/index.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js +4 -0
- package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/index.js +26 -0
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/types.js +2 -0
- package/lib/module/specs/ShadowRegistry/types.js.map +1 -0
- package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js +4 -0
- package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -0
- package/lib/module/specs/StatusBar/index.js +28 -0
- package/lib/module/specs/StatusBar/index.js.map +1 -0
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +4 -0
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -0
- package/lib/module/specs/StyleSheet/index.js +14 -0
- package/lib/module/specs/StyleSheet/index.js.map +1 -0
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +9 -0
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -0
- package/lib/module/specs/TurboUnistyles/index.js +4 -0
- package/lib/module/specs/TurboUnistyles/index.js.map +1 -0
- package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +4 -0
- package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -0
- package/lib/module/specs/UnistylesRuntime/index.js +22 -0
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -0
- package/lib/module/specs/index.js +10 -0
- package/lib/module/specs/index.js.map +1 -0
- package/lib/module/specs/index.web.js +5 -0
- package/lib/module/specs/index.web.js.map +1 -0
- package/lib/module/specs/types.js +20 -0
- package/lib/module/specs/types.js.map +1 -0
- package/lib/module/types/accessibility.js +33 -0
- package/lib/module/types/accessibility.js.map +1 -0
- package/lib/module/types/breakpoints.js +2 -0
- package/lib/module/types/common.js +1 -1
- package/lib/module/types/core.js +2 -0
- package/lib/module/types/index.js +3 -3
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/stylesheet.js +5 -0
- package/lib/module/types/stylesheet.js.map +1 -1
- package/lib/module/types/variants.js +2 -0
- package/lib/typescript/example/App.d.ts +4 -0
- package/lib/typescript/example/App.d.ts.map +1 -0
- package/lib/typescript/example/unistyles.d.ts +63 -0
- package/lib/typescript/example/unistyles.d.ts.map +1 -0
- package/lib/typescript/expo-example/App.d.ts +4 -0
- package/lib/typescript/expo-example/App.d.ts.map +1 -0
- package/lib/typescript/expo-example/unistyles.d.ts +63 -0
- package/lib/typescript/expo-example/unistyles.d.ts.map +1 -0
- package/lib/typescript/src/common.d.ts +0 -50
- package/lib/typescript/src/common.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -76
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/{utils/mq.d.ts → mq.d.ts} +2 -2
- package/lib/typescript/src/mq.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +57 -0
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativePlatform/index.d.ts +3 -0
- package/lib/typescript/src/specs/NativePlatform/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts +11 -0
- package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts +11 -0
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/ShadowRegistry.nitro.d.ts +7 -0
- package/lib/typescript/src/specs/ShadowRegistry/ShadowRegistry.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +12 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +27 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -0
- package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts +11 -0
- package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/StatusBar/index.d.ts +15 -0
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +9 -0
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +28 -0
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/TurboUnistyles/NativeTurboUnistyles.d.ts +2 -0
- package/lib/typescript/src/specs/TurboUnistyles/NativeTurboUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/specs/TurboUnistyles/index.d.ts +2 -0
- package/lib/typescript/src/specs/TurboUnistyles/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +41 -0
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +25 -0
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/index.d.ts +10 -0
- package/lib/typescript/src/specs/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/index.web.d.ts +4 -0
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -0
- package/lib/typescript/src/specs/types.d.ts +32 -0
- package/lib/typescript/src/specs/types.d.ts.map +1 -0
- package/lib/typescript/src/types/accessibility.d.ts +28 -0
- package/lib/typescript/src/types/accessibility.d.ts.map +1 -0
- package/lib/typescript/src/types/breakpoints.d.ts +12 -5
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +2 -5
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +31 -9
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/types/variants.d.ts +5 -8
- package/lib/typescript/src/types/variants.d.ts.map +1 -1
- package/lib/typescript/web/convert/boxShadow.d.ts +3 -0
- package/lib/typescript/web/convert/boxShadow.d.ts.map +1 -0
- package/lib/typescript/web/convert/breakpoint.d.ts +3 -0
- package/lib/typescript/web/convert/breakpoint.d.ts.map +1 -0
- package/lib/typescript/web/convert/index.d.ts +4 -0
- package/lib/typescript/web/convert/index.d.ts.map +1 -0
- package/lib/typescript/web/convert/shadow.d.ts +2 -0
- package/lib/typescript/web/convert/shadow.d.ts.map +1 -0
- package/lib/typescript/web/convert/style.d.ts +3 -0
- package/lib/typescript/web/convert/style.d.ts.map +1 -0
- package/lib/typescript/web/convert/textShadow.d.ts +3 -0
- package/lib/typescript/web/convert/textShadow.d.ts.map +1 -0
- package/lib/typescript/web/convert/transform.d.ts +5 -0
- package/lib/typescript/web/convert/transform.d.ts.map +1 -0
- package/lib/typescript/web/convert/types.d.ts +13 -0
- package/lib/typescript/web/convert/types.d.ts.map +1 -0
- package/lib/typescript/web/convert/utils.d.ts +8 -0
- package/lib/typescript/web/convert/utils.d.ts.map +1 -0
- package/lib/typescript/web/create.d.ts +2449 -0
- package/lib/typescript/web/create.d.ts.map +1 -0
- package/lib/typescript/web/index.d.ts +2464 -0
- package/lib/typescript/web/index.d.ts.map +1 -0
- package/lib/typescript/web/listener/index.d.ts +2 -0
- package/lib/typescript/web/listener/index.d.ts.map +1 -0
- package/lib/typescript/web/listener/listener.d.ts +10 -0
- package/lib/typescript/web/listener/listener.d.ts.map +1 -0
- package/lib/typescript/web/mock.d.ts +14 -0
- package/lib/typescript/web/mock.d.ts.map +1 -0
- package/lib/typescript/web/mq.d.ts +4 -0
- package/lib/typescript/web/mq.d.ts.map +1 -0
- package/lib/typescript/web/pseudo.d.ts +4 -0
- package/lib/typescript/web/pseudo.d.ts.map +1 -0
- package/lib/typescript/web/registry.d.ts +12 -0
- package/lib/typescript/web/registry.d.ts.map +1 -0
- package/lib/typescript/web/runtime.d.ts +42 -0
- package/lib/typescript/web/runtime.d.ts.map +1 -0
- package/lib/typescript/web/state.d.ts +24 -0
- package/lib/typescript/web/state.d.ts.map +1 -0
- package/lib/typescript/web/useVariants.d.ts +3 -0
- package/lib/typescript/web/useVariants.d.ts.map +1 -0
- package/lib/typescript/web/utils.d.ts +18 -0
- package/lib/typescript/web/utils.d.ts.map +1 -0
- package/nitrogen/generated/android/UnistylesOnLoad.cpp +34 -0
- package/nitrogen/generated/android/UnistylesOnLoad.hpp +25 -0
- package/nitrogen/generated/android/UnistylesOnLoad.kt +1 -0
- package/nitrogen/generated/android/c++/JColorScheme.hpp +61 -0
- package/nitrogen/generated/android/c++/JDimensions.hpp +56 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +60 -0
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +145 -0
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +70 -0
- package/nitrogen/generated/android/c++/JInsets.hpp +68 -0
- package/nitrogen/generated/android/c++/JOrientation.hpp +58 -0
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +94 -0
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/ColorScheme.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency_.kt +45 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +134 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Orientation.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +33 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +29 -0
- package/nitrogen/generated/android/unistyles+autolinking.cmake +52 -0
- package/nitrogen/generated/android/unistyles+autolinking.gradle +25 -0
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +56 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +86 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +88 -0
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +151 -0
- package/nitrogen/generated/ios/swift/ColorScheme.swift +44 -0
- package/nitrogen/generated/ios/swift/Dimensions.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +273 -0
- package/nitrogen/generated/ios/swift/Insets.swift +79 -0
- package/nitrogen/generated/ios/swift/Orientation.swift +40 -0
- package/nitrogen/generated/ios/swift/UnistyleDependency.swift +88 -0
- package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +134 -0
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +82 -0
- package/nitrogen/generated/shared/c++/Dimensions.hpp +72 -0
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +38 -0
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +95 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +61 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +36 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +88 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +59 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +61 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +60 -0
- package/nitrogen/generated/shared/c++/Insets.hpp +84 -0
- package/nitrogen/generated/shared/c++/Orientation.hpp +78 -0
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +76 -0
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +128 -0
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +115 -0
- package/package.json +34 -59
- package/plugin/__tests__/dependencies.spec.js +360 -0
- package/plugin/__tests__/ref.spec.js +991 -0
- package/plugin/__tests__/stylesheet.spec.js +396 -0
- package/plugin/common.js +119 -0
- package/plugin/import.js +8 -0
- package/plugin/index.js +122 -0
- package/plugin/ref.js +179 -0
- package/plugin/style.js +58 -0
- package/plugin/stylesheet.js +147 -0
- package/src/common.ts +0 -58
- package/src/index.ts +11 -52
- package/src/{utils/mq.ts → mq.ts} +13 -4
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +61 -0
- package/src/specs/NativePlatform/index.ts +2 -0
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +10 -0
- package/src/specs/NavigtionBar/index.ts +25 -0
- package/src/specs/ShadowRegistry/ShadowRegistry.nitro.ts +3 -0
- package/src/specs/ShadowRegistry/index.ts +51 -0
- package/src/specs/ShadowRegistry/types.ts +29 -0
- package/src/specs/StatusBar/UnistylesStatusBar.nitro.ts +10 -0
- package/src/specs/StatusBar/index.ts +48 -0
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +6 -0
- package/src/specs/StyleSheet/index.ts +44 -0
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +8 -0
- package/src/specs/TurboUnistyles/index.ts +1 -0
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +47 -0
- package/src/specs/UnistylesRuntime/index.ts +64 -0
- package/src/specs/index.ts +23 -0
- package/src/specs/index.web.ts +5 -0
- package/src/specs/types.ts +38 -0
- package/src/types/accessibility.ts +29 -0
- package/src/types/breakpoints.ts +21 -14
- package/src/types/common.ts +1 -0
- package/src/types/index.ts +2 -5
- package/src/types/stylesheet.ts +41 -9
- package/src/types/variants.ts +7 -11
- package/web/convert/boxShadow.ts +72 -0
- package/web/convert/breakpoint.ts +21 -0
- package/web/convert/index.ts +78 -0
- package/web/convert/shadow.ts +68 -0
- package/web/convert/style.ts +94 -0
- package/web/convert/textShadow.ts +69 -0
- package/web/convert/transform.ts +89 -0
- package/web/convert/types.ts +16 -0
- package/web/convert/utils.ts +54 -0
- package/web/create.ts +102 -0
- package/web/index.ts +24 -0
- package/web/listener/index.ts +1 -0
- package/web/listener/listener.ts +33 -0
- package/web/mock.ts +35 -0
- package/web/mq.ts +19 -0
- package/web/pseudo.ts +11 -0
- package/web/registry.ts +41 -0
- package/web/runtime.ts +198 -0
- package/web/state.ts +148 -0
- package/web/useVariants.ts +99 -0
- package/web/utils.ts +95 -0
- package/android/src/main/java/com/unistyles/Models.kt +0 -27
- package/android/src/main/java/com/unistyles/Platform.kt +0 -324
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +0 -217
- package/cxx/Macros.h +0 -11
- package/cxx/UnistylesImpl.cpp +0 -310
- package/cxx/UnistylesModel.cpp +0 -230
- package/cxx/UnistylesModel.h +0 -143
- package/cxx/UnistylesRuntime.cpp +0 -36
- package/cxx/UnistylesRuntime.h +0 -81
- package/ios/UnistylesModule.h +0 -28
- package/ios/UnistylesModule.mm +0 -77
- package/ios/platform/Platform_Shared.h +0 -8
- package/ios/platform/Platform_Shared.mm +0 -160
- package/ios/platform/Platform_iOS.h +0 -20
- package/ios/platform/Platform_iOS.mm +0 -193
- package/ios/platform/Platform_macOS.h +0 -19
- package/ios/platform/Platform_macOS.mm +0 -117
- package/ios/platform/Platform_tvOS.h +0 -16
- package/ios/platform/Platform_tvOS.mm +0 -92
- package/ios/platform/Platform_visionOS.h +0 -19
- package/ios/platform/Platform_visionOS.mm +0 -116
- package/lib/commonjs/core/UnistyleRegistry.js +0 -110
- package/lib/commonjs/core/UnistyleRegistry.js.map +0 -1
- package/lib/commonjs/core/Unistyles.js +0 -39
- package/lib/commonjs/core/Unistyles.js.map +0 -1
- package/lib/commonjs/core/UnistylesModule.js +0 -268
- package/lib/commonjs/core/UnistylesModule.js.map +0 -1
- package/lib/commonjs/core/UnistylesModule.native.js +0 -9
- package/lib/commonjs/core/UnistylesModule.native.js.map +0 -1
- package/lib/commonjs/core/UnistylesModule.windows.js +0 -11
- package/lib/commonjs/core/UnistylesModule.windows.js.map +0 -1
- package/lib/commonjs/core/UnistylesRuntime.js +0 -284
- package/lib/commonjs/core/UnistylesRuntime.js.map +0 -1
- package/lib/commonjs/core/index.js +0 -13
- package/lib/commonjs/core/index.js.map +0 -1
- package/lib/commonjs/core/mocks/UnistylesMockedBridge.js +0 -36
- package/lib/commonjs/core/mocks/UnistylesMockedBridge.js.map +0 -1
- package/lib/commonjs/core/mocks/UnistylesMockedRegistry.js +0 -46
- package/lib/commonjs/core/mocks/UnistylesMockedRegistry.js.map +0 -1
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js +0 -122
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js.map +0 -1
- package/lib/commonjs/core/mocks/index.js +0 -27
- package/lib/commonjs/core/mocks/index.js.map +0 -1
- package/lib/commonjs/createStyleSheet.js +0 -14
- package/lib/commonjs/createStyleSheet.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -34
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/useCSS.js +0 -44
- package/lib/commonjs/hooks/useCSS.js.map +0 -1
- package/lib/commonjs/hooks/useCSS.native.js +0 -9
- package/lib/commonjs/hooks/useCSS.native.js.map +0 -1
- package/lib/commonjs/hooks/useInitialTheme.js +0 -17
- package/lib/commonjs/hooks/useInitialTheme.js.map +0 -1
- package/lib/commonjs/hooks/useUnistyles.js +0 -74
- package/lib/commonjs/hooks/useUnistyles.js.map +0 -1
- package/lib/commonjs/hooks/useVariants.js +0 -14
- package/lib/commonjs/hooks/useVariants.js.map +0 -1
- package/lib/commonjs/normalizer/index.js +0 -32
- package/lib/commonjs/normalizer/index.js.map +0 -1
- package/lib/commonjs/normalizer/module.d.js +0 -2
- package/lib/commonjs/normalizer/module.d.js.map +0 -1
- package/lib/commonjs/normalizer/normalizeStyle.js +0 -59
- package/lib/commonjs/normalizer/normalizeStyle.js.map +0 -1
- package/lib/commonjs/normalizer/normalizer.js +0 -88
- package/lib/commonjs/normalizer/normalizer.js.map +0 -1
- package/lib/commonjs/normalizer/normalizer.macos.js +0 -3
- package/lib/commonjs/normalizer/normalizer.macos.js.map +0 -1
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +0 -14
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +0 -1
- package/lib/commonjs/plugins/index.js +0 -20
- package/lib/commonjs/plugins/index.js.map +0 -1
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +0 -12
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +0 -1
- package/lib/commonjs/types/color.js +0 -2
- package/lib/commonjs/types/color.js.map +0 -1
- package/lib/commonjs/types/normalizer.js.map +0 -1
- package/lib/commonjs/types/plugin.js.map +0 -1
- package/lib/commonjs/types/unistyles.js.map +0 -1
- package/lib/commonjs/useStyles.js +0 -47
- package/lib/commonjs/useStyles.js.map +0 -1
- package/lib/commonjs/utils/breakpoints.js +0 -33
- package/lib/commonjs/utils/breakpoints.js.map +0 -1
- package/lib/commonjs/utils/cssMediaQuery.js +0 -244
- package/lib/commonjs/utils/cssMediaQuery.js.map +0 -1
- package/lib/commonjs/utils/generateId.js +0 -15
- package/lib/commonjs/utils/generateId.js.map +0 -1
- package/lib/commonjs/utils/hash32.js +0 -43
- package/lib/commonjs/utils/hash32.js.map +0 -1
- package/lib/commonjs/utils/index.js +0 -91
- package/lib/commonjs/utils/index.js.map +0 -1
- package/lib/commonjs/utils/mq.js.map +0 -1
- package/lib/commonjs/utils/mqParser.js +0 -89
- package/lib/commonjs/utils/mqParser.js.map +0 -1
- package/lib/commonjs/utils/parseColor.js +0 -35
- package/lib/commonjs/utils/parseColor.js.map +0 -1
- package/lib/commonjs/utils/styles.js +0 -73
- package/lib/commonjs/utils/styles.js.map +0 -1
- package/lib/commonjs/utils/withPlugins.js +0 -15
- package/lib/commonjs/utils/withPlugins.js.map +0 -1
- package/lib/module/core/UnistyleRegistry.js +0 -103
- package/lib/module/core/UnistyleRegistry.js.map +0 -1
- package/lib/module/core/Unistyles.js +0 -33
- package/lib/module/core/Unistyles.js.map +0 -1
- package/lib/module/core/UnistylesModule.js +0 -261
- package/lib/module/core/UnistylesModule.js.map +0 -1
- package/lib/module/core/UnistylesModule.native.js +0 -3
- package/lib/module/core/UnistylesModule.native.js.map +0 -1
- package/lib/module/core/UnistylesModule.windows.js +0 -5
- package/lib/module/core/UnistylesModule.windows.js.map +0 -1
- package/lib/module/core/UnistylesRuntime.js +0 -278
- package/lib/module/core/UnistylesRuntime.js.map +0 -1
- package/lib/module/core/index.js +0 -3
- package/lib/module/core/index.js.map +0 -1
- package/lib/module/core/mocks/UnistylesMockedBridge.js +0 -29
- package/lib/module/core/mocks/UnistylesMockedBridge.js.map +0 -1
- package/lib/module/core/mocks/UnistylesMockedRegistry.js +0 -39
- package/lib/module/core/mocks/UnistylesMockedRegistry.js.map +0 -1
- package/lib/module/core/mocks/UnistylesMockedRuntime.js +0 -114
- package/lib/module/core/mocks/UnistylesMockedRuntime.js.map +0 -1
- package/lib/module/core/mocks/index.js +0 -4
- package/lib/module/core/mocks/index.js.map +0 -1
- package/lib/module/createStyleSheet.js +0 -7
- package/lib/module/createStyleSheet.js.map +0 -1
- package/lib/module/hooks/index.js +0 -5
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/useCSS.js +0 -37
- package/lib/module/hooks/useCSS.js.map +0 -1
- package/lib/module/hooks/useCSS.native.js +0 -2
- package/lib/module/hooks/useCSS.native.js.map +0 -1
- package/lib/module/hooks/useInitialTheme.js +0 -10
- package/lib/module/hooks/useInitialTheme.js.map +0 -1
- package/lib/module/hooks/useUnistyles.js +0 -67
- package/lib/module/hooks/useUnistyles.js.map +0 -1
- package/lib/module/hooks/useVariants.js +0 -7
- package/lib/module/hooks/useVariants.js.map +0 -1
- package/lib/module/normalizer/index.js +0 -3
- package/lib/module/normalizer/index.js.map +0 -1
- package/lib/module/normalizer/module.d.js +0 -2
- package/lib/module/normalizer/module.d.js.map +0 -1
- package/lib/module/normalizer/normalizeStyle.js +0 -52
- package/lib/module/normalizer/normalizeStyle.js.map +0 -1
- package/lib/module/normalizer/normalizer.js +0 -78
- package/lib/module/normalizer/normalizer.js.map +0 -1
- package/lib/module/normalizer/normalizer.macos.js +0 -2
- package/lib/module/normalizer/normalizer.macos.js.map +0 -1
- package/lib/module/plugins/cssMediaQueriesPlugin.js +0 -7
- package/lib/module/plugins/cssMediaQueriesPlugin.js.map +0 -1
- package/lib/module/plugins/index.js +0 -3
- package/lib/module/plugins/index.js.map +0 -1
- package/lib/module/plugins/normalizeWebStylesPlugin.js +0 -6
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +0 -1
- package/lib/module/types/color.js +0 -2
- package/lib/module/types/color.js.map +0 -1
- package/lib/module/types/normalizer.js +0 -2
- package/lib/module/types/normalizer.js.map +0 -1
- package/lib/module/types/plugin.js +0 -2
- package/lib/module/types/plugin.js.map +0 -1
- package/lib/module/types/unistyles.js +0 -2
- package/lib/module/types/unistyles.js.map +0 -1
- package/lib/module/useStyles.js +0 -40
- package/lib/module/useStyles.js.map +0 -1
- package/lib/module/utils/breakpoints.js +0 -26
- package/lib/module/utils/breakpoints.js.map +0 -1
- package/lib/module/utils/cssMediaQuery.js +0 -237
- package/lib/module/utils/cssMediaQuery.js.map +0 -1
- package/lib/module/utils/generateId.js +0 -7
- package/lib/module/utils/generateId.js.map +0 -1
- package/lib/module/utils/hash32.js +0 -36
- package/lib/module/utils/hash32.js.map +0 -1
- package/lib/module/utils/index.js +0 -8
- package/lib/module/utils/index.js.map +0 -1
- package/lib/module/utils/mq.js.map +0 -1
- package/lib/module/utils/mqParser.js +0 -78
- package/lib/module/utils/mqParser.js.map +0 -1
- package/lib/module/utils/parseColor.js +0 -28
- package/lib/module/utils/parseColor.js.map +0 -1
- package/lib/module/utils/styles.js +0 -64
- package/lib/module/utils/styles.js.map +0 -1
- package/lib/module/utils/withPlugins.js +0 -8
- package/lib/module/utils/withPlugins.js.map +0 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +0 -57
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +0 -1
- package/lib/typescript/src/core/Unistyles.d.ts +0 -13
- package/lib/typescript/src/core/Unistyles.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesModule.d.ts +0 -21
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesModule.native.d.ts +0 -6
- package/lib/typescript/src/core/UnistylesModule.native.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesModule.windows.d.ts +0 -6
- package/lib/typescript/src/core/UnistylesModule.windows.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +0 -179
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +0 -1
- package/lib/typescript/src/core/index.d.ts +0 -5
- package/lib/typescript/src/core/index.d.ts.map +0 -1
- package/lib/typescript/src/core/mocks/UnistylesMockedBridge.d.ts +0 -28
- package/lib/typescript/src/core/mocks/UnistylesMockedBridge.d.ts.map +0 -1
- package/lib/typescript/src/core/mocks/UnistylesMockedRegistry.d.ts +0 -21
- package/lib/typescript/src/core/mocks/UnistylesMockedRegistry.d.ts.map +0 -1
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts +0 -79
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts.map +0 -1
- package/lib/typescript/src/core/mocks/index.d.ts +0 -4
- package/lib/typescript/src/core/mocks/index.d.ts.map +0 -1
- package/lib/typescript/src/createStyleSheet.d.ts +0 -8
- package/lib/typescript/src/createStyleSheet.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -5
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCSS.d.ts +0 -3
- package/lib/typescript/src/hooks/useCSS.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCSS.native.d.ts +0 -3
- package/lib/typescript/src/hooks/useCSS.native.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +0 -3
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts +0 -27
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useVariants.d.ts +0 -3
- package/lib/typescript/src/hooks/useVariants.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/index.d.ts +0 -3
- package/lib/typescript/src/normalizer/index.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts +0 -3
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizer.d.ts +0 -11
- package/lib/typescript/src/normalizer/normalizer.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts +0 -1
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts.map +0 -1
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +0 -3
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +0 -1
- package/lib/typescript/src/plugins/index.d.ts +0 -3
- package/lib/typescript/src/plugins/index.d.ts.map +0 -1
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +0 -3
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +0 -1
- package/lib/typescript/src/types/color.d.ts +0 -4
- package/lib/typescript/src/types/color.d.ts.map +0 -1
- package/lib/typescript/src/types/normalizer.d.ts +0 -20
- package/lib/typescript/src/types/normalizer.d.ts.map +0 -1
- package/lib/typescript/src/types/plugin.d.ts +0 -7
- package/lib/typescript/src/types/plugin.d.ts.map +0 -1
- package/lib/typescript/src/types/unistyles.d.ts +0 -81
- package/lib/typescript/src/types/unistyles.d.ts.map +0 -1
- package/lib/typescript/src/useStyles.d.ts +0 -16
- package/lib/typescript/src/useStyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/breakpoints.d.ts +0 -3
- package/lib/typescript/src/utils/breakpoints.d.ts.map +0 -1
- package/lib/typescript/src/utils/cssMediaQuery.d.ts +0 -4
- package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +0 -1
- package/lib/typescript/src/utils/generateId.d.ts +0 -2
- package/lib/typescript/src/utils/generateId.d.ts.map +0 -1
- package/lib/typescript/src/utils/hash32.d.ts +0 -2
- package/lib/typescript/src/utils/hash32.d.ts.map +0 -1
- package/lib/typescript/src/utils/index.d.ts +0 -9
- package/lib/typescript/src/utils/index.d.ts.map +0 -1
- package/lib/typescript/src/utils/mq.d.ts.map +0 -1
- package/lib/typescript/src/utils/mqParser.d.ts +0 -16
- package/lib/typescript/src/utils/mqParser.d.ts.map +0 -1
- package/lib/typescript/src/utils/parseColor.d.ts +0 -3
- package/lib/typescript/src/utils/parseColor.d.ts.map +0 -1
- package/lib/typescript/src/utils/styles.d.ts +0 -5
- package/lib/typescript/src/utils/styles.d.ts.map +0 -1
- package/lib/typescript/src/utils/withPlugins.d.ts +0 -3
- package/lib/typescript/src/utils/withPlugins.d.ts.map +0 -1
- package/react-native.config.js +0 -11
- package/src/__tests__/mocks.ts +0 -24
- package/src/core/UnistyleRegistry.ts +0 -130
- package/src/core/Unistyles.ts +0 -44
- package/src/core/UnistylesModule.native.ts +0 -7
- package/src/core/UnistylesModule.ts +0 -305
- package/src/core/UnistylesModule.windows.ts +0 -9
- package/src/core/UnistylesRuntime.ts +0 -284
- package/src/core/index.ts +0 -8
- package/src/core/mocks/UnistylesMockedBridge.ts +0 -30
- package/src/core/mocks/UnistylesMockedRegistry.ts +0 -47
- package/src/core/mocks/UnistylesMockedRuntime.ts +0 -144
- package/src/core/mocks/index.ts +0 -3
- package/src/createStyleSheet.ts +0 -8
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useCSS.native.ts +0 -3
- package/src/hooks/useCSS.ts +0 -51
- package/src/hooks/useInitialTheme.ts +0 -11
- package/src/hooks/useUnistyles.ts +0 -74
- package/src/hooks/useVariants.ts +0 -10
- package/src/normalizer/index.ts +0 -2
- package/src/normalizer/normalizeStyle.ts +0 -82
- package/src/normalizer/normalizer.macos.ts +0 -1
- package/src/normalizer/normalizer.ts +0 -100
- package/src/plugins/cssMediaQueriesPlugin.ts +0 -8
- package/src/plugins/index.ts +0 -2
- package/src/plugins/normalizeWebStylesPlugin.ts +0 -7
- package/src/types/color.ts +0 -26
- package/src/types/normalizer.ts +0 -29
- package/src/types/plugin.ts +0 -7
- package/src/types/unistyles.ts +0 -98
- package/src/useStyles.ts +0 -60
- package/src/utils/breakpoints.ts +0 -44
- package/src/utils/cssMediaQuery.ts +0 -268
- package/src/utils/generateId.ts +0 -10
- package/src/utils/hash32.ts +0 -53
- package/src/utils/index.ts +0 -8
- package/src/utils/mqParser.ts +0 -99
- package/src/utils/parseColor.ts +0 -33
- package/src/utils/styles.ts +0 -90
- package/src/utils/withPlugins.ts +0 -13
- package/windows/ExperimentalFeatures.props +0 -40
- package/windows/NuGet.Config +0 -13
- package/windows/ReactNativeUnistyles/PropertySheet.props +0 -16
- package/windows/ReactNativeUnistyles/ReactNativeUnistyles.def +0 -3
- package/windows/ReactNativeUnistyles/ReactNativeUnistyles.h +0 -149
- package/windows/ReactNativeUnistyles/ReactNativeUnistyles.vcxproj +0 -162
- package/windows/ReactNativeUnistyles/ReactNativeUnistyles.vcxproj.filters +0 -25
- package/windows/ReactNativeUnistyles/ReactPackageProvider.cpp +0 -19
- package/windows/ReactNativeUnistyles/ReactPackageProvider.h +0 -21
- package/windows/ReactNativeUnistyles/ReactPackageProvider.idl +0 -9
- package/windows/ReactNativeUnistyles/packages.lock.json +0 -133
- package/windows/ReactNativeUnistyles/pch.cpp +0 -1
- package/windows/ReactNativeUnistyles/pch.h +0 -21
- package/windows/ReactNativeUnistyles.sln +0 -156
- /package/{src/normalizer → web/convert}/module.d.ts +0 -0
@@ -1,261 +0,0 @@
|
|
1
|
-
import { NativeEventEmitter, NativeModules } from 'react-native';
|
2
|
-
import { normalizeWebStylesPlugin } from '../plugins';
|
3
|
-
import { isServer } from '../common';
|
4
|
-
export class UnistylesBridgeWeb {
|
5
|
-
#timerRef = undefined;
|
6
|
-
#windowResizeDebounceTimeMs = 100;
|
7
|
-
#hasAdaptiveThemes = false;
|
8
|
-
#supportsAutomaticColorScheme = false;
|
9
|
-
#screenWidth = isServer ? undefined : window.innerWidth;
|
10
|
-
#screenHeight = isServer ? undefined : window.innerHeight;
|
11
|
-
#themes = [];
|
12
|
-
#breakpoints = {};
|
13
|
-
#colorScheme = this.getPreferredColorScheme();
|
14
|
-
#themeName = '';
|
15
|
-
#enabledPlugins = [normalizeWebStylesPlugin.name];
|
16
|
-
#unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
|
17
|
-
#sortedBreakpointPairs = [];
|
18
|
-
#breakpoint = '';
|
19
|
-
#contentSizeCategory = 'unspecified';
|
20
|
-
#insets = {
|
21
|
-
top: 0,
|
22
|
-
right: 0,
|
23
|
-
bottom: 0,
|
24
|
-
left: 0
|
25
|
-
};
|
26
|
-
#statusBar = {
|
27
|
-
height: 0,
|
28
|
-
width: 0,
|
29
|
-
setColor: () => {},
|
30
|
-
setHidden: () => {}
|
31
|
-
};
|
32
|
-
#navigationBar = {
|
33
|
-
height: 0,
|
34
|
-
width: 0,
|
35
|
-
setColor: () => {},
|
36
|
-
setHidden: () => {}
|
37
|
-
};
|
38
|
-
#pixelRatio = 1.0;
|
39
|
-
#fontScale = 1.0;
|
40
|
-
#hairlineWidth = 1;
|
41
|
-
#rtl = false;
|
42
|
-
constructor() {
|
43
|
-
if (!isServer) {
|
44
|
-
this.setupListeners();
|
45
|
-
this.#screenWidth = window.innerWidth;
|
46
|
-
this.#screenHeight = window.innerHeight;
|
47
|
-
this.#rtl = document.documentElement.dir === 'rtl';
|
48
|
-
}
|
49
|
-
}
|
50
|
-
install() {
|
51
|
-
// @ts-ignore
|
52
|
-
// eslint-disable-next-line no-undef
|
53
|
-
globalThis.__UNISTYLES__ = new Proxy({}, {
|
54
|
-
get: (_target, prop) => {
|
55
|
-
switch (prop) {
|
56
|
-
case 'themeName':
|
57
|
-
return this.getTheme();
|
58
|
-
case 'screenWidth':
|
59
|
-
return this.#screenWidth;
|
60
|
-
case 'screenHeight':
|
61
|
-
return this.#screenHeight;
|
62
|
-
case 'contentSizeCategory':
|
63
|
-
return this.#contentSizeCategory;
|
64
|
-
case 'breakpoint':
|
65
|
-
return this.#breakpoint || undefined;
|
66
|
-
case 'breakpoints':
|
67
|
-
return this.#breakpoints;
|
68
|
-
case 'hasAdaptiveThemes':
|
69
|
-
return this.#hasAdaptiveThemes;
|
70
|
-
case 'sortedBreakpointPairs':
|
71
|
-
return this.#sortedBreakpointPairs;
|
72
|
-
case 'enabledPlugins':
|
73
|
-
return this.#enabledPlugins;
|
74
|
-
case 'colorScheme':
|
75
|
-
return this.#colorScheme;
|
76
|
-
case 'insets':
|
77
|
-
return this.#insets;
|
78
|
-
case 'statusBar':
|
79
|
-
return this.#statusBar;
|
80
|
-
case 'navigationBar':
|
81
|
-
return this.#navigationBar;
|
82
|
-
case 'pixelRatio':
|
83
|
-
return this.#pixelRatio;
|
84
|
-
case 'fontScale':
|
85
|
-
return this.#fontScale;
|
86
|
-
case 'hairlineWidth':
|
87
|
-
return this.#hairlineWidth;
|
88
|
-
case 'rtl':
|
89
|
-
return this.#rtl;
|
90
|
-
case 'useTheme':
|
91
|
-
return themeName => this.useTheme(themeName);
|
92
|
-
case 'updateTheme':
|
93
|
-
return themeName => this.updateTheme(themeName);
|
94
|
-
case 'useBreakpoints':
|
95
|
-
return breakpoints => this.useBreakpoints(breakpoints);
|
96
|
-
case 'useAdaptiveThemes':
|
97
|
-
return enable => this.useAdaptiveThemes(enable);
|
98
|
-
case 'addPlugin':
|
99
|
-
return (pluginName, notify) => this.addPlugin(pluginName, notify);
|
100
|
-
case 'removePlugin':
|
101
|
-
return pluginName => this.removePlugin(pluginName);
|
102
|
-
case 'setRootViewBackgroundColor':
|
103
|
-
return color => this.setRootViewBackgroundColor(color);
|
104
|
-
case 'setImmersiveMode':
|
105
|
-
return () => {};
|
106
|
-
case 'setWindowResizeDebounceTimeMs':
|
107
|
-
return timeMs => {
|
108
|
-
if (timeMs >= 0) {
|
109
|
-
this.#windowResizeDebounceTimeMs = timeMs;
|
110
|
-
}
|
111
|
-
};
|
112
|
-
default:
|
113
|
-
return Reflect.get(this, prop);
|
114
|
-
}
|
115
|
-
},
|
116
|
-
set: (target, prop, newValue, receiver) => {
|
117
|
-
switch (prop) {
|
118
|
-
case 'themes':
|
119
|
-
{
|
120
|
-
this.#themes = newValue;
|
121
|
-
this.#supportsAutomaticColorScheme = newValue.includes('light') && newValue.includes('dark');
|
122
|
-
return true;
|
123
|
-
}
|
124
|
-
case 'themeName':
|
125
|
-
{
|
126
|
-
this.#themeName = newValue;
|
127
|
-
this.emitThemeChange();
|
128
|
-
return true;
|
129
|
-
}
|
130
|
-
default:
|
131
|
-
return Reflect.set(target, prop, newValue, receiver);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
});
|
135
|
-
return true;
|
136
|
-
}
|
137
|
-
useTheme(themeName) {
|
138
|
-
this.#themeName = themeName;
|
139
|
-
this.emitThemeChange();
|
140
|
-
}
|
141
|
-
updateTheme(themeName) {
|
142
|
-
if (!this.#themeName) {
|
143
|
-
this.#themeName = this.getTheme();
|
144
|
-
}
|
145
|
-
if (this.#themeName === themeName) {
|
146
|
-
this.emitThemeChange();
|
147
|
-
}
|
148
|
-
}
|
149
|
-
useBreakpoints(breakpoints) {
|
150
|
-
this.#breakpoints = breakpoints;
|
151
|
-
this.#sortedBreakpointPairs = Object.entries(breakpoints).sort(([, a], [, b]) => (a ?? 0) - (b ?? 0));
|
152
|
-
if (!isServer) {
|
153
|
-
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
154
|
-
}
|
155
|
-
}
|
156
|
-
useAdaptiveThemes(enable) {
|
157
|
-
this.#hasAdaptiveThemes = enable;
|
158
|
-
if (!this.#hasAdaptiveThemes || !this.#supportsAutomaticColorScheme) {
|
159
|
-
return;
|
160
|
-
}
|
161
|
-
if (this.#themeName !== this.#colorScheme) {
|
162
|
-
this.#themeName = this.#colorScheme;
|
163
|
-
this.emitThemeChange();
|
164
|
-
}
|
165
|
-
}
|
166
|
-
addPlugin(pluginName, notify) {
|
167
|
-
this.#enabledPlugins = [pluginName].concat(this.#enabledPlugins);
|
168
|
-
if (notify) {
|
169
|
-
this.emitPluginChange();
|
170
|
-
}
|
171
|
-
}
|
172
|
-
removePlugin(pluginName) {
|
173
|
-
this.#enabledPlugins = this.#enabledPlugins.filter(name => name !== pluginName);
|
174
|
-
this.emitPluginChange();
|
175
|
-
}
|
176
|
-
getTheme() {
|
177
|
-
if (this.#themes.length === 1) {
|
178
|
-
return this.#themes.at(0);
|
179
|
-
}
|
180
|
-
return this.#themeName;
|
181
|
-
}
|
182
|
-
setupListeners() {
|
183
|
-
const onResize = () => {
|
184
|
-
this.#screenWidth = window.innerWidth;
|
185
|
-
this.#screenHeight = window.innerHeight;
|
186
|
-
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
187
|
-
this.emitLayoutChange();
|
188
|
-
};
|
189
|
-
window.addEventListener('resize', () => {
|
190
|
-
if (this.#windowResizeDebounceTimeMs === 0) {
|
191
|
-
return onResize();
|
192
|
-
}
|
193
|
-
clearTimeout(this.#timerRef);
|
194
|
-
this.#timerRef = setTimeout(onResize, this.#windowResizeDebounceTimeMs);
|
195
|
-
});
|
196
|
-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
197
|
-
this.#colorScheme = event.matches ? 'dark' : 'light';
|
198
|
-
if (!this.#supportsAutomaticColorScheme || !this.#hasAdaptiveThemes) {
|
199
|
-
return;
|
200
|
-
}
|
201
|
-
if (this.#colorScheme !== this.#themeName) {
|
202
|
-
this.#themeName = this.#colorScheme;
|
203
|
-
this.emitThemeChange();
|
204
|
-
}
|
205
|
-
});
|
206
|
-
new MutationObserver(() => {
|
207
|
-
this.#rtl = document.documentElement.dir === 'rtl';
|
208
|
-
}).observe(document.documentElement, {
|
209
|
-
attributes: true,
|
210
|
-
attributeFilter: ['dir']
|
211
|
-
});
|
212
|
-
}
|
213
|
-
getBreakpointFromScreenWidth(width) {
|
214
|
-
const breakpoint = this.#sortedBreakpointPairs.find(([, value], index, otherBreakpoints) => {
|
215
|
-
const minVal = value;
|
216
|
-
const maxVal = otherBreakpoints[index + 1]?.[1];
|
217
|
-
if (!maxVal) {
|
218
|
-
return true;
|
219
|
-
}
|
220
|
-
return width >= minVal && width < maxVal;
|
221
|
-
});
|
222
|
-
return breakpoint?.at(0);
|
223
|
-
}
|
224
|
-
getPreferredColorScheme() {
|
225
|
-
if (!isServer && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
226
|
-
return 'dark';
|
227
|
-
}
|
228
|
-
return 'light';
|
229
|
-
}
|
230
|
-
setRootViewBackgroundColor(color) {
|
231
|
-
document.body.style.backgroundColor = color;
|
232
|
-
}
|
233
|
-
emitPluginChange() {
|
234
|
-
this.#unistylesEvents.emit('__unistylesOnChange', {
|
235
|
-
type: 'plugin'
|
236
|
-
});
|
237
|
-
}
|
238
|
-
emitThemeChange() {
|
239
|
-
this.#unistylesEvents.emit('__unistylesOnChange', {
|
240
|
-
type: 'theme',
|
241
|
-
payload: {
|
242
|
-
themeName: this.#themeName
|
243
|
-
}
|
244
|
-
});
|
245
|
-
}
|
246
|
-
emitLayoutChange() {
|
247
|
-
this.#unistylesEvents.emit('__unistylesOnChange', {
|
248
|
-
type: 'layout',
|
249
|
-
payload: {
|
250
|
-
breakpoint: this.#breakpoint,
|
251
|
-
orientation: this.#screenWidth > this.#screenHeight ? 'landscape' : 'portrait',
|
252
|
-
screen: {
|
253
|
-
width: this.#screenWidth,
|
254
|
-
height: this.#screenHeight
|
255
|
-
}
|
256
|
-
}
|
257
|
-
});
|
258
|
-
}
|
259
|
-
}
|
260
|
-
export const UnistylesModule = new UnistylesBridgeWeb();
|
261
|
-
//# sourceMappingURL=UnistylesModule.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","isServer","UnistylesBridgeWeb","timerRef","undefined","windowResizeDebounceTimeMs","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","name","unistylesEvents","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","setColor","setHidden","navigationBar","pixelRatio","fontScale","hairlineWidth","rtl","constructor","setupListeners","document","documentElement","dir","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","timeMs","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","onResize","emitLayoutChange","addEventListener","clearTimeout","setTimeout","matchMedia","event","matches","MutationObserver","observe","attributes","attributeFilter","find","value","index","otherBreakpoints","minVal","maxVal","body","style","backgroundColor","emit","type","payload","orientation","screen","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAGhE,SAASC,wBAAwB,QAAQ,YAAY;AACrD,SAASC,QAAQ,QAAQ,WAAW;AAEpC,OAAO,MAAMC,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,0BAA0B,GAAW,GAAG;EACzC,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGP,QAAQ,GAAGG,SAAS,GAAGK,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGV,QAAQ,GAAGG,SAAS,GAAGK,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,C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eAAe,GAAG,IAAI3G,kBAAkB,CAAC,CAAC","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["NativeModules","UnistylesModule","Unistyles"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.native.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAM5C,OAAO,MAAMC,eAAe,GAAGD,aAAa,EAAEE,SAAkC","ignoreList":[]}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import { NativeModules, TurboModuleRegistry } from 'react-native';
|
2
|
-
// while debugging modules will default to NativeModules
|
3
|
-
// without debugging/in release mode module will be available in TurboModules
|
4
|
-
export const UnistylesModule = TurboModuleRegistry.getEnforcing('Unistyles') ?? NativeModules?.Unistyles;
|
5
|
-
//# sourceMappingURL=UnistylesModule.windows.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["NativeModules","TurboModuleRegistry","UnistylesModule","getEnforcing","Unistyles"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.windows.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,mBAAmB,QAAQ,cAAc;AAMjE;AACA;AACA,OAAO,MAAMC,eAAe,GAAID,mBAAmB,CAACE,YAAY,CAAC,WAAW,CAAC,IAAIH,aAAa,EAAEI,SAAmC","ignoreList":[]}
|
@@ -1,278 +0,0 @@
|
|
1
|
-
import { ScreenOrientation, UnistylesError } from '../common';
|
2
|
-
import { parseColor } from '../utils/parseColor';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Utility to interact with the Unistyles during runtime
|
6
|
-
*/
|
7
|
-
export class UnistylesRuntime {
|
8
|
-
constructor(unistylesBridge, unistylesRegistry) {
|
9
|
-
this.unistylesBridge = unistylesBridge;
|
10
|
-
this.unistylesRegistry = unistylesRegistry;
|
11
|
-
}
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Get the mini runtime injected to creteStyleSheet
|
15
|
-
* @returns - The mini runtime
|
16
|
-
*/
|
17
|
-
get miniRuntime() {
|
18
|
-
return {
|
19
|
-
contentSizeCategory: this.contentSizeCategory,
|
20
|
-
breakpoint: this.breakpoint,
|
21
|
-
screen: this.screen,
|
22
|
-
insets: this.insets,
|
23
|
-
statusBar: {
|
24
|
-
width: this.statusBar.width,
|
25
|
-
height: this.statusBar.height
|
26
|
-
},
|
27
|
-
navigationBar: {
|
28
|
-
width: this.navigationBar.width,
|
29
|
-
height: this.navigationBar.height
|
30
|
-
},
|
31
|
-
orientation: this.orientation,
|
32
|
-
pixelRatio: this.pixelRatio,
|
33
|
-
fontScale: this.fontScale,
|
34
|
-
hairlineWidth: this.hairlineWidth,
|
35
|
-
rtl: this.rtl
|
36
|
-
};
|
37
|
-
}
|
38
|
-
|
39
|
-
/**
|
40
|
-
* Get the current color scheme
|
41
|
-
* @returns - The current color scheme
|
42
|
-
*/
|
43
|
-
get colorScheme() {
|
44
|
-
return this.unistylesBridge.colorScheme;
|
45
|
-
}
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Get the layout direction
|
49
|
-
* @returns - Boolean indicating if the layout direction is RTL
|
50
|
-
*/
|
51
|
-
get rtl() {
|
52
|
-
return this.unistylesBridge.rtl;
|
53
|
-
}
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Get info about adaptive themes
|
57
|
-
* @returns - boolean indicating if the adaptive themes are enabled
|
58
|
-
*/
|
59
|
-
get hasAdaptiveThemes() {
|
60
|
-
return this.unistylesBridge.hasAdaptiveThemes;
|
61
|
-
}
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Get the current theme name
|
65
|
-
* @returns - The current theme name
|
66
|
-
*/
|
67
|
-
get themeName() {
|
68
|
-
return this.unistylesBridge.themeName;
|
69
|
-
}
|
70
|
-
|
71
|
-
/**
|
72
|
-
* Get the current content size category
|
73
|
-
* @returns - The current content size category
|
74
|
-
*/
|
75
|
-
get contentSizeCategory() {
|
76
|
-
return this.unistylesBridge.contentSizeCategory;
|
77
|
-
}
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Get the current breakpoint based on device size
|
81
|
-
* @returns - The current breakpoint
|
82
|
-
*/
|
83
|
-
get breakpoint() {
|
84
|
-
return this.unistylesBridge.breakpoint;
|
85
|
-
}
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Get registered breakpoints with UnitylesRegistry
|
89
|
-
* @returns - The registered breakpoints
|
90
|
-
*/
|
91
|
-
get breakpoints() {
|
92
|
-
return this.unistylesRegistry.breakpoints;
|
93
|
-
}
|
94
|
-
|
95
|
-
/**
|
96
|
-
* Get the names of currently enabled plugins
|
97
|
-
* @deprecated - Plugins will be removed in the next major release
|
98
|
-
* @returns - The names of currently enabled plugins
|
99
|
-
*/
|
100
|
-
get enabledPlugins() {
|
101
|
-
return this.unistylesBridge.enabledPlugins;
|
102
|
-
}
|
103
|
-
|
104
|
-
/**
|
105
|
-
* Get the screen size
|
106
|
-
* @returns - The screen size { width, height }
|
107
|
-
*/
|
108
|
-
get screen() {
|
109
|
-
return {
|
110
|
-
width: this.unistylesBridge.screenWidth,
|
111
|
-
height: this.unistylesBridge.screenHeight
|
112
|
-
};
|
113
|
-
}
|
114
|
-
|
115
|
-
/**
|
116
|
-
* Get the safe area insets
|
117
|
-
* @returns - The safe area insets { top, bottom, left, right }
|
118
|
-
*/
|
119
|
-
get insets() {
|
120
|
-
return this.unistylesBridge.insets;
|
121
|
-
}
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Get the status bar info
|
125
|
-
* @returns - The status bar api { width, height, setColor, setHidden }
|
126
|
-
*/
|
127
|
-
get statusBar() {
|
128
|
-
return {
|
129
|
-
width: this.unistylesBridge.statusBar.width,
|
130
|
-
height: this.unistylesBridge.statusBar.height,
|
131
|
-
setColor: (color, alpha) => {
|
132
|
-
const [parsedColor, parsedAlpha] = parseColor(color, alpha);
|
133
|
-
this.unistylesBridge.statusBar.setColor(parsedColor, parsedAlpha);
|
134
|
-
},
|
135
|
-
setHidden: hidden => this.unistylesBridge.statusBar.setHidden(hidden)
|
136
|
-
};
|
137
|
-
}
|
138
|
-
|
139
|
-
/**
|
140
|
-
* Get the navigation bar info (Android)
|
141
|
-
* @returns - The navigation bar api { width, height, setColor, setHidden }
|
142
|
-
*/
|
143
|
-
get navigationBar() {
|
144
|
-
return {
|
145
|
-
width: this.unistylesBridge.navigationBar.width,
|
146
|
-
height: this.unistylesBridge.navigationBar.height,
|
147
|
-
setColor: (color, alpha) => {
|
148
|
-
const [parsedColor, parsedAlpha] = parseColor(color, alpha);
|
149
|
-
this.unistylesBridge.navigationBar.setColor(parsedColor, parsedAlpha);
|
150
|
-
},
|
151
|
-
setHidden: hidden => this.unistylesBridge.navigationBar.setHidden(hidden)
|
152
|
-
};
|
153
|
-
}
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Get the screen orientation
|
157
|
-
* @returns - The screen orientation
|
158
|
-
*/
|
159
|
-
get orientation() {
|
160
|
-
const {
|
161
|
-
width,
|
162
|
-
height
|
163
|
-
} = this.screen;
|
164
|
-
if (width > height) {
|
165
|
-
return ScreenOrientation.Landscape;
|
166
|
-
}
|
167
|
-
return ScreenOrientation.Portrait;
|
168
|
-
}
|
169
|
-
|
170
|
-
/**
|
171
|
-
* Get the pixel ratio
|
172
|
-
* @returns - The pixel ratio
|
173
|
-
*/
|
174
|
-
get pixelRatio() {
|
175
|
-
return this.unistylesBridge.pixelRatio;
|
176
|
-
}
|
177
|
-
|
178
|
-
/**
|
179
|
-
* Get the font scale
|
180
|
-
* @returns - The font scale
|
181
|
-
*/
|
182
|
-
get fontScale() {
|
183
|
-
return parseFloat(this.unistylesBridge.fontScale.toFixed(2));
|
184
|
-
}
|
185
|
-
|
186
|
-
/**
|
187
|
-
* Get the hairline width
|
188
|
-
* @returns - The thinnest width of the platform
|
189
|
-
*/
|
190
|
-
get hairlineWidth() {
|
191
|
-
const pixelRatio = this.pixelRatio;
|
192
|
-
const nearestPixel = Math.trunc(pixelRatio * 0.4) || 1;
|
193
|
-
return nearestPixel / pixelRatio;
|
194
|
-
}
|
195
|
-
|
196
|
-
/**
|
197
|
-
* Get theme by name
|
198
|
-
* @param themeName - The name of the theme to get or current theme if not specified
|
199
|
-
* @returns - The theme
|
200
|
-
*/
|
201
|
-
getTheme(themeName) {
|
202
|
-
if (!themeName) {
|
203
|
-
return this.unistylesRegistry.getTheme(this.themeName);
|
204
|
-
}
|
205
|
-
return this.unistylesRegistry.getTheme(themeName);
|
206
|
-
}
|
207
|
-
|
208
|
-
/**
|
209
|
-
* Get the immersive mode (both status bar and navigation bar hidden (Android))
|
210
|
-
* @param isEnabled
|
211
|
-
*/
|
212
|
-
setImmersiveMode(isEnabled) {
|
213
|
-
return this.unistylesBridge.setImmersiveMode(isEnabled);
|
214
|
-
}
|
215
|
-
|
216
|
-
/**
|
217
|
-
* Set the root view background color
|
218
|
-
* @param color - The color to set
|
219
|
-
* @param alpha - Color alpha - default is 1
|
220
|
-
*/
|
221
|
-
setRootViewBackgroundColor = (color, alpha) => {
|
222
|
-
const [parsedColor, parsedAlpha] = parseColor(color, alpha);
|
223
|
-
this.unistylesBridge.setRootViewBackgroundColor(parsedColor, parsedAlpha);
|
224
|
-
};
|
225
|
-
|
226
|
-
/**
|
227
|
-
* Switch to a different theme
|
228
|
-
* @param name - The name of the theme to switch to
|
229
|
-
* @returns - boolean indicating if the theme was switched
|
230
|
-
*/
|
231
|
-
setTheme = name => {
|
232
|
-
if (name === this.themeName) {
|
233
|
-
return;
|
234
|
-
}
|
235
|
-
if (this.unistylesRegistry.hasTheme(name)) {
|
236
|
-
this.unistylesBridge.useTheme(name);
|
237
|
-
return true;
|
238
|
-
}
|
239
|
-
throw new Error(UnistylesError.ThemeNotRegistered);
|
240
|
-
};
|
241
|
-
|
242
|
-
/**
|
243
|
-
* Update the theme at runtime
|
244
|
-
* If current theme is updated, the changes will be applied immediately
|
245
|
-
* @param name - The name of the theme to update
|
246
|
-
* @param updater - Function that receives the current theme and expect modified theme to be returned
|
247
|
-
*/
|
248
|
-
updateTheme = (name, updater) => {
|
249
|
-
this.unistylesRegistry.updateTheme(name, updater(this.unistylesRegistry.getTheme(name)));
|
250
|
-
};
|
251
|
-
|
252
|
-
/**
|
253
|
-
* Enable or disable adaptive themes
|
254
|
-
* @param enable - boolean indicating if adaptive themes should be enabled
|
255
|
-
*/
|
256
|
-
setAdaptiveThemes = enable => {
|
257
|
-
this.unistylesBridge.useAdaptiveThemes(enable);
|
258
|
-
};
|
259
|
-
|
260
|
-
/**
|
261
|
-
* Enable a plugin
|
262
|
-
* @deprecated - Plugins will be removed in the next major release
|
263
|
-
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
264
|
-
*/
|
265
|
-
addPlugin = plugin => {
|
266
|
-
this.unistylesRegistry.addPlugin(plugin);
|
267
|
-
};
|
268
|
-
|
269
|
-
/**
|
270
|
-
* Disable a plugin
|
271
|
-
* @deprecated - Plugins will be removed in the next major release
|
272
|
-
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
273
|
-
*/
|
274
|
-
removePlugin = plugin => {
|
275
|
-
this.unistylesRegistry.removePlugin(plugin);
|
276
|
-
};
|
277
|
-
}
|
278
|
-
//# sourceMappingURL=UnistylesRuntime.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesError","parseColor","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","hairlineWidth","rtl","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","setHidden","hidden","Landscape","Portrait","parseFloat","toFixed","nearestPixel","Math","trunc","getTheme","setImmersiveMode","isEnabled","setRootViewBackgroundColor","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","updateTheme","updater","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":"AAAA,SAASA,iB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AEM,OAAkG,KAAK;IACtJ,IAAI,CAAC/C,iBAAiB,CAAC8C,WAAW,CAACL,IAAI,EAAEM,OAAO,CAAC,IAAI,CAAC/C,iBAAiB,CAACoC,QAAQ,CAACK,IAAI,CAAC,CAAC,CAAC;EAC5F,CAAC;;EAED;AACJ;AACA;AACA;EACWO,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAClD,eAAe,CAACmD,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;;EAED;AACJ;AACA;AACA;AACA;EACWE,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAACpD,iBAAiB,CAACmD,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAACpD,iBAAiB,CAACqD,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL","ignoreList":[]}
|
package/lib/module/core/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["unistyles"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAKvC,SACIA,SAAS","ignoreList":[]}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
|
3
|
-
export class UnistylesMockedBridge {
|
4
|
-
constructor() {}
|
5
|
-
screenWidth() {}
|
6
|
-
screenHeight() {}
|
7
|
-
enabledPlugins() {}
|
8
|
-
hasAdaptiveThemes() {}
|
9
|
-
themeName() {}
|
10
|
-
breakpoint() {}
|
11
|
-
colorScheme() {}
|
12
|
-
contentSizeCategory() {}
|
13
|
-
sortedBreakpointPairs() {}
|
14
|
-
insets() {}
|
15
|
-
pixelRatio() {}
|
16
|
-
fontScale() {}
|
17
|
-
statusBar() {}
|
18
|
-
navigationBar() {}
|
19
|
-
themes(themes) {}
|
20
|
-
useBreakpoints(breakpoints) {}
|
21
|
-
useTheme(name) {}
|
22
|
-
updateTheme(name) {}
|
23
|
-
useAdaptiveThemes(enable) {}
|
24
|
-
addPlugin(pluginName, notify) {}
|
25
|
-
removePlugin(pluginName) {}
|
26
|
-
setRootViewBackgroundColor(color, alpha) {}
|
27
|
-
setImmersiveMode(isEnabled) {}
|
28
|
-
}
|
29
|
-
//# sourceMappingURL=UnistylesMockedBridge.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["UnistylesMockedBridge","constructor","screenWidth","screenHeight","enabledPlugins","hasAdaptiveThemes","themeName","breakpoint","colorScheme","contentSizeCategory","sortedBreakpointPairs","insets","pixelRatio","fontScale","statusBar","navigationBar","themes","useBreakpoints","breakpoints","useTheme","name","updateTheme","useAdaptiveThemes","enable","addPlugin","pluginName","notify","removePlugin","setRootViewBackgroundColor","color","alpha","setImmersiveMode","isEnabled"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedBridge.ts"],"mappings":"AAAA;;AAGA,OAAO,MAAMA,qBAAqB,CAAC;EAC/BC,WAAWA,CAAA,EAAG,CAAC;EAERC,WAAWA,CAAA,EAAG,CAAC;EACfC,YAAYA,CAAA,EAAG,CAAC;EAChBC,cAAcA,CAAA,EAAG,CAAC;EAClBC,iBAAiBA,CAAA,EAAG,CAAC;EACrBC,SAASA,CAAA,EAAG,CAAC;EACbC,UAAUA,CAAA,EAAG,CAAC;EACdC,WAAWA,CAAA,EAAG,CAAC;EACfC,mBAAmBA,CAAA,EAAG,CAAC;EACvBC,qBAAqBA,CAAA,EAAG,CAAC;EACzBC,MAAMA,CAAA,EAAG,CAAC;EACVC,UAAUA,CAAA,EAAG,CAAC;EACdC,SAASA,CAAA,EAAG,CAAC;EACbC,SAASA,CAAA,EAAG,CAAC;EACbC,aAAaA,CAAA,EAAG,CAAC;EACjBC,MAAMA,CAACA,MAAoC,EAAE,CAAC;EAC9CC,cAAcA,CAACC,WAAiC,EAAE,CAAC;EACnDC,QAAQA,CAACC,IAA2B,EAAE,CAAC;EACvCC,WAAWA,CAACD,IAA2B,EAAE,CAAC;EAC1CE,iBAAiBA,CAACC,MAAe,EAAE,CAAC;EACpCC,SAASA,CAACC,UAAkB,EAAEC,MAAe,EAAE,CAAC;EAChDC,YAAYA,CAACF,UAAkB,EAAE,CAAC;EAClCG,0BAA0BA,CAACC,KAAc,EAAEC,KAAc,EAAE,CAAC;EAC5DC,gBAAgBA,CAACC,SAAkB,EAAE,CAAC;AACjD","ignoreList":[]}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
|
3
|
-
export class UnistylesMockedRegistry {
|
4
|
-
config = {};
|
5
|
-
breakpoints = {};
|
6
|
-
sortedBreakpointPairs = [];
|
7
|
-
plugins = [];
|
8
|
-
themes = {};
|
9
|
-
themeNames = [];
|
10
|
-
constructor(unistylesBridge) {
|
11
|
-
this.unistylesBridge = unistylesBridge;
|
12
|
-
}
|
13
|
-
addThemes = themes => {
|
14
|
-
this.themes = themes;
|
15
|
-
this.themeNames = Object.keys(themes);
|
16
|
-
return this;
|
17
|
-
};
|
18
|
-
addBreakpoints = breakpoints => {
|
19
|
-
this.breakpoints = breakpoints;
|
20
|
-
this.sortedBreakpointPairs = Object.entries(breakpoints).sort((breakpoint1, breakpoint2) => {
|
21
|
-
const [, value1] = breakpoint1;
|
22
|
-
const [, value2] = breakpoint2;
|
23
|
-
return value1 - value2;
|
24
|
-
});
|
25
|
-
return this;
|
26
|
-
};
|
27
|
-
addConfig = config => {};
|
28
|
-
getTheme = forName => {
|
29
|
-
if (this.themeNames.length === 0) {
|
30
|
-
return {};
|
31
|
-
}
|
32
|
-
return this.themes[forName];
|
33
|
-
};
|
34
|
-
addPlugin = (plugin, notify = true) => {};
|
35
|
-
removePlugin = plugin => {};
|
36
|
-
updateTheme = (name, theme) => {};
|
37
|
-
hasTheme = name => true;
|
38
|
-
}
|
39
|
-
//# sourceMappingURL=UnistylesMockedRegistry.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["UnistylesMockedRegistry","config","breakpoints","sortedBreakpointPairs","plugins","themes","themeNames","constructor","unistylesBridge","addThemes","Object","keys","addBreakpoints","entries","sort","breakpoint1","breakpoint2","value1","value2","addConfig","getTheme","forName","length","addPlugin","plugin","notify","removePlugin","updateTheme","name","theme","hasTheme"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRegistry.ts"],"mappings":"AAAA;;AAIA,OAAO,MAAMA,uBAAuB,CAAC;EAC1BC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EACjHC,OAAO,GAA2B,EAAE;EACpCC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,UAAU,GAAiC,EAAE;EAEpDC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIJ,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,UAAU,GAAGI,MAAM,CAACC,IAAI,CAACN,MAAM,CAAiC;IAErE,OAAO,IAAI;EACf,CAAC;EACMO,cAAc,GAAIV,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,qBAAqB,GAAGO,MAAM,CAC9BG,OAAO,CAACX,WAAW,CAAC,CACpBY,IAAI,CAAC,CAACC,WAAW,EAAEC,WAAW,KAAK;MAChC,MAAM,GAAGC,MAAM,CAAC,GAAGF,WAAW;MAC9B,MAAM,GAAGG,MAAM,CAAC,GAAGF,WAAW;MAE9B,OAAOC,MAAM,GAAGC,MAAM;IAC1B,CAAC,CAA0F;IAE/F,OAAO,IAAI;EACf,CAAC;EACMC,SAAS,GAAIlB,MAAuB,IAAK,CAAC,CAAC;EAC3CmB,QAAQ,GAAIC,OAA8B,IAAK;IAClD,IAAI,IAAI,CAACf,UAAU,CAACgB,MAAM,KAAK,CAAC,EAAE;MAC9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