react-native-unistyles 3.0.0-alpha.41 → 3.0.0-alpha.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. package/README.md +7 -1
  2. package/cxx/common/Constants.h +0 -1
  3. package/cxx/core/UnistylesRegistry.cpp +10 -4
  4. package/cxx/core/UnistylesRegistry.h +1 -1
  5. package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -2
  6. package/cxx/parser/Parser.cpp +7 -22
  7. package/cxx/parser/Parser.h +0 -1
  8. package/lib/commonjs/components/Display.js +2 -2
  9. package/lib/commonjs/components/Display.js.map +1 -1
  10. package/lib/commonjs/components/Hide.js +2 -2
  11. package/lib/commonjs/components/Hide.js.map +1 -1
  12. package/lib/commonjs/components/Pressable.js +64 -0
  13. package/lib/commonjs/components/Pressable.js.map +1 -0
  14. package/lib/commonjs/components/Pressable.web.js +97 -0
  15. package/lib/commonjs/components/Pressable.web.js.map +1 -0
  16. package/lib/commonjs/components/index.js +7 -0
  17. package/lib/commonjs/components/index.js.map +1 -1
  18. package/lib/commonjs/core/getBoundArgs.js +18 -0
  19. package/lib/commonjs/core/getBoundArgs.js.map +1 -0
  20. package/lib/commonjs/core/getId.js +9 -0
  21. package/lib/commonjs/core/getId.js.map +1 -0
  22. package/lib/commonjs/core/index.js +14 -0
  23. package/lib/commonjs/core/index.js.map +1 -1
  24. package/lib/commonjs/hooks/index.js +13 -0
  25. package/lib/commonjs/hooks/index.js.map +1 -0
  26. package/lib/commonjs/hooks/useMedia.js.map +1 -0
  27. package/lib/commonjs/hooks/useMedia.web.js.map +1 -0
  28. package/lib/commonjs/index.js +8 -1
  29. package/lib/commonjs/index.js.map +1 -1
  30. package/lib/commonjs/mq.js +6 -6
  31. package/lib/commonjs/mq.js.map +1 -1
  32. package/lib/commonjs/specs/ShadowRegistry/index.js +3 -4
  33. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  34. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  35. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
  36. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  37. package/lib/commonjs/specs/index.web.js +0 -7
  38. package/lib/commonjs/specs/index.web.js.map +1 -1
  39. package/lib/commonjs/utils.js +1 -1
  40. package/lib/commonjs/utils.js.map +1 -1
  41. package/lib/commonjs/web/convert/types.js.map +1 -1
  42. package/lib/commonjs/web/convert/utils.js +1 -1
  43. package/lib/commonjs/web/convert/utils.js.map +1 -1
  44. package/lib/commonjs/web/create.js +4 -1
  45. package/lib/commonjs/web/create.js.map +1 -1
  46. package/lib/commonjs/web/index.js +7 -5
  47. package/lib/commonjs/web/index.js.map +1 -1
  48. package/lib/commonjs/web/listener.js.map +1 -1
  49. package/lib/commonjs/web/runtime.js +7 -7
  50. package/lib/commonjs/web/runtime.js.map +1 -1
  51. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  52. package/lib/commonjs/web/state.js +23 -16
  53. package/lib/commonjs/web/state.js.map +1 -1
  54. package/lib/commonjs/web/utils/common.js +3 -3
  55. package/lib/commonjs/web/utils/common.js.map +1 -1
  56. package/lib/commonjs/web/utils/unistyle.js +2 -4
  57. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  58. package/lib/commonjs/web/variants/getVariants.js +1 -1
  59. package/lib/commonjs/web/variants/getVariants.js.map +1 -1
  60. package/lib/commonjs/web/variants/useVariants.js +1 -1
  61. package/lib/module/components/Display.js +1 -1
  62. package/lib/module/components/Display.js.map +1 -1
  63. package/lib/module/components/Hide.js +1 -1
  64. package/lib/module/components/Hide.js.map +1 -1
  65. package/lib/module/components/Pressable.js +58 -0
  66. package/lib/module/components/Pressable.js.map +1 -0
  67. package/lib/module/components/Pressable.web.js +91 -0
  68. package/lib/module/components/Pressable.web.js.map +1 -0
  69. package/lib/module/components/index.js +1 -0
  70. package/lib/module/components/index.js.map +1 -1
  71. package/lib/module/core/getBoundArgs.js +13 -0
  72. package/lib/module/core/getBoundArgs.js.map +1 -0
  73. package/lib/module/core/getId.js +4 -0
  74. package/lib/module/core/getId.js.map +1 -0
  75. package/lib/module/core/index.js +2 -0
  76. package/lib/module/core/index.js.map +1 -1
  77. package/lib/module/hooks/index.js +4 -0
  78. package/lib/module/hooks/index.js.map +1 -0
  79. package/lib/module/hooks/useMedia.js.map +1 -0
  80. package/lib/module/hooks/useMedia.web.js.map +1 -0
  81. package/lib/module/index.js +1 -1
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/mq.js +6 -6
  84. package/lib/module/mq.js.map +1 -1
  85. package/lib/module/specs/ShadowRegistry/index.js +3 -4
  86. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  87. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  88. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
  89. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  90. package/lib/module/specs/index.web.js +0 -1
  91. package/lib/module/specs/index.web.js.map +1 -1
  92. package/lib/module/utils.js +1 -1
  93. package/lib/module/utils.js.map +1 -1
  94. package/lib/module/web/convert/types.js.map +1 -1
  95. package/lib/module/web/convert/utils.js +1 -1
  96. package/lib/module/web/convert/utils.js.map +1 -1
  97. package/lib/module/web/create.js +5 -2
  98. package/lib/module/web/create.js.map +1 -1
  99. package/lib/module/web/index.js +7 -3
  100. package/lib/module/web/index.js.map +1 -1
  101. package/lib/module/web/listener.js.map +1 -1
  102. package/lib/module/web/runtime.js +8 -8
  103. package/lib/module/web/runtime.js.map +1 -1
  104. package/lib/module/web/shadowRegistry.js.map +1 -1
  105. package/lib/module/web/state.js +24 -17
  106. package/lib/module/web/state.js.map +1 -1
  107. package/lib/module/web/utils/common.js +1 -1
  108. package/lib/module/web/utils/common.js.map +1 -1
  109. package/lib/module/web/utils/unistyle.js +1 -2
  110. package/lib/module/web/utils/unistyle.js.map +1 -1
  111. package/lib/module/web/variants/getVariants.js +1 -1
  112. package/lib/module/web/variants/getVariants.js.map +1 -1
  113. package/lib/module/web/variants/useVariants.js +1 -1
  114. package/lib/typescript/src/components/Pressable.d.ts +7 -0
  115. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  116. package/lib/typescript/src/components/Pressable.web.d.ts +13 -0
  117. package/lib/typescript/src/components/Pressable.web.d.ts.map +1 -0
  118. package/lib/typescript/src/components/index.d.ts +1 -0
  119. package/lib/typescript/src/components/index.d.ts.map +1 -1
  120. package/lib/typescript/src/core/getBoundArgs.d.ts +2 -0
  121. package/lib/typescript/src/core/getBoundArgs.d.ts.map +1 -0
  122. package/lib/typescript/src/core/getId.d.ts +2 -0
  123. package/lib/typescript/src/core/getId.d.ts.map +1 -0
  124. package/lib/typescript/src/core/index.d.ts +2 -0
  125. package/lib/typescript/src/core/index.d.ts.map +1 -1
  126. package/lib/typescript/src/hooks/index.d.ts +2 -0
  127. package/lib/typescript/src/hooks/index.d.ts.map +1 -0
  128. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -0
  129. package/lib/typescript/src/hooks/useMedia.web.d.ts.map +1 -0
  130. package/lib/typescript/src/index.d.ts +1 -1
  131. package/lib/typescript/src/index.d.ts.map +1 -1
  132. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +1 -1
  133. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  134. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
  135. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  136. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +1 -0
  137. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  138. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
  139. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  140. package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -2
  141. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  142. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
  143. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  144. package/lib/typescript/src/specs/index.web.d.ts +0 -2
  145. package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
  146. package/lib/typescript/src/types/common.d.ts +1 -0
  147. package/lib/typescript/src/types/common.d.ts.map +1 -1
  148. package/lib/typescript/src/types/index.d.ts +1 -1
  149. package/lib/typescript/src/types/index.d.ts.map +1 -1
  150. package/lib/typescript/src/web/convert/types.d.ts +1 -1
  151. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  152. package/lib/typescript/src/web/create.d.ts +1 -1
  153. package/lib/typescript/src/web/create.d.ts.map +1 -1
  154. package/lib/typescript/src/web/index.d.ts +8 -2
  155. package/lib/typescript/src/web/index.d.ts.map +1 -1
  156. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  157. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  158. package/lib/typescript/src/web/state.d.ts.map +1 -1
  159. package/lib/typescript/src/web/utils/common.d.ts +1 -1
  160. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  161. package/lib/typescript/src/web/utils/unistyle.d.ts +0 -1
  162. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  163. package/package.json +12 -16
  164. package/plugin/common.js +1 -4
  165. package/plugin/import.js +29 -3
  166. package/plugin/index.js +18 -8
  167. package/plugin/ref.js +14 -74
  168. package/plugin/style.js +117 -63
  169. package/src/components/Display.tsx +1 -1
  170. package/src/components/Hide.tsx +1 -1
  171. package/src/components/Pressable.tsx +72 -0
  172. package/src/components/Pressable.web.tsx +103 -0
  173. package/src/components/index.ts +1 -0
  174. package/src/core/getBoundArgs.ts +15 -0
  175. package/src/core/getId.ts +1 -0
  176. package/src/core/index.ts +2 -0
  177. package/src/hooks/index.ts +1 -0
  178. package/src/index.ts +1 -1
  179. package/src/mq.ts +6 -6
  180. package/src/specs/NativePlatform/NativePlatform.nitro.ts +1 -1
  181. package/src/specs/ShadowRegistry/index.ts +5 -6
  182. package/src/specs/ShadowRegistry/types.ts +2 -1
  183. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
  184. package/src/specs/StyleSheet/index.ts +3 -2
  185. package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -2
  186. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
  187. package/src/specs/UnistylesRuntime/index.ts +1 -1
  188. package/src/specs/index.web.ts +0 -4
  189. package/src/types/common.ts +1 -0
  190. package/src/types/index.ts +1 -1
  191. package/src/utils.ts +1 -1
  192. package/src/web/convert/types.ts +1 -1
  193. package/src/web/convert/utils.ts +2 -2
  194. package/src/web/create.ts +6 -2
  195. package/src/web/index.ts +7 -3
  196. package/src/web/listener.ts +2 -0
  197. package/src/web/registry.ts +1 -1
  198. package/src/web/runtime.ts +9 -9
  199. package/src/web/shadowRegistry.ts +2 -2
  200. package/src/web/state.ts +36 -17
  201. package/src/web/utils/common.ts +1 -1
  202. package/src/web/utils/unistyle.ts +3 -9
  203. package/src/web/variants/getVariants.ts +1 -1
  204. package/src/web/variants/useVariants.ts +1 -1
  205. package/lib/commonjs/components/useMedia.js.map +0 -1
  206. package/lib/commonjs/components/useMedia.web.js.map +0 -1
  207. package/lib/module/components/useMedia.js.map +0 -1
  208. package/lib/module/components/useMedia.web.js.map +0 -1
  209. package/lib/typescript/src/components/useMedia.d.ts.map +0 -1
  210. package/lib/typescript/src/components/useMedia.web.d.ts.map +0 -1
  211. /package/lib/commonjs/{components → hooks}/useMedia.js +0 -0
  212. /package/lib/commonjs/{components → hooks}/useMedia.web.js +0 -0
  213. /package/lib/module/{components → hooks}/useMedia.js +0 -0
  214. /package/lib/module/{components → hooks}/useMedia.web.js +0 -0
  215. /package/lib/typescript/src/{components → hooks}/useMedia.d.ts +0 -0
  216. /package/lib/typescript/src/{components → hooks}/useMedia.web.d.ts +0 -0
  217. /package/src/{components → hooks}/useMedia.ts +0 -0
  218. /package/src/{components → hooks}/useMedia.web.ts +0 -0
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
  ## Installation
23
23
 
24
24
  ```shell
25
- bun install react-native-unistyles
25
+ yarn install react-native-unistyles
26
26
  ```
27
27
  Install CocoaPods dependencies / generate native folders with Expo:
28
28
 
@@ -75,6 +75,12 @@ npx expo prebuild
75
75
  <a href="https://github.com/happyfloat">
76
76
  <img src="https://avatars.githubusercontent.com/u/186333704?s=200&v=4" height="70px" width="70px" alt="happyfloat" />
77
77
  </a>
78
+ <a href="https://github.com">
79
+ <img src="https://avatars.githubusercontent.com/u/138339?v=4" height="70px" width="70px" alt="anonymous" />
80
+ </a>
81
+ <a href="https://github.com/hyoban">
82
+ <img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="70px" width="70px" alt="hyoban" />
83
+ </a>
78
84
 
79
85
  ## Past sponsors
80
86
 
@@ -9,6 +9,5 @@ static const std::string STYLE_VARIANTS = "uni__variants";
9
9
  static const std::string WEB_STYLE_KEY = "_web";
10
10
  static const std::string EXOTIC_STYLE_KEY = "_exotic";
11
11
  static const std::string NAME_STYLE_KEY = "__unistyles_name";
12
- static const std::string UNI_PRESSABLE_ID = "__uni_pressable_id";
13
12
 
14
13
  }
@@ -82,7 +82,8 @@ void core::UnistylesRegistry::linkShadowNodeWithUnistyle(
82
82
  for (size_t index = 0; index < unistyles.size(); index++) {
83
83
  Unistyle::Shared unistyle = unistyles[index];
84
84
 
85
- this->_shadowRegistry[&rt][shadowNodeFamily].emplace_back(std::make_shared<UnistyleData>(unistyle, variants, arguments[index], uniquePressableId));
85
+ this->_shadowRegistry[&rt][shadowNodeFamily]
86
+ .emplace_back(std::make_shared<UnistyleData>(unistyle, variants, arguments[index], uniquePressableId));
86
87
 
87
88
  // add or update node for shadow leaf updates
88
89
  // dynamic functions are parsed later
@@ -149,16 +150,21 @@ core::DependencyMap core::UnistylesRegistry::buildDependencyMap(jsi::Runtime& rt
149
150
 
150
151
  // called from proxied function only, we don't know host
151
152
  // so we need to rebuild all instances as they may have different variants
152
- void core::UnistylesRegistry::shadowLeafUpdateFromUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle, std::optional<std::string> uniquePressableId) {
153
+ void core::UnistylesRegistry::shadowLeafUpdateFromUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle, jsi::Value& maybePressableId) {
153
154
  shadow::ShadowLeafUpdates updates;
154
155
  auto parser = parser::Parser(nullptr);
156
+ std::optional<std::string> pressableId = maybePressableId.isString()
157
+ ? std::make_optional(maybePressableId.asString(rt).utf8(rt))
158
+ : std::nullopt;
155
159
 
156
160
  for (const auto& [family, unistyles] : this->_shadowRegistry[&rt]) {
157
161
  for (const auto& unistyleData : unistyles) {
158
162
  if (unistyleData->unistyle == unistyle) {
159
163
  // special case for pressable
160
- if (uniquePressableId.has_value() && unistyleData->pressableId.has_value() && uniquePressableId.value() == unistyleData->pressableId.value()) {
161
- unistyleData->parsedStyle = jsi::Value(rt, unistyle->parsedStyle.value()).asObject(rt);
164
+ if (pressableId.has_value() && unistyleData->pressableId.has_value()) {
165
+ if (pressableId.value() == unistyleData->pressableId.value()) {
166
+ unistyleData->parsedStyle = jsi::Value(rt, unistyle->parsedStyle.value()).asObject(rt);
167
+ }
162
168
  }
163
169
 
164
170
  updates[family] = parser.parseStylesToShadowTreeStyles(rt, { unistyleData });
@@ -41,7 +41,7 @@ struct UnistylesRegistry: public StyleSheetRegistry {
41
41
  void unlinkShadowNodeWithUnistyles(jsi::Runtime& rt, const ShadowNodeFamily*);
42
42
  std::shared_ptr<core::StyleSheet> addStyleSheet(jsi::Runtime& rt, int tag, core::StyleSheetType type, jsi::Object&& rawValue);
43
43
  DependencyMap buildDependencyMap(jsi::Runtime& rt, std::vector<UnistyleDependency>& deps);
44
- void shadowLeafUpdateFromUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle, std::optional<std::string> uniquePressableId);
44
+ void shadowLeafUpdateFromUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle, jsi::Value& maybePressableId);
45
45
  shadow::ShadowTrafficController trafficController{};
46
46
 
47
47
  private:
@@ -11,8 +11,8 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
11
11
  core::Variants variants = helpers::variantsToPairs(rt, args[2].asObject(rt));
12
12
  jsi::Array rawArguments = args[3].asObject(rt).asArray(rt);
13
13
  std::optional<std::string> uniquePressableId = args[4].isUndefined()
14
- ? std::nullopt
15
- : std::make_optional<std::string>(args[4].asString(rt).utf8(rt));
14
+ ? std::nullopt
15
+ : std::make_optional<std::string>(args[4].asString(rt).utf8(rt));
16
16
  std::vector<std::vector<folly::dynamic>> arguments;
17
17
  auto& registry = core::UnistylesRegistry::get();
18
18
 
@@ -334,26 +334,6 @@ jsi::Object parser::Parser::parseFirstLevel(jsi::Runtime& rt, Unistyle::Shared u
334
334
  return parsedStyle;
335
335
  }
336
336
 
337
- std::optional<std::string> parser::Parser::getUniquePressableIdFromArguments(jsi::Runtime& rt, const jsi::Value* args, size_t count) {
338
- if (count == 0) {
339
- return std::nullopt;
340
- }
341
-
342
- auto& lastArg = args[count - 1];
343
-
344
- if (!lastArg.isObject()) {
345
- return std::nullopt;
346
- }
347
-
348
- auto lastArgObj = lastArg.asObject(rt);
349
-
350
- if (!lastArgObj.hasProperty(rt, helpers::UNI_PRESSABLE_ID.c_str())) {
351
- return std::nullopt;
352
- }
353
-
354
- return lastArgObj.getProperty(rt, helpers::UNI_PRESSABLE_ID.c_str()).asString(rt).utf8(rt);
355
- }
356
-
357
337
  // function replaces original user dynamic function with additional logic to memoize arguments
358
338
  jsi::Function parser::Parser::createDynamicFunctionProxy(jsi::Runtime& rt, Unistyle::Shared unistyle) {
359
339
  auto unistylesRuntime = this->_unistylesRuntime;
@@ -363,7 +343,9 @@ jsi::Function parser::Parser::createDynamicFunctionProxy(jsi::Runtime& rt, Unist
363
343
  jsi::PropNameID::forUtf8(rt, unistyle->styleKey),
364
344
  1,
365
345
  [this, unistylesRuntime, unistyle](jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
366
- auto thisObject = thisVal.asObject(rt);
346
+ auto thisObject = thisVal.isObject()
347
+ ? thisVal.asObject(rt)
348
+ : jsi::Object(rt);
367
349
  auto parser = parser::Parser(unistylesRuntime);
368
350
 
369
351
  // call user function
@@ -391,8 +373,11 @@ jsi::Function parser::Parser::createDynamicFunctionProxy(jsi::Runtime& rt, Unist
391
373
 
392
374
  // update shadow leaf updates to indicate newest changes
393
375
  auto& registry = core::UnistylesRegistry::get();
376
+ auto lastArg = count == 0
377
+ ? jsi::Value::undefined()
378
+ : jsi::Value(rt, args[count - 1]);
394
379
 
395
- registry.shadowLeafUpdateFromUnistyle(rt, unistyle, getUniquePressableIdFromArguments(rt, args, count));
380
+ registry.shadowLeafUpdateFromUnistyle(rt, unistyle, lastArg);
396
381
 
397
382
  return style;
398
383
  });
@@ -43,7 +43,6 @@ private:
43
43
  jsi::Value getStylesForVariant(jsi::Runtime& rt, const std::string groupName, jsi::Object&& groupValue, std::optional<std::string> selectedVariant, Variants& variants);
44
44
  jsi::Object parseCompoundVariants(jsi::Runtime& rt, Unistyle::Shared unistyle, jsi::Object& obj, Variants& variants);
45
45
  bool shouldApplyCompoundVariants(jsi::Runtime& rt, const Variants& variants, jsi::Object& compoundVariant);
46
- std::optional<std::string> getUniquePressableIdFromArguments(jsi::Runtime& rt, const jsi::Value* args, size_t count);
47
46
  bool isColor(const std::string& propertyName);
48
47
 
49
48
  std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Display = void 0;
7
- var _useMedia = require("./useMedia");
7
+ var _hooks = require("../hooks");
8
8
  const Display = ({
9
9
  children,
10
10
  ...props
11
11
  }) => {
12
12
  const {
13
13
  isVisible
14
- } = (0, _useMedia.useMedia)(props);
14
+ } = (0, _hooks.useMedia)(props);
15
15
  return isVisible ? children : null;
16
16
  };
17
17
  exports.Display = Display;
@@ -1 +1 @@
1
- {"version":3,"names":["_useMedia","require","Display","children","props","isVisible","useMedia","exports"],"sourceRoot":"../../../src","sources":["components/Display.tsx"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAIO,MAAMC,OAA8C,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EACtF,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,kBAAQ,EAACF,KAAK,CAAC;EAErC,OAAOC,SAAS,GACVF,QAAQ,GACR,IAAI;AACd,CAAC;AAAAI,OAAA,CAAAL,OAAA,GAAAA,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_hooks","require","Display","children","props","isVisible","useMedia","exports"],"sourceRoot":"../../../src","sources":["components/Display.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAIO,MAAMC,OAA8C,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EACtF,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAQ,EAACF,KAAK,CAAC;EAErC,OAAOC,SAAS,GACVF,QAAQ,GACR,IAAI;AACd,CAAC;AAAAI,OAAA,CAAAL,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Hide = void 0;
7
- var _useMedia = require("./useMedia");
7
+ var _hooks = require("../hooks");
8
8
  const Hide = ({
9
9
  children,
10
10
  ...props
11
11
  }) => {
12
12
  const {
13
13
  isVisible
14
- } = (0, _useMedia.useMedia)(props);
14
+ } = (0, _hooks.useMedia)(props);
15
15
  return !isVisible ? children : null;
16
16
  };
17
17
  exports.Hide = Hide;
@@ -1 +1 @@
1
- {"version":3,"names":["_useMedia","require","Hide","children","props","isVisible","useMedia","exports"],"sourceRoot":"../../../src","sources":["components/Hide.tsx"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAIO,MAAMC,IAAwC,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EAChF,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,kBAAQ,EAACF,KAAK,CAAC;EAErC,OAAO,CAACC,SAAS,GACXF,QAAQ,GACR,IAAI;AACd,CAAC;AAAAI,OAAA,CAAAL,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_hooks","require","Hide","children","props","isVisible","useMedia","exports"],"sourceRoot":"../../../src","sources":["components/Hide.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAIO,MAAMC,IAAwC,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EAChF,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAQ,EAACF,KAAK,CAAC;EAErC,OAAO,CAACC,SAAS,GACXF,QAAQ,GACR,IAAI;AACd,CAAC;AAAAI,OAAA,CAAAL,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Pressable = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _specs = require("../specs");
10
+ var _core = require("../core");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ 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); }
13
+ 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; }
14
+ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
15
+ variants,
16
+ style,
17
+ rawStyle,
18
+ ...props
19
+ }, passedRef) => {
20
+ const storedRef = (0, _react.useRef)();
21
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
22
+ ...props,
23
+ ref: ref => {
24
+ storedRef.current = ref;
25
+ const styleResult = typeof style === 'function' ? style({
26
+ pressed: false
27
+ }) : style;
28
+ const fnArgs = typeof styleResult === 'function'
29
+ // @ts-expect-error - this is hidden from TS
30
+ ? styleResult.getBoundArgs() : [];
31
+ if (typeof passedRef === 'object' && passedRef !== null) {
32
+ passedRef.current = ref;
33
+ }
34
+ const returnFn = typeof passedRef === 'function' ? passedRef(ref) : () => {};
35
+
36
+ // @ts-expect-error - this is hidden from TS
37
+ _specs.UnistylesShadowRegistry.add(ref, rawStyle ?? [], variants, [fnArgs]);
38
+ return () => {
39
+ // @ts-expect-error - this is hidden from TS
40
+ _specs.UnistylesShadowRegistry.remove(ref);
41
+ if (typeof returnFn === 'function') {
42
+ returnFn();
43
+ }
44
+ };
45
+ },
46
+ style: state => {
47
+ const styleResult = typeof style === 'function' ? style(state) : style;
48
+ const fnArgs = typeof styleResult === 'function'
49
+ // @ts-expect-error - this is hidden from TS
50
+ ? styleResult.getBoundArgs() : [];
51
+ const pressId = (0, _core.getId)();
52
+ if (storedRef.current) {
53
+ // @ts-expect-error - this is hidden from TS
54
+ _specs.UnistylesShadowRegistry.remove(storedRef.current);
55
+ // @ts-expect-error - this is hidden from TS
56
+ _specs.UnistylesShadowRegistry.add(storedRef.current, rawStyle ?? [], variants, [fnArgs], pressId);
57
+ }
58
+ return typeof styleResult === 'function'
59
+ // @ts-expect-error - this is hidden from TS
60
+ ? styleResult(pressId) : styleResult;
61
+ }
62
+ });
63
+ });
64
+ //# sourceMappingURL=Pressable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_specs","_core","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Pressable","exports","forwardRef","variants","style","rawStyle","props","passedRef","storedRef","useRef","jsx","ref","current","styleResult","pressed","fnArgs","getBoundArgs","returnFn","UnistylesShadowRegistry","add","remove","state","pressId","getId"],"sourceRoot":"../../../src","sources":["components/Pressable.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAA+B,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,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,SAAAP,wBAAAO,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,CA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,MAAM,CAAC,CAAC;;MAEd;MACAO,8BAAuB,CAACC,GAAG,CAACR,GAAG,EAAEN,QAAQ,IAAI,EAAE,EAAEF,QAAQ,EAAE,CAACY,MAAM,CAAC,CAAC;MAEpE,OAAO,MAAM;QACT;QACAG,8BAAuB,CAACE,MAAM,CAACT,GAAG,CAAC;QAEnC,IAAI,OAAOM,QAAQ,KAAK,UAAU,EAAE;UAChCA,QAAQ,CAAC,CAAC;QACd;MACJ,CAAC;IACL,CAAE;IACFb,KAAK,EAAEiB,KAAK,IAAI;MACZ,MAAMR,WAAW,GAAG,OAAOT,KAAK,KAAK,UAAU,GACzCA,KAAK,CAACiB,KAAK,CAAC,GACZjB,KAAK;MACX,MAAMW,MAAM,GAAG,OAAOF,WAAW,KAAK;MAClC;MAAA,EACEA,WAAW,CAACG,YAAY,CAAC,CAAC,GAC1B,EAAE;MACR,MAAMM,OAAO,GAAG,IAAAC,WAAK,EAAC,CAAC;MAEvB,IAAIf,SAAS,CAACI,OAAO,EAAE;QACnB;QACAM,8BAAuB,CAACE,MAAM,CAACZ,SAAS,CAACI,OAAO,CAAC;QACjD;QACAM,8BAAuB,CAACC,GAAG,CAACX,SAAS,CAACI,OAAO,EAAEP,QAAQ,IAAI,EAAE,EAAEF,QAAQ,EAAE,CAACY,MAAM,CAAC,EAAEO,OAAO,CAAC;MAC/F;MAEA,OAAO,OAAOT,WAAW,KAAK;MAC1B;MAAA,EACEA,WAAW,CAACS,OAAO,CAAC,GACpBT,WAAW;IACrB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Pressable = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _specs = require("../specs");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ 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); }
12
+ 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; }
13
+ const initialState = {
14
+ pressed: false,
15
+ hovered: false,
16
+ focused: false
17
+ };
18
+ const events = {
19
+ 'pointerdown': {
20
+ pressed: true
21
+ },
22
+ 'pointerup': {
23
+ pressed: false
24
+ },
25
+ 'pointerenter': {
26
+ hovered: true
27
+ },
28
+ 'pointerleave': {
29
+ hovered: false
30
+ },
31
+ 'focus': {
32
+ focused: true
33
+ },
34
+ 'blur': {
35
+ focused: false
36
+ }
37
+ };
38
+ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
39
+ variants,
40
+ style,
41
+ ...props
42
+ }, passedRef) => {
43
+ const storedRef = (0, _react.useRef)();
44
+ const state = (0, _react.useRef)(initialState);
45
+ const styleRef = (0, _react.useRef)(style);
46
+ (0, _react.useEffect)(() => {
47
+ styleRef.current = style;
48
+ }, [style]);
49
+ (0, _react.useEffect)(() => {
50
+ const handler = newState => () => {
51
+ state.current = {
52
+ ...state.current,
53
+ ...newState
54
+ };
55
+ const styleResult = typeof styleRef.current === 'function' ? styleRef.current(state.current) : styleRef.current;
56
+ const fnArgs = typeof styleResult === 'function'
57
+ // @ts-expect-error - this is hidden from TS
58
+ ? styleResult.getBoundArgs() : [];
59
+ const extractedResult = typeof styleResult === 'function' ? styleResult() : styleResult;
60
+
61
+ // @ts-expect-error - this is hidden from TS
62
+ _specs.UnistylesShadowRegistry.add(storedRef.current, [extractedResult], variants, [fnArgs]);
63
+ };
64
+ if (!storedRef.current) {
65
+ return;
66
+ }
67
+
68
+ // ref on the web is dom element
69
+ const ref = storedRef.current;
70
+ Object.entries(events).forEach(([event, state]) => {
71
+ ref.addEventListener(event, handler(state));
72
+ });
73
+ return () => {
74
+ Object.entries(events).forEach(([event, state]) => {
75
+ ref.removeEventListener(event, handler(state));
76
+ });
77
+ };
78
+ }, []);
79
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
80
+ ...props,
81
+ ref: ref => {
82
+ storedRef.current = ref;
83
+ const styleResult = typeof style === 'function' ? style(initialState) : style;
84
+ const fnArgs = typeof styleResult === 'function'
85
+ // @ts-expect-error - this is hidden from TS
86
+ ? styleResult.getBoundArgs() : [];
87
+ const extractedResult = typeof styleResult === 'function' ? styleResult() : styleResult;
88
+ if (typeof passedRef === 'object' && passedRef !== null) {
89
+ passedRef.current = ref;
90
+ }
91
+
92
+ // @ts-expect-error - this is hidden from TS
93
+ _specs.UnistylesShadowRegistry.add(ref, [extractedResult], variants, [fnArgs]);
94
+ }
95
+ });
96
+ });
97
+ //# sourceMappingURL=Pressable.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","initialState","pressed","hovered","focused","events","Pressable","exports","forwardRef","variants","style","props","passedRef","storedRef","useRef","state","styleRef","useEffect","current","handler","newState","styleResult","fnArgs","getBoundArgs","extractedResult","UnistylesShadowRegistry","add","ref","entries","forEach","event","addEventListener","removeEventListener","jsx"],"sourceRoot":"../../../src","sources":["components/Pressable.web.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,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AK,QAAQ,IAAIA,SAAS,KAAK,IAAI,EAAE;QACrDA,SAAS,CAACM,OAAO,GAAGS,GAAG;MAC3B;;MAEA;MACAF,8BAAuB,CAACC,GAAG,CAACC,GAAG,EAAE,CAACH,eAAe,CAAC,EAAEf,QAAQ,EAAE,CAACa,MAAM,CAAC,CAAC;IAC3E;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -15,6 +15,13 @@ Object.defineProperty(exports, "Hide", {
15
15
  return _Hide.Hide;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "Pressable", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _Pressable.Pressable;
22
+ }
23
+ });
18
24
  var _Hide = require("./Hide");
19
25
  var _Display = require("./Display");
26
+ var _Pressable = require("./Pressable");
20
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_Hide","require","_Display"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_Hide","require","_Display","_Pressable"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBoundArgs = void 0;
7
+ const getBoundArgs = fn => {
8
+ const boundArgs = [];
9
+ fn.bind = (thisArg, ...args) => {
10
+ boundArgs.push(...args);
11
+ const newFn = Function.prototype.bind.apply(fn, [thisArg, ...args]);
12
+ newFn.getBoundArgs = () => boundArgs;
13
+ return newFn;
14
+ };
15
+ return fn;
16
+ };
17
+ exports.getBoundArgs = getBoundArgs;
18
+ //# sourceMappingURL=getBoundArgs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getBoundArgs","fn","boundArgs","bind","thisArg","args","push","newFn","Function","prototype","apply","exports"],"sourceRoot":"../../../src","sources":["core/getBoundArgs.ts"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAIC,EAAY,IAAK;EAC1C,MAAMC,SAAS,GAAG,EAAgB;EAElCD,EAAE,CAACE,IAAI,GAAG,CAACC,OAAO,EAAE,GAAGC,IAAI,KAAK;IAC5BH,SAAS,CAACI,IAAI,CAAC,GAAGD,IAAI,CAAC;IAEvB,MAAME,KAAK,GAAGC,QAAQ,CAACC,SAAS,CAACN,IAAI,CAACO,KAAK,CAACT,EAAE,EAAE,CAACG,OAAO,EAAE,GAAGC,IAAI,CAAC,CAAC;IAEnEE,KAAK,CAACP,YAAY,GAAG,MAAME,SAAS;IAEpC,OAAOK,KAAK;EAChB,CAAC;EAED,OAAON,EAAE;AACb,CAAC;AAAAU,OAAA,CAAAX,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getId = void 0;
7
+ const getId = () => `${Math.random().toString(36).substring(2, 9)}`;
8
+ exports.getId = getId;
9
+ //# sourceMappingURL=getId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getId","Math","random","toString","substring","exports"],"sourceRoot":"../../../src","sources":["core/getId.ts"],"mappings":";;;;;;AAAO,MAAMA,KAAK,GAAGA,CAAA,KAAM,GAAGC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AAAAC,OAAA,CAAAL,KAAA,GAAAA,KAAA","ignoreList":[]}
@@ -9,5 +9,19 @@ Object.defineProperty(exports, "createUnistylesComponent", {
9
9
  return _createUnistylesComponent.createUnistylesComponent;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "getBoundArgs", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _getBoundArgs.getBoundArgs;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "getId", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _getId.getId;
22
+ }
23
+ });
12
24
  var _createUnistylesComponent = require("./createUnistylesComponent");
25
+ var _getBoundArgs = require("./getBoundArgs");
26
+ var _getId = require("./getId");
13
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_createUnistylesComponent","require"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_createUnistylesComponent","require","_getBoundArgs","_getId"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useMedia", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _useMedia.useMedia;
10
+ }
11
+ });
12
+ var _useMedia = require("./useMedia");
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useMedia","require"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +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":["hooks/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,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,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":[]}
@@ -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":["hooks/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,G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AEF;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":[]}
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  mq: true,
8
- createUnistylesComponent: true
8
+ createUnistylesComponent: true,
9
+ getBoundArgs: true
9
10
  };
10
11
  Object.defineProperty(exports, "createUnistylesComponent", {
11
12
  enumerable: true,
@@ -13,6 +14,12 @@ Object.defineProperty(exports, "createUnistylesComponent", {
13
14
  return _core.createUnistylesComponent;
14
15
  }
15
16
  });
17
+ Object.defineProperty(exports, "getBoundArgs", {
18
+ enumerable: true,
19
+ get: function () {
20
+ return _core.getBoundArgs;
21
+ }
22
+ });
16
23
  Object.defineProperty(exports, "mq", {
17
24
  enumerable: true,
18
25
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_specs","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_mq","_core","_components"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,GAAA,GAAAb,OAAA;AAEA,IAAAc,KAAA,GAAAd,OAAA;AAEA,IAAAe,WAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,WAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAW,WAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,WAAA,CAAAX,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_specs","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_mq","_core","_components"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,GAAA,GAAAb,OAAA;AAEA,IAAAc,KAAA,GAAAd,OAAA;AAEA,IAAAe,WAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,WAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAW,WAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,WAAA,CAAAX,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -25,17 +25,17 @@ const getMQValue = value => {
25
25
  */
26
26
  const mq = exports.mq = {
27
27
  only: {
28
- width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`,
29
- height: (hMin = 0, hMax = Infinity) => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
28
+ width: (wMin = 0, wMax = Number.POSITIVE_INFINITY) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`,
29
+ height: (hMin = 0, hMax = Number.POSITIVE_INFINITY) => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
30
30
  },
31
- width: (wMin = 0, wMax = Infinity) => ({
31
+ width: (wMin = 0, wMax = Number.POSITIVE_INFINITY) => ({
32
32
  and: {
33
- height: (hMin = 0, hMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
33
+ height: (hMin = 0, hMax = Number.POSITIVE_INFINITY) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
34
34
  }
35
35
  }),
36
- height: (hMin = 0, hMax = Infinity) => ({
36
+ height: (hMin = 0, hMax = Number.POSITIVE_INFINITY) => ({
37
37
  and: {
38
- width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
38
+ width: (wMin = 0, wMax = Number.POSITIVE_INFINITY) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
39
39
  }
40
40
  })
41
41
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_specs","require","IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","getMQValue","value","breakpoints","UnistylesRuntime","mq","exports","only","width","wMin","wMax","Infinity","height","hMin","hMax","and","parseMq","fromW","toW","exec","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","isUnistylesMq","test","isValidMq","parsedMQ","isWidthValid","isHeightValid"],"sourceRoot":"../../src","sources":["mq.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAqBpE,MAAMC,UAAU,GAAIC,KAAwB,IAAK;EAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,CAAC;EACZ;EAEA,MAAMC,WAAW,GAAGC,uBAAgB,CAACD,WAAW;EAEhD,OAAOA,WAAW,CAACD,KAAK,CAAC,IAAI,CAAC;AAClC,CAAC;;AAED;AACA;AACA;AACA;AACO,MAAMG,EAAa,GAAAC,OAAA,CAAAD,EAAA,GAAG;EACzBE,IAAI,EAAE;IACFC,KAAK,EAAEA,CAACC,IAAuB,GAAG,CAAC,EAAEC,IAAa,GAAGC,QAAQ,KAAM,MAAMV,UAAU,CAACQ,IAAI,CAAC,KAAKR,UAAU,CAACS,IAAI,C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EAAE,CAACjB,KAAK,IAAIU,GAAG,KAAK,UAAU,GAAGK,SAAS,GAAGC,MAAM,CAACN,GAAG,CAAC;IAChEQ,SAAS,EAAE,CAACd,MAAM,IAAIQ,KAAK,KAAK,UAAU,GAAGG,SAAS,GAAGC,MAAM,CAACJ,KAAK,CAAC;IACtEO,SAAS,EAAE,CAACf,MAAM,IAAIS,GAAG,KAAK,UAAU,GAAGE,SAAS,GAAGC,MAAM,CAACH,GAAG;EACrE,CAAC;AACL,CAAC;AAAAf,OAAA,CAAAU,OAAA,GAAAA,OAAA;AAEM,MAAMY,aAAa,GAAIvB,EAAU,IAAKP,kBAAkB,CAAC+B,IAAI,CAACxB,EAAE,CAAC;AAAAC,OAAA,CAAAsB,aAAA,GAAAA,aAAA;AAEjE,MAAME,SAAS,GAAIC,QAAoC,IAAK;EAC/D,MAAMC,YAAY,GAAGD,QAAQ,CAACT,QAAQ,KAAKC,SAAS,IAAIQ,QAAQ,CAACN,QAAQ,KAAKF,SAAS,IAAIQ,QAAQ,CAACT,QAAQ,IAAIS,QAAQ,CAACN,QAAQ;EACjI,MAAMQ,aAAa,GAAGF,QAAQ,CAACL,SAAS,KAAKH,SAAS,IAAIQ,QAAQ,CAACJ,SAAS,KAAKJ,SAAS,IAAIQ,QAAQ,CAACL,SAAS,IAAIK,QAAQ,CAACJ,SAAS;EAEtI,OAAOK,YAAY,IAAIC,aAAa;AACxC,CAAC;AAAA3B,OAAA,CAAAwB,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_specs","require","IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","getMQValue","value","breakpoints","UnistylesRuntime","mq","exports","only","width","wMin","wMax","Number","POSITIVE_INFINITY","height","hMin","hMax","and","parseMq","fromW","toW","exec","fromH","toH","minWidth","undefined","maxWidth","minHeight","maxHeight","isUnistylesMq","test","isValidMq","parsedMQ","isWidthValid","isHeightValid"],"sourceRoot":"../../src","sources":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;AAEjE,MAAME,SAAS,GAAIC,QAAoC,IAAK;EAC/D,MAAMC,YAAY,GAAGD,QAAQ,CAACR,QAAQ,KAAKC,SAAS,IAAIO,QAAQ,CAACN,QAAQ,KAAKD,SAAS,IAAIO,QAAQ,CAACR,QAAQ,IAAIQ,QAAQ,CAACN,QAAQ;EACjI,MAAMQ,aAAa,GAAGF,QAAQ,CAACL,SAAS,KAAKF,SAAS,IAAIO,QAAQ,CAACJ,SAAS,KAAKH,SAAS,IAAIO,QAAQ,CAACL,SAAS,IAAIK,QAAQ,CAACJ,SAAS;EAEtI,OAAOK,YAAY,IAAIC,aAAa;AACxC,CAAC;AAAA3B,OAAA,CAAAwB,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -9,12 +9,11 @@ const HybridShadowRegistry = _reactNativeNitroModules.NitroModules.createHybridO
9
9
  const findShadowNodeForHandle = handle => {
10
10
  const node = handle?.__internalInstanceHandle?.stateNode?.node ?? handle?.getScrollResponder?.()?.getNativeScrollRef?.()?.__internalInstanceHandle?.stateNode?.node ?? handle?.getNativeScrollRef?.()?.__internalInstanceHandle?.stateNode?.node;
11
11
  if (!node) {
12
- // todo extend log with file name / component name
13
- throw new Error('Could not find shadow node for one of your components');
12
+ throw new Error(`Unistyles: Could not find shadow node for one of your components of type ${handle?.__internalInstanceHandle?.elementType ?? 'unknown'}`);
14
13
  }
15
14
  return node;
16
15
  };
17
- HybridShadowRegistry.add = (handle, styles, variants, args, uniquePressableId) => {
16
+ HybridShadowRegistry.add = (handle, styles, variants, args, id) => {
18
17
  // virtualized nodes can be null
19
18
  if (!handle || !styles || !Array.isArray(styles)) {
20
19
  return;
@@ -22,7 +21,7 @@ HybridShadowRegistry.add = (handle, styles, variants, args, uniquePressableId) =
22
21
 
23
22
  // filter Reanimated styles and styles that are undefined
24
23
  const filteredStyles = styles.filter(style => !style?.initial?.updater).filter(Boolean);
25
- HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles, variants ?? {}, args ?? [], uniquePressableId);
24
+ HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles, variants ?? {}, args ?? [], id);
26
25
  };
27
26
  HybridShadowRegistry.remove = handle => {
28
27
  if (!handle) {
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeNitroModules","require","HybridShadowRegistry","NitroModules","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","add","styles","variants","args","uniquePressableId","Array","isArray","filteredStyles","filter","style","initial","updater","Boolean","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,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,iBAAiB,KAAK;EAC9E;EACA,IAAI,CAACX,MAAM,IAAI,CAACQ,MAAM,IAAI,CAACI,KAAK,CAACC,OAAO,CAACL,MAAM,CAAC,EAAE;IAC9C;EACJ;;EAEA;EACA,MAAMM,cAAc,GAAGN,MAAM,CACxBO,MAAM,CAACC,KAAK,IAAI,CAACA,KAAK,EAAEC,OAAO,EAAEC,OAAO,CAAC,CACzCH,MAAM,CAACI,OAAO,CAAC;EAEpBvB,oBAAoB,CAACwB,IAAI,CAACrB,uBAAuB,CAACC,MAAM,CAAC,EAAEc,cAAc,EAAEL,QAAQ,IAAI,CAAC,CAAC,EAAEC,IAAI,IAAI,EAAE,EAAEC,iBAAiB,CAAC;AAC7H,CAAC;AAEDf,oBAAoB,CAACyB,MAAM,GAAGrB,MAAM,IAAI;EACpC,IAAI,CAACA,MAAM,EAAE;IACT;EACJ;EAEAJ,oBAAoB,CAAC0B,MAAM,CAACvB,uBAAuB,CAACC,MAAM,CAAC,CAAC;AAChE,CAAC;AAQM,MAAMuB,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG3B,oBAA4D","ignoreList":[]}
1
+ {"version":3,"names":["_reactNativeNitroModules","require","HybridShadowRegistry","NitroModules","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","elementType","add","styles","variants","args","id","Array","isArray","filteredStyles","filter","style","initial","updater","Boolean","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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