@dotcms/react 1.2.6-next.2 → 1.2.6-next.3
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/index.server.esm.js +1 -6
- package/lib/next/components/Contentlet/Contentlet.esm.js +1 -1
- package/lib/next/utils/buildSlots.esm.js +3 -7
- package/package.json +1 -1
- package/src/index.d.ts +3 -2
- package/src/index.server.d.ts +2 -7
- package/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.d.ts +1 -1
- package/src/lib/next/components/DotCMSLayoutBody/DotCMSPageProvider.d.ts +1 -1
- package/src/lib/next/contexts/DotCMSPageContext.d.ts +2 -2
- package/src/lib/next/utils/buildSlots.d.ts +2 -2
package/index.server.esm.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export { DotCMSLayoutBody } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.esm.js';
|
|
2
|
-
export { DotCMSShow } from './lib/next/components/DotCMSShow/DotCMSShow.esm.js';
|
|
3
|
-
export { useDotCMSShowWhen } from './lib/next/hooks/useDotCMSShowWhen.esm.js';
|
|
4
|
-
export { useEditableDotCMSPage } from './lib/next/hooks/useEditableDotCMSPage.esm.js';
|
|
5
|
-
export { DotCMSBlockEditorRenderer } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer.esm.js';
|
|
6
|
-
export { useAISearch } from './lib/next/hooks/useAISearch.esm.js';
|
|
7
|
-
export { useStyleEditorSchemas } from './lib/next/hooks/useStyleEditorSchemas.esm.js';
|
|
8
2
|
export { buildSlots } from './lib/next/utils/buildSlots.esm.js';
|
|
3
|
+
export { DotCMSBlockEditorRenderer } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer.esm.js';
|
|
@@ -67,7 +67,7 @@ function CustomComponent({
|
|
|
67
67
|
userComponents,
|
|
68
68
|
slots
|
|
69
69
|
} = useContext(DotCMSPageContext);
|
|
70
|
-
const slotNode =
|
|
70
|
+
const slotNode = contentlet != null && contentlet.identifier ? slots == null ? void 0 : slots[contentlet.identifier] : undefined;
|
|
71
71
|
if (slotNode !== undefined) {
|
|
72
72
|
return jsx(Fragment, {
|
|
73
73
|
children: slotNode
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Builds a slots map of pre-rendered server component nodes keyed by contentlet identifier.
|
|
5
3
|
*
|
|
@@ -21,9 +19,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
21
19
|
* <DotCMSLayoutBody page={pageAsset} components={pageComponents} slots={slots} />
|
|
22
20
|
* ```
|
|
23
21
|
*/
|
|
24
|
-
function buildSlots(containers,
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
serverComponents) {
|
|
22
|
+
function buildSlots(containers, serverComponents) {
|
|
27
23
|
const slots = {};
|
|
28
24
|
for (const {
|
|
29
25
|
contentlets
|
|
@@ -31,8 +27,8 @@ serverComponents) {
|
|
|
31
27
|
for (const contentletList of Object.values(contentlets)) {
|
|
32
28
|
for (const contentlet of contentletList) {
|
|
33
29
|
const Component = serverComponents[contentlet.contentType];
|
|
34
|
-
if (Component) {
|
|
35
|
-
slots[contentlet.identifier] =
|
|
30
|
+
if (Component && contentlet.identifier) {
|
|
31
|
+
slots[contentlet.identifier] = Component(contentlet);
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
34
|
}
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ export { DotCMSShow } from './lib/next/components/DotCMSShow/DotCMSShow';
|
|
|
3
3
|
export { useDotCMSShowWhen } from './lib/next/hooks/useDotCMSShowWhen';
|
|
4
4
|
export { useEditableDotCMSPage } from './lib/next/hooks/useEditableDotCMSPage';
|
|
5
5
|
export { DotCMSEditableText } from './lib/next/components/DotCMSEditableText/DotCMSEditableText';
|
|
6
|
-
export { DotCMSBlockEditorRenderer,
|
|
7
|
-
export {
|
|
6
|
+
export { DotCMSBlockEditorRenderer, CustomRenderer } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';
|
|
7
|
+
export type { BlockEditorRendererProps, CustomRendererProps } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';
|
|
8
|
+
export type { DotCMSLayoutBodyProps } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
|
|
8
9
|
export { useAISearch } from './lib/next/hooks/useAISearch';
|
|
9
10
|
export { useStyleEditorSchemas } from './lib/next/hooks/useStyleEditorSchemas';
|
|
10
11
|
export type { DotCMSAISearchValue, DotCMSAISearchProps } from './lib/next/shared/types';
|
package/src/index.server.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export { DotCMSLayoutBody } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { useEditableDotCMSPage } from './lib/next/hooks/useEditableDotCMSPage';
|
|
2
|
+
export type { DotCMSLayoutBodyProps } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
|
|
3
|
+
export { buildSlots } from './lib/next/utils/buildSlots';
|
|
5
4
|
export { DotCMSBlockEditorRenderer, CustomRenderer } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';
|
|
6
5
|
export type { BlockEditorRendererProps, CustomRendererProps } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';
|
|
7
|
-
export type { DotCMSLayoutBodyProps } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
|
|
8
|
-
export { useAISearch } from './lib/next/hooks/useAISearch';
|
|
9
|
-
export { useStyleEditorSchemas } from './lib/next/hooks/useStyleEditorSchemas';
|
|
10
6
|
export type { DotCMSAISearchValue, DotCMSAISearchProps } from './lib/next/shared/types';
|
|
11
|
-
export { buildSlots } from './lib/next/utils/buildSlots';
|
|
@@ -22,7 +22,7 @@ export interface DotCMSLayoutBodyProps<TContentlet extends DotCMSBasicContentlet
|
|
|
22
22
|
* <DotCMSLayoutBody page={pageAsset} components={pageComponents} slots={slots} />
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
slots?: Record<string, ReactNode
|
|
25
|
+
slots?: Record<string, ReactNode | Promise<ReactNode>>;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* DotCMSLayoutBody component renders the layout body for a DotCMS page.
|
|
@@ -4,7 +4,7 @@ interface DotCMSPageProviderProps {
|
|
|
4
4
|
page: DotCMSPageAsset;
|
|
5
5
|
components: Record<string, React.ComponentType<any>>;
|
|
6
6
|
mode: DotCMSPageRendererMode;
|
|
7
|
-
slots: Record<string, ReactNode
|
|
7
|
+
slots: Record<string, ReactNode | Promise<ReactNode>>;
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
@@ -8,13 +8,13 @@ import { DotCMSBasicContentlet, DotCMSPageAsset, DotCMSPageRendererMode } from '
|
|
|
8
8
|
* @property {DotCMSPageAsset} pageAsset - The DotCMS page asset
|
|
9
9
|
* @property {RendererMode} mode - The renderer mode
|
|
10
10
|
* @property {Record<string, React.ComponentType<DotCMSContentlet>>} userComponents - The user components
|
|
11
|
-
* @property {Record<string, ReactNode
|
|
11
|
+
* @property {Record<string, ReactNode | Promise<ReactNode>>} [slots] - Pre-rendered server component nodes keyed by contentlet identifier
|
|
12
12
|
*/
|
|
13
13
|
export interface DotCMSPageContextProps {
|
|
14
14
|
pageAsset: DotCMSPageAsset;
|
|
15
15
|
mode: DotCMSPageRendererMode;
|
|
16
16
|
userComponents: Record<string, React.ComponentType<DotCMSBasicContentlet>>;
|
|
17
|
-
slots?: Record<string, ReactNode
|
|
17
|
+
slots?: Record<string, ReactNode | Promise<ReactNode>>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* The `PageContext` is a React context that provides access to the DotCMS page context.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { DotCMSPageAssetContainers } from '@dotcms/types';
|
|
2
|
+
import { DotCMSBasicContentlet, DotCMSPageAssetContainers } from '@dotcms/types';
|
|
3
3
|
/**
|
|
4
4
|
* Builds a slots map of pre-rendered server component nodes keyed by contentlet identifier.
|
|
5
5
|
*
|
|
@@ -21,4 +21,4 @@ import { DotCMSPageAssetContainers } from '@dotcms/types';
|
|
|
21
21
|
* <DotCMSLayoutBody page={pageAsset} components={pageComponents} slots={slots} />
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export declare function buildSlots(containers: DotCMSPageAssetContainers, serverComponents: Record<string,
|
|
24
|
+
export declare function buildSlots(containers: DotCMSPageAssetContainers, serverComponents: Record<string, (props: DotCMSBasicContentlet) => ReactNode | Promise<ReactNode>>): Record<string, ReactNode | Promise<ReactNode>>;
|