@redneckz/wildless-cms-uni-blocks 0.3.36 → 0.3.37
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/bundle.umd.js +11 -8
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/ContentPage/ContentPage.js +7 -4
- package/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/dist/components/Header/HeaderSubMenuObserver.js +5 -4
- package/dist/components/Header/HeaderSubMenuObserver.js.map +1 -1
- package/lib/components/ContentPage/ContentPage.js +7 -4
- package/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/lib/components/Header/HeaderSubMenuObserver.js +5 -4
- package/lib/components/Header/HeaderSubMenuObserver.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +8 -4
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/ContentPage/ContentPage.js +7 -4
- package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/dist/components/Header/HeaderSubMenuObserver.js +5 -4
- package/mobile/dist/components/Header/HeaderSubMenuObserver.js.map +1 -1
- package/mobile/lib/components/ContentPage/ContentPage.js +7 -4
- package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/lib/components/Header/HeaderSubMenuObserver.js +5 -4
- package/mobile/lib/components/Header/HeaderSubMenuObserver.js.map +1 -1
- package/mobile/src/components/ContentPage/ContentPage.tsx +10 -6
- package/mobile/src/components/Header/HeaderSubMenuObserver.ts +6 -4
- package/package.json +1 -1
- package/src/components/ContentPage/ContentPage.tsx +10 -6
- package/src/components/Header/HeaderSubMenuObserver.ts +6 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isSSR } from '../../utils/isSSR.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const isClient = !isSSR();
|
|
3
|
+
export const headerSubMenuObserver = isClient
|
|
4
|
+
? new IntersectionObserver((entries) => {
|
|
5
5
|
const headerSubMenuButtonElement = window.document.querySelector('[data-header-submenu-visible=toggled]');
|
|
6
6
|
const headerSubMenuItems = Array.from(window.document.querySelectorAll('[data-item-name=header-submenu]'));
|
|
7
7
|
const dotsHeaderSubMenuItems = Array.from(window.document.querySelectorAll('[data-item-name=dots-header-submenu]'));
|
|
@@ -16,7 +16,8 @@ export const headerSubMenuObserver = isSSR()
|
|
|
16
16
|
? headerSubMenuButtonElement.classList.remove('hidden')
|
|
17
17
|
: headerSubMenuButtonElement.classList.add('hidden');
|
|
18
18
|
}
|
|
19
|
-
}, { root: window.document, threshold: 1.0 })
|
|
19
|
+
}, { root: window.document, threshold: 1.0 })
|
|
20
|
+
: undefined;
|
|
20
21
|
// TODO: add types
|
|
21
22
|
const toggleVisibilityInItems = (visibilityList, items, className) => {
|
|
22
23
|
const isReversed = className !== 'hidden';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderSubMenuObserver.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenuObserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,MAAM,
|
|
1
|
+
{"version":3,"file":"HeaderSubMenuObserver.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenuObserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC;AAE1B,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ;IAC3C,CAAC,CAAC,IAAI,oBAAoB,CACtB,CAAC,OAAO,EAAE,EAAE;QACV,MAAM,0BAA0B,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAC9D,uCAAuC,CACxC,CAAC;QACF,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CACnC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,iCAAiC,CAAC,CACpE,CAAC;QACF,MAAM,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,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX, PropsWithChildren } from '@redneckz/uni-jsx';
|
|
2
2
|
import type { BlockDef, ContentPageDef, UniBlockProps } from '../../types';
|
|
3
3
|
import { changeHashOnScroll } from '../../utils/changeHashOnScroll';
|
|
4
|
+
import { isSSR } from '../../utils/isSSR';
|
|
4
5
|
import type { BlockContent } from '../BlockContent';
|
|
5
6
|
import { LikeControl } from '../LikeControl/LikeControl';
|
|
6
7
|
import { Placeholder } from '../Placeholder/Placeholder';
|
|
@@ -37,6 +38,8 @@ export interface RenderBlockFunc {
|
|
|
37
38
|
context: ContentPageContext;
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
const isClient = !isSSR();
|
|
42
|
+
|
|
40
43
|
const defaultBlockDecorator: BlockDecorator = ({ blockClassName, block, render }) =>
|
|
41
44
|
render({ blockClassName, block });
|
|
42
45
|
|
|
@@ -52,12 +55,13 @@ export const ContentPage = JSX<ContentPageProps>(
|
|
|
52
55
|
const router = context.useRouter();
|
|
53
56
|
|
|
54
57
|
// listener is for NavigatorTabs
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
isClient &&
|
|
59
|
+
globalThis.addEventListener('load', () => {
|
|
60
|
+
const sectionsWithAnchors = globalThis.document.querySelectorAll('section[id]');
|
|
61
|
+
globalThis.document.addEventListener('scroll', () =>
|
|
62
|
+
changeHashOnScroll(router, sectionsWithAnchors),
|
|
63
|
+
);
|
|
64
|
+
});
|
|
61
65
|
|
|
62
66
|
return (
|
|
63
67
|
<section
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { isSSR } from '../../utils/isSSR';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const isClient = !isSSR();
|
|
4
|
+
|
|
5
|
+
export const headerSubMenuObserver = isClient
|
|
6
|
+
? new IntersectionObserver(
|
|
6
7
|
(entries) => {
|
|
7
8
|
const headerSubMenuButtonElement = window.document.querySelector(
|
|
8
9
|
'[data-header-submenu-visible=toggled]',
|
|
@@ -30,7 +31,8 @@ export const headerSubMenuObserver = isSSR()
|
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
{ root: window.document, threshold: 1.0 },
|
|
33
|
-
)
|
|
34
|
+
)
|
|
35
|
+
: undefined;
|
|
34
36
|
|
|
35
37
|
// TODO: add types
|
|
36
38
|
const toggleVisibilityInItems = (visibilityList, items, className) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX, PropsWithChildren } from '@redneckz/uni-jsx';
|
|
2
2
|
import type { BlockDef, ContentPageDef, UniBlockProps } from '../../types';
|
|
3
3
|
import { changeHashOnScroll } from '../../utils/changeHashOnScroll';
|
|
4
|
+
import { isSSR } from '../../utils/isSSR';
|
|
4
5
|
import type { BlockContent } from '../BlockContent';
|
|
5
6
|
import { LikeControl } from '../LikeControl/LikeControl';
|
|
6
7
|
import { Placeholder } from '../Placeholder/Placeholder';
|
|
@@ -37,6 +38,8 @@ export interface RenderBlockFunc {
|
|
|
37
38
|
context: ContentPageContext;
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
const isClient = !isSSR();
|
|
42
|
+
|
|
40
43
|
const defaultBlockDecorator: BlockDecorator = ({ blockClassName, block, render }) =>
|
|
41
44
|
render({ blockClassName, block });
|
|
42
45
|
|
|
@@ -52,12 +55,13 @@ export const ContentPage = JSX<ContentPageProps>(
|
|
|
52
55
|
const router = context.useRouter();
|
|
53
56
|
|
|
54
57
|
// listener is for NavigatorTabs
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
isClient &&
|
|
59
|
+
globalThis.addEventListener('load', () => {
|
|
60
|
+
const sectionsWithAnchors = globalThis.document.querySelectorAll('section[id]');
|
|
61
|
+
globalThis.document.addEventListener('scroll', () =>
|
|
62
|
+
changeHashOnScroll(router, sectionsWithAnchors),
|
|
63
|
+
);
|
|
64
|
+
});
|
|
61
65
|
|
|
62
66
|
return (
|
|
63
67
|
<section
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { isSSR } from '../../utils/isSSR';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const isClient = !isSSR();
|
|
4
|
+
|
|
5
|
+
export const headerSubMenuObserver = isClient
|
|
6
|
+
? new IntersectionObserver(
|
|
6
7
|
(entries) => {
|
|
7
8
|
const headerSubMenuButtonElement = window.document.querySelector(
|
|
8
9
|
'[data-header-submenu-visible=toggled]',
|
|
@@ -30,7 +31,8 @@ export const headerSubMenuObserver = isSSR()
|
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
{ root: window.document, threshold: 1.0 },
|
|
33
|
-
)
|
|
34
|
+
)
|
|
35
|
+
: undefined;
|
|
34
36
|
|
|
35
37
|
// TODO: add types
|
|
36
38
|
const toggleVisibilityInItems = (visibilityList, items, className) => {
|