@semcore/core 17.0.1-prerelease.0 → 17.1.0-prerelease.0

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/CHANGELOG.md +123 -3
  2. package/README.md +5 -35
  3. package/lib/LastInteractionType.js +22 -36
  4. package/lib/LastInteractionType.js.map +1 -1
  5. package/lib/LastInteractionType.mjs +19 -33
  6. package/lib/LastInteractionType.mjs.map +1 -1
  7. package/lib/core-types/Component.js +25 -41
  8. package/lib/core-types/Component.js.map +1 -1
  9. package/lib/core-types/Component.mjs +18 -38
  10. package/lib/core-types/Component.mjs.map +1 -1
  11. package/lib/core-types/symbols.js +9 -9
  12. package/lib/core-types/symbols.js.map +1 -1
  13. package/lib/core-types/symbols.mjs +9 -9
  14. package/lib/core-types/symbols.mjs.map +1 -1
  15. package/lib/coreFactory.js +158 -238
  16. package/lib/coreFactory.js.map +1 -1
  17. package/lib/coreFactory.mjs +133 -189
  18. package/lib/coreFactory.mjs.map +1 -1
  19. package/lib/decorators/propsObserver.js +36 -64
  20. package/lib/decorators/propsObserver.js.map +1 -1
  21. package/lib/decorators/propsObserver.mjs +33 -61
  22. package/lib/decorators/propsObserver.mjs.map +1 -1
  23. package/lib/decorators/reactive.js +17 -17
  24. package/lib/decorators/reactive.js.map +1 -1
  25. package/lib/decorators/reactive.mjs +15 -15
  26. package/lib/decorators/reactive.mjs.map +1 -1
  27. package/lib/enhancement/Children.js +51 -59
  28. package/lib/enhancement/Children.js.map +1 -1
  29. package/lib/enhancement/Children.mjs +47 -41
  30. package/lib/enhancement/Children.mjs.map +1 -1
  31. package/lib/enhancement/Root.js +36 -37
  32. package/lib/enhancement/Root.js.map +1 -1
  33. package/lib/enhancement/Root.mjs +28 -18
  34. package/lib/enhancement/Root.mjs.map +1 -1
  35. package/lib/enhancement/dataName.js +7 -8
  36. package/lib/enhancement/dataName.js.map +1 -1
  37. package/lib/enhancement/dataName.mjs +5 -5
  38. package/lib/enhancement/dataName.mjs.map +1 -1
  39. package/lib/enhancement/enhance.js +6 -9
  40. package/lib/enhancement/enhance.js.map +1 -1
  41. package/lib/enhancement/enhance.mjs +4 -7
  42. package/lib/enhancement/enhance.mjs.map +1 -1
  43. package/lib/enhancement/functionDefaultProps.js +6 -6
  44. package/lib/enhancement/functionDefaultProps.js.map +1 -1
  45. package/lib/enhancement/functionDefaultProps.mjs +4 -4
  46. package/lib/enhancement/functionDefaultProps.mjs.map +1 -1
  47. package/lib/enhancement/i18n.js +13 -13
  48. package/lib/enhancement/i18n.js.map +1 -1
  49. package/lib/enhancement/i18n.mjs +10 -9
  50. package/lib/enhancement/i18n.mjs.map +1 -1
  51. package/lib/enhancement/inheritedName.js +7 -8
  52. package/lib/enhancement/inheritedName.js.map +1 -1
  53. package/lib/enhancement/inheritedName.mjs +5 -5
  54. package/lib/enhancement/inheritedName.mjs.map +1 -1
  55. package/lib/enhancement/staticChildren.js +47 -56
  56. package/lib/enhancement/staticChildren.js.map +1 -1
  57. package/lib/enhancement/staticChildren.mjs +43 -48
  58. package/lib/enhancement/staticChildren.mjs.map +1 -1
  59. package/lib/enhancement/style.js +29 -27
  60. package/lib/enhancement/style.js.map +1 -1
  61. package/lib/enhancement/style.mjs +26 -20
  62. package/lib/enhancement/style.mjs.map +1 -1
  63. package/lib/enhancement/uncontrolledProps.js +46 -65
  64. package/lib/enhancement/uncontrolledProps.js.map +1 -1
  65. package/lib/enhancement/uncontrolledProps.mjs +43 -52
  66. package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
  67. package/lib/esm/LastInteractionType.mjs +19 -33
  68. package/lib/esm/core-types/Component.mjs +18 -38
  69. package/lib/esm/core-types/symbols.mjs +9 -9
  70. package/lib/esm/coreFactory.mjs +133 -189
  71. package/lib/esm/enhancement/Children.mjs +47 -41
  72. package/lib/esm/enhancement/Root.mjs +28 -18
  73. package/lib/esm/enhancement/dataName.mjs +5 -5
  74. package/lib/esm/enhancement/enhance.mjs +4 -7
  75. package/lib/esm/enhancement/functionDefaultProps.mjs +4 -4
  76. package/lib/esm/enhancement/i18n.mjs +10 -9
  77. package/lib/esm/enhancement/inheritedName.mjs +5 -5
  78. package/lib/esm/enhancement/staticChildren.mjs +43 -48
  79. package/lib/esm/enhancement/style.mjs +26 -20
  80. package/lib/esm/enhancement/uncontrolledProps.mjs +43 -52
  81. package/lib/esm/register.mjs +12 -20
  82. package/lib/esm/styled/reshadow-core.mjs +98 -111
  83. package/lib/esm/styled/sstyled.mjs +31 -41
  84. package/lib/esm/utils/assignProps.mjs +32 -36
  85. package/lib/esm/utils/enhances/WithI18n.mjs +15 -17
  86. package/lib/esm/utils/enhances/i18nEnhance.mjs +47 -61
  87. package/lib/esm/utils/logger.mjs +13 -21
  88. package/lib/esm/utils/pick.mjs +4 -4
  89. package/lib/esm/utils/ref.mjs +27 -43
  90. package/lib/esm/utils/use/useEnhancedEffect.mjs +1 -1
  91. package/lib/index.js +17 -17
  92. package/lib/register.js +17 -24
  93. package/lib/register.js.map +1 -1
  94. package/lib/register.mjs +12 -20
  95. package/lib/register.mjs.map +1 -1
  96. package/lib/styled/index.js +4 -4
  97. package/lib/styled/reshadow-core.js +102 -104
  98. package/lib/styled/reshadow-core.js.map +1 -1
  99. package/lib/styled/reshadow-core.mjs +98 -111
  100. package/lib/styled/reshadow-core.mjs.map +1 -1
  101. package/lib/styled/sstyled.js +31 -53
  102. package/lib/styled/sstyled.js.map +1 -1
  103. package/lib/styled/sstyled.mjs +31 -41
  104. package/lib/styled/sstyled.mjs.map +1 -1
  105. package/lib/theme/themes/dark.js +2 -2
  106. package/lib/theme/themes/dark.js.map +1 -1
  107. package/lib/theme/themes/default.js +2 -2
  108. package/lib/theme/themes/default.js.map +1 -1
  109. package/lib/theme/themes/highlights-dark.js +2 -2
  110. package/lib/theme/themes/highlights-dark.js.map +1 -1
  111. package/lib/theme/themes/highlights-light.js +2 -2
  112. package/lib/theme/themes/highlights-light.js.map +1 -1
  113. package/lib/theme/themes/light.js +2 -2
  114. package/lib/theme/themes/light.js.map +1 -1
  115. package/lib/utils/CSSinJS.js +8 -10
  116. package/lib/utils/CSSinJS.js.map +1 -1
  117. package/lib/utils/CSSinJS.mjs +6 -7
  118. package/lib/utils/CSSinJS.mjs.map +1 -1
  119. package/lib/utils/ThemeProvider.js +44 -51
  120. package/lib/utils/ThemeProvider.js.map +1 -1
  121. package/lib/utils/ThemeProvider.mjs +36 -47
  122. package/lib/utils/ThemeProvider.mjs.map +1 -1
  123. package/lib/utils/addonText.js +4 -7
  124. package/lib/utils/addonText.js.map +1 -1
  125. package/lib/utils/addonText.mjs +2 -5
  126. package/lib/utils/addonText.mjs.map +1 -1
  127. package/lib/utils/addonTextChildren.js +15 -21
  128. package/lib/utils/addonTextChildren.js.map +1 -1
  129. package/lib/utils/addonTextChildren.mjs +7 -13
  130. package/lib/utils/addonTextChildren.mjs.map +1 -1
  131. package/lib/utils/ariaProps.js +7 -5
  132. package/lib/utils/ariaProps.js.map +1 -1
  133. package/lib/utils/ariaProps.mjs +7 -5
  134. package/lib/utils/ariaProps.mjs.map +1 -1
  135. package/lib/utils/assignProps.js +33 -37
  136. package/lib/utils/assignProps.js.map +1 -1
  137. package/lib/utils/assignProps.mjs +32 -36
  138. package/lib/utils/assignProps.mjs.map +1 -1
  139. package/lib/utils/canUseDOM.js +1 -1
  140. package/lib/utils/capitalizeFirstLetter.js +1 -1
  141. package/lib/utils/color.js +72 -95
  142. package/lib/utils/color.js.map +1 -1
  143. package/lib/utils/color.mjs +71 -94
  144. package/lib/utils/color.mjs.map +1 -1
  145. package/lib/utils/compose.js +3 -12
  146. package/lib/utils/compose.js.map +1 -1
  147. package/lib/utils/compose.mjs +2 -11
  148. package/lib/utils/compose.mjs.map +1 -1
  149. package/lib/utils/createUUID.js +5 -5
  150. package/lib/utils/createUUID.js.map +1 -1
  151. package/lib/utils/createUUID.mjs +4 -4
  152. package/lib/utils/createUUID.mjs.map +1 -1
  153. package/lib/utils/cssToIntDefault.js +3 -4
  154. package/lib/utils/cssToIntDefault.js.map +1 -1
  155. package/lib/utils/cssToIntDefault.mjs +2 -3
  156. package/lib/utils/cssToIntDefault.mjs.map +1 -1
  157. package/lib/utils/enhances/WithCSS.js +10 -8
  158. package/lib/utils/enhances/WithCSS.js.map +1 -1
  159. package/lib/utils/enhances/WithCSS.mjs +7 -6
  160. package/lib/utils/enhances/WithCSS.mjs.map +1 -1
  161. package/lib/utils/enhances/WithI18n.js +19 -19
  162. package/lib/utils/enhances/WithI18n.js.map +1 -1
  163. package/lib/utils/enhances/WithI18n.mjs +15 -17
  164. package/lib/utils/enhances/WithI18n.mjs.map +1 -1
  165. package/lib/utils/enhances/a11yEnhance.js +34 -39
  166. package/lib/utils/enhances/a11yEnhance.js.map +1 -1
  167. package/lib/utils/enhances/a11yEnhance.mjs +32 -36
  168. package/lib/utils/enhances/a11yEnhance.mjs.map +1 -1
  169. package/lib/utils/enhances/animatedSizeEnhance.js +55 -63
  170. package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
  171. package/lib/utils/enhances/animatedSizeEnhance.mjs +50 -58
  172. package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
  173. package/lib/utils/enhances/contextEnhance.js +12 -11
  174. package/lib/utils/enhances/contextEnhance.js.map +1 -1
  175. package/lib/utils/enhances/contextEnhance.mjs +9 -8
  176. package/lib/utils/enhances/contextEnhance.mjs.map +1 -1
  177. package/lib/utils/enhances/i18nEnhance.js +51 -67
  178. package/lib/utils/enhances/i18nEnhance.js.map +1 -1
  179. package/lib/utils/enhances/i18nEnhance.mjs +47 -61
  180. package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
  181. package/lib/utils/enhances/resolveColorEnhance.js +12 -10
  182. package/lib/utils/enhances/resolveColorEnhance.js.map +1 -1
  183. package/lib/utils/enhances/resolveColorEnhance.mjs +8 -6
  184. package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -1
  185. package/lib/utils/eventEmitter.js +30 -57
  186. package/lib/utils/eventEmitter.js.map +1 -1
  187. package/lib/utils/eventEmitter.mjs +26 -55
  188. package/lib/utils/eventEmitter.mjs.map +1 -1
  189. package/lib/utils/findComponent.js +35 -42
  190. package/lib/utils/findComponent.js.map +1 -1
  191. package/lib/utils/findComponent.mjs +26 -33
  192. package/lib/utils/findComponent.mjs.map +1 -1
  193. package/lib/utils/fire.js +7 -13
  194. package/lib/utils/fire.js.map +1 -1
  195. package/lib/utils/fire.mjs +5 -11
  196. package/lib/utils/fire.mjs.map +1 -1
  197. package/lib/utils/focus-lock/focusBorders.js +28 -32
  198. package/lib/utils/focus-lock/focusBorders.js.map +1 -1
  199. package/lib/utils/focus-lock/focusBorders.mjs +26 -32
  200. package/lib/utils/focus-lock/focusBorders.mjs.map +1 -1
  201. package/lib/utils/focus-lock/getFocusableIn.js +4 -6
  202. package/lib/utils/focus-lock/getFocusableIn.js.map +1 -1
  203. package/lib/utils/focus-lock/getFocusableIn.mjs +3 -6
  204. package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -1
  205. package/lib/utils/focus-lock/isFocusInside.js +5 -6
  206. package/lib/utils/focus-lock/isFocusInside.js.map +1 -1
  207. package/lib/utils/focus-lock/isFocusInside.mjs +4 -6
  208. package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -1
  209. package/lib/utils/focus-lock/isFocusable.js +9 -12
  210. package/lib/utils/focus-lock/isFocusable.js.map +1 -1
  211. package/lib/utils/focus-lock/isFocusable.mjs +8 -11
  212. package/lib/utils/focus-lock/isFocusable.mjs.map +1 -1
  213. package/lib/utils/focus-lock/setFocus.js +21 -27
  214. package/lib/utils/focus-lock/setFocus.js.map +1 -1
  215. package/lib/utils/focus-lock/setFocus.mjs +19 -25
  216. package/lib/utils/focus-lock/setFocus.mjs.map +1 -1
  217. package/lib/utils/getAccessibleName.js +10 -22
  218. package/lib/utils/getAccessibleName.js.map +1 -1
  219. package/lib/utils/getAccessibleName.mjs +10 -21
  220. package/lib/utils/getAccessibleName.mjs.map +1 -1
  221. package/lib/utils/getDisplayName.js +1 -1
  222. package/lib/utils/getEventTarget.js +13 -32
  223. package/lib/utils/getEventTarget.js.map +1 -1
  224. package/lib/utils/getEventTarget.mjs +12 -31
  225. package/lib/utils/getEventTarget.mjs.map +1 -1
  226. package/lib/utils/getOriginChildren.js +4 -4
  227. package/lib/utils/getOriginChildren.js.map +1 -1
  228. package/lib/utils/getRandomInt.js +1 -1
  229. package/lib/utils/getValue.js +4 -6
  230. package/lib/utils/getValue.js.map +1 -1
  231. package/lib/utils/getValue.mjs +3 -5
  232. package/lib/utils/getValue.mjs.map +1 -1
  233. package/lib/utils/hasLabels.js +16 -27
  234. package/lib/utils/hasLabels.js.map +1 -1
  235. package/lib/utils/hasLabels.mjs +14 -24
  236. package/lib/utils/hasLabels.mjs.map +1 -1
  237. package/lib/utils/hasParent.js +3 -2
  238. package/lib/utils/hasParent.js.map +1 -1
  239. package/lib/utils/hasParent.mjs +2 -3
  240. package/lib/utils/hasParent.mjs.map +1 -1
  241. package/lib/utils/ifChildren.js +6 -4
  242. package/lib/utils/ifChildren.js.map +1 -1
  243. package/lib/utils/ifChildren.mjs +4 -2
  244. package/lib/utils/ifChildren.mjs.map +1 -1
  245. package/lib/utils/indentStyles.js +5 -10
  246. package/lib/utils/indentStyles.js.map +1 -1
  247. package/lib/utils/indentStyles.mjs +5 -9
  248. package/lib/utils/indentStyles.mjs.map +1 -1
  249. package/lib/utils/injectStyle.js +11 -13
  250. package/lib/utils/injectStyle.js.map +1 -1
  251. package/lib/utils/injectStyle.mjs +9 -10
  252. package/lib/utils/injectStyle.mjs.map +1 -1
  253. package/lib/utils/inputProps.js +5 -5
  254. package/lib/utils/inputProps.js.map +1 -1
  255. package/lib/utils/inputProps.mjs +4 -4
  256. package/lib/utils/inputProps.mjs.map +1 -1
  257. package/lib/utils/isInteractiveElement.js +7 -9
  258. package/lib/utils/isInteractiveElement.js.map +1 -1
  259. package/lib/utils/isInteractiveElement.mjs +7 -9
  260. package/lib/utils/isInteractiveElement.mjs.map +1 -1
  261. package/lib/utils/isNode.js +4 -5
  262. package/lib/utils/isNode.js.map +1 -1
  263. package/lib/utils/isNode.mjs +1 -2
  264. package/lib/utils/isNode.mjs.map +1 -1
  265. package/lib/utils/isPromise.js +1 -1
  266. package/lib/utils/isRetina.js +7 -2
  267. package/lib/utils/isRetina.js.map +1 -1
  268. package/lib/utils/isRetina.mjs +6 -1
  269. package/lib/utils/isRetina.mjs.map +1 -1
  270. package/lib/utils/logger.js +18 -25
  271. package/lib/utils/logger.js.map +1 -1
  272. package/lib/utils/logger.mjs +13 -21
  273. package/lib/utils/logger.mjs.map +1 -1
  274. package/lib/utils/numericChecker.js +11 -18
  275. package/lib/utils/numericChecker.js.map +1 -1
  276. package/lib/utils/numericChecker.mjs +10 -17
  277. package/lib/utils/numericChecker.mjs.map +1 -1
  278. package/lib/utils/ownerDocument.js +2 -2
  279. package/lib/utils/ownerDocument.js.map +1 -1
  280. package/lib/utils/ownerDocument.mjs +1 -1
  281. package/lib/utils/ownerDocument.mjs.map +1 -1
  282. package/lib/utils/pick.js +5 -5
  283. package/lib/utils/pick.js.map +1 -1
  284. package/lib/utils/pick.mjs +4 -4
  285. package/lib/utils/pick.mjs.map +1 -1
  286. package/lib/utils/propsForElement.js +10 -12
  287. package/lib/utils/propsForElement.js.map +1 -1
  288. package/lib/utils/propsForElement.mjs +8 -10
  289. package/lib/utils/propsForElement.mjs.map +1 -1
  290. package/lib/utils/rafTrottle.js +9 -14
  291. package/lib/utils/rafTrottle.js.map +1 -1
  292. package/lib/utils/rafTrottle.mjs +7 -12
  293. package/lib/utils/rafTrottle.mjs.map +1 -1
  294. package/lib/utils/reactToText.js +5 -8
  295. package/lib/utils/reactToText.js.map +1 -1
  296. package/lib/utils/reactToText.mjs +3 -6
  297. package/lib/utils/reactToText.mjs.map +1 -1
  298. package/lib/utils/ref.js +29 -47
  299. package/lib/utils/ref.js.map +1 -1
  300. package/lib/utils/ref.mjs +27 -43
  301. package/lib/utils/ref.mjs.map +1 -1
  302. package/lib/utils/setRef.js +2 -2
  303. package/lib/utils/setRef.js.map +1 -1
  304. package/lib/utils/syncScroll.js +24 -24
  305. package/lib/utils/syncScroll.js.map +1 -1
  306. package/lib/utils/syncScroll.mjs +21 -21
  307. package/lib/utils/syncScroll.mjs.map +1 -1
  308. package/lib/utils/uncontroll.js +8 -18
  309. package/lib/utils/uncontroll.js.map +1 -1
  310. package/lib/utils/uncontroll.mjs +8 -17
  311. package/lib/utils/uncontroll.mjs.map +1 -1
  312. package/lib/utils/uniqueID.js +22 -27
  313. package/lib/utils/uniqueID.js.map +1 -1
  314. package/lib/utils/uniqueID.mjs +18 -25
  315. package/lib/utils/uniqueID.mjs.map +1 -1
  316. package/lib/utils/use/useColorResolver.js +20 -21
  317. package/lib/utils/use/useColorResolver.js.map +1 -1
  318. package/lib/utils/use/useColorResolver.mjs +16 -18
  319. package/lib/utils/use/useColorResolver.mjs.map +1 -1
  320. package/lib/utils/use/useEnhancedEffect.js +4 -4
  321. package/lib/utils/use/useEnhancedEffect.js.map +1 -1
  322. package/lib/utils/use/useEnhancedEffect.mjs +1 -1
  323. package/lib/utils/use/useEnhancedEffect.mjs.map +1 -1
  324. package/lib/utils/use/useEventCallback.js +5 -10
  325. package/lib/utils/use/useEventCallback.js.map +1 -1
  326. package/lib/utils/use/useEventCallback.mjs +3 -8
  327. package/lib/utils/use/useEventCallback.mjs.map +1 -1
  328. package/lib/utils/use/useEventListener.js +11 -15
  329. package/lib/utils/use/useEventListener.js.map +1 -1
  330. package/lib/utils/use/useEventListener.mjs +7 -11
  331. package/lib/utils/use/useEventListener.mjs.map +1 -1
  332. package/lib/utils/use/useFocusLock.js +80 -94
  333. package/lib/utils/use/useFocusLock.js.map +1 -1
  334. package/lib/utils/use/useFocusLock.mjs +71 -88
  335. package/lib/utils/use/useFocusLock.mjs.map +1 -1
  336. package/lib/utils/use/usePreventScroll.js +24 -26
  337. package/lib/utils/use/usePreventScroll.js.map +1 -1
  338. package/lib/utils/use/usePreventScroll.mjs +19 -21
  339. package/lib/utils/use/usePreventScroll.mjs.map +1 -1
  340. package/lib/utils/use/useScrollBarWidth.js +8 -14
  341. package/lib/utils/use/useScrollBarWidth.js.map +1 -1
  342. package/lib/utils/use/useScrollBarWidth.mjs +8 -13
  343. package/lib/utils/use/useScrollBarWidth.mjs.map +1 -1
  344. package/lib/utils/useCssVariable.js +32 -37
  345. package/lib/utils/useCssVariable.js.map +1 -1
  346. package/lib/utils/useCssVariable.mjs +27 -34
  347. package/lib/utils/useCssVariable.mjs.map +1 -1
  348. package/lib/utils/zIndexStacking.js +28 -24
  349. package/lib/utils/zIndexStacking.js.map +1 -1
  350. package/lib/utils/zIndexStacking.mjs +23 -22
  351. package/lib/utils/zIndexStacking.mjs.map +1 -1
  352. package/package.json +316 -13
  353. package/tsconfig-utils.json +4 -0
  354. package/vite.config.ts +22 -0
@@ -1,15 +1,5 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
- import _superPropGet from "@babel/runtime/helpers/esm/superPropGet";
6
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
7
- import _createClass from "@babel/runtime/helpers/esm/createClass";
8
- import _callSuper from "@babel/runtime/helpers/esm/callSuper";
9
- import _inherits from "@babel/runtime/helpers/esm/inherits";
10
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
11
2
  import _extends from "@babel/runtime/helpers/esm/extends";
12
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
13
3
  import hoistNonReactStatics from "hoist-non-react-statics";
14
4
  import React from "react";
15
5
  import { Component } from "./core-types/Component.mjs";
@@ -27,19 +17,18 @@ import Enhancement$2 from "./enhancement/uncontrolledProps.mjs";
27
17
  import assignProps$1 from "./utils/assignProps.mjs";
28
18
  import { useForkRef } from "./utils/ref.mjs";
29
19
  import useEnhancedEffect from "./utils/use/useEnhancedEffect.mjs";
30
- var _excluded = ["forwardRef"], _excluded2 = ["forwardRef", "__WRAPPER_PROPS_BIND__"], _excluded3 = ["ref"];
31
20
  function isEmptyObject(obj) {
32
21
  return Object.getOwnPropertyNames(obj).length === 0 && Object.getOwnPropertySymbols && // For IE 11
33
22
  Object.getOwnPropertySymbols(obj).length === 0 && Object.getPrototypeOf(obj) === Object.prototype;
34
23
  }
35
24
  function createGetField(enhancements, Component2, isFunction) {
36
25
  return function getField(key) {
37
- return enhancements.filter(function(enhancement) {
26
+ return enhancements.filter((enhancement) => {
38
27
  if (!enhancement.condition) {
39
28
  return true;
40
29
  }
41
30
  return enhancement.condition(Component2, isFunction);
42
- }).reduce(function(acc, item) {
31
+ }).reduce((acc, item) => {
43
32
  if (item[key]) {
44
33
  acc.push(item[key]);
45
34
  }
@@ -48,200 +37,160 @@ function createGetField(enhancements, Component2, isFunction) {
48
37
  };
49
38
  }
50
39
  function createForwardWrapper(Component2, wrapperProps, statics, isFunction) {
51
- var RootComponent = Component2[ROOT_COMPONENT];
52
- var getterMethodName = getterMethodNameByDisplayName(Component2 === null || Component2 === void 0 ? void 0 : Component2.displayName);
53
- var getterMethod = RootComponent !== null && RootComponent !== void 0 && RootComponent.prototype ? RootComponent.prototype[getterMethodName] : void 0;
54
- var useGetterIndex = (getterMethod === null || getterMethod === void 0 ? void 0 : getterMethod.length) >= 2;
55
- function WrapperForwardRefWithBind(_ref, ref) {
56
- var _ref$forwardRef = _ref.forwardRef, forwardRef = _ref$forwardRef === void 0 ? null : _ref$forwardRef, other = _objectWithoutProperties(_ref, _excluded);
40
+ const RootComponent = Component2[ROOT_COMPONENT];
41
+ const getterMethodName = getterMethodNameByDisplayName(Component2?.displayName);
42
+ const getterMethod = RootComponent?.prototype ? RootComponent.prototype[getterMethodName] : void 0;
43
+ const useGetterIndex = getterMethod?.length >= 2;
44
+ function WrapperForwardRefWithBind({
45
+ forwardRef = null,
46
+ ...other
47
+ }, ref) {
57
48
  return /* @__PURE__ */ React.createElement(BindingWrapper, _extends({}, other, {
58
49
  forwardRef: useForkRef(ref, forwardRef)
59
50
  }));
60
51
  }
61
- function WrapperForwardRef(_ref2, ref) {
62
- var _ref2$forwardRef = _ref2.forwardRef, forwardRef = _ref2$forwardRef === void 0 ? null : _ref2$forwardRef, __WRAPPER_PROPS_BIND__ = _ref2.__WRAPPER_PROPS_BIND__, other = _objectWithoutProperties(_ref2, _excluded2);
63
- var _reduce = (__WRAPPER_PROPS_BIND__ || wrapperProps).reduce(function(acc, enhancement) {
64
- return enhancement(acc, WrapperComponent, isFunction);
65
- }, other), _reduce$ref = _reduce.ref, enhancementRef = _reduce$ref === void 0 ? null : _reduce$ref, props = _objectWithoutProperties(_reduce, _excluded3);
52
+ function WrapperForwardRef({
53
+ forwardRef = null,
54
+ __WRAPPER_PROPS_BIND__,
55
+ ...other
56
+ }, ref) {
57
+ const {
58
+ ref: enhancementRef = null,
59
+ ...props
60
+ } = (__WRAPPER_PROPS_BIND__ || wrapperProps).reduce((acc, enhancement) => enhancement(acc, WrapperComponent, isFunction), other);
66
61
  return /* @__PURE__ */ React.createElement(Component2, _extends({}, props, {
67
62
  forwardRef: useForkRef(enhancementRef, ref, forwardRef)
68
63
  }));
69
64
  }
70
- var BindingWrapper = /* @__PURE__ */ (function(_React$Component) {
71
- function BindingWrapper2() {
72
- var _this;
73
- _classCallCheck(this, BindingWrapper2);
74
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
75
- args[_key] = arguments[_key];
76
- }
77
- _this = _callSuper(this, BindingWrapper2, [].concat(args));
78
- _defineProperty(_this, "index", -1);
79
- return _this;
65
+ class BindingWrapper extends React.Component {
66
+ constructor(...args) {
67
+ super(...args);
68
+ _defineProperty(this, "index", -1);
80
69
  }
81
- _inherits(BindingWrapper2, _React$Component);
82
- return _createClass(BindingWrapper2, [{
83
- key: "render",
84
- value: function render() {
85
- var _this2 = this;
86
- return /* @__PURE__ */ React.createElement(WrapperForwardRef, _extends({}, this.props, {
87
- __WRAPPER_PROPS_BIND__: wrapperProps.map(function(fn) {
88
- return fn.bind(_this2);
89
- })
90
- }));
91
- }
92
- }]);
93
- })(React.Component);
94
- var WrapperComponent = /* @__PURE__ */ React.forwardRef(useGetterIndex ? WrapperForwardRefWithBind : WrapperForwardRef);
70
+ render() {
71
+ return /* @__PURE__ */ React.createElement(WrapperForwardRef, _extends({}, this.props, {
72
+ __WRAPPER_PROPS_BIND__: wrapperProps.map((fn) => fn.bind(this))
73
+ }));
74
+ }
75
+ }
76
+ const WrapperComponent = /* @__PURE__ */ React.forwardRef(useGetterIndex ? WrapperForwardRefWithBind : WrapperForwardRef);
95
77
  hoistNonReactStatics(WrapperComponent, Component2);
96
78
  WrapperComponent.displayName = Component2.displayName;
97
79
  WrapperComponent.defaultProps = Component2.defaultProps;
98
- statics.forEach(function(enhancement) {
99
- return Object.assign(WrapperComponent, enhancement(WrapperComponent, Component2, isFunction));
100
- });
80
+ statics.forEach((enhancement) => Object.assign(WrapperComponent, enhancement(WrapperComponent, Component2, isFunction)));
101
81
  return WrapperComponent;
102
82
  }
103
83
  function wrapClass(OriginComponent, enhancements, Context) {
104
- var getField = createGetField(enhancements, OriginComponent, false);
105
- var inits = getField("init");
106
- var props = getField("asProps");
107
- var renders = getField("render");
108
- var statics = getField("static");
109
- var wrapperProps = getField("wrapperProps");
110
- var contexts = getField("context");
111
- var Component2 = /* @__PURE__ */ (function(_OriginComponent2) {
112
- function Component3(props2, context) {
113
- var _this3;
114
- _classCallCheck(this, Component3);
115
- _this3 = _callSuper(this, Component3, [props2, context]);
116
- _defineProperty(_this3, CORE_AS_PROPS, null);
117
- _defineProperty(_this3, CORE_INSTANCE, WrapperComponent);
118
- _defineProperty(_this3, CORE_INIT, false);
119
- inits.forEach(function(enhancement) {
120
- return enhancement.call(_this3, props2, WrapperComponent, false);
121
- });
122
- _this3[CORE_INIT] = true;
123
- return _this3;
84
+ const getField = createGetField(enhancements, OriginComponent, false);
85
+ const inits = getField("init");
86
+ const props = getField("asProps");
87
+ const renders = getField("render");
88
+ const statics = getField("static");
89
+ const wrapperProps = getField("wrapperProps");
90
+ const contexts = getField("context");
91
+ class Component2 extends OriginComponent {
92
+ constructor(props2, context) {
93
+ super(props2, context);
94
+ _defineProperty(this, CORE_AS_PROPS, null);
95
+ _defineProperty(this, CORE_INSTANCE, WrapperComponent);
96
+ _defineProperty(this, CORE_INIT, false);
97
+ inits.forEach((enhancement) => enhancement.call(this, props2, WrapperComponent, false));
98
+ this[CORE_INIT] = true;
124
99
  }
125
- _inherits(Component3, _OriginComponent2);
126
- return _createClass(Component3, [{
127
- key: "asProps",
128
- get: function get() {
129
- var _this4 = this;
130
- if (!this[CORE_INIT]) {
131
- throw new Error("Can not call asProps in constructor");
132
- }
133
- if (!this[CORE_AS_PROPS]) {
134
- this[CORE_AS_PROPS] = props.reduce(function(acc, enhancement) {
135
- return enhancement.call(_this4, acc, WrapperComponent, false);
136
- }, this.props);
137
- if (this[CORE_AS_PROPS] !== null) {
138
- var prefixesMap = /* @__PURE__ */ new Map();
139
- Object.entries(this[CORE_AS_PROPS]).forEach(function(_ref3) {
140
- var _ref4 = _slicedToArray(_ref3, 2), key2 = _ref4[0], value2 = _ref4[1];
141
- var _key$split = key2.split(":"), _key$split2 = _slicedToArray(_key$split, 2), prefix = _key$split2[0], propertyKey = _key$split2[1];
142
- if (prefix !== "use" && propertyKey) {
143
- var _prefixesMap$get;
144
- var obj = (_prefixesMap$get = prefixesMap.get(prefix)) !== null && _prefixesMap$get !== void 0 ? _prefixesMap$get : {};
145
- obj[propertyKey] = value2;
146
- prefixesMap.set(prefix, obj);
147
- }
148
- });
149
- var _iterator = _createForOfIteratorHelper(prefixesMap.entries()), _step;
150
- try {
151
- for (_iterator.s(); !(_step = _iterator.n()).done; ) {
152
- var _step$value = _slicedToArray(_step.value, 2), key = _step$value[0], value = _step$value[1];
153
- Object.defineProperty(this[CORE_AS_PROPS], "".concat(key, "Props"), {
154
- value
155
- });
156
- }
157
- } catch (err) {
158
- _iterator.e(err);
159
- } finally {
160
- _iterator.f();
100
+ get asProps() {
101
+ if (!this[CORE_INIT]) {
102
+ throw new Error("Can not call asProps in constructor");
103
+ }
104
+ if (!this[CORE_AS_PROPS]) {
105
+ this[CORE_AS_PROPS] = props.reduce((acc, enhancement) => {
106
+ return enhancement.call(this, acc, WrapperComponent, false);
107
+ }, this.props);
108
+ if (this[CORE_AS_PROPS] !== null) {
109
+ const prefixesMap = /* @__PURE__ */ new Map();
110
+ Object.entries(this[CORE_AS_PROPS]).forEach(([key, value]) => {
111
+ const [prefix, propertyKey] = key.split(":");
112
+ if (prefix !== "use" && propertyKey) {
113
+ const obj = prefixesMap.get(prefix) ?? {};
114
+ obj[propertyKey] = value;
115
+ prefixesMap.set(prefix, obj);
161
116
  }
117
+ });
118
+ for (const [key, value] of prefixesMap.entries()) {
119
+ Object.defineProperty(this[CORE_AS_PROPS], `${key}Props`, {
120
+ value
121
+ });
162
122
  }
163
123
  }
164
- return this[CORE_AS_PROPS];
165
124
  }
166
- }, {
167
- key: "setContext",
168
- value: function setContext() {
169
- var _this5 = this;
170
- var contextProps = _superPropGet(Component3, "setContext", this, 1) ? _superPropGet(Component3, "setContext", this, 3)([]) : {};
171
- return contexts.reduce(function(acc, enhancement) {
172
- return enhancement.call(_this5, acc, WrapperComponent, false);
173
- }, contextProps);
125
+ return this[CORE_AS_PROPS];
126
+ }
127
+ setContext() {
128
+ const contextProps = super.setContext ? super.setContext() : {};
129
+ return contexts.reduce((acc, enhancement) => enhancement.call(this, acc, WrapperComponent, false), contextProps);
130
+ }
131
+ render() {
132
+ this[CORE_AS_PROPS] = null;
133
+ if (!super.render) {
134
+ throw new Error("Component `render` method is not defined");
174
135
  }
175
- }, {
176
- key: "render",
177
- value: function render() {
178
- var _this6 = this;
179
- this[CORE_AS_PROPS] = null;
180
- if (!_superPropGet(Component3, "render", this, 1)) {
181
- throw new Error("Component `render` method is not defined");
182
- }
183
- var asProps = this.asProps;
184
- var ctx = this.setContext();
185
- var render2 = renders.reduce(function(acc, enhancement) {
186
- return enhancement.call(_this6, acc, asProps, WrapperComponent, false);
187
- }, _superPropGet(Component3, "render", this, 3)([]));
188
- if (!WrapperComponent[STATIC_COMPONENT] && !isEmptyObject(ctx)) {
189
- return /* @__PURE__ */ React.createElement(Context.Provider, {
190
- value: _objectSpread(_objectSpread({}, asProps), ctx)
191
- }, render2);
192
- } else {
193
- return render2;
194
- }
136
+ const asProps = this.asProps;
137
+ const ctx = this.setContext();
138
+ const render = renders.reduce((acc, enhancement) => enhancement.call(this, acc, asProps, WrapperComponent, false), super.render());
139
+ if (!WrapperComponent[STATIC_COMPONENT] && !isEmptyObject(ctx)) {
140
+ return /* @__PURE__ */ React.createElement(Context.Provider, {
141
+ value: {
142
+ ...asProps,
143
+ ...ctx
144
+ }
145
+ }, render);
146
+ } else {
147
+ return render;
195
148
  }
196
- }]);
197
- })(OriginComponent);
198
- var WrapperComponent = createForwardWrapper(Component2, wrapperProps, statics, false);
149
+ }
150
+ }
151
+ const WrapperComponent = createForwardWrapper(Component2, wrapperProps, statics, false);
199
152
  return WrapperComponent;
200
153
  }
201
154
  function wrapFunction(OriginComponent, enhancements, Context) {
202
- var getField = createGetField(enhancements, OriginComponent, true);
203
- var inits = getField("init");
204
- var props = getField("asProps");
205
- var renders = getField("render");
206
- var statics = getField("static");
207
- var wrapperProps = getField("wrapperProps");
208
- var contexts = getField("context");
209
- var Component2 = /* @__PURE__ */ React.memo(function FunctionMemoComponent(other) {
210
- var selfRef = React.useRef({});
211
- var firstRender = React.useRef(true);
212
- useEnhancedEffect(function() {
155
+ const getField = createGetField(enhancements, OriginComponent, true);
156
+ const inits = getField("init");
157
+ const props = getField("asProps");
158
+ const renders = getField("render");
159
+ const statics = getField("static");
160
+ const wrapperProps = getField("wrapperProps");
161
+ const contexts = getField("context");
162
+ const Component2 = /* @__PURE__ */ React.memo(function FunctionMemoComponent(other) {
163
+ const selfRef = React.useRef({});
164
+ const firstRender = React.useRef(true);
165
+ useEnhancedEffect(() => {
213
166
  firstRender.current = false;
214
167
  }, []);
215
168
  if (firstRender.current) {
216
- inits.forEach(function(enhancement) {
217
- return enhancement.call(selfRef.current, other, WrapperComponent, true);
218
- });
169
+ inits.forEach((enhancement) => enhancement.call(selfRef.current, other, WrapperComponent, true));
219
170
  }
220
- var asProps = props.reduce(function(acc, enhancement) {
221
- return enhancement.call(selfRef.current, acc, WrapperComponent, true);
222
- }, other);
223
- var ctx = contexts.reduce(function(acc, enhancement) {
224
- return enhancement.call(selfRef.current, acc, WrapperComponent, true);
225
- }, {});
226
- var render = renders.reduce(function(acc, enhancement) {
227
- return enhancement.call(selfRef.current, acc, asProps, WrapperComponent, true);
228
- }, /* @__PURE__ */ React.createElement(OriginComponent, asProps));
171
+ const asProps = props.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, WrapperComponent, true), other);
172
+ const ctx = contexts.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, WrapperComponent, true), {});
173
+ const render = renders.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, asProps, WrapperComponent, true), /* @__PURE__ */ React.createElement(OriginComponent, asProps));
229
174
  if (!WrapperComponent[STATIC_COMPONENT] && !isEmptyObject(ctx)) {
230
175
  return /* @__PURE__ */ React.createElement(Context.Provider, {
231
- value: _objectSpread(_objectSpread({}, asProps), ctx)
176
+ value: {
177
+ ...asProps,
178
+ ...ctx
179
+ }
232
180
  }, render);
233
181
  } else {
234
182
  return render;
235
183
  }
236
184
  });
237
185
  Object.assign(Component2, OriginComponent);
238
- var WrapperComponent = createForwardWrapper(Component2, wrapperProps, statics, true);
186
+ const WrapperComponent = createForwardWrapper(Component2, wrapperProps, statics, true);
239
187
  return WrapperComponent;
240
188
  }
241
189
  function wrapCore(OriginComponent, enhancements, Context) {
242
- var Component2 = function Component3(_ref5) {
243
- var Root = _ref5.Root;
244
- var defaultProps = OriginComponent.defaultProps || {};
190
+ const Component2 = function({
191
+ Root
192
+ }) {
193
+ const defaultProps = OriginComponent.defaultProps || {};
245
194
  return /* @__PURE__ */ React.createElement(Root, _extends({}, defaultProps, {
246
195
  render: OriginComponent
247
196
  }));
@@ -268,15 +217,17 @@ function createComposeComponent(OriginComponent, Context, enhancements) {
268
217
  function assignProps(p1, p2) {
269
218
  return assignProps$1(p2, p1);
270
219
  }
271
- function createComponent(OriginComponent) {
272
- var childComponents = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
273
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
274
- var _options$context = options.context, context = _options$context === void 0 ? /* @__PURE__ */ React.createContext({}) : _options$context, _options$parent = options.parent, parent = _options$parent === void 0 ? [] : _options$parent, _options$enhancements = options.enhancements, enhancements = _options$enhancements === void 0 ? [] : _options$enhancements;
275
- var parents = Array.isArray(parent) ? parent : [parent];
220
+ function createComponent(OriginComponent, childComponents = {}, options = {}) {
221
+ const {
222
+ context = /* @__PURE__ */ React.createContext({}),
223
+ parent = [],
224
+ enhancements = []
225
+ } = options;
226
+ let parents = Array.isArray(parent) ? parent : [parent];
276
227
  if (parents.length) {
277
- var wholeFamily = parents.reduce(function(acc, parent2) {
228
+ const wholeFamily = parents.reduce((acc, parent2) => {
278
229
  if (parent2[PARENT_COMPONENTS]) {
279
- acc = [].concat(_toConsumableArray(parent2[PARENT_COMPONENTS]), _toConsumableArray(acc));
230
+ acc = [...parent2[PARENT_COMPONENTS], ...acc];
280
231
  }
281
232
  return acc;
282
233
  }, parents);
@@ -286,9 +237,9 @@ function createComponent(OriginComponent) {
286
237
  if (OriginComponent[CORE_COMPONENT]) {
287
238
  parents.push(OriginComponent);
288
239
  }
289
- var Component2 = createComposeComponent(OriginComponent, context, [].concat(_toConsumableArray(enhancements.map(function(f) {
290
- return f(context, parents, createComponent, childComponents);
291
- })), [
240
+ const Component2 = createComposeComponent(OriginComponent, context, [
241
+ // @ts-ignore
242
+ ...enhancements.map((f) => f(context, parents, createComponent, childComponents)),
292
243
  i18nAppLocaleEnhance(),
293
244
  Enhancement(context, parents),
294
245
  // root must be under the children
@@ -308,28 +259,21 @@ function createComponent(OriginComponent) {
308
259
  // enhanceEnhancement must be under the functionDefaultPropsEnhancement
309
260
  Enhancement$7(),
310
261
  Enhancement$8(childComponents, context)
311
- ]));
262
+ ]);
312
263
  Component2[CONTEXT_COMPONENT] = context;
313
264
  Component2._______childrenComponents = childComponents;
314
- Component2[CREATE_COMPONENT] = function() {
315
- var _OriginComponent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : OriginComponent;
316
- var _childComponents = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : childComponents;
317
- var _options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : options;
265
+ Component2[CREATE_COMPONENT] = function(_OriginComponent = OriginComponent, _childComponents = childComponents, _options = options) {
318
266
  return createComponent(_OriginComponent, _childComponents, _options);
319
267
  };
320
- Component2.newInstance = function() {
321
- var _OriginComponent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : OriginComponent;
322
- var _childComponents = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : childComponents;
323
- var _options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : options;
268
+ Component2.newInstance = function(_OriginComponent = OriginComponent, _childComponents = childComponents, _options = options) {
324
269
  return createComponent(_OriginComponent, _childComponents, _options);
325
270
  };
326
271
  Component2[CORE_COMPONENT] = true;
327
272
  return Component2;
328
273
  }
329
274
  function createBaseComponent(OriginComponent) {
330
- var _OriginComponent$disp;
331
- var Component2 = /* @__PURE__ */ React.forwardRef(OriginComponent);
332
- Component2.displayName = (_OriginComponent$disp = OriginComponent.displayName) !== null && _OriginComponent$disp !== void 0 ? _OriginComponent$disp : "";
275
+ const Component2 = /* @__PURE__ */ React.forwardRef(OriginComponent);
276
+ Component2.displayName = OriginComponent.displayName ?? "";
333
277
  Component2.defaultProps = {
334
278
  "data-ui-name": OriginComponent.displayName
335
279
  };
@@ -1,15 +1,9 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
1
  import React from "react";
6
2
  import { CHILDREN_COMPONENT, CONTEXT_COMPONENT } from "../core-types/symbols.mjs";
7
- var _excluded = ["handlers", "getters"], _excluded2 = ["handlers"];
8
- var CHILDREN_SELF = /* @__PURE__ */ Symbol("CHILDREN_SELF");
9
- var GETTER_REG = /^get[\w]+Props$/;
3
+ const CHILDREN_SELF = /* @__PURE__ */ Symbol("CHILDREN_SELF");
4
+ const GETTER_REG = /^get[\w]+Props$/;
10
5
  function splitPropsAndGetters(props) {
11
- return Object.entries(props).reduce(function(acc, _ref) {
12
- var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
6
+ return Object.entries(props).reduce((acc, [key, value]) => {
13
7
  if (GETTER_REG.exec(key) === null) {
14
8
  acc.props[key] = value;
15
9
  } else {
@@ -27,67 +21,79 @@ function getterToArray(getter) {
27
21
  }
28
22
  return getter;
29
23
  }
30
- function mergeObjects() {
31
- var a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
32
- var b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
33
- var core = _objectSpread(_objectSpread({}, a), b);
34
- return Object.keys(core).reduce(function(acc, key) {
24
+ function mergeObjects(a = {}, b = {}) {
25
+ const core = {
26
+ ...a,
27
+ ...b
28
+ };
29
+ return Object.keys(core).reduce((acc, key) => {
35
30
  a[key] = getterToArray(a[key]);
36
31
  b[key] = getterToArray(b[key]);
37
- acc[key] = [].concat(_toConsumableArray(a[key]), _toConsumableArray(b[key]));
32
+ acc[key] = [...a[key], ...b[key]];
38
33
  return acc;
39
34
  }, {});
40
35
  }
41
36
  function assignGettersChain(getters) {
42
- return function() {
43
- var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
44
- return getters.reduce(function(acc, getter) {
37
+ return function(props = {}) {
38
+ return getters.reduce((acc, getter) => {
45
39
  return getter(acc);
46
40
  }, props);
47
41
  };
48
42
  }
49
43
  function createChildren(Context, contexts) {
50
- var _Children = function Children() {
51
- var children = _Children.origin;
44
+ const Children = function() {
45
+ const children = Children.origin;
52
46
  if (typeof children === "function") {
53
- var _reduce = [].concat(_toConsumableArray(contexts), [Context]).reduce(function(acc, ctx) {
54
- var _ref3 = React.useContext(ctx), handlers2 = _ref3.handlers, propsAndGetters = _objectWithoutProperties(_ref3, _excluded2);
55
- var _splitPropsAndGetters = splitPropsAndGetters(propsAndGetters), props2 = _splitPropsAndGetters.props, getters2 = _splitPropsAndGetters.getters;
56
- return Object.assign({}, acc, _objectSpread({
47
+ const {
48
+ handlers = {},
49
+ getters = {},
50
+ ...props
51
+ } = [...contexts, Context].reduce((acc, ctx) => {
52
+ const {
53
+ handlers: handlers2,
54
+ ...propsAndGetters
55
+ } = React.useContext(ctx);
56
+ const {
57
+ props: props2,
58
+ getters: getters2
59
+ } = splitPropsAndGetters(propsAndGetters);
60
+ return Object.assign({}, acc, {
57
61
  handlers: Object.assign({}, acc.handlers, handlers2),
58
- getters: mergeObjects(acc.getters, getters2)
59
- }, props2));
60
- }, _Children.props), _reduce$handlers = _reduce.handlers, handlers = _reduce$handlers === void 0 ? {} : _reduce$handlers, _reduce$getters = _reduce.getters, getters = _reduce$getters === void 0 ? {} : _reduce$getters, props = _objectWithoutProperties(_reduce, _excluded);
61
- var mergedGetters = Object.entries(getters).reduce(function(acc, _ref4) {
62
- var _ref5 = _slicedToArray(_ref4, 2), key = _ref5[0], value = _ref5[1];
62
+ getters: mergeObjects(acc.getters, getters2),
63
+ ...props2
64
+ });
65
+ }, Children.props);
66
+ const mergedGetters = Object.entries(getters).reduce((acc, [key, value]) => {
63
67
  acc[key] = assignGettersChain(value);
64
68
  return acc;
65
69
  }, {});
66
- return children(_objectSpread(_objectSpread({}, props), mergedGetters), handlers);
70
+ return children({
71
+ ...props,
72
+ ...mergedGetters
73
+ }, handlers);
67
74
  } else if (children === void 0) {
68
75
  return null;
69
76
  }
70
77
  return children;
71
78
  };
72
- _Children.origin = null;
73
- _Children.props = {};
74
- _Children[CHILDREN_COMPONENT] = true;
75
- return _Children;
79
+ Children.origin = null;
80
+ Children.props = {};
81
+ Children[CHILDREN_COMPONENT] = true;
82
+ return Children;
76
83
  }
77
84
  function Enhancement(Context, parent) {
78
85
  return {
79
- init: function init() {
80
- var contexts = (Array.isArray(parent) ? parent : [parent]).map(function(component) {
81
- return component[CONTEXT_COMPONENT];
82
- }).filter(Boolean);
86
+ init: function() {
87
+ const contexts = (Array.isArray(parent) ? parent : [parent]).map((component) => component[CONTEXT_COMPONENT]).filter(Boolean);
83
88
  this[CHILDREN_SELF] = createChildren(Context, contexts);
84
89
  },
85
- asProps: function asProps(props) {
90
+ asProps: function(props) {
86
91
  this[CHILDREN_SELF].origin = props.children;
87
92
  this[CHILDREN_SELF].props = props;
88
- return _objectSpread(_objectSpread({}, props), {}, {
93
+ return {
94
+ ...props,
89
95
  Children: this[CHILDREN_SELF]
90
- });
96
+ };
91
97
  }
92
98
  };
93
99
  }
@@ -1,28 +1,37 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
1
  import React from "react";
5
2
  import assignProps from "../utils/assignProps.mjs";
6
3
  import { useForkRef } from "../utils/ref.mjs";
7
- var _excluded = ["render"], _excluded2 = ["Root", "styles", "children", "Children", "forwardRef"];
8
4
  function createRootRender() {
9
- var Root = /* @__PURE__ */ React.forwardRef(function(_ref, ref) {
10
- var Tag = _ref.render, source = _objectWithoutProperties(_ref, _excluded);
11
- var _Root$props = Root.props, _Root = _Root$props.Root, _styles = _Root$props.styles, _children = _Root$props.children, Children = _Root$props.Children, _Root$props$forwardRe = _Root$props.forwardRef, forwardRef = _Root$props$forwardRe === void 0 ? null : _Root$props$forwardRe, props = _objectWithoutProperties(_Root$props, _excluded2);
12
- var clearProps = Object.entries(props).reduce(function(props2, _ref2) {
13
- var _ref3 = _slicedToArray(_ref2, 2), name = _ref3[0], value = _ref3[1];
5
+ const Root = /* @__PURE__ */ React.forwardRef(function({
6
+ render: Tag,
7
+ ...source
8
+ }, ref) {
9
+ const {
10
+ Root: _Root,
11
+ styles: _styles,
12
+ children: _children,
13
+ Children,
14
+ forwardRef = null,
15
+ ...props
16
+ // @ts-ignore
17
+ } = Root.props;
18
+ const clearProps = Object.entries(props).reduce((props2, [name, value]) => {
14
19
  if (value !== void 0) {
15
20
  props2[name] = value;
16
21
  }
17
22
  return props2;
18
23
  }, {});
19
- var child = {};
24
+ const child = {};
20
25
  if (typeof Children.origin !== "undefined") {
21
26
  child.children = /* @__PURE__ */ React.createElement(Children, null);
22
27
  }
23
- var other = assignProps(_objectSpread(_objectSpread({}, clearProps), {}, {
28
+ const other = assignProps({
29
+ ...clearProps,
24
30
  ref: useForkRef(forwardRef, ref)
25
- }), _objectSpread(_objectSpread({}, child), source));
31
+ }, {
32
+ ...child,
33
+ ...source
34
+ });
26
35
  if (!Tag) {
27
36
  throw new Error("`render` prop of Root is not provided");
28
37
  }
@@ -34,20 +43,21 @@ function createRootRender() {
34
43
  }
35
44
  function Enhancement() {
36
45
  return {
37
- init: function init() {
46
+ init: function() {
38
47
  this.Root = createRootRender();
39
48
  },
40
- asProps: function asProps(props, _WrapperComponent, isFunction) {
49
+ asProps: function(props, _WrapperComponent, isFunction) {
41
50
  if (isFunction) {
42
- return _objectSpread(_objectSpread({}, props), {}, {
51
+ return {
52
+ ...props,
43
53
  Root: this.Root
44
- });
54
+ };
45
55
  }
46
56
  return props;
47
57
  },
48
- render: function render(_render, props) {
58
+ render: function(render, props) {
49
59
  this.Root.props = props;
50
- return _render;
60
+ return render;
51
61
  }
52
62
  };
53
63
  }
@@ -1,10 +1,10 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  function Enhancement() {
3
2
  return {
4
- wrapperProps: function wrapperProps(props, WrapperComponent) {
5
- return _objectSpread({
6
- "data-ui-name": WrapperComponent.displayName
7
- }, props);
3
+ wrapperProps: function(props, WrapperComponent) {
4
+ return {
5
+ "data-ui-name": WrapperComponent.displayName,
6
+ ...props
7
+ };
8
8
  }
9
9
  };
10
10
  }