react-native-unistyles 3.0.0-nightly-20250207 → 3.0.0-nightly-20250210
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/android/CMakeLists.txt +1 -1
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +4 -0
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +4 -0
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +4 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +5 -0
- package/cxx/core/HashGenerator.cpp +1 -1
- package/cxx/core/UnistyleWrapper.h +6 -6
- package/lib/commonjs/components/native/Pressable.native.js +2 -2
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/warn.js +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +1 -1
- package/lib/commonjs/web/convert/index.js +1 -1
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +1 -1
- package/lib/commonjs/web/utils/unistyle.js +3 -3
- package/lib/module/components/native/Pressable.native.js +2 -2
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/warn.js +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +1 -1
- package/lib/module/web/convert/index.js +1 -1
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -1
- package/lib/module/web/utils/unistyle.js +3 -3
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +23 -39
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +35 -0
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +2 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +3 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -3
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +18 -18
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +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 +3 -3
- package/plugin/index.js +2 -2
- package/plugin/stylesheet.js +2 -2
- package/src/components/native/Pressable.native.tsx +2 -2
- package/src/core/warn.ts +1 -1
- package/src/core/withUnistyles/withUnistyles.native.tsx +1 -1
- package/src/core/withUnistyles/withUnistyles.tsx +1 -1
- package/src/web/convert/index.ts +1 -1
- package/src/web/utils/common.ts +1 -1
- package/src/web/utils/unistyle.ts +3 -3
package/android/CMakeLists.txt
CHANGED
@@ -23,7 +23,7 @@ include_directories(
|
|
23
23
|
../cxx/shadowTree
|
24
24
|
)
|
25
25
|
|
26
|
-
string(APPEND CMAKE_CXX_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1")
|
26
|
+
string(APPEND CMAKE_CXX_FLAGS " -DFOLLY_NO_CONFIG=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1")
|
27
27
|
|
28
28
|
set_target_properties(unistyles PROPERTIES
|
29
29
|
CXX_STANDARD 20
|
@@ -6,11 +6,13 @@ import android.os.Build
|
|
6
6
|
import android.util.DisplayMetrics
|
7
7
|
import android.view.View
|
8
8
|
import android.view.WindowManager
|
9
|
+
import androidx.annotation.Keep
|
9
10
|
import androidx.core.text.TextUtilsCompat
|
10
11
|
import androidx.core.view.ViewCompat
|
11
12
|
import androidx.core.view.WindowCompat
|
12
13
|
import androidx.core.view.WindowInsetsCompat
|
13
14
|
import androidx.core.view.WindowInsetsControllerCompat
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
14
16
|
import com.facebook.react.bridge.LifecycleEventListener
|
15
17
|
import com.facebook.react.bridge.ReactApplicationContext
|
16
18
|
import com.margelo.nitro.unistyles.ColorScheme
|
@@ -22,6 +24,8 @@ import com.margelo.nitro.unistyles.UnistyleDependency
|
|
22
24
|
import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
23
25
|
import java.util.Locale
|
24
26
|
|
27
|
+
@Keep
|
28
|
+
@DoNotStrip
|
25
29
|
class NativePlatformAndroid(private val reactContext: ReactApplicationContext): HybridNativePlatformSpec(), LifecycleEventListener {
|
26
30
|
private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
|
27
31
|
private var _miniRuntime: UnistylesNativeMiniRuntime = buildMiniRuntime()
|
@@ -5,9 +5,11 @@ import android.os.Build
|
|
5
5
|
import android.view.View
|
6
6
|
import android.view.Window
|
7
7
|
import android.view.WindowManager
|
8
|
+
import androidx.annotation.Keep
|
8
9
|
import androidx.core.view.ViewCompat
|
9
10
|
import androidx.core.view.WindowInsetsAnimationCompat
|
10
11
|
import androidx.core.view.WindowInsetsCompat
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
11
13
|
import com.facebook.react.bridge.ReactApplicationContext
|
12
14
|
import com.margelo.nitro.unistyles.Insets
|
13
15
|
import com.margelo.nitro.unistyles.UnistyleDependency
|
@@ -15,6 +17,8 @@ import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
|
15
17
|
|
16
18
|
typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
17
19
|
|
20
|
+
@Keep
|
21
|
+
@DoNotStrip
|
18
22
|
class NativePlatformInsets(
|
19
23
|
private val reactContext: ReactApplicationContext,
|
20
24
|
private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
|
@@ -6,12 +6,16 @@ import android.content.Intent
|
|
6
6
|
import android.content.IntentFilter
|
7
7
|
import android.os.Handler
|
8
8
|
import android.os.Looper
|
9
|
+
import androidx.annotation.Keep
|
10
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
9
11
|
import com.facebook.react.bridge.ReactApplicationContext
|
10
12
|
import com.margelo.nitro.unistyles.UnistyleDependency
|
11
13
|
import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
12
14
|
|
13
15
|
typealias CxxDependencyListener = (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
14
16
|
|
17
|
+
@Keep
|
18
|
+
@DoNotStrip
|
15
19
|
class NativePlatformListener(
|
16
20
|
private val reactContext: ReactApplicationContext,
|
17
21
|
private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
|
@@ -11,6 +11,7 @@ import com.facebook.react.turbomodule.core.interfaces.TurboModuleWithJSIBindings
|
|
11
11
|
import com.facebook.react.uimanager.UIManagerHelper
|
12
12
|
import com.facebook.react.uimanager.common.UIManagerType
|
13
13
|
import com.margelo.nitro.unistyles.HybridNativePlatformSpec
|
14
|
+
import com.margelo.nitro.unistyles.unistylesOnLoad.Companion.initializeNative
|
14
15
|
|
15
16
|
@Suppress("KotlinJniMissingFunction")
|
16
17
|
class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistylesSpec(reactContext), TurboModuleWithJSIBindings {
|
@@ -20,6 +21,10 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
|
|
20
21
|
|
21
22
|
companion object {
|
22
23
|
const val NAME = NativeTurboUnistylesSpec.NAME
|
24
|
+
|
25
|
+
init {
|
26
|
+
initializeNative()
|
27
|
+
}
|
23
28
|
}
|
24
29
|
|
25
30
|
init {
|
@@ -17,7 +17,7 @@ std::string HashGenerator::generateHash(const std::string& input) {
|
|
17
17
|
std::stringstream ss;
|
18
18
|
ss << std::hex << std::setfill('0') << std::setw(8) << (combinedHash & 0xFFFFFFFF);
|
19
19
|
|
20
|
-
return "
|
20
|
+
return "unistyles_" + ss.str();
|
21
21
|
}
|
22
22
|
|
23
23
|
}
|
@@ -35,7 +35,7 @@ inline static Unistyle::Shared unistyleFromStaticStyleSheet(jsi::Runtime& rt, js
|
|
35
35
|
|
36
36
|
inline static std::vector<std::string> getUnistylesHashKeys(jsi::Runtime& rt, jsi::Object& object) {
|
37
37
|
std::vector<std::string> matchingKeys{};
|
38
|
-
const std::string prefix = "
|
38
|
+
const std::string prefix = "unistyles_";
|
39
39
|
|
40
40
|
auto propertyNames = object.getPropertyNames(rt);
|
41
41
|
size_t length = propertyNames.length(rt);
|
@@ -82,13 +82,13 @@ inline static std::vector<Unistyle::Shared> unistylesFromNonExistentNativeState(
|
|
82
82
|
|
83
83
|
You likely altered unistyle hash key and we're not able to recover C++ state attached to this node.)");
|
84
84
|
}
|
85
|
-
|
85
|
+
|
86
86
|
// someone merged unistyles, and will be warned in JS
|
87
87
|
// the best we can do is to return first unistyle
|
88
88
|
if (unistyles.size() > 1) {
|
89
89
|
return {unistyles.at(0)};
|
90
90
|
}
|
91
|
-
|
91
|
+
|
92
92
|
return unistyles;
|
93
93
|
}
|
94
94
|
|
@@ -137,7 +137,7 @@ inline static jsi::Value objectFromUnistyle(jsi::Runtime& rt, std::shared_ptr<Hy
|
|
137
137
|
auto parsedArguments = arguments.has_value()
|
138
138
|
? helpers::parseDynamicFunctionArguments(rt, arguments.value())
|
139
139
|
: std::optional<std::vector<folly::dynamic>>{};
|
140
|
-
|
140
|
+
|
141
141
|
if (arguments.has_value()) {
|
142
142
|
// this is required for HybridShadowRegistry::link
|
143
143
|
helpers::defineHiddenProperty(rt, secrets, helpers::ARGUMENTS.c_str(), arguments.value());
|
@@ -148,7 +148,7 @@ inline static jsi::Value objectFromUnistyle(jsi::Runtime& rt, std::shared_ptr<Hy
|
|
148
148
|
|
149
149
|
// this is required for withUnistyles
|
150
150
|
helpers::defineHiddenProperty(rt, secrets, helpers::STYLE_DEPENDENCIES.c_str(), helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
|
151
|
-
|
151
|
+
|
152
152
|
// this is required for withUnistyles
|
153
153
|
auto hostFn = jsi::Function::createFromHostFunction(
|
154
154
|
rt,
|
@@ -160,7 +160,7 @@ inline static jsi::Value objectFromUnistyle(jsi::Runtime& rt, std::shared_ptr<Hy
|
|
160
160
|
|
161
161
|
return jsi::Value(rt, unistyle->parsedStyle.value()).asObject(rt);
|
162
162
|
});
|
163
|
-
|
163
|
+
|
164
164
|
helpers::defineHiddenProperty(rt, secrets, helpers::GET_STYLES.c_str(), std::move(hostFn));
|
165
165
|
|
166
166
|
obj.setProperty(rt, unistyleID, secrets);
|
@@ -12,7 +12,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
14
14
|
const getStyles = (styleProps = {}) => {
|
15
|
-
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('
|
15
|
+
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('unistyles_'));
|
16
16
|
if (!unistyleKey) {
|
17
17
|
return styleProps;
|
18
18
|
}
|
@@ -47,7 +47,7 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
47
47
|
style: state => {
|
48
48
|
const isPropStyleAFunction = typeof style === 'function';
|
49
49
|
const unistyles = isPropStyleAFunction ? style.call(style, state) : getStyles(style);
|
50
|
-
if (!storedRef.current
|
50
|
+
if (!storedRef.current) {
|
51
51
|
return unistyles;
|
52
52
|
}
|
53
53
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getStyles","styleProps","unistyleKey","keys","find","key","startsWith","uni__getStyles","Pressable","exports","forwardRef","variants","style","props","forwardedRef","storedRef","useRef","useLayoutEffect","current","UnistylesShadowRegistry","remove","jsx","ref","passForwardedRef","state","isPropStyleAFunction","unistyles","add"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAqD,IAAAI,WAAA,GAAAJ,OAAA;AAA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GAAG,CAACC,UAAU,CAAC,YAAY,CAAC,CAAC;EAE9C,IAAI,CAACJ,WAAW,EAAE;IACd,OAAOD,UAAU;EACrB;EAEA,OAAO;IACH;IACA,GAAGA,UAAU,CAACC,WAAW,CAAC,CAACK,cAAc,CAAC,CAAC;IAC3C,CAACL,WAAW,GAAGD,UAAU,CAACC,WAAW;EACzC,CAAC;AACL,CAAC;AAEM,MAAMM,SAAS,GAAAC,OAAA,CAAAD,SAAA,gBAAG,IAAAE,iBAAU,EAAuB,CAAC;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,KAAK;EACvG,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAc,CAAC;EAEvC,IAAAC,sBAAe,EAAC,MAAM;IAClB,OAAO,MAAM;MACT,IAAIF,SAAS,CAACG,OAAO,EAAE;QACnB;QACAC,8BAAuB,CAACC,MAAM,CAACL,SAAS,CAACG,OAAO,CAAC;MACrD;IACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBACI,IAAAvC,WAAA,CAAA0C,GAAA,EAAC7C,YAAA,CAAAgC,SAA0B;IAAA,GACnBK,KAAK;IACTS,GAAG,EAAEA,GAAG,IAAI;MACR,IAAIA,GAAG,EAAE;QACLP,SAAS,CAACG,OAAO,GAAGI,GAAG;MAC3B;MAEA,OAAO,IAAAC,sBAAgB,EAACV,KAAK,EAAES,GAAG,EAAER,YAAY,CAAC;IACrD,CAAE;IACFF,KAAK,EAAEY,KAAK,IAAI;MACZ,MAAMC,oBAAoB,GAAG,OAAOb,KAAK,KAAK,UAAU;MACxD,MAAMc,SAAS,GAAGD,oBAAoB,GAChCb,KAAK,CAACf,IAAI,CAACe,KAAK,EAAEY,KAAK,CAAC,GACxBxB,SAAS,CAACY,KAAuC,CAAC;MAExD,IAAI,CAACG,SAAS,CAACG,OAAO,
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getStyles","styleProps","unistyleKey","keys","find","key","startsWith","uni__getStyles","Pressable","exports","forwardRef","variants","style","props","forwardedRef","storedRef","useRef","useLayoutEffect","current","UnistylesShadowRegistry","remove","jsx","ref","passForwardedRef","state","isPropStyleAFunction","unistyles","add"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAqD,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBA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;IACTS,GAAG,EAAEA,GAAG,IAAI;MACR,IAAIA,GAAG,EAAE;QACLP,SAAS,CAACG,OAAO,GAAGI,GAAG;MAC3B;MAEA,OAAO,IAAAC,sBAAgB,EAACV,KAAK,EAAES,GAAG,EAAER,YAAY,CAAC;IACrD,CAAE;IACFF,KAAK,EAAEY,KAAK,IAAI;MACZ,MAAMC,oBAAoB,GAAG,OAAOb,KAAK,KAAK,UAAU;MACxD,MAAMc,SAAS,GAAGD,oBAAoB,GAChCb,KAAK,CAACf,IAAI,CAACe,KAAK,EAAEY,KAAK,CAAC,GACxBxB,SAAS,CAACY,KAAuC,CAAC;MAExD,IAAI,CAACG,SAAS,CAACG,OAAO,EAAE;QACpB,OAAOQ,SAAS;MACpB;;MAEA;MACAP,8BAAuB,CAACC,MAAM,CAACL,SAAS,CAACG,OAAO,CAAC;;MAEjD;MACAC,8BAAuB,CAACQ,GAAG,CAACZ,SAAS,CAACG,OAAO,EAAEQ,SAAS,CAAC;MAEzD,OAAOA,SAAS;IACpB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.maybeWarnAboutMultipleUnistyles = void 0;
|
7
7
|
const maybeWarnAboutMultipleUnistyles = (style, displayName = 'Unknown') => {
|
8
8
|
if (__DEV__ && style && !Array.isArray(style)) {
|
9
|
-
const unistylesKeys = Object.keys(style).filter(key => key.startsWith('
|
9
|
+
const unistylesKeys = Object.keys(style).filter(key => key.startsWith('unistyles_'));
|
10
10
|
if (unistylesKeys.length > 1) {
|
11
11
|
console.warn(`Unistyles: we detected style object with ${unistylesKeys.length} unistyles styles. This might cause no updates or unpredictable behavior. Please check style prop for "${displayName}" and use array syntax instead of object syntax.`);
|
12
12
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_utils","_getClassname","_useProxifiedUnistyles","_warn","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","withUnistyles","Component","mappings","forwardRef","props","ref","narrowedProps","styleClassNames","getClassName","style","contentContainerStyleClassNames","contentContainerStyle","proxifiedRuntime","proxifiedTheme","useProxifiedUnistyles","mappingsProps","unistyleProps","uniProps","combinedProps","deepMergeObjects","maybeWarnAboutMultipleUnistyles","displayName","name","NativeComponent","jsx","exports"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAA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,IAAGD,aAAa,CAACK,qBAAqB,GAAG;
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_utils","_getClassname","_useProxifiedUnistyles","_warn","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","withUnistyles","Component","mappings","forwardRef","props","ref","narrowedProps","styleClassNames","getClassName","style","contentContainerStyleClassNames","contentContainerStyle","proxifiedRuntime","proxifiedTheme","useProxifiedUnistyles","mappingsProps","unistyleProps","uniProps","combinedProps","deepMergeObjects","maybeWarnAboutMultipleUnistyles","displayName","name","NativeComponent","jsx","exports"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,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,aAAa,EAAEC,aAAa,EAAEZ,KAAK,CAAC;MACxD,IAAGE,aAAa,CAACG,KAAK,GAAG;QACrBA,KAAK,EAAEF;MACX,CAAC,GAAG,CAAC,CAAC;MACN,IAAGD,aAAa,CAACK,qBAAqB,GAAG;QACrCA,qBAAqB,EAAED;MAC3B,CAAC,GAAG,CAAC,CAAC;IACV,CAAQ;;IAER;IACA,IAAAU,qCAA+B,EAACd,aAAa,CAACG,KAAK,EAAE,iBAAiBR,SAAS,CAACoB,WAAW,IAAIpB,SAAS,CAACqB,IAAI,IAAI,SAAS,GAAG,CAAC;IAC9H;IACA,IAAAF,qCAA+B,EAACd,aAAa,CAACK,qBAAqB,EAAE,iBAAiBV,SAAS,CAACoB,WAAW,IAAIpB,SAAS,CAACqB,IAAI,IAAI,SAAS,GAAG,CAAC;IAE9I,MAAMC,eAAe,GAAGtB,SAA0B;IAElD,oBAAO,IAAAtB,WAAA,CAAA6C,GAAA,EAACD,eAAe;MAAA,GAAKL,aAAa;MAAEb,GAAG,EAAEA;IAAI,CAAE,CAAC;EAC3D,CAAC,CAAC;AACN,CAAC;AAAAoB,OAAA,CAAAzB,aAAA,GAAAA,aAAA","ignoreList":[]}
|
@@ -17,7 +17,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
17
17
|
|
18
18
|
const withUnistyles = (Component, mappings) => {
|
19
19
|
const getSecrets = (styleProps = {}) => {
|
20
|
-
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('
|
20
|
+
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('unistyles_'));
|
21
21
|
return unistyleKey ? styleProps[unistyleKey] : {
|
22
22
|
uni__getStyles: () => styleProps,
|
23
23
|
uni__dependencies: []
|
@@ -20,7 +20,7 @@ const convertUnistyles = value => {
|
|
20
20
|
...value._web
|
21
21
|
}).flatMap(([unistylesKey, unistylesValue]) => {
|
22
22
|
// Keys to omit
|
23
|
-
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'
|
23
|
+
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
|
24
24
|
return [];
|
25
25
|
}
|
26
26
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","_object","_pseudo","_shadow","_style","_utils2","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","isPseudo","flattenValues","isTextShadow","getTextShadowStyle","isShadow","getBoxShadowStyle","isFilter","getFilterStyle","isBoxShadow","getBoxShadow","isTransform","getTransformStyle","map","breakpointKey","breakpointValue","getStyle","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEO,MAAMM,gBAAgB,GAAIC,KAAsB,IAAK;EACxD;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,SAAS,GAAG,KAAK;EAErB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO,CAAC;IAC/B,GAAGL,KAAK;IACR,GAAGA,KAAK,CAACM;EACb,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,YAAY,EAAEC,cAAc,CAAC,KAAK;IAC3C;IACA,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,
|
1
|
+
{"version":3,"names":["_utils","require","_object","_pseudo","_shadow","_style","_utils2","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","isPseudo","flattenValues","isTextShadow","getTextShadowStyle","isShadow","getBoxShadowStyle","isFilter","getFilterStyle","isBoxShadow","getBoxShadow","isTransform","getTransformStyle","map","breakpointKey","breakpointValue","getStyle","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEO,MAAMM,gBAAgB,GAAIC,KAAsB,IAAK;EACxD;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,SAAS,GAAG,KAAK;EAErB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO,CAAC;IAC/B,GAAGL,KAAK;IACR,GAAGA,KAAK,CAACM;EACb,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,YAAY,EAAEC,cAAc,CAAC,KAAK;IAC3C;IACA,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAACC,QAAQ,CAACF,YAAY,CAAC,IAAIA,YAAY,CAACG,UAAU,CAAC,YAAY,CAAC,EAAE;MAC9I,OAAO,EAAE;IACb;;IAEA;IACA,IAAI,IAAAC,gBAAQ,EAACJ,YAAY,CAAC,EAAE;MACxB,MAAMK,aAAa,GAAGd,gBAAgB,CAACU,cAAiC,CAAC;MAEzE,OAAO;QAAE,CAACD,YAAY,GAAGK;MAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,IAAAC,oBAAY,EAACN,YAAY,CAAC,EAAE;MAC5B,IAAIP,aAAa,EAAE;QACf,OAAO,EAAE;MACb;MAEAA,aAAa,GAAG,IAAI;MAEpB,OAAO,IAAAc,0BAAkB,EAACf,KAAK,CAAC;IACpC;;IAEA;IACA,IAAI,IAAAgB,gBAAQ,EAACR,YAAY,CAAC,EAAE;MACxB,IAAIN,SAAS,EAAE;QACX,OAAO,EAAE;MACb;MAEAA,SAAS,GAAG,IAAI;MAEhB,OAAO,IAAAe,yBAAiB,EAACjB,KAAK,CAAC;IACnC;IAEA,IAAI,IAAAkB,gBAAQ,EAACV,YAAY,EAAEC,cAAc,CAAC,EAAE;MACxC,OAAO,IAAAU,sBAAc,EAACV,cAAc,CAAC;IACzC;IAEA,IAAI,IAAAW,mBAAW,EAACZ,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAO,IAAAY,oBAAY,EAACZ,cAAc,CAAC;IACvC;;IAEA;IACA,IAAI,IAAAa,mBAAW,EAACd,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAO,IAAAc,yBAAiB,EAACd,cAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOL,MAAM,CAACC,OAAO,CAACI,cAAc,CAAC,CAACe,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAG,IAAAE,eAAQ,EAACnB,YAAY,EAAEkB,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAO,IAAAC,eAAQ,EAACnB,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAO,IAAAmB,uBAAgB,EAAC,GAAGzB,WAAW,CAAC;AAC3C,CAAC;AAAA0B,OAAA,CAAA9B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -53,7 +53,7 @@ const cyrb53 = (data, seed = 0) => {
|
|
53
53
|
};
|
54
54
|
const generateHash = value => {
|
55
55
|
const serialized = serialize(value);
|
56
|
-
return `
|
56
|
+
return `unistyles_${cyrb53(serialized).toString(36)}`;
|
57
57
|
};
|
58
58
|
exports.generateHash = generateHash;
|
59
59
|
//# sourceMappingURL=common.js.map
|
@@ -22,9 +22,9 @@ const assignSecrets = (object, secrets) => {
|
|
22
22
|
const secretsId = Math.random().toString(36).slice(8);
|
23
23
|
|
24
24
|
// @ts-expect-error assign hidden secrets
|
25
|
-
object[`
|
25
|
+
object[`unistyles_${secretsId}`] = {};
|
26
26
|
// @ts-expect-error assign hidden secrets
|
27
|
-
Object.defineProperties(object[`
|
27
|
+
Object.defineProperties(object[`unistyles_${secretsId}`], (0, _common.reduceObject)(secrets, secret => ({
|
28
28
|
value: secret,
|
29
29
|
enumerable: false,
|
30
30
|
configurable: true
|
@@ -36,7 +36,7 @@ const extractSecrets = object => {
|
|
36
36
|
if (!object) {
|
37
37
|
return undefined;
|
38
38
|
}
|
39
|
-
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('
|
39
|
+
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles_')) ?? [];
|
40
40
|
if (!secrets) {
|
41
41
|
return undefined;
|
42
42
|
}
|
@@ -6,7 +6,7 @@ import { passForwardedRef } from '../../core';
|
|
6
6
|
import { UnistylesShadowRegistry } from '../../specs';
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
8
|
const getStyles = (styleProps = {}) => {
|
9
|
-
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('
|
9
|
+
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('unistyles_'));
|
10
10
|
if (!unistyleKey) {
|
11
11
|
return styleProps;
|
12
12
|
}
|
@@ -41,7 +41,7 @@ export const Pressable = /*#__PURE__*/forwardRef(({
|
|
41
41
|
style: state => {
|
42
42
|
const isPropStyleAFunction = typeof style === 'function';
|
43
43
|
const unistyles = isPropStyleAFunction ? style.call(style, state) : getStyles(style);
|
44
|
-
if (!storedRef.current
|
44
|
+
if (!storedRef.current) {
|
45
45
|
return unistyles;
|
46
46
|
}
|
47
47
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useLayoutEffect","useRef","Pressable","NativePressableReactNative","passForwardedRef","UnistylesShadowRegistry","jsx","_jsx","getStyles","styleProps","unistyleKey","Object","keys","find","key","startsWith","uni__getStyles","variants","style","props","forwardedRef","storedRef","current","remove","ref","state","isPropStyleAFunction","unistyles","call","add"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAClE,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,uBAAuB,QAAQ,aAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMrD,MAAMC,SAAS,GAAGA,CAACC,UAA+B,GAAG,CAAC,CAAC,KAAK;EACxD,MAAMC,WAAW,GAAGC,MAAM,CACrBC,IAAI,CAACH,UAAU,CAAC,CAChBI,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,UAAU,CAAC,YAAY,CAAC,CAAC;EAE9C,IAAI,CAACL,WAAW,EAAE;IACd,OAAOD,UAAU;EACrB;EAEA,OAAO;IACH;IACA,GAAGA,UAAU,CAACC,WAAW,CAAC,CAACM,cAAc,CAAC,CAAC;IAC3C,CAACN,WAAW,GAAGD,UAAU,CAACC,WAAW;EACzC,CAAC;AACL,CAAC;AAED,OAAO,MAAMR,SAAS,gBAAGH,UAAU,CAAuB,CAAC;EAAEkB,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,KAAK;EACvG,MAAMC,SAAS,GAAGpB,MAAM,CAAc,CAAC;EAEvCD,eAAe,CAAC,MAAM;IAClB,OAAO,MAAM;MACT,IAAIqB,SAAS,CAACC,OAAO,EAAE;QACnB;QACAjB,uBAAuB,CAACkB,MAAM,CAACF,SAAS,CAACC,OAAO,CAAC;MACrD;IACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBACIf,IAAA,CAACJ,0BAA0B;IAAA,GACnBgB,KAAK;IACTK,GAAG,EAAEA,GAAG,IAAI;MACR,IAAIA,GAAG,EAAE;QACLH,SAAS,CAACC,OAAO,GAAGE,GAAG;MAC3B;MAEA,OAAOpB,gBAAgB,CAACe,KAAK,EAAEK,GAAG,EAAEJ,YAAY,CAAC;IACrD,CAAE;IACFF,KAAK,EAAEO,KAAK,IAAI;MACZ,MAAMC,oBAAoB,GAAG,OAAOR,KAAK,KAAK,UAAU;MACxD,MAAMS,SAAS,GAAGD,oBAAoB,GAChCR,KAAK,CAACU,IAAI,CAACV,KAAK,EAAEO,KAAK,CAAC,GACxBjB,SAAS,CAACU,KAAuC,CAAC;MAExD,IAAI,CAACG,SAAS,CAACC,OAAO,
|
1
|
+
{"version":3,"names":["React","forwardRef","useLayoutEffect","useRef","Pressable","NativePressableReactNative","passForwardedRef","UnistylesShadowRegistry","jsx","_jsx","getStyles","styleProps","unistyleKey","Object","keys","find","key","startsWith","uni__getStyles","variants","style","props","forwardedRef","storedRef","current","remove","ref","state","isPropStyleAFunction","unistyles","call","add"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAClE,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,uBAAuB,QAAQ,aAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMrD,MAAMC,SAAS,GAAGA,CAACC,UAA+B,GAAG,CAAC,CAAC,KAAK;EACxD,MAAMC,WAAW,GAAGC,MAAM,CACrBC,IAAI,CAACH,UAAU,CAAC,CAChBI,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,UAAU,CAAC,YAAY,CAAC,CAAC;EAE9C,IAAI,CAACL,WAAW,EAAE;IACd,OAAOD,UAAU;EACrB;EAEA,OAAO;IACH;IACA,GAAGA,UAAU,CAACC,WAAW,CAAC,CAACM,cAAc,CAA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
3
3
|
export const maybeWarnAboutMultipleUnistyles = (style, displayName = 'Unknown') => {
|
4
4
|
if (__DEV__ && style && !Array.isArray(style)) {
|
5
|
-
const unistylesKeys = Object.keys(style).filter(key => key.startsWith('
|
5
|
+
const unistylesKeys = Object.keys(style).filter(key => key.startsWith('unistyles_'));
|
6
6
|
if (unistylesKeys.length > 1) {
|
7
7
|
console.warn(`Unistyles: we detected style object with ${unistylesKeys.length} unistyles styles. This might cause no updates or unpredictable behavior. Please check style prop for "${displayName}" and use array syntax instead of object syntax.`);
|
8
8
|
}
|
@@ -27,7 +27,7 @@ export const withUnistyles = (Component, mappings) => {
|
|
27
27
|
style: styleClassNames
|
28
28
|
} : {}),
|
29
29
|
...(narrowedProps.contentContainerStyle ? {
|
30
|
-
|
30
|
+
contentContainerStyle: contentContainerStyleClassNames
|
31
31
|
} : {})
|
32
32
|
};
|
33
33
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","deepMergeObjects","getClassName","useProxifiedUnistyles","maybeWarnAboutMultipleUnistyles","jsx","_jsx","withUnistyles","Component","mappings","props","ref","narrowedProps","styleClassNames","style","contentContainerStyleClassNames","contentContainerStyle","proxifiedRuntime","proxifiedTheme","mappingsProps","unistyleProps","uniProps","combinedProps","displayName","name","NativeComponent"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAwBC,UAAU,QAAgD,OAAO;AAGrG,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,+BAA+B,QAAQ,SAAS;;AAGzD;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA,OAAO,MAAMC,aAAa,GAAGA,CAAkEC,SAAqB,EAAEC,QAA8B,KAAK;EAUrJ,oBAAOT,UAAU,CAAsD,CAACU,KAAK,EAAEC,GAAG,KAAK;IACnF,MAAMC,aAAa,GAAGF,KAA4C;IAClE,MAAMG,eAAe,GAAGX,YAAY,CAACU,aAAa,CAACE,KAAK,CAAC;IACzD,MAAMC,+BAA+B,GAAGb,YAAY,CAACU,aAAa,CAACI,qBAAqB,CAAC;IACzF,MAAM;MAAEC,gBAAgB;MAAEC;IAAe,CAAC,GAAGf,qBAAqB,CAAC,CAAC;IAEpE,MAAMgB,aAAa,GAAGV,QAAQ,GAAGA,QAAQ,CAACS,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAChF,MAAMG,aAAa,GAAGR,aAAa,CAACS,QAAQ,GAAGT,aAAa,CAACS,QAAQ,CAACH,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAE5G,MAAMK,aAAa,GAAG;MAClB,GAAGrB,gBAAgB,CAACkB,aAAa,EAAEC,aAAa,EAAEV,KAAK,CAAC;MACxD,IAAGE,aAAa,CAACE,KAAK,GAAG;QACrBA,KAAK,EAAED;MACX,CAAC,GAAG,CAAC,CAAC;MACN,IAAGD,aAAa,CAACI,qBAAqB,GAAG;
|
1
|
+
{"version":3,"names":["React","forwardRef","deepMergeObjects","getClassName","useProxifiedUnistyles","maybeWarnAboutMultipleUnistyles","jsx","_jsx","withUnistyles","Component","mappings","props","ref","narrowedProps","styleClassNames","style","contentContainerStyleClassNames","contentContainerStyle","proxifiedRuntime","proxifiedTheme","mappingsProps","unistyleProps","uniProps","combinedProps","displayName","name","NativeComponent"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAwBC,UAAU,QAAgD,OAAO;AAGrG,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,+BAA+B,QAAQ,SAAS;;AAGzD;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA,OAAO,MAAMC,aAAa,GAA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CAAC;EAC3D,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -11,7 +11,7 @@ import { maybeWarnAboutMultipleUnistyles } from '../warn';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
12
|
export const withUnistyles = (Component, mappings) => {
|
13
13
|
const getSecrets = (styleProps = {}) => {
|
14
|
-
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('
|
14
|
+
const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('unistyles_'));
|
15
15
|
return unistyleKey ? styleProps[unistyleKey] : {
|
16
16
|
uni__getStyles: () => styleProps,
|
17
17
|
uni__dependencies: []
|
@@ -16,7 +16,7 @@ export const convertUnistyles = value => {
|
|
16
16
|
...value._web
|
17
17
|
}).flatMap(([unistylesKey, unistylesValue]) => {
|
18
18
|
// Keys to omit
|
19
|
-
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'
|
19
|
+
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
|
20
20
|
return [];
|
21
21
|
}
|
22
22
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","getBoxShadow","getFilterStyle","getTransformStyle","isPseudo","getBoxShadowStyle","getTextShadowStyle","getStyle","isBoxShadow","isFilter","isShadow","isTextShadow","isTransform","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","flattenValues","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,YAAY,EAAEC,cAAc,EAAEC,iBAAiB,QAAQ,UAAU;AAC1E,SAASC,QAAQ,QAAQ,UAAU;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,UAAU;AAChE,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAEpF,OAAO,MAAMC,gBAAgB,GAAIC,KAAsB,IAAK;EACxD;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,SAAS,GAAG,KAAK;EAErB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO,CAAC;IAC/B,GAAGL,KAAK;IACR,GAAGA,KAAK,CAACM;EACb,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,YAAY,EAAEC,cAAc,CAAC,KAAK;IAC3C;IACA,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,
|
1
|
+
{"version":3,"names":["deepMergeObjects","getBoxShadow","getFilterStyle","getTransformStyle","isPseudo","getBoxShadowStyle","getTextShadowStyle","getStyle","isBoxShadow","isFilter","isShadow","isTextShadow","isTransform","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","flattenValues","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,YAAY,EAAEC,cAAc,EAAEC,iBAAiB,QAAQ,UAAU;AAC1E,SAASC,QAAQ,QAAQ,UAAU;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,UAAU;AAChE,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAEpF,OAAO,MAAMC,gBAAgB,GAAIC,KAAsB,IAAK;EACxD;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,SAAS,GAAG,KAAK;EAErB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO,CAAC;IAC/B,GAAGL,KAAK;IACR,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cAAc,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAGrB,QAAQ,CAACe,YAAY,EAAEO,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAOtB,QAAQ,CAACe,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAOvB,gBAAgB,CAAC,GAAGiB,WAAW,CAAC;AAC3C,CAAC","ignoreList":[]}
|
@@ -42,6 +42,6 @@ const cyrb53 = (data, seed = 0) => {
|
|
42
42
|
};
|
43
43
|
export const generateHash = value => {
|
44
44
|
const serialized = serialize(value);
|
45
|
-
return `
|
45
|
+
return `unistyles_${cyrb53(serialized).toString(36)}`;
|
46
46
|
};
|
47
47
|
//# sourceMappingURL=common.js.map
|
@@ -17,9 +17,9 @@ export const assignSecrets = (object, secrets) => {
|
|
17
17
|
const secretsId = Math.random().toString(36).slice(8);
|
18
18
|
|
19
19
|
// @ts-expect-error assign hidden secrets
|
20
|
-
object[`
|
20
|
+
object[`unistyles_${secretsId}`] = {};
|
21
21
|
// @ts-expect-error assign hidden secrets
|
22
|
-
Object.defineProperties(object[`
|
22
|
+
Object.defineProperties(object[`unistyles_${secretsId}`], reduceObject(secrets, secret => ({
|
23
23
|
value: secret,
|
24
24
|
enumerable: false,
|
25
25
|
configurable: true
|
@@ -30,7 +30,7 @@ export const extractSecrets = object => {
|
|
30
30
|
if (!object) {
|
31
31
|
return undefined;
|
32
32
|
}
|
33
|
-
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('
|
33
|
+
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles_')) ?? [];
|
34
34
|
if (!secrets) {
|
35
35
|
return undefined;
|
36
36
|
}
|
@@ -32,7 +32,7 @@ namespace margelo::nitro::unistyles {
|
|
32
32
|
_javaPart(jni::make_global(jThis)) {}
|
33
33
|
|
34
34
|
public:
|
35
|
-
|
35
|
+
~JHybridNativePlatformSpec() override {
|
36
36
|
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
37
37
|
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
38
38
|
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt
CHANGED
@@ -7,7 +7,6 @@
|
|
7
7
|
|
8
8
|
package com.margelo.nitro.unistyles
|
9
9
|
|
10
|
-
import android.util.Log
|
11
10
|
import androidx.annotation.Keep
|
12
11
|
import com.facebook.jni.HybridData
|
13
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
@@ -29,100 +28,96 @@ abstract class HybridNativePlatformSpec: HybridObject() {
|
|
29
28
|
private var mHybridData: HybridData = initHybrid()
|
30
29
|
|
31
30
|
init {
|
32
|
-
// Pass this `HybridData` through to it's base class,
|
33
|
-
// to represent inheritance to JHybridObject on C++ side
|
34
31
|
super.updateNative(mHybridData)
|
35
32
|
}
|
36
33
|
|
37
|
-
/**
|
38
|
-
* Call from a child class to initialize HybridData with a child.
|
39
|
-
*/
|
40
34
|
override fun updateNative(hybridData: HybridData) {
|
41
35
|
mHybridData = hybridData
|
36
|
+
super.updateNative(hybridData)
|
42
37
|
}
|
43
38
|
|
44
39
|
// Properties
|
45
|
-
|
40
|
+
|
46
41
|
|
47
42
|
// Methods
|
48
43
|
@DoNotStrip
|
49
44
|
@Keep
|
50
45
|
abstract fun getInsets(): Insets
|
51
|
-
|
46
|
+
|
52
47
|
@DoNotStrip
|
53
48
|
@Keep
|
54
49
|
abstract fun getColorScheme(): ColorScheme
|
55
|
-
|
50
|
+
|
56
51
|
@DoNotStrip
|
57
52
|
@Keep
|
58
53
|
abstract fun getFontScale(): Double
|
59
|
-
|
54
|
+
|
60
55
|
@DoNotStrip
|
61
56
|
@Keep
|
62
57
|
abstract fun getPixelRatio(): Double
|
63
|
-
|
58
|
+
|
64
59
|
@DoNotStrip
|
65
60
|
@Keep
|
66
61
|
abstract fun getOrientation(): Orientation
|
67
|
-
|
62
|
+
|
68
63
|
@DoNotStrip
|
69
64
|
@Keep
|
70
65
|
abstract fun getContentSizeCategory(): String
|
71
|
-
|
66
|
+
|
72
67
|
@DoNotStrip
|
73
68
|
@Keep
|
74
69
|
abstract fun getScreenDimensions(): Dimensions
|
75
|
-
|
70
|
+
|
76
71
|
@DoNotStrip
|
77
72
|
@Keep
|
78
73
|
abstract fun getStatusBarDimensions(): Dimensions
|
79
|
-
|
74
|
+
|
80
75
|
@DoNotStrip
|
81
76
|
@Keep
|
82
77
|
abstract fun getNavigationBarDimensions(): Dimensions
|
83
|
-
|
78
|
+
|
84
79
|
@DoNotStrip
|
85
80
|
@Keep
|
86
81
|
abstract fun getPrefersRtlDirection(): Boolean
|
87
|
-
|
82
|
+
|
88
83
|
@DoNotStrip
|
89
84
|
@Keep
|
90
85
|
abstract fun setRootViewBackgroundColor(color: Double): Unit
|
91
|
-
|
86
|
+
|
92
87
|
@DoNotStrip
|
93
88
|
@Keep
|
94
89
|
abstract fun setNavigationBarHidden(isHidden: Boolean): Unit
|
95
|
-
|
90
|
+
|
96
91
|
@DoNotStrip
|
97
92
|
@Keep
|
98
93
|
abstract fun setStatusBarHidden(isHidden: Boolean): Unit
|
99
|
-
|
94
|
+
|
100
95
|
@DoNotStrip
|
101
96
|
@Keep
|
102
97
|
abstract fun setImmersiveMode(isEnabled: Boolean): Unit
|
103
|
-
|
98
|
+
|
104
99
|
@DoNotStrip
|
105
100
|
@Keep
|
106
101
|
abstract fun getMiniRuntime(): UnistylesNativeMiniRuntime
|
107
|
-
|
102
|
+
|
108
103
|
abstract fun registerPlatformListener(callback: (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) -> Unit): Unit
|
109
|
-
|
104
|
+
|
110
105
|
@DoNotStrip
|
111
106
|
@Keep
|
112
|
-
|
107
|
+
fun registerPlatformListener_cxx(callback: Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime): Unit {
|
113
108
|
val __result = registerPlatformListener(callback)
|
114
109
|
return __result
|
115
110
|
}
|
116
|
-
|
111
|
+
|
117
112
|
abstract fun registerImeListener(callback: (miniRuntime: UnistylesNativeMiniRuntime) -> Unit): Unit
|
118
|
-
|
113
|
+
|
119
114
|
@DoNotStrip
|
120
115
|
@Keep
|
121
|
-
|
116
|
+
fun registerImeListener_cxx(callback: Func_void_UnistylesNativeMiniRuntime): Unit {
|
122
117
|
val __result = registerImeListener(callback)
|
123
118
|
return __result
|
124
119
|
}
|
125
|
-
|
120
|
+
|
126
121
|
@DoNotStrip
|
127
122
|
@Keep
|
128
123
|
abstract fun unregisterPlatformListeners(): Unit
|
@@ -131,16 +126,5 @@ abstract class HybridNativePlatformSpec: HybridObject() {
|
|
131
126
|
|
132
127
|
companion object {
|
133
128
|
private const val TAG = "HybridNativePlatformSpec"
|
134
|
-
init {
|
135
|
-
try {
|
136
|
-
Log.i(TAG, "Loading unistyles C++ library...")
|
137
|
-
System.loadLibrary("unistyles")
|
138
|
-
Log.i(TAG, "Successfully loaded unistyles C++ library!")
|
139
|
-
} catch (e: Error) {
|
140
|
-
Log.e(TAG, "Failed to load unistyles C++ library! Is it properly installed and linked? " +
|
141
|
-
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
142
|
-
throw e
|
143
|
-
}
|
144
|
-
}
|
145
129
|
}
|
146
130
|
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
///
|
2
|
+
/// unistylesOnLoad.kt
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
4
|
+
/// https://github.com/mrousavy/nitro
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
6
|
+
///
|
7
|
+
|
8
|
+
package com.margelo.nitro.unistyles
|
9
|
+
|
10
|
+
import android.util.Log
|
11
|
+
|
12
|
+
internal class unistylesOnLoad {
|
13
|
+
companion object {
|
14
|
+
private const val TAG = "unistylesOnLoad"
|
15
|
+
private var didLoad = false
|
16
|
+
/**
|
17
|
+
* Initializes the native part of "unistyles".
|
18
|
+
* This method is idempotent and can be called more than once.
|
19
|
+
*/
|
20
|
+
@JvmStatic
|
21
|
+
fun initializeNative() {
|
22
|
+
if (didLoad) return
|
23
|
+
try {
|
24
|
+
Log.i(TAG, "Loading unistyles C++ library...")
|
25
|
+
System.loadLibrary("unistyles")
|
26
|
+
Log.i(TAG, "Successfully loaded unistyles C++ library!")
|
27
|
+
didLoad = true
|
28
|
+
} catch (e: Error) {
|
29
|
+
Log.e(TAG, "Failed to load unistyles C++ library! Is it properly installed and linked? " +
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
31
|
+
throw e
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
@@ -44,6 +44,8 @@ def add_nitrogen_files(spec)
|
|
44
44
|
spec.private_header_files = current_private_header_files + [
|
45
45
|
# iOS specific specs
|
46
46
|
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
47
|
+
# Views are framework-specific and should be private
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
47
49
|
]
|
48
50
|
|
49
51
|
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
@@ -41,7 +41,7 @@ namespace margelo::nitro::unistyles::bridge::swift {
|
|
41
41
|
throw std::runtime_error("Class \"HybridNativePlatformSpec\" is not implemented in Swift!");
|
42
42
|
}
|
43
43
|
#endif
|
44
|
-
Unistyles::HybridNativePlatformSpec_cxx swiftPart = swiftWrapper->getSwiftPart();
|
44
|
+
Unistyles::HybridNativePlatformSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
45
45
|
return swiftPart.toUnsafe();
|
46
46
|
}
|
47
47
|
|
@@ -58,7 +58,9 @@ namespace margelo::nitro::unistyles {
|
|
58
58
|
|
59
59
|
public:
|
60
60
|
// Get the Swift part
|
61
|
-
inline Unistyles::HybridNativePlatformSpec_cxx getSwiftPart() noexcept {
|
61
|
+
inline Unistyles::HybridNativePlatformSpec_cxx& getSwiftPart() noexcept {
|
62
|
+
return _swiftPart;
|
63
|
+
}
|
62
64
|
|
63
65
|
public:
|
64
66
|
// Get memory pressure
|
@@ -9,7 +9,7 @@ import Foundation
|
|
9
9
|
import NitroModules
|
10
10
|
|
11
11
|
/// See ``HybridNativePlatformSpec``
|
12
|
-
public protocol HybridNativePlatformSpec_protocol:
|
12
|
+
public protocol HybridNativePlatformSpec_protocol: HybridObject {
|
13
13
|
// Properties
|
14
14
|
|
15
15
|
|
@@ -35,7 +35,7 @@ public protocol HybridNativePlatformSpec_protocol: AnyObject {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
/// See ``HybridNativePlatformSpec``
|
38
|
-
public class HybridNativePlatformSpec_base
|
38
|
+
public class HybridNativePlatformSpec_base {
|
39
39
|
private weak var cxxWrapper: HybridNativePlatformSpec_cxx? = nil
|
40
40
|
public func getCxxWrapper() -> HybridNativePlatformSpec_cxx {
|
41
41
|
#if DEBUG
|
@@ -51,7 +51,6 @@ public class HybridNativePlatformSpec_base: HybridObjectSpec {
|
|
51
51
|
return cxxWrapper
|
52
52
|
}
|
53
53
|
}
|
54
|
-
public var memorySize: Int { return 0 }
|
55
54
|
}
|
56
55
|
|
57
56
|
/**
|
@@ -101,7 +101,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
101
101
|
|
102
102
|
// Methods
|
103
103
|
@inline(__always)
|
104
|
-
public func getInsets() -> bridge.Result_Insets_ {
|
104
|
+
public final func getInsets() -> bridge.Result_Insets_ {
|
105
105
|
do {
|
106
106
|
let __result = try self.__implementation.getInsets()
|
107
107
|
let __resultCpp = __result
|
@@ -113,7 +113,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
113
113
|
}
|
114
114
|
|
115
115
|
@inline(__always)
|
116
|
-
public func getColorScheme() -> bridge.Result_ColorScheme_ {
|
116
|
+
public final func getColorScheme() -> bridge.Result_ColorScheme_ {
|
117
117
|
do {
|
118
118
|
let __result = try self.__implementation.getColorScheme()
|
119
119
|
let __resultCpp = __result
|
@@ -125,7 +125,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
125
125
|
}
|
126
126
|
|
127
127
|
@inline(__always)
|
128
|
-
public func getFontScale() -> bridge.Result_double_ {
|
128
|
+
public final func getFontScale() -> bridge.Result_double_ {
|
129
129
|
do {
|
130
130
|
let __result = try self.__implementation.getFontScale()
|
131
131
|
let __resultCpp = __result
|
@@ -137,7 +137,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
137
137
|
}
|
138
138
|
|
139
139
|
@inline(__always)
|
140
|
-
public func getPixelRatio() -> bridge.Result_double_ {
|
140
|
+
public final func getPixelRatio() -> bridge.Result_double_ {
|
141
141
|
do {
|
142
142
|
let __result = try self.__implementation.getPixelRatio()
|
143
143
|
let __resultCpp = __result
|
@@ -149,7 +149,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
149
149
|
}
|
150
150
|
|
151
151
|
@inline(__always)
|
152
|
-
public func getOrientation() -> bridge.Result_Orientation_ {
|
152
|
+
public final func getOrientation() -> bridge.Result_Orientation_ {
|
153
153
|
do {
|
154
154
|
let __result = try self.__implementation.getOrientation()
|
155
155
|
let __resultCpp = __result
|
@@ -161,7 +161,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
161
161
|
}
|
162
162
|
|
163
163
|
@inline(__always)
|
164
|
-
public func getContentSizeCategory() -> bridge.Result_std__string_ {
|
164
|
+
public final func getContentSizeCategory() -> bridge.Result_std__string_ {
|
165
165
|
do {
|
166
166
|
let __result = try self.__implementation.getContentSizeCategory()
|
167
167
|
let __resultCpp = std.string(__result)
|
@@ -173,7 +173,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
173
173
|
}
|
174
174
|
|
175
175
|
@inline(__always)
|
176
|
-
public func getScreenDimensions() -> bridge.Result_Dimensions_ {
|
176
|
+
public final func getScreenDimensions() -> bridge.Result_Dimensions_ {
|
177
177
|
do {
|
178
178
|
let __result = try self.__implementation.getScreenDimensions()
|
179
179
|
let __resultCpp = __result
|
@@ -185,7 +185,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
185
185
|
}
|
186
186
|
|
187
187
|
@inline(__always)
|
188
|
-
public func getStatusBarDimensions() -> bridge.Result_Dimensions_ {
|
188
|
+
public final func getStatusBarDimensions() -> bridge.Result_Dimensions_ {
|
189
189
|
do {
|
190
190
|
let __result = try self.__implementation.getStatusBarDimensions()
|
191
191
|
let __resultCpp = __result
|
@@ -197,7 +197,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
197
197
|
}
|
198
198
|
|
199
199
|
@inline(__always)
|
200
|
-
public func getNavigationBarDimensions() -> bridge.Result_Dimensions_ {
|
200
|
+
public final func getNavigationBarDimensions() -> bridge.Result_Dimensions_ {
|
201
201
|
do {
|
202
202
|
let __result = try self.__implementation.getNavigationBarDimensions()
|
203
203
|
let __resultCpp = __result
|
@@ -209,7 +209,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
209
209
|
}
|
210
210
|
|
211
211
|
@inline(__always)
|
212
|
-
public func getPrefersRtlDirection() -> bridge.Result_bool_ {
|
212
|
+
public final func getPrefersRtlDirection() -> bridge.Result_bool_ {
|
213
213
|
do {
|
214
214
|
let __result = try self.__implementation.getPrefersRtlDirection()
|
215
215
|
let __resultCpp = __result
|
@@ -221,7 +221,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
221
221
|
}
|
222
222
|
|
223
223
|
@inline(__always)
|
224
|
-
public func setRootViewBackgroundColor(color: Double) -> bridge.Result_void_ {
|
224
|
+
public final func setRootViewBackgroundColor(color: Double) -> bridge.Result_void_ {
|
225
225
|
do {
|
226
226
|
try self.__implementation.setRootViewBackgroundColor(color: color)
|
227
227
|
return bridge.create_Result_void_()
|
@@ -232,7 +232,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
232
232
|
}
|
233
233
|
|
234
234
|
@inline(__always)
|
235
|
-
public func setNavigationBarHidden(isHidden: Bool) -> bridge.Result_void_ {
|
235
|
+
public final func setNavigationBarHidden(isHidden: Bool) -> bridge.Result_void_ {
|
236
236
|
do {
|
237
237
|
try self.__implementation.setNavigationBarHidden(isHidden: isHidden)
|
238
238
|
return bridge.create_Result_void_()
|
@@ -243,7 +243,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
243
243
|
}
|
244
244
|
|
245
245
|
@inline(__always)
|
246
|
-
public func setStatusBarHidden(isHidden: Bool) -> bridge.Result_void_ {
|
246
|
+
public final func setStatusBarHidden(isHidden: Bool) -> bridge.Result_void_ {
|
247
247
|
do {
|
248
248
|
try self.__implementation.setStatusBarHidden(isHidden: isHidden)
|
249
249
|
return bridge.create_Result_void_()
|
@@ -254,7 +254,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
254
254
|
}
|
255
255
|
|
256
256
|
@inline(__always)
|
257
|
-
public func setImmersiveMode(isEnabled: Bool) -> bridge.Result_void_ {
|
257
|
+
public final func setImmersiveMode(isEnabled: Bool) -> bridge.Result_void_ {
|
258
258
|
do {
|
259
259
|
try self.__implementation.setImmersiveMode(isEnabled: isEnabled)
|
260
260
|
return bridge.create_Result_void_()
|
@@ -265,7 +265,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
265
265
|
}
|
266
266
|
|
267
267
|
@inline(__always)
|
268
|
-
public func getMiniRuntime() -> bridge.Result_UnistylesNativeMiniRuntime_ {
|
268
|
+
public final func getMiniRuntime() -> bridge.Result_UnistylesNativeMiniRuntime_ {
|
269
269
|
do {
|
270
270
|
let __result = try self.__implementation.getMiniRuntime()
|
271
271
|
let __resultCpp = __result
|
@@ -277,7 +277,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
277
277
|
}
|
278
278
|
|
279
279
|
@inline(__always)
|
280
|
-
public func registerPlatformListener(callback: bridge.Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
|
280
|
+
public final func registerPlatformListener(callback: bridge.Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
|
281
281
|
do {
|
282
282
|
try self.__implementation.registerPlatformListener(callback: { () -> ([UnistyleDependency], UnistylesNativeMiniRuntime) -> Void in
|
283
283
|
let __wrappedFunction = bridge.wrap_Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime(callback)
|
@@ -299,7 +299,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
299
299
|
}
|
300
300
|
|
301
301
|
@inline(__always)
|
302
|
-
public func registerImeListener(callback: bridge.Func_void_UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
|
302
|
+
public final func registerImeListener(callback: bridge.Func_void_UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
|
303
303
|
do {
|
304
304
|
try self.__implementation.registerImeListener(callback: { () -> (UnistylesNativeMiniRuntime) -> Void in
|
305
305
|
let __wrappedFunction = bridge.wrap_Func_void_UnistylesNativeMiniRuntime(callback)
|
@@ -315,7 +315,7 @@ public class HybridNativePlatformSpec_cxx {
|
|
315
315
|
}
|
316
316
|
|
317
317
|
@inline(__always)
|
318
|
-
public func unregisterPlatformListeners() -> bridge.Result_void_ {
|
318
|
+
public final func unregisterPlatformListeners() -> bridge.Result_void_ {
|
319
319
|
do {
|
320
320
|
try self.__implementation.unregisterPlatformListeners()
|
321
321
|
return bridge.create_Result_void_()
|
@@ -42,7 +42,7 @@ namespace margelo::nitro {
|
|
42
42
|
|
43
43
|
// C++ ColorScheme <> JS ColorScheme (union)
|
44
44
|
template <>
|
45
|
-
struct JSIConverter<ColorScheme> {
|
45
|
+
struct JSIConverter<ColorScheme> final {
|
46
46
|
static inline ColorScheme fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
47
47
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
48
48
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
@@ -44,7 +44,7 @@ namespace margelo::nitro {
|
|
44
44
|
|
45
45
|
// C++ Dimensions <> JS Dimensions (object)
|
46
46
|
template <>
|
47
|
-
struct JSIConverter<Dimensions> {
|
47
|
+
struct JSIConverter<Dimensions> final {
|
48
48
|
static inline Dimensions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
49
49
|
jsi::Object obj = arg.asObject(runtime);
|
50
50
|
return Dimensions(
|
@@ -40,7 +40,7 @@ namespace margelo::nitro::unistyles {
|
|
40
40
|
explicit HybridUnistylesNavigationBarSpec(): HybridObject(TAG) { }
|
41
41
|
|
42
42
|
// Destructor
|
43
|
-
|
43
|
+
~HybridUnistylesNavigationBarSpec() override = default;
|
44
44
|
|
45
45
|
public:
|
46
46
|
// Properties
|
@@ -40,7 +40,7 @@ namespace margelo::nitro::unistyles {
|
|
40
40
|
explicit HybridUnistylesShadowRegistrySpec(): HybridObject(TAG) { }
|
41
41
|
|
42
42
|
// Destructor
|
43
|
-
|
43
|
+
~HybridUnistylesShadowRegistrySpec() override = default;
|
44
44
|
|
45
45
|
public:
|
46
46
|
// Properties
|
@@ -47,7 +47,7 @@ namespace margelo::nitro {
|
|
47
47
|
|
48
48
|
// C++ Insets <> JS Insets (object)
|
49
49
|
template <>
|
50
|
-
struct JSIConverter<Insets> {
|
50
|
+
struct JSIConverter<Insets> final {
|
51
51
|
static inline Insets fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
52
52
|
jsi::Object obj = arg.asObject(runtime);
|
53
53
|
return Insets(
|
@@ -41,7 +41,7 @@ namespace margelo::nitro {
|
|
41
41
|
|
42
42
|
// C++ Orientation <> JS Orientation (union)
|
43
43
|
template <>
|
44
|
-
struct JSIConverter<Orientation> {
|
44
|
+
struct JSIConverter<Orientation> final {
|
45
45
|
static inline Orientation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
46
46
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
47
47
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
@@ -50,7 +50,7 @@ namespace margelo::nitro {
|
|
50
50
|
|
51
51
|
// C++ UnistyleDependency <> JS UnistyleDependency (enum)
|
52
52
|
template <>
|
53
|
-
struct JSIConverter<UnistyleDependency> {
|
53
|
+
struct JSIConverter<UnistyleDependency> final {
|
54
54
|
static inline UnistyleDependency fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
55
55
|
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
56
56
|
return static_cast<UnistyleDependency>(enumValue);
|
@@ -65,7 +65,7 @@ namespace margelo::nitro {
|
|
65
65
|
|
66
66
|
// C++ UnistylesCxxMiniRuntime <> JS UnistylesCxxMiniRuntime (object)
|
67
67
|
template <>
|
68
|
-
struct JSIConverter<UnistylesCxxMiniRuntime> {
|
68
|
+
struct JSIConverter<UnistylesCxxMiniRuntime> final {
|
69
69
|
static inline UnistylesCxxMiniRuntime fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
70
70
|
jsi::Object obj = arg.asObject(runtime);
|
71
71
|
return UnistylesCxxMiniRuntime(
|
@@ -61,7 +61,7 @@ namespace margelo::nitro {
|
|
61
61
|
|
62
62
|
// C++ UnistylesNativeMiniRuntime <> JS UnistylesNativeMiniRuntime (object)
|
63
63
|
template <>
|
64
|
-
struct JSIConverter<UnistylesNativeMiniRuntime> {
|
64
|
+
struct JSIConverter<UnistylesNativeMiniRuntime> final {
|
65
65
|
static inline UnistylesNativeMiniRuntime fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
66
66
|
jsi::Object obj = arg.asObject(runtime);
|
67
67
|
return UnistylesNativeMiniRuntime(
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-unistyles",
|
3
|
-
"version": "3.0.0-nightly-
|
3
|
+
"version": "3.0.0-nightly-20250210",
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
5
5
|
"scripts": {
|
6
6
|
"test": "jest",
|
@@ -98,11 +98,11 @@
|
|
98
98
|
"husky": "9.1.7",
|
99
99
|
"jest": "29.7.0",
|
100
100
|
"metro-react-native-babel-preset": "0.77.0",
|
101
|
-
"nitro-codegen": "0.
|
101
|
+
"nitro-codegen": "0.22.1",
|
102
102
|
"react": "18.3.1",
|
103
103
|
"react-native": "0.77.0",
|
104
104
|
"react-native-builder-bob": "0.33.1",
|
105
|
-
"react-native-nitro-modules": "0.
|
105
|
+
"react-native-nitro-modules": "0.22.1",
|
106
106
|
"react-native-web": "0.19.13",
|
107
107
|
"react-test-renderer": "18.3.1",
|
108
108
|
"release-it": "17.6.0",
|
package/plugin/index.js
CHANGED
@@ -159,7 +159,7 @@ module.exports = function ({ types: t }) {
|
|
159
159
|
if (detectedDependencies) {
|
160
160
|
if (t.isObjectExpression(arg)) {
|
161
161
|
arg.properties.forEach(property => {
|
162
|
-
if (detectedDependencies
|
162
|
+
if (detectedDependencies.hasOwnProperty(property.key.name)) {
|
163
163
|
addDependencies(t, state, property.key.name, property, detectedDependencies[property.key.name])
|
164
164
|
}
|
165
165
|
})
|
@@ -179,7 +179,7 @@ module.exports = function ({ types: t }) {
|
|
179
179
|
// Ensure the function body returns an object
|
180
180
|
if (t.isObjectExpression(body)) {
|
181
181
|
body.properties.forEach(property => {
|
182
|
-
if (detectedDependencies
|
182
|
+
if (detectedDependencies.hasOwnProperty(property.key.name)) {
|
183
183
|
addDependencies(t, state, property.key.name, property, detectedDependencies[property.key.name])
|
184
184
|
}
|
185
185
|
})
|
package/plugin/stylesheet.js
CHANGED
@@ -153,7 +153,7 @@ function getStylesDependenciesFromObject(t, path) {
|
|
153
153
|
...acc,
|
154
154
|
[key]: [label]
|
155
155
|
}
|
156
|
-
},
|
156
|
+
}, {})
|
157
157
|
}
|
158
158
|
|
159
159
|
function getStylesDependenciesFromFunction(t, path) {
|
@@ -415,7 +415,7 @@ function getStylesDependenciesFromFunction(t, path) {
|
|
415
415
|
...acc,
|
416
416
|
[key]: [label]
|
417
417
|
}
|
418
|
-
},
|
418
|
+
}, {})
|
419
419
|
}
|
420
420
|
|
421
421
|
function toUnistylesDependency(dependency) {
|
@@ -11,7 +11,7 @@ type PressableProps = Props & {
|
|
11
11
|
const getStyles = (styleProps: Record<string, any> = {}) => {
|
12
12
|
const unistyleKey = Object
|
13
13
|
.keys(styleProps)
|
14
|
-
.find(key => key.startsWith('
|
14
|
+
.find(key => key.startsWith('unistyles_'))
|
15
15
|
|
16
16
|
if (!unistyleKey) {
|
17
17
|
return styleProps
|
@@ -52,7 +52,7 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
|
|
52
52
|
? style.call(style, state)
|
53
53
|
: getStyles(style as unknown as Record<string, any>)
|
54
54
|
|
55
|
-
if (!storedRef.current
|
55
|
+
if (!storedRef.current) {
|
56
56
|
return unistyles
|
57
57
|
}
|
58
58
|
|
package/src/core/warn.ts
CHANGED
@@ -4,7 +4,7 @@ export const maybeWarnAboutMultipleUnistyles = (style: ViewStyle, displayName =
|
|
4
4
|
if (__DEV__ && style && !Array.isArray(style)) {
|
5
5
|
const unistylesKeys = Object
|
6
6
|
.keys(style)
|
7
|
-
.filter(key => key.startsWith('
|
7
|
+
.filter(key => key.startsWith('unistyles_'))
|
8
8
|
|
9
9
|
if (unistylesKeys.length > 1) {
|
10
10
|
console.warn(`Unistyles: we detected style object with ${unistylesKeys.length} unistyles styles. This might cause no updates or unpredictable behavior. Please check style prop for "${displayName}" and use array syntax instead of object syntax.`)
|
@@ -19,7 +19,7 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
19
19
|
const getSecrets = (styleProps: Record<string, any> = {}): { uni__getStyles(): any, uni__dependencies: Array<UnistyleDependency> } => {
|
20
20
|
const unistyleKey = Object
|
21
21
|
.keys(styleProps)
|
22
|
-
.find(key => key.startsWith('
|
22
|
+
.find(key => key.startsWith('unistyles_'))
|
23
23
|
|
24
24
|
return unistyleKey
|
25
25
|
? styleProps[unistyleKey]
|
@@ -37,7 +37,7 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
37
37
|
style: styleClassNames,
|
38
38
|
} : {},
|
39
39
|
...narrowedProps.contentContainerStyle ? {
|
40
|
-
|
40
|
+
contentContainerStyle: contentContainerStyleClassNames,
|
41
41
|
} : {},
|
42
42
|
} as any
|
43
43
|
|
package/src/web/convert/index.ts
CHANGED
@@ -17,7 +17,7 @@ export const convertUnistyles = (value: UnistylesValues) => {
|
|
17
17
|
...value._web
|
18
18
|
}).flatMap(([unistylesKey, unistylesValue]) => {
|
19
19
|
// Keys to omit
|
20
|
-
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'
|
20
|
+
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
|
21
21
|
return []
|
22
22
|
}
|
23
23
|
|
package/src/web/utils/common.ts
CHANGED
@@ -27,9 +27,9 @@ export const assignSecrets = <T>(object: T, secrets: UnistyleSecrets) => {
|
|
27
27
|
const secretsId = Math.random().toString(36).slice(8)
|
28
28
|
|
29
29
|
// @ts-expect-error assign hidden secrets
|
30
|
-
object[`
|
30
|
+
object[`unistyles_${secretsId}`] = {}
|
31
31
|
// @ts-expect-error assign hidden secrets
|
32
|
-
Object.defineProperties(object[`
|
32
|
+
Object.defineProperties(object[`unistyles_${secretsId}`], reduceObject(secrets, secret => ({
|
33
33
|
value: secret,
|
34
34
|
enumerable: false,
|
35
35
|
configurable: true
|
@@ -43,7 +43,7 @@ export const extractSecrets = (object: any) => {
|
|
43
43
|
return undefined
|
44
44
|
}
|
45
45
|
|
46
|
-
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('
|
46
|
+
const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles_')) ?? []
|
47
47
|
|
48
48
|
if (!secrets) {
|
49
49
|
return undefined
|