react-native-unistyles 2.0.0-beta.2 → 2.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/core/UnistyleRegistry.js +6 -2
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
- package/lib/commonjs/core/UnistylesModule.web.js +4 -0
- package/lib/commonjs/core/UnistylesModule.web.js.map +1 -1
- package/lib/commonjs/core/UnistylesRuntime.js +3 -0
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/hooks/index.js +7 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useCSS.js +9 -0
- package/lib/commonjs/hooks/useCSS.js.map +1 -0
- package/lib/commonjs/hooks/useCSS.web.js +46 -0
- package/lib/commonjs/hooks/useCSS.web.js.map +1 -0
- package/lib/commonjs/normalizer/index.js.map +1 -0
- package/lib/commonjs/normalizer/module.d.js.map +1 -0
- package/lib/commonjs/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
- package/lib/commonjs/normalizer/normalizeStyle.js.map +1 -0
- package/lib/commonjs/normalizer/normalizer.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 +3 -21
- package/lib/commonjs/plugins/index.js.map +1 -1
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +1 -1
- package/lib/commonjs/useStyles.js +4 -1
- package/lib/commonjs/useStyles.js.map +1 -1
- package/lib/commonjs/utils/cssMediaQuery.js +250 -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 +13 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mqParser.js +2 -1
- package/lib/commonjs/utils/mqParser.js.map +1 -1
- package/lib/commonjs/utils/styles.js +9 -0
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/module/core/UnistyleRegistry.js +7 -3
- package/lib/module/core/UnistyleRegistry.js.map +1 -1
- package/lib/module/core/UnistylesModule.web.js +4 -0
- package/lib/module/core/UnistylesModule.web.js.map +1 -1
- package/lib/module/core/UnistylesRuntime.js +3 -0
- package/lib/module/core/UnistylesRuntime.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useCSS.js +2 -0
- package/lib/module/hooks/useCSS.js.map +1 -0
- package/lib/module/hooks/useCSS.web.js +39 -0
- package/lib/module/hooks/useCSS.web.js.map +1 -0
- package/lib/module/normalizer/index.js.map +1 -0
- package/lib/module/normalizer/module.d.js.map +1 -0
- package/lib/module/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
- package/lib/module/normalizer/normalizeStyle.js.map +1 -0
- package/lib/module/normalizer/normalizer.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 +1 -1
- package/lib/module/plugins/index.js.map +1 -1
- package/lib/module/plugins/normalizeWebStylesPlugin.js +1 -1
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -1
- package/lib/module/useStyles.js +5 -2
- package/lib/module/useStyles.js.map +1 -1
- package/lib/module/utils/cssMediaQuery.js +243 -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 +2 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mqParser.js +1 -1
- package/lib/module/utils/mqParser.js.map +1 -1
- package/lib/module/utils/styles.js +9 -0
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesModule.web.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- 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.web.d.ts +3 -0
- package/lib/typescript/src/hooks/useCSS.web.d.ts.map +1 -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/{plugins/normalizer → normalizer}/normalizer.d.ts +1 -1
- package/lib/typescript/src/normalizer/normalizer.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 +1 -1
- package/lib/typescript/src/plugins/index.d.ts.map +1 -1
- package/lib/typescript/src/types/unistyles.d.ts +2 -1
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/lib/typescript/src/useStyles.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 +3 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mqParser.d.ts +2 -1
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
- package/lib/typescript/src/utils/styles.d.ts +1 -1
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/core/UnistyleRegistry.ts +8 -3
- package/src/core/UnistylesModule.web.ts +4 -0
- package/src/core/UnistylesRuntime.ts +4 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCSS.ts +3 -0
- package/src/hooks/useCSS.web.ts +51 -0
- package/src/{plugins/normalizer → normalizer}/normalizeStyle.ts +2 -2
- package/src/{plugins/normalizer → normalizer}/normalizer.ts +2 -1
- package/src/plugins/cssMediaQueriesPlugin.ts +8 -0
- package/src/plugins/index.ts +1 -1
- package/src/plugins/normalizeWebStylesPlugin.ts +1 -1
- package/src/types/unistyles.ts +3 -2
- package/src/useStyles.ts +10 -2
- 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 +3 -1
- package/src/utils/mqParser.ts +2 -2
- package/src/utils/styles.ts +10 -1
- package/lib/commonjs/plugins/normalizer/index.js.map +0 -1
- package/lib/commonjs/plugins/normalizer/module.d.js.map +0 -1
- package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +0 -1
- package/lib/commonjs/plugins/normalizer/normalizer.js.map +0 -1
- package/lib/module/plugins/normalizer/index.js.map +0 -1
- package/lib/module/plugins/normalizer/module.d.js.map +0 -1
- package/lib/module/plugins/normalizer/normalizeStyle.js.map +0 -1
- package/lib/module/plugins/normalizer/normalizer.js.map +0 -1
- package/lib/typescript/src/plugins/normalizer/index.d.ts.map +0 -1
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +0 -3
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +0 -1
- package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +0 -1
- /package/lib/commonjs/{plugins/normalizer → normalizer}/index.js +0 -0
- /package/lib/commonjs/{plugins/normalizer → normalizer}/module.d.js +0 -0
- /package/lib/commonjs/{plugins/normalizer → normalizer}/normalizer.js +0 -0
- /package/lib/module/{plugins/normalizer → normalizer}/index.js +0 -0
- /package/lib/module/{plugins/normalizer → normalizer}/module.d.js +0 -0
- /package/lib/module/{plugins/normalizer → normalizer}/normalizer.js +0 -0
- /package/lib/typescript/src/{plugins/normalizer → normalizer}/index.d.ts +0 -0
- /package/src/{plugins/normalizer → normalizer}/index.ts +0 -0
- /package/src/{plugins/normalizer → normalizer}/module.d.ts +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-unistyles",
|
3
|
-
"version": "2.0.0-beta.
|
3
|
+
"version": "2.0.0-beta.3",
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
5
5
|
"scripts": {
|
6
6
|
"test": "jest",
|
@@ -144,7 +144,8 @@
|
|
144
144
|
},
|
145
145
|
"eslintIgnore": [
|
146
146
|
"node_modules/",
|
147
|
-
"lib/"
|
147
|
+
"lib/",
|
148
|
+
"src/utils/hash32.ts"
|
148
149
|
],
|
149
150
|
"react-native-builder-bob": {
|
150
151
|
"source": "src",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { UnistylesBridge, UnistylesConfig, UnistylesPlugin } from '../types'
|
2
2
|
import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
|
3
3
|
import { isWeb, UnistylesError } from '../common'
|
4
|
-
import { normalizeWebStylesPlugin } from '../plugins'
|
4
|
+
import { cssMediaQueriesPlugin, normalizeWebStylesPlugin } from '../plugins'
|
5
5
|
|
6
6
|
export class UnistyleRegistry {
|
7
7
|
public config: UnistylesConfig = {}
|
@@ -47,14 +47,19 @@ export class UnistyleRegistry {
|
|
47
47
|
this.unistylesBridge.useAdaptiveThemes(config.adaptiveThemes)
|
48
48
|
}
|
49
49
|
|
50
|
-
if (config.
|
51
|
-
config.
|
50
|
+
if (config.plugins) {
|
51
|
+
config.plugins.forEach(plugin => this.addPlugin(plugin, false))
|
52
52
|
}
|
53
53
|
|
54
54
|
if (config.initialTheme) {
|
55
55
|
this.unistylesBridge.useTheme(config.initialTheme)
|
56
56
|
}
|
57
57
|
|
58
|
+
if (config.experimentalCSSMediaQueries) {
|
59
|
+
this.plugins = [cssMediaQueriesPlugin].concat(this.plugins)
|
60
|
+
this.unistylesBridge.addPlugin(cssMediaQueriesPlugin.name, false)
|
61
|
+
}
|
62
|
+
|
58
63
|
return {
|
59
64
|
addBreakpoints: this.addBreakpoints,
|
60
65
|
addThemes: this.addThemes
|
@@ -10,6 +10,7 @@ export class UnistylesBridgeWeb {
|
|
10
10
|
#screenWidth: number = window.innerWidth
|
11
11
|
#screenHeight: number = window.innerHeight
|
12
12
|
#themes: Array<keyof UnistylesThemes> = []
|
13
|
+
#breakpoints: UnistylesBreakpoints = {} as UnistylesBreakpoints
|
13
14
|
#colorScheme: ColorSchemeName = this.getPreferredColorScheme()
|
14
15
|
#themeName: keyof UnistylesThemes = '' as keyof UnistylesThemes
|
15
16
|
#enabledPlugins: Array<string> = [normalizeWebStylesPlugin.name]
|
@@ -34,6 +35,8 @@ export class UnistylesBridgeWeb {
|
|
34
35
|
return this.#screenHeight
|
35
36
|
case 'breakpoint':
|
36
37
|
return this.#breakpoint || undefined
|
38
|
+
case 'breakpoints':
|
39
|
+
return this.#breakpoints
|
37
40
|
case 'hasAdaptiveThemes':
|
38
41
|
return this.#hasAdaptiveThemes
|
39
42
|
case 'sortedBreakpointPairs':
|
@@ -85,6 +88,7 @@ export class UnistylesBridgeWeb {
|
|
85
88
|
}
|
86
89
|
|
87
90
|
private useBreakpoints(breakpoints: UnistylesBreakpoints) {
|
91
|
+
this.#breakpoints = breakpoints
|
88
92
|
this.#sortedBreakpointPairs = Object
|
89
93
|
.entries(breakpoints)
|
90
94
|
.sort(([, a], [, b]) => (a ?? 0) - (b ?? 0)) as Array<[keyof UnistylesBreakpoints, number]>
|
package/src/hooks/index.ts
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
import { useInsertionEffect, useRef } from 'react'
|
2
|
+
import { unistyles } from '../core'
|
3
|
+
import type { ReactNativeStyleSheet } from '../types'
|
4
|
+
import { generateReactNativeWebId } from '../utils'
|
5
|
+
|
6
|
+
export const useCSS = <T>(stylesheet: ReactNativeStyleSheet<T>) => {
|
7
|
+
const insertedIds = useRef<Array<string>>([])
|
8
|
+
|
9
|
+
useInsertionEffect(() => {
|
10
|
+
if (!unistyles.registry.config.experimentalCSSMediaQueries) {
|
11
|
+
return
|
12
|
+
}
|
13
|
+
|
14
|
+
Object
|
15
|
+
.entries(stylesheet)
|
16
|
+
.forEach(([_key, value]) => {
|
17
|
+
Object.entries(value!)
|
18
|
+
.forEach(([prop, val]) => {
|
19
|
+
if (!val.toString().includes('@media')) {
|
20
|
+
return
|
21
|
+
}
|
22
|
+
|
23
|
+
const id = generateReactNativeWebId(prop, '""')
|
24
|
+
|
25
|
+
if (insertedIds.current.includes(id)) {
|
26
|
+
return
|
27
|
+
}
|
28
|
+
|
29
|
+
const style = document.createElement('style')
|
30
|
+
|
31
|
+
style.id = id
|
32
|
+
style.innerHTML = val
|
33
|
+
|
34
|
+
document.head.appendChild(style)
|
35
|
+
insertedIds.current = [...insertedIds.current, id]
|
36
|
+
})
|
37
|
+
})
|
38
|
+
|
39
|
+
return () => {
|
40
|
+
insertedIds.current.forEach(id => {
|
41
|
+
const style = document.getElementById(id)
|
42
|
+
|
43
|
+
if (style) {
|
44
|
+
style.remove()
|
45
|
+
}
|
46
|
+
})
|
47
|
+
|
48
|
+
insertedIds.current = []
|
49
|
+
}
|
50
|
+
}, [stylesheet])
|
51
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { preprocessor } from './normalizer'
|
2
|
-
import { warn } from '
|
3
|
-
import type { NormalizedBoxShadow, NormalizedTextShadow, BoxShadow, TextShadow, RNStyle } from '
|
2
|
+
import { warn } from '../common'
|
3
|
+
import type { NormalizedBoxShadow, NormalizedTextShadow, BoxShadow, TextShadow, RNStyle } from '../types'
|
4
4
|
|
5
5
|
const normalizeBoxShadow = <T extends BoxShadow>(style: T): NormalizedBoxShadow => {
|
6
6
|
const requiredBoxShadowProperties = [
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// based on react-native-web normalizer
|
2
2
|
// https://github.com/necolas/react-native-web
|
3
3
|
import normalizeColors from '@react-native/normalize-colors'
|
4
|
-
import type { TextShadow, Transforms, BoxShadow, Nullable } from '
|
4
|
+
import type { TextShadow, Transforms, BoxShadow, Nullable } from '../types'
|
5
5
|
|
6
6
|
type Preprocessor = {
|
7
7
|
createTextShadowValue(style: TextShadow): string,
|
@@ -37,6 +37,7 @@ export const normalizeColor = (color: string, opacity: number = 1) => {
|
|
37
37
|
}
|
38
38
|
|
39
39
|
export const normalizeNumericValue = (value: number) => value ? `${value}px` : value
|
40
|
+
|
40
41
|
const normalizeTransform = (key: string, value: number | string) => {
|
41
42
|
if (key.includes('scale')) {
|
42
43
|
return value
|
@@ -0,0 +1,8 @@
|
|
1
|
+
// prevent recursive import
|
2
|
+
import { createMediaQueryForStyles } from '../utils/cssMediaQuery'
|
3
|
+
import type { UnistylesPlugin } from '../types'
|
4
|
+
|
5
|
+
export const cssMediaQueriesPlugin: UnistylesPlugin = {
|
6
|
+
name: '__unistylesCSSMediaQueries',
|
7
|
+
onParsedStyle: (_key, styles, runtime) => createMediaQueryForStyles(styles, runtime)
|
8
|
+
}
|
package/src/plugins/index.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export { normalizeWebStylesPlugin } from './normalizeWebStylesPlugin'
|
2
|
-
export {
|
2
|
+
export { cssMediaQueriesPlugin } from './cssMediaQueriesPlugin'
|
package/src/types/unistyles.ts
CHANGED
@@ -7,8 +7,9 @@ export type ColorSchemeName = 'light' | 'dark' | 'unspecified'
|
|
7
7
|
|
8
8
|
export type UnistylesConfig = {
|
9
9
|
adaptiveThemes?: boolean,
|
10
|
-
|
11
|
-
|
10
|
+
initialTheme?: keyof UnistylesThemes,
|
11
|
+
plugins?: Array<UnistylesPlugin>,
|
12
|
+
experimentalCSSMediaQueries?: boolean
|
12
13
|
}
|
13
14
|
|
14
15
|
export type UnistylesBridge = {
|
package/src/useStyles.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
import { useMemo } from 'react'
|
2
2
|
import { StyleSheet } from 'react-native'
|
3
3
|
import { parseStyle, proxifyFunction, withPlugins } from './utils'
|
4
|
-
import { useUnistyles, useVariants } from './hooks'
|
4
|
+
import { useCSS, useUnistyles, useVariants } from './hooks'
|
5
5
|
import type { UnistylesBreakpoints } from './global'
|
6
6
|
import type { ExtractVariantNames, ReactNativeStyleSheet, StyleSheetWithSuperPowers, UnistylesTheme } from './types'
|
7
|
+
import { unistyles } from './core'
|
8
|
+
import { isWeb } from './common'
|
7
9
|
|
8
10
|
type ParsedStylesheet<ST extends StyleSheetWithSuperPowers> = {
|
9
11
|
theme: UnistylesTheme,
|
@@ -33,11 +35,17 @@ export const useStyles = <ST extends StyleSheetWithSuperPowers>(
|
|
33
35
|
|
34
36
|
return StyleSheet.create({
|
35
37
|
...acc,
|
36
|
-
[key]: withPlugins(key, parseStyle(
|
38
|
+
[key]: withPlugins(key, parseStyle(
|
39
|
+
value,
|
40
|
+
variants,
|
41
|
+
!isWeb || !unistyles.registry.config.experimentalCSSMediaQueries)
|
42
|
+
)
|
37
43
|
})
|
38
44
|
}, {}), [parsedStyles, variants, plugins]
|
39
45
|
)
|
40
46
|
|
47
|
+
useCSS(dynamicStyleSheet as ReactNativeStyleSheet<ST>)
|
48
|
+
|
41
49
|
return {
|
42
50
|
theme,
|
43
51
|
breakpoint: layout.breakpoint,
|
@@ -0,0 +1,268 @@
|
|
1
|
+
import { normalizeColor } from '../normalizer'
|
2
|
+
import { isUnistylesMq, isValidMq, parseMq, type UnistylesParsedMq } from './mqParser'
|
3
|
+
import type { RNStyle, RNValue } from '../types'
|
4
|
+
import { generateReactNativeWebId } from './generateId'
|
5
|
+
import type { UnistylesRuntime } from '../core'
|
6
|
+
|
7
|
+
export const createMediaQueryForStyles = (styles: RNStyle, runtime: UnistylesRuntime): RNStyle => {
|
8
|
+
const withMediaQueries = Object
|
9
|
+
.entries(styles)
|
10
|
+
.filter(([, value]) => typeof value === 'object')
|
11
|
+
.reduce((acc, [prop, value]) => {
|
12
|
+
const objectKeys = Object.keys(value)
|
13
|
+
const mediaQueries = objectKeys.filter(key => isUnistylesMq(key))
|
14
|
+
const breakpoints = objectKeys.filter(key => runtime.breakpoints[key as keyof typeof runtime.breakpoints])
|
15
|
+
|
16
|
+
if (mediaQueries.length === 0 && breakpoints.length === 0) {
|
17
|
+
return acc
|
18
|
+
}
|
19
|
+
|
20
|
+
const className = generateReactNativeWebId(prop, '""')
|
21
|
+
const breakpointsStyles = getBreakpointsStyles(prop, value as Record<string, RNValue>, runtime, className)
|
22
|
+
const mediaQueriesStyles = getMediaQueriesFromMQ(prop, value as Record<string, RNValue>, className)
|
23
|
+
|
24
|
+
return {
|
25
|
+
...acc,
|
26
|
+
[prop]: `
|
27
|
+
${breakpointsStyles}
|
28
|
+
${mediaQueriesStyles}
|
29
|
+
`.trim()
|
30
|
+
}
|
31
|
+
}, {})
|
32
|
+
|
33
|
+
return {
|
34
|
+
...styles,
|
35
|
+
...withMediaQueries
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
const getMaxWidthMediaQuery = (width: UnistylesParsedMq['width']): string => {
|
40
|
+
if (!width) {
|
41
|
+
return ''
|
42
|
+
}
|
43
|
+
|
44
|
+
if (width.to === Infinity) {
|
45
|
+
return ''
|
46
|
+
}
|
47
|
+
|
48
|
+
return `and (max-width: ${width.to}px)`
|
49
|
+
}
|
50
|
+
|
51
|
+
const getMaxHeightMediaQuery = (height: UnistylesParsedMq['height']): string => {
|
52
|
+
if (!height) {
|
53
|
+
return ''
|
54
|
+
}
|
55
|
+
|
56
|
+
if (height.to === Infinity) {
|
57
|
+
return ''
|
58
|
+
}
|
59
|
+
|
60
|
+
return `and (max-height: ${height.to}px)`
|
61
|
+
}
|
62
|
+
|
63
|
+
const getMediaQueriesFromMQ = (prop: string, value: Record<string, RNValue>, className: string): string => Object
|
64
|
+
.entries(value)
|
65
|
+
.reduce((acc, [key, value]) => {
|
66
|
+
const result = parseMq(key)
|
67
|
+
|
68
|
+
if (!isValidMq(result)) {
|
69
|
+
return acc
|
70
|
+
}
|
71
|
+
|
72
|
+
if (result.width && result.height) {
|
73
|
+
return `${acc}
|
74
|
+
|
75
|
+
@media screen and (min-width: ${result.width.from}px) and (min-height: ${result.height.from}px) ${getMaxWidthMediaQuery(result.width)} ${getMaxHeightMediaQuery(result.height)} {
|
76
|
+
.${className} {
|
77
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
78
|
+
}
|
79
|
+
}
|
80
|
+
`
|
81
|
+
}
|
82
|
+
|
83
|
+
if (result.width) {
|
84
|
+
return `${acc}
|
85
|
+
|
86
|
+
@media screen and (min-width: ${result.width.from}px) ${getMaxWidthMediaQuery(result.width)} {
|
87
|
+
.${className} {
|
88
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
89
|
+
}
|
90
|
+
}
|
91
|
+
`
|
92
|
+
}
|
93
|
+
|
94
|
+
if (result.height) {
|
95
|
+
return `${acc}
|
96
|
+
|
97
|
+
@media screen and (min-height: ${result.height.from}px) ${getMaxHeightMediaQuery(result.height)} {
|
98
|
+
.${className} {
|
99
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
100
|
+
}
|
101
|
+
}
|
102
|
+
`
|
103
|
+
}
|
104
|
+
|
105
|
+
return acc
|
106
|
+
}, '')
|
107
|
+
|
108
|
+
const getBreakpointsStyles = (prop: string, value: Record<string, RNValue>, runtime: UnistylesRuntime, className: string): string => Object
|
109
|
+
.entries(value)
|
110
|
+
.reduce((acc, [key, value]) => {
|
111
|
+
const breakpoint = runtime.breakpoints[key as keyof typeof runtime.breakpoints]
|
112
|
+
|
113
|
+
if (breakpoint === undefined) {
|
114
|
+
return acc
|
115
|
+
}
|
116
|
+
|
117
|
+
return `${acc}
|
118
|
+
|
119
|
+
@media screen and (min-width: ${breakpoint}px) {
|
120
|
+
.${className} {
|
121
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
122
|
+
}
|
123
|
+
}
|
124
|
+
`
|
125
|
+
}, '')
|
126
|
+
|
127
|
+
const normalizePropName = (prop: string) => prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
|
128
|
+
|
129
|
+
const normalizeWebValue = (prop: string, value: RNValue): string => {
|
130
|
+
if (value === undefined) {
|
131
|
+
return 'unset'
|
132
|
+
}
|
133
|
+
|
134
|
+
switch (prop) {
|
135
|
+
// colors
|
136
|
+
case 'color':
|
137
|
+
case 'backgroundColor':
|
138
|
+
case 'borderColor':
|
139
|
+
case 'borderBottomColor':
|
140
|
+
case 'borderLeftColor':
|
141
|
+
case 'borderRightColor':
|
142
|
+
case 'borderTopColor':
|
143
|
+
case 'borderBlockColor':
|
144
|
+
case 'borderBlockEndColor':
|
145
|
+
case 'borderBlockStartColor':
|
146
|
+
case 'textDecorationColor':
|
147
|
+
return normalizeColor(value as string)
|
148
|
+
|
149
|
+
// dimensions
|
150
|
+
case 'width':
|
151
|
+
case 'height':
|
152
|
+
case 'minWidth':
|
153
|
+
case 'minHeight':
|
154
|
+
case 'maxWidth':
|
155
|
+
case 'maxHeight':
|
156
|
+
case 'borderRadius':
|
157
|
+
case 'borderWidth':
|
158
|
+
case 'borderBottomLeftRadius':
|
159
|
+
case 'borderBottomRightRadius':
|
160
|
+
case 'borderEndEndRadius':
|
161
|
+
case 'borderEndStartRadius':
|
162
|
+
case 'borderStartEndRadius':
|
163
|
+
case 'borderStartStartRadius':
|
164
|
+
case 'borderTopLeftRadius':
|
165
|
+
case 'borderTopRightRadius':
|
166
|
+
case 'borderBottomWidth':
|
167
|
+
case 'borderLeftWidth':
|
168
|
+
case 'borderRightWidth':
|
169
|
+
case 'borderTopWidth':
|
170
|
+
case 'bottom':
|
171
|
+
case 'left':
|
172
|
+
case 'right':
|
173
|
+
case 'top':
|
174
|
+
case 'marginTop':
|
175
|
+
case 'marginBottom':
|
176
|
+
case 'marginLeft':
|
177
|
+
case 'marginRight':
|
178
|
+
case 'paddingTop':
|
179
|
+
case 'paddingBottom':
|
180
|
+
case 'paddingLeft':
|
181
|
+
case 'paddingRight':
|
182
|
+
case 'flexBasis':
|
183
|
+
case 'rowGap':
|
184
|
+
case 'columnGap':
|
185
|
+
case 'gap':
|
186
|
+
case 'margin':
|
187
|
+
case 'padding':
|
188
|
+
case 'fontSize':
|
189
|
+
case 'letterSpacing':
|
190
|
+
return `${value as string}px`
|
191
|
+
|
192
|
+
// without unit
|
193
|
+
case 'borderStyle':
|
194
|
+
case 'pointerEvents':
|
195
|
+
case 'backfaceVisibility':
|
196
|
+
case 'alignContent':
|
197
|
+
case 'alignItems':
|
198
|
+
case 'alignSelf':
|
199
|
+
case 'flexDirection':
|
200
|
+
case 'flexWrap':
|
201
|
+
case 'flex':
|
202
|
+
case 'aspectRatio':
|
203
|
+
case 'opacity':
|
204
|
+
case 'direction':
|
205
|
+
case 'zIndex':
|
206
|
+
case 'justifyContent':
|
207
|
+
case 'overflow':
|
208
|
+
case 'display':
|
209
|
+
case 'position':
|
210
|
+
case 'flexGrow':
|
211
|
+
case 'flexShrink':
|
212
|
+
case 'fontFamily':
|
213
|
+
case 'fontStyle':
|
214
|
+
case 'textDecorationLine':
|
215
|
+
case 'textAlign':
|
216
|
+
case 'textDecorationStyle':
|
217
|
+
case 'lineHeight':
|
218
|
+
case 'textTransform':
|
219
|
+
case 'fontVariant':
|
220
|
+
case 'verticalAlign':
|
221
|
+
case 'objectFit':
|
222
|
+
return value as string
|
223
|
+
|
224
|
+
// to be transformed for now
|
225
|
+
// not supported
|
226
|
+
case 'marginHorizontal':
|
227
|
+
case 'paddingHorizontal':
|
228
|
+
case 'marginVertical':
|
229
|
+
case 'paddingVertical':
|
230
|
+
case 'shadowColor':
|
231
|
+
case 'shadowOffset':
|
232
|
+
case 'shadowOpacity':
|
233
|
+
case 'shadowRadius':
|
234
|
+
case 'transform':
|
235
|
+
case 'transformMatrix':
|
236
|
+
case 'fontWeight':
|
237
|
+
case 'textShadowOffset':
|
238
|
+
case 'textShadowRadius':
|
239
|
+
case 'textShadowColor':
|
240
|
+
return ''
|
241
|
+
|
242
|
+
// unsupported
|
243
|
+
case 'borderStartColor':
|
244
|
+
case 'borderEndColor':
|
245
|
+
case 'borderEndWidth':
|
246
|
+
case 'borderBottomEndRadius':
|
247
|
+
case 'borderBottomStartRadius':
|
248
|
+
case 'borderCurve':
|
249
|
+
case 'elevation':
|
250
|
+
case 'borderTopEndRadius':
|
251
|
+
case 'borderTopStartRadius':
|
252
|
+
case 'borderStartWidth':
|
253
|
+
case 'start':
|
254
|
+
case 'end':
|
255
|
+
case 'margin-end':
|
256
|
+
case 'margin-start':
|
257
|
+
case 'padding-end':
|
258
|
+
case 'padding-start':
|
259
|
+
case 'writingDirection':
|
260
|
+
case 'textAlignVertical':
|
261
|
+
case 'includeFontPadding':
|
262
|
+
case 'resizeMode':
|
263
|
+
case 'overlayColor':
|
264
|
+
case 'tintColor':
|
265
|
+
default:
|
266
|
+
return ''
|
267
|
+
}
|
268
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// eslint-disable-next-line camelcase
|
2
|
+
import { murmurhash2_32_gc } from './hash32'
|
3
|
+
|
4
|
+
export const generateReactNativeWebId = (key: string, value: string): string => {
|
5
|
+
const hashedString = murmurhash2_32_gc(key + value, 1).toString(36)
|
6
|
+
|
7
|
+
return process.env.NODE_ENV !== 'production'
|
8
|
+
? `r-${key}-${hashedString}`
|
9
|
+
: `r-${hashedString}`
|
10
|
+
}
|
@@ -0,0 +1,53 @@
|
|
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: string, seed: number) => {
|
7
|
+
let l = str.length
|
8
|
+
let h = seed ^ l
|
9
|
+
let i = 0
|
10
|
+
let k
|
11
|
+
|
12
|
+
while (l >= 4) {
|
13
|
+
k =
|
14
|
+
(str.charCodeAt(i) & 0xff) |
|
15
|
+
((str.charCodeAt(++i) & 0xff) << 8) |
|
16
|
+
((str.charCodeAt(++i) & 0xff) << 16) |
|
17
|
+
((str.charCodeAt(++i) & 0xff) << 24)
|
18
|
+
|
19
|
+
k =
|
20
|
+
(k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16)
|
21
|
+
k ^= k >>> 24
|
22
|
+
k =
|
23
|
+
(k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16)
|
24
|
+
|
25
|
+
h =
|
26
|
+
((h & 0xffff) * 0x5bd1e995 +
|
27
|
+
((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^
|
28
|
+
k
|
29
|
+
|
30
|
+
l -= 4
|
31
|
+
++i
|
32
|
+
}
|
33
|
+
|
34
|
+
switch (l) {
|
35
|
+
// @ts-ignore
|
36
|
+
case 3:
|
37
|
+
h ^= (str.charCodeAt(i + 2) & 0xff) << 16
|
38
|
+
// @ts-ignore
|
39
|
+
case 2:
|
40
|
+
h ^= (str.charCodeAt(i + 1) & 0xff) << 8
|
41
|
+
case 1:
|
42
|
+
h ^= str.charCodeAt(i) & 0xff
|
43
|
+
h =
|
44
|
+
(h & 0xffff) * 0x5bd1e995 +
|
45
|
+
((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)
|
46
|
+
}
|
47
|
+
|
48
|
+
h ^= h >>> 13
|
49
|
+
h = (h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)
|
50
|
+
h ^= h >>> 15
|
51
|
+
|
52
|
+
return h >>> 0
|
53
|
+
}
|
package/src/utils/index.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
export { mq } from './mq'
|
2
|
-
export {
|
2
|
+
export type { UnistylesParsedMq } from './mqParser'
|
3
|
+
export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq, isUnistylesMq } from './mqParser'
|
3
4
|
export { getValueForBreakpoint } from './breakpoints'
|
4
5
|
export { proxifyFunction, parseStyle } from './styles'
|
5
6
|
export { withPlugins } from './withPlugins'
|
7
|
+
export { generateReactNativeWebId } from './generateId'
|
package/src/utils/mqParser.ts
CHANGED
@@ -9,7 +9,7 @@ type ParsedMqDimension = {
|
|
9
9
|
to: number
|
10
10
|
}
|
11
11
|
|
12
|
-
type UnistylesParsedMq = {
|
12
|
+
export type UnistylesParsedMq = {
|
13
13
|
width?: ParsedMqDimension,
|
14
14
|
height?: ParsedMqDimension
|
15
15
|
}
|
@@ -30,7 +30,7 @@ export const parseMq = (mq: string): UnistylesParsedMq => {
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
|
33
|
-
const isUnistylesMq = (mq: string) => IS_UNISTYLES_REGEX.test(mq)
|
33
|
+
export const isUnistylesMq = (mq: string) => IS_UNISTYLES_REGEX.test(mq)
|
34
34
|
|
35
35
|
export const isValidMq = (parsedMq: UnistylesParsedMq) => {
|
36
36
|
const { width, height } = parsedMq
|
package/src/utils/styles.ts
CHANGED
@@ -21,7 +21,8 @@ export const isPlatformColor = <T extends {}>(value: T): boolean => {
|
|
21
21
|
|
22
22
|
export const parseStyle = <T extends RNStyle>(
|
23
23
|
style: T,
|
24
|
-
variant: Record<string, Optional<string>> = {}
|
24
|
+
variant: Record<string, Optional<string>> = {},
|
25
|
+
parseMediaQueries = true
|
25
26
|
): T => Object
|
26
27
|
.entries(style || {})
|
27
28
|
.reduce((acc, [key, value]) => {
|
@@ -58,6 +59,14 @@ export const parseStyle = <T extends RNStyle>(
|
|
58
59
|
}
|
59
60
|
}
|
60
61
|
|
62
|
+
// don't parse media queries and breakpoints
|
63
|
+
if (!parseMediaQueries) {
|
64
|
+
return {
|
65
|
+
...acc,
|
66
|
+
[key]: value
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
61
70
|
return {
|
62
71
|
...acc,
|
63
72
|
[key]: getValueForBreakpoint(value as Record<string, RNValue>)
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizeStyle","require","_normalizer"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["plugins/normalizer/module.d.ts"],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizer","require","_common","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","warn","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","preprocessor","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyle","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow","exports"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/normalizeStyle.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,MAAME,kBAAkB,GAAyBC,KAAQ,IAA0B;EAC/E,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC3D,IAAAI,YAAI,EAAE,wEAAuEH,2BAA2B,CAACI,IAAI,CAAC,IAAI,CAAE,EAAC,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AK,IACvB,eAAe,IAAIA,KAAK,IACxB,cAAc,IAAIA,KAAK,GACvBD,kBAAkB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM4B,oBAAoB,GACtB,iBAAiB,IAAI5B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3Bc,mBAAmB,CAACd,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGsB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAR,cAAA,GAAAA,cAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_normalizeColors","_interopRequireDefault","require","obj","__esModule","default","normalizeColor","color","opacity","arguments","length","undefined","integer","normalizeColors","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","exports","normalizeNumericValue","value","normalizeTransform","key","includes","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","createBoxShadowValue","shadowColor","shadowOffset","shadowOpacity","shadowRadius","createTransformValue","transforms","transform","Object","keys","join","Boolean","preprocessor"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/normalizer.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAF5D;AACA;;AAUO,MAAMG,cAAc,GAAG,SAAAA,CAACC,KAAa,EAA0B;EAAA,IAAxBC,OAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC7D;EACA,IAAID,OAAO,KAAK,CAAC,EAAE;IACf,OAAOD,KAAK;EAChB;EAEA,MAAMK,OA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wB,IAAI,CAAC,GAAG,CAAE,GAAE;IAC1D;MACI,OAAQ,GAAEtB,GAAI,IAAGD,kBAAkB,CAACC,GAAG,EAAEF,KAAK,CAAE,GAAE;EAC1D;AACJ,CAAC,CAAC,CACDL,MAAM,CAAC8B,OAAO,CAAC,CACfD,IAAI,CAAC,GAAG,CAAC;AAEP,MAAME,YAA0B,GAAA5B,OAAA,CAAA4B,YAAA,GAAG;EACtCtB,qBAAqB;EACrBU,oBAAoB;EACpBK;AACJ,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["normalizeStyle","preprocessor","normalizeNumericValue","normalizeColor"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/index.ts"],"mappings":"AAAA,SAASA,cAAc,QAAQ,kBAAkB;AACjD,SAASC,YAAY,EAAEC,qBAAqB,EAAEC,cAAc,QAAQ,cAAc"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["plugins/normalizer/module.d.ts"],"mappings":""}
|