react-native-unistyles 3.0.0-alpha.34 → 3.0.0-alpha.36
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +31 -36
- package/android/build.gradle +2 -1
- package/android/src/main/cxx/NativeUnistylesModule.cpp +71 -0
- package/android/src/main/cxx/NativeUnistylesModule.h +42 -0
- package/android/src/main/cxx/cpp-adapter.cpp +8 -86
- package/android/src/main/java/com/unistyles/NativePlatform.kt +184 -0
- package/android/src/main/java/com/unistyles/UnistylesModule+insets.kt +8 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +47 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +16 -14
- package/cxx/NativePlatform.h +11 -0
- package/cxx/common/Helpers.h +1 -1
- package/cxx/core/Unistyle.h +1 -1
- package/cxx/core/UnistylesRegistry.h +1 -1
- package/cxx/hybridObjects/HybridNavigationBar.h +3 -3
- package/cxx/hybridObjects/HybridStatusBar.h +3 -3
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +4 -4
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -2
- package/lib/commonjs/components/useMedia.js.map +1 -1
- package/lib/commonjs/components/useMedia.web.js +43 -0
- package/lib/commonjs/components/useMedia.web.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.js +57 -4
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
- package/lib/commonjs/core/createUnistylesComponent.native.js +6 -5
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +5 -0
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +16 -11
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +58 -0
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/object/filter.js +42 -0
- package/lib/commonjs/web/convert/object/filter.js.map +1 -0
- package/lib/commonjs/web/convert/object/index.js +39 -0
- package/lib/commonjs/web/convert/object/index.js.map +1 -0
- package/lib/commonjs/web/convert/object/objectStyle.js +55 -0
- package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -0
- package/lib/commonjs/web/convert/object/transform.js +27 -0
- package/lib/commonjs/web/convert/object/transform.js.map +1 -0
- package/lib/commonjs/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
- package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js +38 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/index.js +28 -0
- package/lib/commonjs/web/convert/shadow/index.js.map +1 -0
- package/lib/commonjs/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
- package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +7 -3
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/listener.js +10 -0
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/registry.js +13 -26
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +3 -0
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +79 -39
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +3 -33
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +4 -1
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/useMedia.js.map +1 -1
- package/lib/module/components/useMedia.web.js +38 -0
- package/lib/module/components/useMedia.web.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.js +55 -3
- package/lib/module/core/createUnistylesComponent.js.map +1 -1
- package/lib/module/core/createUnistylesComponent.native.js +6 -5
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +5 -0
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/web/convert/index.js +14 -9
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +53 -0
- package/lib/module/web/convert/object/boxShadow.js.map +1 -0
- package/lib/module/web/convert/object/filter.js +37 -0
- package/lib/module/web/convert/object/filter.js.map +1 -0
- package/lib/module/web/convert/object/index.js +6 -0
- package/lib/module/web/convert/object/index.js.map +1 -0
- package/lib/module/web/convert/object/objectStyle.js +50 -0
- package/lib/module/web/convert/object/objectStyle.js.map +1 -0
- package/lib/module/web/convert/object/transform.js +22 -0
- package/lib/module/web/convert/object/transform.js.map +1 -0
- package/lib/module/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
- package/lib/module/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js +33 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/module/web/convert/shadow/index.js +5 -0
- package/lib/module/web/convert/shadow/index.js.map +1 -0
- package/lib/module/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
- package/lib/module/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/module/web/convert/utils.js +4 -2
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/listener.js +10 -0
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/registry.js +14 -27
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +3 -0
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +80 -40
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -31
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +4 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/useMedia.web.d.ts +6 -0
- package/lib/typescript/src/components/useMedia.web.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +4 -3
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +4 -3
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +3 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts +9 -0
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/index.d.ts +4 -0
- package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts +5 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts +2 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts +3 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/types.d.ts +7 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +8 -4
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +8 -8
- package/lib/typescript/src/web/index.d.ts +8 -8
- package/lib/typescript/src/web/listener.d.ts +2 -0
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +5 -9
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -0
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +4 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts +1 -6
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +6 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency_.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -0
- package/nitrogen/generated/android/unistyles+autolinking.gradle +2 -0
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
- package/package.json +3 -3
- package/src/components/useMedia.ts +1 -1
- package/src/components/useMedia.web.ts +47 -0
- package/src/core/createUnistylesComponent.native.tsx +12 -10
- package/src/core/createUnistylesComponent.tsx +72 -6
- package/src/specs/ShadowRegistry/index.ts +5 -0
- package/src/specs/ShadowRegistry/types.ts +4 -1
- package/src/types/common.ts +1 -0
- package/src/web/convert/index.ts +16 -9
- package/src/web/convert/object/boxShadow.ts +54 -0
- package/src/web/convert/object/filter.ts +39 -0
- package/src/web/convert/object/index.ts +3 -0
- package/src/web/convert/object/objectStyle.ts +68 -0
- package/src/web/convert/object/transform.ts +24 -0
- package/src/web/convert/{boxShadow.ts → shadow/boxShadow.ts} +9 -30
- package/src/web/convert/shadow/getShadowBreakpoints.ts +34 -0
- package/src/web/convert/shadow/index.ts +2 -0
- package/src/web/convert/{textShadow.ts → shadow/textShadow.ts} +9 -29
- package/src/web/convert/types.ts +8 -1
- package/src/web/convert/utils.ts +11 -5
- package/src/web/listener.ts +10 -0
- package/src/web/registry.ts +10 -31
- package/src/web/runtime.ts +4 -0
- package/src/web/shadowRegistry.ts +85 -46
- package/src/web/utils/common.ts +1 -37
- package/src/web/utils/unistyle.ts +5 -1
- package/android/src/main/cxx/helpers.cpp +0 -105
- package/android/src/main/cxx/helpers.h +0 -16
- package/android/src/main/cxx/platform.cpp +0 -170
- package/android/src/main/cxx/platform.h +0 -20
- package/lib/commonjs/web/convert/boxShadow.js.map +0 -1
- package/lib/commonjs/web/convert/shadow.js +0 -68
- package/lib/commonjs/web/convert/shadow.js.map +0 -1
- package/lib/commonjs/web/convert/textShadow.js.map +0 -1
- package/lib/commonjs/web/convert/transform.js +0 -72
- package/lib/commonjs/web/convert/transform.js.map +0 -1
- package/lib/module/web/convert/boxShadow.js.map +0 -1
- package/lib/module/web/convert/shadow.js +0 -63
- package/lib/module/web/convert/shadow.js.map +0 -1
- package/lib/module/web/convert/textShadow.js.map +0 -1
- package/lib/module/web/convert/transform.js +0 -67
- package/lib/module/web/convert/transform.js.map +0 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/shadow.d.ts +0 -2
- package/lib/typescript/src/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/transform.d.ts +0 -4
- package/lib/typescript/src/web/convert/transform.d.ts.map +0 -1
- package/src/web/convert/shadow.ts +0 -68
- package/src/web/convert/transform.ts +0 -88
- /package/lib/typescript/src/web/convert/{boxShadow.d.ts → shadow/boxShadow.d.ts} +0 -0
- /package/lib/typescript/src/web/convert/{textShadow.d.ts → shadow/textShadow.d.ts} +0 -0
@@ -1,170 +0,0 @@
|
|
1
|
-
#include "platform.h"
|
2
|
-
|
3
|
-
void makeShared(JNIEnv *env, jobject unistylesModule, std::shared_ptr<UnistylesRuntime> unistylesRuntime) {
|
4
|
-
unistylesRuntime->setScreenDimensionsCallback([&](){
|
5
|
-
return getScreenDimensions(env, unistylesModule);
|
6
|
-
});
|
7
|
-
|
8
|
-
unistylesRuntime->setColorSchemeCallback([&](){
|
9
|
-
return getColorScheme(env, unistylesModule);
|
10
|
-
});
|
11
|
-
|
12
|
-
unistylesRuntime->setStatusBarDimensionsCallback([&](){
|
13
|
-
return getStatusBarDimensions(env, unistylesModule);
|
14
|
-
});
|
15
|
-
|
16
|
-
unistylesRuntime->setNavigationBarDimensionsCallback([&](){
|
17
|
-
return getNavigationBarDimensions(env, unistylesModule);
|
18
|
-
});
|
19
|
-
|
20
|
-
unistylesRuntime->setInsetsCallback([&](){
|
21
|
-
return getInsets(env, unistylesModule);
|
22
|
-
});
|
23
|
-
|
24
|
-
unistylesRuntime->setContentSizeCategoryCallback([&](){
|
25
|
-
return getContentSizeCategory(env, unistylesModule);
|
26
|
-
});
|
27
|
-
|
28
|
-
unistylesRuntime->setNavigationBarColorCallback([=](const std::string &color, float alpha) {
|
29
|
-
setNavigationBarColor(env, unistylesModule, color, alpha);
|
30
|
-
});
|
31
|
-
|
32
|
-
unistylesRuntime->setStatusBarColorCallback([=](const std::string &color, float alpha) {
|
33
|
-
setStatusBarColor(env, unistylesModule, color, alpha);
|
34
|
-
});
|
35
|
-
|
36
|
-
unistylesRuntime->setNavigationBarHiddenCallback([=](bool hidden) {
|
37
|
-
setNavigationBarHidden(env, unistylesModule, hidden);
|
38
|
-
});
|
39
|
-
|
40
|
-
unistylesRuntime->setStatusBarHiddenCallback([=](bool hidden) {
|
41
|
-
setStatusBarHidden(env, unistylesModule, hidden);
|
42
|
-
});
|
43
|
-
|
44
|
-
unistylesRuntime->setImmersiveModeCallback([=](bool enabled) {
|
45
|
-
setImmersiveMode(env, unistylesModule, enabled);
|
46
|
-
});
|
47
|
-
|
48
|
-
unistylesRuntime->setRootViewBackgroundColorCallback([=](const std::string &color, float alpha) {
|
49
|
-
setRootViewBackgroundColor(env, unistylesModule, color, alpha);
|
50
|
-
});
|
51
|
-
|
52
|
-
unistylesRuntime->setDisableAnimatedInsetsAndroidCallback([=]() {
|
53
|
-
disableAnimatedInsets(env, unistylesModule);
|
54
|
-
});
|
55
|
-
|
56
|
-
Screen screen = getScreenDimensions(env, unistylesModule);
|
57
|
-
|
58
|
-
unistylesRuntime->screen = Dimensions{screen.width, screen.height};
|
59
|
-
unistylesRuntime->contentSizeCategory = getContentSizeCategory(env, unistylesModule);
|
60
|
-
unistylesRuntime->colorScheme = getColorScheme(env, unistylesModule);
|
61
|
-
unistylesRuntime->statusBar = getStatusBarDimensions(env, unistylesModule);
|
62
|
-
unistylesRuntime->insets = getInsets(env, unistylesModule);
|
63
|
-
unistylesRuntime->navigationBar = getNavigationBarDimensions(env, unistylesModule);
|
64
|
-
unistylesRuntime->fontScale = screen.fontScale;
|
65
|
-
unistylesRuntime->pixelRatio = screen.pixelRatio;
|
66
|
-
unistylesRuntime->rtl = getIsRTL(env, unistylesModule);
|
67
|
-
}
|
68
|
-
|
69
|
-
void disableAnimatedInsets(JNIEnv *env, jobject unistylesModule) {
|
70
|
-
jclass cls = env->GetObjectClass(unistylesModule);
|
71
|
-
jfieldID platformFieldId = env->GetFieldID(cls, "platform", "Lcom/unistyles/Platform;");
|
72
|
-
jobject platformInstance = env->GetObjectField(unistylesModule, platformFieldId);
|
73
|
-
jclass platformClass = env->GetObjectClass(platformInstance);
|
74
|
-
jmethodID methodId = env->GetMethodID(platformClass, "disableAnimatedInsets", "()V");
|
75
|
-
|
76
|
-
env->CallVoidMethod(platformInstance, methodId);
|
77
|
-
|
78
|
-
env->DeleteLocalRef(cls);
|
79
|
-
env->DeleteLocalRef(platformInstance);
|
80
|
-
env->DeleteLocalRef(platformClass);
|
81
|
-
}
|
82
|
-
|
83
|
-
Screen getScreenDimensions(JNIEnv *env, jobject unistylesModule) {
|
84
|
-
jobject result = JNI_callPlatform(env, unistylesModule, "getScreenDimensions", "()Lcom/unistyles/Screen;");
|
85
|
-
Screen screenDimensions = jobjectToScreen(env, result);
|
86
|
-
|
87
|
-
return screenDimensions;
|
88
|
-
}
|
89
|
-
|
90
|
-
std::string getColorScheme(JNIEnv *env, jobject unistylesModule) {
|
91
|
-
jstring colorScheme = (jstring) JNI_callPlatform(env, unistylesModule, "getColorScheme", "()Ljava/lang/String;");
|
92
|
-
const char *colorSchemeChars = env->GetStringUTFChars(colorScheme, nullptr);
|
93
|
-
std::string colorSchemeStr = std::string(colorSchemeChars);
|
94
|
-
|
95
|
-
env->ReleaseStringUTFChars(colorScheme, colorSchemeChars);
|
96
|
-
env->DeleteLocalRef(colorScheme);
|
97
|
-
|
98
|
-
return colorSchemeStr;
|
99
|
-
}
|
100
|
-
|
101
|
-
bool getIsRTL(JNIEnv *env, jobject unistylesModule) {
|
102
|
-
jclass cls = env->GetObjectClass(unistylesModule);
|
103
|
-
jfieldID platformFieldId = env->GetFieldID(cls, "platform", "Lcom/unistyles/Platform;");
|
104
|
-
jobject platformInstance = env->GetObjectField(unistylesModule, platformFieldId);
|
105
|
-
jclass platformClass = env->GetObjectClass(platformInstance);
|
106
|
-
jmethodID methodId = env->GetMethodID(platformClass, "getIsRTL", "()Z");
|
107
|
-
jboolean result = env->CallBooleanMethod(platformInstance, methodId);
|
108
|
-
|
109
|
-
env->DeleteLocalRef(cls);
|
110
|
-
env->DeleteLocalRef(platformInstance);
|
111
|
-
env->DeleteLocalRef(platformClass);
|
112
|
-
|
113
|
-
return result;
|
114
|
-
}
|
115
|
-
|
116
|
-
Dimensions getStatusBarDimensions(JNIEnv *env, jobject unistylesModule) {
|
117
|
-
jobject dimensionsObj = JNI_callPlatform(env, unistylesModule, "getStatusBarDimensions", "()Lcom/unistyles/Dimensions;");
|
118
|
-
Dimensions statusBarDimensions = jobjectToDimensions(env, dimensionsObj);
|
119
|
-
|
120
|
-
return statusBarDimensions;
|
121
|
-
}
|
122
|
-
|
123
|
-
Dimensions getNavigationBarDimensions(JNIEnv *env, jobject unistylesModule) {
|
124
|
-
jobject dimensionsObj = JNI_callPlatform(env, unistylesModule, "getNavigationBarDimensions", "()Lcom/unistyles/Dimensions;");
|
125
|
-
Dimensions navigationBarDimensions = jobjectToDimensions(env, dimensionsObj);
|
126
|
-
|
127
|
-
return navigationBarDimensions;
|
128
|
-
}
|
129
|
-
|
130
|
-
Insets getInsets(JNIEnv *env, jobject unistylesModule) {
|
131
|
-
jobject insetsObj = JNI_callPlatform(env, unistylesModule, "getInsets", "()Lcom/unistyles/Insets;");
|
132
|
-
Insets insets = jobjectToInsets(env, insetsObj);
|
133
|
-
|
134
|
-
return insets;
|
135
|
-
}
|
136
|
-
|
137
|
-
std::string getContentSizeCategory(JNIEnv *env, jobject unistylesModule) {
|
138
|
-
jstring contentSizeCategory = (jstring) JNI_callPlatform(env, unistylesModule, "getContentSizeCategory", "()Ljava/lang/String;");
|
139
|
-
const char *contentSizeCategoryChars = env->GetStringUTFChars(contentSizeCategory, nullptr);
|
140
|
-
std::string contentSizeCategoryStr = std::string(contentSizeCategoryChars);
|
141
|
-
|
142
|
-
env->ReleaseStringUTFChars(contentSizeCategory, contentSizeCategoryChars);
|
143
|
-
env->DeleteLocalRef(contentSizeCategory);
|
144
|
-
|
145
|
-
return contentSizeCategoryStr;
|
146
|
-
}
|
147
|
-
|
148
|
-
void setStatusBarColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha) {
|
149
|
-
JNI_callPlatformWithColor(env, unistylesModule, "onSetStatusBarColor", "(Ljava/lang/String;F)V", color, alpha);
|
150
|
-
}
|
151
|
-
|
152
|
-
void setNavigationBarColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha) {
|
153
|
-
JNI_callPlatformWithColor(env, unistylesModule, "onSetNavigationBarColor", "(Ljava/lang/String;F)V", color, alpha);
|
154
|
-
}
|
155
|
-
|
156
|
-
void setNavigationBarHidden(JNIEnv *env, jobject unistylesModule, bool hidden) {
|
157
|
-
JNI_callPlatformWithBool(env, unistylesModule, "onSetNavigationBarHidden", "(Z)V", hidden);
|
158
|
-
}
|
159
|
-
|
160
|
-
void setStatusBarHidden(JNIEnv *env, jobject unistylesModule, bool hidden) {
|
161
|
-
JNI_callPlatformWithBool(env, unistylesModule, "onSetStatusBarHidden", "(Z)V", hidden);
|
162
|
-
}
|
163
|
-
|
164
|
-
void setImmersiveMode(JNIEnv *env, jobject unistylesModule, bool enabled) {
|
165
|
-
JNI_callPlatformWithBool(env, unistylesModule, "onSetImmersiveMode", "(Z)V", enabled);
|
166
|
-
}
|
167
|
-
|
168
|
-
void setRootViewBackgroundColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha) {
|
169
|
-
JNI_callPlatformWithColor(env, unistylesModule, "onSetRootViewBackgroundColor", "(Ljava/lang/String;F)V", color, alpha);
|
170
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include "UnistylesRuntime.h"
|
4
|
-
#include "helpers.h"
|
5
|
-
|
6
|
-
void makeShared(JNIEnv *env, jobject unistylesModule, std::shared_ptr<UnistylesRuntime> unistylesRuntime);
|
7
|
-
Screen getScreenDimensions(JNIEnv *env, jobject unistylesModule);
|
8
|
-
std::string getColorScheme(JNIEnv *env, jobject unistylesModule);
|
9
|
-
Dimensions getStatusBarDimensions(JNIEnv *env, jobject unistylesModule);
|
10
|
-
Dimensions getNavigationBarDimensions(JNIEnv *env, jobject unistylesModule);
|
11
|
-
void setNavigationBarHidden(JNIEnv *env, jobject unistylesModule, bool hidden);
|
12
|
-
void setStatusBarHidden(JNIEnv *env, jobject unistylesModule, bool hidden);
|
13
|
-
void setImmersiveMode(JNIEnv *env, jobject unistylesModule, bool hidden);
|
14
|
-
void setRootViewBackgroundColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha);
|
15
|
-
Insets getInsets(JNIEnv *env, jobject unistylesModule);
|
16
|
-
bool getIsRTL(JNIEnv *env, jobject unistylesModule);
|
17
|
-
std::string getContentSizeCategory(JNIEnv *env, jobject unistylesModule);
|
18
|
-
void setNavigationBarColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha);
|
19
|
-
void setStatusBarColor(JNIEnv *env, jobject unistylesModule, std::string color, float alpha);
|
20
|
-
void disableAnimatedInsets(JNIEnv *env, jobject unistylesModule);
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","_shadow","_types","_utils2","createBoxShadowValue","style","shadowColor","shadowOffset","shadowOpacity","shadowRadius","offsetX","normalizeNumericValue","width","offsetY","height","radius","color","normalizeColor","getBoxShadowStyle","styles","missingStyles","BOX_SHADOW_STYLES","filter","key","length","warn","join","breakpointsSet","Set","validateShadow","error","breakpoints","Array","from","boxShadow","breakpointStyles","map","breakpoint","extractShadowValue","opacity","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/boxShadow.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,oBAAoB,GAAIC,KAAgB,IAAK;EAC/C;EACA,MAAM;IAAEC,WAAW;IAAEC,YAAY;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGJ,KAAK;EACxE,MAAMK,OAAO,GAAG,IAAAC,6BAAqB,EAACJ,YAAY,CAACK,KAAK,CAAC;EACzD,MAAMC,OAAO,GAAG,IAAAF,6BAAqB,EAACJ,YAAY,CAACO,MAAM,CAAC;EAC1D,MAAMC,MAAM,GAAG,IAAAJ,6BAAqB,EAACF,YAAY,CAAC;EAClD,MAAMO,KAAK,GAAG,IAAAC,sBAAc,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B,MAAM,CAAC;IACrE,MAAMoB,OAAO,GAAG,IAAAD,0BAAkB,EAAC,eAAe,EAAED,UAAU,EAAElB,MAAM,CAAC;IAEvE,OAAO;MACH,CAACkB,UAAU,GAAG;QACVH,SAAS,EAAE9B,oBAAoB,CAAC;UAC5BE,WAAW,EAAEU,KAAK;UAClBT,YAAY,EAAE;YACVK,KAAK;YACLE;UACJ,CAAC;UACDL,YAAY,EAAEM,MAAM;UACpBP,aAAa,EAAE+B;QACnB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAO,IAAAC,uBAAgB,EAAC,GAAGL,gBAAgB,CAAC;AAChD,CAAC;AAAAM,OAAA,CAAAvB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.validateShadow = void 0;
|
7
|
-
const validateShadow = (shadowProperties, styles, breakpoints) => {
|
8
|
-
// Collect breakpoints
|
9
|
-
shadowProperties.forEach(key => {
|
10
|
-
const value = styles[key];
|
11
|
-
if (typeof value !== 'object') {
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
15
|
-
const {
|
16
|
-
width,
|
17
|
-
height
|
18
|
-
} = value;
|
19
|
-
|
20
|
-
// If shadowOffset.width has breakpoints
|
21
|
-
if (typeof width === 'object') {
|
22
|
-
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
|
23
|
-
}
|
24
|
-
|
25
|
-
// If shadowOffset.height has breakpoints
|
26
|
-
if (typeof height === 'object') {
|
27
|
-
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
|
28
|
-
}
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
|
32
|
-
// Collect regular breakpoints
|
33
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
34
|
-
});
|
35
|
-
|
36
|
-
// Validate if all breakpoints are present
|
37
|
-
shadowProperties.forEach(key => {
|
38
|
-
const value = styles[key];
|
39
|
-
if (typeof value !== 'object') {
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
43
|
-
const {
|
44
|
-
width,
|
45
|
-
height
|
46
|
-
} = value;
|
47
|
-
if (typeof width === 'object') {
|
48
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width));
|
49
|
-
if (missingBreakpoints.length) {
|
50
|
-
throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
if (typeof height === 'object') {
|
54
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height));
|
55
|
-
if (missingBreakpoints.length) {
|
56
|
-
throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value));
|
62
|
-
if (missingBreakpoints.length) {
|
63
|
-
throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`;
|
64
|
-
}
|
65
|
-
});
|
66
|
-
};
|
67
|
-
exports.validateShadow = validateShadow;
|
68
|
-
//# sourceMappingURL=shadow.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["validateShadow","shadowProperties","styles","breakpoints","forEach","key","value","width","height","Object","keys","breakpoint","add","missingBreakpoints","Array","from","filter","length","join","exports"],"sourceRoot":"../../../../src","sources":["web/convert/shadow.ts"],"mappings":";;;;;;AAEO,MAAMA,cAAc,GAAGA,CAACC,gBAAuC,EAAEC,MAA2B,EAAEC,WAAwB,KAAK;EAC9H;EACAF,gBAAgB,CAACG,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGJ,MAAM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BAA0BZ,GAAG,WAAWQ,kBAAkB,CAACK,IAAI,CAAC,IAAI,CAAC,EAAE;QACjF;MACJ;MAEA,IAAI,OAAOV,MAAM,KAAK,QAAQ,EAAE;QAC5B,MAAMK,kBAAkB,GAAGC,KAAK,CAACC,IAAI,CAACZ,WAAW,CAAC,CAACa,MAAM,CAACL,UAAU,IAAI,EAAEA,UAAU,IAAIH,MAAM,CAAC,CAAC;QAEhG,IAAIK,kBAAkB,CAACI,MAAM,EAAE;UAC3B,MAAM,0BAA0BZ,GAAG,YAAYQ,kBAAkB,CAACK,IAAI,CAAC,IAAI,CAAC,EAAE;QAClF;MACJ;MAEA;IACJ;IAEA,MAAML,kBAAkB,GAAGC,KAAK,CAACC,IAAI,CAACZ,WAAW,CAAC,CAACa,MAAM,CAACL,UAAU,IAAI,EAAEA,UAAU,IAAIL,KAAK,CAAC,CAAC;IAE/F,IAAIO,kBAAkB,CAACI,MAAM,EAAE;MAC3B,MAAM,0BAA0BZ,GAAG,KAAKQ,kBAAkB,CAACK,IAAI,CAAC,IAAI,CAAC,EAAE;IAC3E;EACJ,CAAC,CAAC;AACN,CAAC;AAAAC,OAAA,CAAAnB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","_shadow","_types","_utils2","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","normalizeNumericValue","width","offsetY","height","radius","color","normalizeColor","getTextShadowStyle","styles","missingStyles","TEXT_SHADOW_STYLES","filter","key","length","warn","join","breakpointsSet","Set","validateShadow","error","breakpoints","Array","from","textShadow","breakpointStyles","map","breakpoint","extractShadowValue","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/textShadow.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAE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AAC;EACL;;EAEA;EACA,MAAMgB,gBAAgB,GAAGJ,WAAW,CAACK,GAAG,CAACC,UAAU,IAAI;IACnD,MAAMrB,KAAK,GAAG,IAAAsB,0BAAkB,EAAC,iBAAiB,EAAED,UAAU,EAAElB,MAAM,CAAC;IACvE,MAAM;MAAEP,KAAK;MAAEE;IAAO,CAAC,GAAG,IAAAwB,0BAAkB,EAAC,kBAAkB,EAAED,UAAU,EAAElB,MAAM,CAAC;IACpF,MAAMJ,MAAM,GAAG,IAAAuB,0BAAkB,EAAC,kBAAkB,EAAED,UAAU,EAAElB,MAAM,CAAC;IAEzE,OAAO;MACH,CAACkB,UAAU,GAAG;QACVH,UAAU,EAAE7B,qBAAqB,CAAC;UAC9BE,eAAe,EAAES,KAAK;UACtBR,gBAAgB,EAAE;YACdI,KAAK;YACLE;UACJ,CAAC;UACDL,gBAAgB,EAAEM;QACtB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAO,IAAAwB,uBAAgB,EAAC,GAAGJ,gBAAgB,CAAC;AAChD,CAAC;AAAAK,OAAA,CAAAtB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getTransformStyle = void 0;
|
7
|
-
var _utils = require("../utils");
|
8
|
-
var _utils2 = require("./utils");
|
9
|
-
const normalizeTransform = (key, value) => {
|
10
|
-
if (key.includes('scale')) {
|
11
|
-
return value;
|
12
|
-
}
|
13
|
-
if (typeof value === 'number') {
|
14
|
-
return (0, _utils2.normalizeNumericValue)(value);
|
15
|
-
}
|
16
|
-
return value;
|
17
|
-
};
|
18
|
-
const createTransformValue = transforms => transforms.map(transform => {
|
19
|
-
const [key] = Object.keys(transform);
|
20
|
-
if (!key) {
|
21
|
-
return undefined;
|
22
|
-
}
|
23
|
-
const value = transform[key];
|
24
|
-
switch (key) {
|
25
|
-
case 'matrix':
|
26
|
-
case 'matrix3d':
|
27
|
-
return `${key}(${value.join(',')})`;
|
28
|
-
default:
|
29
|
-
return `${key}(${normalizeTransform(key, value)})`;
|
30
|
-
}
|
31
|
-
}).filter(Boolean).join(' ');
|
32
|
-
const getTransformStyle = transforms => {
|
33
|
-
const breakpoints = new Set();
|
34
|
-
const normalTransforms = [];
|
35
|
-
transforms.forEach(transform => {
|
36
|
-
const [property] = Object.keys(transform);
|
37
|
-
if (!property) {
|
38
|
-
return;
|
39
|
-
}
|
40
|
-
const value = transform[property];
|
41
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
42
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
normalTransforms.push(transform);
|
46
|
-
});
|
47
|
-
const breakpointTransforms = Array.from(breakpoints).flatMap(breakpoint => {
|
48
|
-
const transformsPerBreakpoint = transforms.flatMap(transform => {
|
49
|
-
const [property] = Object.keys(transform);
|
50
|
-
if (!property) {
|
51
|
-
return [];
|
52
|
-
}
|
53
|
-
const value = transform[property];
|
54
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
55
|
-
return (0, _utils.keyInObject)(value, breakpoint) ? [{
|
56
|
-
[property]: value[breakpoint]
|
57
|
-
}] : [];
|
58
|
-
}
|
59
|
-
return [];
|
60
|
-
});
|
61
|
-
return [{
|
62
|
-
[breakpoint]: {
|
63
|
-
transform: createTransformValue(transformsPerBreakpoint)
|
64
|
-
}
|
65
|
-
}];
|
66
|
-
});
|
67
|
-
return (0, _utils.deepMergeObjects)({
|
68
|
-
transform: createTransformValue(normalTransforms)
|
69
|
-
}, ...breakpointTransforms);
|
70
|
-
};
|
71
|
-
exports.getTransformStyle = getTransformStyle;
|
72
|
-
//# sourceMappingURL=transform.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","_utils2","normalizeTransform","key","value","includes","normalizeNumericValue","createTransformValue","transforms","map","transform","Object","keys","undefined","join","filter","Boolean","getTransformStyle","breakpoints","Set","normalTransforms","forEach","property","Array","isArray","breakpoint","add","push","breakpointTransforms","from","flatMap","transformsPerBreakpoint","keyInObject","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/transform.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,MAAME,kBAAkB,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAK;EACpD,IAAID,GAAG,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;IACvB,OAAOD,KAAK;EAChB;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAO,IAAAE,6BAAqB,EAACF,KAAK,CAAC;EACvC;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,MAAMG,oBAAoB,GAAIC,UAAsB,IAAKA,UAAU,CAC9DC,GAAG,CAACC,SAAS,IAAI;EACd,MAAM,CAACP,GAAG,CAAC,GAAGQ,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;EAEpC,IAAI,CAACP,GAAG,EAAE;IACN,OAAOU,SAAS;EACpB;EAEA,MAAMT,KAAK,GAAGM,SAAS,CAACP,GAAG,CAAC;EAE5B,QAAOA,GAAG;IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAO,GAAGA,GAAG,IAAKC,KAAK,CAAmBU,IAAI,CAAC,GAAG,CAAC,GAAG;IAC1D;MACI,OAAO,GAAGX,GAAG,IAAID,kBAAkB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAG;EAC1D;AACJ,CAAC,CAAC,CACDW,MAAM,CAACC,OAAO,CAAC,CACfF,IAAI,CAAC,GAAG,CAAC;AAEP,MAAMG,iBAAiB,GAAIT,UAAsB,IAAK;EACzD,MAAMU,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EACrC,MAAMC,gBAA4B,GAAG,EAAE;EAEvC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3D;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAO,IAAAE,uBAAgB,EAAsB;IACzCvB,SAAS,EAAEH,oBAAoB,CAACa,gBAAgB;EACpD,CAAC,EAAE,GAAGQ,oBAAoB,CAAC;AAC/B,CAAC;AAAAM,OAAA,CAAAjB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","warn","validateShadow","BOX_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","createBoxShadowValue","style","shadowColor","shadowOffset","shadowOpacity","shadowRadius","offsetX","width","offsetY","height","radius","color","getBoxShadowStyle","styles","missingStyles","filter","key","length","join","breakpointsSet","Set","error","breakpoints","Array","from","boxShadow","breakpointStyles","map","breakpoint","opacity"],"sourceRoot":"../../../../src","sources":["web/convert/boxShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,IAAI,QAAQ,UAAU;AACjD,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,iBAAiB,QAAwB,SAAS;AAC3D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,SAAS;AAEnF,MAAMC,oBAAoB,GAAIC,KAAgB,IAAK;EAC/C;EACA,MAAM;IAAEC,WAAW;IAAEC,YAAY;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGJ,KAAK;EACxE,MAAMK,OAAO,GAAGP,qBAAqB,CAACI,YAAY,CAACI,KAAK,CAAC;EACzD,MAAMC,OAAO,GAAGT,qBAAqB,CAACI,YAAY,CAACM,MAAM,CAAC;EAC1D,MAAMC,MAAM,GAAGX,qBAAqB,CAACM,YAAY,CAAC;EAClD,MAAMM,KAAK,GAAGb,cAAc,CAACI,WAAW,EAAYE,aAAuB,CAAC;EAE5E,OAAO,GAAGE,OAAO,IAAIE,OAAO,IAAIE,MAAM,IAAIC,KAAK,EAAE;AACrD,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAI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C;UAC5BE,WAAW,EAAES,KAAK;UAClBR,YAAY,EAAE;YACVI,KAAK;YACLE;UACJ,CAAC;UACDJ,YAAY,EAAEK,MAAM;UACpBN,aAAa,EAAEyB;QACnB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAOpC,gBAAgB,CAAC,GAAGiC,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
|
@@ -1,63 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
export const validateShadow = (shadowProperties, styles, breakpoints) => {
|
4
|
-
// Collect breakpoints
|
5
|
-
shadowProperties.forEach(key => {
|
6
|
-
const value = styles[key];
|
7
|
-
if (typeof value !== 'object') {
|
8
|
-
return;
|
9
|
-
}
|
10
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
11
|
-
const {
|
12
|
-
width,
|
13
|
-
height
|
14
|
-
} = value;
|
15
|
-
|
16
|
-
// If shadowOffset.width has breakpoints
|
17
|
-
if (typeof width === 'object') {
|
18
|
-
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
|
19
|
-
}
|
20
|
-
|
21
|
-
// If shadowOffset.height has breakpoints
|
22
|
-
if (typeof height === 'object') {
|
23
|
-
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
|
24
|
-
}
|
25
|
-
return;
|
26
|
-
}
|
27
|
-
|
28
|
-
// Collect regular breakpoints
|
29
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
30
|
-
});
|
31
|
-
|
32
|
-
// Validate if all breakpoints are present
|
33
|
-
shadowProperties.forEach(key => {
|
34
|
-
const value = styles[key];
|
35
|
-
if (typeof value !== 'object') {
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
39
|
-
const {
|
40
|
-
width,
|
41
|
-
height
|
42
|
-
} = value;
|
43
|
-
if (typeof width === 'object') {
|
44
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width));
|
45
|
-
if (missingBreakpoints.length) {
|
46
|
-
throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
if (typeof height === 'object') {
|
50
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height));
|
51
|
-
if (missingBreakpoints.length) {
|
52
|
-
throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value));
|
58
|
-
if (missingBreakpoints.length) {
|
59
|
-
throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`;
|
60
|
-
}
|
61
|
-
});
|
62
|
-
};
|
63
|
-
//# sourceMappingURL=shadow.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["validateShadow","shadowProperties","styles","breakpoints","forEach","key","value","width","height","Object","keys","breakpoint","add","missingBreakpoints","Array","from","filter","length","join"],"sourceRoot":"../../../../src","sources":["web/convert/shadow.ts"],"mappings":";;AAEA,OAAO,MAAMA,cAAc,GAAGA,CAACC,gBAAuC,EAAEC,MAA2B,EAAEC,WAAwB,KAAK;EAC9H;EACAF,gBAAgB,CAACG,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGJ,MAAM,CAACG,GAAG,CAAC;IAEzB,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC3B;IACJ;IAEA,IAAID,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB,EAAE;MACtD,MAAM;QAAEE,KAAK;QAAEC;MAAO,CAAC,GAAGF,KAAqB;;MAE/C;MACA,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;QAC3BE,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC,CAACH,OAAO,CAACO,UAAU,IAAIR,WAAW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AAYQ,kBAAkB,CAACK,IAAI,CAAC,IAAI,CAAC,EAAE;QAClF;MACJ;MAEA;IACJ;IAEA,MAAML,kBAAkB,GAAGC,KAAK,CAACC,IAAI,CAACZ,WAAW,CAAC,CAACa,MAAM,CAACL,UAAU,IAAI,EAAEA,UAAU,IAAIL,KAAK,CAAC,CAAC;IAE/F,IAAIO,kBAAkB,CAACI,MAAM,EAAE;MAC3B,MAAM,0BAA0BZ,GAAG,KAAKQ,kBAAkB,CAACK,IAAI,CAAC,IAAI,CAAC,EAAE;IAC3E;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","warn","validateShadow","TEXT_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","color","getTextShadowStyle","styles","missingStyles","filter","key","length","join","breakpointsSet","Set","error","breakpoints","Array","from","textShadow","breakpointStyles","map","breakpoint"],"sourceRoot":"../../../../src","sources":["web/convert/textShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,IAAI,QAAQ,UAAU;AACjD,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,kBAAkB,QAAyB,SAAS;AAC7D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,SAAS;AAEnF,MAAMC,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAGN,qBAAqB,CAACI,gBAAgB,CAACG,KAAK,CAAC;EAC7D,MAAMC,OAAO,GAAGR,qBAAqB,CAACI,gBAAgB,CAACK,MAAM,CAAC;EAC9D,MAAMC,MAAM,GAAGV,qBAAqB,CAACK,gBAAgB,CAAC;EACtD,MAAMM,KAAK,GAAGZ,cAAc,CAACI,eAAyB,CA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AAU,GAAG;QACVH,UAAU,EAAExB,qBAAqB,CAAC;UAC9BE,eAAe,EAAEQ,KAAK;UACtBP,gBAAgB,EAAE;YACdG,KAAK;YACLE;UACJ,CAAC;UACDJ,gBAAgB,EAAEK;QACtB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAOhB,gBAAgB,CAAC,GAAGgC,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
|
@@ -1,67 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
import { deepMergeObjects, keyInObject } from '../utils';
|
4
|
-
import { normalizeNumericValue } from './utils';
|
5
|
-
const normalizeTransform = (key, value) => {
|
6
|
-
if (key.includes('scale')) {
|
7
|
-
return value;
|
8
|
-
}
|
9
|
-
if (typeof value === 'number') {
|
10
|
-
return normalizeNumericValue(value);
|
11
|
-
}
|
12
|
-
return value;
|
13
|
-
};
|
14
|
-
const createTransformValue = transforms => transforms.map(transform => {
|
15
|
-
const [key] = Object.keys(transform);
|
16
|
-
if (!key) {
|
17
|
-
return undefined;
|
18
|
-
}
|
19
|
-
const value = transform[key];
|
20
|
-
switch (key) {
|
21
|
-
case 'matrix':
|
22
|
-
case 'matrix3d':
|
23
|
-
return `${key}(${value.join(',')})`;
|
24
|
-
default:
|
25
|
-
return `${key}(${normalizeTransform(key, value)})`;
|
26
|
-
}
|
27
|
-
}).filter(Boolean).join(' ');
|
28
|
-
export const getTransformStyle = transforms => {
|
29
|
-
const breakpoints = new Set();
|
30
|
-
const normalTransforms = [];
|
31
|
-
transforms.forEach(transform => {
|
32
|
-
const [property] = Object.keys(transform);
|
33
|
-
if (!property) {
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
const value = transform[property];
|
37
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
38
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
normalTransforms.push(transform);
|
42
|
-
});
|
43
|
-
const breakpointTransforms = Array.from(breakpoints).flatMap(breakpoint => {
|
44
|
-
const transformsPerBreakpoint = transforms.flatMap(transform => {
|
45
|
-
const [property] = Object.keys(transform);
|
46
|
-
if (!property) {
|
47
|
-
return [];
|
48
|
-
}
|
49
|
-
const value = transform[property];
|
50
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
51
|
-
return keyInObject(value, breakpoint) ? [{
|
52
|
-
[property]: value[breakpoint]
|
53
|
-
}] : [];
|
54
|
-
}
|
55
|
-
return [];
|
56
|
-
});
|
57
|
-
return [{
|
58
|
-
[breakpoint]: {
|
59
|
-
transform: createTransformValue(transformsPerBreakpoint)
|
60
|
-
}
|
61
|
-
}];
|
62
|
-
});
|
63
|
-
return deepMergeObjects({
|
64
|
-
transform: createTransformValue(normalTransforms)
|
65
|
-
}, ...breakpointTransforms);
|
66
|
-
};
|
67
|
-
//# sourceMappingURL=transform.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","keyInObject","normalizeNumericValue","normalizeTransform","key","value","includes","createTransformValue","transforms","map","transform","Object","keys","undefined","join","filter","Boolean","getTransformStyle","breakpoints","Set","normalTransforms","forEach","property","Array","isArray","breakpoint","add","push","breakpointTransforms","from","flatMap","transformsPerBreakpoint"],"sourceRoot":"../../../../src","sources":["web/convert/transform.ts"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,UAAU;AACxD,SAASC,qBAAqB,QAAQ,SAAS;AAI/C,MAAMC,kBAAkB,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAK;EACpD,IAAID,GAAG,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;IACvB,OAAOD,KAAK;EAChB;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOH,qBAAqB,CAACG,KAAK,CAAC;EACvC;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,MAAME,oBAAoB,GAAIC,UAAsB,IAAKA,UAAU,C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AACL,UAAU,IAAI;IACvE,MAAMM,uBAAuB,GAAGvB,UAAU,CAACsB,OAAO,CAACpB,SAAS,IAAI;MAC5D,MAAM,CAACY,QAAQ,CAAC,GAAGX,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;MAEzC,IAAI,CAACY,QAAQ,EAAE;QACX,OAAO,EAAE;MACb;MAEA,MAAMjB,KAAK,GAAGK,SAAS,CAACY,QAAQ,CAAC;MAEjC,IAAI,OAAOjB,KAAK,KAAK,QAAQ,IAAI,CAACkB,KAAK,CAACC,OAAO,CAACnB,KAAK,CAAC,EAAE;QACpD,OAAOJ,WAAW,CAACI,KAAK,EAAEoB,UAAU,CAAC,GAAG,CAAC;UAAE,CAACH,QAAQ,GAAGjB,KAAK,CAACoB,UAAU;QAAE,CAAC,CAAC,GAAG,EAAE;MACpF;MAEA,OAAO,EAAE;IACb,CAAC,CAAC;IAEF,OAAO,CAAC;MACJ,CAACA,UAAU,GAAG;QACVf,SAAS,EAAEH,oBAAoB,CAACwB,uBAAuB;MAC3D;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAO/B,gBAAgB,CAAsB;IACzCU,SAAS,EAAEH,oBAAoB,CAACa,gBAAgB;EACpD,CAAC,EAAE,GAAGQ,oBAAoB,CAAC;AAC/B,CAAC","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"boxShadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/boxShadow.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;CAsD5D,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"shadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/shadow.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,qBAAsB,aAAa,CAAC,MAAM,CAAC,UAAU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAAe,GAAG,CAAC,MAAM,CAAC,SAiE5H,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"textShadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/textShadow.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,kBAAkB,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;CAoD7D,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/transform.ts"],"names":[],"mappings":"AAGA,KAAK,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;AAmC5C,eAAO,MAAM,iBAAiB,eAAgB,UAAU,wBAiDvD,CAAA"}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import type { ShadowOffset } from './types'
|
2
|
-
|
3
|
-
export const validateShadow = (shadowProperties: ReadonlyArray<string>, styles: Record<string, any>, breakpoints: Set<string>) => {
|
4
|
-
// Collect breakpoints
|
5
|
-
shadowProperties.forEach(key => {
|
6
|
-
const value = styles[key]
|
7
|
-
|
8
|
-
if (typeof value !== 'object') {
|
9
|
-
return
|
10
|
-
}
|
11
|
-
|
12
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
13
|
-
const { width, height } = value as ShadowOffset
|
14
|
-
|
15
|
-
// If shadowOffset.width has breakpoints
|
16
|
-
if (typeof width === 'object') {
|
17
|
-
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint))
|
18
|
-
}
|
19
|
-
|
20
|
-
// If shadowOffset.height has breakpoints
|
21
|
-
if (typeof height === 'object') {
|
22
|
-
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint))
|
23
|
-
}
|
24
|
-
|
25
|
-
return
|
26
|
-
}
|
27
|
-
|
28
|
-
// Collect regular breakpoints
|
29
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint))
|
30
|
-
})
|
31
|
-
|
32
|
-
// Validate if all breakpoints are present
|
33
|
-
shadowProperties.forEach(key => {
|
34
|
-
const value = styles[key]
|
35
|
-
|
36
|
-
if (typeof value !== 'object') {
|
37
|
-
return
|
38
|
-
}
|
39
|
-
|
40
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
41
|
-
const { width, height } = value as ShadowOffset
|
42
|
-
|
43
|
-
if (typeof width === 'object') {
|
44
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width))
|
45
|
-
|
46
|
-
if (missingBreakpoints.length) {
|
47
|
-
throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
if (typeof height === 'object') {
|
52
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height))
|
53
|
-
|
54
|
-
if (missingBreakpoints.length) {
|
55
|
-
throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
return
|
60
|
-
}
|
61
|
-
|
62
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value))
|
63
|
-
|
64
|
-
if (missingBreakpoints.length) {
|
65
|
-
throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`
|
66
|
-
}
|
67
|
-
})
|
68
|
-
}
|