react-native-unistyles 2.5.4 → 2.5.5
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/cxx/cpp-adapter.cpp +20 -0
- package/android/src/main/java/com/unistyles/Platform.kt +3 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +29 -0
- package/cxx/UnistylesRuntime.cpp +28 -0
- package/cxx/UnistylesRuntime.h +18 -7
- package/lib/commonjs/core/UnistylesModule.js +7 -2
- package/lib/commonjs/core/UnistylesModule.js.map +1 -1
- package/lib/commonjs/core/UnistylesRuntime.js +12 -4
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js +4 -2
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js.map +1 -1
- package/lib/module/core/UnistylesModule.js +7 -2
- package/lib/module/core/UnistylesModule.js.map +1 -1
- package/lib/module/core/UnistylesRuntime.js +12 -4
- package/lib/module/core/UnistylesRuntime.js.map +1 -1
- package/lib/module/core/mocks/UnistylesMockedRuntime.js +4 -2
- package/lib/module/core/mocks/UnistylesMockedRuntime.js.map +1 -1
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +12 -4
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts +2 -0
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts.map +1 -1
- package/lib/typescript/src/types/unistyles.d.ts +8 -2
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/UnistylesModule.ts +11 -6
- package/src/core/UnistylesRuntime.ts +12 -4
- package/src/core/mocks/UnistylesMockedRuntime.ts +4 -2
- package/src/types/unistyles.ts +10 -2
@@ -99,6 +99,26 @@ Java_com_unistyles_UnistylesModule_nativeInstall(
|
|
99
99
|
env->DeleteLocalRef(cls);
|
100
100
|
});
|
101
101
|
|
102
|
+
unistylesRuntime->onSetNavigationBarColor([=](const std::string &color) {
|
103
|
+
jstring colorStr = env->NewStringUTF(color.c_str());
|
104
|
+
jclass cls = env->GetObjectClass(unistylesModule);
|
105
|
+
jmethodID methodId = env->GetMethodID(cls, "onSetNavigationBarColor", "(Ljava/lang/String;)V");
|
106
|
+
|
107
|
+
env->CallVoidMethod(unistylesModule, methodId, colorStr);
|
108
|
+
env->DeleteLocalRef(colorStr);
|
109
|
+
env->DeleteLocalRef(cls);
|
110
|
+
});
|
111
|
+
|
112
|
+
unistylesRuntime->onSetStatusBarColor([=](const std::string &color) {
|
113
|
+
jstring colorStr = env->NewStringUTF(color.c_str());
|
114
|
+
jclass cls = env->GetObjectClass(unistylesModule);
|
115
|
+
jmethodID methodId = env->GetMethodID(cls, "onSetStatusBarColor", "(Ljava/lang/String;)V");
|
116
|
+
|
117
|
+
env->CallVoidMethod(unistylesModule, methodId, colorStr);
|
118
|
+
env->DeleteLocalRef(colorStr);
|
119
|
+
env->DeleteLocalRef(cls);
|
120
|
+
});
|
121
|
+
|
102
122
|
jsi::Object hostObject = jsi::Object::createFromHostObject(*runtime, unistylesRuntime);
|
103
123
|
|
104
124
|
runtime->global().setProperty(*runtime, "__UNISTYLES__", std::move(hostObject));
|
@@ -5,6 +5,9 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
5
5
|
class Platform(reactApplicationContext: ReactApplicationContext) {
|
6
6
|
private val config: UnistylesConfig = UnistylesConfig(reactApplicationContext)
|
7
7
|
|
8
|
+
var defaultNavigationBarColor: Int? = null
|
9
|
+
var defaultStatusBarColor: Int? = null
|
10
|
+
|
8
11
|
fun hasNewLayoutConfig(): Boolean {
|
9
12
|
return this.config.hasNewLayoutConfig()
|
10
13
|
}
|
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
|
|
4
4
|
import android.content.Context
|
5
5
|
import android.content.Intent
|
6
6
|
import android.content.IntentFilter
|
7
|
+
import android.graphics.Color
|
7
8
|
import android.os.Handler
|
8
9
|
import android.os.Looper
|
9
10
|
import android.util.Log
|
@@ -235,6 +236,34 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
235
236
|
.emit("__unistylesOnChange", body)
|
236
237
|
}
|
237
238
|
|
239
|
+
private fun onSetNavigationBarColor(color: String) {
|
240
|
+
val activity = currentActivity ?: return
|
241
|
+
|
242
|
+
if (platform.defaultNavigationBarColor == null) {
|
243
|
+
platform.defaultNavigationBarColor = activity.window.navigationBarColor
|
244
|
+
}
|
245
|
+
|
246
|
+
try {
|
247
|
+
activity.window.navigationBarColor = if (color == "") platform.defaultNavigationBarColor!! else Color.parseColor(color)
|
248
|
+
} catch (_: Exception) {
|
249
|
+
Log.d("Unistyles", "Failed to set navigation bar color: $color")
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
private fun onSetStatusBarColor(color: String) {
|
254
|
+
val activity = currentActivity ?: return
|
255
|
+
|
256
|
+
if (platform.defaultStatusBarColor == null) {
|
257
|
+
platform.defaultStatusBarColor = activity.window.statusBarColor
|
258
|
+
}
|
259
|
+
|
260
|
+
try {
|
261
|
+
activity.window.statusBarColor = if (color == "") platform.defaultStatusBarColor!! else Color.parseColor(color)
|
262
|
+
} catch (_: Exception) {
|
263
|
+
Log.d("Unistyles", "Failed to set status bar color: $color")
|
264
|
+
}
|
265
|
+
}
|
266
|
+
|
238
267
|
@ReactMethod
|
239
268
|
fun addListener(eventName: String?) = Unit
|
240
269
|
|
package/cxx/UnistylesRuntime.cpp
CHANGED
@@ -250,18 +250,46 @@ jsi::Value UnistylesRuntime::get(jsi::Runtime& runtime, const jsi::PropNameID& p
|
|
250
250
|
|
251
251
|
if (propName == "statusBar") {
|
252
252
|
auto statusBar = jsi::Object(runtime);
|
253
|
+
auto setStatusBarColorFunction = jsi::Function::createFromHostFunction(runtime,
|
254
|
+
jsi::PropNameID::forAscii(runtime, "setColor"),
|
255
|
+
1,
|
256
|
+
[this](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) -> jsi::Value {
|
257
|
+
std::string color = arguments[0].asString(runtime).utf8(runtime);
|
258
|
+
|
259
|
+
if (this->onSetStatusBarColorCallback.has_value()) {
|
260
|
+
this->onSetStatusBarColorCallback.value()(color);
|
261
|
+
}
|
262
|
+
|
263
|
+
return jsi::Value::undefined();
|
264
|
+
}
|
265
|
+
);
|
253
266
|
|
254
267
|
statusBar.setProperty(runtime, "width", this->statusBar.width);
|
255
268
|
statusBar.setProperty(runtime, "height", this->statusBar.height);
|
269
|
+
statusBar.setProperty(runtime, "setColor", setStatusBarColorFunction);
|
256
270
|
|
257
271
|
return statusBar;
|
258
272
|
}
|
259
273
|
|
260
274
|
if (propName == "navigationBar") {
|
261
275
|
auto navigationBarValue = jsi::Object(runtime);
|
276
|
+
auto setNavigationBarColorFunction = jsi::Function::createFromHostFunction(runtime,
|
277
|
+
jsi::PropNameID::forAscii(runtime, "setColor"),
|
278
|
+
1,
|
279
|
+
[this](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) -> jsi::Value {
|
280
|
+
std::string color = arguments[0].asString(runtime).utf8(runtime);
|
281
|
+
|
282
|
+
if (this->onSetStatusBarColorCallback.has_value()) {
|
283
|
+
this->onSetNavigationBarColorCallback.value()(color);
|
284
|
+
}
|
285
|
+
|
286
|
+
return jsi::Value::undefined();
|
287
|
+
}
|
288
|
+
);
|
262
289
|
|
263
290
|
navigationBarValue.setProperty(runtime, "width", this->navigationBar.width);
|
264
291
|
navigationBarValue.setProperty(runtime, "height", this->navigationBar.height);
|
292
|
+
navigationBarValue.setProperty(runtime, "setColor", setNavigationBarColorFunction);
|
265
293
|
|
266
294
|
return navigationBarValue;
|
267
295
|
}
|
package/cxx/UnistylesRuntime.h
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#include <jsi/jsi.h>
|
4
4
|
#include <vector>
|
5
5
|
#include <map>
|
6
|
+
#include <optional>
|
6
7
|
|
7
8
|
using namespace facebook;
|
8
9
|
|
@@ -35,14 +36,16 @@ private:
|
|
35
36
|
std::function<void(std::string breakpoint, std::string orientation, Dimensions& screen, Dimensions& statusBar, Insets& insets, Dimensions& navigationBar)> onLayoutChangeCallback;
|
36
37
|
std::function<void(std::string)> onContentSizeCategoryChangeCallback;
|
37
38
|
std::function<void()> onPluginChangeCallback;
|
38
|
-
|
39
|
+
std::optional<std::function<void(std::string)>> onSetStatusBarColorCallback;
|
40
|
+
std::optional<std::function<void(std::string)>> onSetNavigationBarColorCallback;
|
41
|
+
|
39
42
|
Dimensions screen;
|
40
43
|
Dimensions statusBar;
|
41
44
|
Dimensions navigationBar;
|
42
45
|
Insets insets;
|
43
46
|
std::string colorScheme;
|
44
47
|
std::string contentSizeCategory;
|
45
|
-
|
48
|
+
|
46
49
|
public:
|
47
50
|
UnistylesRuntime(
|
48
51
|
Dimensions screen,
|
@@ -60,28 +63,36 @@ public:
|
|
60
63
|
|
61
64
|
bool hasAdaptiveThemes;
|
62
65
|
bool supportsAutomaticColorScheme;
|
63
|
-
|
66
|
+
|
64
67
|
std::string themeName;
|
65
68
|
std::string breakpoint;
|
66
69
|
std::vector<std::string> pluginNames;
|
67
70
|
std::vector<std::string> themes;
|
68
71
|
std::vector<std::pair<std::string, double>> sortedBreakpointPairs;
|
69
|
-
|
72
|
+
|
70
73
|
void onThemeChange(std::function<void(std::string)> callback) {
|
71
74
|
this->onThemeChangeCallback = callback;
|
72
75
|
}
|
73
|
-
|
76
|
+
|
74
77
|
void onLayoutChange(std::function<void(std::string breakpoint, std::string orientation, Dimensions& screen, Dimensions& statusBar, Insets& insets, Dimensions& navigationBar)> callback) {
|
75
78
|
this->onLayoutChangeCallback = callback;
|
76
79
|
}
|
77
|
-
|
80
|
+
|
78
81
|
void onPluginChange(std::function<void()> callback) {
|
79
82
|
this->onPluginChangeCallback = callback;
|
80
83
|
}
|
81
|
-
|
84
|
+
|
82
85
|
void onContentSizeCategoryChange(std::function<void(std::string)> callback) {
|
83
86
|
this->onContentSizeCategoryChangeCallback = callback;
|
84
87
|
}
|
88
|
+
|
89
|
+
void onSetStatusBarColor(std::function<void(std::string color)> callback) {
|
90
|
+
this->onSetStatusBarColorCallback = callback;
|
91
|
+
}
|
92
|
+
|
93
|
+
void onSetNavigationBarColor(std::function<void(std::string color)> callback) {
|
94
|
+
this->onSetNavigationBarColorCallback = callback;
|
95
|
+
}
|
85
96
|
|
86
97
|
jsi::Value get(jsi::Runtime&, const jsi::PropNameID& name) override;
|
87
98
|
void set(jsi::Runtime& runtime, const jsi::PropNameID& propNameId, const jsi::Value& value) override;
|
@@ -30,11 +30,13 @@ class UnistylesBridgeWeb {
|
|
30
30
|
};
|
31
31
|
#statusBar = {
|
32
32
|
height: 0,
|
33
|
-
width: 0
|
33
|
+
width: 0,
|
34
|
+
setColor: () => {}
|
34
35
|
};
|
35
36
|
#navigationBar = {
|
36
37
|
height: 0,
|
37
|
-
width: 0
|
38
|
+
width: 0,
|
39
|
+
setColor: () => {}
|
38
40
|
};
|
39
41
|
constructor() {
|
40
42
|
if (!_common.isServer) {
|
@@ -117,6 +119,9 @@ class UnistylesBridgeWeb {
|
|
117
119
|
this.emitThemeChange();
|
118
120
|
}
|
119
121
|
updateTheme(themeName) {
|
122
|
+
if (!this.#themeName) {
|
123
|
+
this.#themeName = this.getTheme();
|
124
|
+
}
|
120
125
|
if (this.#themeName === themeName) {
|
121
126
|
this.emitThemeChange();
|
122
127
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","isServer","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","navigationBar","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","emitLayoutChange","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","exports","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAMG,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGC,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGH,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAACC,iCAAwB,CAACC,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAC5C,CAACC,mBAAmB,GAAW,aAAa;EAC5C,CAACC,MAAM,GAAiB;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE;EACV,CAAC;EACD,CAACC,SAAS,
|
1
|
+
{"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","isServer","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","setColor","navigationBar","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","emitLayoutChange","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","exports","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAMG,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGC,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGH,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB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@ -91,18 +91,26 @@ class UnistylesRuntime {
|
|
91
91
|
|
92
92
|
/**
|
93
93
|
* Get the status bar info
|
94
|
-
* @returns - The status bar
|
94
|
+
* @returns - The status bar api { width, height, setColor }
|
95
95
|
*/
|
96
96
|
get statusBar() {
|
97
|
-
return
|
97
|
+
return {
|
98
|
+
width: this.unistylesBridge.statusBar.width,
|
99
|
+
height: this.unistylesBridge.statusBar.height,
|
100
|
+
setColor: color => this.unistylesBridge.statusBar.setColor(color ?? '')
|
101
|
+
};
|
98
102
|
}
|
99
103
|
|
100
104
|
/**
|
101
105
|
* Get the navigation bar info (Android)
|
102
|
-
* @returns - The navigation bar
|
106
|
+
* @returns - The navigation bar api { width, height, setColor }
|
103
107
|
*/
|
104
108
|
get navigationBar() {
|
105
|
-
return
|
109
|
+
return {
|
110
|
+
width: this.unistylesBridge.navigationBar.width,
|
111
|
+
height: this.unistylesBridge.navigationBar.height,
|
112
|
+
setColor: color => this.unistylesBridge.navigationBar.setColor(color ?? '')
|
113
|
+
};
|
106
114
|
}
|
107
115
|
|
108
116
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","contentSizeCategory","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","insets","statusBar","navigationBar","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKA;AACA;AACA;AACO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;;EAEpG;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,IAAI,CAACL,eAAe,CAACK,mBAAmB;EACnD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACN,eAAe,CAACM,UAAU;EAC1C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACN,iBAAiB,CAACM,WAAW;EAC7C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACR,eAAe,CAACQ,cAAc;EAC9C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACV,eAAe,CAACW,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACZ,eAAe,CAACa;IACjC,CAAC;EACL;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACd,eAAe,CAACc,MAAM;EACtC;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,
|
1
|
+
{"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","contentSizeCategory","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","insets","statusBar","setColor","color","navigationBar","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKA;AACA;AACA;AACO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;;EAEpG;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,IAAI,CAACL,eAAe,CAACK,mBAAmB;EACnD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACN,eAAe,CAACM,UAAU;EAC1C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACN,iBAAiB,CAACM,WAAW;EAC7C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACR,eAAe,CAACQ,cAAc;EAC9C;;EAEA;AACJ;AACA;AACA;EACI,IAAW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;IAEA,IAAI,IAAI,CAACH,iBAAiB,CAACwB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAACxB,eAAe,CAAC0B,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;EACtD,CAAC;;EAED;AACJ;AACA;AACA;AACA;AACA;EACWC,WAAW,GAAGA,CAACN,IAA2B,EAAEO,OAAkG,KAAK;IACtJ,IAAI,CAAC9B,iBAAiB,CAAC6B,WAAW,CAACN,IAAI,EAAEO,OAAO,CAAC,IAAI,CAAC9B,iBAAiB,CAAC+B,QAAQ,CAACR,IAAI,CAAC,CAAC,CAAC;EAC5F,CAAC;;EAED;AACJ;AACA;AACA;EACWS,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAClC,eAAe,CAACmC,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;;EAED;AACJ;AACA;AACA;EACWE,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAACpC,iBAAiB,CAACmC,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAACpC,iBAAiB,CAACqC,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAAzC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -55,13 +55,15 @@ class UnistylesMockedRuntime {
|
|
55
55
|
get statusBar() {
|
56
56
|
return {
|
57
57
|
height: 24,
|
58
|
-
width: 800
|
58
|
+
width: 800,
|
59
|
+
setColor: () => {}
|
59
60
|
};
|
60
61
|
}
|
61
62
|
get navigationBar() {
|
62
63
|
return {
|
63
64
|
height: 0,
|
64
|
-
width: 0
|
65
|
+
width: 0,
|
66
|
+
setColor: () => {}
|
65
67
|
};
|
66
68
|
}
|
67
69
|
get orientation() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","contentSizeCategory","breakpoint","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","screen","width","height","insets","top","right","bottom","left","statusBar","navigationBar","orientation","ScreenOrientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRuntime.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AADA;;AAOO,MAAMC,sBAAsB,CAAC;EAGhCC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;IAC7F,IAAI,CAACA,iBAAiB,GAAGA,iBAAuD;EACpF;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,MAAM;EACjB;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI;EACf;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACH,iBAAiB,CAACI,UAAU,CAACC,MAAM,GAAG,CAAC,GAC7C,IAAI,CAACL,iBAAiB,CAACI,UAAU,CAACE,EAAE,CAAC,CAAC,CAAC,GACvCC,SAAS;EACnB;EAEA,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,aAAa;EACxB;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,IAAI,IAAI,CAACT,iBAAiB,CAACU,qBAAqB,CAACL,MAAM,KAAK,CAAC,EAAE;MAC3D,OAAOE,SAAS;IACpB;IAEA,MAAMI,eAAe,GAAG,IAAI,CAACX,iBAAiB,CAACU,qBAAqB,CAACJ,EAAE,CAAC,CAAC,CAAC;IAE1E,OAAOK,eAAe,GAChBA,eAAe,CAACL,EAAE,CAAC,CAAC,CAAC,GACrBC,SAAS;EACnB;EAEA,IAAWK,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACZ,iBAAiB,CAACY,WAAW;EAC7C;EAEA,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACb,iBAAiB,CAACc,OAAO;EACzC;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;EACL;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,GAAG,EAAE,CAAC;MACNC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CAAC;MACTC,IAAI,EAAE;IACV,CAAC;EACL;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO;MACHN,MAAM,EAAE,EAAE;MACVD,KAAK,EAAE;
|
1
|
+
{"version":3,"names":["_common","require","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","contentSizeCategory","breakpoint","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","screen","width","height","insets","top","right","bottom","left","statusBar","setColor","navigationBar","orientation","ScreenOrientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRuntime.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AADA;;AAOO,MAAMC,sBAAsB,CAAC;EAGhCC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;IAC7F,IAAI,CAACA,iBAAiB,GAAGA,iBAAuD;EACpF;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,MAAM;EACjB;EAEA,I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MAAM,EAAE,CAAC;MACTD,KAAK,EAAE,CAAC;MACRQ,QAAQ,EAAEA,CAAA,KAAM,CAAC;IACrB,CAAC;EACL;EAEA,IAAWE,WAAWA,CAAA,EAAG;IACrB,OAAOC,yBAAiB,CAACC,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK,IAAI;EAChDC,WAAW,GAAGA,CAACD,IAA2B,EAAEE,KAA6C,KAAK,CAAC,CAAC;EAChGC,iBAAiB,GAAIC,OAAgB,IAAK,CAAC,CAAC;EAC5CC,SAAS,GAAIC,MAAuB,IAAK,CAAC,CAAC;EAC3CC,YAAY,GAAID,MAAuB,IAAK,CAAC,CAAC;AACzD;AAACE,OAAA,CAAAzC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -24,11 +24,13 @@ export class UnistylesBridgeWeb {
|
|
24
24
|
};
|
25
25
|
#statusBar = {
|
26
26
|
height: 0,
|
27
|
-
width: 0
|
27
|
+
width: 0,
|
28
|
+
setColor: () => {}
|
28
29
|
};
|
29
30
|
#navigationBar = {
|
30
31
|
height: 0,
|
31
|
-
width: 0
|
32
|
+
width: 0,
|
33
|
+
setColor: () => {}
|
32
34
|
};
|
33
35
|
constructor() {
|
34
36
|
if (!isServer) {
|
@@ -111,6 +113,9 @@ export class UnistylesBridgeWeb {
|
|
111
113
|
this.emitThemeChange();
|
112
114
|
}
|
113
115
|
updateTheme(themeName) {
|
116
|
+
if (!this.#themeName) {
|
117
|
+
this.#themeName = this.getTheme();
|
118
|
+
}
|
114
119
|
if (this.#themeName === themeName) {
|
115
120
|
this.emitThemeChange();
|
116
121
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","isServer","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","name","unistylesEvents","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","navigationBar","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","emitLayoutChange","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAGhE,SAASC,wBAAwB,QAAQ,YAAY;AACrD,SAASC,QAAQ,QAAQ,WAAW;AAEpC,OAAO,MAAMC,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGN,QAAQ,GAAGG,SAAS,GAAGI,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGT,QAAQ,GAAGG,SAAS,GAAGI,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAACjB,wBAAwB,CAACkB,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIrB,kBAAkB,CAACC,aAAa,CAACqB,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAC5C,CAACC,mBAAmB,GAAW,aAAa;EAC5C,CAACC,MAAM,GAAiB;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE;EACV,CAAC;EACD,CAACC,SAAS,
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","isServer","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","name","unistylesEvents","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","setColor","navigationBar","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","emitLayoutChange","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAGhE,SAASC,wBAAwB,QAAQ,YAAY;AACrD,SAASC,QAAQ,QAAQ,WAAW;AAEpC,OAAO,MAAMC,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGN,QAAQ,GAAGG,SAAS,GAAGI,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGT,QAAQ,GAAGG,SAAS,GAAGI,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAA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eAAe,GAAG,IAAIvF,kBAAkB,CAAC,CAAC","ignoreList":[]}
|
@@ -85,18 +85,26 @@ export class UnistylesRuntime {
|
|
85
85
|
|
86
86
|
/**
|
87
87
|
* Get the status bar info
|
88
|
-
* @returns - The status bar
|
88
|
+
* @returns - The status bar api { width, height, setColor }
|
89
89
|
*/
|
90
90
|
get statusBar() {
|
91
|
-
return
|
91
|
+
return {
|
92
|
+
width: this.unistylesBridge.statusBar.width,
|
93
|
+
height: this.unistylesBridge.statusBar.height,
|
94
|
+
setColor: color => this.unistylesBridge.statusBar.setColor(color ?? '')
|
95
|
+
};
|
92
96
|
}
|
93
97
|
|
94
98
|
/**
|
95
99
|
* Get the navigation bar info (Android)
|
96
|
-
* @returns - The navigation bar
|
100
|
+
* @returns - The navigation bar api { width, height, setColor }
|
97
101
|
*/
|
98
102
|
get navigationBar() {
|
99
|
-
return
|
103
|
+
return {
|
104
|
+
width: this.unistylesBridge.navigationBar.width,
|
105
|
+
height: this.unistylesBridge.navigationBar.height,
|
106
|
+
setColor: color => this.unistylesBridge.navigationBar.setColor(color ?? '')
|
107
|
+
};
|
100
108
|
}
|
101
109
|
|
102
110
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","contentSizeCategory","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","insets","statusBar","navigationBar","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":"AAAA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;AAK7D;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;;EAEpG;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,IAAI,CAACL,eAAe,CAACK,mBAAmB;EACnD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACN,eAAe,CAACM,UAAU;EAC1C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACN,iBAAiB,CAACM,WAAW;EAC7C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACR,eAAe,CAACQ,cAAc;EAC9C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACV,eAAe,CAACW,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACZ,eAAe,CAACa;IACjC,CAAC;EACL;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACd,eAAe,CAACc,MAAM;EACtC;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","contentSizeCategory","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","insets","statusBar","setColor","color","navigationBar","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":"AAAA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;AAK7D;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;;EAEpG;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,IAAI,CAACL,eAAe,CAACK,mBAAmB;EACnD;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACN,eAAe,CAACM,UAAU;EAC1C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACN,iBAAiB,CAACM,WAAW;EAC7C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,I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AA2B,IAAK;IAC/C,IAAIA,IAAI,KAAK,IAAI,CAACnB,SAAS,EAAE;MACzB;IACJ;IAEA,IAAI,IAAI,CAACH,iBAAiB,CAACuB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAACvB,eAAe,CAACyB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAAC7B,cAAc,CAAC8B,kBAAkB,CAAC;EACtD,CAAC;;EAED;AACJ;AACA;AACA;AACA;AACA;EACWC,WAAW,GAAGA,CAACL,IAA2B,EAAEM,OAAkG,KAAK;IACtJ,IAAI,CAAC5B,iBAAiB,CAAC2B,WAAW,CAACL,IAAI,EAAEM,OAAO,CAAC,IAAI,CAAC5B,iBAAiB,CAAC6B,QAAQ,CAACP,IAAI,CAAC,CAAC,CAAC;EAC5F,CAAC;;EAED;AACJ;AACA;AACA;EACWQ,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAChC,eAAe,CAACiC,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;;EAED;AACJ;AACA;AACA;EACWE,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAAClC,iBAAiB,CAACiC,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAClC,iBAAiB,CAACmC,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL","ignoreList":[]}
|
@@ -48,13 +48,15 @@ export class UnistylesMockedRuntime {
|
|
48
48
|
get statusBar() {
|
49
49
|
return {
|
50
50
|
height: 24,
|
51
|
-
width: 800
|
51
|
+
width: 800,
|
52
|
+
setColor: () => {}
|
52
53
|
};
|
53
54
|
}
|
54
55
|
get navigationBar() {
|
55
56
|
return {
|
56
57
|
height: 0,
|
57
|
-
width: 0
|
58
|
+
width: 0,
|
59
|
+
setColor: () => {}
|
58
60
|
};
|
59
61
|
}
|
60
62
|
get orientation() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","contentSizeCategory","breakpoint","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","screen","width","height","insets","top","right","bottom","left","statusBar","navigationBar","orientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRuntime.ts"],"mappings":"AAAA;AACA,SAASA,iBAAiB,QAAQ,cAAc;AAMhD,OAAO,MAAMC,sBAAsB,CAAC;EAGhCC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;IAC7F,IAAI,CAACA,iBAAiB,GAAGA,iBAAuD;EACpF;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,MAAM;EACjB;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI;EACf;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACH,iBAAiB,CAACI,UAAU,CAACC,MAAM,GAAG,CAAC,GAC7C,IAAI,CAACL,iBAAiB,CAACI,UAAU,CAACE,EAAE,CAAC,CAAC,CAAC,GACvCC,SAAS;EACnB;EAEA,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,aAAa;EACxB;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,IAAI,IAAI,CAACT,iBAAiB,CAACU,qBAAqB,CAACL,MAAM,KAAK,CAAC,EAAE;MAC3D,OAAOE,SAAS;IACpB;IAEA,MAAMI,eAAe,GAAG,IAAI,CAACX,iBAAiB,CAACU,qBAAqB,CAACJ,EAAE,CAAC,CAAC,CAAC;IAE1E,OAAOK,eAAe,GAChBA,eAAe,CAACL,EAAE,CAAC,CAAC,CAAC,GACrBC,SAAS;EACnB;EAEA,IAAWK,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACZ,iBAAiB,CAACY,WAAW;EAC7C;EAEA,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACb,iBAAiB,CAACc,OAAO;EACzC;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;EACL;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,GAAG,EAAE,CAAC;MACNC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CAAC;MACTC,IAAI,EAAE;IACV,CAAC;EACL;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO;MACHN,MAAM,EAAE,EAAE;MACVD,KAAK,EAAE;
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","contentSizeCategory","breakpoint","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","screen","width","height","insets","top","right","bottom","left","statusBar","setColor","navigationBar","orientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRuntime.ts"],"mappings":"AAAA;AACA,SAASA,iBAAiB,QAAQ,cAAc;AAMhD,OAAO,MAAMC,sBAAsB,CAAC;EAGhCC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;IAC7F,IAAI,CAACA,iBAAiB,GAAGA,iBAAuD;EACpF;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAA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AG;IACvB,OAAO;MACHR,MAAM,EAAE,CAAC;MACTD,KAAK,EAAE,CAAC;MACRQ,QAAQ,EAAEA,CAAA,KAAM,CAAC;IACrB,CAAC;EACL;EAEA,IAAWE,WAAWA,CAAA,EAAG;IACrB,OAAO9B,iBAAiB,CAAC+B,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK,IAAI;EAChDC,WAAW,GAAGA,CAACD,IAA2B,EAAEE,KAA6C,KAAK,CAAC,CAAC;EAChGC,iBAAiB,GAAIC,OAAgB,IAAK,CAAC,CAAC;EAC5CC,SAAS,GAAIC,MAAuB,IAAK,CAAC,CAAC;EAC3CC,YAAY,GAAID,MAAuB,IAAK,CAAC,CAAC;AACzD","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAMA,qBAAa,kBAAkB;;;
|
1
|
+
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAMA,qBAAa,kBAAkB;;;IAwCpB,OAAO;IAuEd,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;CAe3B;AAED,eAAO,MAAM,eAAe,oBAA2B,CAAA"}
|
@@ -58,14 +58,22 @@ export declare class UnistylesRuntime {
|
|
58
58
|
get insets(): import("../types").ScreenInsets;
|
59
59
|
/**
|
60
60
|
* Get the status bar info
|
61
|
-
* @returns - The status bar
|
61
|
+
* @returns - The status bar api { width, height, setColor }
|
62
62
|
*/
|
63
|
-
get statusBar():
|
63
|
+
get statusBar(): {
|
64
|
+
width: number;
|
65
|
+
height: number;
|
66
|
+
setColor: (color?: string) => void;
|
67
|
+
};
|
64
68
|
/**
|
65
69
|
* Get the navigation bar info (Android)
|
66
|
-
* @returns - The navigation bar
|
70
|
+
* @returns - The navigation bar api { width, height, setColor }
|
67
71
|
*/
|
68
|
-
get navigationBar():
|
72
|
+
get navigationBar(): {
|
73
|
+
width: number;
|
74
|
+
height: number;
|
75
|
+
setColor: (color?: string) => void;
|
76
|
+
};
|
69
77
|
/**
|
70
78
|
* Get the screen orientation
|
71
79
|
* @returns - The screen orientation
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,iBAAiB,YAE3B;IAED;;;OAGG;IACH,IAAW,SAAS,UAEnB;IAED;;;OAGG;IACH,IAAW,mBAAmB,gGAE7B;IAED;;;OAGG;IACH,IAAW,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,MAAM,oCAEhB;IAED;;;OAGG;IACH,IAAW,SAAS,
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,iBAAiB,YAE3B;IAED;;;OAGG;IACH,IAAW,SAAS,UAEnB;IAED;;;OAGG;IACH,IAAW,mBAAmB,gGAE7B;IAED;;;OAGG;IACH,IAAW,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,MAAM,oCAEhB;IAED;;;OAGG;IACH,IAAW,SAAS;;;2BAIO,MAAM;MAEhC;IAED;;;OAGG;IACH,IAAW,aAAa;;;2BAIG,MAAM;MAEhC;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;;OAIG;IACI,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAED;;;;;OAKG;IACI,WAAW,SAAU,MAAM,eAAe,mBAAmB,eAAe,CAAC,MAAM,eAAe,CAAC,KAAK,eAAe,CAAC,MAAM,eAAe,CAAC,UAEpJ;IAED;;;OAGG;IACI,iBAAiB,WAAY,OAAO,UAE1C;IAED;;;OAGG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;OAGG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
@@ -26,10 +26,12 @@ export declare class UnistylesMockedRuntime {
|
|
26
26
|
get statusBar(): {
|
27
27
|
height: number;
|
28
28
|
width: number;
|
29
|
+
setColor: () => void;
|
29
30
|
};
|
30
31
|
get navigationBar(): {
|
31
32
|
height: number;
|
32
33
|
width: number;
|
34
|
+
setColor: () => void;
|
33
35
|
};
|
34
36
|
get orientation(): "portrait";
|
35
37
|
setTheme: (name: keyof UnistylesThemes) => boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesMockedRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,qBAAa,sBAAsB;IAGnB,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;IAF/E,OAAO,CAAC,iBAAiB,CAAyB;gBAE9B,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAIjG,IAAW,WAAW,WAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,cAInB;IAED,IAAW,mBAAmB,WAE7B;IAED,IAAW,UAAU,2EAUpB;IAED,IAAW,WAAW,gDAErB;IAED,IAAW,cAAc,sBAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,MAAM;;;;;MAOhB;IAED,IAAW,SAAS
|
1
|
+
{"version":3,"file":"UnistylesMockedRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,qBAAa,sBAAsB;IAGnB,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;IAF/E,OAAO,CAAC,iBAAiB,CAAyB;gBAE9B,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAIjG,IAAW,WAAW,WAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,cAInB;IAED,IAAW,mBAAmB,WAE7B;IAED,IAAW,UAAU,2EAUpB;IAED,IAAW,WAAW,gDAErB;IAED,IAAW,cAAc,sBAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,MAAM;;;;;MAOhB;IAED,IAAW,SAAS;;;;MAMnB;IAED,IAAW,aAAa;;;;MAMvB;IAED,IAAW,WAAW,eAErB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAS;IAChD,WAAW,SAAU,MAAM,eAAe,SAAS,eAAe,CAAC,MAAM,eAAe,CAAC,UAAO;IAChG,iBAAiB,YAAa,OAAO,UAAO;IAC5C,SAAS,WAAY,eAAe,UAAO;IAC3C,YAAY,WAAY,eAAe,UAAO;CACxD"}
|
@@ -13,6 +13,12 @@ export type ScreenDimensions = {
|
|
13
13
|
height: number;
|
14
14
|
width: number;
|
15
15
|
};
|
16
|
+
export interface StatusBar extends ScreenDimensions {
|
17
|
+
setColor(color?: string): void;
|
18
|
+
}
|
19
|
+
export interface NavigationBar extends ScreenDimensions {
|
20
|
+
setColor(color?: string): void;
|
21
|
+
}
|
16
22
|
export type UnistylesConfig = {
|
17
23
|
adaptiveThemes?: boolean;
|
18
24
|
initialTheme?: keyof UnistylesThemes;
|
@@ -30,8 +36,8 @@ export type UnistylesBridge = {
|
|
30
36
|
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory;
|
31
37
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
32
38
|
insets: ScreenInsets;
|
33
|
-
statusBar:
|
34
|
-
navigationBar:
|
39
|
+
statusBar: StatusBar;
|
40
|
+
navigationBar: NavigationBar;
|
35
41
|
themes: Array<keyof UnistylesThemes>;
|
36
42
|
useBreakpoints(breakpoints: UnistylesBreakpoints): void;
|
37
43
|
useTheme(name: keyof UnistylesThemes): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,eAAe,CAAC;IACrC,OAAO,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACjC,2BAA2B,CAAC,EAAE,OAAO,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAE1B,WAAW,EAAE,MAAM,CAAC;I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AU,EAAE,MAAM,GAAG,IAAI,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC;IAC/B,OAAO,EAAE;QACL,SAAS,EAAE,MAAM,eAAe,CAAA;KACnC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,SAAS,EAAE,gBAAgB,CAAC;QAC5B,aAAa,EAAE,gBAAgB,CAAC;QAChC,MAAM,EAAE,YAAY,CAAC;QACrB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;KACxE,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC,IAAI,EAAE,kBAAkB,CAAC,eAAe,CAAC;IACzC,OAAO,EAAE;QACL,mBAAmB,EAAE,sBAAsB,GAAG,0BAA0B,CAAA;KAC3E,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,oBAAoB,GAAG,6BAA6B,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { NativeEventEmitter, NativeModules } from 'react-native'
|
2
2
|
import type { UnistylesThemes, UnistylesBreakpoints } from 'react-native-unistyles'
|
3
|
-
import type { ColorSchemeName, ScreenInsets,
|
3
|
+
import type { ColorSchemeName, ScreenInsets, StatusBar, NavigationBar } from '../types'
|
4
4
|
import { normalizeWebStylesPlugin } from '../plugins'
|
5
5
|
import { isServer } from '../common'
|
6
6
|
|
@@ -25,13 +25,15 @@ export class UnistylesBridgeWeb {
|
|
25
25
|
bottom: 0,
|
26
26
|
left: 0
|
27
27
|
}
|
28
|
-
#statusBar:
|
28
|
+
#statusBar: StatusBar = {
|
29
29
|
height: 0,
|
30
|
-
width: 0
|
30
|
+
width: 0,
|
31
|
+
setColor: () => {}
|
31
32
|
}
|
32
|
-
#navigationBar:
|
33
|
+
#navigationBar: NavigationBar = {
|
33
34
|
height: 0,
|
34
|
-
width: 0
|
35
|
+
width: 0,
|
36
|
+
setColor: () => {}
|
35
37
|
}
|
36
38
|
|
37
39
|
constructor() {
|
@@ -119,6 +121,10 @@ export class UnistylesBridgeWeb {
|
|
119
121
|
}
|
120
122
|
|
121
123
|
private updateTheme(themeName: keyof UnistylesThemes) {
|
124
|
+
if (!this.#themeName) {
|
125
|
+
this.#themeName = this.getTheme()
|
126
|
+
}
|
127
|
+
|
122
128
|
if (this.#themeName === themeName) {
|
123
129
|
this.emitThemeChange()
|
124
130
|
}
|
@@ -162,7 +168,6 @@ export class UnistylesBridgeWeb {
|
|
162
168
|
}
|
163
169
|
|
164
170
|
private getTheme(): keyof UnistylesThemes {
|
165
|
-
|
166
171
|
if (this.#themes.length === 1) {
|
167
172
|
return this.#themes.at(0) as keyof UnistylesThemes
|
168
173
|
}
|
@@ -86,18 +86,26 @@ export class UnistylesRuntime {
|
|
86
86
|
|
87
87
|
/**
|
88
88
|
* Get the status bar info
|
89
|
-
* @returns - The status bar
|
89
|
+
* @returns - The status bar api { width, height, setColor }
|
90
90
|
*/
|
91
91
|
public get statusBar() {
|
92
|
-
return
|
92
|
+
return {
|
93
|
+
width: this.unistylesBridge.statusBar.width,
|
94
|
+
height: this.unistylesBridge.statusBar.height,
|
95
|
+
setColor: (color?: string) => this.unistylesBridge.statusBar.setColor(color ?? '')
|
96
|
+
}
|
93
97
|
}
|
94
98
|
|
95
99
|
/**
|
96
100
|
* Get the navigation bar info (Android)
|
97
|
-
* @returns - The navigation bar
|
101
|
+
* @returns - The navigation bar api { width, height, setColor }
|
98
102
|
*/
|
99
103
|
public get navigationBar() {
|
100
|
-
return
|
104
|
+
return {
|
105
|
+
width: this.unistylesBridge.navigationBar.width,
|
106
|
+
height: this.unistylesBridge.navigationBar.height,
|
107
|
+
setColor: (color?: string) => this.unistylesBridge.navigationBar.setColor(color ?? '')
|
108
|
+
}
|
101
109
|
}
|
102
110
|
|
103
111
|
/**
|
@@ -69,14 +69,16 @@ export class UnistylesMockedRuntime {
|
|
69
69
|
public get statusBar() {
|
70
70
|
return {
|
71
71
|
height: 24,
|
72
|
-
width: 800
|
72
|
+
width: 800,
|
73
|
+
setColor: () => {}
|
73
74
|
}
|
74
75
|
}
|
75
76
|
|
76
77
|
public get navigationBar() {
|
77
78
|
return {
|
78
79
|
height: 0,
|
79
|
-
width: 0
|
80
|
+
width: 0,
|
81
|
+
setColor: () => {}
|
80
82
|
}
|
81
83
|
}
|
82
84
|
|
package/src/types/unistyles.ts
CHANGED
@@ -17,6 +17,14 @@ export type ScreenDimensions = {
|
|
17
17
|
width: number
|
18
18
|
}
|
19
19
|
|
20
|
+
export interface StatusBar extends ScreenDimensions {
|
21
|
+
setColor(color?: string): void
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface NavigationBar extends ScreenDimensions {
|
25
|
+
setColor(color?: string): void
|
26
|
+
}
|
27
|
+
|
20
28
|
export type UnistylesConfig = {
|
21
29
|
adaptiveThemes?: boolean,
|
22
30
|
initialTheme?: keyof UnistylesThemes,
|
@@ -36,8 +44,8 @@ export type UnistylesBridge = {
|
|
36
44
|
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory,
|
37
45
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>,
|
38
46
|
insets: ScreenInsets,
|
39
|
-
statusBar:
|
40
|
-
navigationBar:
|
47
|
+
statusBar: StatusBar,
|
48
|
+
navigationBar: NavigationBar
|
41
49
|
|
42
50
|
// setters
|
43
51
|
themes: Array<keyof UnistylesThemes>,
|