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,176 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Extracts numeric values from a coded string.
|
3
|
-
*
|
4
|
-
* The function is designed to process strings that have a format like "w[100,200]" or "h[300]".
|
5
|
-
* It removes characters 'w', 'h', '[', and ']' from the input string and then extracts the numbers.
|
6
|
-
*
|
7
|
-
* @param {string} codedValue - The input string to extract values from.
|
8
|
-
* @returns {Array<number>} An array of extracted numbers. Can contain one or two numbers based on the input format.
|
9
|
-
*
|
10
|
-
* @example
|
11
|
-
* extractValues("w[100,200]") // returns [100, 200]
|
12
|
-
* extractValues("h[300]") // returns [300]
|
13
|
-
* extractValues("h[,300]") // returns [0,300]
|
14
|
-
* extractValues("h[100,]") // returns [100]
|
15
|
-
*/
|
16
|
-
export const extractValues = codedValue => {
|
17
|
-
const [lh, rh] = codedValue.replace(/[wh[\]]/g, '').split(',');
|
18
|
-
return rh ? [Number(lh), Number(rh)] : [Number(lh)];
|
19
|
-
};
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Determines if the given screen size matches the specified breakpoint query.
|
23
|
-
*
|
24
|
-
* The function checks if the screen size (width and/or height) falls within the range
|
25
|
-
* specified by the breakpoint query. The query can specify width (using 'w'), height (using 'h'),
|
26
|
-
* or both.
|
27
|
-
*
|
28
|
-
* @param {string} query - The breakpoint query string. Examples: 'w[100,200]', 'h[300]', 'w[100,200]h[300,400]'.
|
29
|
-
* @param {ScreenSize} screenSize - The screen size to check against the breakpoint query.
|
30
|
-
* @returns {boolean} True if the screen size matches the breakpoint query, false otherwise.
|
31
|
-
*
|
32
|
-
* @example
|
33
|
-
* const screenSize = { width: 150, height: 350 }
|
34
|
-
* isWithinBreakpoint('w[100,200]', screenSize) // returns true
|
35
|
-
* isWithinBreakpoint('h[400]', screenSize) // returns false
|
36
|
-
*/
|
37
|
-
export const isWithinBreakpoint = (query, screenSize) => {
|
38
|
-
if (query.includes('w') && query.includes('h')) {
|
39
|
-
return isWithinTheWidthAndHeight(query, screenSize);
|
40
|
-
}
|
41
|
-
if (query.charAt(0) === 'w') {
|
42
|
-
return isWithinTheWidth(query, screenSize.width);
|
43
|
-
}
|
44
|
-
if (query.charAt(0) === 'h') {
|
45
|
-
return isWithinTheHeight(query, screenSize.height);
|
46
|
-
}
|
47
|
-
return false;
|
48
|
-
};
|
49
|
-
|
50
|
-
/**
|
51
|
-
* Determines if the given width matches the specified width range in the query.
|
52
|
-
*
|
53
|
-
* The function checks if the provided width falls within the range specified by the query.
|
54
|
-
* The query specifies a width range using a format like 'w[100,200]'. If only one value is provided,
|
55
|
-
* it's treated as a minimum width.
|
56
|
-
*
|
57
|
-
* @param {string} query - The width query string. Examples: 'w[100,200]' or 'w[100]'.
|
58
|
-
* @param {number} width - The width to check against the query.
|
59
|
-
* @returns {boolean} True if the width matches the query range, false otherwise.
|
60
|
-
*
|
61
|
-
* @example
|
62
|
-
* isWithinTheWidth('w[100,200]', 150) // returns true
|
63
|
-
* isWithinTheWidth('w[100]', 50) // returns false
|
64
|
-
* isWithinTheWidth('w[100]', 150) // returns true
|
65
|
-
*/
|
66
|
-
export const isWithinTheWidth = (query, width) => {
|
67
|
-
const [minWidth, maxWidth] = extractValues(query);
|
68
|
-
if (maxWidth && width >= minWidth && width <= maxWidth) {
|
69
|
-
return true;
|
70
|
-
}
|
71
|
-
return !maxWidth && width >= minWidth;
|
72
|
-
};
|
73
|
-
|
74
|
-
/**
|
75
|
-
* Determines if the given height matches the specified height range in the query.
|
76
|
-
*
|
77
|
-
* The function checks if the provided height falls within the range specified by the query.
|
78
|
-
* The query specifies a height range using a format like 'h[100,200]'. If only one value is provided,
|
79
|
-
* it's treated as a minimum height.
|
80
|
-
*
|
81
|
-
* @param {string} query - The height query string. Examples: 'h[100,200]' or 'h[100]'.
|
82
|
-
* @param {number} height - The height to check against the query.
|
83
|
-
* @returns {boolean} True if the height matches the query range, false otherwise.
|
84
|
-
*
|
85
|
-
* @example
|
86
|
-
* isWithinTheHeight('h[100,200]', 150) // returns true
|
87
|
-
* isWithinTheHeight('h[100]', 50) // returns false
|
88
|
-
* isWithinTheHeight('h[100]', 150) // returns true
|
89
|
-
*/
|
90
|
-
export const isWithinTheHeight = (query, height) => {
|
91
|
-
const [minHeight, maxHeight] = extractValues(query);
|
92
|
-
if (maxHeight && height >= minHeight && height <= maxHeight) {
|
93
|
-
return true;
|
94
|
-
}
|
95
|
-
return !maxHeight && height >= minHeight;
|
96
|
-
};
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Determines if the given screen size matches both the specified width and height ranges in the query.
|
100
|
-
*
|
101
|
-
* The function checks if the provided screen size (both width and height) falls within the ranges
|
102
|
-
* specified by the query. The query can specify both width and height using a format like 'w[100,200]:h[300,400]'.
|
103
|
-
*
|
104
|
-
* @param {string} query - The combined width and height query string. Example: 'w[100,200]:h[300,400]'.
|
105
|
-
* @param {ScreenSize} screenSize - The screen size to check against the query.
|
106
|
-
* @returns {boolean} True if the screen size matches both the width and height ranges in the query, false otherwise.
|
107
|
-
*
|
108
|
-
* @example
|
109
|
-
* const screenSize = { width: 150, height: 350 }
|
110
|
-
* isWithinTheWidthAndHeight('w[100,200]:h[300,400]', screenSize) // returns true
|
111
|
-
* isWithinTheWidthAndHeight('w[100,200]:h[400,500]', screenSize) // returns false
|
112
|
-
*/
|
113
|
-
export const isWithinTheWidthAndHeight = (query, screenSize) => {
|
114
|
-
const result = query.split(':').filter(Boolean).map(q => isWithinBreakpoint(q, screenSize)).filter(Boolean);
|
115
|
-
return result.length === 2;
|
116
|
-
};
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Checks if the given query string is a valid custom media query.
|
120
|
-
*
|
121
|
-
* The valid custom media query formats include:
|
122
|
-
* - :w[200]
|
123
|
-
* - :w[0, 200]
|
124
|
-
* - :w[, 300]
|
125
|
-
* - :h[200]
|
126
|
-
* - :h[0, 500]
|
127
|
-
* - :h[,200]
|
128
|
-
* - :w[100, 300]:h[200,500]
|
129
|
-
* - :h[200,500]:w[100, 300]
|
130
|
-
*
|
131
|
-
* @param {string} query - The query string to be checked.
|
132
|
-
* @returns {boolean} Returns `true` if the query is a valid custom media query, otherwise `false`.
|
133
|
-
* @example
|
134
|
-
*
|
135
|
-
* isMediaQuery(':w[200]') // true
|
136
|
-
* isMediaQuery(':w100]') // false
|
137
|
-
*/
|
138
|
-
export const isMediaQuery = query => {
|
139
|
-
const regex = /^(?:(:w\[\d*(?:,\s?\d+)?])?(:h\[\d*(?:,\s?\d+)?])?|(:h\[\d*(?:,\s?\d+)?])?(:w\[\d*(?:,\s?\d+)?])?)$/;
|
140
|
-
return query.length > 0 && regex.test(query);
|
141
|
-
};
|
142
|
-
|
143
|
-
/**
|
144
|
-
* Retrieves the first matching custom media query key based on the provided screen size.
|
145
|
-
*
|
146
|
-
* The function processes an array of media queries and returns the first query that matches
|
147
|
-
* the given screen size. The media queries can be in formats like:
|
148
|
-
* - w[200]
|
149
|
-
* - w[0, 200]
|
150
|
-
* - w[, 300]
|
151
|
-
* - h[200]
|
152
|
-
* - h[0, 500]
|
153
|
-
* - h[,200]
|
154
|
-
* - w[100, 300]:h[200,500]
|
155
|
-
* - h[200,500]:w[100, 300]
|
156
|
-
*
|
157
|
-
* @param {Array<[string, string | number]>} mediaQueries - An array of tuples containing media query keys and associated values.
|
158
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
159
|
-
* @returns {string | undefined} Returns the first matching media query key or `undefined` if no match is found.
|
160
|
-
* @example
|
161
|
-
*
|
162
|
-
* const queries = [[':w[200]', 'value1'], [':h[300,500]', 'value2']]
|
163
|
-
* const size = { width: 250, height: 400 }
|
164
|
-
* getKeyForCustomMediaQuery(queries, size) // ':w[200]
|
165
|
-
*/
|
166
|
-
export const getKeyForCustomMediaQuery = (mediaQueries, screenSize) => {
|
167
|
-
const [matchedQuery] = mediaQueries.flatMap(_ref => {
|
168
|
-
let [key] = _ref;
|
169
|
-
if (key.includes('w') && key.includes('h')) {
|
170
|
-
return isWithinBreakpoint(key, screenSize) ? key : undefined;
|
171
|
-
}
|
172
|
-
return key.split(':').filter(Boolean).map(query => isWithinBreakpoint(query, screenSize) ? key : undefined);
|
173
|
-
}).filter(Boolean);
|
174
|
-
return matchedQuery;
|
175
|
-
};
|
176
|
-
//# sourceMappingURL=mediaQueries.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["extractValues","codedValue","lh","rh","replace","split","Number","isWithinBreakpoint","query","screenSize","includes","isWithinTheWidthAndHeight","charAt","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":"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"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["normalizeStyles","styles"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,eAAe,GAAOC,MAAS,IAAKA,MAAW"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["warn","preprocessor","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyles","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.web.ts"],"mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAC/B,SAASC,YAAY,QAAQ,cAAc;AAG3C,MAAMC,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;IAC3DH,IAAI,CAAE,wEAAuEI,2BAA2B,CAACG,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,EAAEZ,YAAY,CAACa,oBAAoB,CAACX,KAAK,CAAC;IACnDK,WAAW,EAAEC,SAAS;IACtBC,YAAY,EAAED,SAAS;IACvBE,aAAa,EAAEF,SAAS;IACxBG,YAAY,EAAEH;EAClB,CAAC;AACL,CAAC;AAED,MAAMM,mBAAmB,GAA0BZ,KAAQ,IAA2B;EAClF,MAAMa,4BAA4B,GAAG,CACjC,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,CACrB;EAED,IAAI,CAACA,4BAA4B,CAACX,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC5DH,IAAI,CAAE,yEAAwEgB,4BAA4B,CAACT,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAExH,OAAO;MACHU,eAAe,EAAER,SAAS;MAC1BS,gBAAgB,EAAET,SAAS;MAC3BU,gBAAgB,EAAEV;IACtB,CAAC;EACL;EAEA,OAAO;IACHW,UAAU,EAAEnB,YAAY,CAACoB,qBAAqB,CAAClB,KAAK,CAAC;IACrDc,eAAe,EAAER,SAAS;IAC1BS,gBAAgB,EAAET,SAAS;IAC3BU,gBAAgB,EAAEV;EACtB,CAAC;AACL,CAAC;AAED,OAAO,MAAMa,eAAe,GAAkEnB,KAAQ,IAAQ;EAC1G,MAAMoB,mBAAmB,GAAI,WAAW,IAAIpB,KAAK,IAAIqB,KAAK,CAACC,OAAO,CAACtB,KAAK,CAACuB,SAAS,CAAC,GAC7E;IAAEA,SAAS,EAAEzB,YAAY,CAAC0B,oBAAoB,CAACxB,KAAK,CAACuB,SAAS;EAAE,CAAC,GACjE,CAAC,CAAC;EAER,MAAME,mBAAmB,GACrB,aAAa,IAAIzB,KAAK,IACtB,cAAc,IAAIA,KAAK,IACvB,eAAe,IAAIA,KAAK,IACxB,cAAc,IAAIA,KAAK,GACvBD,kBAAkB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM0B,oBAAoB,GACtB,iBAAiB,IAAI1B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3BY,mBAAmB,CAACZ,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGoB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["normalizeColors","normalizeColor","color","opacity","arguments","length","undefined","integer","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","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","join","Boolean","preprocessor"],"sourceRoot":"../../../src","sources":["utils/normalizer.ts"],"mappings":"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"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../examples/expo/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAUvC,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,iBAgBvB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Breakpoints.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Breakpoints.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAiB/B,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EmptyStyles.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/EmptyStyles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAU/B,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Extreme.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Extreme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,KAAK,YAAY,GAAG;IAChB,aAAa,EAAE,YAAY,CAAA;CAC9B,CAAA;AAGD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAezD,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MediaQueries.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/MediaQueries.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAahC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Memoization.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Memoization.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAY/B,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Minimal.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Minimal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,iBAU3B,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MinimalWithCreateStyleSheet.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/MinimalWithCreateStyleSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,iBAU/C,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Theme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,iBAUzB,CAAA"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export { Minimal } from './Minimal';
|
2
|
-
export { MinimalWithCreateStyleSheet } from './MinimalWithCreateStyleSheet';
|
3
|
-
export { Theme } from './Theme';
|
4
|
-
export { Breakpoints } from './Breakpoints';
|
5
|
-
export { MediaQueries } from './MediaQueries';
|
6
|
-
export { Extreme } from './Extreme';
|
7
|
-
export { Memoization } from './Memoization';
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../examples/expo/src/index.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/styles/breakpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAA"}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import type { AppTheme } from './theme';
|
2
|
-
import { lightTheme, darkTheme } from './theme';
|
3
|
-
export declare const useStyles: <ST extends import("../../../../src/types").CustomNamedStyles<ST, {
|
4
|
-
xs: number;
|
5
|
-
sm: number;
|
6
|
-
md: number;
|
7
|
-
lg: number;
|
8
|
-
xl: number;
|
9
|
-
}>>(stylesheet?: ST | import("../../../../src/types").CreateStylesFactory<ST, AppTheme> | undefined) => {
|
10
|
-
theme: AppTheme;
|
11
|
-
breakpoint: "xs" | "sm" | "md" | "lg" | "xl";
|
12
|
-
styles: import("../../../../src/types").ExtractBreakpoints<import("../../../../src/types").RemoveKeysWithPrefix<ST, {
|
13
|
-
xs: number;
|
14
|
-
sm: number;
|
15
|
-
md: number;
|
16
|
-
lg: number;
|
17
|
-
xl: number;
|
18
|
-
}>, {
|
19
|
-
xs: number;
|
20
|
-
sm: number;
|
21
|
-
md: number;
|
22
|
-
lg: number;
|
23
|
-
xl: number;
|
24
|
-
}>;
|
25
|
-
}, createStyleSheet: <S extends import("../../../../src/types").CustomNamedStyles<S, {
|
26
|
-
xs: number;
|
27
|
-
sm: number;
|
28
|
-
md: number;
|
29
|
-
lg: number;
|
30
|
-
xl: number;
|
31
|
-
}>, X>(styles: S | X | import("../../../../src/types").CustomNamedStyles<S, {
|
32
|
-
xs: number;
|
33
|
-
sm: number;
|
34
|
-
md: number;
|
35
|
-
lg: number;
|
36
|
-
xl: number;
|
37
|
-
}> | ((theme: AppTheme) => X | import("../../../../src/types").CustomNamedStyles<X, {
|
38
|
-
xs: number;
|
39
|
-
sm: number;
|
40
|
-
md: number;
|
41
|
-
lg: number;
|
42
|
-
xl: number;
|
43
|
-
}>)) => S | X;
|
44
|
-
export { lightTheme, darkTheme };
|
45
|
-
export type { AppTheme };
|
46
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/styles/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAQ,SAAS;;;;;;;;;;;;;;;;;;;;;;GAAE,gBAAgB;;;;;;;;;;;;;;;;;;aAA+D,CAAA;AAEzG,OAAO,EACH,UAAU,EACV,SAAS,EACZ,CAAA;AAED,YAAY,EACR,QAAQ,EACX,CAAA"}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
export declare const lightTheme: {
|
2
|
-
colors: {
|
3
|
-
backgroundColor: string;
|
4
|
-
typography: string;
|
5
|
-
barbie: string;
|
6
|
-
oak: string;
|
7
|
-
sky: string;
|
8
|
-
fog: string;
|
9
|
-
aloes: string;
|
10
|
-
};
|
11
|
-
};
|
12
|
-
export declare const darkTheme: {
|
13
|
-
colors: {
|
14
|
-
backgroundColor: string;
|
15
|
-
typography: string;
|
16
|
-
barbie: string;
|
17
|
-
oak: string;
|
18
|
-
sky: string;
|
19
|
-
fog: string;
|
20
|
-
aloes: string;
|
21
|
-
};
|
22
|
-
};
|
23
|
-
export type AppTheme = typeof lightTheme | typeof darkTheme;
|
24
|
-
//# sourceMappingURL=theme.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/styles/theme.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU;;;;;;;;;;CAOtB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;CAOrB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,GAAG,OAAO,SAAS,CAAA"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import type { PropsWithChildren } from 'react';
|
3
|
-
interface UnistylesThemeProps extends PropsWithChildren {
|
4
|
-
theme: any;
|
5
|
-
}
|
6
|
-
export declare const UnistylesContext: React.Context<{}>;
|
7
|
-
export declare const UnistylesTheme: React.FunctionComponent<UnistylesThemeProps>;
|
8
|
-
export {};
|
9
|
-
//# sourceMappingURL=UnistylesTheme.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"UnistylesTheme.d.ts","sourceRoot":"","sources":["../../../src/UnistylesTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAA;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE9C,UAAU,mBAAoB,SAAQ,iBAAiB;IACnD,KAAK,EAAE,GAAG,CAAA;CACb;AAED,eAAO,MAAM,gBAAgB,mBAAoB,CAAA;AAEjD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC,mBAAmB,CAOvE,CAAA"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { Breakpoints, CreateStylesFactory, CustomNamedStyles, ExtractBreakpoints, RemoveKeysWithPrefix } from './types';
|
2
|
-
export declare const createUnistyles: <B extends Breakpoints, T = {}>(breakpoints: B) => {
|
3
|
-
createStyleSheet: <S extends CustomNamedStyles<S, B>, X>(styles: S | X | CustomNamedStyles<S, B> | ((theme: T) => X | CustomNamedStyles<X, B>)) => S | X;
|
4
|
-
useStyles: <ST extends CustomNamedStyles<ST, B>>(stylesheet?: ST | CreateStylesFactory<ST, T> | undefined) => {
|
5
|
-
theme: T;
|
6
|
-
breakpoint: keyof B & string;
|
7
|
-
styles: ExtractBreakpoints<RemoveKeysWithPrefix<ST, B>, B>;
|
8
|
-
};
|
9
|
-
};
|
10
|
-
//# sourceMappingURL=createUnistyles.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createUnistyles.d.ts","sourceRoot":"","sources":["../../../src/createUnistyles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EAEvB,MAAM,SAAS,CAAA;AAKhB,eAAO,MAAM,eAAe;;;;;;;CAuD3B,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useDimensions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,eAAO,MAAM,aAAa,QAAO,UAAmC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,eAAO,MAAM,aAAa,QAAO,UA8BhC,CAAA"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
type Optional<TOptional extends string> = TOptional | '';
|
2
|
-
type Separator = ',' | ', ';
|
3
|
-
type MediaQuery = `[${Separator}${bigint}]` | `[${bigint}${Optional<`${Separator}${bigint}`>}]`;
|
4
|
-
type WidthMediaQuery = `:w${MediaQuery}`;
|
5
|
-
type HeightMediaQuery = `:h${MediaQuery}`;
|
6
|
-
export type MediaQueries = `${WidthMediaQuery}${Optional<HeightMediaQuery>}` | `${HeightMediaQuery}${Optional<WidthMediaQuery>}`;
|
7
|
-
export {};
|
8
|
-
//# sourceMappingURL=mediaQueries.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/types/mediaQueries.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,SAAS,SAAS,MAAM,IAAI,SAAS,GAAG,EAAE,CAAA;AACxD,KAAK,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAE3B,KAAK,UAAU,GAAG,IAAI,SAAS,GAAG,MAAM,GAAG,GAAG,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,CAAA;AAC/F,KAAK,eAAe,GAAG,KAAK,UAAU,EAAE,CAAA;AACxC,KAAK,gBAAgB,GAAG,KAAK,UAAU,EAAE,CAAA;AAEzC,MAAM,MAAM,YAAY,GAClB,GAAG,eAAe,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,GACjD,GAAG,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/utils/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAAa,MAAM,UAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA"}
|
@@ -1,130 +0,0 @@
|
|
1
|
-
import type { ScreenSize } from '../types';
|
2
|
-
/**
|
3
|
-
* Extracts numeric values from a coded string.
|
4
|
-
*
|
5
|
-
* The function is designed to process strings that have a format like "w[100,200]" or "h[300]".
|
6
|
-
* It removes characters 'w', 'h', '[', and ']' from the input string and then extracts the numbers.
|
7
|
-
*
|
8
|
-
* @param {string} codedValue - The input string to extract values from.
|
9
|
-
* @returns {Array<number>} An array of extracted numbers. Can contain one or two numbers based on the input format.
|
10
|
-
*
|
11
|
-
* @example
|
12
|
-
* extractValues("w[100,200]") // returns [100, 200]
|
13
|
-
* extractValues("h[300]") // returns [300]
|
14
|
-
* extractValues("h[,300]") // returns [0,300]
|
15
|
-
* extractValues("h[100,]") // returns [100]
|
16
|
-
*/
|
17
|
-
export declare const extractValues: (codedValue: string) => Array<number>;
|
18
|
-
/**
|
19
|
-
* Determines if the given screen size matches the specified breakpoint query.
|
20
|
-
*
|
21
|
-
* The function checks if the screen size (width and/or height) falls within the range
|
22
|
-
* specified by the breakpoint query. The query can specify width (using 'w'), height (using 'h'),
|
23
|
-
* or both.
|
24
|
-
*
|
25
|
-
* @param {string} query - The breakpoint query string. Examples: 'w[100,200]', 'h[300]', 'w[100,200]h[300,400]'.
|
26
|
-
* @param {ScreenSize} screenSize - The screen size to check against the breakpoint query.
|
27
|
-
* @returns {boolean} True if the screen size matches the breakpoint query, false otherwise.
|
28
|
-
*
|
29
|
-
* @example
|
30
|
-
* const screenSize = { width: 150, height: 350 }
|
31
|
-
* isWithinBreakpoint('w[100,200]', screenSize) // returns true
|
32
|
-
* isWithinBreakpoint('h[400]', screenSize) // returns false
|
33
|
-
*/
|
34
|
-
export declare const isWithinBreakpoint: (query: string, screenSize: ScreenSize) => boolean;
|
35
|
-
/**
|
36
|
-
* Determines if the given width matches the specified width range in the query.
|
37
|
-
*
|
38
|
-
* The function checks if the provided width falls within the range specified by the query.
|
39
|
-
* The query specifies a width range using a format like 'w[100,200]'. If only one value is provided,
|
40
|
-
* it's treated as a minimum width.
|
41
|
-
*
|
42
|
-
* @param {string} query - The width query string. Examples: 'w[100,200]' or 'w[100]'.
|
43
|
-
* @param {number} width - The width to check against the query.
|
44
|
-
* @returns {boolean} True if the width matches the query range, false otherwise.
|
45
|
-
*
|
46
|
-
* @example
|
47
|
-
* isWithinTheWidth('w[100,200]', 150) // returns true
|
48
|
-
* isWithinTheWidth('w[100]', 50) // returns false
|
49
|
-
* isWithinTheWidth('w[100]', 150) // returns true
|
50
|
-
*/
|
51
|
-
export declare const isWithinTheWidth: (query: string, width: number) => boolean;
|
52
|
-
/**
|
53
|
-
* Determines if the given height matches the specified height range in the query.
|
54
|
-
*
|
55
|
-
* The function checks if the provided height falls within the range specified by the query.
|
56
|
-
* The query specifies a height range using a format like 'h[100,200]'. If only one value is provided,
|
57
|
-
* it's treated as a minimum height.
|
58
|
-
*
|
59
|
-
* @param {string} query - The height query string. Examples: 'h[100,200]' or 'h[100]'.
|
60
|
-
* @param {number} height - The height to check against the query.
|
61
|
-
* @returns {boolean} True if the height matches the query range, false otherwise.
|
62
|
-
*
|
63
|
-
* @example
|
64
|
-
* isWithinTheHeight('h[100,200]', 150) // returns true
|
65
|
-
* isWithinTheHeight('h[100]', 50) // returns false
|
66
|
-
* isWithinTheHeight('h[100]', 150) // returns true
|
67
|
-
*/
|
68
|
-
export declare const isWithinTheHeight: (query: string, height: number) => boolean;
|
69
|
-
/**
|
70
|
-
* Determines if the given screen size matches both the specified width and height ranges in the query.
|
71
|
-
*
|
72
|
-
* The function checks if the provided screen size (both width and height) falls within the ranges
|
73
|
-
* specified by the query. The query can specify both width and height using a format like 'w[100,200]:h[300,400]'.
|
74
|
-
*
|
75
|
-
* @param {string} query - The combined width and height query string. Example: 'w[100,200]:h[300,400]'.
|
76
|
-
* @param {ScreenSize} screenSize - The screen size to check against the query.
|
77
|
-
* @returns {boolean} True if the screen size matches both the width and height ranges in the query, false otherwise.
|
78
|
-
*
|
79
|
-
* @example
|
80
|
-
* const screenSize = { width: 150, height: 350 }
|
81
|
-
* isWithinTheWidthAndHeight('w[100,200]:h[300,400]', screenSize) // returns true
|
82
|
-
* isWithinTheWidthAndHeight('w[100,200]:h[400,500]', screenSize) // returns false
|
83
|
-
*/
|
84
|
-
export declare const isWithinTheWidthAndHeight: (query: string, screenSize: ScreenSize) => boolean;
|
85
|
-
/**
|
86
|
-
* Checks if the given query string is a valid custom media query.
|
87
|
-
*
|
88
|
-
* The valid custom media query formats include:
|
89
|
-
* - :w[200]
|
90
|
-
* - :w[0, 200]
|
91
|
-
* - :w[, 300]
|
92
|
-
* - :h[200]
|
93
|
-
* - :h[0, 500]
|
94
|
-
* - :h[,200]
|
95
|
-
* - :w[100, 300]:h[200,500]
|
96
|
-
* - :h[200,500]:w[100, 300]
|
97
|
-
*
|
98
|
-
* @param {string} query - The query string to be checked.
|
99
|
-
* @returns {boolean} Returns `true` if the query is a valid custom media query, otherwise `false`.
|
100
|
-
* @example
|
101
|
-
*
|
102
|
-
* isMediaQuery(':w[200]') // true
|
103
|
-
* isMediaQuery(':w100]') // false
|
104
|
-
*/
|
105
|
-
export declare const isMediaQuery: (query: string) => boolean;
|
106
|
-
/**
|
107
|
-
* Retrieves the first matching custom media query key based on the provided screen size.
|
108
|
-
*
|
109
|
-
* The function processes an array of media queries and returns the first query that matches
|
110
|
-
* the given screen size. The media queries can be in formats like:
|
111
|
-
* - w[200]
|
112
|
-
* - w[0, 200]
|
113
|
-
* - w[, 300]
|
114
|
-
* - h[200]
|
115
|
-
* - h[0, 500]
|
116
|
-
* - h[,200]
|
117
|
-
* - w[100, 300]:h[200,500]
|
118
|
-
* - h[200,500]:w[100, 300]
|
119
|
-
*
|
120
|
-
* @param {Array<[string, string | number]>} mediaQueries - An array of tuples containing media query keys and associated values.
|
121
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
122
|
-
* @returns {string | undefined} Returns the first matching media query key or `undefined` if no match is found.
|
123
|
-
* @example
|
124
|
-
*
|
125
|
-
* const queries = [[':w[200]', 'value1'], [':h[300,500]', 'value2']]
|
126
|
-
* const size = { width: 250, height: 400 }
|
127
|
-
* getKeyForCustomMediaQuery(queries, size) // ':w[200]
|
128
|
-
*/
|
129
|
-
export declare const getKeyForCustomMediaQuery: (mediaQueries: Array<[string, string | number | undefined]>, screenSize: ScreenSize) => string | undefined;
|
130
|
-
//# sourceMappingURL=mediaQueries.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/utils/mediaQueries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,eAAgB,MAAM,KAAG,MAAM,MAAM,CAQ9D,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,cAAc,UAAU,KAAG,OAc1E,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,SAAS,MAAM,KAAG,OAQ/D,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,UAAW,MAAM,UAAU,MAAM,KAAG,OAQjE,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,UAAW,MAAM,cAAc,UAAU,KAAG,OAQjF,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAI5C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,iBAAkB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,cAAc,UAAU,KAAG,MAAM,GAAG,SAevI,CAAA"}
|