react-native-unistyles 3.0.0-alpha.35 → 3.0.0-alpha.37
Sign up to get free protection for your applications and to get access to all the features.
- package/Unistyles.podspec +1 -1
- package/android/CMakeLists.txt +19 -36
- package/android/build.gradle +2 -1
- package/android/src/main/cxx/NativeUnistylesModule.cpp +71 -0
- package/android/src/main/cxx/NativeUnistylesModule.h +42 -0
- package/android/src/main/cxx/cpp-adapter.cpp +8 -86
- package/android/src/main/java/com/unistyles/Equatable.kt +61 -0
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +302 -0
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +148 -0
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +54 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +51 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +16 -14
- package/cxx/NativePlatform.h +11 -0
- package/cxx/common/Helpers.h +1 -1
- package/cxx/core/Unistyle.h +1 -1
- package/cxx/core/UnistyleData.h +1 -1
- package/cxx/core/UnistyleWrapper.h +1 -2
- package/cxx/core/UnistylesCommitHook.cpp +1 -1
- package/cxx/core/UnistylesMountHook.cpp +1 -1
- package/cxx/core/UnistylesRegistry.cpp +4 -13
- package/cxx/core/UnistylesRegistry.h +2 -3
- package/cxx/core/UnistylesState.cpp +10 -7
- package/cxx/hybridObjects/HybridNavigationBar.h +3 -3
- package/cxx/hybridObjects/HybridStatusBar.h +3 -3
- package/cxx/hybridObjects/HybridStyleSheet.cpp +21 -18
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +4 -8
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -3
- package/cxx/parser/Parser.cpp +3 -27
- package/cxx/parser/Parser.h +2 -3
- package/cxx/shadowTree/ShadowTrafficController.h +9 -5
- package/cxx/shadowTree/ShadowTreeManager.cpp +10 -5
- package/cxx/shadowTree/ShadowTreeManager.h +1 -1
- package/lib/commonjs/components/useMedia.js.map +1 -1
- package/lib/commonjs/components/useMedia.web.js +43 -0
- package/lib/commonjs/components/useMedia.web.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.js +57 -4
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
- package/lib/commonjs/core/createUnistylesComponent.native.js +6 -5
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +16 -11
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +58 -0
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/object/filter.js +42 -0
- package/lib/commonjs/web/convert/object/filter.js.map +1 -0
- package/lib/commonjs/web/convert/object/index.js +39 -0
- package/lib/commonjs/web/convert/object/index.js.map +1 -0
- package/lib/commonjs/web/convert/object/objectStyle.js +55 -0
- package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -0
- package/lib/commonjs/web/convert/object/transform.js +27 -0
- package/lib/commonjs/web/convert/object/transform.js.map +1 -0
- package/lib/commonjs/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
- package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js +38 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/index.js +28 -0
- package/lib/commonjs/web/convert/shadow/index.js.map +1 -0
- package/lib/commonjs/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
- package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +7 -3
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/listener.js +10 -0
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/registry.js +13 -26
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +3 -0
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +79 -39
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +3 -33
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +4 -1
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/useMedia.js.map +1 -1
- package/lib/module/components/useMedia.web.js +38 -0
- package/lib/module/components/useMedia.web.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.js +55 -3
- package/lib/module/core/createUnistylesComponent.js.map +1 -1
- package/lib/module/core/createUnistylesComponent.native.js +6 -5
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/module/web/convert/index.js +14 -9
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +53 -0
- package/lib/module/web/convert/object/boxShadow.js.map +1 -0
- package/lib/module/web/convert/object/filter.js +37 -0
- package/lib/module/web/convert/object/filter.js.map +1 -0
- package/lib/module/web/convert/object/index.js +6 -0
- package/lib/module/web/convert/object/index.js.map +1 -0
- package/lib/module/web/convert/object/objectStyle.js +50 -0
- package/lib/module/web/convert/object/objectStyle.js.map +1 -0
- package/lib/module/web/convert/object/transform.js +22 -0
- package/lib/module/web/convert/object/transform.js.map +1 -0
- package/lib/module/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
- package/lib/module/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js +33 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/module/web/convert/shadow/index.js +5 -0
- package/lib/module/web/convert/shadow/index.js.map +1 -0
- package/lib/module/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
- package/lib/module/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/module/web/convert/utils.js +4 -2
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/listener.js +10 -0
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/registry.js +14 -27
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +3 -0
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +80 -40
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -31
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +4 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/useMedia.web.d.ts +6 -0
- package/lib/typescript/src/components/useMedia.web.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +4 -3
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +4 -3
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts +9 -0
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/index.d.ts +4 -0
- package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts +5 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts +2 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts +3 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/types.d.ts +7 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +8 -4
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +8 -8
- package/lib/typescript/src/web/index.d.ts +8 -8
- package/lib/typescript/src/web/listener.d.ts +2 -0
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +5 -9
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -0
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +4 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts +1 -6
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +6 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency_.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -0
- package/nitrogen/generated/android/unistyles+autolinking.gradle +2 -0
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
- package/package.json +3 -3
- package/src/components/useMedia.ts +1 -1
- package/src/components/useMedia.web.ts +47 -0
- package/src/core/createUnistylesComponent.native.tsx +12 -10
- package/src/core/createUnistylesComponent.tsx +72 -6
- package/src/types/common.ts +1 -0
- package/src/web/convert/index.ts +16 -9
- package/src/web/convert/object/boxShadow.ts +54 -0
- package/src/web/convert/object/filter.ts +39 -0
- package/src/web/convert/object/index.ts +3 -0
- package/src/web/convert/object/objectStyle.ts +68 -0
- package/src/web/convert/object/transform.ts +24 -0
- package/src/web/convert/{boxShadow.ts → shadow/boxShadow.ts} +9 -30
- package/src/web/convert/shadow/getShadowBreakpoints.ts +34 -0
- package/src/web/convert/shadow/index.ts +2 -0
- package/src/web/convert/{textShadow.ts → shadow/textShadow.ts} +9 -29
- package/src/web/convert/types.ts +8 -1
- package/src/web/convert/utils.ts +11 -5
- package/src/web/listener.ts +10 -0
- package/src/web/registry.ts +10 -31
- package/src/web/runtime.ts +4 -0
- package/src/web/shadowRegistry.ts +85 -46
- package/src/web/utils/common.ts +1 -37
- package/src/web/utils/unistyle.ts +5 -1
- package/android/src/main/cxx/helpers.cpp +0 -105
- package/android/src/main/cxx/helpers.h +0 -16
- package/android/src/main/cxx/platform.cpp +0 -170
- package/android/src/main/cxx/platform.h +0 -20
- package/lib/commonjs/web/convert/boxShadow.js.map +0 -1
- package/lib/commonjs/web/convert/shadow.js +0 -68
- package/lib/commonjs/web/convert/shadow.js.map +0 -1
- package/lib/commonjs/web/convert/textShadow.js.map +0 -1
- package/lib/commonjs/web/convert/transform.js +0 -72
- package/lib/commonjs/web/convert/transform.js.map +0 -1
- package/lib/module/web/convert/boxShadow.js.map +0 -1
- package/lib/module/web/convert/shadow.js +0 -63
- package/lib/module/web/convert/shadow.js.map +0 -1
- package/lib/module/web/convert/textShadow.js.map +0 -1
- package/lib/module/web/convert/transform.js +0 -67
- package/lib/module/web/convert/transform.js.map +0 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/shadow.d.ts +0 -2
- package/lib/typescript/src/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/transform.d.ts +0 -4
- package/lib/typescript/src/web/convert/transform.d.ts.map +0 -1
- package/src/web/convert/shadow.ts +0 -68
- package/src/web/convert/transform.ts +0 -88
- /package/lib/typescript/src/web/convert/{boxShadow.d.ts → shadow/boxShadow.d.ts} +0 -0
- /package/lib/typescript/src/web/convert/{textShadow.d.ts → shadow/textShadow.d.ts} +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"shadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/shadow.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,qBAAsB,aAAa,CAAC,MAAM,CAAC,UAAU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAAe,GAAG,CAAC,MAAM,CAAC,SAiE5H,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"textShadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/textShadow.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,kBAAkB,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;CAoD7D,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/transform.ts"],"names":[],"mappings":"AAGA,KAAK,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;AAmC5C,eAAO,MAAM,iBAAiB,eAAgB,UAAU,wBAiDvD,CAAA"}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import type { ShadowOffset } from './types'
|
2
|
-
|
3
|
-
export const validateShadow = (shadowProperties: ReadonlyArray<string>, styles: Record<string, any>, breakpoints: Set<string>) => {
|
4
|
-
// Collect breakpoints
|
5
|
-
shadowProperties.forEach(key => {
|
6
|
-
const value = styles[key]
|
7
|
-
|
8
|
-
if (typeof value !== 'object') {
|
9
|
-
return
|
10
|
-
}
|
11
|
-
|
12
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
13
|
-
const { width, height } = value as ShadowOffset
|
14
|
-
|
15
|
-
// If shadowOffset.width has breakpoints
|
16
|
-
if (typeof width === 'object') {
|
17
|
-
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint))
|
18
|
-
}
|
19
|
-
|
20
|
-
// If shadowOffset.height has breakpoints
|
21
|
-
if (typeof height === 'object') {
|
22
|
-
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint))
|
23
|
-
}
|
24
|
-
|
25
|
-
return
|
26
|
-
}
|
27
|
-
|
28
|
-
// Collect regular breakpoints
|
29
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint))
|
30
|
-
})
|
31
|
-
|
32
|
-
// Validate if all breakpoints are present
|
33
|
-
shadowProperties.forEach(key => {
|
34
|
-
const value = styles[key]
|
35
|
-
|
36
|
-
if (typeof value !== 'object') {
|
37
|
-
return
|
38
|
-
}
|
39
|
-
|
40
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
41
|
-
const { width, height } = value as ShadowOffset
|
42
|
-
|
43
|
-
if (typeof width === 'object') {
|
44
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width))
|
45
|
-
|
46
|
-
if (missingBreakpoints.length) {
|
47
|
-
throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
if (typeof height === 'object') {
|
52
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height))
|
53
|
-
|
54
|
-
if (missingBreakpoints.length) {
|
55
|
-
throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
return
|
60
|
-
}
|
61
|
-
|
62
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value))
|
63
|
-
|
64
|
-
if (missingBreakpoints.length) {
|
65
|
-
throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`
|
66
|
-
}
|
67
|
-
})
|
68
|
-
}
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import { deepMergeObjects, keyInObject } from '../utils'
|
2
|
-
import { normalizeNumericValue } from './utils'
|
3
|
-
|
4
|
-
type Transforms = Array<Record<string, any>>
|
5
|
-
|
6
|
-
const normalizeTransform = (key: string, value: any) => {
|
7
|
-
if (key.includes('scale')) {
|
8
|
-
return value
|
9
|
-
}
|
10
|
-
|
11
|
-
if (typeof value === 'number') {
|
12
|
-
return normalizeNumericValue(value)
|
13
|
-
}
|
14
|
-
|
15
|
-
return value
|
16
|
-
}
|
17
|
-
|
18
|
-
const createTransformValue = (transforms: Transforms) => transforms
|
19
|
-
.map(transform => {
|
20
|
-
const [key] = Object.keys(transform)
|
21
|
-
|
22
|
-
if (!key) {
|
23
|
-
return undefined
|
24
|
-
}
|
25
|
-
|
26
|
-
const value = transform[key]
|
27
|
-
|
28
|
-
switch(key) {
|
29
|
-
case 'matrix':
|
30
|
-
case 'matrix3d':
|
31
|
-
return `${key}(${(value as Array<number>).join(',')})`
|
32
|
-
default:
|
33
|
-
return `${key}(${normalizeTransform(key, value)})`
|
34
|
-
}
|
35
|
-
})
|
36
|
-
.filter(Boolean)
|
37
|
-
.join(' ')
|
38
|
-
|
39
|
-
export const getTransformStyle = (transforms: Transforms) => {
|
40
|
-
const breakpoints = new Set<string>()
|
41
|
-
const normalTransforms: Transforms = []
|
42
|
-
|
43
|
-
transforms.forEach(transform => {
|
44
|
-
const [property] = Object.keys(transform)
|
45
|
-
|
46
|
-
if (!property) {
|
47
|
-
return
|
48
|
-
}
|
49
|
-
|
50
|
-
const value = transform[property]
|
51
|
-
|
52
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
53
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint))
|
54
|
-
|
55
|
-
return
|
56
|
-
}
|
57
|
-
|
58
|
-
normalTransforms.push(transform)
|
59
|
-
})
|
60
|
-
|
61
|
-
const breakpointTransforms = Array.from(breakpoints).flatMap(breakpoint => {
|
62
|
-
const transformsPerBreakpoint = transforms.flatMap(transform => {
|
63
|
-
const [property] = Object.keys(transform)
|
64
|
-
|
65
|
-
if (!property) {
|
66
|
-
return []
|
67
|
-
}
|
68
|
-
|
69
|
-
const value = transform[property]
|
70
|
-
|
71
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
72
|
-
return keyInObject(value, breakpoint) ? [{ [property]: value[breakpoint] }] : []
|
73
|
-
}
|
74
|
-
|
75
|
-
return []
|
76
|
-
})
|
77
|
-
|
78
|
-
return [{
|
79
|
-
[breakpoint]: {
|
80
|
-
transform: createTransformValue(transformsPerBreakpoint)
|
81
|
-
}
|
82
|
-
}]
|
83
|
-
})
|
84
|
-
|
85
|
-
return deepMergeObjects<Record<string, any>>({
|
86
|
-
transform: createTransformValue(normalTransforms)
|
87
|
-
}, ...breakpointTransforms)
|
88
|
-
}
|
File without changes
|
File without changes
|