@redneckz/wildless-cms-uni-blocks 0.6.42 → 0.6.44

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 (292) hide show
  1. package/bin/migration-scripts/0.6.34.js +2 -0
  2. package/bin/migration-scripts/0.6.43.js +29 -0
  3. package/bundle/ProjectSettings.d.ts +2 -0
  4. package/bundle/blocks.schema.json +1 -1
  5. package/bundle/bundle.umd.js +122 -91
  6. package/bundle/bundle.umd.min.js +1 -1
  7. package/bundle/components/ProductTile/ProductTileContent.d.ts +24 -2
  8. package/bundle/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
  9. package/bundle/components/ProductTile/renderBenefit.d.ts +4 -0
  10. package/bundle/components/ProductTile/renderImage.d.ts +3 -0
  11. package/bundle/content-page-repository/transformImg.d.ts +1 -1
  12. package/bundle/services/BlockRouter/BlockRouter.d.ts +1 -1
  13. package/bundle/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
  14. package/bundle/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
  15. package/bundle/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
  16. package/bundle/utils/normalizeURLPath.d.ts +1 -0
  17. package/bundle/utils/url.d.ts +1 -0
  18. package/dist/ProjectSettings.d.ts +2 -0
  19. package/dist/ProjectSettings.js +5 -0
  20. package/dist/ProjectSettings.js.map +1 -1
  21. package/dist/api/LikeAPI.js +2 -2
  22. package/dist/api/LikeAPI.js.map +1 -1
  23. package/dist/components/Header/Header.js +1 -6
  24. package/dist/components/Header/Header.js.map +1 -1
  25. package/dist/components/ProductTile/ProductTile.js +9 -22
  26. package/dist/components/ProductTile/ProductTile.js.map +1 -1
  27. package/dist/components/ProductTile/ProductTileContent.d.ts +24 -2
  28. package/dist/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
  29. package/dist/components/ProductTile/renderAdditionalDescription.js +18 -0
  30. package/dist/components/ProductTile/renderAdditionalDescription.js.map +1 -0
  31. package/dist/components/ProductTile/renderBenefit.d.ts +4 -0
  32. package/dist/components/ProductTile/renderBenefit.js +32 -0
  33. package/dist/components/ProductTile/renderBenefit.js.map +1 -0
  34. package/dist/components/ProductTile/renderImage.d.ts +3 -0
  35. package/dist/components/ProductTile/renderImage.js +12 -0
  36. package/dist/components/ProductTile/renderImage.js.map +1 -0
  37. package/dist/components/TextBlock/TextBlock.js +13 -28
  38. package/dist/components/TextBlock/TextBlock.js.map +1 -1
  39. package/dist/content-page-repository/transformImg.d.ts +1 -1
  40. package/dist/content-page-repository/transformImg.js +4 -10
  41. package/dist/content-page-repository/transformImg.js.map +1 -1
  42. package/dist/content-page-repository/transformMarkdown.js +3 -3
  43. package/dist/content-page-repository/transformMarkdown.js.map +1 -1
  44. package/dist/hooks/useLink.js +3 -5
  45. package/dist/hooks/useLink.js.map +1 -1
  46. package/dist/hooks/useLocation.js +11 -5
  47. package/dist/hooks/useLocation.js.map +1 -1
  48. package/dist/services/BlockRouter/BlockRouter.d.ts +1 -1
  49. package/dist/services/BlockRouter/BlockRouter.js.map +1 -1
  50. package/dist/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
  51. package/dist/services/sitemap/checkIsHrefSameOrigin.js +1 -1
  52. package/dist/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
  53. package/dist/services/sitemap/isHrefActive.js +2 -3
  54. package/dist/services/sitemap/isHrefActive.js.map +1 -1
  55. package/dist/setup-fixture.js +3 -3
  56. package/dist/setup-fixture.js.map +1 -1
  57. package/dist/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
  58. package/dist/ui-kit/MarkdownText/MarkdownText.js +9 -0
  59. package/dist/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
  60. package/dist/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
  61. package/dist/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
  62. package/dist/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
  63. package/dist/ui-kit/Text/Text.js +1 -5
  64. package/dist/ui-kit/Text/Text.js.map +1 -1
  65. package/dist/utils/normalizeURLPath.d.ts +1 -0
  66. package/dist/utils/normalizeURLPath.js +12 -0
  67. package/dist/utils/normalizeURLPath.js.map +1 -0
  68. package/dist/utils/url.d.ts +1 -0
  69. package/dist/utils/url.js +9 -1
  70. package/dist/utils/url.js.map +1 -1
  71. package/dist/wlc.json +3 -1
  72. package/lib/ProjectSettings.d.ts +2 -0
  73. package/lib/ProjectSettings.js +5 -0
  74. package/lib/ProjectSettings.js.map +1 -1
  75. package/lib/api/LikeAPI.js +2 -2
  76. package/lib/api/LikeAPI.js.map +1 -1
  77. package/lib/common.css +1 -1
  78. package/lib/components/Header/Header.js +1 -6
  79. package/lib/components/Header/Header.js.map +1 -1
  80. package/lib/components/ProductTile/ProductTile.js +10 -23
  81. package/lib/components/ProductTile/ProductTile.js.map +1 -1
  82. package/lib/components/ProductTile/ProductTileContent.d.ts +24 -2
  83. package/lib/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
  84. package/lib/components/ProductTile/renderAdditionalDescription.js +15 -0
  85. package/lib/components/ProductTile/renderAdditionalDescription.js.map +1 -0
  86. package/lib/components/ProductTile/renderBenefit.d.ts +4 -0
  87. package/lib/components/ProductTile/renderBenefit.js +29 -0
  88. package/lib/components/ProductTile/renderBenefit.js.map +1 -0
  89. package/lib/components/ProductTile/renderImage.d.ts +3 -0
  90. package/lib/components/ProductTile/renderImage.js +9 -0
  91. package/lib/components/ProductTile/renderImage.js.map +1 -0
  92. package/lib/components/TextBlock/TextBlock.js +13 -28
  93. package/lib/components/TextBlock/TextBlock.js.map +1 -1
  94. package/lib/content-page-repository/transformImg.d.ts +1 -1
  95. package/lib/content-page-repository/transformImg.js +4 -10
  96. package/lib/content-page-repository/transformImg.js.map +1 -1
  97. package/lib/content-page-repository/transformMarkdown.js +3 -3
  98. package/lib/content-page-repository/transformMarkdown.js.map +1 -1
  99. package/lib/hooks/useLink.js +3 -5
  100. package/lib/hooks/useLink.js.map +1 -1
  101. package/lib/hooks/useLocation.js +11 -5
  102. package/lib/hooks/useLocation.js.map +1 -1
  103. package/lib/services/BlockRouter/BlockRouter.d.ts +1 -1
  104. package/lib/services/BlockRouter/BlockRouter.js.map +1 -1
  105. package/lib/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
  106. package/lib/services/sitemap/checkIsHrefSameOrigin.js +1 -1
  107. package/lib/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
  108. package/lib/services/sitemap/isHrefActive.js +3 -4
  109. package/lib/services/sitemap/isHrefActive.js.map +1 -1
  110. package/lib/setup-fixture.js +3 -3
  111. package/lib/setup-fixture.js.map +1 -1
  112. package/lib/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
  113. package/lib/ui-kit/MarkdownText/MarkdownText.js +7 -0
  114. package/lib/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
  115. package/lib/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
  116. package/lib/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
  117. package/lib/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
  118. package/lib/ui-kit/Text/Text.js +1 -5
  119. package/lib/ui-kit/Text/Text.js.map +1 -1
  120. package/lib/utils/normalizeURLPath.d.ts +1 -0
  121. package/lib/utils/normalizeURLPath.js +9 -0
  122. package/lib/utils/normalizeURLPath.js.map +1 -0
  123. package/lib/utils/url.d.ts +1 -0
  124. package/lib/utils/url.js +7 -0
  125. package/lib/utils/url.js.map +1 -1
  126. package/lib/wlc.json +3 -1
  127. package/mobile/bundle/ProjectSettings.d.ts +2 -0
  128. package/mobile/bundle/bundle.umd.js +39 -21
  129. package/mobile/bundle/bundle.umd.min.js +1 -1
  130. package/mobile/bundle/components/ProductTile/ProductTileContent.d.ts +24 -2
  131. package/mobile/bundle/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
  132. package/mobile/bundle/components/ProductTile/renderBenefit.d.ts +4 -0
  133. package/mobile/bundle/components/ProductTile/renderImage.d.ts +3 -0
  134. package/mobile/bundle/content-page-repository/transformImg.d.ts +1 -1
  135. package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +1 -1
  136. package/mobile/bundle/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
  137. package/mobile/bundle/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
  138. package/mobile/bundle/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
  139. package/mobile/bundle/utils/normalizeURLPath.d.ts +1 -0
  140. package/mobile/bundle/utils/url.d.ts +1 -0
  141. package/mobile/dist/ProjectSettings.d.ts +2 -0
  142. package/mobile/dist/ProjectSettings.js +5 -0
  143. package/mobile/dist/ProjectSettings.js.map +1 -1
  144. package/mobile/dist/api/LikeAPI.js +2 -2
  145. package/mobile/dist/api/LikeAPI.js.map +1 -1
  146. package/mobile/dist/components/ProductTile/ProductTile.js +9 -22
  147. package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
  148. package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +24 -2
  149. package/mobile/dist/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
  150. package/mobile/dist/components/ProductTile/renderAdditionalDescription.js +18 -0
  151. package/mobile/dist/components/ProductTile/renderAdditionalDescription.js.map +1 -0
  152. package/mobile/dist/components/ProductTile/renderBenefit.d.ts +4 -0
  153. package/mobile/dist/components/ProductTile/renderBenefit.js +32 -0
  154. package/mobile/dist/components/ProductTile/renderBenefit.js.map +1 -0
  155. package/mobile/dist/components/ProductTile/renderImage.d.ts +3 -0
  156. package/mobile/dist/components/ProductTile/renderImage.js +12 -0
  157. package/mobile/dist/components/ProductTile/renderImage.js.map +1 -0
  158. package/mobile/dist/content-page-repository/transformImg.d.ts +1 -1
  159. package/mobile/dist/content-page-repository/transformImg.js +4 -10
  160. package/mobile/dist/content-page-repository/transformImg.js.map +1 -1
  161. package/mobile/dist/content-page-repository/transformMarkdown.js +3 -3
  162. package/mobile/dist/content-page-repository/transformMarkdown.js.map +1 -1
  163. package/mobile/dist/hooks/useLink.js +3 -5
  164. package/mobile/dist/hooks/useLink.js.map +1 -1
  165. package/mobile/dist/hooks/useLocation.js +11 -5
  166. package/mobile/dist/hooks/useLocation.js.map +1 -1
  167. package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +1 -1
  168. package/mobile/dist/services/BlockRouter/BlockRouter.js.map +1 -1
  169. package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
  170. package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.js +1 -1
  171. package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
  172. package/mobile/dist/services/sitemap/isHrefActive.js +2 -3
  173. package/mobile/dist/services/sitemap/isHrefActive.js.map +1 -1
  174. package/mobile/dist/setup-fixture.js +3 -3
  175. package/mobile/dist/setup-fixture.js.map +1 -1
  176. package/mobile/dist/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
  177. package/mobile/dist/ui-kit/MarkdownText/MarkdownText.js +9 -0
  178. package/mobile/dist/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
  179. package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
  180. package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
  181. package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
  182. package/mobile/dist/ui-kit/Text/Text.js +1 -5
  183. package/mobile/dist/ui-kit/Text/Text.js.map +1 -1
  184. package/mobile/dist/utils/normalizeURLPath.d.ts +1 -0
  185. package/mobile/dist/utils/normalizeURLPath.js +12 -0
  186. package/mobile/dist/utils/normalizeURLPath.js.map +1 -0
  187. package/mobile/dist/utils/url.d.ts +1 -0
  188. package/mobile/dist/utils/url.js +9 -1
  189. package/mobile/dist/utils/url.js.map +1 -1
  190. package/mobile/dist/wlc.json +3 -1
  191. package/mobile/lib/ProjectSettings.d.ts +2 -0
  192. package/mobile/lib/ProjectSettings.js +5 -0
  193. package/mobile/lib/ProjectSettings.js.map +1 -1
  194. package/mobile/lib/api/LikeAPI.js +2 -2
  195. package/mobile/lib/api/LikeAPI.js.map +1 -1
  196. package/mobile/lib/components/ProductTile/ProductTile.js +10 -23
  197. package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
  198. package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +24 -2
  199. package/mobile/lib/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
  200. package/mobile/lib/components/ProductTile/renderAdditionalDescription.js +15 -0
  201. package/mobile/lib/components/ProductTile/renderAdditionalDescription.js.map +1 -0
  202. package/mobile/lib/components/ProductTile/renderBenefit.d.ts +4 -0
  203. package/mobile/lib/components/ProductTile/renderBenefit.js +29 -0
  204. package/mobile/lib/components/ProductTile/renderBenefit.js.map +1 -0
  205. package/mobile/lib/components/ProductTile/renderImage.d.ts +3 -0
  206. package/mobile/lib/components/ProductTile/renderImage.js +9 -0
  207. package/mobile/lib/components/ProductTile/renderImage.js.map +1 -0
  208. package/mobile/lib/content-page-repository/transformImg.d.ts +1 -1
  209. package/mobile/lib/content-page-repository/transformImg.js +4 -10
  210. package/mobile/lib/content-page-repository/transformImg.js.map +1 -1
  211. package/mobile/lib/content-page-repository/transformMarkdown.js +3 -3
  212. package/mobile/lib/content-page-repository/transformMarkdown.js.map +1 -1
  213. package/mobile/lib/hooks/useLink.js +3 -5
  214. package/mobile/lib/hooks/useLink.js.map +1 -1
  215. package/mobile/lib/hooks/useLocation.js +11 -5
  216. package/mobile/lib/hooks/useLocation.js.map +1 -1
  217. package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +1 -1
  218. package/mobile/lib/services/BlockRouter/BlockRouter.js.map +1 -1
  219. package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
  220. package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.js +1 -1
  221. package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
  222. package/mobile/lib/services/sitemap/isHrefActive.js +3 -4
  223. package/mobile/lib/services/sitemap/isHrefActive.js.map +1 -1
  224. package/mobile/lib/setup-fixture.js +3 -3
  225. package/mobile/lib/setup-fixture.js.map +1 -1
  226. package/mobile/lib/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
  227. package/mobile/lib/ui-kit/MarkdownText/MarkdownText.js +7 -0
  228. package/mobile/lib/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
  229. package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
  230. package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
  231. package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
  232. package/mobile/lib/ui-kit/Text/Text.js +1 -5
  233. package/mobile/lib/ui-kit/Text/Text.js.map +1 -1
  234. package/mobile/lib/utils/normalizeURLPath.d.ts +1 -0
  235. package/mobile/lib/utils/normalizeURLPath.js +9 -0
  236. package/mobile/lib/utils/normalizeURLPath.js.map +1 -0
  237. package/mobile/lib/utils/url.d.ts +1 -0
  238. package/mobile/lib/utils/url.js +7 -0
  239. package/mobile/lib/utils/url.js.map +1 -1
  240. package/mobile/lib/wlc.json +3 -1
  241. package/mobile/src/ProjectSettings.ts +6 -0
  242. package/mobile/src/api/LikeAPI.ts +2 -2
  243. package/mobile/src/common.css +50 -0
  244. package/mobile/src/components/ProductTile/ProductTile.example.json +3 -0
  245. package/mobile/src/components/ProductTile/ProductTile.tsx +13 -44
  246. package/mobile/src/components/ProductTile/ProductTile.ui.json +14 -1
  247. package/mobile/src/components/ProductTile/ProductTileContent.ts +26 -2
  248. package/mobile/src/components/ProductTile/renderAdditionalDescription.tsx +30 -0
  249. package/mobile/src/components/ProductTile/renderBenefit.tsx +39 -0
  250. package/mobile/src/components/ProductTile/renderImage.tsx +15 -0
  251. package/mobile/src/content-page-repository/transformImg.ts +6 -14
  252. package/mobile/src/content-page-repository/transformMarkdown.ts +3 -3
  253. package/mobile/src/hooks/useLink.ts +6 -7
  254. package/mobile/src/hooks/useLocation.ts +12 -6
  255. package/mobile/src/services/BlockRouter/BlockRouter.ts +1 -1
  256. package/mobile/src/services/sitemap/checkIsHrefSameOrigin.ts +5 -4
  257. package/mobile/src/services/sitemap/isHrefActive.ts +7 -4
  258. package/mobile/src/setup-fixture.ts +3 -3
  259. package/mobile/src/ui-kit/MarkdownText/MarkdownText.tsx +8 -0
  260. package/mobile/src/ui-kit/MarkdownText/MarkdownTextProps.ts +6 -0
  261. package/mobile/src/ui-kit/Text/Text.tsx +5 -7
  262. package/mobile/src/utils/normalizeURLPath.ts +10 -0
  263. package/mobile/src/utils/url.ts +10 -0
  264. package/mobile/src/wlc.json +3 -1
  265. package/package.json +1 -1
  266. package/src/ProjectSettings.ts +6 -0
  267. package/src/api/LikeAPI.ts +2 -2
  268. package/src/common.css +50 -0
  269. package/src/components/Header/Header.tsx +2 -10
  270. package/src/components/ProductTile/ProductTile.example.json +3 -0
  271. package/src/components/ProductTile/ProductTile.fixture.tsx +11 -4
  272. package/src/components/ProductTile/ProductTile.tsx +13 -44
  273. package/src/components/ProductTile/ProductTile.ui.json +14 -1
  274. package/src/components/ProductTile/ProductTileContent.ts +26 -2
  275. package/src/components/ProductTile/renderAdditionalDescription.tsx +30 -0
  276. package/src/components/ProductTile/renderBenefit.tsx +39 -0
  277. package/src/components/ProductTile/renderImage.tsx +15 -0
  278. package/src/components/TextBlock/TextBlock.tsx +49 -41
  279. package/src/content-page-repository/transformImg.ts +6 -14
  280. package/src/content-page-repository/transformMarkdown.ts +3 -3
  281. package/src/hooks/useLink.ts +6 -7
  282. package/src/hooks/useLocation.ts +12 -6
  283. package/src/services/BlockRouter/BlockRouter.ts +1 -1
  284. package/src/services/sitemap/checkIsHrefSameOrigin.ts +5 -4
  285. package/src/services/sitemap/isHrefActive.ts +7 -4
  286. package/src/setup-fixture.ts +3 -3
  287. package/src/ui-kit/MarkdownText/MarkdownText.tsx +8 -0
  288. package/src/ui-kit/MarkdownText/MarkdownTextProps.ts +6 -0
  289. package/src/ui-kit/Text/Text.tsx +5 -7
  290. package/src/utils/normalizeURLPath.ts +10 -0
  291. package/src/utils/url.ts +10 -0
  292. package/src/wlc.json +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/ui-kit/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAUxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,KAAK,EAAE,EAAE;IAC3C,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,WAAW,GAAG,aAAa,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;IAElE,OAAO,eAAM,SAAS,EAAE,WAAW,YAAG,QAAQ,GAAQ,CAAC;AACzD,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/ui-kit/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAUxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAC7E,eAAM,SAAS,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YAC/E,QAAQ,GACJ,CACR,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const normalizeURLPath: (href?: string) => string | undefined;
@@ -0,0 +1,9 @@
1
+ import { projectSettings } from '../ProjectSettings.js';
2
+ import { isURL } from './url.js';
3
+ export const normalizeURLPath = (href) => {
4
+ if (isURL(href) || href?.startsWith('/')) {
5
+ return href;
6
+ }
7
+ return `${projectSettings.BASE_PATH || ''}${href}`;
8
+ };
9
+ //# sourceMappingURL=normalizeURLPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeURLPath.js","sourceRoot":"","sources":["../../src/utils/normalizeURLPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAE,EAAE;IAChD,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,GAAG,eAAe,CAAC,SAAS,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AACrD,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export declare const isURL: (href?: string) => boolean | undefined;
2
2
  export declare const withoutQuery: (href?: string) => string;
3
3
  export declare const getOrigin: (href?: string) => string | undefined;
4
+ export declare const getPathname: (href?: string) => string | undefined;
4
5
  export declare const getHash: (href?: string) => string | undefined;
5
6
  export declare const isHash: (href?: string) => boolean | undefined;
@@ -10,6 +10,13 @@ export const getOrigin = (href) => {
10
10
  const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
11
11
  return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
12
12
  };
13
+ export const getPathname = (href) => {
14
+ if (!href || !isURL(href)) {
15
+ return undefined;
16
+ }
17
+ const url = new URL(href);
18
+ return url.pathname;
19
+ };
13
20
  export const getHash = (href) => {
14
21
  if (!href || !isURL(href)) {
15
22
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAEzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAa,EAAE,EAAE;IACvC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAEzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAa,EAAE,EAAE;IAC3C,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAE1B,OAAO,GAAG,CAAC,QAAQ,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAa,EAAE,EAAE;IACvC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "PROD_BRANCH": "master",
3
3
  "FORCED_DRAFT_FLOW": false,
4
- "YANDEX_MAP_API_KEY": "f4b40c1e-1891-45f2-b307-90c481af210b"
4
+ "YANDEX_MAP_API_KEY": "f4b40c1e-1891-45f2-b307-90c481af210b",
5
+ "BASE_PATH": "/natural/",
6
+ "SITEMAP": "sayt-rshb"
5
7
  }
@@ -7,6 +7,7 @@ export interface ProjectSettings {
7
7
  SITEMAP?: string;
8
8
  FOOTER?: string;
9
9
  CDN?: string; // Should ends with "/"
10
+ BASE_PATH?: string; // Should ends with "/"
10
11
  YANDEX_MAP_API_KEY?: string;
11
12
  YANDEX_METRIKA_ID?: string;
12
13
  }
@@ -45,6 +46,11 @@ export const projectSettings = new (class implements ProjectSettings {
45
46
  get CDN() {
46
47
  return this._.CDN;
47
48
  }
49
+ get BASE_PATH() {
50
+ return this._.BASE_PATH && !this._.BASE_PATH.endsWith('/')
51
+ ? `${this._.BASE_PATH}/`
52
+ : this._.BASE_PATH;
53
+ }
48
54
  get YANDEX_MAP_API_KEY() {
49
55
  return this._.YANDEX_MAP_API_KEY;
50
56
  }
@@ -114,7 +114,7 @@ export function LikeAPI() {
114
114
 
115
115
  async function auth(): Promise<UserData> {
116
116
  try {
117
- const userData: UserData = JSON.parse(globalThis.localStorage.getItem(STORAGE_KEY) || '');
117
+ const userData: UserData = JSON.parse(globalThis.localStorage?.getItem(STORAGE_KEY) || '');
118
118
  if (userData?.token) {
119
119
  return userData;
120
120
  }
@@ -136,7 +136,7 @@ export function LikeAPI() {
136
136
 
137
137
  const { token, name } = await response.json();
138
138
 
139
- globalThis.localStorage.setItem(STORAGE_KEY, JSON.stringify({ token, name }));
139
+ globalThis.localStorage?.setItem(STORAGE_KEY, JSON.stringify({ token, name }));
140
140
 
141
141
  return { token, name } as UserData;
142
142
  } catch (e) {
@@ -151,6 +151,56 @@ html {
151
151
  }
152
152
  }
153
153
 
154
+ @layer components {
155
+ .md-container .h1 {
156
+ @apply text-h1;
157
+ }
158
+
159
+ .md-container .h2 {
160
+ @apply text-h2;
161
+ }
162
+
163
+ .md-container .h3 {
164
+ @apply text-h3;
165
+ }
166
+
167
+ .md-container .h4 {
168
+ @apply text-h4;
169
+ }
170
+
171
+ .md-container .h5 {
172
+ @apply text-h5;
173
+ }
174
+
175
+ .md-container .h6 {
176
+ @apply text-h6;
177
+ }
178
+
179
+ .md-container ul {
180
+ @apply list-inside list-disc;
181
+ }
182
+
183
+ .md-container ol {
184
+ @apply list-inside list-decimal;
185
+ }
186
+
187
+ .md-container p {
188
+ @apply text-l font-light;
189
+ }
190
+
191
+ .md-container li {
192
+ @apply text-l font-light;
193
+ }
194
+
195
+ .md-container li > p {
196
+ @apply inline;
197
+ }
198
+
199
+ .md-container a {
200
+ @apply text-primary-main;
201
+ }
202
+ }
203
+
154
204
  /*
155
205
  Styling Yandex Map element
156
206
  */
@@ -12,14 +12,17 @@
12
12
  "version": "primary",
13
13
  "benefits": [
14
14
  {
15
+ "type": "default",
15
16
  "label": "Преимущество 1",
16
17
  "description": "Описание"
17
18
  },
18
19
  {
20
+ "type": "default",
19
21
  "label": "Преимущество 2",
20
22
  "description": "Описание"
21
23
  },
22
24
  {
25
+ "type": "default",
23
26
  "label": "Преимущество 3",
24
27
  "description": "Описание"
25
28
  }
@@ -1,14 +1,16 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { BlockVersion } from '../../model/BlockVersion';
3
- import { VersionAdditionalStyleMap, VersionStyleMap } from '../../model/BlockVersion';
3
+ import { VersionStyleMap } from '../../model/BlockVersion';
4
4
  import type { UniBlockProps } from '../../model/JSXBlock';
5
5
  import type { Picture } from '../../model/Picture';
6
6
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
7
  import { ButtonSection } from '../../ui-kit/Button/ButtonSection';
8
- import { Img } from '../../ui-kit/Img/Img';
9
8
  import { getTileRightPadding } from '../BaseTile/getTileRightPadding';
10
9
  import { Headline } from '../Headline/Headline';
11
- import type { ProductTileContent, TextBenefit } from './ProductTileContent';
10
+ import type { Benefit, ProductTileContent } from './ProductTileContent';
11
+ import { renderAdditionalDescription } from './renderAdditionalDescription';
12
+ import { renderBenefit } from './renderBenefit';
13
+ import { renderImage } from './renderImage';
12
14
 
13
15
  export interface ProductTileProps extends ProductTileContent, UniBlockProps {}
14
16
 
@@ -43,7 +45,7 @@ export const ProductTile = JSX<ProductTileProps>(
43
45
  {...rest}
44
46
  />
45
47
  {renderBenefits(benefits, version, image)}
46
- {additionalDescription ? renderAdditionalDescription(additionalDescription, image) : null}
48
+ {renderAdditionalDescription(additionalDescription, image)}
47
49
  {buttons?.length ? (
48
50
  <ButtonSection buttons={buttons} className="mt-5 gap-4 z-10 text-l" />
49
51
  ) : null}
@@ -53,53 +55,20 @@ export const ProductTile = JSX<ProductTileProps>(
53
55
  ),
54
56
  );
55
57
 
56
- function renderBenefits(benefits: TextBenefit[], version: BlockVersion, image?: Picture) {
58
+ function renderBenefits(benefits: Benefit[], version: BlockVersion, image?: Picture) {
59
+ if (!benefits.length) {
60
+ return null;
61
+ }
62
+
57
63
  // picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
58
- const BENEFITS_WIDTH = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
64
+ const benefitsWidth = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
59
65
 
60
66
  return (
61
67
  <div
62
68
  className={`z-10 grid grid-cols-[max-content_1fr] auto-rows-auto gap-x-6 gap-y-2.5 items-baseline
63
- ${BENEFITS_WIDTH}`}
69
+ ${benefitsWidth}`}
64
70
  >
65
71
  {benefits.length ? benefits.map(renderBenefit(version)) : null}
66
72
  </div>
67
73
  );
68
74
  }
69
-
70
- const renderBenefit =
71
- (version: BlockVersion = 'primary') =>
72
- (benefit: TextBenefit, i: number) => {
73
- const { label = '', description = '' } = benefit;
74
-
75
- return [
76
- <div key={`label-${i}`} className="text-h6">
77
- {label}
78
- </div>,
79
- <div key={`desc-${i}`} className={`text-m-light ${VersionAdditionalStyleMap[version]}`}>
80
- {description}
81
- </div>,
82
- ];
83
- };
84
-
85
- function renderAdditionalDescription(additionalDescription: string, image?: Picture) {
86
- // picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
87
- const DESCRIPTION_WIDTH = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
88
-
89
- return (
90
- <div className={`text-m-light mt-2.5 z-10 ${DESCRIPTION_WIDTH}`}>{additionalDescription}</div>
91
- );
92
- }
93
-
94
- function renderImage(image?: Picture, isImageOnRightSide?: boolean) {
95
- if (!image?.src) {
96
- return null;
97
- }
98
-
99
- return (
100
- <Img
101
- className={`absolute ${isImageOnRightSide ? 'right-0' : 'left-0'} bottom-0`}
102
- image={image}
103
- />
104
- );
105
- }
@@ -1 +1,14 @@
1
- {}
1
+ {
2
+ "content": {
3
+ "benefits": {
4
+ "items": {
5
+ "md": {
6
+ "ui:widget": "html"
7
+ },
8
+ "type": {
9
+ "ui:widget": "hidden"
10
+ }
11
+ }
12
+ }
13
+ }
14
+ }
@@ -2,8 +2,32 @@ import type { BlockVersion } from '../../model/BlockVersion';
2
2
  import type { DescriptionProps, HeadlineProps, LabelProps } from '../../model/HeadlineType';
3
3
  import type { Picture } from '../../model/Picture';
4
4
  import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
5
+ import type { MarkdownTextProps } from '../../ui-kit/MarkdownText/MarkdownTextProps';
5
6
 
6
- export type TextBenefit = DescriptionProps & LabelProps;
7
+ /**
8
+ * @title Стандартный
9
+ */
10
+ type TextBenefit = DescriptionProps &
11
+ LabelProps & {
12
+ /** @default default */
13
+ type: 'default';
14
+ };
15
+
16
+ /**
17
+ * @title Форматированный текст
18
+ */
19
+ type MarkdownTextContent = MarkdownTextProps & {
20
+ /** @default md */
21
+ type: 'md';
22
+ };
23
+
24
+ /**
25
+ * @title Преимущество
26
+ * @default{
27
+ * "type": "default"
28
+ * }
29
+ */
30
+ export type Benefit = TextBenefit | MarkdownTextContent;
7
31
 
8
32
  /**
9
33
  * @title Продуктовая плитка
@@ -30,7 +54,7 @@ export type ProductTileContent = HeadlineProps &
30
54
  * @title Преимущества
31
55
  * @maxItems 7
32
56
  */
33
- benefits?: TextBenefit[];
57
+ benefits?: Benefit[];
34
58
  /** @title Дополнительное описание */
35
59
  additionalDescription?: string;
36
60
  /** @title Картинка справа/текст слева */
@@ -0,0 +1,30 @@
1
+ import type { BlockVersion } from '../../model/BlockVersion';
2
+ import type { Picture } from '../../model/Picture';
3
+ import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
4
+ import type { TextColor } from '../../ui-kit/Text/TextProps';
5
+
6
+ const DESCRIPTION_STYLE_MAP: Record<BlockVersion, TextColor> = {
7
+ primary: 'text-secondary-text',
8
+ secondary: 'text-white',
9
+ };
10
+
11
+ export function renderAdditionalDescription(
12
+ additionalDescription?: string,
13
+ image?: Picture,
14
+ version: BlockVersion = 'primary',
15
+ ) {
16
+ if (!additionalDescription) {
17
+ return null;
18
+ }
19
+
20
+ // picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
21
+ const descriptionWidth = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
22
+
23
+ return (
24
+ <div className={`mt-2.5 z-10 ${descriptionWidth}`}>
25
+ <Paragraph size="text-m" font="font-light" color={DESCRIPTION_STYLE_MAP[version]}>
26
+ {additionalDescription}
27
+ </Paragraph>
28
+ </div>
29
+ );
30
+ }
@@ -0,0 +1,39 @@
1
+ import type { BlockVersion } from '../../model/BlockVersion';
2
+ import { MarkdownText } from '../../ui-kit/MarkdownText/MarkdownText';
3
+ import { Text } from '../../ui-kit/Text/Text';
4
+ import type { TextColor } from '../../ui-kit/Text/TextProps';
5
+ import { assertUnreachable } from '../../utils/assertUnreachable';
6
+ import type { Benefit } from './ProductTileContent';
7
+
8
+ const LABEL_STYLE_MAP: Record<BlockVersion, TextColor> = {
9
+ primary: 'text-secondary-text',
10
+ secondary: 'text-white',
11
+ };
12
+
13
+ export const renderBenefit =
14
+ (version: BlockVersion = 'primary') =>
15
+ // Linter doesn't understand that switch processes all cases
16
+ // eslint-disable-next-line consistent-return
17
+ (benefit: Benefit, i: number) => {
18
+ const { type } = benefit;
19
+
20
+ if (!(type === 'default' || type === 'md')) {
21
+ return null;
22
+ }
23
+
24
+ switch (type) {
25
+ case 'default':
26
+ return [
27
+ <Text key={`label-${i}`} size="text-h6">
28
+ {benefit.label}
29
+ </Text>,
30
+ <Text key={`desc-${i}`} size="text-m-light" color={LABEL_STYLE_MAP[version]}>
31
+ {benefit.description}
32
+ </Text>,
33
+ ];
34
+ case 'md':
35
+ return <MarkdownText md={benefit.md} />;
36
+ default:
37
+ assertUnreachable(benefit);
38
+ }
39
+ };
@@ -0,0 +1,15 @@
1
+ import type { Picture } from '../../model/Picture';
2
+ import { Img } from '../../ui-kit/Img/Img';
3
+
4
+ export function renderImage(image?: Picture, isImageOnRightSide?: boolean) {
5
+ if (!image?.src) {
6
+ return null;
7
+ }
8
+
9
+ return (
10
+ <Img
11
+ className={`absolute ${isImageOnRightSide ? 'right-0' : 'left-0'} bottom-0`}
12
+ image={image}
13
+ />
14
+ );
15
+ }
@@ -1,13 +1,13 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import util from 'util';
4
- import sharp from 'sharp';
5
3
  import type { ResizeOptions, Sharp } from 'sharp';
4
+ import sharp from 'sharp';
5
+ import util from 'util';
6
6
  import type { ImageSize } from '../model/ImageSize';
7
- import type { TransformationOptions } from './TransformationOptions';
8
7
  import type { ImgAlignment, ImgSource, Picture } from '../model/Picture';
9
- import { transformSrc } from './transformSrc';
10
8
  import { isPictureSizeEmpty } from '../utils/isPictureSizeEmpty';
9
+ import type { TransformationOptions } from './TransformationOptions';
10
+ import { transformSrc } from './transformSrc';
11
11
 
12
12
  const mkdir = util.promisify(fs.mkdir);
13
13
 
@@ -126,20 +126,12 @@ function getCompositionResizeSize(
126
126
  const { width, height } = size;
127
127
  const { width: containerWidth, height: containerHeight } = containerSize;
128
128
 
129
- let widthRatio = 0;
130
- let heightRatio = 0;
131
-
132
129
  if (!(width || height)) {
133
130
  return undefined;
134
131
  }
135
132
 
136
- if (width) {
137
- widthRatio = containerWidth / width;
138
- }
139
-
140
- if (height) {
141
- heightRatio = containerHeight / height;
142
- }
133
+ const widthRatio = width ? containerWidth / width : 0;
134
+ const heightRatio = height ? containerHeight / height : 0;
143
135
 
144
136
  return widthRatio > heightRatio
145
137
  ? { width: Math.min(Number(width), containerWidth) }
@@ -1,6 +1,6 @@
1
- import { unified } from 'unified';
2
- import remarkParse from 'remark-parse';
3
1
  import remarkHtml from 'remark-html';
2
+ import remarkParse from 'remark-parse';
3
+ import { unified } from 'unified';
4
4
 
5
5
  export async function transformMarkdown(markdown: string | null | undefined): Promise<string> {
6
6
  if (!markdown) {
@@ -9,5 +9,5 @@ export async function transformMarkdown(markdown: string | null | undefined): Pr
9
9
 
10
10
  const result = await unified().use(remarkParse).use(remarkHtml).process(markdown);
11
11
 
12
- return result.toString('utf-8');
12
+ return result.toString('utf-8').replaceAll(/<h(\d)>([^<]*)<\/h\d>/g, '<p class="h$1">$2</p>');
13
13
  }
@@ -1,4 +1,4 @@
1
- import type { LinkProps } from '../model/LinkProps';
1
+ import type { LinkProps, Target } from '../model/LinkProps';
2
2
  import { useBlockRouter } from '../services/BlockRouter/useBlockRouter';
3
3
  import { adjustHref } from '../utils/adjustHref';
4
4
  import { isHash, isURL } from '../utils/url';
@@ -25,11 +25,7 @@ export function useLink(): <L extends Partial<LinkProps & ClickHandler>>(
25
25
  onClick: handlerDecorator((ev?: { preventDefault: () => void }) => {
26
26
  props.onClick && props.onClick(ev);
27
27
 
28
- const isLocalHref = href && !isURL(href);
29
- const isLocalTarget = !props.target || props.target === '_self';
30
-
31
- if (!isLocalHref || !isLocalTarget) {
32
- // Default handle
28
+ if (isRemoteHref(href, props.target)) {
33
29
  return;
34
30
  }
35
31
 
@@ -37,9 +33,12 @@ export function useLink(): <L extends Partial<LinkProps & ClickHandler>>(
37
33
  if (isHash(href)) {
38
34
  blockRouter.goto(href);
39
35
  } else {
40
- router.push(href);
36
+ href && router.push(href);
41
37
  }
42
38
  }, props),
43
39
  };
44
40
  };
45
41
  }
42
+
43
+ const isRemoteHref = (href?: string, target?: Target) =>
44
+ isURL(href) || (target && target !== '_self') || href?.startsWith('/');
@@ -15,14 +15,10 @@ interface LocationStorageData {
15
15
  region: RegionData;
16
16
  }
17
17
 
18
- const localStorageLocation = globalThis?.localStorage.getItem('location');
19
- const currentLocation: LocationStorageData | null = localStorageLocation
20
- ? JSON.parse(localStorageLocation)
21
- : null;
22
-
23
18
  export function useLocation(
24
19
  defaultLocation: string,
25
20
  ): [RegionData, (newLocation: RegionData) => void] {
21
+ const currentLocation = getLocalStorageLocation();
26
22
  const [location, setLocation] = useState<RegionData>(
27
23
  currentLocation?.region ?? { name: defaultLocation },
28
24
  );
@@ -38,7 +34,7 @@ export function useLocation(
38
34
 
39
35
  const onChangeLocation = useCallback(
40
36
  (region: RegionData) => {
41
- globalThis?.localStorage.setItem('location', JSON.stringify({ manual: true, region }));
37
+ globalThis.localStorage?.setItem('location', JSON.stringify({ manual: true, region }));
42
38
  setLocation(region);
43
39
  },
44
40
  [setLocation],
@@ -46,3 +42,13 @@ export function useLocation(
46
42
 
47
43
  return [location, onChangeLocation];
48
44
  }
45
+
46
+ const getLocalStorageLocation = (): LocationStorageData | null => {
47
+ const localStorageLocation = globalThis.localStorage?.getItem('location');
48
+
49
+ try {
50
+ return localStorageLocation ? JSON.parse(localStorageLocation) : null;
51
+ } catch (_) {
52
+ return null;
53
+ }
54
+ };
@@ -29,7 +29,7 @@ export class BlockRouter {
29
29
  }
30
30
  }
31
31
 
32
- goto(rawAnchor: string) {
32
+ goto(rawAnchor?: string) {
33
33
  const anchor = normalizeAnchor(rawAnchor);
34
34
  if (anchor) {
35
35
  this.push(anchor);
@@ -1,6 +1,7 @@
1
+ import type { Router } from '../../hooks/useRouter';
1
2
  import { getOrigin } from '../../utils/url';
2
3
 
3
- export const checkIsHrefSameOrigin = (
4
- href: string | undefined,
5
- router: { pathname?: string; href?: string },
6
- ) => getOrigin(href) === getOrigin(router.href);
4
+ export const checkIsHrefSameOrigin = (href: string | undefined, router: Router) =>
5
+ [getOrigin(href), getOrigin(router.href)].every(
6
+ (link, _, arr) => Boolean(link) && link === arr[0],
7
+ );
@@ -1,10 +1,13 @@
1
- import { isURL, withoutQuery } from '../../utils/url';
1
+ import { normalizeURLPath } from '../../utils/normalizeURLPath';
2
+ import { getPathname, isURL, withoutQuery } from '../../utils/url';
2
3
 
3
4
  export const isHrefActive = (
4
5
  href: string | undefined,
5
6
  router: { pathname?: string; href?: string },
6
7
  cmp: (targetHref: string, baseHref: string) => boolean = (targetHref, baseHref) =>
7
8
  baseHref.startsWith(targetHref),
8
- ) => {
9
- return cmp(withoutQuery(href), withoutQuery(isURL(href) ? router.href : router.pathname));
10
- };
9
+ ) =>
10
+ cmp(
11
+ withoutQuery(normalizeURLPath(href)),
12
+ withoutQuery(isURL(href) ? router.href : getPathname(router.href)),
13
+ );
@@ -8,11 +8,11 @@ import wlc from './wlc.json';
8
8
  projectSettings.setup(wlc);
9
9
 
10
10
  useRouter.setup(() => {
11
- const [href, setHref] = useState<string>(globalThis.location.href);
11
+ const [, setHref] = useState<string>(globalThis.location.href);
12
12
 
13
13
  return {
14
- href: href,
15
- pathname: '/credits',
14
+ href: `${globalThis.location.origin}${projectSettings.BASE_PATH}cards-credit`, //for header active links
15
+ pathname: '/cards-credit',
16
16
  query: {},
17
17
  push: (url: string) => {
18
18
  globalThis.history.pushState(null, '', url);
@@ -0,0 +1,8 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { MarkdownTextProps } from './MarkdownTextProps';
3
+
4
+ export const MarkdownText = JSX<MarkdownTextProps>((props) => {
5
+ const { md = '' } = props;
6
+
7
+ return <div className="md-container" dangerouslySetInnerHTML={{ __html: md }} />;
8
+ });
@@ -0,0 +1,6 @@
1
+ type Markdown = string;
2
+
3
+ export interface MarkdownTextProps {
4
+ /** @title Текст */
5
+ md?: Markdown;
6
+ }
@@ -8,10 +8,8 @@ interface TextProps {
8
8
  font?: FontWeight;
9
9
  }
10
10
 
11
- export const Text = JSX<TextProps>((props) => {
12
- const { size = '', color = '', align = '', font = '', children } = props;
13
-
14
- const textClasses = `font-sans ${size} ${color} ${align} ${font}`;
15
-
16
- return <span className={textClasses}>{children}</span>;
17
- });
11
+ export const Text = JSX<TextProps>(({ size, color, align, font, children }) => (
12
+ <span className={['font-sans', size, color, align, font].filter(Boolean).join(' ')}>
13
+ {children}
14
+ </span>
15
+ ));
@@ -0,0 +1,10 @@
1
+ import { projectSettings } from '../ProjectSettings';
2
+ import { isURL } from './url';
3
+
4
+ export const normalizeURLPath = (href?: string) => {
5
+ if (isURL(href) || href?.startsWith('/')) {
6
+ return href;
7
+ }
8
+
9
+ return `${projectSettings.BASE_PATH || ''}${href}`;
10
+ };