@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.
- package/bundle/EventBus/EventBus.d.ts +1 -4
- package/bundle/EventBus/defaultEventBus.d.ts +7 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +34 -70
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
- package/bundle/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/bundle/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/bundle/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/bundle/hooks/useRouter.d.ts +6 -2
- package/bundle/model/DefaultListItemType.d.ts +4 -0
- package/bundle/model/RichTextItem.d.ts +8 -0
- package/bundle/services/BlockRouter/BlockRouter.d.ts +3 -22
- package/bundle/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
- package/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
- package/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
- package/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/dist/EventBus/EventBus.d.ts +1 -4
- package/dist/EventBus/EventBus.js +0 -1
- package/dist/EventBus/EventBus.js.map +1 -1
- package/dist/EventBus/defaultEventBus.d.ts +7 -0
- package/dist/EventBus/defaultEventBus.js +5 -0
- package/dist/EventBus/defaultEventBus.js.map +1 -0
- package/dist/components/ButtonBlock/ButtonBlock.js +2 -1
- package/dist/components/ButtonBlock/ButtonBlock.js.map +1 -1
- package/dist/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
- package/dist/components/ProductTile/ProductTile.js +1 -2
- package/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/dist/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/dist/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/dist/components/Tabs/Tabs.js +4 -4
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/TextBlock/TextBlock.js +3 -2
- package/dist/components/TextBlock/TextBlock.js.map +1 -1
- package/dist/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/dist/hooks/useLink.js +2 -3
- package/dist/hooks/useLink.js.map +1 -1
- package/dist/hooks/useRouter.d.ts +6 -2
- package/dist/hooks/useRouter.js.map +1 -1
- package/dist/model/DefaultListItemType.d.ts +4 -0
- package/dist/model/DefaultListItemType.js +2 -0
- package/dist/model/DefaultListItemType.js.map +1 -0
- package/dist/model/RichTextItem.d.ts +8 -0
- package/{mobile/dist/EventBus/EventMap.js → dist/model/RichTextItem.js} +1 -1
- package/dist/model/RichTextItem.js.map +1 -0
- package/dist/services/BlockRouter/BlockRouter.d.ts +3 -22
- package/dist/services/BlockRouter/BlockRouter.js +11 -30
- package/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/dist/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
- package/dist/services/BlockRouter/blockRouterEventBus.js +5 -0
- package/dist/services/BlockRouter/blockRouterEventBus.js.map +1 -0
- package/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
- package/dist/services/BlockRouter/useBlockIntersectionObserver.js +5 -16
- package/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
- package/dist/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
- package/dist/services/BlockRouter/useBlockRouterProvider.js +11 -12
- package/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/dist/ui-kit/BlockWrapper.js +2 -2
- package/dist/ui-kit/BlockWrapper.js.map +1 -1
- package/lib/EventBus/EventBus.d.ts +1 -4
- package/lib/EventBus/EventBus.js +0 -1
- package/lib/EventBus/EventBus.js.map +1 -1
- package/lib/EventBus/defaultEventBus.d.ts +7 -0
- package/lib/EventBus/defaultEventBus.js +3 -0
- package/lib/EventBus/defaultEventBus.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/ButtonBlock/ButtonBlock.js +2 -1
- package/lib/components/ButtonBlock/ButtonBlock.js.map +1 -1
- package/lib/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
- package/lib/components/ProductTile/ProductTile.js +1 -2
- package/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/lib/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/lib/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/lib/components/Tabs/Tabs.js +4 -4
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/TextBlock/TextBlock.js +3 -2
- package/lib/components/TextBlock/TextBlock.js.map +1 -1
- package/lib/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/lib/hooks/useLink.js +2 -3
- package/lib/hooks/useLink.js.map +1 -1
- package/lib/hooks/useRouter.d.ts +6 -2
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/model/DefaultListItemType.d.ts +4 -0
- package/lib/model/DefaultListItemType.js +2 -0
- package/lib/model/DefaultListItemType.js.map +1 -0
- package/lib/model/RichTextItem.d.ts +8 -0
- package/lib/model/RichTextItem.js +2 -0
- package/lib/model/RichTextItem.js.map +1 -0
- package/lib/services/BlockRouter/BlockRouter.d.ts +3 -22
- package/lib/services/BlockRouter/BlockRouter.js +8 -28
- package/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/lib/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
- package/lib/services/BlockRouter/blockRouterEventBus.js +3 -0
- package/lib/services/BlockRouter/blockRouterEventBus.js.map +1 -0
- package/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
- package/lib/services/BlockRouter/useBlockIntersectionObserver.js +6 -17
- package/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
- package/lib/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
- package/lib/services/BlockRouter/useBlockRouterProvider.js +12 -13
- package/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/lib/ui-kit/BlockWrapper.js +2 -2
- package/lib/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/bundle/EventBus/EventBus.d.ts +1 -4
- package/mobile/bundle/EventBus/defaultEventBus.d.ts +7 -0
- package/mobile/bundle/bundle.umd.js +27 -62
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
- package/mobile/bundle/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/mobile/bundle/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/mobile/bundle/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/mobile/bundle/hooks/useRouter.d.ts +6 -2
- package/mobile/bundle/model/DefaultListItemType.d.ts +4 -0
- package/mobile/bundle/model/RichTextItem.d.ts +8 -0
- package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +3 -22
- package/mobile/bundle/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
- package/mobile/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
- package/mobile/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
- package/mobile/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/mobile/dist/EventBus/EventBus.d.ts +1 -4
- package/mobile/dist/EventBus/EventBus.js +0 -1
- package/mobile/dist/EventBus/EventBus.js.map +1 -1
- package/mobile/dist/EventBus/defaultEventBus.d.ts +7 -0
- package/mobile/dist/EventBus/defaultEventBus.js +5 -0
- package/mobile/dist/EventBus/defaultEventBus.js.map +1 -0
- package/mobile/dist/components/ButtonBlock/ButtonBlock.js +2 -1
- package/mobile/dist/components/ButtonBlock/ButtonBlock.js.map +1 -1
- package/mobile/dist/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
- package/mobile/dist/components/ProductTile/ProductTile.js +1 -2
- package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/mobile/dist/components/Tabs/Tabs.js +4 -4
- package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
- package/mobile/dist/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/mobile/dist/hooks/useLink.js +2 -3
- package/mobile/dist/hooks/useLink.js.map +1 -1
- package/mobile/dist/hooks/useRouter.d.ts +6 -2
- package/mobile/dist/hooks/useRouter.js.map +1 -1
- package/mobile/dist/model/DefaultListItemType.d.ts +4 -0
- package/mobile/dist/model/DefaultListItemType.js +2 -0
- package/mobile/dist/model/DefaultListItemType.js.map +1 -0
- package/mobile/dist/model/RichTextItem.d.ts +8 -0
- package/{dist/EventBus/EventMap.js → mobile/dist/model/RichTextItem.js} +1 -1
- package/mobile/dist/model/RichTextItem.js.map +1 -0
- package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +3 -22
- package/mobile/dist/services/BlockRouter/BlockRouter.js +11 -30
- package/mobile/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/dist/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
- package/mobile/dist/services/BlockRouter/blockRouterEventBus.js +5 -0
- package/mobile/dist/services/BlockRouter/blockRouterEventBus.js.map +1 -0
- package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
- package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js +5 -16
- package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
- package/mobile/dist/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
- package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js +11 -12
- package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/mobile/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/mobile/dist/ui-kit/BlockWrapper.js +2 -2
- package/mobile/dist/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/lib/EventBus/EventBus.d.ts +1 -4
- package/mobile/lib/EventBus/EventBus.js +0 -1
- package/mobile/lib/EventBus/EventBus.js.map +1 -1
- package/mobile/lib/EventBus/defaultEventBus.d.ts +7 -0
- package/mobile/lib/EventBus/defaultEventBus.js +3 -0
- package/mobile/lib/EventBus/defaultEventBus.js.map +1 -0
- package/mobile/lib/components/ButtonBlock/ButtonBlock.js +2 -1
- package/mobile/lib/components/ButtonBlock/ButtonBlock.js.map +1 -1
- package/mobile/lib/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
- package/mobile/lib/components/ProductTile/ProductTile.js +1 -2
- package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/mobile/lib/components/Tabs/Tabs.js +4 -4
- package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
- package/mobile/lib/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/mobile/lib/hooks/useLink.js +2 -3
- package/mobile/lib/hooks/useLink.js.map +1 -1
- package/mobile/lib/hooks/useRouter.d.ts +6 -2
- package/mobile/lib/hooks/useRouter.js.map +1 -1
- package/mobile/lib/model/DefaultListItemType.d.ts +4 -0
- package/mobile/lib/model/DefaultListItemType.js +2 -0
- package/mobile/lib/model/DefaultListItemType.js.map +1 -0
- package/mobile/lib/model/RichTextItem.d.ts +8 -0
- package/mobile/lib/model/RichTextItem.js +2 -0
- package/mobile/lib/model/RichTextItem.js.map +1 -0
- package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +3 -22
- package/mobile/lib/services/BlockRouter/BlockRouter.js +8 -28
- package/mobile/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/lib/services/BlockRouter/blockRouterEventBus.d.ts +11 -0
- package/mobile/lib/services/BlockRouter/blockRouterEventBus.js +3 -0
- package/mobile/lib/services/BlockRouter/blockRouterEventBus.js.map +1 -0
- package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +1 -2
- package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js +6 -17
- package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +1 -1
- package/mobile/lib/services/BlockRouter/useBlockRouterProvider.d.ts +1 -2
- package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js +12 -13
- package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/mobile/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/mobile/lib/ui-kit/BlockWrapper.js +2 -2
- package/mobile/lib/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/src/EventBus/EventBus.ts +1 -7
- package/mobile/src/EventBus/defaultEventBus.ts +8 -0
- package/mobile/src/components/ButtonBlock/ButtonBlock.example.json +2 -2
- package/mobile/src/components/ButtonBlock/ButtonBlock.tsx +5 -2
- package/mobile/src/components/ButtonBlock/ButtonBlockContent.ts +5 -1
- package/mobile/src/components/ProductTile/ProductTile.tsx +1 -2
- package/mobile/src/components/ProductTile/ProductTileContent.ts +4 -15
- package/mobile/src/components/StepsBlock/StepsBlockContent.ts +13 -13
- package/mobile/src/components/Tabs/Tabs.tsx +4 -4
- package/mobile/src/components/TextBlock/TextBlock.ui.json +7 -1
- package/mobile/src/components/TextBlock/TextBlockContent.ts +12 -10
- package/mobile/src/hooks/useLink.ts +2 -3
- package/mobile/src/hooks/useRouter.ts +6 -2
- package/mobile/src/model/DefaultListItemType.ts +4 -0
- package/mobile/src/model/RichTextItem.ts +9 -0
- package/mobile/src/services/BlockRouter/BlockRouter.ts +8 -47
- package/mobile/src/services/BlockRouter/blockRouterEventBus.ts +13 -0
- package/mobile/src/services/BlockRouter/useBlockIntersectionObserver.ts +6 -23
- package/mobile/src/services/BlockRouter/useBlockRouterProvider.ts +13 -19
- package/mobile/src/ui-kit/BenefitItem/BenefitItemProps.ts +4 -14
- package/mobile/src/ui-kit/BlockWrapper.tsx +2 -2
- package/package.json +1 -1
- package/src/EventBus/EventBus.ts +1 -7
- package/src/EventBus/defaultEventBus.ts +8 -0
- package/src/components/ButtonBlock/ButtonBlock.example.json +2 -2
- package/src/components/ButtonBlock/ButtonBlock.tsx +5 -2
- package/src/components/ButtonBlock/ButtonBlockContent.ts +5 -1
- package/src/components/ProductTile/ProductTile.tsx +1 -2
- package/src/components/ProductTile/ProductTileContent.ts +4 -15
- package/src/components/StepsBlock/StepsBlockContent.ts +13 -13
- package/src/components/Tabs/Tabs.tsx +4 -4
- package/src/components/TextBlock/TextBlock.tsx +3 -0
- package/src/components/TextBlock/TextBlock.ui.json +7 -1
- package/src/components/TextBlock/TextBlockContent.ts +12 -10
- package/src/hooks/useLink.ts +2 -3
- package/src/hooks/useRouter.ts +6 -2
- package/src/model/DefaultListItemType.ts +4 -0
- package/src/model/RichTextItem.ts +9 -0
- package/src/services/BlockRouter/BlockRouter.ts +8 -47
- package/src/services/BlockRouter/blockRouterEventBus.ts +13 -0
- package/src/services/BlockRouter/useBlockIntersectionObserver.ts +6 -23
- package/src/services/BlockRouter/useBlockRouterProvider.ts +13 -19
- package/src/ui-kit/BenefitItem/BenefitItemProps.ts +4 -14
- package/src/ui-kit/BlockWrapper.tsx +2 -2
- package/bundle/EventBus/EventMap.d.ts +0 -4
- package/bundle/services/BlockRouter/useBlockRouter.d.ts +0 -2
- package/dist/EventBus/EventMap.d.ts +0 -4
- package/dist/EventBus/EventMap.js.map +0 -1
- package/dist/model/BlurVersion.d.ts +0 -0
- package/dist/model/BlurVersion.js +0 -1
- package/dist/model/BlurVersion.js.map +0 -1
- package/dist/services/BlockRouter/useBlockRouter.d.ts +0 -2
- package/dist/services/BlockRouter/useBlockRouter.js +0 -8
- package/dist/services/BlockRouter/useBlockRouter.js.map +0 -1
- package/lib/EventBus/EventMap.d.ts +0 -4
- package/lib/EventBus/EventMap.js +0 -2
- package/lib/EventBus/EventMap.js.map +0 -1
- package/lib/model/BlurVersion.d.ts +0 -0
- package/lib/model/BlurVersion.js +0 -1
- package/lib/model/BlurVersion.js.map +0 -1
- package/lib/services/BlockRouter/useBlockRouter.d.ts +0 -2
- package/lib/services/BlockRouter/useBlockRouter.js +0 -5
- package/lib/services/BlockRouter/useBlockRouter.js.map +0 -1
- package/mobile/bundle/EventBus/EventMap.d.ts +0 -4
- package/mobile/bundle/services/BlockRouter/useBlockRouter.d.ts +0 -2
- package/mobile/dist/EventBus/EventMap.d.ts +0 -4
- package/mobile/dist/EventBus/EventMap.js.map +0 -1
- package/mobile/dist/model/BlurVersion.d.ts +0 -0
- package/mobile/dist/model/BlurVersion.js +0 -1
- package/mobile/dist/model/BlurVersion.js.map +0 -1
- package/mobile/dist/services/BlockRouter/useBlockRouter.d.ts +0 -2
- package/mobile/dist/services/BlockRouter/useBlockRouter.js +0 -8
- package/mobile/dist/services/BlockRouter/useBlockRouter.js.map +0 -1
- package/mobile/lib/EventBus/EventMap.d.ts +0 -4
- package/mobile/lib/EventBus/EventMap.js +0 -2
- package/mobile/lib/EventBus/EventMap.js.map +0 -1
- package/mobile/lib/model/BlurVersion.d.ts +0 -0
- package/mobile/lib/model/BlurVersion.js +0 -1
- package/mobile/lib/model/BlurVersion.js.map +0 -1
- package/mobile/lib/services/BlockRouter/useBlockRouter.d.ts +0 -2
- package/mobile/lib/services/BlockRouter/useBlockRouter.js +0 -5
- package/mobile/lib/services/BlockRouter/useBlockRouter.js.map +0 -1
- package/mobile/src/EventBus/EventMap.ts +0 -5
- package/mobile/src/model/BlurVersion.ts +0 -0
- package/mobile/src/services/BlockRouter/useBlockRouter.ts +0 -5
- package/src/EventBus/EventMap.ts +0 -5
- package/src/model/BlurVersion.ts +0 -0
- 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 {
|
|
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 |
|
|
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 {
|
|
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(() =>
|
|
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,
|
|
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
|
-
|
|
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
|
|
|
@@ -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}>
|
|
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
|
-
/**
|
|
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 |
|
|
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 {
|
|
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
|
-
|
|
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
|
-
?
|
|
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
|
-
|
|
45
|
+
defaultEventBus.fire('tab', { type: selectedTab.type, label: selectedTab.ref });
|
|
46
46
|
}
|
|
47
47
|
setCurrentTab(selectedTab);
|
|
48
48
|
}, []);
|
|
@@ -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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
@@ -1,53 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Router } from '../../hooks/useRouter';
|
|
2
2
|
import type { BlockDef } from '../../model/ContentPageDef';
|
|
3
3
|
|
|
4
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
intersection: BlockIntersectionEvent;
|
|
6
|
+
export function gotoBlock(router: Router, anchor?: string) {
|
|
7
|
+
router.replace(`#${normalizeAnchor(anchor)}`);
|
|
16
8
|
}
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
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 {
|
|
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
|
-
|
|
14
|
+
blockRouterEventBus.fire('intersection', { block, intersection });
|
|
18
15
|
},
|
|
19
|
-
[block
|
|
16
|
+
[block],
|
|
20
17
|
);
|
|
21
18
|
|
|
22
|
-
|
|
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 {
|
|
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
|
|
11
|
-
|
|
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
|
-
|
|
18
|
+
blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
|
|
18
19
|
if (intersectionsMapRef.current) {
|
|
19
20
|
intersectionsMapRef.current.set(block, intersection);
|
|
20
21
|
}
|
|
21
22
|
}),
|
|
22
|
-
[
|
|
23
|
+
[],
|
|
23
24
|
);
|
|
24
25
|
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
const handleScroll = debounce(() => {
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 {
|
|
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 |
|
|
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 {
|
|
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
|
-
|
|
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
package/src/EventBus/EventBus.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
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
|
|
|
@@ -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}>
|
|
10
|
+
export const ButtonBlock = JSX<ButtonBlockProps>(({ button, className, ...rest }) => (
|
|
11
|
+
<BlockWrapper className={style('!bg-transparent', className)} {...rest}>
|
|
12
|
+
{renderButtonsSection([button])}
|
|
13
|
+
</BlockWrapper>
|
|
11
14
|
));
|