react-native-unistyles 2.0.0-rc.2 → 2.0.0-rc.3
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 +26 -2
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +29 -3
- package/cxx/UnistylesRuntime.cpp +10 -0
- package/cxx/UnistylesRuntime.h +10 -2
- package/ios/UnistylesHelpers.h +1 -0
- package/ios/UnistylesHelpers.mm +32 -0
- package/ios/UnistylesModule.mm +39 -2
- package/lib/commonjs/common.js +21 -1
- package/lib/commonjs/common.js.map +1 -1
- package/lib/commonjs/core/UnistylesModule.js +3 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -1
- package/lib/commonjs/core/UnistylesRuntime.js +8 -0
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/hooks/useUnistyles.js +8 -1
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/useStyles.js +1 -1
- package/lib/commonjs/useStyles.js.map +1 -1
- package/lib/module/common.js +20 -0
- package/lib/module/common.js.map +1 -1
- package/lib/module/core/UnistylesModule.js +3 -0
- package/lib/module/core/UnistylesModule.js.map +1 -1
- package/lib/module/core/UnistylesRuntime.js +8 -0
- package/lib/module/core/UnistylesRuntime.js.map +1 -1
- package/lib/module/hooks/useUnistyles.js +8 -1
- package/lib/module/hooks/useUnistyles.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/useStyles.js +1 -1
- package/lib/module/useStyles.js.map +1 -1
- package/lib/typescript/src/common.d.ts +19 -1
- package/lib/typescript/src/common.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +5 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts +1 -0
- package/lib/typescript/src/hooks/useUnistyles.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/unistyles.d.ts +9 -2
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common.ts +21 -1
- package/src/core/UnistylesModule.ts +3 -0
- package/src/core/UnistylesRuntime.ts +8 -0
- package/src/hooks/useUnistyles.ts +9 -2
- package/src/index.ts +3 -1
- package/src/types/unistyles.ts +10 -2
- package/src/useStyles.ts +1 -1
@@ -27,7 +27,8 @@ Java_com_unistyles_UnistylesModule_nativeInstall(
|
|
27
27
|
jlong jsi,
|
28
28
|
jint screenWidth,
|
29
29
|
jint screenHeight,
|
30
|
-
jstring colorScheme
|
30
|
+
jstring colorScheme,
|
31
|
+
jstring contentSizeCategory
|
31
32
|
) {
|
32
33
|
auto runtime = reinterpret_cast<facebook::jsi::Runtime *>(jsi);
|
33
34
|
|
@@ -43,10 +44,15 @@ Java_com_unistyles_UnistylesModule_nativeInstall(
|
|
43
44
|
std::string colorSchemeStr(colorSchemeChars);
|
44
45
|
env->ReleaseStringUTFChars(colorScheme, colorSchemeChars);
|
45
46
|
|
47
|
+
const char *contentSizeCategoryChars = env->GetStringUTFChars(contentSizeCategory, nullptr);
|
48
|
+
std::string contentSizeCategoryStr(contentSizeCategoryChars);
|
49
|
+
env->ReleaseStringUTFChars(contentSizeCategory, contentSizeCategoryChars);
|
50
|
+
|
46
51
|
unistylesRuntime = std::make_shared<UnistylesRuntime>(
|
47
52
|
screenWidth,
|
48
53
|
screenHeight,
|
49
|
-
colorSchemeStr
|
54
|
+
colorSchemeStr,
|
55
|
+
contentSizeCategoryStr
|
50
56
|
);
|
51
57
|
|
52
58
|
unistylesRuntime->onThemeChange([=](const std::string &theme) {
|
@@ -79,6 +85,16 @@ Java_com_unistyles_UnistylesModule_nativeInstall(
|
|
79
85
|
env->DeleteLocalRef(cls);
|
80
86
|
});
|
81
87
|
|
88
|
+
unistylesRuntime->onContentSizeCategoryChange([=](const std::string &contentSizeCategory) {
|
89
|
+
jstring contentSizeCategoryStr = env->NewStringUTF(contentSizeCategory.c_str());
|
90
|
+
jclass cls = env->GetObjectClass(unistylesModule);
|
91
|
+
jmethodID methodId = env->GetMethodID(cls, "onContentSizeCategoryChange", "(Ljava/lang/String;)V");
|
92
|
+
|
93
|
+
env->CallVoidMethod(unistylesModule, methodId, contentSizeCategoryStr);
|
94
|
+
env->DeleteLocalRef(contentSizeCategoryStr);
|
95
|
+
env->DeleteLocalRef(cls);
|
96
|
+
});
|
97
|
+
|
82
98
|
jsi::Object hostObject = jsi::Object::createFromHostObject(*runtime, unistylesRuntime);
|
83
99
|
|
84
100
|
runtime->global().setProperty(*runtime, "__UNISTYLES__", std::move(hostObject));
|
@@ -106,3 +122,11 @@ Java_com_unistyles_UnistylesModule_nativeOnAppearanceChange(JNIEnv *env, jobject
|
|
106
122
|
unistylesRuntime->handleAppearanceChange(env->GetStringUTFChars(colorScheme, nullptr));
|
107
123
|
}
|
108
124
|
}
|
125
|
+
|
126
|
+
extern "C"
|
127
|
+
JNIEXPORT void JNICALL
|
128
|
+
Java_com_unistyles_UnistylesModule_nativeOnContentSizeCategoryChange(JNIEnv *env, jobject thiz, jstring contentSizeCategory) {
|
129
|
+
if (unistylesRuntime != nullptr) {
|
130
|
+
unistylesRuntime->handleContentSizeCategoryChange(env->GetStringUTFChars(contentSizeCategory, nullptr));
|
131
|
+
}
|
132
|
+
}
|
@@ -15,6 +15,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
15
15
|
import com.facebook.react.bridge.ReactMethod
|
16
16
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
17
17
|
|
18
|
+
|
18
19
|
class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), LifecycleEventListener {
|
19
20
|
private val configurationChangeReceiver = object : BroadcastReceiver() {
|
20
21
|
override fun onReceive(context: Context, intent: Intent) {
|
@@ -54,6 +55,7 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
54
55
|
this.nativeOnAppearanceChange(
|
55
56
|
config["colorScheme"] as String
|
56
57
|
)
|
58
|
+
this.nativeOnContentSizeCategoryChange(config["contentSizeCategory"] as String)
|
57
59
|
}
|
58
60
|
}
|
59
61
|
|
@@ -64,11 +66,20 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
64
66
|
Configuration.UI_MODE_NIGHT_NO -> "light"
|
65
67
|
else -> "unspecified"
|
66
68
|
}
|
69
|
+
val fontScale = reactApplicationContext.resources.configuration.fontScale
|
70
|
+
val contentSizeCategory = when {
|
71
|
+
fontScale <= 0.85f -> "Small"
|
72
|
+
fontScale <= 1.0f -> "Default"
|
73
|
+
fontScale <= 1.15f -> "Large"
|
74
|
+
fontScale <= 1.3f -> "ExtraLarge"
|
75
|
+
else -> "Huge"
|
76
|
+
}
|
67
77
|
|
68
78
|
return mapOf(
|
69
79
|
"width" to (displayMetrics.widthPixels / displayMetrics.density).toInt(),
|
70
80
|
"height" to (displayMetrics.heightPixels / displayMetrics.density).toInt(),
|
71
|
-
"colorScheme" to colorScheme
|
81
|
+
"colorScheme" to colorScheme,
|
82
|
+
"contentSizeCategory" to contentSizeCategory
|
72
83
|
)
|
73
84
|
}
|
74
85
|
|
@@ -85,7 +96,8 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
85
96
|
it.get(),
|
86
97
|
config["width"] as Int,
|
87
98
|
config["height"] as Int,
|
88
|
-
config["colorScheme"] as String
|
99
|
+
config["colorScheme"] as String,
|
100
|
+
config["contentSizeCategory"] as String
|
89
101
|
)
|
90
102
|
|
91
103
|
Log.i(NAME, "Installed Unistyles \uD83E\uDD84!")
|
@@ -99,10 +111,11 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
99
111
|
}
|
100
112
|
}
|
101
113
|
|
102
|
-
private external fun nativeInstall(jsi: Long, width: Int, height: Int, colorScheme: String)
|
114
|
+
private external fun nativeInstall(jsi: Long, width: Int, height: Int, colorScheme: String, contentSizeCategory: String)
|
103
115
|
private external fun nativeDestroy()
|
104
116
|
private external fun nativeOnOrientationChange(width: Int, height: Int)
|
105
117
|
private external fun nativeOnAppearanceChange(colorScheme: String)
|
118
|
+
private external fun nativeOnContentSizeCategoryChange(contentSizeCategory: String)
|
106
119
|
|
107
120
|
//endregion
|
108
121
|
//region Event emitter
|
@@ -147,6 +160,19 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
147
160
|
.emit("__unistylesOnChange", body)
|
148
161
|
}
|
149
162
|
|
163
|
+
private fun onContentSizeCategoryChange(contentSizeCategory: String) {
|
164
|
+
val body = Arguments.createMap().apply {
|
165
|
+
putString("type", "dynamicTypeSize")
|
166
|
+
putMap("payload", Arguments.createMap().apply {
|
167
|
+
putString("contentSizeCategory", contentSizeCategory)
|
168
|
+
})
|
169
|
+
}
|
170
|
+
|
171
|
+
reactApplicationContext
|
172
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
173
|
+
.emit("__unistylesOnChange", body)
|
174
|
+
}
|
175
|
+
|
150
176
|
@ReactMethod
|
151
177
|
fun addListener(eventName: String?) = Unit
|
152
178
|
|
package/cxx/UnistylesRuntime.cpp
CHANGED
@@ -11,6 +11,7 @@ std::vector<jsi::PropNameID> UnistylesRuntime::getPropertyNames(jsi::Runtime& ru
|
|
11
11
|
// getters
|
12
12
|
properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("screenWidth")));
|
13
13
|
properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("screenHeight")));
|
14
|
+
properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("contentSizeCategory")));
|
14
15
|
properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("hasAdaptiveThemes")));
|
15
16
|
properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("themeName")));
|
16
17
|
properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("breakpoint")));
|
@@ -43,6 +44,10 @@ jsi::Value UnistylesRuntime::get(jsi::Runtime& runtime, const jsi::PropNameID& p
|
|
43
44
|
if (propName == "hasAdaptiveThemes") {
|
44
45
|
return jsi::Value(this->hasAdaptiveThemes);
|
45
46
|
}
|
47
|
+
|
48
|
+
if (propName == "contentSizeCategory") {
|
49
|
+
return jsi::Value(jsi::String::createFromUtf8(runtime, this->contentSizeCategory));
|
50
|
+
}
|
46
51
|
|
47
52
|
if (propName == "themeName") {
|
48
53
|
return !this->themeName.empty()
|
@@ -293,6 +298,11 @@ void UnistylesRuntime::handleAppearanceChange(std::string colorScheme) {
|
|
293
298
|
}
|
294
299
|
}
|
295
300
|
|
301
|
+
void UnistylesRuntime::handleContentSizeCategoryChange(std::string contentSizeCategory) {
|
302
|
+
this->contentSizeCategory = contentSizeCategory;
|
303
|
+
this->onContentSizeCategoryChangeCallback(contentSizeCategory);
|
304
|
+
}
|
305
|
+
|
296
306
|
jsi::Value UnistylesRuntime::getThemeOrFail(jsi::Runtime& runtime) {
|
297
307
|
if (this->themes.size() == 1) {
|
298
308
|
std::string themeName = this->themes.at(0);
|
package/cxx/UnistylesRuntime.h
CHANGED
@@ -20,18 +20,21 @@ class JSI_EXPORT UnistylesRuntime : public jsi::HostObject {
|
|
20
20
|
private:
|
21
21
|
std::function<void(std::string)> onThemeChangeCallback;
|
22
22
|
std::function<void(std::string breakpoint, std::string orientation, int screenWidth, int screenHeight)> onLayoutChangeCallback;
|
23
|
+
std::function<void(std::string)> onContentSizeCategoryChangeCallback;
|
23
24
|
std::function<void()> onPluginChangeCallback;
|
24
25
|
|
25
26
|
int screenWidth;
|
26
27
|
int screenHeight;
|
27
28
|
std::string colorScheme;
|
29
|
+
std::string contentSizeCategory;
|
28
30
|
|
29
31
|
public:
|
30
32
|
UnistylesRuntime(
|
31
33
|
int screenWidth,
|
32
34
|
int screenHeight,
|
33
|
-
std::string colorScheme
|
34
|
-
|
35
|
+
std::string colorScheme,
|
36
|
+
std::string contentSizeCategory
|
37
|
+
): screenWidth(screenWidth), screenHeight(screenHeight), colorScheme(colorScheme), contentSizeCategory(contentSizeCategory) {}
|
35
38
|
|
36
39
|
bool hasAdaptiveThemes;
|
37
40
|
bool supportsAutomaticColorScheme;
|
@@ -53,6 +56,10 @@ public:
|
|
53
56
|
void onPluginChange(std::function<void()> callback) {
|
54
57
|
this->onPluginChangeCallback = callback;
|
55
58
|
}
|
59
|
+
|
60
|
+
void onContentSizeCategoryChange(std::function<void(std::string)> callback) {
|
61
|
+
this->onContentSizeCategoryChangeCallback = callback;
|
62
|
+
}
|
56
63
|
|
57
64
|
jsi::Value get(jsi::Runtime&, const jsi::PropNameID& name) override;
|
58
65
|
void set(jsi::Runtime& runtime, const jsi::PropNameID& propNameId, const jsi::Value& value) override;
|
@@ -60,6 +67,7 @@ public:
|
|
60
67
|
|
61
68
|
void handleScreenSizeChange(int width, int height);
|
62
69
|
void handleAppearanceChange(std::string colorScheme);
|
70
|
+
void handleContentSizeCategoryChange(std::string contentSizeCategory);
|
63
71
|
|
64
72
|
jsi::Value getThemeOrFail(jsi::Runtime&);
|
65
73
|
std::string getBreakpointFromScreenWidth(int width, const std::vector<std::pair<std::string, double>>& sortedBreakpointEntries);
|
package/ios/UnistylesHelpers.h
CHANGED
package/ios/UnistylesHelpers.mm
CHANGED
@@ -15,6 +15,38 @@ std::string getColorScheme() {
|
|
15
15
|
}
|
16
16
|
}
|
17
17
|
|
18
|
+
std::string getContentSizeCategory(UIContentSizeCategory contentSizeCategory) {
|
19
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraExtraExtraLarge]) {
|
20
|
+
return std::string([@"xxxLarge" UTF8String]);
|
21
|
+
}
|
22
|
+
|
23
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraExtraLarge]) {
|
24
|
+
return std::string([@"xxLarge" UTF8String]);
|
25
|
+
}
|
26
|
+
|
27
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraLarge]) {
|
28
|
+
return std::string([@"xLarge" UTF8String]);
|
29
|
+
}
|
30
|
+
|
31
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryLarge]) {
|
32
|
+
return std::string([@"Large" UTF8String]);
|
33
|
+
}
|
34
|
+
|
35
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryMedium]) {
|
36
|
+
return std::string([@"Medium" UTF8String]);
|
37
|
+
}
|
38
|
+
|
39
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategorySmall]) {
|
40
|
+
return std::string([@"Small" UTF8String]);
|
41
|
+
}
|
42
|
+
|
43
|
+
if ([contentSizeCategory isEqualToString:UIContentSizeCategoryExtraSmall]) {
|
44
|
+
return std::string([@"xSmall" UTF8String]);
|
45
|
+
}
|
46
|
+
|
47
|
+
return std::string([@"unspecified" UTF8String]);
|
48
|
+
}
|
49
|
+
|
18
50
|
NSString* cxxStringToNSString(std::string cxxString) {
|
19
51
|
return [NSString stringWithUTF8String:cxxString.c_str()];
|
20
52
|
}
|
package/ios/UnistylesModule.mm
CHANGED
@@ -24,6 +24,10 @@ RCT_EXPORT_MODULE(Unistyles)
|
|
24
24
|
selector:@selector(appearanceChanged:)
|
25
25
|
name:RCTUserInterfaceStyleDidChangeNotification
|
26
26
|
object:nil];
|
27
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
28
|
+
selector:@selector(contentSizeCategoryDidChange:)
|
29
|
+
name:UIContentSizeCategoryDidChangeNotification
|
30
|
+
object:nil];
|
27
31
|
}
|
28
32
|
|
29
33
|
return self;
|
@@ -34,7 +38,15 @@ RCT_EXPORT_MODULE(Unistyles)
|
|
34
38
|
self.unistylesRuntime = nullptr;
|
35
39
|
}
|
36
40
|
|
37
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self
|
41
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self
|
42
|
+
name: UIContentSizeCategoryDidChangeNotification
|
43
|
+
object: nil];
|
44
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self
|
45
|
+
name: RCTUserInterfaceStyleDidChangeNotification
|
46
|
+
object: nil];
|
47
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self
|
48
|
+
name: UIDeviceOrientationDidChangeNotification
|
49
|
+
object: nil];
|
38
50
|
}
|
39
51
|
|
40
52
|
|
@@ -63,6 +75,14 @@ RCT_EXPORT_MODULE(Unistyles)
|
|
63
75
|
}
|
64
76
|
}
|
65
77
|
|
78
|
+
- (void)contentSizeCategoryDidChange:(NSNotification *)notification {
|
79
|
+
UIContentSizeCategory contentSizeCategory = [[UIApplication sharedApplication] preferredContentSizeCategory];
|
80
|
+
|
81
|
+
if (self.unistylesRuntime != nullptr) {
|
82
|
+
((UnistylesRuntime*)self.unistylesRuntime)->handleContentSizeCategoryChange(getContentSizeCategory(contentSizeCategory));
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
66
86
|
#pragma mark - Event emitter
|
67
87
|
- (NSArray<NSString *> *)supportedEvents {
|
68
88
|
return @[@"__unistylesOnChange"];
|
@@ -112,11 +132,17 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
|
|
112
132
|
CGFloat initialScreenWidth = [UIScreen mainScreen].bounds.size.width;
|
113
133
|
CGFloat initialScreenHeight = [UIScreen mainScreen].bounds.size.height;
|
114
134
|
std::string initialColorScheme = getColorScheme();
|
135
|
+
__block UIContentSizeCategory contentSizeCategory;
|
136
|
+
|
137
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
138
|
+
contentSizeCategory = [[UIApplication sharedApplication] preferredContentSizeCategory];
|
139
|
+
});
|
115
140
|
|
116
141
|
auto unistylesRuntime = std::make_shared<UnistylesRuntime>(
|
117
142
|
(int)initialScreenWidth,
|
118
143
|
(int)initialScreenHeight,
|
119
|
-
initialColorScheme
|
144
|
+
initialColorScheme,
|
145
|
+
getContentSizeCategory(contentSizeCategory)
|
120
146
|
);
|
121
147
|
|
122
148
|
unistylesRuntime.get()->onThemeChange([=](std::string theme) {
|
@@ -155,6 +181,17 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
|
|
155
181
|
[weakSelf emitEvent:@"__unistylesOnChange" withBody:body];
|
156
182
|
});
|
157
183
|
});
|
184
|
+
|
185
|
+
unistylesRuntime.get()->onContentSizeCategoryChange([=](std::string contentSizeCategory) {
|
186
|
+
NSDictionary *body = @{
|
187
|
+
@"type": @"dynamicTypeSize",
|
188
|
+
@"payload": @{
|
189
|
+
@"contentSizeCategory": cxxStringToNSString(contentSizeCategory)
|
190
|
+
}
|
191
|
+
};
|
192
|
+
|
193
|
+
[weakSelf emitEvent:@"__unistylesOnChange" withBody:body];
|
194
|
+
});
|
158
195
|
|
159
196
|
weakSelf.unistylesRuntime = unistylesRuntime.get();
|
160
197
|
|
package/lib/commonjs/common.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.warn = exports.isWeb = exports.isServer = exports.isMobile = exports.isIOS = exports.isAndroid = exports.UnistylesEventType = exports.UnistylesError = exports.ScreenOrientation = void 0;
|
6
|
+
exports.warn = exports.isWeb = exports.isServer = exports.isMobile = exports.isIOS = exports.isAndroid = exports.UnistylesEventType = exports.UnistylesError = exports.ScreenOrientation = exports.IOSContentSizeCategory = exports.AndroidContentSizeCategory = void 0;
|
7
7
|
var _reactNative = require("react-native");
|
8
8
|
const warn = message => {
|
9
9
|
console.warn(`🦄 [react-native-unistyles]: ${message}`);
|
@@ -18,10 +18,30 @@ const ScreenOrientation = exports.ScreenOrientation = {
|
|
18
18
|
Landscape: 'landscape',
|
19
19
|
Portrait: 'portrait'
|
20
20
|
};
|
21
|
+
let IOSContentSizeCategory = exports.IOSContentSizeCategory = /*#__PURE__*/function (IOSContentSizeCategory) {
|
22
|
+
IOSContentSizeCategory["ExtraExtraExtraLarge"] = "xxxLarge";
|
23
|
+
IOSContentSizeCategory["ExtraExtraLarge"] = "xxLarge";
|
24
|
+
IOSContentSizeCategory["ExtraLarge"] = "xLarge";
|
25
|
+
IOSContentSizeCategory["Large"] = "Large";
|
26
|
+
IOSContentSizeCategory["Medium"] = "Medium";
|
27
|
+
IOSContentSizeCategory["Small"] = "Small";
|
28
|
+
IOSContentSizeCategory["ExtraSmall"] = "xSmall";
|
29
|
+
IOSContentSizeCategory["Unspecified"] = "unspecified";
|
30
|
+
return IOSContentSizeCategory;
|
31
|
+
}({});
|
32
|
+
let AndroidContentSizeCategory = exports.AndroidContentSizeCategory = /*#__PURE__*/function (AndroidContentSizeCategory) {
|
33
|
+
AndroidContentSizeCategory["Small"] = "Small";
|
34
|
+
AndroidContentSizeCategory["Default"] = "Default";
|
35
|
+
AndroidContentSizeCategory["Large"] = "Large";
|
36
|
+
AndroidContentSizeCategory["ExtraLarge"] = "ExtraLarge";
|
37
|
+
AndroidContentSizeCategory["Huge"] = "Huge";
|
38
|
+
return AndroidContentSizeCategory;
|
39
|
+
}({});
|
21
40
|
let UnistylesEventType = exports.UnistylesEventType = /*#__PURE__*/function (UnistylesEventType) {
|
22
41
|
UnistylesEventType["Theme"] = "theme";
|
23
42
|
UnistylesEventType["Layout"] = "layout";
|
24
43
|
UnistylesEventType["Plugin"] = "plugin";
|
44
|
+
UnistylesEventType["DynamicTypeSize"] = "dynamicTypeSize";
|
25
45
|
return UnistylesEventType;
|
26
46
|
}({});
|
27
47
|
let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesError) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","warn","message","console","exports","isWeb","Platform","OS","isIOS","isAndroid","isMobile","isServer","window","ScreenOrientation","Landscape","Portrait","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEM,MAAMI,KAAK,GAAAD,OAAA,CAAAC,KAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMC,KAAK,GAAAJ,OAAA,CAAAI,KAAA,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAME,SAAS,GAAAL,OAAA,CAAAK,SAAA,GAAGH,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMG,QAAQ,GAAAN,OAAA,CAAAM,QAAA,GAAGF,KAAK,IAAIC,SAAS;AACnC,MAAME,QAAQ,GAAAP,OAAA,CAAAO,QAAA,GAAG,OAAOC,MAAM,KAAK,WAAW;AAE9C,MAAMC,iBAAiB,GAAAT,OAAA,CAAAS,iBAAA,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAAA,IAEEC,
|
1
|
+
{"version":3,"names":["_reactNative","require","warn","message","console","exports","isWeb","Platform","OS","isIOS","isAndroid","isMobile","isServer","window","ScreenOrientation","Landscape","Portrait","IOSContentSizeCategory","AndroidContentSizeCategory","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEM,MAAMI,KAAK,GAAAD,OAAA,CAAAC,KAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMC,KAAK,GAAAJ,OAAA,CAAAI,KAAA,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAME,SAAS,GAAAL,OAAA,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
|
#sortedBreakpointPairs = [];
|
23
23
|
#breakpoint = '';
|
24
|
+
#contentSizeCategory = 'unspecified';
|
24
25
|
constructor() {
|
25
26
|
if (!_common.isServer) {
|
26
27
|
this.setupListeners();
|
@@ -40,6 +41,8 @@ class UnistylesBridgeWeb {
|
|
40
41
|
return this.#screenWidth;
|
41
42
|
case 'screenHeight':
|
42
43
|
return this.#screenHeight;
|
44
|
+
case 'contentSizeCategory':
|
45
|
+
return this.#contentSizeCategory;
|
43
46
|
case 'breakpoint':
|
44
47
|
return this.#breakpoint || undefined;
|
45
48
|
case 'breakpoints':
|
@@ -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","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","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","width","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","height","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;EAE5CC,WAAWA,CAAA,EAAG;IACV,IAAI,
|
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","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","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","width","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","height","exports","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAA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EAAE;MAC9CC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEQ3B,eAAeA,CAAA,EAAG;IACtB,IAAI,CAAC,CAAC/B,eAAe,CAACyD,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,OAAO;MACbC,OAAO,EAAE;QACL/D,SAAS,EAAE,IAAI,CAAC,CAACA;MACrB;IACJ,CAAC,CAAC;EACN;EAEQkD,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAAC9C,eAAe,CAACyD,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;QACLtD,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5BuD,WAAW,EAAG,IAAI,CAAC,CAAC1E,WAAW,GAAe,IAAI,CAAC,CAACI,YAAuB,GACrE,WAAW,GACX,UAAU;QAChBuE,MAAM,EAAE;UACJX,KAAK,EAAE,IAAI,CAAC,CAAChE,WAAW;UACxB4E,MAAM,EAAE,IAAI,CAAC,CAACxE;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAACyE,OAAA,CAAAlF,kBAAA,GAAAA,kBAAA;AAEM,MAAMmF,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,IAAInF,kBAAkB,CAAC,CAAC"}
|
@@ -38,6 +38,14 @@ class UnistylesRuntime {
|
|
38
38
|
return this.unistylesBridge.themeName;
|
39
39
|
}
|
40
40
|
|
41
|
+
/**
|
42
|
+
* Get the current content size category
|
43
|
+
* @returns - The current content size category
|
44
|
+
*/
|
45
|
+
get contentSizeCategory() {
|
46
|
+
return this.unistylesBridge.contentSizeCategory;
|
47
|
+
}
|
48
|
+
|
41
49
|
/**
|
42
50
|
* Get the current breakpoint based on device size
|
43
51
|
* @returns - The current breakpoint
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","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,
|
1
|
+
{"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","contentSizeCategory","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","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,iBAA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E,QAAQ;EACrC;;EAEA;AACJ;AACA;AACA;AACA;EACWC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAIA,IAAI,KAAK,IAAI,CAACf,SAAS,EAAE;MACzB;IACJ;IAEA,IAAI,IAAI,CAACH,iBAAiB,CAACmB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAACnB,eAAe,CAACqB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;EACtD,CAAC;;EAED;AACJ;AACA;AACA;EACWC,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAC1B,eAAe,CAAC2B,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;;EAED;AACJ;AACA;AACA;EACWE,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAAC5B,iBAAiB,CAAC2B,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAC5B,iBAAiB,CAAC6B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAAjC,gBAAA,GAAAA,gBAAA"}
|
@@ -12,6 +12,7 @@ const unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeM
|
|
12
12
|
const useUnistyles = () => {
|
13
13
|
const [plugins, setPlugins] = (0, _react.useState)(_core.unistyles.runtime.enabledPlugins);
|
14
14
|
const [theme, setTheme] = (0, _react.useState)(_core.unistyles.registry.getTheme(_core.unistyles.runtime.themeName));
|
15
|
+
const [contentSizeCategory, setContentSizeCategory] = (0, _react.useState)(_core.unistyles.runtime.contentSizeCategory);
|
15
16
|
const [layout, setLayout] = (0, _react.useState)({
|
16
17
|
breakpoint: _core.unistyles.runtime.breakpoint,
|
17
18
|
orientation: _core.unistyles.runtime.orientation,
|
@@ -41,6 +42,11 @@ const useUnistyles = () => {
|
|
41
42
|
{
|
42
43
|
return setPlugins(_core.unistyles.runtime.enabledPlugins);
|
43
44
|
}
|
45
|
+
case _common.UnistylesEventType.DynamicTypeSize:
|
46
|
+
{
|
47
|
+
const dynamicTypeSizeEvent = event;
|
48
|
+
return setContentSizeCategory(dynamicTypeSizeEvent.payload.contentSizeCategory);
|
49
|
+
}
|
44
50
|
default:
|
45
51
|
return;
|
46
52
|
}
|
@@ -50,7 +56,8 @@ const useUnistyles = () => {
|
|
50
56
|
return {
|
51
57
|
plugins,
|
52
58
|
theme,
|
53
|
-
layout
|
59
|
+
layout,
|
60
|
+
contentSizeCategory
|
54
61
|
};
|
55
62
|
};
|
56
63
|
exports.useUnistyles = useUnistyles;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","plugins","setPlugins","useState","unistyles","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","UnistylesEventType","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAGA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAACC,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAL,eAAQ,EAACC,eAAS,CAACK,QAAQ,CAACC,QAAQ,CAACN,eAAS,CAACC,OAAO,CAACM,SAAS,CAAC,CAAC;EAC5F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,
|
1
|
+
{"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","plugins","setPlugins","useState","unistyles","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","contentSizeCategory","setContentSizeCategory","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","UnistylesEventType","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","DynamicTypeSize","dynamicTypeSizeEvent","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAGA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAACC,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAL,eAAQ,EAACC,eAAS,CAACK,QAAQ,CAACC,QAAQ,CAACN,eAAS,CAACC,OAAO,CAACM,SAAS,CAAC,CAAC;EAC5F,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GAAG,IAAAV,eAAQ,EAACC,eAAS,CAACC,OAAO,CAACO,mBAAmB,CAAC;EACrG,MAAM,CAACE,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAZ,eAAQ,EAAC;IACjCa,UAAU,EAAEZ,eAAS,CAACC,OAAO,CAACW,UAAU;IACxCC,WAAW,EAAEb,eAAS,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CAAC;AAAAyB,OAAA,CAAArC,YAAA,GAAAA,YAAA"}
|
package/lib/commonjs/index.js
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
Object.defineProperty(exports, "AndroidContentSizeCategory", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _common.AndroidContentSizeCategory;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "IOSContentSizeCategory", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _common.IOSContentSizeCategory;
|
16
|
+
}
|
17
|
+
});
|
6
18
|
Object.defineProperty(exports, "ScreenOrientation", {
|
7
19
|
enumerable: true,
|
8
20
|
get: function () {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_core","require","_utils","_hooks","_common","_useStyles","_createStyleSheet","UnistylesRegistry","exports","addThemes","unistyles","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_core","require","_utils","_hooks","_common","_useStyles","_createStyleSheet","UnistylesRegistry","exports","addThemes","unistyles","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACA;AACA,MAAMM,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EACtB;AACJ;AACA;AACA;EACIE,SAAS,EAAEC,eAAS,CAACC,QAAQ,CAACF,SAAS;EACvC;AACJ;AACA;AACA;EACIG,cAAc,EAAEF,eAAS,CAACC,QAAQ,CAACC,cAAc;EACjD;AACJ;AACA;AACA;EACIC,SAAS,EAAEH,eAAS,CAACC,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAAN,OAAA,CAAAM,gBAAA,GAAGJ,eAAS,CAACK,OAAO"}
|
@@ -28,7 +28,7 @@ const useStyles = (stylesheet, variantsMap) => {
|
|
28
28
|
if (typeof value === 'function') {
|
29
29
|
return {
|
30
30
|
...acc,
|
31
|
-
[key]: (0, _utils.proxifyFunction)(key, value)
|
31
|
+
[key]: (0, _utils.proxifyFunction)(key, value, variants)
|
32
32
|
};
|
33
33
|
}
|
34
34
|
return _reactNative.StyleSheet.create({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_utils","_hooks","_core","_common","useStyles","stylesheet","variantsMap","theme","layout","plugins","useUnistyles","variants","useVariants","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","key","value","proxifyFunction","StyleSheet","create","withPlugins","parseStyle","isWeb","unistyles","registry","config","experimentalCSSMediaQueries","useCSS","breakpoint","styles","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAGA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,mBAAY,EAAC,CAAC;EACjD,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAACN,WAAW,CAAC;EACzC,MAAMO,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOT,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMO,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BK,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAG,IAAAE,sBAAe,EAACF,GAAG,EAAEC,KAAK;
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_utils","_hooks","_core","_common","useStyles","stylesheet","variantsMap","theme","layout","plugins","useUnistyles","variants","useVariants","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","key","value","proxifyFunction","StyleSheet","create","withPlugins","parseStyle","isWeb","unistyles","registry","config","experimentalCSSMediaQueries","useCSS","breakpoint","styles","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAGA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,mBAAY,EAAC,CAAC;EACjD,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAACN,WAAW,CAAC;EACzC,MAAMO,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOT,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMO,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BK,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAG,IAAAE,sBAAe,EAACF,GAAG,EAAEC,KAAK,EAAEV,QAAQ;MAC/C,CAAC;IACL;IAEA,OAAOY,uBAAU,CAACC,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACC,GAAG,GAAG,IAAAK,kBAAW,EAACL,GAAG,EAAE,IAAAM,iBAAU,EAC9BL,KAAK,EACLV,QAAQ,EACR,CAACgB,aAAK,IAAI,CAACC,eAAS,CAACC,QAAQ,CAACC,MAAM,CAACC,2BAA2B,CACpE;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAClB,YAAY,EAAEF,QAAQ,EAAEF,OAAO,CAC5C,CAAC;EAED,IAAAuB,aAAM,EAACjB,iBAA8C,CAAC;EAEtD,OAAO;IACHR,KAAK;IACL0B,UAAU,EAAEzB,MAAM,CAACyB,UAAU;IAC7BC,MAAM,EAAEnB;EACZ,CAAC;AACL,CAAC;AAAAoB,OAAA,CAAA/B,SAAA,GAAAA,SAAA"}
|
package/lib/module/common.js
CHANGED
@@ -11,10 +11,30 @@ export const ScreenOrientation = {
|
|
11
11
|
Landscape: 'landscape',
|
12
12
|
Portrait: 'portrait'
|
13
13
|
};
|
14
|
+
export let IOSContentSizeCategory = /*#__PURE__*/function (IOSContentSizeCategory) {
|
15
|
+
IOSContentSizeCategory["ExtraExtraExtraLarge"] = "xxxLarge";
|
16
|
+
IOSContentSizeCategory["ExtraExtraLarge"] = "xxLarge";
|
17
|
+
IOSContentSizeCategory["ExtraLarge"] = "xLarge";
|
18
|
+
IOSContentSizeCategory["Large"] = "Large";
|
19
|
+
IOSContentSizeCategory["Medium"] = "Medium";
|
20
|
+
IOSContentSizeCategory["Small"] = "Small";
|
21
|
+
IOSContentSizeCategory["ExtraSmall"] = "xSmall";
|
22
|
+
IOSContentSizeCategory["Unspecified"] = "unspecified";
|
23
|
+
return IOSContentSizeCategory;
|
24
|
+
}({});
|
25
|
+
export let AndroidContentSizeCategory = /*#__PURE__*/function (AndroidContentSizeCategory) {
|
26
|
+
AndroidContentSizeCategory["Small"] = "Small";
|
27
|
+
AndroidContentSizeCategory["Default"] = "Default";
|
28
|
+
AndroidContentSizeCategory["Large"] = "Large";
|
29
|
+
AndroidContentSizeCategory["ExtraLarge"] = "ExtraLarge";
|
30
|
+
AndroidContentSizeCategory["Huge"] = "Huge";
|
31
|
+
return AndroidContentSizeCategory;
|
32
|
+
}({});
|
14
33
|
export let UnistylesEventType = /*#__PURE__*/function (UnistylesEventType) {
|
15
34
|
UnistylesEventType["Theme"] = "theme";
|
16
35
|
UnistylesEventType["Layout"] = "layout";
|
17
36
|
UnistylesEventType["Plugin"] = "plugin";
|
37
|
+
UnistylesEventType["DynamicTypeSize"] = "dynamicTypeSize";
|
18
38
|
return UnistylesEventType;
|
19
39
|
}({});
|
20
40
|
export let UnistylesError = /*#__PURE__*/function (UnistylesError) {
|
package/lib/module/common.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Platform","warn","message","console","isWeb","OS","isIOS","isAndroid","isMobile","isServer","window","ScreenOrientation","Landscape","Portrait","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAME,KAAK,GAAGJ,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAMC,KAAK,GAAGN,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAME,SAAS,GAAGP,QAAQ,CAACK,EAAE,KAAK,SAAS;AAClD,OAAO,MAAMG,QAAQ,GAAGF,KAAK,IAAIC,SAAS;AAC1C,OAAO,MAAME,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;AAErD,OAAO,MAAMC,iBAAiB,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAEV,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;
|
1
|
+
{"version":3,"names":["Platform","warn","message","console","isWeb","OS","isIOS","isAndroid","isMobile","isServer","window","ScreenOrientation","Landscape","Portrait","IOSContentSizeCategory","AndroidContentSizeCategory","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAME,KAAK,GAAGJ,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAMC,KAAK,GAAGN,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAME,SAAS,GAAGP,QAAQ,CAACK,EAAE,KAAK,SAAS;AAClD,OAAO,MAAMG,QAAQ,GAAGF,KAAK,IAAIC,SAAS;AAC1C,OAAO,MAAME,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;AAErD,OAAO,MAAMC,iBAAiB,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAEV,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAWlC,WAAYC,0BAA0B,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;AAQtC,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAO9B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
@@ -15,6 +15,7 @@ export class UnistylesBridgeWeb {
|
|
15
15
|
#unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
|
16
16
|
#sortedBreakpointPairs = [];
|
17
17
|
#breakpoint = '';
|
18
|
+
#contentSizeCategory = 'unspecified';
|
18
19
|
constructor() {
|
19
20
|
if (!isServer) {
|
20
21
|
this.setupListeners();
|
@@ -34,6 +35,8 @@ export class UnistylesBridgeWeb {
|
|
34
35
|
return this.#screenWidth;
|
35
36
|
case 'screenHeight':
|
36
37
|
return this.#screenHeight;
|
38
|
+
case 'contentSizeCategory':
|
39
|
+
return this.#contentSizeCategory;
|
37
40
|
case 'breakpoint':
|
38
41
|
return this.#breakpoint || undefined;
|
39
42
|
case 'breakpoints':
|
@@ -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","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","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","width","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","height","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;EAE5CC,WAAWA,CAAA,EAAG;IACV,IAAI,
|
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","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","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","width","find","value","index","otherBreakpoints","minVal","maxVal","emit","type","payload","orientation","screen","height","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,GAAy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,EAAE,QAAQ;MACdC,OAAO,EAAE;QACLtD,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5BuD,WAAW,EAAG,IAAI,CAAC,CAACtE,WAAW,GAAe,IAAI,CAAC,CAACG,YAAuB,GACrE,WAAW,GACX,UAAU;QAChBoE,MAAM,EAAE;UACJX,KAAK,EAAE,IAAI,CAAC,CAAC5D,WAAW;UACxBwE,MAAM,EAAE,IAAI,CAAC,CAACrE;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMsE,eAAe,GAAG,IAAI9E,kBAAkB,CAAC,CAAC"}
|
@@ -32,6 +32,14 @@ export class UnistylesRuntime {
|
|
32
32
|
return this.unistylesBridge.themeName;
|
33
33
|
}
|
34
34
|
|
35
|
+
/**
|
36
|
+
* Get the current content size category
|
37
|
+
* @returns - The current content size category
|
38
|
+
*/
|
39
|
+
get contentSizeCategory() {
|
40
|
+
return this.unistylesBridge.contentSizeCategory;
|
41
|
+
}
|
42
|
+
|
35
43
|
/**
|
36
44
|
* Get the current breakpoint based on device size
|
37
45
|
* @returns - The current breakpoint
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","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,
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","contentSizeCategory","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","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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MAAe,IAAK;IAC5C,IAAI,CAACxB,eAAe,CAACyB,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;;EAED;AACJ;AACA;AACA;EACWE,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAAC1B,iBAAiB,CAACyB,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAC1B,iBAAiB,CAAC2B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL"}
|
@@ -6,6 +6,7 @@ const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
|
|
6
6
|
export const useUnistyles = () => {
|
7
7
|
const [plugins, setPlugins] = useState(unistyles.runtime.enabledPlugins);
|
8
8
|
const [theme, setTheme] = useState(unistyles.registry.getTheme(unistyles.runtime.themeName));
|
9
|
+
const [contentSizeCategory, setContentSizeCategory] = useState(unistyles.runtime.contentSizeCategory);
|
9
10
|
const [layout, setLayout] = useState({
|
10
11
|
breakpoint: unistyles.runtime.breakpoint,
|
11
12
|
orientation: unistyles.runtime.orientation,
|
@@ -35,6 +36,11 @@ export const useUnistyles = () => {
|
|
35
36
|
{
|
36
37
|
return setPlugins(unistyles.runtime.enabledPlugins);
|
37
38
|
}
|
39
|
+
case UnistylesEventType.DynamicTypeSize:
|
40
|
+
{
|
41
|
+
const dynamicTypeSizeEvent = event;
|
42
|
+
return setContentSizeCategory(dynamicTypeSizeEvent.payload.contentSizeCategory);
|
43
|
+
}
|
38
44
|
default:
|
39
45
|
return;
|
40
46
|
}
|
@@ -44,7 +50,8 @@ export const useUnistyles = () => {
|
|
44
50
|
return {
|
45
51
|
plugins,
|
46
52
|
theme,
|
47
|
-
layout
|
53
|
+
layout,
|
54
|
+
contentSizeCategory
|
48
55
|
};
|
49
56
|
};
|
50
57
|
//# sourceMappingURL=useUnistyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","UnistylesEventType","unistylesEvents","Unistyles","useUnistyles","plugins","setPlugins","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","remove"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,kBAAkB,QAAQ,WAAW;AAG9C,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGP,QAAQ,CAACC,SAAS,CAACO,OAAO,CAACC,cAAc,CAAC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGX,QAAQ,CAACC,SAAS,CAACW,QAAQ,CAACC,QAAQ,CAACZ,SAAS,CAACO,OAAO,CAACM,SAAS,CAAC,CAAC;EAC5F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","UnistylesEventType","unistylesEvents","Unistyles","useUnistyles","plugins","setPlugins","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","contentSizeCategory","setContentSizeCategory","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","DynamicTypeSize","dynamicTypeSizeEvent","remove"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ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AAKZ,kBAAkB,CAAC8B,MAAM;UAAE;YAC5B,MAAMC,WAAW,GAAGN,KAAmC;YAEvD,OAAOT,SAAS,CAAC;cACbC,UAAU,EAAEc,WAAW,CAACF,OAAO,CAACZ,UAAU;cAC1CC,WAAW,EAAEa,WAAW,CAACF,OAAO,CAACX,WAAW;cAC5CC,UAAU,EAAEY,WAAW,CAACF,OAAO,CAACR;YACpC,CAAC,CAAC;UACN;QACA,KAAKrB,kBAAkB,CAACgC,MAAM;UAAE;YAC5B,OAAO3B,UAAU,CAACN,SAAS,CAACO,OAAO,CAACC,cAAc,CAAC;UACvD;QACA,KAAKP,kBAAkB,CAACiC,eAAe;UAAE;YACrC,MAAMC,oBAAoB,GAAGT,KAAsC;YAEnE,OAAOX,sBAAsB,CAACoB,oBAAoB,CAACL,OAAO,CAAChB,mBAAmB,CAAC;UACnF;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOU,YAAY,CAACY,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH/B,OAAO;IACPI,KAAK;IACLO,MAAM;IACNF;EACJ,CAAC;AACL,CAAC"}
|
package/lib/module/index.js
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 { ScreenOrientation } from './common';
|
4
|
+
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common';
|
5
5
|
import { useStyles } from './useStyles';
|
6
6
|
import { createStyleSheet } from './createStyleSheet';
|
7
7
|
|
@@ -27,5 +27,5 @@ const UnistylesRegistry = {
|
|
27
27
|
addConfig: unistyles.registry.addConfig
|
28
28
|
};
|
29
29
|
const UnistylesRuntime = unistyles.runtime;
|
30
|
-
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
30
|
+
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesRegistry, UnistylesRuntime };
|
31
31
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["unistyles","mq","useInitialTheme","ScreenOrientation","useStyles","createStyleSheet","UnistylesRegistry","addThemes","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,SAAS;AAGzC,SAASC,iBAAiB,QAAQ,UAAU;
|
1
|
+
{"version":3,"names":["unistyles","mq","useInitialTheme","ScreenOrientation","AndroidContentSizeCategory","IOSContentSizeCategory","useStyles","createStyleSheet","UnistylesRegistry","addThemes","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,SAAS;AAGzC,SAASC,iBAAiB,EAAEC,0BAA0B,EAAEC,sBAAsB,QAAQ,UAAU;AAChG,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAG;EACtB;AACJ;AACA;AACA;EACIC,SAAS,EAAET,SAAS,CAACU,QAAQ,CAACD,SAAS;EACvC;AACJ;AACA;AACA;EACIE,cAAc,EAAEX,SAAS,CAACU,QAAQ,CAACC,cAAc;EACjD;AACJ;AACA;AACA;EACIC,SAAS,EAAEZ,SAAS,CAACU,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAGb,SAAS,CAACc,OAAO;AAE1C,SACIb,EAAE,EACFK,SAAS,EACTJ,eAAe,EACfK,gBAAgB,EAChBJ,iBAAiB,EACjBC,0BAA0B,EAC1BC,sBAAsB,EACtBG,iBAAiB,EACjBK,gBAAgB"}
|
package/lib/module/useStyles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","withPlugins","useCSS","useUnistyles","useVariants","unistyles","isWeb","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","key","value","create","registry","config","experimentalCSSMediaQueries","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAClE,SAASC,MAAM,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAG3D,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,KAAK,QAAQ,UAAU;AAQhC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGT,YAAY,CAAC,CAAC;EACjD,MAAMU,QAAQ,GAAGT,WAAW,CAACK,WAAW,CAAC;EACzC,MAAMK,YAAY,GAAGjB,OAAO,CAAC,MAAM,OAAOW,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMI,iBAAiB,GAAGlB,OAAO,CAAC,MAAMmB,MAAM,CACzCC,OAAO,CAACH,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BI,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAGpB,eAAe,CAACoB,GAAG,EAAEC,KAAK;
|
1
|
+
{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","withPlugins","useCSS","useUnistyles","useVariants","unistyles","isWeb","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","key","value","create","registry","config","experimentalCSSMediaQueries","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAClE,SAASC,MAAM,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAG3D,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,KAAK,QAAQ,UAAU;AAQhC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGT,YAAY,CAAC,CAAC;EACjD,MAAMU,QAAQ,GAAGT,WAAW,CAACK,WAAW,CAAC;EACzC,MAAMK,YAAY,GAAGjB,OAAO,CAAC,MAAM,OAAOW,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMI,iBAAiB,GAAGlB,OAAO,CAAC,MAAMmB,MAAM,CACzCC,OAAO,CAACH,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BI,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAGpB,eAAe,CAACoB,GAAG,EAAEC,KAAK,EAAER,QAAQ;MAC/C,CAAC;IACL;IAEA,OAAOf,UAAU,CAACwB,MAAM,CAAC;MACrB,GAAGH,GAAG;MACN,CAACC,GAAG,GAAGnB,WAAW,CAACmB,GAAG,EAAErB,UAAU,CAC9BsB,KAAK,EACLR,QAAQ,EACR,CAACP,KAAK,IAAI,CAACD,SAAS,CAACkB,QAAQ,CAACC,MAAM,CAACC,2BAA2B,CACpE;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACX,YAAY,EAAED,QAAQ,EAAED,OAAO,CAC5C,CAAC;EAEDV,MAAM,CAACa,iBAA8C,CAAC;EAEtD,OAAO;IACHL,KAAK;IACLgB,UAAU,EAAEf,MAAM,CAACe,UAAU;IAC7BC,MAAM,EAAEZ;EACZ,CAAC;AACL,CAAC"}
|
@@ -8,10 +8,28 @@ export declare const ScreenOrientation: {
|
|
8
8
|
readonly Landscape: "landscape";
|
9
9
|
readonly Portrait: "portrait";
|
10
10
|
};
|
11
|
+
export declare enum IOSContentSizeCategory {
|
12
|
+
ExtraExtraExtraLarge = "xxxLarge",
|
13
|
+
ExtraExtraLarge = "xxLarge",
|
14
|
+
ExtraLarge = "xLarge",
|
15
|
+
Large = "Large",
|
16
|
+
Medium = "Medium",
|
17
|
+
Small = "Small",
|
18
|
+
ExtraSmall = "xSmall",
|
19
|
+
Unspecified = "unspecified"
|
20
|
+
}
|
21
|
+
export declare enum AndroidContentSizeCategory {
|
22
|
+
Small = "Small",
|
23
|
+
Default = "Default",
|
24
|
+
Large = "Large",
|
25
|
+
ExtraLarge = "ExtraLarge",
|
26
|
+
Huge = "Huge"
|
27
|
+
}
|
11
28
|
export declare enum UnistylesEventType {
|
12
29
|
Theme = "theme",
|
13
30
|
Layout = "layout",
|
14
|
-
Plugin = "plugin"
|
31
|
+
Plugin = "plugin",
|
32
|
+
DynamicTypeSize = "dynamicTypeSize"
|
15
33
|
}
|
16
34
|
export declare enum UnistylesError {
|
17
35
|
RuntimeUnavailable = "Unistyles runtime is not available. Make sure you followed the installation instructions",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAqB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAqB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,sBAAsB;IAC9B,oBAAoB,aAAa;IACjC,eAAe,YAAY;IAC3B,UAAU,WAAW;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,UAAU,WAAW;IACrB,WAAW,gBAAgB;CAC9B;AAED,oBAAY,0BAA0B;IAClC,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,IAAI,SAAS;CAChB;AAED,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,eAAe,oBAAoB;CACtC;AAED,oBAAY,cAAc;IACtB,kBAAkB,6FAA6F;IAC/G,aAAa,gFAAgF;IAC7F,kBAAkB,iFAAiF;IACnG,gBAAgB,wEAAyE;IACzF,mBAAmB,mDAAmD;IACtE,wBAAwB,wDAAwD;IAChF,4BAA4B,mEAAoE;IAChG,iBAAiB,6DAA8D;IAC/E,mBAAmB,+EAA+E;IAClG,wBAAwB,0DAA0D;CACrF"}
|
@@ -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;;;IAwBpB,OAAO;IA+Dd,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAShB,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"}
|
@@ -23,6 +23,11 @@ export declare class UnistylesRuntime {
|
|
23
23
|
* @returns - The current theme name
|
24
24
|
*/
|
25
25
|
get themeName(): never;
|
26
|
+
/**
|
27
|
+
* Get the current content size category
|
28
|
+
* @returns - The current content size category
|
29
|
+
*/
|
30
|
+
get contentSizeCategory(): import("../common").IOSContentSizeCategory | import("../common").AndroidContentSizeCategory;
|
26
31
|
/**
|
27
32
|
* Get the current breakpoint based on device size
|
28
33
|
* @returns - The current breakpoint
|
@@ -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,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;;OAIG;IACI,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAED;;;OAGG;IACI,iBAAiB,WAAY,OAAO,UAE1C;IAED;;;OAGG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;OAGG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
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,WAAW,6BAQrB;IAED;;;;OAIG;IACI,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAED;;;OAGG;IACI,iBAAiB,WAAY,OAAO,UAE1C;IAED;;;OAGG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;OAGG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY
|
1
|
+
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;;CAuDxB,CAAA"}
|
@@ -2,7 +2,7 @@ import { mq } from './utils';
|
|
2
2
|
import { useInitialTheme } from './hooks';
|
3
3
|
import type { UnistylesPlugin } from './types';
|
4
4
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
5
|
-
import { ScreenOrientation } from './common';
|
5
|
+
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common';
|
6
6
|
import { useStyles } from './useStyles';
|
7
7
|
import { createStyleSheet } from './createStyleSheet';
|
8
8
|
/**
|
@@ -72,6 +72,6 @@ declare const UnistylesRegistry: {
|
|
72
72
|
};
|
73
73
|
};
|
74
74
|
declare const UnistylesRuntime: import("./core").UnistylesRuntime;
|
75
|
-
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
75
|
+
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesRegistry, UnistylesRuntime };
|
76
76
|
export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin };
|
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,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,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,MAAM,SAAS,CAAA;AAC9C,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,EAClB,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { UnistylesEventType, ScreenOrientation } from '../common';
|
1
|
+
import { UnistylesEventType, ScreenOrientation, IOSContentSizeCategory, AndroidContentSizeCategory } from '../common';
|
2
2
|
import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
|
3
3
|
import type { ScreenSize } from './core';
|
4
4
|
import type { UnistylesPlugin } from './plugin';
|
@@ -17,6 +17,7 @@ export type UnistylesBridge = {
|
|
17
17
|
themeName: keyof UnistylesThemes;
|
18
18
|
breakpoint: keyof UnistylesBreakpoints;
|
19
19
|
colorScheme: ColorSchemeName;
|
20
|
+
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory;
|
20
21
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
21
22
|
themes: Array<keyof UnistylesThemes>;
|
22
23
|
useBreakpoints(breakpoints: UnistylesBreakpoints): void;
|
@@ -42,5 +43,11 @@ export type UnistylesMobileLayoutEvent = {
|
|
42
43
|
export type UnistylesPluginEvent = {
|
43
44
|
type: UnistylesEventType.Plugin;
|
44
45
|
};
|
45
|
-
export type
|
46
|
+
export type UnistylesDynamicTypeSizeEvent = {
|
47
|
+
type: UnistylesEventType.DynamicTypeSize;
|
48
|
+
payload: {
|
49
|
+
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory;
|
50
|
+
};
|
51
|
+
};
|
52
|
+
export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent | UnistylesPluginEvent | UnistylesDynamicTypeSizeEvent;
|
46
53
|
//# sourceMappingURL=unistyles.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;
|
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,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;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,MAAM,eAAe,CAAC;I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,0BAA0B,CAAA;KAC3E,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,oBAAoB,GAAG,6BAA6B,CAAA"}
|
package/package.json
CHANGED
package/src/common.ts
CHANGED
@@ -15,10 +15,30 @@ export const ScreenOrientation = {
|
|
15
15
|
Portrait: 'portrait'
|
16
16
|
} as const
|
17
17
|
|
18
|
+
export enum IOSContentSizeCategory {
|
19
|
+
ExtraExtraExtraLarge = 'xxxLarge',
|
20
|
+
ExtraExtraLarge = 'xxLarge',
|
21
|
+
ExtraLarge = 'xLarge',
|
22
|
+
Large = 'Large',
|
23
|
+
Medium = 'Medium',
|
24
|
+
Small = 'Small',
|
25
|
+
ExtraSmall = 'xSmall',
|
26
|
+
Unspecified = 'unspecified'
|
27
|
+
}
|
28
|
+
|
29
|
+
export enum AndroidContentSizeCategory {
|
30
|
+
Small = 'Small',
|
31
|
+
Default = 'Default',
|
32
|
+
Large = 'Large',
|
33
|
+
ExtraLarge = 'ExtraLarge',
|
34
|
+
Huge = 'Huge'
|
35
|
+
}
|
36
|
+
|
18
37
|
export enum UnistylesEventType {
|
19
38
|
Theme = 'theme',
|
20
39
|
Layout = 'layout',
|
21
|
-
Plugin = 'plugin'
|
40
|
+
Plugin = 'plugin',
|
41
|
+
DynamicTypeSize = 'dynamicTypeSize'
|
22
42
|
}
|
23
43
|
|
24
44
|
export enum UnistylesError {
|
@@ -18,6 +18,7 @@ export class UnistylesBridgeWeb {
|
|
18
18
|
#unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles)
|
19
19
|
#sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, number]> = []
|
20
20
|
#breakpoint: keyof UnistylesBreakpoints = '' as keyof UnistylesBreakpoints
|
21
|
+
#contentSizeCategory: string = 'unspecified'
|
21
22
|
|
22
23
|
constructor() {
|
23
24
|
if (!isServer) {
|
@@ -39,6 +40,8 @@ export class UnistylesBridgeWeb {
|
|
39
40
|
return this.#screenWidth
|
40
41
|
case 'screenHeight':
|
41
42
|
return this.#screenHeight
|
43
|
+
case 'contentSizeCategory':
|
44
|
+
return this.#contentSizeCategory
|
42
45
|
case 'breakpoint':
|
43
46
|
return this.#breakpoint || undefined
|
44
47
|
case 'breakpoints':
|
@@ -33,6 +33,14 @@ export class UnistylesRuntime {
|
|
33
33
|
return this.unistylesBridge.themeName
|
34
34
|
}
|
35
35
|
|
36
|
+
/**
|
37
|
+
* Get the current content size category
|
38
|
+
* @returns - The current content size category
|
39
|
+
*/
|
40
|
+
public get contentSizeCategory() {
|
41
|
+
return this.unistylesBridge.contentSizeCategory
|
42
|
+
}
|
43
|
+
|
36
44
|
/**
|
37
45
|
* Get the current breakpoint based on device size
|
38
46
|
* @returns - The current breakpoint
|
@@ -2,13 +2,14 @@ import { NativeEventEmitter, NativeModules } from 'react-native'
|
|
2
2
|
import { useEffect, useState } from 'react'
|
3
3
|
import { unistyles } from '../core'
|
4
4
|
import { UnistylesEventType } from '../common'
|
5
|
-
import type { UnistylesEvents, UnistylesMobileLayoutEvent, UnistylesThemeEvent } from '../types'
|
5
|
+
import type { UnistylesDynamicTypeSizeEvent, UnistylesEvents, UnistylesMobileLayoutEvent, UnistylesThemeEvent } from '../types'
|
6
6
|
|
7
7
|
const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles)
|
8
8
|
|
9
9
|
export const useUnistyles = () => {
|
10
10
|
const [plugins, setPlugins] = useState(unistyles.runtime.enabledPlugins)
|
11
11
|
const [theme, setTheme] = useState(unistyles.registry.getTheme(unistyles.runtime.themeName))
|
12
|
+
const [contentSizeCategory, setContentSizeCategory] = useState(unistyles.runtime.contentSizeCategory)
|
12
13
|
const [layout, setLayout] = useState({
|
13
14
|
breakpoint: unistyles.runtime.breakpoint,
|
14
15
|
orientation: unistyles.runtime.orientation,
|
@@ -40,6 +41,11 @@ export const useUnistyles = () => {
|
|
40
41
|
case UnistylesEventType.Plugin: {
|
41
42
|
return setPlugins(unistyles.runtime.enabledPlugins)
|
42
43
|
}
|
44
|
+
case UnistylesEventType.DynamicTypeSize: {
|
45
|
+
const dynamicTypeSizeEvent = event as UnistylesDynamicTypeSizeEvent
|
46
|
+
|
47
|
+
return setContentSizeCategory(dynamicTypeSizeEvent.payload.contentSizeCategory)
|
48
|
+
}
|
43
49
|
default:
|
44
50
|
return
|
45
51
|
}
|
@@ -52,6 +58,7 @@ export const useUnistyles = () => {
|
|
52
58
|
return {
|
53
59
|
plugins,
|
54
60
|
theme,
|
55
|
-
layout
|
61
|
+
layout,
|
62
|
+
contentSizeCategory
|
56
63
|
}
|
57
64
|
}
|
package/src/index.ts
CHANGED
@@ -3,7 +3,7 @@ import { mq } from './utils'
|
|
3
3
|
import { useInitialTheme } from './hooks'
|
4
4
|
import type { UnistylesPlugin } from './types'
|
5
5
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global'
|
6
|
-
import { ScreenOrientation } from './common'
|
6
|
+
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common'
|
7
7
|
import { useStyles } from './useStyles'
|
8
8
|
import { createStyleSheet } from './createStyleSheet'
|
9
9
|
|
@@ -37,6 +37,8 @@ export {
|
|
37
37
|
useInitialTheme,
|
38
38
|
createStyleSheet,
|
39
39
|
ScreenOrientation,
|
40
|
+
AndroidContentSizeCategory,
|
41
|
+
IOSContentSizeCategory,
|
40
42
|
UnistylesRegistry,
|
41
43
|
UnistylesRuntime
|
42
44
|
}
|
package/src/types/unistyles.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { UnistylesEventType, ScreenOrientation } from '../common'
|
1
|
+
import { UnistylesEventType, ScreenOrientation, IOSContentSizeCategory, AndroidContentSizeCategory } from '../common'
|
2
2
|
import type { UnistylesThemes, UnistylesBreakpoints } from '../global'
|
3
3
|
import type { ScreenSize } from './core'
|
4
4
|
import type { UnistylesPlugin } from './plugin'
|
@@ -21,6 +21,7 @@ export type UnistylesBridge = {
|
|
21
21
|
themeName: keyof UnistylesThemes,
|
22
22
|
breakpoint: keyof UnistylesBreakpoints,
|
23
23
|
colorScheme: ColorSchemeName,
|
24
|
+
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory,
|
24
25
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>,
|
25
26
|
|
26
27
|
// setters
|
@@ -52,4 +53,11 @@ export type UnistylesPluginEvent = {
|
|
52
53
|
type: UnistylesEventType.Plugin
|
53
54
|
}
|
54
55
|
|
55
|
-
export type
|
56
|
+
export type UnistylesDynamicTypeSizeEvent = {
|
57
|
+
type: UnistylesEventType.DynamicTypeSize,
|
58
|
+
payload: {
|
59
|
+
contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent | UnistylesPluginEvent | UnistylesDynamicTypeSizeEvent
|