@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.
Files changed (28) hide show
  1. package/README.md +4 -4
  2. package/package.json +5 -2
  3. package/templates/full/README.md +11 -7
  4. package/templates/full/app/globals.css +58 -7
  5. package/templates/full/components/ExtendedCard.tsx +17 -5
  6. package/templates/full/components/ExtendedGallery.tsx +43 -0
  7. package/templates/full/components/ExtendedText.tsx +16 -0
  8. package/templates/full/components/ExtendedVideo.tsx +27 -0
  9. package/templates/full/components/server-components.ts +3 -3
  10. package/templates/full/lib/diggo-config.ts +8 -7
  11. package/templates/full/tsconfig.tsbuildinfo +1 -0
  12. package/templates/with-mock/README.md +9 -6
  13. package/templates/with-mock/app/globals.css +58 -7
  14. package/templates/with-mock/components/ExtendedCard.tsx +17 -5
  15. package/templates/with-mock/components/ExtendedGallery.tsx +43 -0
  16. package/templates/with-mock/components/ExtendedText.tsx +16 -0
  17. package/templates/with-mock/components/ExtendedVideo.tsx +27 -0
  18. package/templates/with-mock/components/server-components.ts +3 -3
  19. package/templates/with-mock/fixtures/collection.json +59 -18
  20. package/templates/with-mock/fixtures/pages/chi-siamo.json +9 -8
  21. package/templates/with-mock/fixtures/pages/contatti.json +10 -7
  22. package/templates/with-mock/fixtures/pages/home.json +71 -22
  23. package/templates/with-mock/lib/diggo-config.ts +8 -7
  24. package/templates/with-mock/tsconfig.tsbuildinfo +1 -0
  25. package/templates/full/components/ExtendedRichtext.tsx +0 -15
  26. package/templates/full/components/ExtendedSubtitle.tsx +0 -10
  27. package/templates/with-mock/components/ExtendedRichtext.tsx +0 -15
  28. 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 { ExtendedRichtext } from './ExtendedRichtext';
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": "Getting Started with DiggoCMS",
7
- "excerpt": "Learn how to set up your first DiggoCMS project",
8
- "image": "https://via.placeholder.com/400x200/3b82f6/ffffff?text=Getting+Started"
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": "Building Custom Components",
13
- "excerpt": "Create your own components for the SDK",
14
- "image": "https://via.placeholder.com/400x200/10b981/ffffff?text=Custom+Components"
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": "Working with Mock Data",
19
- "excerpt": "Develop without a backend using our mock API",
20
- "image": "https://via.placeholder.com/400x200/f59e0b/ffffff?text=Mock+Data"
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
- "pagination": {
24
- "page": 1,
25
- "totalPages": 1,
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": "subtitle",
13
+ "type": "text",
14
14
  "data": {
15
- "content": "About Our Company"
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": "richtext",
19
+ "type": "text",
20
20
  "data": {
21
- "content": "<p>We are a team of passionate developers building the next generation of headless CMS tools. DiggoCMS provides a flexible, developer-friendly platform for content management.</p>"
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": "subtitle",
25
+ "type": "text",
26
26
  "data": {
27
- "content": "Our Mission"
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": "richtext",
31
+ "type": "image",
32
32
  "data": {
33
- "content": "<p>To simplify content management for developers while providing powerful features for content editors.</p>"
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": "subtitle",
13
+ "type": "text",
14
14
  "data": {
15
- "content": "Get in Touch"
15
+ "content": "Contacts siamo qui per aiutarti con domande, collaborazioni e richieste di supporto."
16
16
  }
17
17
  },
18
18
  {
19
- "type": "richtext",
19
+ "type": "text",
20
20
  "data": {
21
- "content": "<p>Have questions? We'd love to hear from you.</p><p><strong>Email:</strong> hello@example.com<br><strong>Phone:</strong> +1 234 567 890</p>"
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": "Office Location",
28
- "subtitle": "Headquarters",
29
- "content": "<p>123 Developer Street<br>Tech City, TC 12345<br>United States</p>"
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": "home",
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": "Welcome to DiggoCMS"
9
+ "content": "Benvenuto su DiggoCMS Demo"
10
10
  }
11
11
  },
12
12
  {
13
- "type": "subtitle",
13
+ "type": "text",
14
14
  "data": {
15
- "content": "Your headless CMS powered by React & Next.js"
15
+ "content": "A demonstration of the SDK rendering capabilities built around the current component model."
16
16
  }
17
17
  },
18
18
  {
19
- "type": "richtext",
19
+ "type": "text",
20
20
  "data": {
21
- "content": "<p>This is a sample page rendered from a <strong>mock API</strong>. All content comes from JSON fixtures in the <code>fixtures/</code> directory.</p><p>The DiggoCMS SDK automatically renders components based on the page payload.</p>"
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://via.placeholder.com/800x400/3b82f6/ffffff?text=DiggoCMS+Mock",
28
- "alt": "DiggoCMS Mock Placeholder"
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": "subtitle",
32
+ "type": "text",
33
33
  "data": {
34
- "content": "Features"
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": "card",
38
+ "type": "video",
39
39
  "data": {
40
- "title": "Dynamic Routing",
41
- "subtitle": "Built on Next.js App Router",
42
- "content": "<p>Pages are rendered dynamically using the [...slug] catch-all route pattern. Each page is fetched from the CMS API.</p>"
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": "card",
46
+ "type": "gallery",
47
47
  "data": {
48
- "title": "Component System",
49
- "subtitle": "Extensible & Type-Safe",
50
- "content": "<p>Components are registered in a type-safe registry. Extend base components or create your own custom ones.</p>"
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
- "title": "Mock API",
57
- "subtitle": "Develop Without a Backend",
58
- "content": "<p>The included mock server lets you develop your frontend without needing a real CMS API running.</p>"
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
- ExtendedRichtext,
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: ComponentRegistry = {
13
- subtitle: ExtendedSubtitle,
12
+ export const componentsRegistry = {
14
13
  image: ExtendedImage,
15
- richtext: ExtendedRichtext,
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,