@semcore/core 17.0.0-prerelease.20-prerelease.20 → 17.0.0-prerelease.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/lib/LastInteractionType.js +22 -36
  2. package/lib/LastInteractionType.js.map +1 -1
  3. package/lib/LastInteractionType.mjs +19 -33
  4. package/lib/LastInteractionType.mjs.map +1 -1
  5. package/lib/core-types/Component.js +25 -41
  6. package/lib/core-types/Component.js.map +1 -1
  7. package/lib/core-types/Component.mjs +18 -38
  8. package/lib/core-types/Component.mjs.map +1 -1
  9. package/lib/core-types/symbols.js +9 -9
  10. package/lib/core-types/symbols.js.map +1 -1
  11. package/lib/core-types/symbols.mjs +9 -9
  12. package/lib/core-types/symbols.mjs.map +1 -1
  13. package/lib/coreFactory.js +143 -205
  14. package/lib/coreFactory.js.map +1 -1
  15. package/lib/coreFactory.mjs +118 -164
  16. package/lib/coreFactory.mjs.map +1 -1
  17. package/lib/decorators/propsObserver.js +36 -64
  18. package/lib/decorators/propsObserver.js.map +1 -1
  19. package/lib/decorators/propsObserver.mjs +33 -61
  20. package/lib/decorators/propsObserver.mjs.map +1 -1
  21. package/lib/decorators/reactive.js +17 -17
  22. package/lib/decorators/reactive.js.map +1 -1
  23. package/lib/decorators/reactive.mjs +15 -15
  24. package/lib/decorators/reactive.mjs.map +1 -1
  25. package/lib/enhancement/Children.js +51 -59
  26. package/lib/enhancement/Children.js.map +1 -1
  27. package/lib/enhancement/Children.mjs +47 -41
  28. package/lib/enhancement/Children.mjs.map +1 -1
  29. package/lib/enhancement/Root.js +36 -37
  30. package/lib/enhancement/Root.js.map +1 -1
  31. package/lib/enhancement/Root.mjs +28 -18
  32. package/lib/enhancement/Root.mjs.map +1 -1
  33. package/lib/enhancement/dataName.js +7 -8
  34. package/lib/enhancement/dataName.js.map +1 -1
  35. package/lib/enhancement/dataName.mjs +5 -5
  36. package/lib/enhancement/dataName.mjs.map +1 -1
  37. package/lib/enhancement/enhance.js +6 -9
  38. package/lib/enhancement/enhance.js.map +1 -1
  39. package/lib/enhancement/enhance.mjs +5 -7
  40. package/lib/enhancement/enhance.mjs.map +1 -1
  41. package/lib/enhancement/functionDefaultProps.js +6 -6
  42. package/lib/enhancement/functionDefaultProps.js.map +1 -1
  43. package/lib/enhancement/functionDefaultProps.mjs +4 -4
  44. package/lib/enhancement/functionDefaultProps.mjs.map +1 -1
  45. package/lib/enhancement/i18n.js +13 -13
  46. package/lib/enhancement/i18n.js.map +1 -1
  47. package/lib/enhancement/i18n.mjs +10 -9
  48. package/lib/enhancement/i18n.mjs.map +1 -1
  49. package/lib/enhancement/inheritedName.js +7 -8
  50. package/lib/enhancement/inheritedName.js.map +1 -1
  51. package/lib/enhancement/inheritedName.mjs +5 -5
  52. package/lib/enhancement/inheritedName.mjs.map +1 -1
  53. package/lib/enhancement/staticChildren.js +47 -56
  54. package/lib/enhancement/staticChildren.js.map +1 -1
  55. package/lib/enhancement/staticChildren.mjs +43 -48
  56. package/lib/enhancement/staticChildren.mjs.map +1 -1
  57. package/lib/enhancement/style.js +29 -27
  58. package/lib/enhancement/style.js.map +1 -1
  59. package/lib/enhancement/style.mjs +26 -20
  60. package/lib/enhancement/style.mjs.map +1 -1
  61. package/lib/enhancement/uncontrolledProps.js +46 -65
  62. package/lib/enhancement/uncontrolledProps.js.map +1 -1
  63. package/lib/enhancement/uncontrolledProps.mjs +43 -52
  64. package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
  65. package/lib/esm/LastInteractionType.mjs +19 -33
  66. package/lib/esm/core-types/Component.mjs +18 -38
  67. package/lib/esm/core-types/symbols.mjs +9 -9
  68. package/lib/esm/coreFactory.mjs +118 -164
  69. package/lib/esm/enhancement/Children.mjs +47 -41
  70. package/lib/esm/enhancement/Root.mjs +28 -18
  71. package/lib/esm/enhancement/dataName.mjs +5 -5
  72. package/lib/esm/enhancement/enhance.mjs +5 -7
  73. package/lib/esm/enhancement/functionDefaultProps.mjs +4 -4
  74. package/lib/esm/enhancement/i18n.mjs +10 -9
  75. package/lib/esm/enhancement/inheritedName.mjs +5 -5
  76. package/lib/esm/enhancement/staticChildren.mjs +43 -48
  77. package/lib/esm/enhancement/style.mjs +26 -20
  78. package/lib/esm/enhancement/uncontrolledProps.mjs +43 -52
  79. package/lib/esm/register.mjs +12 -20
  80. package/lib/esm/styled/reshadow-core.mjs +98 -111
  81. package/lib/esm/styled/sstyled.mjs +31 -41
  82. package/lib/esm/utils/assignProps.mjs +32 -36
  83. package/lib/esm/utils/enhances/WithI18n.mjs +15 -17
  84. package/lib/esm/utils/enhances/i18nEnhance.mjs +47 -61
  85. package/lib/esm/utils/logger.mjs +13 -21
  86. package/lib/esm/utils/pick.mjs +4 -4
  87. package/lib/esm/utils/ref.mjs +27 -43
  88. package/lib/esm/utils/use/useEnhancedEffect.mjs +1 -1
  89. package/lib/index.js +17 -17
  90. package/lib/register.js +17 -24
  91. package/lib/register.js.map +1 -1
  92. package/lib/register.mjs +12 -20
  93. package/lib/register.mjs.map +1 -1
  94. package/lib/styled/index.js +4 -4
  95. package/lib/styled/reshadow-core.js +102 -104
  96. package/lib/styled/reshadow-core.js.map +1 -1
  97. package/lib/styled/reshadow-core.mjs +98 -111
  98. package/lib/styled/reshadow-core.mjs.map +1 -1
  99. package/lib/styled/sstyled.js +31 -53
  100. package/lib/styled/sstyled.js.map +1 -1
  101. package/lib/styled/sstyled.mjs +31 -41
  102. package/lib/styled/sstyled.mjs.map +1 -1
  103. package/lib/theme/processor.js +150 -222
  104. package/lib/theme/processor.js.map +1 -1
  105. package/lib/theme/processor.mjs +148 -221
  106. package/lib/theme/processor.mjs.map +1 -1
  107. package/lib/theme/themes/dark.js +2 -2
  108. package/lib/theme/themes/dark.js.map +1 -1
  109. package/lib/theme/themes/default.js +2 -2
  110. package/lib/theme/themes/default.js.map +1 -1
  111. package/lib/theme/themes/highlights-dark.js +2 -2
  112. package/lib/theme/themes/highlights-dark.js.map +1 -1
  113. package/lib/theme/themes/highlights-light.js +2 -2
  114. package/lib/theme/themes/highlights-light.js.map +1 -1
  115. package/lib/theme/themes/light.js +2 -2
  116. package/lib/theme/themes/light.js.map +1 -1
  117. package/lib/theme/utils.js +140 -215
  118. package/lib/theme/utils.js.map +1 -1
  119. package/lib/theme/utils.mjs +135 -214
  120. package/lib/theme/utils.mjs.map +1 -1
  121. package/lib/utils/CSSinJS.js +8 -10
  122. package/lib/utils/CSSinJS.js.map +1 -1
  123. package/lib/utils/CSSinJS.mjs +6 -7
  124. package/lib/utils/CSSinJS.mjs.map +1 -1
  125. package/lib/utils/ThemeProvider.js +44 -51
  126. package/lib/utils/ThemeProvider.js.map +1 -1
  127. package/lib/utils/ThemeProvider.mjs +36 -47
  128. package/lib/utils/ThemeProvider.mjs.map +1 -1
  129. package/lib/utils/addonText.js +4 -7
  130. package/lib/utils/addonText.js.map +1 -1
  131. package/lib/utils/addonText.mjs +2 -5
  132. package/lib/utils/addonText.mjs.map +1 -1
  133. package/lib/utils/addonTextChildren.js +15 -21
  134. package/lib/utils/addonTextChildren.js.map +1 -1
  135. package/lib/utils/addonTextChildren.mjs +7 -13
  136. package/lib/utils/addonTextChildren.mjs.map +1 -1
  137. package/lib/utils/ariaProps.js +7 -5
  138. package/lib/utils/ariaProps.js.map +1 -1
  139. package/lib/utils/ariaProps.mjs +7 -5
  140. package/lib/utils/ariaProps.mjs.map +1 -1
  141. package/lib/utils/assignProps.js +33 -37
  142. package/lib/utils/assignProps.js.map +1 -1
  143. package/lib/utils/assignProps.mjs +32 -36
  144. package/lib/utils/assignProps.mjs.map +1 -1
  145. package/lib/utils/canUseDOM.js +1 -1
  146. package/lib/utils/capitalizeFirstLetter.js +1 -1
  147. package/lib/utils/color.js +72 -95
  148. package/lib/utils/color.js.map +1 -1
  149. package/lib/utils/color.mjs +71 -94
  150. package/lib/utils/color.mjs.map +1 -1
  151. package/lib/utils/compose.js +3 -12
  152. package/lib/utils/compose.js.map +1 -1
  153. package/lib/utils/compose.mjs +2 -11
  154. package/lib/utils/compose.mjs.map +1 -1
  155. package/lib/utils/createUUID.js +5 -5
  156. package/lib/utils/createUUID.js.map +1 -1
  157. package/lib/utils/createUUID.mjs +4 -4
  158. package/lib/utils/createUUID.mjs.map +1 -1
  159. package/lib/utils/cssToIntDefault.js +3 -4
  160. package/lib/utils/cssToIntDefault.js.map +1 -1
  161. package/lib/utils/cssToIntDefault.mjs +2 -3
  162. package/lib/utils/cssToIntDefault.mjs.map +1 -1
  163. package/lib/utils/enhances/WithCSS.js +10 -8
  164. package/lib/utils/enhances/WithCSS.js.map +1 -1
  165. package/lib/utils/enhances/WithCSS.mjs +7 -6
  166. package/lib/utils/enhances/WithCSS.mjs.map +1 -1
  167. package/lib/utils/enhances/WithI18n.js +19 -19
  168. package/lib/utils/enhances/WithI18n.js.map +1 -1
  169. package/lib/utils/enhances/WithI18n.mjs +15 -17
  170. package/lib/utils/enhances/WithI18n.mjs.map +1 -1
  171. package/lib/utils/enhances/a11yEnhance.js +34 -39
  172. package/lib/utils/enhances/a11yEnhance.js.map +1 -1
  173. package/lib/utils/enhances/a11yEnhance.mjs +32 -36
  174. package/lib/utils/enhances/a11yEnhance.mjs.map +1 -1
  175. package/lib/utils/enhances/animatedSizeEnhance.js +55 -63
  176. package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
  177. package/lib/utils/enhances/animatedSizeEnhance.mjs +50 -58
  178. package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
  179. package/lib/utils/enhances/contextEnhance.js +12 -11
  180. package/lib/utils/enhances/contextEnhance.js.map +1 -1
  181. package/lib/utils/enhances/contextEnhance.mjs +9 -8
  182. package/lib/utils/enhances/contextEnhance.mjs.map +1 -1
  183. package/lib/utils/enhances/i18nEnhance.js +51 -67
  184. package/lib/utils/enhances/i18nEnhance.js.map +1 -1
  185. package/lib/utils/enhances/i18nEnhance.mjs +47 -61
  186. package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
  187. package/lib/utils/enhances/resolveColorEnhance.js +12 -10
  188. package/lib/utils/enhances/resolveColorEnhance.js.map +1 -1
  189. package/lib/utils/enhances/resolveColorEnhance.mjs +8 -6
  190. package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -1
  191. package/lib/utils/eventEmitter.js +30 -57
  192. package/lib/utils/eventEmitter.js.map +1 -1
  193. package/lib/utils/eventEmitter.mjs +26 -55
  194. package/lib/utils/eventEmitter.mjs.map +1 -1
  195. package/lib/utils/findComponent.js +35 -42
  196. package/lib/utils/findComponent.js.map +1 -1
  197. package/lib/utils/findComponent.mjs +26 -33
  198. package/lib/utils/findComponent.mjs.map +1 -1
  199. package/lib/utils/fire.js +7 -13
  200. package/lib/utils/fire.js.map +1 -1
  201. package/lib/utils/fire.mjs +5 -11
  202. package/lib/utils/fire.mjs.map +1 -1
  203. package/lib/utils/focus-lock/focusBorders.js +28 -32
  204. package/lib/utils/focus-lock/focusBorders.js.map +1 -1
  205. package/lib/utils/focus-lock/focusBorders.mjs +26 -32
  206. package/lib/utils/focus-lock/focusBorders.mjs.map +1 -1
  207. package/lib/utils/focus-lock/getFocusableIn.js +4 -6
  208. package/lib/utils/focus-lock/getFocusableIn.js.map +1 -1
  209. package/lib/utils/focus-lock/getFocusableIn.mjs +3 -6
  210. package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -1
  211. package/lib/utils/focus-lock/isFocusInside.js +5 -6
  212. package/lib/utils/focus-lock/isFocusInside.js.map +1 -1
  213. package/lib/utils/focus-lock/isFocusInside.mjs +4 -6
  214. package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -1
  215. package/lib/utils/focus-lock/isFocusable.js +9 -12
  216. package/lib/utils/focus-lock/isFocusable.js.map +1 -1
  217. package/lib/utils/focus-lock/isFocusable.mjs +8 -11
  218. package/lib/utils/focus-lock/isFocusable.mjs.map +1 -1
  219. package/lib/utils/focus-lock/setFocus.js +21 -27
  220. package/lib/utils/focus-lock/setFocus.js.map +1 -1
  221. package/lib/utils/focus-lock/setFocus.mjs +19 -25
  222. package/lib/utils/focus-lock/setFocus.mjs.map +1 -1
  223. package/lib/utils/getAccessibleName.js +10 -22
  224. package/lib/utils/getAccessibleName.js.map +1 -1
  225. package/lib/utils/getAccessibleName.mjs +10 -21
  226. package/lib/utils/getAccessibleName.mjs.map +1 -1
  227. package/lib/utils/getDisplayName.js +1 -1
  228. package/lib/utils/getEventTarget.js +13 -32
  229. package/lib/utils/getEventTarget.js.map +1 -1
  230. package/lib/utils/getEventTarget.mjs +12 -31
  231. package/lib/utils/getEventTarget.mjs.map +1 -1
  232. package/lib/utils/getOriginChildren.js +4 -4
  233. package/lib/utils/getOriginChildren.js.map +1 -1
  234. package/lib/utils/getRandomInt.js +1 -1
  235. package/lib/utils/getValue.js +4 -6
  236. package/lib/utils/getValue.js.map +1 -1
  237. package/lib/utils/getValue.mjs +3 -5
  238. package/lib/utils/getValue.mjs.map +1 -1
  239. package/lib/utils/hasLabels.js +16 -27
  240. package/lib/utils/hasLabels.js.map +1 -1
  241. package/lib/utils/hasLabels.mjs +14 -24
  242. package/lib/utils/hasLabels.mjs.map +1 -1
  243. package/lib/utils/hasParent.js +3 -2
  244. package/lib/utils/hasParent.js.map +1 -1
  245. package/lib/utils/hasParent.mjs +2 -3
  246. package/lib/utils/hasParent.mjs.map +1 -1
  247. package/lib/utils/ifChildren.js +6 -4
  248. package/lib/utils/ifChildren.js.map +1 -1
  249. package/lib/utils/ifChildren.mjs +4 -2
  250. package/lib/utils/ifChildren.mjs.map +1 -1
  251. package/lib/utils/injectStyle.js +11 -13
  252. package/lib/utils/injectStyle.js.map +1 -1
  253. package/lib/utils/injectStyle.mjs +9 -10
  254. package/lib/utils/injectStyle.mjs.map +1 -1
  255. package/lib/utils/inputProps.js +5 -5
  256. package/lib/utils/inputProps.js.map +1 -1
  257. package/lib/utils/inputProps.mjs +4 -4
  258. package/lib/utils/inputProps.mjs.map +1 -1
  259. package/lib/utils/isInteractiveElement.js +7 -9
  260. package/lib/utils/isInteractiveElement.js.map +1 -1
  261. package/lib/utils/isInteractiveElement.mjs +7 -9
  262. package/lib/utils/isInteractiveElement.mjs.map +1 -1
  263. package/lib/utils/isNode.js +4 -5
  264. package/lib/utils/isNode.js.map +1 -1
  265. package/lib/utils/isNode.mjs +1 -2
  266. package/lib/utils/isNode.mjs.map +1 -1
  267. package/lib/utils/isPromise.js +1 -1
  268. package/lib/utils/isRetina.js +7 -2
  269. package/lib/utils/isRetina.js.map +1 -1
  270. package/lib/utils/isRetina.mjs +6 -1
  271. package/lib/utils/isRetina.mjs.map +1 -1
  272. package/lib/utils/logger.js +18 -25
  273. package/lib/utils/logger.js.map +1 -1
  274. package/lib/utils/logger.mjs +13 -21
  275. package/lib/utils/logger.mjs.map +1 -1
  276. package/lib/utils/numericChecker.js +11 -18
  277. package/lib/utils/numericChecker.js.map +1 -1
  278. package/lib/utils/numericChecker.mjs +10 -17
  279. package/lib/utils/numericChecker.mjs.map +1 -1
  280. package/lib/utils/ownerDocument.js +2 -2
  281. package/lib/utils/ownerDocument.js.map +1 -1
  282. package/lib/utils/ownerDocument.mjs +1 -1
  283. package/lib/utils/ownerDocument.mjs.map +1 -1
  284. package/lib/utils/pick.js +5 -5
  285. package/lib/utils/pick.js.map +1 -1
  286. package/lib/utils/pick.mjs +4 -4
  287. package/lib/utils/pick.mjs.map +1 -1
  288. package/lib/utils/propsForElement.js +10 -12
  289. package/lib/utils/propsForElement.js.map +1 -1
  290. package/lib/utils/propsForElement.mjs +8 -10
  291. package/lib/utils/propsForElement.mjs.map +1 -1
  292. package/lib/utils/rafTrottle.js +9 -14
  293. package/lib/utils/rafTrottle.js.map +1 -1
  294. package/lib/utils/rafTrottle.mjs +7 -12
  295. package/lib/utils/rafTrottle.mjs.map +1 -1
  296. package/lib/utils/reactToText.js +5 -8
  297. package/lib/utils/reactToText.js.map +1 -1
  298. package/lib/utils/reactToText.mjs +3 -6
  299. package/lib/utils/reactToText.mjs.map +1 -1
  300. package/lib/utils/ref.js +29 -47
  301. package/lib/utils/ref.js.map +1 -1
  302. package/lib/utils/ref.mjs +27 -43
  303. package/lib/utils/ref.mjs.map +1 -1
  304. package/lib/utils/setRef.js +2 -2
  305. package/lib/utils/setRef.js.map +1 -1
  306. package/lib/utils/syncScroll.js +24 -24
  307. package/lib/utils/syncScroll.js.map +1 -1
  308. package/lib/utils/syncScroll.mjs +21 -21
  309. package/lib/utils/syncScroll.mjs.map +1 -1
  310. package/lib/utils/uncontroll.js +8 -18
  311. package/lib/utils/uncontroll.js.map +1 -1
  312. package/lib/utils/uncontroll.mjs +8 -17
  313. package/lib/utils/uncontroll.mjs.map +1 -1
  314. package/lib/utils/uniqueID.js +22 -27
  315. package/lib/utils/uniqueID.js.map +1 -1
  316. package/lib/utils/uniqueID.mjs +18 -25
  317. package/lib/utils/uniqueID.mjs.map +1 -1
  318. package/lib/utils/use/useColorResolver.js +20 -21
  319. package/lib/utils/use/useColorResolver.js.map +1 -1
  320. package/lib/utils/use/useColorResolver.mjs +16 -18
  321. package/lib/utils/use/useColorResolver.mjs.map +1 -1
  322. package/lib/utils/use/useEnhancedEffect.js +4 -4
  323. package/lib/utils/use/useEnhancedEffect.js.map +1 -1
  324. package/lib/utils/use/useEnhancedEffect.mjs +1 -1
  325. package/lib/utils/use/useEnhancedEffect.mjs.map +1 -1
  326. package/lib/utils/use/useEventCallback.js +5 -10
  327. package/lib/utils/use/useEventCallback.js.map +1 -1
  328. package/lib/utils/use/useEventCallback.mjs +3 -8
  329. package/lib/utils/use/useEventCallback.mjs.map +1 -1
  330. package/lib/utils/use/useEventListener.js +11 -15
  331. package/lib/utils/use/useEventListener.js.map +1 -1
  332. package/lib/utils/use/useEventListener.mjs +7 -11
  333. package/lib/utils/use/useEventListener.mjs.map +1 -1
  334. package/lib/utils/use/useFocusLock.js +80 -94
  335. package/lib/utils/use/useFocusLock.js.map +1 -1
  336. package/lib/utils/use/useFocusLock.mjs +71 -88
  337. package/lib/utils/use/useFocusLock.mjs.map +1 -1
  338. package/lib/utils/use/usePreventScroll.js +26 -28
  339. package/lib/utils/use/usePreventScroll.js.map +1 -1
  340. package/lib/utils/use/usePreventScroll.mjs +21 -23
  341. package/lib/utils/use/usePreventScroll.mjs.map +1 -1
  342. package/lib/utils/use/useScrollBarWidth.js +8 -14
  343. package/lib/utils/use/useScrollBarWidth.js.map +1 -1
  344. package/lib/utils/use/useScrollBarWidth.mjs +8 -13
  345. package/lib/utils/use/useScrollBarWidth.mjs.map +1 -1
  346. package/lib/utils/useCssVariable.js +32 -37
  347. package/lib/utils/useCssVariable.js.map +1 -1
  348. package/lib/utils/useCssVariable.mjs +27 -34
  349. package/lib/utils/useCssVariable.mjs.map +1 -1
  350. package/lib/utils/zIndexStacking.js +28 -24
  351. package/lib/utils/zIndexStacking.js.map +1 -1
  352. package/lib/utils/zIndexStacking.mjs +23 -22
  353. package/lib/utils/zIndexStacking.mjs.map +1 -1
  354. package/package.json +1 -1
@@ -1,21 +1,22 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports["default"] = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
- var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
11
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
+ exports.default = void 0;
12
8
  var _react = _interopRequireDefault(require("react"));
13
9
  function contextEnhance(context, setOnProp) {
14
- return function (props) {
15
- var other = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(props), props));
16
- var value = _react["default"].useContext(context);
17
- return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, other), {}, (0, _defineProperty2["default"])({}, setOnProp, value));
10
+ return props => {
11
+ const {
12
+ ...other
13
+ } = props;
14
+ const value = _react.default.useContext(context);
15
+ return {
16
+ ...other,
17
+ [setOnProp]: value
18
+ };
18
19
  };
19
20
  }
20
- var _default = exports["default"] = contextEnhance;
21
+ var _default = exports.default = contextEnhance;
21
22
  //# sourceMappingURL=contextEnhance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contextEnhance.js","names":["_react","_interopRequireDefault","require","contextEnhance","context","setOnProp","props","other","_extends2","_objectDestructuringEmpty2","value","React","useContext","_objectSpread3","_defineProperty2","_default","exports"],"sources":["../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAO,UAACC,KAAU,EAAK;IACrB,IAAWC,KAAK,OAAAC,SAAA,sBAAAC,0BAAA,aAAKH,KAAK,GAALA,KAAK;IAC1B,IAAMI,KAAK,GAAGC,iBAAK,CAACC,UAAU,CAACR,OAAO,CAAC;IACvC,WAAAS,cAAA,iBAAAA,cAAA,iBACKN,KAAK,WAAAO,gBAAA,iBACPT,SAAS,EAAGK,KAAK;EAEtB,CAAC;AACH;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEcb,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"contextEnhance.js","names":["_react","_interopRequireDefault","require","contextEnhance","context","setOnProp","props","other","value","React","useContext","_default","exports","default"],"sources":["../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAQC,KAAU,IAAK;IACrB,MAAM;MAAE,GAAGC;IAAM,CAAC,GAAGD,KAAK;IAC1B,MAAME,KAAK,GAAGC,cAAK,CAACC,UAAU,CAACN,OAAO,CAAC;IACvC,OAAO;MACL,GAAGG,KAAK;MACR,CAACF,SAAS,GAAGG;IACf,CAAC;EACH,CAAC;AACH;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcV,cAAc","ignoreList":[]}
@@ -1,13 +1,14 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
4
- import _extends from "@babel/runtime/helpers/esm/extends";
5
1
  import React from 'react';
6
2
  function contextEnhance(context, setOnProp) {
7
- return function (props) {
8
- var other = _extends({}, (_objectDestructuringEmpty(props), props));
9
- var value = React.useContext(context);
10
- return _objectSpread(_objectSpread({}, other), {}, _defineProperty({}, setOnProp, value));
3
+ return props => {
4
+ const {
5
+ ...other
6
+ } = props;
7
+ const value = React.useContext(context);
8
+ return {
9
+ ...other,
10
+ [setOnProp]: value
11
+ };
11
12
  };
12
13
  }
13
14
  export default contextEnhance;
@@ -1 +1 @@
1
- {"version":3,"file":"contextEnhance.mjs","names":["React","contextEnhance","context","setOnProp","props","other","_extends","_objectDestructuringEmpty","value","useContext","_objectSpread","_defineProperty"],"sources":["../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAO,UAACC,KAAU,EAAK;IACrB,IAAWC,KAAK,GAAAC,QAAA,MAAAC,yBAAA,CAAKH,KAAK,GAALA,KAAK;IAC1B,IAAMI,KAAK,GAAGR,KAAK,CAACS,UAAU,CAACP,OAAO,CAAC;IACvC,OAAAQ,aAAA,CAAAA,aAAA,KACKL,KAAK,OAAAM,eAAA,KACPR,SAAS,EAAGK,KAAK;EAEtB,CAAC;AACH;AAEA,eAAeP,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"contextEnhance.mjs","names":["React","contextEnhance","context","setOnProp","props","other","value","useContext"],"sources":["../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAQC,KAAU,IAAK;IACrB,MAAM;MAAE,GAAGC;IAAM,CAAC,GAAGD,KAAK;IAC1B,MAAME,KAAK,GAAGN,KAAK,CAACO,UAAU,CAACL,OAAO,CAAC;IACvC,OAAO;MACL,GAAGG,KAAK;MACR,CAACF,SAAS,GAAGG;IACf,CAAC;EACH,CAAC;AACH;AAEA,eAAeL,cAAc","ignoreList":[]}
@@ -1,99 +1,83 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useAsyncI18nMessages = exports["default"] = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
- var _regenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/regenerator"));
11
- var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
7
+ exports.useAsyncI18nMessages = exports.default = void 0;
14
8
  var _react = _interopRequireDefault(require("react"));
15
9
  var _WithI18n = require("./WithI18n");
16
- var useAsyncI18nMessages = exports.useAsyncI18nMessages = function useAsyncI18nMessages(primaryContainer, locale, fallbackContainer) {
17
- var _store$locale;
18
- var container = _react["default"].useMemo(function () {
10
+ const useAsyncI18nMessages = (primaryContainer, locale, fallbackContainer) => {
11
+ const container = _react.default.useMemo(() => {
19
12
  if (!fallbackContainer) return primaryContainer;
20
13
  if (!primaryContainer) return fallbackContainer;
21
14
  if (primaryContainer === fallbackContainer) return primaryContainer;
22
- var container = {};
23
- var _loop = function _loop(_locale) {
24
- if (typeof primaryContainer[_locale] === 'function' || typeof fallbackContainer[_locale] === 'function') {
25
- container[_locale] = /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regenerator2["default"])().m(function _callee() {
26
- var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
27
- return (0, _regenerator2["default"])().w(function (_context) {
28
- while (1) switch (_context.n) {
29
- case 0:
30
- _context.n = 1;
31
- return Promise.all([primaryContainer[_locale], fallbackContainer[_locale]]);
32
- case 1:
33
- _yield$Promise$all = _context.v;
34
- _yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 2);
35
- primary = _yield$Promise$all2[0];
36
- fallback = _yield$Promise$all2[1];
37
- return _context.a(2, (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, primary), fallback));
38
- }
39
- }, _callee);
40
- }));
15
+ const container = {};
16
+ for (const locale in primaryContainer) {
17
+ if (typeof primaryContainer[locale] === 'function' || typeof fallbackContainer[locale] === 'function') {
18
+ container[locale] = async () => {
19
+ const [primary, fallback] = await Promise.all([primaryContainer[locale], fallbackContainer[locale]]);
20
+ return {
21
+ ...primary,
22
+ ...fallback
23
+ };
24
+ };
41
25
  } else {
42
- var _primaryContainer$_lo, _fallbackContainer$_l;
43
- container[_locale] = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, (_primaryContainer$_lo = primaryContainer[_locale]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
26
+ container[locale] = {
27
+ ...(primaryContainer[locale] ?? {}),
28
+ ...(fallbackContainer[locale] ?? {})
29
+ };
44
30
  }
45
- };
46
- for (var _locale in primaryContainer) {
47
- _loop(_locale);
48
31
  }
49
32
  return container;
50
33
  }, [primaryContainer, fallbackContainer]);
51
- var initStore = _react["default"].useMemo(function () {
52
- var store = {};
53
- for (var _locale2 in container) {
54
- if ((0, _typeof2["default"])(container[_locale2]) === 'object') {
55
- store[_locale2] = container[_locale2];
34
+ const initStore = _react.default.useMemo(() => {
35
+ const store = {};
36
+ for (const locale in container) {
37
+ if (typeof container[locale] === 'object') {
38
+ store[locale] = container[locale];
56
39
  }
57
40
  }
58
41
  return store;
59
42
  }, [container]);
60
- var _React$useState = _react["default"].useState(initStore),
61
- _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
62
- store = _React$useState2[0],
63
- setStore = _React$useState2[1];
64
- var lastLoadedLocaleRef = _react["default"].useRef(null);
43
+ const [store, setStore] = _react.default.useState(initStore);
44
+ const lastLoadedLocaleRef = _react.default.useRef(null);
65
45
  if (store[locale]) lastLoadedLocaleRef.current = locale;
66
- var fallbackMessages = _react["default"].useMemo(function () {
67
- return Object.values(store)[0];
68
- }, [store]);
69
- var loadingLocaleRef = _react["default"].useRef(null);
70
- _react["default"].useEffect(function () {
46
+ const fallbackMessages = _react.default.useMemo(() => Object.values(store)[0], [store]);
47
+ const loadingLocaleRef = _react.default.useRef(null);
48
+ _react.default.useEffect(() => {
71
49
  loadingLocaleRef.current = locale;
72
- var asyncMessages = container[locale];
50
+ const asyncMessages = container[locale];
73
51
  if (typeof asyncMessages === 'function') {
74
- asyncMessages().then(function (module) {
52
+ asyncMessages().then(module => {
75
53
  if (loadingLocaleRef.current !== locale) return;
76
- var messages = module;
77
- if ('default' in module && (0, _typeof2["default"])(module["default"]) === 'object') messages = module["default"];
78
- setStore(function (store) {
79
- return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, store), {}, (0, _defineProperty2["default"])({}, locale, messages));
80
- });
81
- })["catch"](function (err) {
54
+ let messages = module;
55
+ if ('default' in module && typeof module.default === 'object') messages = module.default;
56
+ setStore(store => ({
57
+ ...store,
58
+ [locale]: messages
59
+ }));
60
+ }).catch(err => {
82
61
  // eslint-disable-next-line no-console
83
62
  console.error(err);
84
63
  });
85
64
  }
86
65
  }, [container, locale]);
87
- return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
66
+ return store[locale] ?? fallbackMessages;
88
67
  };
89
- var _default = exports["default"] = function _default(container) {
90
- return function (props) {
91
- var i18n = props.i18n,
92
- locale = props.locale;
93
- var getI18nText = (0, _WithI18n.useI18n)(i18n, locale, container);
94
- return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, props), {}, {
95
- getI18nText: getI18nText
96
- });
68
+ exports.useAsyncI18nMessages = useAsyncI18nMessages;
69
+ var _default = container => {
70
+ return props => {
71
+ const {
72
+ i18n,
73
+ locale
74
+ } = props;
75
+ const getI18nText = (0, _WithI18n.useI18n)(i18n, locale, container);
76
+ return {
77
+ ...props,
78
+ getI18nText
79
+ };
97
80
  };
98
81
  };
82
+ exports.default = _default;
99
83
  //# sourceMappingURL=i18nEnhance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18nEnhance.js","names":["_react","_interopRequireDefault","require","_WithI18n","useAsyncI18nMessages","exports","primaryContainer","locale","fallbackContainer","_store$locale","container","React","useMemo","_loop","_locale","_asyncToGenerator2","_regenerator2","m","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","w","_context","n","Promise","all","v","_slicedToArray2","a","_objectSpread3","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof2","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty2","err","console","error","_default","props","i18n","getI18nText","useI18n"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { type LocaleKeys, useI18n } from './WithI18n';\n\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAkBO,IAAME,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,SAAvBA,oBAAoBA,CAC/BE,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGC,iBAAK,CAACC,OAAO,CAAC,YAAM;IACpC,IAAI,CAACJ,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAA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,aAAa,KAAK,UAAU,EAAE;MACvCA,aAAa,CAAC,CAAC,CACZC,IAAI,CAAC,UAACC,MAAM,EAAK;QAChB,IAAIJ,gBAAgB,CAACJ,OAAO,KAAKpC,MAAM,EAAE;QACzC,IAAI6C,QAAQ,GAAGD,MAAM;QACrB,IAAI,SAAS,IAAIA,MAAM,IAAI,IAAAf,QAAA,aAAOe,MAAM,WAAQ,MAAK,QAAQ,EAAEC,QAAQ,GAAGD,MAAM,WAAQ;QACxFX,QAAQ,CAAC,UAACL,KAAK;UAAA,WAAAJ,cAAA,iBAAAA,cAAA,iBACVI,KAAK,WAAAkB,gBAAA,iBACP9C,MAAM,EAAG6C,QAAQ;QAAA,CAClB,CAAC;MACL,CAAC,CAAC,SAEI,CAAC,UAACE,GAAG,EAAK;QACd;QACAC,OAAO,CAACC,KAAK,CAACF,GAAG,CAAC;MACpB,CAAC,CAAC;IACN;EACF,CAAC,EAAE,CAAC5C,SAAS,EAAEH,MAAM,CAAC,CAAC;EAEvB,QAAAE,aAAA,GAAO0B,KAAK,CAAC5B,MAAM,CAAC,cAAAE,aAAA,cAAAA,aAAA,GAAImC,gBAAgB;AAC1C,CAAC;AAAC,IAAAa,QAAA,GAAApD,OAAA,cACa,SAAAoD,SAAC/C,SAA6B,EAAK;EAChD,OAAO,UAACgD,KAAU,EAAkD;IAClE,IAAQC,IAAI,GAAaD,KAAK,CAAtBC,IAAI;MAAEpD,MAAM,GAAKmD,KAAK,CAAhBnD,MAAM;IACpB,IAAMqD,WAAW,GAAG,IAAAC,iBAAO,EAACF,IAAI,EAAEpD,MAAM,EAAEG,SAAS,CAAC;IAEpD,WAAAqB,cAAA,iBAAAA,cAAA,iBAAY2B,KAAK;MAAEE,WAAW,EAAXA;IAAW;EAChC,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"i18nEnhance.js","names":["_react","_interopRequireDefault","require","_WithI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","container","React","useMemo","primary","fallback","Promise","all","initStore","store","setStore","useState","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","default","catch","err","console","error","exports","_default","props","i18n","getI18nText","useI18n"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { type LocaleKeys, useI18n } from './WithI18n';\n\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAkBO,MAAME,oBAAoB,GAAGA,CAClCC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,KAClC;EACH,MAAMC,SAAS,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAM;IACpC,IAAI,CAACH,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAAiB,EAAE,OAAOF,gBAAgB;IACnE,MAAMG,SAA4B,GAAG,CAAC,CAAC;IACvC,KAAK,MAAMF,MAAM,IAAID,gBAAgB,EAAE;MACrC,IACE,OAAOA,gBAAgB,CAACC,MAAM,CAAC,KAAK,UAAU,IAC9C,OAAOC,iBAAiB,CAACD,MAAM,CAAC,KAAK,UAAU,EAC/C;QACAE,SAAS,CAACF,MAAM,CAAC,GAAG,YAAY;UAC9B,MAAM,CAACK,OAAO,EAAEC,QAAQ,CAAC,GAAG,MAAMC,OAAO,CAACC,GAAG,CAAC,CAC5CT,gBAAgB,CAACC,MAAM,CAAC,EACxBC,iBAAiB,CA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Gf,MAAM;IACjC,MAAMqB,aAAa,GAAGnB,SAAS,CAACF,MAAM,CAAC;IACvC,IAAI,OAAOqB,aAAa,KAAK,UAAU,EAAE;MACvCA,aAAa,CAAC,CAAC,CACZC,IAAI,CAAEC,MAAM,IAAK;QAChB,IAAIJ,gBAAgB,CAACJ,OAAO,KAAKf,MAAM,EAAE;QACzC,IAAIwB,QAAQ,GAAGD,MAAM;QACrB,IAAI,SAAS,IAAIA,MAAM,IAAI,OAAOA,MAAM,CAACE,OAAO,KAAK,QAAQ,EAAED,QAAQ,GAAGD,MAAM,CAACE,OAAO;QACxFd,QAAQ,CAAED,KAAK,KAAM;UACnB,GAAGA,KAAK;UACR,CAACV,MAAM,GAAGwB;QACZ,CAAC,CAAC,CAAC;MACL,CAAC,CAAC,CAEDE,KAAK,CAAEC,GAAG,IAAK;QACd;QACAC,OAAO,CAACC,KAAK,CAACF,GAAG,CAAC;MACpB,CAAC,CAAC;IACN;EACF,CAAC,EAAE,CAACzB,SAAS,EAAEF,MAAM,CAAC,CAAC;EAEvB,OAAOU,KAAK,CAACV,MAAM,CAAC,IAAIgB,gBAAgB;AAC1C,CAAC;AAACc,OAAA,CAAAhC,oBAAA,GAAAA,oBAAA;AAAA,IAAAiC,QAAA,GACc7B,SAA6B,IAAK;EAChD,OAAQ8B,KAAU,IAAkD;IAClE,MAAM;MAAEC,IAAI;MAAEjC;IAAO,CAAC,GAAGgC,KAAK;IAC9B,MAAME,WAAW,GAAG,IAAAC,iBAAO,EAACF,IAAI,EAAEjC,MAAM,EAAEE,SAAS,CAAC;IAEpD,OAAO;MAAE,GAAG8B,KAAK;MAAEE;IAAY,CAAC;EAClC,CAAC;AACH,CAAC;AAAAJ,OAAA,CAAAL,OAAA,GAAAM,QAAA","ignoreList":[]}
@@ -1,89 +1,75 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _typeof from "@babel/runtime/helpers/esm/typeof";
3
- import _regenerator from "@babel/runtime/helpers/esm/regenerator";
4
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
7
1
  import React from "react";
8
2
  import { useI18n } from "./WithI18n.mjs";
9
- var useAsyncI18nMessages = function useAsyncI18nMessages2(primaryContainer, locale, fallbackContainer) {
10
- var _store$locale;
11
- var container = React.useMemo(function() {
3
+ const useAsyncI18nMessages = (primaryContainer, locale, fallbackContainer) => {
4
+ const container = React.useMemo(() => {
12
5
  if (!fallbackContainer) return primaryContainer;
13
6
  if (!primaryContainer) return fallbackContainer;
14
7
  if (primaryContainer === fallbackContainer) return primaryContainer;
15
- var container2 = {};
16
- var _loop = function _loop2(_locale2) {
17
- if (typeof primaryContainer[_locale2] === "function" || typeof fallbackContainer[_locale2] === "function") {
18
- container2[_locale2] = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee() {
19
- var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
20
- return _regenerator().w(function(_context) {
21
- while (1) switch (_context.n) {
22
- case 0:
23
- _context.n = 1;
24
- return Promise.all([primaryContainer[_locale2], fallbackContainer[_locale2]]);
25
- case 1:
26
- _yield$Promise$all = _context.v;
27
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
28
- primary = _yield$Promise$all2[0];
29
- fallback = _yield$Promise$all2[1];
30
- return _context.a(2, _objectSpread(_objectSpread({}, primary), fallback));
31
- }
32
- }, _callee);
33
- }));
8
+ const container2 = {};
9
+ for (const locale2 in primaryContainer) {
10
+ if (typeof primaryContainer[locale2] === "function" || typeof fallbackContainer[locale2] === "function") {
11
+ container2[locale2] = async () => {
12
+ const [primary, fallback] = await Promise.all([primaryContainer[locale2], fallbackContainer[locale2]]);
13
+ return {
14
+ ...primary,
15
+ ...fallback
16
+ };
17
+ };
34
18
  } else {
35
- var _primaryContainer$_lo, _fallbackContainer$_l;
36
- container2[_locale2] = _objectSpread(_objectSpread({}, (_primaryContainer$_lo = primaryContainer[_locale2]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale2]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
19
+ container2[locale2] = {
20
+ ...primaryContainer[locale2] ?? {},
21
+ ...fallbackContainer[locale2] ?? {}
22
+ };
37
23
  }
38
- };
39
- for (var _locale in primaryContainer) {
40
- _loop(_locale);
41
24
  }
42
25
  return container2;
43
26
  }, [primaryContainer, fallbackContainer]);
44
- var initStore = React.useMemo(function() {
45
- var store2 = {};
46
- for (var _locale2 in container) {
47
- if (_typeof(container[_locale2]) === "object") {
48
- store2[_locale2] = container[_locale2];
27
+ const initStore = React.useMemo(() => {
28
+ const store2 = {};
29
+ for (const locale2 in container) {
30
+ if (typeof container[locale2] === "object") {
31
+ store2[locale2] = container[locale2];
49
32
  }
50
33
  }
51
34
  return store2;
52
35
  }, [container]);
53
- var _React$useState = React.useState(initStore), _React$useState2 = _slicedToArray(_React$useState, 2), store = _React$useState2[0], setStore = _React$useState2[1];
54
- var lastLoadedLocaleRef = React.useRef(null);
36
+ const [store, setStore] = React.useState(initStore);
37
+ const lastLoadedLocaleRef = React.useRef(null);
55
38
  if (store[locale]) lastLoadedLocaleRef.current = locale;
56
- var fallbackMessages = React.useMemo(function() {
57
- return Object.values(store)[0];
58
- }, [store]);
59
- var loadingLocaleRef = React.useRef(null);
60
- React.useEffect(function() {
39
+ const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);
40
+ const loadingLocaleRef = React.useRef(null);
41
+ React.useEffect(() => {
61
42
  loadingLocaleRef.current = locale;
62
- var asyncMessages = container[locale];
43
+ const asyncMessages = container[locale];
63
44
  if (typeof asyncMessages === "function") {
64
- asyncMessages().then(function(module) {
45
+ asyncMessages().then((module) => {
65
46
  if (loadingLocaleRef.current !== locale) return;
66
- var messages = module;
67
- if ("default" in module && _typeof(module["default"]) === "object") messages = module["default"];
68
- setStore(function(store2) {
69
- return _objectSpread(_objectSpread({}, store2), {}, _defineProperty({}, locale, messages));
70
- });
71
- })["catch"](function(err) {
47
+ let messages = module;
48
+ if ("default" in module && typeof module.default === "object") messages = module.default;
49
+ setStore((store2) => ({
50
+ ...store2,
51
+ [locale]: messages
52
+ }));
53
+ }).catch((err) => {
72
54
  console.error(err);
73
55
  });
74
56
  }
75
57
  }, [container, locale]);
76
- return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
58
+ return store[locale] ?? fallbackMessages;
77
59
  };
78
- const i18nEnhance = (function(container) {
79
- return function(props) {
80
- var i18n = props.i18n, locale = props.locale;
81
- var getI18nText = useI18n(i18n, locale, container);
82
- return _objectSpread(_objectSpread({}, props), {}, {
60
+ const i18nEnhance = (container) => {
61
+ return (props) => {
62
+ const {
63
+ i18n,
64
+ locale
65
+ } = props;
66
+ const getI18nText = useI18n(i18n, locale, container);
67
+ return {
68
+ ...props,
83
69
  getI18nText
84
- });
70
+ };
85
71
  };
86
- });
72
+ };
87
73
  export {
88
74
  i18nEnhance as default,
89
75
  useAsyncI18nMessages
@@ -1 +1 @@
1
- {"version":3,"file":"i18nEnhance.mjs","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","useMemo","_loop","_locale","_asyncToGenerator","_regenerator","m","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","w","_context","n","Promise","all","v","_slicedToArray","a","_objectSpread","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty","err","console","error","props","i18n","getI18nText"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { type LocaleKeys, useI18n } from './WithI18n';\n\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAA0BC,OAAO,QAAQ,gBAAY;AAkBrD,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC/BC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAAC,YAAM;IACpC,IAAI,CAACH,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAAiB,EAAE,OAAOF,gBAAgB;IACnE,IAAMI,SAA4B,GAAG,CAAC,CAAC;IAAC,IAAAE,KAAA,YAAAA,MAAAC,OAAA,EACD;MACrC,IACE,OAAOP,gBAAgB,CAACC,OAAM,CAAC,KAAK,UAAU,IAC9C,OAAOC,iBAAiB,CAACD,OAAM,CAAC,KAAK,UAAU,EAC/C;QACAG,SAAS,CAACH,OAAM,CAAC,gBAAAO,iBAAA,cAAAC,YAAA,GAAAC,CAAA,CAAG,SAAAC,QAAA;UAAA,IAAAC,kBAAA,EAAAC,mBAAA,EAAAC,OAAA,EAAAC,QAAA;UAAA,OAAAN,YAAA,GAAAO,CAAA,WAAAC,QAAA;YAAA,kBAAAA,QAAA,CAAAC,CAAA;cAAA;gBAAAD,QAAA,CAAAC,CAAA;gBAAA,OACgBC,OAAO,CAACC,GAAG,CAAC,CAC5CpB,gBAAgB,CAACC,OAAM,CAAC,EACxBC,iBAAiB,CAACD,OAAM,CAAC,CAC1B,CAAC;cAAA;gBAAAW,kBAAA,GAAA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AAAE,aAAA,cAAAA,aAAA,GAAIkC,gBAAgB;AAC1C,CAAC;AACD,gBAAe,UAACjC,SAA6B,EAAK;EAChD,OAAO,UAAC8C,KAAU,EAAkD;IAClE,IAAQC,IAAI,GAAaD,KAAK,CAAtBC,IAAI;MAAElD,MAAM,GAAKiD,KAAK,CAAhBjD,MAAM;IACpB,IAAMmD,WAAW,GAAGtD,OAAO,CAACqD,IAAI,EAAElD,MAAM,EAAEG,SAAS,CAAC;IAEpD,OAAAoB,aAAA,CAAAA,aAAA,KAAY0B,KAAK;MAAEE,WAAW,EAAXA;IAAW;EAChC,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"i18nEnhance.mjs","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","container","useMemo","primary","fallback","Promise","all","initStore","store","setStore","useState","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","default","catch","err","console","error","props","i18n","getI18nText"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { type LocaleKeys, useI18n } from './WithI18n';\n\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAA0BC,OAAO,QAAQ,gBAAY;AAkBrD,OAAO,MAAMC,oBAAoB,GAAGA,CAClCC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,KAClC;EACH,MAAMC,SAAS,GAAGN,KAAK,CAACO,OAAO,CAAC,MAAM;IACpC,IAAI,CAACF,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI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KAAU,IAAkD;IAClE,MAAM;MAAEC,IAAI;MAAE9B;IAAO,CAAC,GAAG6B,KAAK;IAC9B,MAAME,WAAW,GAAGlC,OAAO,CAACiC,IAAI,EAAE9B,MAAM,EAAEE,SAAS,CAAC;IAEpD,OAAO;MAAE,GAAG2B,KAAK;MAAEE;IAAY,CAAC;EAClC,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,24 +1,26 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports["default"] = void 0;
7
+ exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _assignProps = _interopRequireDefault(require("../assignProps"));
10
10
  var _ref = require("../ref");
11
11
  var _useColorResolver = require("../use/useColorResolver");
12
- var resolveColorEnhance = function resolveColorEnhance() {
13
- return function (props) {
14
- var ref = props.ref;
15
- var internalRef = _react["default"].useRef();
16
- var resolveColor = (0, _useColorResolver.useColorResolver)();
17
- return (0, _assignProps["default"])(props, {
12
+ const resolveColorEnhance = () => {
13
+ return props => {
14
+ const {
15
+ ref
16
+ } = props;
17
+ const internalRef = _react.default.useRef();
18
+ const resolveColor = (0, _useColorResolver.useColorResolver)();
19
+ return (0, _assignProps.default)(props, {
18
20
  ref: (0, _ref.useForkRef)(ref, internalRef),
19
- resolveColor: resolveColor
21
+ resolveColor
20
22
  });
21
23
  };
22
24
  };
23
- var _default = exports["default"] = resolveColorEnhance;
25
+ var _default = exports.default = resolveColorEnhance;
24
26
  //# sourceMappingURL=resolveColorEnhance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveColorEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","_ref","_useColorResolver","resolveColorEnhance","props","ref","internalRef","React","useRef","resolveColor","useColorResolver","assignProps","useForkRef","_default","exports"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,IAAMI,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChC,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAKD,KAAK,CAAbC,GAAG;IACX,IAAMC,WAAW,GAAGC,iBAAK,CAACC,MAAM,CAAc,CAAC;IAC/C,IAAMC,YAAY,GAAG,IAAAC,kCAAgB,EAAC,CAAC;IAEvC,OAAO,IAAAC,uBAAW,EAACP,KAAK,EAAE;MACxBC,GAAG,EAAE,IAAAO,eAAU,EAACP,GAAG,EAAEC,WAAW,CAAC;MACjCG,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,cAEaX,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"resolveColorEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","_ref","_useColorResolver","resolveColorEnhance","props","ref","internalRef","React","useRef","resolveColor","useColorResolver","assignProps","useForkRef","_default","exports","default"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,MAAMI,mBAAmB,GAAGA,CAAA,KAAM;EAChC,OAAQC,KAAU,IAAK;IACrB,MAAM;MAAEC;IAAI,CAAC,GAAGD,KAAK;IACrB,MAAME,WAAW,GAAGC,cAAK,CAACC,MAAM,CAAc,CAAC;IAC/C,MAAMC,YAAY,GAAG,IAAAC,kCAAgB,EAAC,CAAC;IAEvC,OAAO,IAAAC,oBAAW,EAACP,KAAK,EAAE;MACxBC,GAAG,EAAE,IAAAO,eAAU,EAACP,GAAG,EAAEC,WAAW,CAAC;MACjCG;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,mBAAmB","ignoreList":[]}
@@ -2,14 +2,16 @@ import React from 'react';
2
2
  import assignProps from "../assignProps.mjs";
3
3
  import { useForkRef } from "../ref.mjs";
4
4
  import { useColorResolver } from "../use/useColorResolver.mjs";
5
- var resolveColorEnhance = function resolveColorEnhance() {
6
- return function (props) {
7
- var ref = props.ref;
8
- var internalRef = React.useRef();
9
- var resolveColor = useColorResolver();
5
+ const resolveColorEnhance = () => {
6
+ return props => {
7
+ const {
8
+ ref
9
+ } = props;
10
+ const internalRef = React.useRef();
11
+ const resolveColor = useColorResolver();
10
12
  return assignProps(props, {
11
13
  ref: useForkRef(ref, internalRef),
12
- resolveColor: resolveColor
14
+ resolveColor
13
15
  });
14
16
  };
15
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"resolveColorEnhance.mjs","names":["React","assignProps","useForkRef","useColorResolver","resolveColorEnhance","props","ref","internalRef","useRef","resolveColor"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,WAAW,MAAM,oBAAgB;AACxC,SAASC,UAAU,QAAQ,YAAQ;AACnC,SAASC,gBAAgB,QAAQ,6BAAyB;AAE1D,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChC,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAKD,KAAK,CAAbC,GAAG;IACX,IAAMC,WAAW,GAAGP,KAAK,CAACQ,MAAM,CAAc,CAAC;IAC/C,IAAMC,YAAY,GAAGN,gBAAgB,CAAC,CAAC;IAEvC,OAAOF,WAAW,CAACI,KAAK,EAAE;MACxBC,GAAG,EAAEJ,UAAU,CAACI,GAAG,EAAEC,WAAW,CAAC;MACjCE,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAeL,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"resolveColorEnhance.mjs","names":["React","assignProps","useForkRef","useColorResolver","resolveColorEnhance","props","ref","internalRef","useRef","resolveColor"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,WAAW,MAAM,oBAAgB;AACxC,SAASC,UAAU,QAAQ,YAAQ;AACnC,SAASC,gBAAgB,QAAQ,6BAAyB;AAE1D,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EAChC,OAAQC,KAAU,IAAK;IACrB,MAAM;MAAEC;IAAI,CAAC,GAAGD,KAAK;IACrB,MAAME,WAAW,GAAGP,KAAK,CAACQ,MAAM,CAAc,CAAC;IAC/C,MAAMC,YAAY,GAAGN,gBAAgB,CAAC,CAAC;IAEvC,OAAOF,WAAW,CAACI,KAAK,EAAE;MACxBC,GAAG,EAAEJ,UAAU,CAACI,GAAG,EAAEC,WAAW,CAAC;MACjCE;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAeL,mBAAmB","ignoreList":[]}