@redneckz/wildless-cms-uni-blocks 0.9.10 → 0.9.12

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 (392) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +145 -66
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/Calculator/CalculatorContent.d.ts +18 -17
  5. package/bundle/components/Calculator/DepositCalculatorForm.d.ts +2 -2
  6. package/bundle/components/Calculator/rangeHelpers.d.ts +1 -0
  7. package/bundle/components/Calculator/renderMonthsInput.d.ts +1 -0
  8. package/bundle/components/Calculator/useDepositCalculatorParams.d.ts +3 -1
  9. package/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -6
  10. package/bundle/components/Filtration/FiltrationContent.d.ts +18 -8
  11. package/bundle/components/Footer/MediaButton.d.ts +3 -4
  12. package/bundle/content-page-repository/ContentPageRepository.d.ts +1 -5
  13. package/bundle/content-page-repository/alignImg.d.ts +9 -0
  14. package/bundle/content-page-repository/computeImgOutputPath.d.ts +3 -0
  15. package/bundle/content-page-repository/resizeImg.d.ts +3 -0
  16. package/bundle/content-page-repository/transformContentPage.d.ts +1 -0
  17. package/bundle/content-page-repository/transformImg.d.ts +6 -5
  18. package/bundle/content-page-repository/transformPicture.d.ts +1 -1
  19. package/bundle/ui-kit/InputListRange/InputListRange.d.ts +2 -0
  20. package/bundle/ui-kit/InputListRange/InputListRangeProps.d.ts +10 -0
  21. package/bundle/utils/arrayByRange.d.ts +1 -0
  22. package/bundle/utils/isPictureSizeEmpty.d.ts +2 -2
  23. package/bundle/utils/mergeIntervals.d.ts +1 -0
  24. package/dist/components/Calculator/CalculatorContent.d.ts +18 -17
  25. package/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
  26. package/dist/components/Calculator/DepositCalculatorForm.d.ts +2 -2
  27. package/dist/components/Calculator/DepositCalculatorForm.js +21 -11
  28. package/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
  29. package/dist/components/Calculator/constants.js +1 -1
  30. package/dist/components/Calculator/constants.js.map +1 -1
  31. package/dist/components/Calculator/rangeHelpers.d.ts +1 -0
  32. package/dist/components/Calculator/rangeHelpers.js +4 -1
  33. package/dist/components/Calculator/rangeHelpers.js.map +1 -1
  34. package/dist/components/Calculator/renderMonthsInput.d.ts +1 -0
  35. package/dist/components/Calculator/renderMonthsInput.js +3 -2
  36. package/dist/components/Calculator/renderMonthsInput.js.map +1 -1
  37. package/dist/components/Calculator/useCreditCalculatorParams.js +27 -29
  38. package/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  39. package/dist/components/Calculator/useDepositCalculatorParams.d.ts +3 -1
  40. package/dist/components/Calculator/useDepositCalculatorParams.js +22 -6
  41. package/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  42. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -6
  43. package/dist/components/Filtration/Filtration.js +1 -1
  44. package/dist/components/Filtration/Filtration.js.map +1 -1
  45. package/dist/components/Filtration/FiltrationContent.d.ts +18 -8
  46. package/dist/components/Filtration/FiltrationInner.js +9 -5
  47. package/dist/components/Filtration/FiltrationInner.js.map +1 -1
  48. package/dist/components/Filtration/renderFormItem.js +6 -5
  49. package/dist/components/Filtration/renderFormItem.js.map +1 -1
  50. package/dist/components/Footer/MediaButton.d.ts +3 -4
  51. package/dist/components/Footer/MediaButton.js.map +1 -1
  52. package/dist/content-page-repository/ContentPageRepository.d.ts +1 -5
  53. package/dist/content-page-repository/ContentPageRepository.js +7 -25
  54. package/dist/content-page-repository/ContentPageRepository.js.map +1 -1
  55. package/dist/content-page-repository/alignImg.d.ts +9 -0
  56. package/dist/content-page-repository/alignImg.js +23 -0
  57. package/dist/content-page-repository/alignImg.js.map +1 -0
  58. package/dist/content-page-repository/computeImgOutputPath.d.ts +3 -0
  59. package/dist/content-page-repository/computeImgOutputPath.js +18 -0
  60. package/dist/content-page-repository/computeImgOutputPath.js.map +1 -0
  61. package/dist/content-page-repository/resizeImg.d.ts +3 -0
  62. package/dist/content-page-repository/resizeImg.js +19 -0
  63. package/dist/content-page-repository/resizeImg.js.map +1 -0
  64. package/dist/content-page-repository/transformContentPage.d.ts +1 -0
  65. package/dist/content-page-repository/transformContentPage.js +25 -19
  66. package/dist/content-page-repository/transformContentPage.js.map +1 -1
  67. package/dist/content-page-repository/transformImg.d.ts +6 -5
  68. package/dist/content-page-repository/transformImg.js +26 -76
  69. package/dist/content-page-repository/transformImg.js.map +1 -1
  70. package/dist/content-page-repository/transformPicture.d.ts +1 -1
  71. package/dist/content-page-repository/transformPicture.js +8 -16
  72. package/dist/content-page-repository/transformPicture.js.map +1 -1
  73. package/dist/ui-kit/InputListRange/InputListRange.d.ts +2 -0
  74. package/dist/ui-kit/InputListRange/InputListRange.js +41 -0
  75. package/dist/ui-kit/InputListRange/InputListRange.js.map +1 -0
  76. package/dist/ui-kit/InputListRange/InputListRangeProps.d.ts +10 -0
  77. package/dist/ui-kit/InputListRange/InputListRangeProps.js +2 -0
  78. package/dist/ui-kit/InputListRange/InputListRangeProps.js.map +1 -0
  79. package/dist/ui-kit/Select/Select.js +2 -1
  80. package/dist/ui-kit/Select/Select.js.map +1 -1
  81. package/dist/utils/arrayByRange.d.ts +1 -0
  82. package/dist/utils/arrayByRange.js +5 -0
  83. package/dist/utils/arrayByRange.js.map +1 -0
  84. package/dist/utils/isPictureSizeEmpty.d.ts +2 -2
  85. package/dist/utils/isPictureSizeEmpty.js +1 -1
  86. package/dist/utils/isPictureSizeEmpty.js.map +1 -1
  87. package/dist/utils/mergeIntervals.d.ts +1 -0
  88. package/dist/utils/mergeIntervals.js +20 -0
  89. package/dist/utils/mergeIntervals.js.map +1 -0
  90. package/lib/common.css +1 -1
  91. package/lib/components/Calculator/CalculatorContent.d.ts +18 -17
  92. package/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
  93. package/lib/components/Calculator/DepositCalculatorForm.d.ts +2 -2
  94. package/lib/components/Calculator/DepositCalculatorForm.js +22 -12
  95. package/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
  96. package/lib/components/Calculator/constants.js +1 -1
  97. package/lib/components/Calculator/constants.js.map +1 -1
  98. package/lib/components/Calculator/rangeHelpers.d.ts +1 -0
  99. package/lib/components/Calculator/rangeHelpers.js +2 -0
  100. package/lib/components/Calculator/rangeHelpers.js.map +1 -1
  101. package/lib/components/Calculator/renderMonthsInput.d.ts +1 -0
  102. package/lib/components/Calculator/renderMonthsInput.js +3 -2
  103. package/lib/components/Calculator/renderMonthsInput.js.map +1 -1
  104. package/lib/components/Calculator/useCreditCalculatorParams.js +27 -29
  105. package/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  106. package/lib/components/Calculator/useDepositCalculatorParams.d.ts +3 -1
  107. package/lib/components/Calculator/useDepositCalculatorParams.js +22 -6
  108. package/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  109. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -6
  110. package/lib/components/Filtration/Filtration.js +1 -1
  111. package/lib/components/Filtration/Filtration.js.map +1 -1
  112. package/lib/components/Filtration/FiltrationContent.d.ts +18 -8
  113. package/lib/components/Filtration/FiltrationInner.js +9 -5
  114. package/lib/components/Filtration/FiltrationInner.js.map +1 -1
  115. package/lib/components/Filtration/renderFormItem.js +6 -5
  116. package/lib/components/Filtration/renderFormItem.js.map +1 -1
  117. package/lib/components/Footer/MediaButton.d.ts +3 -4
  118. package/lib/components/Footer/MediaButton.js.map +1 -1
  119. package/lib/content-page-repository/ContentPageRepository.d.ts +1 -5
  120. package/lib/content-page-repository/ContentPageRepository.js +8 -26
  121. package/lib/content-page-repository/ContentPageRepository.js.map +1 -1
  122. package/lib/content-page-repository/alignImg.d.ts +9 -0
  123. package/lib/content-page-repository/alignImg.js +17 -0
  124. package/lib/content-page-repository/alignImg.js.map +1 -0
  125. package/lib/content-page-repository/computeImgOutputPath.d.ts +3 -0
  126. package/lib/content-page-repository/computeImgOutputPath.js +12 -0
  127. package/lib/content-page-repository/computeImgOutputPath.js.map +1 -0
  128. package/lib/content-page-repository/resizeImg.d.ts +3 -0
  129. package/lib/content-page-repository/resizeImg.js +13 -0
  130. package/lib/content-page-repository/resizeImg.js.map +1 -0
  131. package/lib/content-page-repository/transformContentPage.d.ts +1 -0
  132. package/lib/content-page-repository/transformContentPage.js +23 -18
  133. package/lib/content-page-repository/transformContentPage.js.map +1 -1
  134. package/lib/content-page-repository/transformImg.d.ts +6 -5
  135. package/lib/content-page-repository/transformImg.js +26 -76
  136. package/lib/content-page-repository/transformImg.js.map +1 -1
  137. package/lib/content-page-repository/transformPicture.d.ts +1 -1
  138. package/lib/content-page-repository/transformPicture.js +8 -16
  139. package/lib/content-page-repository/transformPicture.js.map +1 -1
  140. package/lib/ui-kit/InputListRange/InputListRange.d.ts +2 -0
  141. package/lib/ui-kit/InputListRange/InputListRange.js +39 -0
  142. package/lib/ui-kit/InputListRange/InputListRange.js.map +1 -0
  143. package/lib/ui-kit/InputListRange/InputListRangeProps.d.ts +10 -0
  144. package/lib/ui-kit/InputListRange/InputListRangeProps.js +2 -0
  145. package/lib/ui-kit/InputListRange/InputListRangeProps.js.map +1 -0
  146. package/lib/ui-kit/Select/Select.js +2 -1
  147. package/lib/ui-kit/Select/Select.js.map +1 -1
  148. package/lib/utils/arrayByRange.d.ts +1 -0
  149. package/lib/utils/arrayByRange.js +2 -0
  150. package/lib/utils/arrayByRange.js.map +1 -0
  151. package/lib/utils/isPictureSizeEmpty.d.ts +2 -2
  152. package/lib/utils/isPictureSizeEmpty.js +1 -1
  153. package/lib/utils/isPictureSizeEmpty.js.map +1 -1
  154. package/lib/utils/mergeIntervals.d.ts +1 -0
  155. package/lib/utils/mergeIntervals.js +17 -0
  156. package/lib/utils/mergeIntervals.js.map +1 -0
  157. package/mobile/bundle/bundle.umd.js +1 -1
  158. package/mobile/bundle/bundle.umd.min.js +1 -1
  159. package/mobile/bundle/components/Calculator/CalculatorContent.d.ts +18 -17
  160. package/mobile/bundle/components/Calculator/DepositCalculatorForm.d.ts +2 -2
  161. package/mobile/bundle/components/Calculator/rangeHelpers.d.ts +1 -0
  162. package/mobile/bundle/components/Calculator/renderMonthsInput.d.ts +1 -0
  163. package/mobile/bundle/components/Calculator/useDepositCalculatorParams.d.ts +3 -1
  164. package/mobile/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -6
  165. package/mobile/bundle/components/Filtration/FiltrationContent.d.ts +18 -8
  166. package/mobile/bundle/components/Footer/MediaButton.d.ts +3 -4
  167. package/mobile/bundle/content-page-repository/ContentPageRepository.d.ts +1 -5
  168. package/mobile/bundle/content-page-repository/alignImg.d.ts +9 -0
  169. package/mobile/bundle/content-page-repository/computeImgOutputPath.d.ts +3 -0
  170. package/mobile/bundle/content-page-repository/resizeImg.d.ts +3 -0
  171. package/mobile/bundle/content-page-repository/transformContentPage.d.ts +1 -0
  172. package/mobile/bundle/content-page-repository/transformImg.d.ts +6 -5
  173. package/mobile/bundle/content-page-repository/transformPicture.d.ts +1 -1
  174. package/mobile/bundle/ui-kit/InputListRange/InputListRange.d.ts +2 -0
  175. package/mobile/bundle/ui-kit/InputListRange/InputListRangeProps.d.ts +10 -0
  176. package/mobile/bundle/utils/arrayByRange.d.ts +1 -0
  177. package/mobile/bundle/utils/isPictureSizeEmpty.d.ts +2 -2
  178. package/mobile/bundle/utils/mergeIntervals.d.ts +1 -0
  179. package/mobile/dist/components/Calculator/CalculatorContent.d.ts +18 -17
  180. package/mobile/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
  181. package/mobile/dist/components/Calculator/DepositCalculatorForm.d.ts +2 -2
  182. package/mobile/dist/components/Calculator/DepositCalculatorForm.js +21 -11
  183. package/mobile/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
  184. package/mobile/dist/components/Calculator/constants.js +1 -1
  185. package/mobile/dist/components/Calculator/constants.js.map +1 -1
  186. package/mobile/dist/components/Calculator/rangeHelpers.d.ts +1 -0
  187. package/mobile/dist/components/Calculator/rangeHelpers.js +4 -1
  188. package/mobile/dist/components/Calculator/rangeHelpers.js.map +1 -1
  189. package/mobile/dist/components/Calculator/renderMonthsInput.d.ts +1 -0
  190. package/mobile/dist/components/Calculator/renderMonthsInput.js +3 -2
  191. package/mobile/dist/components/Calculator/renderMonthsInput.js.map +1 -1
  192. package/mobile/dist/components/Calculator/useCreditCalculatorParams.js +27 -29
  193. package/mobile/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  194. package/mobile/dist/components/Calculator/useDepositCalculatorParams.d.ts +3 -1
  195. package/mobile/dist/components/Calculator/useDepositCalculatorParams.js +22 -6
  196. package/mobile/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  197. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -6
  198. package/mobile/dist/components/Filtration/Filtration.js +1 -1
  199. package/mobile/dist/components/Filtration/Filtration.js.map +1 -1
  200. package/mobile/dist/components/Filtration/FiltrationContent.d.ts +18 -8
  201. package/mobile/dist/components/Filtration/FiltrationInner.js +9 -5
  202. package/mobile/dist/components/Filtration/FiltrationInner.js.map +1 -1
  203. package/mobile/dist/components/Filtration/renderFormItem.js +6 -5
  204. package/mobile/dist/components/Filtration/renderFormItem.js.map +1 -1
  205. package/mobile/dist/components/Footer/MediaButton.d.ts +3 -4
  206. package/mobile/dist/components/Footer/MediaButton.js.map +1 -1
  207. package/mobile/dist/content-page-repository/ContentPageRepository.d.ts +1 -5
  208. package/mobile/dist/content-page-repository/ContentPageRepository.js +7 -25
  209. package/mobile/dist/content-page-repository/ContentPageRepository.js.map +1 -1
  210. package/mobile/dist/content-page-repository/alignImg.d.ts +9 -0
  211. package/mobile/dist/content-page-repository/alignImg.js +23 -0
  212. package/mobile/dist/content-page-repository/alignImg.js.map +1 -0
  213. package/mobile/dist/content-page-repository/computeImgOutputPath.d.ts +3 -0
  214. package/mobile/dist/content-page-repository/computeImgOutputPath.js +18 -0
  215. package/mobile/dist/content-page-repository/computeImgOutputPath.js.map +1 -0
  216. package/mobile/dist/content-page-repository/resizeImg.d.ts +3 -0
  217. package/mobile/dist/content-page-repository/resizeImg.js +19 -0
  218. package/mobile/dist/content-page-repository/resizeImg.js.map +1 -0
  219. package/mobile/dist/content-page-repository/transformContentPage.d.ts +1 -0
  220. package/mobile/dist/content-page-repository/transformContentPage.js +25 -19
  221. package/mobile/dist/content-page-repository/transformContentPage.js.map +1 -1
  222. package/mobile/dist/content-page-repository/transformImg.d.ts +6 -5
  223. package/mobile/dist/content-page-repository/transformImg.js +26 -76
  224. package/mobile/dist/content-page-repository/transformImg.js.map +1 -1
  225. package/mobile/dist/content-page-repository/transformPicture.d.ts +1 -1
  226. package/mobile/dist/content-page-repository/transformPicture.js +8 -16
  227. package/mobile/dist/content-page-repository/transformPicture.js.map +1 -1
  228. package/mobile/dist/ui-kit/InputListRange/InputListRange.d.ts +2 -0
  229. package/mobile/dist/ui-kit/InputListRange/InputListRange.js +41 -0
  230. package/mobile/dist/ui-kit/InputListRange/InputListRange.js.map +1 -0
  231. package/mobile/dist/ui-kit/InputListRange/InputListRangeProps.d.ts +10 -0
  232. package/mobile/dist/ui-kit/InputListRange/InputListRangeProps.js +2 -0
  233. package/mobile/dist/ui-kit/InputListRange/InputListRangeProps.js.map +1 -0
  234. package/mobile/dist/ui-kit/Select/Select.js +2 -1
  235. package/mobile/dist/ui-kit/Select/Select.js.map +1 -1
  236. package/mobile/dist/utils/arrayByRange.d.ts +1 -0
  237. package/mobile/dist/utils/arrayByRange.js +5 -0
  238. package/mobile/dist/utils/arrayByRange.js.map +1 -0
  239. package/mobile/dist/utils/isPictureSizeEmpty.d.ts +2 -2
  240. package/mobile/dist/utils/isPictureSizeEmpty.js +1 -1
  241. package/mobile/dist/utils/isPictureSizeEmpty.js.map +1 -1
  242. package/mobile/dist/utils/mergeIntervals.d.ts +1 -0
  243. package/mobile/dist/utils/mergeIntervals.js +20 -0
  244. package/mobile/dist/utils/mergeIntervals.js.map +1 -0
  245. package/mobile/lib/components/Calculator/CalculatorContent.d.ts +18 -17
  246. package/mobile/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
  247. package/mobile/lib/components/Calculator/DepositCalculatorForm.d.ts +2 -2
  248. package/mobile/lib/components/Calculator/DepositCalculatorForm.js +22 -12
  249. package/mobile/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
  250. package/mobile/lib/components/Calculator/constants.js +1 -1
  251. package/mobile/lib/components/Calculator/constants.js.map +1 -1
  252. package/mobile/lib/components/Calculator/rangeHelpers.d.ts +1 -0
  253. package/mobile/lib/components/Calculator/rangeHelpers.js +2 -0
  254. package/mobile/lib/components/Calculator/rangeHelpers.js.map +1 -1
  255. package/mobile/lib/components/Calculator/renderMonthsInput.d.ts +1 -0
  256. package/mobile/lib/components/Calculator/renderMonthsInput.js +3 -2
  257. package/mobile/lib/components/Calculator/renderMonthsInput.js.map +1 -1
  258. package/mobile/lib/components/Calculator/useCreditCalculatorParams.js +27 -29
  259. package/mobile/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  260. package/mobile/lib/components/Calculator/useDepositCalculatorParams.d.ts +3 -1
  261. package/mobile/lib/components/Calculator/useDepositCalculatorParams.js +22 -6
  262. package/mobile/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  263. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -6
  264. package/mobile/lib/components/Filtration/Filtration.js +1 -1
  265. package/mobile/lib/components/Filtration/Filtration.js.map +1 -1
  266. package/mobile/lib/components/Filtration/FiltrationContent.d.ts +18 -8
  267. package/mobile/lib/components/Filtration/FiltrationInner.js +9 -5
  268. package/mobile/lib/components/Filtration/FiltrationInner.js.map +1 -1
  269. package/mobile/lib/components/Filtration/renderFormItem.js +6 -5
  270. package/mobile/lib/components/Filtration/renderFormItem.js.map +1 -1
  271. package/mobile/lib/components/Footer/MediaButton.d.ts +3 -4
  272. package/mobile/lib/components/Footer/MediaButton.js.map +1 -1
  273. package/mobile/lib/content-page-repository/ContentPageRepository.d.ts +1 -5
  274. package/mobile/lib/content-page-repository/ContentPageRepository.js +8 -26
  275. package/mobile/lib/content-page-repository/ContentPageRepository.js.map +1 -1
  276. package/mobile/lib/content-page-repository/alignImg.d.ts +9 -0
  277. package/mobile/lib/content-page-repository/alignImg.js +17 -0
  278. package/mobile/lib/content-page-repository/alignImg.js.map +1 -0
  279. package/mobile/lib/content-page-repository/computeImgOutputPath.d.ts +3 -0
  280. package/mobile/lib/content-page-repository/computeImgOutputPath.js +12 -0
  281. package/mobile/lib/content-page-repository/computeImgOutputPath.js.map +1 -0
  282. package/mobile/lib/content-page-repository/resizeImg.d.ts +3 -0
  283. package/mobile/lib/content-page-repository/resizeImg.js +13 -0
  284. package/mobile/lib/content-page-repository/resizeImg.js.map +1 -0
  285. package/mobile/lib/content-page-repository/transformContentPage.d.ts +1 -0
  286. package/mobile/lib/content-page-repository/transformContentPage.js +23 -18
  287. package/mobile/lib/content-page-repository/transformContentPage.js.map +1 -1
  288. package/mobile/lib/content-page-repository/transformImg.d.ts +6 -5
  289. package/mobile/lib/content-page-repository/transformImg.js +26 -76
  290. package/mobile/lib/content-page-repository/transformImg.js.map +1 -1
  291. package/mobile/lib/content-page-repository/transformPicture.d.ts +1 -1
  292. package/mobile/lib/content-page-repository/transformPicture.js +8 -16
  293. package/mobile/lib/content-page-repository/transformPicture.js.map +1 -1
  294. package/mobile/lib/ui-kit/InputListRange/InputListRange.d.ts +2 -0
  295. package/mobile/lib/ui-kit/InputListRange/InputListRange.js +39 -0
  296. package/mobile/lib/ui-kit/InputListRange/InputListRange.js.map +1 -0
  297. package/mobile/lib/ui-kit/InputListRange/InputListRangeProps.d.ts +10 -0
  298. package/mobile/lib/ui-kit/InputListRange/InputListRangeProps.js +2 -0
  299. package/mobile/lib/ui-kit/InputListRange/InputListRangeProps.js.map +1 -0
  300. package/mobile/lib/ui-kit/Select/Select.js +2 -1
  301. package/mobile/lib/ui-kit/Select/Select.js.map +1 -1
  302. package/mobile/lib/utils/arrayByRange.d.ts +1 -0
  303. package/mobile/lib/utils/arrayByRange.js +2 -0
  304. package/mobile/lib/utils/arrayByRange.js.map +1 -0
  305. package/mobile/lib/utils/isPictureSizeEmpty.d.ts +2 -2
  306. package/mobile/lib/utils/isPictureSizeEmpty.js +1 -1
  307. package/mobile/lib/utils/isPictureSizeEmpty.js.map +1 -1
  308. package/mobile/lib/utils/mergeIntervals.d.ts +1 -0
  309. package/mobile/lib/utils/mergeIntervals.js +17 -0
  310. package/mobile/lib/utils/mergeIntervals.js.map +1 -0
  311. package/mobile/src/components/Calculator/Calculator.example.json +3 -1
  312. package/mobile/src/components/Calculator/CalculatorContent.ts +20 -19
  313. package/mobile/src/components/Calculator/CreditCalculatorForm.tsx +6 -7
  314. package/mobile/src/components/Calculator/DepositCalculatorForm.tsx +48 -15
  315. package/mobile/src/components/Calculator/constants.ts +1 -1
  316. package/mobile/src/components/Calculator/rangeHelpers.ts +10 -0
  317. package/mobile/src/components/Calculator/renderMonthsInput.tsx +13 -2
  318. package/mobile/src/components/Calculator/useCreditCalculatorParams.ts +8 -10
  319. package/mobile/src/components/Calculator/useDepositCalculatorParams.ts +36 -9
  320. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +1 -2
  321. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +2 -8
  322. package/mobile/src/components/Filtration/Filtration.example.json +39 -19
  323. package/mobile/src/components/Filtration/Filtration.tsx +3 -8
  324. package/mobile/src/components/Filtration/FiltrationContent.ts +19 -8
  325. package/mobile/src/components/Filtration/FiltrationInner.tsx +31 -12
  326. package/mobile/src/components/Filtration/renderFormItem.tsx +20 -20
  327. package/mobile/src/components/Footer/MediaButton.tsx +3 -5
  328. package/mobile/src/components/RichTextBlock/RichTextBlock.example.json +1 -1
  329. package/mobile/src/content-page-repository/ContentPageRepository.ts +8 -40
  330. package/mobile/src/content-page-repository/alignImg.ts +32 -0
  331. package/mobile/src/content-page-repository/computeImgOutputPath.ts +20 -0
  332. package/mobile/src/content-page-repository/resizeImg.ts +18 -0
  333. package/mobile/src/content-page-repository/transformContentPage.ts +25 -18
  334. package/mobile/src/content-page-repository/transformImg.ts +49 -121
  335. package/mobile/src/content-page-repository/transformPicture.ts +9 -21
  336. package/mobile/src/ui-kit/InputListRange/InputListRange.tsx +99 -0
  337. package/mobile/src/ui-kit/InputListRange/InputListRangeProps.ts +11 -0
  338. package/mobile/src/ui-kit/Select/Select.tsx +8 -1
  339. package/mobile/src/utils/arrayByRange.ts +4 -0
  340. package/mobile/src/utils/isPictureSizeEmpty.ts +3 -3
  341. package/mobile/src/utils/mergeIntervals.ts +19 -0
  342. package/package.json +1 -1
  343. package/src/components/Calculator/Calculator.example.json +3 -1
  344. package/src/components/Calculator/Calculator.fixture.tsx +4 -0
  345. package/src/components/Calculator/CalculatorContent.ts +20 -19
  346. package/src/components/Calculator/CreditCalculatorForm.tsx +6 -7
  347. package/src/components/Calculator/DepositCalculatorForm.tsx +48 -15
  348. package/src/components/Calculator/constants.ts +1 -1
  349. package/src/components/Calculator/rangeHelpers.ts +10 -0
  350. package/src/components/Calculator/renderMonthsInput.tsx +13 -2
  351. package/src/components/Calculator/useCreditCalculatorParams.ts +8 -10
  352. package/src/components/Calculator/useDepositCalculatorParams.ts +36 -9
  353. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +1 -2
  354. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.tsx +0 -9
  355. package/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +2 -8
  356. package/src/components/Filtration/Filtration.example.json +39 -19
  357. package/src/components/Filtration/Filtration.fixture.tsx +36 -20
  358. package/src/components/Filtration/Filtration.tsx +3 -8
  359. package/src/components/Filtration/FiltrationContent.ts +19 -8
  360. package/src/components/Filtration/FiltrationInner.tsx +31 -12
  361. package/src/components/Filtration/renderFormItem.tsx +20 -20
  362. package/src/components/Footer/MediaButton.tsx +3 -5
  363. package/src/components/RichTextBlock/RichTextBlock.example.json +1 -1
  364. package/src/content-page-repository/ContentPageRepository.ts +8 -40
  365. package/src/content-page-repository/alignImg.ts +32 -0
  366. package/src/content-page-repository/computeImgOutputPath.ts +20 -0
  367. package/src/content-page-repository/resizeImg.ts +18 -0
  368. package/src/content-page-repository/transformContentPage.ts +25 -18
  369. package/src/content-page-repository/transformImg.ts +49 -121
  370. package/src/content-page-repository/transformPicture.ts +9 -21
  371. package/src/ui-kit/InputListRange/InputListRange.tsx +99 -0
  372. package/src/ui-kit/InputListRange/InputListRangeProps.ts +11 -0
  373. package/src/ui-kit/Select/Select.tsx +8 -1
  374. package/src/utils/arrayByRange.ts +4 -0
  375. package/src/utils/isPictureSizeEmpty.ts +3 -3
  376. package/src/utils/mergeIntervals.ts +19 -0
  377. package/bundle/content-page-repository/transformImgPath.d.ts +0 -8
  378. package/dist/content-page-repository/transformImgPath.d.ts +0 -8
  379. package/dist/content-page-repository/transformImgPath.js +0 -22
  380. package/dist/content-page-repository/transformImgPath.js.map +0 -1
  381. package/lib/content-page-repository/transformImgPath.d.ts +0 -8
  382. package/lib/content-page-repository/transformImgPath.js +0 -16
  383. package/lib/content-page-repository/transformImgPath.js.map +0 -1
  384. package/mobile/bundle/content-page-repository/transformImgPath.d.ts +0 -8
  385. package/mobile/dist/content-page-repository/transformImgPath.d.ts +0 -8
  386. package/mobile/dist/content-page-repository/transformImgPath.js +0 -22
  387. package/mobile/dist/content-page-repository/transformImgPath.js.map +0 -1
  388. package/mobile/lib/content-page-repository/transformImgPath.d.ts +0 -8
  389. package/mobile/lib/content-page-repository/transformImgPath.js +0 -16
  390. package/mobile/lib/content-page-repository/transformImgPath.js.map +0 -1
  391. package/mobile/src/content-page-repository/transformImgPath.ts +0 -30
  392. package/src/content-page-repository/transformImgPath.ts +0 -30
@@ -1,26 +1,16 @@
1
+ import fs from 'fs';
1
2
  import glob from 'glob';
2
3
  import util from 'util';
3
4
  import type { ContentPageDef } from '../model/ContentPageDef';
4
5
  import type { TransformationOptions } from './TransformationOptions';
5
- import { transformContentPage } from './transformContentPage';
6
+ import { generatedPagePath, transformContentPage } from './transformContentPage';
6
7
 
7
- const INDEX_PAGE_SLUG = 'index';
8
8
  const find = util.promisify(glob);
9
-
10
- const bySlug = (slug: string) => (content: ContentPageDef) => content.slug === slug;
11
- const byCustomPageType = (type?: string) => (content: ContentPageDef) =>
12
- type ? content._customPageType === type : !content._customPageType;
13
-
14
- const not =
15
- <Arg>(predicate: (_: Arg) => boolean) =>
16
- (_: Arg) =>
17
- !predicate(_);
9
+ const readFile = util.promisify(fs.readFile);
18
10
 
19
11
  export class ContentPageRepository {
20
12
  public static readonly inst = new ContentPageRepository();
21
13
 
22
- private cache: Record<string, ContentPageDef> = {};
23
-
24
14
  constructor(
25
15
  private readonly options: TransformationOptions = {
26
16
  contentDir: 'content',
@@ -28,37 +18,15 @@ export class ContentPageRepository {
28
18
  },
29
19
  ) {}
30
20
 
31
- async listAllContentPages(): Promise<string[]> {
21
+ listAllContentPages(): Promise<string[]> {
32
22
  return find(`${this.options.contentDir}/**/*.page.json`);
33
23
  }
34
24
 
35
- async getAllContentPages(): Promise<ContentPageDef[]> {
36
- const pagePaths = await this.listAllContentPages();
37
-
38
- return Promise.all(pagePaths.map((_) => this.readPage(_)));
39
- }
40
-
41
- async getSecondaryContentPages(customPageType?: string): Promise<ContentPageDef[]> {
42
- const pages = await this.getAllContentPages();
43
-
44
- return pages.filter(not(bySlug(INDEX_PAGE_SLUG))).filter(byCustomPageType(customPageType));
45
- }
46
-
47
- async getContentPageBySlug(slug: string): Promise<ContentPageDef | undefined> {
48
- const pages = await this.getAllContentPages();
49
-
50
- return pages.find(bySlug(slug));
51
- }
52
-
53
- async getIndexPage(): Promise<ContentPageDef | undefined> {
54
- return this.getContentPageBySlug(INDEX_PAGE_SLUG);
55
- }
56
-
57
25
  async readPage(filePath: string): Promise<ContentPageDef> {
58
- if (!(filePath in this.cache)) {
59
- this.cache[filePath] = await transformContentPage(filePath, this.options);
60
- }
26
+ return JSON.parse(await readFile(generatedPagePath(filePath), 'utf-8'));
27
+ }
61
28
 
62
- return this.cache[filePath];
29
+ generatePage(filePath: string): Promise<ContentPageDef> {
30
+ return transformContentPage(filePath, this.options);
63
31
  }
64
32
  }
@@ -0,0 +1,32 @@
1
+ import type { Sharp } from 'sharp';
2
+ import sharp from 'sharp';
3
+ import type { ImageSize } from '../model/ImageSize';
4
+ import type { ImgAlignment } from '../model/Picture';
5
+
6
+ interface ImgAlignmentParams {
7
+ containerSize?: Partial<ImageSize>;
8
+ alignment?: ImgAlignment;
9
+ }
10
+
11
+ export const alignImg =
12
+ ({ containerSize, alignment }: ImgAlignmentParams) =>
13
+ async (chain: Sharp): Promise<Sharp> =>
14
+ containerSize?.width && containerSize?.height && alignment
15
+ ? createTransparentBack(containerSize as ImageSize).composite([
16
+ {
17
+ input: await toBuffer(chain),
18
+ gravity: alignment,
19
+ },
20
+ ])
21
+ : chain;
22
+
23
+ const toBuffer = async (chain: Sharp) => (await chain.toBuffer({ resolveWithObject: true })).data;
24
+
25
+ function createTransparentBack({ width, height }: ImageSize) {
26
+ const channels = 4;
27
+ const rgbaColor = 0x00000000;
28
+
29
+ const canvas = Buffer.alloc(width * height * channels, rgbaColor);
30
+
31
+ return sharp(canvas, { raw: { width, height, channels } });
32
+ }
@@ -0,0 +1,20 @@
1
+ import path from 'path';
2
+ import type { ImgSource } from '../model/Picture';
3
+ import type { TransformationOptions } from './TransformationOptions';
4
+
5
+ export function computeImgOutputPath(
6
+ imgInputPath: string,
7
+ { contentDir, publicDir, format, size, alignment }: TransformationOptions & ImgSource,
8
+ ): string {
9
+ const imgRelativePath = path.relative(contentDir, imgInputPath);
10
+
11
+ const imgDir = path.dirname(imgRelativePath);
12
+
13
+ const inputExt = path.extname(imgRelativePath);
14
+ const fileName = path.basename(imgRelativePath, inputExt);
15
+ const suffixParts = [size?.width, size?.height, alignment].filter(Boolean);
16
+ const suffix = suffixParts.length ? `-${suffixParts.join('-')}` : '';
17
+ const ext = format ? `.${format}` : inputExt;
18
+
19
+ return path.join(publicDir, imgDir, `${fileName}${suffix}${ext}`);
20
+ }
@@ -0,0 +1,18 @@
1
+ import type { ResizeOptions, Sharp } from 'sharp';
2
+ import sharp from 'sharp';
3
+ import type { ImageSize } from '../model/ImageSize';
4
+
5
+ export const resizeImg =
6
+ (size?: Partial<ImageSize>, options?: ResizeOptions) =>
7
+ (chain: Sharp): Sharp =>
8
+ size
9
+ ? chain.resize(size.width || null, size.height || null, {
10
+ /*
11
+ * Editor behaviour with one dimension present: resize by given dimension maintaining aspect ratio. (fit: contain)
12
+ * With two dimensions present: resize trying to fill given dimensions (fit: fill)
13
+ */
14
+ fit: size.width && size.height ? sharp.fit.fill : sharp.fit.contain,
15
+ background: { r: 0, g: 0, b: 0, alpha: 0 },
16
+ ...options,
17
+ })
18
+ : chain;
@@ -9,6 +9,9 @@ import { transformMarkdown } from './transformMarkdown';
9
9
  import { transformPicture } from './transformPicture';
10
10
 
11
11
  const readFile = util.promisify(fs.readFile);
12
+ const writeFile = util.promisify(fs.writeFile);
13
+
14
+ const OUTPUT_SUFFIX = '.static';
12
15
 
13
16
  export async function transformContentPage(
14
17
  pagePath: string,
@@ -17,31 +20,35 @@ export async function transformContentPage(
17
20
  const content = await readFile(pagePath, 'utf8');
18
21
 
19
22
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
20
- return mapJSON<ContentPageDef>(JSON.parse(content), async (value: any, [key]) => {
21
- const isMarkdown = typeof value === 'string' && key?.endsWith('__md');
22
- const isHTML = typeof value === 'string' && key?.endsWith('__html');
23
-
24
- if (isMarkdown) {
25
- return await transformMarkdown(value);
26
- } else if (isHTML) {
27
- return await transformHTML(value);
28
- } else if (isPicture(value)) {
29
- try {
30
- return await transformPicture(pagePath, value, options);
31
- } catch (ex) {
32
- console.warn('Error while transforming picture on page: %s', pagePath);
33
- console.error(ex);
23
+ const result = await mapJSON<ContentPageDef>(JSON.parse(content), async (value: any, [key]) => {
24
+ const isMarkdown = isString(value) && key?.endsWith('__md');
25
+ const isHTML = isString(value) && key?.endsWith('__html');
26
+
27
+ try {
28
+ if (isMarkdown) {
29
+ return await transformMarkdown(value);
30
+ } else if (isHTML) {
31
+ return await transformHTML(value);
32
+ } else if (isPicture(value)) {
33
+ return await transformPicture(value, pagePath, options);
34
34
  }
35
+ } catch (ex) {
36
+ console.warn(`Error while transforming field "${key}" on page: ${pagePath}`);
37
+ console.error(ex);
35
38
  }
36
39
 
37
40
  return value;
38
41
  });
39
- }
40
42
 
41
- const isLocalPath = (_: any): boolean => isString(_) && _.length < 512 && !isURL(_);
43
+ await writeFile(generatedPagePath(pagePath), JSON.stringify(result), 'utf-8');
42
44
 
43
- const isString = (_: any): _ is string => Boolean(_ && typeof _ === 'string');
45
+ return result;
46
+ }
44
47
 
45
- const isURL = (src: string) => ['data:', 'https:', 'http:'].some((proto) => src.startsWith(proto));
48
+ export const generatedPagePath = (pagePath: string) => `${pagePath}${OUTPUT_SUFFIX}`;
46
49
 
47
50
  const isPicture = (_: any): _ is Picture => Boolean(_ && isLocalPath(_?.src));
51
+ const isLocalPath = (_: any): boolean => isString(_) && _.length < 1024 && !isURL(_);
52
+ const isURL = (src: string) => ['data:', 'https:', 'http:'].some((proto) => src.startsWith(proto));
53
+
54
+ const isString = (_: any): _ is string => Boolean(_ && typeof _ === 'string');
@@ -1,146 +1,74 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import type { ResizeOptions, Sharp } from 'sharp';
4
- import sharp from 'sharp';
3
+ import sharp, { type Sharp } from 'sharp';
5
4
  import util from 'util';
6
5
  import type { ImageSize } from '../model/ImageSize';
7
- import type { ImgAlignment, ImgSource, Picture } from '../model/Picture';
6
+ import type { ImgSource } from '../model/Picture';
8
7
  import { isPictureSizeEmpty } from '../utils/isPictureSizeEmpty';
8
+ import { alignImg } from './alignImg';
9
+ import { computeImgOutputPath } from './computeImgOutputPath';
10
+ import { resizeImg } from './resizeImg';
9
11
  import type { TransformationOptions } from './TransformationOptions';
10
- import { transformImgPath } from './transformImgPath';
11
12
 
12
13
  const mkdir = util.promisify(fs.mkdir);
13
14
 
14
- type TransformImgParams = {
15
- pagePath: string;
16
- src: string;
17
- containerSize?: ImageSize;
18
- transformationOptions: TransformationOptions & ImgSource;
19
- };
15
+ type ImgOutputPath = string;
16
+ type TransformationTaskKey = ImgOutputPath;
17
+ type TransformationTasksCache = Map<TransformationTaskKey, Promise<ImgOutputPath>>;
20
18
 
21
- export async function transformImg({
22
- pagePath,
23
- src,
24
- containerSize,
25
- transformationOptions,
26
- }: TransformImgParams): Promise<string> {
27
- if (!src) {
28
- return '';
29
- }
30
-
31
- const { contentDir, publicDir, format, options, size, alignment } = transformationOptions;
32
-
33
- const pageDir = path.dirname(pagePath);
34
- const imgPath = `${pageDir}/${src}`;
35
- let chain = sharp(imgPath);
36
-
37
- const targetSize = getPictureSize(size, containerSize);
38
-
39
- if (targetSize) {
40
- chain = resizeImg(chain, targetSize, getResizeFit(targetSize));
41
- }
42
-
43
- if (containerSize) {
44
- chain = resizeImg(chain, containerSize);
45
-
46
- // Save intermediate transform result to modify further
47
- const { data } = await chain.toBuffer({ resolveWithObject: true });
48
-
49
- chain = resizeImg(
50
- sharp(data),
51
- getCompositionResizeSize(containerSize, targetSize),
52
- getResizeFit(targetSize),
53
- );
19
+ type TransformImgOptions = TransformationOptions &
20
+ ImgSource & { containerSize?: ImageSize; cache?: TransformationTasksCache };
54
21
 
55
- chain = await compositeImg({ chain, containerSize, alignment });
56
- }
22
+ const defaultTransformationCache: TransformationTasksCache = new Map();
57
23
 
58
- if (format) {
59
- chain = chain.toFormat(format, options);
24
+ export function transformImg(
25
+ src: string,
26
+ pagePath: string,
27
+ options: TransformImgOptions,
28
+ ): ImgOutputPath | Promise<ImgOutputPath> {
29
+ if (!src) {
30
+ return '';
60
31
  }
61
32
 
62
- const transformedImgPath = transformImgPath(src, { pageDir, contentDir }, transformationOptions);
63
- const imgPublicPath = path.join(publicDir, transformedImgPath);
33
+ const input = path.join(path.dirname(pagePath), src);
34
+ const output = computeImgOutputPath(input, options);
64
35
 
65
- await mkdir(path.dirname(imgPublicPath), { recursive: true });
36
+ const { cache = defaultTransformationCache } = options;
66
37
 
67
- try {
68
- await chain.toFile(imgPublicPath);
69
- } catch (e) {
70
- console.error(e);
38
+ const cachedResult = cache.get(output);
39
+ if (cachedResult) {
40
+ return cachedResult;
71
41
  }
72
42
 
73
- return transformedImgPath;
74
- }
43
+ const result = (async () => {
44
+ try {
45
+ await mkdir(path.dirname(output), { recursive: true });
75
46
 
76
- function createBackgroundImageChain({ width, height }: ImageSize) {
77
- const channels = 4;
78
- const rgbaColor = 0x00000000;
47
+ const chain = await computeTransformationChain(options)(sharp(input));
48
+ await chain.toFile(output);
49
+ } catch (e) {
50
+ console.error(e);
51
+ }
79
52
 
80
- const canvas = Buffer.alloc(width * height * channels, rgbaColor);
53
+ return output;
54
+ })();
55
+ cache.set(output, result);
81
56
 
82
- return sharp(canvas, { raw: { width, height, channels } });
57
+ return result;
83
58
  }
84
59
 
85
- function resizeImg(chain: Sharp, size: Picture['size'], options?: ResizeOptions) {
86
- return chain.resize(size?.width || null, size?.height || null, {
87
- fit: sharp.fit.fill,
88
- background: { r: 0, g: 0, b: 0, alpha: 0 },
89
- ...options,
90
- });
91
- }
92
-
93
- type CompositeImgParams = {
94
- chain: Sharp;
95
- containerSize: ImageSize;
96
- alignment?: ImgAlignment;
97
- };
98
-
99
- async function compositeImg({
100
- chain,
60
+ const computeTransformationChain = ({
61
+ size,
101
62
  containerSize,
102
63
  alignment,
103
- }: CompositeImgParams): Promise<Sharp> {
104
- const { data } = await chain.toBuffer({ resolveWithObject: true });
105
-
106
- return createBackgroundImageChain(containerSize).composite([
107
- {
108
- input: data,
109
- gravity: alignment,
110
- },
111
- ]);
112
- }
113
-
114
- function getPictureSize(size: Picture['size'], containerSize?: ImageSize) {
115
- // If containerSize is undefined intrinsic dimensions of image will be used then.
116
- return isPictureSizeEmpty(size) ? containerSize : size;
117
- }
118
-
119
- function getCompositionResizeSize(
120
- containerSize: ImageSize,
121
- size: Picture['size'] = {},
122
- ): Picture['size'] {
123
- const { width, height } = size;
124
- const { width: containerWidth, height: containerHeight } = containerSize;
125
-
126
- if (!(width || height)) {
127
- return undefined;
128
- }
129
-
130
- const widthRatio = width ? containerWidth / width : 0;
131
- const heightRatio = height ? containerHeight / height : 0;
132
-
133
- return widthRatio > heightRatio
134
- ? { width: Math.min(Number(width), containerWidth) }
135
- : { height: Math.min(Number(height), containerHeight) };
136
- }
137
-
138
- function getResizeFit(size: Picture['size']): ResizeOptions {
139
- /*
140
- Editor behaviour with one dimension present: resize by given dimension maintaining aspect ratio. (fit: contain)
141
- With two dimensions present: resize trying to fill given dimensions (fit: fill)
142
- */
143
- return {
144
- fit: size?.width && size?.height ? sharp.fit.fill : sharp.fit.contain,
145
- };
146
- }
64
+ format,
65
+ options,
66
+ }: TransformImgOptions) =>
67
+ pipe(
68
+ resizeImg(isPictureSizeEmpty(size) ? containerSize : size),
69
+ alignImg({ containerSize, alignment }),
70
+ (_) => (format ? _.toFormat(format, options) : _),
71
+ );
72
+
73
+ const pipe = (...operations: Array<(chain: Sharp) => Promise<Sharp> | Sharp>) =>
74
+ operations.reduce((a, b) => async (chain: Sharp) => b(await a(chain)));
@@ -5,42 +5,30 @@ import type { TransformationOptions } from './TransformationOptions';
5
5
  import { transformImg } from './transformImg';
6
6
 
7
7
  export async function transformPicture(
8
- pagePath: string,
9
8
  picture: Picture,
9
+ pagePath: string,
10
10
  options: TransformationOptions,
11
11
  ): Promise<Picture> {
12
- const sources = picture.sources || [];
13
12
  const src = picture?.src || '';
14
13
 
15
- const transformedPicture = await transformImg({
16
- pagePath,
17
- src,
18
- transformationOptions: { ...options, ...picture },
19
- });
20
-
21
- const { width, height } = await sharp(
22
- path.resolve(options.publicDir, transformedPicture),
23
- ).metadata();
14
+ const transformedImgPath = await transformImg(src, pagePath, { ...options, ...picture });
24
15
 
16
+ const { width, height } = await sharp(transformedImgPath).metadata();
25
17
  const containerSize = width && height ? { width, height } : undefined;
26
18
 
19
+ const sources = picture.sources || [];
27
20
  const transformedSources = await Promise.all(
28
- sources.map((_) =>
29
- transformImg({
30
- pagePath,
31
- src,
32
- containerSize,
33
- transformationOptions: { ...options, ..._ },
34
- }),
35
- ),
21
+ sources.map((_) => transformImg(src, pagePath, { ...options, ..._, containerSize })),
36
22
  );
37
23
 
24
+ const imgPathToSrc = (_: string) => path.join('/', path.relative(options.publicDir, _));
25
+
38
26
  return {
39
27
  ...picture,
40
- src: path.join('/', transformedPicture),
28
+ src: imgPathToSrc(transformedImgPath),
41
29
  sources: transformedSources.map((_, i) => ({
42
30
  ...sources[i],
43
- src: path.join('/', _),
31
+ src: imgPathToSrc(_),
44
32
  size: { width, height },
45
33
  })),
46
34
  };
@@ -0,0 +1,99 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers';
3
+ import { clamp } from '../../utils/clamp';
4
+ import { getSanitizedValue } from '../../utils/getSanitizedValue';
5
+ import type { InputListRangeProps } from './InputListRangeProps';
6
+
7
+ const DISABLED_INPUT_CLASSES = 'disabled:border-gray disabled:bg-main-divider';
8
+
9
+ export const InputListRange = JSX<InputListRangeProps>(
10
+ ({ className, title, items = [], list = [], value = list[0], disabled = false, onChange }) => {
11
+ const min = 0;
12
+ const max = list.length - 1;
13
+ const step = 1;
14
+
15
+ const handleTextChange: JSX.IntrinsicElements['input']['onChange'] = (e) => {
16
+ if (!onChange) {
17
+ return;
18
+ }
19
+ const newValue = parseInt(e.target.value);
20
+
21
+ const closetValue = list.reduce(function (prev, curr) {
22
+ return Math.abs(curr - newValue) < Math.abs(prev - newValue) ? curr : prev;
23
+ });
24
+
25
+ onChange(Number(getSanitizedValue(closetValue.toString())));
26
+ };
27
+
28
+ const handleRangeChange: JSX.IntrinsicElements['input']['onChange'] = (e) => {
29
+ if (!onChange) {
30
+ return;
31
+ }
32
+
33
+ const val = list.at(clamp(parseInt(e.target.value), min, max)) || 0;
34
+ onChange(Number(getSanitizedValue(val.toString())));
35
+ };
36
+
37
+ const valueIndex = list.findIndex((item) => item === value) || 0;
38
+ const inputStyle = {
39
+ backgroundSize: `${(((valueIndex - min) * 100) / (max - min)).toFixed(2)}% 100%`,
40
+ };
41
+
42
+ return (
43
+ <div className={className}>
44
+ <label className="block relative">
45
+ {title ? <span className="text-m-light text-primary-text">{title}</span> : null}
46
+ <input
47
+ className={`m-0 mt-2 font-sans text-h3 w-full h-14 border border-solid border-gray rounded-md
48
+ outline-none p-0 pl-4 box-border text-primary-text hover:border-primary-hover focus:border-primary-text ${DISABLED_INPUT_CLASSES}`}
49
+ value={addSpacesBetweenNumbers(value)}
50
+ disabled={disabled}
51
+ onChange={handleTextChange}
52
+ onBlur={handleTextChange}
53
+ />
54
+ {list.length ? (
55
+ <div className="absolute w-full flex justify-between -bottom-[3px] px-4">
56
+ {list.map(renderTick(valueIndex, disabled))}
57
+ </div>
58
+ ) : null}
59
+ <div className="absolute inset-x-0 -bottom-1 px-4 leading-[18px]">
60
+ <input
61
+ className="box-border w-full m-0 cursor-pointer slider relative z-10"
62
+ type="range"
63
+ min={min}
64
+ max={max}
65
+ step={step}
66
+ value={valueIndex}
67
+ disabled={disabled}
68
+ onChange={handleRangeChange}
69
+ style={inputStyle}
70
+ />
71
+ </div>
72
+ </label>
73
+ {renderRangeCaption(items)}
74
+ </div>
75
+ );
76
+ },
77
+ );
78
+
79
+ const renderTick = (valueIndex: number, disabled: boolean) => (value: number, i: number) =>
80
+ (
81
+ <span
82
+ key={String(i)}
83
+ className={`w-2 h-2 rounded-full ${
84
+ valueIndex <= i || disabled ? 'bg-gray' : 'bg-primary-main'
85
+ }`}
86
+ />
87
+ );
88
+
89
+ function renderRangeCaption(items: string[]) {
90
+ return (
91
+ <div className="flex justify-between my-2">
92
+ {items.map((item, i) => (
93
+ <span key={String(i)} className="text-s-light text-secondary-text">
94
+ {item}
95
+ </span>
96
+ ))}
97
+ </div>
98
+ );
99
+ }
@@ -0,0 +1,11 @@
1
+ import type { ListContent } from '../List/ListContent';
2
+
3
+ export interface InputListRangeProps extends ListContent {
4
+ className?: string;
5
+ items?: string[];
6
+ list?: number[];
7
+ value?: number;
8
+ title?: string;
9
+ disabled?: boolean;
10
+ onChange?: (value: number) => void;
11
+ }
@@ -2,6 +2,7 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useOutsideClick } from '../../hooks/useOutsideClick';
4
4
  import { LabelProps } from '../../model/HeadlineType';
5
+ import { Text } from '../../ui-kit/Text/Text';
5
6
  import { Icon } from '../Icon/Icon';
6
7
 
7
8
  export interface OptionProps {
@@ -39,7 +40,13 @@ export const Select = JSX<SelectProps>(
39
40
 
40
41
  return (
41
42
  <div className={`${className}`} ref={wrapperRef}>
42
- {label ? <span className="mb-2 flex text-primary-text">{label}</span> : null}
43
+ {label ? (
44
+ <div className="mb-2">
45
+ <Text size="text-m" color="text-primary-text" font="font-light">
46
+ {label}
47
+ </Text>
48
+ </div>
49
+ ) : null}
43
50
  <div className={`relative ${isOpen ? 'z-20' : 'z-10'}`}>
44
51
  <div
45
52
  className={`text-l flex justify-between items-center mb-0.5 text-primary-text cursor-pointer
@@ -0,0 +1,4 @@
1
+ export const arrayByRange = (start: number, stop: number, step = 1) =>
2
+ Array.from({ length: Math.abs(stop - start) / step + 1 }, (value, index) =>
3
+ stop >= start ? start + index * step : start - index * step,
4
+ );
@@ -1,5 +1,5 @@
1
- import type { Picture } from '../model/Picture';
1
+ import type { ImageSize } from '../model/ImageSize';
2
2
 
3
- export function isPictureSizeEmpty(size: Picture['size']): boolean {
4
- return !(size?.width || size?.height);
3
+ export function isPictureSizeEmpty(size: Partial<ImageSize> | undefined): boolean {
4
+ return !size?.width && !size?.height;
5
5
  }
@@ -0,0 +1,19 @@
1
+ export const mergeIntervals = (intervals: number[][]): number[][] => {
2
+ const result = [...intervals];
3
+ result.sort(([a], [c]) => a - c);
4
+
5
+ let i = 1;
6
+
7
+ while (i < result.length) {
8
+ const [a, b] = result[i - 1];
9
+ const [c, d] = result[i];
10
+
11
+ if (b >= c) {
12
+ result.splice(i - 1, 2, [a, Math.max(b, d)]);
13
+ } else {
14
+ i++;
15
+ }
16
+ }
17
+
18
+ return result;
19
+ };
@@ -1,8 +0,0 @@
1
- import type { ImgSource } from '../model/Picture';
2
- import type { TransformationOptions } from './TransformationOptions';
3
- interface DirectoryParams {
4
- pageDir: string;
5
- contentDir: string;
6
- }
7
- export declare function transformImgPath(src: string, { pageDir, contentDir }: DirectoryParams, { format, size }: TransformationOptions & ImgSource): string;
8
- export {};
@@ -1,8 +0,0 @@
1
- import type { ImgSource } from '../model/Picture';
2
- import type { TransformationOptions } from './TransformationOptions';
3
- interface DirectoryParams {
4
- pageDir: string;
5
- contentDir: string;
6
- }
7
- export declare function transformImgPath(src: string, { pageDir, contentDir }: DirectoryParams, { format, size }: TransformationOptions & ImgSource): string;
8
- export {};