@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/src/hooks/useRouter.ts
CHANGED
|
@@ -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,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(
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventMap.js","sourceRoot":"","sources":["../../src/EventBus/EventMap.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.useBlockRouter = void 0;
|
|
3
|
-
const BlockRouter_1 = require("./BlockRouter");
|
|
4
|
-
function useBlockRouter() {
|
|
5
|
-
return BlockRouter_1.BlockRouter.inst;
|
|
6
|
-
}
|
|
7
|
-
exports.useBlockRouter = useBlockRouter;
|
|
8
|
-
//# sourceMappingURL=useBlockRouter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRouter.js","sourceRoot":"","sources":["../../../src/services/BlockRouter/useBlockRouter.ts"],"names":[],"mappings":";;AAAA,+CAA4C;AAE5C,SAAgB,cAAc;IAC5B,OAAO,yBAAW,CAAC,IAAI,CAAC;AAC1B,CAAC;AAFD,wCAEC"}
|
package/lib/EventBus/EventMap.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventMap.js","sourceRoot":"","sources":["../../src/EventBus/EventMap.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRouter.js","sourceRoot":"","sources":["../../../src/services/BlockRouter/useBlockRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventMap.js","sourceRoot":"","sources":["../../src/EventBus/EventMap.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.useBlockRouter = void 0;
|
|
3
|
-
const BlockRouter_1 = require("./BlockRouter");
|
|
4
|
-
function useBlockRouter() {
|
|
5
|
-
return BlockRouter_1.BlockRouter.inst;
|
|
6
|
-
}
|
|
7
|
-
exports.useBlockRouter = useBlockRouter;
|
|
8
|
-
//# sourceMappingURL=useBlockRouter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRouter.js","sourceRoot":"","sources":["../../../src/services/BlockRouter/useBlockRouter.ts"],"names":[],"mappings":";;AAAA,+CAA4C;AAE5C,SAAgB,cAAc;IAC5B,OAAO,yBAAW,CAAC,IAAI,CAAC;AAC1B,CAAC;AAFD,wCAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventMap.js","sourceRoot":"","sources":["../../src/EventBus/EventMap.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRouter.js","sourceRoot":"","sources":["../../../src/services/BlockRouter/useBlockRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC"}
|
package/src/EventBus/EventMap.ts
DELETED