@redneckz/wildless-cms-uni-blocks 0.8.7 → 0.8.9

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 (290) hide show
  1. package/bundle/EventBus/EventBus.d.ts +1 -4
  2. package/bundle/EventBus/defaultEventBus.d.ts +7 -0
  3. package/bundle/blocks.schema.json +1 -1
  4. package/bundle/bundle.umd.js +34 -70
  5. package/bundle/bundle.umd.min.js +1 -1
  6. package/bundle/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
  7. package/bundle/components/ProductTile/ProductTileContent.d.ts +4 -13
  8. package/bundle/components/StepsBlock/StepsBlockContent.d.ts +6 -4
  9. package/bundle/components/TextBlock/TextBlockContent.d.ts +3 -2
  10. package/bundle/hooks/useRouter.d.ts +6 -2
  11. package/bundle/model/DefaultListItemType.d.ts +4 -0
  12. package/bundle/model/RichTextItem.d.ts +8 -0
  13. package/bundle/services/BlockRouter/BlockRouter.d.ts +3 -22
  14. package/bundle/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
  15. package/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
  16. package/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
  17. package/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
  18. package/dist/EventBus/EventBus.d.ts +1 -4
  19. package/dist/EventBus/EventBus.js +0 -1
  20. package/dist/EventBus/EventBus.js.map +1 -1
  21. package/dist/EventBus/defaultEventBus.d.ts +7 -0
  22. package/dist/EventBus/defaultEventBus.js +5 -0
  23. package/dist/EventBus/defaultEventBus.js.map +1 -0
  24. package/dist/components/ButtonBlock/ButtonBlock.js +2 -1
  25. package/dist/components/ButtonBlock/ButtonBlock.js.map +1 -1
  26. package/dist/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
  27. package/dist/components/ProductTile/ProductTile.js +1 -2
  28. package/dist/components/ProductTile/ProductTile.js.map +1 -1
  29. package/dist/components/ProductTile/ProductTileContent.d.ts +4 -13
  30. package/dist/components/StepsBlock/StepsBlockContent.d.ts +6 -4
  31. package/dist/components/Tabs/Tabs.js +4 -4
  32. package/dist/components/Tabs/Tabs.js.map +1 -1
  33. package/dist/components/TextBlock/TextBlock.js +3 -2
  34. package/dist/components/TextBlock/TextBlock.js.map +1 -1
  35. package/dist/components/TextBlock/TextBlockContent.d.ts +3 -2
  36. package/dist/hooks/useLink.js +2 -3
  37. package/dist/hooks/useLink.js.map +1 -1
  38. package/dist/hooks/useRouter.d.ts +6 -2
  39. package/dist/hooks/useRouter.js.map +1 -1
  40. package/dist/model/DefaultListItemType.d.ts +4 -0
  41. package/dist/model/DefaultListItemType.js +2 -0
  42. package/dist/model/DefaultListItemType.js.map +1 -0
  43. package/dist/model/RichTextItem.d.ts +8 -0
  44. package/{mobile/dist/EventBus/EventMap.js → dist/model/RichTextItem.js} +1 -1
  45. package/dist/model/RichTextItem.js.map +1 -0
  46. package/dist/services/BlockRouter/BlockRouter.d.ts +3 -22
  47. package/dist/services/BlockRouter/BlockRouter.js +11 -30
  48. package/dist/services/BlockRouter/BlockRouter.js.map +1 -1
  49. package/dist/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
  50. package/dist/services/BlockRouter/blockRouterEventBus.js +5 -0
  51. package/dist/services/BlockRouter/blockRouterEventBus.js.map +1 -0
  52. package/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
  53. package/dist/services/BlockRouter/useBlockIntersectionObserver.js +5 -16
  54. package/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
  55. package/dist/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
  56. package/dist/services/BlockRouter/useBlockRouterProvider.js +11 -12
  57. package/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  58. package/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
  59. package/dist/ui-kit/BlockWrapper.js +2 -2
  60. package/dist/ui-kit/BlockWrapper.js.map +1 -1
  61. package/lib/EventBus/EventBus.d.ts +1 -4
  62. package/lib/EventBus/EventBus.js +0 -1
  63. package/lib/EventBus/EventBus.js.map +1 -1
  64. package/lib/EventBus/defaultEventBus.d.ts +7 -0
  65. package/lib/EventBus/defaultEventBus.js +3 -0
  66. package/lib/EventBus/defaultEventBus.js.map +1 -0
  67. package/lib/common.css +1 -1
  68. package/lib/components/ButtonBlock/ButtonBlock.js +2 -1
  69. package/lib/components/ButtonBlock/ButtonBlock.js.map +1 -1
  70. package/lib/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
  71. package/lib/components/ProductTile/ProductTile.js +1 -2
  72. package/lib/components/ProductTile/ProductTile.js.map +1 -1
  73. package/lib/components/ProductTile/ProductTileContent.d.ts +4 -13
  74. package/lib/components/StepsBlock/StepsBlockContent.d.ts +6 -4
  75. package/lib/components/Tabs/Tabs.js +4 -4
  76. package/lib/components/Tabs/Tabs.js.map +1 -1
  77. package/lib/components/TextBlock/TextBlock.js +3 -2
  78. package/lib/components/TextBlock/TextBlock.js.map +1 -1
  79. package/lib/components/TextBlock/TextBlockContent.d.ts +3 -2
  80. package/lib/hooks/useLink.js +2 -3
  81. package/lib/hooks/useLink.js.map +1 -1
  82. package/lib/hooks/useRouter.d.ts +6 -2
  83. package/lib/hooks/useRouter.js.map +1 -1
  84. package/lib/model/DefaultListItemType.d.ts +4 -0
  85. package/lib/model/DefaultListItemType.js +2 -0
  86. package/lib/model/DefaultListItemType.js.map +1 -0
  87. package/lib/model/RichTextItem.d.ts +8 -0
  88. package/lib/model/RichTextItem.js +2 -0
  89. package/lib/model/RichTextItem.js.map +1 -0
  90. package/lib/services/BlockRouter/BlockRouter.d.ts +3 -22
  91. package/lib/services/BlockRouter/BlockRouter.js +8 -28
  92. package/lib/services/BlockRouter/BlockRouter.js.map +1 -1
  93. package/lib/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
  94. package/lib/services/BlockRouter/blockRouterEventBus.js +3 -0
  95. package/lib/services/BlockRouter/blockRouterEventBus.js.map +1 -0
  96. package/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
  97. package/lib/services/BlockRouter/useBlockIntersectionObserver.js +6 -17
  98. package/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
  99. package/lib/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
  100. package/lib/services/BlockRouter/useBlockRouterProvider.js +12 -13
  101. package/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  102. package/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
  103. package/lib/ui-kit/BlockWrapper.js +2 -2
  104. package/lib/ui-kit/BlockWrapper.js.map +1 -1
  105. package/mobile/bundle/EventBus/EventBus.d.ts +1 -4
  106. package/mobile/bundle/EventBus/defaultEventBus.d.ts +7 -0
  107. package/mobile/bundle/bundle.umd.js +27 -62
  108. package/mobile/bundle/bundle.umd.min.js +1 -1
  109. package/mobile/bundle/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
  110. package/mobile/bundle/components/ProductTile/ProductTileContent.d.ts +4 -13
  111. package/mobile/bundle/components/StepsBlock/StepsBlockContent.d.ts +6 -4
  112. package/mobile/bundle/components/TextBlock/TextBlockContent.d.ts +3 -2
  113. package/mobile/bundle/hooks/useRouter.d.ts +6 -2
  114. package/mobile/bundle/model/DefaultListItemType.d.ts +4 -0
  115. package/mobile/bundle/model/RichTextItem.d.ts +8 -0
  116. package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +3 -22
  117. package/mobile/bundle/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
  118. package/mobile/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
  119. package/mobile/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
  120. package/mobile/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
  121. package/mobile/dist/EventBus/EventBus.d.ts +1 -4
  122. package/mobile/dist/EventBus/EventBus.js +0 -1
  123. package/mobile/dist/EventBus/EventBus.js.map +1 -1
  124. package/mobile/dist/EventBus/defaultEventBus.d.ts +7 -0
  125. package/mobile/dist/EventBus/defaultEventBus.js +5 -0
  126. package/mobile/dist/EventBus/defaultEventBus.js.map +1 -0
  127. package/mobile/dist/components/ButtonBlock/ButtonBlock.js +2 -1
  128. package/mobile/dist/components/ButtonBlock/ButtonBlock.js.map +1 -1
  129. package/mobile/dist/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
  130. package/mobile/dist/components/ProductTile/ProductTile.js +1 -2
  131. package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
  132. package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +4 -13
  133. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +6 -4
  134. package/mobile/dist/components/Tabs/Tabs.js +4 -4
  135. package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
  136. package/mobile/dist/components/TextBlock/TextBlockContent.d.ts +3 -2
  137. package/mobile/dist/hooks/useLink.js +2 -3
  138. package/mobile/dist/hooks/useLink.js.map +1 -1
  139. package/mobile/dist/hooks/useRouter.d.ts +6 -2
  140. package/mobile/dist/hooks/useRouter.js.map +1 -1
  141. package/mobile/dist/model/DefaultListItemType.d.ts +4 -0
  142. package/mobile/dist/model/DefaultListItemType.js +2 -0
  143. package/mobile/dist/model/DefaultListItemType.js.map +1 -0
  144. package/mobile/dist/model/RichTextItem.d.ts +8 -0
  145. package/{dist/EventBus/EventMap.js → mobile/dist/model/RichTextItem.js} +1 -1
  146. package/mobile/dist/model/RichTextItem.js.map +1 -0
  147. package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +3 -22
  148. package/mobile/dist/services/BlockRouter/BlockRouter.js +11 -30
  149. package/mobile/dist/services/BlockRouter/BlockRouter.js.map +1 -1
  150. package/mobile/dist/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
  151. package/mobile/dist/services/BlockRouter/blockRouterEventBus.js +5 -0
  152. package/mobile/dist/services/BlockRouter/blockRouterEventBus.js.map +1 -0
  153. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
  154. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js +5 -16
  155. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
  156. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
  157. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js +11 -12
  158. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  159. package/mobile/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
  160. package/mobile/dist/ui-kit/BlockWrapper.js +2 -2
  161. package/mobile/dist/ui-kit/BlockWrapper.js.map +1 -1
  162. package/mobile/lib/EventBus/EventBus.d.ts +1 -4
  163. package/mobile/lib/EventBus/EventBus.js +0 -1
  164. package/mobile/lib/EventBus/EventBus.js.map +1 -1
  165. package/mobile/lib/EventBus/defaultEventBus.d.ts +7 -0
  166. package/mobile/lib/EventBus/defaultEventBus.js +3 -0
  167. package/mobile/lib/EventBus/defaultEventBus.js.map +1 -0
  168. package/mobile/lib/components/ButtonBlock/ButtonBlock.js +2 -1
  169. package/mobile/lib/components/ButtonBlock/ButtonBlock.js.map +1 -1
  170. package/mobile/lib/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
  171. package/mobile/lib/components/ProductTile/ProductTile.js +1 -2
  172. package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
  173. package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +4 -13
  174. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +6 -4
  175. package/mobile/lib/components/Tabs/Tabs.js +4 -4
  176. package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
  177. package/mobile/lib/components/TextBlock/TextBlockContent.d.ts +3 -2
  178. package/mobile/lib/hooks/useLink.js +2 -3
  179. package/mobile/lib/hooks/useLink.js.map +1 -1
  180. package/mobile/lib/hooks/useRouter.d.ts +6 -2
  181. package/mobile/lib/hooks/useRouter.js.map +1 -1
  182. package/mobile/lib/model/DefaultListItemType.d.ts +4 -0
  183. package/mobile/lib/model/DefaultListItemType.js +2 -0
  184. package/mobile/lib/model/DefaultListItemType.js.map +1 -0
  185. package/mobile/lib/model/RichTextItem.d.ts +8 -0
  186. package/mobile/lib/model/RichTextItem.js +2 -0
  187. package/mobile/lib/model/RichTextItem.js.map +1 -0
  188. package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +3 -22
  189. package/mobile/lib/services/BlockRouter/BlockRouter.js +8 -28
  190. package/mobile/lib/services/BlockRouter/BlockRouter.js.map +1 -1
  191. package/mobile/lib/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
  192. package/mobile/lib/services/BlockRouter/blockRouterEventBus.js +3 -0
  193. package/mobile/lib/services/BlockRouter/blockRouterEventBus.js.map +1 -0
  194. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
  195. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js +6 -17
  196. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
  197. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
  198. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js +12 -13
  199. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  200. package/mobile/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
  201. package/mobile/lib/ui-kit/BlockWrapper.js +2 -2
  202. package/mobile/lib/ui-kit/BlockWrapper.js.map +1 -1
  203. package/mobile/src/EventBus/EventBus.ts +1 -7
  204. package/mobile/src/EventBus/defaultEventBus.ts +8 -0
  205. package/mobile/src/components/ButtonBlock/ButtonBlock.example.json +2 -2
  206. package/mobile/src/components/ButtonBlock/ButtonBlock.tsx +5 -2
  207. package/mobile/src/components/ButtonBlock/ButtonBlockContent.ts +5 -1
  208. package/mobile/src/components/ProductTile/ProductTile.tsx +1 -2
  209. package/mobile/src/components/ProductTile/ProductTileContent.ts +4 -15
  210. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +13 -13
  211. package/mobile/src/components/Tabs/Tabs.tsx +4 -4
  212. package/mobile/src/components/TextBlock/TextBlock.ui.json +7 -1
  213. package/mobile/src/components/TextBlock/TextBlockContent.ts +12 -10
  214. package/mobile/src/hooks/useLink.ts +2 -3
  215. package/mobile/src/hooks/useRouter.ts +6 -2
  216. package/mobile/src/model/DefaultListItemType.ts +4 -0
  217. package/mobile/src/model/RichTextItem.ts +9 -0
  218. package/mobile/src/services/BlockRouter/BlockRouter.ts +8 -47
  219. package/mobile/src/services/BlockRouter/blockRouterEventBus.ts +13 -0
  220. package/mobile/src/services/BlockRouter/useBlockIntersectionObserver.ts +6 -23
  221. package/mobile/src/services/BlockRouter/useBlockRouterProvider.ts +13 -19
  222. package/mobile/src/ui-kit/BenefitItem/BenefitItemProps.ts +4 -14
  223. package/mobile/src/ui-kit/BlockWrapper.tsx +2 -2
  224. package/package.json +1 -1
  225. package/src/EventBus/EventBus.ts +1 -7
  226. package/src/EventBus/defaultEventBus.ts +8 -0
  227. package/src/components/ButtonBlock/ButtonBlock.example.json +2 -2
  228. package/src/components/ButtonBlock/ButtonBlock.tsx +5 -2
  229. package/src/components/ButtonBlock/ButtonBlockContent.ts +5 -1
  230. package/src/components/ProductTile/ProductTile.tsx +1 -2
  231. package/src/components/ProductTile/ProductTileContent.ts +4 -15
  232. package/src/components/StepsBlock/StepsBlockContent.ts +13 -13
  233. package/src/components/Tabs/Tabs.tsx +4 -4
  234. package/src/components/TextBlock/TextBlock.tsx +3 -0
  235. package/src/components/TextBlock/TextBlock.ui.json +7 -1
  236. package/src/components/TextBlock/TextBlockContent.ts +12 -10
  237. package/src/hooks/useLink.ts +2 -3
  238. package/src/hooks/useRouter.ts +6 -2
  239. package/src/model/DefaultListItemType.ts +4 -0
  240. package/src/model/RichTextItem.ts +9 -0
  241. package/src/services/BlockRouter/BlockRouter.ts +8 -47
  242. package/src/services/BlockRouter/blockRouterEventBus.ts +13 -0
  243. package/src/services/BlockRouter/useBlockIntersectionObserver.ts +6 -23
  244. package/src/services/BlockRouter/useBlockRouterProvider.ts +13 -19
  245. package/src/ui-kit/BenefitItem/BenefitItemProps.ts +4 -14
  246. package/src/ui-kit/BlockWrapper.tsx +2 -2
  247. package/bundle/EventBus/EventMap.d.ts +0 -4
  248. package/bundle/services/BlockRouter/useBlockRouter.d.ts +0 -2
  249. package/dist/EventBus/EventMap.d.ts +0 -4
  250. package/dist/EventBus/EventMap.js.map +0 -1
  251. package/dist/model/BlurVersion.d.ts +0 -0
  252. package/dist/model/BlurVersion.js +0 -1
  253. package/dist/model/BlurVersion.js.map +0 -1
  254. package/dist/services/BlockRouter/useBlockRouter.d.ts +0 -2
  255. package/dist/services/BlockRouter/useBlockRouter.js +0 -8
  256. package/dist/services/BlockRouter/useBlockRouter.js.map +0 -1
  257. package/lib/EventBus/EventMap.d.ts +0 -4
  258. package/lib/EventBus/EventMap.js +0 -2
  259. package/lib/EventBus/EventMap.js.map +0 -1
  260. package/lib/model/BlurVersion.d.ts +0 -0
  261. package/lib/model/BlurVersion.js +0 -1
  262. package/lib/model/BlurVersion.js.map +0 -1
  263. package/lib/services/BlockRouter/useBlockRouter.d.ts +0 -2
  264. package/lib/services/BlockRouter/useBlockRouter.js +0 -5
  265. package/lib/services/BlockRouter/useBlockRouter.js.map +0 -1
  266. package/mobile/bundle/EventBus/EventMap.d.ts +0 -4
  267. package/mobile/bundle/services/BlockRouter/useBlockRouter.d.ts +0 -2
  268. package/mobile/dist/EventBus/EventMap.d.ts +0 -4
  269. package/mobile/dist/EventBus/EventMap.js.map +0 -1
  270. package/mobile/dist/model/BlurVersion.d.ts +0 -0
  271. package/mobile/dist/model/BlurVersion.js +0 -1
  272. package/mobile/dist/model/BlurVersion.js.map +0 -1
  273. package/mobile/dist/services/BlockRouter/useBlockRouter.d.ts +0 -2
  274. package/mobile/dist/services/BlockRouter/useBlockRouter.js +0 -8
  275. package/mobile/dist/services/BlockRouter/useBlockRouter.js.map +0 -1
  276. package/mobile/lib/EventBus/EventMap.d.ts +0 -4
  277. package/mobile/lib/EventBus/EventMap.js +0 -2
  278. package/mobile/lib/EventBus/EventMap.js.map +0 -1
  279. package/mobile/lib/model/BlurVersion.d.ts +0 -0
  280. package/mobile/lib/model/BlurVersion.js +0 -1
  281. package/mobile/lib/model/BlurVersion.js.map +0 -1
  282. package/mobile/lib/services/BlockRouter/useBlockRouter.d.ts +0 -2
  283. package/mobile/lib/services/BlockRouter/useBlockRouter.js +0 -5
  284. package/mobile/lib/services/BlockRouter/useBlockRouter.js.map +0 -1
  285. package/mobile/src/EventBus/EventMap.ts +0 -5
  286. package/mobile/src/model/BlurVersion.ts +0 -0
  287. package/mobile/src/services/BlockRouter/useBlockRouter.ts +0 -5
  288. package/src/EventBus/EventMap.ts +0 -5
  289. package/src/model/BlurVersion.ts +0 -0
  290. package/src/services/BlockRouter/useBlockRouter.ts +0 -5
@@ -1,8 +1,9 @@
1
1
  import type { BlockVersion } from '../../model/BlockVersion';
2
+ import type { DefaultListItemType } from '../../model/DefaultListItemType';
2
3
  import type { DescriptionProps, LabelProps } from '../../model/HeadlineType';
3
4
  import type { IconVersion } from '../../model/IconVersion';
4
5
  import type { IconProps } from '../../model/Picture';
5
- import { RichTextProps } from '../RichText/RichTextProps';
6
+ import type { RichTextItem } from '../../model/RichTextItem';
6
7
  export interface BenefitItemCommonProps {
7
8
  /** @hidden */
8
9
  benefitsVersion?: IconVersion;
@@ -15,24 +16,14 @@ export declare type BenefitItemProps = DescriptionProps & LabelProps & IconProps
15
16
  /**
16
17
  * @title Стандартный бенефит
17
18
  */
18
- declare type DefaultBenefit = BenefitItemProps & {
19
- /** @default default */
20
- type: 'default';
21
- };
22
- /**
23
- * @title Форматированный текст
24
- */
25
- declare type RichText = RichTextProps & {
26
- /** @default rte */
27
- type: 'rte';
28
- };
19
+ declare type DefaultBenefit = BenefitItemProps & DefaultListItemType;
29
20
  /**
30
21
  * @title Преимущество
31
22
  * @default{
32
23
  * "type": "default"
33
24
  * }
34
25
  */
35
- export declare type ComplexBenefitProps = DefaultBenefit | RichText;
26
+ export declare type ComplexBenefitProps = DefaultBenefit | RichTextItem;
36
27
  /**
37
28
  * @title Преимущество
38
29
  */
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
3
  import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
4
- import { EventBus } from '../EventBus/EventBus.js';
4
+ import { defaultEventBus } from '../EventBus/defaultEventBus.js';
5
5
  import { useBlockIntersectionObserver } from '../services/BlockRouter/useBlockIntersectionObserver.js';
6
6
  import { style } from '../utils/style.js';
7
7
  export const blockStyles = {
@@ -15,7 +15,7 @@ export const BlockWrapper = JSX(({ className = '', version = 'primary', block, t
15
15
  const Tag = tag;
16
16
  const ref = useBlockIntersectionObserver(block);
17
17
  const [isVisible, setVisible] = useState(true);
18
- useEffect(() => EventBus.inst.subscribe('tab', (event) => {
18
+ useEffect(() => defaultEventBus.subscribe('tab', (event) => {
19
19
  if (event.type === 'group') {
20
20
  const hasSettings = block?.labels?.length || block?.anchor;
21
21
  setVisible(event.label ? !hasSettings || Boolean(block?.labels?.includes(event.label)) : true);
@@ -1 +1 @@
1
- {"version":3,"file":"BlockWrapper.js","sourceRoot":"","sources":["../../src/ui-kit/BlockWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sDAAsD,CAAC;AACpG,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAOvC,MAAM,CAAC,MAAM,WAAW,GAAiC;IACvD,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;IACvC,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,kCAAkC;IAC/C,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAC7B,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,GAAG,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClF,MAAM,GAAG,GAAQ,GAAG,CAAC;IAErB,MAAM,GAAG,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;IAEhD,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,SAAS,CACP,GAAG,EAAE,CACH,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACvC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;YAC1B,MAAM,WAAW,GAAG,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,CAAC;YAC3D,UAAU,CACR,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACnF,CAAC;SACH;aAAM;YACL,UAAU,CAAC,IAAI,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,EACJ,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,OAAO,SAAS,CAAC,CAAC,CAAC,CACjB,KAAC,GAAG,IACF,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,KACtD,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACxC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACpD,IAAI,EAAE,IAAI,YAET,QAAQ,GACL,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"BlockWrapper.js","sourceRoot":"","sources":["../../src/ui-kit/BlockWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sDAAsD,CAAC;AACpG,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAOvC,MAAM,CAAC,MAAM,WAAW,GAAiC;IACvD,OAAO,EAAE,4BAA4B;IACrC,SAAS,EAAE,4BAA4B;IACvC,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,kCAAkC;IAC/C,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAC7B,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,GAAG,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClF,MAAM,GAAG,GAAQ,GAAG,CAAC;IAErB,MAAM,GAAG,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;IAEhD,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,SAAS,CACP,GAAG,EAAE,CACH,eAAe,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACzC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;YAC1B,MAAM,WAAW,GAAG,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,CAAC;YAC3D,UAAU,CACR,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACnF,CAAC;SACH;aAAM;YACL,UAAU,CAAC,IAAI,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,EACJ,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,OAAO,SAAS,CAAC,CAAC,CAAC,CACjB,KAAC,GAAG,IACF,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,KACtD,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACxC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACpD,IAAI,EAAE,IAAI,YAET,QAAQ,GACL,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC"}
@@ -1,10 +1,4 @@
1
- import type { EventMap } from './EventMap';
2
-
3
- export type BaseEventMap = Record<string, any>;
4
-
5
- export class EventBus<EM extends BaseEventMap> {
6
- public static readonly inst = new EventBus<EventMap>();
7
-
1
+ export class EventBus<EM extends Record<string, any>> {
8
2
  private subscribers: Partial<Record<keyof EM, Array<(ev: EM[keyof EM]) => void>>> = {};
9
3
  private subjectsStateMap: Partial<EM> = {};
10
4
 
@@ -0,0 +1,8 @@
1
+ import type { TabActivationEvent } from '../components/Tabs/Tabs';
2
+ import { EventBus } from './EventBus';
3
+
4
+ interface GlobalEventMap {
5
+ tab: TabActivationEvent;
6
+ }
7
+
8
+ export const defaultEventBus = new EventBus<GlobalEventMap>();
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "content": {
3
3
  "button": {
4
- "href": "/credit-cards",
5
- "text": "Подробнее",
4
+ "href": "#",
5
+ "text": "Кнопка",
6
6
  "target": "_blank",
7
7
  "version": "primary"
8
8
  }
@@ -2,10 +2,13 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { UniBlockProps } from '../../model/JSXBlock';
3
3
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
4
4
  import { renderButtonsSection } from '../../ui-kit/Button/renderButtonsSection';
5
+ import { style } from '../../utils/style';
5
6
  import type { ButtonBlockContent } from './ButtonBlockContent';
6
7
 
7
8
  interface ButtonBlockProps extends ButtonBlockContent, UniBlockProps {}
8
9
 
9
- export const ButtonBlock = JSX<ButtonBlockProps>(({ button, ...rest }) => (
10
- <BlockWrapper {...rest}>{renderButtonsSection([button])}</BlockWrapper>
10
+ export const ButtonBlock = JSX<ButtonBlockProps>(({ button, className, ...rest }) => (
11
+ <BlockWrapper className={style('!bg-transparent', className)} {...rest}>
12
+ {renderButtonsSection([button])}
13
+ </BlockWrapper>
11
14
  ));
@@ -4,6 +4,10 @@ import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
4
4
  * @title Блок Кнопка
5
5
  */
6
6
  export interface ButtonBlockContent {
7
- /** @title Кнопка */
7
+ /**
8
+ * @title Кнопка
9
+ * @default {"icon": {"format": "webp", "size": { "width": 24, "height": 24 }},
10
+ * "iconRight": {"format": "webp", "size": { "width": 24, "height": 24 }}}
11
+ */
8
12
  button?: ButtonWithIconProps;
9
13
  }
@@ -62,8 +62,7 @@ function renderBenefits(benefits: Benefit[], image?: Picture) {
62
62
 
63
63
  return (
64
64
  <div
65
- className={`z-10 grid grid-cols-[max-content_1fr] auto-rows-auto gap-x-6 gap-y-2.5 items-baseline
66
- ${benefitsWidth}`}
65
+ className={`z-10 grid grid-cols-[max-content_1fr] auto-rows-auto gap-x-6 gap-y-2.5 items-baseline ${benefitsWidth}`}
67
66
  >
68
67
  {benefits.length ? benefits.map(renderBenefit) : null}
69
68
  </div>
@@ -1,25 +1,14 @@
1
1
  import type { BlockVersion } from '../../model/BlockVersion';
2
+ import type { DefaultListItemType } from '../../model/DefaultListItemType';
2
3
  import type { DescriptionProps, HeadlineProps, LabelProps } from '../../model/HeadlineType';
3
4
  import type { Picture } from '../../model/Picture';
5
+ import type { RichTextItem } from '../../model/RichTextItem';
4
6
  import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
5
- import type { RichTextProps } from '../../ui-kit/RichText/RichTextProps';
6
7
 
7
8
  /**
8
9
  * @title Стандартный
9
10
  */
10
- type TextBenefit = DescriptionProps &
11
- LabelProps & {
12
- /** @default default */
13
- type: 'default';
14
- };
15
-
16
- /**
17
- * @title Форматированный текст
18
- */
19
- type RichText = RichTextProps & {
20
- /** @default rte */
21
- type: 'rte';
22
- };
11
+ type TextBenefit = DescriptionProps & LabelProps & DefaultListItemType;
23
12
 
24
13
  /**
25
14
  * @title Преимущество
@@ -27,7 +16,7 @@ type RichText = RichTextProps & {
27
16
  * "type": "default"
28
17
  * }
29
18
  */
30
- export type Benefit = TextBenefit | RichText;
19
+ export type Benefit = TextBenefit | RichTextItem;
31
20
 
32
21
  /**
33
22
  * @title Продуктовая плитка
@@ -4,22 +4,22 @@ import type { IconProps } from '../../model/Picture';
4
4
  import type { SizeVersion } from '../../model/SizeVersion';
5
5
  import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
6
6
 
7
+ type StepCommonProps = IconProps & {
8
+ /** @title Кнопка */
9
+ button?: ButtonWithIconProps;
10
+ /**
11
+ * @title Буллиты
12
+ * @default true
13
+ */
14
+ isDotted?: boolean;
15
+ /** @title Список */
16
+ items?: string[];
17
+ };
18
+
7
19
  /**
8
20
  * @title Шаг
9
21
  */
10
- export type Step = DescriptionProps &
11
- LabelProps &
12
- IconProps & {
13
- /** @title Кнопка */
14
- button?: ButtonWithIconProps;
15
- /**
16
- * @title Буллиты
17
- * @default true
18
- */
19
- isDotted?: boolean;
20
- /** @title Список */
21
- items?: string[];
22
- };
22
+ export type Step = DescriptionProps & LabelProps & StepCommonProps;
23
23
 
24
24
  /**
25
25
  * @title Блок шаги
@@ -1,6 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
- import { EventBus } from '../../EventBus/EventBus';
3
+ import { defaultEventBus } from '../../EventBus/defaultEventBus';
4
4
  import type { UniBlockProps } from '../../model/JSXBlock';
5
5
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
6
6
  import { renderTab } from './renderTab';
@@ -21,7 +21,7 @@ export const Tabs = JSX<TabsBlockProps>((props) => {
21
21
 
22
22
  useEffect(
23
23
  () =>
24
- EventBus.inst.subscribe('tab', (event) => {
24
+ defaultEventBus.subscribe('tab', (event) => {
25
25
  const tab = tabs?.find(checkTab(event));
26
26
  if (event.type === 'link' && tab) {
27
27
  setCurrentTab(tab);
@@ -35,14 +35,14 @@ export const Tabs = JSX<TabsBlockProps>((props) => {
35
35
  useEffect(
36
36
  () =>
37
37
  currentTab?.type === 'group'
38
- ? EventBus.inst.subject('tab', { type: currentTab.type, label: currentTab.ref })
38
+ ? defaultEventBus.subject('tab', { type: currentTab.type, label: currentTab.ref })
39
39
  : undefined,
40
40
  [currentTab],
41
41
  );
42
42
 
43
43
  const handleClick = useCallback((selectedTab: TabData) => {
44
44
  if (selectedTab?.type === 'group') {
45
- EventBus.inst.fire('tab', { type: selectedTab.type, label: selectedTab.ref });
45
+ defaultEventBus.fire('tab', { type: selectedTab.type, label: selectedTab.ref });
46
46
  }
47
47
  setCurrentTab(selectedTab);
48
48
  }, []);
@@ -1 +1,7 @@
1
- {}
1
+ {
2
+ "content": {
3
+ "__html": {
4
+ "ui:widget": "html"
5
+ }
6
+ }
7
+ }
@@ -1,5 +1,6 @@
1
- import type { Picture } from '../../model/Picture';
2
1
  import type { HeadlineCommonProps } from '../../model/HeadlineType';
2
+ import type { Picture } from '../../model/Picture';
3
+ import type { RichTextProps } from '../../ui-kit/RichText/RichTextProps';
3
4
 
4
5
  /**
5
6
  * @title Цвет блока
@@ -16,12 +17,13 @@ export type TextBlockIconVersion = 'none' | 'small' | 'big';
16
17
  /**
17
18
  * @title Текстовый блок
18
19
  */
19
- export type TextBlockContent = HeadlineCommonProps & {
20
- iconVersion?: TextBlockIconVersion;
21
- image?: Picture;
22
- blockVersion?: TextBlockVersion;
23
- /** @title Буллиты */ // TODO: mobile prop
24
- isDotted?: boolean;
25
- /** @title Список (моб.) */ // TODO: mobile prop
26
- items?: string[];
27
- };
20
+ export type TextBlockContent = HeadlineCommonProps &
21
+ RichTextProps & {
22
+ iconVersion?: TextBlockIconVersion;
23
+ image?: Picture;
24
+ blockVersion?: TextBlockVersion;
25
+ /** @title Буллиты */ // TODO: mobile prop
26
+ isDotted?: boolean;
27
+ /** @title Список (моб.) */ // TODO: mobile prop
28
+ items?: string[];
29
+ };
@@ -1,6 +1,6 @@
1
1
  import type { LinkProps } from '../model/LinkProps';
2
2
  import { projectSettings } from '../ProjectSettings';
3
- import { useBlockRouter } from '../services/BlockRouter/useBlockRouter';
3
+ import { gotoBlock } from '../services/BlockRouter/BlockRouter';
4
4
  import { isHash, isLocalURL, joinPath } from '../utils/url';
5
5
  import { handlerDecorator } from './handlerDecorator';
6
6
  import { useRouter } from './useRouter';
@@ -15,7 +15,6 @@ interface Clickable {
15
15
 
16
16
  export function useLink(isRemote?: boolean) {
17
17
  const router = useRouter();
18
- const blockRouter = useBlockRouter();
19
18
 
20
19
  return <L extends Partial<LinkProps & Clickable>>(props: L): L & Clickable => ({
21
20
  ...props,
@@ -44,7 +43,7 @@ export function useLink(isRemote?: boolean) {
44
43
  // Client routing
45
44
  ev?.preventDefault();
46
45
  if (isHash(href)) {
47
- blockRouter.goto(href);
46
+ gotoBlock(router, href);
48
47
  } else if (href) {
49
48
  router.push(href);
50
49
  }
@@ -1,10 +1,14 @@
1
+ interface RouterOptions {
2
+ scroll?: boolean;
3
+ }
4
+
1
5
  export interface Router {
2
6
  pathname: string;
3
7
  query: Record<string, string | string[] | undefined>;
4
8
  href?: string;
5
9
  basePath?: string;
6
- push: (url: string) => void;
7
- replace: (url: string) => void;
10
+ push: (url: string, as?: string, options?: RouterOptions) => void;
11
+ replace: (url: string, as?: string, options?: RouterOptions) => void;
8
12
  }
9
13
 
10
14
  export function useRouter(): Router {
@@ -0,0 +1,4 @@
1
+ export interface DefaultListItemType {
2
+ /** @default default */
3
+ type: 'default';
4
+ }
@@ -0,0 +1,9 @@
1
+ import type { RichTextProps } from '../ui-kit/RichText/RichTextProps';
2
+
3
+ /**
4
+ * @title Форматированный текст
5
+ */
6
+ export interface RichTextItem extends RichTextProps {
7
+ /** @default rte */
8
+ type: 'rte';
9
+ }
@@ -1,53 +1,14 @@
1
- import { EventBus } from '../../EventBus/EventBus';
1
+ import type { Router } from '../../hooks/useRouter';
2
2
  import type { BlockDef } from '../../model/ContentPageDef';
3
3
 
4
- export interface GotoAnchorEvent {
5
- anchor: string;
6
- }
7
-
8
- export interface BlockIntersectionEvent {
9
- block: BlockDef;
10
- intersection: IntersectionObserverEntry;
11
- }
4
+ const normalizeAnchor = (anchor?: string) => anchor?.replace('#', '') || '';
12
5
 
13
- interface EventMap {
14
- goto: GotoAnchorEvent;
15
- intersection: BlockIntersectionEvent;
6
+ export function gotoBlock(router: Router, anchor?: string) {
7
+ router.replace(`#${normalizeAnchor(anchor)}`);
16
8
  }
17
9
 
18
- const normalizeAnchor = (rawAnchor?: string) => rawAnchor?.replace('#', '') || '';
19
- const getURLWithAnchor = (rawAnchor?: string) =>
20
- `${globalThis.location?.pathname}#${normalizeAnchor(rawAnchor)}`;
21
-
22
- export class BlockRouter {
23
- public static readonly inst = new BlockRouter();
24
-
25
- readonly eventBus = new EventBus<EventMap>();
26
-
27
- constructor() {
28
- const anchor = normalizeAnchor(globalThis.location?.hash);
29
- if (anchor) {
30
- this.eventBus.subject('goto', { anchor });
31
- }
32
- }
33
-
34
- goto(rawAnchor?: string) {
35
- const anchor = normalizeAnchor(rawAnchor);
36
- if (anchor) {
37
- this.push(anchor);
38
- this.eventBus.fire('goto', { anchor });
39
- }
40
- }
41
-
42
- push(rawAnchor: string) {
43
- globalThis.history?.pushState(null, '', getURLWithAnchor(rawAnchor));
44
- }
45
-
46
- replace(rawAnchor: string) {
47
- globalThis.history?.replaceState(null, '', getURLWithAnchor(rawAnchor));
48
- }
49
-
50
- reset() {
51
- globalThis.history?.replaceState(null, '', getURLWithAnchor());
52
- }
10
+ export function trackBlock(router: Router, block?: BlockDef) {
11
+ router.replace(`#${normalizeAnchor(block?.anchor)}`, undefined, {
12
+ scroll: false,
13
+ });
53
14
  }
@@ -0,0 +1,13 @@
1
+ import { EventBus } from '../../EventBus/EventBus';
2
+ import type { BlockDef } from '../../model/ContentPageDef';
3
+
4
+ export interface BlockIntersectionEvent {
5
+ block: BlockDef;
6
+ intersection: IntersectionObserverEntry;
7
+ }
8
+
9
+ interface EventMap {
10
+ intersection: BlockIntersectionEvent;
11
+ }
12
+
13
+ export const blockRouterEventBus = new EventBus<EventMap>();
@@ -1,12 +1,9 @@
1
- import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
1
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
3
3
  import type { BlockDef } from '../../model/ContentPageDef';
4
- import { BlockRouter } from './BlockRouter';
4
+ import { blockRouterEventBus } from './blockRouterEventBus';
5
5
 
6
- export function useBlockIntersectionObserver(
7
- block?: BlockDef,
8
- router: BlockRouter = BlockRouter.inst,
9
- ) {
6
+ export function useBlockIntersectionObserver(block?: BlockDef) {
10
7
  const observerCallback = useCallback(
11
8
  (entries: IntersectionObserverEntry[]) => {
12
9
  if (!block || !entries?.length) {
@@ -14,24 +11,10 @@ export function useBlockIntersectionObserver(
14
11
  }
15
12
 
16
13
  const intersection = entries[entries.length - 1];
17
- router.eventBus.fire('intersection', { block, intersection });
14
+ blockRouterEventBus.fire('intersection', { block, intersection });
18
15
  },
19
- [block, router],
16
+ [block],
20
17
  );
21
18
 
22
- const ref = useIntersectionObserver(observerCallback, { sensitivity: 1 });
23
-
24
- useEffect(() => {
25
- if (!ref.current) {
26
- return undefined;
27
- }
28
-
29
- return router.eventBus.subscribe('goto', ({ anchor }) => {
30
- if (ref.current && block?.anchor === anchor) {
31
- ref.current.scrollIntoView({ behavior: 'smooth', block: 'start' });
32
- }
33
- });
34
- }, [block, router]);
35
-
36
- return ref;
19
+ return useIntersectionObserver(observerCallback, { sensitivity: 1 });
37
20
  }
@@ -1,41 +1,35 @@
1
1
  import { useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useRouter } from '../../hooks/useRouter';
2
3
  import type { BlockDef } from '../../model/ContentPageDef';
3
4
  import { debounce } from '../../utils/debounce';
4
- import { BlockRouter } from './BlockRouter';
5
+ import { trackBlock } from './BlockRouter';
6
+ import { blockRouterEventBus } from './blockRouterEventBus';
5
7
  import { findActiveBlock } from './findActiveBlock';
6
8
 
7
9
  const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
8
10
 
9
- export function useBlockRouterProvider(
10
- router: BlockRouter = BlockRouter.inst,
11
- scrollTarget: EventTarget = globalThis,
12
- ) {
11
+ export function useBlockRouterProvider(scrollTarget: EventTarget = globalThis) {
12
+ const router = useRouter();
13
+
13
14
  const intersectionsMapRef = useRef<Map<BlockDef, IntersectionObserverEntry>>(new Map());
14
15
 
15
16
  useEffect(
16
17
  () =>
17
- router.eventBus.subscribe('intersection', ({ block, intersection }) => {
18
+ blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
18
19
  if (intersectionsMapRef.current) {
19
20
  intersectionsMapRef.current.set(block, intersection);
20
21
  }
21
22
  }),
22
- [router],
23
+ [],
23
24
  );
24
25
 
25
26
  useEffect(() => {
26
27
  const handleScroll = debounce(() => {
27
- if (!isScrolledEnough()) {
28
- router.reset();
29
-
30
- return;
31
- }
32
-
33
- const activeBlock = findActiveBlock([...(intersectionsMapRef.current || [])]);
34
-
35
- if (activeBlock?.anchor) {
36
- router.replace(activeBlock.anchor);
37
- } else if (!activeBlock) {
38
- router.reset();
28
+ if (isScrolledEnough()) {
29
+ const activeBlock = findActiveBlock([...(intersectionsMapRef.current || [])]);
30
+ trackBlock(router, activeBlock);
31
+ } else {
32
+ trackBlock(router);
39
33
  }
40
34
  }, 100);
41
35
 
@@ -1,8 +1,9 @@
1
1
  import type { BlockVersion } from '../../model/BlockVersion';
2
+ import type { DefaultListItemType } from '../../model/DefaultListItemType';
2
3
  import type { DescriptionProps, LabelProps } from '../../model/HeadlineType';
3
4
  import type { IconVersion } from '../../model/IconVersion';
4
5
  import type { IconProps } from '../../model/Picture';
5
- import { RichTextProps } from '../RichText/RichTextProps';
6
+ import type { RichTextItem } from '../../model/RichTextItem';
6
7
 
7
8
  export interface BenefitItemCommonProps {
8
9
  /** @hidden */
@@ -18,18 +19,7 @@ export type BenefitItemProps = DescriptionProps & LabelProps & IconProps;
18
19
  /**
19
20
  * @title Стандартный бенефит
20
21
  */
21
- type DefaultBenefit = BenefitItemProps & {
22
- /** @default default */
23
- type: 'default';
24
- };
25
-
26
- /**
27
- * @title Форматированный текст
28
- */
29
- type RichText = RichTextProps & {
30
- /** @default rte */
31
- type: 'rte';
32
- };
22
+ type DefaultBenefit = BenefitItemProps & DefaultListItemType;
33
23
 
34
24
  /**
35
25
  * @title Преимущество
@@ -37,7 +27,7 @@ type RichText = RichTextProps & {
37
27
  * "type": "default"
38
28
  * }
39
29
  */
40
- export type ComplexBenefitProps = DefaultBenefit | RichText;
30
+ export type ComplexBenefitProps = DefaultBenefit | RichTextItem;
41
31
 
42
32
  /**
43
33
  * @title Преимущество
@@ -1,6 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
- import { EventBus } from '../EventBus/EventBus';
3
+ import { defaultEventBus } from '../EventBus/defaultEventBus';
4
4
  import type { BlockVersion } from '../model/BlockVersion';
5
5
  import type { UniBlockProps } from '../model/JSXBlock';
6
6
  import { useBlockIntersectionObserver } from '../services/BlockRouter/useBlockIntersectionObserver';
@@ -28,7 +28,7 @@ export const BlockWrapper = JSX<BlockWrapperProps>(
28
28
  const [isVisible, setVisible] = useState(true);
29
29
  useEffect(
30
30
  () =>
31
- EventBus.inst.subscribe('tab', (event) => {
31
+ defaultEventBus.subscribe('tab', (event) => {
32
32
  if (event.type === 'group') {
33
33
  const hasSettings = block?.labels?.length || block?.anchor;
34
34
  setVisible(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -1,10 +1,4 @@
1
- import type { EventMap } from './EventMap';
2
-
3
- export type BaseEventMap = Record<string, any>;
4
-
5
- export class EventBus<EM extends BaseEventMap> {
6
- public static readonly inst = new EventBus<EventMap>();
7
-
1
+ export class EventBus<EM extends Record<string, any>> {
8
2
  private subscribers: Partial<Record<keyof EM, Array<(ev: EM[keyof EM]) => void>>> = {};
9
3
  private subjectsStateMap: Partial<EM> = {};
10
4
 
@@ -0,0 +1,8 @@
1
+ import type { TabActivationEvent } from '../components/Tabs/Tabs';
2
+ import { EventBus } from './EventBus';
3
+
4
+ interface GlobalEventMap {
5
+ tab: TabActivationEvent;
6
+ }
7
+
8
+ export const defaultEventBus = new EventBus<GlobalEventMap>();
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "content": {
3
3
  "button": {
4
- "href": "/credit-cards",
5
- "text": "Подробнее",
4
+ "href": "#",
5
+ "text": "Кнопка",
6
6
  "target": "_blank",
7
7
  "version": "primary"
8
8
  }
@@ -2,10 +2,13 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { UniBlockProps } from '../../model/JSXBlock';
3
3
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
4
4
  import { renderButtonsSection } from '../../ui-kit/Button/renderButtonsSection';
5
+ import { style } from '../../utils/style';
5
6
  import type { ButtonBlockContent } from './ButtonBlockContent';
6
7
 
7
8
  interface ButtonBlockProps extends ButtonBlockContent, UniBlockProps {}
8
9
 
9
- export const ButtonBlock = JSX<ButtonBlockProps>(({ button, ...rest }) => (
10
- <BlockWrapper {...rest}>{renderButtonsSection([button])}</BlockWrapper>
10
+ export const ButtonBlock = JSX<ButtonBlockProps>(({ button, className, ...rest }) => (
11
+ <BlockWrapper className={style('!bg-transparent', className)} {...rest}>
12
+ {renderButtonsSection([button])}
13
+ </BlockWrapper>
11
14
  ));