react-native-unistyles 3.0.0-beta.7 → 3.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/android/CMakeLists.txt +2 -1
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +9 -1
- package/cxx/common/Helpers.h +85 -0
- package/cxx/core/UnistylesCommitHook.cpp +20 -17
- package/cxx/core/UnistylesMountHook.cpp +2 -2
- package/cxx/core/UnistylesMountHook.h +1 -4
- package/cxx/core/UnistylesRegistry.cpp +8 -6
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -5
- package/cxx/hybridObjects/HybridStyleSheet.cpp +1 -1
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +5 -1
- package/cxx/parser/Parser.cpp +74 -9
- package/cxx/shadowTree/ShadowTrafficController.h +10 -4
- package/cxx/shadowTree/ShadowTreeManager.cpp +38 -35
- package/lib/commonjs/components/native/ImageBackground.js +26 -30
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +12 -1
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +4 -0
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +4 -0
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +14 -7
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/components/native/ImageBackground.js +26 -30
- package/lib/module/components/native/ImageBackground.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +12 -1
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +4 -0
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +4 -0
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +14 -7
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +1 -1
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +2 -2
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +19 -19
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +22 -22
- package/nitrogen/generated/android/unistyles+autolinking.cmake +16 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -0
- package/nitrogen/generated/shared/c++/Insets.hpp +1 -0
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -0
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -0
- package/package.json +28 -18
- package/plugin/index.d.ts +51 -18
- package/plugin/index.js +791 -178
- package/src/components/native/ImageBackground.tsx +3 -4
- package/src/components/native/Pressable.native.tsx +16 -1
- package/src/core/createUnistylesElement.native.tsx +5 -0
- package/src/core/createUnistylesImageBackground.tsx +5 -0
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +1 -1
- package/src/core/withUnistyles/withUnistyles.native.tsx +40 -14
- package/src/specs/ShadowRegistry/index.ts +1 -0
- package/src/types/stylesheet.ts +1 -1
- package/plugin/consts.js +0 -63
- package/plugin/exotic.js +0 -54
- package/plugin/import.js +0 -51
- package/plugin/ref.js +0 -11
- package/plugin/stylesheet.js +0 -565
- package/plugin/variants.js +0 -66
package/plugin/index.d.ts
CHANGED
@@ -1,18 +1,43 @@
|
|
1
|
-
|
1
|
+
interface RemapImport {
|
2
|
+
/**
|
3
|
+
* The target import name if `isDefault` is false.
|
4
|
+
*/
|
2
5
|
name?: string,
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Whether the import is default.
|
9
|
+
*/
|
3
10
|
isDefault: boolean,
|
11
|
+
|
12
|
+
/**
|
13
|
+
* The path to the target import.
|
14
|
+
*/
|
4
15
|
path: string,
|
16
|
+
|
17
|
+
/**
|
18
|
+
* The name of the Unistyles component, check `react-native-unistyles/src/components/native`
|
19
|
+
*/
|
5
20
|
mapTo: string
|
6
21
|
}
|
7
22
|
|
8
|
-
|
23
|
+
/**
|
24
|
+
* A more powerful API that allows converting unmatched imports to Unistyles.
|
25
|
+
*/
|
26
|
+
export interface RemapConfig {
|
27
|
+
/**
|
28
|
+
* The node_modules path.
|
29
|
+
*/
|
9
30
|
path: string,
|
31
|
+
|
32
|
+
/**
|
33
|
+
* An array of import objects with the following properties:
|
34
|
+
*/
|
10
35
|
imports: Array<RemapImport>
|
11
36
|
}
|
12
37
|
|
13
38
|
export interface UnistylesPluginOptions {
|
14
39
|
/**
|
15
|
-
* Example:
|
40
|
+
* Example: 'src' or 'apps/mobile'
|
16
41
|
* Add this option if some of your components don't have `react-native-unistyles` import.
|
17
42
|
* Babel plugin will automatically process all files under this root.
|
18
43
|
*/
|
@@ -25,29 +50,41 @@ export interface UnistylesPluginOptions {
|
|
25
50
|
autoProcessImports?: Array<string>,
|
26
51
|
|
27
52
|
/**
|
28
|
-
* Example:
|
29
|
-
*
|
53
|
+
* Example:
|
54
|
+
* ```js
|
55
|
+
* [{
|
56
|
+
* path: 'node_modules/custom-library/components',
|
30
57
|
* imports: [
|
31
58
|
* {
|
32
|
-
* name:
|
59
|
+
* name: 'NativeText',
|
33
60
|
* isDefault: false,
|
34
|
-
* path:
|
35
|
-
* mapTo:
|
61
|
+
* path: 'react-native/Libraries/Text/TextNativeComponent',
|
62
|
+
* mapTo: 'NativeText'
|
36
63
|
* },
|
37
64
|
* {
|
38
65
|
* isDefault: true,
|
39
|
-
* path:
|
40
|
-
* mapTo:
|
66
|
+
* path: 'react-native/Libraries/Components/View/ViewNativeComponent',
|
67
|
+
* mapTo: 'NativeView'
|
41
68
|
* }
|
42
69
|
* ]
|
43
70
|
* }]
|
71
|
+
* ```
|
44
72
|
*
|
45
73
|
* Will map:
|
46
|
-
* import { NativeText } from "react-native/Libraries/Text/TextNativeComponent"
|
47
|
-
* to Unistyles "NativeText"
|
48
74
|
*
|
49
|
-
*
|
50
|
-
*
|
75
|
+
* ```js
|
76
|
+
* import { NativeText } from 'react-native/Libraries/Text/TextNativeComponent'
|
77
|
+
* ```
|
78
|
+
*
|
79
|
+
* to Unistyles 'NativeText'
|
80
|
+
*
|
81
|
+
* and
|
82
|
+
*
|
83
|
+
* ```js
|
84
|
+
* import View from 'react-native/Libraries/Components/View/ViewNativeComponent'
|
85
|
+
* ```
|
86
|
+
*
|
87
|
+
* to Unistyles 'NativeView'
|
51
88
|
*
|
52
89
|
* This is the most powerful way of remapping imports. If 3rd party library uses imports different from `react-native` we can remap them to `react-native-unistyles` factories.
|
53
90
|
* Internally we do that for raw RCTView and RCTText components.
|
@@ -83,7 +120,3 @@ export interface UnistylesPluginOptions {
|
|
83
120
|
*/
|
84
121
|
isLocal?: boolean
|
85
122
|
}
|
86
|
-
|
87
|
-
export interface UnistylesPluginPass {
|
88
|
-
opts: UnistylesPluginOptions
|
89
|
-
}
|