@pronto-tools-and-more/components-renderer 10.18.0 → 10.20.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/src/parts/RenderCustomElement/RenderCustomElement.js +3 -20
- package/src/parts/RenderCustomElementAuthorList/RenderCustomElementAuthorList.js +0 -30
- package/src/parts/RenderCustomElementCategoryList/RenderCustomElementCategoryList.js +0 -29
- package/src/parts/RenderCustomElementCollection/RenderCustomElementCollection.js +0 -24
- package/src/parts/RenderCustomElementList/RenderCustomElementList.js +0 -24
- package/src/parts/RenderCustomElementSearchResults/RenderCustomElementSearchResults.js +0 -31
- package/src/parts/RenderCustomElementTagList/RenderCustomElementTagList.js +0 -28
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pronto-tools-and-more/components-renderer",
|
3
|
-
"version": "10.
|
3
|
+
"version": "10.20.0",
|
4
4
|
"description": "",
|
5
5
|
"main": "src/componentsRendererMain.js",
|
6
6
|
"type": "module",
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"@swc-node/register": "^1.10.9"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
|
-
"@types/node": "^22.9.
|
23
|
+
"@types/node": "^22.9.1",
|
24
24
|
"jest": "^29.7.0"
|
25
25
|
}
|
26
26
|
}
|
@@ -1,26 +1,9 @@
|
|
1
|
-
import * as RenderCustomElementCategoryList from "../RenderCustomElementCategoryList/RenderCustomElementCategoryList.js";
|
2
|
-
import * as RenderCustomElementCollection from "../RenderCustomElementCollection/RenderCustomElementCollection.js";
|
3
|
-
import * as RenderCustomElementList from "../RenderCustomElementList/RenderCustomElementList.js";
|
4
|
-
import * as RenderCustomElementSearchResults from "../RenderCustomElementSearchResults/RenderCustomElementSearchResults.js";
|
5
1
|
import * as RenderCustomElementUnknown from "../RenderCustomElementUnknown/RenderCustomElementUnknown.js";
|
6
|
-
import * as RenderCustomElementTagList from "../RenderCustomElementTagList/RenderCustomElementTagList.js";
|
7
|
-
import * as RenderCustomElementAuthorList from "../RenderCustomElementAuthorList/RenderCustomElementAuthorList.js";
|
8
|
-
|
9
|
-
const renderers = [
|
10
|
-
RenderCustomElementAuthorList.renderCustomElementAuthorList,
|
11
|
-
RenderCustomElementCategoryList.renderCustomElementCategoryList,
|
12
|
-
RenderCustomElementCollection.renderCustomElementCollection,
|
13
|
-
RenderCustomElementList.renderCustomElementList,
|
14
|
-
RenderCustomElementSearchResults.renderCustomElementSearchResults,
|
15
|
-
RenderCustomElementTagList.renderCustomElementTagList,
|
16
|
-
];
|
17
2
|
|
18
3
|
export const renderCustomElement = (element, renderElement) => {
|
19
|
-
|
20
|
-
const result =
|
21
|
-
|
22
|
-
return result;
|
23
|
-
}
|
4
|
+
if (element.render && element.unrender) {
|
5
|
+
const result = element.unrender(element, renderElement);
|
6
|
+
return result;
|
24
7
|
}
|
25
8
|
return RenderCustomElementUnknown.renderCustomElementUnknown(
|
26
9
|
element,
|
@@ -1,30 +0,0 @@
|
|
1
|
-
export const renderCustomElementAuthorList = (element, renderElement) => {
|
2
|
-
if (
|
3
|
-
element.type === "list" &&
|
4
|
-
element.class &&
|
5
|
-
element.class.includes("data-custom-author-list")
|
6
|
-
) {
|
7
|
-
const { render, ...rest } = element;
|
8
|
-
const node = render({
|
9
|
-
id: `$functions.id($context, 'context', 'id')`,
|
10
|
-
name: `$functions.id($context, 'context', 'name')`,
|
11
|
-
type: `$functions.id($context, 'context', 'type')`,
|
12
|
-
language: `$functions.id($context, 'context', 'properties', 'lang')`,
|
13
|
-
imageSrc: `$functions.id($context, 'context', 'properties', 'thumbnails', 'default')`,
|
14
|
-
});
|
15
|
-
const condition = {
|
16
|
-
value: "$context.context.type",
|
17
|
-
operation: "EQUALS",
|
18
|
-
compareValue: "author",
|
19
|
-
};
|
20
|
-
const final = {
|
21
|
-
...renderElement(node),
|
22
|
-
condition,
|
23
|
-
};
|
24
|
-
return {
|
25
|
-
...rest,
|
26
|
-
content: final,
|
27
|
-
};
|
28
|
-
}
|
29
|
-
return undefined;
|
30
|
-
};
|
@@ -1,29 +0,0 @@
|
|
1
|
-
export const renderCustomElementCategoryList = (element, renderElement) => {
|
2
|
-
if (
|
3
|
-
element.type === "list" &&
|
4
|
-
element.class &&
|
5
|
-
element.class.includes("data-custom-category-list")
|
6
|
-
) {
|
7
|
-
const { render, ...rest } = element;
|
8
|
-
const node = render({
|
9
|
-
id: `$functions.id($context, 'context', 'id')`,
|
10
|
-
name: `$functions.id($context, 'context', 'name')`,
|
11
|
-
type: `$functions.id($context, 'context', 'type')`,
|
12
|
-
language: `$functions.id($context, 'context', 'properties', 'lang')`,
|
13
|
-
});
|
14
|
-
const condition = {
|
15
|
-
value: "$context.context.type",
|
16
|
-
operation: "EQUALS",
|
17
|
-
compareValue: "category",
|
18
|
-
};
|
19
|
-
const final = {
|
20
|
-
...renderElement(node),
|
21
|
-
condition,
|
22
|
-
};
|
23
|
-
return {
|
24
|
-
...rest,
|
25
|
-
content: final,
|
26
|
-
};
|
27
|
-
}
|
28
|
-
return undefined;
|
29
|
-
};
|
@@ -1,24 +0,0 @@
|
|
1
|
-
export const renderCustomElementCollection = (element, renderElement) => {
|
2
|
-
if (
|
3
|
-
element.type === "list" &&
|
4
|
-
element.class &&
|
5
|
-
element.class.includes("data-custom-collection")
|
6
|
-
) {
|
7
|
-
const { render, ...rest } = element;
|
8
|
-
const node = render({
|
9
|
-
name: `$functions.id($context, 'collection-content', 'name')`,
|
10
|
-
description: `$functions.id($context, 'collection-content', 'description')`,
|
11
|
-
imageSrc: `$functions.id($context, 'collection-content', 'thumbnails', 'default')`,
|
12
|
-
slug: `$functions.id($context, 'collection-content', 'properties', 'slug')`,
|
13
|
-
metadataVideoPodcast: `$functions.id($context, 'collection-content', 'properties', 'metadataVideoPodcast')`,
|
14
|
-
readTime: `$functions.getReadTime($context['collection-content'])`,
|
15
|
-
publicationDate: `$functions.id($context, 'collection-content', 'publicationDate')`,
|
16
|
-
});
|
17
|
-
const final = renderElement(node);
|
18
|
-
return {
|
19
|
-
...rest,
|
20
|
-
content: final,
|
21
|
-
};
|
22
|
-
}
|
23
|
-
return undefined;
|
24
|
-
};
|
@@ -1,24 +0,0 @@
|
|
1
|
-
export const renderCustomElementList = (element, renderElement) => {
|
2
|
-
if (
|
3
|
-
element.type === "list" &&
|
4
|
-
element.class &&
|
5
|
-
element.class.includes("data-custom-list")
|
6
|
-
) {
|
7
|
-
const { render, ...rest } = element;
|
8
|
-
const node = render({
|
9
|
-
name: `$functions.id($context, 'content', 'name')`,
|
10
|
-
description: `$functions.id($context, 'content', 'description')`,
|
11
|
-
imageSrc: `$functions.id($context, 'content', 'thumbnails', 'default')`,
|
12
|
-
slug: `$functions.id($context, 'content', 'properties', 'slug')`,
|
13
|
-
metadataVideoPodcast: `$functions.id($context, 'content', 'properties', 'metadataVideoPodcast')`,
|
14
|
-
readTime: `$functions.getReadTime($context.content)`,
|
15
|
-
publicationDate: `$functions.id($context, 'content', 'publicationDate')`,
|
16
|
-
});
|
17
|
-
const final = renderElement(node);
|
18
|
-
return {
|
19
|
-
...rest,
|
20
|
-
content: final,
|
21
|
-
};
|
22
|
-
}
|
23
|
-
return undefined;
|
24
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
const getImageSrc = (fallbackImage) => {
|
2
|
-
if (fallbackImage) {
|
3
|
-
return `$functions.fallback($functions.id($context, 'search-result', 'issue', 'thumbnails', 'default'), '${fallbackImage}')`;
|
4
|
-
}
|
5
|
-
return `$functions.id($context, 'search-result', 'issue', 'thumbnails', 'default')`;
|
6
|
-
};
|
7
|
-
|
8
|
-
export const renderCustomElementSearchResults = (element, renderElement) => {
|
9
|
-
if (
|
10
|
-
element.type === "list" &&
|
11
|
-
element.class &&
|
12
|
-
element.class.includes("data-custom-search-results")
|
13
|
-
) {
|
14
|
-
const { render, fallbackImage, ...rest } = element;
|
15
|
-
const node = render({
|
16
|
-
title: "$functions.id($context, 'search-result', 'issue', 'name')",
|
17
|
-
name: "$functions.id($context, 'search-result', 'issue', 'name')",
|
18
|
-
description:
|
19
|
-
"$functions.id($context, 'search-result', 'issue', 'description')",
|
20
|
-
imageSrc: getImageSrc(fallbackImage),
|
21
|
-
language:
|
22
|
-
"$functions.id($context, 'search-result', 'issue', 'properties', 'lang')",
|
23
|
-
slug: "$functions.id($context, 'search-result', 'issue', 'properties', 'slug')",
|
24
|
-
});
|
25
|
-
const final = renderElement(node);
|
26
|
-
return {
|
27
|
-
...rest,
|
28
|
-
content: final,
|
29
|
-
};
|
30
|
-
}
|
31
|
-
};
|
@@ -1,28 +0,0 @@
|
|
1
|
-
export const renderCustomElementTagList = (element, renderElement) => {
|
2
|
-
if (
|
3
|
-
element.type === "list" &&
|
4
|
-
element.class &&
|
5
|
-
element.class.includes("data-custom-tag-list")
|
6
|
-
) {
|
7
|
-
const { render, ...rest } = element;
|
8
|
-
const node = render({
|
9
|
-
id: `$functions.id($context, 'context', 'id')`,
|
10
|
-
name: `$functions.id($context, 'context', 'name')`,
|
11
|
-
language: `$functions.id($context, 'context', 'properties', 'lang')`,
|
12
|
-
});
|
13
|
-
const condition = {
|
14
|
-
value: "$context.context.type",
|
15
|
-
operation: "EQUALS",
|
16
|
-
compareValue: "tag",
|
17
|
-
};
|
18
|
-
const final = {
|
19
|
-
...renderElement(node),
|
20
|
-
condition,
|
21
|
-
};
|
22
|
-
return {
|
23
|
-
...rest,
|
24
|
-
content: final,
|
25
|
-
};
|
26
|
-
}
|
27
|
-
return undefined;
|
28
|
-
};
|