react-native-unistyles 1.1.6 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +30 -38
- package/android/CMakeLists.txt +27 -0
- package/android/build.gradle +75 -0
- package/android/src/main/cxx/cpp-adapter.cpp +132 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +189 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +18 -0
- package/cxx/UnistylesRuntime.cpp +318 -0
- package/cxx/UnistylesRuntime.h +74 -0
- package/ios/UnistylesHelpers.h +3 -0
- package/ios/UnistylesHelpers.mm +5 -0
- package/ios/UnistylesModule.h +16 -0
- package/ios/UnistylesModule.mm +138 -0
- package/ios/platform/Platform_iOS.h +21 -0
- package/ios/platform/Platform_iOS.mm +132 -0
- package/ios/platform/Platform_macOS.h +20 -0
- package/ios/platform/Platform_macOS.mm +83 -0
- package/lib/commonjs/common.js +60 -0
- package/lib/commonjs/common.js.map +1 -0
- package/lib/commonjs/core/UnistyleRegistry.js +94 -0
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
- package/lib/commonjs/core/Unistyles.js +32 -0
- package/lib/commonjs/core/Unistyles.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.js +197 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.native.js +9 -0
- package/lib/commonjs/core/UnistylesModule.native.js.map +1 -0
- package/lib/commonjs/core/UnistylesRuntime.js +140 -0
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
- package/lib/commonjs/core/index.js +13 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/createStyleSheet.js +14 -0
- package/lib/commonjs/createStyleSheet.js.map +1 -0
- package/lib/commonjs/global.js +2 -0
- package/lib/commonjs/global.js.map +1 -0
- package/lib/commonjs/hooks/index.js +24 -3
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useCSS.js +44 -0
- package/lib/commonjs/hooks/useCSS.js.map +1 -0
- package/lib/commonjs/hooks/useCSS.native.js +9 -0
- package/lib/commonjs/hooks/useCSS.native.js.map +1 -0
- package/lib/commonjs/hooks/useInitialTheme.js +17 -0
- package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
- package/lib/commonjs/hooks/useUnistyles.js +64 -0
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
- package/lib/commonjs/hooks/useVariants.js +14 -0
- package/lib/commonjs/hooks/useVariants.js.map +1 -0
- package/lib/commonjs/index.js +63 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/normalizer/index.js +32 -0
- package/lib/commonjs/normalizer/index.js.map +1 -0
- package/lib/commonjs/normalizer/module.d.js.map +1 -0
- package/lib/commonjs/{utils/normalizeStyles.web.js → normalizer/normalizeStyle.js} +5 -5
- package/lib/commonjs/normalizer/normalizeStyle.js.map +1 -0
- package/lib/commonjs/{utils → normalizer}/normalizer.js +2 -3
- package/lib/commonjs/normalizer/normalizer.js.map +1 -0
- package/lib/commonjs/normalizer/normalizer.macos.js +3 -0
- package/lib/commonjs/normalizer/normalizer.macos.js.map +1 -0
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +14 -0
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +1 -0
- package/lib/commonjs/plugins/index.js +20 -0
- package/lib/commonjs/plugins/index.js.map +1 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/commonjs/types/common.js +2 -0
- package/lib/{module/utils/module.d.js.map → commonjs/types/common.js.map} +1 -1
- package/lib/commonjs/types/index.js +11 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/plugin.js +6 -0
- package/lib/commonjs/{utils/module.d.js.map → types/plugin.js.map} +1 -1
- package/lib/commonjs/types/stylesheet.js +6 -0
- package/lib/commonjs/types/{mediaQueries.js.map → stylesheet.js.map} +1 -1
- package/lib/commonjs/types/unistyles.js +6 -0
- package/lib/{module/types/mediaQueries.js.map → commonjs/types/unistyles.js.map} +1 -1
- package/lib/commonjs/types/variants.js +2 -0
- package/lib/commonjs/types/variants.js.map +1 -0
- package/lib/commonjs/useStyles.js +47 -0
- package/lib/commonjs/useStyles.js.map +1 -0
- package/lib/commonjs/utils/breakpoints.js +20 -122
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/cssMediaQuery.js +244 -0
- package/lib/commonjs/utils/cssMediaQuery.js.map +1 -0
- package/lib/commonjs/utils/generateId.js +15 -0
- package/lib/commonjs/utils/generateId.js.map +1 -0
- package/lib/commonjs/utils/hash32.js +43 -0
- package/lib/commonjs/utils/hash32.js.map +1 -0
- package/lib/commonjs/utils/index.js +22 -54
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +38 -0
- package/lib/commonjs/utils/mq.js.map +1 -0
- package/lib/commonjs/utils/mqParser.js +89 -0
- package/lib/commonjs/utils/mqParser.js.map +1 -0
- package/lib/commonjs/utils/styles.js +52 -72
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/withPlugins.js +15 -0
- package/lib/commonjs/utils/withPlugins.js.map +1 -0
- package/lib/module/common.js +53 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/core/UnistyleRegistry.js +87 -0
- package/lib/module/core/UnistyleRegistry.js.map +1 -0
- package/lib/module/core/Unistyles.js +26 -0
- package/lib/module/core/Unistyles.js.map +1 -0
- package/lib/module/core/UnistylesModule.js +190 -0
- package/lib/module/core/UnistylesModule.js.map +1 -0
- package/lib/module/core/UnistylesModule.native.js +3 -0
- package/lib/module/core/UnistylesModule.native.js.map +1 -0
- package/lib/module/core/UnistylesRuntime.js +133 -0
- package/lib/module/core/UnistylesRuntime.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/createStyleSheet.js +7 -0
- package/lib/module/createStyleSheet.js.map +1 -0
- package/lib/module/global.js +2 -0
- package/lib/module/global.js.map +1 -0
- package/lib/module/hooks/index.js +4 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useCSS.js +37 -0
- package/lib/module/hooks/useCSS.js.map +1 -0
- package/lib/module/hooks/useCSS.native.js +2 -0
- package/lib/module/hooks/useCSS.native.js.map +1 -0
- package/lib/module/hooks/useInitialTheme.js +10 -0
- package/lib/module/hooks/useInitialTheme.js.map +1 -0
- package/lib/module/hooks/useUnistyles.js +57 -0
- package/lib/module/hooks/useUnistyles.js.map +1 -0
- package/lib/module/hooks/useVariants.js +7 -0
- package/lib/module/hooks/useVariants.js.map +1 -0
- package/lib/module/index.js +30 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/normalizer/index.js +3 -0
- package/lib/module/normalizer/index.js.map +1 -0
- package/lib/module/normalizer/module.d.js.map +1 -0
- package/lib/module/{utils/normalizeStyles.web.js → normalizer/normalizeStyle.js} +3 -3
- package/lib/module/normalizer/normalizeStyle.js.map +1 -0
- package/lib/module/{utils → normalizer}/normalizer.js +2 -3
- package/lib/module/normalizer/normalizer.js.map +1 -0
- package/lib/module/normalizer/normalizer.macos.js +2 -0
- package/lib/module/normalizer/normalizer.macos.js.map +1 -0
- package/lib/module/plugins/cssMediaQueriesPlugin.js +7 -0
- package/lib/module/plugins/cssMediaQueriesPlugin.js.map +1 -0
- package/lib/module/plugins/index.js +3 -0
- package/lib/module/plugins/index.js.map +1 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +1 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/plugin.js +2 -0
- package/lib/module/types/plugin.js.map +1 -0
- package/lib/module/types/stylesheet.js +2 -0
- package/lib/module/types/stylesheet.js.map +1 -0
- package/lib/module/types/unistyles.js +2 -0
- package/lib/module/types/unistyles.js.map +1 -0
- package/lib/module/types/variants.js +2 -0
- package/lib/module/types/variants.js.map +1 -0
- package/lib/module/useStyles.js +40 -0
- package/lib/module/useStyles.js.map +1 -0
- package/lib/module/utils/breakpoints.js +19 -120
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/cssMediaQuery.js +237 -0
- package/lib/module/utils/cssMediaQuery.js.map +1 -0
- package/lib/module/utils/generateId.js +7 -0
- package/lib/module/utils/generateId.js.map +1 -0
- package/lib/module/utils/hash32.js +36 -0
- package/lib/module/utils/hash32.js.map +1 -0
- package/lib/module/utils/index.js +6 -6
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mq.js +32 -0
- package/lib/module/utils/mq.js.map +1 -0
- package/lib/module/utils/mqParser.js +78 -0
- package/lib/module/utils/mqParser.js.map +1 -0
- package/lib/module/utils/styles.js +50 -72
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/withPlugins.js +8 -0
- package/lib/module/utils/withPlugins.js.map +1 -0
- package/lib/typescript/src/common.d.ts +46 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +56 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
- package/lib/typescript/src/core/Unistyles.d.ts +13 -0
- package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts +19 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.native.d.ts +6 -0
- package/lib/typescript/src/core/UnistylesModule.native.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +81 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +3 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/createStyleSheet.d.ts +8 -0
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -0
- package/lib/typescript/src/global.d.ts +7 -0
- package/lib/typescript/src/global.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +4 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCSS.d.ts +3 -0
- package/lib/typescript/src/hooks/useCSS.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCSS.native.d.ts +3 -0
- package/lib/typescript/src/hooks/useCSS.native.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts +14 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useVariants.d.ts +3 -0
- package/lib/typescript/src/hooks/useVariants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +76 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/normalizer/index.d.ts +3 -0
- package/lib/typescript/src/normalizer/index.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts +3 -0
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts +1 -0
- package/lib/typescript/src/normalizer/normalizer.macos.d.ts.map +1 -0
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +3 -0
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +1 -0
- package/lib/typescript/src/plugins/index.d.ts +3 -0
- package/lib/typescript/src/plugins/index.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
- package/lib/typescript/src/types/breakpoints.d.ts +25 -16
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +3 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/lib/typescript/src/types/core.d.ts +11 -25
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/plugin.d.ts +7 -0
- package/lib/typescript/src/types/plugin.d.ts.map +1 -0
- package/lib/typescript/src/types/stylesheet.d.ts +40 -0
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -0
- package/lib/typescript/src/types/unistyles.d.ts +53 -0
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
- package/lib/typescript/src/types/variants.d.ts +14 -0
- package/lib/typescript/src/types/variants.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +16 -0
- package/lib/typescript/src/useStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +2 -62
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/cssMediaQuery.d.ts +4 -0
- package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +1 -0
- package/lib/typescript/src/utils/generateId.d.ts +2 -0
- package/lib/typescript/src/utils/generateId.d.ts.map +1 -0
- package/lib/typescript/src/utils/hash32.d.ts +2 -0
- package/lib/typescript/src/utils/hash32.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +7 -6
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +26 -0
- package/lib/typescript/src/utils/mq.d.ts.map +1 -0
- package/lib/typescript/src/utils/mqParser.d.ts +16 -0
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +4 -49
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/lib/typescript/src/utils/withPlugins.d.ts +3 -0
- package/lib/typescript/src/utils/withPlugins.d.ts.map +1 -0
- package/package.json +46 -25
- package/react-native-unistyles.podspec +22 -0
- package/src/__tests__/mocks.ts +24 -0
- package/src/common.ts +55 -0
- package/src/core/UnistyleRegistry.ts +108 -0
- package/src/core/Unistyles.ts +35 -0
- package/src/core/UnistylesModule.native.ts +7 -0
- package/src/core/UnistylesModule.ts +230 -0
- package/src/core/UnistylesRuntime.ts +135 -0
- package/src/core/index.ts +2 -0
- package/src/createStyleSheet.ts +8 -0
- package/src/global.ts +6 -0
- package/src/hooks/index.ts +4 -1
- package/src/hooks/useCSS.native.ts +3 -0
- package/src/hooks/useCSS.ts +51 -0
- package/src/hooks/useInitialTheme.ts +11 -0
- package/src/hooks/useUnistyles.ts +64 -0
- package/src/hooks/useVariants.ts +10 -0
- package/src/index.ts +50 -2
- package/src/normalizer/index.ts +2 -0
- package/src/{utils/normalizeStyles.web.ts → normalizer/normalizeStyle.ts} +3 -3
- package/src/normalizer/normalizer.macos.ts +1 -0
- package/src/{utils → normalizer}/normalizer.ts +5 -4
- package/src/plugins/cssMediaQueriesPlugin.ts +8 -0
- package/src/plugins/index.ts +2 -0
- package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
- package/src/types/breakpoints.ts +55 -27
- package/src/types/common.ts +2 -0
- package/src/types/core.ts +11 -36
- package/src/types/index.ts +12 -7
- package/src/types/plugin.ts +7 -0
- package/src/types/stylesheet.ts +49 -0
- package/src/types/unistyles.ts +63 -0
- package/src/types/variants.ts +19 -0
- package/src/useStyles.ts +60 -0
- package/src/utils/breakpoints.ts +28 -124
- package/src/utils/cssMediaQuery.ts +268 -0
- package/src/utils/generateId.ts +10 -0
- package/src/utils/hash32.ts +53 -0
- package/src/utils/index.ts +7 -13
- package/src/utils/mq.ts +57 -0
- package/src/utils/mqParser.ts +99 -0
- package/src/utils/styles.ts +62 -102
- package/src/utils/withPlugins.ts +13 -0
- package/lib/commonjs/UnistylesTheme.js +0 -21
- package/lib/commonjs/UnistylesTheme.js.map +0 -1
- package/lib/commonjs/createUnistyles.js +0 -57
- package/lib/commonjs/createUnistyles.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.js +0 -10
- package/lib/commonjs/hooks/useDimensions.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.web.js +0 -34
- package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
- package/lib/commonjs/types/mediaQueries.js +0 -2
- package/lib/commonjs/utils/common.js +0 -18
- package/lib/commonjs/utils/common.js.map +0 -1
- package/lib/commonjs/utils/mediaQueries.js +0 -189
- package/lib/commonjs/utils/mediaQueries.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.js +0 -10
- package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
- package/lib/commonjs/utils/normalizer.js.map +0 -1
- package/lib/module/UnistylesTheme.js +0 -12
- package/lib/module/UnistylesTheme.js.map +0 -1
- package/lib/module/createUnistyles.js +0 -50
- package/lib/module/createUnistyles.js.map +0 -1
- package/lib/module/hooks/useDimensions.js +0 -3
- package/lib/module/hooks/useDimensions.js.map +0 -1
- package/lib/module/hooks/useDimensions.web.js +0 -27
- package/lib/module/hooks/useDimensions.web.js.map +0 -1
- package/lib/module/types/mediaQueries.js +0 -2
- package/lib/module/utils/common.js +0 -10
- package/lib/module/utils/common.js.map +0 -1
- package/lib/module/utils/mediaQueries.js +0 -176
- package/lib/module/utils/mediaQueries.js.map +0 -1
- package/lib/module/utils/normalizeStyles.js +0 -3
- package/lib/module/utils/normalizeStyles.js.map +0 -1
- package/lib/module/utils/normalizeStyles.web.js.map +0 -1
- package/lib/module/utils/normalizer.js.map +0 -1
- package/lib/typescript/examples/expo/src/App.d.ts +0 -3
- package/lib/typescript/examples/expo/src/App.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +0 -7
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/index.d.ts +0 -8
- package/lib/typescript/examples/expo/src/examples/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/index.d.ts +0 -2
- package/lib/typescript/examples/expo/src/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +0 -8
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/index.d.ts +0 -46
- package/lib/typescript/examples/expo/src/styles/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/theme.d.ts +0 -24
- package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +0 -1
- package/lib/typescript/src/UnistylesTheme.d.ts +0 -9
- package/lib/typescript/src/UnistylesTheme.d.ts.map +0 -1
- package/lib/typescript/src/createUnistyles.d.ts +0 -10
- package/lib/typescript/src/createUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +0 -8
- package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/utils/common.d.ts +0 -5
- package/lib/typescript/src/utils/common.d.ts.map +0 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +0 -130
- package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
- package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
- package/src/UnistylesTheme.tsx +0 -17
- package/src/__tests__/createUnistyles.spec.tsx +0 -192
- package/src/createUnistyles.ts +0 -70
- package/src/hooks/useDimensions.ts +0 -4
- package/src/hooks/useDimensions.web.ts +0 -34
- package/src/types/mediaQueries.ts +0 -10
- package/src/utils/common.ts +0 -12
- package/src/utils/mediaQueries.ts +0 -201
- package/src/utils/normalizeStyles.ts +0 -2
- /package/lib/commonjs/{utils → normalizer}/module.d.js +0 -0
- /package/lib/module/{utils → normalizer}/module.d.js +0 -0
- /package/lib/typescript/src/{utils → normalizer}/normalizer.d.ts +0 -0
- /package/src/{utils → normalizer}/module.d.ts +0 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
#if TARGET_OS_IOS
|
2
|
+
|
3
|
+
#import "Platform_iOS.h"
|
4
|
+
#import "UnistylesRuntime.h"
|
5
|
+
#import <React/RCTAppearance.h>
|
6
|
+
|
7
|
+
@implementation Platform
|
8
|
+
|
9
|
+
- (instancetype)init {
|
10
|
+
self = [super init];
|
11
|
+
if (self) {
|
12
|
+
UIScreen *screen = [UIScreen mainScreen];
|
13
|
+
UIContentSizeCategory contentSizeCategory = [[UIApplication sharedApplication] preferredContentSizeCategory];
|
14
|
+
|
15
|
+
self.initialWidth = screen.bounds.size.width;
|
16
|
+
self.initialHeight = screen.bounds.size.height;
|
17
|
+
self.initialColorScheme = [self getColorScheme];
|
18
|
+
self.initialContentSizeCategory = [self getContentSizeCategory:contentSizeCategory];
|
19
|
+
|
20
|
+
[self setupListeners];
|
21
|
+
}
|
22
|
+
return self;
|
23
|
+
}
|
24
|
+
|
25
|
+
- (void)dealloc {
|
26
|
+
if (self.unistylesRuntime != nullptr) {
|
27
|
+
self.unistylesRuntime = nullptr;
|
28
|
+
}
|
29
|
+
|
30
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self
|
31
|
+
name: UIContentSizeCategoryDidChangeNotification
|
32
|
+
object: nil];
|
33
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self
|
34
|
+
name: RCTUserInterfaceStyleDidChangeNotification
|
35
|
+
object: nil];
|
36
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self
|
37
|
+
name: UIDeviceOrientationDidChangeNotification
|
38
|
+
object: nil];
|
39
|
+
}
|
40
|
+
|
41
|
+
- (void)setupListeners {
|
42
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
43
|
+
selector:@selector(onOrientationChange:)
|
44
|
+
name:UIDeviceOrientationDidChangeNotification
|
45
|
+
object:nil];
|
46
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
47
|
+
selector:@selector(onAppearanceChange:)
|
48
|
+
name:RCTUserInterfaceStyleDidChangeNotification
|
49
|
+
object:nil];
|
50
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
51
|
+
selector:@selector(onContentSizeCategoryChange:)
|
52
|
+
name:UIContentSizeCategoryDidChangeNotification
|
53
|
+
object:nil];
|
54
|
+
}
|
55
|
+
|
56
|
+
- (void)onAppearanceChange:(NSNotification *)notification {
|
57
|
+
std::string colorScheme = [self getColorScheme];
|
58
|
+
|
59
|
+
if (self.unistylesRuntime != nullptr) {
|
60
|
+
((UnistylesRuntime*)self.unistylesRuntime)->handleAppearanceChange(colorScheme);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
- (void)onContentSizeCategoryChange:(NSNotification *)notification {
|
65
|
+
UIContentSizeCategory contentSizeCategory = [[UIApplication sharedApplication] preferredContentSizeCategory];
|
66
|
+
|
67
|
+
if (self.unistylesRuntime != nullptr) {
|
68
|
+
((UnistylesRuntime*)self.unistylesRuntime)->handleContentSizeCategoryChange([self getContentSizeCategory:contentSizeCategory]);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
- (void)onOrientationChange:(NSNotification *)notification {
|
73
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
74
|
+
UIScreen *screen = [UIScreen mainScreen];
|
75
|
+
CGFloat screenWidth = screen.bounds.size.width;
|
76
|
+
CGFloat screenHeight = screen.bounds.size.height;
|
77
|
+
|
78
|
+
if (self.unistylesRuntime != nullptr) {
|
79
|
+
((UnistylesRuntime*)self.unistylesRuntime)->handleScreenSizeChange((int)screenWidth, (int)screenHeight);
|
80
|
+
}
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
- (std::string)getColorScheme {
|
85
|
+
UIUserInterfaceStyle colorScheme = [UIScreen mainScreen].traitCollection.userInterfaceStyle;
|
86
|
+
|
87
|
+
switch (colorScheme) {
|
88
|
+
case UIUserInterfaceStyleLight:
|
89
|
+
return UnistylesLightScheme;
|
90
|
+
case UIUserInterfaceStyleDark:
|
91
|
+
return UnistylesDarkScheme;
|
92
|
+
case UIUserInterfaceStyleUnspecified:
|
93
|
+
default:
|
94
|
+
return UnistylesUnspecifiedScheme;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
- (std::string)getContentSizeCategory:(UIContentSizeCategory)contentSizeCategory {
|
99
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraExtraExtraLarge]) {
|
100
|
+
return std::string([@"xxxLarge" UTF8String]);
|
101
|
+
}
|
102
|
+
|
103
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraExtraLarge]) {
|
104
|
+
return std::string([@"xxLarge" UTF8String]);
|
105
|
+
}
|
106
|
+
|
107
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraLarge]) {
|
108
|
+
return std::string([@"xLarge" UTF8String]);
|
109
|
+
}
|
110
|
+
|
111
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryLarge]) {
|
112
|
+
return std::string([@"Large" UTF8String]);
|
113
|
+
}
|
114
|
+
|
115
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryMedium]) {
|
116
|
+
return std::string([@"Medium" UTF8String]);
|
117
|
+
}
|
118
|
+
|
119
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategorySmall]) {
|
120
|
+
return std::string([@"Small" UTF8String]);
|
121
|
+
}
|
122
|
+
|
123
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraSmall]) {
|
124
|
+
return std::string([@"xSmall" UTF8String]);
|
125
|
+
}
|
126
|
+
|
127
|
+
return std::string([@"unspecified" UTF8String]);
|
128
|
+
}
|
129
|
+
|
130
|
+
@end
|
131
|
+
|
132
|
+
#endif
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#include <string>
|
2
|
+
|
3
|
+
@interface Platform : NSObject
|
4
|
+
|
5
|
+
@property (nonatomic, assign) CGFloat initialWidth;
|
6
|
+
@property (nonatomic, assign) CGFloat initialHeight;
|
7
|
+
@property (nonatomic, assign) std::string initialColorScheme;
|
8
|
+
@property (nonatomic, assign) std::string initialContentSizeCategory;
|
9
|
+
@property (nonatomic, assign) void* unistylesRuntime;
|
10
|
+
|
11
|
+
- (instancetype)init;
|
12
|
+
|
13
|
+
- (void)setupListeners;
|
14
|
+
- (void)onWindowResize;
|
15
|
+
- (void)onAppearanceChange;
|
16
|
+
|
17
|
+
- (std::string)getColorScheme;
|
18
|
+
|
19
|
+
@end
|
20
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#if TARGET_OS_OSX
|
2
|
+
|
3
|
+
#import "Platform_macOS.h"
|
4
|
+
#import "UnistylesRuntime.h"
|
5
|
+
#import <React/RCTUtils.h>
|
6
|
+
|
7
|
+
@implementation Platform
|
8
|
+
|
9
|
+
- (instancetype)init {
|
10
|
+
self = [super init];
|
11
|
+
if (self) {
|
12
|
+
NSWindow *window = RCTSharedApplication().mainWindow;
|
13
|
+
|
14
|
+
self.initialWidth = window.frame.size.width;
|
15
|
+
self.initialHeight = window.frame.size.height;
|
16
|
+
self.initialContentSizeCategory = std::string([@"unspecified" UTF8String]);
|
17
|
+
self.initialColorScheme = [self getColorScheme];
|
18
|
+
|
19
|
+
[self setupListeners];
|
20
|
+
}
|
21
|
+
return self;
|
22
|
+
}
|
23
|
+
|
24
|
+
- (void)dealloc {
|
25
|
+
if (self.unistylesRuntime != nullptr) {
|
26
|
+
self.unistylesRuntime = nullptr;
|
27
|
+
}
|
28
|
+
|
29
|
+
NSWindow *window = RCTSharedApplication().mainWindow;
|
30
|
+
|
31
|
+
[window removeObserver:self forKeyPath:@"effectiveAppearance"];
|
32
|
+
[window removeObserver:self forKeyPath:@"frame"];
|
33
|
+
}
|
34
|
+
|
35
|
+
- (void)setupListeners {
|
36
|
+
NSWindow *window = RCTSharedApplication().mainWindow;
|
37
|
+
|
38
|
+
[window addObserver:self forKeyPath:@"effectiveAppearance" options:NSKeyValueObservingOptionNew context:nil];
|
39
|
+
[window addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:nil];
|
40
|
+
}
|
41
|
+
|
42
|
+
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
|
43
|
+
if ([keyPath isEqualToString:@"effectiveAppearance"]) {
|
44
|
+
return [self onAppearanceChange];
|
45
|
+
}
|
46
|
+
|
47
|
+
if ([keyPath isEqualToString:@"frame"]) {
|
48
|
+
return [self onWindowResize];
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
- (void)onAppearanceChange {
|
53
|
+
std::string colorScheme = [self getColorScheme];
|
54
|
+
|
55
|
+
if (self.unistylesRuntime != nullptr) {
|
56
|
+
((UnistylesRuntime*)self.unistylesRuntime)->handleAppearanceChange(colorScheme);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
- (void)onWindowResize {
|
61
|
+
NSWindow *window = RCTSharedApplication().mainWindow;
|
62
|
+
|
63
|
+
CGFloat screenWidth = window.frame.size.width;
|
64
|
+
CGFloat screenHeight = window.frame.size.height;
|
65
|
+
|
66
|
+
if (self.unistylesRuntime != nullptr) {
|
67
|
+
((UnistylesRuntime*)self.unistylesRuntime)->handleScreenSizeChange((int)screenWidth, (int)screenHeight);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
- (std::string)getColorScheme {
|
72
|
+
NSAppearance *appearance = RCTSharedApplication().effectiveAppearance;
|
73
|
+
|
74
|
+
if (appearance.name == NSAppearanceNameDarkAqua) {
|
75
|
+
return UnistylesDarkScheme;
|
76
|
+
}
|
77
|
+
|
78
|
+
return UnistylesLightScheme;
|
79
|
+
}
|
80
|
+
|
81
|
+
@end
|
82
|
+
|
83
|
+
#endif
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.warn = exports.isWeb = exports.isServer = exports.isMobile = exports.isIOS = exports.isAndroid = exports.UnistylesEventType = exports.UnistylesError = exports.ScreenOrientation = exports.IOSContentSizeCategory = exports.AndroidContentSizeCategory = void 0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
const warn = message => {
|
9
|
+
console.warn(`🦄 [react-native-unistyles]: ${message}`);
|
10
|
+
};
|
11
|
+
exports.warn = warn;
|
12
|
+
const isWeb = exports.isWeb = _reactNative.Platform.OS === 'web';
|
13
|
+
const isIOS = exports.isIOS = _reactNative.Platform.OS === 'ios';
|
14
|
+
const isAndroid = exports.isAndroid = _reactNative.Platform.OS === 'android';
|
15
|
+
const isMobile = exports.isMobile = isIOS || isAndroid;
|
16
|
+
const isServer = exports.isServer = typeof window === 'undefined';
|
17
|
+
const ScreenOrientation = exports.ScreenOrientation = {
|
18
|
+
Landscape: 'landscape',
|
19
|
+
Portrait: 'portrait'
|
20
|
+
};
|
21
|
+
let IOSContentSizeCategory = exports.IOSContentSizeCategory = /*#__PURE__*/function (IOSContentSizeCategory) {
|
22
|
+
IOSContentSizeCategory["ExtraExtraExtraLarge"] = "xxxLarge";
|
23
|
+
IOSContentSizeCategory["ExtraExtraLarge"] = "xxLarge";
|
24
|
+
IOSContentSizeCategory["ExtraLarge"] = "xLarge";
|
25
|
+
IOSContentSizeCategory["Large"] = "Large";
|
26
|
+
IOSContentSizeCategory["Medium"] = "Medium";
|
27
|
+
IOSContentSizeCategory["Small"] = "Small";
|
28
|
+
IOSContentSizeCategory["ExtraSmall"] = "xSmall";
|
29
|
+
IOSContentSizeCategory["Unspecified"] = "unspecified";
|
30
|
+
return IOSContentSizeCategory;
|
31
|
+
}({});
|
32
|
+
let AndroidContentSizeCategory = exports.AndroidContentSizeCategory = /*#__PURE__*/function (AndroidContentSizeCategory) {
|
33
|
+
AndroidContentSizeCategory["Small"] = "Small";
|
34
|
+
AndroidContentSizeCategory["Default"] = "Default";
|
35
|
+
AndroidContentSizeCategory["Large"] = "Large";
|
36
|
+
AndroidContentSizeCategory["ExtraLarge"] = "ExtraLarge";
|
37
|
+
AndroidContentSizeCategory["Huge"] = "Huge";
|
38
|
+
return AndroidContentSizeCategory;
|
39
|
+
}({});
|
40
|
+
let UnistylesEventType = exports.UnistylesEventType = /*#__PURE__*/function (UnistylesEventType) {
|
41
|
+
UnistylesEventType["Theme"] = "theme";
|
42
|
+
UnistylesEventType["Layout"] = "layout";
|
43
|
+
UnistylesEventType["Plugin"] = "plugin";
|
44
|
+
UnistylesEventType["DynamicTypeSize"] = "dynamicTypeSize";
|
45
|
+
return UnistylesEventType;
|
46
|
+
}({});
|
47
|
+
let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesError) {
|
48
|
+
UnistylesError["RuntimeUnavailable"] = "Unistyles runtime is not available. Make sure you followed the installation instructions";
|
49
|
+
UnistylesError["ThemeNotFound"] = "You are trying to get a theme that is not registered with UnistylesRegistry";
|
50
|
+
UnistylesError["ThemeNotRegistered"] = "You are trying to set a theme that was not registered with UnistylesRegistry";
|
51
|
+
UnistylesError["ThemeNotSelected"] = "Your themes are registered, but you didn't select the initial theme";
|
52
|
+
UnistylesError["ThemesCannotBeEmpty"] = "You are trying to register empty themes object";
|
53
|
+
UnistylesError["BreakpointsCannotBeEmpty"] = "You are trying to register empty breakpoints object";
|
54
|
+
UnistylesError["BreakpointsMustStartFromZero"] = "You are trying to register breakpoints that don't start from 0";
|
55
|
+
UnistylesError["InvalidPluginName"] = "Plugin name can't start from reserved prefix __unistyles";
|
56
|
+
UnistylesError["DuplicatePluginName"] = "You are trying to register a plugin with a name that is already registered";
|
57
|
+
UnistylesError["CantRemoveInternalPlugin"] = "You are trying to remove an internal unistyles plugin";
|
58
|
+
return UnistylesError;
|
59
|
+
}({});
|
60
|
+
//# sourceMappingURL=common.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","warn","message","console","exports","isWeb","Platform","OS","isIOS","isAndroid","isMobile","isServer","window","ScreenOrientation","Landscape","Portrait","IOSContentSizeCategory","AndroidContentSizeCategory","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEM,MAAMI,K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dA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.UnistyleRegistry = void 0;
|
7
|
+
var _common = require("../common");
|
8
|
+
var _plugins = require("../plugins");
|
9
|
+
class UnistyleRegistry {
|
10
|
+
config = {};
|
11
|
+
plugins = _common.isWeb ? [_plugins.normalizeWebStylesPlugin] : [];
|
12
|
+
themeNames = [];
|
13
|
+
themes = {};
|
14
|
+
breakpoints = {};
|
15
|
+
sortedBreakpointPairs = [];
|
16
|
+
constructor(unistylesBridge) {
|
17
|
+
this.unistylesBridge = unistylesBridge;
|
18
|
+
}
|
19
|
+
addThemes = themes => {
|
20
|
+
this.themes = themes;
|
21
|
+
const keys = Object.keys(themes);
|
22
|
+
this.unistylesBridge.themes = keys;
|
23
|
+
this.themeNames = keys;
|
24
|
+
return {
|
25
|
+
addBreakpoints: this.addBreakpoints,
|
26
|
+
addConfig: this.addConfig
|
27
|
+
};
|
28
|
+
};
|
29
|
+
addBreakpoints = breakpoints => {
|
30
|
+
this.breakpoints = breakpoints;
|
31
|
+
this.unistylesBridge.useBreakpoints(breakpoints);
|
32
|
+
this.sortedBreakpointPairs = this.unistylesBridge.sortedBreakpointPairs;
|
33
|
+
return {
|
34
|
+
addThemes: this.addThemes,
|
35
|
+
addConfig: this.addConfig
|
36
|
+
};
|
37
|
+
};
|
38
|
+
addConfig = config => {
|
39
|
+
this.config = config;
|
40
|
+
if (config.adaptiveThemes) {
|
41
|
+
this.unistylesBridge.useAdaptiveThemes(config.adaptiveThemes);
|
42
|
+
}
|
43
|
+
if (config.plugins) {
|
44
|
+
config.plugins.forEach(plugin => this.addPlugin(plugin, false));
|
45
|
+
}
|
46
|
+
if (config.initialTheme) {
|
47
|
+
this.unistylesBridge.useTheme(config.initialTheme);
|
48
|
+
}
|
49
|
+
if (config.experimentalCSSMediaQueries) {
|
50
|
+
this.plugins = [_plugins.cssMediaQueriesPlugin].concat(this.plugins);
|
51
|
+
this.unistylesBridge.addPlugin(_plugins.cssMediaQueriesPlugin.name, false);
|
52
|
+
}
|
53
|
+
return {
|
54
|
+
addBreakpoints: this.addBreakpoints,
|
55
|
+
addThemes: this.addThemes
|
56
|
+
};
|
57
|
+
};
|
58
|
+
getTheme = forName => {
|
59
|
+
if (this.themeNames.length === 0) {
|
60
|
+
return {};
|
61
|
+
}
|
62
|
+
if (this.hasTheme(forName)) {
|
63
|
+
return this.themes[forName];
|
64
|
+
}
|
65
|
+
if (this.unistylesBridge.themeName) {
|
66
|
+
throw new Error(_common.UnistylesError.ThemeNotFound);
|
67
|
+
}
|
68
|
+
throw new Error(_common.UnistylesError.ThemeNotSelected);
|
69
|
+
};
|
70
|
+
addPlugin = (plugin, notify = true) => {
|
71
|
+
if (plugin.name.startsWith('__unistyles')) {
|
72
|
+
throw new Error(_common.UnistylesError.InvalidPluginName);
|
73
|
+
}
|
74
|
+
if (this.plugins.some(({
|
75
|
+
name
|
76
|
+
}) => name === plugin.name)) {
|
77
|
+
throw new Error(_common.UnistylesError.DuplicatePluginName);
|
78
|
+
}
|
79
|
+
this.plugins = [plugin].concat(this.plugins);
|
80
|
+
this.unistylesBridge.addPlugin(plugin.name, notify);
|
81
|
+
};
|
82
|
+
removePlugin = plugin => {
|
83
|
+
if (plugin.name.startsWith('__unistyles')) {
|
84
|
+
throw new Error(_common.UnistylesError.CantRemoveInternalPlugin);
|
85
|
+
}
|
86
|
+
this.plugins = this.plugins.filter(({
|
87
|
+
name
|
88
|
+
}) => name !== plugin.name);
|
89
|
+
this.unistylesBridge.removePlugin(plugin.name);
|
90
|
+
};
|
91
|
+
hasTheme = name => name in this.themes;
|
92
|
+
}
|
93
|
+
exports.UnistyleRegistry = UnistyleRegistry;
|
94
|
+
//# sourceMappingURL=UnistyleRegistry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_common","require","_plugins","UnistyleRegistry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","forEach","plugin","addPlugin","initialTheme","useTheme","experimentalCSSMediaQueries","cssMediaQueriesPlugin","concat","name","getTheme","forName","length","hasTheme","themeName","Error","UnistylesError","ThemeNotFound","ThemeNotSelected","notify","startsWith","InvalidPluginName","some","DuplicatePluginName","removePlugin","CantRemoveInternalPlugin","filter","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BC,aAAK,GACxC,CAACC,iCAAwB,CAAC,GAC1B,EAAE;EACDC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMD,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GA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AAI,IAAI,CAACrB,MAAM;AAC1E;AAACuC,OAAA,CAAA7C,gBAAA,GAAAA,gBAAA"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.unistyles = void 0;
|
7
|
+
var _UnistylesModule = require("./UnistylesModule");
|
8
|
+
var _UnistylesRuntime = require("./UnistylesRuntime");
|
9
|
+
var _UnistyleRegistry = require("./UnistyleRegistry");
|
10
|
+
var _common = require("../common");
|
11
|
+
class Unistyles {
|
12
|
+
constructor() {
|
13
|
+
const isInstalled = _UnistylesModule.UnistylesModule?.install() ?? false;
|
14
|
+
if (!isInstalled) {
|
15
|
+
throw new Error(_common.UnistylesError.RuntimeUnavailable);
|
16
|
+
}
|
17
|
+
|
18
|
+
// @ts-ignore
|
19
|
+
// eslint-disable-next-line no-undef
|
20
|
+
this._bridge = (_common.isWeb ? globalThis : global).__UNISTYLES__;
|
21
|
+
this._registry = new _UnistyleRegistry.UnistyleRegistry(this._bridge);
|
22
|
+
this._runtime = new _UnistylesRuntime.UnistylesRuntime(this._bridge, this._registry);
|
23
|
+
}
|
24
|
+
get registry() {
|
25
|
+
return this._registry;
|
26
|
+
}
|
27
|
+
get runtime() {
|
28
|
+
return this._runtime;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
const unistyles = exports.unistyles = new Unistyles();
|
32
|
+
//# sourceMappingURL=Unistyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_UnistylesModule","require","_UnistylesRuntime","_UnistyleRegistry","_common","Unistyles","constructor","isInstalled","UnistylesModule","install","Error","UnistylesError","RuntimeUnavailable","_bridge","isWeb","globalThis","global","__UNISTYLES__","_registry","UnistyleRegistry","_runtime","UnistylesRuntime","registry","runtime","unistyles","exports"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGC,gCAAe,EAAEC,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACF,WAAW,EAAE;MACd,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;IACtD;;IAEA;IACA;IACA,IAAI,CAACC,OAAO,GAAG,CAACC,aAAK,GAAGC,UAAU,GAAGC,MAAM,EAAEC,aAAgC;IAC7E,IAAI,CAACC,SAAS,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACN,OAAO,CAAC;IACnD,IAAI,CAACO,QAAQ,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACR,OAAO,EAAE,IAAI,CAACK,SAAS,CAAC;EACtE;EAEA,IAAWI,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACJ,SAAS;EACzB;EAEA,IAAWK,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACH,QAAQ;EACxB;AACJ;AAEO,MAAMI,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAInB,SAAS,CAAC,CAAC"}
|
@@ -0,0 +1,197 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.UnistylesModule = exports.UnistylesBridgeWeb = void 0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
var _plugins = require("../plugins");
|
9
|
+
var _common = require("../common");
|
10
|
+
class UnistylesBridgeWeb {
|
11
|
+
#timerRef = undefined;
|
12
|
+
#hasAdaptiveThemes = false;
|
13
|
+
#supportsAutomaticColorScheme = false;
|
14
|
+
#screenWidth = _common.isServer ? undefined : window.innerWidth;
|
15
|
+
#screenHeight = _common.isServer ? undefined : window.innerHeight;
|
16
|
+
#themes = [];
|
17
|
+
#breakpoints = {};
|
18
|
+
#colorScheme = this.getPreferredColorScheme();
|
19
|
+
#themeName = '';
|
20
|
+
#enabledPlugins = [_plugins.normalizeWebStylesPlugin.name];
|
21
|
+
#unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
|
22
|
+
#sortedBreakpointPairs = [];
|
23
|
+
#breakpoint = '';
|
24
|
+
#contentSizeCategory = 'unspecified';
|
25
|
+
constructor() {
|
26
|
+
if (!_common.isServer) {
|
27
|
+
this.setupListeners();
|
28
|
+
this.#screenWidth = window.innerWidth;
|
29
|
+
this.#screenHeight = window.innerHeight;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
install() {
|
33
|
+
// @ts-ignore
|
34
|
+
// eslint-disable-next-line no-undef
|
35
|
+
globalThis.__UNISTYLES__ = new Proxy({}, {
|
36
|
+
get: (_target, prop) => {
|
37
|
+
switch (prop) {
|
38
|
+
case 'themeName':
|
39
|
+
return this.getTheme();
|
40
|
+
case 'screenWidth':
|
41
|
+
return this.#screenWidth;
|
42
|
+
case 'screenHeight':
|
43
|
+
return this.#screenHeight;
|
44
|
+
case 'contentSizeCategory':
|
45
|
+
return this.#contentSizeCategory;
|
46
|
+
case 'breakpoint':
|
47
|
+
return this.#breakpoint || undefined;
|
48
|
+
case 'breakpoints':
|
49
|
+
return this.#breakpoints;
|
50
|
+
case 'hasAdaptiveThemes':
|
51
|
+
return this.#hasAdaptiveThemes;
|
52
|
+
case 'sortedBreakpointPairs':
|
53
|
+
return this.#sortedBreakpointPairs;
|
54
|
+
case 'enabledPlugins':
|
55
|
+
return this.#enabledPlugins;
|
56
|
+
case 'colorScheme':
|
57
|
+
return this.#colorScheme;
|
58
|
+
case 'useTheme':
|
59
|
+
return themeName => this.useTheme(themeName);
|
60
|
+
case 'useBreakpoints':
|
61
|
+
return breakpoints => this.useBreakpoints(breakpoints);
|
62
|
+
case 'useAdaptiveThemes':
|
63
|
+
return enable => this.useAdaptiveThemes(enable);
|
64
|
+
case 'addPlugin':
|
65
|
+
return (pluginName, notify) => this.addPlugin(pluginName, notify);
|
66
|
+
case 'removePlugin':
|
67
|
+
return pluginName => this.removePlugin(pluginName);
|
68
|
+
default:
|
69
|
+
return Reflect.get(this, prop);
|
70
|
+
}
|
71
|
+
},
|
72
|
+
set: (target, prop, newValue, receiver) => {
|
73
|
+
switch (prop) {
|
74
|
+
case 'themes':
|
75
|
+
{
|
76
|
+
this.#themes = newValue;
|
77
|
+
this.#supportsAutomaticColorScheme = newValue.includes('light') && newValue.includes('dark');
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
case 'themeName':
|
81
|
+
{
|
82
|
+
this.#themeName = newValue;
|
83
|
+
this.emitThemeChange();
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
default:
|
87
|
+
return Reflect.set(target, prop, newValue, receiver);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
return true;
|
92
|
+
}
|
93
|
+
useTheme(themeName) {
|
94
|
+
this.#themeName = themeName;
|
95
|
+
this.emitThemeChange();
|
96
|
+
}
|
97
|
+
useBreakpoints(breakpoints) {
|
98
|
+
this.#breakpoints = breakpoints;
|
99
|
+
this.#sortedBreakpointPairs = Object.entries(breakpoints).sort(([, a], [, b]) => (a ?? 0) - (b ?? 0));
|
100
|
+
if (!_common.isServer) {
|
101
|
+
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
useAdaptiveThemes(enable) {
|
105
|
+
this.#hasAdaptiveThemes = enable;
|
106
|
+
if (!this.#hasAdaptiveThemes || !this.#supportsAutomaticColorScheme) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
if (this.#themeName !== this.#colorScheme) {
|
110
|
+
this.#themeName = this.#colorScheme;
|
111
|
+
this.emitThemeChange();
|
112
|
+
}
|
113
|
+
}
|
114
|
+
addPlugin(pluginName, notify) {
|
115
|
+
this.#enabledPlugins = [pluginName].concat(this.#enabledPlugins);
|
116
|
+
if (notify) {
|
117
|
+
this.emitPluginChange();
|
118
|
+
}
|
119
|
+
}
|
120
|
+
removePlugin(pluginName) {
|
121
|
+
this.#enabledPlugins = this.#enabledPlugins.filter(name => name !== pluginName);
|
122
|
+
this.emitPluginChange();
|
123
|
+
}
|
124
|
+
getTheme() {
|
125
|
+
if (this.#themes.length === 1) {
|
126
|
+
return this.#themes.at(0);
|
127
|
+
}
|
128
|
+
return this.#themeName;
|
129
|
+
}
|
130
|
+
setupListeners() {
|
131
|
+
window.addEventListener('resize', () => {
|
132
|
+
clearTimeout(this.#timerRef);
|
133
|
+
this.#timerRef = setTimeout(() => {
|
134
|
+
this.#screenWidth = window.innerWidth;
|
135
|
+
this.#screenHeight = window.innerHeight;
|
136
|
+
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
137
|
+
this.emitLayoutChange();
|
138
|
+
}, 100);
|
139
|
+
});
|
140
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
141
|
+
this.#colorScheme = event.matches ? 'dark' : 'light';
|
142
|
+
if (!this.#supportsAutomaticColorScheme || !this.#hasAdaptiveThemes) {
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
if (this.#colorScheme !== this.#themeName) {
|
146
|
+
this.#themeName = this.#colorScheme;
|
147
|
+
this.emitThemeChange();
|
148
|
+
}
|
149
|
+
});
|
150
|
+
}
|
151
|
+
getBreakpointFromScreenWidth(width) {
|
152
|
+
const breakpoint = this.#sortedBreakpointPairs.find(([, value], index, otherBreakpoints) => {
|
153
|
+
const minVal = value;
|
154
|
+
const maxVal = otherBreakpoints[index + 1]?.[1];
|
155
|
+
if (!maxVal) {
|
156
|
+
return true;
|
157
|
+
}
|
158
|
+
return width >= minVal && width < maxVal;
|
159
|
+
});
|
160
|
+
return breakpoint?.at(0);
|
161
|
+
}
|
162
|
+
getPreferredColorScheme() {
|
163
|
+
if (!_common.isServer && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
164
|
+
return 'dark';
|
165
|
+
}
|
166
|
+
return 'light';
|
167
|
+
}
|
168
|
+
emitPluginChange() {
|
169
|
+
this.#unistylesEvents.emit('__unistylesOnChange', {
|
170
|
+
type: 'plugin'
|
171
|
+
});
|
172
|
+
}
|
173
|
+
emitThemeChange() {
|
174
|
+
this.#unistylesEvents.emit('__unistylesOnChange', {
|
175
|
+
type: 'theme',
|
176
|
+
payload: {
|
177
|
+
themeName: this.#themeName
|
178
|
+
}
|
179
|
+
});
|
180
|
+
}
|
181
|
+
emitLayoutChange() {
|
182
|
+
this.#unistylesEvents.emit('__unistylesOnChange', {
|
183
|
+
type: 'layout',
|
184
|
+
payload: {
|
185
|
+
breakpoint: this.#breakpoint,
|
186
|
+
orientation: this.#screenWidth > this.#screenHeight ? 'landscape' : 'portrait',
|
187
|
+
screen: {
|
188
|
+
width: this.#screenWidth,
|
189
|
+
height: this.#screenHeight
|
190
|
+
}
|
191
|
+
}
|
192
|
+
});
|
193
|
+
}
|
194
|
+
}
|
195
|
+
exports.UnistylesBridgeWeb = UnistylesBridgeWeb;
|
196
|
+
const UnistylesModule = exports.UnistylesModule = new UnistylesBridgeWeb();
|
197
|
+
//# sourceMappingURL=UnistylesModule.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","isServer","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","emitLayoutChange","matchMedia","event","matches","width","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","height","exports","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAMG,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGC,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGH,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAACC,iCAAwB,CAACC,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAC5C,CAACC,mBAAmB,GAAW,aAAa;EAE5CC,WAAWA,CAAA,EAAG;IACV,IAAI,CAACpB,gBAAQ,EAAE;MACX,IAAI,CAACqB,cAAc,CAAC,CAAC;MACrB,IAAI,CAAC,CAACtB,WAAW,GAAGE,MAAM,CAACC,UAAU;MACrC,IAAI,CAAC,CAACC,YAAY,GAAGF,MAAM,CAACG,WAAW;IAC3C;EACJ;EAEOkB,OAAOA,CAAA,EAA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0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
const UnistylesModule = exports.UnistylesModule = _reactNative.NativeModules?.Unistyles;
|
9
|
+
//# sourceMappingURL=UnistylesModule.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","UnistylesModule","exports","NativeModules","Unistyles"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.native.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,0BAAa,EAAEC,SAAkC"}
|