react-native-unistyles 3.0.0-alpha.3 → 3.0.0-alpha.31
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -0
- package/android/CMakeLists.txt +12 -21
- package/cxx/common/Constants.h +3 -0
- package/cxx/common/Helpers.h +118 -5
- package/cxx/core/HostStyle.cpp +12 -8
- package/cxx/core/HostStyle.h +4 -0
- package/cxx/core/StyleSheet.h +0 -2
- package/cxx/core/StyleSheetRegistry.cpp +10 -13
- package/cxx/core/StyleSheetRegistry.h +4 -4
- package/cxx/core/Unistyle.h +7 -10
- package/cxx/core/UnistyleData.h +23 -0
- package/cxx/core/UnistyleWrapper.h +61 -12
- 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 +25 -0
- package/cxx/core/UnistylesRegistry.cpp +104 -89
- package/cxx/core/UnistylesRegistry.h +16 -13
- package/cxx/core/UnistylesState.cpp +29 -11
- package/cxx/core/UnistylesState.h +5 -2
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +15 -13
- package/cxx/hybridObjects/HybridStyleSheet.cpp +136 -46
- package/cxx/hybridObjects/HybridStyleSheet.h +23 -5
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +51 -8
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +12 -1
- package/cxx/parser/Parser.cpp +236 -165
- package/cxx/parser/Parser.h +11 -14
- package/cxx/shadowTree/ShadowLeafUpdate.h +2 -1
- package/cxx/shadowTree/ShadowTrafficController.h +60 -0
- package/cxx/shadowTree/ShadowTreeManager.cpp +17 -17
- package/cxx/shadowTree/ShadowTreeManager.h +3 -2
- package/ios/Equatable.swift +2 -1
- package/ios/NativePlatform+ios.swift +21 -5
- package/ios/NativePlatform+keyboard.swift +83 -0
- package/ios/NativePlatformListener+ios.swift +36 -23
- package/ios/Unistyles.h +1 -0
- package/ios/UnistylesModuleOnLoad.h +13 -2
- package/ios/UnistylesModuleOnLoad.mm +9 -1
- package/lib/commonjs/core/createUnistylesComponent.js +18 -0
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.native.js +46 -0
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -0
- package/lib/commonjs/core/index.js +27 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/core/useBreakpoint.js +22 -0
- package/lib/commonjs/core/useBreakpoint.js.map +1 -0
- package/lib/commonjs/core/useBreakpoint.native.js +24 -0
- package/lib/commonjs/core/useBreakpoint.native.js.map +1 -0
- package/lib/commonjs/core/useTheme.js +22 -0
- package/lib/commonjs/core/useTheme.js.map +1 -0
- package/lib/commonjs/core/useTheme.native.js +24 -0
- package/lib/commonjs/core/useTheme.native.js.map +1 -0
- package/lib/commonjs/global.js +3 -0
- package/lib/commonjs/index.js +23 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +1 -4
- package/lib/commonjs/mq.js.map +2 -1
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +1 -0
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +2 -1
- package/lib/commonjs/specs/NativePlatform/index.js.map +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +7 -6
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/types.js +3 -0
- package/lib/commonjs/specs/StatusBar/index.js +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +2 -4
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js +1 -0
- package/lib/commonjs/specs/StyleSheet/index.js.map +2 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
- 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/specs/index.web.js.map +2 -1
- package/lib/commonjs/specs/types.js +10 -10
- package/lib/commonjs/specs/types.js.map +1 -0
- package/lib/commonjs/types/accessibility.js +1 -1
- package/lib/commonjs/types/accessibility.js.map +1 -0
- package/lib/commonjs/types/common.js +3 -0
- package/lib/commonjs/types/stylesheet.js.map +1 -1
- package/lib/commonjs/types/variants.js.map +1 -1
- package/lib/commonjs/web/convert/boxShadow.js +74 -0
- package/lib/commonjs/web/convert/boxShadow.js.map +2 -0
- package/lib/commonjs/web/convert/index.js +68 -0
- package/lib/commonjs/web/convert/index.js.map +2 -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/pseudo.js +10 -0
- package/lib/commonjs/web/convert/pseudo.js.map +2 -0
- package/lib/commonjs/web/convert/shadow.js +64 -0
- package/lib/commonjs/web/convert/shadow.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +93 -0
- package/lib/commonjs/web/convert/style.js.map +2 -0
- package/lib/commonjs/web/convert/textShadow.js +73 -0
- package/lib/commonjs/web/convert/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/transform.js +72 -0
- package/lib/commonjs/web/convert/transform.js.map +2 -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 +54 -0
- package/lib/commonjs/web/convert/utils.js.map +2 -0
- package/lib/commonjs/web/create.js +48 -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 +35 -0
- package/lib/commonjs/web/listener.js.map +1 -0
- package/lib/commonjs/web/mock.js +28 -0
- package/lib/commonjs/web/mock.js.map +1 -0
- package/lib/commonjs/web/mq.js +23 -0
- package/lib/commonjs/web/mq.js.map +1 -0
- package/lib/commonjs/web/registry.js +183 -0
- package/lib/commonjs/web/registry.js.map +2 -0
- package/lib/commonjs/web/runtime.js +167 -0
- package/lib/commonjs/web/runtime.js.map +2 -0
- package/lib/commonjs/web/shadowRegistry.js +114 -0
- package/lib/commonjs/web/shadowRegistry.js.map +2 -0
- package/lib/commonjs/web/state.js +69 -0
- package/lib/commonjs/web/state.js.map +2 -0
- package/lib/commonjs/web/utils/common.js +92 -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 +82 -0
- package/lib/commonjs/web/utils/unistyle.js.map +2 -0
- package/lib/commonjs/web/variants/getVariants.js +39 -0
- package/lib/commonjs/web/variants/getVariants.js.map +2 -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 +58 -0
- package/lib/commonjs/web/variants/useVariants.js.map +2 -0
- package/lib/module/common.js.map +1 -1
- package/lib/module/core/createUnistylesComponent.js +12 -0
- package/lib/module/core/createUnistylesComponent.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.native.js +39 -0
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -0
- package/lib/module/core/index.js +6 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/core/useBreakpoint.js +17 -0
- package/lib/module/core/useBreakpoint.js.map +1 -0
- package/lib/module/core/useBreakpoint.native.js +19 -0
- package/lib/module/core/useBreakpoint.native.js.map +2 -0
- package/lib/module/core/useTheme.js +17 -0
- package/lib/module/core/useTheme.js.map +1 -0
- package/lib/module/core/useTheme.native.js +19 -0
- package/lib/module/core/useTheme.native.js.map +1 -0
- package/lib/module/global.js +1 -1
- package/lib/module/global.js.map +1 -0
- package/lib/module/index.js +1 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +1 -4
- package/lib/module/mq.js.map +2 -1
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +1 -0
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +2 -1
- package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +1 -1
- package/lib/module/specs/NavigtionBar/index.js +1 -1
- package/lib/module/specs/NavigtionBar/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/index.js +7 -6
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/types.js +2 -0
- package/lib/module/specs/ShadowRegistry/types.js.map +1 -1
- package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -0
- package/lib/module/specs/StatusBar/index.js +1 -1
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js +1 -0
- package/lib/module/specs/StyleSheet/index.js.map +2 -1
- package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js.map +2 -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 +2 -1
- package/lib/module/specs/types.js.map +1 -0
- package/lib/module/types/accessibility.js +1 -1
- package/lib/module/types/accessibility.js.map +1 -0
- package/lib/module/types/breakpoints.js.map +1 -1
- package/lib/module/types/common.js +1 -1
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/core.js.map +1 -0
- package/lib/module/types/index.js.map +2 -1
- package/lib/module/types/stylesheet.js.map +1 -1
- package/lib/module/types/variants.js.map +1 -0
- package/lib/module/web/convert/boxShadow.js +72 -0
- package/lib/module/web/convert/boxShadow.js.map +1 -0
- package/lib/module/web/convert/index.js +69 -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/pseudo.js +5 -0
- package/lib/module/web/convert/pseudo.js.map +1 -0
- package/lib/module/web/convert/shadow.js +63 -0
- package/lib/module/web/convert/shadow.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/textShadow.js +65 -0
- package/lib/module/web/convert/textShadow.js.map +2 -0
- package/lib/module/web/convert/transform.js +67 -0
- package/lib/module/web/convert/transform.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 +42 -0
- package/lib/module/web/convert/utils.js.map +2 -0
- package/lib/module/web/create.js +39 -0
- package/lib/module/web/create.js.map +2 -0
- package/lib/module/web/index.js +25 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/listener.js +31 -0
- package/lib/module/web/listener.js.map +2 -0
- package/lib/module/web/mock.js +24 -0
- package/lib/module/web/mock.js.map +1 -0
- package/lib/module/web/mq.js +17 -0
- package/lib/module/web/mq.js.map +1 -0
- package/lib/module/web/registry.js +179 -0
- package/lib/module/web/registry.js.map +1 -0
- package/lib/module/web/runtime.js +163 -0
- package/lib/module/web/runtime.js.map +1 -0
- package/lib/module/web/shadowRegistry.js +118 -0
- package/lib/module/web/shadowRegistry.js.map +1 -0
- package/lib/module/web/state.js +65 -0
- package/lib/module/web/state.js.map +2 -0
- package/lib/module/web/utils/common.js +78 -0
- package/lib/module/web/utils/common.js.map +2 -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 +69 -0
- package/lib/module/web/utils/unistyle.js.map +2 -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 +53 -0
- package/lib/module/web/variants/useVariants.js.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +6 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +6 -0
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +4 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/core/useBreakpoint.d.ts +2 -0
- package/lib/typescript/src/core/useBreakpoint.d.ts.map +1 -0
- package/lib/typescript/src/core/useBreakpoint.native.d.ts +2 -0
- package/lib/typescript/src/core/useBreakpoint.native.d.ts.map +1 -0
- package/lib/typescript/src/core/useTheme.d.ts +3 -0
- package/lib/typescript/src/core/useTheme.d.ts.map +1 -0
- package/lib/typescript/src/core/useTheme.native.d.ts +3 -0
- package/lib/typescript/src/core/useTheme.native.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +6 -2
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts +5 -0
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +3 -3
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts +5 -0
- 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 +0 -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/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/web/convert/boxShadow.d.ts +8 -0
- package/lib/typescript/src/web/convert/boxShadow.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/pseudo.d.ts +6 -0
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow.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/src/web/convert/textShadow.d.ts +8 -0
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/transform.d.ts +4 -0
- package/lib/typescript/src/web/convert/transform.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -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 +3 -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/mq.d.ts +8 -0
- package/lib/typescript/src/web/mq.d.ts.map +1 -0
- package/lib/typescript/src/web/registry.d.ts +28 -0
- package/lib/typescript/src/web/registry.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/runtime.d.ts +9 -9
- package/lib/typescript/src/web/runtime.d.ts.map +1 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts +16 -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/{web/utils.d.ts → src/web/utils/common.d.ts} +8 -9
- 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.hpp +48 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +8 -8
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +31 -22
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +8 -3
- 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/Func_void.kt +45 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +25 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +2 -1
- package/nitrogen/generated/android/unistyles+autolinking.cmake +13 -1
- package/nitrogen/generated/android/{UnistylesOnLoad.cpp → unistylesOnLoad.cpp} +4 -2
- package/nitrogen/generated/android/{UnistylesOnLoad.hpp → unistylesOnLoad.hpp} +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +5 -3
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +25 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +53 -31
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -29
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +7 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +3 -13
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +167 -104
- 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 -0
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +5 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +3 -0
- 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 +18 -30
- package/plugin/common.js +12 -1
- package/plugin/index.js +110 -23
- package/plugin/ref.js +64 -13
- package/plugin/style.js +82 -22
- package/plugin/stylesheet.js +53 -3
- package/plugin/variants.js +33 -0
- package/src/common.js +4 -0
- package/src/core/createUnistylesComponent.js +6 -0
- package/src/core/createUnistylesComponent.native.js +31 -0
- package/src/core/createUnistylesComponent.native.tsx +44 -0
- package/src/core/createUnistylesComponent.tsx +10 -0
- package/src/core/index.js +3 -0
- package/src/core/index.ts +3 -0
- package/src/core/useBreakpoint.js +14 -0
- package/src/core/useBreakpoint.native.js +16 -0
- package/src/core/useBreakpoint.native.ts +21 -0
- package/src/core/useBreakpoint.ts +18 -0
- package/src/core/useTheme.js +14 -0
- package/src/core/useTheme.native.js +16 -0
- package/src/core/useTheme.native.ts +22 -0
- package/src/core/useTheme.ts +19 -0
- package/src/global.js +1 -0
- package/src/index.js +3 -0
- package/src/index.ts +2 -12
- package/src/mq.js +38 -0
- package/src/specs/NativePlatform/NativePlatform.nitro.js +19 -0
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +7 -3
- package/src/specs/NativePlatform/index.js +1 -0
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +1 -0
- package/src/specs/NavigtionBar/index.js +9 -0
- package/src/specs/NavigtionBar/index.ts +6 -1
- package/src/specs/ShadowRegistry/ShadowRegistry.nitro.js +1 -0
- package/src/specs/ShadowRegistry/index.js +26 -0
- package/src/specs/ShadowRegistry/index.ts +10 -9
- package/src/specs/ShadowRegistry/types.js +1 -0
- package/src/specs/StatusBar/UnistylesStatusBar.nitro.js +1 -0
- package/src/specs/StatusBar/index.js +25 -0
- package/src/specs/StatusBar/index.ts +6 -1
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -0
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +4 -1
- package/src/specs/StyleSheet/index.js +13 -0
- package/src/specs/StyleSheet/index.ts +6 -1
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.js +2 -0
- package/src/specs/TurboUnistyles/index.js +1 -0
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +1 -0
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +0 -1
- package/src/specs/UnistylesRuntime/index.js +20 -0
- package/src/specs/UnistylesRuntime/index.ts +4 -2
- package/src/specs/index.js +8 -0
- package/src/specs/index.ts +6 -2
- package/src/specs/index.web.js +2 -0
- package/src/specs/index.web.ts +1 -1
- package/src/specs/types.js +17 -0
- package/src/types/accessibility.js +30 -0
- package/src/types/breakpoints.js +1 -0
- package/src/types/breakpoints.ts +25 -13
- package/src/types/common.js +1 -0
- package/src/types/core.js +1 -0
- package/src/types/index.js +1 -0
- package/src/types/index.ts +1 -1
- package/src/types/stylesheet.js +2 -0
- package/src/types/stylesheet.ts +7 -5
- package/src/types/variants.js +1 -0
- package/src/types/variants.ts +7 -1
- package/src/web/convert/boxShadow.js +59 -0
- package/{web → src/web}/convert/boxShadow.ts +14 -15
- package/src/web/convert/index.js +56 -0
- package/{web → src/web}/convert/index.ts +8 -15
- package/src/web/convert/pseudo.js +131 -0
- package/src/web/convert/pseudo.ts +137 -0
- package/src/web/convert/shadow.js +50 -0
- package/src/web/convert/style.js +137 -0
- package/{web → src/web}/convert/style.ts +61 -10
- package/src/web/convert/textShadow.js +56 -0
- package/{web → src/web}/convert/textShadow.ts +13 -14
- package/src/web/convert/transform.js +65 -0
- package/{web → src/web}/convert/transform.ts +7 -8
- package/src/web/convert/types.js +2 -0
- package/{web → src/web}/convert/types.ts +1 -1
- package/src/web/convert/utils.js +39 -0
- package/src/web/create.js +36 -0
- package/src/web/create.ts +47 -0
- package/src/web/index.js +22 -0
- package/{web → src/web}/index.ts +3 -2
- package/src/web/listener.js +26 -0
- package/{web/listener → src/web}/listener.ts +3 -3
- package/src/web/mock.js +21 -0
- package/{web → src/web}/mock.ts +2 -12
- package/src/web/mq.js +14 -0
- package/{web → src/web}/mq.ts +1 -3
- package/src/web/registry.js +165 -0
- package/src/web/registry.ts +236 -0
- package/src/web/runtime.js +160 -0
- package/{web → src/web}/runtime.ts +21 -18
- package/src/web/shadowRegistry.js +96 -0
- package/src/web/shadowRegistry.ts +121 -0
- package/src/web/state.js +68 -0
- package/src/web/state.ts +94 -0
- package/src/web/utils/common.js +79 -0
- package/{web/utils.ts → src/web/utils/common.ts} +48 -36
- package/src/web/utils/index.js +2 -0
- package/src/web/utils/index.ts +2 -0
- package/src/web/utils/unistyle.js +72 -0
- package/src/web/utils/unistyle.ts +104 -0
- package/src/web/variants/getVariants.js +26 -0
- package/src/web/variants/getVariants.ts +42 -0
- package/src/web/variants/index.js +2 -0
- package/src/web/variants/index.ts +2 -0
- package/src/web/variants/useVariants.js +50 -0
- package/src/web/variants/useVariants.ts +65 -0
- 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.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.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.map +0 -1
- 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/breakpoint.ts +0 -21
- package/web/create.ts +0 -102
- package/web/listener/index.ts +0 -1
- 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/lib/typescript/{web → src/web}/convert/shadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/utils.d.ts +0 -0
- /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
- /package/{web → src/web}/convert/module.d.ts +0 -0
- /package/{web → src/web}/convert/shadow.ts +0 -0
- /package/{web → src/web}/convert/utils.ts +0 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.convertUnistyles = void 0;
|
7
|
+
var _pseudo = require("./pseudo");
|
8
|
+
var _style = require("./style");
|
9
|
+
var _utils = require("../utils");
|
10
|
+
var _transform = require("./transform");
|
11
|
+
var _utils2 = require("./utils");
|
12
|
+
var _textShadow = require("./textShadow");
|
13
|
+
var _boxShadow = require("./boxShadow");
|
14
|
+
const convertUnistyles = value => {
|
15
|
+
// Flag to mark if textShadow is already created
|
16
|
+
let hasTextShadow = false;
|
17
|
+
// Flag to mark if boxShadow is already created
|
18
|
+
let hasBoxShadow = false;
|
19
|
+
const stylesArray = Object.entries({
|
20
|
+
...value,
|
21
|
+
...value._web
|
22
|
+
}).flatMap(([unistylesKey, unistylesValue]) => {
|
23
|
+
// Keys to omit
|
24
|
+
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies', '__unistyles-secrets__'].includes(unistylesKey) || unistylesKey.startsWith('variant-')) {
|
25
|
+
return [];
|
26
|
+
}
|
27
|
+
// Pseudo classes :hover, :before etc.
|
28
|
+
if ((0, _pseudo.isPseudo)(unistylesKey)) {
|
29
|
+
const flattenValues = convertUnistyles(unistylesValue);
|
30
|
+
return {
|
31
|
+
[unistylesKey]: flattenValues
|
32
|
+
};
|
33
|
+
}
|
34
|
+
// Text shadow
|
35
|
+
if ((0, _utils2.isTextShadow)(unistylesKey)) {
|
36
|
+
if (hasTextShadow) {
|
37
|
+
return [];
|
38
|
+
}
|
39
|
+
hasTextShadow = true;
|
40
|
+
return (0, _textShadow.getTextShadowStyle)(value);
|
41
|
+
}
|
42
|
+
// Box shadow
|
43
|
+
if ((0, _utils2.isBoxShadow)(unistylesKey)) {
|
44
|
+
if (hasBoxShadow) {
|
45
|
+
return [];
|
46
|
+
}
|
47
|
+
hasBoxShadow = true;
|
48
|
+
return (0, _boxShadow.getBoxShadowStyle)(value);
|
49
|
+
}
|
50
|
+
// Transforms
|
51
|
+
if ((0, _utils2.isTransform)(unistylesKey, unistylesValue)) {
|
52
|
+
return (0, _transform.getTransformStyle)(unistylesValue);
|
53
|
+
}
|
54
|
+
// Breakpoints
|
55
|
+
if (typeof unistylesValue === 'object' && unistylesValue !== null) {
|
56
|
+
return Object.entries(unistylesValue).map(([breakpointKey, breakpointValue]) => {
|
57
|
+
return {
|
58
|
+
[breakpointKey]: (0, _style.getStyle)(unistylesKey, breakpointValue)
|
59
|
+
};
|
60
|
+
});
|
61
|
+
}
|
62
|
+
// Regular styles
|
63
|
+
return (0, _style.getStyle)(unistylesKey, unistylesValue);
|
64
|
+
});
|
65
|
+
return (0, _utils.deepMergeObjects)(...stylesArray);
|
66
|
+
};
|
67
|
+
exports.convertUnistyles = convertUnistyles;
|
68
|
+
//# sourceMappingURL=index.js.mapjs.map
|
@@ -0,0 +1,2 @@
|
|
1
|
+
{"version":3,"names":["_pseudo","require","_style","_utils","_transform","_utils2","_textShadow","_boxShadow","convertUnistyles","value","hasTextShadow","hasBoxShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","isPseudo","flattenValues","isTextShadow","getTextShadowStyle","isBoxShadow","getBoxShadowStyle","isTransform","getTransformStyle","map","breakpointKey","breakpointValue","getStyle","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/index.js"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACO,MAAMO,gBAAgB,GAAIC,KAAK,IAAK;EACvC;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,YAAY,GAAG,KAAK;EACxB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO,CAAC;IAC/B,GAAGL,KAAK;IACR,GAAGA,KAAK,CAACM;EACb,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,YAAY,EAAEC,cAAc,CAAC,KAAK;IAC3C;IACA,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,uBAAuB,CAAC,CAACC,QAAQ,CAACF,YAAY,CAAC,IAAIA,YAAY,CAACG,UAAU,CAAC,UAAU,CAAC,EAAE;MACrK,OAAO,EAAE;IACb;IACA;IACA,IAAI,IAAAC,gBAAQ,EAACJ,YAAY,CAAC,EAAE;MACxB,MAAMK,aAAa,GAAGd,gBAAgB,CAACU,cAAc,CAAC;MACtD,OAAO;QAAE,CAACD,YAAY,GAAGK;MAAc,CAAC;IAC5C;IACA;IACA,IAAI,IAAAC,oBAAY,EAACN,YAAY,CAAC,EAAE;MAC5B,IAAIP,aAAa,EAAE;QACf,OAAO,EAAE;MACb;MACAA,aAAa,GAAG,IAAI;MACpB,OAAO,IAAAc,8BAAkB,EAACf,KAAK,CAAC;IACpC;IACA;IACA,IAAI,IAAAgB,mBAAW,EAACR,YAAY,CAAC,EAAE;MAC3B,IAAIN,YAAY,EAAE;QACd,OAAO,EAAE;MACb;MACAA,YAAY,GAAG,IAAI;MACnB,OAAO,IAAAe,4BAAiB,EAACjB,KAAK,CAAC;IACnC;IACA;IACA,IAAI,IAAAkB,mBAAW,EAACV,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAO,IAAAU,4BAAiB,EAACV,cAAc,CAAC;IAC5C;IACA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOL,MAAM,CAACC,OAAO,CAACI,cAAc,CAAC,CAACW,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAG,IAAAE,eAAQ,EAACf,YAAY,EAAEc,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;IACA;IACA,OAAO,IAAAC,eAAQ,EAACf,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAAC;EACF,OAAO,IAAAe,uBAAgB,EAAC,GAAGrB,WAAW,CAAC;AAC3C,CAAC;AAACsB,OAAA,CAAA1B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
2
|
+
List":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["web/convert/module.d.ts"],"mappings":"","ignoreList":[]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.pseudos = exports.isPseudo = void 0;
|
7
|
+
const pseudos = exports.pseudos = ['_-moz-broken', '_-moz-drag-over', '_-moz-first-node', '_-moz-handler-blocked', '_-moz-handler-crashed', '_-moz-handler-disabled', '_-moz-last-node', '_-moz-loading', '_-moz-locale-dir(ltr)', '_-moz-locale-dir(rtl)', '_-moz-only-whitespace', '_-moz-submit-invalid', '_-moz-suppressed', '_-moz-user-disabled', '_-moz-window-inactive', '_active', '_any-link', '_autofill', '_blank', '_buffering', '_checked', '_current', '_default', '_defined', '_dir(', '_disabled', '_empty', '_enabled', '_first', '_first-child', '_first-of-type', '_focus', '_focus-visible', '_focus-within', '_fullscreen', '_future', '_has(', '_host', '_host-context(', '_host(', '_hover', '_in-range', '_indeterminate', '_invalid', '_is(', '_lang(', '_last-child', '_last-of-type', '_left', '_link', '_local-link', '_modal', '_muted', '_not(', '_nth-child(', '_nth-last-child(', '_nth-last-of-type(', '_nth-of-type(', '_only-child', '_only-of-type', '_optional', '_out-of-range', '_past', '_paused', '_picture-in-picture', '_placeholder-shown', '_playing', '_popover-open', '_read-only', '_read-write', '_required', '_right', '_scope', '_seeking', '_stalled', '_state(', '_target', '_target-within', '_user-invalid', '_user-valid', '_valid', '_visited', '_volume-locked', '_where(', '_-moz-color-swatch', '_-moz-focus-inner', '_-moz-list-bullet', '_-moz-list-number', '_-moz-meter-bar', '_-moz-progress-bar', '_-moz-range-progress', '_-moz-range-thumb', '_-moz-range-track', '_-webkit-inner-spin-button', '_-webkit-meter-barDeprecated', '_-webkit-meter-even-less-good-value', '_-webkit-meter-inner-element', '_-webkit-meter-optimum-value', '_-webkit-meter-suboptimum-value', '_-webkit-progress-bar', '_-webkit-progress-inner-element', '_-webkit-progress-value', '_-webkit-scrollbar', '_-webkit-search-cancel-button', '_-webkit-search-results-button', '_-webkit-slider-runnable-track', '_-webkit-slider-thumb', '_after', '_backdrop', '_before', '_cue', '_file-selector-button', '_first-letter', '_first-line', '_grammar-error', '_highlight(', '_marker', '_part(', '_placeholder', '_selection', '_slotted(', '_spelling-error', '_target-text', '_view-transition', '_view-transition-group', '_view-transition-image-pair', '_view-transition-new', '_view-transition-old'];
|
8
|
+
const isPseudo = selector => pseudos.some(pseudo => selector.startsWith(pseudo));
|
9
|
+
exports.isPseudo = isPseudo;
|
10
|
+
//# sourceMappingURL=pseudo.js.map
|
@@ -0,0 +1,2 @@
|
|
1
|
+
{"version":3,"names":["pseudos","exports","isPseudo","selector","some","pseudo","startsWith"],"sourceRoot":"../../../../src","sources":["web/convert/pseudo.js"],"mappings":";;;;;;AAAO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,CACnB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACT,WAAW,EACX,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,WAAW,EACX,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,SAAS,EACT,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,QAAQ,EACR,aAAa,EACb,eAAe,EACf,OAAO,EACP,OAAO,EACP,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EACf,OAAO,EACP,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,EAC5B,8BAA8B,EAC9B,qCAAqC,EACrC,8BAA8B,EAC9B,8BAA8B,EAC9B,iCAAiC,EACjC,uBAAuB,EACvB,iCAAiC,EACjC,yBAAyB,EACzB,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACN,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,CACzB;AACM,MAAME,QAAQ,GAAIC,QAAQ,IAAKH,OAAO,CAACI,IAAI,CAACC,MAAM,IAAIF,QAAQ,CAACG,UAAU,CAACD,MAAM,CAAC,CAAC;AAACJ,OAAA,CAAAC,QAAA,GAAAA,QAAA","ignoreList":[]}
|
2
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.validateShadow = void 0;
|
7
|
+
const validateShadow = (shadowProperties, styles, breakpoints) => {
|
8
|
+
// Collect breakpoints
|
9
|
+
shadowProperties.forEach(key => {
|
10
|
+
const value = styles[key];
|
11
|
+
if (typeof value !== 'object') {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
15
|
+
const {
|
16
|
+
width,
|
17
|
+
height
|
18
|
+
} = value;
|
19
|
+
// If shadowOffset.width has breakpoints
|
20
|
+
if (typeof width === 'object') {
|
21
|
+
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
|
22
|
+
}
|
23
|
+
// If shadowOffset.height has breakpoints
|
24
|
+
if (typeof height === 'object') {
|
25
|
+
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
|
26
|
+
}
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
// Collect regular breakpoints
|
30
|
+
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
31
|
+
});
|
32
|
+
// Validate if all breakpoints are present
|
33
|
+
shadowProperties.forEach(key => {
|
34
|
+
const value = styles[key];
|
35
|
+
if (typeof value !== 'object') {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
39
|
+
const {
|
40
|
+
width,
|
41
|
+
height
|
42
|
+
} = value;
|
43
|
+
if (typeof width === 'object') {
|
44
|
+
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width));
|
45
|
+
if (missingBreakpoints.length) {
|
46
|
+
throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
if (typeof height === 'object') {
|
50
|
+
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height));
|
51
|
+
if (missingBreakpoints.length) {
|
52
|
+
throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value));
|
58
|
+
if (missingBreakpoints.length) {
|
59
|
+
throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`;
|
60
|
+
}
|
61
|
+
});
|
62
|
+
};
|
63
|
+
exports.validateShadow = validateShadow;
|
64
|
+
//# sourceMappingURL=shadow.js.map.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["validateShadow","shadowProperties","styles","breakpoints","forEach","key","value","width","height","Object","keys","breakpoint","add","missingBreakpoints","Array","from","filter","length","join","exports"],"sourceRoot":"../../../../src","sources":["web/convert/shadow.ts"],"mappings":";;;;;;AAEO,MAAMA,cAAc,GAAGA,CAACC,gBAAuC,EAAEC,MAA2B,EAAEC,WAAwB,KAAK;EAC9H;EACAF,gBAAgB,CAACG,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGJ,MAAM,CAACG,GAAG,CAAC;IAEzB,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC3B;IACJ;IAEA,IAAID,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB,EAAE;MACtD,MAAM;QAAEE,KAAK;QAAEC;MAAO,CAAC,GAAGF,KAAqB;;MAE/C;MACA,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;QAC3BE,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC,CAACH,OAAO,CAACO,UAAU,IAAIR,WAAW,CAACS,GAAG,CAACD,UAAU,CAAC,CAAC;MACzE;;MAEA;MACA,IAAI,OAAOH,MAAM,KAAK,QAAQ,EAAE;QAC5BC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACJ,OAAO,CAACO,UAAU,IAAIR,WAAW,CAACS,GAAG,CAACD,UAAU,CAAC,CAAC;MAC1E;MAEA;IACJ;;IAEA;IACAF,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACF,OAAO,CAACO,UAAU,IAAIR,WAAW,CAACS,GAAG,CAACD,UAAU,CAAC,CAAC;EACzE,CAAC,CAAC;;EAEF;EACAV,gBAAgB,CAACG,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGJ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
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getStyle = void 0;
|
7
|
+
var _utils = require("../utils");
|
8
|
+
const SKIP_STYLES = ['borderCurve', 'elevation', 'textAlignVertical', 'includeFontPadding', 'overlayColor', 'tintColor'];
|
9
|
+
const CSS_NUMBER_KEYS = ['animationIterationCount', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'columns', 'counterIncrement', 'counterReset', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'fontWeight', 'gridArea', 'gridColumn', 'gridColumnEnd', 'gridColumnSpan', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowSpan', 'gridRowStart', 'line-clamp', 'line-height', 'opacity', 'order', 'orphans', 'tabSize', 'widows', 'zIndex', 'zoom', 'fillOpacity', 'floodOpacity', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth'];
|
10
|
+
const convertMap = {
|
11
|
+
marginHorizontal: value => ({
|
12
|
+
marginInline: value
|
13
|
+
}),
|
14
|
+
marginVertical: value => ({
|
15
|
+
marginBlock: value
|
16
|
+
}),
|
17
|
+
paddingHorizontal: value => ({
|
18
|
+
paddingInline: value
|
19
|
+
}),
|
20
|
+
paddingVertical: value => ({
|
21
|
+
paddingBlock: value
|
22
|
+
}),
|
23
|
+
writingDirection: value => ({
|
24
|
+
direction: value
|
25
|
+
}),
|
26
|
+
borderBottomEndRadius: value => ({
|
27
|
+
borderBottomRightRadius: value
|
28
|
+
}),
|
29
|
+
borderBottomStartRadius: value => ({
|
30
|
+
borderBottomLeftRadius: value
|
31
|
+
}),
|
32
|
+
borderEndColor: value => ({
|
33
|
+
borderInlineEndColor: value
|
34
|
+
}),
|
35
|
+
borderStartColor: value => ({
|
36
|
+
borderInlineStartColor: value
|
37
|
+
}),
|
38
|
+
borderTopEndRadius: value => ({
|
39
|
+
borderTopRightRadius: value
|
40
|
+
}),
|
41
|
+
borderTopStartRadius: value => ({
|
42
|
+
borderTopLeftRadius: value
|
43
|
+
}),
|
44
|
+
borderEndWidth: value => ({
|
45
|
+
borderInlineEndWidth: value
|
46
|
+
}),
|
47
|
+
borderStartWidth: value => ({
|
48
|
+
borderInlineStartWidth: value
|
49
|
+
}),
|
50
|
+
end: value => ({
|
51
|
+
right: value
|
52
|
+
}),
|
53
|
+
start: value => ({
|
54
|
+
left: value
|
55
|
+
}),
|
56
|
+
marginEnd: value => ({
|
57
|
+
marginRight: value
|
58
|
+
}),
|
59
|
+
marginStart: value => ({
|
60
|
+
marginLeft: value
|
61
|
+
}),
|
62
|
+
paddingEnd: value => ({
|
63
|
+
paddingRight: value
|
64
|
+
}),
|
65
|
+
paddingStart: value => ({
|
66
|
+
paddingLeft: value
|
67
|
+
}),
|
68
|
+
transformMatrix: value => ({
|
69
|
+
transform: `matrix(${value.join(', ')})`
|
70
|
+
}),
|
71
|
+
resizeMode: value => ({
|
72
|
+
backgroundSize: value
|
73
|
+
})
|
74
|
+
};
|
75
|
+
const convertNumber = (key, value) => {
|
76
|
+
if (typeof value === 'number') {
|
77
|
+
return CSS_NUMBER_KEYS.includes(key, value) ? value : `${value}px`;
|
78
|
+
}
|
79
|
+
return value;
|
80
|
+
};
|
81
|
+
const getStyle = (key, value) => {
|
82
|
+
if (SKIP_STYLES.includes(key)) {
|
83
|
+
return {};
|
84
|
+
}
|
85
|
+
if ((0, _utils.keyInObject)(convertMap, key)) {
|
86
|
+
return convertMap[key]?.(convertNumber(key, value)) ?? {};
|
87
|
+
}
|
88
|
+
return {
|
89
|
+
[key]: convertNumber(key, value)
|
90
|
+
};
|
91
|
+
};
|
92
|
+
exports.getStyle = getStyle;
|
93
|
+
//# sourceMappingURL=style.js.map
|
@@ -0,0 +1,2 @@
|
|
1
|
+
{"version":3,"names":["_utils","require","SKIP_STYLES","CSS_NUMBER_KEYS","convertMap","marginHorizontal","value","marginInline","marginVertical","marginBlock","paddingHorizontal","paddingInline","paddingVertical","paddingBlock","writingDirection","direction","borderBottomEndRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomLeftRadius","borderEndColor","borderInlineEndColor","borderStartColor","borderInlineStartColor","borderTopEndRadius","borderTopRightRadius","borderTopStartRadius","borderTopLeftRadius","borderEndWidth","borderInlineEndWidth","borderStartWidth","borderInlineStartWidth","end","right","start","left","marginEnd","marginRight","marginStart","marginLeft","paddingEnd","paddingRight","paddingStart","paddingLeft","transformMatrix","transform","join","resizeMode","backgroundSize","convertNumber","key","includes","getStyle","keyInObject","exports"],"sourceRoot":"../../../../src","sources":["web/convert/style.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,MAAMC,WAAW,GAAG,CAChB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,CACd;AACD,MAAMC,eAAe,GAAG,CACpB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,MAAM,EACN,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,aAAa,CAChB;AACD,MAAMC,UAAU,GAAG;EACfC,gBAAgB,EAAGC,KAAK,KAAM;IAC1BC,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C,CAAC;EACFkC,UAAU,EAAGlC,KAAK,KAAM;IACpBmC,YAAY,EAAEnC;EAClB,CAAC,CAAC;EACFoC,YAAY,EAAGpC,KAAK,KAAM;IACtBqC,WAAW,EAAErC;EACjB,CAAC,CAAC;EACFsC,eAAe,EAAGtC,KAAK,KAAM;IACzBuC,SAAS,EAAE,UAAUvC,KAAK,CAACwC,IAAI,CAAC,IAAI,CAAC;EACzC,CAAC,CAAC;EACFC,UAAU,EAAGzC,KAAK,KAAM;IACpB0C,cAAc,EAAE1C;EACpB,CAAC;AACL,CAAC;AACD,MAAM2C,aAAa,GAAGA,CAACC,GAAG,EAAE5C,KAAK,KAAK;EAClC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOH,eAAe,CAACgD,QAAQ,CAACD,GAAG,EAAE5C,KAAK,CAAC,GAAGA,KAAK,GAAG,GAAGA,KAAK,IAAI;EACtE;EACA,OAAOA,KAAK;AAChB,CAAC;AACM,MAAM8C,QAAQ,GAAGA,CAACF,GAAG,EAAE5C,KAAK,KAAK;EACpC,IAAIJ,WAAW,CAACiD,QAAQ,CAACD,GAAG,CAAC,EAAE;IAC3B,OAAO,CAAC,CAAC;EACb;EACA,IAAI,IAAAG,kBAAW,EAACjD,UAAU,EAAE8C,GAAG,CAAC,EAAE;IAC9B,OAAO9C,UAAU,CAAC8C,GAAG,CAAC,GAAGD,aAAa,CAACC,GAAG,EAAE5C,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;EAC7D;EACA,OAAO;IACH,CAAC4C,GAAG,GAAGD,aAAa,CAACC,GAAG,EAAE5C,KAAK;EACnC,CAAC;AACL,CAAC;AAACgD,OAAA,CAAAF,QAAA,GAAAA,QAAA","ignoreList":[]}
|
2
|
+
:[]}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getTextShadowStyle = void 0;
|
7
|
+
var _utils = require("../utils");
|
8
|
+
var _shadow = require("./shadow");
|
9
|
+
var _types = require("./types");
|
10
|
+
var _utils2 = require("./utils");
|
11
|
+
const createTextShadowValue = style => {
|
12
|
+
const {
|
13
|
+
textShadowColor,
|
14
|
+
textShadowOffset,
|
15
|
+
textShadowRadius
|
16
|
+
} = style;
|
17
|
+
const offsetX = (0, _utils2.normalizeNumericValue)(textShadowOffset.width);
|
18
|
+
const offsetY = (0, _utils2.normalizeNumericValue)(textShadowOffset.height);
|
19
|
+
const radius = (0, _utils2.normalizeNumericValue)(textShadowRadius);
|
20
|
+
const color = (0, _utils2.normalizeColor)(textShadowColor);
|
21
|
+
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
22
|
+
};
|
23
|
+
const getTextShadowStyle = styles => {
|
24
|
+
const missingStyles = _types.TEXT_SHADOW_STYLES.filter(key => !(key in styles));
|
25
|
+
if (missingStyles.length) {
|
26
|
+
(0, _utils.warn)(`can't apply text shadow as you miss these properties: ${missingStyles.join(', ')}`);
|
27
|
+
return {};
|
28
|
+
}
|
29
|
+
const breakpointsSet = new Set();
|
30
|
+
try {
|
31
|
+
(0, _shadow.validateShadow)(_types.TEXT_SHADOW_STYLES, styles, breakpointsSet);
|
32
|
+
} catch (error) {
|
33
|
+
if (typeof error === 'string') {
|
34
|
+
(0, _utils.warn)(error);
|
35
|
+
}
|
36
|
+
return {};
|
37
|
+
}
|
38
|
+
const breakpoints = Array.from(breakpointsSet);
|
39
|
+
|
40
|
+
// If no breakpoints were used return styles without media queries
|
41
|
+
if (breakpoints.length === 0) {
|
42
|
+
return {
|
43
|
+
textShadow: createTextShadowValue(styles)
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
47
|
+
// Create textShadow for each breakpoint
|
48
|
+
const breakpointStyles = breakpoints.map(breakpoint => {
|
49
|
+
const color = (0, _utils2.extractShadowValue)('textShadowColor', breakpoint, styles);
|
50
|
+
const {
|
51
|
+
width,
|
52
|
+
height
|
53
|
+
} = (0, _utils2.extractShadowValue)('textShadowOffset', breakpoint, styles);
|
54
|
+
const radius = (0, _utils2.extractShadowValue)('textShadowRadius', breakpoint, styles);
|
55
|
+
return {
|
56
|
+
[breakpoint]: {
|
57
|
+
textShadow: createTextShadowValue({
|
58
|
+
textShadowColor: color,
|
59
|
+
textShadowOffset: {
|
60
|
+
width,
|
61
|
+
height
|
62
|
+
},
|
63
|
+
textShadowRadius: radius
|
64
|
+
})
|
65
|
+
}
|
66
|
+
};
|
67
|
+
});
|
68
|
+
|
69
|
+
// Merge all breakpoints styles into one
|
70
|
+
return (0, _utils.deepMergeObjects)(...breakpointStyles);
|
71
|
+
};
|
72
|
+
exports.getTextShadowStyle = getTextShadowStyle;
|
73
|
+
//# sourceMappingURL=textShadow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_utils","require","_shadow","_types","_utils2","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","normalizeNumericValue","width","offsetY","height","radius","color","normalizeColor","getTextShadowStyle","styles","missingStyles","TEXT_SHADOW_STYLES","filter","key","length","warn","join","breakpointsSet","Set","validateShadow","error","breakpoints","Array","from","textShadow","breakpointStyles","map","breakpoint","extractShadowValue","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/textShadow.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAG,IAAAC,6BAAqB,EAACH,gBAAgB,CAACI,KAAK,CAAC;EAC7D,MAAMC,OAAO,GAAG,IAAAF,6BAAqB,EAACH,gBAAgB,CAACM,MAAM,CAAC;EAC9D,MAAMC,MA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,CAAC;IACpF,MAAMJ,MAAM,GAAG,IAAAuB,0BAAkB,EAAC,kBAAkB,EAAED,UAAU,EAAElB,MAAM,CAAC;IAEzE,OAAO;MACH,CAACkB,UAAU,GAAG;QACVH,UAAU,EAAE7B,qBAAqB,CAAC;UAC9BE,eAAe,EAAES,KAAK;UACtBR,gBAAgB,EAAE;YACdI,KAAK;YACLE;UACJ,CAAC;UACDL,gBAAgB,EAAEM;QACtB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAO,IAAAwB,uBAAgB,EAAC,GAAGJ,gBAAgB,CAAC;AAChD,CAAC;AAAAK,OAAA,CAAAtB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getTransformStyle = void 0;
|
7
|
+
var _utils = require("../utils");
|
8
|
+
var _utils2 = require("./utils");
|
9
|
+
const normalizeTransform = (key, value) => {
|
10
|
+
if (key.includes('scale')) {
|
11
|
+
return value;
|
12
|
+
}
|
13
|
+
if (typeof value === 'number') {
|
14
|
+
return (0, _utils2.normalizeNumericValue)(value);
|
15
|
+
}
|
16
|
+
return value;
|
17
|
+
};
|
18
|
+
const createTransformValue = transforms => transforms.map(transform => {
|
19
|
+
const [key] = Object.keys(transform);
|
20
|
+
if (!key) {
|
21
|
+
return undefined;
|
22
|
+
}
|
23
|
+
const value = transform[key];
|
24
|
+
switch (key) {
|
25
|
+
case 'matrix':
|
26
|
+
case 'matrix3d':
|
27
|
+
return `${key}(${value.join(',')})`;
|
28
|
+
default:
|
29
|
+
return `${key}(${normalizeTransform(key, value)})`;
|
30
|
+
}
|
31
|
+
}).filter(Boolean).join(' ');
|
32
|
+
const getTransformStyle = transforms => {
|
33
|
+
const breakpoints = new Set();
|
34
|
+
const normalTransforms = [];
|
35
|
+
transforms.forEach(transform => {
|
36
|
+
const [property] = Object.keys(transform);
|
37
|
+
if (!property) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
const value = transform[property];
|
41
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
42
|
+
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
normalTransforms.push(transform);
|
46
|
+
});
|
47
|
+
const breakpointTransforms = Array.from(breakpoints).flatMap(breakpoint => {
|
48
|
+
const transformsPerBreakpoint = transforms.flatMap(transform => {
|
49
|
+
const [property] = Object.keys(transform);
|
50
|
+
if (!property) {
|
51
|
+
return [];
|
52
|
+
}
|
53
|
+
const value = transform[property];
|
54
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
55
|
+
return (0, _utils.keyInObject)(value, breakpoint) ? [{
|
56
|
+
[property]: value[breakpoint]
|
57
|
+
}] : [];
|
58
|
+
}
|
59
|
+
return [];
|
60
|
+
});
|
61
|
+
return [{
|
62
|
+
[breakpoint]: {
|
63
|
+
transform: createTransformValue(transformsPerBreakpoint)
|
64
|
+
}
|
65
|
+
}];
|
66
|
+
});
|
67
|
+
return (0, _utils.deepMergeObjects)({
|
68
|
+
transform: createTransformValue(normalTransforms)
|
69
|
+
}, ...breakpointTransforms);
|
70
|
+
};
|
71
|
+
exports.getTransformStyle = getTransformStyle;
|
72
|
+
//# sourceMappingURL=transform.js.map
|
@@ -0,0 +1,2 @@
|
|
1
|
+
{"version":3,"names":["_utils","require","_utils2","normalizeTransform","key","value","includes","normalizeNumericValue","createTransformValue","transforms","map","transform","Object","keys","undefined","join","filter","Boolean","getTransformStyle","breakpoints","Set","normalTransforms","forEach","property","Array","isArray","breakpoint","add","push","breakpointTransforms","from","flatMap","transformsPerBreakpoint","keyInObject","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/transform.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,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defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.TEXT_SHADOW_STYLES = exports.BOX_SHADOW_STYLES = void 0;
|
7
|
+
const TEXT_SHADOW_STYLES = exports.TEXT_SHADOW_STYLES = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
|
8
|
+
const BOX_SHADOW_STYLES = exports.BOX_SHADOW_STYLES = ['shadowColor', 'shadowRadius', 'shadowOpacity', 'shadowOffset'];
|
9
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["TEXT_SHADOW_STYLES","exports","BOX_SHADOW_STYLES"],"sourceRoot":"../../../../src","sources":["web/convert/types.ts"],"mappings":";;;;;;AAKO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAU;AAI/F,MAAME,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAU","ignoreList":[]}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.normalizeNumericValue = exports.normalizeColor = exports.isTransform = exports.isTextShadow = exports.isBoxShadow = exports.extractShadowValue = void 0;
|
7
|
+
var _normalizeColors = _interopRequireDefault(require("@react-native/normalize-colors"));
|
8
|
+
var _types = require("./types");
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
+
// based on react-native-web normalizer
|
11
|
+
// https://github.com/necolas/react-native-web
|
12
|
+
|
13
|
+
const isTransform = (key, value) => key === 'transform' && Array.isArray(value);
|
14
|
+
exports.isTransform = isTransform;
|
15
|
+
const isTextShadow = key => _types.TEXT_SHADOW_STYLES.includes(key);
|
16
|
+
exports.isTextShadow = isTextShadow;
|
17
|
+
const isBoxShadow = key => _types.BOX_SHADOW_STYLES.includes(key);
|
18
|
+
exports.isBoxShadow = isBoxShadow;
|
19
|
+
const normalizeNumericValue = value => value ? `${value}px` : value;
|
20
|
+
exports.normalizeNumericValue = normalizeNumericValue;
|
21
|
+
const normalizeColor = (color, opacity = 1) => {
|
22
|
+
// If the opacity is 1 there's no need to normalize the color
|
23
|
+
if (opacity === 1) {
|
24
|
+
return color;
|
25
|
+
}
|
26
|
+
const integer = (0, _normalizeColors.default)(color);
|
27
|
+
// If the color is an unknown format, the return value is null
|
28
|
+
if (integer === null) {
|
29
|
+
return color;
|
30
|
+
}
|
31
|
+
const hex = integer.toString(16).padStart(8, '0');
|
32
|
+
if (hex.length === 8) {
|
33
|
+
const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
|
34
|
+
return `rgba(${r},${g},${b},${a / 255 * opacity})`;
|
35
|
+
}
|
36
|
+
return color;
|
37
|
+
};
|
38
|
+
exports.normalizeColor = normalizeColor;
|
39
|
+
const extractShadowValue = (key, breakpoint, styles) => {
|
40
|
+
const value = styles[key];
|
41
|
+
if (key === 'textShadowOffset' || key === 'shadowOffset') {
|
42
|
+
const {
|
43
|
+
width,
|
44
|
+
height
|
45
|
+
} = value;
|
46
|
+
return {
|
47
|
+
width: typeof width === 'object' ? width[breakpoint] : width,
|
48
|
+
height: typeof height === 'object' ? height[breakpoint] : height
|
49
|
+
};
|
50
|
+
}
|
51
|
+
return typeof value === 'object' ? value[breakpoint] : value;
|
52
|
+
};
|
53
|
+
exports.extractShadowValue = extractShadowValue;
|
54
|
+
//# sourceMappingURL=utils.js.mapp
|
@@ -0,0 +1,2 @@
|
|
1
|
+
{"version":3,"names":["_normalizeColors","_interopRequireDefault","require","_types","e","__esModule","default","isTransform","key","value","Array","isArray","exports","isTextShadow","TEXT_SHADOW_STYLES","includes","isBoxShadow","BOX_SHADOW_STYLES","normalizeNumericValue","normalizeColor","color","opacity","integer","normalizeColors","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.js"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAgE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAHhE;AACA;;AAGO,MAAMG,WAAW,GAAGA,CAACC,GAAG,EAAEC,KAAK,KAAKD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAACG,OAAA,CAAAL,WAAA,GAAAA,WAAA;AAChF,MAAMM,YAAY,GAAIL,GAAG,IAAKM,yBAAkB,CAACC,QAAQ,CAACP,GAAG,CAAC;AAACI,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAC/D,MAAMG,WAAW,GAAIR,GAAG,IAAKS,wBAAiB,CAACF,QAAQ,CAACP,GAAG,CAAC;AAACI,OAAA,CAAAI,WAAA,GAAAA,WAAA;AAC7D,MAAME,qBAAqB,GAAIT,KAAK,IAAKA,KAAK,GAAG,GAAGA,KAAK,IAAI,GAAGA,KAAK;AAACG,OAAA,CAAAM,qBAAA,GAAAA,qBAAA;AACtE,MAAMC,cAAc,GAAGA,CAACC,KAAK,EAAEC,OAAO,GAAG,CAAC,KAAK;EAClD;EACA,IAAIA,OAAO,KAAK,CAAC,EAAE;IACf,OAAOD,KAAK;EAChB;EACA,MAAME,OAAO,GAAG,IAAAC,wBAAe,EAACH,KAAK,CAAC;EACtC;EACA,IAAIE,OAAO,KAAK,IAAI,EAAE;IAClB,OAAOF,KAAK;EAChB;EACA,MAAMI,GAAG,GAAGF,OAAO,CAACG,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,G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
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.create = void 0;
|
7
|
+
var _utils = require("./utils");
|
8
|
+
var _runtime = require("./runtime");
|
9
|
+
var _variants = require("./variants");
|
10
|
+
const create = stylesheet => {
|
11
|
+
const computedStylesheet = typeof stylesheet === 'function' ? stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime) : stylesheet;
|
12
|
+
const selectedVariants = new Map();
|
13
|
+
const copyVariants = () => Object.fromEntries(selectedVariants.entries());
|
14
|
+
const addSecrets = (value, key, args) => (0, _utils.assignSecrets)(value, {
|
15
|
+
__uni__key: key,
|
16
|
+
__uni__refs: new Set(),
|
17
|
+
__uni__stylesheet: stylesheet,
|
18
|
+
__uni__args: args,
|
19
|
+
__uni__variants: copyVariants()
|
20
|
+
});
|
21
|
+
const styles = (0, _utils.reduceObject)(computedStylesheet, (value, _key) => {
|
22
|
+
const key = String(_key);
|
23
|
+
if (typeof value === 'function') {
|
24
|
+
const dynamicStyle = (...args) => {
|
25
|
+
const result = value(...args);
|
26
|
+
const variants = Object.fromEntries((0, _variants.getVariants)({
|
27
|
+
[key]: result
|
28
|
+
}, copyVariants()));
|
29
|
+
const resultWithVariants = (0, _utils.deepMergeObjects)(result, variants[key] ?? {});
|
30
|
+
|
31
|
+
// Add secrets to result of dynamic styles function
|
32
|
+
return addSecrets((0, _utils.getStyles)(resultWithVariants), key, args);
|
33
|
+
};
|
34
|
+
|
35
|
+
// Add secrets to dynamic styles function
|
36
|
+
return addSecrets(dynamicStyle, key);
|
37
|
+
}
|
38
|
+
|
39
|
+
// Add secrets to static styles
|
40
|
+
return addSecrets((0, _utils.getStyles)(value), key);
|
41
|
+
});
|
42
|
+
|
43
|
+
// Inject useVariants hook to styles
|
44
|
+
(0, _variants.createUseVariants)(styles, newVariants => Object.entries(newVariants).forEach(([key, value]) => selectedVariants.set(key, value)));
|
45
|
+
return styles;
|
46
|
+
};
|
47
|
+
exports.create = create;
|
48
|
+
//# sourceMappingURL=create.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_utils","require","_runtime","_variants","create","stylesheet","computedStylesheet","UnistylesRuntime","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","assignSecrets","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","reduceObject","_key","String","dynamicStyle","result","variants","getVariants","resultWithVariants","deepMergeObjects","getStyles","createUseVariants","newVariants","forEach","set","exports"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEO,MAAMG,MAAM,GAAIC,UAAiD,IAAK;EACzE,MAAMC,kBAAkB,GAAG,OAAOD,UAAU,KAAK,UAAU,GACrDA,UAAU,CAACE,yBAAgB,CAACC,KAAK,EAAED,yBAAgB,CAACE,WAAW,CAAC,GAChEJ,UAAU;EAChB,MAAMK,gBAAgB,GAAG,IAAIC,GAAG,CAAc,CAAC;EAE/C,MAAMC,YAAY,GAAGA,CAAA,KAAMC,MAAM,CAACC,WAAW,CAACJ,gBAAgB,CAACK,OAAO,CAAC,CAAC,CAAC;EACzE,MAAMC,UAAU,GAAGA,CAACC,KAAU,EAAEC,GAAW,EAAEC,IAAiB,KAAK,IAAAC,oBAAa,EAACH,KAAK,EAAE;IACpFI,UAAU,EAAEH,GAAG;IACfI,WAAW,EAAE,IAAIC,GAAG,CAAC,CAAC;IACtBC,iBAAiB,EAAEnB,UAAU;IAC7BoB,WAAW,EAAEN,IAAI;IACjBO,eAAe,EAAEd,YAAY,CAAC;EAClC,CAAC,CAAC;EAEF,MAAMe,MAAM,GAAG,IAAAC,mBAAY,EAACtB,kBAAkB,EAAE,CAACW,KAAK,EAAEY,IAAI,KAAK;IAC7D,MAAMX,GAAG,GAAGY,MAAM,CAACD,IAAI,CAAC;IAExB,IAAI,OAAOZ,KAAK,KAAK,UAAU,EAAE;MAC7B,MAAMc,YAAY,GAAGA,CAAC,GAAGZ,IAAgB,KAAK;QAC1C,MAAMa,MAAM,GAAGf,KAAK,CAAC,GAAGE,IAAI,CAAC;QAC7B,MAAMc,QAAQ,GAAGpB,MAAM,CAACC,WAAW,CAAC,IAAAoB,qBAAW,EAAC;UAAE,CAAChB,GAAG,GAAGc;QAAO,CAAC,EAAuCpB,YAAY,CAAC,CAAC,CAAC,CAAC;QACxH,MAAMuB,kBAAkB,GAAG,IAAAC,uBAAgB,EAACJ,MAAM,EAAEC,QAAQ,CAACf,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;;QAExE;QACA,OAAOF,UAAU,CAAC,IAAAqB,gBAAS,EAACF,kBAAkB,CAAC,EAAEjB,GAAG,EAAEC,IAAI,CAAC;MAC/D,CAAC;;MAED;MACA,OAAOH,UAAU,CAACe,YAAY,EAAEb,GAAG,CAAC;IACxC;;IAEA;IACA,OAAOF,UAAU,CAAC,IAAAqB,gBAAS,EAACpB,KAAK,CAAC,EAAEC,GAAG,CAAC;EAC5C,CAAC,CAAsC;;EAEvC;EACA,IAAAoB,2BAAiB,EAACX,MAAM,EAAEY,WAAW,IAAI1B,MAAM,CAACE,OAAO,CAACwB,WAAW,CAAC,CAACC,OAAO,CAAC,CAAC,CAACtB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAAC+B,GAAG,CAACvB,GAAG,EAAED,KAAK,CAAC,CAAC,CAAC;EAEjI,OAAOU,MAAM;AACjB,CAAC;AAAAe,OAAA,CAAAtC,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _exportNames = {
|
7
|
+
StyleSheet: true,
|
8
|
+
getSSRUnistyles: true,
|
9
|
+
UnistylesRuntime: true,
|
10
|
+
UnistylesShadowRegistry: true
|
11
|
+
};
|
12
|
+
exports.StyleSheet = void 0;
|
13
|
+
Object.defineProperty(exports, "UnistylesRuntime", {
|
14
|
+
enumerable: true,
|
15
|
+
get: function () {
|
16
|
+
return _runtime.UnistylesRuntime;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
Object.defineProperty(exports, "UnistylesShadowRegistry", {
|
20
|
+
enumerable: true,
|
21
|
+
get: function () {
|
22
|
+
return _shadowRegistry.UnistylesShadowRegistry;
|
23
|
+
}
|
24
|
+
});
|
25
|
+
exports.getSSRUnistyles = void 0;
|
26
|
+
var _create = require("./create");
|
27
|
+
var _state = require("./state");
|
28
|
+
var _utils = require("./utils");
|
29
|
+
var _runtime = require("./runtime");
|
30
|
+
var _shadowRegistry = require("./shadowRegistry");
|
31
|
+
var _mock = require("./mock");
|
32
|
+
Object.keys(_mock).forEach(function (key) {
|
33
|
+
if (key === "default" || key === "__esModule") return;
|
34
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
35
|
+
if (key in exports && exports[key] === _mock[key]) return;
|
36
|
+
Object.defineProperty(exports, key, {
|
37
|
+
enumerable: true,
|
38
|
+
get: function () {
|
39
|
+
return _mock[key];
|
40
|
+
}
|
41
|
+
});
|
42
|
+
});
|
43
|
+
const StyleSheet = exports.StyleSheet = {
|
44
|
+
configure: _state.UnistylesState.init,
|
45
|
+
create: _create.create,
|
46
|
+
absoluteFill: {
|
47
|
+
position: 'absolute',
|
48
|
+
left: 0,
|
49
|
+
top: 0,
|
50
|
+
right: 0,
|
51
|
+
bottom: 0
|
52
|
+
},
|
53
|
+
compose: (a, b) => (0, _utils.deepMergeObjects)(a, b),
|
54
|
+
flatten: (...styles) => (0, _utils.deepMergeObjects)(...styles),
|
55
|
+
hairlineWidth: 1
|
56
|
+
};
|
57
|
+
// TODO: Work on SSR
|
58
|
+
const getSSRUnistyles = () => [];
|
59
|
+
exports.getSSRUnistyles = getSSRUnistyles;
|
60
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_create","require","_state","_utils","_runtime","_shadowRegistry","_mock","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","StyleSheet","configure","UnistylesState","init","create","absoluteFill","position","left","top","right","bottom","compose","a","b","deepMergeObjects","flatten","styles","hairlineWidth","getSSRUnistyles"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAiBA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAjBO,MAAMS,UAAU,GAAAJ,OAAA,CAAAI,UAAA,GAAG;EACtBC,SAAS,EAAEC,qBAAc,CAACC,IAAI;EAC9BC,MAAM,EAANA,cAAM;EACNC,YAAY,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,OAAO,EAAEA,CAACC,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