@pronto-tools-and-more/components 6.27.0 → 6.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/main.js +18 -0
  2. package/dist/parts/Components/Components.d.ts +2 -0
  3. package/dist/parts/ContentBody/ContentBody.d.ts +1 -0
  4. package/dist/parts/ContentTitle/ContentTitle.d.ts +1 -0
  5. package/package.json +1 -1
  6. package/src/main.ts +0 -1
  7. package/src/parts/AppBar/AppBar.tsx +0 -3
  8. package/src/parts/Button/Button.tsx +0 -10
  9. package/src/parts/Components/Components.tsx +0 -12
  10. package/src/parts/CreateFakeSection/CreateFakeSection.ts +0 -8
  11. package/src/parts/EPaperLink/EPaperLink.tsx +0 -19
  12. package/src/parts/EPapers/EPapers.tsx +0 -28
  13. package/src/parts/FakeNode/FakeNode.ts +0 -6
  14. package/src/parts/FooterItemsList/FooterItemsList.tsx +0 -13
  15. package/src/parts/HasComplexChildren/HasComplexChildren.ts +0 -7
  16. package/src/parts/HeaderMenuItems/HeaderMenuItems.tsx +0 -12
  17. package/src/parts/Home/Home.tsx +0 -9
  18. package/src/parts/ISearchResult/ISearchResult.tsx +0 -7
  19. package/src/parts/ISearchResultComponent/ISearchResultComponent.tsx +0 -6
  20. package/src/parts/IssueList/IssueList.tsx +0 -31
  21. package/src/parts/JsonComponent/JsonComponent.tsx +0 -6
  22. package/src/parts/Link/Link.tsx +0 -17
  23. package/src/parts/Login/Login.tsx +0 -9
  24. package/src/parts/Main/Main.tsx +0 -1
  25. package/src/parts/MenuItems/MenuItems.tsx +0 -17
  26. package/src/parts/MockReact/MockReact.tsx +0 -21
  27. package/src/parts/MostRead/MostRead.tsx +0 -42
  28. package/src/parts/NoSearchResults/NoSearchResults.tsx +0 -15
  29. package/src/parts/Parts/Parts.tsx +0 -10
  30. package/src/parts/PostContentBody/PostContentBody.tsx +0 -21
  31. package/src/parts/React/React.tsx +0 -9
  32. package/src/parts/SearchField/SearchField.tsx +0 -14
  33. package/src/parts/SearchLink/SearchLink.tsx +0 -19
  34. package/src/parts/SearchResults/SearchResults.tsx +0 -118
  35. package/src/parts/SubscriptionLink/SubscriptionLink.tsx +0 -19
  36. package/src/parts/Swiper/Swiper.tsx +0 -11
  37. package/src/parts/UnwrapComponent/UnwrapComponent.tsx +0 -98
package/dist/main.js CHANGED
@@ -4,6 +4,22 @@ var JsonComponent = ({ json }) => {
4
4
  return node;
5
5
  };
6
6
 
7
+ // src/parts/ContentBody/ContentBody.tsx
8
+ var ContentBody = () => {
9
+ const json = {
10
+ type: "content-body"
11
+ };
12
+ return /* @__PURE__ */ React.createElement(JsonComponent, { json });
13
+ };
14
+
15
+ // src/parts/ContentTitle/ContentTitle.tsx
16
+ var ContentTitle = () => {
17
+ const json = {
18
+ type: "content-title"
19
+ };
20
+ return /* @__PURE__ */ React.createElement(JsonComponent, { json });
21
+ };
22
+
7
23
  // src/parts/EPaperLink/EPaperLink.tsx
8
24
  var EPaperLink = ({ message } = {}) => {
9
25
  const json = {
@@ -337,6 +353,8 @@ var SubscriptionLink = ({ message } = {}) => {
337
353
  return /* @__PURE__ */ React.createElement("div", { className: "SubscriptionLink" }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
338
354
  };
339
355
  export {
356
+ ContentBody,
357
+ ContentTitle,
340
358
  EPaperLink,
341
359
  FooterItemsList,
342
360
  HeaderMenuItems,
@@ -1,3 +1,5 @@
1
+ export * from "../ContentBody/ContentBody.tsx";
2
+ export * from "../ContentTitle/ContentTitle.tsx";
1
3
  export * from "../EPaperLink/EPaperLink.tsx";
2
4
  export * from "../FooterItemsList/FooterItemsList.tsx";
3
5
  export * from "../HeaderMenuItems/HeaderMenuItems.tsx";
@@ -0,0 +1 @@
1
+ export declare const ContentBody: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ContentTitle: () => import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/components",
3
- "version": "6.27.0",
3
+ "version": "6.29.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
package/src/main.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./parts/Components/Components.tsx";
@@ -1,3 +0,0 @@
1
- export const AppBar = () => {
2
- return <div className="AppBar">hello from appbar</div>;
3
- };
@@ -1,10 +0,0 @@
1
- export const Button = ({ message }: { message: string }) => {
2
- return {
3
- type: "button",
4
- message,
5
- tap: {
6
- type: "navigate",
7
- path: "epaper",
8
- },
9
- };
10
- };
@@ -1,12 +0,0 @@
1
- export * from "../EPaperLink/EPaperLink.tsx";
2
- export * from "../FooterItemsList/FooterItemsList.tsx";
3
- export * from "../HeaderMenuItems/HeaderMenuItems.tsx";
4
- export * from "../JsonComponent/JsonComponent.tsx";
5
- export * from "../Link/Link.tsx";
6
- export * from "../Login/Login.tsx";
7
- export * from "../MenuItems/MenuItems.tsx";
8
- export * from "../PostContentBody/PostContentBody.tsx";
9
- export * from "../SearchField/SearchField.tsx";
10
- export * from "../SearchLink/SearchLink.tsx";
11
- export * from "../SearchResults/SearchResults.tsx";
12
- export * from "../SubscriptionLink/SubscriptionLink.tsx";
@@ -1,8 +0,0 @@
1
- import * as FakeNode from "../FakeNode/FakeNode.ts";
2
-
3
- export const createFakeSection = (children) => {
4
- return {
5
- type: "section",
6
- content: [FakeNode.fakeNode, ...children],
7
- };
8
- };
@@ -1,19 +0,0 @@
1
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
2
-
3
- export const EPaperLink = ({ message }: { message?: string } = {}) => {
4
- const json = {
5
- type: "button",
6
- tap: {
7
- type: "navigate",
8
- path: "e-paper",
9
- },
10
- message,
11
- buttonClass: "e-paper",
12
- id: "button-epaper",
13
- };
14
- return (
15
- <div className="EPaperLink">
16
- <JsonComponent json={json} />
17
- </div>
18
- );
19
- };
@@ -1,28 +0,0 @@
1
- export const EPapers = () => {
2
- return {
3
- content: {
4
- type: "issue",
5
- descriptionMessage: "",
6
- customMessages: [],
7
- tapCover: {
8
- type: "openContent",
9
- mode: "MODAL",
10
- titleBar: true,
11
- },
12
- },
13
- dataSource: {
14
- type: "issue",
15
- sort: [
16
- {
17
- publicationDate: {
18
- direction: "ASC",
19
- },
20
- },
21
- ],
22
- batchSize: 12,
23
- },
24
- type: "list",
25
- class: "epaper-issues",
26
- template: "grid",
27
- };
28
- };
@@ -1,6 +0,0 @@
1
- // fake node (to allow using normal html)
2
- export const fakeNode = {
3
- type: "html",
4
- tag: "div",
5
- content: '<img src="x" onerror="globalThis.fixRender(this)" />',
6
- };
@@ -1,13 +0,0 @@
1
- import { MenuItems } from "../MenuItems/MenuItems.tsx";
2
-
3
- export const FooterItemsList = ({
4
- className,
5
- menuName = "",
6
- }: { className?: string; menuName?: string } = {}) => {
7
- const fullClassName = `FooterItemsList ${className}`;
8
- return (
9
- <div className={fullClassName}>
10
- <MenuItems menuName={menuName} />
11
- </div>
12
- );
13
- };
@@ -1,7 +0,0 @@
1
- const isComplex = (child) => {
2
- return typeof child !== "string";
3
- };
4
-
5
- export const hasComplexChildren = (children) => {
6
- return children.some(isComplex);
7
- };
@@ -1,12 +0,0 @@
1
- import { MenuItems } from "../MenuItems/MenuItems.tsx";
2
-
3
- export const HeaderMenuItems = ({
4
- menuName = "",
5
- }: { menuName?: string } = {}) => {
6
- const fullClassName = `HeaderMenuItems`;
7
- return (
8
- <div className={fullClassName}>
9
- <MenuItems menuName={menuName} />
10
- </div>
11
- );
12
- };
@@ -1,9 +0,0 @@
1
- import { AppBar } from "../AppBar/AppBar.tsx";
2
-
3
- export const Home = () => {
4
- return (
5
- <div>
6
- <AppBar />
7
- </div>
8
- );
9
- };
@@ -1,7 +0,0 @@
1
- export interface ISearchResult {
2
- readonly label: string;
3
- readonly readtime: string;
4
- readonly title: string;
5
- readonly description: string;
6
- readonly imageSrc: string;
7
- }
@@ -1,6 +0,0 @@
1
- import type React from "react";
2
- import type { ISearchResult } from "../ISearchResult/ISearchResult.tsx";
3
-
4
- export interface ISearchResultComponent {
5
- ({ item }: { item: ISearchResult }): React.ReactNode;
6
- }
@@ -1,31 +0,0 @@
1
- export const IssueList = () => {
2
- return {
3
- content: {
4
- type: "issue",
5
- template: "cover",
6
- downloadOptions: {
7
- buttonType: "SINGLE",
8
- progressType: "RADIAL",
9
- },
10
- openContent: {},
11
- tapCover: {
12
- type: "openContent",
13
- mode: "MODAL",
14
- titleBar: true,
15
- },
16
- },
17
- dataSource: {
18
- type: "issue",
19
- sort: [
20
- {
21
- publicationDate: {
22
- direction: "DESC",
23
- },
24
- },
25
- ],
26
- limit: 3,
27
- },
28
- type: "list",
29
- template: "horizontal",
30
- };
31
- };
@@ -1,6 +0,0 @@
1
- import type React from "react";
2
-
3
- export const JsonComponent = ({ json }): React.ReactElement => {
4
- const node = json as React.ReactElement;
5
- return node;
6
- };
@@ -1,17 +0,0 @@
1
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
2
-
3
- export const Link = ({ to, message }: { to: string; message: string }) => {
4
- const json = {
5
- type: "button",
6
- tap: {
7
- type: "navigate",
8
- path: to,
9
- },
10
- message,
11
- };
12
- return (
13
- <div className="Link">
14
- <JsonComponent json={json} />
15
- </div>
16
- );
17
- };
@@ -1,9 +0,0 @@
1
- import type React from "react";
2
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
3
-
4
- export const Login = (): React.ReactNode => {
5
- const json = {
6
- type: "login",
7
- };
8
- return <JsonComponent json={json} />;
9
- };
@@ -1 +0,0 @@
1
- export * from "../Components/Components.tsx";
@@ -1,17 +0,0 @@
1
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
2
-
3
- export const MenuItems = ({ menuName }: { menuName: string }) => {
4
- const json = {
5
- dataSource: {
6
- type: "menu",
7
- filter: {
8
- name: {
9
- value: menuName,
10
- },
11
- },
12
- },
13
- type: "menu",
14
- template: "STATIC",
15
- };
16
- return <JsonComponent json={json} />;
17
- };
@@ -1,21 +0,0 @@
1
- import { jest } from "@jest/globals";
2
-
3
- // jest.unstable_mockModule("react", () => {
4
- // return {
5
- // createElement(key, props, children) {
6
- // return {
7
- // key,
8
- // props,
9
- // children,
10
- // };
11
- // },
12
- // };
13
- // });
14
-
15
- // jest.unstable_mockModule("react/jsx-runtime", () => {
16
- // return {
17
- // jsx(fn, props) {
18
- // return fn(props);
19
- // },
20
- // };
21
- // });
@@ -1,42 +0,0 @@
1
- export const MostRead = ({ limit = 3 }) => {
2
- return {
3
- content: {
4
- type: "issue",
5
- issueContextKey: "content",
6
- template: "details",
7
- descriptionMessage: "",
8
- class: "issue-card",
9
- hideComponents: {
10
- publication: true,
11
- tags: true,
12
- categories: true,
13
- publicationDate: true,
14
- cover: true,
15
- properties: true,
16
- description: false,
17
- },
18
- },
19
- dataSource: {
20
- type: "content",
21
- filter: {
22
- AND: [
23
- {
24
- contentType: {
25
- value: "POST",
26
- },
27
- },
28
- {
29
- postType: {
30
- value: "post",
31
- },
32
- },
33
- ],
34
- },
35
- limit,
36
- },
37
- type: "list",
38
- tapEntry: {
39
- type: "openContent",
40
- },
41
- };
42
- };
@@ -1,15 +0,0 @@
1
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
2
-
3
- export const NoSearchResults = () => {
4
- const json = {
5
- tag: "p",
6
- type: "html",
7
- content: "SEARCH_RESULT_NO_SEARCH",
8
- class: "no-search",
9
- condition: {
10
- value: "$context.phrase",
11
- operation: "NOT_SET",
12
- },
13
- };
14
- return <JsonComponent json={json} />;
15
- };
@@ -1,10 +0,0 @@
1
- export * from "../AppBar/AppBar.tsx";
2
- export * from "../Button/Button.tsx";
3
- export * from "../EPapers/EPapers.tsx";
4
- export * from "../Home/Home.tsx";
5
- export * from "../IssueList/IssueList.tsx";
6
- export * from "../Login/Login.tsx";
7
- export * from "../MostRead/MostRead.tsx";
8
- export * from "../NoSearchResults/NoSearchResults.tsx";
9
- export * from "../SearchField/SearchField.tsx";
10
- export * from "../Swiper/Swiper.tsx";
@@ -1,21 +0,0 @@
1
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
2
-
3
- export const PostContentBody = () => {
4
- const json = {
5
- type: "content-body",
6
- id: "post-content-body",
7
- customBlocks: [],
8
- class: ["post-content-service"],
9
- dataSource: {
10
- type: "content",
11
- preventSSRCache: true,
12
- filter: {
13
- id: {
14
- value: "$context.content.id",
15
- },
16
- },
17
- },
18
- isLazy: false,
19
- };
20
- return <JsonComponent json={json} />;
21
- };
@@ -1,9 +0,0 @@
1
- export const React = {
2
- createElement(tag, props, children) {
3
- return {
4
- tag,
5
- props,
6
- children,
7
- };
8
- },
9
- };
@@ -1,14 +0,0 @@
1
- import type React from "react";
2
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
3
-
4
- export const SearchField = (): React.ReactElement => {
5
- const json = {
6
- type: "search-field",
7
- className: "searchfield",
8
- };
9
- return (
10
- <div className="SearchField">
11
- <JsonComponent json={json} />
12
- </div>
13
- );
14
- };
@@ -1,19 +0,0 @@
1
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
2
-
3
- export const SearchLink = ({ message }: { message?: string } = {}) => {
4
- const json = {
5
- type: "button",
6
- tap: {
7
- type: "navigate",
8
- path: "suche",
9
- },
10
- message,
11
- buttonClass: "search",
12
- id: "button-search",
13
- };
14
- return (
15
- <div className="SearchLink">
16
- <JsonComponent json={json} />
17
- </div>
18
- );
19
- };
@@ -1,118 +0,0 @@
1
- import { ISearchResult } from "../ISearchResult/ISearchResult.tsx";
2
- import type { ISearchResultComponent } from "../ISearchResultComponent/ISearchResultComponent.tsx";
3
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
4
- import * as UnwrapComponent from "../UnwrapComponent/UnwrapComponent.tsx";
5
-
6
- export const SearchResults = ({
7
- SearchResult,
8
- }: {
9
- SearchResult: ISearchResultComponent;
10
- }) => {
11
- const searchResult: ISearchResult = {
12
- description: "abc",
13
- label: "abc",
14
- readtime: "",
15
- title: "$context.title",
16
- imageSrc: "",
17
- };
18
- const unwrapped = UnwrapComponent.unwrapComponent(
19
- <SearchResult item={searchResult} />
20
- );
21
- const json = {
22
- content: unwrapped,
23
- dataSource: {
24
- phrase: "$context.phrase",
25
- type: "search-result",
26
- filter: {
27
- AND: [
28
- {
29
- OR: [
30
- {
31
- contentType: {
32
- value: "POST",
33
- },
34
- },
35
- {
36
- contentType: {
37
- value: "BUNDLE",
38
- },
39
- },
40
- ],
41
- },
42
- {
43
- postType: {
44
- value: "post",
45
- },
46
- },
47
- {
48
- condition: {
49
- value: "$context.issue-age",
50
- compareValue: "day",
51
- },
52
- age: {
53
- count: 1,
54
- unit: "DAY",
55
- },
56
- },
57
- {
58
- condition: {
59
- value: "$context.issue-age",
60
- compareValue: "week",
61
- },
62
- age: {
63
- count: 1,
64
- unit: "WEEK",
65
- },
66
- },
67
- {
68
- condition: {
69
- value: "$context.issue-age",
70
- compareValue: "month",
71
- },
72
- age: {
73
- count: 1,
74
- unit: "MONTH",
75
- },
76
- },
77
- {
78
- condition: {
79
- value: "$context.issue-age",
80
- compareValue: "year",
81
- },
82
- age: {
83
- count: 1,
84
- unit: "YEAR",
85
- },
86
- },
87
- ],
88
- },
89
- contextKey: "searchResults",
90
- searchOptions: {
91
- sortBy: "PUB_DATE_DESC",
92
- findAll: true,
93
- },
94
- limitCharactersBeforeHit: 70,
95
- legacyMode: {
96
- mapPostToIssue: true,
97
- unwrapBundles: true,
98
- },
99
- },
100
- type: "list",
101
- class: "schlauch-section",
102
- emptyMessage: {
103
- message: "SEARCH_RESULT_NO_RESULT",
104
- variables: ["$context.phrase"],
105
- },
106
- errorMessage: "SEARCH_ERROR",
107
- errorButtonLabel: "SEARCH_ERROR_RETRY",
108
- template: "grid",
109
- tapEntry: {
110
- type: "openContent",
111
- },
112
- };
113
- return (
114
- <div className="SearchResults">
115
- <JsonComponent json={json} />
116
- </div>
117
- );
118
- };
@@ -1,19 +0,0 @@
1
- import { JsonComponent } from "../JsonComponent/JsonComponent.tsx";
2
-
3
- export const SubscriptionLink = ({ message }: { message?: string } = {}) => {
4
- const json = {
5
- type: "button",
6
- tap: {
7
- type: "navigate",
8
- path: "subscriptions",
9
- },
10
- message,
11
- buttonClass: "subscriptions",
12
- id: "button-subscriptions",
13
- };
14
- return (
15
- <div className="SubscriptionLink">
16
- <JsonComponent json={json} />
17
- </div>
18
- );
19
- };
@@ -1,11 +0,0 @@
1
- export const Swiper = () => {
2
- return {
3
- type: "swiper",
4
- effect: "slide",
5
- loop: false,
6
- pagination: false,
7
- centeredSlides: false,
8
- param: "$context.embeddedParams.swiperIndex",
9
- paramScope: "USER_ATTRIBUTE",
10
- };
11
- };
@@ -1,98 +0,0 @@
1
- import type React from "react";
2
- import * as HasComplexChildren from "../HasComplexChildren/HasComplexChildren.ts";
3
- import * as CreateFakeSection from "../CreateFakeSection/CreateFakeSection.ts";
4
-
5
- export const createElement = (tag, props, ...children) => {
6
- return {
7
- tag,
8
- props,
9
- children,
10
- };
11
- };
12
-
13
- const getComponentChildren = (element: any, componentProps: any) => {
14
- if (componentProps && componentProps.children) {
15
- if (typeof componentProps.children === "string") {
16
- return [componentProps.children];
17
- }
18
- return componentProps.children;
19
- }
20
- if (element && element.children) {
21
- if (typeof element.children === "string") {
22
- return [element.children];
23
- }
24
- return element.children;
25
- }
26
- return [];
27
- };
28
-
29
- const getComponentProperties = (element: any) => {
30
- // @ts-ignore
31
- const componentType = element.type;
32
- // @ts-ignore
33
- const componentProps = element.props;
34
- //@ts-ignore
35
- const componentChildren = getComponentChildren(element, componentProps);
36
- return {
37
- componentType,
38
- componentProps,
39
- componentChildren,
40
- };
41
- };
42
-
43
- export const unwrapComponent = (element: React.ReactNode) => {
44
- if (!element) {
45
- return {
46
- type: "html",
47
- tag: "div",
48
- content: `Unknown component`,
49
- };
50
- }
51
- if (
52
- typeof element === "string" ||
53
- typeof element === "number" ||
54
- typeof element === "boolean"
55
- ) {
56
- return {
57
- type: "html",
58
- tag: "div",
59
- content: `${element}`,
60
- };
61
- }
62
-
63
- const { componentChildren, componentProps, componentType } =
64
- getComponentProperties(element);
65
-
66
- if (typeof componentType === "function") {
67
- const vnode = componentType({
68
- ...componentProps,
69
- });
70
- const rendered = unwrapComponent(vnode);
71
- return rendered;
72
- }
73
-
74
- if (typeof componentType === "string") {
75
- const hasComplexChildren =
76
- HasComplexChildren.hasComplexChildren(componentChildren);
77
- const renderedChildren = hasComplexChildren
78
- ? componentChildren.map(unwrapComponent)
79
- : [];
80
- const content = hasComplexChildren ? "" : componentChildren[0] || "";
81
- const props = componentProps ? componentProps : {};
82
-
83
- return CreateFakeSection.createFakeSection([
84
- {
85
- type: "html",
86
- tag: componentType,
87
- content,
88
- },
89
- ...renderedChildren,
90
- ]);
91
- }
92
- if (componentType) {
93
- return {
94
- type: "TODO",
95
- };
96
- }
97
- return {};
98
- };