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.
Files changed (208) hide show
  1. package/android/CMakeLists.txt +31 -36
  2. package/android/build.gradle +2 -1
  3. package/android/src/main/cxx/NativeUnistylesModule.cpp +71 -0
  4. package/android/src/main/cxx/NativeUnistylesModule.h +42 -0
  5. package/android/src/main/cxx/cpp-adapter.cpp +8 -86
  6. package/android/src/main/java/com/unistyles/NativePlatform.kt +184 -0
  7. package/android/src/main/java/com/unistyles/UnistylesModule+insets.kt +8 -0
  8. package/android/src/main/java/com/unistyles/UnistylesModule.kt +47 -0
  9. package/android/src/main/java/com/unistyles/UnistylesPackage.kt +16 -14
  10. package/cxx/NativePlatform.h +11 -0
  11. package/cxx/common/Helpers.h +1 -1
  12. package/cxx/core/Unistyle.h +1 -1
  13. package/cxx/core/UnistylesRegistry.h +1 -1
  14. package/cxx/hybridObjects/HybridNavigationBar.h +3 -3
  15. package/cxx/hybridObjects/HybridStatusBar.h +3 -3
  16. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +4 -4
  17. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -2
  18. package/lib/commonjs/components/useMedia.js.map +1 -1
  19. package/lib/commonjs/components/useMedia.web.js +43 -0
  20. package/lib/commonjs/components/useMedia.web.js.map +1 -0
  21. package/lib/commonjs/core/createUnistylesComponent.js +57 -4
  22. package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
  23. package/lib/commonjs/core/createUnistylesComponent.native.js +6 -5
  24. package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
  25. package/lib/commonjs/specs/ShadowRegistry/index.js +5 -0
  26. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  27. package/lib/commonjs/web/convert/index.js +16 -11
  28. package/lib/commonjs/web/convert/index.js.map +1 -1
  29. package/lib/commonjs/web/convert/object/boxShadow.js +58 -0
  30. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -0
  31. package/lib/commonjs/web/convert/object/filter.js +42 -0
  32. package/lib/commonjs/web/convert/object/filter.js.map +1 -0
  33. package/lib/commonjs/web/convert/object/index.js +39 -0
  34. package/lib/commonjs/web/convert/object/index.js.map +1 -0
  35. package/lib/commonjs/web/convert/object/objectStyle.js +55 -0
  36. package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -0
  37. package/lib/commonjs/web/convert/object/transform.js +27 -0
  38. package/lib/commonjs/web/convert/object/transform.js.map +1 -0
  39. package/lib/commonjs/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
  40. package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -0
  41. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js +38 -0
  42. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
  43. package/lib/commonjs/web/convert/shadow/index.js +28 -0
  44. package/lib/commonjs/web/convert/shadow/index.js.map +1 -0
  45. package/lib/commonjs/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
  46. package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
  47. package/lib/commonjs/web/convert/utils.js +7 -3
  48. package/lib/commonjs/web/convert/utils.js.map +1 -1
  49. package/lib/commonjs/web/listener.js +10 -0
  50. package/lib/commonjs/web/listener.js.map +1 -1
  51. package/lib/commonjs/web/registry.js +13 -26
  52. package/lib/commonjs/web/registry.js.map +1 -1
  53. package/lib/commonjs/web/runtime.js +3 -0
  54. package/lib/commonjs/web/runtime.js.map +1 -1
  55. package/lib/commonjs/web/shadowRegistry.js +79 -39
  56. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  57. package/lib/commonjs/web/utils/common.js +3 -33
  58. package/lib/commonjs/web/utils/common.js.map +1 -1
  59. package/lib/commonjs/web/utils/unistyle.js +4 -1
  60. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  61. package/lib/module/components/useMedia.js.map +1 -1
  62. package/lib/module/components/useMedia.web.js +38 -0
  63. package/lib/module/components/useMedia.web.js.map +1 -0
  64. package/lib/module/core/createUnistylesComponent.js +55 -3
  65. package/lib/module/core/createUnistylesComponent.js.map +1 -1
  66. package/lib/module/core/createUnistylesComponent.native.js +6 -5
  67. package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
  68. package/lib/module/specs/ShadowRegistry/index.js +5 -0
  69. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  70. package/lib/module/web/convert/index.js +14 -9
  71. package/lib/module/web/convert/index.js.map +1 -1
  72. package/lib/module/web/convert/object/boxShadow.js +53 -0
  73. package/lib/module/web/convert/object/boxShadow.js.map +1 -0
  74. package/lib/module/web/convert/object/filter.js +37 -0
  75. package/lib/module/web/convert/object/filter.js.map +1 -0
  76. package/lib/module/web/convert/object/index.js +6 -0
  77. package/lib/module/web/convert/object/index.js.map +1 -0
  78. package/lib/module/web/convert/object/objectStyle.js +50 -0
  79. package/lib/module/web/convert/object/objectStyle.js.map +1 -0
  80. package/lib/module/web/convert/object/transform.js +22 -0
  81. package/lib/module/web/convert/object/transform.js.map +1 -0
  82. package/lib/module/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
  83. package/lib/module/web/convert/shadow/boxShadow.js.map +1 -0
  84. package/lib/module/web/convert/shadow/getShadowBreakpoints.js +33 -0
  85. package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
  86. package/lib/module/web/convert/shadow/index.js +5 -0
  87. package/lib/module/web/convert/shadow/index.js.map +1 -0
  88. package/lib/module/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
  89. package/lib/module/web/convert/shadow/textShadow.js.map +1 -0
  90. package/lib/module/web/convert/utils.js +4 -2
  91. package/lib/module/web/convert/utils.js.map +1 -1
  92. package/lib/module/web/listener.js +10 -0
  93. package/lib/module/web/listener.js.map +1 -1
  94. package/lib/module/web/registry.js +14 -27
  95. package/lib/module/web/registry.js.map +1 -1
  96. package/lib/module/web/runtime.js +3 -0
  97. package/lib/module/web/runtime.js.map +1 -1
  98. package/lib/module/web/shadowRegistry.js +80 -40
  99. package/lib/module/web/shadowRegistry.js.map +1 -1
  100. package/lib/module/web/utils/common.js +1 -31
  101. package/lib/module/web/utils/common.js.map +1 -1
  102. package/lib/module/web/utils/unistyle.js +4 -1
  103. package/lib/module/web/utils/unistyle.js.map +1 -1
  104. package/lib/typescript/src/components/useMedia.web.d.ts +6 -0
  105. package/lib/typescript/src/components/useMedia.web.d.ts.map +1 -0
  106. package/lib/typescript/src/core/createUnistylesComponent.d.ts +4 -3
  107. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
  108. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +4 -3
  109. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
  110. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  111. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +3 -0
  112. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  113. package/lib/typescript/src/types/common.d.ts +1 -0
  114. package/lib/typescript/src/types/common.d.ts.map +1 -1
  115. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  116. package/lib/typescript/src/web/convert/object/boxShadow.d.ts +9 -0
  117. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -0
  118. package/lib/typescript/src/web/convert/object/filter.d.ts +3 -0
  119. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -0
  120. package/lib/typescript/src/web/convert/object/index.d.ts +4 -0
  121. package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -0
  122. package/lib/typescript/src/web/convert/object/objectStyle.d.ts +5 -0
  123. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -0
  124. package/lib/typescript/src/web/convert/object/transform.d.ts +3 -0
  125. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -0
  126. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -0
  127. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts +2 -0
  128. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -0
  129. package/lib/typescript/src/web/convert/shadow/index.d.ts +3 -0
  130. package/lib/typescript/src/web/convert/shadow/index.d.ts.map +1 -0
  131. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -0
  132. package/lib/typescript/src/web/convert/types.d.ts +7 -1
  133. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  134. package/lib/typescript/src/web/convert/utils.d.ts +8 -4
  135. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  136. package/lib/typescript/src/web/create.d.ts +8 -8
  137. package/lib/typescript/src/web/index.d.ts +8 -8
  138. package/lib/typescript/src/web/listener.d.ts +2 -0
  139. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  140. package/lib/typescript/src/web/registry.d.ts +5 -9
  141. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  142. package/lib/typescript/src/web/runtime.d.ts +1 -0
  143. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  144. package/lib/typescript/src/web/shadowRegistry.d.ts +4 -1
  145. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  146. package/lib/typescript/src/web/utils/common.d.ts +1 -6
  147. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  148. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  149. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +6 -0
  150. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
  151. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void.kt +1 -0
  152. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency_.kt +1 -0
  153. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
  154. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -0
  155. package/nitrogen/generated/android/unistyles+autolinking.gradle +2 -0
  156. package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
  157. package/package.json +3 -3
  158. package/src/components/useMedia.ts +1 -1
  159. package/src/components/useMedia.web.ts +47 -0
  160. package/src/core/createUnistylesComponent.native.tsx +12 -10
  161. package/src/core/createUnistylesComponent.tsx +72 -6
  162. package/src/specs/ShadowRegistry/index.ts +5 -0
  163. package/src/specs/ShadowRegistry/types.ts +4 -1
  164. package/src/types/common.ts +1 -0
  165. package/src/web/convert/index.ts +16 -9
  166. package/src/web/convert/object/boxShadow.ts +54 -0
  167. package/src/web/convert/object/filter.ts +39 -0
  168. package/src/web/convert/object/index.ts +3 -0
  169. package/src/web/convert/object/objectStyle.ts +68 -0
  170. package/src/web/convert/object/transform.ts +24 -0
  171. package/src/web/convert/{boxShadow.ts → shadow/boxShadow.ts} +9 -30
  172. package/src/web/convert/shadow/getShadowBreakpoints.ts +34 -0
  173. package/src/web/convert/shadow/index.ts +2 -0
  174. package/src/web/convert/{textShadow.ts → shadow/textShadow.ts} +9 -29
  175. package/src/web/convert/types.ts +8 -1
  176. package/src/web/convert/utils.ts +11 -5
  177. package/src/web/listener.ts +10 -0
  178. package/src/web/registry.ts +10 -31
  179. package/src/web/runtime.ts +4 -0
  180. package/src/web/shadowRegistry.ts +85 -46
  181. package/src/web/utils/common.ts +1 -37
  182. package/src/web/utils/unistyle.ts +5 -1
  183. package/android/src/main/cxx/helpers.cpp +0 -105
  184. package/android/src/main/cxx/helpers.h +0 -16
  185. package/android/src/main/cxx/platform.cpp +0 -170
  186. package/android/src/main/cxx/platform.h +0 -20
  187. package/lib/commonjs/web/convert/boxShadow.js.map +0 -1
  188. package/lib/commonjs/web/convert/shadow.js +0 -68
  189. package/lib/commonjs/web/convert/shadow.js.map +0 -1
  190. package/lib/commonjs/web/convert/textShadow.js.map +0 -1
  191. package/lib/commonjs/web/convert/transform.js +0 -72
  192. package/lib/commonjs/web/convert/transform.js.map +0 -1
  193. package/lib/module/web/convert/boxShadow.js.map +0 -1
  194. package/lib/module/web/convert/shadow.js +0 -63
  195. package/lib/module/web/convert/shadow.js.map +0 -1
  196. package/lib/module/web/convert/textShadow.js.map +0 -1
  197. package/lib/module/web/convert/transform.js +0 -67
  198. package/lib/module/web/convert/transform.js.map +0 -1
  199. package/lib/typescript/src/web/convert/boxShadow.d.ts.map +0 -1
  200. package/lib/typescript/src/web/convert/shadow.d.ts +0 -2
  201. package/lib/typescript/src/web/convert/shadow.d.ts.map +0 -1
  202. package/lib/typescript/src/web/convert/textShadow.d.ts.map +0 -1
  203. package/lib/typescript/src/web/convert/transform.d.ts +0 -4
  204. package/lib/typescript/src/web/convert/transform.d.ts.map +0 -1
  205. package/src/web/convert/shadow.ts +0 -68
  206. package/src/web/convert/transform.ts +0 -88
  207. /package/lib/typescript/src/web/convert/{boxShadow.d.ts → shadow/boxShadow.d.ts} +0 -0
  208. /package/lib/typescript/src/web/convert/{textShadow.d.ts → shadow/textShadow.d.ts} +0 -0
@@ -1,19 +1,19 @@
1
1
  #pragma once
2
2
 
3
3
  #include "HybridUnistylesStatusBarSpec.hpp"
4
- #include "Unistyles-Swift-Cxx-Umbrella.hpp"
4
+ #include "NativePlatform.h"
5
5
  #include <optional>
6
6
 
7
7
  using namespace margelo::nitro::unistyles;
8
8
 
9
9
  struct HybridStatusBar: public HybridUnistylesStatusBarSpec {
10
10
  HybridStatusBar(Unistyles::HybridNativePlatformSpecCxx nativePlatform): HybridObject(TAG), _nativePlatform{nativePlatform} {}
11
-
11
+
12
12
  void setBackgroundColor(double color) override;
13
13
  double getWidth() override;
14
14
  double getHeight() override;
15
15
  void setHidden(bool isHidden) override;
16
-
16
+
17
17
  private:
18
18
  Unistyles::HybridNativePlatformSpecCxx _nativePlatform;
19
19
  };
@@ -4,7 +4,7 @@
4
4
  using namespace margelo::nitro::unistyles;
5
5
 
6
6
  ColorScheme HybridUnistylesRuntime::getColorScheme() {
7
- int colorScheme = this->_nativePlatform.getColorScheme();
7
+ auto colorScheme = this->_nativePlatform.getColorScheme();
8
8
 
9
9
  return static_cast<ColorScheme>(colorScheme);
10
10
  }
@@ -44,7 +44,7 @@ Insets HybridUnistylesRuntime::getInsets() {
44
44
  };
45
45
 
46
46
  Orientation HybridUnistylesRuntime::getOrientation() {
47
- int orientation = this->_nativePlatform.getOrientation();
47
+ auto orientation = this->_nativePlatform.getOrientation();
48
48
 
49
49
  return static_cast<Orientation>(orientation);
50
50
  };
@@ -61,11 +61,11 @@ std::unordered_map<std::string, double> HybridUnistylesRuntime::getBreakpoints()
61
61
  auto& state = core::UnistylesRegistry::get().getState(*_rt);
62
62
  auto sortedBreakpointPairs = state.getSortedBreakpointPairs();
63
63
  std::unordered_map<std::string, double> breakpoints{};
64
-
64
+
65
65
  std::for_each(sortedBreakpointPairs.begin(), sortedBreakpointPairs.end(), [&breakpoints](std::pair<std::string, double>& pair){
66
66
  breakpoints[pair.first] = pair.second;
67
67
  });
68
-
68
+
69
69
  return breakpoints;
70
70
  }
71
71
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include "HybridUnistylesRuntimeSpec.hpp"
4
4
  #include "HybridNativePlatformSpec.hpp"
5
- #include "Unistyles-Swift-Cxx-Umbrella.hpp"
5
+ #include "NativePlatform.h"
6
6
  #include "UnistylesState.h"
7
7
  #include "HybridUnistylesStatusBarSpec.hpp"
8
8
  #include "HybridNavigationBar.h"
@@ -65,7 +65,7 @@ struct HybridUnistylesRuntime: public HybridUnistylesRuntimeSpec {
65
65
  void setRootViewBackgroundColor(double color) override;
66
66
  UnistylesCxxMiniRuntime getMiniRuntime() override;
67
67
  std::unordered_map<std::string, double> getBreakpoints() override;
68
-
68
+
69
69
  jsi::Value getMiniRuntimeAsValue(jsi::Runtime& rt);
70
70
  jsi::Runtime& getRuntime();
71
71
  void includeDependenciesForColorSchemeChange(std::vector<UnistyleDependency>& deps);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_specs","_mq","useMedia","config","computeIsVisible","maybeMq","mq","isUnistylesMq","console","error","parsedMq","parseMq","isValidMq","width","height","UnistylesRuntime","screen","minWidth","undefined","maxWidth","minHeight","maxHeight","isVisible","setIsVisible","useState","useEffect","useLayoutEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["components/useMedia.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAF,OAAA;AAEO,MAAMG,QAAQ,GAAIC,MAAsB,IAAK;EAChD,MAAMC,gBAAgB,GAAGA,CAAA,KAAe;IACpC,MAAMC,OAAO,GAAGF,MAAM,CAACG,EAAuB;IAE9C,IAAI,CAAC,IAAAC,iBAAa,EAACF,OAAO,CAAC,EAAE;MACzBG,OAAO,CAACC,KAAK,CAAC,sCAAsCJ,OAAO,EAAE,CAAC;MAE9D,OAAO,KAAK;IAChB;IAEA,MAAMK,QAAQ,GAAI,IAAAC,WAAO,EAACN,OAAO,CAAC;IAElC,IAAI,CAAC,IAAAO,aAAS,EAACF,QAAQ,CAAC,EAAE;MACtBF,OAAO,CAACC,KAAK,CAAC,oEAAoEJ,OAAO,EAAE,CAAC;MAE5F,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEQ,KAAK;MAAEC;IAAO,CAAC,GAAGC,uBAAgB,CAACC,MAAM;IAEjD,IAAIN,QAAQ,CAACO,QAAQ,KAAKC,SAAS,IAAIL,KAAK,GAAGH,QAAQ,CAACO,QAAQ,EAAE;MAC9D,OAAO,KAAK;IAChB;IAEA,IAAIP,QAAQ,CAACS,QAAQ,KAAKD,SAAS,IAAIL,KAAK,GAAGH,QAAQ,CAACS,QAAQ,EAAE;MAC9D,OAAO,KAAK;IAChB;IAEA,IAAIT,QAAQ,CAACU,SAAS,KAAKF,SAAS,IAAIJ,MAAM,GAAGJ,QAAQ,CAACU,SAAS,EAAE;MACjE,OAAO,KAAK;IAChB;IAEA,IAAIV,QAAQ,CAACW,SAAS,KAAKH,SAAS,IAAIJ,MAAM,GAAGJ,QAAQ,CAACW,SAAS,EAAE;MACjE,OAAO,KAAK;IAChB;IAEA,OAAO,IAAI;EACf,CAAC;EACD,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAG,IAAAC,eAAQ,EAAiBpB,gBAAgB,CAAC,CAAC,CAAC;EAE9E,IAAAqB,gBAAS,EAAC,MAAM;IACZF,YAAY,CAACnB,gBAAgB,CAAC,CAAC,CAAC;EACpC,CAAC,EAAE,CAACD,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,IAAAoB,sBAAe,EAAC,MAAM;IAClB,MAAMC,oBAAoB,GAAIC,iBAAU,CAAyBC,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,WAAW,CAAC,EAAE;QACvDV,YAAY,CAACnB,gBAAgB,CAAC,CAAC,CAAC;MACpC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTuB,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,CAACxB,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,OAAO;IACHgB;EACJ,CAAC;AACL,CAAC;AAAAY,OAAA,CAAAhC,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_specs","_mq","useMedia","config","computeIsVisible","maybeMq","mq","isUnistylesMq","console","error","parsedMq","parseMq","isValidMq","width","height","UnistylesRuntime","screen","minWidth","undefined","maxWidth","minHeight","maxHeight","isVisible","setIsVisible","useState","useEffect","useLayoutEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["components/useMedia.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAF,OAAA;AAEO,MAAMG,QAAQ,GAAIC,MAA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,EAAE,CAAC,CAAC;EAEf,IAAAoB,sBAAe,EAAC,MAAM;IAClB,MAAMC,oBAAoB,GAAIC,iBAAU,CAAyBC,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,WAAW,CAAC,EAAE;QACvDV,YAAY,CAACnB,gBAAgB,CAAC,CAAC,CAAC;MACpC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTuB,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,CAACxB,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,OAAO;IACHgB;EACJ,CAAC;AACL,CAAC;AAAAY,OAAA,CAAAhC,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMedia = void 0;
7
+ var _react = require("react");
8
+ var _mq = require("../mq");
9
+ const useMedia = config => {
10
+ const disposeRef = (0, _react.useRef)(() => {});
11
+ const [isVisible, setIsVisible] = (0, _react.useState)(() => {
12
+ const maybeMq = config.mq;
13
+ if (!(0, _mq.isUnistylesMq)(maybeMq)) {
14
+ console.error(`🦄 Unistyles: Received invalid mq: ${maybeMq}`);
15
+ return false;
16
+ }
17
+ const parsedMq = (0, _mq.parseMq)(maybeMq);
18
+ if (!(0, _mq.isValidMq)(parsedMq)) {
19
+ console.error(`🦄 Unistyles: Received invalid mq where min is greater than max: ${maybeMq}`);
20
+ return false;
21
+ }
22
+ const {
23
+ minWidth,
24
+ maxWidth,
25
+ minHeight,
26
+ maxHeight
27
+ } = parsedMq;
28
+ const mediaQuery = [minWidth !== undefined ? `(min-width: ${minWidth}px)` : undefined, maxWidth !== undefined ? `(max-width: ${maxWidth}px)` : undefined, minHeight !== undefined ? `(min-height: ${minHeight}px)` : undefined, maxHeight !== undefined ? `(max-height: ${maxHeight}px)` : undefined].filter(Boolean).join(' and ');
29
+ const media = window.matchMedia(mediaQuery);
30
+ const handler = event => setIsVisible(event.matches);
31
+ media.addEventListener('change', handler);
32
+ disposeRef.current = () => media.removeEventListener('change', handler);
33
+ return media.matches;
34
+ });
35
+
36
+ // Unmount
37
+ (0, _react.useEffect)(() => () => disposeRef.current(), []);
38
+ return {
39
+ isVisible
40
+ };
41
+ };
42
+ exports.useMedia = useMedia;
43
+ //# sourceMappingURL=useMedia.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_mq","useMedia","config","disposeRef","useRef","isVisible","setIsVisible","useState","maybeMq","mq","isUnistylesMq","console","error","parsedMq","parseMq","isValidMq","minWidth","maxWidth","minHeight","maxHeight","mediaQuery","undefined","filter","Boolean","join","media","window","matchMedia","handler","event","matches","addEventListener","current","removeEventListener","useEffect","exports"],"sourceRoot":"../../../src","sources":["components/useMedia.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA;AAEO,MAAME,QAAQ,GAAIC,MAAsB,IAAK;EAChD,MAAMC,UAAU,GAAG,IAAAC,aAAM,EAAC,MAAM,CAAC,CAAC,CAAC;EACnC,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAG,IAAAC,eAAQ,EAAC,MAAM;IAC7C,MAAMC,OAAO,GAAGN,MAAM,CAACO,EAAuB;IAE9C,IAAI,CAAC,IAAAC,iBAAa,EAACF,OAAO,CAAC,EAAE;MACzBG,OAAO,CAACC,KAAK,CAAC,sCAAsCJ,OAAO,EAAE,CAAC;MAE9D,OAAO,KAAK;IAChB;IAEA,MAAMK,QAAQ,GAAG,IAAAC,WAAO,EAACN,OAAO,CAAC;IAEjC,IAAI,CAAC,IAAAO,aAAS,EAACF,QAAQ,CAAC,EAAE;MACtBF,OAAO,CAACC,KAAK,CAAC,oEAAoEJ,OAAO,EAAE,CAAC;MAE5F,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEQ,QAAQ;MAAEC,QAAQ;MAAEC,SAAS;MAAEC;IAAU,CAAC,GAAGN,QAAQ;IAE7D,MAAMO,UAAU,GAAG,CACfJ,QAAQ,KAAKK,SAAS,GAAG,eAAeL,QAAQ,KAAK,GAAGK,SAAS,EACjEJ,QAAQ,KAAKI,SAAS,GAAG,eAAeJ,QAAQ,KAAK,GAAGI,SAAS,EACjEH,SAAS,KAAKG,SAAS,GAAG,gBAAgBH,SAAS,KAAK,GAAGG,SAAS,EACpEF,SAAS,KAAKE,SAAS,GAAG,gBAAgBF,SAAS,KAAK,GAAGE,SAAS,CACvE,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;IAE/B,MAAMC,KAAK,GAAGC,MAAM,CAACC,UAAU,CAACP,UAAU,CAAC;IAC3C,MAAMQ,OAAO,GAAIC,KAA0B,IAAKvB,YAAY,CAACuB,KAAK,CAACC,OAAO,CAAC;IAE3EL,KAAK,CAACM,gBAAgB,CAAC,QAAQ,EAAEH,OAAO,CAAC;IACzCzB,UAAU,CAAC6B,OAAO,GAAG,MAAMP,KAAK,CAACQ,mBAAmB,CAAC,QAAQ,EAAEL,OAAO,CAAC;IAEvE,OAAOH,KAAK,CAACK,OAAO;EACxB,CAAC,CAAC;;EAEF;EACA,IAAAI,gBAAS,EAAC,MAAM,MAAM/B,UAAU,CAAC6B,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;EAE/C,OAAO;IACH3B;EACJ,CAAC;AACL,CAAC;AAAA8B,OAAA,CAAAlC,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -4,14 +4,67 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createUnistylesComponent = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _specs = require("../specs");
9
+ var _NativePlatform = require("../specs/NativePlatform");
10
+ var _listener = require("../web/listener");
11
+ var _web = require("../web");
12
+ var _utils = require("../web/utils");
8
13
  var _jsxRuntime = require("react/jsx-runtime");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
16
  const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
11
- const createUnistylesComponent = (Component, _ = () => ({})) => {
17
+ const ALL_DEPENDENCIES = Object.values(_NativePlatform.UnistyleDependency).filter(dependency => typeof dependency === 'number');
18
+ const useShadowRegistry = style => {
19
+ const [classNames, setClassNames] = (0, _react.useState)([]);
20
+ const [ref] = (0, _react.useState)(document.createElement('div'));
21
+ if (style) {
22
+ _web.UnistylesShadowRegistry.add(ref, style).then(newClassNames => {
23
+ if ((0, _utils.equal)(classNames, newClassNames)) {
24
+ return;
25
+ }
26
+ setClassNames(newClassNames);
27
+ });
28
+ }
29
+ (0, _react.useEffect)(() => () => {
30
+ // Remove styles on unmount
31
+ _web.UnistylesShadowRegistry.add(null, style);
32
+ });
33
+ return classNames;
34
+ };
35
+ const createUnistylesComponent = (Component, mappings) => {
12
36
  return props => {
37
+ const [mappingsProps, setMappingsProps] = (0, _react.useState)(mappings?.(_specs.UnistylesRuntime.getTheme()));
38
+ const styleClassNames = useShadowRegistry(props.style);
39
+ const contentContainerStyleClassNames = useShadowRegistry(props.contentContainerStyle);
40
+ (0, _react.useEffect)(() => {
41
+ const disposeMappings = _listener.UnistylesListener.addListeners(ALL_DEPENDENCIES, () => {
42
+ if (!mappings) {
43
+ disposeMappings();
44
+ return;
45
+ }
46
+ return setMappingsProps(mappings(_specs.UnistylesRuntime.getTheme()));
47
+ });
48
+ return () => disposeMappings();
49
+ }, [mappingsProps, props.style]);
50
+ const combinedProps = {
51
+ ...mappingsProps,
52
+ ...props,
53
+ ...(props.style ? {
54
+ style: {
55
+ $$css: true,
56
+ 'unistyles': styleClassNames.join(' ')
57
+ }
58
+ } : {}),
59
+ ...(props.contentContainerStyle ? {
60
+ style: {
61
+ $$css: true,
62
+ 'unistyles': contentContainerStyleClassNames.join(' ')
63
+ }
64
+ } : {})
65
+ };
13
66
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
14
- ...props
67
+ ...combinedProps
15
68
  });
16
69
  };
17
70
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_jsxRuntime","e","__esModule","default","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","_","props","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsE,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKtE,MAAMG,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAElE,MAAMC,wBAAwB,GAAGA,CAA+BC,SAAY,EAAEC,CAAc,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC,KAAK;EACjH,OAAQC,KAAwB,IAAK;IACjC,oBAAO,IAAAR,WAAA,CAAAS,GAAA,EAACH,SAAS;MAAA,GAAKE;IAAK,CAAG,CAAC;EACnC,CAAC;AACL,CAAC;AAAAE,OAAA,CAAAL,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_NativePlatform","_listener","_web","_utils","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SUPPORTED_STYLE_PROPS","ALL_DEPENDENCIES","values","UnistyleDependency","filter","dependency","useShadowRegistry","style","classNames","setClassNames","useState","ref","document","createElement","UnistylesShadowRegistry","add","then","newClassNames","equal","useEffect","createUnistylesComponent","Component","mappings","props","mappingsProps","setMappingsProps","UnistylesRuntime","getTheme","styleClassNames","contentContainerStyleClassNames","contentContainerStyle","disposeMappings","UnistylesListener","addListeners","combinedProps","$$css","join","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAoC,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAA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E;UACH4B,KAAK,EAAE,IAAI;UACX,WAAW,EAAEN,+BAA+B,CAACO,IAAI,CAAC,GAAG;QACzD;MACJ,CAAC,GAAG,CAAC,CAAC;IACV,CAAsB;IAEtB,oBAAO,IAAAzD,WAAA,CAAA0D,GAAA,EAAChB,SAAS;MAAA,GAAKa;IAAa,CAAG,CAAC;EAC3C,CAAC;AACL,CAAC;AAAAI,OAAA,CAAAlB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -10,7 +10,7 @@ var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
11
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
12
  const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
13
- const createUnistylesComponent = (Component, mappings = () => ({})) => {
13
+ const createUnistylesComponent = (Component, mappings) => {
14
14
  return props => {
15
15
  const [theme, setTheme] = (0, _react.useState)(_specs.UnistylesRuntime.getTheme());
16
16
  const [, setRt] = (0, _react.useState)(0);
@@ -22,6 +22,8 @@ const createUnistylesComponent = (Component, mappings = () => ({})) => {
22
22
  if (Array.isArray(props[propName])) {
23
23
  console.error(`🦄 Unistyles: createUnistylesComponent requires ${propName} to be an object. Please check props for component: ${Component.displayName}`);
24
24
  }
25
+
26
+ // @ts-expect-error - this is hidden from TS
25
27
  if (props[propName].__unistyles_name && !props[propName].__proto__?.getStyle) {
26
28
  console.error(`🦄 Unistyles: createUnistylesComponent received style that is not bound. You likely used the spread operator on a Unistyle style. Please check props for component: ${Component.displayName}`);
27
29
  }
@@ -34,7 +36,7 @@ const createUnistylesComponent = (Component, mappings = () => ({})) => {
34
36
  }
35
37
  (0, _react.useEffect)(() => {
36
38
  const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
37
- const componentDependencies = props.style?.__proto__.uni__dependencies || mappings(theme).style?.__proto__.uni__dependencies;
39
+ const componentDependencies = props.style?.__proto__.uni__dependencies || mappings?.(theme).style?.__proto__.uni__dependencies;
38
40
  if (dependencies.includes(_specs.UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(_specs.UnistyleDependency.Theme))) {
39
41
  setTheme(_specs.UnistylesRuntime.getTheme());
40
42
 
@@ -43,6 +45,7 @@ const createUnistylesComponent = (Component, mappings = () => ({})) => {
43
45
  if (props?.[propName]) {
44
46
  stylesRef.current = {
45
47
  ...stylesRef.current,
48
+ // @ts-expect-error - this is hidden from TS
46
49
  [propName]: props[propName].__proto__?.getStyle() || props[propName]
47
50
  };
48
51
  }
@@ -57,9 +60,7 @@ const createUnistylesComponent = (Component, mappings = () => ({})) => {
57
60
  removeChangeListener();
58
61
  };
59
62
  }, []);
60
- const mergedProps = {
61
- ...mappings(theme)
62
- };
63
+ const mergedProps = mappings?.(theme) ?? {};
63
64
  Object.keys(props).forEach(key => {
64
65
  if (key in mergedProps) {
65
66
  mergedProps[key] = Object.assign(props[key], mergedProps[key]);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","theme","setTheme","useState","UnistylesRuntime","getTheme","setRt","stylesRef","useRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","getStyle","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","UnistyleDependency","Theme","some","dependency","prevState","mergedProps","keys","key","assign","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAqG,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAA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C;MAC1B,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,MAAMa,WAAW,GAAG;MAAE,GAAGnC,QAAQ,CAACE,KAAK;IAAE,CAAsB;IAE/Db,MAAM,CAAC+C,IAAI,CAACnC,KAAK,CAAC,CAACW,OAAO,CAACyB,GAAG,IAAI;MAC9B,IAAIA,GAAG,IAAIF,WAAW,EAAE;QACpBA,WAAW,CAACE,GAAG,CAAC,GAAGhD,MAAM,CAACiD,MAAM,CAACrC,KAAK,CAACoC,GAAG,CAAC,EAAEF,WAAW,CAACE,GAAG,CAAC,CAAC;QAE9D;MACJ;MAEAF,WAAW,CAACE,GAAG,CAAC,GAAGpC,KAAK,CAACoC,GAAG,CAAC;IACjC,CAAC,CAAC;;IAEF;IACAxC,qBAAqB,CAACe,OAAO,CAACC,QAAQ,IAAI;MACtC,IAAIsB,WAAW,CAACtB,QAAQ,CAAC,EAAE;QACvBsB,WAAW,CAACtB,QAAQ,CAAC,GAAGL,SAAS,CAACG,OAAO,CAACE,QAAQ,CAAC;MACvD;IACJ,CAAC,CAAC;IAEFH,WAAW,CAACC,OAAO,GAAG,KAAK;IAE3B,oBAAO,IAAAnC,WAAA,CAAA+D,GAAA,EAACxC,SAAS;MAAA,GAAKoC;IAAW,CAAG,CAAC;EACzC,CAAC;AACL,CAAC;AAAAK,OAAA,CAAA1C,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","theme","setTheme","useState","UnistylesRuntime","getTheme","setRt","stylesRef","useRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","getStyle","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","UnistyleDependency","Theme","some","dependency","prevState","mergedProps","keys","key","assign","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAqG,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IA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IAA2B,CAAC,CAAC;IAElEb,MAAM,CAAC+C,IAAI,CAACnC,KAAK,CAAC,CAACW,OAAO,CAACyB,GAAG,IAAI;MAC9B,IAAIA,GAAG,IAAIF,WAAW,EAAE;QACpBA,WAAW,CAACE,GAAG,CAAC,GAAGhD,MAAM,CAACiD,MAAM,CAACrC,KAAK,CAACoC,GAAG,CAAuB,EAAEF,WAAW,CAACE,GAAG,CAAC,CAAC;QAEpF;MACJ;MAEAF,WAAW,CAACE,GAAG,CAAC,GAAGpC,KAAK,CAACoC,GAAG,CAAuB;IACvD,CAAC,CAAC;;IAEF;IACAxC,qBAAqB,CAACe,OAAO,CAACC,QAAQ,IAAI;MACtC,IAAIsB,WAAW,CAACtB,QAAQ,CAAC,EAAE;QACvBsB,WAAW,CAACtB,QAAQ,CAAC,GAAGL,SAAS,CAACG,OAAO,CAACE,QAAQ,CAAC;MACvD;IACJ,CAAC,CAAC;IAEFH,WAAW,CAACC,OAAO,GAAG,KAAK;IAE3B,oBAAO,IAAAnC,WAAA,CAAA+D,GAAA,EAACxC,SAAS;MAAA,GAAKoC;IAAW,CAAa,CAAC;EACnD,CAAC;AACL,CAAC;AAAAK,OAAA,CAAA1C,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -19,6 +19,11 @@ HybridShadowRegistry.add = (handle, style, variants, args) => {
19
19
  if (!handle || !style) {
20
20
  return;
21
21
  }
22
+
23
+ // don't register Reanimated styles
24
+ if (style?.initial?.updater) {
25
+ return;
26
+ }
22
27
  HybridShadowRegistry.link(findShadowNodeForHandle(handle), style, variants ?? {}, args ?? []);
23
28
  };
24
29
  HybridShadowRegistry.remove = handle => {
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeNitroModules","require","HybridShadowRegistry","NitroModules","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","add","style","variants","args","link","remove","unlink","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAaA,MAAMC,oBAAoB,GAAGC,qCAAY,CAACC,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEhF,IAAI,CAACA,IAAI,EAAE;IACP;IACA,MAAM,IAAIK,KAAK,CAAC,uDAAuD,CAAC;EAC5E;EAEA,OAAOL,IAAI;AACf,CAAC;AAEDL,oBAAoB,CAACW,GAAG,GAAG,CAACP,MAAM,EAAEQ,KAAK,EAAEC,QAAQ,EAAEC,IAAI,KAAK;EAC1D;EACA,IAAI,CAACV,MAAM,IAAI,CAACQ,KAAK,EAAE;IACnB;EACJ;EAEAZ,oBAAoB,CAACe,IAAI,CAACZ,uBAAuB,CAACC,MAAM,CAAC,EAAEQ,KAAK,EAAEC,QAAQ,IAAI,CAAC,CAAC,EAAEC,IAAI,IAAI,EAAE,CAAC;AACjG,CAAC;AAEDd,oBAAoB,CAACgB,MAAM,GAAGZ,MAAM,IAAI;EACpC,IAAI,CAACA,MAAM,EAAE;IACT;EACJ;EAEAJ,oBAAoB,CAACiB,MAAM,CAACd,uBAAuB,CAACC,MAAM,CAAC,CAAC;AAChE,CAAC;AAQM,MAAMc,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAGlB,oBAA4D","ignoreList":[]}
1
+ {"version":3,"names":["_reactNativeNitroModules","require","HybridShadowRegistry","NitroModules","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","add","style","variants","args","initial","updater","link","remove","unlink","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAaA,MAAMC,oBAAoB,GAAGC,qCAAY,CAACC,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEhF,IAAI,CAACA,IAAI,EAAE;IACP;IACA,MAAM,IAAIK,KAAK,CAAC,uDAAuD,CAAC;EAC5E;EAEA,OAAOL,IAAI;AACf,CAAC;AAEDL,oBAAoB,CAACW,GAAG,GAAG,CAACP,MAAM,EAAEQ,KAAK,EAAEC,QAAQ,EAAEC,IAAI,KAAK;EAC1D;EACA,IAAI,CAACV,MAAM,IAAI,CAACQ,KAAK,EAAE;IACnB;EACJ;;EAEA;EACA,IAAIA,KAAK,EAAEG,OAAO,EAAEC,OAAO,EAAE;IACzB;EACJ;EAEAhB,oBAAoB,CAACiB,IAAI,CAACd,uBAAuB,CAACC,MAAM,CAAC,EAAEQ,KAAK,EAAEC,QAAQ,IAAI,CAAC,CAAC,EAAEC,IAAI,IAAI,EAAE,CAAC;AACjG,CAAC;AAEDd,oBAAoB,CAACkB,MAAM,GAAGd,MAAM,IAAI;EACpC,IAAI,CAACA,MAAM,EAAE;IACT;EACJ;EAEAJ,oBAAoB,CAACmB,MAAM,CAAChB,uBAAuB,CAACC,MAAM,CAAC,CAAC;AAChE,CAAC;AAQM,MAAMgB,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAGpB,oBAA4D","ignoreList":[]}
@@ -7,15 +7,14 @@ exports.convertUnistyles = void 0;
7
7
  var _pseudo = require("./pseudo");
8
8
  var _style = require("./style");
9
9
  var _utils = require("../utils");
10
- var _transform = require("./transform");
10
+ var _object = require("./object");
11
11
  var _utils2 = require("./utils");
12
- var _textShadow = require("./textShadow");
13
- var _boxShadow = require("./boxShadow");
12
+ var _shadow = require("./shadow");
14
13
  const convertUnistyles = value => {
15
14
  // Flag to mark if textShadow is already created
16
15
  let hasTextShadow = false;
17
16
  // Flag to mark if boxShadow is already created
18
- let hasBoxShadow = false;
17
+ let hasShadow = false;
19
18
  const stylesArray = Object.entries({
20
19
  ...value,
21
20
  ...value._web
@@ -39,21 +38,27 @@ const convertUnistyles = value => {
39
38
  return [];
40
39
  }
41
40
  hasTextShadow = true;
42
- return (0, _textShadow.getTextShadowStyle)(value);
41
+ return (0, _shadow.getTextShadowStyle)(value);
43
42
  }
44
43
 
45
- // Box shadow
46
- if ((0, _utils2.isBoxShadow)(unistylesKey)) {
47
- if (hasBoxShadow) {
44
+ // RN shadows
45
+ if ((0, _utils2.isShadow)(unistylesKey)) {
46
+ if (hasShadow) {
48
47
  return [];
49
48
  }
50
- hasBoxShadow = true;
51
- return (0, _boxShadow.getBoxShadowStyle)(value);
49
+ hasShadow = true;
50
+ return (0, _shadow.getBoxShadowStyle)(value);
51
+ }
52
+ if ((0, _utils2.isFilter)(unistylesKey, unistylesValue)) {
53
+ return (0, _object.getFilterStyle)(unistylesValue);
54
+ }
55
+ if ((0, _utils2.isBoxShadow)(unistylesKey, unistylesValue)) {
56
+ return (0, _object.getBoxShadow)(unistylesValue);
52
57
  }
53
58
 
54
59
  // Transforms
55
60
  if ((0, _utils2.isTransform)(unistylesKey, unistylesValue)) {
56
- return (0, _transform.getTransformStyle)(unistylesValue);
61
+ return (0, _object.getTransformStyle)(unistylesValue);
57
62
  }
58
63
 
59
64
  // Breakpoints
@@ -1 +1 @@
1
- {"version":3,"names":["_pseudo","require","_style","_utils","_transform","_utils2","_textShadow","_boxShadow","convertUnistyles","value","hasTextShadow","hasBoxShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","isPseudo","flattenValues","isTextShadow","getTextShadowStyle","isBoxShadow","getBoxShadowStyle","isTransform","getTransformStyle","map","breakpointKey","breakpointValue","getStyle","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAEO,MAAMO,gBAAgB,GAAIC,KAAsB,IAAK;EACxD;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,YAAY,GAAG,KAAK;EAExB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO,CAAC;IAC/B,GAAGL,KAAK;IACR,GAAGA,KAAK,CAACM;EACb,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,YAAY,EAAEC,cAAc,CAAC,KAAK;IAC3C;IACA,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,uBAAuB,CAAC,CAACC,QAAQ,CAACF,YAAY,CAAC,IAAIA,YAAY,CAACG,UAAU,CAAC,UAAU,CAAC,EAAE;MACrK,OAAO,EAAE;IACb;;IAEA;IACA,IAAI,IAAAC,gBAAQ,EAACJ,YAAY,CAAC,EAAE;MACxB,MAAMK,aAAa,GAAGd,gBAAgB,CAACU,cAAiC,CAAC;MAEzE,OAAO;QAAE,CAACD,YAAY,GAAGK;MAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,IAAAC,oBAAY,EAACN,YAAY,CAAC,EAAE;MAC5B,IAAIP,aAAa,EAAE;QACf,OAAO,EAAE;MACb;MAEAA,aAAa,GAAG,IAAI;MAEpB,OAAO,IAAAc,8BAAkB,EAACf,KAAK,CAAC;IACpC;;IAEA;IACA,IAAI,IAAAgB,mBAAW,EAACR,YAAY,CAAC,EAAE;MAC3B,IAAIN,YAAY,EAAE;QACd,OAAO,EAAE;MACb;MAEAA,YAAY,GAAG,IAAI;MAEnB,OAAO,IAAAe,4BAAiB,EAACjB,KAAK,CAAC;IACnC;;IAEA;IACA,IAAI,IAAAkB,mBAAW,EAACV,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAO,IAAAU,4BAAiB,EAACV,cAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOL,MAAM,CAACC,OAAO,CAACI,cAAc,CAAC,CAACW,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAG,IAAAE,eAAQ,EAACf,YAAY,EAAEc,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAO,IAAAC,eAAQ,EAACf,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAO,IAAAe,uBAAgB,EAAC,GAAGrB,WAAW,CAAC;AAC3C,CAAC;AAAAsB,OAAA,CAAA1B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_pseudo","require","_style","_utils","_object","_utils2","_shadow","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","isPseudo","flattenValues","isTextShadow","getTextShadowStyle","isShadow","getBoxShadowStyle","isFilter","getFilterStyle","isBoxShadow","getBoxShadow","isTransform","getTransformStyle","map","breakpointKey","breakpointValue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G,IAAI;MAEhB,OAAO,IAAAe,yBAAiB,EAACjB,KAAK,CAAC;IACnC;IAEA,IAAI,IAAAkB,gBAAQ,EAACV,YAAY,EAAEC,cAAc,CAAC,EAAE;MACxC,OAAO,IAAAU,sBAAc,EAACV,cAAc,CAAC;IACzC;IAEA,IAAI,IAAAW,mBAAW,EAACZ,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAO,IAAAY,oBAAY,EAACZ,cAAc,CAAC;IACvC;;IAEA;IACA,IAAI,IAAAa,mBAAW,EAACd,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAO,IAAAc,yBAAiB,EAACd,cAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOL,MAAM,CAACC,OAAO,CAACI,cAAc,CAAC,CAACe,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAG,IAAAE,eAAQ,EAACnB,YAAY,EAAEkB,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAO,IAAAC,eAAQ,EAACnB,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAO,IAAAmB,uBAAgB,EAAC,GAAGzB,WAAW,CAAC;AAC3C,CAAC;AAAA0B,OAAA,CAAA9B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBoxShadow = void 0;
7
+ var _utils = require("../utils");
8
+ var _utils2 = require("../../utils");
9
+ const createBoxShadowValue = style => {
10
+ const {
11
+ offsetX,
12
+ offsetY,
13
+ blurRadius = 0,
14
+ spreadDistance = 0,
15
+ color = '#000',
16
+ inset
17
+ } = style;
18
+ return `${inset ? 'inset ' : ''}${(0, _utils.normalizeNumericValue)(offsetX)} ${(0, _utils.normalizeNumericValue)(offsetY)} ${(0, _utils.normalizeNumericValue)(blurRadius)} ${(0, _utils.normalizeNumericValue)(spreadDistance)} ${color}`;
19
+ };
20
+ const getBoxShadow = boxShadow => {
21
+ const breakpoints = new Set();
22
+ boxShadow.forEach(shadow => {
23
+ const [key] = Object.keys(shadow);
24
+ const value = shadow[key];
25
+
26
+ // Breakpoints
27
+ if (typeof value === 'object') {
28
+ Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
29
+ }
30
+ });
31
+ if (breakpoints.size === 0) {
32
+ const boxShadowStyle = Object.fromEntries(boxShadow.map(shadow => {
33
+ const [key] = Object.keys(shadow);
34
+ return [key, shadow[key]];
35
+ }));
36
+ return {
37
+ boxShadow: createBoxShadowValue(boxShadowStyle)
38
+ };
39
+ }
40
+ const breakpointStyles = Array.from(breakpoints).map(breakpoint => {
41
+ const styles = Object.fromEntries(boxShadow.map(shadow => {
42
+ const [key] = Object.keys(shadow);
43
+ const value = shadow[key];
44
+ if (typeof value === 'object' && (0, _utils2.keyInObject)(value, breakpoint)) {
45
+ return [key, value[breakpoint]];
46
+ }
47
+ return [key, value];
48
+ }));
49
+ return {
50
+ [breakpoint]: {
51
+ boxShadow: createBoxShadowValue(styles)
52
+ }
53
+ };
54
+ });
55
+ return (0, _utils2.deepMergeObjects)(...breakpointStyles);
56
+ };
57
+ exports.getBoxShadow = getBoxShadow;
58
+ //# sourceMappingURL=boxShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","_utils2","createBoxShadowValue","style","offsetX","offsetY","blurRadius","spreadDistance","color","inset","normalizeNumericValue","getBoxShadow","boxShadow","breakpoints","Set","forEach","shadow","key","Object","keys","value","breakpoint","add","size","boxShadowStyle","fromEntries","map","breakpointStyles","Array","from","styles","keyInObject","deepMergeObjects","exports"],"sourceRoot":"../../../../../src","sources":["web/convert/object/boxShadow.ts"],"mappings":";;;;;;AACA,IAAAA,MA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IAEH,OAAO;MACHL,SAAS,EAAEV,oBAAoB,CAACsB,cAAc;IAClD,CAAC;EACL;EAEA,MAAMG,gBAAgB,GAAGC,KAAK,CAACC,IAAI,CAAChB,WAAW,CAAC,CAACa,GAAG,CAACL,UAAU,IAAI;IAC/D,MAAMS,MAAM,GAAGZ,MAAM,CAACO,WAAW,CAACb,SAAS,CAACc,GAAG,CAACV,MAAM,IAAI;MACtD,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC;MACjC,MAAMI,KAAK,GAAGJ,MAAM,CAACC,GAAG,CAAyB;MAEjD,IAAI,OAAOG,KAAK,KAAK,QAAQ,IAAI,IAAAW,mBAAW,EAACX,KAAK,EAAEC,UAAU,CAAC,EAAE;QAC7D,OAAO,CAACJ,GAAG,EAAEG,KAAK,CAACC,UAAU,CAAC,CAAC;MACnC;MAEA,OAAO,CAACJ,GAAG,EAAEG,KAAK,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO;MACH,CAACC,UAAU,GAAG;QACVT,SAAS,EAAEV,oBAAoB,CAAC4B,MAAM;MAC1C;IACJ,CAAC;EACL,CAAC,CAAC;EAEF,OAAO,IAAAE,wBAAgB,EAAC,GAAGL,gBAAgB,CAAC;AAChD,CAAC;AAAAM,OAAA,CAAAtB,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getFilterStyle = void 0;
7
+ var _utils = require("../../utils");
8
+ var _objectStyle = require("./objectStyle");
9
+ var _utils2 = require("../utils");
10
+ var _runtime = require("../../runtime");
11
+ var _mq = require("../../../mq");
12
+ const getDropShadowStyle = dropShadow => {
13
+ const {
14
+ offsetX = 0,
15
+ offsetY = 0,
16
+ standardDeviation = 0,
17
+ color = '#000'
18
+ } = dropShadow;
19
+ return `${(0, _utils2.normalizeColor)(String(color))} ${(0, _utils2.normalizeNumericValue)(offsetX)} ${(0, _utils2.normalizeNumericValue)(offsetY)} ${(0, _utils2.normalizeNumericValue)(standardDeviation)}`;
20
+ };
21
+ const getFilterStyle = filters => {
22
+ const restFilters = filters.filter(filter => Object.keys(filter)[0] !== 'dropShadow');
23
+ const dropShadow = (() => {
24
+ const dropShadowValue = filters.find(filter => Object.keys(filter)[0] === 'dropShadow')?.dropShadow;
25
+ if (typeof dropShadowValue !== 'object') {
26
+ return [];
27
+ }
28
+ const breakpoints = Object.keys(dropShadowValue).filter(key => Object.keys(_runtime.UnistylesRuntime.breakpoints).includes(key) || (0, _mq.isUnistylesMq)(key));
29
+ const breakpointsDropShadow = Object.fromEntries(breakpoints.map(breakpoint => [breakpoint, getDropShadowStyle(dropShadowValue[breakpoint])]));
30
+ if (breakpoints.length === 0) {
31
+ return [{
32
+ dropShadow: getDropShadowStyle(dropShadowValue)
33
+ }];
34
+ }
35
+ return [{
36
+ dropShadow: breakpointsDropShadow
37
+ }];
38
+ })();
39
+ return (0, _objectStyle.getObjectStyle)([...restFilters, ...dropShadow], 'filter', (key, value) => `${(0, _utils.hyphenate)(key)}(${(0, _utils2.normalizeNumericValue)(value)})`);
40
+ };
41
+ exports.getFilterStyle = getFilterStyle;
42
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","_objectStyle","_utils2","_runtime","_mq","getDropShadowStyle","dropShadow","offsetX","offsetY","standardDeviation","color","normalizeColor","String","normalizeNumericValue","getFilterStyle","filters","restFilters","filter","Object","keys","dropShadowValue","find","breakpoints","key","UnistylesRuntime","includes","isUnistylesMq","breakpointsDropShadow","fromEntries","map","breakpoint","length","getObjectStyle","value","hyphenate","exports"],"sourceRoot":"../../../../../src","sources":["web/convert/object/filter.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAA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,CAAC,CAAC,CAAC,CAAC;IAE9I,IAAIR,WAAW,CAACS,MAAM,KAAK,CAAC,EAAE;MAC1B,OAAO,CAAC;QACJzB,UAAU,EAAED,kBAAkB,CAACe,eAAkC;MACrE,CAAC,CAAC;IACN;IAEA,OAAO,CAAC;MACJd,UAAU,EAAEqB;IAChB,CAAC,CAAC;EACN,CAAC,EAAE,CAAC;EAEJ,OAAO,IAAAK,2BAAc,EAAC,CAAC,GAAGhB,WAAW,EAAE,GAAGV,UAAU,CAAC,EAAE,QAAQ,EAAE,CAACiB,GAAG,EAAEU,KAAK,KAAK,GAAG,IAAAC,gBAAS,EAACX,GAAG,CAAC,IAAI,IAAAV,6BAAqB,EAACoB,KAAwB,CAAC,GAAG,CAAC;AAC7J,CAAC;AAAAE,OAAA,CAAArB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _transform = require("./transform");
7
+ Object.keys(_transform).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _transform[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _transform[key];
14
+ }
15
+ });
16
+ });
17
+ var _boxShadow = require("./boxShadow");
18
+ Object.keys(_boxShadow).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _boxShadow[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _boxShadow[key];
25
+ }
26
+ });
27
+ });
28
+ var _filter = require("./filter");
29
+ Object.keys(_filter).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _filter[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _filter[key];
36
+ }
37
+ });
38
+ });
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_transform","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_boxShadow","_filter"],"sourceRoot":"../../../../../src","sources":["web/convert/object/index.ts"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,OAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getObjectStyle = void 0;
7
+ var _utils = require("../../utils");
8
+ const createStylesValue = (styles, normalize) => styles.map(style => {
9
+ const [key] = Object.keys(style);
10
+ if (!key) {
11
+ return undefined;
12
+ }
13
+ return normalize(key, style[key]);
14
+ }).filter(Boolean).join(' ');
15
+ const getObjectStyle = (styles, styleKey, normalize) => {
16
+ const breakpoints = new Set();
17
+ const normalStyles = [];
18
+ styles.forEach(style => {
19
+ const [property] = Object.keys(style);
20
+ if (!property) {
21
+ return;
22
+ }
23
+ const value = style[property];
24
+ if (typeof value === 'object' && !Array.isArray(value)) {
25
+ Object.keys(value ?? {}).forEach(breakpoint => breakpoints.add(breakpoint));
26
+ return;
27
+ }
28
+ normalStyles.push(style);
29
+ });
30
+ const breakpointStyles = Array.from(breakpoints).flatMap(breakpoint => {
31
+ const stylesPerBreakpoint = styles.flatMap(style => {
32
+ const [property] = Object.keys(style);
33
+ if (!property) {
34
+ return [];
35
+ }
36
+ const value = style[property];
37
+ if (typeof value === 'object' && !Array.isArray(value)) {
38
+ return (0, _utils.keyInObject)(value, breakpoint) ? [{
39
+ [property]: value[breakpoint]
40
+ }] : [];
41
+ }
42
+ return [];
43
+ });
44
+ return [{
45
+ [breakpoint]: {
46
+ [styleKey]: createStylesValue(stylesPerBreakpoint, normalize)
47
+ }
48
+ }];
49
+ });
50
+ return (0, _utils.deepMergeObjects)({
51
+ [styleKey]: createStylesValue(normalStyles, normalize)
52
+ }, ...breakpointStyles);
53
+ };
54
+ exports.getObjectStyle = getObjectStyle;
55
+ //# sourceMappingURL=objectStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","createStylesValue","styles","normalize","map","style","key","Object","keys","undefined","filter","Boolean","join","getObjectStyle","styleKey","breakpoints","Set","normalStyles","forEach","property","value","Array","isArray","breakpoint","add","push","breakpointStyles","from","flatMap","stylesPerBreakpoint","keyInObject","deepMergeObjects","exports"],"sourceRoot":"../../../../../src","sources":["web/convert/object/objectStyle.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA,MAAMC,iBAAiB,GAAGA,CAAyBC,MAAsB,EAAEC,SAA6B,KAAKD,MAAM,CAC9GE,GAAG,CAACC,KAAK,IAAI;EACV,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;EAEhC,IAAI,CAACC,GAAG,EAAE;IACN,OAAOG,SAAS;EACpB;EAEA,OAAON,SAAS,CAACG,GAAG,EAAED,KAAK,CAACC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CACDI,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;AAEP,MAAMC,cAAc,GAAGA,CAAyBX,MAAsB,EAAEY,QAAgB,EAAEX,SAA6B,KAAK;EAC/H,MAAMY,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EACrC,MAAMC,YAA4B,GAAG,EAAE;EAEvCf,MAAM,CAACgB,OAAO,CAACb,KAAK,IAAI;IACpB,MAAM,CAACc,QAAQ,CAAC,GAAGZ,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;IAErC,IAAI,CAACc,QAAQ,EAAE;MACX;IACJ;IAEA,MAAMC,KAAK,GAAGf,KAAK,CAACc,QAAQ,CAAC;IAE7B,IAAI,OAAOC,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACpDb,MAAM,CAACC,IAAI,CAACY,KAAK,IAAI,CAAC,CAAC,CAAC,CAACF,OAAO,CAACK,UAAU,IAAIR,WAAW,CAACS,GAAG,CAACD,UAAU,CAAC,CAAC;MAE3E;IACJ;IAEAN,YAAY,CAACQ,IAAI,CAACpB,KAAK,CAAC;EAC5B,CAAC,CAAC;EAEF,MAAMqB,gBAAgB,GAAGL,KAAK,CAACM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