react-native-unistyles 3.8.1 → 3.9.0
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 +3 -0
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +11 -12
- package/cxx/core/Unistyle.h +2 -0
- package/cxx/core/UnistyleWrapper.h +2 -1
- package/cxx/core/UnistylesRegistry.cpp +13 -1
- package/cxx/core/UnistylesRegistry.h +2 -0
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +27 -3
- package/cxx/parser/Parser.cpp +9 -0
- package/cxx/shadowTree/NativeProps.h +47 -14
- package/lib/commonjs/components/ScopedTheme.js +22 -8
- package/lib/commonjs/components/ScopedTheme.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js +4 -3
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +3 -7
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +7 -10
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/styleSource.js +3 -7
- package/lib/commonjs/specs/ShadowRegistry/styleSource.js.map +1 -1
- package/lib/commonjs/web/registry.js +3 -3
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/module/components/ScopedTheme.js +21 -7
- package/lib/module/components/ScopedTheme.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/listener.native.js +4 -3
- package/lib/module/core/useProxifiedUnistyles/listener.native.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +3 -7
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +7 -10
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/styleSource.js +3 -7
- package/lib/module/specs/ShadowRegistry/styleSource.js.map +1 -1
- package/lib/module/web/registry.js +3 -3
- package/lib/module/web/registry.js.map +1 -1
- package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/styleSource.d.ts.map +1 -1
- package/metro/index.d.ts +1 -1
- package/metro/index.js +8 -4
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- package/nitrogen/generated/android/c++/JDimensions.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JInsets.hpp +1 -1
- package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +1 -1
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/ColorScheme.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Orientation.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +1 -1
- package/nitrogen/generated/android/unistyles+autolinking.cmake +1 -1
- package/nitrogen/generated/android/unistyles+autolinking.gradle +1 -1
- package/nitrogen/generated/android/unistylesOnLoad.cpp +1 -1
- package/nitrogen/generated/android/unistylesOnLoad.hpp +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/swift/ColorScheme.swift +1 -1
- package/nitrogen/generated/ios/swift/Dimensions.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +3 -3
- package/nitrogen/generated/ios/swift/Insets.swift +1 -1
- package/nitrogen/generated/ios/swift/Orientation.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistyleDependency.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Insets.hpp +1 -1
- package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -1
- package/package.json +7 -6
- package/plugin/index.d.ts +20 -0
- package/plugin/index.js +33 -2
- package/repack-plugin/index.d.ts +41 -0
- package/repack-plugin/index.js +294 -9
- package/src/components/ScopedTheme.tsx +23 -7
- package/src/core/useProxifiedUnistyles/listener.native.ts +8 -3
- package/src/core/useProxifiedUnistyles/types.ts +1 -1
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +2 -2
- package/src/core/withUnistyles/withUnistyles.native.tsx +3 -7
- package/src/index.ts +1 -0
- package/src/specs/ShadowRegistry/index.ts +8 -11
- package/src/specs/ShadowRegistry/styleSource.ts +3 -7
- package/src/web/registry.ts +3 -3
package/metro/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ type MetroConfig = {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Replaces the deprecated `react-native-unistyles/plugin` in babel.config.js
|
|
9
9
|
*
|
|
10
10
|
* Every `react-native` import (also from node_modules) resolves to Unistyles components
|
|
11
11
|
* and Unistyles records the dependencies of every StyleSheet while it runs, there is no Babel transform.
|
package/metro/index.js
CHANGED
|
@@ -60,6 +60,7 @@ var REACT_NATIVE_COMPONENT_NAMES = [
|
|
|
60
60
|
// TouchableWithoutFeedback - can't accept a ref
|
|
61
61
|
];
|
|
62
62
|
var METRO_ENV = "UNISTYLES_METRO";
|
|
63
|
+
var METRO_INTEGRATION = "metro";
|
|
63
64
|
|
|
64
65
|
// metro/src/resolver.ts
|
|
65
66
|
var import_node_fs = __toESM(require("node:fs"));
|
|
@@ -73,8 +74,10 @@ var getRealPath = (filePath) => {
|
|
|
73
74
|
return filePath;
|
|
74
75
|
}
|
|
75
76
|
};
|
|
77
|
+
var isSourceFile = (resolution) => resolution.type === "sourceFile" && "filePath" in resolution;
|
|
76
78
|
var createResolveRequest = ({
|
|
77
79
|
unistylesRoot,
|
|
80
|
+
integration,
|
|
78
81
|
upstream,
|
|
79
82
|
path: path2 = import_node_path.default,
|
|
80
83
|
realpath = getRealPath
|
|
@@ -143,18 +146,18 @@ var createResolveRequest = ({
|
|
|
143
146
|
copies.set(copyRoot, realCopyRoot);
|
|
144
147
|
if (realCopyRoot !== unistylesRoot) {
|
|
145
148
|
console.warn(
|
|
146
|
-
`Unistyles \u{1F984}: Found a second copy of react-native-unistyles at ${realCopyRoot},
|
|
149
|
+
`Unistyles \u{1F984}: Found a second copy of react-native-unistyles at ${realCopyRoot}, ${integration} handles only ${unistylesRoot}. Styles of the second copy won't update, make sure that your app installs react-native-unistyles once.`
|
|
147
150
|
);
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
const copyPath = filePath.slice(copyRoot.length + 1);
|
|
151
154
|
return copies.get(copyRoot) === unistylesRoot && !copyPath.startsWith(`node_modules${sep}`) ? path2.join(unistylesRoot, copyPath) : filePath;
|
|
152
155
|
};
|
|
153
|
-
const withTrackedDependencies = (resolution) => resolution
|
|
156
|
+
const withTrackedDependencies = (resolution) => isSourceFile(resolution) && resolution.filePath === trackDependencies ? { type: "sourceFile", filePath: trackDependenciesWithMetro } : resolution;
|
|
154
157
|
return (context, moduleName, platform) => {
|
|
155
158
|
const resolve = upstream ?? context.resolveRequest;
|
|
156
159
|
const upstreamResolution = resolve(context, moduleName, platform);
|
|
157
|
-
if (
|
|
160
|
+
if (!isSourceFile(upstreamResolution)) {
|
|
158
161
|
return upstreamResolution;
|
|
159
162
|
}
|
|
160
163
|
const filePath = toUnistylesPath(upstreamResolution.filePath);
|
|
@@ -176,13 +179,14 @@ var createResolveRequest = ({
|
|
|
176
179
|
|
|
177
180
|
// metro/src/index.ts
|
|
178
181
|
var withUnistylesConfig = (config) => {
|
|
179
|
-
process.env[METRO_ENV] =
|
|
182
|
+
process.env[METRO_ENV] = METRO_INTEGRATION;
|
|
180
183
|
return {
|
|
181
184
|
...config,
|
|
182
185
|
resolver: {
|
|
183
186
|
...config.resolver,
|
|
184
187
|
resolveRequest: createResolveRequest({
|
|
185
188
|
unistylesRoot: import_node_fs2.default.realpathSync(import_node_path2.default.join(__dirname, "..")),
|
|
189
|
+
integration: "withUnistylesConfig",
|
|
186
190
|
upstream: config.resolver?.resolveRequest
|
|
187
191
|
})
|
|
188
192
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
///
|
|
2
2
|
/// JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
///
|
|
2
2
|
/// Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
///
|
|
2
2
|
/// Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
///
|
|
2
2
|
/// HybridNativePlatformSpec_cxx.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ open class HybridNativePlatformSpec_cxx {
|
|
|
27
27
|
/**
|
|
28
28
|
* Holds an instance of the `HybridNativePlatformSpec` Swift protocol.
|
|
29
29
|
*/
|
|
30
|
-
private
|
|
30
|
+
private let __implementation: any HybridNativePlatformSpec
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
@@ -75,7 +75,7 @@ open class HybridNativePlatformSpec_cxx {
|
|
|
75
75
|
*/
|
|
76
76
|
public func getCxxPart() -> bridge.std__shared_ptr_HybridNativePlatformSpec_ {
|
|
77
77
|
let cachedCxxPart = self.__cxxPart.lock()
|
|
78
|
-
if
|
|
78
|
+
if cachedCxxPart.use_count() > 0 {
|
|
79
79
|
return cachedCxxPart
|
|
80
80
|
} else {
|
|
81
81
|
let newCxxPart = bridge.create_std__shared_ptr_HybridNativePlatformSpec_(self.toUnsafe())
|