react-native-unistyles 1.1.6 → 1.3.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 +30 -38
- package/android/CMakeLists.txt +27 -0
- package/android/build.gradle +75 -0
- package/android/src/main/cxx/cpp-adapter.cpp +132 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +189 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +18 -0
- package/cxx/UnistylesRuntime.cpp +318 -0
- package/cxx/UnistylesRuntime.h +74 -0
- package/ios/UnistylesHelpers.h +3 -0
- package/ios/UnistylesHelpers.mm +5 -0
- package/ios/UnistylesModule.h +16 -0
- package/ios/UnistylesModule.mm +138 -0
- package/ios/platform/Platform_iOS.h +21 -0
- package/ios/platform/Platform_iOS.mm +132 -0
- package/ios/platform/Platform_macOS.h +20 -0
- package/ios/platform/Platform_macOS.mm +83 -0
- package/lib/commonjs/common.js +60 -0
- package/lib/commonjs/common.js.map +1 -0
- package/lib/commonjs/core/UnistyleRegistry.js +94 -0
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
- package/lib/commonjs/core/Unistyles.js +32 -0
- package/lib/commonjs/core/Unistyles.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.js +197 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.native.js +9 -0
- package/lib/commonjs/core/UnistylesModule.native.js.map +1 -0
- package/lib/commonjs/core/UnistylesRuntime.js +140 -0
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
- package/lib/commonjs/core/index.js +13 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/createStyleSheet.js +14 -0
- package/lib/commonjs/createStyleSheet.js.map +1 -0
- package/lib/commonjs/global.js +2 -0
- package/lib/commonjs/global.js.map +1 -0
- package/lib/commonjs/hooks/index.js +24 -3
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useCSS.js +44 -0
- package/lib/commonjs/hooks/useCSS.js.map +1 -0
- package/lib/commonjs/hooks/useCSS.native.js +9 -0
- package/lib/commonjs/hooks/useCSS.native.js.map +1 -0
- package/lib/commonjs/hooks/useInitialTheme.js +17 -0
- package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
- package/lib/commonjs/hooks/useUnistyles.js +64 -0
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
- package/lib/commonjs/hooks/useVariants.js +14 -0
- package/lib/commonjs/hooks/useVariants.js.map +1 -0
- package/lib/commonjs/index.js +63 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/normalizer/index.js +32 -0
- package/lib/commonjs/normalizer/index.js.map +1 -0
- package/lib/commonjs/normalizer/module.d.js.map +1 -0
- package/lib/commonjs/{utils/normalizeStyles.web.js → normalizer/normalizeStyle.js} +5 -5
- package/lib/commonjs/normalizer/normalizeStyle.js.map +1 -0
- package/lib/commonjs/{utils → normalizer}/normalizer.js +2 -3
- package/lib/commonjs/normalizer/normalizer.js.map +1 -0
- package/lib/commonjs/normalizer/normalizer.macos.js +3 -0
- package/lib/commonjs/normalizer/normalizer.macos.js.map +1 -0
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +14 -0
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +1 -0
- package/lib/commonjs/plugins/index.js +20 -0
- package/lib/commonjs/plugins/index.js.map +1 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/commonjs/types/common.js +2 -0
- package/lib/{module/utils/module.d.js.map → commonjs/types/common.js.map} +1 -1
- package/lib/commonjs/types/index.js +11 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/plugin.js +6 -0
- package/lib/commonjs/{utils/module.d.js.map → types/plugin.js.map} +1 -1
- package/lib/commonjs/types/stylesheet.js +6 -0
- package/lib/commonjs/types/{mediaQueries.js.map → stylesheet.js.map} +1 -1
- package/lib/commonjs/types/unistyles.js +6 -0
- package/lib/{module/types/mediaQueries.js.map → commonjs/types/unistyles.js.map} +1 -1
- package/lib/commonjs/types/variants.js +2 -0
- package/lib/commonjs/types/variants.js.map +1 -0
- package/lib/commonjs/useStyles.js +47 -0
- package/lib/commonjs/useStyles.js.map +1 -0
- package/lib/commonjs/utils/breakpoints.js +20 -122
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/cssMediaQuery.js +244 -0
- package/lib/commonjs/utils/cssMediaQuery.js.map +1 -0
- package/lib/commonjs/utils/generateId.js +15 -0
- package/lib/commonjs/utils/generateId.js.map +1 -0
- package/lib/commonjs/utils/hash32.js +43 -0
- package/lib/commonjs/utils/hash32.js.map +1 -0
- package/lib/commonjs/utils/index.js +22 -54
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +38 -0
- package/lib/commonjs/utils/mq.js.map +1 -0
- package/lib/commonjs/utils/mqParser.js +89 -0
- package/lib/commonjs/utils/mqParser.js.map +1 -0
- package/lib/commonjs/utils/styles.js +52 -72
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/withPlugins.js +15 -0
- package/lib/commonjs/utils/withPlugins.js.map +1 -0
- package/lib/module/common.js +53 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/core/UnistyleRegistry.js +87 -0
- package/lib/module/core/UnistyleRegistry.js.map +1 -0
- package/lib/module/core/Unistyles.js +26 -0
- package/lib/module/core/Unistyles.js.map +1 -0
- package/lib/module/core/UnistylesModule.js +190 -0
- package/lib/module/core/UnistylesModule.js.map +1 -0
- package/lib/module/core/UnistylesModule.native.js +3 -0
- package/lib/module/core/UnistylesModule.native.js.map +1 -0
- package/lib/module/core/UnistylesRuntime.js +133 -0
- package/lib/module/core/UnistylesRuntime.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/createStyleSheet.js +7 -0
- package/lib/module/createStyleSheet.js.map +1 -0
- package/lib/module/global.js +2 -0
- package/lib/module/global.js.map +1 -0
- package/lib/module/hooks/index.js +4 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useCSS.js +37 -0
- package/lib/module/hooks/useCSS.js.map +1 -0
- package/lib/module/hooks/useCSS.native.js +2 -0
- package/lib/module/hooks/useCSS.native.js.map +1 -0
- package/lib/module/hooks/useInitialTheme.js +10 -0
- package/lib/module/hooks/useInitialTheme.js.map +1 -0
- package/lib/module/hooks/useUnistyles.js +57 -0
- package/lib/module/hooks/useUnistyles.js.map +1 -0
- package/lib/module/hooks/useVariants.js +7 -0
- package/lib/module/hooks/useVariants.js.map +1 -0
- package/lib/module/index.js +30 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/normalizer/index.js +3 -0
- package/lib/module/normalizer/index.js.map +1 -0
- package/lib/module/normalizer/module.d.js.map +1 -0
- package/lib/module/{utils/normalizeStyles.web.js → normalizer/normalizeStyle.js} +3 -3
- package/lib/module/normalizer/normalizeStyle.js.map +1 -0
- package/lib/module/{utils → normalizer}/normalizer.js +2 -3
- package/lib/module/normalizer/normalizer.js.map +1 -0
- package/lib/module/normalizer/normalizer.macos.js +2 -0
- package/lib/module/normalizer/normalizer.macos.js.map +1 -0
- package/lib/module/plugins/cssMediaQueriesPlugin.js +7 -0
- package/lib/module/plugins/cssMediaQueriesPlugin.js.map +1 -0
- package/lib/module/plugins/index.js +3 -0
- package/lib/module/plugins/index.js.map +1 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +1 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/plugin.js +2 -0
- package/lib/module/types/plugin.js.map +1 -0
- package/lib/module/types/stylesheet.js +2 -0
- package/lib/module/types/stylesheet.js.map +1 -0
- package/lib/module/types/unistyles.js +2 -0
- package/lib/module/types/unistyles.js.map +1 -0
- package/lib/module/types/variants.js +2 -0
- package/lib/module/types/variants.js.map +1 -0
- package/lib/module/useStyles.js +40 -0
- package/lib/module/useStyles.js.map +1 -0
- package/lib/module/utils/breakpoints.js +19 -120
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/cssMediaQuery.js +237 -0
- package/lib/module/utils/cssMediaQuery.js.map +1 -0
- package/lib/module/utils/generateId.js +7 -0
- package/lib/module/utils/generateId.js.map +1 -0
- package/lib/module/utils/hash32.js +36 -0
- package/lib/module/utils/hash32.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/mq.js +32 -0
- package/lib/module/utils/mq.js.map +1 -0
- package/lib/module/utils/mqParser.js +78 -0
- package/lib/module/utils/mqParser.js.map +1 -0
- package/lib/module/utils/styles.js +50 -72
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/withPlugins.js +8 -0
- package/lib/module/utils/withPlugins.js.map +1 -0
- package/lib/typescript/src/common.d.ts +46 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +56 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
- package/lib/typescript/src/core/Unistyles.d.ts +13 -0
- package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts +19 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.native.d.ts +6 -0
- package/lib/typescript/src/core/UnistylesModule.native.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +81 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +3 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/createStyleSheet.d.ts +8 -0
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -0
- package/lib/typescript/src/global.d.ts +7 -0
- package/lib/typescript/src/global.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +4 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCSS.d.ts +3 -0
- package/lib/typescript/src/hooks/useCSS.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCSS.native.d.ts +3 -0
- package/lib/typescript/src/hooks/useCSS.native.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts +14 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useVariants.d.ts +3 -0
- package/lib/typescript/src/hooks/useVariants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +76 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/normalizer/index.d.ts +3 -0
- package/lib/typescript/src/normalizer/index.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts +3 -0
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts +1 -0
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts.map +1 -0
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +3 -0
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +1 -0
- package/lib/typescript/src/plugins/index.d.ts +3 -0
- package/lib/typescript/src/plugins/index.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
- package/lib/typescript/src/types/breakpoints.d.ts +25 -16
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +3 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/lib/typescript/src/types/core.d.ts +11 -25
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/plugin.d.ts +7 -0
- package/lib/typescript/src/types/plugin.d.ts.map +1 -0
- package/lib/typescript/src/types/stylesheet.d.ts +40 -0
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -0
- package/lib/typescript/src/types/unistyles.d.ts +53 -0
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
- package/lib/typescript/src/types/variants.d.ts +14 -0
- package/lib/typescript/src/types/variants.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +16 -0
- package/lib/typescript/src/useStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +2 -62
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/cssMediaQuery.d.ts +4 -0
- package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +1 -0
- package/lib/typescript/src/utils/generateId.d.ts +2 -0
- package/lib/typescript/src/utils/generateId.d.ts.map +1 -0
- package/lib/typescript/src/utils/hash32.d.ts +2 -0
- package/lib/typescript/src/utils/hash32.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +7 -6
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +26 -0
- package/lib/typescript/src/utils/mq.d.ts.map +1 -0
- package/lib/typescript/src/utils/mqParser.d.ts +16 -0
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +4 -49
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/lib/typescript/src/utils/withPlugins.d.ts +3 -0
- package/lib/typescript/src/utils/withPlugins.d.ts.map +1 -0
- package/package.json +46 -25
- package/react-native-unistyles.podspec +22 -0
- package/src/__tests__/mocks.ts +24 -0
- package/src/common.ts +55 -0
- package/src/core/UnistyleRegistry.ts +108 -0
- package/src/core/Unistyles.ts +35 -0
- package/src/core/UnistylesModule.native.ts +7 -0
- package/src/core/UnistylesModule.ts +230 -0
- package/src/core/UnistylesRuntime.ts +135 -0
- package/src/core/index.ts +2 -0
- package/src/createStyleSheet.ts +8 -0
- package/src/global.ts +6 -0
- package/src/hooks/index.ts +4 -1
- package/src/hooks/useCSS.native.ts +3 -0
- package/src/hooks/useCSS.ts +51 -0
- package/src/hooks/useInitialTheme.ts +11 -0
- package/src/hooks/useUnistyles.ts +64 -0
- package/src/hooks/useVariants.ts +10 -0
- package/src/index.ts +50 -2
- package/src/normalizer/index.ts +2 -0
- package/src/{utils/normalizeStyles.web.ts → normalizer/normalizeStyle.ts} +3 -3
- package/src/normalizer/normalizer.macos.ts +1 -0
- package/src/{utils → normalizer}/normalizer.ts +5 -4
- package/src/plugins/cssMediaQueriesPlugin.ts +8 -0
- package/src/plugins/index.ts +2 -0
- package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
- package/src/types/breakpoints.ts +55 -27
- package/src/types/common.ts +2 -0
- package/src/types/core.ts +11 -36
- package/src/types/index.ts +12 -7
- package/src/types/plugin.ts +7 -0
- package/src/types/stylesheet.ts +49 -0
- package/src/types/unistyles.ts +63 -0
- package/src/types/variants.ts +19 -0
- package/src/useStyles.ts +60 -0
- package/src/utils/breakpoints.ts +28 -124
- package/src/utils/cssMediaQuery.ts +268 -0
- package/src/utils/generateId.ts +10 -0
- package/src/utils/hash32.ts +53 -0
- package/src/utils/index.ts +7 -13
- package/src/utils/mq.ts +57 -0
- package/src/utils/mqParser.ts +99 -0
- package/src/utils/styles.ts +62 -102
- package/src/utils/withPlugins.ts +13 -0
- package/lib/commonjs/UnistylesTheme.js +0 -21
- package/lib/commonjs/UnistylesTheme.js.map +0 -1
- package/lib/commonjs/createUnistyles.js +0 -57
- package/lib/commonjs/createUnistyles.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.js +0 -10
- package/lib/commonjs/hooks/useDimensions.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.web.js +0 -34
- package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
- package/lib/commonjs/types/mediaQueries.js +0 -2
- package/lib/commonjs/utils/common.js +0 -18
- package/lib/commonjs/utils/common.js.map +0 -1
- package/lib/commonjs/utils/mediaQueries.js +0 -189
- package/lib/commonjs/utils/mediaQueries.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.js +0 -10
- package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
- package/lib/commonjs/utils/normalizer.js.map +0 -1
- package/lib/module/UnistylesTheme.js +0 -12
- package/lib/module/UnistylesTheme.js.map +0 -1
- package/lib/module/createUnistyles.js +0 -50
- package/lib/module/createUnistyles.js.map +0 -1
- package/lib/module/hooks/useDimensions.js +0 -3
- package/lib/module/hooks/useDimensions.js.map +0 -1
- package/lib/module/hooks/useDimensions.web.js +0 -27
- package/lib/module/hooks/useDimensions.web.js.map +0 -1
- package/lib/module/types/mediaQueries.js +0 -2
- package/lib/module/utils/common.js +0 -10
- package/lib/module/utils/common.js.map +0 -1
- package/lib/module/utils/mediaQueries.js +0 -176
- package/lib/module/utils/mediaQueries.js.map +0 -1
- package/lib/module/utils/normalizeStyles.js +0 -3
- package/lib/module/utils/normalizeStyles.js.map +0 -1
- package/lib/module/utils/normalizeStyles.web.js.map +0 -1
- package/lib/module/utils/normalizer.js.map +0 -1
- package/lib/typescript/examples/expo/src/App.d.ts +0 -3
- package/lib/typescript/examples/expo/src/App.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +0 -7
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/index.d.ts +0 -8
- package/lib/typescript/examples/expo/src/examples/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/index.d.ts +0 -2
- package/lib/typescript/examples/expo/src/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +0 -8
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/index.d.ts +0 -46
- package/lib/typescript/examples/expo/src/styles/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/theme.d.ts +0 -24
- package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +0 -1
- package/lib/typescript/src/UnistylesTheme.d.ts +0 -9
- package/lib/typescript/src/UnistylesTheme.d.ts.map +0 -1
- package/lib/typescript/src/createUnistyles.d.ts +0 -10
- package/lib/typescript/src/createUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +0 -8
- package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/utils/common.d.ts +0 -5
- package/lib/typescript/src/utils/common.d.ts.map +0 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +0 -130
- package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
- package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
- package/src/UnistylesTheme.tsx +0 -17
- package/src/__tests__/createUnistyles.spec.tsx +0 -192
- package/src/createUnistyles.ts +0 -70
- package/src/hooks/useDimensions.ts +0 -4
- package/src/hooks/useDimensions.web.ts +0 -34
- package/src/types/mediaQueries.ts +0 -10
- package/src/utils/common.ts +0 -12
- package/src/utils/mediaQueries.ts +0 -201
- package/src/utils/normalizeStyles.ts +0 -2
- /package/lib/commonjs/{utils → normalizer}/module.d.js +0 -0
- /package/lib/module/{utils → normalizer}/module.d.js +0 -0
- /package/lib/typescript/src/{utils → normalizer}/normalizer.d.ts +0 -0
- /package/src/{utils → normalizer}/module.d.ts +0 -0
@@ -1,2 +1,5 @@
|
|
1
|
-
export {
|
1
|
+
export { useInitialTheme } from './useInitialTheme';
|
2
|
+
export { useUnistyles } from './useUnistyles';
|
3
|
+
export { useVariants } from './useVariants';
|
4
|
+
export { useCSS } from './useCSS';
|
2
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useCSS.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCSS.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAGrD,eAAO,MAAM,MAAM,mDA6ClB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useCSS.native.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCSS.native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAErD,eAAO,MAAM,MAAM,gDAA+C,IAAU,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useInitialTheme.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useInitialTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,eAAe,YAAa,MAAM,eAAe,SAM7D,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare const useUnistyles: () => {
|
2
|
+
plugins: string[];
|
3
|
+
theme: never;
|
4
|
+
layout: {
|
5
|
+
breakpoint: keyof import("..").UnistylesBreakpoints;
|
6
|
+
orientation: "landscape" | "portrait";
|
7
|
+
screenSize: {
|
8
|
+
width: number;
|
9
|
+
height: number;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
contentSizeCategory: import("../common").IOSContentSizeCategory | import("../common").AndroidContentSizeCategory;
|
13
|
+
};
|
14
|
+
//# sourceMappingURL=useUnistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;;CAuDxB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVariants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,WAAW,iBAAkB,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,+CAMzE,CAAA"}
|
@@ -1,3 +1,77 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { mq } from './utils';
|
2
|
+
import { useInitialTheme } from './hooks';
|
3
|
+
import type { UnistylesPlugin } from './types';
|
4
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
5
|
+
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common';
|
6
|
+
import { useStyles } from './useStyles';
|
7
|
+
import { createStyleSheet } from './createStyleSheet';
|
8
|
+
/**
|
9
|
+
* Utility to interact with the Unistyles
|
10
|
+
* (should be called only once)
|
11
|
+
*/
|
12
|
+
declare const UnistylesRegistry: {
|
13
|
+
/**
|
14
|
+
* Register themes to be used in the app
|
15
|
+
* @param themes - Key value pair of themes
|
16
|
+
*/
|
17
|
+
addThemes: (themes: UnistylesThemes) => {
|
18
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
19
|
+
addThemes: any;
|
20
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
21
|
+
addBreakpoints: any;
|
22
|
+
addThemes: any;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
26
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
27
|
+
addThemes: any;
|
28
|
+
addConfig: any;
|
29
|
+
};
|
30
|
+
addThemes: any;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
/**
|
34
|
+
* Register breakpoints to be used in the app
|
35
|
+
* @param breakpoints - Key value pair of breakpoints
|
36
|
+
*/
|
37
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
38
|
+
addThemes: (themes: UnistylesThemes) => {
|
39
|
+
addBreakpoints: any;
|
40
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
41
|
+
addBreakpoints: any;
|
42
|
+
addThemes: any;
|
43
|
+
};
|
44
|
+
};
|
45
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
46
|
+
addBreakpoints: any;
|
47
|
+
addThemes: (themes: UnistylesThemes) => {
|
48
|
+
addBreakpoints: any;
|
49
|
+
addConfig: any;
|
50
|
+
};
|
51
|
+
};
|
52
|
+
};
|
53
|
+
/**
|
54
|
+
* Register additional config to customize the Unistyles
|
55
|
+
* @param config - Key value pair of config
|
56
|
+
*/
|
57
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
58
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
59
|
+
addThemes: (themes: UnistylesThemes) => {
|
60
|
+
addBreakpoints: any;
|
61
|
+
addConfig: any;
|
62
|
+
};
|
63
|
+
addConfig: any;
|
64
|
+
};
|
65
|
+
addThemes: (themes: UnistylesThemes) => {
|
66
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
67
|
+
addThemes: any;
|
68
|
+
addConfig: any;
|
69
|
+
};
|
70
|
+
addConfig: any;
|
71
|
+
};
|
72
|
+
};
|
73
|
+
};
|
74
|
+
declare const UnistylesRuntime: import("./core").UnistylesRuntime;
|
75
|
+
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesRegistry, UnistylesRuntime };
|
76
|
+
export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin };
|
3
77
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD;;;GAGG;AACH,QAAA,MAAM,iBAAiB;IACnB;;;OAGG;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;CAEN,CAAA;AAED,QAAA,MAAM,gBAAgB,mCAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,eAAe,EAClB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/normalizer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizeStyle.d.ts","sourceRoot":"","sources":["../../../../src/normalizer/normalizeStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoE,OAAO,EAAE,MAAM,UAAU,CAAA;AAuDzG,eAAO,MAAM,cAAc,oCAwB1B,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../src/normalizer/normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAY,MAAM,UAAU,CAAA;AAE3E,KAAK,YAAY,GAAG;IAChB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;IACjD,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;IACzD,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;CAClE,CAAA;AAED,eAAO,MAAM,cAAc,UAAW,MAAM,YAAW,MAAM,WAyB5D,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,MAAM,oBAAiC,CAAA;AAyDpF,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=normalizer.macos.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizer.macos.d.ts","sourceRoot":"","sources":["../../../../src/normalizer/normalizer.macos.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cssMediaQueriesPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/cssMediaQueriesPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,eAAO,MAAM,qBAAqB,EAAE,eAGnC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizeWebStylesPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/normalizeWebStylesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAA"}
|
@@ -1,19 +1,28 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
};
|
8
|
-
|
9
|
-
|
10
|
-
export type ExtractBreakpoints<T, B extends Breakpoints> = T extends Partial<Record<keyof B & string, infer V>> ? WithEmptyObject<V> : T extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R, B> : {
|
11
|
-
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R, B> : T[K] extends object ? ExtractBreakpoints<T[K], B> : T[K];
|
12
|
-
};
|
13
|
-
export type RemoveKeysWithPrefix<T, B extends Breakpoints> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R, B> : T extends object ? T extends Record<string, infer _V> ? {
|
14
|
-
[K in keyof T as K extends MediaQueries ? keyof B & string : K]: RemoveKeysWithPrefix<T[K], B>;
|
15
|
-
} : {
|
16
|
-
[K in keyof T]: RemoveKeysWithPrefix<T[K], B>;
|
1
|
+
import type { ColorValue, OpaqueColorValue } from 'react-native';
|
2
|
+
import type { UnistylesTheme } from '../types';
|
3
|
+
import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet';
|
4
|
+
import type { TransformStyles } from './core';
|
5
|
+
type ExtractTransformArray<T> = T extends object ? {
|
6
|
+
[K in keyof T]: ExtractBreakpoints<T[K]>;
|
7
|
+
} : never;
|
8
|
+
type ExtractBreakpoints<T> = T extends object ? keyof T extends BreakpointsOrMediaQueries ? T[keyof T] : T extends Array<ToDeepUnistyles<TransformStyles>> ? Array<ExtractTransformArray<T[number]>> : {
|
9
|
+
[K in keyof T]: ExtractBreakpoints<T[K]>;
|
17
10
|
} : T;
|
11
|
+
type ParseNestedObject<T> = T extends (...args: infer A) => infer R ? (...args: A) => ParseNestedObject<R> : T extends object ? T extends {
|
12
|
+
variants: infer R;
|
13
|
+
} ? ParseVariants<FlattenVariants<R>> & ParseNestedObject<Omit<T, 'variants'>> : {
|
14
|
+
[K in keyof T]: T[K] extends object ? T[K] extends OpaqueColorValue ? ColorValue : ExtractBreakpoints<T[K]> : T[K];
|
15
|
+
} : T;
|
16
|
+
type FlattenVariants<T> = T extends object ? {
|
17
|
+
[K in keyof T]: T[K] extends object ? {
|
18
|
+
[key in keyof T[K]]: T[K][key] extends object ? ParseNestedObject<T[K][key]> : never;
|
19
|
+
} : never;
|
20
|
+
} : never;
|
21
|
+
type ParseVariants<T> = T extends object ? T[keyof T] extends object ? UnionToIntersection<ParseVariants<T[keyof T]>> : T : T;
|
22
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
23
|
+
type ParseStyleKeys<T> = T extends object ? {
|
24
|
+
[K in keyof T]: ParseNestedObject<T[K]>;
|
25
|
+
} : never;
|
26
|
+
export type ReactNativeStyleSheet<T> = T extends (theme: UnistylesTheme) => infer R ? ParseStyleKeys<R> : ParseStyleKeys<T>;
|
18
27
|
export {};
|
19
28
|
//# sourceMappingURL=breakpoints.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{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CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,KAAK,MAAM,CAAC,GAC7E,cAAc,CAAC,CAAC,CAAC,GACjB,cAAc,CAAC,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/types/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;AACvC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA"}
|
@@ -1,32 +1,18 @@
|
|
1
1
|
import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
|
2
2
|
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
3
|
-
import type {
|
4
|
-
|
5
|
-
type ShadowOffset = {
|
3
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
4
|
+
export type ShadowOffset = {
|
6
5
|
width: number;
|
7
6
|
height: number;
|
8
7
|
};
|
9
|
-
type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
|
10
|
-
type
|
11
|
-
|
12
|
-
|
13
|
-
transform?: Array<DeepUniStyle<TransformStyles, B>>;
|
14
|
-
};
|
15
|
-
type UniStyle<V, B> = {
|
16
|
-
[innerKey in keyof B]?: V;
|
17
|
-
} | {
|
18
|
-
[innerKey in MediaQueries]?: V;
|
19
|
-
} | V;
|
20
|
-
type DeepUniStyle<T, B> = {
|
21
|
-
[K in keyof T]?: UniStyle<T[K], B>;
|
22
|
-
};
|
23
|
-
type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
|
24
|
-
type UnistyleView<B> = DeepUniStyle<Omit<ViewStyle, NestedTypes>, B>;
|
25
|
-
type UnistyleText<B> = DeepUniStyle<Omit<TextStyle, NestedTypes>, B>;
|
26
|
-
type UnistyleImage<B> = DeepUniStyle<Omit<ImageStyle, NestedTypes>, B>;
|
27
|
-
export type StaticStyles<B extends Breakpoints> = UnistyleView<B> | UnistyleText<B> | UnistyleImage<B> & UnistyleNested<B>;
|
28
|
-
export type CustomNamedStyles<T, B extends Breakpoints> = {
|
29
|
-
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles<B> ? (...args: A) => StaticStyles<B> : StaticStyles<B>;
|
8
|
+
export type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
|
9
|
+
export type ScreenSize = {
|
10
|
+
width: number;
|
11
|
+
height: number;
|
30
12
|
};
|
31
|
-
export
|
13
|
+
export type RNStyle = ViewStyle & TextStyle & ImageStyle;
|
14
|
+
export type RNValue = ViewStyle[keyof ViewStyle] | TextStyle[keyof TextStyle] | ImageStyle[keyof ImageStyle];
|
15
|
+
export type NestedStyle = Record<keyof UnistylesBreakpoints | symbol, RNValue>;
|
16
|
+
export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | symbol, RNValue]>;
|
17
|
+
export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
|
32
18
|
//# sourceMappingURL=core.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBA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AoB,GAAG,MAAM,EAAE,OAAO,CAAC,CAAA;AAC9E,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,CAAC,MAAM,oBAAoB,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AACpF,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA"}
|
@@ -1,4 +1,9 @@
|
|
1
1
|
export * from './normalizer';
|
2
|
-
export
|
3
|
-
export type {
|
2
|
+
export * from './unistyles';
|
3
|
+
export type { Optional, Nullable } from './common';
|
4
|
+
export type { NestedStylePairs, UnistylesTheme, ScreenSize, NestedStyle, RNValue, RNStyle } from './core';
|
5
|
+
export type { StyleSheetWithSuperPowers, StyleSheet, AllAvailableKeys } from './stylesheet';
|
6
|
+
export type { ReactNativeStyleSheet } from './breakpoints';
|
7
|
+
export type { ExtractVariantNames } from './variants';
|
8
|
+
export type { UnistylesPlugin } from './plugin';
|
4
9
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,YAAY,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EACR,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACV,MAAM,QAAQ,CAAA;AACf,YAAY,EAAE,yBAAyB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC3F,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { RNStyle } from './core';
|
2
|
+
import type { UnistylesRuntime } from '../core';
|
3
|
+
export type UnistylesPlugin = {
|
4
|
+
name: string;
|
5
|
+
onParsedStyle?: (styleKey: string, style: RNStyle, runtime: UnistylesRuntime) => RNStyle;
|
6
|
+
};
|
7
|
+
//# sourceMappingURL=plugin.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/types/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAA;CAC3F,CAAA"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
2
|
+
import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core';
|
3
|
+
import type { UnistylesBreakpoints } from '../global';
|
4
|
+
type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset';
|
5
|
+
type UnistyleView = Omit<ViewStyle, NestedKeys>;
|
6
|
+
type UnistyleText = Omit<TextStyle, NestedKeys>;
|
7
|
+
type UnistyleImage = Omit<ImageStyle, NestedKeys>;
|
8
|
+
type UnistyleNestedStyles = {
|
9
|
+
shadowOffset?: ToDeepUnistyles<ShadowOffset>;
|
10
|
+
textShadowOffset?: ToDeepUnistyles<ShadowOffset>;
|
11
|
+
transform?: Array<ToDeepUnistyles<TransformStyles>>;
|
12
|
+
};
|
13
|
+
type Variants = {
|
14
|
+
variants?: {
|
15
|
+
[variantName: string]: {
|
16
|
+
[variant: string]: Omit<UnistylesValues, 'variants'>;
|
17
|
+
};
|
18
|
+
};
|
19
|
+
};
|
20
|
+
export type ToDeepUnistyles<T> = {
|
21
|
+
[K in keyof T]?: T[K] | {
|
22
|
+
[key in BreakpointsOrMediaQueries]?: T[K];
|
23
|
+
};
|
24
|
+
};
|
25
|
+
type AllAvailableStyles = UnistyleView & UnistyleText & UnistyleImage & UnistyleNestedStyles;
|
26
|
+
export type AllAvailableKeys = keyof (UnistyleView & UnistyleText & UnistyleImage);
|
27
|
+
export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | symbol;
|
28
|
+
export type UnistylesValues = {
|
29
|
+
[propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
|
30
|
+
[key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName];
|
31
|
+
};
|
32
|
+
} & Variants & {
|
33
|
+
[propName in NestedKeys]?: UnistyleNestedStyles[propName];
|
34
|
+
};
|
35
|
+
export type StyleSheet = {
|
36
|
+
[styleName: string]: UnistylesValues | ((...args: any) => UnistylesValues);
|
37
|
+
};
|
38
|
+
export type StyleSheetWithSuperPowers = ((theme: UnistylesTheme) => StyleSheet) | StyleSheet;
|
39
|
+
export {};
|
40
|
+
//# sourceMappingURL=stylesheet.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../src/types/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,KAAK,UAAU,GAAG,cAAc,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAEnE,KAAK,YAAY,GAAG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,GAAG,QAAQ,GAAG;KACV,QAAQ,IAAI,UAAU,CAAC,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC;CAC5D,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,eAAe,CAAC,CAAA;CAC7E,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,UAAU,CAAC,GAAG,UAAU,CAAA"}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { UnistylesEventType, ScreenOrientation, IOSContentSizeCategory, AndroidContentSizeCategory } from '../common';
|
2
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
|
3
|
+
import type { ScreenSize } from './core';
|
4
|
+
import type { UnistylesPlugin } from './plugin';
|
5
|
+
export type ColorSchemeName = 'light' | 'dark' | 'unspecified';
|
6
|
+
export type UnistylesConfig = {
|
7
|
+
adaptiveThemes?: boolean;
|
8
|
+
initialTheme?: keyof UnistylesThemes;
|
9
|
+
plugins?: Array<UnistylesPlugin>;
|
10
|
+
experimentalCSSMediaQueries?: boolean;
|
11
|
+
};
|
12
|
+
export type UnistylesBridge = {
|
13
|
+
screenWidth: number;
|
14
|
+
screenHeight: number;
|
15
|
+
enabledPlugins: Array<string>;
|
16
|
+
hasAdaptiveThemes: boolean;
|
17
|
+
themeName: keyof UnistylesThemes;
|
18
|
+
breakpoint: keyof UnistylesBreakpoints;
|
19
|
+
colorScheme: ColorSchemeName;
|
20
|
+
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory;
|
21
|
+
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
22
|
+
themes: Array<keyof UnistylesThemes>;
|
23
|
+
useBreakpoints(breakpoints: UnistylesBreakpoints): void;
|
24
|
+
useTheme(name: keyof UnistylesThemes): void;
|
25
|
+
useAdaptiveThemes(enable: boolean): void;
|
26
|
+
addPlugin(pluginName: string, notify: boolean): void;
|
27
|
+
removePlugin(pluginName: string): void;
|
28
|
+
};
|
29
|
+
export type UnistylesThemeEvent = {
|
30
|
+
type: UnistylesEventType.Theme;
|
31
|
+
payload: {
|
32
|
+
themeName: keyof UnistylesThemes;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
export type UnistylesMobileLayoutEvent = {
|
36
|
+
type: UnistylesEventType.Layout;
|
37
|
+
payload: {
|
38
|
+
screen: ScreenSize;
|
39
|
+
breakpoint: keyof UnistylesBreakpoints;
|
40
|
+
orientation: typeof ScreenOrientation[keyof typeof ScreenOrientation];
|
41
|
+
};
|
42
|
+
};
|
43
|
+
export type UnistylesPluginEvent = {
|
44
|
+
type: UnistylesEventType.Plugin;
|
45
|
+
};
|
46
|
+
export type UnistylesDynamicTypeSizeEvent = {
|
47
|
+
type: UnistylesEventType.DynamicTypeSize;
|
48
|
+
payload: {
|
49
|
+
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory;
|
50
|
+
};
|
51
|
+
};
|
52
|
+
export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent | UnistylesPluginEvent | UnistylesDynamicTypeSizeEvent;
|
53
|
+
//# sourceMappingURL=unistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG,O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MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;KACxE,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC,IAAI,EAAE,kBAAkB,CAAC,eAAe,CAAC;IACzC,OAAO,EAAE;QACL,mBAAmB,EAAE,sBAAsB,GAAG,0BAA0B,CAAA;KAC3E,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,oBAAoB,GAAG,6BAA6B,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export type ExtractVariantNames<T> = T extends (...args: any) => infer R ? ExtractVariantKeys<R> : ExtractVariantKeys<T>;
|
2
|
+
type ExtractVariantKeys<T> = T extends object ? ExtractVariant<T[keyof T]> : never;
|
3
|
+
type ExtractSubVariantKeys<T> = T extends object ? keyof Omit<T, 'default'> | undefined : never;
|
4
|
+
type ExtractVariant<T> = T extends (...args: any) => infer R ? R extends {
|
5
|
+
variants: infer V;
|
6
|
+
} ? {
|
7
|
+
[key in keyof V]?: ExtractSubVariantKeys<V[key]>;
|
8
|
+
} : never : T extends {
|
9
|
+
variants: infer V;
|
10
|
+
} ? {
|
11
|
+
[key in keyof V]?: ExtractSubVariantKeys<V[key]>;
|
12
|
+
} : never;
|
13
|
+
export {};
|
14
|
+
//# sourceMappingURL=variants.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/types/variants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GAClE,kBAAkB,CAAC,CAAC,CAAC,GACrB,kBAAkB,CAAC,CAAC,CAAC,CAAA;AAE3B,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACvC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAC1B,KAAK,CAAA;AAEX,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC1C,MAAM,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,SAAS,GACpC,KAAK,CAAA;AAEX,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GACtD,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3B;KAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,GACpD,KAAK,GACT,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3B;KAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,GACpD,KAAK,CAAA"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { UnistylesBreakpoints } from './global';
|
2
|
+
import type { ExtractVariantNames, ReactNativeStyleSheet, StyleSheetWithSuperPowers, UnistylesTheme } from './types';
|
3
|
+
type ParsedStylesheet<ST extends StyleSheetWithSuperPowers> = {
|
4
|
+
theme: UnistylesTheme;
|
5
|
+
breakpoint: keyof UnistylesBreakpoints;
|
6
|
+
styles: ReactNativeStyleSheet<ST>;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Hook that enables all the features of Unistyles
|
10
|
+
* @param stylesheet - The stylesheet with superpowers to be used
|
11
|
+
* @param variantsMap - The map of variants to be used
|
12
|
+
* @returns - The theme, current breakpoint and RN compatible styles
|
13
|
+
*/
|
14
|
+
export declare const useStyles: <ST extends StyleSheetWithSuperPowers>(stylesheet?: ST | undefined, variantsMap?: ExtractVariantNames<ST> | undefined) => ParsedStylesheet<ST>;
|
15
|
+
export {};
|
16
|
+
//# sourceMappingURL=useStyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIpH,KAAK,gBAAgB,CAAC,EAAE,SAAS,yBAAyB,IAAI;IAC1D,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAA;CACpC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,gJAsCrB,CAAA"}
|
@@ -1,63 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
* Sorts the breakpoints object based on its numeric values in ascending order and validates them.
|
4
|
-
*
|
5
|
-
* This function takes an object where keys represent breakpoint names and values are numeric.
|
6
|
-
* It returns a new object with the same keys but sorted based on their corresponding numeric values.
|
7
|
-
* Additionally, it validates that:
|
8
|
-
* 1. The first breakpoint starts with a value of 0.
|
9
|
-
* 2. No duplicate breakpoint values exist.
|
10
|
-
*
|
11
|
-
* If the validation fails, appropriate error messages are logged to the console.
|
12
|
-
*
|
13
|
-
* @template B - An object type where keys are strings and values are numbers.
|
14
|
-
* @param {B} breakpoints - The breakpoints object to be sorted and validated.
|
15
|
-
* @returns {B} A new object with sorted and validated breakpoints.
|
16
|
-
*
|
17
|
-
* @example
|
18
|
-
* const input = { md: 768, lg: 1024, sm: 0 }
|
19
|
-
* sortAndValidateBreakpoints(input) // returns { sm: 0, md: 768, lg: 1024 }
|
20
|
-
*/
|
21
|
-
export declare const sortAndValidateBreakpoints: <B extends Breakpoints>(breakpoints: B) => B;
|
22
|
-
/**
|
23
|
-
* Determines the appropriate breakpoint key for a given screen width based on provided breakpoints.
|
24
|
-
*
|
25
|
-
* This function takes a screen width and an object of breakpoints. It returns the key of the breakpoint
|
26
|
-
* that the screen width falls into. The breakpoints are assumed to be sorted in ascending order.
|
27
|
-
*
|
28
|
-
* @template B - An object type where keys are strings and values are numbers representing screen widths.
|
29
|
-
* @param {number} width - The screen width to determine the breakpoint for.
|
30
|
-
* @param breakpointEntries - sorted pairs of breakpoints
|
31
|
-
* @returns {keyof B & string} The key of the breakpoint that the screen width falls into.
|
32
|
-
*
|
33
|
-
* @example
|
34
|
-
* const breakpoints = { sm: 0, md: 768, lg: 1024 }
|
35
|
-
* getBreakpointFromScreenWidth(800, breakpoints) // returns 'md'
|
36
|
-
*/
|
37
|
-
export declare const getBreakpointFromScreenWidth: <B extends Breakpoints>(width: number, breakpointEntries: SortedBreakpointEntries<B>) => keyof B & string;
|
38
|
-
/**
|
39
|
-
* Retrieves the value associated with a given breakpoint or custom media query based on the provided screen size.
|
40
|
-
*
|
41
|
-
* The function first checks for custom media queries. If a matching custom media query is found, its associated value is returned.
|
42
|
-
* If no custom media query matches, the function then checks for a direct breakpoint match.
|
43
|
-
* If there's no direct breakpoint match, the function simulates CSS cascading to find the closest matching breakpoint.
|
44
|
-
*
|
45
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
46
|
-
*
|
47
|
-
* @param {Record<keyof B & string, string | number>} value - An object containing values associated with breakpoints or custom media queries.
|
48
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
49
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
50
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
51
|
-
*
|
52
|
-
* @returns {string | number | undefined} Returns the value associated with the matching breakpoint or custom media query, or `undefined` if no match is found.
|
53
|
-
*
|
54
|
-
* @example
|
55
|
-
*
|
56
|
-
* const values = { ':w[200]': 'value1', sm: 'value2', md: 'value3' }
|
57
|
-
* const screenSize = { width: 250, height: 400 }
|
58
|
-
* const breakpoints = { sm: 300, md: 600, lg: 900 }
|
59
|
-
*
|
60
|
-
* getValueForBreakpoint(values, 'sm', screenSize, breakpoints); // 'value1'
|
61
|
-
*/
|
62
|
-
export declare const getValueForBreakpoint: <B extends Breakpoints>(value: Record<keyof B & string, string | number | undefined>, breakpoint: keyof B & string, screenSize: ScreenSize, breakpointPairs: SortedBreakpointEntries<B>) => string | number | undefined;
|
1
|
+
import type { Optional, RNValue } from '../types';
|
2
|
+
export declare const getValueForBreakpoint: (value: Record<string, RNValue>) => Optional<RNValue>;
|
63
3
|
//# sourceMappingURL=breakpoints.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAKjD,eAAO,MAAM,qBAAqB,UAAW,OAAO,MAAM,EAAE,OAAO,CAAC,KAAG,SAAS,OAAO,CAqCtF,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cssMediaQuery.d.ts","sourceRoot":"","sources":["../../../../src/utils/cssMediaQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,UAAU,CAAA;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,yBAAyB,WAAY,OAAO,WAAW,gBAAgB,KAAG,OA8BtF,CAAA"}
|