@redneckz/wildless-cms-uni-blocks 0.8.8 → 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 +31 -66
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ButtonBlock/ButtonBlockContent.d.ts +5 -1
- package/bundle/hooks/useRouter.d.ts +6 -2
- 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/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/Tabs/Tabs.js +4 -4
- package/dist/components/Tabs/Tabs.js.map +1 -1
- 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/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/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/Tabs/Tabs.js +4 -4
- package/lib/components/Tabs/Tabs.js.map +1 -1
- 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/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/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/hooks/useRouter.d.ts +6 -2
- 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/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/Tabs/Tabs.js +4 -4
- package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
- 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/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/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/Tabs/Tabs.js +4 -4
- package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
- 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/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/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/Tabs/Tabs.tsx +4 -4
- package/mobile/src/hooks/useLink.ts +2 -3
- package/mobile/src/hooks/useRouter.ts +6 -2
- 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/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/Tabs/Tabs.tsx +4 -4
- package/src/hooks/useLink.ts +2 -3
- package/src/hooks/useRouter.ts +6 -2
- 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/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 +0 -2
- package/dist/EventBus/EventMap.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/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 +0 -2
- package/mobile/dist/EventBus/EventMap.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/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/services/BlockRouter/useBlockRouter.ts +0 -5
- package/src/EventBus/EventMap.ts +0 -5
- package/src/services/BlockRouter/useBlockRouter.ts +0 -5
package/bundle/bundle.umd.js
CHANGED
|
@@ -290,7 +290,6 @@
|
|
|
290
290
|
};
|
|
291
291
|
|
|
292
292
|
class EventBus {
|
|
293
|
-
static inst = new EventBus();
|
|
294
293
|
subscribers = {};
|
|
295
294
|
subjectsStateMap = {};
|
|
296
295
|
subscribe(type, listener) {
|
|
@@ -318,6 +317,8 @@
|
|
|
318
317
|
}
|
|
319
318
|
}
|
|
320
319
|
|
|
320
|
+
const defaultEventBus = new EventBus();
|
|
321
|
+
|
|
321
322
|
const SENSITIVITY_SCALE = 10;
|
|
322
323
|
function useIntersectionObserver(observerCallback, { sensitivity, rootRef } = {}) {
|
|
323
324
|
const ref = useRef(null);
|
|
@@ -342,55 +343,17 @@
|
|
|
342
343
|
.concat(1);
|
|
343
344
|
}
|
|
344
345
|
|
|
345
|
-
const
|
|
346
|
-
const getURLWithAnchor = (rawAnchor) => `${globalThis.location?.pathname}#${normalizeAnchor(rawAnchor)}`;
|
|
347
|
-
class BlockRouter {
|
|
348
|
-
static inst = new BlockRouter();
|
|
349
|
-
eventBus = new EventBus();
|
|
350
|
-
constructor() {
|
|
351
|
-
const anchor = normalizeAnchor(globalThis.location?.hash);
|
|
352
|
-
if (anchor) {
|
|
353
|
-
this.eventBus.subject('goto', { anchor });
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
goto(rawAnchor) {
|
|
357
|
-
const anchor = normalizeAnchor(rawAnchor);
|
|
358
|
-
if (anchor) {
|
|
359
|
-
this.push(anchor);
|
|
360
|
-
this.eventBus.fire('goto', { anchor });
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
push(rawAnchor) {
|
|
364
|
-
globalThis.history?.pushState(null, '', getURLWithAnchor(rawAnchor));
|
|
365
|
-
}
|
|
366
|
-
replace(rawAnchor) {
|
|
367
|
-
globalThis.history?.replaceState(null, '', getURLWithAnchor(rawAnchor));
|
|
368
|
-
}
|
|
369
|
-
reset() {
|
|
370
|
-
globalThis.history?.replaceState(null, '', getURLWithAnchor());
|
|
371
|
-
}
|
|
372
|
-
}
|
|
346
|
+
const blockRouterEventBus = new EventBus();
|
|
373
347
|
|
|
374
|
-
function useBlockIntersectionObserver(block
|
|
348
|
+
function useBlockIntersectionObserver(block) {
|
|
375
349
|
const observerCallback = useCallback((entries) => {
|
|
376
350
|
if (!block || !entries?.length) {
|
|
377
351
|
return;
|
|
378
352
|
}
|
|
379
353
|
const intersection = entries[entries.length - 1];
|
|
380
|
-
|
|
381
|
-
}, [block
|
|
382
|
-
|
|
383
|
-
useEffect(() => {
|
|
384
|
-
if (!ref.current) {
|
|
385
|
-
return undefined;
|
|
386
|
-
}
|
|
387
|
-
return router.eventBus.subscribe('goto', ({ anchor }) => {
|
|
388
|
-
if (ref.current && block?.anchor === anchor) {
|
|
389
|
-
ref.current.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
}, [block, router]);
|
|
393
|
-
return ref;
|
|
354
|
+
blockRouterEventBus.fire('intersection', { block, intersection });
|
|
355
|
+
}, [block]);
|
|
356
|
+
return useIntersectionObserver(observerCallback, { sensitivity: 1 });
|
|
394
357
|
}
|
|
395
358
|
|
|
396
359
|
const blockStyles = {
|
|
@@ -404,7 +367,7 @@
|
|
|
404
367
|
const Tag = tag;
|
|
405
368
|
const ref = useBlockIntersectionObserver(block);
|
|
406
369
|
const [isVisible, setVisible] = useState(true);
|
|
407
|
-
useEffect(() =>
|
|
370
|
+
useEffect(() => defaultEventBus.subscribe('tab', (event) => {
|
|
408
371
|
if (event.type === 'group') {
|
|
409
372
|
const hasSettings = block?.labels?.length || block?.anchor;
|
|
410
373
|
setVisible(event.label ? !hasSettings || Boolean(block?.labels?.includes(event.label)) : true);
|
|
@@ -651,8 +614,14 @@
|
|
|
651
614
|
},
|
|
652
615
|
];
|
|
653
616
|
|
|
654
|
-
|
|
655
|
-
|
|
617
|
+
const normalizeAnchor = (anchor) => anchor?.replace('#', '') || '';
|
|
618
|
+
function gotoBlock(router, anchor) {
|
|
619
|
+
router.replace(`#${normalizeAnchor(anchor)}`);
|
|
620
|
+
}
|
|
621
|
+
function trackBlock(router, block) {
|
|
622
|
+
router.replace(`#${normalizeAnchor(block?.anchor)}`, undefined, {
|
|
623
|
+
scroll: false,
|
|
624
|
+
});
|
|
656
625
|
}
|
|
657
626
|
|
|
658
627
|
const isURL = (href) => Boolean(href?.includes('//'));
|
|
@@ -699,7 +668,6 @@
|
|
|
699
668
|
|
|
700
669
|
function useLink(isRemote) {
|
|
701
670
|
const router = useRouter();
|
|
702
|
-
const blockRouter = useBlockRouter();
|
|
703
671
|
return (props) => ({
|
|
704
672
|
...props,
|
|
705
673
|
href: adjustHref(props.href),
|
|
@@ -722,7 +690,7 @@
|
|
|
722
690
|
// Client routing
|
|
723
691
|
ev?.preventDefault();
|
|
724
692
|
if (isHash(href)) {
|
|
725
|
-
|
|
693
|
+
gotoBlock(router, href);
|
|
726
694
|
}
|
|
727
695
|
else if (href) {
|
|
728
696
|
router.push(href);
|
|
@@ -1260,7 +1228,7 @@
|
|
|
1260
1228
|
|
|
1261
1229
|
const BusinessBlock = JSX(({ className = '', title, cards, ...rest }) => (jsxs(BlockWrapper, { className: `p-12 pb-9 ${className}`, ...rest, children: [jsx(Heading, { headingType: "h3", title: title, className: "text-center mb-8" }), jsx("div", { className: "flex gap-5", children: cards?.length ? cards.map((_, i) => jsx(BusinessCard, { ..._ }, String(i))) : null })] })));
|
|
1262
1230
|
|
|
1263
|
-
const ButtonBlock = JSX(({ button, ...rest }) => (jsx(BlockWrapper, { ...rest, children: renderButtonsSection([button]) })));
|
|
1231
|
+
const ButtonBlock = JSX(({ button, className, ...rest }) => (jsx(BlockWrapper, { className: style('!bg-transparent', className), ...rest, children: renderButtonsSection([button]) })));
|
|
1264
1232
|
|
|
1265
1233
|
const useCarouselControls = (props) => {
|
|
1266
1234
|
const { itemCount, visibleItemCount, isCyclic } = props;
|
|
@@ -4121,7 +4089,7 @@
|
|
|
4121
4089
|
const Tabs = JSX((props) => {
|
|
4122
4090
|
const { className = '', tabs, showCounter, isSticky, tabsMode, ...rest } = props;
|
|
4123
4091
|
const [currentTab, setCurrentTab] = useState(tabs ? tabs[0] : undefined);
|
|
4124
|
-
useEffect(() =>
|
|
4092
|
+
useEffect(() => defaultEventBus.subscribe('tab', (event) => {
|
|
4125
4093
|
const tab = tabs?.find(checkTab(event));
|
|
4126
4094
|
if (event.type === 'link' && tab) {
|
|
4127
4095
|
setCurrentTab(tab);
|
|
@@ -4129,11 +4097,11 @@
|
|
|
4129
4097
|
return [];
|
|
4130
4098
|
}), [tabs]);
|
|
4131
4099
|
useEffect(() => currentTab?.type === 'group'
|
|
4132
|
-
?
|
|
4100
|
+
? defaultEventBus.subject('tab', { type: currentTab.type, label: currentTab.ref })
|
|
4133
4101
|
: undefined, [currentTab]);
|
|
4134
4102
|
const handleClick = useCallback((selectedTab) => {
|
|
4135
4103
|
if (selectedTab?.type === 'group') {
|
|
4136
|
-
|
|
4104
|
+
defaultEventBus.fire('tab', { type: selectedTab.type, label: selectedTab.ref });
|
|
4137
4105
|
}
|
|
4138
4106
|
setCurrentTab(selectedTab);
|
|
4139
4107
|
}, []);
|
|
@@ -4459,25 +4427,22 @@
|
|
|
4459
4427
|
}
|
|
4460
4428
|
|
|
4461
4429
|
const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
|
|
4462
|
-
function useBlockRouterProvider(
|
|
4430
|
+
function useBlockRouterProvider(scrollTarget = globalThis) {
|
|
4431
|
+
const router = useRouter();
|
|
4463
4432
|
const intersectionsMapRef = useRef(new Map());
|
|
4464
|
-
useEffect(() =>
|
|
4433
|
+
useEffect(() => blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
|
|
4465
4434
|
if (intersectionsMapRef.current) {
|
|
4466
4435
|
intersectionsMapRef.current.set(block, intersection);
|
|
4467
4436
|
}
|
|
4468
|
-
}), [
|
|
4437
|
+
}), []);
|
|
4469
4438
|
useEffect(() => {
|
|
4470
4439
|
const handleScroll = debounce(() => {
|
|
4471
|
-
if (
|
|
4472
|
-
|
|
4473
|
-
|
|
4440
|
+
if (isScrolledEnough()) {
|
|
4441
|
+
const activeBlock = findActiveBlock([...(intersectionsMapRef.current || [])]);
|
|
4442
|
+
trackBlock(router, activeBlock);
|
|
4474
4443
|
}
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
router.replace(activeBlock.anchor);
|
|
4478
|
-
}
|
|
4479
|
-
else if (!activeBlock) {
|
|
4480
|
-
router.reset();
|
|
4444
|
+
else {
|
|
4445
|
+
trackBlock(router);
|
|
4481
4446
|
}
|
|
4482
4447
|
}, 100);
|
|
4483
4448
|
scrollTarget.addEventListener('scroll', handleScroll);
|
|
@@ -4556,7 +4521,7 @@
|
|
|
4556
4521
|
return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto" }) }));
|
|
4557
4522
|
}
|
|
4558
4523
|
|
|
4559
|
-
const packageVersion = "0.8.
|
|
4524
|
+
const packageVersion = "0.8.9";
|
|
4560
4525
|
|
|
4561
4526
|
exports.Blocks = Blocks;
|
|
4562
4527
|
exports.ContentPage = ContentPage;
|