@dotcms/react 0.0.1-alpha.9 → 0.0.1-beta.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 +0 -1
- package/index.esm.d.ts +1 -0
- package/index.esm.js +5336 -0
- package/package.json +33 -28
- package/src/{index.ts → index.d.ts} +3 -0
- package/src/lib/components/BlockEditorRenderer/BlockEditorRenderer.d.ts +37 -0
- package/src/lib/components/BlockEditorRenderer/blocks/Code.d.ts +17 -0
- package/src/lib/components/BlockEditorRenderer/blocks/Contentlet.d.ts +41 -0
- package/src/lib/components/BlockEditorRenderer/blocks/Image.d.ts +8 -0
- package/src/lib/components/BlockEditorRenderer/blocks/Lists.d.ts +22 -0
- package/src/lib/components/BlockEditorRenderer/blocks/Table.d.ts +16 -0
- package/src/lib/components/BlockEditorRenderer/blocks/Texts.d.ts +71 -0
- package/src/lib/components/BlockEditorRenderer/blocks/Video.d.ts +8 -0
- package/src/lib/components/BlockEditorRenderer/item/BlockEditorBlock.d.ts +12 -0
- package/src/lib/components/Column/Column.d.ts +19 -0
- package/src/lib/components/Container/Container.d.ts +19 -0
- package/src/lib/components/DotEditableText/DotEditableText.d.ts +30 -0
- package/src/lib/components/DotEditableText/utils.d.ts +36 -0
- package/src/lib/components/DotcmsLayout/{DotcmsLayout.tsx → DotcmsLayout.d.ts} +8 -23
- package/src/lib/components/PageProvider/PageProvider.d.ts +14 -0
- package/src/lib/components/Row/Row.d.ts +26 -0
- package/src/lib/contexts/PageContext.d.ts +8 -0
- package/src/lib/hooks/useCheckHaveContent.d.ts +5 -0
- package/src/lib/hooks/useDotcmsEditor.d.ts +13 -0
- package/src/lib/hooks/useDotcmsPageContext.d.ts +9 -0
- package/src/lib/mocks/mockPageContext.d.ts +7 -0
- package/src/lib/models/blocks.interface.d.ts +89 -0
- package/src/lib/models/content-node.interface.d.ts +82 -0
- package/src/lib/models/index.d.ts +127 -0
- package/src/lib/utils/utils.d.ts +58 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -18
- package/jest.config.ts +0 -11
- package/project.json +0 -51
- package/src/lib/components/Column/Column.module.css +0 -99
- package/src/lib/components/Column/Column.spec.tsx +0 -78
- package/src/lib/components/Column/Column.tsx +0 -45
- package/src/lib/components/Container/Container.module.css +0 -7
- package/src/lib/components/Container/Container.spec.tsx +0 -82
- package/src/lib/components/Container/Container.tsx +0 -105
- package/src/lib/components/DotcmsLayout/DotcmsLayout.module.css +0 -7
- package/src/lib/components/DotcmsLayout/DotcmsLayout.spec.tsx +0 -41
- package/src/lib/components/PageProvider/PageProvider.module.css +0 -7
- package/src/lib/components/PageProvider/PageProvider.spec.tsx +0 -54
- package/src/lib/components/PageProvider/PageProvider.tsx +0 -95
- package/src/lib/components/Row/Row.module.css +0 -5
- package/src/lib/components/Row/Row.spec.tsx +0 -92
- package/src/lib/components/Row/Row.tsx +0 -51
- package/src/lib/contexts/PageContext.tsx +0 -5
- package/src/lib/hooks/useDotcmsEditor.spec.ts +0 -56
- package/src/lib/hooks/useDotcmsEditor.ts +0 -29
- package/src/lib/hooks/useDotcmsPageContext.spec.tsx +0 -43
- package/src/lib/hooks/useDotcmsPageContext.tsx +0 -15
- package/src/lib/mocks/mockPageContext.tsx +0 -84
- package/src/lib/utils/utils.ts +0 -69
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -23
- package/tsconfig.spec.json +0 -20
- /package/src/lib/mocks/{index.ts → index.d.ts} +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
|
|
3
|
-
import { PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
4
|
-
import { PageContext } from '../contexts/PageContext';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* `useDotcmsPageContext` is a custom React hook that provides access to the `PageProviderContext`.
|
|
8
|
-
* It takes no parameters and returns the context value or `null` if it's not available.
|
|
9
|
-
*
|
|
10
|
-
* @category Hooks
|
|
11
|
-
* @returns {PageProviderContext | null} - The context value or `null` if it's not available.
|
|
12
|
-
*/
|
|
13
|
-
export function useDotcmsPageContext() {
|
|
14
|
-
return useContext<PageProviderContext | null>(PageContext);
|
|
15
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { PageProvider, PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
2
|
-
|
|
3
|
-
export const mockPageContext: PageProviderContext = {
|
|
4
|
-
layout: {
|
|
5
|
-
header: true,
|
|
6
|
-
footer: true,
|
|
7
|
-
body: {
|
|
8
|
-
rows: [
|
|
9
|
-
{
|
|
10
|
-
styleClass: 'row',
|
|
11
|
-
columns: [
|
|
12
|
-
{
|
|
13
|
-
styleClass: 'col-md-12',
|
|
14
|
-
width: 6,
|
|
15
|
-
leftOffset: 3,
|
|
16
|
-
containers: [
|
|
17
|
-
{
|
|
18
|
-
identifier: 'container-1',
|
|
19
|
-
uuid: 'uuid-1'
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
containers: {
|
|
29
|
-
'container-1': {
|
|
30
|
-
container: {
|
|
31
|
-
path: 'path/to/container',
|
|
32
|
-
identifier: 'container-1',
|
|
33
|
-
maxContentlets: 100,
|
|
34
|
-
parentPermissionable: {}
|
|
35
|
-
},
|
|
36
|
-
containerStructures: [
|
|
37
|
-
{
|
|
38
|
-
contentTypeVar: 'content-type-1'
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
contentlets: {
|
|
42
|
-
'uuid-1': [
|
|
43
|
-
{
|
|
44
|
-
contentType: 'content-type-1',
|
|
45
|
-
identifier: 'contentlet-1',
|
|
46
|
-
title: 'Contentlet 1',
|
|
47
|
-
inode: 'inode-1',
|
|
48
|
-
onNumberOfPages: 1
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
'container-2': {
|
|
54
|
-
container: {
|
|
55
|
-
path: 'path/to/container',
|
|
56
|
-
identifier: 'container-2',
|
|
57
|
-
maxContentlets: 100,
|
|
58
|
-
parentPermissionable: {}
|
|
59
|
-
},
|
|
60
|
-
containerStructures: [
|
|
61
|
-
{
|
|
62
|
-
contentTypeVar: 'content-type-2'
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
contentlets: {
|
|
66
|
-
'uuid-2': []
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
page: { identifier: 'page-1', title: 'Hello Page' },
|
|
71
|
-
viewAs: { language: { id: 'en' }, persona: { keyTag: 'persona-1' } },
|
|
72
|
-
components: {},
|
|
73
|
-
isInsideEditor: false
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const MockContextRender = ({
|
|
77
|
-
children,
|
|
78
|
-
mockContext
|
|
79
|
-
}: {
|
|
80
|
-
children: JSX.Element;
|
|
81
|
-
mockContext: Partial<PageProviderContext>;
|
|
82
|
-
}) => {
|
|
83
|
-
return <PageProvider entity={mockContext}>{children}</PageProvider>;
|
|
84
|
-
};
|
package/src/lib/utils/utils.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ContainerData, PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
2
|
-
|
|
3
|
-
const endClassMap: Record<number, string> = {
|
|
4
|
-
1: 'col-end-1',
|
|
5
|
-
2: 'col-end-2',
|
|
6
|
-
3: 'col-end-3',
|
|
7
|
-
4: 'col-end-4',
|
|
8
|
-
5: 'col-end-5',
|
|
9
|
-
6: 'col-end-6',
|
|
10
|
-
7: 'col-end-7',
|
|
11
|
-
8: 'col-end-8',
|
|
12
|
-
9: 'col-end-9',
|
|
13
|
-
10: 'col-end-10',
|
|
14
|
-
11: 'col-end-11',
|
|
15
|
-
12: 'col-end-12',
|
|
16
|
-
13: 'col-end-13'
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const startClassMap: Record<number, string> = {
|
|
20
|
-
1: 'col-start-1',
|
|
21
|
-
2: 'col-start-2',
|
|
22
|
-
3: 'col-start-3',
|
|
23
|
-
4: 'col-start-4',
|
|
24
|
-
5: 'col-start-5',
|
|
25
|
-
6: 'col-start-6',
|
|
26
|
-
7: 'col-start-7',
|
|
27
|
-
8: 'col-start-8',
|
|
28
|
-
9: 'col-start-9',
|
|
29
|
-
10: 'col-start-10',
|
|
30
|
-
11: 'col-start-11',
|
|
31
|
-
12: 'col-start-12'
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const getContainersData = (
|
|
35
|
-
containers: ContainerData,
|
|
36
|
-
containerRef: PageProviderContext['layout']['body']['rows'][0]['columns'][0]['containers'][0]
|
|
37
|
-
) => {
|
|
38
|
-
const { identifier, uuid } = containerRef;
|
|
39
|
-
|
|
40
|
-
const { containerStructures, container } = containers[identifier];
|
|
41
|
-
|
|
42
|
-
// Get the variant id
|
|
43
|
-
const { variantId } = container?.parentPermissionable || {};
|
|
44
|
-
|
|
45
|
-
// Get accepts types of content types for this container
|
|
46
|
-
const acceptTypes = containerStructures.map((structure) => structure.contentTypeVar).join(',');
|
|
47
|
-
|
|
48
|
-
// Get the contentlets for "this" container
|
|
49
|
-
const contentlets = containers[identifier].contentlets[`uuid-${uuid}`];
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
...containers[identifier].container,
|
|
53
|
-
acceptTypes,
|
|
54
|
-
contentlets,
|
|
55
|
-
variantId
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const combineClasses = (classes: string[]) => classes.filter(Boolean).join(' ');
|
|
60
|
-
|
|
61
|
-
export const getPositionStyleClasses = (start: number, end: number) => {
|
|
62
|
-
const startClass = startClassMap[start];
|
|
63
|
-
const endClass = endClassMap[end];
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
startClass,
|
|
67
|
-
endClass
|
|
68
|
-
};
|
|
69
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"jsx": "react-jsx",
|
|
4
|
-
"allowJs": false,
|
|
5
|
-
"esModuleInterop": false,
|
|
6
|
-
"allowSyntheticDefaultImports": true,
|
|
7
|
-
"strict": true
|
|
8
|
-
},
|
|
9
|
-
"files": [],
|
|
10
|
-
"include": [],
|
|
11
|
-
"references": [
|
|
12
|
-
{
|
|
13
|
-
"path": "./tsconfig.lib.json"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"path": "./tsconfig.spec.json"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"extends": "../../../tsconfig.base.json"
|
|
20
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../../dist/out-tsc",
|
|
5
|
-
"types": ["node"]
|
|
6
|
-
},
|
|
7
|
-
"files": [
|
|
8
|
-
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
9
|
-
"../../../node_modules/@nrwl/react/typings/image.d.ts"
|
|
10
|
-
],
|
|
11
|
-
"exclude": [
|
|
12
|
-
"jest.config.ts",
|
|
13
|
-
"src/**/*.spec.ts",
|
|
14
|
-
"src/**/*.test.ts",
|
|
15
|
-
"src/**/*.spec.tsx",
|
|
16
|
-
"src/**/*.test.tsx",
|
|
17
|
-
"src/**/*.spec.js",
|
|
18
|
-
"src/**/*.test.js",
|
|
19
|
-
"src/**/*.spec.jsx",
|
|
20
|
-
"src/**/*.test.jsx"
|
|
21
|
-
],
|
|
22
|
-
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
23
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../../dist/out-tsc",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"types": ["jest", "node"]
|
|
7
|
-
},
|
|
8
|
-
"include": [
|
|
9
|
-
"jest.config.ts",
|
|
10
|
-
"src/**/*.test.ts",
|
|
11
|
-
"src/**/*.spec.ts",
|
|
12
|
-
"src/**/*.test.tsx",
|
|
13
|
-
"src/**/*.spec.tsx",
|
|
14
|
-
"src/**/*.test.js",
|
|
15
|
-
"src/**/*.spec.js",
|
|
16
|
-
"src/**/*.test.jsx",
|
|
17
|
-
"src/**/*.spec.jsx",
|
|
18
|
-
"src/**/*.d.ts"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
File without changes
|