react-native-unistyles 1.2.0 → 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 +45 -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 +44 -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 -17
- 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 +3 -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 +58 -33
- 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 +54 -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 -20
- 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 -12
- 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/PlatformColors.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/PlatformColors.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 -9
- 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 -7
- 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 -14
- 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
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
Authors: Gary Court and Austin Appleby
|
3
|
+
Compatible with React Native Web
|
4
|
+
https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/StyleSheet/compiler/hash.js#L65
|
5
|
+
*/
|
6
|
+
export const murmurhash2_32_gc = (str, seed) => {
|
7
|
+
let l = str.length;
|
8
|
+
let h = seed ^ l;
|
9
|
+
let i = 0;
|
10
|
+
let k;
|
11
|
+
while (l >= 4) {
|
12
|
+
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
|
13
|
+
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
14
|
+
k ^= k >>> 24;
|
15
|
+
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
16
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
|
17
|
+
l -= 4;
|
18
|
+
++i;
|
19
|
+
}
|
20
|
+
switch (l) {
|
21
|
+
// @ts-ignore
|
22
|
+
case 3:
|
23
|
+
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
24
|
+
// @ts-ignore
|
25
|
+
case 2:
|
26
|
+
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
27
|
+
case 1:
|
28
|
+
h ^= str.charCodeAt(i) & 0xff;
|
29
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
30
|
+
}
|
31
|
+
h ^= h >>> 13;
|
32
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
33
|
+
h ^= h >>> 15;
|
34
|
+
return h >>> 0;
|
35
|
+
};
|
36
|
+
//# sourceMappingURL=hash32.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["murmurhash2_32_gc","str","seed","l","length","h","i","k","charCodeAt"],"sourceRoot":"../../../src","sources":["utils/hash32.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,GAAGA,CAACC,GAAW,EAAEC,IAAY,KAAK;EAC5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CAAC;IAC5C,KAAK,CAAC;MACFD,CAAC,IAAIJ,GAAG,CAACO,UAAU,CAACF,CAAC,CAAC,GAAG,IAAI;MAC7BD,CAAC,GACH,CAACA,CAAC,GAAG,MAAM,IAAI,UAAU,IACxB,CAAE,CAACA,CAAC,KAAK,EAAE,IAAI,UAAU,GAAI,MAAM,KAAK,EAAE,CAAC;EAClD;EAEAA,CAAC,IAAIA,CAAC,KAAK,EAAE;EACbA,CAAC,GAAG,CAACA,CAAC,GAAG,MAAM,IAAI,UAAU,IAAI,CAAE,CAACA,CAAC,KAAK,EAAE,IAAI,UAAU,GAAI,MAAM,KAAK,EAAE,CAAC;EAC5EA,CAAC,IAAIA,CAAC,KAAK,EAAE;EAEb,OAAOA,CAAC,KAAK,CAAC;AAClB,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export {
|
2
|
-
export
|
3
|
-
export {
|
4
|
-
export { proxifyFunction, parseStyle } from './styles';
|
5
|
-
export {
|
6
|
-
export {
|
1
|
+
export { mq } from './mq';
|
2
|
+
export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq, isUnistylesMq } from './mqParser';
|
3
|
+
export { getValueForBreakpoint } from './breakpoints';
|
4
|
+
export { proxifyFunction, parseStyle, isPlatformColor } from './styles';
|
5
|
+
export { withPlugins } from './withPlugins';
|
6
|
+
export { generateReactNativeWebId } from './generateId';
|
7
7
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["mq","getKeyForUnistylesMediaQuery","isWithinTheWidthAndHeight","isValidMq","parseMq","isUnistylesMq","getValueForBreakpoint","proxifyFunction","parseStyle","isPlatformColor","withPlugins","generateReactNativeWebId"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,EAAE,QAAQ,MAAM;AAEzB,SAASC,4BAA4B,EAAEC,yBAAyB,EAAEC,SAAS,EAAEC,OAAO,EAAEC,aAAa,QAAQ,YAAY;AACvH,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,EAAEC,UAAU,EAAEC,eAAe,QAAQ,UAAU;AACvE,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,wBAAwB,QAAQ,cAAc"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { unistyles } from '../core';
|
2
|
+
const getMQValue = value => {
|
3
|
+
if (typeof value === 'number') {
|
4
|
+
return value;
|
5
|
+
}
|
6
|
+
if (value === null) {
|
7
|
+
return 0;
|
8
|
+
}
|
9
|
+
return unistyles.registry.breakpoints[value] ?? 0;
|
10
|
+
};
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Utility to create cross-platform media queries
|
14
|
+
* @returns - JavaScript symbol to be used in your stylesheet
|
15
|
+
*/
|
16
|
+
export const mq = {
|
17
|
+
only: {
|
18
|
+
width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`,
|
19
|
+
height: (hMin = 0, hMax = Infinity) => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
|
20
|
+
},
|
21
|
+
width: (wMin = 0, wMax = Infinity) => ({
|
22
|
+
and: {
|
23
|
+
height: (hMin = 0, hMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
|
24
|
+
}
|
25
|
+
}),
|
26
|
+
height: (hMin = 0, hMax = Infinity) => ({
|
27
|
+
and: {
|
28
|
+
width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
|
29
|
+
}
|
30
|
+
})
|
31
|
+
};
|
32
|
+
//# sourceMappingURL=mq.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["unistyles","getMQValue","value","registry","breakpoints","mq","only","width","wMin","wMax","Infinity","height","hMin","hMax","and"],"sourceRoot":"../../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IP,UAAU,CAACQ,IAAI,CAAE,OAAMR,UAAU,CAACW,IAAI,CAAE,KAAIX,UAAU,CAACY,IAAI,CAAE;IACjG;EACJ,CAAC;AACL,CAAC"}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
2
|
+
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
3
|
+
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
4
|
+
export const parseMq = mq => {
|
5
|
+
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
6
|
+
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
7
|
+
return {
|
8
|
+
width: width ? {
|
9
|
+
from: Number(fromW),
|
10
|
+
to: Number(toW)
|
11
|
+
} : undefined,
|
12
|
+
height: height ? {
|
13
|
+
from: Number(fromH),
|
14
|
+
to: Number(toH)
|
15
|
+
} : undefined
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
19
|
+
export const isValidMq = parsedMq => {
|
20
|
+
const {
|
21
|
+
width,
|
22
|
+
height
|
23
|
+
} = parsedMq;
|
24
|
+
if (width && height) {
|
25
|
+
return width.from <= width.to && height.from <= height.to;
|
26
|
+
}
|
27
|
+
if (width) {
|
28
|
+
return width.from <= width.to;
|
29
|
+
}
|
30
|
+
if (height) {
|
31
|
+
return height.from <= height.to;
|
32
|
+
}
|
33
|
+
return false;
|
34
|
+
};
|
35
|
+
export const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
|
36
|
+
const {
|
37
|
+
width,
|
38
|
+
height
|
39
|
+
} = parsedMq;
|
40
|
+
if (width && height) {
|
41
|
+
return isWithinTheWidth(width, screenSize.width) && isWithinTheHeight(height, screenSize.height);
|
42
|
+
}
|
43
|
+
if (width) {
|
44
|
+
return isWithinTheWidth(width, screenSize.width);
|
45
|
+
}
|
46
|
+
if (height) {
|
47
|
+
return isWithinTheHeight(height, screenSize.height);
|
48
|
+
}
|
49
|
+
return false;
|
50
|
+
};
|
51
|
+
const isWithinTheWidth = (width, screenWidth) => {
|
52
|
+
const {
|
53
|
+
from,
|
54
|
+
to
|
55
|
+
} = width;
|
56
|
+
return screenWidth >= from && screenWidth <= to;
|
57
|
+
};
|
58
|
+
const isWithinTheHeight = (height, screenHeight) => {
|
59
|
+
const {
|
60
|
+
from,
|
61
|
+
to
|
62
|
+
} = height;
|
63
|
+
return screenHeight >= from && screenHeight <= to;
|
64
|
+
};
|
65
|
+
export const getKeyForUnistylesMediaQuery = (mediaQueries, screenSize) => {
|
66
|
+
const mq = mediaQueries.find(([key]) => {
|
67
|
+
if (!isUnistylesMq(key)) {
|
68
|
+
return false;
|
69
|
+
}
|
70
|
+
const parsedMq = parseMq(key);
|
71
|
+
if (!isValidMq(parsedMq)) {
|
72
|
+
return false;
|
73
|
+
}
|
74
|
+
return isWithinTheWidthAndHeight(parsedMq, screenSize);
|
75
|
+
});
|
76
|
+
return mq?.at(0);
|
77
|
+
};
|
78
|
+
//# sourceMappingURL=mqParser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","key","at"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAYpE,O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AAC,CAAC;EAEF,OAAOjB,EAAE,EAAE0B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
@@ -1,30 +1,8 @@
|
|
1
1
|
import { getValueForBreakpoint } from './breakpoints';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
* Proxies a function to parse its return value for custom media queries or breakpoints.
|
7
|
-
*
|
8
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
9
|
-
*
|
10
|
-
* @param {Function} fn - The function to be proxified.
|
11
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
12
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
13
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
14
|
-
*
|
15
|
-
* @returns {Function} Returns the proxified function
|
16
|
-
*
|
17
|
-
* @example
|
18
|
-
*
|
19
|
-
* const myFunction = () => ({ ':w[200]': 'value1', sm: 'value2' })
|
20
|
-
* const screenSize = { width: 250, height: 400 }
|
21
|
-
* const breakpoints = { sm: 300, md: 600 }
|
22
|
-
*
|
23
|
-
* const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
|
24
|
-
* proxifiedFunction() // parsed style based on screenSize and breakpoints
|
25
|
-
*/
|
26
|
-
export const proxifyFunction = (fn, breakpoint, screenSize, breakpointPairs) => new Proxy(fn, {
|
27
|
-
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, breakpointPairs)
|
2
|
+
import { isAndroid, isIOS } from '../common';
|
3
|
+
import { withPlugins } from './withPlugins';
|
4
|
+
export const proxifyFunction = (key, fn, variant) => new Proxy(fn, {
|
5
|
+
apply: (target, thisArg, argumentsList) => withPlugins(key, parseStyle(target.apply(thisArg, argumentsList), variant))
|
28
6
|
});
|
29
7
|
export const isPlatformColor = value => {
|
30
8
|
if (isIOS) {
|
@@ -32,51 +10,45 @@ export const isPlatformColor = value => {
|
|
32
10
|
}
|
33
11
|
return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
|
34
12
|
};
|
13
|
+
export const parseStyle = (style, variant = {}, parseMediaQueries = true) => Object.entries(style || {}).reduce((acc, [key, value]) => {
|
14
|
+
// nested objects
|
15
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
16
|
+
acc[key] = parseStyle(value, variant);
|
17
|
+
return acc;
|
18
|
+
}
|
35
19
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
if (isTransform && Array.isArray(value)) {
|
71
|
-
return [key, value.map(value => parseStyle(value, breakpoint, screenSize, breakpointPairs))];
|
72
|
-
}
|
73
|
-
const isDynamicFunction = typeof value === 'function';
|
74
|
-
const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
|
75
|
-
if (isDynamicFunction || isValidStyle) {
|
76
|
-
return [key, value];
|
77
|
-
}
|
78
|
-
return [key, getValueForBreakpoint(value, breakpoint, screenSize, breakpointPairs)];
|
79
|
-
}));
|
80
|
-
return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
|
81
|
-
};
|
20
|
+
// transforms
|
21
|
+
if (key === 'transform' && Array.isArray(value)) {
|
22
|
+
acc[key] = value.map(value => parseStyle(value, variant));
|
23
|
+
return acc;
|
24
|
+
}
|
25
|
+
|
26
|
+
// values or platform colors
|
27
|
+
if (typeof value !== 'object' || isPlatformColor(value)) {
|
28
|
+
acc[key] = value;
|
29
|
+
return acc;
|
30
|
+
}
|
31
|
+
if (key === 'variants') {
|
32
|
+
return {
|
33
|
+
...acc,
|
34
|
+
...Object.keys(value).reduce((acc, key) => ({
|
35
|
+
...acc,
|
36
|
+
// this will parse the styles of the selected variant (or default if it is undefined), if selected variant has no styles then it will fallback to default styles
|
37
|
+
...parseStyle(value[key][variant[key] || 'default'] ?? value[key].default ?? {})
|
38
|
+
}), {})
|
39
|
+
};
|
40
|
+
}
|
41
|
+
|
42
|
+
// don't parse media queries and breakpoints
|
43
|
+
if (!parseMediaQueries) {
|
44
|
+
return {
|
45
|
+
...acc,
|
46
|
+
[key]: value
|
47
|
+
};
|
48
|
+
}
|
49
|
+
return {
|
50
|
+
...acc,
|
51
|
+
[key]: getValueForBreakpoint(value)
|
52
|
+
};
|
53
|
+
}, {});
|
82
54
|
//# sourceMappingURL=styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getValueForBreakpoint","
|
1
|
+
{"version":3,"names":["getValueForBreakpoint","isAndroid","isIOS","withPlugins","proxifyFunction","key","fn","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","parseMediaQueries","Object","entries","reduce","acc","Array","isArray","map","keys","default"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,SAAS,EAAEC,KAAK,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EACZC,OAA0C,KAC/B,IAAIC,KAAK,CAACF,EAAE,EAAE;EACzBG,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAAKT,WAAW,CAACE,GAAG,EAAEQ,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEL,OAAO,CAAC;AACzH,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIb,KA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AEV,GAAG,CAAC,CAACE,OAAO,CAACF,GAAG,CAAyB,IAAI,SAAS,CAAC,IAAKU,KAAK,CAAEV,GAAG,CAAC,CAACuB,OAAO,IAAI,CAAC,CAAC;MAC/G,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;EACL;;EAEA;EACA,IAAI,CAACT,iBAAiB,EAAE;IACpB,OAAO;MACH,GAAGI,GAAG;MACN,CAAClB,GAAG,GAAGU;IACX,CAAC;EACL;EAEA,OAAO;IACH,GAAGQ,GAAG;IACN,CAAClB,GAAG,GAAGL,qBAAqB,CAACe,KAAgC;EACjE,CAAC;AACL,CAAC,EAAE,CAAC,CAAM,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { unistyles } from '../core';
|
2
|
+
export const withPlugins = (key, style) => unistyles.registry.plugins.reduce((acc, plugin) => {
|
3
|
+
if (plugin.onParsedStyle) {
|
4
|
+
return plugin.onParsedStyle(key, acc, unistyles.runtime);
|
5
|
+
}
|
6
|
+
return acc;
|
7
|
+
}, style);
|
8
|
+
//# sourceMappingURL=withPlugins.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["unistyles","withPlugins","key","style","registry","plugins","reduce","acc","plugin","onParsedStyle","runtime"],"sourceRoot":"../../../src","sources":["utils/withPlugins.ts"],"mappings":"AACA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,WAAW,GAAGA,CACvBC,GAAW,EACXC,KAAc,KACbH,SAAS,CAACI,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACpD,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACP,GAAG,EAAEK,GAAG,EAAEP,SAAS,CAACU,OAAO,CAAC;EAC5D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEJ,KAAK,CAAC"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
export declare const warn: (message: string) => void;
|
2
|
+
export declare const isWeb: boolean;
|
3
|
+
export declare const isIOS: boolean;
|
4
|
+
export declare const isAndroid: boolean;
|
5
|
+
export declare const isMobile: boolean;
|
6
|
+
export declare const isServer: boolean;
|
7
|
+
export declare const ScreenOrientation: {
|
8
|
+
readonly Landscape: "landscape";
|
9
|
+
readonly Portrait: "portrait";
|
10
|
+
};
|
11
|
+
export declare enum IOSContentSizeCategory {
|
12
|
+
ExtraExtraExtraLarge = "xxxLarge",
|
13
|
+
ExtraExtraLarge = "xxLarge",
|
14
|
+
ExtraLarge = "xLarge",
|
15
|
+
Large = "Large",
|
16
|
+
Medium = "Medium",
|
17
|
+
Small = "Small",
|
18
|
+
ExtraSmall = "xSmall",
|
19
|
+
Unspecified = "unspecified"
|
20
|
+
}
|
21
|
+
export declare enum AndroidContentSizeCategory {
|
22
|
+
Small = "Small",
|
23
|
+
Default = "Default",
|
24
|
+
Large = "Large",
|
25
|
+
ExtraLarge = "ExtraLarge",
|
26
|
+
Huge = "Huge"
|
27
|
+
}
|
28
|
+
export declare enum UnistylesEventType {
|
29
|
+
Theme = "theme",
|
30
|
+
Layout = "layout",
|
31
|
+
Plugin = "plugin",
|
32
|
+
DynamicTypeSize = "dynamicTypeSize"
|
33
|
+
}
|
34
|
+
export declare enum UnistylesError {
|
35
|
+
RuntimeUnavailable = "Unistyles runtime is not available. Make sure you followed the installation instructions",
|
36
|
+
ThemeNotFound = "You are trying to get a theme that is not registered with UnistylesRegistry",
|
37
|
+
ThemeNotRegistered = "You are trying to set a theme that was not registered with UnistylesRegistry",
|
38
|
+
ThemeNotSelected = "Your themes are registered, but you didn't select the initial theme",
|
39
|
+
ThemesCannotBeEmpty = "You are trying to register empty themes object",
|
40
|
+
BreakpointsCannotBeEmpty = "You are trying to register empty breakpoints object",
|
41
|
+
BreakpointsMustStartFromZero = "You are trying to register breakpoints that don't start from 0",
|
42
|
+
InvalidPluginName = "Plugin name can't start from reserved prefix __unistyles",
|
43
|
+
DuplicatePluginName = "You are trying to register a plugin with a name that is already registered",
|
44
|
+
CantRemoveInternalPlugin = "You are trying to remove an internal unistyles plugin"
|
45
|
+
}
|
46
|
+
//# sourceMappingURL=common.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAqB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,sBAAsB;IAC9B,oBAAoB,aAAa;IACjC,eAAe,YAAY;IAC3B,UAAU,WAAW;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,UAAU,WAAW;IACrB,WAAW,gBAAgB;CAC9B;AAED,oBAAY,0BAA0B;IAClC,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,IAAI,SAAS;CAChB;AAED,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,eAAe,oBAAoB;CACtC;AAED,oBAAY,cAAc;IACtB,kBAAkB,6FAA6F;IAC/G,aAAa,gFAAgF;IAC7F,kBAAkB,iFAAiF;IACnG,gBAAgB,wEAAyE;IACzF,mBAAmB,mDAAmD;IACtE,wBAAwB,wDAAwD;IAChF,4BAA4B,mEAAoE;IAChG,iBAAiB,6DAA8D;IAC/E,mBAAmB,+EAA+E;IAClG,wBAAwB,0DAA0D;CACrF"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import type { UnistylesBridge, UnistylesConfig, UnistylesPlugin } from '../types';
|
2
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
3
|
+
export declare class UnistyleRegistry {
|
4
|
+
private unistylesBridge;
|
5
|
+
config: UnistylesConfig;
|
6
|
+
plugins: Array<UnistylesPlugin>;
|
7
|
+
themeNames: Array<keyof UnistylesThemes>;
|
8
|
+
themes: UnistylesThemes;
|
9
|
+
breakpoints: UnistylesBreakpoints;
|
10
|
+
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
11
|
+
constructor(unistylesBridge: UnistylesBridge);
|
12
|
+
addThemes: (themes: UnistylesThemes) => {
|
13
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
14
|
+
addThemes: any;
|
15
|
+
addConfig: (config: UnistylesConfig) => {
|
16
|
+
addBreakpoints: any;
|
17
|
+
addThemes: any;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
addConfig: (config: UnistylesConfig) => {
|
21
|
+
addBreakpoints: any;
|
22
|
+
addThemes: any;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
26
|
+
addThemes: (themes: UnistylesThemes) => {
|
27
|
+
addBreakpoints: any;
|
28
|
+
addConfig: (config: UnistylesConfig) => {
|
29
|
+
addBreakpoints: any;
|
30
|
+
addThemes: any;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
addConfig: (config: UnistylesConfig) => {
|
34
|
+
addBreakpoints: any;
|
35
|
+
addThemes: any;
|
36
|
+
};
|
37
|
+
};
|
38
|
+
addConfig: (config: UnistylesConfig) => {
|
39
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
40
|
+
addThemes: (themes: UnistylesThemes) => {
|
41
|
+
addBreakpoints: any;
|
42
|
+
addConfig: any;
|
43
|
+
};
|
44
|
+
addConfig: any;
|
45
|
+
};
|
46
|
+
addThemes: (themes: UnistylesThemes) => {
|
47
|
+
addBreakpoints: any;
|
48
|
+
addConfig: any;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
getTheme: (forName: keyof UnistylesThemes) => never;
|
52
|
+
addPlugin: (plugin: UnistylesPlugin, notify?: boolean) => void;
|
53
|
+
removePlugin: (plugin: UnistylesPlugin) => void;
|
54
|
+
hasTheme: (name: keyof UnistylesThemes) => boolean;
|
55
|
+
}
|
56
|
+
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAItE,qBAAa,gBAAgB;IAUb,OAAO,CAAC,eAAe;IAT5B,MAAM,EAAE,eAAe,CAAK;IAC5B,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,CAE9B;IACD,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe;sCAcL,oBAAoB;;gCAW9B,eAAe;;;;;4BAAf,eAAe;;;;MAb1C;IAEM,cAAc,gBAAiB,oBAAoB;4BAd9B,eAAe;;gCAyBf,eAAe;;;;;4BAAf,eAAe;;;;MAF1C;IAEM,SAAS,WAAY,eAAe;sCAXL,oBAAoB;gCAd9B,eAAe;;;;;;4BAAf,eAAe;;;;MAiD1C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAchD;IAEM,SAAS,WAAY,eAAe,WAAU,OAAO,UAW3D;IAEM,YAAY,WAAY,eAAe,UAO7C;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAwB;CACzE"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { UnistylesRuntime } from './UnistylesRuntime';
|
2
|
+
import { UnistyleRegistry } from './UnistyleRegistry';
|
3
|
+
declare class Unistyles {
|
4
|
+
private _runtime;
|
5
|
+
private _registry;
|
6
|
+
private _bridge;
|
7
|
+
constructor();
|
8
|
+
get registry(): UnistyleRegistry;
|
9
|
+
get runtime(): UnistylesRuntime;
|
10
|
+
}
|
11
|
+
export declare const unistyles: Unistyles;
|
12
|
+
export {};
|
13
|
+
//# sourceMappingURL=Unistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../../src/core/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAgBhC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export declare class UnistylesBridgeWeb {
|
2
|
+
#private;
|
3
|
+
constructor();
|
4
|
+
install(): boolean;
|
5
|
+
private useTheme;
|
6
|
+
private useBreakpoints;
|
7
|
+
private useAdaptiveThemes;
|
8
|
+
private addPlugin;
|
9
|
+
private removePlugin;
|
10
|
+
private getTheme;
|
11
|
+
private setupListeners;
|
12
|
+
private getBreakpointFromScreenWidth;
|
13
|
+
private getPreferredColorScheme;
|
14
|
+
private emitPluginChange;
|
15
|
+
private emitThemeChange;
|
16
|
+
private emitLayoutChange;
|
17
|
+
}
|
18
|
+
export declare const UnistylesModule: UnistylesBridgeWeb;
|
19
|
+
//# sourceMappingURL=UnistylesModule.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAMA,qBAAa,kBAAkB;;;IAwBpB,OAAO;IA+Dd,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;CAe3B;AAED,eAAO,MAAM,eAAe,oBAA2B,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesModule.native.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.native.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IACzB,OAAO,IAAI,OAAO,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,eAAe,uBAAoD,CAAA"}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import type { UnistylesBridge, UnistylesPlugin } from '../types';
|
2
|
+
import type { UnistylesThemes } from '../global';
|
3
|
+
import type { UnistyleRegistry } from './UnistyleRegistry';
|
4
|
+
/**
|
5
|
+
* Utility to interact with the Unistyles during runtime
|
6
|
+
*/
|
7
|
+
export declare class UnistylesRuntime {
|
8
|
+
private unistylesBridge;
|
9
|
+
private unistylesRegistry;
|
10
|
+
constructor(unistylesBridge: UnistylesBridge, unistylesRegistry: UnistyleRegistry);
|
11
|
+
/**
|
12
|
+
* Get the current color scheme
|
13
|
+
* @returns - The current color scheme
|
14
|
+
*/
|
15
|
+
get colorScheme(): import("../types").ColorSchemeName;
|
16
|
+
/**
|
17
|
+
* Get info about adaptive themes
|
18
|
+
* @returns - boolean indicating if the adaptive themes are enabled
|
19
|
+
*/
|
20
|
+
get hasAdaptiveThemes(): boolean;
|
21
|
+
/**
|
22
|
+
* Get the current theme name
|
23
|
+
* @returns - The current theme name
|
24
|
+
*/
|
25
|
+
get themeName(): never;
|
26
|
+
/**
|
27
|
+
* Get the current content size category
|
28
|
+
* @returns - The current content size category
|
29
|
+
*/
|
30
|
+
get contentSizeCategory(): import("../common").IOSContentSizeCategory | import("../common").AndroidContentSizeCategory;
|
31
|
+
/**
|
32
|
+
* Get the current breakpoint based on device size
|
33
|
+
* @returns - The current breakpoint
|
34
|
+
*/
|
35
|
+
get breakpoint(): keyof import("../global").UnistylesBreakpoints;
|
36
|
+
/**
|
37
|
+
* Get registered breakpoints with UnitylesRegistry
|
38
|
+
* @returns - The registered breakpoints
|
39
|
+
*/
|
40
|
+
get breakpoints(): import("../global").UnistylesBreakpoints;
|
41
|
+
/**
|
42
|
+
* Get the names of currently enabled plugins
|
43
|
+
* @returns - The names of currently enabled plugins
|
44
|
+
*/
|
45
|
+
get enabledPlugins(): string[];
|
46
|
+
/**
|
47
|
+
* Get the screen size
|
48
|
+
* @returns - The screen size { width, height }
|
49
|
+
*/
|
50
|
+
get screen(): {
|
51
|
+
width: number;
|
52
|
+
height: number;
|
53
|
+
};
|
54
|
+
/**
|
55
|
+
* Get the screen orientation
|
56
|
+
* @returns - The screen orientation
|
57
|
+
*/
|
58
|
+
get orientation(): "landscape" | "portrait";
|
59
|
+
/**
|
60
|
+
* Switch to a different theme
|
61
|
+
* @param name - The name of the theme to switch to
|
62
|
+
* @returns - boolean indicating if the theme was switched
|
63
|
+
*/
|
64
|
+
setTheme: (name: keyof UnistylesThemes) => true | undefined;
|
65
|
+
/**
|
66
|
+
* Enable or disable adaptive themes
|
67
|
+
* @param enable - boolean indicating if adaptive themes should be enabled
|
68
|
+
*/
|
69
|
+
setAdaptiveThemes: (enable: boolean) => void;
|
70
|
+
/**
|
71
|
+
* Enable a plugin
|
72
|
+
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
73
|
+
*/
|
74
|
+
addPlugin: (plugin: UnistylesPlugin) => void;
|
75
|
+
/**
|
76
|
+
* Disable a plugin
|
77
|
+
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
78
|
+
*/
|
79
|
+
removePlugin: (plugin: UnistylesPlugin) => void;
|
80
|
+
}
|
81
|
+
//# sourceMappingURL=UnistylesRuntime.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,iBAAiB,YAE3B;IAED;;;OAGG;IACH,IAAW,SAAS,UAEnB;IAED;;;OAGG;IACH,IAAW,mBAAmB,gGAE7B;IAED;;;OAGG;IACH,IAAW,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;;OAIG;IACI,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAED;;;OAGG;IACI,iBAAiB,WAAY,OAAO,UAE1C;IAED;;;OAGG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;OAGG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { StyleSheetWithSuperPowers } from './types';
|
2
|
+
/**
|
3
|
+
* Utility to create a stylesheet with superpowers
|
4
|
+
* Compatible with React Native StyleSheet.create
|
5
|
+
* @param stylesheet - The stylesheet with superpowers to be used
|
6
|
+
*/
|
7
|
+
export declare const createStyleSheet: <S extends StyleSheetWithSuperPowers>(stylesheet: S) => S;
|
8
|
+
//# sourceMappingURL=createStyleSheet.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,2DAAwE,CAAA"}
|