@semcore/core 2.39.4 → 16.0.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 (543) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/lib/LastInteractionType.d.ts +11 -0
  4. package/lib/LastInteractionType.js +57 -0
  5. package/lib/LastInteractionType.js.map +1 -0
  6. package/lib/LastInteractionType.mjs +51 -0
  7. package/lib/LastInteractionType.mjs.map +1 -0
  8. package/lib/core-types/Component.d.ts +189 -0
  9. package/lib/core-types/Component.js +59 -0
  10. package/lib/core-types/Component.js.map +1 -0
  11. package/lib/core-types/Component.mjs +51 -0
  12. package/lib/core-types/Component.mjs.map +1 -0
  13. package/lib/core-types/UnknownProperties.d.ts +3 -0
  14. package/lib/core-types/UnknownProperties.js +2 -0
  15. package/lib/core-types/UnknownProperties.js.map +1 -0
  16. package/lib/core-types/UnknownProperties.mjs +2 -0
  17. package/lib/core-types/UnknownProperties.mjs.map +1 -0
  18. package/lib/core-types/reshadow.d.js +2 -0
  19. package/lib/core-types/reshadow.d.js.map +1 -0
  20. package/lib/core-types/reshadow.d.mjs +2 -0
  21. package/lib/core-types/reshadow.d.mjs.map +1 -0
  22. package/lib/core-types/symbols.d.ts +9 -0
  23. package/lib/core-types/symbols.js +25 -0
  24. package/lib/core-types/symbols.js.map +1 -0
  25. package/lib/core-types/symbols.mjs +20 -0
  26. package/lib/core-types/symbols.mjs.map +1 -0
  27. package/lib/coreFactory.d.ts +27 -0
  28. package/lib/coreFactory.js +352 -0
  29. package/lib/coreFactory.js.map +1 -0
  30. package/lib/coreFactory.mjs +324 -0
  31. package/lib/coreFactory.mjs.map +1 -0
  32. package/lib/enhancement/Children.d.ts +5 -0
  33. package/lib/enhancement/Children.js +119 -0
  34. package/lib/enhancement/Children.js.map +1 -0
  35. package/lib/enhancement/Children.mjs +96 -0
  36. package/lib/enhancement/Children.mjs.map +1 -0
  37. package/lib/enhancement/Root.d.ts +6 -0
  38. package/lib/enhancement/Root.js +78 -0
  39. package/lib/enhancement/Root.js.map +1 -0
  40. package/lib/enhancement/Root.mjs +56 -0
  41. package/lib/enhancement/Root.mjs.map +1 -0
  42. package/lib/enhancement/bindHandler.d.ts +5 -0
  43. package/lib/enhancement/bindHandler.js +54 -0
  44. package/lib/enhancement/bindHandler.js.map +1 -0
  45. package/lib/enhancement/bindHandler.mjs +48 -0
  46. package/lib/enhancement/bindHandler.mjs.map +1 -0
  47. package/lib/enhancement/dataName.d.ts +4 -0
  48. package/lib/enhancement/dataName.js +20 -0
  49. package/lib/enhancement/dataName.js.map +1 -0
  50. package/lib/enhancement/dataName.mjs +13 -0
  51. package/lib/enhancement/dataName.mjs.map +1 -0
  52. package/lib/enhancement/enhance.d.ts +5 -0
  53. package/lib/enhancement/enhance.js +22 -0
  54. package/lib/enhancement/enhance.js.map +1 -0
  55. package/lib/enhancement/enhance.mjs +16 -0
  56. package/lib/enhancement/enhance.mjs.map +1 -0
  57. package/lib/enhancement/functionDefaultProps.d.ts +8 -0
  58. package/lib/enhancement/functionDefaultProps.js +36 -0
  59. package/lib/enhancement/functionDefaultProps.js.map +1 -0
  60. package/lib/enhancement/functionDefaultProps.mjs +29 -0
  61. package/lib/enhancement/functionDefaultProps.mjs.map +1 -0
  62. package/lib/enhancement/hoistProps.d.ts +10 -0
  63. package/lib/enhancement/hoistProps.js +97 -0
  64. package/lib/enhancement/hoistProps.js.map +1 -0
  65. package/lib/enhancement/hoistProps.mjs +78 -0
  66. package/lib/enhancement/hoistProps.mjs.map +1 -0
  67. package/lib/enhancement/i18n.d.ts +4 -0
  68. package/lib/enhancement/i18n.js +28 -0
  69. package/lib/enhancement/i18n.js.map +1 -0
  70. package/lib/enhancement/i18n.mjs +20 -0
  71. package/lib/enhancement/i18n.mjs.map +1 -0
  72. package/lib/enhancement/inheritedName.d.ts +8 -0
  73. package/lib/enhancement/inheritedName.js +23 -0
  74. package/lib/enhancement/inheritedName.js.map +1 -0
  75. package/lib/enhancement/inheritedName.mjs +16 -0
  76. package/lib/enhancement/inheritedName.mjs.map +1 -0
  77. package/lib/enhancement/staticChildren.d.ts +13 -0
  78. package/lib/enhancement/staticChildren.js +135 -0
  79. package/lib/enhancement/staticChildren.js.map +1 -0
  80. package/lib/enhancement/staticChildren.mjs +120 -0
  81. package/lib/enhancement/staticChildren.mjs.map +1 -0
  82. package/lib/enhancement/style.d.ts +9 -0
  83. package/lib/enhancement/style.js +60 -0
  84. package/lib/enhancement/style.js.map +1 -0
  85. package/lib/enhancement/style.mjs +49 -0
  86. package/lib/enhancement/style.mjs.map +1 -0
  87. package/lib/enhancement/uncontrolledProps.d.ts +7 -0
  88. package/lib/enhancement/uncontrolledProps.js +131 -0
  89. package/lib/enhancement/uncontrolledProps.js.map +1 -0
  90. package/lib/enhancement/uncontrolledProps.mjs +107 -0
  91. package/lib/enhancement/uncontrolledProps.mjs.map +1 -0
  92. package/lib/esm/LastInteractionType.mjs +51 -0
  93. package/lib/esm/core-types/Component.mjs +51 -0
  94. package/lib/esm/core-types/symbols.mjs +20 -0
  95. package/lib/esm/coreFactory.mjs +324 -0
  96. package/lib/esm/enhancement/Children.mjs +96 -0
  97. package/lib/esm/enhancement/Root.mjs +56 -0
  98. package/lib/esm/enhancement/bindHandler.mjs +48 -0
  99. package/lib/esm/enhancement/dataName.mjs +13 -0
  100. package/lib/esm/enhancement/enhance.mjs +16 -0
  101. package/lib/esm/enhancement/functionDefaultProps.mjs +29 -0
  102. package/lib/esm/enhancement/hoistProps.mjs +78 -0
  103. package/lib/esm/enhancement/i18n.mjs +20 -0
  104. package/lib/esm/enhancement/inheritedName.mjs +16 -0
  105. package/lib/esm/enhancement/staticChildren.mjs +120 -0
  106. package/lib/esm/enhancement/style.mjs +49 -0
  107. package/lib/esm/enhancement/uncontrolledProps.mjs +107 -0
  108. package/lib/esm/index.mjs +22 -4
  109. package/lib/esm/register.mjs +31 -0
  110. package/lib/esm/styled/index.mjs +8 -0
  111. package/lib/esm/styled/reshadow-core.mjs +234 -0
  112. package/lib/esm/styled/sstyled.mjs +121 -0
  113. package/lib/esm/utils/assignProps.mjs +86 -0
  114. package/lib/esm/utils/canUseDOM.mjs +6 -0
  115. package/lib/esm/utils/capitalizeFirstLetter.mjs +6 -0
  116. package/lib/esm/utils/createHoc.mjs +44 -0
  117. package/lib/esm/utils/enhances/WithI18n.mjs +78 -0
  118. package/lib/esm/utils/enhances/i18nEnhance.mjs +91 -0
  119. package/lib/esm/utils/getDisplayName.mjs +6 -0
  120. package/lib/esm/utils/logger.mjs +35 -0
  121. package/lib/esm/utils/pick.mjs +15 -0
  122. package/lib/esm/utils/ref.mjs +87 -0
  123. package/lib/esm/utils/use/useEnhancedEffect.mjs +6 -0
  124. package/lib/index.d.ts +11 -0
  125. package/lib/index.js +103 -0
  126. package/lib/index.js.map +1 -0
  127. package/lib/index.mjs +24 -0
  128. package/lib/index.mjs.map +1 -0
  129. package/lib/register.d.ts +8 -0
  130. package/lib/register.js +37 -0
  131. package/lib/register.js.map +1 -0
  132. package/lib/register.mjs +31 -0
  133. package/lib/register.mjs.map +1 -0
  134. package/lib/styled/index.d.ts +11 -0
  135. package/lib/styled/index.js +32 -0
  136. package/lib/styled/index.js.map +1 -0
  137. package/lib/styled/index.mjs +8 -0
  138. package/lib/styled/index.mjs.map +1 -0
  139. package/lib/styled/reshadow-core.d.ts +37 -0
  140. package/lib/styled/reshadow-core.js +256 -0
  141. package/lib/styled/reshadow-core.js.map +1 -0
  142. package/lib/styled/reshadow-core.mjs +234 -0
  143. package/lib/styled/reshadow-core.mjs.map +1 -0
  144. package/lib/styled/sstyled.d.ts +17 -0
  145. package/lib/styled/sstyled.js +149 -0
  146. package/lib/styled/sstyled.js.map +1 -0
  147. package/lib/styled/sstyled.mjs +121 -0
  148. package/lib/styled/sstyled.mjs.map +1 -0
  149. package/lib/theme/dark.json +2506 -0
  150. package/lib/theme/exclude-tokens.json +10 -0
  151. package/lib/theme/light.json +2584 -0
  152. package/lib/theme/processor.d.ts +1 -0
  153. package/lib/theme/processor.js +315 -0
  154. package/lib/theme/processor.js.map +1 -0
  155. package/lib/theme/processor.mjs +307 -0
  156. package/lib/theme/processor.mjs.map +1 -0
  157. package/lib/theme/themes/auto.css +1465 -0
  158. package/lib/theme/themes/dark.css +723 -0
  159. package/lib/theme/themes/dark.d.ts +378 -0
  160. package/lib/theme/themes/dark.js +385 -0
  161. package/lib/theme/themes/dark.js.map +1 -0
  162. package/lib/theme/themes/dark.mjs +378 -0
  163. package/lib/theme/themes/dark.mjs.map +1 -0
  164. package/lib/theme/themes/default.css +742 -0
  165. package/lib/theme/themes/default.d.ts +387 -0
  166. package/lib/theme/themes/default.js +394 -0
  167. package/lib/theme/themes/default.js.map +1 -0
  168. package/lib/theme/themes/default.mjs +387 -0
  169. package/lib/theme/themes/default.mjs.map +1 -0
  170. package/lib/theme/themes/light.css +742 -0
  171. package/lib/theme/themes/light.d.ts +387 -0
  172. package/lib/theme/themes/light.js +394 -0
  173. package/lib/theme/themes/light.js.map +1 -0
  174. package/lib/theme/themes/light.mjs +387 -0
  175. package/lib/theme/themes/light.mjs.map +1 -0
  176. package/lib/theme/utils.d.ts +52 -0
  177. package/lib/theme/utils.js +297 -0
  178. package/lib/theme/utils.js.map +1 -0
  179. package/lib/theme/utils.mjs +286 -0
  180. package/lib/theme/utils.mjs.map +1 -0
  181. package/lib/utils/CSSinJS.d.ts +5 -0
  182. package/lib/utils/CSSinJS.js +36 -0
  183. package/lib/utils/CSSinJS.js.map +1 -0
  184. package/lib/utils/CSSinJS.mjs +28 -0
  185. package/lib/utils/CSSinJS.mjs.map +1 -0
  186. package/lib/utils/ScreenReaderOnly.d.ts +8 -0
  187. package/lib/utils/ScreenReaderOnly.js +31 -0
  188. package/lib/utils/ScreenReaderOnly.js.map +1 -0
  189. package/lib/utils/ScreenReaderOnly.mjs +24 -0
  190. package/lib/utils/ScreenReaderOnly.mjs.map +1 -0
  191. package/lib/utils/ThemeProvider.d.ts +15 -0
  192. package/lib/utils/ThemeProvider.js +82 -0
  193. package/lib/utils/ThemeProvider.js.map +1 -0
  194. package/lib/utils/ThemeProvider.mjs +71 -0
  195. package/lib/utils/ThemeProvider.mjs.map +1 -0
  196. package/lib/utils/addonText.d.ts +2 -0
  197. package/lib/utils/addonText.js +18 -0
  198. package/lib/utils/addonText.js.map +1 -0
  199. package/lib/utils/addonText.mjs +11 -0
  200. package/lib/utils/addonText.mjs.map +1 -0
  201. package/lib/utils/addonTextChildren.d.ts +3 -0
  202. package/lib/utils/addonTextChildren.js +45 -0
  203. package/lib/utils/addonTextChildren.js.map +1 -0
  204. package/lib/utils/addonTextChildren.mjs +37 -0
  205. package/lib/utils/addonTextChildren.mjs.map +1 -0
  206. package/lib/utils/ariaProps.d.ts +12 -0
  207. package/lib/utils/ariaProps.js +22 -0
  208. package/lib/utils/ariaProps.js.map +1 -0
  209. package/lib/utils/ariaProps.mjs +16 -0
  210. package/lib/utils/ariaProps.mjs.map +1 -0
  211. package/lib/utils/assignProps.d.ts +11 -0
  212. package/lib/utils/assignProps.js +93 -0
  213. package/lib/utils/assignProps.js.map +1 -0
  214. package/lib/utils/assignProps.mjs +86 -0
  215. package/lib/utils/assignProps.mjs.map +1 -0
  216. package/lib/utils/canUseDOM.d.ts +1 -0
  217. package/lib/utils/canUseDOM.js +10 -0
  218. package/lib/utils/canUseDOM.js.map +1 -0
  219. package/lib/utils/canUseDOM.mjs +6 -0
  220. package/lib/utils/canUseDOM.mjs.map +1 -0
  221. package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
  222. package/lib/utils/capitalizeFirstLetter.js +10 -0
  223. package/lib/utils/capitalizeFirstLetter.js.map +1 -0
  224. package/lib/utils/capitalizeFirstLetter.mjs +6 -0
  225. package/lib/utils/capitalizeFirstLetter.mjs.map +1 -0
  226. package/lib/utils/color.d.ts +5 -0
  227. package/lib/utils/color.js +208 -0
  228. package/lib/utils/color.js.map +1 -0
  229. package/lib/utils/color.mjs +196 -0
  230. package/lib/utils/color.mjs.map +1 -0
  231. package/lib/utils/compose.d.ts +1 -0
  232. package/lib/utils/compose.js +21 -0
  233. package/lib/utils/compose.js.map +1 -0
  234. package/lib/utils/compose.mjs +15 -0
  235. package/lib/utils/compose.mjs.map +1 -0
  236. package/lib/utils/createHoc.d.ts +3 -0
  237. package/lib/utils/createHoc.js +55 -0
  238. package/lib/utils/createHoc.js.map +1 -0
  239. package/lib/utils/createHoc.mjs +44 -0
  240. package/lib/utils/createHoc.mjs.map +1 -0
  241. package/lib/utils/createUUID.d.ts +1 -0
  242. package/lib/utils/createUUID.js +15 -0
  243. package/lib/utils/createUUID.js.map +1 -0
  244. package/lib/utils/createUUID.mjs +9 -0
  245. package/lib/utils/createUUID.mjs.map +1 -0
  246. package/lib/utils/cssToIntDefault.d.ts +8 -0
  247. package/lib/utils/cssToIntDefault.js +22 -0
  248. package/lib/utils/cssToIntDefault.js.map +1 -0
  249. package/lib/utils/cssToIntDefault.mjs +16 -0
  250. package/lib/utils/cssToIntDefault.mjs.map +1 -0
  251. package/lib/utils/enhances/WithAutoFocus.d.ts +14 -0
  252. package/lib/utils/enhances/WithAutoFocus.js +75 -0
  253. package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
  254. package/lib/utils/enhances/WithAutoFocus.mjs +67 -0
  255. package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -0
  256. package/lib/utils/enhances/WithCSS.d.ts +41 -0
  257. package/lib/utils/enhances/WithCSS.js +93 -0
  258. package/lib/utils/enhances/WithCSS.js.map +1 -0
  259. package/lib/utils/enhances/WithCSS.mjs +79 -0
  260. package/lib/utils/enhances/WithCSS.mjs.map +1 -0
  261. package/lib/utils/enhances/WithI18n.d.ts +43 -0
  262. package/lib/utils/enhances/WithI18n.js +95 -0
  263. package/lib/utils/enhances/WithI18n.js.map +1 -0
  264. package/lib/utils/enhances/WithI18n.mjs +78 -0
  265. package/lib/utils/enhances/WithI18n.mjs.map +1 -0
  266. package/lib/utils/enhances/WithKeyboardFocus.d.ts +45 -0
  267. package/lib/utils/enhances/WithKeyboardFocus.js +93 -0
  268. package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
  269. package/lib/utils/enhances/WithKeyboardFocus.mjs +84 -0
  270. package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -0
  271. package/lib/utils/enhances/WithRef.d.ts +3 -0
  272. package/lib/utils/enhances/WithRef.js +26 -0
  273. package/lib/utils/enhances/WithRef.js.map +1 -0
  274. package/lib/utils/enhances/WithRef.mjs +18 -0
  275. package/lib/utils/enhances/WithRef.mjs.map +1 -0
  276. package/lib/utils/enhances/a11yEnhance.d.ts +10 -0
  277. package/lib/utils/enhances/a11yEnhance.js +74 -0
  278. package/lib/utils/enhances/a11yEnhance.js.map +1 -0
  279. package/lib/utils/enhances/a11yEnhance.mjs +66 -0
  280. package/lib/utils/enhances/a11yEnhance.mjs.map +1 -0
  281. package/lib/utils/enhances/animatedSizeEnhance.d.ts +12 -0
  282. package/lib/utils/enhances/animatedSizeEnhance.js +98 -0
  283. package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
  284. package/lib/utils/enhances/animatedSizeEnhance.mjs +90 -0
  285. package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -0
  286. package/lib/utils/enhances/autoFocusEnhance.d.ts +10 -0
  287. package/lib/utils/enhances/autoFocusEnhance.js +46 -0
  288. package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
  289. package/lib/utils/enhances/autoFocusEnhance.mjs +38 -0
  290. package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -0
  291. package/lib/utils/enhances/contextEnhance.d.ts +3 -0
  292. package/lib/utils/enhances/contextEnhance.js +22 -0
  293. package/lib/utils/enhances/contextEnhance.js.map +1 -0
  294. package/lib/utils/enhances/contextEnhance.mjs +14 -0
  295. package/lib/utils/enhances/contextEnhance.mjs.map +1 -0
  296. package/lib/utils/enhances/i18nEnhance.d.ts +25 -0
  297. package/lib/utils/enhances/i18nEnhance.js +101 -0
  298. package/lib/utils/enhances/i18nEnhance.js.map +1 -0
  299. package/lib/utils/enhances/i18nEnhance.mjs +91 -0
  300. package/lib/utils/enhances/i18nEnhance.mjs.map +1 -0
  301. package/lib/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
  302. package/lib/utils/enhances/keyboardFocusEnhance.js +63 -0
  303. package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
  304. package/lib/utils/enhances/keyboardFocusEnhance.mjs +57 -0
  305. package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -0
  306. package/lib/utils/enhances/resolveColorEnhance.d.ts +2 -0
  307. package/lib/utils/enhances/resolveColorEnhance.js +25 -0
  308. package/lib/utils/enhances/resolveColorEnhance.js.map +1 -0
  309. package/lib/utils/enhances/resolveColorEnhance.mjs +17 -0
  310. package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -0
  311. package/lib/utils/eventEmitter.d.ts +9 -0
  312. package/lib/utils/eventEmitter.js +41 -0
  313. package/lib/utils/eventEmitter.js.map +1 -0
  314. package/lib/utils/eventEmitter.mjs +34 -0
  315. package/lib/utils/eventEmitter.mjs.map +1 -0
  316. package/lib/utils/findComponent.d.ts +12 -0
  317. package/lib/utils/findComponent.js +106 -0
  318. package/lib/utils/findComponent.js.map +1 -0
  319. package/lib/utils/findComponent.mjs +95 -0
  320. package/lib/utils/findComponent.mjs.map +1 -0
  321. package/lib/utils/fire.d.ts +2 -0
  322. package/lib/utils/fire.js +23 -0
  323. package/lib/utils/fire.js.map +1 -0
  324. package/lib/utils/fire.mjs +15 -0
  325. package/lib/utils/fire.mjs.map +1 -0
  326. package/lib/utils/focus-lock/focusBorders.d.ts +4 -0
  327. package/lib/utils/focus-lock/focusBorders.js +72 -0
  328. package/lib/utils/focus-lock/focusBorders.js.map +1 -0
  329. package/lib/utils/focus-lock/focusBorders.mjs +62 -0
  330. package/lib/utils/focus-lock/focusBorders.mjs.map +1 -0
  331. package/lib/utils/focus-lock/getFocusableIn.d.ts +1 -0
  332. package/lib/utils/focus-lock/getFocusableIn.js +26 -0
  333. package/lib/utils/focus-lock/getFocusableIn.js.map +1 -0
  334. package/lib/utils/focus-lock/getFocusableIn.mjs +19 -0
  335. package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -0
  336. package/lib/utils/focus-lock/isFocusInside.d.ts +1 -0
  337. package/lib/utils/focus-lock/isFocusInside.js +16 -0
  338. package/lib/utils/focus-lock/isFocusInside.js.map +1 -0
  339. package/lib/utils/focus-lock/isFocusInside.mjs +9 -0
  340. package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -0
  341. package/lib/utils/focus-lock/isFocusable.d.ts +1 -0
  342. package/lib/utils/focus-lock/isFocusable.js +51 -0
  343. package/lib/utils/focus-lock/isFocusable.js.map +1 -0
  344. package/lib/utils/focus-lock/isFocusable.mjs +43 -0
  345. package/lib/utils/focus-lock/isFocusable.mjs.map +1 -0
  346. package/lib/utils/focus-lock/setFocus.d.ts +1 -0
  347. package/lib/utils/focus-lock/setFocus.js +63 -0
  348. package/lib/utils/focus-lock/setFocus.js.map +1 -0
  349. package/lib/utils/focus-lock/setFocus.mjs +55 -0
  350. package/lib/utils/focus-lock/setFocus.mjs.map +1 -0
  351. package/lib/utils/getAccessibleName.d.ts +1 -0
  352. package/lib/utils/getAccessibleName.js +56 -0
  353. package/lib/utils/getAccessibleName.js.map +1 -0
  354. package/lib/utils/getAccessibleName.mjs +49 -0
  355. package/lib/utils/getAccessibleName.mjs.map +1 -0
  356. package/lib/utils/getDisplayName.d.ts +2 -0
  357. package/lib/utils/getDisplayName.js +10 -0
  358. package/lib/utils/getDisplayName.js.map +1 -0
  359. package/lib/utils/getDisplayName.mjs +6 -0
  360. package/lib/utils/getDisplayName.mjs.map +1 -0
  361. package/lib/utils/getEventTarget.d.ts +1 -0
  362. package/lib/utils/getEventTarget.js +53 -0
  363. package/lib/utils/getEventTarget.js.map +1 -0
  364. package/lib/utils/getEventTarget.mjs +45 -0
  365. package/lib/utils/getEventTarget.mjs.map +1 -0
  366. package/lib/utils/getOriginChildren.d.ts +2 -0
  367. package/lib/utils/getOriginChildren.js +18 -0
  368. package/lib/utils/getOriginChildren.js.map +1 -0
  369. package/lib/utils/getOriginChildren.mjs +10 -0
  370. package/lib/utils/getOriginChildren.mjs.map +1 -0
  371. package/lib/utils/getRandomInt.d.ts +1 -0
  372. package/lib/utils/getRandomInt.js +11 -0
  373. package/lib/utils/getRandomInt.js.map +1 -0
  374. package/lib/utils/getRandomInt.mjs +5 -0
  375. package/lib/utils/getRandomInt.mjs.map +1 -0
  376. package/lib/utils/getValue.d.ts +1 -0
  377. package/lib/utils/getValue.js +16 -0
  378. package/lib/utils/getValue.js.map +1 -0
  379. package/lib/utils/getValue.mjs +10 -0
  380. package/lib/utils/getValue.mjs.map +1 -0
  381. package/lib/utils/hasLabels.d.ts +7 -0
  382. package/lib/utils/hasLabels.js +47 -0
  383. package/lib/utils/hasLabels.js.map +1 -0
  384. package/lib/utils/hasLabels.mjs +39 -0
  385. package/lib/utils/hasLabels.mjs.map +1 -0
  386. package/lib/utils/hasParent.d.ts +1 -0
  387. package/lib/utils/hasParent.js +14 -0
  388. package/lib/utils/hasParent.js.map +1 -0
  389. package/lib/utils/hasParent.mjs +7 -0
  390. package/lib/utils/hasParent.mjs.map +1 -0
  391. package/lib/utils/if.d.ts +11 -0
  392. package/lib/utils/if.js +16 -0
  393. package/lib/utils/if.js.map +1 -0
  394. package/lib/utils/if.mjs +9 -0
  395. package/lib/utils/if.mjs.map +1 -0
  396. package/lib/utils/ifChildren.d.ts +8 -0
  397. package/lib/utils/ifChildren.js +17 -0
  398. package/lib/utils/ifChildren.js.map +1 -0
  399. package/lib/utils/ifChildren.mjs +10 -0
  400. package/lib/utils/ifChildren.mjs.map +1 -0
  401. package/lib/utils/injectStyle.d.ts +2 -0
  402. package/lib/utils/injectStyle.js +49 -0
  403. package/lib/utils/injectStyle.js.map +1 -0
  404. package/lib/utils/injectStyle.mjs +41 -0
  405. package/lib/utils/injectStyle.mjs.map +1 -0
  406. package/lib/utils/inputProps.d.ts +2 -0
  407. package/lib/utils/inputProps.js +22 -0
  408. package/lib/utils/inputProps.js.map +1 -0
  409. package/lib/utils/inputProps.mjs +14 -0
  410. package/lib/utils/inputProps.mjs.map +1 -0
  411. package/lib/utils/isInteractiveElement.d.ts +1 -0
  412. package/lib/utils/isInteractiveElement.js +34 -0
  413. package/lib/utils/isInteractiveElement.js.map +1 -0
  414. package/lib/utils/isInteractiveElement.mjs +28 -0
  415. package/lib/utils/isInteractiveElement.mjs.map +1 -0
  416. package/lib/utils/isNode.d.ts +1 -0
  417. package/lib/utils/isNode.js +28 -0
  418. package/lib/utils/isNode.js.map +1 -0
  419. package/lib/utils/isNode.mjs +21 -0
  420. package/lib/utils/isNode.mjs.map +1 -0
  421. package/lib/utils/isPromise.d.ts +1 -0
  422. package/lib/utils/isPromise.js +10 -0
  423. package/lib/utils/isPromise.js.map +1 -0
  424. package/lib/utils/isPromise.mjs +4 -0
  425. package/lib/utils/isPromise.mjs.map +1 -0
  426. package/lib/utils/isRetina.d.ts +1 -0
  427. package/lib/utils/isRetina.js +15 -0
  428. package/lib/utils/isRetina.js.map +1 -0
  429. package/lib/utils/isRetina.mjs +9 -0
  430. package/lib/utils/isRetina.mjs.map +1 -0
  431. package/lib/utils/logger.d.ts +9 -0
  432. package/lib/utils/logger.js +40 -0
  433. package/lib/utils/logger.js.map +1 -0
  434. package/lib/utils/logger.mjs +35 -0
  435. package/lib/utils/logger.mjs.map +1 -0
  436. package/lib/utils/numericChecker.d.ts +5 -0
  437. package/lib/utils/numericChecker.js +33 -0
  438. package/lib/utils/numericChecker.js.map +1 -0
  439. package/lib/utils/numericChecker.mjs +27 -0
  440. package/lib/utils/numericChecker.mjs.map +1 -0
  441. package/lib/utils/ownerDocument.d.ts +1 -0
  442. package/lib/utils/ownerDocument.js +10 -0
  443. package/lib/utils/ownerDocument.js.map +1 -0
  444. package/lib/utils/ownerDocument.mjs +4 -0
  445. package/lib/utils/ownerDocument.mjs.map +1 -0
  446. package/lib/utils/pick.d.ts +1 -0
  447. package/lib/utils/pick.js +19 -0
  448. package/lib/utils/pick.js.map +1 -0
  449. package/lib/utils/pick.mjs +15 -0
  450. package/lib/utils/pick.mjs.map +1 -0
  451. package/lib/utils/propsForElement.d.ts +3 -0
  452. package/lib/utils/propsForElement.js +59 -0
  453. package/lib/utils/propsForElement.js.map +1 -0
  454. package/lib/utils/propsForElement.mjs +50 -0
  455. package/lib/utils/propsForElement.mjs.map +1 -0
  456. package/lib/utils/rafTrottle.d.ts +2 -0
  457. package/lib/utils/rafTrottle.js +33 -0
  458. package/lib/utils/rafTrottle.js.map +1 -0
  459. package/lib/utils/rafTrottle.mjs +26 -0
  460. package/lib/utils/rafTrottle.mjs.map +1 -0
  461. package/lib/utils/reactToText.d.ts +3 -0
  462. package/lib/utils/reactToText.js +33 -0
  463. package/lib/utils/reactToText.js.map +1 -0
  464. package/lib/utils/reactToText.mjs +26 -0
  465. package/lib/utils/reactToText.mjs.map +1 -0
  466. package/lib/utils/ref.d.ts +10 -0
  467. package/lib/utils/ref.js +96 -0
  468. package/lib/utils/ref.js.map +1 -0
  469. package/lib/utils/ref.mjs +87 -0
  470. package/lib/utils/ref.mjs.map +1 -0
  471. package/lib/utils/setRef.d.ts +2 -0
  472. package/lib/utils/setRef.js +10 -0
  473. package/lib/utils/setRef.js.map +1 -0
  474. package/lib/utils/setRef.mjs +3 -0
  475. package/lib/utils/setRef.mjs.map +1 -0
  476. package/lib/utils/syncScroll.d.ts +1 -0
  477. package/lib/utils/syncScroll.js +61 -0
  478. package/lib/utils/syncScroll.js.map +1 -0
  479. package/lib/utils/syncScroll.mjs +54 -0
  480. package/lib/utils/syncScroll.mjs.map +1 -0
  481. package/lib/utils/uncontroll.d.ts +4 -0
  482. package/lib/utils/uncontroll.js +47 -0
  483. package/lib/utils/uncontroll.js.map +1 -0
  484. package/lib/utils/uncontroll.mjs +38 -0
  485. package/lib/utils/uncontroll.mjs.map +1 -0
  486. package/lib/utils/uniqueID.d.ts +12 -0
  487. package/lib/utils/uniqueID.js +42 -0
  488. package/lib/utils/uniqueID.js.map +1 -0
  489. package/lib/utils/uniqueID.mjs +33 -0
  490. package/lib/utils/uniqueID.mjs.map +1 -0
  491. package/lib/utils/use/useColorResolver.d.ts +1 -0
  492. package/lib/utils/use/useColorResolver.js +208 -0
  493. package/lib/utils/use/useColorResolver.js.map +1 -0
  494. package/lib/utils/use/useColorResolver.mjs +200 -0
  495. package/lib/utils/use/useColorResolver.mjs.map +1 -0
  496. package/lib/utils/use/useCss.d.ts +4 -0
  497. package/lib/utils/use/useCss.js +20 -0
  498. package/lib/utils/use/useCss.js.map +1 -0
  499. package/lib/utils/use/useCss.mjs +12 -0
  500. package/lib/utils/use/useCss.mjs.map +1 -0
  501. package/lib/utils/use/useEnhancedEffect.d.ts +3 -0
  502. package/lib/utils/use/useEnhancedEffect.js +13 -0
  503. package/lib/utils/use/useEnhancedEffect.js.map +1 -0
  504. package/lib/utils/use/useEnhancedEffect.mjs +6 -0
  505. package/lib/utils/use/useEnhancedEffect.mjs.map +1 -0
  506. package/lib/utils/use/useEventCallback.d.ts +4 -0
  507. package/lib/utils/use/useEventCallback.js +25 -0
  508. package/lib/utils/use/useEventCallback.js.map +1 -0
  509. package/lib/utils/use/useEventCallback.mjs +19 -0
  510. package/lib/utils/use/useEventCallback.mjs.map +1 -0
  511. package/lib/utils/use/useEventListener.d.ts +2 -0
  512. package/lib/utils/use/useEventListener.js +33 -0
  513. package/lib/utils/use/useEventListener.js.map +1 -0
  514. package/lib/utils/use/useEventListener.mjs +25 -0
  515. package/lib/utils/use/useEventListener.mjs.map +1 -0
  516. package/lib/utils/use/useFocusLock.d.ts +10 -0
  517. package/lib/utils/use/useFocusLock.js +289 -0
  518. package/lib/utils/use/useFocusLock.js.map +1 -0
  519. package/lib/utils/use/useFocusLock.mjs +266 -0
  520. package/lib/utils/use/useFocusLock.mjs.map +1 -0
  521. package/lib/utils/use/usePreventScroll.d.ts +2 -0
  522. package/lib/utils/use/usePreventScroll.js +78 -0
  523. package/lib/utils/use/usePreventScroll.js.map +1 -0
  524. package/lib/utils/use/usePreventScroll.mjs +70 -0
  525. package/lib/utils/use/usePreventScroll.mjs.map +1 -0
  526. package/lib/utils/useCssVariable.d.ts +8 -0
  527. package/lib/utils/useCssVariable.js +55 -0
  528. package/lib/utils/useCssVariable.js.map +1 -0
  529. package/lib/utils/useCssVariable.mjs +46 -0
  530. package/lib/utils/useCssVariable.mjs.map +1 -0
  531. package/lib/utils/zIndexStacking.d.ts +8 -0
  532. package/lib/utils/zIndexStacking.js +48 -0
  533. package/lib/utils/zIndexStacking.js.map +1 -0
  534. package/lib/utils/zIndexStacking.mjs +38 -0
  535. package/lib/utils/zIndexStacking.mjs.map +1 -0
  536. package/package.json +297 -10
  537. package/tsconfig-utils.json +4 -0
  538. package/vite.config.ts +24 -0
  539. package/lib/cjs/index.js +0 -23
  540. package/lib/cjs/index.js.map +0 -1
  541. package/lib/es6/index.js +0 -4
  542. package/lib/es6/index.js.map +0 -1
  543. package/lib/types/index.d.ts +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Children.mjs","names":["React","CONTEXT_COMPONENT","CHILDREN_COMPONENT","CHILDREN_SELF","Symbol","GETTER_REG","splitPropsAndGetters","props","Object","entries","reduce","acc","_ref","_ref2","_slicedToArray","key","value","exec","getters","getterToArray","getter","Array","isArray","mergeObjects","a","arguments","length","undefined","b","core","_objectSpread","keys","concat","_toConsumableArray","assignGettersChain","createChildren","Context","contexts","Children","children","origin","_reduce","ctx","_ref3","useContext","handlers","propsAndGetters","_objectWithoutProperties","_excluded2","_splitPropsAndGetters","assign","_reduce$handlers","_reduce$getters","_excluded","mergedGetters","_ref4","_ref5","Enhancement","parent","init","map","component","filter","Boolean","asProps"],"sources":["../../src/enhancement/Children.tsx"],"sourcesContent":["import React from 'react';\nimport { CONTEXT_COMPONENT, CHILDREN_COMPONENT } from '../core-types/symbols';\n\nconst CHILDREN_SELF = Symbol('CHILDREN_SELF');\n\nconst GETTER_REG = /^get[\\w]+Props$/;\n\nfunction splitPropsAndGetters(props: any) {\n return Object.entries(props).reduce(\n (acc: any, [key, value]) => {\n if (GETTER_REG.exec(key) === null) {\n acc.props[key] = value;\n } else {\n acc.getters[key] = value;\n }\n return acc;\n },\n { props: {}, getters: {} },\n );\n}\n\nfunction getterToArray(getter: any) {\n if (!Array.isArray(getter)) {\n return typeof getter === 'function' ? [getter] : [];\n }\n return getter;\n}\n\nfunction mergeObjects(a: any = {}, b: any = {}) {\n const core = { ...a, ...b };\n return Object.keys(core).reduce((acc: any, key) => {\n a[key] = getterToArray(a[key]);\n b[key] = getterToArray(b[key]);\n acc[key] = [...a[key], ...b[key]];\n return acc;\n }, {});\n}\n\nfunction assignGettersChain(getters: Array<Function>) {\n return function (props = {}) {\n return getters.reduce((acc, getter) => {\n return getter(acc);\n }, props);\n };\n}\n\nfunction createChildren(Context: any, contexts: any) {\n const Children: any = function () {\n const children = Children.origin;\n if (typeof children === 'function') {\n const {\n handlers = {},\n getters = {},\n ...props\n } = [...contexts, Context].reduce((acc, ctx) => {\n const { handlers, ...propsAndGetters } = React.useContext(ctx) as any;\n const { props, getters } = splitPropsAndGetters(propsAndGetters);\n return Object.assign({}, acc, {\n handlers: Object.assign({}, acc.handlers, handlers),\n getters: mergeObjects(acc.getters, getters),\n ...props,\n });\n }, Children.props);\n\n const mergedGetters = Object.entries(getters).reduce((acc: any, [key, value]) => {\n acc[key] = assignGettersChain(value as []);\n return acc;\n }, {});\n\n return children({ ...props, ...mergedGetters }, handlers);\n } else if (children === undefined) {\n return null;\n }\n return children;\n };\n Children.origin = null;\n Children.props = {};\n Children[CHILDREN_COMPONENT] = true;\n return Children;\n}\n\nfunction Enhancement(this: any, Context: any, parent: any) {\n return {\n init: function (this: any) {\n const contexts = (Array.isArray(parent) ? parent : [parent])\n .map((component) => component[CONTEXT_COMPONENT])\n .filter(Boolean);\n this[CHILDREN_SELF] = createChildren(Context, contexts);\n },\n asProps: function (this: any, props: any) {\n // TODO: learn the reason what it was used for (by lsroman)\n // this[CHILDREN_SELF].origin = _Children ? _Children.origin : children;\n this[CHILDREN_SELF].origin = props.children;\n this[CHILDREN_SELF].props = props;\n return {\n ...props,\n Children: this[CHILDREN_SELF],\n };\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,2BAAuB;AAE7E,IAAMC,aAAa,GAAGC,MAAM,CAAC,eAAe,CAAC;AAE7C,IAAMC,UAAU,GAAG,iBAAiB;AAEpC,SAASC,oBAAoBA,CAACC,KAAU,EAAE;EACxC,OAAOC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAACG,MAAM,CACjC,UAACC,GAAQ,EAAAC,IAAA,EAAmB;IAAA,IAAAC,KAAA,GAAAC,cAAA,CAAAF,IAAA;MAAhBG,GAAG,GAAAF,KAAA;MAAEG,KAAK,GAAAH,KAAA;IACpB,IAAIR,UAAU,CAACY,IAAI,CAACF,GAAG,CAAC,KAAK,IAAI,EAAE;MACjCJ,GAAG,CAACJ,KAAK,CAACQ,GAAG,CAAC,GAAGC,KAAK;IACxB,CAAC,MAAM;MACLL,GAAG,CAACO,OAAO,CAACH,GAAG,CAAC,GAAGC,KAAK;IAC1B;IACA,OAAOL,GAAG;EACZ,CAAC,EACD;IAAEJ,KAAK,EAAE,CAAC,CAAC;IAAEW,OAAO,EAAE,CAAC;EAAE,CAAC,CAC3B;AACH;AAEA,SAASC,aAAaA,CAACC,MAAW,EAAE;EAClC,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IAC1B,OAAO,OAAOA,MAAM,KAAK,UAAU,GAAG,CAACA,MAAM,CAAC,GAAG,EAAE;EACrD;EACA,OAAOA,MAAM;AACf;AAEA,SAASG,YAAYA,CAAA,EAA2B;EAAA,IAA1BC,CAAM,GAAAC,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Aa;MAAC;IAEjC;EACF,CAAC;AACH;AAEA,eAAesD,WAAW"}
@@ -0,0 +1,6 @@
1
+ declare function Enhancement(): {
2
+ init: (this: any) => void;
3
+ asProps: (this: any, props: any, WrapperComponent: any, isFunction: boolean) => any;
4
+ render: (this: any, render: any, props: any) => any;
5
+ };
6
+ export default Enhancement;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _assignProps = _interopRequireDefault(require("../utils/assignProps"));
13
+ var _ref4 = require("../utils/ref");
14
+ var _excluded = ["render"],
15
+ _excluded2 = ["Root", "styles", "children", "Children", "forwardRef"];
16
+ function createRootRender() {
17
+ // @ts-ignore
18
+ var Root = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
19
+ var Tag = _ref.render,
20
+ source = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
21
+ var _Root$props = Root.props,
22
+ _Root = _Root$props.Root,
23
+ styles = _Root$props.styles,
24
+ children = _Root$props.children,
25
+ Children = _Root$props.Children,
26
+ _Root$props$forwardRe = _Root$props.forwardRef,
27
+ forwardRef = _Root$props$forwardRe === void 0 ? null : _Root$props$forwardRe,
28
+ props = (0, _objectWithoutProperties2["default"])(_Root$props, _excluded2);
29
+ var clearProps = Object.entries(props).reduce(function (props, _ref2) {
30
+ var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
31
+ name = _ref3[0],
32
+ value = _ref3[1];
33
+ if (value !== undefined) {
34
+ props[name] = value;
35
+ }
36
+ return props;
37
+ }, {});
38
+ var child = {};
39
+ // TODO: need to find better check solution (by lsroman)
40
+ if (typeof Children.origin !== 'undefined') {
41
+ // @ts-ignore
42
+ child.children = /*#__PURE__*/_react["default"].createElement(Children, null);
43
+ }
44
+ var other = (0, _assignProps["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, clearProps), {}, {
45
+ ref: (0, _ref4.useForkRef)(forwardRef, ref)
46
+ }), (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, child), source));
47
+ if (!Tag) {
48
+ throw new Error('`render` prop of Root is not provided');
49
+ }
50
+ if (Tag === _react["default"].Fragment) return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, other.children);
51
+ return /*#__PURE__*/_react["default"].createElement(Tag, other);
52
+ });
53
+ // @ts-ignore
54
+ Root.props = {};
55
+ return Root;
56
+ }
57
+ function Enhancement() {
58
+ return {
59
+ init: function init() {
60
+ this.Root = createRootRender();
61
+ },
62
+ asProps: function asProps(props, WrapperComponent, isFunction) {
63
+ if (isFunction) {
64
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
65
+ Root: this.Root
66
+ });
67
+ }
68
+ return props;
69
+ },
70
+ render: function render(_render, props) {
71
+ this.Root.props = props;
72
+ return _render;
73
+ }
74
+ };
75
+ }
76
+ var _default = Enhancement;
77
+ exports["default"] = _default;
78
+ //# sourceMappingURL=Root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Root.js","names":["_react","_interopRequireDefault","require","_assignProps","_ref4","_excluded","_excluded2","createRootRender","Root","React","forwardRef","_ref","ref","Tag","render","source","_objectWithoutProperties2","_Root$props","props","_Root","styles","children","Children","_Root$props$forwardRe","clearProps","Object","entries","reduce","_ref2","_ref3","_slicedToArray2","name","value","undefined","child","origin","createElement","other","assignProps","_objectSpread2","useForkRef","Error","Fragment","Enhancement","init","asProps","WrapperComponent","isFunction","_default","exports"],"sources":["../../src/enhancement/Root.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../utils/assignProps';\nimport { useForkRef } from '../utils/ref';\n\nfunction createRootRender() {\n // @ts-ignore\n const Root = React.forwardRef(function ({ render: Tag, ...source }, ref) {\n const {\n Root: _Root,\n\n styles,\n\n children,\n Children,\n forwardRef = null,\n ...props\n // @ts-ignore\n } = Root.props;\n\n const clearProps = Object.entries(props).reduce((props: any, [name, value]) => {\n if (value !== undefined) {\n props[name] = value;\n }\n return props;\n }, {});\n\n const child = {};\n // TODO: need to find better check solution (by lsroman)\n if (typeof Children.origin !== 'undefined') {\n // @ts-ignore\n child.children = <Children />;\n }\n\n const other = assignProps(\n {\n ...clearProps,\n ref: useForkRef(forwardRef, ref),\n },\n {\n ...child,\n ...source,\n },\n );\n if (!Tag) {\n throw new Error('`render` prop of Root is not provided');\n }\n if (Tag === React.Fragment) return <React.Fragment>{other.children}</React.Fragment>;\n\n return <Tag {...other} />;\n });\n // @ts-ignore\n Root.props = {};\n return Root;\n}\n\nfunction Enhancement() {\n return {\n init: function (this: any) {\n this.Root = createRootRender();\n },\n asProps: function (this: any, props: any, WrapperComponent: any, isFunction: boolean) {\n if (isFunction) {\n return {\n ...props,\n Root: this.Root,\n };\n }\n return props;\n },\n render: function (this: any, render: any, props: any) {\n this.Root.props = props;\n return render;\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAA0C,IAAAG,SAAA;EAAAC,UAAA;AAE1C,SAASC,gBAAgBA,CAAA,EAAG;EAC1B;EACA,IAAMC,IAAI,gBAAGC,iBAAK,CAACC,UAAU,CAAC,UAAAC,IAAA,EAAsCC,GAAG,EAAE;IAAA,IAAvBC,GAAG,GAAAF,IAAA,CAAXG,MAAM;MAAUC,MAAM,OAAAC,yBAAA,aAAAL,IAAA,EAAAN,SAAA;IAC9D,IAAAY,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E,oBAAO1C,MAAA,YAAAoC,aAAA,CAACpC,MAAA,WAAK,CAAC0C,QAAQ,QAAEL,KAAK,CAAChB,QAAQ,CAAkB;IAEpF,oBAAOrB,MAAA,YAAAoC,aAAA,CAACvB,GAAG,EAAKwB,KAAK,CAAI;EAC3B,CAAC,CAAC;EACF;EACA7B,IAAI,CAACU,KAAK,GAAG,CAAC,CAAC;EACf,OAAOV,IAAI;AACb;AAEA,SAASmC,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,IAAI,EAAE,SAAAA,KAAA,EAAqB;MACzB,IAAI,CAACpC,IAAI,GAAGD,gBAAgB,EAAE;IAChC,CAAC;IACDsC,OAAO,EAAE,SAAAA,QAAqB3B,KAAU,EAAE4B,gBAAqB,EAAEC,UAAmB,EAAE;MACpF,IAAIA,UAAU,EAAE;QACd,WAAAR,cAAA,iBAAAA,cAAA,iBACKrB,KAAK;UACRV,IAAI,EAAE,IAAI,CAACA;QAAI;MAEnB;MACA,OAAOU,KAAK;IACd,CAAC;IACDJ,MAAM,EAAE,SAAAA,OAAqBA,OAAW,EAAEI,KAAU,EAAE;MACpD,IAAI,CAACV,IAAI,CAACU,KAAK,GAAGA,KAAK;MACvB,OAAOJ,OAAM;IACf;EACF,CAAC;AACH;AAAC,IAAAkC,QAAA,GAEcL,WAAW;AAAAM,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,56 @@
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
+ import React from "react";
5
+ import assignProps from "../utils/assignProps.mjs";
6
+ import { useForkRef } from "../utils/ref.mjs";
7
+ var _excluded = ["render"], _excluded2 = ["Root", "styles", "children", "Children", "forwardRef"];
8
+ 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];
14
+ if (value !== void 0) {
15
+ props2[name] = value;
16
+ }
17
+ return props2;
18
+ }, {});
19
+ var child = {};
20
+ if (typeof Children.origin !== "undefined") {
21
+ child.children = /* @__PURE__ */ React.createElement(Children, null);
22
+ }
23
+ var other = assignProps(_objectSpread(_objectSpread({}, clearProps), {}, {
24
+ ref: useForkRef(forwardRef, ref)
25
+ }), _objectSpread(_objectSpread({}, child), source));
26
+ if (!Tag) {
27
+ throw new Error("`render` prop of Root is not provided");
28
+ }
29
+ if (Tag === React.Fragment) return /* @__PURE__ */ React.createElement(React.Fragment, null, other.children);
30
+ return /* @__PURE__ */ React.createElement(Tag, other);
31
+ });
32
+ Root.props = {};
33
+ return Root;
34
+ }
35
+ function Enhancement() {
36
+ return {
37
+ init: function init() {
38
+ this.Root = createRootRender();
39
+ },
40
+ asProps: function asProps(props, WrapperComponent, isFunction) {
41
+ if (isFunction) {
42
+ return _objectSpread(_objectSpread({}, props), {}, {
43
+ Root: this.Root
44
+ });
45
+ }
46
+ return props;
47
+ },
48
+ render: function render(_render, props) {
49
+ this.Root.props = props;
50
+ return _render;
51
+ }
52
+ };
53
+ }
54
+ export {
55
+ Enhancement as default
56
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Root.mjs","names":["React","assignProps","useForkRef","createRootRender","Root","forwardRef","_ref","ref","Tag","render","source","_objectWithoutProperties","_excluded","_Root$props","props","_Root","styles","children","Children","_Root$props$forwardRe","_excluded2","clearProps","Object","entries","reduce","_ref2","_ref3","_slicedToArray","name","value","undefined","child","origin","createElement","other","_objectSpread","Error","Fragment","Enhancement","init","asProps","WrapperComponent","isFunction"],"sources":["../../src/enhancement/Root.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../utils/assignProps';\nimport { useForkRef } from '../utils/ref';\n\nfunction createRootRender() {\n // @ts-ignore\n const Root = React.forwardRef(function ({ render: Tag, ...source }, ref) {\n const {\n Root: _Root,\n\n styles,\n\n children,\n Children,\n forwardRef = null,\n ...props\n // @ts-ignore\n } = Root.props;\n\n const clearProps = Object.entries(props).reduce((props: any, [name, value]) => {\n if (value !== undefined) {\n props[name] = value;\n }\n return props;\n }, {});\n\n const child = {};\n // TODO: need to find better check solution (by lsroman)\n if (typeof Children.origin !== 'undefined') {\n // @ts-ignore\n child.children = <Children />;\n }\n\n const other = assignProps(\n {\n ...clearProps,\n ref: useForkRef(forwardRef, ref),\n },\n {\n ...child,\n ...source,\n },\n );\n if (!Tag) {\n throw new Error('`render` prop of Root is not provided');\n }\n if (Tag === React.Fragment) return <React.Fragment>{other.children}</React.Fragment>;\n\n return <Tag {...other} />;\n });\n // @ts-ignore\n Root.props = {};\n return Root;\n}\n\nfunction Enhancement() {\n return {\n init: function (this: any) {\n this.Root = createRootRender();\n },\n asProps: function (this: any, props: any, WrapperComponent: any, isFunction: boolean) {\n if (isFunction) {\n return {\n ...props,\n Root: this.Root,\n };\n }\n return props;\n },\n render: function (this: any, render: any, props: any) {\n this.Root.props = props;\n return render;\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,0BAAsB;AAC9C,SAASC,UAAU,QAAQ,kBAAc;AAEzC,SAASC,gBAAgBA,CAAA,EAAG;EAC1B;EACA,IAAMC,IAAI,gBAAGJ,KAAK,CAACK,UAAU,CAAC,UAAAC,IAAA,EAAsCC,GAAG,EAAE;IAAA,IAAvBC,GAAG,GAAAF,IAAA,CAAXG,MAAM;MAAUC,MAAM,GAAAC,wBAAA,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CAACqC,QAAQ,EAAE,oBAAOrC,KAAA,CAAAiC,aAAA,CAACjC,KAAK,CAACqC,QAAQ,QAAEH,KAAK,CAACjB,QAAQ,CAAkB;IAEpF,oBAAOjB,KAAA,CAAAiC,aAAA,CAACzB,GAAG,EAAK0B,KAAK,CAAI;EAC3B,CAAC,CAAC;EACF;EACA9B,IAAI,CAACU,KAAK,GAAG,CAAC,CAAC;EACf,OAAOV,IAAI;AACb;AAEA,SAASkC,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,IAAI,EAAE,SAAAA,KAAA,EAAqB;MACzB,IAAI,CAACnC,IAAI,GAAGD,gBAAgB,EAAE;IAChC,CAAC;IACDqC,OAAO,EAAE,SAAAA,QAAqB1B,KAAU,EAAE2B,gBAAqB,EAAEC,UAAmB,EAAE;MACpF,IAAIA,UAAU,EAAE;QACd,OAAAP,aAAA,CAAAA,aAAA,KACKrB,KAAK;UACRV,IAAI,EAAE,IAAI,CAACA;QAAI;MAEnB;MACA,OAAOU,KAAK;IACd,CAAC;IACDL,MAAM,EAAE,SAAAA,OAAqBA,OAAW,EAAEK,KAAU,EAAE;MACpD,IAAI,CAACV,IAAI,CAACU,KAAK,GAAGA,KAAK;MACvB,OAAOL,OAAM;IACf;EACF,CAAC;AACH;AAEA,eAAe6B,WAAW"}
@@ -0,0 +1,5 @@
1
+ declare function Enhancement(): {
2
+ condition: (Component: any, isFunction: boolean) => boolean;
3
+ init: (this: any) => void;
4
+ };
5
+ export default Enhancement;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ function arraysEqual(a, b) {
8
+ if (a.length !== b.length) return false;
9
+ for (var i = 0; i < a.length; i++) {
10
+ if (a[i] !== b[i]) return false;
11
+ }
12
+ return true;
13
+ }
14
+ function handlerBinder(fn) {
15
+ return function () {
16
+ for (var _len = arguments.length, depsArgs = new Array(_len), _key = 0; _key < _len; _key++) {
17
+ depsArgs[_key] = arguments[_key];
18
+ }
19
+ var memoizeds = [];
20
+ if (handlerBinder.hasher.has(fn)) {
21
+ memoizeds = handlerBinder.hasher.get(fn);
22
+ var memoized = memoizeds.find(function (memoized) {
23
+ return arraysEqual(memoized.deps, depsArgs);
24
+ });
25
+ if (memoized) return memoized.fn;
26
+ }
27
+ var bindFn = fn.apply(void 0, depsArgs).bind(fn);
28
+ memoizeds.push({
29
+ deps: depsArgs,
30
+ fn: bindFn
31
+ });
32
+ handlerBinder.hasher.set(fn, memoizeds);
33
+ return bindFn;
34
+ };
35
+ }
36
+ handlerBinder.hasher = new WeakMap();
37
+ function Enhancement() {
38
+ return {
39
+ condition: function condition(Component, isFunction) {
40
+ return !isFunction;
41
+ },
42
+ init: function init() {
43
+ var _this = this;
44
+ Object.keys(this).filter(function (field) {
45
+ return field.startsWith('bindHandler');
46
+ }).forEach(function (name) {
47
+ _this[name] = handlerBinder(_this[name].bind(_this));
48
+ });
49
+ }
50
+ };
51
+ }
52
+ var _default = Enhancement;
53
+ exports["default"] = _default;
54
+ //# sourceMappingURL=bindHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindHandler.js","names":["arraysEqual","a","b","length","i","handlerBinder","fn","_len","arguments","depsArgs","Array","_key","memoizeds","hasher","has","get","memoized","find","deps","bindFn","apply","bind","push","set","WeakMap","Enhancement","condition","Component","isFunction","init","_this","Object","keys","filter","field","startsWith","forEach","name","_default","exports"],"sources":["../../src/enhancement/bindHandler.tsx"],"sourcesContent":["function arraysEqual(a: any, b: any) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction handlerBinder(fn: any) {\n return function (...depsArgs: any[]) {\n let memoizeds = [];\n if (handlerBinder.hasher.has(fn)) {\n memoizeds = handlerBinder.hasher.get(fn);\n const memoized = memoizeds.find((memoized: any) => arraysEqual(memoized.deps, depsArgs));\n if (memoized) return memoized.fn;\n }\n\n const bindFn = fn(...depsArgs).bind(fn);\n memoizeds.push({\n deps: depsArgs,\n fn: bindFn,\n });\n handlerBinder.hasher.set(fn, memoizeds);\n return bindFn;\n };\n}\n\nhandlerBinder.hasher = new WeakMap();\n\nfunction Enhancement() {\n return {\n condition: function (Component: any, isFunction: boolean) {\n return !isFunction;\n },\n init: function (this: any) {\n Object.keys(this)\n .filter((field) => field.startsWith('bindHandler'))\n .forEach((name) => {\n this[name] = handlerBinder(this[name].bind(this));\n });\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;;AAAA,SAASA,WAAWA,CAACC,CAAM,EAAEC,CAAM,EAAE;EACnC,IAAID,CAAC,CAACE,MAAM,KAAKD,CAAC,CAACC,MAAM,EAAE,OAAO,KAAK;EACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,CAAC,CAACE,MAAM,EAAEC,CAAC,EAAE,EAAE;IACjC,IAAIH,CAAC,CAACG,CAAC,CAAC,KAAKF,CAAC,CAACE,CAAC,CAAC,EAAE,OAAO,KAAK;EACjC;EACA,OAAO,IAAI;AACb;AAEA,SAASC,aAAaA,CAACC,EAAO,EAAE;EAC9B,OAAO,YAA8B;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAL,MAAA,EAAjBM,QAAQ,OAAAC,KAAA,CAAAH,IAAA,GAAAI,IAAA,MAAAA,IAAA,GAAAJ,IAAA,EAAAI,IAAA;MAARF,QAAQ,CAAAE,IAAA,IAAAH,SAAA,CAAAG,IAAA;IAAA;IAC1B,IAAIC,SAAS,GAAG,EAAE;IAClB,IAAIP,aAAa,CAACQ,MAAM,CAACC,GAAG,CAACR,EAAE,CAAC,EAAE;MAChCM,SAAS,GAAGP,aAAa,CAACQ,MAAM,CAACE,GAAG,CAACT,EAAE,CAAC;MACxC,IAAMU,QAAQ,GAAGJ,SAAS,CAACK,IAAI,CAAC,UAACD,QAAa;QAAA,OAAKhB,WAAW,CAACgB,QAAQ,CAACE,IAAI,EAAET,QAAQ,CAAC;MAAA,EAAC;MACxF,IAAIO,QAAQ,EAAE,OAAOA,QAAQ,CAACV,EAAE;IAClC;IAEA,IAAMa,MAAM,GAAGb,EAAE,CAAAc,KAAA,SAAIX,QAAQ,CAAC,CAACY,IAAI,CAACf,EAAE,CAAC;IACvCM,SAAS,CAACU,IAAI,CAAC;MACbJ,IAAI,EAAET,QAAQ;MACdH,EAAE,EAAEa;IACN,CAAC,CAAC;IACFd,aAAa,CAACQ,MAAM,CAACU,GAAG,CAACjB,EAAE,EAAEM,SAAS,CAAC;IACvC,OAAOO,MAAM;EACf,CAAC;AACH;AAEAd,aAAa,CAACQ,MAAM,GAAG,IAAIW,OAAO,EAAE;AAEpC,SAASC,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAEC,UAAmB,EAAE;MACxD,OAAO,CAACA,UAAU;IACpB,CAAC;IACDC,IAAI,EAAE,SAAAA,KAAA,EAAqB;MAAA,IAAAC,KAAA;MACzBC,MAAM,CAACC,IAAI,CAAC,IAAI,CAAC,CACdC,MAAM,CAAC,UAACC,KAAK;QAAA,OAAKA,KAAK,CAACC,UAAU,CAAC,aAAa,CAAC;MAAA,EAAC,CAClDC,OAAO,CAAC,UAACC,IAAI,EAAK;QACjBP,KAAI,CAACO,IAAI,CAAC,GAAGhC,aAAa,CAACyB,KAAI,CAACO,IAAI,CAAC,CAAChB,IAAI,CAACS,KAAI,CAAC,CAAC;MACnD,CAAC,CAAC;IACN;EACF,CAAC;AACH;AAAC,IAAAQ,QAAA,GAEcb,WAAW;AAAAc,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,48 @@
1
+ function arraysEqual(a, b) {
2
+ if (a.length !== b.length) return false;
3
+ for (var i = 0; i < a.length; i++) {
4
+ if (a[i] !== b[i]) return false;
5
+ }
6
+ return true;
7
+ }
8
+ function handlerBinder(fn) {
9
+ return function() {
10
+ for (var _len = arguments.length, depsArgs = new Array(_len), _key = 0; _key < _len; _key++) {
11
+ depsArgs[_key] = arguments[_key];
12
+ }
13
+ var memoizeds = [];
14
+ if (handlerBinder.hasher.has(fn)) {
15
+ memoizeds = handlerBinder.hasher.get(fn);
16
+ var memoized = memoizeds.find(function(memoized2) {
17
+ return arraysEqual(memoized2.deps, depsArgs);
18
+ });
19
+ if (memoized) return memoized.fn;
20
+ }
21
+ var bindFn = fn.apply(void 0, depsArgs).bind(fn);
22
+ memoizeds.push({
23
+ deps: depsArgs,
24
+ fn: bindFn
25
+ });
26
+ handlerBinder.hasher.set(fn, memoizeds);
27
+ return bindFn;
28
+ };
29
+ }
30
+ handlerBinder.hasher = /* @__PURE__ */ new WeakMap();
31
+ function Enhancement() {
32
+ return {
33
+ condition: function condition(Component, isFunction) {
34
+ return !isFunction;
35
+ },
36
+ init: function init() {
37
+ var _this = this;
38
+ Object.keys(this).filter(function(field) {
39
+ return field.startsWith("bindHandler");
40
+ }).forEach(function(name) {
41
+ _this[name] = handlerBinder(_this[name].bind(_this));
42
+ });
43
+ }
44
+ };
45
+ }
46
+ export {
47
+ Enhancement as default
48
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindHandler.mjs","names":["arraysEqual","a","b","length","i","handlerBinder","fn","_len","arguments","depsArgs","Array","_key","memoizeds","hasher","has","get","memoized","find","deps","bindFn","apply","bind","push","set","WeakMap","Enhancement","condition","Component","isFunction","init","_this","Object","keys","filter","field","startsWith","forEach","name"],"sources":["../../src/enhancement/bindHandler.tsx"],"sourcesContent":["function arraysEqual(a: any, b: any) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction handlerBinder(fn: any) {\n return function (...depsArgs: any[]) {\n let memoizeds = [];\n if (handlerBinder.hasher.has(fn)) {\n memoizeds = handlerBinder.hasher.get(fn);\n const memoized = memoizeds.find((memoized: any) => arraysEqual(memoized.deps, depsArgs));\n if (memoized) return memoized.fn;\n }\n\n const bindFn = fn(...depsArgs).bind(fn);\n memoizeds.push({\n deps: depsArgs,\n fn: bindFn,\n });\n handlerBinder.hasher.set(fn, memoizeds);\n return bindFn;\n };\n}\n\nhandlerBinder.hasher = new WeakMap();\n\nfunction Enhancement() {\n return {\n condition: function (Component: any, isFunction: boolean) {\n return !isFunction;\n },\n init: function (this: any) {\n Object.keys(this)\n .filter((field) => field.startsWith('bindHandler'))\n .forEach((name) => {\n this[name] = handlerBinder(this[name].bind(this));\n });\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":"AAAA,SAASA,WAAWA,CAACC,CAAM,EAAEC,CAAM,EAAE;EACnC,IAAID,CAAC,CAACE,MAAM,KAAKD,CAAC,CAACC,MAAM,EAAE,OAAO,KAAK;EACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,CAAC,CAACE,MAAM,EAAEC,CAAC,EAAE,EAAE;IACjC,IAAIH,CAAC,CAACG,CAAC,CAAC,KAAKF,CAAC,CAACE,CAAC,CAAC,EAAE,OAAO,KAAK;EACjC;EACA,OAAO,IAAI;AACb;AAEA,SAASC,aAAaA,CAACC,EAAO,EAAE;EAC9B,OAAO,YAA8B;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAL,MAAA,EAAjBM,QAAQ,OAAAC,KAAA,CAAAH,IAAA,GAAAI,IAAA,MAAAA,IAAA,GAAAJ,IAAA,EAAAI,IAAA;MAARF,QAAQ,CAAAE,IAAA,IAAAH,SAAA,CAAAG,IAAA;IAAA;IAC1B,IAAIC,SAAS,GAAG,EAAE;IAClB,IAAIP,aAAa,CAACQ,MAAM,CAACC,GAAG,CAACR,EAAE,CAAC,EAAE;MAChCM,SAAS,GAAGP,aAAa,CAACQ,MAAM,CAACE,GAAG,CAACT,EAAE,CAAC;MACxC,IAAMU,QAAQ,GAAGJ,SAAS,CAACK,IAAI,CAAC,UAACD,QAAa;QAAA,OAAKhB,WAAW,CAACgB,QAAQ,CAACE,IAAI,EAAET,QAAQ,CAAC;MAAA,EAAC;MACxF,IAAIO,QAAQ,EAAE,OAAOA,QAAQ,CAACV,EAAE;IAClC;IAEA,IAAMa,MAAM,GAAGb,EAAE,CAAAc,KAAA,SAAIX,QAAQ,CAAC,CAACY,IAAI,CAACf,EAAE,CAAC;IACvCM,SAAS,CAACU,IAAI,CAAC;MACbJ,IAAI,EAAET,QAAQ;MACdH,EAAE,EAAEa;IACN,CAAC,CAAC;IACFd,aAAa,CAACQ,MAAM,CAACU,GAAG,CAACjB,EAAE,EAAEM,SAAS,CAAC;IACvC,OAAOO,MAAM;EACf,CAAC;AACH;AAEAd,aAAa,CAACQ,MAAM,GAAG,IAAIW,OAAO,EAAE;AAEpC,SAASC,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAEC,UAAmB,EAAE;MACxD,OAAO,CAACA,UAAU;IACpB,CAAC;IACDC,IAAI,EAAE,SAAAA,KAAA,EAAqB;MAAA,IAAAC,KAAA;MACzBC,MAAM,CAACC,IAAI,CAAC,IAAI,CAAC,CACdC,MAAM,CAAC,UAACC,KAAK;QAAA,OAAKA,KAAK,CAACC,UAAU,CAAC,aAAa,CAAC;MAAA,EAAC,CAClDC,OAAO,CAAC,UAACC,IAAI,EAAK;QACjBP,KAAI,CAACO,IAAI,CAAC,GAAGhC,aAAa,CAACyB,KAAI,CAACO,IAAI,CAAC,CAAChB,IAAI,CAACS,KAAI,CAAC,CAAC;MACnD,CAAC,CAAC;IACN;EACF,CAAC;AACH;AAEA,eAAeL,WAAW"}
@@ -0,0 +1,4 @@
1
+ declare function Enhancement(): {
2
+ wrapperProps: (props: any, WrapperComponent: any) => any;
3
+ };
4
+ export default Enhancement;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ function Enhancement() {
10
+ return {
11
+ wrapperProps: function wrapperProps(props, WrapperComponent) {
12
+ return (0, _objectSpread2["default"])({
13
+ 'data-ui-name': WrapperComponent.displayName
14
+ }, props);
15
+ }
16
+ };
17
+ }
18
+ var _default = Enhancement;
19
+ exports["default"] = _default;
20
+ //# sourceMappingURL=dataName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataName.js","names":["Enhancement","wrapperProps","props","WrapperComponent","_objectSpread2","displayName","_default","exports"],"sources":["../../src/enhancement/dataName.tsx"],"sourcesContent":["function Enhancement() {\n return {\n wrapperProps: function (props: any, WrapperComponent: any) {\n return {\n 'data-ui-name': WrapperComponent.displayName,\n ...props,\n };\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;;;;AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAEC,gBAAqB,EAAE;MACzD,WAAAC,cAAA;QACE,cAAc,EAAED,gBAAgB,CAACE;MAAW,GACzCH,KAAK;IAEZ;EACF,CAAC;AACH;AAAC,IAAAI,QAAA,GAEcN,WAAW;AAAAO,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,13 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ function Enhancement() {
3
+ return {
4
+ wrapperProps: function wrapperProps(props, WrapperComponent) {
5
+ return _objectSpread({
6
+ "data-ui-name": WrapperComponent.displayName
7
+ }, props);
8
+ }
9
+ };
10
+ }
11
+ export {
12
+ Enhancement as default
13
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataName.mjs","names":["Enhancement","wrapperProps","props","WrapperComponent","_objectSpread","displayName"],"sources":["../../src/enhancement/dataName.tsx"],"sourcesContent":["function Enhancement() {\n return {\n wrapperProps: function (props: any, WrapperComponent: any) {\n return {\n 'data-ui-name': WrapperComponent.displayName,\n ...props,\n };\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAEC,gBAAqB,EAAE;MACzD,OAAAC,aAAA;QACE,cAAc,EAAED,gBAAgB,CAACE;MAAW,GACzCH,KAAK;IAEZ;EACF,CAAC;AACH;AAEA,eAAeF,WAAW"}
@@ -0,0 +1,5 @@
1
+ declare function Enhancement(): {
2
+ condition: (Component: any) => boolean;
3
+ wrapperProps: (props: any, WrapperComponent: any) => any;
4
+ };
5
+ export default Enhancement;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ function Enhancement() {
8
+ return {
9
+ condition: function condition(Component) {
10
+ var _Component$enhance;
11
+ return Boolean((_Component$enhance = Component.enhance) === null || _Component$enhance === void 0 ? void 0 : _Component$enhance.length);
12
+ },
13
+ wrapperProps: function wrapperProps(props, WrapperComponent) {
14
+ return WrapperComponent.enhance.reduce(function (acc, enhance) {
15
+ return enhance(acc);
16
+ }, props);
17
+ }
18
+ };
19
+ }
20
+ var _default = Enhancement;
21
+ exports["default"] = _default;
22
+ //# sourceMappingURL=enhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhance.js","names":["Enhancement","condition","Component","_Component$enhance","Boolean","enhance","length","wrapperProps","props","WrapperComponent","reduce","acc","_default","exports"],"sources":["../../src/enhancement/enhance.tsx"],"sourcesContent":["function Enhancement() {\n return {\n condition: function (Component: any) {\n return Boolean(Component.enhance?.length);\n },\n wrapperProps: function (props: any, WrapperComponent: any) {\n return WrapperComponent.enhance.reduce((acc: any, enhance: any) => enhance(acc), props);\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;;AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAE;MAAA,IAAAC,kBAAA;MACnC,OAAOC,OAAO,EAAAD,kBAAA,GAACD,SAAS,CAACG,OAAO,cAAAF,kBAAA,uBAAjBA,kBAAA,CAAmBG,MAAM,CAAC;IAC3C,CAAC;IACDC,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAEC,gBAAqB,EAAE;MACzD,OAAOA,gBAAgB,CAACJ,OAAO,CAACK,MAAM,CAAC,UAACC,GAAQ,EAAEN,OAAY;QAAA,OAAKA,OAAO,CAACM,GAAG,CAAC;MAAA,GAAEH,KAAK,CAAC;IACzF;EACF,CAAC;AACH;AAAC,IAAAI,QAAA,GAEcZ,WAAW;AAAAa,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,16 @@
1
+ function Enhancement() {
2
+ return {
3
+ condition: function condition(Component) {
4
+ var _Component$enhance;
5
+ return Boolean((_Component$enhance = Component.enhance) === null || _Component$enhance === void 0 ? void 0 : _Component$enhance.length);
6
+ },
7
+ wrapperProps: function wrapperProps(props, WrapperComponent) {
8
+ return WrapperComponent.enhance.reduce(function(acc, enhance) {
9
+ return enhance(acc);
10
+ }, props);
11
+ }
12
+ };
13
+ }
14
+ export {
15
+ Enhancement as default
16
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhance.mjs","names":["Enhancement","condition","Component","_Component$enhance","Boolean","enhance","length","wrapperProps","props","WrapperComponent","reduce","acc"],"sources":["../../src/enhancement/enhance.tsx"],"sourcesContent":["function Enhancement() {\n return {\n condition: function (Component: any) {\n return Boolean(Component.enhance?.length);\n },\n wrapperProps: function (props: any, WrapperComponent: any) {\n return WrapperComponent.enhance.reduce((acc: any, enhance: any) => enhance(acc), props);\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":"AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAE;MAAA,IAAAC,kBAAA;MACnC,OAAOC,OAAO,EAAAD,kBAAA,GAACD,SAAS,CAACG,OAAO,cAAAF,kBAAA,uBAAjBA,kBAAA,CAAmBG,MAAM,CAAC;IAC3C,CAAC;IACDC,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAEC,gBAAqB,EAAE;MACzD,OAAOA,gBAAgB,CAACJ,OAAO,CAACK,MAAM,CAAC,UAACC,GAAQ,EAAEN,OAAY;QAAA,OAAKA,OAAO,CAACM,GAAG,CAAC;MAAA,GAAEH,KAAK,CAAC;IACzF;EACF,CAAC;AACH;AAEA,eAAeR,WAAW"}
@@ -0,0 +1,8 @@
1
+ declare function Enhancement(): {
2
+ condition: (Component: any) => boolean;
3
+ static: (WrapperComponent: any) => {
4
+ defaultProps: {};
5
+ };
6
+ wrapperProps: (props: any) => any;
7
+ };
8
+ export default Enhancement;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ function Enhancement() {
8
+ var defaultProps = {};
9
+ return {
10
+ condition: function condition(Component) {
11
+ if (!Component.defaultProps) {
12
+ return false;
13
+ }
14
+ if (typeof Component.defaultProps === 'function') {
15
+ return true;
16
+ }
17
+ return Boolean(Object.keys(Component.defaultProps).length);
18
+ },
19
+ "static": function _static(WrapperComponent) {
20
+ defaultProps = WrapperComponent.defaultProps;
21
+ return {
22
+ defaultProps: {}
23
+ };
24
+ },
25
+ wrapperProps: function wrapperProps(props) {
26
+ if (typeof defaultProps === 'function') {
27
+ // TODO: optimization
28
+ return Object.assign({}, defaultProps(props), props);
29
+ }
30
+ return Object.assign({}, defaultProps, props);
31
+ }
32
+ };
33
+ }
34
+ var _default = Enhancement;
35
+ exports["default"] = _default;
36
+ //# sourceMappingURL=functionDefaultProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functionDefaultProps.js","names":["Enhancement","defaultProps","condition","Component","Boolean","Object","keys","length","_static","WrapperComponent","wrapperProps","props","assign","_default","exports"],"sources":["../../src/enhancement/functionDefaultProps.tsx"],"sourcesContent":["function Enhancement() {\n let defaultProps = {};\n return {\n condition: function (Component: any) {\n if (!Component.defaultProps) {\n return false;\n }\n if (typeof Component.defaultProps === 'function') {\n return true;\n }\n return Boolean(Object.keys(Component.defaultProps).length);\n },\n static: function (WrapperComponent: any) {\n defaultProps = WrapperComponent.defaultProps;\n return {\n defaultProps: {},\n };\n },\n wrapperProps: function (props: any) {\n if (typeof defaultProps === 'function') {\n // TODO: optimization\n return Object.assign({}, defaultProps(props), props);\n }\n return Object.assign({}, defaultProps, props);\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;;AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,IAAIC,YAAY,GAAG,CAAC,CAAC;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAE;MACnC,IAAI,CAACA,SAAS,CAACF,YAAY,EAAE;QAC3B,OAAO,KAAK;MACd;MACA,IAAI,OAAOE,SAAS,CAACF,YAAY,KAAK,UAAU,EAAE;QAChD,OAAO,IAAI;MACb;MACA,OAAOG,OAAO,CAACC,MAAM,CAACC,IAAI,CAACH,SAAS,CAACF,YAAY,CAAC,CAACM,MAAM,CAAC;IAC5D,CAAC;IACD,UAAQ,SAAAC,QAAUC,gBAAqB,EAAE;MACvCR,YAAY,GAAGQ,gBAAgB,CAACR,YAAY;MAC5C,OAAO;QACLA,YAAY,EAAE,CAAC;MACjB,CAAC;IACH,CAAC;IACDS,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAE;MAClC,IAAI,OAAOV,YAAY,KAAK,UAAU,EAAE;QACtC;QACA,OAAOI,MAAM,CAACO,MAAM,CAAC,CAAC,CAAC,EAAEX,YAAY,CAACU,KAAK,CAAC,EAAEA,KAAK,CAAC;MACtD;MACA,OAAON,MAAM,CAACO,MAAM,CAAC,CAAC,CAAC,EAAEX,YAAY,EAAEU,KAAK,CAAC;IAC/C;EACF,CAAC;AACH;AAAC,IAAAE,QAAA,GAEcb,WAAW;AAAAc,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,29 @@
1
+ function Enhancement() {
2
+ var defaultProps = {};
3
+ return {
4
+ condition: function condition(Component) {
5
+ if (!Component.defaultProps) {
6
+ return false;
7
+ }
8
+ if (typeof Component.defaultProps === "function") {
9
+ return true;
10
+ }
11
+ return Boolean(Object.keys(Component.defaultProps).length);
12
+ },
13
+ "static": function _static(WrapperComponent) {
14
+ defaultProps = WrapperComponent.defaultProps;
15
+ return {
16
+ defaultProps: {}
17
+ };
18
+ },
19
+ wrapperProps: function wrapperProps(props) {
20
+ if (typeof defaultProps === "function") {
21
+ return Object.assign({}, defaultProps(props), props);
22
+ }
23
+ return Object.assign({}, defaultProps, props);
24
+ }
25
+ };
26
+ }
27
+ export {
28
+ Enhancement as default
29
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functionDefaultProps.mjs","names":["Enhancement","defaultProps","condition","Component","Boolean","Object","keys","length","_static","WrapperComponent","wrapperProps","props","assign"],"sources":["../../src/enhancement/functionDefaultProps.tsx"],"sourcesContent":["function Enhancement() {\n let defaultProps = {};\n return {\n condition: function (Component: any) {\n if (!Component.defaultProps) {\n return false;\n }\n if (typeof Component.defaultProps === 'function') {\n return true;\n }\n return Boolean(Object.keys(Component.defaultProps).length);\n },\n static: function (WrapperComponent: any) {\n defaultProps = WrapperComponent.defaultProps;\n return {\n defaultProps: {},\n };\n },\n wrapperProps: function (props: any) {\n if (typeof defaultProps === 'function') {\n // TODO: optimization\n return Object.assign({}, defaultProps(props), props);\n }\n return Object.assign({}, defaultProps, props);\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":"AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,IAAIC,YAAY,GAAG,CAAC,CAAC;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAE;MACnC,IAAI,CAACA,SAAS,CAACF,YAAY,EAAE;QAC3B,OAAO,KAAK;MACd;MACA,IAAI,OAAOE,SAAS,CAACF,YAAY,KAAK,UAAU,EAAE;QAChD,OAAO,IAAI;MACb;MACA,OAAOG,OAAO,CAACC,MAAM,CAACC,IAAI,CAACH,SAAS,CAACF,YAAY,CAAC,CAACM,MAAM,CAAC;IAC5D,CAAC;IACD,UAAQ,SAAAC,QAAUC,gBAAqB,EAAE;MACvCR,YAAY,GAAGQ,gBAAgB,CAACR,YAAY;MAC5C,OAAO;QACLA,YAAY,EAAE,CAAC;MACjB,CAAC;IACH,CAAC;IACDS,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAE;MAClC,IAAI,OAAOV,YAAY,KAAK,UAAU,EAAE;QACtC;QACA,OAAOI,MAAM,CAACO,MAAM,CAAC,CAAC,CAAC,EAAEX,YAAY,CAACU,KAAK,CAAC,EAAEA,KAAK,CAAC;MACtD;MACA,OAAON,MAAM,CAACO,MAAM,CAAC,CAAC,CAAC,EAAEX,YAAY,EAAEU,KAAK,CAAC;IAC/C;EACF,CAAC;AACH;AAEA,eAAeX,WAAW"}
@@ -0,0 +1,10 @@
1
+ export declare const HOIST_CONTEXT: unique symbol;
2
+ /** @deprecated Doesn't work in ssr and sometimes breakes rulles of hooks. We should never use it. */
3
+ declare function Enhancement(childComponents: any, Context: any): {
4
+ condition: (Component: any) => boolean;
5
+ init: (this: any, props: any, WrapperComponent: any, isFunction: boolean) => void;
6
+ context: (this: any, context: any) => any;
7
+ asProps: (this: any, props: any) => any;
8
+ wrapperProps: (props: any, WrapperComponent: any) => any;
9
+ };
10
+ export default Enhancement;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.HOIST_CONTEXT = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
+ var _react = _interopRequireDefault(require("react"));
13
+ var _assignProps = _interopRequireDefault(require("../utils/assignProps"));
14
+ var _useEnhancedEffect = _interopRequireDefault(require("../utils/use/useEnhancedEffect"));
15
+ var _pick = _interopRequireDefault(require("../utils/pick"));
16
+ var HOIST_CONTEXT = Symbol('HOIST_CONTEXT');
17
+ exports.HOIST_CONTEXT = HOIST_CONTEXT;
18
+ var HOIST_SELF = Symbol('HOIST_SELF');
19
+ var HOIST_SET = Symbol('HOIST_SET');
20
+ function flatChildComponent(childComponents) {
21
+ return Object.values(childComponents).reduce(function (acc, Component) {
22
+ if (Array.isArray(Component)) {
23
+ acc.push(Component[0]);
24
+ acc.push.apply(acc, (0, _toConsumableArray2["default"])(flatChildComponent(Component[1])));
25
+ } else {
26
+ acc.push(Component);
27
+ }
28
+ return acc;
29
+ }, []);
30
+ }
31
+
32
+ /** @deprecated Doesn't work in ssr and sometimes breakes rulles of hooks. We should never use it. */
33
+ function Enhancement(childComponents, Context) {
34
+ return {
35
+ condition: function condition(Component) {
36
+ return [Component].concat((0, _toConsumableArray2["default"])(flatChildComponent(childComponents))).some(function (Component) {
37
+ var _Component$hoistProps;
38
+ return Boolean((_Component$hoistProps = Component.hoistProps) === null || _Component$hoistProps === void 0 ? void 0 : _Component$hoistProps.length);
39
+ });
40
+ },
41
+ init: function init(props, WrapperComponent, isFunction) {
42
+ var _this = this;
43
+ if (isFunction) {
44
+ // TODO: might breake rules of hooks (by lsroman)
45
+ this[HOIST_SELF] = _react["default"].useState({});
46
+ } else {
47
+ this[HOIST_SELF] = [{}, function (obj) {
48
+ _this[HOIST_SELF][0] = obj;
49
+ _this.forceUpdate();
50
+ }];
51
+ }
52
+ // For optimization render
53
+ this[HOIST_SET] = function (obj) {
54
+ _this[HOIST_SELF][1](obj);
55
+ };
56
+ },
57
+ context: function context(_context) {
58
+ // TODO: need to optimizte container initialization (by lsroman)
59
+ // WrapperComponent.hoistProps
60
+ return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, _context), {}, (0, _defineProperty2["default"])({}, HOIST_CONTEXT, this[HOIST_SET]));
61
+ },
62
+ asProps: function asProps(props) {
63
+ // TODO: need to check for no props overwriting (by lsroman)
64
+ return (0, _assignProps["default"])(this[HOIST_SELF][0], props);
65
+ },
66
+ wrapperProps: function wrapperProps(props, WrapperComponent) {
67
+ var _WrapperComponent$hoi;
68
+ if ((_WrapperComponent$hoi = WrapperComponent.hoistProps) !== null && _WrapperComponent$hoi !== void 0 && _WrapperComponent$hoi.length) {
69
+ var context = _react["default"].useContext(Context);
70
+ var renameProps = WrapperComponent.hoistProps.reduce(function (acc, propName) {
71
+ var _propName$split = propName.split(':'),
72
+ _propName$split2 = (0, _slicedToArray2["default"])(_propName$split, 2),
73
+ name = _propName$split2[0],
74
+ rename = _propName$split2[1];
75
+ acc[name] = rename || name;
76
+ return acc;
77
+ }, {});
78
+ var hoistProps = Object.entries((0, _pick["default"])(props, Object.keys(renameProps))).reduce(function (acc, _ref) {
79
+ var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
80
+ name = _ref2[0],
81
+ value = _ref2[1];
82
+ acc[renameProps[name]] = value;
83
+ return acc;
84
+ }, {});
85
+ (0, _useEnhancedEffect["default"])(function () {
86
+ if (context[HOIST_CONTEXT]) {
87
+ context[HOIST_CONTEXT](hoistProps);
88
+ }
89
+ }, Object.values(hoistProps));
90
+ }
91
+ return props;
92
+ }
93
+ };
94
+ }
95
+ var _default = Enhancement;
96
+ exports["default"] = _default;
97
+ //# sourceMappingURL=hoistProps.js.map