@dotcms/client 0.0.1-alpha.9 → 0.0.1-beta.2
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 +166 -19
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +2050 -0
- package/index.cjs.mjs +2 -0
- package/index.esm.d.ts +1 -0
- package/index.esm.js +2038 -0
- package/package.json +36 -25
- package/src/index.d.ts +8 -0
- package/src/lib/client/content/builders/collection/collection.d.ts +226 -0
- package/src/lib/client/content/content-api.d.ts +129 -0
- package/src/lib/client/content/shared/const.d.ts +13 -0
- package/src/lib/client/content/shared/types.d.ts +138 -0
- package/src/lib/client/content/shared/utils.d.ts +20 -0
- package/src/lib/client/models/index.d.ts +12 -0
- package/src/lib/client/models/types.d.ts +13 -0
- package/src/lib/client/sdk-js-client.d.ts +276 -0
- package/src/lib/editor/listeners/listeners.d.ts +45 -0
- package/src/lib/editor/models/client.model.d.ts +98 -0
- package/src/lib/editor/models/editor.model.d.ts +62 -0
- package/src/lib/editor/models/inline-event.model.d.ts +9 -0
- package/src/lib/editor/models/{listeners.model.ts → listeners.model.d.ts} +17 -8
- package/src/lib/editor/sdk-editor-vtl.d.ts +1 -0
- package/src/lib/editor/sdk-editor.d.ts +92 -0
- package/src/lib/editor/utils/editor.utils.d.ts +159 -0
- package/src/lib/editor/utils/traditional-vtl.utils.d.ts +4 -0
- package/src/lib/query-builder/lucene-syntax/Equals.d.ts +114 -0
- package/src/lib/query-builder/lucene-syntax/Field.d.ts +32 -0
- package/src/lib/query-builder/lucene-syntax/NotOperand.d.ts +26 -0
- package/src/lib/query-builder/lucene-syntax/Operand.d.ts +44 -0
- package/src/lib/query-builder/lucene-syntax/index.d.ts +4 -0
- package/src/lib/query-builder/sdk-query-builder.d.ts +76 -0
- package/src/lib/query-builder/utils/index.d.ts +142 -0
- package/src/lib/utils/graphql/transforms.d.ts +24 -0
- package/src/lib/utils/index.d.ts +2 -0
- package/src/lib/utils/page/common-utils.d.ts +33 -0
- package/.eslintrc.json +0 -18
- package/jest.config.ts +0 -15
- package/project.json +0 -63
- package/src/index.ts +0 -4
- package/src/lib/client/sdk-js-client.spec.ts +0 -258
- package/src/lib/client/sdk-js-client.ts +0 -297
- package/src/lib/editor/listeners/listeners.spec.ts +0 -55
- package/src/lib/editor/listeners/listeners.ts +0 -200
- package/src/lib/editor/models/client.model.ts +0 -55
- package/src/lib/editor/models/editor.model.ts +0 -17
- package/src/lib/editor/sdk-editor-vtl.ts +0 -24
- package/src/lib/editor/sdk-editor.spec.ts +0 -95
- package/src/lib/editor/sdk-editor.ts +0 -70
- package/src/lib/editor/utils/editor.utils.spec.ts +0 -164
- package/src/lib/editor/utils/editor.utils.ts +0 -151
- package/tsconfig.json +0 -22
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -9
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bound information for a contentlet.
|
|
3
|
-
*
|
|
4
|
-
* @interface ContentletBound
|
|
5
|
-
*/
|
|
6
|
-
interface ContentletBound {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
payload: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Bound information for a container.
|
|
16
|
-
*
|
|
17
|
-
* @interface ContenainerBound
|
|
18
|
-
*/
|
|
19
|
-
interface ContenainerBound {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
width: number;
|
|
23
|
-
height: number;
|
|
24
|
-
payload: {
|
|
25
|
-
container: {
|
|
26
|
-
acceptTypes: string;
|
|
27
|
-
identifier: string;
|
|
28
|
-
maxContentlets: string;
|
|
29
|
-
uuid: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
contentlets: ContentletBound[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Calculates the bounding information for each page element within the given containers.
|
|
37
|
-
*
|
|
38
|
-
* @export
|
|
39
|
-
* @param {HTMLDivElement[]} containers
|
|
40
|
-
* @return {*} An array of objects containing the bounding information for each page element.
|
|
41
|
-
*/
|
|
42
|
-
export function getPageElementBound(containers: HTMLDivElement[]): ContenainerBound[] {
|
|
43
|
-
return containers.map((container) => {
|
|
44
|
-
const containerRect = container.getBoundingClientRect();
|
|
45
|
-
const contentlets = Array.from(
|
|
46
|
-
container.querySelectorAll('[data-dot-object="contentlet"]')
|
|
47
|
-
) as HTMLDivElement[];
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
x: containerRect.x,
|
|
51
|
-
y: containerRect.y,
|
|
52
|
-
width: containerRect.width,
|
|
53
|
-
height: containerRect.height,
|
|
54
|
-
payload: {
|
|
55
|
-
container: getContainerData(container)
|
|
56
|
-
},
|
|
57
|
-
contentlets: getContentletsBound(containerRect, contentlets)
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* An array of objects containing the bounding information for each contentlet inside a container.
|
|
64
|
-
*
|
|
65
|
-
* @export
|
|
66
|
-
* @param {DOMRect} containerRect
|
|
67
|
-
* @param {HTMLDivElement[]} contentlets
|
|
68
|
-
* @return {*}
|
|
69
|
-
*/
|
|
70
|
-
export function getContentletsBound(
|
|
71
|
-
containerRect: DOMRect,
|
|
72
|
-
contentlets: HTMLDivElement[]
|
|
73
|
-
): ContentletBound[] {
|
|
74
|
-
return contentlets.map((contentlet) => {
|
|
75
|
-
const contentletRect = contentlet.getBoundingClientRect();
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
x: 0,
|
|
79
|
-
y: contentletRect.y - containerRect.y,
|
|
80
|
-
width: contentletRect.width,
|
|
81
|
-
height: contentletRect.height,
|
|
82
|
-
payload: JSON.stringify({
|
|
83
|
-
container: contentlet.dataset?.['dotContainer']
|
|
84
|
-
? JSON.parse(contentlet.dataset?.['dotContainer'])
|
|
85
|
-
: getClosestContainerData(contentlet),
|
|
86
|
-
contentlet: {
|
|
87
|
-
identifier: contentlet.dataset?.['dotIdentifier'],
|
|
88
|
-
title: contentlet.dataset?.['dotTitle'],
|
|
89
|
-
inode: contentlet.dataset?.['dotInode'],
|
|
90
|
-
contentType: contentlet.dataset?.['dotType']
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Get container data from VTLS.
|
|
99
|
-
*
|
|
100
|
-
* @export
|
|
101
|
-
* @param {HTMLElement} container
|
|
102
|
-
* @return {*}
|
|
103
|
-
*/
|
|
104
|
-
export function getContainerData(container: HTMLElement) {
|
|
105
|
-
return {
|
|
106
|
-
acceptTypes: container.dataset?.['dotAcceptTypes'] || '',
|
|
107
|
-
identifier: container.dataset?.['dotIdentifier'] || '',
|
|
108
|
-
maxContentlets: container.dataset?.['maxContentlets'] || '',
|
|
109
|
-
uuid: container.dataset?.['dotUuid'] || ''
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Get the closest container data from the contentlet.
|
|
115
|
-
*
|
|
116
|
-
* @export
|
|
117
|
-
* @param {Element} element
|
|
118
|
-
* @return {*}
|
|
119
|
-
*/
|
|
120
|
-
export function getClosestContainerData(element: Element) {
|
|
121
|
-
// Find the closest ancestor element with data-dot-object="container" attribute
|
|
122
|
-
const container = element.closest('[data-dot-object="container"]') as HTMLElement;
|
|
123
|
-
|
|
124
|
-
// If a container element is found
|
|
125
|
-
if (container) {
|
|
126
|
-
// Return the dataset of the container element
|
|
127
|
-
return getContainerData(container);
|
|
128
|
-
} else {
|
|
129
|
-
// If no container element is found, return null
|
|
130
|
-
console.warn('No container found for the contentlet');
|
|
131
|
-
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Find the closest contentlet element based on HTMLElement.
|
|
138
|
-
*
|
|
139
|
-
* @export
|
|
140
|
-
* @param {(HTMLElement | null)} element
|
|
141
|
-
* @return {*}
|
|
142
|
-
*/
|
|
143
|
-
export function findContentletElement(element: HTMLElement | null): HTMLElement | null {
|
|
144
|
-
if (!element) return null;
|
|
145
|
-
|
|
146
|
-
if (element.dataset && element.dataset?.['dotObject'] === 'contentlet') {
|
|
147
|
-
return element;
|
|
148
|
-
} else {
|
|
149
|
-
return findContentletElement(element?.['parentElement']);
|
|
150
|
-
}
|
|
151
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"forceConsistentCasingInFileNames": true,
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noImplicitOverride": true,
|
|
8
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
9
|
-
"noImplicitReturns": true,
|
|
10
|
-
"noFallthroughCasesInSwitch": true
|
|
11
|
-
},
|
|
12
|
-
"files": [],
|
|
13
|
-
"include": [],
|
|
14
|
-
"references": [
|
|
15
|
-
{
|
|
16
|
-
"path": "./tsconfig.lib.json"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"path": "./tsconfig.spec.json"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
package/tsconfig.lib.json
DELETED
package/tsconfig.spec.json
DELETED