react-native-unistyles 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +38 -30
- package/lib/commonjs/UnistylesTheme.js +21 -0
- package/lib/commonjs/UnistylesTheme.js.map +1 -0
- package/lib/commonjs/createUnistyles.js +57 -0
- package/lib/commonjs/createUnistyles.js.map +1 -0
- package/lib/commonjs/hooks/index.js +3 -24
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useDimensions.js +10 -0
- package/lib/commonjs/hooks/useDimensions.js.map +1 -0
- package/lib/commonjs/hooks/useDimensions.web.js +34 -0
- package/lib/commonjs/hooks/useDimensions.web.js.map +1 -0
- package/lib/commonjs/index.js +6 -63
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/index.js +0 -11
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/mediaQueries.js +2 -0
- package/lib/commonjs/types/{unistyles.js.map → mediaQueries.js.map} +1 -1
- package/lib/commonjs/utils/breakpoints.js +122 -20
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/common.js +20 -0
- package/lib/commonjs/utils/common.js.map +1 -0
- package/lib/commonjs/utils/index.js +54 -22
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mediaQueries.js +189 -0
- package/lib/commonjs/utils/mediaQueries.js.map +1 -0
- package/lib/{module/types/common.js.map → commonjs/utils/module.d.js.map} +1 -1
- package/lib/commonjs/utils/normalizeStyles.js +10 -0
- package/lib/commonjs/utils/normalizeStyles.js.map +1 -0
- package/lib/commonjs/{normalizer/normalizeStyle.js → utils/normalizeStyles.web.js} +5 -5
- package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -0
- package/lib/commonjs/{normalizer → utils}/normalizer.js +3 -2
- package/lib/commonjs/utils/normalizer.js.map +1 -0
- package/lib/commonjs/utils/styles.js +72 -45
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/module/UnistylesTheme.js +12 -0
- package/lib/module/UnistylesTheme.js.map +1 -0
- package/lib/module/createUnistyles.js +50 -0
- package/lib/module/createUnistyles.js.map +1 -0
- package/lib/module/hooks/index.js +1 -4
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useDimensions.js +3 -0
- package/lib/module/hooks/useDimensions.js.map +1 -0
- package/lib/module/hooks/useDimensions.web.js +27 -0
- package/lib/module/hooks/useDimensions.web.js.map +1 -0
- package/lib/module/index.js +2 -30
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.js +0 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/mediaQueries.js +2 -0
- package/lib/{commonjs/types/stylesheet.js.map → module/types/mediaQueries.js.map} +1 -1
- package/lib/module/utils/breakpoints.js +120 -19
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/common.js +12 -0
- package/lib/module/utils/common.js.map +1 -0
- package/lib/module/utils/index.js +6 -6
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mediaQueries.js +176 -0
- package/lib/module/utils/mediaQueries.js.map +1 -0
- package/lib/{commonjs/types/variants.js.map → module/utils/module.d.js.map} +1 -1
- package/lib/module/utils/normalizeStyles.js +3 -0
- package/lib/module/utils/normalizeStyles.js.map +1 -0
- package/lib/module/{normalizer/normalizeStyle.js → utils/normalizeStyles.web.js} +3 -3
- package/lib/module/utils/normalizeStyles.web.js.map +1 -0
- package/lib/module/{normalizer → utils}/normalizer.js +3 -2
- package/lib/module/utils/normalizer.js.map +1 -0
- package/lib/module/utils/styles.js +72 -44
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/typescript/examples/expo/src/App.d.ts +3 -0
- package/lib/typescript/examples/expo/src/App.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +7 -0
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/index.d.ts +9 -0
- package/lib/typescript/examples/expo/src/examples/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/index.d.ts +2 -0
- package/lib/typescript/examples/expo/src/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +8 -0
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/index.d.ts +46 -0
- package/lib/typescript/examples/expo/src/styles/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/theme.d.ts +24 -0
- package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +1 -0
- package/lib/typescript/src/UnistylesTheme.d.ts +9 -0
- package/lib/typescript/src/UnistylesTheme.d.ts.map +1 -0
- package/lib/typescript/src/createUnistyles.d.ts +10 -0
- package/lib/typescript/src/createUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +1 -4
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useDimensions.d.ts +3 -0
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +3 -0
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -76
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +17 -25
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +25 -11
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +2 -7
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +8 -0
- package/lib/typescript/src/types/mediaQueries.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +62 -2
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/common.d.ts +7 -0
- package/lib/typescript/src/utils/common.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +6 -7
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +130 -0
- package/lib/typescript/src/utils/mediaQueries.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizeStyles.d.ts +2 -0
- package/lib/typescript/src/utils/normalizeStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +5 -0
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +49 -3
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/package.json +25 -46
- package/src/UnistylesTheme.tsx +17 -0
- package/src/__tests__/createUnistyles.spec.tsx +192 -0
- package/src/createUnistyles.ts +70 -0
- package/src/hooks/index.ts +1 -4
- package/src/hooks/useDimensions.ts +4 -0
- package/src/hooks/useDimensions.web.ts +34 -0
- package/src/index.ts +2 -50
- package/src/types/breakpoints.ts +33 -58
- package/src/types/core.ts +36 -11
- package/src/types/index.ts +7 -12
- package/src/types/mediaQueries.ts +10 -0
- package/src/utils/breakpoints.ts +124 -28
- package/src/utils/common.ts +14 -0
- package/src/utils/index.ts +13 -7
- package/src/utils/mediaQueries.ts +201 -0
- package/src/utils/normalizeStyles.ts +2 -0
- package/src/{normalizer/normalizeStyle.ts → utils/normalizeStyles.web.ts} +3 -3
- package/src/{normalizer → utils}/normalizer.ts +4 -5
- package/src/utils/styles.ts +102 -54
- package/android/CMakeLists.txt +0 -27
- package/android/build.gradle +0 -75
- package/android/src/main/cxx/cpp-adapter.cpp +0 -132
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +0 -189
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +0 -18
- package/cxx/UnistylesRuntime.cpp +0 -318
- package/cxx/UnistylesRuntime.h +0 -74
- package/ios/UnistylesHelpers.h +0 -3
- package/ios/UnistylesHelpers.mm +0 -5
- package/ios/UnistylesModule.h +0 -16
- package/ios/UnistylesModule.mm +0 -138
- package/ios/platform/Platform_iOS.h +0 -21
- package/ios/platform/Platform_iOS.mm +0 -132
- package/ios/platform/Platform_macOS.h +0 -20
- package/ios/platform/Platform_macOS.mm +0 -83
- package/lib/commonjs/common.js +0 -60
- package/lib/commonjs/common.js.map +0 -1
- package/lib/commonjs/core/UnistyleRegistry.js +0 -94
- package/lib/commonjs/core/UnistyleRegistry.js.map +0 -1
- package/lib/commonjs/core/Unistyles.js +0 -32
- package/lib/commonjs/core/Unistyles.js.map +0 -1
- package/lib/commonjs/core/UnistylesModule.js +0 -197
- package/lib/commonjs/core/UnistylesModule.js.map +0 -1
- package/lib/commonjs/core/UnistylesModule.native.js +0 -9
- package/lib/commonjs/core/UnistylesModule.native.js.map +0 -1
- package/lib/commonjs/core/UnistylesRuntime.js +0 -140
- package/lib/commonjs/core/UnistylesRuntime.js.map +0 -1
- package/lib/commonjs/core/index.js +0 -13
- package/lib/commonjs/core/index.js.map +0 -1
- package/lib/commonjs/createStyleSheet.js +0 -14
- package/lib/commonjs/createStyleSheet.js.map +0 -1
- package/lib/commonjs/global.js +0 -2
- package/lib/commonjs/global.js.map +0 -1
- package/lib/commonjs/hooks/useCSS.js +0 -44
- package/lib/commonjs/hooks/useCSS.js.map +0 -1
- package/lib/commonjs/hooks/useCSS.native.js +0 -9
- package/lib/commonjs/hooks/useCSS.native.js.map +0 -1
- package/lib/commonjs/hooks/useInitialTheme.js +0 -17
- package/lib/commonjs/hooks/useInitialTheme.js.map +0 -1
- package/lib/commonjs/hooks/useUnistyles.js +0 -64
- package/lib/commonjs/hooks/useUnistyles.js.map +0 -1
- package/lib/commonjs/hooks/useVariants.js +0 -14
- package/lib/commonjs/hooks/useVariants.js.map +0 -1
- package/lib/commonjs/normalizer/index.js +0 -32
- package/lib/commonjs/normalizer/index.js.map +0 -1
- package/lib/commonjs/normalizer/module.d.js.map +0 -1
- package/lib/commonjs/normalizer/normalizeStyle.js.map +0 -1
- package/lib/commonjs/normalizer/normalizer.js.map +0 -1
- package/lib/commonjs/normalizer/normalizer.macos.js +0 -3
- package/lib/commonjs/normalizer/normalizer.macos.js.map +0 -1
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +0 -14
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +0 -1
- package/lib/commonjs/plugins/index.js +0 -20
- package/lib/commonjs/plugins/index.js.map +0 -1
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +0 -12
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +0 -1
- package/lib/commonjs/types/common.js +0 -2
- package/lib/commonjs/types/common.js.map +0 -1
- package/lib/commonjs/types/plugin.js +0 -6
- package/lib/commonjs/types/plugin.js.map +0 -1
- package/lib/commonjs/types/stylesheet.js +0 -6
- package/lib/commonjs/types/unistyles.js +0 -6
- package/lib/commonjs/types/variants.js +0 -2
- package/lib/commonjs/useStyles.js +0 -47
- package/lib/commonjs/useStyles.js.map +0 -1
- package/lib/commonjs/utils/cssMediaQuery.js +0 -244
- package/lib/commonjs/utils/cssMediaQuery.js.map +0 -1
- package/lib/commonjs/utils/generateId.js +0 -15
- package/lib/commonjs/utils/generateId.js.map +0 -1
- package/lib/commonjs/utils/hash32.js +0 -43
- package/lib/commonjs/utils/hash32.js.map +0 -1
- package/lib/commonjs/utils/mq.js +0 -38
- package/lib/commonjs/utils/mq.js.map +0 -1
- package/lib/commonjs/utils/mqParser.js +0 -89
- package/lib/commonjs/utils/mqParser.js.map +0 -1
- package/lib/commonjs/utils/withPlugins.js +0 -15
- package/lib/commonjs/utils/withPlugins.js.map +0 -1
- package/lib/module/common.js +0 -53
- package/lib/module/common.js.map +0 -1
- package/lib/module/core/UnistyleRegistry.js +0 -87
- package/lib/module/core/UnistyleRegistry.js.map +0 -1
- package/lib/module/core/Unistyles.js +0 -26
- package/lib/module/core/Unistyles.js.map +0 -1
- package/lib/module/core/UnistylesModule.js +0 -190
- package/lib/module/core/UnistylesModule.js.map +0 -1
- package/lib/module/core/UnistylesModule.native.js +0 -3
- package/lib/module/core/UnistylesModule.native.js.map +0 -1
- package/lib/module/core/UnistylesRuntime.js +0 -133
- package/lib/module/core/UnistylesRuntime.js.map +0 -1
- package/lib/module/core/index.js +0 -2
- package/lib/module/core/index.js.map +0 -1
- package/lib/module/createStyleSheet.js +0 -7
- package/lib/module/createStyleSheet.js.map +0 -1
- package/lib/module/global.js +0 -2
- package/lib/module/global.js.map +0 -1
- package/lib/module/hooks/useCSS.js +0 -37
- package/lib/module/hooks/useCSS.js.map +0 -1
- package/lib/module/hooks/useCSS.native.js +0 -2
- package/lib/module/hooks/useCSS.native.js.map +0 -1
- package/lib/module/hooks/useInitialTheme.js +0 -10
- package/lib/module/hooks/useInitialTheme.js.map +0 -1
- package/lib/module/hooks/useUnistyles.js +0 -57
- package/lib/module/hooks/useUnistyles.js.map +0 -1
- package/lib/module/hooks/useVariants.js +0 -7
- package/lib/module/hooks/useVariants.js.map +0 -1
- package/lib/module/normalizer/index.js +0 -3
- package/lib/module/normalizer/index.js.map +0 -1
- package/lib/module/normalizer/module.d.js.map +0 -1
- package/lib/module/normalizer/normalizeStyle.js.map +0 -1
- package/lib/module/normalizer/normalizer.js.map +0 -1
- package/lib/module/normalizer/normalizer.macos.js +0 -2
- package/lib/module/normalizer/normalizer.macos.js.map +0 -1
- package/lib/module/plugins/cssMediaQueriesPlugin.js +0 -7
- package/lib/module/plugins/cssMediaQueriesPlugin.js.map +0 -1
- package/lib/module/plugins/index.js +0 -3
- package/lib/module/plugins/index.js.map +0 -1
- package/lib/module/plugins/normalizeWebStylesPlugin.js +0 -6
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +0 -1
- package/lib/module/types/common.js +0 -2
- package/lib/module/types/plugin.js +0 -2
- package/lib/module/types/plugin.js.map +0 -1
- package/lib/module/types/stylesheet.js +0 -2
- package/lib/module/types/stylesheet.js.map +0 -1
- package/lib/module/types/unistyles.js +0 -2
- package/lib/module/types/unistyles.js.map +0 -1
- package/lib/module/types/variants.js +0 -2
- package/lib/module/types/variants.js.map +0 -1
- package/lib/module/useStyles.js +0 -40
- package/lib/module/useStyles.js.map +0 -1
- package/lib/module/utils/cssMediaQuery.js +0 -237
- package/lib/module/utils/cssMediaQuery.js.map +0 -1
- package/lib/module/utils/generateId.js +0 -7
- package/lib/module/utils/generateId.js.map +0 -1
- package/lib/module/utils/hash32.js +0 -36
- package/lib/module/utils/hash32.js.map +0 -1
- package/lib/module/utils/mq.js +0 -32
- package/lib/module/utils/mq.js.map +0 -1
- package/lib/module/utils/mqParser.js +0 -78
- package/lib/module/utils/mqParser.js.map +0 -1
- package/lib/module/utils/withPlugins.js +0 -8
- package/lib/module/utils/withPlugins.js.map +0 -1
- package/lib/typescript/src/common.d.ts +0 -46
- package/lib/typescript/src/common.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +0 -56
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +0 -1
- package/lib/typescript/src/core/Unistyles.d.ts +0 -13
- package/lib/typescript/src/core/Unistyles.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesModule.d.ts +0 -19
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesModule.native.d.ts +0 -6
- package/lib/typescript/src/core/UnistylesModule.native.d.ts.map +0 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +0 -81
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +0 -1
- package/lib/typescript/src/core/index.d.ts +0 -3
- package/lib/typescript/src/core/index.d.ts.map +0 -1
- package/lib/typescript/src/createStyleSheet.d.ts +0 -8
- package/lib/typescript/src/createStyleSheet.d.ts.map +0 -1
- package/lib/typescript/src/global.d.ts +0 -7
- package/lib/typescript/src/global.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCSS.d.ts +0 -3
- package/lib/typescript/src/hooks/useCSS.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCSS.native.d.ts +0 -3
- package/lib/typescript/src/hooks/useCSS.native.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +0 -3
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts +0 -14
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useVariants.d.ts +0 -3
- package/lib/typescript/src/hooks/useVariants.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/index.d.ts +0 -3
- package/lib/typescript/src/normalizer/index.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts +0 -3
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizer.d.ts.map +0 -1
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts +0 -1
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts.map +0 -1
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +0 -3
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +0 -1
- package/lib/typescript/src/plugins/index.d.ts +0 -3
- package/lib/typescript/src/plugins/index.d.ts.map +0 -1
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +0 -3
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +0 -1
- package/lib/typescript/src/types/common.d.ts +0 -3
- package/lib/typescript/src/types/common.d.ts.map +0 -1
- package/lib/typescript/src/types/plugin.d.ts +0 -7
- package/lib/typescript/src/types/plugin.d.ts.map +0 -1
- package/lib/typescript/src/types/stylesheet.d.ts +0 -40
- package/lib/typescript/src/types/stylesheet.d.ts.map +0 -1
- package/lib/typescript/src/types/unistyles.d.ts +0 -53
- package/lib/typescript/src/types/unistyles.d.ts.map +0 -1
- package/lib/typescript/src/types/variants.d.ts +0 -14
- package/lib/typescript/src/types/variants.d.ts.map +0 -1
- package/lib/typescript/src/useStyles.d.ts +0 -16
- package/lib/typescript/src/useStyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/cssMediaQuery.d.ts +0 -4
- package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +0 -1
- package/lib/typescript/src/utils/generateId.d.ts +0 -2
- package/lib/typescript/src/utils/generateId.d.ts.map +0 -1
- package/lib/typescript/src/utils/hash32.d.ts +0 -2
- package/lib/typescript/src/utils/hash32.d.ts.map +0 -1
- package/lib/typescript/src/utils/mq.d.ts +0 -26
- package/lib/typescript/src/utils/mq.d.ts.map +0 -1
- package/lib/typescript/src/utils/mqParser.d.ts +0 -16
- package/lib/typescript/src/utils/mqParser.d.ts.map +0 -1
- package/lib/typescript/src/utils/withPlugins.d.ts +0 -3
- package/lib/typescript/src/utils/withPlugins.d.ts.map +0 -1
- package/react-native-unistyles.podspec +0 -22
- package/src/__tests__/mocks.ts +0 -24
- package/src/common.ts +0 -55
- package/src/core/UnistyleRegistry.ts +0 -108
- package/src/core/Unistyles.ts +0 -35
- package/src/core/UnistylesModule.native.ts +0 -7
- package/src/core/UnistylesModule.ts +0 -230
- package/src/core/UnistylesRuntime.ts +0 -135
- package/src/core/index.ts +0 -2
- package/src/createStyleSheet.ts +0 -8
- package/src/global.ts +0 -6
- package/src/hooks/useCSS.native.ts +0 -3
- package/src/hooks/useCSS.ts +0 -51
- package/src/hooks/useInitialTheme.ts +0 -11
- package/src/hooks/useUnistyles.ts +0 -64
- package/src/hooks/useVariants.ts +0 -10
- package/src/normalizer/index.ts +0 -2
- package/src/normalizer/normalizer.macos.ts +0 -1
- package/src/plugins/cssMediaQueriesPlugin.ts +0 -8
- package/src/plugins/index.ts +0 -2
- package/src/plugins/normalizeWebStylesPlugin.ts +0 -7
- package/src/types/common.ts +0 -2
- package/src/types/plugin.ts +0 -7
- package/src/types/stylesheet.ts +0 -49
- package/src/types/unistyles.ts +0 -63
- package/src/types/variants.ts +0 -19
- package/src/useStyles.ts +0 -60
- package/src/utils/cssMediaQuery.ts +0 -268
- package/src/utils/generateId.ts +0 -10
- package/src/utils/hash32.ts +0 -53
- package/src/utils/mq.ts +0 -57
- package/src/utils/mqParser.ts +0 -99
- package/src/utils/withPlugins.ts +0 -13
- /package/lib/commonjs/{normalizer → utils}/module.d.js +0 -0
- /package/lib/module/{normalizer → utils}/module.d.js +0 -0
- /package/lib/typescript/src/{normalizer → utils}/normalizer.d.ts +0 -0
- /package/src/{normalizer → utils}/module.d.ts +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/plugin.ts"],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/stylesheet.ts"],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/unistyles.ts"],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/variants.ts"],"mappings":""}
|
package/lib/module/useStyles.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { useMemo } from 'react';
|
2
|
-
import { StyleSheet } from 'react-native';
|
3
|
-
import { parseStyle, proxifyFunction, withPlugins } from './utils';
|
4
|
-
import { useCSS, useUnistyles, useVariants } from './hooks';
|
5
|
-
import { unistyles } from './core';
|
6
|
-
import { isWeb } from './common';
|
7
|
-
/**
|
8
|
-
* Hook that enables all the features of Unistyles
|
9
|
-
* @param stylesheet - The stylesheet with superpowers to be used
|
10
|
-
* @param variantsMap - The map of variants to be used
|
11
|
-
* @returns - The theme, current breakpoint and RN compatible styles
|
12
|
-
*/
|
13
|
-
export const useStyles = (stylesheet, variantsMap) => {
|
14
|
-
const {
|
15
|
-
theme,
|
16
|
-
layout,
|
17
|
-
plugins
|
18
|
-
} = useUnistyles();
|
19
|
-
const variants = useVariants(variantsMap);
|
20
|
-
const parsedStyles = useMemo(() => typeof stylesheet === 'function' ? stylesheet(theme) : stylesheet, [theme, stylesheet, layout]);
|
21
|
-
const dynamicStyleSheet = useMemo(() => Object.entries(parsedStyles || {}).reduce((acc, [key, value]) => {
|
22
|
-
if (typeof value === 'function') {
|
23
|
-
return {
|
24
|
-
...acc,
|
25
|
-
[key]: proxifyFunction(key, value, variants)
|
26
|
-
};
|
27
|
-
}
|
28
|
-
return StyleSheet.create({
|
29
|
-
...acc,
|
30
|
-
[key]: withPlugins(key, parseStyle(value, variants, !isWeb || !unistyles.registry.config.experimentalCSSMediaQueries))
|
31
|
-
});
|
32
|
-
}, {}), [parsedStyles, variants, plugins]);
|
33
|
-
useCSS(dynamicStyleSheet);
|
34
|
-
return {
|
35
|
-
theme,
|
36
|
-
breakpoint: layout.breakpoint,
|
37
|
-
styles: dynamicStyleSheet
|
38
|
-
};
|
39
|
-
};
|
40
|
-
//# sourceMappingURL=useStyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","withPlugins","useCSS","useUnistyles","useVariants","unistyles","isWeb","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","key","value","create","registry","config","experimentalCSSMediaQueries","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAClE,SAASC,MAAM,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAG3D,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,KAAK,QAAQ,UAAU;AAQhC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGT,YAAY,CAAC,CAAC;EACjD,MAAMU,QAAQ,GAAGT,WAAW,CAACK,WAAW,CAAC;EACzC,MAAMK,YAAY,GAAGjB,OAAO,CAAC,MAAM,OAAOW,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMI,iBAAiB,GAAGlB,OAAO,CAAC,MAAMmB,MAAM,CACzCC,OAAO,CAACH,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BI,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAGpB,eAAe,CAACoB,GAAG,EAAEC,KAAK,EAAER,QAAQ;MAC/C,CAAC;IACL;IAEA,OAAOf,UAAU,CAACwB,MAAM,CAAC;MACrB,GAAGH,GAAG;MACN,CAACC,GAAG,GAAGnB,WAAW,CAACmB,GAAG,EAAErB,UAAU,CAC9BsB,KAAK,EACLR,QAAQ,EACR,CAACP,KAAK,IAAI,CAACD,SAAS,CAACkB,QAAQ,CAACC,MAAM,CAACC,2BAA2B,CACpE;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACX,YAAY,EAAED,QAAQ,EAAED,OAAO,CAC5C,CAAC;EAEDV,MAAM,CAACa,iBAA8C,CAAC;EAEtD,OAAO;IACHL,KAAK;IACLgB,UAAU,EAAEf,MAAM,CAACe,UAAU;IAC7BC,MAAM,EAAEZ;EACZ,CAAC;AACL,CAAC"}
|
@@ -1,237 +0,0 @@
|
|
1
|
-
import { normalizeColor } from '../normalizer';
|
2
|
-
import { isUnistylesMq, isValidMq, parseMq } from './mqParser';
|
3
|
-
import { generateReactNativeWebId } from './generateId';
|
4
|
-
export const createMediaQueryForStyles = (styles, runtime) => {
|
5
|
-
const withMediaQueries = Object.entries(styles).filter(([, value]) => typeof value === 'object').reduce((acc, [prop, value]) => {
|
6
|
-
const objectKeys = Object.keys(value);
|
7
|
-
const mediaQueries = objectKeys.filter(key => isUnistylesMq(key));
|
8
|
-
const breakpoints = objectKeys.filter(key => runtime.breakpoints[key]);
|
9
|
-
if (mediaQueries.length === 0 && breakpoints.length === 0) {
|
10
|
-
return acc;
|
11
|
-
}
|
12
|
-
const className = generateReactNativeWebId(prop, '""');
|
13
|
-
const breakpointsStyles = getBreakpointsStyles(prop, value, runtime, className);
|
14
|
-
const mediaQueriesStyles = getMediaQueriesFromMQ(prop, value, className);
|
15
|
-
return {
|
16
|
-
...acc,
|
17
|
-
[prop]: `
|
18
|
-
${breakpointsStyles}
|
19
|
-
${mediaQueriesStyles}
|
20
|
-
`.trim()
|
21
|
-
};
|
22
|
-
}, {});
|
23
|
-
return {
|
24
|
-
...styles,
|
25
|
-
...withMediaQueries
|
26
|
-
};
|
27
|
-
};
|
28
|
-
const getMaxWidthMediaQuery = width => {
|
29
|
-
if (!width) {
|
30
|
-
return '';
|
31
|
-
}
|
32
|
-
if (width.to === Infinity) {
|
33
|
-
return '';
|
34
|
-
}
|
35
|
-
return `and (max-width: ${width.to}px)`;
|
36
|
-
};
|
37
|
-
const getMaxHeightMediaQuery = height => {
|
38
|
-
if (!height) {
|
39
|
-
return '';
|
40
|
-
}
|
41
|
-
if (height.to === Infinity) {
|
42
|
-
return '';
|
43
|
-
}
|
44
|
-
return `and (max-height: ${height.to}px)`;
|
45
|
-
};
|
46
|
-
const getMediaQueriesFromMQ = (prop, value, className) => Object.entries(value).reduce((acc, [key, value]) => {
|
47
|
-
const result = parseMq(key);
|
48
|
-
if (!isValidMq(result)) {
|
49
|
-
return acc;
|
50
|
-
}
|
51
|
-
if (result.width && result.height) {
|
52
|
-
return `${acc}
|
53
|
-
|
54
|
-
@media screen and (min-width: ${result.width.from}px) and (min-height: ${result.height.from}px) ${getMaxWidthMediaQuery(result.width)} ${getMaxHeightMediaQuery(result.height)} {
|
55
|
-
.${className} {
|
56
|
-
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
57
|
-
}
|
58
|
-
}
|
59
|
-
`;
|
60
|
-
}
|
61
|
-
if (result.width) {
|
62
|
-
return `${acc}
|
63
|
-
|
64
|
-
@media screen and (min-width: ${result.width.from}px) ${getMaxWidthMediaQuery(result.width)} {
|
65
|
-
.${className} {
|
66
|
-
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
67
|
-
}
|
68
|
-
}
|
69
|
-
`;
|
70
|
-
}
|
71
|
-
if (result.height) {
|
72
|
-
return `${acc}
|
73
|
-
|
74
|
-
@media screen and (min-height: ${result.height.from}px) ${getMaxHeightMediaQuery(result.height)} {
|
75
|
-
.${className} {
|
76
|
-
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
77
|
-
}
|
78
|
-
}
|
79
|
-
`;
|
80
|
-
}
|
81
|
-
return acc;
|
82
|
-
}, '');
|
83
|
-
const getBreakpointsStyles = (prop, value, runtime, className) => Object.entries(value).reduce((acc, [key, value]) => {
|
84
|
-
const breakpoint = runtime.breakpoints[key];
|
85
|
-
if (breakpoint === undefined) {
|
86
|
-
return acc;
|
87
|
-
}
|
88
|
-
return `${acc}
|
89
|
-
|
90
|
-
@media screen and (min-width: ${breakpoint}px) {
|
91
|
-
.${className} {
|
92
|
-
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
93
|
-
}
|
94
|
-
}
|
95
|
-
`;
|
96
|
-
}, '');
|
97
|
-
const normalizePropName = prop => prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
98
|
-
const normalizeWebValue = (prop, value) => {
|
99
|
-
if (value === undefined) {
|
100
|
-
return 'unset';
|
101
|
-
}
|
102
|
-
switch (prop) {
|
103
|
-
// colors
|
104
|
-
case 'color':
|
105
|
-
case 'backgroundColor':
|
106
|
-
case 'borderColor':
|
107
|
-
case 'borderBottomColor':
|
108
|
-
case 'borderLeftColor':
|
109
|
-
case 'borderRightColor':
|
110
|
-
case 'borderTopColor':
|
111
|
-
case 'borderBlockColor':
|
112
|
-
case 'borderBlockEndColor':
|
113
|
-
case 'borderBlockStartColor':
|
114
|
-
case 'textDecorationColor':
|
115
|
-
return normalizeColor(value);
|
116
|
-
|
117
|
-
// dimensions
|
118
|
-
case 'width':
|
119
|
-
case 'height':
|
120
|
-
case 'minWidth':
|
121
|
-
case 'minHeight':
|
122
|
-
case 'maxWidth':
|
123
|
-
case 'maxHeight':
|
124
|
-
case 'borderRadius':
|
125
|
-
case 'borderWidth':
|
126
|
-
case 'borderBottomLeftRadius':
|
127
|
-
case 'borderBottomRightRadius':
|
128
|
-
case 'borderEndEndRadius':
|
129
|
-
case 'borderEndStartRadius':
|
130
|
-
case 'borderStartEndRadius':
|
131
|
-
case 'borderStartStartRadius':
|
132
|
-
case 'borderTopLeftRadius':
|
133
|
-
case 'borderTopRightRadius':
|
134
|
-
case 'borderBottomWidth':
|
135
|
-
case 'borderLeftWidth':
|
136
|
-
case 'borderRightWidth':
|
137
|
-
case 'borderTopWidth':
|
138
|
-
case 'bottom':
|
139
|
-
case 'left':
|
140
|
-
case 'right':
|
141
|
-
case 'top':
|
142
|
-
case 'marginTop':
|
143
|
-
case 'marginBottom':
|
144
|
-
case 'marginLeft':
|
145
|
-
case 'marginRight':
|
146
|
-
case 'paddingTop':
|
147
|
-
case 'paddingBottom':
|
148
|
-
case 'paddingLeft':
|
149
|
-
case 'paddingRight':
|
150
|
-
case 'flexBasis':
|
151
|
-
case 'rowGap':
|
152
|
-
case 'columnGap':
|
153
|
-
case 'gap':
|
154
|
-
case 'margin':
|
155
|
-
case 'padding':
|
156
|
-
case 'fontSize':
|
157
|
-
case 'letterSpacing':
|
158
|
-
return `${value}px`;
|
159
|
-
|
160
|
-
// without unit
|
161
|
-
case 'borderStyle':
|
162
|
-
case 'pointerEvents':
|
163
|
-
case 'backfaceVisibility':
|
164
|
-
case 'alignContent':
|
165
|
-
case 'alignItems':
|
166
|
-
case 'alignSelf':
|
167
|
-
case 'flexDirection':
|
168
|
-
case 'flexWrap':
|
169
|
-
case 'flex':
|
170
|
-
case 'aspectRatio':
|
171
|
-
case 'opacity':
|
172
|
-
case 'direction':
|
173
|
-
case 'zIndex':
|
174
|
-
case 'justifyContent':
|
175
|
-
case 'overflow':
|
176
|
-
case 'display':
|
177
|
-
case 'position':
|
178
|
-
case 'flexGrow':
|
179
|
-
case 'flexShrink':
|
180
|
-
case 'fontFamily':
|
181
|
-
case 'fontStyle':
|
182
|
-
case 'textDecorationLine':
|
183
|
-
case 'textAlign':
|
184
|
-
case 'textDecorationStyle':
|
185
|
-
case 'lineHeight':
|
186
|
-
case 'textTransform':
|
187
|
-
case 'fontVariant':
|
188
|
-
case 'verticalAlign':
|
189
|
-
case 'objectFit':
|
190
|
-
return value;
|
191
|
-
|
192
|
-
// to be transformed for now
|
193
|
-
// not supported
|
194
|
-
case 'marginHorizontal':
|
195
|
-
case 'paddingHorizontal':
|
196
|
-
case 'marginVertical':
|
197
|
-
case 'paddingVertical':
|
198
|
-
case 'shadowColor':
|
199
|
-
case 'shadowOffset':
|
200
|
-
case 'shadowOpacity':
|
201
|
-
case 'shadowRadius':
|
202
|
-
case 'transform':
|
203
|
-
case 'transformMatrix':
|
204
|
-
case 'fontWeight':
|
205
|
-
case 'textShadowOffset':
|
206
|
-
case 'textShadowRadius':
|
207
|
-
case 'textShadowColor':
|
208
|
-
return '';
|
209
|
-
|
210
|
-
// unsupported
|
211
|
-
case 'borderStartColor':
|
212
|
-
case 'borderEndColor':
|
213
|
-
case 'borderEndWidth':
|
214
|
-
case 'borderBottomEndRadius':
|
215
|
-
case 'borderBottomStartRadius':
|
216
|
-
case 'borderCurve':
|
217
|
-
case 'elevation':
|
218
|
-
case 'borderTopEndRadius':
|
219
|
-
case 'borderTopStartRadius':
|
220
|
-
case 'borderStartWidth':
|
221
|
-
case 'start':
|
222
|
-
case 'end':
|
223
|
-
case 'margin-end':
|
224
|
-
case 'margin-start':
|
225
|
-
case 'padding-end':
|
226
|
-
case 'padding-start':
|
227
|
-
case 'writingDirection':
|
228
|
-
case 'textAlignVertical':
|
229
|
-
case 'includeFontPadding':
|
230
|
-
case 'resizeMode':
|
231
|
-
case 'overlayColor':
|
232
|
-
case 'tintColor':
|
233
|
-
default:
|
234
|
-
return '';
|
235
|
-
}
|
236
|
-
};
|
237
|
-
//# sourceMappingURL=cssMediaQuery.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["normalizeColor","isUnistylesMq","isValidMq","parseMq","generateReactNativeWebId","createMediaQueryForStyles","styles","runtime","withMediaQueries","Object","entries","filter","value","reduce","acc","prop","objectKeys","keys","mediaQueries","key","breakpoints","length","className","breakpointsStyles","getBreakpointsStyles","mediaQueriesStyles","getMediaQueriesFromMQ","trim","getMaxWidthMediaQuery","width","to","Infinity","getMaxHeightMediaQuery","height","result","from","normalizePropName","normalizeWebValue","breakpoint","undefined","replace","toLowerCase"],"sourceRoot":"../../../src","sources":["utils/cssMediaQuery.ts"],"mappings":"AAAA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,aAAa,EAAEC,SAAS,EAAEC,OAAO,QAAgC,YAAY;AAEtF,SAASC,wBAAwB,QAAQ,cAAc;AAGvD,OAAO,MAAMC,yBAAyB,GAAGA,CAACC,MAAe,EAAEC,OAAyB,KAAc;EAC9F,MAAMC,gBAAgB,GAAGC,MAAM,CAC1BC,OAAO,CAACJ,MAAM,CAAC,CACfK,MAAM,CAAC,CAAC,GAAGC,KAAK,CAAC,KAAK,OAAOA,KAAK,KAAK,QAAQ,CAAC,CAChDC,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,IAAI,EAAEH,KAAK,CAAC,KAAK;IAC5B,MAAMI,UAAU,GAAGP,MAAM,CAACQ,IAAI,CAACL,KAAK,CAAC;IACrC,MAAMM,YAAY,GAAGF,UAAU,CAACL,MAAM,CAACQ,GAAG,IAAIlB,aAAa,CAACkB,GAAG,CAAC,CAAC;IACjE,MAAMC,WAAW,GAAGJ,UAAU,CAACL,MAAM,CAACQ,GAAG,IAAIZ,OAAO,CAACa,WAAW,CAACD,GAAG,CAAqC,CAAC;IAE1G,IAAID,YAAY,CAACG,MAAM,KAAK,CAAC,IAAID,WAAW,CAACC,MAAM,KAAK,CAAC,EAAE;MACvD,OAAOP,GAAG;IACd;IAEA,MAAMQ,SAAS,GAAGlB,wBAAwB,CAACW,IAAI,EAAE,IAAI,CAAC;IACtD,MAAMQ,iBAAiB,GAAGC,oBAAoB,CAACT,IAAI,EAAEH,KAAK,EAA6BL,OAAO,EAAEe,SAAS,CAAC;IAC1G,MAAMG,kBAAkB,GAAGC,qBAAqB,CAACX,IAAI,EAAEH,KAAK,EAA6BU,SAAS,CAAC;IAEnG,OAAO;MAC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IAC9B,KAAK,aAAa;IAClB,KAAK,WAAW;IAChB,KAAK,oBAAoB;IACzB,KAAK,sBAAsB;IAC3B,KAAK,kBAAkB;IACvB,KAAK,OAAO;IACZ,KAAK,KAAK;IACV,KAAK,YAAY;IACjB,KAAK,cAAc;IACnB,KAAK,aAAa;IAClB,KAAK,eAAe;IACpB,KAAK,kBAAkB;IACvB,KAAK,mBAAmB;IACxB,KAAK,oBAAoB;IACzB,KAAK,YAAY;IACjB,KAAK,cAAc;IACnB,KAAK,WAAW;IAChB;MACI,OAAO,EAAE;EACjB;AACJ,CAAC"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
// eslint-disable-next-line camelcase
|
2
|
-
import { murmurhash2_32_gc } from './hash32';
|
3
|
-
export const generateReactNativeWebId = (key, value) => {
|
4
|
-
const hashedString = murmurhash2_32_gc(key + value, 1).toString(36);
|
5
|
-
return process.env.NODE_ENV !== 'production' ? `r-${key}-${hashedString}` : `r-${hashedString}`;
|
6
|
-
};
|
7
|
-
//# sourceMappingURL=generateId.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["murmurhash2_32_gc","generateReactNativeWebId","key","value","hashedString","toString","process","env","NODE_ENV"],"sourceRoot":"../../../src","sources":["utils/generateId.ts"],"mappings":"AAAA;AACA,SAASA,iBAAiB,QAAQ,UAAU;AAE5C,OAAO,MAAMC,wBAAwB,GAAGA,CAACC,GAAW,EAAEC,KAAa,KAAa;EAC5E,MAAMC,YAAY,GAAGJ,iBAAiB,CAACE,GAAG,GAAGC,KAAK,EAAE,CAAC,CAAC,CAACE,QAAQ,CAAC,EAAE,CAAC;EAEnE,OAAOC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GACrC,KAAIN,GAAI,IAAGE,YAAa,EAAC,GACzB,KAAIA,YAAa,EAAC;AAC7B,CAAC"}
|
@@ -1,36 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["murmurhash2_32_gc","str","seed","l","length","h","i","k","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,CAAC,GAAG,IAAI,KAAK,EAAE;IAC7C;IACA,KAAK,CAAC;MACFD,CAAC,IAAI,CAACJ,GAAG,CAACO,UAAU,CAACF,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,KAAK,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"}
|
package/lib/module/utils/mq.js
DELETED
@@ -1,32 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["unistyles","getMQValue","value","registry","breakpoints","mq","only","width","wMin","wMax","Infinity","height","hMin","hMax","and"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":"AAEA,SAASA,SAAS,QAAQ,SAAS;AAqBnC,MAAMC,UAAU,GAAIC,KAAwB,IAAK;EAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,CAAC;EACZ;EAEA,OAAOF,SAAS,CAACG,QAAQ,CAACC,WAAW,CAACF,KAAK,CAAC,IAAI,CAAC;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMG,EAAa,GAAG;EACzBC,IAAI,EAAE;IACFC,KAAK,EAAEA,CAACC,IAAuB,GAAG,CAAC,EAAEC,IAAa,GAAGC,QAAQ,KAAO,MAAKT,UAAU,CAACO,IAAI,CAAE,KAAIP,UAAU,CAACQ,IAAI,CAAE,GAAwB;IACvIE,MAAM,EAAEA,CAACC,IAAuB,GAAG,CAAC,EAAEC,IAAa,GAAGH,QAAQ,KAAO,MAAKT,UAAU,CAACW,IAAI,CAAE,KAAIX,UAAU,CAACY,IAAI,CAAE;EACpH,CAAC;EACDN,KAAK,EAAEA,CAACC,IAAuB,GAAG,CAAC,EAAEC,IAAa,GAAGC,QAAQ,MAAM;IAC/DI,GAAG,EAAE;MACDH,MAAM,EAAEA,CAACC,IAAuB,GAAG,CAAC,EAAEC,IAAa,GAAGH,QAAQ,KACxD,MAAKT,UAAU,CAACO,IAAI,CAAE,KAAIP,UAAU,CAACQ,IAAI,CAAE,OAAMR,UAAU,CAACW,IAAI,CAAE,KAAIX,UAAU,CAACY,IAAI,CAAE;IACjG;EACJ,CAAC,CAAC;EACFF,MAAM,EAAEA,CAACC,IAAuB,GAAG,CAAC,EAAEC,IAAa,GAAGH,QAAQ,MAAM;IAChEI,GAAG,EAAE;MACDP,KAAK,EAAEA,CAACC,IAAuB,GAAG,CAAC,EAAEC,IAAa,GAAGC,QAAQ,KACvD,MAAKT,UAAU,CAACO,IAAI,CAAE,KAAIP,UAAU,CAACQ,IAAI,CAAE,OAAMR,UAAU,CAACW,IAAI,CAAE,KAAIX,UAAU,CAACY,IAAI,CAAE;IACjG;EACJ,CAAC;AACL,CAAC"}
|
@@ -1,78 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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,OAAO,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EACtD,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,IAAI,EAAEC,MAAM,CAACP,KAAK,CAAC;MACnBQ,EAAE,EAAED,MAAM,CAACN,GAAG;IAClB,CAAC,GAAGQ,SAAS;IACbN,MAAM,EAAEA,MAAM,GAAG;MACbG,IAAI,EAAEC,MAAM,CAACH,KAAK,CAAC;MACnBI,EAAE,EAAED,MAAM,CAACF,GAAG;IAClB,CAAC,GAAGI;EACR,CAAC;AACL,CAAC;AAED,OAAO,MAAMC,aAAa,GAAIZ,EAAU,IAAKJ,kBAAkB,CAACiB,IAAI,CAACb,EAAE,CAAC;AAExE,OAAO,MAAMc,SAAS,GAAIC,QAA2B,IAAK;EACtD,MAAM;IAAEd,KAAK;IAAEI;EAAO,C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AOgB,YAAY,IAAIb,IAAI,IAAIa,YAAY,IAAIX,EAAE;AACrD,CAAC;AAED,OAAO,MAAMY,4BAA4B,GAAGA,CAACC,YAAsC,EAAEN,UAAsB,KAAuB;EAC9H,MAAMjB,EAAE,GAAGuB,YAAY,CAACC,IAAI,CAAC,CAAC,CAACC,GAAG,CAAC,KAAK;IACpC,IAAI,CAACb,aAAa,CAACa,GAAa,CAAC,EAAE;MAC/B,OAAO,KAAK;IAChB;IAEA,MAAMV,QAAQ,GAAGhB,OAAO,CAAC0B,GAAa,CAAC;IAEvC,IAAI,CAACX,SAAS,CAACC,QAAQ,CAAC,EAAE;MACtB,OAAO,KAAK;IAChB;IAEA,OAAOC,yBAAyB,CAACD,QAAQ,EAAEE,UAAU,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAOjB,EAAE,EAAE0B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
@@ -1,8 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,46 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,56 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,13 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|