react-native-unistyles 3.0.0-alpha.4 → 3.0.0-alpha.40
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -0
- package/Unistyles.podspec +1 -1
- package/android/CMakeLists.txt +19 -45
- package/android/build.gradle +6 -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 +285 -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 +3 -0
- package/cxx/common/Helpers.h +140 -5
- package/cxx/core/HostStyle.cpp +10 -6
- package/cxx/core/HostStyle.h +4 -0
- package/cxx/core/StyleSheet.h +0 -2
- package/cxx/core/StyleSheetRegistry.cpp +9 -17
- package/cxx/core/StyleSheetRegistry.h +3 -4
- package/cxx/core/Unistyle.h +8 -11
- package/cxx/core/UnistyleData.h +23 -0
- package/cxx/core/UnistyleWrapper.h +108 -13
- package/cxx/core/UnistylesCommitHook.cpp +14 -15
- 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 +119 -83
- package/cxx/core/UnistylesRegistry.h +16 -14
- 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 +16 -11
- package/cxx/hybridObjects/HybridStatusBar.cpp +0 -4
- package/cxx/hybridObjects/HybridStatusBar.h +3 -4
- package/cxx/hybridObjects/HybridStyleSheet.cpp +154 -23
- package/cxx/hybridObjects/HybridStyleSheet.h +27 -5
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +96 -14
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +19 -3
- package/cxx/parser/Parser.cpp +226 -175
- package/cxx/parser/Parser.h +11 -15
- package/cxx/shadowTree/ShadowLeafUpdate.h +2 -1
- package/cxx/shadowTree/ShadowTrafficController.h +71 -0
- package/cxx/shadowTree/ShadowTreeManager.cpp +23 -18
- package/cxx/shadowTree/ShadowTreeManager.h +3 -2
- package/ios/Equatable.swift +2 -1
- package/ios/NativePlatform+ios.swift +21 -7
- package/ios/NativePlatform+keyboard.swift +83 -0
- package/ios/NativePlatformListener+ios.swift +37 -24
- package/ios/Unistyles.h +1 -0
- package/ios/UnistylesModuleOnLoad.h +8 -2
- package/ios/UnistylesModuleOnLoad.mm +9 -1
- 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/index.js +20 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/components/useMedia.js +59 -0
- package/lib/commonjs/components/useMedia.js.map +1 -0
- package/lib/commonjs/components/useMedia.web.js +43 -0
- package/lib/commonjs/components/useMedia.web.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.js +79 -0
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.native.js +82 -0
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -0
- package/lib/commonjs/core/index.js +13 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/index.js +21 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +25 -12
- 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 +10 -6
- 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/UnistylesRuntime/index.js +1 -3
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.js +7 -0
- package/lib/commonjs/specs/index.js.map +1 -1
- package/lib/commonjs/specs/index.web.js +1 -1
- 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 +79 -0
- package/lib/commonjs/web/convert/index.js.map +1 -0
- package/lib/commonjs/web/convert/module.d.js +2 -0
- package/lib/commonjs/web/convert/module.d.js.map +1 -0
- 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/shadow/boxShadow.js +62 -0
- 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/shadow/textShadow.js +59 -0
- package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +93 -0
- package/lib/commonjs/web/convert/style.js.map +1 -0
- package/lib/commonjs/web/convert/types.js +9 -0
- package/lib/commonjs/web/convert/types.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +59 -0
- package/lib/commonjs/web/convert/utils.js.map +1 -0
- package/lib/commonjs/web/create.js +49 -0
- package/lib/commonjs/web/create.js.map +1 -0
- package/lib/commonjs/web/index.js +60 -0
- package/lib/commonjs/web/index.js.map +1 -0
- package/lib/commonjs/web/listener.js +61 -0
- package/lib/commonjs/web/listener.js.map +1 -0
- package/lib/commonjs/web/mock.js +27 -0
- package/lib/commonjs/web/mock.js.map +1 -0
- package/lib/commonjs/web/registry.js +172 -0
- package/lib/commonjs/web/registry.js.map +1 -0
- package/lib/commonjs/web/runtime.js +173 -0
- package/lib/commonjs/web/runtime.js.map +1 -0
- package/lib/commonjs/web/shadowRegistry.js +142 -0
- package/lib/commonjs/web/shadowRegistry.js.map +1 -0
- package/lib/commonjs/web/state.js +73 -0
- package/lib/commonjs/web/state.js.map +1 -0
- 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 +85 -0
- package/lib/commonjs/web/utils/unistyle.js.map +1 -0
- package/lib/commonjs/web/variants/getVariants.js +39 -0
- package/lib/commonjs/web/variants/getVariants.js.map +1 -0
- package/lib/commonjs/web/variants/index.js +28 -0
- package/lib/commonjs/web/variants/index.js.map +1 -0
- package/lib/commonjs/web/variants/useVariants.js +59 -0
- package/lib/commonjs/web/variants/useVariants.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/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/components/useMedia.js +54 -0
- package/lib/module/components/useMedia.js.map +1 -0
- package/lib/module/components/useMedia.web.js +38 -0
- package/lib/module/components/useMedia.web.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.js +72 -0
- package/lib/module/core/createUnistylesComponent.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.native.js +75 -0
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -0
- package/lib/module/core/index.js +4 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/index.js +2 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +21 -11
- 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 +10 -6
- 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/UnistylesRuntime/index.js +1 -3
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.js +2 -1
- package/lib/module/specs/index.js.map +1 -1
- package/lib/module/specs/index.web.js +1 -1
- package/lib/module/specs/index.web.js.map +1 -1
- 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 +74 -0
- package/lib/module/web/convert/index.js.map +1 -0
- package/lib/module/web/convert/module.d.js +2 -0
- package/lib/module/web/convert/module.d.js.map +1 -0
- 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 +88 -0
- package/lib/module/web/convert/style.js.map +1 -0
- package/lib/module/web/convert/types.js +5 -0
- package/lib/module/web/convert/types.js.map +1 -0
- package/lib/module/web/convert/utils.js +45 -0
- package/lib/module/web/convert/utils.js.map +1 -0
- package/lib/module/web/create.js +44 -0
- package/lib/module/web/create.js.map +1 -0
- package/lib/module/web/index.js +26 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/listener.js +57 -0
- package/lib/module/web/listener.js.map +1 -0
- package/lib/module/web/mock.js +23 -0
- package/lib/module/web/mock.js.map +1 -0
- package/lib/module/web/registry.js +168 -0
- package/lib/module/web/registry.js.map +1 -0
- package/lib/module/web/runtime.js +169 -0
- package/lib/module/web/runtime.js.map +1 -0
- package/lib/module/web/shadowRegistry.js +138 -0
- package/lib/module/web/shadowRegistry.js.map +1 -0
- package/lib/module/web/state.js +69 -0
- package/lib/module/web/state.js.map +1 -0
- 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 +72 -0
- package/lib/module/web/utils/unistyle.js.map +1 -0
- package/lib/module/web/variants/getVariants.js +34 -0
- package/lib/module/web/variants/getVariants.js.map +1 -0
- package/lib/module/web/variants/index.js +5 -0
- package/lib/module/web/variants/index.js.map +1 -0
- package/lib/module/web/variants/useVariants.js +54 -0
- package/lib/module/web/variants/useVariants.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/index.d.ts +3 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/useMedia.d.ts +6 -0
- package/lib/typescript/src/components/useMedia.d.ts.map +1 -0
- package/lib/typescript/src/components/useMedia.web.d.ts +6 -0
- package/lib/typescript/src/components/useMedia.web.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +8 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +8 -0
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.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 +7 -5
- 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 +4 -4
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +3 -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 +3 -1
- 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 +3 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.d.ts +4 -2
- package/lib/typescript/src/specs/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.web.d.ts +1 -1
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
- 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 +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +1 -1
- 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 +3 -0
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -0
- 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 +2 -0
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/types.d.ts +8 -2
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/utils.d.ts +12 -0
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/create.d.ts +1443 -0
- package/lib/typescript/{web → src/web}/create.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +1459 -0
- package/lib/typescript/{web → src/web}/index.d.ts.map +1 -1
- package/lib/typescript/{web/listener → src/web}/listener.d.ts +5 -2
- package/lib/typescript/src/web/listener.d.ts.map +1 -0
- package/lib/typescript/src/web/mock.d.ts +5 -0
- package/lib/typescript/src/web/mock.d.ts.map +1 -0
- package/lib/typescript/src/web/registry.d.ts +24 -0
- package/lib/typescript/src/web/registry.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/runtime.d.ts +11 -10
- package/lib/typescript/src/web/runtime.d.ts.map +1 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts +17 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -0
- package/lib/typescript/src/web/state.d.ts +18 -0
- package/lib/typescript/src/web/state.d.ts.map +1 -0
- 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 +20 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/index.d.ts +3 -0
- package/lib/typescript/src/web/variants/index.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- 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 +1 -1
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +4 -1
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +9 -7
- 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/UnistyleDependency.kt +2 -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 +0 -29
- 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 +20 -30
- package/plugin/common.js +31 -3
- package/plugin/index.js +107 -18
- package/plugin/ref.js +129 -13
- package/plugin/style.js +189 -22
- package/plugin/stylesheet.js +53 -3
- package/plugin/variants.js +33 -0
- package/src/components/Display.tsx +12 -0
- package/src/components/Hide.tsx +12 -0
- package/src/components/index.ts +2 -0
- package/src/components/useMedia.ts +64 -0
- package/src/components/useMedia.web.ts +47 -0
- package/src/core/createUnistylesComponent.native.tsx +83 -0
- package/src/core/createUnistylesComponent.tsx +84 -0
- package/src/core/index.ts +1 -0
- package/src/index.ts +3 -12
- package/src/mq.ts +27 -9
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +7 -5
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +0 -1
- package/src/specs/NavigtionBar/index.ts +1 -25
- package/src/specs/ShadowRegistry/index.ts +16 -10
- package/src/specs/ShadowRegistry/types.ts +4 -1
- 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 +6 -1
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
- package/src/specs/UnistylesRuntime/index.ts +5 -4
- package/src/specs/index.ts +6 -2
- package/src/specs/index.web.ts +1 -1
- package/src/types/breakpoints.ts +25 -13
- package/src/types/common.ts +1 -0
- package/src/types/index.ts +1 -1
- package/src/types/stylesheet.ts +7 -5
- package/src/types/variants.ts +7 -1
- package/src/utils.ts +22 -0
- package/{web → src/web}/convert/index.ts +25 -25
- 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/{web → src/web}/convert/style.ts +61 -10
- package/{web → src/web}/convert/types.ts +9 -2
- package/{web → src/web}/convert/utils.ts +11 -5
- package/src/web/create.ts +48 -0
- package/{web → src/web}/index.ts +4 -3
- package/src/web/listener.ts +63 -0
- package/{web → src/web}/mock.ts +3 -14
- package/src/web/registry.ts +215 -0
- package/{web → src/web}/runtime.ts +32 -21
- package/src/web/shadowRegistry.ts +145 -0
- package/src/web/state.ts +94 -0
- package/src/web/utils/common.ts +45 -0
- package/src/web/utils/index.ts +2 -0
- package/src/web/utils/unistyle.ts +108 -0
- package/src/web/variants/getVariants.ts +42 -0
- package/src/web/variants/index.ts +2 -0
- package/src/web/variants/useVariants.ts +65 -0
- 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/typescript/example/App.d.ts +0 -4
- package/lib/typescript/example/App.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/web/convert/boxShadow.d.ts +0 -3
- package/lib/typescript/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/breakpoint.d.ts +0 -3
- package/lib/typescript/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/web/convert/index.d.ts +0 -4
- package/lib/typescript/web/convert/index.d.ts.map +0 -1
- package/lib/typescript/web/convert/shadow.d.ts +0 -2
- package/lib/typescript/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/style.d.ts +0 -3
- package/lib/typescript/web/convert/style.d.ts.map +0 -1
- package/lib/typescript/web/convert/textShadow.d.ts +0 -3
- package/lib/typescript/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/transform.d.ts +0 -5
- package/lib/typescript/web/convert/transform.d.ts.map +0 -1
- package/lib/typescript/web/convert/types.d.ts.map +0 -1
- package/lib/typescript/web/convert/utils.d.ts +0 -8
- package/lib/typescript/web/convert/utils.d.ts.map +0 -1
- package/lib/typescript/web/create.d.ts +0 -2449
- package/lib/typescript/web/index.d.ts +0 -2464
- package/lib/typescript/web/listener/index.d.ts +0 -2
- package/lib/typescript/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/web/mock.d.ts +0 -14
- package/lib/typescript/web/mock.d.ts.map +0 -1
- package/lib/typescript/web/mq.d.ts +0 -4
- package/lib/typescript/web/mq.d.ts.map +0 -1
- package/lib/typescript/web/pseudo.d.ts +0 -4
- package/lib/typescript/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/web/registry.d.ts +0 -12
- package/lib/typescript/web/registry.d.ts.map +0 -1
- package/lib/typescript/web/runtime.d.ts.map +0 -1
- package/lib/typescript/web/state.d.ts +0 -24
- package/lib/typescript/web/state.d.ts.map +0 -1
- package/lib/typescript/web/useVariants.d.ts +0 -3
- package/lib/typescript/web/useVariants.d.ts.map +0 -1
- package/lib/typescript/web/utils.d.ts +0 -18
- package/lib/typescript/web/utils.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 -360
- package/plugin/__tests__/ref.spec.js +0 -991
- package/plugin/__tests__/stylesheet.spec.js +0 -396
- package/web/convert/boxShadow.ts +0 -72
- package/web/convert/breakpoint.ts +0 -21
- package/web/convert/shadow.ts +0 -68
- package/web/convert/textShadow.ts +0 -69
- package/web/convert/transform.ts +0 -89
- package/web/create.ts +0 -102
- package/web/listener/index.ts +0 -1
- package/web/listener/listener.ts +0 -33
- package/web/mq.ts +0 -19
- package/web/pseudo.ts +0 -11
- package/web/registry.ts +0 -41
- package/web/state.ts +0 -148
- package/web/useVariants.ts +0 -99
- package/web/utils.ts +0 -95
- /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
- /package/{web → src/web}/convert/module.d.ts +0 -0
@@ -9,24 +9,25 @@ double HybridStyleSheet::getHairlineWidth() {
|
|
9
9
|
return nearestPixel / pixelRatio;
|
10
10
|
}
|
11
11
|
|
12
|
-
double HybridStyleSheet::
|
12
|
+
double HybridStyleSheet::getUnid() {
|
13
13
|
return this->__unid;
|
14
14
|
}
|
15
15
|
|
16
|
-
jsi::Value HybridStyleSheet::create(jsi::Runtime
|
17
|
-
|
16
|
+
jsi::Value HybridStyleSheet::create(jsi::Runtime& rt, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) {
|
17
|
+
if (count == 1) {
|
18
|
+
helpers::assertThat(rt, false, "Unistyles is not initialized correctly. Please add babel plugin to your babel config.");
|
19
|
+
}
|
20
|
+
|
21
|
+
// second argument is hidden, so validation is perfectly fine
|
22
|
+
helpers::assertThat(rt, count == 2, "StyleSheet.create expected to be called with one argument.");
|
18
23
|
helpers::assertThat(rt, arguments[0].isObject(), "StyleSheet.create expected to be called with object or function.");
|
19
24
|
|
20
25
|
auto thisStyleSheet = thisVal.asObject(rt);
|
21
26
|
auto& registry = core::UnistylesRegistry::get();
|
22
|
-
|
23
|
-
// this might happen only when hot reloading
|
24
|
-
if (this->__unid != -1) {
|
25
|
-
registry.removeStyleSheet(this->__unid);
|
26
|
-
}
|
27
|
+
int unid = arguments[1].asNumber();
|
27
28
|
|
28
29
|
jsi::Object rawStyleSheet = arguments[0].asObject(rt);
|
29
|
-
auto registeredStyleSheet = registry.addStyleSheetFromValue(rt, std::move(rawStyleSheet));
|
30
|
+
auto registeredStyleSheet = registry.addStyleSheetFromValue(rt, std::move(rawStyleSheet), unid);
|
30
31
|
|
31
32
|
this->__unid = registeredStyleSheet->tag;
|
32
33
|
|
@@ -45,11 +46,7 @@ jsi::Value HybridStyleSheet::configure(jsi::Runtime &rt, const jsi::Value &thisV
|
|
45
46
|
helpers::assertThat(rt, count == 1, "StyleSheet.configure expected to be called with one argument.");
|
46
47
|
helpers::assertThat(rt, arguments[0].isObject(), "StyleSheet.configure expected to be called with object.");
|
47
48
|
|
48
|
-
// create new state
|
49
49
|
auto config = arguments[0].asObject(rt);
|
50
|
-
auto& registry = core::UnistylesRegistry::get();
|
51
|
-
|
52
|
-
registry.createState(rt);
|
53
50
|
|
54
51
|
helpers::enumerateJSIObject(rt, config, [&](const std::string& propertyName, jsi::Value& propertyValue){
|
55
52
|
if (propertyName == "settings") {
|
@@ -74,7 +71,22 @@ jsi::Value HybridStyleSheet::configure(jsi::Runtime &rt, const jsi::Value &thisV
|
|
74
71
|
});
|
75
72
|
|
76
73
|
verifyAndSelectTheme(rt);
|
74
|
+
|
75
|
+
auto& state = core::UnistylesRegistry::get().getState(rt);
|
76
|
+
|
77
|
+
state.hasUserConfig = true;
|
78
|
+
|
79
|
+
return jsi::Value::undefined();
|
80
|
+
}
|
81
|
+
|
82
|
+
jsi::Value HybridStyleSheet::init(jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) {
|
83
|
+
// create new state
|
84
|
+
auto& registry = core::UnistylesRegistry::get();
|
85
|
+
|
86
|
+
registry.createState(rt);
|
87
|
+
|
77
88
|
loadExternalMethods(thisVal, rt);
|
89
|
+
registerHooks(rt);
|
78
90
|
|
79
91
|
return jsi::Value::undefined();
|
80
92
|
}
|
@@ -116,7 +128,7 @@ void HybridStyleSheet::parseSettings(jsi::Runtime &rt, jsi::Object settings) {
|
|
116
128
|
void HybridStyleSheet::parseBreakpoints(jsi::Runtime &rt, jsi::Object breakpoints){
|
117
129
|
helpers::Breakpoints sortedBreakpoints = helpers::jsiBreakpointsToVecPairs(rt, std::move(breakpoints));
|
118
130
|
|
119
|
-
helpers::assertThat(rt, sortedBreakpoints.
|
131
|
+
helpers::assertThat(rt, !sortedBreakpoints.empty(), "StyleSheet.configure's breakpoints can't be empty.");
|
120
132
|
helpers::assertThat(rt, sortedBreakpoints.front().second == 0, "StyleSheet.configure's first breakpoint must start from 0.");
|
121
133
|
|
122
134
|
auto& registry = core::UnistylesRegistry::get();
|
@@ -132,11 +144,10 @@ void HybridStyleSheet::parseThemes(jsi::Runtime &rt, jsi::Object themes) {
|
|
132
144
|
helpers::enumerateJSIObject(rt, themes, [&](const std::string& propertyName, jsi::Value& propertyValue){
|
133
145
|
helpers::assertThat(rt, propertyValue.isObject(), "StyleSheet.configure's registered theme '" + propertyName + "' must be an object.");
|
134
146
|
|
135
|
-
registry.registerTheme(rt, propertyName, propertyValue
|
147
|
+
registry.registerTheme(rt, propertyName, propertyValue);
|
136
148
|
});
|
137
149
|
}
|
138
150
|
|
139
|
-
|
140
151
|
void HybridStyleSheet::verifyAndSelectTheme(jsi::Runtime &rt) {
|
141
152
|
auto& state = core::UnistylesRegistry::get().getState(rt);
|
142
153
|
|
@@ -186,7 +197,7 @@ void HybridStyleSheet::verifyAndSelectTheme(jsi::Runtime &rt) {
|
|
186
197
|
|
187
198
|
void HybridStyleSheet::setThemeFromColorScheme(jsi::Runtime& rt) {
|
188
199
|
auto& state = core::UnistylesRegistry::get().getState(rt);
|
189
|
-
|
200
|
+
auto colorScheme = static_cast<ColorScheme>(this->_unistylesRuntime->getColorScheme());
|
190
201
|
|
191
202
|
switch (colorScheme) {
|
192
203
|
case ColorScheme::LIGHT:
|
@@ -218,19 +229,139 @@ void HybridStyleSheet::loadExternalMethods(const jsi::Value& thisValue, jsi::Run
|
|
218
229
|
state.registerProcessColorFunction(std::move(processColorFn));
|
219
230
|
}
|
220
231
|
|
232
|
+
void HybridStyleSheet::registerHooks(jsi::Runtime& rt) {
|
233
|
+
// cleanup Shadow updates
|
234
|
+
core::UnistylesRegistry::get().trafficController.restore();
|
235
|
+
|
236
|
+
this->_unistylesCommitHook = std::make_shared<core::UnistylesCommitHook>(this->_uiManager);
|
237
|
+
this->_unistylesMountHook = std::make_shared<core::UnistylesMountHook>(this->_uiManager, this->_unistylesRuntime);
|
238
|
+
}
|
239
|
+
|
221
240
|
void HybridStyleSheet::onPlatformDependenciesChange(std::vector<UnistyleDependency> dependencies) {
|
241
|
+
// this event listener is triggered from C++ module, and it's only about theme / adaptive theme changes
|
242
|
+
if (dependencies.size() == 0) {
|
243
|
+
return;
|
244
|
+
}
|
245
|
+
|
222
246
|
auto& registry = core::UnistylesRegistry::get();
|
223
|
-
auto parser = parser::Parser(this->_unistylesRuntime);
|
224
|
-
auto dependencyMap = registry.buildDependencyMap(dependencies);
|
225
247
|
auto& rt = this->_unistylesRuntime->getRuntime();
|
248
|
+
auto parser = parser::Parser(this->_unistylesRuntime);
|
249
|
+
auto dependencyMap = registry.buildDependencyMap(rt, dependencies);
|
250
|
+
|
251
|
+
if (dependencyMap.empty()) {
|
252
|
+
this->notifyJSListeners(dependencies);
|
253
|
+
|
254
|
+
return;
|
255
|
+
}
|
256
|
+
|
257
|
+
// in a later step, we will rebuild only Unistyles with mounted StyleSheets
|
258
|
+
// however, user may have StyleSheets with components that haven't mounted yet
|
259
|
+
// we need to rebuild all dependent StyleSheets as well
|
260
|
+
auto dependentStyleSheets = registry.getStyleSheetsToRefresh(rt, dependencies);
|
261
|
+
|
262
|
+
parser.rebuildUnistylesInDependencyMap(rt, dependencyMap, dependentStyleSheets, std::nullopt);
|
263
|
+
parser.rebuildShadowLeafUpdates(rt, dependencyMap);
|
264
|
+
|
265
|
+
this->notifyJSListeners(dependencies);
|
266
|
+
shadow::ShadowTreeManager::updateShadowTree(UIManagerBinding::getBinding(rt)->getUIManager().getShadowTreeRegistry());
|
267
|
+
}
|
268
|
+
|
269
|
+
void HybridStyleSheet::onPlatformNativeDependenciesChange(std::vector<UnistyleDependency> dependencies, UnistylesNativeMiniRuntime miniRuntime) {
|
270
|
+
// this event listener is triggered from Native platform
|
271
|
+
if (dependencies.size() == 0 || this->_unistylesRuntime == nullptr) {
|
272
|
+
return;
|
273
|
+
}
|
274
|
+
|
275
|
+
this->_unistylesRuntime->runOnJSThread([this, dependencies, miniRuntime](jsi::Runtime& rt){
|
276
|
+
auto& registry = core::UnistylesRegistry::get();
|
277
|
+
auto parser = parser::Parser(this->_unistylesRuntime);
|
278
|
+
auto unistyleDependencies = std::move(dependencies);
|
279
|
+
|
280
|
+
// re-compute new breakpoint
|
281
|
+
auto dimensionsIt = std::find(dependencies.begin(), dependencies.end(), UnistyleDependency::DIMENSIONS);
|
282
|
+
|
283
|
+
if (dimensionsIt != dependencies.end()) {
|
284
|
+
registry.getState(rt).computeCurrentBreakpoint(this->_unistylesRuntime->getScreen().width);
|
285
|
+
}
|
286
|
+
|
287
|
+
// check if color scheme changed and then if Unistyles state depend on it (adaptive themes)
|
288
|
+
auto colorSchemeIt = std::find(dependencies.begin(), dependencies.end(), UnistyleDependency::COLORSCHEME);
|
289
|
+
auto hasNewColorScheme = colorSchemeIt != dependencies.end();
|
290
|
+
|
291
|
+
if (hasNewColorScheme) {
|
292
|
+
this->_unistylesRuntime->includeDependenciesForColorSchemeChange(unistyleDependencies);
|
293
|
+
}
|
294
|
+
|
295
|
+
auto dependencyMap = registry.buildDependencyMap(rt, unistyleDependencies);
|
296
|
+
|
297
|
+
if (dependencyMap.empty()) {
|
298
|
+
this->notifyJSListeners(unistyleDependencies);
|
299
|
+
|
300
|
+
return;
|
301
|
+
}
|
302
|
+
|
303
|
+
// in a later step, we will rebuild only Unistyles with mounted StyleSheets
|
304
|
+
// however, user may have StyleSheets with components that haven't mounted yet
|
305
|
+
// we need to rebuild all dependent StyleSheets as well
|
306
|
+
auto dependentStyleSheets = registry.getStyleSheetsToRefresh(rt, unistyleDependencies);
|
307
|
+
|
308
|
+
parser.rebuildUnistylesInDependencyMap(rt, dependencyMap, dependentStyleSheets, miniRuntime);
|
309
|
+
parser.rebuildShadowLeafUpdates(rt, dependencyMap);
|
226
310
|
|
227
|
-
|
311
|
+
this->notifyJSListeners(unistyleDependencies);
|
312
|
+
shadow::ShadowTreeManager::updateShadowTree(UIManagerBinding::getBinding(rt)->getUIManager().getShadowTreeRegistry());
|
313
|
+
});
|
314
|
+
}
|
315
|
+
|
316
|
+
void HybridStyleSheet::onImeChange(UnistylesNativeMiniRuntime miniRuntime) {
|
317
|
+
if (this->_unistylesRuntime == nullptr) {
|
228
318
|
return;
|
229
319
|
}
|
230
320
|
|
231
|
-
|
321
|
+
this->_unistylesRuntime->runOnJSThread([this, miniRuntime](jsi::Runtime& rt){
|
322
|
+
std::vector<UnistyleDependency> dependencies{UnistyleDependency::IME};
|
323
|
+
auto& registry = core::UnistylesRegistry::get();
|
324
|
+
auto parser = parser::Parser(this->_unistylesRuntime);
|
325
|
+
auto dependencyMap = registry.buildDependencyMap(rt, dependencies);
|
326
|
+
|
327
|
+
if (dependencyMap.empty()) {
|
328
|
+
this->notifyJSListeners(dependencies);
|
329
|
+
|
330
|
+
return;
|
331
|
+
}
|
332
|
+
|
333
|
+
// we don't care about other unmounted stylesheets as their not visible
|
334
|
+
// so user won't see any changes
|
335
|
+
std::vector<std::shared_ptr<core::StyleSheet>> dependentStyleSheets;
|
336
|
+
|
337
|
+
parser.rebuildUnistylesInDependencyMap(rt, dependencyMap, dependentStyleSheets, miniRuntime);
|
338
|
+
parser.rebuildShadowLeafUpdates(rt, dependencyMap);
|
339
|
+
|
340
|
+
this->notifyJSListeners(dependencies);
|
341
|
+
shadow::ShadowTreeManager::updateShadowTree(UIManagerBinding::getBinding(rt)->getUIManager().getShadowTreeRegistry());
|
342
|
+
});
|
343
|
+
}
|
344
|
+
|
345
|
+
void HybridStyleSheet::notifyJSListeners(std::vector<UnistyleDependency>& dependencies) {
|
346
|
+
if (!dependencies.empty()) {
|
347
|
+
std::for_each(this->_changeListeners.begin(), this->_changeListeners.end(), [&](auto& listener){
|
348
|
+
(*listener)(dependencies);
|
349
|
+
});
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
std::function<void ()> HybridStyleSheet::addChangeListener(const std::function<void (const std::vector<UnistyleDependency>&)>& onChanged) {
|
354
|
+
auto listener = std::make_unique<std::function<void(std::vector<UnistyleDependency>&)>>(onChanged);
|
232
355
|
|
233
|
-
|
356
|
+
this->_changeListeners.push_back(std::move(listener));
|
234
357
|
|
235
|
-
|
358
|
+
return [this, listenerPtr = this->_changeListeners.back().get()](){
|
359
|
+
auto it = std::find_if(this->_changeListeners.begin(), this->_changeListeners.end(), [listenerPtr](auto& ptr) {
|
360
|
+
return ptr.get() == listenerPtr;
|
361
|
+
});
|
362
|
+
|
363
|
+
if (it != this->_changeListeners.end()) {
|
364
|
+
this->_changeListeners.erase(it);
|
365
|
+
}
|
366
|
+
};
|
236
367
|
}
|
@@ -9,21 +9,30 @@
|
|
9
9
|
#include "Constants.h"
|
10
10
|
#include "Breakpoints.h"
|
11
11
|
#include "Parser.h"
|
12
|
-
#include "ShadowTreeManager.h"
|
13
12
|
#include "UnistylesCommitHook.h"
|
13
|
+
#include "UnistylesMountHook.h"
|
14
14
|
|
15
15
|
using namespace margelo::nitro::unistyles;
|
16
16
|
using namespace facebook::react;
|
17
17
|
|
18
18
|
struct HybridStyleSheet: public HybridUnistylesStyleSheetSpec {
|
19
19
|
HybridStyleSheet(std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, std::shared_ptr<UIManager> uiManager)
|
20
|
-
: HybridObject(TAG), _unistylesRuntime{unistylesRuntime} {
|
21
|
-
this->_unistylesCommitHook = std::make_shared<core::UnistylesCommitHook>(uiManager, unistylesRuntime);
|
20
|
+
: HybridObject(TAG), _unistylesRuntime{unistylesRuntime}, _uiManager{uiManager} {
|
22
21
|
this->_unistylesRuntime->registerPlatformListener(
|
23
22
|
std::bind(&HybridStyleSheet::onPlatformDependenciesChange, this, std::placeholders::_1)
|
24
23
|
);
|
24
|
+
this->_unistylesRuntime->registerNativePlatformListener(
|
25
|
+
std::bind(&HybridStyleSheet::onPlatformNativeDependenciesChange, this, std::placeholders::_1, std::placeholders::_2)
|
26
|
+
);
|
27
|
+
this->_unistylesRuntime->registerImeListener(
|
28
|
+
std::bind(&HybridStyleSheet::onImeChange, this, std::placeholders::_1)
|
29
|
+
);
|
25
30
|
}
|
26
31
|
|
32
|
+
~HybridStyleSheet() {
|
33
|
+
this->_unistylesRuntime->unregisterNativePlatformListeners();
|
34
|
+
}
|
35
|
+
|
27
36
|
jsi::Value create(jsi::Runtime& rt,
|
28
37
|
const jsi::Value& thisValue,
|
29
38
|
const jsi::Value* args,
|
@@ -32,19 +41,25 @@ struct HybridStyleSheet: public HybridUnistylesStyleSheetSpec {
|
|
32
41
|
const jsi::Value& thisValue,
|
33
42
|
const jsi::Value* args,
|
34
43
|
size_t count);
|
44
|
+
jsi::Value init(jsi::Runtime& rt,
|
45
|
+
const jsi::Value& thisValue,
|
46
|
+
const jsi::Value* args,
|
47
|
+
size_t count);
|
35
48
|
|
36
49
|
void loadHybridMethods() override {
|
37
50
|
HybridUnistylesStyleSheetSpec::loadHybridMethods();
|
38
51
|
|
39
52
|
registerHybrids(this, [](Prototype& prototype) {
|
53
|
+
prototype.registerRawHybridMethod("init", 1, &HybridStyleSheet::init);
|
40
54
|
prototype.registerRawHybridMethod("create", 1, &HybridStyleSheet::create);
|
41
55
|
prototype.registerRawHybridMethod("configure", 1, &HybridStyleSheet::configure);
|
42
56
|
});
|
43
57
|
};
|
44
58
|
|
45
59
|
double getHairlineWidth() override;
|
46
|
-
double
|
47
|
-
|
60
|
+
double getUnid() override;
|
61
|
+
std::function<void ()> addChangeListener(const std::function<void (const std::vector<UnistyleDependency> &)>& onChanged) override;
|
62
|
+
|
48
63
|
private:
|
49
64
|
void parseSettings(jsi::Runtime& rt, jsi::Object settings);
|
50
65
|
void parseBreakpoints(jsi::Runtime& rt, jsi::Object breakpoints);
|
@@ -52,10 +67,17 @@ private:
|
|
52
67
|
void verifyAndSelectTheme(jsi::Runtime &rt);
|
53
68
|
void setThemeFromColorScheme(jsi::Runtime& rt);
|
54
69
|
void loadExternalMethods(const jsi::Value& thisValue, jsi::Runtime& rt);
|
70
|
+
void registerHooks(jsi::Runtime& rt);
|
55
71
|
void onPlatformDependenciesChange(std::vector<UnistyleDependency> dependencies);
|
72
|
+
void onPlatformNativeDependenciesChange(std::vector<UnistyleDependency> dependencies, UnistylesNativeMiniRuntime miniRuntime);
|
73
|
+
void onImeChange(UnistylesNativeMiniRuntime miniRuntime);
|
74
|
+
void notifyJSListeners(std::vector<UnistyleDependency>& dependencies);
|
56
75
|
|
57
76
|
double __unid = -1;
|
77
|
+
std::vector<std::unique_ptr<const std::function<void(std::vector<UnistyleDependency>&)>>> _changeListeners{};
|
58
78
|
std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
|
59
79
|
std::shared_ptr<core::UnistylesCommitHook> _unistylesCommitHook;
|
80
|
+
std::shared_ptr<core::UnistylesMountHook> _unistylesMountHook;
|
81
|
+
std::shared_ptr<UIManager> _uiManager;
|
60
82
|
};
|
61
83
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
using namespace margelo::nitro::unistyles;
|
5
5
|
|
6
6
|
ColorScheme HybridUnistylesRuntime::getColorScheme() {
|
7
|
-
|
7
|
+
auto colorScheme = this->_nativePlatform.getColorScheme();
|
8
8
|
|
9
9
|
return static_cast<ColorScheme>(colorScheme);
|
10
10
|
}
|
@@ -44,7 +44,7 @@ Insets HybridUnistylesRuntime::getInsets() {
|
|
44
44
|
};
|
45
45
|
|
46
46
|
Orientation HybridUnistylesRuntime::getOrientation() {
|
47
|
-
|
47
|
+
auto orientation = this->_nativePlatform.getOrientation();
|
48
48
|
|
49
49
|
return static_cast<Orientation>(orientation);
|
50
50
|
};
|
@@ -57,6 +57,18 @@ double HybridUnistylesRuntime::getFontScale() {
|
|
57
57
|
return this->_nativePlatform.getFontScale();
|
58
58
|
};
|
59
59
|
|
60
|
+
std::unordered_map<std::string, double> HybridUnistylesRuntime::getBreakpoints() {
|
61
|
+
auto& state = core::UnistylesRegistry::get().getState(*_rt);
|
62
|
+
auto sortedBreakpointPairs = state.getSortedBreakpointPairs();
|
63
|
+
std::unordered_map<std::string, double> breakpoints{};
|
64
|
+
|
65
|
+
std::for_each(sortedBreakpointPairs.begin(), sortedBreakpointPairs.end(), [&breakpoints](std::pair<std::string, double>& pair){
|
66
|
+
breakpoints[pair.first] = pair.second;
|
67
|
+
});
|
68
|
+
|
69
|
+
return breakpoints;
|
70
|
+
}
|
71
|
+
|
60
72
|
void HybridUnistylesRuntime::setTheme(const std::string &themeName) {
|
61
73
|
helpers::assertThat(*_rt, !this->getHasAdaptiveThemes(), "Unistyles: You're trying to set theme to: '" + themeName + "', but adaptiveThemes are enabled.");
|
62
74
|
|
@@ -71,7 +83,7 @@ void HybridUnistylesRuntime::setAdaptiveThemes(bool isEnabled) {
|
|
71
83
|
|
72
84
|
std::vector<UnistyleDependency> changedDependencies{};
|
73
85
|
|
74
|
-
changedDependencies.reserve(
|
86
|
+
changedDependencies.reserve(3);
|
75
87
|
|
76
88
|
bool hadAdaptiveThemes = this->getHasAdaptiveThemes();
|
77
89
|
|
@@ -92,6 +104,11 @@ void HybridUnistylesRuntime::setAdaptiveThemes(bool isEnabled) {
|
|
92
104
|
|
93
105
|
// if user enabled adaptive themes, then we need to make sure
|
94
106
|
// we selected theme based on color scheme
|
107
|
+
this->calculateNewThemeAndDependencies(changedDependencies);
|
108
|
+
this->_onDependenciesChange(changedDependencies);
|
109
|
+
};
|
110
|
+
|
111
|
+
void HybridUnistylesRuntime::calculateNewThemeAndDependencies(std::vector<UnistyleDependency>& changedDependencies) {
|
95
112
|
auto& state = core::UnistylesRegistry::get().getState(*_rt);
|
96
113
|
auto colorScheme = this->getColorScheme();
|
97
114
|
auto currentThemeName = this->getThemeName();
|
@@ -105,9 +122,25 @@ void HybridUnistylesRuntime::setAdaptiveThemes(bool isEnabled) {
|
|
105
122
|
|
106
123
|
state.setTheme(nextTheme);
|
107
124
|
}
|
125
|
+
}
|
108
126
|
|
109
|
-
|
110
|
-
|
127
|
+
jsi::Value HybridUnistylesRuntime::getTheme(jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
128
|
+
helpers::assertThat(rt, count <= 1, "UnistylesRuntime.getTheme expected to be called with 0 or 1 argument.");
|
129
|
+
|
130
|
+
auto& state = core::UnistylesRegistry::get().getState(*_rt);
|
131
|
+
|
132
|
+
if (count == 1) {
|
133
|
+
helpers::assertThat(rt, args[0].isString(), "UnistylesRuntime.getTheme expected to be called with string.");
|
134
|
+
|
135
|
+
auto themeName = args[0].asString(rt).utf8(rt);
|
136
|
+
|
137
|
+
helpers::assertThat(rt, state.hasTheme(themeName), "Unistyles: You're trying to get theme '" + themeName + "' but it wasn't registered.");
|
138
|
+
|
139
|
+
return state.getJSThemeByName(themeName);
|
140
|
+
}
|
141
|
+
|
142
|
+
return state.getCurrentJSTheme();
|
143
|
+
}
|
111
144
|
|
112
145
|
jsi::Value HybridUnistylesRuntime::updateTheme(jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
113
146
|
helpers::assertThat(rt, count == 2, "UnistylesRuntime.updateTheme expected to be called with 2 arguments.");
|
@@ -155,7 +188,6 @@ UnistylesCxxMiniRuntime HybridUnistylesRuntime::getMiniRuntime() {
|
|
155
188
|
UnistylesCxxMiniRuntime cxxMiniRuntime{
|
156
189
|
this->getThemeName(),
|
157
190
|
this->getBreakpoint(),
|
158
|
-
nativeMiniRuntime.orientation,
|
159
191
|
this->getHasAdaptiveThemes(),
|
160
192
|
nativeMiniRuntime.colorScheme,
|
161
193
|
nativeMiniRuntime.screen,
|
@@ -165,20 +197,44 @@ UnistylesCxxMiniRuntime HybridUnistylesRuntime::getMiniRuntime() {
|
|
165
197
|
nativeMiniRuntime.fontScale,
|
166
198
|
nativeMiniRuntime.rtl,
|
167
199
|
nativeMiniRuntime.statusBar,
|
168
|
-
nativeMiniRuntime.navigationBar
|
200
|
+
nativeMiniRuntime.navigationBar,
|
201
|
+
nativeMiniRuntime.isPortrait,
|
202
|
+
nativeMiniRuntime.isLandscape
|
203
|
+
};
|
204
|
+
|
205
|
+
return cxxMiniRuntime;
|
206
|
+
}
|
207
|
+
|
208
|
+
UnistylesCxxMiniRuntime HybridUnistylesRuntime::buildMiniRuntimeFromNativeRuntime(UnistylesNativeMiniRuntime& nativeMiniRuntime) {
|
209
|
+
UnistylesCxxMiniRuntime cxxMiniRuntime{
|
210
|
+
this->getThemeName(),
|
211
|
+
this->getBreakpoint(),
|
212
|
+
this->getHasAdaptiveThemes(),
|
213
|
+
nativeMiniRuntime.colorScheme,
|
214
|
+
nativeMiniRuntime.screen,
|
215
|
+
nativeMiniRuntime.contentSizeCategory,
|
216
|
+
nativeMiniRuntime.insets,
|
217
|
+
nativeMiniRuntime.pixelRatio,
|
218
|
+
nativeMiniRuntime.fontScale,
|
219
|
+
nativeMiniRuntime.rtl,
|
220
|
+
nativeMiniRuntime.statusBar,
|
221
|
+
nativeMiniRuntime.navigationBar,
|
222
|
+
nativeMiniRuntime.isPortrait,
|
223
|
+
nativeMiniRuntime.isLandscape
|
169
224
|
};
|
170
225
|
|
171
226
|
return cxxMiniRuntime;
|
172
227
|
}
|
173
228
|
|
174
|
-
jsi::Value HybridUnistylesRuntime::getMiniRuntimeAsValue(jsi::Runtime& rt) {
|
175
|
-
auto miniRuntime = this->getMiniRuntime();
|
229
|
+
jsi::Value HybridUnistylesRuntime::getMiniRuntimeAsValue(jsi::Runtime& rt, std::optional<UnistylesNativeMiniRuntime> maybeMiniRuntime) {
|
176
230
|
jsi::Object obj(rt);
|
231
|
+
auto miniRuntime = maybeMiniRuntime.has_value()
|
232
|
+
? this->buildMiniRuntimeFromNativeRuntime(maybeMiniRuntime.value())
|
233
|
+
: this->getMiniRuntime();
|
177
234
|
|
178
235
|
// auto generated by nitro, but can't be accessed due to static inline function
|
179
236
|
obj.setProperty(rt, "themeName", JSIConverter<std::optional<std::string>>::toJSI(rt, miniRuntime.themeName));
|
180
237
|
obj.setProperty(rt, "breakpoint", JSIConverter<std::optional<std::string>>::toJSI(rt, miniRuntime.breakpoint));
|
181
|
-
obj.setProperty(rt, "orientation", JSIConverter<Orientation>::toJSI(rt, miniRuntime.orientation));
|
182
238
|
obj.setProperty(rt, "hasAdaptiveThemes", JSIConverter<bool>::toJSI(rt, miniRuntime.hasAdaptiveThemes));
|
183
239
|
obj.setProperty(rt, "colorScheme", JSIConverter<ColorScheme>::toJSI(rt, miniRuntime.colorScheme));
|
184
240
|
obj.setProperty(rt, "screen", JSIConverter<Dimensions>::toJSI(rt, miniRuntime.screen));
|
@@ -189,15 +245,41 @@ jsi::Value HybridUnistylesRuntime::getMiniRuntimeAsValue(jsi::Runtime& rt) {
|
|
189
245
|
obj.setProperty(rt, "rtl", JSIConverter<bool>::toJSI(rt, miniRuntime.rtl));
|
190
246
|
obj.setProperty(rt, "statusBar", JSIConverter<Dimensions>::toJSI(rt, miniRuntime.statusBar));
|
191
247
|
obj.setProperty(rt, "navigationBar", JSIConverter<Dimensions>::toJSI(rt, miniRuntime.navigationBar));
|
248
|
+
obj.setProperty(rt, "isPortrait", JSIConverter<bool>::toJSI(rt, miniRuntime.isPortrait));
|
249
|
+
obj.setProperty(rt, "isLandscape", JSIConverter<bool>::toJSI(rt, miniRuntime.isLandscape));
|
192
250
|
|
193
251
|
return obj;
|
194
252
|
}
|
195
253
|
|
196
|
-
|
197
|
-
|
254
|
+
void HybridUnistylesRuntime::registerPlatformListener(const std::function<void (std::vector<UnistyleDependency>)>& listener) {
|
255
|
+
this->_onDependenciesChange = listener;
|
198
256
|
}
|
199
257
|
|
200
|
-
void HybridUnistylesRuntime::
|
258
|
+
void HybridUnistylesRuntime::registerNativePlatformListener(const std::function<void(std::vector<UnistyleDependency>, UnistylesNativeMiniRuntime)>& listener) {
|
201
259
|
this->_nativePlatform.registerPlatformListener(listener);
|
202
|
-
this->
|
260
|
+
this->_onNativeDependenciesChange = listener;
|
261
|
+
}
|
262
|
+
|
263
|
+
void HybridUnistylesRuntime::registerImeListener(const std::function<void(UnistylesNativeMiniRuntime)>& listener) {
|
264
|
+
this->_nativePlatform.registerImeListener(listener);
|
265
|
+
}
|
266
|
+
|
267
|
+
void HybridUnistylesRuntime::unregisterNativePlatformListeners() {
|
268
|
+
this->_nativePlatform.unregisterPlatformListeners();
|
269
|
+
}
|
270
|
+
|
271
|
+
void HybridUnistylesRuntime::includeDependenciesForColorSchemeChange(std::vector<UnistyleDependency>& deps) {
|
272
|
+
auto& registry = core::UnistylesRegistry::get();
|
273
|
+
auto& state = registry.getState(*this->_rt);
|
274
|
+
|
275
|
+
// ignore color scheme changes if user has no adaptive themes
|
276
|
+
if (!state.hasAdaptiveThemes()) {
|
277
|
+
return;
|
278
|
+
}
|
279
|
+
|
280
|
+
this->calculateNewThemeAndDependencies(deps);
|
281
|
+
}
|
282
|
+
|
283
|
+
jsi::Runtime& HybridUnistylesRuntime::getRuntime() {
|
284
|
+
return *this->_rt;
|
203
285
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
#include "HybridUnistylesRuntimeSpec.hpp"
|
4
4
|
#include "HybridNativePlatformSpec.hpp"
|
5
|
-
#include "
|
5
|
+
#include "NativePlatform.h"
|
6
6
|
#include "UnistylesState.h"
|
7
7
|
#include "HybridUnistylesStatusBarSpec.hpp"
|
8
8
|
#include "HybridNavigationBar.h"
|
@@ -13,8 +13,13 @@
|
|
13
13
|
namespace margelo::nitro::unistyles {
|
14
14
|
|
15
15
|
struct HybridUnistylesRuntime: public HybridUnistylesRuntimeSpec {
|
16
|
-
HybridUnistylesRuntime(Unistyles::HybridNativePlatformSpecCxx nativePlatform, jsi::Runtime& rt
|
16
|
+
HybridUnistylesRuntime(Unistyles::HybridNativePlatformSpecCxx nativePlatform, jsi::Runtime& rt, std::function<void(std::function<void(jsi::Runtime&)>&&)> runOnJSThread)
|
17
|
+
: HybridObject(TAG), _nativePlatform{nativePlatform}, _rt{&rt}, runOnJSThread(std::move(runOnJSThread)) {}
|
17
18
|
|
19
|
+
jsi::Value getTheme(jsi::Runtime& rt,
|
20
|
+
const jsi::Value& thisValue,
|
21
|
+
const jsi::Value* args,
|
22
|
+
size_t count);
|
18
23
|
jsi::Value updateTheme(jsi::Runtime& rt,
|
19
24
|
const jsi::Value& thisValue,
|
20
25
|
const jsi::Value* args,
|
@@ -32,6 +37,7 @@ struct HybridUnistylesRuntime: public HybridUnistylesRuntimeSpec {
|
|
32
37
|
HybridUnistylesRuntimeSpec::loadHybridMethods();
|
33
38
|
|
34
39
|
registerHybrids(this, [](Prototype& prototype) {
|
40
|
+
prototype.registerRawHybridMethod("getTheme", 1, &HybridUnistylesRuntime::getTheme);
|
35
41
|
prototype.registerRawHybridMethod("updateTheme", 1, &HybridUnistylesRuntime::updateTheme);
|
36
42
|
prototype.registerRawHybridMethod("createHybridStatusBar", 0, &HybridUnistylesRuntime::createHybridStatusBar);
|
37
43
|
prototype.registerRawHybridMethod("createHybridNavigationBar", 0, &HybridUnistylesRuntime::createHybridNavigationBar);
|
@@ -50,14 +56,23 @@ struct HybridUnistylesRuntime: public HybridUnistylesRuntimeSpec {
|
|
50
56
|
double getPixelRatio() override;
|
51
57
|
double getFontScale() override;
|
52
58
|
void registerPlatformListener(const std::function<void(std::vector<UnistyleDependency>)>& listener);
|
59
|
+
void registerNativePlatformListener(const std::function<void(std::vector<UnistyleDependency>, UnistylesNativeMiniRuntime)>& listener);
|
60
|
+
void registerImeListener(const std::function<void(UnistylesNativeMiniRuntime)>& listener);
|
61
|
+
void unregisterNativePlatformListeners();
|
53
62
|
|
54
63
|
void setTheme(const std::string &themeName) override;
|
55
64
|
void setAdaptiveThemes(bool isEnabled) override;
|
56
65
|
void setImmersiveMode(bool isEnabled) override;
|
57
66
|
void setRootViewBackgroundColor(double color) override;
|
58
67
|
UnistylesCxxMiniRuntime getMiniRuntime() override;
|
59
|
-
|
68
|
+
std::unordered_map<std::string, double> getBreakpoints() override;
|
69
|
+
|
60
70
|
jsi::Runtime& getRuntime();
|
71
|
+
UnistylesCxxMiniRuntime buildMiniRuntimeFromNativeRuntime(UnistylesNativeMiniRuntime& nativeMiniRuntime);
|
72
|
+
jsi::Value getMiniRuntimeAsValue(jsi::Runtime& rt, std::optional<UnistylesNativeMiniRuntime> maybeMiniRuntime);
|
73
|
+
void includeDependenciesForColorSchemeChange(std::vector<UnistyleDependency>& deps);
|
74
|
+
void calculateNewThemeAndDependencies(std::vector<UnistyleDependency>& deps);
|
75
|
+
std::function<void(std::function<void(jsi::Runtime&)>&&)> runOnJSThread;
|
61
76
|
|
62
77
|
private:
|
63
78
|
jsi::Runtime* _rt;
|
@@ -65,6 +80,7 @@ private:
|
|
65
80
|
std::shared_ptr<HybridStatusBar> _statusBar;
|
66
81
|
Unistyles::HybridNativePlatformSpecCxx _nativePlatform;
|
67
82
|
std::function<void(std::vector<UnistyleDependency>)> _onDependenciesChange;
|
83
|
+
std::function<void(std::vector<UnistyleDependency>, UnistylesNativeMiniRuntime)> _onNativeDependenciesChange;
|
68
84
|
};
|
69
85
|
|
70
86
|
}
|