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
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getVariants = void 0;
|
7
|
+
var _utils = require("../../utils");
|
8
|
+
const hasVariants = value => 'variants' in value[1];
|
9
|
+
const getVariants = (styles, selectedVariants) => {
|
10
|
+
return Object.entries(styles).filter(hasVariants).filter(([_key, {
|
11
|
+
variants
|
12
|
+
}]) => Object.keys(variants).some(variant => variant in variants)).map(([key, {
|
13
|
+
variants,
|
14
|
+
compoundVariants = []
|
15
|
+
}]) => {
|
16
|
+
const variantStyles = Object.entries(variants).flatMap(([variant, styles]) => {
|
17
|
+
const selectedVariant = selectedVariants[variant];
|
18
|
+
const selectedVariantStyles = styles[selectedVariant] ?? styles['default'];
|
19
|
+
if (!selectedVariantStyles) {
|
20
|
+
return [];
|
21
|
+
}
|
22
|
+
return selectedVariantStyles;
|
23
|
+
});
|
24
|
+
const compoundVariantStyles = compoundVariants.flatMap(compoundVariant => {
|
25
|
+
const {
|
26
|
+
styles,
|
27
|
+
...conditions
|
28
|
+
} = compoundVariant;
|
29
|
+
if (Object.entries(conditions).some(([variant, value]) => String(selectedVariants[variant]) !== String(value))) {
|
30
|
+
return [];
|
31
|
+
}
|
32
|
+
return styles;
|
33
|
+
});
|
34
|
+
const mergedVariantStyles = (0, _utils.deepMergeObjects)(...variantStyles, ...compoundVariantStyles);
|
35
|
+
return [key, mergedVariantStyles];
|
36
|
+
});
|
37
|
+
};
|
38
|
+
exports.getVariants = getVariants;
|
39
|
+
//# sourceMappingURL=getVariants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_utils","require","hasVariants","value","getVariants","styles","selectedVariants","Object","entries","filter","_key","variants","keys","some","variant","map","key","compoundVariants","variantStyles","flatMap","selectedVariant","selectedVariantStyles","compoundVariantStyles","compoundVariant","conditions","String","mergedVariantStyles","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/variants/getVariants.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAQA,MAAMC,WAAW,GAAsBC,KAAkB,IAAgD,UAAU,IAAIA,KAAK,CAAC,CAAC,CAAC;AAExH,MAAMC,WAAW,GAAGA,CAACC,MAAyC,EAAEC,gBAAqC,KAAK;EAC7G,OAAOC,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CACxBI,MAAM,CAACP,WAAW,CAAC,CACnBO,MAAM,CAAC,CAAC,CAACC,IAAI,EAAE;IAAEC;EAAS,CAAC,CAAC,KAAKJ,MAAM,CAACK,IAAI,CAACD,QAAQ,CAAC,CAACE,IAAI,CAACC,OAAO,IAAIA,OAAO,IAAIH,QAAQ,CAAC,CAAC,CAC5FI,GAAG,CAAC,CAAC,CAACC,GAAG,EAAE;IAAEL,QAAQ;IAAEM,gBAAgB,GAAG;EAAG,CAAC,CAAC,KAAK;IACjD,MAAMC,aAAa,GAAGX,MAAM,CAACC,OAAO,CAACG,QAAQ,CAAC,CAACQ,OAAO,CAAC,CAAC,CAACL,OAAO,EAAET,MAAM,CAAC,KAAK;MAC1E,MAAMe,eAAe,GAAGd,gBAAgB,CAACQ,OAAO,CAAC;MACjD,MAAMO,qBAAqB,GAAGhB,MAAM,CAACe,eAAe,CAAC,IAAIf,MAAM,CAAC,SAAS,CAAC;MAE1E,IAAI,CAACgB,qBAAqB,EAAE;QACxB,OAAO,EAAE;MACb;MAEA,OAAOA,qBAAqB;IAChC,CAAC,CAAC;IAEF,MAAMC,qBAAqB,GAAGL,gBAAgB,CAACE,OAAO,CAACI,eAAe,IAAI;MACtE,MAAM;QAAElB,MAAM;QAAE,GAAGmB;MAAW,CAAC,GAAGD,eAAe;MAEjD,IAAIhB,MAAM,CAACC,OAAO,CAACgB,UAAU,CAAC,CAACX,IAAI,CAAC,CAAC,CAACC,OAAO,EAAEX,KAAK,CAAC,KAAKsB,MAAM,CAACnB,gBAAgB,CAACQ,OAAO,CAAC,CAAC,KAAKW,MAAM,CAACtB,KAAK,CAAC,CAAC,EAAE;QAC5G,OAAO,EAAE;MACb;MAEA,OAAOE,MAAM;IACjB,CAAC,CAAC;IAEF,MAAMqB,mBAAmB,GAAG,IAAAC,uBAAgB,EAAC,GAAGT,aAAa,EAAE,GAAGI,qBAAqB,CAAC;IAExF,OAAO,CAACN,GAAG,EAAEU,mBAAmB,CAAC;EACrC,CAAC,CAAC;AACV,CAAC;AAAAE,OAAA,CAAAxB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _useVariants = require("./useVariants");
|
7
|
+
Object.keys(_useVariants).forEach(function (key) {
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
9
|
+
if (key in exports && exports[key] === _useVariants[key]) return;
|
10
|
+
Object.defineProperty(exports, key, {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return _useVariants[key];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
});
|
17
|
+
var _getVariants = require("./getVariants");
|
18
|
+
Object.keys(_getVariants).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (key in exports && exports[key] === _getVariants[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function () {
|
24
|
+
return _getVariants[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_useVariants","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getVariants"],"sourceRoot":"../../../../src","sources":["web/variants/index.ts"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createUseVariants = void 0;
|
7
|
+
var _react = require("react");
|
8
|
+
var _utils = require("../utils");
|
9
|
+
var _getVariants = require("./getVariants");
|
10
|
+
const createUseVariants = (styles, setSelectedVariants) => {
|
11
|
+
const useVariants = selectedVariants => {
|
12
|
+
const [selectedVariantStylesMap] = (0, _react.useState)(() => new Map());
|
13
|
+
const lastSelectedVariantsRef = (0, _react.useRef)();
|
14
|
+
// Variable that determines if variants have changed and we need to recalculate styles
|
15
|
+
const variantsChanged = !(0, _utils.equal)(lastSelectedVariantsRef.current, selectedVariants);
|
16
|
+
if (variantsChanged) {
|
17
|
+
lastSelectedVariantsRef.current = selectedVariants;
|
18
|
+
setSelectedVariants(selectedVariants);
|
19
|
+
}
|
20
|
+
const combinedVariantStyles = (0, _react.useMemo)(() => {
|
21
|
+
const result = (0, _getVariants.getVariants)(styles, selectedVariants);
|
22
|
+
result.forEach(([key, value]) => {
|
23
|
+
selectedVariantStylesMap.set(key, value);
|
24
|
+
});
|
25
|
+
return result;
|
26
|
+
}, [lastSelectedVariantsRef.current]);
|
27
|
+
combinedVariantStyles.forEach(([key]) => {
|
28
|
+
const styleEntry = styles[key];
|
29
|
+
if (!styleEntry) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
const selectedVariantStyles = selectedVariantStylesMap.get(key);
|
33
|
+
Object.defineProperties(styleEntry, (0, _utils.reduceObject)(selectedVariantStyles ?? {}, value => ({
|
34
|
+
value,
|
35
|
+
enumerable: false,
|
36
|
+
configurable: true
|
37
|
+
})));
|
38
|
+
|
39
|
+
// Add __uni__variants to static styles
|
40
|
+
Object.keys(styleEntry).forEach(key => {
|
41
|
+
if (!key.startsWith('__uni__secrets__')) {
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
const secret = (0, _utils.keyInObject)(styleEntry, key) ? styleEntry[key] : undefined;
|
45
|
+
if (!secret) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
Object.defineProperty(secret, '__uni__variants', {
|
49
|
+
value: selectedVariants
|
50
|
+
});
|
51
|
+
});
|
52
|
+
});
|
53
|
+
};
|
54
|
+
Object.defineProperty(styles, 'useVariants', {
|
55
|
+
value: useVariants
|
56
|
+
});
|
57
|
+
};
|
58
|
+
exports.createUseVariants = createUseVariants;
|
59
|
+
//# sourceMappingURL=useVariants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_react","require","_utils","_getVariants","createUseVariants","styles","setSelectedVariants","useVariants","selectedVariants","selectedVariantStylesMap","useState","Map","lastSelectedVariantsRef","useRef","variantsChanged","equal","current","combinedVariantStyles","useMemo","result","getVariants","forEach","key","value","set","styleEntry","selectedVariantStyles","get","Object","defineProperties","reduceObject","enumerable","configurable","keys","startsWith","secret","keyInObject","undefined","defineProperty","exports"],"sourceRoot":"../../../../src","sources":["web/variants/useVariants.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEO,MAAMG,iBAAiB,GAAGA,CAACC,MAAyC,EAAEC,mBAA4D,KAAK;EAC1I,MAAMC,WAAW,GAAIC,gBAAqC,IAAK;IAC3D,MAAM,CAACC,wBAAwB,CAAC,GAAG,IAAAC,eAAQ,EAAC,MAAM,IAAIC,GAAG,CAA8B,CAAC,CAAC;IACzF,MAAMC,uBAAuB,GAAG,IAAAC,aAAM,EAAsB,CAAC;IAC7D;IACA,MAAMC,eAAe,GAAG,CAAC,IAAAC,YAAK,EAACH,uBAAuB,CAACI,OAAO,EAAER,gBAAgB,CAAC;IAEjF,IAAIM,eAAe,EAAE;MACjBF,uBAAuB,CAACI,OAAO,GAAGR,gBAAgB;MAClDF,mBAAmB,CAACE,gBAAgB,CAAC;IACzC;IAEA,MAAMS,qBAAqB,GAAG,IAAAC,cAAO,EAAC,MAAM;MACxC,MAAMC,MAAM,GAAG,IAAAC,wBAAW,EAACf,MAAM,EAAEG,gBAAgB,CAAC;MAEpDW,MAAM,CAACE,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;QAC7Bd,wBAAwB,CAACe,GAAG,CAACF,GAAG,EAAEC,KAAK,CAAC;MAC5C,CAAC,CAAC;MAEF,OAAOJ,MAAM;IACjB,CAAC,EAAE,CAACP,uBAAuB,CAACI,OAAO,CAAC,CAAC;IAErCC,qBAAqB,CAACI,OAAO,CAAC,CAAC,CAACC,GAAG,CAAC,KAAK;MACrC,MAAMG,UAAU,GAAGpB,MAAM,CAACiB,GAAG,CAAC;MAE9B,IAAI,CAACG,UAAU,EAAE;QACb;MACJ;MAEA,MAAMC,qBAAqB,GAAGjB,wBAAwB,CAACkB,GAAG,CAACL,GAAG,CAAC;MAE/DM,MAAM,CAACC,gBAAgB,CAACJ,UAAU,EAAE,IAAAK,mBAAY,EAACJ,qBAAqB,IAAI,CAAC,CAAC,EAAEH,KAAK,KAAK;QACpFA,KAAK;QACLQ,UAAU,EAAE,KAAK;QACjBC,YAAY,EAAE;MAClB,CAAC,CAAC,CAAC,CAAC;;MAEJ;MACAJ,MAAM,CAACK,IAAI,CAACR,UAAU,CAAC,CAACJ,OAAO,CAACC,GAAG,IAAI;QACnC,IAAI,CAACA,GAAG,CAACY,UAAU,CAAC,kBAAkB,CAAC,EAAE;UACrC;QACJ;QAEA,MAAMC,MAAM,GAAG,IAAAC,kBAAW,EAACX,UAAU,EAAEH,GAAG,CAAC,GAAGG,UAAU,CAACH,GAAG,CAAC,GAAGe,SAAS;QAEzE,IAAI,CAACF,MAAM,EAAE;UACT;QACJ;QAEAP,MAAM,CAACU,cAAc,CAACH,MAAM,EAAE,iBAAiB,EAAE;UAC7CZ,KAAK,EAAEf;QACX,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC;EAEDoB,MAAM,CAACU,cAAc,CAACjC,MAAM,EAAE,aAAa,EAAE;IACzCkB,KAAK,EAAEhB;EACX,CAAC,CAAC;AACN,CAAC;AAAAgC,OAAA,CAAAnC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useMedia","Display","children","props","isVisible"],"sourceRoot":"../../../src","sources":["components/Display.tsx"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,YAAY;AAIrC,OAAO,MAAMC,OAA8C,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EACtF,MAAM;IAAEC;EAAU,CAAC,GAAGJ,QAAQ,CAACG,KAAK,CAAC;EAErC,OAAOC,SAAS,GACVF,QAAQ,GACR,IAAI;AACd,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useMedia","Hide","children","props","isVisible"],"sourceRoot":"../../../src","sources":["components/Hide.tsx"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,YAAY;AAIrC,OAAO,MAAMC,IAAwC,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EAChF,MAAM;IAAEC;EAAU,CAAC,GAAGJ,QAAQ,CAACG,KAAK,CAAC;EAErC,OAAO,CAACC,SAAS,GACXF,QAAQ,GACR,IAAI;AACd,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Hide","Display"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SAASC,OAAO,QAAQ,WAAW","ignoreList":[]}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { useEffect, useLayoutEffect, useState } from 'react';
|
4
|
+
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
5
|
+
import { isValidMq, parseMq, isUnistylesMq } from '../mq';
|
6
|
+
export const useMedia = config => {
|
7
|
+
const computeIsVisible = () => {
|
8
|
+
const maybeMq = config.mq;
|
9
|
+
if (!isUnistylesMq(maybeMq)) {
|
10
|
+
console.error(`🦄 Unistyles: Received invalid mq: ${maybeMq}`);
|
11
|
+
return false;
|
12
|
+
}
|
13
|
+
const parsedMq = parseMq(maybeMq);
|
14
|
+
if (!isValidMq(parsedMq)) {
|
15
|
+
console.error(`🦄 Unistyles: Received invalid mq where min is greater than max: ${maybeMq}`);
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
const {
|
19
|
+
width,
|
20
|
+
height
|
21
|
+
} = UnistylesRuntime.screen;
|
22
|
+
if (parsedMq.minWidth !== undefined && width < parsedMq.minWidth) {
|
23
|
+
return false;
|
24
|
+
}
|
25
|
+
if (parsedMq.maxWidth !== undefined && width > parsedMq.maxWidth) {
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
if (parsedMq.minHeight !== undefined && height < parsedMq.minHeight) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
if (parsedMq.maxHeight !== undefined && height > parsedMq.maxHeight) {
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
return true;
|
35
|
+
};
|
36
|
+
const [isVisible, setIsVisible] = useState(computeIsVisible());
|
37
|
+
useEffect(() => {
|
38
|
+
setIsVisible(computeIsVisible());
|
39
|
+
}, [config.mq]);
|
40
|
+
useLayoutEffect(() => {
|
41
|
+
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
42
|
+
if (dependencies.includes(UnistyleDependency.Breakpoints)) {
|
43
|
+
setIsVisible(computeIsVisible());
|
44
|
+
}
|
45
|
+
});
|
46
|
+
return () => {
|
47
|
+
removeChangeListener();
|
48
|
+
};
|
49
|
+
}, [config.mq]);
|
50
|
+
return {
|
51
|
+
isVisible
|
52
|
+
};
|
53
|
+
};
|
54
|
+
//# sourceMappingURL=useMedia.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useEffect","useLayoutEffect","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","isValidMq","parseMq","isUnistylesMq","useMedia","config","computeIsVisible","maybeMq","mq","console","error","parsedMq","width","height","screen","minWidth","undefined","maxWidth","minHeight","maxHeight","isVisible","setIsVisible","removeChangeListener","addChangeListener","dependencies","includes","Breakpoints"],"sourceRoot":"../../../src","sources":["components/useMedia.ts"],"mappings":";;AAAA,SAASA,SAAS,EAA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,GAAGxB,QAAQ,CAAiBS,gBAAgB,CAAC,CAAC,CAAC;EAE9EX,SAAS,CAAC,MAAM;IACZ0B,YAAY,CAACf,gBAAgB,CAAC,CAAC,CAAC;EACpC,CAAC,EAAE,CAACD,MAAM,CAACG,EAAE,CAAC,CAAC;EAEfZ,eAAe,CAAC,MAAM;IAClB,MAAM0B,oBAAoB,GAAIxB,UAAU,CAAyByB,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAAC1B,kBAAkB,CAAC2B,WAAW,CAAC,EAAE;QACvDL,YAAY,CAACf,gBAAgB,CAAC,CAAC,CAAC;MACpC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTgB,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,CAACjB,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,OAAO;IACHY;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
4
|
+
import { isUnistylesMq, isValidMq, parseMq } from '../mq';
|
5
|
+
export const useMedia = config => {
|
6
|
+
const disposeRef = useRef(() => {});
|
7
|
+
const [isVisible, setIsVisible] = useState(() => {
|
8
|
+
const maybeMq = config.mq;
|
9
|
+
if (!isUnistylesMq(maybeMq)) {
|
10
|
+
console.error(`🦄 Unistyles: Received invalid mq: ${maybeMq}`);
|
11
|
+
return false;
|
12
|
+
}
|
13
|
+
const parsedMq = parseMq(maybeMq);
|
14
|
+
if (!isValidMq(parsedMq)) {
|
15
|
+
console.error(`🦄 Unistyles: Received invalid mq where min is greater than max: ${maybeMq}`);
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
const {
|
19
|
+
minWidth,
|
20
|
+
maxWidth,
|
21
|
+
minHeight,
|
22
|
+
maxHeight
|
23
|
+
} = parsedMq;
|
24
|
+
const mediaQuery = [minWidth !== undefined ? `(min-width: ${minWidth}px)` : undefined, maxWidth !== undefined ? `(max-width: ${maxWidth}px)` : undefined, minHeight !== undefined ? `(min-height: ${minHeight}px)` : undefined, maxHeight !== undefined ? `(max-height: ${maxHeight}px)` : undefined].filter(Boolean).join(' and ');
|
25
|
+
const media = window.matchMedia(mediaQuery);
|
26
|
+
const handler = event => setIsVisible(event.matches);
|
27
|
+
media.addEventListener('change', handler);
|
28
|
+
disposeRef.current = () => media.removeEventListener('change', handler);
|
29
|
+
return media.matches;
|
30
|
+
});
|
31
|
+
|
32
|
+
// Unmount
|
33
|
+
useEffect(() => () => disposeRef.current(), []);
|
34
|
+
return {
|
35
|
+
isVisible
|
36
|
+
};
|
37
|
+
};
|
38
|
+
//# sourceMappingURL=useMedia.web.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","isUnistylesMq","isValidMq","parseMq","useMedia","config","disposeRef","isVisible","setIsVisible","maybeMq","mq","console","error","parsedMq","minWidth","maxWidth","minHeight","maxHeight","mediaQuery","undefined","filter","Boolean","join","media","window","matchMedia","handler","event","matches","addEventListener","current","removeEventListener"],"sourceRoot":"../../../src","sources":["components/useMedia.web.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,aAAa,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAEzD,OAAO,MAAMC,QAAQ,GAAIC,MAAsB,IAAK;EAChD,MAAMC,UAAU,GAAGP,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;EACnC,MAAM,CAACQ,SAAS,EAAEC,YAAY,CAAC,GAAGR,QAAQ,CAAC,MAAM;IAC7C,MAAMS,OAAO,GAAGJ,MAAM,CAACK,EAAuB;IAE9C,IAAI,CAACT,aAAa,CAACQ,OAAO,CAAC,EAAE;MACzBE,OAAO,CAACC,KAAK,CAAC,sCAAsCH,OAAO,EAAE,CAAC;MAE9D,OAAO,KAAK;IAChB;IAEA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
|
4
|
+
import { UnistylesRuntime } from '../specs';
|
5
|
+
import { UnistyleDependency } from '../specs/NativePlatform';
|
6
|
+
import { UnistylesListener } from '../web/listener';
|
7
|
+
import { UnistylesShadowRegistry } from '../web';
|
8
|
+
import { equal } from '../web/utils';
|
9
|
+
import { deepMergeObjects } from '../utils';
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
|
+
const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
|
12
|
+
const ALL_DEPENDENCIES = Object.values(UnistyleDependency).filter(dependency => typeof dependency === 'number');
|
13
|
+
const useShadowRegistry = style => {
|
14
|
+
const [ref] = useState(document.createElement('div'));
|
15
|
+
const oldClassNames = useRef([]);
|
16
|
+
const classNames = useMemo(() => {
|
17
|
+
if (!style) {
|
18
|
+
return [];
|
19
|
+
}
|
20
|
+
const newClassNames = UnistylesShadowRegistry.add(ref, [style], undefined, []) ?? [];
|
21
|
+
if (equal(oldClassNames.current, newClassNames)) {
|
22
|
+
return oldClassNames.current;
|
23
|
+
}
|
24
|
+
oldClassNames.current = newClassNames;
|
25
|
+
return newClassNames;
|
26
|
+
}, [style]);
|
27
|
+
useEffect(() => () => {
|
28
|
+
// Remove styles on unmount
|
29
|
+
if (style) {
|
30
|
+
UnistylesShadowRegistry.add(null, [style], undefined, []);
|
31
|
+
}
|
32
|
+
});
|
33
|
+
return classNames;
|
34
|
+
};
|
35
|
+
export const createUnistylesComponent = (Component, mappings) => {
|
36
|
+
return /*#__PURE__*/forwardRef((props, ref) => {
|
37
|
+
const narrowedProps = props;
|
38
|
+
const [mappingsProps, setMappingsProps] = useState(mappings?.(UnistylesRuntime.getTheme()));
|
39
|
+
const styleClassNames = useShadowRegistry(narrowedProps.style);
|
40
|
+
const contentContainerStyleClassNames = useShadowRegistry(narrowedProps.contentContainerStyle);
|
41
|
+
useEffect(() => {
|
42
|
+
const disposeMappings = UnistylesListener.addListeners(ALL_DEPENDENCIES, () => {
|
43
|
+
if (!mappings) {
|
44
|
+
disposeMappings();
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
return setMappingsProps(mappings(UnistylesRuntime.getTheme()));
|
48
|
+
});
|
49
|
+
return () => disposeMappings();
|
50
|
+
}, [mappingsProps, narrowedProps.style]);
|
51
|
+
const combinedProps = {
|
52
|
+
...deepMergeObjects(props, mappingsProps ?? {}),
|
53
|
+
...(narrowedProps.style ? {
|
54
|
+
style: {
|
55
|
+
$$css: true,
|
56
|
+
'unistyles': styleClassNames.join(' ')
|
57
|
+
}
|
58
|
+
} : {}),
|
59
|
+
...(narrowedProps.contentContainerStyle ? {
|
60
|
+
style: {
|
61
|
+
$$css: true,
|
62
|
+
'unistyles': contentContainerStyleClassNames.join(' ')
|
63
|
+
}
|
64
|
+
} : {})
|
65
|
+
};
|
66
|
+
return /*#__PURE__*/_jsx(Component, {
|
67
|
+
...combinedProps,
|
68
|
+
ref: ref
|
69
|
+
});
|
70
|
+
});
|
71
|
+
};
|
72
|
+
//# sourceMappingURL=createUnistylesComponent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","forwardRef","useRef","useMemo","UnistylesRuntime","UnistyleDependency","UnistylesListener","UnistylesShadowRegistry","equal","deepMergeObjects","jsx","_jsx","SUPPORTED_STYLE_PROPS","ALL_DEPENDENCIES","Object","values","filter","dependency","useShadowRegistry","style","ref","document","createElement","oldClassNames","classNames","newClassNames","add","undefined","current","createUnistylesComponent","Component","mappings","props","narrowedProps","mappingsProps","setMappingsProps","getTheme","styleClassNames","contentContainerStyleClassNames","contentContainerStyle","disposeMappings","addListeners","combinedProps","$$css","join"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAsBC,UAAU,EAAEC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAEnG,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,kBAAkB,QAAQ,yBAAyB;AAE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AAG,CAAC,CAAC;IACV,CAAsB;IAEtB,oBAAOjC,IAAA,CAACmB,SAAS;MAAA,GAAKY,aAAa;MAAEtB,GAAG,EAAEA;IAAI,CAAE,CAAC;EACrD,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
4
|
+
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
5
|
+
import { deepMergeObjects } from '../utils';
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
|
8
|
+
export const createUnistylesComponent = (Component, mappings) => {
|
9
|
+
return /*#__PURE__*/forwardRef((props, ref) => {
|
10
|
+
const narrowedProps = props;
|
11
|
+
const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
|
12
|
+
const [, setRt] = useState(0);
|
13
|
+
const stylesRef = useRef({});
|
14
|
+
const isForcedRef = useRef(false);
|
15
|
+
if (!isForcedRef.current) {
|
16
|
+
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
17
|
+
if (narrowedProps?.[propName]) {
|
18
|
+
if (Array.isArray(narrowedProps[propName])) {
|
19
|
+
console.error(`🦄 Unistyles: createUnistylesComponent requires ${propName} to be an object. Please check props for component: ${Component.displayName}`);
|
20
|
+
}
|
21
|
+
|
22
|
+
// @ts-expect-error - this is hidden from TS
|
23
|
+
if (props[propName].__unistyles_name && !props[propName].__proto__?.getStyle) {
|
24
|
+
console.error(`🦄 Unistyles: createUnistylesComponent received style that is not bound. You likely used the spread operator on a Unistyle style. Please check props for component: ${Component.displayName}`);
|
25
|
+
}
|
26
|
+
stylesRef.current = {
|
27
|
+
...stylesRef.current,
|
28
|
+
[propName]: narrowedProps[propName]
|
29
|
+
};
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}
|
33
|
+
useEffect(() => {
|
34
|
+
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
35
|
+
const componentDependencies = narrowedProps.style?.__proto__.uni__dependencies || mappings?.(theme).style?.__proto__.uni__dependencies;
|
36
|
+
if (dependencies.includes(UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(UnistyleDependency.Theme))) {
|
37
|
+
setTheme(UnistylesRuntime.getTheme());
|
38
|
+
|
39
|
+
// override with Unistyles styles
|
40
|
+
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
41
|
+
if (narrowedProps?.[propName]) {
|
42
|
+
stylesRef.current = {
|
43
|
+
...stylesRef.current,
|
44
|
+
// @ts-expect-error - this is hidden from TS
|
45
|
+
[propName]: props[propName].__proto__?.getStyle?.() || props[propName]
|
46
|
+
};
|
47
|
+
}
|
48
|
+
});
|
49
|
+
isForcedRef.current = true;
|
50
|
+
}
|
51
|
+
if (dependencies.some(dependency => dependency >= 2) && (!componentDependencies || componentDependencies.some(dependency => dependency >= 2))) {
|
52
|
+
setRt(prevState => prevState + 1);
|
53
|
+
}
|
54
|
+
});
|
55
|
+
return () => {
|
56
|
+
removeChangeListener();
|
57
|
+
};
|
58
|
+
}, []);
|
59
|
+
const mergedProps = mappings?.(theme) ?? {};
|
60
|
+
const finalProps = deepMergeObjects(mergedProps, props);
|
61
|
+
|
62
|
+
// override with Unistyles styles
|
63
|
+
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
64
|
+
if (finalProps[propName]) {
|
65
|
+
finalProps[propName] = stylesRef.current[propName];
|
66
|
+
}
|
67
|
+
});
|
68
|
+
isForcedRef.current = false;
|
69
|
+
return /*#__PURE__*/_jsx(Component, {
|
70
|
+
...finalProps,
|
71
|
+
ref: ref
|
72
|
+
});
|
73
|
+
});
|
74
|
+
};
|
75
|
+
//# sourceMappingURL=createUnistylesComponent.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","useRef","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","deepMergeObjects","jsx","_jsx","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","ref","narrowedProps","theme","setTheme","getTheme","setRt","stylesRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","__proto__","getStyle","removeChangeListener","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","Theme","some","dependency","prevState","mergedProps","finalProps"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAwBC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE1F,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAkC,UAAU;AAErG,SAASC,gBAAgB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAMC,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAGzE,OAAO,MAAMC,wBAAwB,GAAGA,CAAmGC,SAAgC,EAAEC,QAA+C,KAAK;EAC7N,oBAAOb,UAAU,CAAoE,CAACc,KAAK,EAAEC,GAAG,KAAK;IACjG,MAAMC,aAAa,GAAGF,KAAiE;IACvF,MAAM,CAACG,KAAK,EAAEC,QAAQ,CAAC,GAAGf,QAAQ,CAAiBG,gBAAgB,CAACa,QAAQ,CAAC,CAAC,CAAC;IAC/E,MAAM,GAAGC,KAAK,CAAC,GAAGjB,QAAQ,CAAC,CAAC,CAAC;IAC7B,MAAMkB,SAAS,GAAGnB,MAAM,CAAsB,CAAC,CAAC,CAAC;IACjD,MAAMoB,WAAW,GAAGpB,MAAM,CAAC,KAAK,CAAC;IAEjC,IAAI,CAACoB,WAAW,CAACC,OAAO,EAAE;MACtBb,qBAAqB,CAACc,OAAO,CAACC,QAAQ,IAAI;QACtC,IAAIT,aAAa,GAAGS,QAAQ,CAAC,EAAE;UAC3B,IAAIC,KAAK,CAACC,OAAO,CAACX,aAAa,CAACS,QAAQ,CAAC,CAAC,EAAE;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,CAAC;YACL;UACJ,CAAC,CAAC;UAEFH,WAAW,CAACC,OAAO,GAAG,IAAI;QAC9B;QAEA,IAAIa,YAAY,CAACM,IAAI,CAACC,UAAU,IAAIA,UAAU,IAAI,CAAC,CAAC,KAAK,CAACN,qBAAqB,IAAIA,qBAAqB,CAACK,IAAI,CAACC,UAAU,IAAIA,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE;UAC3IvB,KAAK,CAACwB,SAAS,IAAIA,SAAS,GAAG,CAAC,CAAC;QACrC;MACJ,CAAC,CAAC;MAEF,OAAO,MAAM;QACTV,oBAAoB,CAAC,CAAC;MAC1B,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,MAAMW,WAAW,GAAGhC,QAAQ,GAAGI,KAAK,CAAC,IAA2B,CAAC,CAAC;IAClE,MAAM6B,UAAU,GAAGvC,gBAAgB,CAACsC,WAAW,EAAE/B,KAAK,CAAC;;IAEvD;IACAJ,qBAAqB,CAACc,OAAO,CAACC,QAAQ,IAAI;MACtC,IAAIqB,UAAU,CAACrB,QAAQ,CAAC,EAAE;QACtBqB,UAAU,CAACrB,QAAQ,CAAC,GAAGJ,SAAS,CAACE,OAAO,CAACE,QAAQ,CAAC;MACtD;IACJ,CAAC,CAAC;IAEFH,WAAW,CAACC,OAAO,GAAG,KAAK;IAE3B,oBAAOd,IAAA,CAACG,SAAS;MAAA,GAAKkC,UAAU;MAAY/B,GAAG,EAAEA;IAAI,CAAE,CAAC;EAC5D,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createUnistylesComponent"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;AAAA,SAASA,wBAAwB,QAAQ,4BAA4B","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React from 'react';
|
4
3
|
export * from './specs';
|
5
4
|
export { mq } from './mq';
|
6
|
-
|
7
|
-
|
8
|
-
if (React.version < minReactVersionRequiredByUnistyles) {
|
9
|
-
throw new Error(`
|
10
|
-
You are using an outdated version of React (${React.version}).
|
11
|
-
Unistyles requires at least React ${minReactVersionRequiredByUnistyles}.
|
12
|
-
`);
|
13
|
-
}
|
5
|
+
export { createUnistylesComponent } from './core';
|
6
|
+
export * from './components';
|
14
7
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["mq","createUnistylesComponent"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,SAAS;AACvB,SAASA,EAAE,QAAQ,MAAM;AAEzB,SAASC,wBAAwB,QAAQ,QAAQ;AAEjD,cAAc,cAAc","ignoreList":[]}
|
package/lib/module/mq.js
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
import { UnistylesRuntime } from './specs';
|
4
|
+
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
5
|
+
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
6
|
+
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
3
7
|
const getMQValue = value => {
|
4
8
|
if (typeof value === 'number') {
|
5
9
|
return value;
|
@@ -7,17 +11,7 @@ const getMQValue = value => {
|
|
7
11
|
if (value === null) {
|
8
12
|
return 0;
|
9
13
|
}
|
10
|
-
|
11
|
-
// todo take it from js
|
12
|
-
const breakpoints = {
|
13
|
-
xs: 0,
|
14
|
-
sm: 300,
|
15
|
-
md: 500,
|
16
|
-
lg: 800,
|
17
|
-
xl: 1200
|
18
|
-
};
|
19
|
-
|
20
|
-
// @ts-ignore
|
14
|
+
const breakpoints = UnistylesRuntime.breakpoints;
|
21
15
|
return breakpoints[value] ?? 0;
|
22
16
|
};
|
23
17
|
|
@@ -41,4 +35,20 @@ export const mq = {
|
|
41
35
|
}
|
42
36
|
})
|
43
37
|
};
|
38
|
+
export const parseMq = mq => {
|
39
|
+
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
40
|
+
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
41
|
+
return {
|
42
|
+
minWidth: !width || fromW === 'Infinity' ? undefined : Number(fromW),
|
43
|
+
maxWidth: !width || toW === 'Infinity' ? undefined : Number(toW),
|
44
|
+
minHeight: !height || fromH === 'Infinity' ? undefined : Number(fromH),
|
45
|
+
maxHeight: !height || toH === 'Infinity' ? undefined : Number(toH)
|
46
|
+
};
|
47
|
+
};
|
48
|
+
export const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
49
|
+
export const isValidMq = parsedMQ => {
|
50
|
+
const isWidthValid = parsedMQ.minWidth === undefined || parsedMQ.maxWidth === undefined || parsedMQ.minWidth <= parsedMQ.maxWidth;
|
51
|
+
const isHeightValid = parsedMQ.minHeight === undefined || parsedMQ.maxHeight === undefined || parsedMQ.minHeight <= parsedMQ.maxHeight;
|
52
|
+
return isWidthValid && isHeightValid;
|
53
|
+
};
|
44
54
|
//# sourceMappingURL=mq.js.map
|
package/lib/module/mq.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["UnistylesRuntime","IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","getMQValue","value","breakpoints","mq","only","width","wMin","wMax","Infinity","height","hMin","hMax","and","parseMq","fromW","toW","exec","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","isUnistylesMq","test","isValidMq","parsedMQ","isWidthValid","isHeightValid"],"sourceRoot":"../../src","sources":["mq.ts"],"mappings":";;AAEA,SAASA,gBAAgB,QAAQ,SAAS;AAE1C,MAAMC,kBAAkB,GAAG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AS,IAAIQ,QAAQ,CAACJ,SAAS,KAAKJ,SAAS,IAAIQ,QAAQ,CAACL,SAAS,IAAIK,QAAQ,CAACJ,SAAS;EAEtI,OAAOK,YAAY,IAAIC,aAAa;AACxC,CAAC","ignoreList":[]}
|
@@ -15,6 +15,7 @@ export let UnistyleDependency = /*#__PURE__*/function (UnistyleDependency) {
|
|
15
15
|
UnistyleDependency[UnistyleDependency["FontScale"] = 11] = "FontScale";
|
16
16
|
UnistyleDependency[UnistyleDependency["StatusBar"] = 12] = "StatusBar";
|
17
17
|
UnistyleDependency[UnistyleDependency["NavigationBar"] = 13] = "NavigationBar";
|
18
|
+
UnistyleDependency[UnistyleDependency["Ime"] = 14] = "Ime";
|
18
19
|
return UnistyleDependency;
|
19
20
|
}({});
|
20
21
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistyleDependency"],"sourceRoot":"../../../../src","sources":["specs/NativePlatform/NativePlatform.nitro.ts"],"mappings":";;AAMA,WAAYA,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;;
|
1
|
+
{"version":3,"names":["UnistyleDependency"],"sourceRoot":"../../../../src","sources":["specs/NativePlatform/NativePlatform.nitro.ts"],"mappings":";;AAMA,WAAYA,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;;AAgC9B;AACA","ignoreList":[]}
|
@@ -1,12 +1,2 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
import { processColor } from 'react-native';
|
4
|
-
export const attachNavigationBarJSMethods = hybridObject => {
|
5
|
-
const privateHybrid = hybridObject;
|
6
|
-
privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
|
7
|
-
hybridObject.setBackgroundColor = color => {
|
8
|
-
const parsedColor = processColor(color);
|
9
|
-
privateHybrid._setBackgroundColor(parsedColor);
|
10
|
-
};
|
11
|
-
};
|
12
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["specs/NavigtionBar/index.ts"],"mappings":"","ignoreList":[]}
|
@@ -10,17 +10,21 @@ const findShadowNodeForHandle = handle => {
|
|
10
10
|
}
|
11
11
|
return node;
|
12
12
|
};
|
13
|
-
HybridShadowRegistry.add = (handle,
|
14
|
-
|
13
|
+
HybridShadowRegistry.add = (handle, styles, variants, args) => {
|
14
|
+
// virtualized nodes can be null
|
15
|
+
if (!handle || !styles || !Array.isArray(styles)) {
|
15
16
|
return;
|
16
17
|
}
|
17
|
-
|
18
|
+
|
19
|
+
// filter Reanimated styles and styles that are undefined
|
20
|
+
const filteredStyles = styles.filter(style => !style?.initial?.updater).filter(Boolean);
|
21
|
+
HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles, variants ?? {}, args ?? []);
|
18
22
|
};
|
19
|
-
HybridShadowRegistry.remove =
|
20
|
-
if (!handle
|
23
|
+
HybridShadowRegistry.remove = handle => {
|
24
|
+
if (!handle) {
|
21
25
|
return;
|
22
26
|
}
|
23
|
-
HybridShadowRegistry.unlink(findShadowNodeForHandle(handle)
|
27
|
+
HybridShadowRegistry.unlink(findShadowNodeForHandle(handle));
|
24
28
|
};
|
25
29
|
export const UnistylesShadowRegistry = HybridShadowRegistry;
|
26
30
|
//# sourceMappingURL=index.js.map
|