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

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 (121) hide show
  1. package/bundle/bundle.umd.js +26 -96
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/dist/components/ContentPage/ContentPage.js +0 -2
  4. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  5. package/dist/ui-kit/BlockWrapper.js +1 -3
  6. package/dist/ui-kit/BlockWrapper.js.map +1 -1
  7. package/lib/components/ContentPage/ContentPage.js +0 -2
  8. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  9. package/lib/ui-kit/BlockWrapper.js +1 -3
  10. package/lib/ui-kit/BlockWrapper.js.map +1 -1
  11. package/mobile/bundle/bundle.umd.js +26 -96
  12. package/mobile/bundle/bundle.umd.min.js +1 -1
  13. package/mobile/dist/components/ContentPage/ContentPage.js +0 -2
  14. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  15. package/mobile/dist/ui-kit/BlockWrapper.js +1 -3
  16. package/mobile/dist/ui-kit/BlockWrapper.js.map +1 -1
  17. package/mobile/lib/components/ContentPage/ContentPage.js +0 -2
  18. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  19. package/mobile/lib/ui-kit/BlockWrapper.js +1 -3
  20. package/mobile/lib/ui-kit/BlockWrapper.js.map +1 -1
  21. package/mobile/src/components/ContentPage/ContentPage.tsx +0 -3
  22. package/mobile/src/ui-kit/BlockWrapper.tsx +2 -4
  23. package/package.json +1 -1
  24. package/src/components/ContentPage/ContentPage.tsx +0 -3
  25. package/src/ui-kit/BlockWrapper.tsx +2 -4
  26. package/bundle/services/BlockRouter/BlockIntersection.d.ts +0 -2
  27. package/bundle/services/BlockRouter/BlockRouter.d.ts +0 -2
  28. package/bundle/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  29. package/bundle/services/BlockRouter/findActiveBlock.d.ts +0 -3
  30. package/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  31. package/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  32. package/dist/services/BlockRouter/BlockIntersection.d.ts +0 -2
  33. package/dist/services/BlockRouter/BlockIntersection.js +0 -2
  34. package/dist/services/BlockRouter/BlockIntersection.js.map +0 -1
  35. package/dist/services/BlockRouter/BlockRouter.d.ts +0 -2
  36. package/dist/services/BlockRouter/BlockRouter.js +0 -11
  37. package/dist/services/BlockRouter/BlockRouter.js.map +0 -1
  38. package/dist/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  39. package/dist/services/BlockRouter/blockRouterEventBus.js +0 -5
  40. package/dist/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  41. package/dist/services/BlockRouter/findActiveBlock.d.ts +0 -3
  42. package/dist/services/BlockRouter/findActiveBlock.js +0 -15
  43. package/dist/services/BlockRouter/findActiveBlock.js.map +0 -1
  44. package/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  45. package/dist/services/BlockRouter/useBlockIntersectionObserver.js +0 -17
  46. package/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  47. package/dist/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  48. package/dist/services/BlockRouter/useBlockRouterProvider.js +0 -28
  49. package/dist/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  50. package/lib/services/BlockRouter/BlockIntersection.d.ts +0 -2
  51. package/lib/services/BlockRouter/BlockIntersection.js +0 -2
  52. package/lib/services/BlockRouter/BlockIntersection.js.map +0 -1
  53. package/lib/services/BlockRouter/BlockRouter.d.ts +0 -2
  54. package/lib/services/BlockRouter/BlockRouter.js +0 -8
  55. package/lib/services/BlockRouter/BlockRouter.js.map +0 -1
  56. package/lib/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  57. package/lib/services/BlockRouter/blockRouterEventBus.js +0 -3
  58. package/lib/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  59. package/lib/services/BlockRouter/findActiveBlock.d.ts +0 -3
  60. package/lib/services/BlockRouter/findActiveBlock.js +0 -12
  61. package/lib/services/BlockRouter/findActiveBlock.js.map +0 -1
  62. package/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  63. package/lib/services/BlockRouter/useBlockIntersectionObserver.js +0 -14
  64. package/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  65. package/lib/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  66. package/lib/services/BlockRouter/useBlockRouterProvider.js +0 -25
  67. package/lib/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  68. package/mobile/bundle/services/BlockRouter/BlockIntersection.d.ts +0 -2
  69. package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +0 -2
  70. package/mobile/bundle/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  71. package/mobile/bundle/services/BlockRouter/findActiveBlock.d.ts +0 -3
  72. package/mobile/bundle/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  73. package/mobile/bundle/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  74. package/mobile/dist/services/BlockRouter/BlockIntersection.d.ts +0 -2
  75. package/mobile/dist/services/BlockRouter/BlockIntersection.js +0 -2
  76. package/mobile/dist/services/BlockRouter/BlockIntersection.js.map +0 -1
  77. package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +0 -2
  78. package/mobile/dist/services/BlockRouter/BlockRouter.js +0 -11
  79. package/mobile/dist/services/BlockRouter/BlockRouter.js.map +0 -1
  80. package/mobile/dist/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  81. package/mobile/dist/services/BlockRouter/blockRouterEventBus.js +0 -5
  82. package/mobile/dist/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  83. package/mobile/dist/services/BlockRouter/findActiveBlock.d.ts +0 -3
  84. package/mobile/dist/services/BlockRouter/findActiveBlock.js +0 -15
  85. package/mobile/dist/services/BlockRouter/findActiveBlock.js.map +0 -1
  86. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  87. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js +0 -17
  88. package/mobile/dist/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  89. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  90. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js +0 -28
  91. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  92. package/mobile/lib/services/BlockRouter/BlockIntersection.d.ts +0 -2
  93. package/mobile/lib/services/BlockRouter/BlockIntersection.js +0 -2
  94. package/mobile/lib/services/BlockRouter/BlockIntersection.js.map +0 -1
  95. package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +0 -2
  96. package/mobile/lib/services/BlockRouter/BlockRouter.js +0 -8
  97. package/mobile/lib/services/BlockRouter/BlockRouter.js.map +0 -1
  98. package/mobile/lib/services/BlockRouter/blockRouterEventBus.d.ts +0 -11
  99. package/mobile/lib/services/BlockRouter/blockRouterEventBus.js +0 -3
  100. package/mobile/lib/services/BlockRouter/blockRouterEventBus.js.map +0 -1
  101. package/mobile/lib/services/BlockRouter/findActiveBlock.d.ts +0 -3
  102. package/mobile/lib/services/BlockRouter/findActiveBlock.js +0 -12
  103. package/mobile/lib/services/BlockRouter/findActiveBlock.js.map +0 -1
  104. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.d.ts +0 -4
  105. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js +0 -14
  106. package/mobile/lib/services/BlockRouter/useBlockIntersectionObserver.js.map +0 -1
  107. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.d.ts +0 -1
  108. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js +0 -25
  109. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js.map +0 -1
  110. package/mobile/src/services/BlockRouter/BlockIntersection.ts +0 -3
  111. package/mobile/src/services/BlockRouter/BlockRouter.ts +0 -11
  112. package/mobile/src/services/BlockRouter/blockRouterEventBus.ts +0 -13
  113. package/mobile/src/services/BlockRouter/findActiveBlock.ts +0 -20
  114. package/mobile/src/services/BlockRouter/useBlockIntersectionObserver.ts +0 -20
  115. package/mobile/src/services/BlockRouter/useBlockRouterProvider.ts +0 -37
  116. package/src/services/BlockRouter/BlockIntersection.ts +0 -3
  117. package/src/services/BlockRouter/BlockRouter.ts +0 -11
  118. package/src/services/BlockRouter/blockRouterEventBus.ts +0 -13
  119. package/src/services/BlockRouter/findActiveBlock.ts +0 -20
  120. package/src/services/BlockRouter/useBlockIntersectionObserver.ts +0 -20
  121. package/src/services/BlockRouter/useBlockRouterProvider.ts +0 -37
@@ -278,43 +278,6 @@
278
278
 
279
279
  const defaultEventBus = new EventBus();
280
280
 
281
- const SENSITIVITY_SCALE = 10;
282
- function useIntersectionObserver(observerCallback, { sensitivity, rootRef } = {}) {
283
- const ref = useRef(null);
284
- const observerOptions = useMemo(() => ({ threshold: sensitivityToThreshold(sensitivity), root: rootRef?.current }), [sensitivity, rootRef?.current]);
285
- useEffect(() => {
286
- if (!ref.current) {
287
- return undefined;
288
- }
289
- const intersectionObserver = new IntersectionObserver(observerCallback, observerOptions);
290
- intersectionObserver.observe(ref.current);
291
- return () => {
292
- intersectionObserver.disconnect();
293
- };
294
- }, [observerCallback, observerOptions]);
295
- return ref;
296
- }
297
- function sensitivityToThreshold(sensitivity = 0) {
298
- const thresholdsCount = Math.round(sensitivity * SENSITIVITY_SCALE);
299
- return new Array(thresholdsCount)
300
- .fill(0)
301
- .map((_, thi) => Math.min(thi / thresholdsCount), 1)
302
- .concat(1);
303
- }
304
-
305
- const blockRouterEventBus = new EventBus();
306
-
307
- function useBlockIntersectionObserver(block) {
308
- const observerCallback = useCallback((entries) => {
309
- if (!block || !entries?.length) {
310
- return;
311
- }
312
- const intersection = entries[entries.length - 1];
313
- blockRouterEventBus.fire('intersection', { block, intersection });
314
- }, [block]);
315
- return useIntersectionObserver(observerCallback, { sensitivity: 1 });
316
- }
317
-
318
281
  const style = (...atoms) => atoms
319
282
  .flatMap((_) => _)
320
283
  .filter(Boolean)
@@ -329,13 +292,12 @@
329
292
  };
330
293
  const BlockWrapper = JSX(({ className, version = 'primary', isTheme = true, defaultPadding = 'p-xl', padding, block, tag = 'section', role, children, }) => {
331
294
  const Tag = tag;
332
- const ref = useBlockIntersectionObserver(block);
333
295
  const [isHidden, setHidden] = useState(false);
334
296
  useEffect(() => defaultEventBus.subscribe('tab', (event) => {
335
297
  setHidden(Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)));
336
298
  }), [block]);
337
299
  const isGroup = version && isTheme;
338
- return (jsx(Tag, { className: style('@container font-sans', isGroup ? 'group' : '', blockStyles[version], isHidden ? 'hidden' : '', padding || defaultPadding, className), ...(isGroup ? { 'data-ver': version } : {}), ...(block?.anchor ? { id: block.anchor, ref } : {}), role: role, children: children }));
300
+ return (jsx(Tag, { className: style('@container font-sans', isGroup ? 'group' : '', blockStyles[version], isHidden ? 'hidden' : '', padding || defaultPadding, className), ...(isGroup ? { 'data-ver': version } : {}), ...(block?.anchor ? { id: block.anchor } : {}), role: role, children: children }));
339
301
  });
340
302
 
341
303
  const headingTag = (tag) => tag;
@@ -2711,6 +2673,30 @@
2711
2673
  minHeight: `${minHeight || DEFAULT_HEIGHT}px`,
2712
2674
  });
2713
2675
 
2676
+ const SENSITIVITY_SCALE = 10;
2677
+ function useIntersectionObserver(observerCallback, { sensitivity, rootRef } = {}) {
2678
+ const ref = useRef(null);
2679
+ const observerOptions = useMemo(() => ({ threshold: sensitivityToThreshold(sensitivity), root: rootRef?.current }), [sensitivity, rootRef?.current]);
2680
+ useEffect(() => {
2681
+ if (!ref.current) {
2682
+ return undefined;
2683
+ }
2684
+ const intersectionObserver = new IntersectionObserver(observerCallback, observerOptions);
2685
+ intersectionObserver.observe(ref.current);
2686
+ return () => {
2687
+ intersectionObserver.disconnect();
2688
+ };
2689
+ }, [observerCallback, observerOptions]);
2690
+ return ref;
2691
+ }
2692
+ function sensitivityToThreshold(sensitivity = 0) {
2693
+ const thresholdsCount = Math.round(sensitivity * SENSITIVITY_SCALE);
2694
+ return new Array(thresholdsCount)
2695
+ .fill(0)
2696
+ .map((_, thi) => Math.min(thi / thresholdsCount), 1)
2697
+ .concat(1);
2698
+ }
2699
+
2714
2700
  const SwipeListItem = JSX(({ className = '', style, idx, activeIndex, observerOptions, children, onIntersection }) => {
2715
2701
  const observerCallback = useCallback((entries) => {
2716
2702
  if (entries.length && onIntersection) {
@@ -5597,61 +5583,6 @@
5597
5583
  Video,
5598
5584
  };
5599
5585
 
5600
- const debounce = (fn, delay = 600) => {
5601
- let timerId;
5602
- const debouncedCallback = (...args) => {
5603
- debouncedCallback.dispose();
5604
- timerId = setTimeout(() => {
5605
- fn(...args);
5606
- }, delay);
5607
- };
5608
- debouncedCallback.dispose = () => {
5609
- if (timerId) {
5610
- clearTimeout(timerId);
5611
- }
5612
- };
5613
- return debouncedCallback;
5614
- };
5615
-
5616
- const normalizeAnchor = (anchor) => anchor?.replace('#', '') || '';
5617
- function trackBlock(block) {
5618
- const hash = `#${normalizeAnchor(block?.anchor)}`;
5619
- if (globalThis.location?.hash !== hash) {
5620
- globalThis.history?.replaceState(globalThis.history?.state, '', hash);
5621
- }
5622
- }
5623
-
5624
- const SPECIAL_BLOCK_TYPES = ['Header', 'Footer'];
5625
- const EPS = 0.01;
5626
- const topLineDelta = ([, { target }]) => Math.abs(target.getBoundingClientRect().top);
5627
- function findActiveBlock(intersections) {
5628
- const visibleIntersections = intersections
5629
- .filter(([block]) => !SPECIAL_BLOCK_TYPES.includes(block.type || ''))
5630
- .filter(([, { intersectionRatio }]) => intersectionRatio > EPS);
5631
- const [activeBlock] = visibleIntersections.length > 0 ? minBy(topLineDelta)(visibleIntersections) : [];
5632
- return activeBlock;
5633
- }
5634
-
5635
- const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
5636
- function useBlockRouterProvider(scrollTarget = globalThis) {
5637
- const intersectionsMapRef = useRef(new Map());
5638
- useEffect(() => blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
5639
- if (intersectionsMapRef.current) {
5640
- intersectionsMapRef.current.set(block, intersection);
5641
- }
5642
- }), []);
5643
- useEffect(() => {
5644
- const handleScroll = debounce(() => {
5645
- trackBlock(isScrolledEnough() ? findActiveBlock([...(intersectionsMapRef.current || [])]) : undefined);
5646
- }, 100);
5647
- scrollTarget.addEventListener('scroll', handleScroll);
5648
- return () => {
5649
- handleScroll.dispose();
5650
- scrollTarget.removeEventListener('scroll', handleScroll);
5651
- };
5652
- }, [scrollTarget]);
5653
- }
5654
-
5655
5586
  const COOKIE_DIALOG_ID = 'cookie';
5656
5587
  const DIALOG_INITIAL_DELAY = 3 * 1000;
5657
5588
  const CookiePopup = JSX(({ termLink, personalDataPolicyLink }) => {
@@ -5820,7 +5751,6 @@
5820
5751
  blockDecorator,
5821
5752
  parent: data,
5822
5753
  };
5823
- useBlockRouterProvider();
5824
5754
  return (jsxs("div", { "data-theme": colorPalette, children: [jsxs("section", { className: style('@container relative', pageStyle, className), children: [slots?.header ? (jsx("div", { className: "relative z-10 mb-lg shadow-[0_8px_32px_0px_#00000014]", children: renderBlocksList(slots?.header, { ...options, slotName: 'header' }) })) : null, jsxs("div", { className: "container space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: [renderChildren({ block: data, options, extraProps: { className: 'scroll-mt-12' } }), renderBlocksList(slots?.footer, { ...options, slotName: 'footer' })] }), likeControl ? renderLikeControl() : null] }), jsx(StickyBottomMenu, {}), jsx(DialogManager, {}), jsx(PopupManager, {}), jsx(CookiePopup, { termLink: { href: '/pd-policy#cookie', target: '_blank' }, personalDataPolicyLink: { href: '/pd-policy', target: '_blank' } })] }));
5825
5755
  });
5826
5756
  ContentPage.childrenTypes = [];
@@ -5829,7 +5759,7 @@
5829
5759
  return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-3xl sticky bottom-0 pointer-events-auto" }) }));
5830
5760
  }
5831
5761
 
5832
- const packageVersion = "0.14.75";
5762
+ const packageVersion = "0.14.76";
5833
5763
 
5834
5764
  exports.Blocks = Blocks;
5835
5765
  exports.ContentPage = ContentPage;