@dotcms/react 0.0.1-beta.9 → 1.0.0-next.1
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/README.md +531 -93
- package/index.esm.js +2992 -786
- package/package.json +10 -12
- package/src/index.d.ts +7 -1
- package/src/lib/next/__test__/mock.d.ts +2 -1
- package/src/lib/next/components/Column/Column.d.ts +1 -1
- package/src/lib/next/components/Container/Container.d.ts +1 -1
- package/src/lib/next/components/Container/{ContainerFallbakcs.d.ts → ContainerFallbacks.d.ts} +2 -2
- package/src/lib/next/components/Contentlet/Contentlet.d.ts +2 -2
- package/src/lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer.d.ts +27 -0
- package/src/lib/{deprecated/components/BlockEditorRenderer/item → next/components/DotCMSBlockEditorRenderer/components}/BlockEditorBlock.d.ts +8 -5
- package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Code.d.ts +24 -0
- package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/DotContent.d.ts +14 -0
- package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Image.d.ts +10 -0
- package/src/lib/{deprecated/components/BlockEditorRenderer → next/components/DotCMSBlockEditorRenderer/components}/blocks/Lists.d.ts +8 -4
- package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/NoComponentProvided.d.ts +3 -0
- package/src/lib/{deprecated/components/BlockEditorRenderer → next/components/DotCMSBlockEditorRenderer/components}/blocks/Table.d.ts +3 -3
- package/src/lib/{deprecated/components/BlockEditorRenderer → next/components/DotCMSBlockEditorRenderer/components}/blocks/Texts.d.ts +23 -13
- package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Video.d.ts +10 -0
- package/src/lib/{deprecated/components/DotEditableText/DotEditableText.d.ts → next/components/DotCMSEditableText/DotCMSEditableText.d.ts} +8 -6
- package/src/lib/{deprecated/components/DotEditableText → next/components/DotCMSEditableText}/utils.d.ts +9 -9
- package/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.d.ts +5 -5
- package/src/lib/next/components/DotCMSLayoutBody/components/ErrorMessage.d.ts +1 -4
- package/src/lib/next/components/DotCMSShow/DotCMSShow.d.ts +2 -2
- package/src/lib/next/components/FallbackComponent/FallbackComponent.d.ts +6 -6
- package/src/lib/next/components/Row/Row.d.ts +1 -1
- package/src/lib/next/contexts/DotCMSPageContext.d.ts +2 -3
- package/src/lib/next/hooks/{useShowInUVE.d.ts → useDotCMSShowWhen.d.ts} +5 -5
- package/src/lib/next/hooks/useEditableDotCMSPage.d.ts +90 -0
- package/src/lib/next/hooks/useIsDevMode.d.ts +2 -5
- package/es.regexp.to-string.esm.js +0 -1878
- package/next.esm.d.ts +0 -1
- package/next.esm.js +0 -738
- package/src/lib/deprecated/components/BlockEditorRenderer/BlockEditorRenderer.d.ts +0 -37
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Code.d.ts +0 -17
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Contentlet.d.ts +0 -41
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Image.d.ts +0 -8
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Video.d.ts +0 -8
- package/src/lib/deprecated/components/Column/Column.d.ts +0 -19
- package/src/lib/deprecated/components/Container/Container.d.ts +0 -19
- package/src/lib/deprecated/components/DotcmsLayout/DotcmsLayout.d.ts +0 -34
- package/src/lib/deprecated/components/PageProvider/PageProvider.d.ts +0 -14
- package/src/lib/deprecated/components/Row/Row.d.ts +0 -26
- package/src/lib/deprecated/contexts/PageContext.d.ts +0 -8
- package/src/lib/deprecated/deprecated_api.d.ts +0 -7
- package/src/lib/deprecated/hooks/useCheckHaveContent.d.ts +0 -5
- package/src/lib/deprecated/hooks/useDotcmsEditor.d.ts +0 -13
- package/src/lib/deprecated/hooks/useDotcmsPageContext.d.ts +0 -9
- package/src/lib/deprecated/mocks/index.d.ts +0 -1
- package/src/lib/deprecated/mocks/mockPageContext.d.ts +0 -7
- package/src/lib/deprecated/models/blocks.interface.d.ts +0 -89
- package/src/lib/deprecated/models/content-node.interface.d.ts +0 -82
- package/src/lib/deprecated/models/index.d.ts +0 -127
- package/src/lib/deprecated/utils/utils.d.ts +0 -58
- package/src/lib/next/types.d.ts +0 -421
- package/src/lib/next/utils/index.d.ts +0 -136
- package/src/next.d.ts +0 -3
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DotCMSContentlet } from '../../models';
|
|
3
|
-
import { Block } from '../../models/blocks.interface';
|
|
4
|
-
import { CustomRenderer } from '../../models/content-node.interface';
|
|
5
|
-
interface BaseProps {
|
|
6
|
-
blocks: Block;
|
|
7
|
-
customRenderers?: CustomRenderer;
|
|
8
|
-
className?: string;
|
|
9
|
-
style?: React.CSSProperties;
|
|
10
|
-
}
|
|
11
|
-
interface EditableProps extends BaseProps {
|
|
12
|
-
editable: true;
|
|
13
|
-
contentlet: DotCMSContentlet;
|
|
14
|
-
fieldName: string;
|
|
15
|
-
}
|
|
16
|
-
interface NonEditableProps extends BaseProps {
|
|
17
|
-
editable?: false;
|
|
18
|
-
contentlet?: never;
|
|
19
|
-
fieldName?: never;
|
|
20
|
-
}
|
|
21
|
-
type BlockEditorRendererProps = EditableProps | NonEditableProps;
|
|
22
|
-
/**
|
|
23
|
-
* BlockEditorRenderer component for rendering block editor field.
|
|
24
|
-
*
|
|
25
|
-
* @component
|
|
26
|
-
* @param {Object} props - The component props.
|
|
27
|
-
* @param {Block} props.blocks - The blocks of content to render.
|
|
28
|
-
* @param {CustomRenderer} [props.customRenderers] - Optional custom renderers for specific block types.
|
|
29
|
-
* @param {string} [props.className] - Optional CSS class name for the container div.
|
|
30
|
-
* @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
|
|
31
|
-
* @param {boolean} props.editable - Flag to enable inline editing. When true, `contentlet` and `fieldName` are required. Note: Enterprise only feature.
|
|
32
|
-
* @param {DotCMSContentlet} [props.contentlet] - Contentlet object for inline editing. Required when `editable` is true.
|
|
33
|
-
* @param {string} [props.fieldName] - Field name for inline editing. Required when `editable` is true.
|
|
34
|
-
* @returns {JSX.Element} A div containing the rendered blocks of content.
|
|
35
|
-
*/
|
|
36
|
-
export declare const BlockEditorRenderer: ({ style, blocks, editable, fieldName, className, contentlet, customRenderers }: BlockEditorRendererProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
37
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BlockProps } from '../../../models/blocks.interface';
|
|
2
|
-
import { CodeBlockProps } from '../../../models/content-node.interface';
|
|
3
|
-
/**
|
|
4
|
-
* Renders a code block component.
|
|
5
|
-
*
|
|
6
|
-
* @param attrs - The attributes of the code block.
|
|
7
|
-
* @param children - The content of the code block.
|
|
8
|
-
* @returns The rendered code block component.
|
|
9
|
-
*/
|
|
10
|
-
export declare const CodeBlock: ({ attrs, children }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
/**
|
|
12
|
-
* Renders a blockquote component.
|
|
13
|
-
*
|
|
14
|
-
* @param children - The content to be rendered inside the blockquote.
|
|
15
|
-
* @returns The rendered blockquote component.
|
|
16
|
-
*/
|
|
17
|
-
export declare const BlockQuote: ({ children }: BlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { DotContentProps } from '../../../models/content-node.interface';
|
|
2
|
-
export interface Contentlet {
|
|
3
|
-
hostName: string;
|
|
4
|
-
modDate: string;
|
|
5
|
-
publishDate: string;
|
|
6
|
-
title: string;
|
|
7
|
-
baseType: string;
|
|
8
|
-
inode: string;
|
|
9
|
-
archived: boolean;
|
|
10
|
-
ownerName: string;
|
|
11
|
-
host: string;
|
|
12
|
-
working: boolean;
|
|
13
|
-
locked: boolean;
|
|
14
|
-
stInode: string;
|
|
15
|
-
contentType: string;
|
|
16
|
-
live: boolean;
|
|
17
|
-
owner: string;
|
|
18
|
-
identifier: string;
|
|
19
|
-
publishUserName: string;
|
|
20
|
-
publishUser: string;
|
|
21
|
-
languageId: number;
|
|
22
|
-
creationDate: string;
|
|
23
|
-
url: string;
|
|
24
|
-
titleImage: string;
|
|
25
|
-
modUserName: string;
|
|
26
|
-
hasLiveVersion: boolean;
|
|
27
|
-
folder: string;
|
|
28
|
-
hasTitleImage: boolean;
|
|
29
|
-
sortOrder: number;
|
|
30
|
-
modUser: string;
|
|
31
|
-
__icon__: string;
|
|
32
|
-
contentTypeIcon: string;
|
|
33
|
-
variant: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Renders a DotContent component.
|
|
37
|
-
*
|
|
38
|
-
* @param {DotContentProps} props - The props for the DotContent component.
|
|
39
|
-
* @returns {JSX.Element} The rendered DotContent component.
|
|
40
|
-
*/
|
|
41
|
-
export declare const DotContent: ({ customRenderers, ...props }: DotContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ContentNode } from '../../../models/content-node.interface';
|
|
2
|
-
/**
|
|
3
|
-
* Renders an image component for dotCMS.
|
|
4
|
-
*
|
|
5
|
-
* @param props - The props for the DotCMSImage component.
|
|
6
|
-
* @returns The rendered image component.
|
|
7
|
-
*/
|
|
8
|
-
export declare const DotCMSImage: (props: ContentNode) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ContentNode } from '../../../models/content-node.interface';
|
|
2
|
-
/**
|
|
3
|
-
* Renders a video component for displaying videos.
|
|
4
|
-
*
|
|
5
|
-
* @param props - The properties for the video component.
|
|
6
|
-
* @returns The rendered video component.
|
|
7
|
-
*/
|
|
8
|
-
export declare const DotCMSVideo: (props: ContentNode) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DotCMSPageContext } from '../../models';
|
|
2
|
-
/**
|
|
3
|
-
* Props for Column component to render a column with its containers.
|
|
4
|
-
*
|
|
5
|
-
* @export
|
|
6
|
-
* @interface ColumnProps
|
|
7
|
-
*/
|
|
8
|
-
export interface ColumnProps {
|
|
9
|
-
readonly column: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Renders a Column with its containers using information provided by dotCMS Page API.
|
|
13
|
-
*
|
|
14
|
-
* @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
|
|
15
|
-
* @export
|
|
16
|
-
* @param {ColumnProps} { column }
|
|
17
|
-
* @return {JSX.Element} Rendered column with containers
|
|
18
|
-
*/
|
|
19
|
-
export declare function Column({ column }: ColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DotCMSPageContext } from '../../models';
|
|
2
|
-
/**
|
|
3
|
-
* Props for the Container component.
|
|
4
|
-
*
|
|
5
|
-
* @export
|
|
6
|
-
* @interface ContainerProps
|
|
7
|
-
*/
|
|
8
|
-
export interface ContainerProps {
|
|
9
|
-
readonly containerRef: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Renders a Container with its content using information provided by dotCMS Page API.
|
|
13
|
-
*
|
|
14
|
-
* @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
|
|
15
|
-
* @export
|
|
16
|
-
* @param {ContainerProps} { containerRef }
|
|
17
|
-
* @return {JSX.Element} Rendered container with content
|
|
18
|
-
*/
|
|
19
|
-
export declare function Container({ containerRef }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { DotCMSPageEditorConfig } from '@dotcms/client';
|
|
2
|
-
import { DotCMSPageContext } from '../../models';
|
|
3
|
-
/**
|
|
4
|
-
* `DotcmsPageProps` is a type that defines the properties for the `DotcmsLayout` component.
|
|
5
|
-
* It includes a readonly `entity` property that represents the context for a DotCMS page.
|
|
6
|
-
*
|
|
7
|
-
* @typedef {Object} DotcmsPageProps
|
|
8
|
-
*
|
|
9
|
-
* @property {DotCMSPageContext} entity - The context for a DotCMS page.
|
|
10
|
-
* @readonly
|
|
11
|
-
*/
|
|
12
|
-
export type DotcmsPageProps = {
|
|
13
|
-
/**
|
|
14
|
-
* `pageContext` is a readonly property of the `DotcmsPageProps` type.
|
|
15
|
-
* It represents the context for a DotCMS page and is of type `PageProviderContext`.
|
|
16
|
-
*
|
|
17
|
-
* @property {PageProviderContext} pageContext
|
|
18
|
-
* @memberof DotcmsPageProps
|
|
19
|
-
* @type {DotCMSPageContext}
|
|
20
|
-
* @readonly
|
|
21
|
-
*/
|
|
22
|
-
readonly pageContext: DotCMSPageContext;
|
|
23
|
-
readonly config: DotCMSPageEditorConfig;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* `DotcmsLayout` is a functional component that renders a layout for a DotCMS page.
|
|
27
|
-
* It takes a `DotcmsPageProps` object as a parameter and returns a JSX element.
|
|
28
|
-
*
|
|
29
|
-
* @category Components
|
|
30
|
-
* @param {DotcmsPageProps} props - The properties for the DotCMS page.
|
|
31
|
-
* @returns {JSX.Element} - A JSX element that represents the layout for a DotCMS page.
|
|
32
|
-
* @deprecated Use {@link https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/react/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.tsx DotCMSLayoutBody} instead.
|
|
33
|
-
*/
|
|
34
|
-
export declare function DotcmsLayout(dotPageProps: DotcmsPageProps): JSX.Element;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface PageProviderProps {
|
|
3
|
-
readonly pageContext: any;
|
|
4
|
-
readonly children: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* `PageProvider` is a functional component that provides a context for a DotCMS page.
|
|
8
|
-
* It takes a `PageProviderProps` object as a parameter and returns a JSX element.
|
|
9
|
-
*
|
|
10
|
-
* @category Components
|
|
11
|
-
* @param {PageProviderProps} props - The properties for the PageProvider. Includes an `entity` and `children`.
|
|
12
|
-
* @returns {JSX.Element} - A JSX element that provides a context for a DotCMS page.
|
|
13
|
-
*/
|
|
14
|
-
export declare function PageProvider(props: PageProviderProps): JSX.Element;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DotCMSPageContext } from '../../models';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the row component
|
|
5
|
-
*
|
|
6
|
-
* @interface RowProps
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export interface RowProps {
|
|
10
|
-
/**
|
|
11
|
-
* Row data
|
|
12
|
-
*
|
|
13
|
-
* @type {DotCMSPageContext['layout']['body']['rows'][0]}
|
|
14
|
-
* @memberof RowProps
|
|
15
|
-
*/
|
|
16
|
-
row: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* This component renders a row with all it's content using the layout provided by dotCMS Page API.
|
|
20
|
-
*
|
|
21
|
-
* @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
|
|
22
|
-
* @category Components
|
|
23
|
-
* @param {React.ForwardedRef<HTMLDivElement, RowProps>} ref
|
|
24
|
-
* @return {JSX.Element} Rendered rows with columns
|
|
25
|
-
*/
|
|
26
|
-
export declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DotCMSPageContext } from '../models';
|
|
3
|
-
/**
|
|
4
|
-
* The `PageContext` is a React context that provides access to the DotCMS page context.
|
|
5
|
-
*
|
|
6
|
-
* @category Contexts
|
|
7
|
-
*/
|
|
8
|
-
export declare const PageContext: import("react").Context<DotCMSPageContext | null>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './components/DotcmsLayout/DotcmsLayout';
|
|
2
|
-
export * from './components/DotEditableText/DotEditableText';
|
|
3
|
-
export * from './components/PageProvider/PageProvider';
|
|
4
|
-
export * from './components/Row/Row';
|
|
5
|
-
export * from './hooks/useDotcmsPageContext';
|
|
6
|
-
export * from './components/BlockEditorRenderer/BlockEditorRenderer';
|
|
7
|
-
export * from './models/content-node.interface';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DotcmsPageProps } from '../components/DotcmsLayout/DotcmsLayout';
|
|
2
|
-
import { DotCMSPageContext } from '../models';
|
|
3
|
-
/**
|
|
4
|
-
* Custom Hook to handle the DotCMS editor interaction with the page.
|
|
5
|
-
*
|
|
6
|
-
* @category Hooks
|
|
7
|
-
* @param {DotcmsPageProps} props {
|
|
8
|
-
* pageContext,
|
|
9
|
-
* config,
|
|
10
|
-
* }
|
|
11
|
-
* @returns {DotCMSPageContext} The context for a DotCMS page provided by the editor.
|
|
12
|
-
*/
|
|
13
|
-
export declare const useDotcmsEditor: ({ pageContext, config }: DotcmsPageProps) => DotCMSPageContext;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DotCMSPageContext } from '../models';
|
|
2
|
-
/**
|
|
3
|
-
* `useDotcmsPageContext` is a custom React hook that provides access to the `PageProviderContext`.
|
|
4
|
-
* It takes no parameters and returns the context value or `null` if it's not available.
|
|
5
|
-
*
|
|
6
|
-
* @category Hooks
|
|
7
|
-
* @returns {DotCMSPageContext | null} - The context value or `null` if it's not available.
|
|
8
|
-
*/
|
|
9
|
-
export declare function useDotcmsPageContext(): DotCMSPageContext | null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './mockPageContext';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DotCMSPageContext, DotCMSContentlet } from '../models';
|
|
2
|
-
export declare const dotcmsContentletMock: DotCMSContentlet;
|
|
3
|
-
export declare const mockPageContext: DotCMSPageContext;
|
|
4
|
-
export declare const MockContextRender: ({ children, mockContext }: {
|
|
5
|
-
children: JSX.Element;
|
|
6
|
-
mockContext: Partial<DotCMSPageContext>;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ContentNode } from './content-node.interface';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a Block of content provided by the Block Editor
|
|
5
|
-
*
|
|
6
|
-
* @export
|
|
7
|
-
* @interface Block
|
|
8
|
-
*/
|
|
9
|
-
export interface Block {
|
|
10
|
-
content: ContentNode[];
|
|
11
|
-
type: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Props for a contentlet inside the Block Editor
|
|
15
|
-
*
|
|
16
|
-
* @export
|
|
17
|
-
* @interface DotContentletProps
|
|
18
|
-
*/
|
|
19
|
-
export interface DotContentletProps {
|
|
20
|
-
title: string;
|
|
21
|
-
baseType: string;
|
|
22
|
-
inode: string;
|
|
23
|
-
archived: boolean;
|
|
24
|
-
working: boolean;
|
|
25
|
-
locked: boolean;
|
|
26
|
-
contentType: string;
|
|
27
|
-
live: boolean;
|
|
28
|
-
identifier: string;
|
|
29
|
-
image: string;
|
|
30
|
-
imageContentAsset: string;
|
|
31
|
-
urlTitle: string;
|
|
32
|
-
url: string;
|
|
33
|
-
titleImage: string;
|
|
34
|
-
urlMap: string;
|
|
35
|
-
hasLiveVersion: boolean;
|
|
36
|
-
hasTitleImage: boolean;
|
|
37
|
-
sortOrder: number;
|
|
38
|
-
modUser: string;
|
|
39
|
-
__icon__: string;
|
|
40
|
-
contentTypeIcon: string;
|
|
41
|
-
language: string;
|
|
42
|
-
description: string;
|
|
43
|
-
shortDescription: string;
|
|
44
|
-
salePrice: string;
|
|
45
|
-
retailPrice: string;
|
|
46
|
-
mimeType: string;
|
|
47
|
-
thumbnail?: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Props for a block inside the Block Editor Component
|
|
51
|
-
*
|
|
52
|
-
* @export
|
|
53
|
-
* @interface BlockProps
|
|
54
|
-
*/
|
|
55
|
-
export interface BlockProps {
|
|
56
|
-
children: React.ReactNode;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Represents the different types of Blocks that can be used in the Block Editor
|
|
60
|
-
*
|
|
61
|
-
* @export
|
|
62
|
-
* @enum {number}
|
|
63
|
-
*/
|
|
64
|
-
export declare enum Blocks {
|
|
65
|
-
PARAGRAPH = "paragraph",
|
|
66
|
-
HEADING = "heading",
|
|
67
|
-
TEXT = "text",
|
|
68
|
-
BULLET_LIST = "bulletList",
|
|
69
|
-
ORDERED_LIST = "orderedList",
|
|
70
|
-
LIST_ITEM = "listItem",
|
|
71
|
-
BLOCK_QUOTE = "blockquote",
|
|
72
|
-
CODE_BLOCK = "codeBlock",
|
|
73
|
-
HARDBREAK = "hardBreak",
|
|
74
|
-
HORIZONTAL_RULE = "horizontalRule",
|
|
75
|
-
DOT_IMAGE = "dotImage",
|
|
76
|
-
DOT_VIDEO = "dotVideo",
|
|
77
|
-
TABLE = "table",
|
|
78
|
-
DOT_CONTENT = "dotContent"
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Represents the validation state of a Block Editor instance
|
|
82
|
-
*
|
|
83
|
-
* @interface BlockEditorState
|
|
84
|
-
* @property {boolean} isValid - Whether the blocks structure is valid
|
|
85
|
-
* @property {string | null} error - Error message if blocks are invalid, null otherwise
|
|
86
|
-
*/
|
|
87
|
-
export interface BlockEditorState {
|
|
88
|
-
error: string | null;
|
|
89
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { BlockProps } from './blocks.interface';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a Mark used by text content in the Block Editor
|
|
5
|
-
*
|
|
6
|
-
* @export
|
|
7
|
-
* @interface Mark
|
|
8
|
-
*/
|
|
9
|
-
export interface Mark {
|
|
10
|
-
type: string;
|
|
11
|
-
attrs: Record<string, string>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Represents a Content Node used by the Block Editor
|
|
15
|
-
*
|
|
16
|
-
* @export
|
|
17
|
-
* @interface ContentNode
|
|
18
|
-
*/
|
|
19
|
-
export interface ContentNode {
|
|
20
|
-
type: string;
|
|
21
|
-
content: ContentNode[];
|
|
22
|
-
attrs?: Record<string, string>;
|
|
23
|
-
marks?: Mark[];
|
|
24
|
-
text?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Represents a Custom Renderer used by the Block Editor Component
|
|
28
|
-
*
|
|
29
|
-
* @export
|
|
30
|
-
* @interface CustomRenderer
|
|
31
|
-
*/
|
|
32
|
-
export type CustomRenderer<T = any> = Record<string, React.FC<T>>;
|
|
33
|
-
/**
|
|
34
|
-
* Represents a CodeBlock used by the Block Editor Component
|
|
35
|
-
* @export
|
|
36
|
-
* @interface CodeBlockProps
|
|
37
|
-
*/
|
|
38
|
-
export type CodeBlockProps = BlockProps & ContentNode;
|
|
39
|
-
/**
|
|
40
|
-
* Represents a Heading used by the Block Editor Component
|
|
41
|
-
* @export
|
|
42
|
-
* @interface HeadingProps
|
|
43
|
-
*/
|
|
44
|
-
export type HeadingProps = BlockProps & ContentNode;
|
|
45
|
-
/**
|
|
46
|
-
* Represents a Link used by the Block Editor Component
|
|
47
|
-
* @export
|
|
48
|
-
* @interface LinkProps
|
|
49
|
-
*/
|
|
50
|
-
export type LinkProps = BlockProps & {
|
|
51
|
-
attrs?: Mark['attrs'];
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Represents a Paragraph used by the Block Editor Component
|
|
55
|
-
* @export
|
|
56
|
-
* @interface ParagraphProps
|
|
57
|
-
*/
|
|
58
|
-
export type ParagraphProps = BlockProps & ContentNode;
|
|
59
|
-
/**
|
|
60
|
-
* Represents a DotCMSVideo used by the Block Editor Component
|
|
61
|
-
* @export
|
|
62
|
-
* @interface DotCMSVideoProps
|
|
63
|
-
*/
|
|
64
|
-
export type DotCMSVideoProps = ContentNode['attrs'] & {
|
|
65
|
-
data?: Record<string, string>;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Represents a DotCMSImage used by the Block Editor Component
|
|
69
|
-
* @export
|
|
70
|
-
* @interface DotCMSImageProps
|
|
71
|
-
*/
|
|
72
|
-
export type DotCMSImageProps = ContentNode['attrs'] & {
|
|
73
|
-
data?: Record<string, unknown>;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Represents a DotContent used by the Block Editor Component
|
|
77
|
-
* @export
|
|
78
|
-
* @interface DotContentProps
|
|
79
|
-
*/
|
|
80
|
-
export type DotContentProps = ContentNode & {
|
|
81
|
-
customRenderers?: CustomRenderer;
|
|
82
|
-
};
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface ContainerData {
|
|
3
|
-
[key: string]: {
|
|
4
|
-
container: {
|
|
5
|
-
path: string;
|
|
6
|
-
identifier: string;
|
|
7
|
-
maxContentlets: number;
|
|
8
|
-
parentPermissionable: Record<string, string>;
|
|
9
|
-
};
|
|
10
|
-
containerStructures: {
|
|
11
|
-
contentTypeVar: string;
|
|
12
|
-
}[];
|
|
13
|
-
contentlets: {
|
|
14
|
-
[key: string]: {
|
|
15
|
-
contentType: string;
|
|
16
|
-
identifier: string;
|
|
17
|
-
title: string;
|
|
18
|
-
inode: string;
|
|
19
|
-
onNumberOfPages: number;
|
|
20
|
-
widgetTitle?: string;
|
|
21
|
-
baseType: string;
|
|
22
|
-
}[];
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export interface DotCMSPageContext {
|
|
27
|
-
/**
|
|
28
|
-
* `components` is a property of the `PageProviderProps` type.
|
|
29
|
-
* It is an object that maps content type variables to their corresponding React components.
|
|
30
|
-
*
|
|
31
|
-
* It will be use to render the contentlets in the page.
|
|
32
|
-
*
|
|
33
|
-
* @property {Object} components
|
|
34
|
-
* @memberof PageProviderProps
|
|
35
|
-
* @type {Object.<string, React.ElementType>}
|
|
36
|
-
*/
|
|
37
|
-
components: {
|
|
38
|
-
[contentTypeVariable: string]: React.ElementType;
|
|
39
|
-
};
|
|
40
|
-
pageAsset: {
|
|
41
|
-
containers: ContainerData;
|
|
42
|
-
layout: {
|
|
43
|
-
header: boolean;
|
|
44
|
-
footer: boolean;
|
|
45
|
-
body: {
|
|
46
|
-
rows: {
|
|
47
|
-
styleClass: string;
|
|
48
|
-
columns: {
|
|
49
|
-
styleClass: string;
|
|
50
|
-
width: number;
|
|
51
|
-
leftOffset: number;
|
|
52
|
-
containers: {
|
|
53
|
-
identifier: string;
|
|
54
|
-
uuid: string;
|
|
55
|
-
}[];
|
|
56
|
-
}[];
|
|
57
|
-
}[];
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
page: {
|
|
61
|
-
title: string;
|
|
62
|
-
identifier: string;
|
|
63
|
-
};
|
|
64
|
-
viewAs: {
|
|
65
|
-
language: {
|
|
66
|
-
id: string;
|
|
67
|
-
};
|
|
68
|
-
persona: {
|
|
69
|
-
keyTag: string;
|
|
70
|
-
};
|
|
71
|
-
variantId: string;
|
|
72
|
-
};
|
|
73
|
-
vanityUrl?: {
|
|
74
|
-
pattern: string;
|
|
75
|
-
vanityUrlId: string;
|
|
76
|
-
url: string;
|
|
77
|
-
siteId: string;
|
|
78
|
-
languageId: number;
|
|
79
|
-
forwardTo: string;
|
|
80
|
-
response: number;
|
|
81
|
-
order: number;
|
|
82
|
-
temporaryRedirect: boolean;
|
|
83
|
-
permanentRedirect: boolean;
|
|
84
|
-
forward: boolean;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
isInsideEditor: boolean;
|
|
88
|
-
}
|
|
89
|
-
export interface DotCMSContentlet {
|
|
90
|
-
archived: boolean;
|
|
91
|
-
binaryContentAsset?: string;
|
|
92
|
-
deleted?: boolean;
|
|
93
|
-
baseType: string;
|
|
94
|
-
binary?: string;
|
|
95
|
-
binaryVersion?: string;
|
|
96
|
-
file?: string;
|
|
97
|
-
contentType: string;
|
|
98
|
-
hasLiveVersion?: boolean;
|
|
99
|
-
folder: string;
|
|
100
|
-
hasTitleImage: boolean;
|
|
101
|
-
hostName: string;
|
|
102
|
-
host: string;
|
|
103
|
-
inode: string;
|
|
104
|
-
identifier: string;
|
|
105
|
-
languageId: number;
|
|
106
|
-
image?: string;
|
|
107
|
-
locked: boolean;
|
|
108
|
-
language?: string;
|
|
109
|
-
mimeType?: string;
|
|
110
|
-
modUser: string;
|
|
111
|
-
modDate: string;
|
|
112
|
-
live: boolean;
|
|
113
|
-
sortOrder: number;
|
|
114
|
-
owner: string;
|
|
115
|
-
title: string;
|
|
116
|
-
stInode: string;
|
|
117
|
-
titleImage: string;
|
|
118
|
-
modUserName: string;
|
|
119
|
-
text?: string;
|
|
120
|
-
working: boolean;
|
|
121
|
-
url: string;
|
|
122
|
-
contentTypeIcon?: string;
|
|
123
|
-
body?: string;
|
|
124
|
-
variant?: string;
|
|
125
|
-
__icon__?: string;
|
|
126
|
-
[key: string]: any;
|
|
127
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ContainerData, DotCMSPageContext } from '../models';
|
|
2
|
-
import { Block, BlockEditorState } from '../models/blocks.interface';
|
|
3
|
-
/**
|
|
4
|
-
* Get the container data from the containers object using the current container reference obtained from the layout.
|
|
5
|
-
*
|
|
6
|
-
* @param {ContainerData} containers
|
|
7
|
-
* @param {DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]} containerRef
|
|
8
|
-
* @returns {Object} Container with all the data it has.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getContainersData: (containers: ContainerData, containerRef: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]) => {
|
|
11
|
-
acceptTypes: string;
|
|
12
|
-
contentlets: {
|
|
13
|
-
contentType: string;
|
|
14
|
-
identifier: string;
|
|
15
|
-
title: string;
|
|
16
|
-
inode: string;
|
|
17
|
-
onNumberOfPages: number;
|
|
18
|
-
widgetTitle?: string | undefined;
|
|
19
|
-
baseType: string;
|
|
20
|
-
}[];
|
|
21
|
-
variantId: string;
|
|
22
|
-
path: string;
|
|
23
|
-
identifier: string;
|
|
24
|
-
maxContentlets: number;
|
|
25
|
-
parentPermissionable: Record<string, string>;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Combine classes into a single string.
|
|
29
|
-
*
|
|
30
|
-
* @param {string[]} classes
|
|
31
|
-
* @returns {string} Combined classes
|
|
32
|
-
*/
|
|
33
|
-
export declare const combineClasses: (classes: string[]) => string;
|
|
34
|
-
/**
|
|
35
|
-
* Get the start and end classes for the column based on the left offset and width.
|
|
36
|
-
*
|
|
37
|
-
* @param {number} start
|
|
38
|
-
* @param {number} end
|
|
39
|
-
* @returns {Object} Start and end classes
|
|
40
|
-
*/
|
|
41
|
-
export declare const getPositionStyleClasses: (start: number, end: number) => {
|
|
42
|
-
startClass: string;
|
|
43
|
-
endClass: string;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Validates the structure of a Block Editor block.
|
|
47
|
-
*
|
|
48
|
-
* This function checks that:
|
|
49
|
-
* 1. The blocks parameter is a valid object
|
|
50
|
-
* 2. The block has a 'doc' type
|
|
51
|
-
* 3. The block has a valid content array that is not empty
|
|
52
|
-
*
|
|
53
|
-
* @param {Block} blocks - The blocks structure to validate
|
|
54
|
-
* @returns {BlockEditorState} Object containing validation state and any error message
|
|
55
|
-
* @property {boolean} BlockEditorState.isValid - Whether the blocks structure is valid
|
|
56
|
-
* @property {string | null} BlockEditorState.error - Error message if invalid, null if valid
|
|
57
|
-
*/
|
|
58
|
-
export declare const isValidBlocks: (blocks: Block) => BlockEditorState;
|