@redneckz/wildless-cms-uni-blocks 0.14.76 → 0.14.78

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 (134) hide show
  1. package/bin/migration-scripts/0.14.68.js +1 -1
  2. package/bundle/bundle.umd.js +27 -97
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/BonusBenefitsBlock/renderBonusBenefit.js +1 -1
  5. package/dist/components/BonusBenefitsBlock/renderBonusBenefit.js.map +1 -1
  6. package/dist/components/ContentPage/ContentPage.js +0 -2
  7. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  8. package/dist/ui-kit/BlockWrapper.js +1 -3
  9. package/dist/ui-kit/BlockWrapper.js.map +1 -1
  10. package/lib/components/BonusBenefitsBlock/renderBonusBenefit.js +1 -1
  11. package/lib/components/BonusBenefitsBlock/renderBonusBenefit.js.map +1 -1
  12. package/lib/components/ContentPage/ContentPage.js +0 -2
  13. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  14. package/lib/ui-kit/BlockWrapper.js +1 -3
  15. package/lib/ui-kit/BlockWrapper.js.map +1 -1
  16. package/mobile/bundle/bundle.umd.js +27 -97
  17. package/mobile/bundle/bundle.umd.min.js +1 -1
  18. package/mobile/dist/components/BonusBenefitsBlock/renderBonusBenefit.js +1 -1
  19. package/mobile/dist/components/BonusBenefitsBlock/renderBonusBenefit.js.map +1 -1
  20. package/mobile/dist/components/ContentPage/ContentPage.js +0 -2
  21. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  22. package/mobile/dist/ui-kit/BlockWrapper.js +1 -3
  23. package/mobile/dist/ui-kit/BlockWrapper.js.map +1 -1
  24. package/mobile/lib/common.css +1 -1
  25. package/mobile/lib/components/BonusBenefitsBlock/renderBonusBenefit.js +1 -1
  26. package/mobile/lib/components/BonusBenefitsBlock/renderBonusBenefit.js.map +1 -1
  27. package/mobile/lib/components/ContentPage/ContentPage.js +0 -2
  28. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  29. package/mobile/lib/ui-kit/BlockWrapper.js +1 -3
  30. package/mobile/lib/ui-kit/BlockWrapper.js.map +1 -1
  31. package/mobile/src/components/BonusBenefitsBlock/renderBonusBenefit.tsx +1 -1
  32. package/mobile/src/components/ContentPage/ContentPage.tsx +0 -3
  33. package/mobile/src/ui-kit/BlockWrapper.tsx +2 -4
  34. package/package.json +1 -1
  35. package/src/components/BenefitsBlock/BenefitsBlock.fixture.tsx +3 -3
  36. package/src/components/BonusBenefitsBlock/renderBonusBenefit.tsx +1 -1
  37. package/src/components/ContentPage/ContentPage.tsx +0 -3
  38. package/src/ui-kit/BlockWrapper.tsx +2 -4
  39. package/bundle/services/BlockRouter/BlockIntersection.d.ts +0 -2
  40. package/bundle/services/BlockRouter/BlockRouter.d.ts +0 -2
  41. package/bundle/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  42. package/bundle/services/BlockRouter/findActiveBlock.d.ts +0 -3
  43. package/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  44. package/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  45. package/dist/services/BlockRouter/BlockIntersection.d.ts +0 -2
  46. package/dist/services/BlockRouter/BlockIntersection.js +0 -2
  47. package/dist/services/BlockRouter/BlockIntersection.js.map +0 -1
  48. package/dist/services/BlockRouter/BlockRouter.d.ts +0 -2
  49. package/dist/services/BlockRouter/BlockRouter.js +0 -11
  50. package/dist/services/BlockRouter/BlockRouter.js.map +0 -1
  51. package/dist/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  52. package/dist/services/BlockRouter/blockRouterEventBus.js +0 -5
  53. package/dist/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  54. package/dist/services/BlockRouter/findActiveBlock.d.ts +0 -3
  55. package/dist/services/BlockRouter/findActiveBlock.js +0 -15
  56. package/dist/services/BlockRouter/findActiveBlock.js.map +0 -1
  57. package/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  58. package/dist/services/BlockRouter/useBlockIntersectionObserver.js +0 -17
  59. package/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  60. package/dist/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  61. package/dist/services/BlockRouter/useBlockRouterProvider.js +0 -28
  62. package/dist/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  63. package/lib/services/BlockRouter/BlockIntersection.d.ts +0 -2
  64. package/lib/services/BlockRouter/BlockIntersection.js +0 -2
  65. package/lib/services/BlockRouter/BlockIntersection.js.map +0 -1
  66. package/lib/services/BlockRouter/BlockRouter.d.ts +0 -2
  67. package/lib/services/BlockRouter/BlockRouter.js +0 -8
  68. package/lib/services/BlockRouter/BlockRouter.js.map +0 -1
  69. package/lib/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  70. package/lib/services/BlockRouter/blockRouterEventBus.js +0 -3
  71. package/lib/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  72. package/lib/services/BlockRouter/findActiveBlock.d.ts +0 -3
  73. package/lib/services/BlockRouter/findActiveBlock.js +0 -12
  74. package/lib/services/BlockRouter/findActiveBlock.js.map +0 -1
  75. package/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  76. package/lib/services/BlockRouter/useBlockIntersectionObserver.js +0 -14
  77. package/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  78. package/lib/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  79. package/lib/services/BlockRouter/useBlockRouterProvider.js +0 -25
  80. package/lib/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  81. package/mobile/bundle/services/BlockRouter/BlockIntersection.d.ts +0 -2
  82. package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +0 -2
  83. package/mobile/bundle/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  84. package/mobile/bundle/services/BlockRouter/findActiveBlock.d.ts +0 -3
  85. package/mobile/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  86. package/mobile/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  87. package/mobile/dist/services/BlockRouter/BlockIntersection.d.ts +0 -2
  88. package/mobile/dist/services/BlockRouter/BlockIntersection.js +0 -2
  89. package/mobile/dist/services/BlockRouter/BlockIntersection.js.map +0 -1
  90. package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +0 -2
  91. package/mobile/dist/services/BlockRouter/BlockRouter.js +0 -11
  92. package/mobile/dist/services/BlockRouter/BlockRouter.js.map +0 -1
  93. package/mobile/dist/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  94. package/mobile/dist/services/BlockRouter/blockRouterEventBus.js +0 -5
  95. package/mobile/dist/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  96. package/mobile/dist/services/BlockRouter/findActiveBlock.d.ts +0 -3
  97. package/mobile/dist/services/BlockRouter/findActiveBlock.js +0 -15
  98. package/mobile/dist/services/BlockRouter/findActiveBlock.js.map +0 -1
  99. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  100. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js +0 -17
  101. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  102. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  103. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js +0 -28
  104. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  105. package/mobile/lib/services/BlockRouter/BlockIntersection.d.ts +0 -2
  106. package/mobile/lib/services/BlockRouter/BlockIntersection.js +0 -2
  107. package/mobile/lib/services/BlockRouter/BlockIntersection.js.map +0 -1
  108. package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +0 -2
  109. package/mobile/lib/services/BlockRouter/BlockRouter.js +0 -8
  110. package/mobile/lib/services/BlockRouter/BlockRouter.js.map +0 -1
  111. package/mobile/lib/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  112. package/mobile/lib/services/BlockRouter/blockRouterEventBus.js +0 -3
  113. package/mobile/lib/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  114. package/mobile/lib/services/BlockRouter/findActiveBlock.d.ts +0 -3
  115. package/mobile/lib/services/BlockRouter/findActiveBlock.js +0 -12
  116. package/mobile/lib/services/BlockRouter/findActiveBlock.js.map +0 -1
  117. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  118. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js +0 -14
  119. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  120. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  121. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js +0 -25
  122. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  123. package/mobile/src/services/BlockRouter/BlockIntersection.ts +0 -3
  124. package/mobile/src/services/BlockRouter/BlockRouter.ts +0 -11
  125. package/mobile/src/services/BlockRouter/blockRouterEventBus.ts +0 -13
  126. package/mobile/src/services/BlockRouter/findActiveBlock.ts +0 -20
  127. package/mobile/src/services/BlockRouter/useBlockIntersectionObserver.ts +0 -20
  128. package/mobile/src/services/BlockRouter/useBlockRouterProvider.ts +0 -37
  129. package/src/services/BlockRouter/BlockIntersection.ts +0 -3
  130. package/src/services/BlockRouter/BlockRouter.ts +0 -11
  131. package/src/services/BlockRouter/blockRouterEventBus.ts +0 -13
  132. package/src/services/BlockRouter/findActiveBlock.ts +0 -20
  133. package/src/services/BlockRouter/useBlockIntersectionObserver.ts +0 -20
  134. package/src/services/BlockRouter/useBlockRouterProvider.ts +0 -37
@@ -1,11 +0,0 @@
1
- import { type BlockDef } from '../../model/ContentPageDef';
2
-
3
- const normalizeAnchor = (anchor?: string) => anchor?.replace('#', '') || '';
4
-
5
- export function trackBlock(block?: BlockDef) {
6
- const hash = `#${normalizeAnchor(block?.anchor)}`;
7
-
8
- if (globalThis.location?.hash !== hash) {
9
- globalThis.history?.replaceState(globalThis.history?.state, '', hash);
10
- }
11
- }
@@ -1,13 +0,0 @@
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,20 +0,0 @@
1
- import { type BlockDef } from '../../model/ContentPageDef';
2
- import { minBy } from '../../utils/minBy';
3
- import { type BlockIntersection } from './BlockIntersection';
4
-
5
- const SPECIAL_BLOCK_TYPES = ['Header', 'Footer'];
6
- const EPS = 0.01;
7
-
8
- const topLineDelta = ([, { target }]: BlockIntersection) =>
9
- Math.abs(target.getBoundingClientRect().top);
10
-
11
- export function findActiveBlock(intersections: BlockIntersection[]): BlockDef | undefined {
12
- const visibleIntersections = intersections
13
- .filter(([block]) => !SPECIAL_BLOCK_TYPES.includes(block.type || ''))
14
- .filter(([, { intersectionRatio }]) => intersectionRatio > EPS);
15
-
16
- const [activeBlock] =
17
- visibleIntersections.length > 0 ? minBy(topLineDelta)(visibleIntersections) : [];
18
-
19
- return activeBlock;
20
- }
@@ -1,20 +0,0 @@
1
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
- import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
3
- import { type BlockDef } from '../../model/ContentPageDef';
4
- import { blockRouterEventBus } from './blockRouterEventBus';
5
-
6
- export function useBlockIntersectionObserver(block?: BlockDef) {
7
- const observerCallback = useCallback(
8
- (entries: IntersectionObserverEntry[]) => {
9
- if (!block || !entries?.length) {
10
- return;
11
- }
12
-
13
- const intersection = entries[entries.length - 1];
14
- blockRouterEventBus.fire('intersection', { block, intersection });
15
- },
16
- [block],
17
- );
18
-
19
- return useIntersectionObserver(observerCallback, { sensitivity: 1 });
20
- }
@@ -1,37 +0,0 @@
1
- import { useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
2
- import { type BlockDef } from '../../model/ContentPageDef';
3
- import { debounce } from '../../utils/debounce';
4
- import { trackBlock } from './BlockRouter';
5
- import { blockRouterEventBus } from './blockRouterEventBus';
6
- import { findActiveBlock } from './findActiveBlock';
7
-
8
- const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
9
-
10
- export function useBlockRouterProvider(scrollTarget: EventTarget = globalThis) {
11
- const intersectionsMapRef = useRef<Map<BlockDef, IntersectionObserverEntry>>(new Map());
12
-
13
- useEffect(
14
- () =>
15
- blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
16
- if (intersectionsMapRef.current) {
17
- intersectionsMapRef.current.set(block, intersection);
18
- }
19
- }),
20
- [],
21
- );
22
-
23
- useEffect(() => {
24
- const handleScroll = debounce(() => {
25
- trackBlock(
26
- isScrolledEnough() ? findActiveBlock([...(intersectionsMapRef.current || [])]) : undefined,
27
- );
28
- }, 100);
29
-
30
- scrollTarget.addEventListener('scroll', handleScroll);
31
-
32
- return () => {
33
- handleScroll.dispose();
34
- scrollTarget.removeEventListener('scroll', handleScroll);
35
- };
36
- }, [scrollTarget]);
37
- }
@@ -1,3 +0,0 @@
1
- import { type BlockDef } from '../../model/ContentPageDef';
2
-
3
- export type BlockIntersection = [BlockDef, IntersectionObserverEntry];
@@ -1,11 +0,0 @@
1
- import { type BlockDef } from '../../model/ContentPageDef';
2
-
3
- const normalizeAnchor = (anchor?: string) => anchor?.replace('#', '') || '';
4
-
5
- export function trackBlock(block?: BlockDef) {
6
- const hash = `#${normalizeAnchor(block?.anchor)}`;
7
-
8
- if (globalThis.location?.hash !== hash) {
9
- globalThis.history?.replaceState(globalThis.history?.state, '', hash);
10
- }
11
- }
@@ -1,13 +0,0 @@
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,20 +0,0 @@
1
- import { type BlockDef } from '../../model/ContentPageDef';
2
- import { minBy } from '../../utils/minBy';
3
- import { type BlockIntersection } from './BlockIntersection';
4
-
5
- const SPECIAL_BLOCK_TYPES = ['Header', 'Footer'];
6
- const EPS = 0.01;
7
-
8
- const topLineDelta = ([, { target }]: BlockIntersection) =>
9
- Math.abs(target.getBoundingClientRect().top);
10
-
11
- export function findActiveBlock(intersections: BlockIntersection[]): BlockDef | undefined {
12
- const visibleIntersections = intersections
13
- .filter(([block]) => !SPECIAL_BLOCK_TYPES.includes(block.type || ''))
14
- .filter(([, { intersectionRatio }]) => intersectionRatio > EPS);
15
-
16
- const [activeBlock] =
17
- visibleIntersections.length > 0 ? minBy(topLineDelta)(visibleIntersections) : [];
18
-
19
- return activeBlock;
20
- }
@@ -1,20 +0,0 @@
1
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
- import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
3
- import { type BlockDef } from '../../model/ContentPageDef';
4
- import { blockRouterEventBus } from './blockRouterEventBus';
5
-
6
- export function useBlockIntersectionObserver(block?: BlockDef) {
7
- const observerCallback = useCallback(
8
- (entries: IntersectionObserverEntry[]) => {
9
- if (!block || !entries?.length) {
10
- return;
11
- }
12
-
13
- const intersection = entries[entries.length - 1];
14
- blockRouterEventBus.fire('intersection', { block, intersection });
15
- },
16
- [block],
17
- );
18
-
19
- return useIntersectionObserver(observerCallback, { sensitivity: 1 });
20
- }
@@ -1,37 +0,0 @@
1
- import { useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
2
- import { type BlockDef } from '../../model/ContentPageDef';
3
- import { debounce } from '../../utils/debounce';
4
- import { trackBlock } from './BlockRouter';
5
- import { blockRouterEventBus } from './blockRouterEventBus';
6
- import { findActiveBlock } from './findActiveBlock';
7
-
8
- const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
9
-
10
- export function useBlockRouterProvider(scrollTarget: EventTarget = globalThis) {
11
- const intersectionsMapRef = useRef<Map<BlockDef, IntersectionObserverEntry>>(new Map());
12
-
13
- useEffect(
14
- () =>
15
- blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
16
- if (intersectionsMapRef.current) {
17
- intersectionsMapRef.current.set(block, intersection);
18
- }
19
- }),
20
- [],
21
- );
22
-
23
- useEffect(() => {
24
- const handleScroll = debounce(() => {
25
- trackBlock(
26
- isScrolledEnough() ? findActiveBlock([...(intersectionsMapRef.current || [])]) : undefined,
27
- );
28
- }, 100);
29
-
30
- scrollTarget.addEventListener('scroll', handleScroll);
31
-
32
- return () => {
33
- handleScroll.dispose();
34
- scrollTarget.removeEventListener('scroll', handleScroll);
35
- };
36
- }, [scrollTarget]);
37
- }