react-native-unistyles 2.8.4 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/cxx/platform.cpp +16 -0
- package/android/src/main/cxx/platform.h +1 -0
- package/android/src/main/java/com/unistyles/Platform.kt +15 -0
- package/cxx/UnistylesImpl.cpp +4 -0
- package/cxx/UnistylesModel.h +1 -0
- package/cxx/UnistylesRuntime.h +3 -1
- package/ios/platform/Platform_iOS.mm +10 -0
- package/lib/commonjs/core/UnistylesModule.js +7 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -1
- package/lib/commonjs/core/UnistylesRuntime.js +28 -5
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js +9 -1
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js.map +1 -1
- package/lib/module/core/UnistylesModule.js +7 -0
- package/lib/module/core/UnistylesModule.js.map +1 -1
- package/lib/module/core/UnistylesRuntime.js +25 -2
- package/lib/module/core/UnistylesRuntime.js.map +1 -1
- package/lib/module/core/mocks/UnistylesMockedRuntime.js +9 -1
- 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 +15 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts +4 -0
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +1 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +3 -3
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/types/unistyles.d.ts +1 -0
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/UnistylesModule.ts +7 -0
- package/src/core/UnistylesRuntime.ts +26 -2
- package/src/core/mocks/UnistylesMockedRuntime.ts +11 -1
- package/src/index.ts +4 -1
- package/src/types/index.ts +4 -1
- package/src/types/stylesheet.ts +3 -3
- package/src/types/unistyles.ts +2 -1
@@ -59,6 +59,7 @@ void makeShared(JNIEnv *env, jobject unistylesModule, std::shared_ptr<UnistylesR
|
|
59
59
|
unistylesRuntime->navigationBar = getNavigationBarDimensions(env, unistylesModule);
|
60
60
|
unistylesRuntime->fontScale = screen.fontScale;
|
61
61
|
unistylesRuntime->pixelRatio = screen.pixelRatio;
|
62
|
+
unistylesRuntime->rtl = getIsRTL(env, unistylesModule);
|
62
63
|
}
|
63
64
|
|
64
65
|
Screen getScreenDimensions(JNIEnv *env, jobject unistylesModule) {
|
@@ -79,6 +80,21 @@ std::string getColorScheme(JNIEnv *env, jobject unistylesModule) {
|
|
79
80
|
return colorSchemeStr;
|
80
81
|
}
|
81
82
|
|
83
|
+
bool getIsRTL(JNIEnv *env, jobject unistylesModule) {
|
84
|
+
jclass cls = env->GetObjectClass(unistylesModule);
|
85
|
+
jfieldID platformFieldId = env->GetFieldID(cls, "platform", "Lcom/unistyles/Platform;");
|
86
|
+
jobject platformInstance = env->GetObjectField(unistylesModule, platformFieldId);
|
87
|
+
jclass platformClass = env->GetObjectClass(platformInstance);
|
88
|
+
jmethodID methodId = env->GetMethodID(platformClass, "getIsRTL", "()Z");
|
89
|
+
jboolean result = env->CallBooleanMethod(platformInstance, methodId);
|
90
|
+
|
91
|
+
env->DeleteLocalRef(cls);
|
92
|
+
env->DeleteLocalRef(platformInstance);
|
93
|
+
env->DeleteLocalRef(platformClass);
|
94
|
+
|
95
|
+
return result;
|
96
|
+
}
|
97
|
+
|
82
98
|
Dimensions getStatusBarDimensions(JNIEnv *env, jobject unistylesModule) {
|
83
99
|
jobject dimensionsObj = JNI_callPlatform(env, unistylesModule, "getStatusBarDimensions", "()Lcom/unistyles/Dimensions;");
|
84
100
|
Dimensions statusBarDimensions = jobjectToDimensions(env, dimensionsObj);
|
@@ -13,6 +13,7 @@ void setStatusBarHidden(JNIEnv *env, jobject unistylesModule, bool hidden);
|
|
13
13
|
void setImmersiveMode(JNIEnv *env, jobject unistylesModule, bool hidden);
|
14
14
|
void setRootViewBackgroundColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha);
|
15
15
|
Insets getInsets(JNIEnv *env, jobject unistylesModule);
|
16
|
+
bool getIsRTL(JNIEnv *env, jobject unistylesModule);
|
16
17
|
std::string getContentSizeCategory(JNIEnv *env, jobject unistylesModule);
|
17
18
|
void setNavigationBarColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha);
|
18
19
|
void setStatusBarColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha);
|
@@ -11,10 +11,12 @@ import android.view.View
|
|
11
11
|
import android.view.Window
|
12
12
|
import android.view.WindowManager
|
13
13
|
import androidx.core.graphics.ColorUtils
|
14
|
+
import androidx.core.text.TextUtilsCompat
|
14
15
|
import androidx.core.view.ViewCompat
|
15
16
|
import androidx.core.view.WindowInsetsCompat
|
16
17
|
import androidx.core.view.WindowInsetsControllerCompat
|
17
18
|
import com.facebook.react.bridge.ReactApplicationContext
|
19
|
+
import java.util.Locale
|
18
20
|
import kotlin.math.roundToInt
|
19
21
|
|
20
22
|
class Platform(private val reactApplicationContext: ReactApplicationContext) {
|
@@ -77,6 +79,19 @@ class Platform(private val reactApplicationContext: ReactApplicationContext) {
|
|
77
79
|
return Dimensions(screenWidth, getStatusBarHeight())
|
78
80
|
}
|
79
81
|
|
82
|
+
fun getIsRTL(): Boolean {
|
83
|
+
// forced by React Native
|
84
|
+
val sharedPrefs = reactApplicationContext.getSharedPreferences(
|
85
|
+
"com.facebook.react.modules.i18nmanager.I18nUtil",
|
86
|
+
Context.MODE_PRIVATE
|
87
|
+
)
|
88
|
+
val hasForcedRtl = sharedPrefs.getBoolean("RCTI18nUtil_forceRTL", false)
|
89
|
+
// user preferences
|
90
|
+
val isRtl = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL
|
91
|
+
|
92
|
+
return hasForcedRtl || isRtl
|
93
|
+
}
|
94
|
+
|
80
95
|
fun getNavigationBarDimensions(): Dimensions {
|
81
96
|
val displayMetrics = reactApplicationContext.resources.displayMetrics
|
82
97
|
val screenWidth = (displayMetrics.widthPixels / displayMetrics.density).roundToInt()
|
package/cxx/UnistylesImpl.cpp
CHANGED
package/cxx/UnistylesModel.h
CHANGED
@@ -110,6 +110,7 @@ struct UnistylesModel {
|
|
110
110
|
Insets insets = {0, 0, 0, 0};
|
111
111
|
float pixelRatio = 1.0;
|
112
112
|
float fontScale = 1.0;
|
113
|
+
bool rtl = false;
|
113
114
|
std::string colorScheme = UnistylesUnspecifiedScheme;
|
114
115
|
std::string contentSizeCategory = UnistylesUnspecifiedScheme;
|
115
116
|
|
package/cxx/UnistylesRuntime.h
CHANGED
@@ -34,7 +34,8 @@ struct JSI_EXPORT UnistylesRuntime : public jsi::HostObject, UnistylesModel {
|
|
34
34
|
{"pixelRatio", BIND_FN(getPixelRatio)},
|
35
35
|
{"fontScale", BIND_FN(getFontScale)},
|
36
36
|
{"setRootViewBackgroundColor", BIND_FN(setRootBackgroundColor)},
|
37
|
-
{"setImmersiveMode", BIND_FN(setImmersiveModeEnabled)}
|
37
|
+
{"setImmersiveMode", BIND_FN(setImmersiveModeEnabled)},
|
38
|
+
{"rtl", BIND_FN(getIsRtl)}
|
38
39
|
};
|
39
40
|
|
40
41
|
this->setters = {
|
@@ -64,6 +65,7 @@ struct JSI_EXPORT UnistylesRuntime : public jsi::HostObject, UnistylesModel {
|
|
64
65
|
jsi::Value getFontScale(jsi::Runtime&, std::string);
|
65
66
|
jsi::Value setRootBackgroundColor(jsi::Runtime&, std::string);
|
66
67
|
jsi::Value setImmersiveModeEnabled(jsi::Runtime&, std::string);
|
68
|
+
jsi::Value getIsRtl(jsi::Runtime&, std::string);
|
67
69
|
|
68
70
|
std::optional<jsi::Value> setThemes(jsi::Runtime&, const jsi::Value&);
|
69
71
|
|
@@ -91,6 +91,7 @@
|
|
91
91
|
unistylesRuntime->insets = [self getInsets];
|
92
92
|
unistylesRuntime->pixelRatio = screen.pixelRatio;
|
93
93
|
unistylesRuntime->fontScale = screen.fontScale;
|
94
|
+
unistylesRuntime->rtl = [self isRtl];
|
94
95
|
});
|
95
96
|
}
|
96
97
|
|
@@ -149,6 +150,15 @@
|
|
149
150
|
return Screen({width, height, pixelRatio, fontScale});
|
150
151
|
}
|
151
152
|
|
153
|
+
- (bool)isRtl {
|
154
|
+
// forced by React Native
|
155
|
+
BOOL hasForcedRtl = [[NSUserDefaults standardUserDefaults] boolForKey:@"RCTI18nUtil_forceRTL"];
|
156
|
+
// user preferences
|
157
|
+
BOOL isRtl = [UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
|
158
|
+
|
159
|
+
return hasForcedRtl || isRtl;
|
160
|
+
}
|
161
|
+
|
152
162
|
- (void)setStatusBarHidden:(bool)isHidden {
|
153
163
|
// forward it to React Native ViewController
|
154
164
|
dispatch_async(dispatch_get_main_queue(), ^{
|
@@ -43,11 +43,14 @@ class UnistylesBridgeWeb {
|
|
43
43
|
};
|
44
44
|
#pixelRatio = 1.0;
|
45
45
|
#fontScale = 1.0;
|
46
|
+
#hairlineWidth = 1;
|
47
|
+
#rtl = false;
|
46
48
|
constructor() {
|
47
49
|
if (!_common.isServer) {
|
48
50
|
this.setupListeners();
|
49
51
|
this.#screenWidth = window.innerWidth;
|
50
52
|
this.#screenHeight = window.innerHeight;
|
53
|
+
this.#rtl = window.getComputedStyle(document.documentElement).direction === 'rtl';
|
51
54
|
}
|
52
55
|
}
|
53
56
|
install() {
|
@@ -86,6 +89,10 @@ class UnistylesBridgeWeb {
|
|
86
89
|
return this.#pixelRatio;
|
87
90
|
case 'fontScale':
|
88
91
|
return this.#fontScale;
|
92
|
+
case 'hairlineWidth':
|
93
|
+
return this.#hairlineWidth;
|
94
|
+
case 'rtl':
|
95
|
+
return this.#rtl;
|
89
96
|
case 'useTheme':
|
90
97
|
return themeName => this.useTheme(themeName);
|
91
98
|
case 'updateTheme':
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","windowResizeDebounceTimeMs","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","setHidden","navigationBar","pixelRatio","fontScale","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","timeMs","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","onResize","emitLayoutChange","addEventListener","clearTimeout","setTimeout","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","
|
1
|
+
{"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","windowResizeDebounceTimeMs","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","setHidden","navigationBar","pixelRatio","fontScale","hairlineWidth","rtl","constructor","setupListeners","getComputedStyle","document","documentElement","direction","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","timeMs","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","onResize","emitLayoutChange","addEventListener","clearTimeout","setTimeout","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","body","style","backgroundColor","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,0BAA0B,GAAW,GAAG;EACzC,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGC,gBAAQ,GAAGL,SAAS,GAAGM,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGH,gBAAQ,GAAGL,SAAS,GAAGM,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,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,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEQ9B,eAAeA,CAAA,EAAG;IACtB,IAAI,CAAC,CAACtD,eAAe,CAACmF,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,OAAO;MACbC,OAAO,EAAE;QACLzF,SAAS,EAAE,IAAI,CAAC,CAACA;MACrB;IACJ,CAAC,CAAC;EACN;EAEQuE,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAACnE,eAAe,CAACmF,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;QACLhF,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5BiF,WAAW,EAAG,IAAI,CAAC,CAACpG,WAAW,GAAe,IAAI,CAAC,CAACI,YAAuB,GACrE,WAAW,GACX,UAAU;QAChBiG,MAAM,EAAE;UACJzE,KAAK,EAAE,IAAI,CAAC,CAAC5B,WAAW;UACxB2B,MAAM,EAAE,IAAI,CAAC,CAACvB;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAACkG,OAAA,CAAA5G,kBAAA,GAAAA,kBAAA;AAEM,MAAM6G,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,IAAI7G,kBAAkB,CAAC,CAAC","ignoreList":[]}
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.UnistylesRuntime = void 0;
|
7
7
|
var _common = require("../common");
|
8
|
-
var
|
8
|
+
var _parseColor = require("../utils/parseColor");
|
9
9
|
/**
|
10
10
|
* Utility to interact with the Unistyles during runtime
|
11
11
|
*/
|
@@ -35,7 +35,9 @@ class UnistylesRuntime {
|
|
35
35
|
},
|
36
36
|
orientation: this.orientation,
|
37
37
|
pixelRatio: this.pixelRatio,
|
38
|
-
fontScale: this.fontScale
|
38
|
+
fontScale: this.fontScale,
|
39
|
+
hairlineWidth: this.hairlineWidth,
|
40
|
+
rtl: this.rtl
|
39
41
|
};
|
40
42
|
}
|
41
43
|
|
@@ -47,6 +49,14 @@ class UnistylesRuntime {
|
|
47
49
|
return this.unistylesBridge.colorScheme;
|
48
50
|
}
|
49
51
|
|
52
|
+
/**
|
53
|
+
* Get the layout direction
|
54
|
+
* @returns - Boolean indicating if the layout direction is RTL
|
55
|
+
*/
|
56
|
+
get rtl() {
|
57
|
+
return this.unistylesBridge.rtl;
|
58
|
+
}
|
59
|
+
|
50
60
|
/**
|
51
61
|
* Get info about adaptive themes
|
52
62
|
* @returns - boolean indicating if the adaptive themes are enabled
|
@@ -89,6 +99,7 @@ class UnistylesRuntime {
|
|
89
99
|
|
90
100
|
/**
|
91
101
|
* Get the names of currently enabled plugins
|
102
|
+
* @deprecated - Plugins will be removed in the next major release
|
92
103
|
* @returns - The names of currently enabled plugins
|
93
104
|
*/
|
94
105
|
get enabledPlugins() {
|
@@ -123,7 +134,7 @@ class UnistylesRuntime {
|
|
123
134
|
width: this.unistylesBridge.statusBar.width,
|
124
135
|
height: this.unistylesBridge.statusBar.height,
|
125
136
|
setColor: (color, alpha) => {
|
126
|
-
const [parsedColor, parsedAlpha] = (0,
|
137
|
+
const [parsedColor, parsedAlpha] = (0, _parseColor.parseColor)(color, alpha);
|
127
138
|
this.unistylesBridge.statusBar.setColor(parsedColor, parsedAlpha);
|
128
139
|
},
|
129
140
|
setHidden: hidden => this.unistylesBridge.statusBar.setHidden(hidden)
|
@@ -139,7 +150,7 @@ class UnistylesRuntime {
|
|
139
150
|
width: this.unistylesBridge.navigationBar.width,
|
140
151
|
height: this.unistylesBridge.navigationBar.height,
|
141
152
|
setColor: (color, alpha) => {
|
142
|
-
const [parsedColor, parsedAlpha] = (0,
|
153
|
+
const [parsedColor, parsedAlpha] = (0, _parseColor.parseColor)(color, alpha);
|
143
154
|
this.unistylesBridge.navigationBar.setColor(parsedColor, parsedAlpha);
|
144
155
|
},
|
145
156
|
setHidden: hidden => this.unistylesBridge.navigationBar.setHidden(hidden)
|
@@ -177,6 +188,16 @@ class UnistylesRuntime {
|
|
177
188
|
return parseFloat(this.unistylesBridge.fontScale.toFixed(2));
|
178
189
|
}
|
179
190
|
|
191
|
+
/**
|
192
|
+
* Get the hairline width
|
193
|
+
* @returns - The thinnest width of the platform
|
194
|
+
*/
|
195
|
+
get hairlineWidth() {
|
196
|
+
const pixelRatio = this.pixelRatio;
|
197
|
+
const nearestPixel = Math.trunc(pixelRatio * 0.4) || 1;
|
198
|
+
return nearestPixel / pixelRatio;
|
199
|
+
}
|
200
|
+
|
180
201
|
/**
|
181
202
|
* Get the immersive mode (both status bar and navigation bar hidden (Android))
|
182
203
|
* @param isEnabled
|
@@ -191,7 +212,7 @@ class UnistylesRuntime {
|
|
191
212
|
* @param alpha - Color alpha - default is 1
|
192
213
|
*/
|
193
214
|
setRootViewBackgroundColor = (color, alpha) => {
|
194
|
-
const [parsedColor, parsedAlpha] = (0,
|
215
|
+
const [parsedColor, parsedAlpha] = (0, _parseColor.parseColor)(color, alpha);
|
195
216
|
this.unistylesBridge.setRootViewBackgroundColor(parsedColor, parsedAlpha);
|
196
217
|
};
|
197
218
|
|
@@ -231,6 +252,7 @@ class UnistylesRuntime {
|
|
231
252
|
|
232
253
|
/**
|
233
254
|
* Enable a plugin
|
255
|
+
* @deprecated - Plugins will be removed in the next major release
|
234
256
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
235
257
|
*/
|
236
258
|
addPlugin = plugin => {
|
@@ -239,6 +261,7 @@ class UnistylesRuntime {
|
|
239
261
|
|
240
262
|
/**
|
241
263
|
* Disable a plugin
|
264
|
+
* @deprecated - Plugins will be removed in the next major release
|
242
265
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
243
266
|
*/
|
244
267
|
removePlugin = plugin => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","
|
1
|
+
{"version":3,"names":["_common","require","_parseColor","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","hairlineWidth","rtl","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","parseColor","setHidden","hidden","ScreenOrientation","Landscape","Portrait","parseFloat","toFixed","nearestPixel","Math","trunc","setImmersiveMode","isEnabled","setRootViewBackgroundColor","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;AAIA,IAAAC,WAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACO,MAAME,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;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,KAAK,EAAE,IAAI,CAACD,SAAS,CAACC,KAAK;QAC3BC,MAAM,EAAE,IAAI,CAACF,SAAS,CAACE;MAC3B,CAAC;MACDC,aAAa,EAAE;QACXF,KAAK,EAAE,IAAI,CAACE,aAAa,CAACF,KAAK;QAC/BC,MAAM,EAAE,IAAI,CAACC,aAAa,CAACD;MAC/B,CAAC;MACDE,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,UAAU,EAAE,IAAI,CAAC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,eAAe,CAAC6C,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,CAACjD,iBAAiB,CAACgD,WAAW,CAACN,IAAI,EAAEO,OAAO,CAAC,IAAI,CAACjD,iBAAiB,CAACkD,QAAQ,CAACR,IAAI,CAAC,CAAC,CAAC;EAC5F,CAAC;;EAED;AACJ;AACA;AACA;EACWS,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAACrD,eAAe,CAACsD,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;;EAED;AACJ;AACA;AACA;AACA;EACWE,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAACvD,iBAAiB,CAACsD,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAACvD,iBAAiB,CAACwD,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAA5D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -29,7 +29,9 @@ class UnistylesMockedRuntime {
|
|
29
29
|
},
|
30
30
|
orientation: this.orientation,
|
31
31
|
pixelRatio: this.pixelRatio,
|
32
|
-
fontScale: this.fontScale
|
32
|
+
fontScale: this.fontScale,
|
33
|
+
hairlineWidth: this.hairlineWidth,
|
34
|
+
rtl: this.rtl
|
33
35
|
};
|
34
36
|
}
|
35
37
|
get colorScheme() {
|
@@ -51,6 +53,9 @@ class UnistylesMockedRuntime {
|
|
51
53
|
const firstBreakpoint = this.unistylesRegistry.sortedBreakpointPairs.at(0);
|
52
54
|
return firstBreakpoint ? firstBreakpoint.at(0) : undefined;
|
53
55
|
}
|
56
|
+
get rtl() {
|
57
|
+
return false;
|
58
|
+
}
|
54
59
|
get breakpoints() {
|
55
60
|
return this.unistylesRegistry.breakpoints;
|
56
61
|
}
|
@@ -74,6 +79,9 @@ class UnistylesMockedRuntime {
|
|
74
79
|
get pixelRatio() {
|
75
80
|
return 1.0;
|
76
81
|
}
|
82
|
+
get hairlineWidth() {
|
83
|
+
return 0.333333;
|
84
|
+
}
|
77
85
|
get fontScale() {
|
78
86
|
return 1.0;
|
79
87
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","top","right","bottom","left","setColor","setHidden","ScreenOrientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","setRootViewBackgroundColor","color","setImmersiveMode","isEnabled","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;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,KAAK,EAAE,IAAI,CAACD,SAAS,CAACC,KAAK;QAC3BC,MAAM,EAAE,IAAI,CAACF,SAAS,CAACE;MAC3B,CAAC;MACDC,aAAa,EAAE;QACXF,KAAK,EAAE,IAAI,CAACE,aAAa,CAACF,KAAK;QAC/BC,MAAM,EAAE,IAAI,CAACC,aAAa,CAACD;MAC/B,CAAC;MACDE,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,SAAS,EAAE,IAAI,CAACA;
|
1
|
+
{"version":3,"names":["_common","require","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","hairlineWidth","rtl","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","top","right","bottom","left","setColor","setHidden","ScreenOrientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","setRootViewBackgroundColor","color","setImmersiveMode","isEnabled","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;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,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AC;EAC9CE,0BAA0B,GAAIC,KAAsB,IAAK,CAAC,CAAC;EAC3DC,gBAAgB,GAAIC,SAAkB,IAAK,CAAC,CAAC;AACxD;AAACC,OAAA,CAAAnD,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -37,11 +37,14 @@ export class UnistylesBridgeWeb {
|
|
37
37
|
};
|
38
38
|
#pixelRatio = 1.0;
|
39
39
|
#fontScale = 1.0;
|
40
|
+
#hairlineWidth = 1;
|
41
|
+
#rtl = false;
|
40
42
|
constructor() {
|
41
43
|
if (!isServer) {
|
42
44
|
this.setupListeners();
|
43
45
|
this.#screenWidth = window.innerWidth;
|
44
46
|
this.#screenHeight = window.innerHeight;
|
47
|
+
this.#rtl = window.getComputedStyle(document.documentElement).direction === 'rtl';
|
45
48
|
}
|
46
49
|
}
|
47
50
|
install() {
|
@@ -80,6 +83,10 @@ export class UnistylesBridgeWeb {
|
|
80
83
|
return this.#pixelRatio;
|
81
84
|
case 'fontScale':
|
82
85
|
return this.#fontScale;
|
86
|
+
case 'hairlineWidth':
|
87
|
+
return this.#hairlineWidth;
|
88
|
+
case 'rtl':
|
89
|
+
return this.#rtl;
|
83
90
|
case 'useTheme':
|
84
91
|
return themeName => this.useTheme(themeName);
|
85
92
|
case 'updateTheme':
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","isServer","UnistylesBridgeWeb","timerRef","undefined","windowResizeDebounceTimeMs","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","setHidden","navigationBar","pixelRatio","fontScale","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","timeMs","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","onResize","emitLayoutChange","addEventListener","clearTimeout","setTimeout","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","isServer","UnistylesBridgeWeb","timerRef","undefined","windowResizeDebounceTimeMs","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","setHidden","navigationBar","pixelRatio","fontScale","hairlineWidth","rtl","constructor","setupListeners","getComputedStyle","document","documentElement","direction","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","timeMs","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","onResize","emitLayoutChange","addEventListener","clearTimeout","setTimeout","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","body","style","backgroundColor","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,0BAA0B,GAAW,GAAG;EACzC,CAACC,iBAAiB,GAAY,KAAK;EAC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AC,CAACxB,WAAW;UACxBuB,MAAM,EAAE,IAAI,CAAC,CAACpB;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAM+F,eAAe,GAAG,IAAIxG,kBAAkB,CAAC,CAAC","ignoreList":[]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ScreenOrientation, UnistylesError } from '../common';
|
2
|
-
import { parseColor } from '../utils';
|
2
|
+
import { parseColor } from '../utils/parseColor';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* Utility to interact with the Unistyles during runtime
|
@@ -30,7 +30,9 @@ export class UnistylesRuntime {
|
|
30
30
|
},
|
31
31
|
orientation: this.orientation,
|
32
32
|
pixelRatio: this.pixelRatio,
|
33
|
-
fontScale: this.fontScale
|
33
|
+
fontScale: this.fontScale,
|
34
|
+
hairlineWidth: this.hairlineWidth,
|
35
|
+
rtl: this.rtl
|
34
36
|
};
|
35
37
|
}
|
36
38
|
|
@@ -42,6 +44,14 @@ export class UnistylesRuntime {
|
|
42
44
|
return this.unistylesBridge.colorScheme;
|
43
45
|
}
|
44
46
|
|
47
|
+
/**
|
48
|
+
* Get the layout direction
|
49
|
+
* @returns - Boolean indicating if the layout direction is RTL
|
50
|
+
*/
|
51
|
+
get rtl() {
|
52
|
+
return this.unistylesBridge.rtl;
|
53
|
+
}
|
54
|
+
|
45
55
|
/**
|
46
56
|
* Get info about adaptive themes
|
47
57
|
* @returns - boolean indicating if the adaptive themes are enabled
|
@@ -84,6 +94,7 @@ export class UnistylesRuntime {
|
|
84
94
|
|
85
95
|
/**
|
86
96
|
* Get the names of currently enabled plugins
|
97
|
+
* @deprecated - Plugins will be removed in the next major release
|
87
98
|
* @returns - The names of currently enabled plugins
|
88
99
|
*/
|
89
100
|
get enabledPlugins() {
|
@@ -172,6 +183,16 @@ export class UnistylesRuntime {
|
|
172
183
|
return parseFloat(this.unistylesBridge.fontScale.toFixed(2));
|
173
184
|
}
|
174
185
|
|
186
|
+
/**
|
187
|
+
* Get the hairline width
|
188
|
+
* @returns - The thinnest width of the platform
|
189
|
+
*/
|
190
|
+
get hairlineWidth() {
|
191
|
+
const pixelRatio = this.pixelRatio;
|
192
|
+
const nearestPixel = Math.trunc(pixelRatio * 0.4) || 1;
|
193
|
+
return nearestPixel / pixelRatio;
|
194
|
+
}
|
195
|
+
|
175
196
|
/**
|
176
197
|
* Get the immersive mode (both status bar and navigation bar hidden (Android))
|
177
198
|
* @param isEnabled
|
@@ -226,6 +247,7 @@ export class UnistylesRuntime {
|
|
226
247
|
|
227
248
|
/**
|
228
249
|
* Enable a plugin
|
250
|
+
* @deprecated - Plugins will be removed in the next major release
|
229
251
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
230
252
|
*/
|
231
253
|
addPlugin = plugin => {
|
@@ -234,6 +256,7 @@ export class UnistylesRuntime {
|
|
234
256
|
|
235
257
|
/**
|
236
258
|
* Disable a plugin
|
259
|
+
* @deprecated - Plugins will be removed in the next major release
|
237
260
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
238
261
|
*/
|
239
262
|
removePlugin = plugin => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesError","parseColor","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","setHidden","hidden","Landscape","Portrait","parseFloat","toFixed","setImmersiveMode","isEnabled","setRootViewBackgroundColor","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;AAI7D,SAASC,UAAU,QAAQ,
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesError","parseColor","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","hairlineWidth","rtl","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","setHidden","hidden","Landscape","Portrait","parseFloat","toFixed","nearestPixel","Math","trunc","setImmersiveMode","isEnabled","setRootViewBackgroundColor","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;AAI7D,SAASC,UAAU,QAAQ,qBAAqB;;AAEhD;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;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,KAAK,EAAE,IAAI,CAACD,SAAS,CAACC,KAAK;QAC3BC,MAAM,EAAE,IAAI,CAACF,SAAS,CAACE;MAC3B,CAAC;MACDC,aAAa,EAAE;QACXF,KAAK,EAAE,IAAI,CAACE,aAAa,CAACF,KAAK;QAC/BC,MAAM,EAAE,IAAI,CAACC,aAAa,CAACD;MAC/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,CAACyC,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAACzC,eAAe,CAAC2C,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAAChD,cAAc,CAACiD,kBAAkB,CAAC;EACtD,CAAC;;EAED;AACJ;AACA;AACA;AACA;AACA;EACWC,WAAW,GAAGA,CAACL,IAA2B,EAAEM,OAAkG,KAAK;IACtJ,IAAI,CAAC9C,iBAAiB,CAAC6C,WAAW,CAACL,IAAI,EAAEM,OAAO,CAAC,IAAI,CAAC9C,iBAAiB,CAAC+C,QAAQ,CAACP,IAAI,CAAC,CAAC,CAAC;EAC5F,CAAC;;EAED;AACJ;AACA;AACA;EACWQ,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAClD,eAAe,CAACmD,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;;EAED;AACJ;AACA;AACA;AACA;EACWE,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAACpD,iBAAiB,CAACmD,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAACpD,iBAAiB,CAACqD,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL","ignoreList":[]}
|
@@ -22,7 +22,9 @@ export class UnistylesMockedRuntime {
|
|
22
22
|
},
|
23
23
|
orientation: this.orientation,
|
24
24
|
pixelRatio: this.pixelRatio,
|
25
|
-
fontScale: this.fontScale
|
25
|
+
fontScale: this.fontScale,
|
26
|
+
hairlineWidth: this.hairlineWidth,
|
27
|
+
rtl: this.rtl
|
26
28
|
};
|
27
29
|
}
|
28
30
|
get colorScheme() {
|
@@ -44,6 +46,9 @@ export class UnistylesMockedRuntime {
|
|
44
46
|
const firstBreakpoint = this.unistylesRegistry.sortedBreakpointPairs.at(0);
|
45
47
|
return firstBreakpoint ? firstBreakpoint.at(0) : undefined;
|
46
48
|
}
|
49
|
+
get rtl() {
|
50
|
+
return false;
|
51
|
+
}
|
47
52
|
get breakpoints() {
|
48
53
|
return this.unistylesRegistry.breakpoints;
|
49
54
|
}
|
@@ -67,6 +72,9 @@ export class UnistylesMockedRuntime {
|
|
67
72
|
get pixelRatio() {
|
68
73
|
return 1.0;
|
69
74
|
}
|
75
|
+
get hairlineWidth() {
|
76
|
+
return 0.333333;
|
77
|
+
}
|
70
78
|
get fontScale() {
|
71
79
|
return 1.0;
|
72
80
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","top","right","bottom","left","setColor","setHidden","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","setRootViewBackgroundColor","color","setImmersiveMode","isEnabled"],"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;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,KAAK,EAAE,IAAI,CAACD,SAAS,CAACC,KAAK;QAC3BC,MAAM,EAAE,IAAI,CAACF,SAAS,CAACE;MAC3B,CAAC;MACDC,aAAa,EAAE;QACXF,KAAK,EAAE,IAAI,CAACE,aAAa,CAACF,KAAK;QAC/BC,MAAM,EAAE,IAAI,CAACC,aAAa,CAACD;MAC/B,CAAC;MACDE,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,SAAS,EAAE,IAAI,CAACA;
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","hairlineWidth","rtl","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","top","right","bottom","left","setColor","setHidden","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","setRootViewBackgroundColor","color","setImmersiveMode","isEnabled"],"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;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,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AK,CAAC,CAAC;EAC9CE,0BAA0B,GAAIC,KAAsB,IAAK,CAAC,CAAC;EAC3DC,gBAAgB,GAAIC,SAAkB,IAAK,CAAC,CAAC;AACxD","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;;;IAgDpB,OAAO;IAyFd,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;IAkCtB,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;CAe3B;AAED,eAAO,MAAM,eAAe,oBAA2B,CAAA"}
|
@@ -31,12 +31,19 @@ export declare class UnistylesRuntime {
|
|
31
31
|
orientation: "landscape" | "portrait";
|
32
32
|
pixelRatio: number;
|
33
33
|
fontScale: number;
|
34
|
+
hairlineWidth: number;
|
35
|
+
rtl: boolean;
|
34
36
|
};
|
35
37
|
/**
|
36
38
|
* Get the current color scheme
|
37
39
|
* @returns - The current color scheme
|
38
40
|
*/
|
39
41
|
get colorScheme(): import("../types").ColorSchemeName;
|
42
|
+
/**
|
43
|
+
* Get the layout direction
|
44
|
+
* @returns - Boolean indicating if the layout direction is RTL
|
45
|
+
*/
|
46
|
+
get rtl(): boolean;
|
40
47
|
/**
|
41
48
|
* Get info about adaptive themes
|
42
49
|
* @returns - boolean indicating if the adaptive themes are enabled
|
@@ -64,6 +71,7 @@ export declare class UnistylesRuntime {
|
|
64
71
|
get breakpoints(): import("../global").UnistylesBreakpoints;
|
65
72
|
/**
|
66
73
|
* Get the names of currently enabled plugins
|
74
|
+
* @deprecated - Plugins will be removed in the next major release
|
67
75
|
* @returns - The names of currently enabled plugins
|
68
76
|
*/
|
69
77
|
get enabledPlugins(): string[];
|
@@ -115,6 +123,11 @@ export declare class UnistylesRuntime {
|
|
115
123
|
* @returns - The font scale
|
116
124
|
*/
|
117
125
|
get fontScale(): number;
|
126
|
+
/**
|
127
|
+
* Get the hairline width
|
128
|
+
* @returns - The thinnest width of the platform
|
129
|
+
*/
|
130
|
+
get hairlineWidth(): number;
|
118
131
|
/**
|
119
132
|
* Get the immersive mode (both status bar and navigation bar hidden (Android))
|
120
133
|
* @param isEnabled
|
@@ -146,11 +159,13 @@ export declare class UnistylesRuntime {
|
|
146
159
|
setAdaptiveThemes: (enable: boolean) => void;
|
147
160
|
/**
|
148
161
|
* Enable a plugin
|
162
|
+
* @deprecated - Plugins will be removed in the next major release
|
149
163
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
150
164
|
*/
|
151
165
|
addPlugin: (plugin: UnistylesPlugin) => void;
|
152
166
|
/**
|
153
167
|
* Disable a plugin
|
168
|
+
* @deprecated - Plugins will be removed in the next major release
|
154
169
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
155
170
|
*/
|
156
171
|
removePlugin: (plugin: UnistylesPlugin) => void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D;;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
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D;;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;;;;;;;;;;;;;;;;;;;;;MAoBrB;IAED;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,GAAG,YAEb;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;;;;OAIG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,MAAM,oCAEhB;IAED;;;OAGG;IACH,IAAW,SAAS;;;2BAIO,KAAK,UAAU,MAAM;4BAKpB,OAAO;MAElC;IAED;;;OAGG;IACH,IAAW,aAAa;;;2BAIG,KAAK,UAAU,MAAM;4BAKpB,OAAO;MAElC;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;OAGG;IACH,IAAW,UAAU,WAEpB;IAED;;;OAGG;IACH,IAAW,SAAS,WAEnB;IAED;;;OAGG;IACH,IAAW,aAAa,WAKvB;IAED;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,OAAO;IAI1C;;;;OAIG;IACI,0BAA0B,WAAY,KAAK,UAAU,MAAM,UAIjE;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;;;;OAIG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;;OAIG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
@@ -30,12 +30,15 @@ export declare class UnistylesMockedRuntime {
|
|
30
30
|
orientation: "portrait";
|
31
31
|
pixelRatio: number;
|
32
32
|
fontScale: number;
|
33
|
+
hairlineWidth: number;
|
34
|
+
rtl: boolean;
|
33
35
|
};
|
34
36
|
get colorScheme(): string;
|
35
37
|
get hasAdaptiveThemes(): boolean;
|
36
38
|
get themeName(): undefined;
|
37
39
|
get contentSizeCategory(): string;
|
38
40
|
get breakpoint(): number | keyof import("../../global").UnistylesBreakpoints | undefined;
|
41
|
+
get rtl(): boolean;
|
39
42
|
get breakpoints(): import("../../global").UnistylesBreakpoints;
|
40
43
|
get enabledPlugins(): UnistylesPlugin[];
|
41
44
|
get screen(): {
|
@@ -49,6 +52,7 @@ export declare class UnistylesMockedRuntime {
|
|
49
52
|
left: number;
|
50
53
|
};
|
51
54
|
get pixelRatio(): number;
|
55
|
+
get hairlineWidth(): number;
|
52
56
|
get fontScale(): number;
|
53
57
|
get statusBar(): {
|
54
58
|
height: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesMockedRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1E,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
|
1
|
+
{"version":3,"file":"UnistylesMockedRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1E,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;;;;;;;;;;;;;;;;;;;;;;;;;;MAoBrB;IAED,IAAW,WAAW,WAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,cAInB;IAED,IAAW,mBAAmB,WAE7B;IAED,IAAW,UAAU,2EAUpB;IAED,IAAW,GAAG,YAEb;IAED,IAAW,WAAW,gDAErB;IAED,IAAW,cAAc,sBAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,MAAM;;;;;MAOhB;IAED,IAAW,UAAU,WAEpB;IAED,IAAW,aAAa,WAEvB;IAED,IAAW,SAAS,WAEnB;IAED,IAAW,SAAS;;;;;MAOnB;IAED,IAAW,aAAa;;;;;MAOvB;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;IAC9C,0BAA0B,WAAY,KAAK,GAAG,MAAM,UAAO;IAC3D,gBAAgB,cAAe,OAAO,UAAO;CACvD"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { mq } from './utils';
|
2
2
|
import { useInitialTheme } from './hooks';
|
3
|
-
import type { UnistylesPlugin, UnistylesValues, ExtractVariantNames } from './types';
|
3
|
+
import type { UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames } from './types';
|
4
4
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
5
5
|
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common';
|
6
6
|
import { useStyles } from './useStyles';
|
@@ -73,5 +73,5 @@ declare const UnistylesRegistry: {
|
|
73
73
|
};
|
74
74
|
declare const UnistylesRuntime: import("./core").UnistylesRuntime;
|
75
75
|
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesRegistry, UnistylesRuntime };
|
76
|
-
export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin, UnistylesValues, ExtractVariantNames as UnistylesVariants };
|
76
|
+
export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames as UnistylesVariants };
|
77
77
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC/H,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD;;;GAGG;AACH,QAAA,MAAM,iBAAiB;IACnB;;;OAGG;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;CAEN,CAAA;AAED,QAAA,MAAM,gBAAgB,mCAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,mBAAmB,IAAI,iBAAiB,EAC3C,CAAA"}
|
@@ -3,7 +3,7 @@ export * from './unistyles';
|
|
3
3
|
export * from './color';
|
4
4
|
export type { Optional, Nullable } from './common';
|
5
5
|
export type { NestedStylePairs, UnistylesTheme, ScreenSize, NestedStyle, RNValue, RNStyle } from './core';
|
6
|
-
export type { StyleSheetWithSuperPowers, StyleSheet, AllAvailableKeys, UnistylesValues } from './stylesheet';
|
6
|
+
export type { StyleSheetWithSuperPowers, StyleSheet, AllAvailableKeys, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage } from './stylesheet';
|
7
7
|
export type { ReactNativeStyleSheet } from './breakpoints';
|
8
8
|
export type { ExtractVariantNames } from './variants';
|
9
9
|
export type { UnistylesPlugin } from './plugin';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EACR,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACV,MAAM,QAAQ,CAAA;AACf,YAAY,EACR,yBAAyB,EACzB,UAAU,EACV,gBAAgB,EAChB,eAAe,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EACR,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACV,MAAM,QAAQ,CAAA;AACf,YAAY,EACR,yBAAyB,EACzB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,aAAa,EAChB,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
|
@@ -3,9 +3,9 @@ import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core';
|
|
3
3
|
import type { UnistylesBreakpoints } from '../global';
|
4
4
|
import type { UnistylesMiniRuntime } from '../core';
|
5
5
|
type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset';
|
6
|
-
type UnistyleView = Omit<ViewStyle, NestedKeys>;
|
7
|
-
type UnistyleText = Omit<TextStyle, NestedKeys>;
|
8
|
-
type UnistyleImage = Omit<ImageStyle, NestedKeys>;
|
6
|
+
export type UnistyleView = Omit<ViewStyle, NestedKeys>;
|
7
|
+
export type UnistyleText = Omit<TextStyle, NestedKeys>;
|
8
|
+
export type UnistyleImage = Omit<ImageStyle, NestedKeys>;
|
9
9
|
type UnistyleNestedStyles = {
|
10
10
|
shadowOffset?: ToDeepUnistyles<ShadowOffset>;
|
11
11
|
textShadowOffset?: ToDeepUnistyles<ShadowOffset>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../src/types/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGnD,KAAK,UAAU,GAAG,cAAc,GAAG,WA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BAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC5C;CACJ,CAAA;AAED,KAAK,kBAAkB,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,oBAAoB,CAAA;AAE5F,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,YAAY,GAAG,YAAY,GAAG,aAAa,CAAC,CAAA;AAClF,MAAM,MAAM,yBAAyB,GAAG,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAE3E,MAAM,MAAM,eAAe,GAAG;KACzB,QAAQ,IAAI,gBAAgB,CAAC,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG;SAC3D,GAAG,IAAI,yBAAyB,CAAC,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC;KACpE;CACJ,GAAG,QAAQ,GAAG;KACV,QAAQ,IAAI,UAAU,CAAC,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC;CAC5D,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,eAAe,CAAC,CAAA;CAC7E,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,KAAK,UAAU,CAAC,GAAG,UAAU,CAAA"}
|
@@ -43,6 +43,7 @@ export type UnistylesBridge = {
|
|
43
43
|
navigationBar: NavigationBar;
|
44
44
|
pixelRatio: number;
|
45
45
|
fontScale: number;
|
46
|
+
rtl: boolean;
|
46
47
|
themes: Array<keyof UnistylesThemes>;
|
47
48
|
useBreakpoints(breakpoints: UnistylesBreakpoints): void;
|
48
49
|
useTheme(name: keyof UnistylesThemes): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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,oBAAoB,GAAG;IAC/B,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,oBAAoB,CAAA"}
|
package/package.json
CHANGED
@@ -40,12 +40,15 @@ export class UnistylesBridgeWeb {
|
|
40
40
|
}
|
41
41
|
#pixelRatio = 1.0
|
42
42
|
#fontScale = 1.0
|
43
|
+
#hairlineWidth = 1
|
44
|
+
#rtl = false
|
43
45
|
|
44
46
|
constructor() {
|
45
47
|
if (!isServer) {
|
46
48
|
this.setupListeners()
|
47
49
|
this.#screenWidth = window.innerWidth
|
48
50
|
this.#screenHeight = window.innerHeight
|
51
|
+
this.#rtl = window.getComputedStyle(document.documentElement).direction === 'rtl'
|
49
52
|
}
|
50
53
|
}
|
51
54
|
|
@@ -85,6 +88,10 @@ export class UnistylesBridgeWeb {
|
|
85
88
|
return this.#pixelRatio
|
86
89
|
case 'fontScale':
|
87
90
|
return this.#fontScale
|
91
|
+
case 'hairlineWidth':
|
92
|
+
return this.#hairlineWidth
|
93
|
+
case 'rtl':
|
94
|
+
return this.#rtl
|
88
95
|
case 'useTheme':
|
89
96
|
return (themeName: keyof UnistylesThemes) => this.useTheme(themeName)
|
90
97
|
case 'updateTheme':
|
@@ -2,7 +2,7 @@ import { ScreenOrientation, UnistylesError } from '../common'
|
|
2
2
|
import type { Color, UnistylesBridge, UnistylesPlugin } from '../types'
|
3
3
|
import type { UnistylesThemes } from '../global'
|
4
4
|
import type { UnistyleRegistry } from './UnistyleRegistry'
|
5
|
-
import { parseColor } from '../utils'
|
5
|
+
import { parseColor } from '../utils/parseColor'
|
6
6
|
|
7
7
|
/**
|
8
8
|
* Utility to interact with the Unistyles during runtime
|
@@ -30,7 +30,9 @@ export class UnistylesRuntime {
|
|
30
30
|
},
|
31
31
|
orientation: this.orientation,
|
32
32
|
pixelRatio: this.pixelRatio,
|
33
|
-
fontScale: this.fontScale
|
33
|
+
fontScale: this.fontScale,
|
34
|
+
hairlineWidth: this.hairlineWidth,
|
35
|
+
rtl: this.rtl
|
34
36
|
}
|
35
37
|
}
|
36
38
|
|
@@ -42,6 +44,14 @@ export class UnistylesRuntime {
|
|
42
44
|
return this.unistylesBridge.colorScheme
|
43
45
|
}
|
44
46
|
|
47
|
+
/**
|
48
|
+
* Get the layout direction
|
49
|
+
* @returns - Boolean indicating if the layout direction is RTL
|
50
|
+
*/
|
51
|
+
public get rtl() {
|
52
|
+
return this.unistylesBridge.rtl
|
53
|
+
}
|
54
|
+
|
45
55
|
/**
|
46
56
|
* Get info about adaptive themes
|
47
57
|
* @returns - boolean indicating if the adaptive themes are enabled
|
@@ -84,6 +94,7 @@ export class UnistylesRuntime {
|
|
84
94
|
|
85
95
|
/**
|
86
96
|
* Get the names of currently enabled plugins
|
97
|
+
* @deprecated - Plugins will be removed in the next major release
|
87
98
|
* @returns - The names of currently enabled plugins
|
88
99
|
*/
|
89
100
|
public get enabledPlugins() {
|
@@ -173,6 +184,17 @@ export class UnistylesRuntime {
|
|
173
184
|
return parseFloat(this.unistylesBridge.fontScale.toFixed(2))
|
174
185
|
}
|
175
186
|
|
187
|
+
/**
|
188
|
+
* Get the hairline width
|
189
|
+
* @returns - The thinnest width of the platform
|
190
|
+
*/
|
191
|
+
public get hairlineWidth() {
|
192
|
+
const pixelRatio = this.pixelRatio
|
193
|
+
const nearestPixel = Math.trunc(pixelRatio * 0.4) || 1
|
194
|
+
|
195
|
+
return nearestPixel / pixelRatio
|
196
|
+
}
|
197
|
+
|
176
198
|
/**
|
177
199
|
* Get the immersive mode (both status bar and navigation bar hidden (Android))
|
178
200
|
* @param isEnabled
|
@@ -231,6 +253,7 @@ export class UnistylesRuntime {
|
|
231
253
|
|
232
254
|
/**
|
233
255
|
* Enable a plugin
|
256
|
+
* @deprecated - Plugins will be removed in the next major release
|
234
257
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
235
258
|
*/
|
236
259
|
public addPlugin = (plugin: UnistylesPlugin) => {
|
@@ -239,6 +262,7 @@ export class UnistylesRuntime {
|
|
239
262
|
|
240
263
|
/**
|
241
264
|
* Disable a plugin
|
265
|
+
* @deprecated - Plugins will be removed in the next major release
|
242
266
|
* @param plugin - Plugin that conforms to UnistylesPlugin interface
|
243
267
|
*/
|
244
268
|
public removePlugin = (plugin: UnistylesPlugin) => {
|
@@ -28,7 +28,9 @@ export class UnistylesMockedRuntime {
|
|
28
28
|
},
|
29
29
|
orientation: this.orientation,
|
30
30
|
pixelRatio: this.pixelRatio,
|
31
|
-
fontScale: this.fontScale
|
31
|
+
fontScale: this.fontScale,
|
32
|
+
hairlineWidth: this.hairlineWidth,
|
33
|
+
rtl: this.rtl
|
32
34
|
}
|
33
35
|
}
|
34
36
|
|
@@ -62,6 +64,10 @@ export class UnistylesMockedRuntime {
|
|
62
64
|
: undefined
|
63
65
|
}
|
64
66
|
|
67
|
+
public get rtl() {
|
68
|
+
return false
|
69
|
+
}
|
70
|
+
|
65
71
|
public get breakpoints() {
|
66
72
|
return this.unistylesRegistry.breakpoints
|
67
73
|
}
|
@@ -90,6 +96,10 @@ export class UnistylesMockedRuntime {
|
|
90
96
|
return 1.0
|
91
97
|
}
|
92
98
|
|
99
|
+
public get hairlineWidth() {
|
100
|
+
return 0.333333
|
101
|
+
}
|
102
|
+
|
93
103
|
public get fontScale() {
|
94
104
|
return 1.0
|
95
105
|
}
|
package/src/index.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { unistyles } from './core'
|
2
2
|
import { mq } from './utils'
|
3
3
|
import { useInitialTheme } from './hooks'
|
4
|
-
import type { UnistylesPlugin, UnistylesValues, ExtractVariantNames } from './types'
|
4
|
+
import type { UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames } from './types'
|
5
5
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global'
|
6
6
|
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common'
|
7
7
|
import { useStyles } from './useStyles'
|
@@ -48,5 +48,8 @@ export type {
|
|
48
48
|
UnistylesBreakpoints,
|
49
49
|
UnistylesPlugin,
|
50
50
|
UnistylesValues,
|
51
|
+
UnistyleText,
|
52
|
+
UnistyleView,
|
53
|
+
UnistyleImage,
|
51
54
|
ExtractVariantNames as UnistylesVariants
|
52
55
|
}
|
package/src/types/index.ts
CHANGED
@@ -14,7 +14,10 @@ export type {
|
|
14
14
|
StyleSheetWithSuperPowers,
|
15
15
|
StyleSheet,
|
16
16
|
AllAvailableKeys,
|
17
|
-
UnistylesValues
|
17
|
+
UnistylesValues,
|
18
|
+
UnistyleText,
|
19
|
+
UnistyleView,
|
20
|
+
UnistyleImage
|
18
21
|
} from './stylesheet'
|
19
22
|
export type { ReactNativeStyleSheet } from './breakpoints'
|
20
23
|
export type { ExtractVariantNames } from './variants'
|
package/src/types/stylesheet.ts
CHANGED
@@ -6,9 +6,9 @@ import type { UnistylesMiniRuntime } from '../core'
|
|
6
6
|
// these props are treated differently to nest breakpoints and media queries
|
7
7
|
type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset'
|
8
8
|
|
9
|
-
type UnistyleView = Omit<ViewStyle, NestedKeys>
|
10
|
-
type UnistyleText = Omit<TextStyle, NestedKeys>
|
11
|
-
type UnistyleImage = Omit<ImageStyle, NestedKeys>
|
9
|
+
export type UnistyleView = Omit<ViewStyle, NestedKeys>
|
10
|
+
export type UnistyleText = Omit<TextStyle, NestedKeys>
|
11
|
+
export type UnistyleImage = Omit<ImageStyle, NestedKeys>
|
12
12
|
|
13
13
|
type UnistyleNestedStyles = {
|
14
14
|
shadowOffset?: ToDeepUnistyles<ShadowOffset>,
|
package/src/types/unistyles.ts
CHANGED