react-native-unistyles 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +38 -30
- package/lib/commonjs/UnistylesTheme.js +21 -0
- package/lib/commonjs/UnistylesTheme.js.map +1 -0
- package/lib/commonjs/createUnistyles.js +57 -0
- package/lib/commonjs/createUnistyles.js.map +1 -0
- package/lib/commonjs/hooks/index.js +3 -24
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useDimensions.js +10 -0
- package/lib/commonjs/hooks/useDimensions.js.map +1 -0
- package/lib/commonjs/hooks/useDimensions.web.js +34 -0
- package/lib/commonjs/hooks/useDimensions.web.js.map +1 -0
- package/lib/commonjs/index.js +6 -63
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/index.js +0 -11
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/mediaQueries.js +2 -0
- package/lib/commonjs/types/{unistyles.js.map → mediaQueries.js.map} +1 -1
- package/lib/commonjs/utils/breakpoints.js +122 -20
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/common.js +20 -0
- package/lib/commonjs/utils/common.js.map +1 -0
- package/lib/commonjs/utils/index.js +54 -22
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mediaQueries.js +189 -0
- package/lib/commonjs/utils/mediaQueries.js.map +1 -0
- package/lib/{module/types/common.js.map → commonjs/utils/module.d.js.map} +1 -1
- package/lib/commonjs/utils/normalizeStyles.js +10 -0
- package/lib/commonjs/utils/normalizeStyles.js.map +1 -0
- package/lib/commonjs/{normalizer/normalizeStyle.js → utils/normalizeStyles.web.js} +5 -5
- package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -0
- package/lib/commonjs/{normalizer → utils}/normalizer.js +3 -2
- package/lib/commonjs/utils/normalizer.js.map +1 -0
- package/lib/commonjs/utils/styles.js +72 -45
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/module/UnistylesTheme.js +12 -0
- package/lib/module/UnistylesTheme.js.map +1 -0
- package/lib/module/createUnistyles.js +50 -0
- package/lib/module/createUnistyles.js.map +1 -0
- package/lib/module/hooks/index.js +1 -4
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useDimensions.js +3 -0
- package/lib/module/hooks/useDimensions.js.map +1 -0
- package/lib/module/hooks/useDimensions.web.js +27 -0
- package/lib/module/hooks/useDimensions.web.js.map +1 -0
- package/lib/module/index.js +2 -30
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.js +0 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/mediaQueries.js +2 -0
- package/lib/{commonjs/types/stylesheet.js.map → module/types/mediaQueries.js.map} +1 -1
- package/lib/module/utils/breakpoints.js +120 -19
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/common.js +12 -0
- package/lib/module/utils/common.js.map +1 -0
- package/lib/module/utils/index.js +6 -6
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mediaQueries.js +176 -0
- package/lib/module/utils/mediaQueries.js.map +1 -0
- package/lib/{commonjs/types/variants.js.map → module/utils/module.d.js.map} +1 -1
- package/lib/module/utils/normalizeStyles.js +3 -0
- package/lib/module/utils/normalizeStyles.js.map +1 -0
- package/lib/module/{normalizer/normalizeStyle.js → utils/normalizeStyles.web.js} +3 -3
- package/lib/module/utils/normalizeStyles.web.js.map +1 -0
- package/lib/module/{normalizer → utils}/normalizer.js +3 -2
- package/lib/module/utils/normalizer.js.map +1 -0
- package/lib/module/utils/styles.js +72 -44
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/typescript/examples/expo/src/App.d.ts +3 -0
- package/lib/typescript/examples/expo/src/App.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +7 -0
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/index.d.ts +9 -0
- package/lib/typescript/examples/expo/src/examples/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/index.d.ts +2 -0
- package/lib/typescript/examples/expo/src/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +8 -0
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/index.d.ts +46 -0
- package/lib/typescript/examples/expo/src/styles/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/theme.d.ts +24 -0
- package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +1 -0
- package/lib/typescript/src/UnistylesTheme.d.ts +9 -0
- package/lib/typescript/src/UnistylesTheme.d.ts.map +1 -0
- package/lib/typescript/src/createUnistyles.d.ts +10 -0
- package/lib/typescript/src/createUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +1 -4
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useDimensions.d.ts +3 -0
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +3 -0
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -76
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +17 -25
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +25 -11
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +2 -7
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +8 -0
- package/lib/typescript/src/types/mediaQueries.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +62 -2
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/common.d.ts +7 -0
- package/lib/typescript/src/utils/common.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +6 -7
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +130 -0
- package/lib/typescript/src/utils/mediaQueries.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizeStyles.d.ts +2 -0
- package/lib/typescript/src/utils/normalizeStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +5 -0
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +49 -3
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/package.json +25 -46
- package/src/UnistylesTheme.tsx +17 -0
- package/src/__tests__/createUnistyles.spec.tsx +192 -0
- package/src/createUnistyles.ts +70 -0
- package/src/hooks/index.ts +1 -4
- package/src/hooks/useDimensions.ts +4 -0
- package/src/hooks/useDimensions.web.ts +34 -0
- package/src/index.ts +2 -50
- package/src/types/breakpoints.ts +33 -58
- package/src/types/core.ts +36 -11
- package/src/types/index.ts +7 -12
- package/src/types/mediaQueries.ts +10 -0
- package/src/utils/breakpoints.ts +124 -28
- package/src/utils/common.ts +14 -0
- package/src/utils/index.ts +13 -7
- package/src/utils/mediaQueries.ts +201 -0
- package/src/utils/normalizeStyles.ts +2 -0
- package/src/{normalizer/normalizeStyle.ts → utils/normalizeStyles.web.ts} +3 -3
- package/src/{normalizer → utils}/normalizer.ts +4 -5
- package/src/utils/styles.ts +102 -54
- package/android/CMakeLists.txt +0 -27
- package/android/build.gradle +0 -75
- package/android/src/main/cxx/cpp-adapter.cpp +0 -132
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +0 -189
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +0 -18
- package/cxx/UnistylesRuntime.cpp +0 -318
- package/cxx/UnistylesRuntime.h +0 -74
- package/ios/UnistylesHelpers.h +0 -3
- package/ios/UnistylesHelpers.mm +0 -5
- package/ios/UnistylesModule.h +0 -16
- package/ios/UnistylesModule.mm +0 -138
- package/ios/platform/Platform_iOS.h +0 -21
- package/ios/platform/Platform_iOS.mm +0 -132
- package/ios/platform/Platform_macOS.h +0 -20
- package/ios/platform/Platform_macOS.mm +0 -83
- package/lib/commonjs/common.js +0 -60
- package/lib/commonjs/common.js.map +0 -1
- package/lib/commonjs/core/UnistyleRegistry.js +0 -94
- package/lib/commonjs/core/UnistyleRegistry.js.map +0 -1
- package/lib/commonjs/core/Unistyles.js +0 -32
- package/lib/commonjs/core/Unistyles.js.map +0 -1
- package/lib/commonjs/core/UnistylesModule.js +0 -197
- package/lib/commonjs/core/UnistylesModule.js.map +0 -1
- package/lib/commonjs/core/UnistylesModule.native.js +0 -9
- package/lib/commonjs/core/UnistylesModule.native.js.map +0 -1
- package/lib/commonjs/core/UnistylesRuntime.js +0 -140
- package/lib/commonjs/core/UnistylesRuntime.js.map +0 -1
- package/lib/commonjs/core/index.js +0 -13
- package/lib/commonjs/core/index.js.map +0 -1
- package/lib/commonjs/createStyleSheet.js +0 -14
- package/lib/commonjs/createStyleSheet.js.map +0 -1
- package/lib/commonjs/global.js +0 -2
- package/lib/commonjs/global.js.map +0 -1
- package/lib/commonjs/hooks/useCSS.js +0 -44
- package/lib/commonjs/hooks/useCSS.js.map +0 -1
- package/lib/commonjs/hooks/useCSS.native.js +0 -9
- package/lib/commonjs/hooks/useCSS.native.js.map +0 -1
- package/lib/commonjs/hooks/useInitialTheme.js +0 -17
- package/lib/commonjs/hooks/useInitialTheme.js.map +0 -1
- package/lib/commonjs/hooks/useUnistyles.js +0 -64
- package/lib/commonjs/hooks/useUnistyles.js.map +0 -1
- package/lib/commonjs/hooks/useVariants.js +0 -14
- package/lib/commonjs/hooks/useVariants.js.map +0 -1
- package/lib/commonjs/normalizer/index.js +0 -32
- package/lib/commonjs/normalizer/index.js.map +0 -1
- package/lib/commonjs/normalizer/module.d.js.map +0 -1
- package/lib/commonjs/normalizer/normalizeStyle.js.map +0 -1
- package/lib/commonjs/normalizer/normalizer.js.map +0 -1
- package/lib/commonjs/normalizer/normalizer.macos.js +0 -3
- package/lib/commonjs/normalizer/normalizer.macos.js.map +0 -1
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +0 -14
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +0 -1
- package/lib/commonjs/plugins/index.js +0 -20
- package/lib/commonjs/plugins/index.js.map +0 -1
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +0 -12
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +0 -1
- package/lib/commonjs/types/common.js +0 -2
- package/lib/commonjs/types/common.js.map +0 -1
- package/lib/commonjs/types/plugin.js +0 -6
- package/lib/commonjs/types/plugin.js.map +0 -1
- package/lib/commonjs/types/stylesheet.js +0 -6
- package/lib/commonjs/types/unistyles.js +0 -6
- package/lib/commonjs/types/variants.js +0 -2
- package/lib/commonjs/useStyles.js +0 -47
- package/lib/commonjs/useStyles.js.map +0 -1
- package/lib/commonjs/utils/cssMediaQuery.js +0 -244
- package/lib/commonjs/utils/cssMediaQuery.js.map +0 -1
- package/lib/commonjs/utils/generateId.js +0 -15
- package/lib/commonjs/utils/generateId.js.map +0 -1
- package/lib/commonjs/utils/hash32.js +0 -43
- package/lib/commonjs/utils/hash32.js.map +0 -1
- package/lib/commonjs/utils/mq.js +0 -38
- package/lib/commonjs/utils/mq.js.map +0 -1
- package/lib/commonjs/utils/mqParser.js +0 -89
- package/lib/commonjs/utils/mqParser.js.map +0 -1
- package/lib/commonjs/utils/withPlugins.js +0 -15
- package/lib/commonjs/utils/withPlugins.js.map +0 -1
- package/lib/module/common.js +0 -53
- package/lib/module/common.js.map +0 -1
- package/lib/module/core/UnistyleRegistry.js +0 -87
- package/lib/module/core/UnistyleRegistry.js.map +0 -1
- package/lib/module/core/Unistyles.js +0 -26
- package/lib/module/core/Unistyles.js.map +0 -1
- package/lib/module/core/UnistylesModule.js +0 -190
- package/lib/module/core/UnistylesModule.js.map +0 -1
- package/lib/module/core/UnistylesModule.native.js +0 -3
- package/lib/module/core/UnistylesModule.native.js.map +0 -1
- package/lib/module/core/UnistylesRuntime.js +0 -133
- package/lib/module/core/UnistylesRuntime.js.map +0 -1
- package/lib/module/core/index.js +0 -2
- package/lib/module/core/index.js.map +0 -1
- package/lib/module/createStyleSheet.js +0 -7
- package/lib/module/createStyleSheet.js.map +0 -1
- package/lib/module/global.js +0 -2
- package/lib/module/global.js.map +0 -1
- package/lib/module/hooks/useCSS.js +0 -37
- package/lib/module/hooks/useCSS.js.map +0 -1
- package/lib/module/hooks/useCSS.native.js +0 -2
- package/lib/module/hooks/useCSS.native.js.map +0 -1
- package/lib/module/hooks/useInitialTheme.js +0 -10
- package/lib/module/hooks/useInitialTheme.js.map +0 -1
- package/lib/module/hooks/useUnistyles.js +0 -57
- package/lib/module/hooks/useUnistyles.js.map +0 -1
- package/lib/module/hooks/useVariants.js +0 -7
- package/lib/module/hooks/useVariants.js.map +0 -1
- package/lib/module/normalizer/index.js +0 -3
- package/lib/module/normalizer/index.js.map +0 -1
- package/lib/module/normalizer/module.d.js.map +0 -1
- package/lib/module/normalizer/normalizeStyle.js.map +0 -1
- package/lib/module/normalizer/normalizer.js.map +0 -1
- package/lib/module/normalizer/normalizer.macos.js +0 -2
- package/lib/module/normalizer/normalizer.macos.js.map +0 -1
- package/lib/module/plugins/cssMediaQueriesPlugin.js +0 -7
- package/lib/module/plugins/cssMediaQueriesPlugin.js.map +0 -1
- package/lib/module/plugins/index.js +0 -3
- package/lib/module/plugins/index.js.map +0 -1
- package/lib/module/plugins/normalizeWebStylesPlugin.js +0 -6
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +0 -1
- package/lib/module/types/common.js +0 -2
- package/lib/module/types/plugin.js +0 -2
- package/lib/module/types/plugin.js.map +0 -1
- package/lib/module/types/stylesheet.js +0 -2
- package/lib/module/types/stylesheet.js.map +0 -1
- package/lib/module/types/unistyles.js +0 -2
- package/lib/module/types/unistyles.js.map +0 -1
- package/lib/module/types/variants.js +0 -2
- package/lib/module/types/variants.js.map +0 -1
- package/lib/module/useStyles.js +0 -40
- package/lib/module/useStyles.js.map +0 -1
- package/lib/module/utils/cssMediaQuery.js +0 -237
- package/lib/module/utils/cssMediaQuery.js.map +0 -1
- package/lib/module/utils/generateId.js +0 -7
- package/lib/module/utils/generateId.js.map +0 -1
- package/lib/module/utils/hash32.js +0 -36
- package/lib/module/utils/hash32.js.map +0 -1
- package/lib/module/utils/mq.js +0 -32
- package/lib/module/utils/mq.js.map +0 -1
- package/lib/module/utils/mqParser.js +0 -78
- package/lib/module/utils/mqParser.js.map +0 -1
- package/lib/module/utils/withPlugins.js +0 -8
- package/lib/module/utils/withPlugins.js.map +0 -1
- package/lib/typescript/src/common.d.ts +0 -46
- package/lib/typescript/src/common.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +0 -56
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +0 -1
- package/lib/typescript/src/core/Unistyles.d.ts +0 -13
- package/lib/typescript/src/core/Unistyles.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesModule.d.ts +0 -19
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesModule.native.d.ts +0 -6
- package/lib/typescript/src/core/UnistylesModule.native.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +0 -81
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +0 -1
- package/lib/typescript/src/core/index.d.ts +0 -3
- package/lib/typescript/src/core/index.d.ts.map +0 -1
- package/lib/typescript/src/createStyleSheet.d.ts +0 -8
- package/lib/typescript/src/createStyleSheet.d.ts.map +0 -1
- package/lib/typescript/src/global.d.ts +0 -7
- package/lib/typescript/src/global.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCSS.d.ts +0 -3
- package/lib/typescript/src/hooks/useCSS.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCSS.native.d.ts +0 -3
- package/lib/typescript/src/hooks/useCSS.native.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +0 -3
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts +0 -14
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useVariants.d.ts +0 -3
- package/lib/typescript/src/hooks/useVariants.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/index.d.ts +0 -3
- package/lib/typescript/src/normalizer/index.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts +0 -3
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizer.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts +0 -1
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts.map +0 -1
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +0 -3
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +0 -1
- package/lib/typescript/src/plugins/index.d.ts +0 -3
- package/lib/typescript/src/plugins/index.d.ts.map +0 -1
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +0 -3
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +0 -1
- package/lib/typescript/src/types/common.d.ts +0 -3
- package/lib/typescript/src/types/common.d.ts.map +0 -1
- package/lib/typescript/src/types/plugin.d.ts +0 -7
- package/lib/typescript/src/types/plugin.d.ts.map +0 -1
- package/lib/typescript/src/types/stylesheet.d.ts +0 -40
- package/lib/typescript/src/types/stylesheet.d.ts.map +0 -1
- package/lib/typescript/src/types/unistyles.d.ts +0 -53
- package/lib/typescript/src/types/unistyles.d.ts.map +0 -1
- package/lib/typescript/src/types/variants.d.ts +0 -14
- package/lib/typescript/src/types/variants.d.ts.map +0 -1
- package/lib/typescript/src/useStyles.d.ts +0 -16
- package/lib/typescript/src/useStyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/cssMediaQuery.d.ts +0 -4
- package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +0 -1
- package/lib/typescript/src/utils/generateId.d.ts +0 -2
- package/lib/typescript/src/utils/generateId.d.ts.map +0 -1
- package/lib/typescript/src/utils/hash32.d.ts +0 -2
- package/lib/typescript/src/utils/hash32.d.ts.map +0 -1
- package/lib/typescript/src/utils/mq.d.ts +0 -26
- package/lib/typescript/src/utils/mq.d.ts.map +0 -1
- package/lib/typescript/src/utils/mqParser.d.ts +0 -16
- package/lib/typescript/src/utils/mqParser.d.ts.map +0 -1
- package/lib/typescript/src/utils/withPlugins.d.ts +0 -3
- package/lib/typescript/src/utils/withPlugins.d.ts.map +0 -1
- package/react-native-unistyles.podspec +0 -22
- package/src/__tests__/mocks.ts +0 -24
- package/src/common.ts +0 -55
- package/src/core/UnistyleRegistry.ts +0 -108
- package/src/core/Unistyles.ts +0 -35
- package/src/core/UnistylesModule.native.ts +0 -7
- package/src/core/UnistylesModule.ts +0 -230
- package/src/core/UnistylesRuntime.ts +0 -135
- package/src/core/index.ts +0 -2
- package/src/createStyleSheet.ts +0 -8
- package/src/global.ts +0 -6
- package/src/hooks/useCSS.native.ts +0 -3
- package/src/hooks/useCSS.ts +0 -51
- package/src/hooks/useInitialTheme.ts +0 -11
- package/src/hooks/useUnistyles.ts +0 -64
- package/src/hooks/useVariants.ts +0 -10
- package/src/normalizer/index.ts +0 -2
- package/src/normalizer/normalizer.macos.ts +0 -1
- package/src/plugins/cssMediaQueriesPlugin.ts +0 -8
- package/src/plugins/index.ts +0 -2
- package/src/plugins/normalizeWebStylesPlugin.ts +0 -7
- package/src/types/common.ts +0 -2
- package/src/types/plugin.ts +0 -7
- package/src/types/stylesheet.ts +0 -49
- package/src/types/unistyles.ts +0 -63
- package/src/types/variants.ts +0 -19
- package/src/useStyles.ts +0 -60
- package/src/utils/cssMediaQuery.ts +0 -268
- package/src/utils/generateId.ts +0 -10
- package/src/utils/hash32.ts +0 -53
- package/src/utils/mq.ts +0 -57
- package/src/utils/mqParser.ts +0 -99
- package/src/utils/withPlugins.ts +0 -13
- /package/lib/commonjs/{normalizer → utils}/module.d.js +0 -0
- /package/lib/module/{normalizer → utils}/module.d.js +0 -0
- /package/lib/typescript/src/{normalizer → utils}/normalizer.d.ts +0 -0
- /package/src/{normalizer → utils}/module.d.ts +0 -0
@@ -1,140 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.UnistylesRuntime = void 0;
|
7
|
-
var _common = require("../common");
|
8
|
-
/**
|
9
|
-
* Utility to interact with the Unistyles during runtime
|
10
|
-
*/
|
11
|
-
class UnistylesRuntime {
|
12
|
-
constructor(unistylesBridge, unistylesRegistry) {
|
13
|
-
this.unistylesBridge = unistylesBridge;
|
14
|
-
this.unistylesRegistry = unistylesRegistry;
|
15
|
-
}
|
16
|
-
|
17
|
-
/**
|
18
|
-
* Get the current color scheme
|
19
|
-
* @returns - The current color scheme
|
20
|
-
*/
|
21
|
-
get colorScheme() {
|
22
|
-
return this.unistylesBridge.colorScheme;
|
23
|
-
}
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Get info about adaptive themes
|
27
|
-
* @returns - boolean indicating if the adaptive themes are enabled
|
28
|
-
*/
|
29
|
-
get hasAdaptiveThemes() {
|
30
|
-
return this.unistylesBridge.hasAdaptiveThemes;
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Get the current theme name
|
35
|
-
* @returns - The current theme name
|
36
|
-
*/
|
37
|
-
get themeName() {
|
38
|
-
return this.unistylesBridge.themeName;
|
39
|
-
}
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Get the current content size category
|
43
|
-
* @returns - The current content size category
|
44
|
-
*/
|
45
|
-
get contentSizeCategory() {
|
46
|
-
return this.unistylesBridge.contentSizeCategory;
|
47
|
-
}
|
48
|
-
|
49
|
-
/**
|
50
|
-
* Get the current breakpoint based on device size
|
51
|
-
* @returns - The current breakpoint
|
52
|
-
*/
|
53
|
-
get breakpoint() {
|
54
|
-
return this.unistylesBridge.breakpoint;
|
55
|
-
}
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Get registered breakpoints with UnitylesRegistry
|
59
|
-
* @returns - The registered breakpoints
|
60
|
-
*/
|
61
|
-
get breakpoints() {
|
62
|
-
return this.unistylesRegistry.breakpoints;
|
63
|
-
}
|
64
|
-
|
65
|
-
/**
|
66
|
-
* Get the names of currently enabled plugins
|
67
|
-
* @returns - The names of currently enabled plugins
|
68
|
-
*/
|
69
|
-
get enabledPlugins() {
|
70
|
-
return this.unistylesBridge.enabledPlugins;
|
71
|
-
}
|
72
|
-
|
73
|
-
/**
|
74
|
-
* Get the screen size
|
75
|
-
* @returns - The screen size { width, height }
|
76
|
-
*/
|
77
|
-
get screen() {
|
78
|
-
return {
|
79
|
-
width: this.unistylesBridge.screenWidth,
|
80
|
-
height: this.unistylesBridge.screenHeight
|
81
|
-
};
|
82
|
-
}
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Get the screen orientation
|
86
|
-
* @returns - The screen orientation
|
87
|
-
*/
|
88
|
-
get orientation() {
|
89
|
-
const {
|
90
|
-
width,
|
91
|
-
height
|
92
|
-
} = this.screen;
|
93
|
-
if (width > height) {
|
94
|
-
return _common.ScreenOrientation.Landscape;
|
95
|
-
}
|
96
|
-
return _common.ScreenOrientation.Portrait;
|
97
|
-
}
|
98
|
-
|
99
|
-
/**
|
100
|
-
* Switch to a different theme
|
101
|
-
* @param name - The name of the theme to switch to
|
102
|
-
* @returns - boolean indicating if the theme was switched
|
103
|
-
*/
|
104
|
-
setTheme = name => {
|
105
|
-
if (name === this.themeName) {
|
106
|
-
return;
|
107
|
-
}
|
108
|
-
if (this.unistylesRegistry.hasTheme(name)) {
|
109
|
-
this.unistylesBridge.useTheme(name);
|
110
|
-
return true;
|
111
|
-
}
|
112
|
-
throw new Error(_common.UnistylesError.ThemeNotRegistered);
|
113
|
-
};
|
114
|
-
|
115
|
-
/**
|
116
|
-
* Enable or disable adaptive themes
|
117
|
-
* @param enable - boolean indicating if adaptive themes should be enabled
|
118
|
-
*/
|
119
|
-
setAdaptiveThemes = enable => {
|
120
|
-
this.unistylesBridge.useAdaptiveThemes(enable);
|
121
|
-
};
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Enable a plugin
|
125
|
-
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
126
|
-
*/
|
127
|
-
addPlugin = plugin => {
|
128
|
-
this.unistylesRegistry.addPlugin(plugin);
|
129
|
-
};
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Disable a plugin
|
133
|
-
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
134
|
-
*/
|
135
|
-
removePlugin = plugin => {
|
136
|
-
this.unistylesRegistry.removePlugin(plugin);
|
137
|
-
};
|
138
|
-
}
|
139
|
-
exports.UnistylesRuntime = UnistylesRuntime;
|
140
|
-
//# sourceMappingURL=UnistylesRuntime.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","contentSizeCategory","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKA;AACA;AACA;AACO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;;EAEpG;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,IAAI,CAACL,eAAe,CAACK,mBAAmB;EACnD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAA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AAC2B,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAC5B,iBAAiB,CAAC6B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAAjC,gBAAA,GAAAA,gBAAA"}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "unistyles", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _Unistyles.unistyles;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
var _Unistyles = require("./Unistyles");
|
13
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_Unistyles","require"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.createStyleSheet = void 0;
|
7
|
-
/**
|
8
|
-
* Utility to create a stylesheet with superpowers
|
9
|
-
* Compatible with React Native StyleSheet.create
|
10
|
-
* @param stylesheet - The stylesheet with superpowers to be used
|
11
|
-
*/
|
12
|
-
const createStyleSheet = stylesheet => stylesheet;
|
13
|
-
exports.createStyleSheet = createStyleSheet;
|
14
|
-
//# sourceMappingURL=createStyleSheet.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["createStyleSheet","stylesheet","exports"],"sourceRoot":"../../src","sources":["createStyleSheet.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAyCC,UAAa,IAAQA,UAAU;AAAAC,OAAA,CAAAF,gBAAA,GAAAA,gBAAA"}
|
package/lib/commonjs/global.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["global.ts"],"mappings":""}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useCSS = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
var _core = require("../core");
|
9
|
-
var _utils = require("../utils");
|
10
|
-
const useCSS = stylesheet => {
|
11
|
-
const insertedIds = (0, _react.useRef)([]);
|
12
|
-
(0, _react.useInsertionEffect)(() => {
|
13
|
-
if (!_core.unistyles.registry.config.experimentalCSSMediaQueries) {
|
14
|
-
return;
|
15
|
-
}
|
16
|
-
Object.entries(stylesheet).forEach(([_key, value]) => {
|
17
|
-
Object.entries(value).forEach(([prop, val]) => {
|
18
|
-
if (!val.toString().includes('@media')) {
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
const id = (0, _utils.generateReactNativeWebId)(prop, '""');
|
22
|
-
if (insertedIds.current.includes(id)) {
|
23
|
-
return;
|
24
|
-
}
|
25
|
-
const style = document.createElement('style');
|
26
|
-
style.id = id;
|
27
|
-
style.innerHTML = val;
|
28
|
-
document.head.appendChild(style);
|
29
|
-
insertedIds.current = [...insertedIds.current, id];
|
30
|
-
});
|
31
|
-
});
|
32
|
-
return () => {
|
33
|
-
insertedIds.current.forEach(id => {
|
34
|
-
const style = document.getElementById(id);
|
35
|
-
if (style) {
|
36
|
-
style.remove();
|
37
|
-
}
|
38
|
-
});
|
39
|
-
insertedIds.current = [];
|
40
|
-
};
|
41
|
-
}, [stylesheet]);
|
42
|
-
};
|
43
|
-
exports.useCSS = useCSS;
|
44
|
-
//# sourceMappingURL=useCSS.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_core","_utils","useCSS","stylesheet","insertedIds","useRef","useInsertionEffect","unistyles","registry","config","experimentalCSSMediaQueries","Object","entries","forEach","_key","value","prop","val","toString","includes","id","generateReactNativeWebId","current","style","document","createElement","innerHTML","head","appendChild","getElementById","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useCSS.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,MAAM,GAAOC,UAAoC,IAAK;EAC/D,MAAMC,WAAW,GAAG,IAAAC,aAAM,EAAgB,EAAE,CAAC;EAE7C,IAAAC,yBAAkB,EAAC,MAAM;IACrB,IAAI,CAACC,eAAS,CAACC,QAAQ,CAACC,MAAM,CAACC,2BAA2B,EAAE;MACxD;IACJ;IAEAC,MAAM,CACDC,OAAO,CAACT,UAAU,CAAC,CACnBU,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,KAAK,CAAC,KAAK;MACxBJ,MAAM,CAACC,OAAO,CAACG,KAAM,CAAC,CACjBF,OAAO,CAAC,CAAC,CAACG,IAAI,EAAEC,GAAG,CAAC,KAAK;QACtB,IAAI,CAACA,GAAG,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;UACpC;QACJ;QAEA,MAAMC,EAAE,GAAG,IAAAC,+BAAwB,EAACL,IAAI,EAAE,IAAI,CAAC;QAE/C,IAAIZ,WAAW,CAACkB,OAAO,CAACH,QAAQ,CAACC,EAAE,CAAC,EAAE;UAClC;QACJ;QAEA,MAAMG,KAAK,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;QAE7CF,KAAK,CAACH,EAAE,GAAGA,EAAE;QACbG,KAAK,CAACG,SAAS,GAAGT,GAAG;QAErBO,QAAQ,CAACG,IAAI,CAACC,WAAW,CAACL,KAAK,CAAC;QAChCnB,WAAW,CAACkB,OAAO,GAAG,CAAC,GAAGlB,WAAW,CAACkB,OAAO,EAAEF,EAAE,CAAC;MACtD,CAAC,CAAC;IACV,CAAC,CAAC;IAEN,OAAO,MAAM;MACThB,WAAW,CAACkB,OAAO,CAACT,OAAO,CAACO,EAAE,IAAI;QAC9B,MAAMG,KAAK,GAAGC,QAAQ,CAACK,cAAc,CAACT,EAAE,CAAC;QAEzC,IAAIG,KAAK,EAAE;UACPA,KAAK,CAACO,MAAM,CAAC,CAAC;QAClB;MACJ,CAAC,CAAC;MAEF1B,WAAW,CAACkB,OAAO,GAAG,EAAE;IAC5B,CAAC;EACL,CAAC,EAAE,CAACnB,UAAU,CAAC,CAAC;AACpB,CAAC;AAAA4B,OAAA,CAAA7B,MAAA,GAAAA,MAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["useCSS","_stylesheet","exports"],"sourceRoot":"../../../src","sources":["hooks/useCSS.native.ts"],"mappings":";;;;;;AAEO,MAAMA,MAAM,GAAOC,WAAqC,IAAW,CAAC,CAAC;AAAAC,OAAA,CAAAF,MAAA,GAAAA,MAAA"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useInitialTheme = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
var _core = require("../core");
|
9
|
-
const useInitialTheme = forName => {
|
10
|
-
(0, _react.useMemo)(() => {
|
11
|
-
if (!_core.unistyles.runtime.themeName) {
|
12
|
-
_core.unistyles.runtime.setTheme(forName);
|
13
|
-
}
|
14
|
-
}, []);
|
15
|
-
};
|
16
|
-
exports.useInitialTheme = useInitialTheme;
|
17
|
-
//# sourceMappingURL=useInitialTheme.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_core","useInitialTheme","forName","useMemo","unistyles","runtime","themeName","setTheme","exports"],"sourceRoot":"../../../src","sources":["hooks/useInitialTheme.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAGO,MAAME,eAAe,GAAIC,OAA8B,IAAK;EAC/D,IAAAC,cAAO,EAAC,MAAM;IACV,IAAI,CAACC,eAAS,CAACC,OAAO,CAACC,SAAS,EAAE;MAC9BF,eAAS,CAACC,OAAO,CAACE,QAAQ,CAACL,OAAO,CAAC;IACvC;EACJ,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAAAM,OAAA,CAAAP,eAAA,GAAAA,eAAA"}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useUnistyles = void 0;
|
7
|
-
var _reactNative = require("react-native");
|
8
|
-
var _react = require("react");
|
9
|
-
var _core = require("../core");
|
10
|
-
var _common = require("../common");
|
11
|
-
const unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
|
12
|
-
const useUnistyles = () => {
|
13
|
-
const [plugins, setPlugins] = (0, _react.useState)(_core.unistyles.runtime.enabledPlugins);
|
14
|
-
const [theme, setTheme] = (0, _react.useState)(_core.unistyles.registry.getTheme(_core.unistyles.runtime.themeName));
|
15
|
-
const [contentSizeCategory, setContentSizeCategory] = (0, _react.useState)(_core.unistyles.runtime.contentSizeCategory);
|
16
|
-
const [layout, setLayout] = (0, _react.useState)({
|
17
|
-
breakpoint: _core.unistyles.runtime.breakpoint,
|
18
|
-
orientation: _core.unistyles.runtime.orientation,
|
19
|
-
screenSize: {
|
20
|
-
width: _core.unistyles.runtime.screen.width,
|
21
|
-
height: _core.unistyles.runtime.screen.height
|
22
|
-
}
|
23
|
-
});
|
24
|
-
(0, _react.useEffect)(() => {
|
25
|
-
const subscription = unistylesEvents.addListener('__unistylesOnChange', event => {
|
26
|
-
switch (event.type) {
|
27
|
-
case _common.UnistylesEventType.Theme:
|
28
|
-
{
|
29
|
-
const themeEvent = event;
|
30
|
-
return setTheme(_core.unistyles.registry.getTheme(themeEvent.payload.themeName));
|
31
|
-
}
|
32
|
-
case _common.UnistylesEventType.Layout:
|
33
|
-
{
|
34
|
-
const layoutEvent = event;
|
35
|
-
return setLayout({
|
36
|
-
breakpoint: layoutEvent.payload.breakpoint,
|
37
|
-
orientation: layoutEvent.payload.orientation,
|
38
|
-
screenSize: layoutEvent.payload.screen
|
39
|
-
});
|
40
|
-
}
|
41
|
-
case _common.UnistylesEventType.Plugin:
|
42
|
-
{
|
43
|
-
return setPlugins(_core.unistyles.runtime.enabledPlugins);
|
44
|
-
}
|
45
|
-
case _common.UnistylesEventType.DynamicTypeSize:
|
46
|
-
{
|
47
|
-
const dynamicTypeSizeEvent = event;
|
48
|
-
return setContentSizeCategory(dynamicTypeSizeEvent.payload.contentSizeCategory);
|
49
|
-
}
|
50
|
-
default:
|
51
|
-
return;
|
52
|
-
}
|
53
|
-
});
|
54
|
-
return subscription.remove;
|
55
|
-
}, []);
|
56
|
-
return {
|
57
|
-
plugins,
|
58
|
-
theme,
|
59
|
-
layout,
|
60
|
-
contentSizeCategory
|
61
|
-
};
|
62
|
-
};
|
63
|
-
exports.useUnistyles = useUnistyles;
|
64
|
-
//# sourceMappingURL=useUnistyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","plugins","setPlugins","useState","unistyles","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","contentSizeCategory","setContentSizeCategory","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","UnistylesEventType","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","DynamicTypeSize","dynamicTypeSizeEvent","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA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AAE;YAC5B,MAAMC,WAAW,GAAGP,KAAmC;YAEvD,OAAOV,SAAS,CAAC;cACbC,UAAU,EAAEgB,WAAW,CAACF,OAAO,CAACd,UAAU;cAC1CC,WAAW,EAAEe,WAAW,CAACF,OAAO,CAACb,WAAW;cAC5CC,UAAU,EAAEc,WAAW,CAACF,OAAO,CAACV;YACpC,CAAC,CAAC;UACN;QACA,KAAKO,0BAAkB,CAACM,MAAM;UAAE;YAC5B,OAAO/B,UAAU,CAACE,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;UACvD;QACA,KAAKqB,0BAAkB,CAACO,eAAe;UAAE;YACrC,MAAMC,oBAAoB,GAAGV,KAAsC;YAEnE,OAAOZ,sBAAsB,CAACsB,oBAAoB,CAACL,OAAO,CAAClB,mBAAmB,CAAC;UACnF;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOW,YAAY,CAACa,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHnC,OAAO;IACPM,KAAK;IACLO,MAAM;IACNF;EACJ,CAAC;AACL,CAAC;AAAAyB,OAAA,CAAArC,YAAA,GAAAA,YAAA"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useVariants = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
const useVariants = variantsMap => {
|
9
|
-
const variantsRef = (0, _react.useRef)(variantsMap);
|
10
|
-
variantsRef.current = variantsMap;
|
11
|
-
return variantsRef.current;
|
12
|
-
};
|
13
|
-
exports.useVariants = useVariants;
|
14
|
-
//# sourceMappingURL=useVariants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","useVariants","variantsMap","variantsRef","useRef","current","exports"],"sourceRoot":"../../../src","sources":["hooks/useVariants.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,WAAW,GAAIC,WAA8C,IAAK;EAC3E,MAAMC,WAAW,GAAG,IAAAC,aAAM,EAA6CF,WAAW,CAAC;EAEnFC,WAAW,CAACE,OAAO,GAAGH,WAAW;EAEjC,OAAOC,WAAW,CAACE,OAAO;AAC9B,CAAC;AAAAC,OAAA,CAAAL,WAAA,GAAAA,WAAA"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "normalizeColor", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _normalizer.normalizeColor;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
Object.defineProperty(exports, "normalizeNumericValue", {
|
13
|
-
enumerable: true,
|
14
|
-
get: function () {
|
15
|
-
return _normalizer.normalizeNumericValue;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
Object.defineProperty(exports, "normalizeStyle", {
|
19
|
-
enumerable: true,
|
20
|
-
get: function () {
|
21
|
-
return _normalizeStyle.normalizeStyle;
|
22
|
-
}
|
23
|
-
});
|
24
|
-
Object.defineProperty(exports, "preprocessor", {
|
25
|
-
enumerable: true,
|
26
|
-
get: function () {
|
27
|
-
return _normalizer.preprocessor;
|
28
|
-
}
|
29
|
-
});
|
30
|
-
var _normalizeStyle = require("./normalizeStyle");
|
31
|
-
var _normalizer = require("./normalizer");
|
32
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizeStyle","require","_normalizer"],"sourceRoot":"../../../src","sources":["normalizer/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["normalizer/module.d.ts"],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizer","require","_common","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","warn","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","preprocessor","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyle","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow","exports"],"sourceRoot":"../../../src","sources":["normalizer/normalizeStyle.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,MAAME,kBAAkB,GAAyBC,KAAQ,IAA0B;EAC/E,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC3D,IAAAI,YAAI,EAAE,wEAAuEH,2BAA2B,CAACI,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAEtH,OAAO;MACHC,WAAW,EAAEC,SAAS;MACtBC,YAAY,EAAED,SAAS;MACvBE,aAAa,EAAEF,SAAS;MACxBG,YAAY,EAAEH;IAClB,CAAC;EACL;EAEA,OAAO;IACHI,SAAS,EAAEC,wBAAY,CAACC,oBAAoB,CAACb,KAAK,CAAC;IACnDM,WAAW,EAAEC,SAAS;IACtBC,YAAY,EAAED,SAAS;IACvBE,aAAa,EAAEF,SAAS;IACxBG,YAAY,EAAEH;EAClB,CAAC;AACL,CAAC;AAED,MAAMO,mBAAmB,GAA0Bd,KAAQ,IAA2B;EAClF,MAAMe,4BAA4B,GAAG,CACjC,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,CACrB;EAED,IAAI,CAACA,4BAA4B,CAACb,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC5D,IAAAI,YAAI,EAAE,yEAAwEW,4BAA4B,CAACV,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAExH,OAAO;MACHW,eAAe,EAAET,SAAS;MAC1BU,gBAAgB,EAAEV,SAAS;MAC3BW,gBAAgB,EAAEX;IACtB,CAAC;EACL;EAEA,OAAO;IACHY,UAAU,EAAEP,wBAAY,CAACQ,qBAAqB,CAACpB,KAAK,CAAC;IACrDgB,eAAe,EAAET,SAAS;IAC1BU,gBAAgB,EAAEV,SAAS;IAC3BW,gBAAgB,EAAEX;EACtB,CAAC;AACL,CAAC;AAEM,MAAMc,cAAc,GAAuBrB,KAAQ,IAAQ;EAC9D,MAAMsB,mBAAmB,GAAI,WAAW,IAAItB,KAAK,IAAIuB,KAAK,CAACC,OAAO,CAACxB,KAAK,CAACyB,SAAS,CAAC,GAC7E;IAAEA,SAAS,EAAEb,wBAAY,CAACc,oBAAoB,CAAC1B,KAAK,CAACyB,SAAS;EAAE,CAAC,GACjE,CAAC,CAAC;EAER,MAAME,mBAAmB,GACrB,aAAa,IAAI3B,KAAK,IACtB,cAAc,IAAIA,KAAK,IACvB,eAAe,IAAIA,KAAK,IACxB,cAAc,IAAIA,KAAK,GACvBD,kBAAkB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM4B,oBAAoB,GACtB,iBAAiB,IAAI5B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3Bc,mBAAmB,CAACd,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGsB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAR,cAAA,GAAAA,cAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizeColors","_interopRequireDefault","require","obj","__esModule","default","normalizeColor","color","opacity","integer","normalizeColors","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","exports","normalizeNumericValue","value","normalizeTransform","key","includes","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","createBoxShadowValue","shadowColor","shadowOffset","shadowOpacity","shadowRadius","createTransformValue","transforms","transform","Object","keys","undefined","join","Boolean","preprocessor"],"sourceRoot":"../../../src","sources":["normalizer/normalizer.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAF5D;AACA;;AAUO,MAAMG,cAAc,GAAGA,CAACC,KAAa,EAAEC,OAAe,GAAG,CAAC,KAAK;EAClE;EACA,IAAIA,OAAO,KAAK,CAAC,EAAE;IACf,OAAOD,KAAK;EAChB;EAEA,MAAME,OAAO,GAAG,IAAAC,wBAAe,EAACH,KAAK,CAAqB;;EAE1D;EACA,IAAIE,OAAO,KAAK,IAAI,EAAE;IAClB,OAAOF,KAAK;EAChB;EAEA,MAAMI,GAAG,GAAGF,OAAO,CAACG,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAEjD,IAAIF,GAAG,CAACG,MAAM,KAAK,CAAC,EAAE;IAClB,MAAM,CAACC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,CAAC,GAAGP,GAAG,CACnCQ,KAAK,CAAC,cAAc,CAAC,CACrBC,GAAG,CAACC,CAAC,IAAIC,QAAQ,CAACD,CAAC,EAAE,EAAE,CAAC,CAAC,CACzBE,MAAM,CAACC,GAAG,IAAI,CAACC,KAAK,CAACD,GAAG,CAAC,CAAC;IAE/B,OAAQ,QAAOT,CAAE,IAAG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AAqB,CAACiB,YAAY,CAACJ,MAAM,CAAC;EAC1D,MAAMC,MAAM,GAAGd,qBAAqB,CAACmB,YAAY,CAAC;EAClD,MAAMvC,KAAK,GAAGD,cAAc,CAACqC,WAAW,EAAYE,aAAuB,CAAC;EAE5E,OAAQ,GAAER,OAAQ,IAAGE,OAAQ,IAAGE,MAAO,IAAGlC,KAAM,EAAC;AACrD,CAAC;AAED,MAAMwC,oBAAoB,GAAIC,UAAsB,IAAKA,UAAU,CAC9D5B,GAAG,CAAC6B,SAAS,IAAI;EACd,MAAM,CAACnB,GAAG,CAAC,GAAGoB,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;EAEpC,IAAI,CAACnB,GAAG,EAAE;IACN,OAAOsB,SAAS;EACpB;EAEA,MAAMxB,KAAK,GAAGqB,SAAS,CAACnB,GAAG,CAA2B;EAEtD,QAAOA,GAAG;IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAQ,GAAEA,GAAI,IAAIF,KAAK,CAAmByB,IAAI,CAAC,GAAG,CAAE,GAAE;IAC1D;MACI,OAAQ,GAAEvB,GAAI,IAAGD,kBAAkB,CAACC,GAAG,EAAEF,KAAK,CAAE,GAAE;EAC1D;AACJ,CAAC,CAAC,CACDL,MAAM,CAAC+B,OAAO,CAAC,CACfD,IAAI,CAAC,GAAG,CAAC;AAEP,MAAME,YAA0B,GAAA7B,OAAA,CAAA6B,YAAA,GAAG;EACtCvB,qBAAqB;EACrBU,oBAAoB;EACpBK;AACJ,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["normalizer/normalizer.macos.ts"],"mappings":"AAAA;AAAA"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.cssMediaQueriesPlugin = void 0;
|
7
|
-
var _cssMediaQuery = require("../utils/cssMediaQuery");
|
8
|
-
// prevent recursive import
|
9
|
-
|
10
|
-
const cssMediaQueriesPlugin = exports.cssMediaQueriesPlugin = {
|
11
|
-
name: '__unistylesCSSMediaQueries',
|
12
|
-
onParsedStyle: (_key, styles, runtime) => (0, _cssMediaQuery.createMediaQueryForStyles)(styles, runtime)
|
13
|
-
};
|
14
|
-
//# sourceMappingURL=cssMediaQueriesPlugin.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_cssMediaQuery","require","cssMediaQueriesPlugin","exports","name","onParsedStyle","_key","styles","runtime","createMediaQueryForStyles"],"sourceRoot":"../../../src","sources":["plugins/cssMediaQueriesPlugin.ts"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AADA;;AAIO,MAAMC,qBAAsC,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EAClDE,IAAI,EAAE,4BAA4B;EAClCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,EAAEC,OAAO,KAAK,IAAAC,wCAAyB,EAACF,MAAM,EAAEC,OAAO;AACvF,CAAC"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "cssMediaQueriesPlugin", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _cssMediaQueriesPlugin.cssMediaQueriesPlugin;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
Object.defineProperty(exports, "normalizeWebStylesPlugin", {
|
13
|
-
enumerable: true,
|
14
|
-
get: function () {
|
15
|
-
return _normalizeWebStylesPlugin.normalizeWebStylesPlugin;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
var _normalizeWebStylesPlugin = require("./normalizeWebStylesPlugin");
|
19
|
-
var _cssMediaQueriesPlugin = require("./cssMediaQueriesPlugin");
|
20
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizeWebStylesPlugin","require","_cssMediaQueriesPlugin"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.normalizeWebStylesPlugin = void 0;
|
7
|
-
var _normalizer = require("../normalizer");
|
8
|
-
const normalizeWebStylesPlugin = exports.normalizeWebStylesPlugin = {
|
9
|
-
name: '__unistylesNormalizeWebStyles',
|
10
|
-
onParsedStyle: (_key, styles) => (0, _normalizer.normalizeStyle)(styles)
|
11
|
-
};
|
12
|
-
//# sourceMappingURL=normalizeWebStylesPlugin.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizer","require","normalizeWebStylesPlugin","exports","name","onParsedStyle","_key","styles","normalizeStyle"],"sourceRoot":"../../../src","sources":["plugins/normalizeWebStylesPlugin.ts"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,wBAAyC,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACrDE,IAAI,EAAE,+BAA+B;EACrCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,KAAK,IAAAC,0BAAc,EAACD,MAAM;AAC1D,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/common.ts"],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/plugin.ts"],"mappings":""}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useStyles = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
var _reactNative = require("react-native");
|
9
|
-
var _utils = require("./utils");
|
10
|
-
var _hooks = require("./hooks");
|
11
|
-
var _core = require("./core");
|
12
|
-
var _common = require("./common");
|
13
|
-
/**
|
14
|
-
* Hook that enables all the features of Unistyles
|
15
|
-
* @param stylesheet - The stylesheet with superpowers to be used
|
16
|
-
* @param variantsMap - The map of variants to be used
|
17
|
-
* @returns - The theme, current breakpoint and RN compatible styles
|
18
|
-
*/
|
19
|
-
const useStyles = (stylesheet, variantsMap) => {
|
20
|
-
const {
|
21
|
-
theme,
|
22
|
-
layout,
|
23
|
-
plugins
|
24
|
-
} = (0, _hooks.useUnistyles)();
|
25
|
-
const variants = (0, _hooks.useVariants)(variantsMap);
|
26
|
-
const parsedStyles = (0, _react.useMemo)(() => typeof stylesheet === 'function' ? stylesheet(theme) : stylesheet, [theme, stylesheet, layout]);
|
27
|
-
const dynamicStyleSheet = (0, _react.useMemo)(() => Object.entries(parsedStyles || {}).reduce((acc, [key, value]) => {
|
28
|
-
if (typeof value === 'function') {
|
29
|
-
return {
|
30
|
-
...acc,
|
31
|
-
[key]: (0, _utils.proxifyFunction)(key, value, variants)
|
32
|
-
};
|
33
|
-
}
|
34
|
-
return _reactNative.StyleSheet.create({
|
35
|
-
...acc,
|
36
|
-
[key]: (0, _utils.withPlugins)(key, (0, _utils.parseStyle)(value, variants, !_common.isWeb || !_core.unistyles.registry.config.experimentalCSSMediaQueries))
|
37
|
-
});
|
38
|
-
}, {}), [parsedStyles, variants, plugins]);
|
39
|
-
(0, _hooks.useCSS)(dynamicStyleSheet);
|
40
|
-
return {
|
41
|
-
theme,
|
42
|
-
breakpoint: layout.breakpoint,
|
43
|
-
styles: dynamicStyleSheet
|
44
|
-
};
|
45
|
-
};
|
46
|
-
exports.useStyles = useStyles;
|
47
|
-
//# sourceMappingURL=useStyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_utils","_hooks","_core","_common","useStyles","stylesheet","variantsMap","theme","layout","plugins","useUnistyles","variants","useVariants","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","key","value","proxifyFunction","StyleSheet","create","withPlugins","parseStyle","isWeb","unistyles","registry","config","experimentalCSSMediaQueries","useCSS","breakpoint","styles","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAGA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,mBAAY,EAAC,CAAC;EACjD,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAACN,WAAW,CAAC;EACzC,MAAMO,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOT,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMO,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BK,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAG,IAAAE,sBAAe,EAACF,GAAG,EAAEC,KAAK,EAAEV,QAAQ;MAC/C,CAAC;IACL;IAEA,OA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