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.
Files changed (79) hide show
  1. package/README.md +16 -0
  2. package/android/CMakeLists.txt +2 -1
  3. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +9 -1
  4. package/cxx/common/Helpers.h +85 -0
  5. package/cxx/core/UnistylesCommitHook.cpp +20 -17
  6. package/cxx/core/UnistylesMountHook.cpp +2 -2
  7. package/cxx/core/UnistylesMountHook.h +1 -4
  8. package/cxx/core/UnistylesRegistry.cpp +8 -6
  9. package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -5
  10. package/cxx/hybridObjects/HybridStyleSheet.cpp +1 -1
  11. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +5 -1
  12. package/cxx/parser/Parser.cpp +74 -9
  13. package/cxx/shadowTree/ShadowTrafficController.h +10 -4
  14. package/cxx/shadowTree/ShadowTreeManager.cpp +38 -35
  15. package/lib/commonjs/components/native/ImageBackground.js +26 -30
  16. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  17. package/lib/commonjs/components/native/Pressable.native.js +12 -1
  18. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  19. package/lib/commonjs/core/createUnistylesElement.native.js +4 -0
  20. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  21. package/lib/commonjs/core/createUnistylesImageBackground.js +4 -0
  22. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  23. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +1 -1
  24. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  25. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +14 -7
  26. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  27. package/lib/commonjs/specs/ShadowRegistry/index.js +1 -1
  28. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  29. package/lib/module/components/native/ImageBackground.js +26 -30
  30. package/lib/module/components/native/ImageBackground.js.map +1 -1
  31. package/lib/module/components/native/Pressable.native.js +12 -1
  32. package/lib/module/components/native/Pressable.native.js.map +1 -1
  33. package/lib/module/core/createUnistylesElement.native.js +4 -0
  34. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  35. package/lib/module/core/createUnistylesImageBackground.js +4 -0
  36. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  37. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +1 -1
  38. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  39. package/lib/module/core/withUnistyles/withUnistyles.native.js +14 -7
  40. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  41. package/lib/module/specs/ShadowRegistry/index.js +1 -1
  42. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  43. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  44. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  45. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  46. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  47. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  48. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  49. package/lib/typescript/src/types/stylesheet.d.ts +1 -1
  50. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  51. package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +2 -2
  52. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +2 -2
  53. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +19 -19
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +7 -2
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +7 -2
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +22 -22
  57. package/nitrogen/generated/android/unistyles+autolinking.cmake +16 -0
  58. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -1
  59. package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -0
  60. package/nitrogen/generated/shared/c++/Insets.hpp +1 -0
  61. package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -0
  62. package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -0
  63. package/package.json +28 -18
  64. package/plugin/index.d.ts +51 -18
  65. package/plugin/index.js +791 -178
  66. package/src/components/native/ImageBackground.tsx +3 -4
  67. package/src/components/native/Pressable.native.tsx +16 -1
  68. package/src/core/createUnistylesElement.native.tsx +5 -0
  69. package/src/core/createUnistylesImageBackground.tsx +5 -0
  70. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +1 -1
  71. package/src/core/withUnistyles/withUnistyles.native.tsx +40 -14
  72. package/src/specs/ShadowRegistry/index.ts +1 -0
  73. package/src/types/stylesheet.ts +1 -1
  74. package/plugin/consts.js +0 -63
  75. package/plugin/exotic.js +0 -54
  76. package/plugin/import.js +0 -51
  77. package/plugin/ref.js +0 -11
  78. package/plugin/stylesheet.js +0 -565
  79. package/plugin/variants.js +0 -66
package/plugin/index.d.ts CHANGED
@@ -1,18 +1,43 @@
1
- type RemapImport = {
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
- type RemapConfig = {
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: "src" or "apps/mobile"
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
- * path: "node_modules/custom-library/components",
53
+ * Example:
54
+ * ```js
55
+ * [{
56
+ * path: 'node_modules/custom-library/components',
30
57
  * imports: [
31
58
  * {
32
- * name: "NativeText",
59
+ * name: 'NativeText',
33
60
  * isDefault: false,
34
- * path: "react-native/Libraries/Text/TextNativeComponent",
35
- * mapTo: "NativeText"
61
+ * path: 'react-native/Libraries/Text/TextNativeComponent',
62
+ * mapTo: 'NativeText'
36
63
  * },
37
64
  * {
38
65
  * isDefault: true,
39
- * path: "react-native/Libraries/Components/View/ViewNativeComponent",
40
- * mapTo: "NativeView"
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
- * import View from "react-native/Libraries/Components/View/ViewNativeComponent"
50
- * to Unistyles "NativeView"
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
- }