@digitalygo/create-diggocms-app 0.1.0 → 0.1.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 +4 -4
- package/package.json +5 -2
- package/templates/full/README.md +11 -7
- package/templates/full/app/globals.css +58 -7
- package/templates/full/components/ExtendedCard.tsx +17 -5
- package/templates/full/components/ExtendedGallery.tsx +43 -0
- package/templates/full/components/ExtendedText.tsx +16 -0
- package/templates/full/components/ExtendedVideo.tsx +27 -0
- package/templates/full/components/server-components.ts +3 -3
- package/templates/full/lib/diggo-config.ts +8 -7
- package/templates/full/tsconfig.tsbuildinfo +1 -0
- package/templates/with-mock/README.md +9 -6
- package/templates/with-mock/app/globals.css +58 -7
- package/templates/with-mock/components/ExtendedCard.tsx +17 -5
- package/templates/with-mock/components/ExtendedGallery.tsx +43 -0
- package/templates/with-mock/components/ExtendedText.tsx +16 -0
- package/templates/with-mock/components/ExtendedVideo.tsx +27 -0
- package/templates/with-mock/components/server-components.ts +3 -3
- package/templates/with-mock/fixtures/collection.json +59 -18
- package/templates/with-mock/fixtures/pages/chi-siamo.json +9 -8
- package/templates/with-mock/fixtures/pages/contatti.json +10 -7
- package/templates/with-mock/fixtures/pages/home.json +71 -22
- package/templates/with-mock/lib/diggo-config.ts +8 -7
- package/templates/with-mock/tsconfig.tsbuildinfo +1 -0
- package/templates/full/components/ExtendedRichtext.tsx +0 -15
- package/templates/full/components/ExtendedSubtitle.tsx +0 -10
- package/templates/with-mock/components/ExtendedRichtext.tsx +0 -15
- package/templates/with-mock/components/ExtendedSubtitle.tsx +0 -10
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
type TextProps = {
|
|
4
|
+
content?: string | null;
|
|
5
|
+
text?: string | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function ExtendedText({ content, text }: TextProps): ReactElement | null {
|
|
9
|
+
const value = content ?? text;
|
|
10
|
+
|
|
11
|
+
if (!value) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <p className="diggo-text">{value}</p>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { VideoProps } from '@digitalygo/diggocms-sdk-core';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
type LegacyVideoProps = VideoProps & {
|
|
5
|
+
title?: string | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function ExtendedVideo({
|
|
9
|
+
src,
|
|
10
|
+
poster,
|
|
11
|
+
alt,
|
|
12
|
+
title,
|
|
13
|
+
}: LegacyVideoProps): ReactElement | null {
|
|
14
|
+
if (!src) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<figure className="diggo-video-block">
|
|
20
|
+
<video className="diggo-video" controls poster={poster ?? undefined}>
|
|
21
|
+
<source src={src} />
|
|
22
|
+
{alt ?? title ?? ''}
|
|
23
|
+
</video>
|
|
24
|
+
{alt || title ? <figcaption className="diggo-media-caption">{alt ?? title}</figcaption> : null}
|
|
25
|
+
</figure>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Re-export components for server-side usage (they're server-safe pure components)
|
|
2
1
|
export { ExtendedTitle } from './ExtendedTitle';
|
|
3
|
-
export { ExtendedSubtitle } from './ExtendedSubtitle';
|
|
4
2
|
export { ExtendedImage } from './ExtendedImage';
|
|
5
|
-
export {
|
|
3
|
+
export { ExtendedText } from './ExtendedText';
|
|
4
|
+
export { ExtendedVideo } from './ExtendedVideo';
|
|
5
|
+
export { ExtendedGallery } from './ExtendedGallery';
|
|
6
6
|
export { ExtendedCard } from './ExtendedCard';
|
|
7
7
|
export { ExtendedMenuItem } from './ExtendedMenuItem';
|
|
8
8
|
export { ExtendedMenuContainer } from './ExtendedMenuContainer';
|
|
@@ -1,28 +1,69 @@
|
|
|
1
1
|
{
|
|
2
|
-
"type": "posts",
|
|
3
2
|
"items": [
|
|
4
3
|
{
|
|
5
|
-
"id": "1",
|
|
6
|
-
"title": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
4
|
+
"id": "item-1",
|
|
5
|
+
"title": "First Article",
|
|
6
|
+
"slug": "first-article",
|
|
7
|
+
"excerpt": "This is the first article in the collection demonstration.",
|
|
8
|
+
"image": {
|
|
9
|
+
"src": "https://images.unsplash.com/photo-1499750310107-5fef28a66643?w=400&h=200&fit=crop",
|
|
10
|
+
"alt": "Article 1 image"
|
|
11
|
+
},
|
|
12
|
+
"components": [
|
|
13
|
+
{
|
|
14
|
+
"type": "title",
|
|
15
|
+
"data": {
|
|
16
|
+
"content": "Nested Title in Article 1"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
9
20
|
},
|
|
10
21
|
{
|
|
11
|
-
"id": "2",
|
|
12
|
-
"title": "
|
|
13
|
-
"
|
|
14
|
-
"
|
|
22
|
+
"id": "item-2",
|
|
23
|
+
"title": "Second Article",
|
|
24
|
+
"slug": "second-article",
|
|
25
|
+
"excerpt": "This is the second article with null image field.",
|
|
26
|
+
"image": null,
|
|
27
|
+
"components": [
|
|
28
|
+
{
|
|
29
|
+
"type": "text",
|
|
30
|
+
"data": {
|
|
31
|
+
"content": "Component with null image"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
15
35
|
},
|
|
16
36
|
{
|
|
17
|
-
"id": "3",
|
|
18
|
-
"title":
|
|
19
|
-
"
|
|
20
|
-
"
|
|
37
|
+
"id": "item-3",
|
|
38
|
+
"title": null,
|
|
39
|
+
"slug": "third-article",
|
|
40
|
+
"excerpt": "This item has null title but still renders.",
|
|
41
|
+
"image": {
|
|
42
|
+
"src": "https://images.unsplash.com/photo-1519389950473-47ba0277781c?w=400&h=200&fit=crop",
|
|
43
|
+
"alt": "Article 3 image"
|
|
44
|
+
},
|
|
45
|
+
"components": []
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "item-4",
|
|
49
|
+
"title": "Fourth Article",
|
|
50
|
+
"slug": "fourth-article",
|
|
51
|
+
"excerpt": "Full content with all fields present.",
|
|
52
|
+
"image": {
|
|
53
|
+
"src": "https://images.unsplash.com/photo-1558655146-9f40138edfeb?w=400&h=200&fit=crop",
|
|
54
|
+
"alt": "Article 4 image"
|
|
55
|
+
},
|
|
56
|
+
"components": [
|
|
57
|
+
{
|
|
58
|
+
"type": "text",
|
|
59
|
+
"data": {
|
|
60
|
+
"content": "Additional content inside the collection item."
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
21
64
|
}
|
|
22
65
|
],
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"totalItems": 3
|
|
27
|
-
}
|
|
66
|
+
"total": 4,
|
|
67
|
+
"page": 1,
|
|
68
|
+
"perPage": 10
|
|
28
69
|
}
|
|
@@ -10,27 +10,28 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
"type": "
|
|
13
|
+
"type": "text",
|
|
14
14
|
"data": {
|
|
15
|
-
"content": "
|
|
15
|
+
"content": "Who we are — scopri la nostra storia, i nostri valori e il modo in cui lavoriamo insieme ai clienti."
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"type": "
|
|
19
|
+
"type": "text",
|
|
20
20
|
"data": {
|
|
21
|
-
"content": "
|
|
21
|
+
"content": "Siamo un'azienda italiana con una passione per l'innovazione e la qualità. Dal 2010 realizziamo soluzioni digitali che aiutano le aziende a crescere nel panorama digitale moderno."
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
"type": "
|
|
25
|
+
"type": "text",
|
|
26
26
|
"data": {
|
|
27
|
-
"content": "
|
|
27
|
+
"content": "Il nostro team unisce collaborazione, creatività ed eccellenza. Se stai visualizzando questa pagina, significa che la navigazione verso Chi Siamo funziona correttamente."
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
"type": "
|
|
31
|
+
"type": "image",
|
|
32
32
|
"data": {
|
|
33
|
-
"
|
|
33
|
+
"src": "https://images.unsplash.com/photo-1522071820081-009f0129c71c?w=800&h=400&fit=crop",
|
|
34
|
+
"alt": "Il nostro team"
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
]
|
|
@@ -10,23 +10,26 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
"type": "
|
|
13
|
+
"type": "text",
|
|
14
14
|
"data": {
|
|
15
|
-
"content": "
|
|
15
|
+
"content": "Contacts — siamo qui per aiutarti con domande, collaborazioni e richieste di supporto."
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"type": "
|
|
19
|
+
"type": "text",
|
|
20
20
|
"data": {
|
|
21
|
-
"content": "
|
|
21
|
+
"content": "Questa sezione raccoglie i recapiti principali per scriverci, chiamarci o venire a trovarci in sede. Se stai visualizzando questa pagina, la navigazione verso Contatti funziona correttamente."
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"type": "card",
|
|
26
26
|
"data": {
|
|
27
|
-
"title": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
27
|
+
"title": "Informazioni di Contatto",
|
|
28
|
+
"richtext": "Indirizzo: Via Roma 123, 00100 Roma, Italia. Email: info@example.com. Telefono: +39 06 12345678. Orari: lun-ven 9:00-18:00.",
|
|
29
|
+
"callToAction": {
|
|
30
|
+
"text": "Scrivici",
|
|
31
|
+
"url": "mailto:info@example.com"
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
]
|
|
@@ -1,61 +1,110 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
2
|
+
"id": "page-1",
|
|
3
3
|
"slug": "home",
|
|
4
|
-
"title": "Welcome to DiggoCMS",
|
|
4
|
+
"title": "Welcome to DiggoCMS Demo",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"type": "title",
|
|
8
8
|
"data": {
|
|
9
|
-
"content": "
|
|
9
|
+
"content": "Benvenuto su DiggoCMS Demo"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
"type": "
|
|
13
|
+
"type": "text",
|
|
14
14
|
"data": {
|
|
15
|
-
"content": "
|
|
15
|
+
"content": "A demonstration of the SDK rendering capabilities built around the current component model."
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"type": "
|
|
19
|
+
"type": "text",
|
|
20
20
|
"data": {
|
|
21
|
-
"content": "
|
|
21
|
+
"content": "This page showcases the DiggoCMS SDK with extended components. All content is rendered from a JSON payload matching the CMS API format."
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"type": "image",
|
|
26
26
|
"data": {
|
|
27
|
-
"src": "https://
|
|
28
|
-
"alt": "DiggoCMS
|
|
27
|
+
"src": "https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=800&h=400&fit=crop",
|
|
28
|
+
"alt": "DiggoCMS Demo Placeholder"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"type": "
|
|
32
|
+
"type": "text",
|
|
33
33
|
"data": {
|
|
34
|
-
"content": "
|
|
34
|
+
"content": "The SDK now renders plain text, videos, galleries, and richer CMS cards with minimal custom components."
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
"type": "
|
|
38
|
+
"type": "video",
|
|
39
39
|
"data": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
40
|
+
"src": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
|
|
41
|
+
"poster": "https://images.unsplash.com/photo-1492691527719-9d1e07e534b4?w=800&h=450&fit=crop",
|
|
42
|
+
"alt": "Short sample video"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
"type": "
|
|
46
|
+
"type": "gallery",
|
|
47
47
|
"data": {
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
"items": [
|
|
49
|
+
{
|
|
50
|
+
"type": "image",
|
|
51
|
+
"order": 2,
|
|
52
|
+
"data": {
|
|
53
|
+
"src": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=600&h=400&fit=crop",
|
|
54
|
+
"alt": "Gallery item one"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"type": "video",
|
|
59
|
+
"order": 1,
|
|
60
|
+
"data": {
|
|
61
|
+
"src": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
|
|
62
|
+
"poster": "https://images.unsplash.com/photo-1518837695005-2083093ee35b?w=600&h=400&fit=crop",
|
|
63
|
+
"alt": "Gallery video item"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "image",
|
|
68
|
+
"order": 0,
|
|
69
|
+
"data": {
|
|
70
|
+
"src": "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=600&h=400&fit=crop",
|
|
71
|
+
"alt": "Gallery item three"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
51
75
|
}
|
|
52
76
|
},
|
|
53
77
|
{
|
|
54
78
|
"type": "card",
|
|
55
79
|
"data": {
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
"image": {
|
|
81
|
+
"src": "https://images.unsplash.com/photo-1551434678-e076c223a692?w=640&h=360&fit=crop",
|
|
82
|
+
"alt": "CMS card preview"
|
|
83
|
+
},
|
|
84
|
+
"title": "Feature Card",
|
|
85
|
+
"richtext": "This card demonstrates the updated CMS card shape with an image, body copy, and a call to action.",
|
|
86
|
+
"callToAction": {
|
|
87
|
+
"text": "Explore collection",
|
|
88
|
+
"url": "/collection"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "text",
|
|
94
|
+
"data": {
|
|
95
|
+
"content": "Null value handling"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "title",
|
|
100
|
+
"data": {
|
|
101
|
+
"content": null
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"type": "text",
|
|
106
|
+
"data": {
|
|
107
|
+
"content": "The null title above should not render, demonstrating graceful null handling."
|
|
59
108
|
}
|
|
60
109
|
}
|
|
61
110
|
]
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import type { ComponentRegistry, NavigationRegistry, DiggoConfig } from '@digitalygo/diggocms-sdk-core';
|
|
2
2
|
import {
|
|
3
|
-
ExtendedTitle,
|
|
4
|
-
ExtendedSubtitle,
|
|
5
3
|
ExtendedImage,
|
|
6
|
-
|
|
4
|
+
ExtendedText,
|
|
5
|
+
ExtendedVideo,
|
|
6
|
+
ExtendedGallery,
|
|
7
7
|
ExtendedCard,
|
|
8
8
|
ExtendedMenuItem,
|
|
9
9
|
ExtendedMenuContainer,
|
|
10
10
|
} from '@/components/server-components';
|
|
11
11
|
|
|
12
|
-
export const componentsRegistry
|
|
13
|
-
subtitle: ExtendedSubtitle,
|
|
12
|
+
export const componentsRegistry = {
|
|
14
13
|
image: ExtendedImage,
|
|
15
|
-
|
|
14
|
+
text: ExtendedText,
|
|
15
|
+
video: ExtendedVideo,
|
|
16
|
+
gallery: ExtendedGallery,
|
|
16
17
|
card: ExtendedCard,
|
|
17
|
-
};
|
|
18
|
+
} as ComponentRegistry;
|
|
18
19
|
|
|
19
20
|
export const navigationRegistry: NavigationRegistry = {
|
|
20
21
|
MenuItem: ExtendedMenuItem,
|