@schneiderelli/cms-runtime 0.0.3 → 0.0.4

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 (41) hide show
  1. package/dist/components/BlockRenderer.svelte +106 -71
  2. package/dist/components/BlockRenderer.svelte.d.ts +15 -4
  3. package/dist/components/blocks/AdBlock.svelte +58 -0
  4. package/dist/components/blocks/AdBlock.svelte.d.ts +9 -0
  5. package/dist/components/blocks/AffiliateBlock.svelte +50 -0
  6. package/dist/components/blocks/AffiliateBlock.svelte.d.ts +9 -0
  7. package/dist/components/blocks/BreadcrumbBlock.svelte +30 -0
  8. package/dist/components/blocks/BreadcrumbBlock.svelte.d.ts +9 -0
  9. package/dist/components/blocks/ChildrenBlock.svelte +46 -0
  10. package/dist/components/blocks/ChildrenBlock.svelte.d.ts +9 -0
  11. package/dist/components/blocks/DividerBlock.svelte +9 -0
  12. package/dist/components/blocks/DividerBlock.svelte.d.ts +26 -0
  13. package/dist/components/blocks/FaqBlock.svelte +77 -0
  14. package/dist/components/blocks/FaqBlock.svelte.d.ts +7 -0
  15. package/dist/components/blocks/HeadingBlock.svelte +35 -5
  16. package/dist/components/blocks/HeadingBlock.svelte.d.ts +3 -3
  17. package/dist/components/blocks/HeroBlock.svelte +43 -0
  18. package/dist/components/blocks/HeroBlock.svelte.d.ts +7 -0
  19. package/dist/components/blocks/HowToBlock.svelte +100 -0
  20. package/dist/components/blocks/HowToBlock.svelte.d.ts +7 -0
  21. package/dist/components/blocks/ImageBlock.svelte +42 -3
  22. package/dist/components/blocks/ImageBlock.svelte.d.ts +3 -3
  23. package/dist/components/blocks/LinksBlock.svelte +66 -0
  24. package/dist/components/blocks/LinksBlock.svelte.d.ts +7 -0
  25. package/dist/components/blocks/MarkdownBlock.svelte +118 -0
  26. package/dist/components/blocks/MarkdownBlock.svelte.d.ts +7 -0
  27. package/dist/components/blocks/NoteBlock.svelte +59 -0
  28. package/dist/components/blocks/NoteBlock.svelte.d.ts +7 -0
  29. package/dist/components/blocks/QuoteBlock.svelte +44 -0
  30. package/dist/components/blocks/QuoteBlock.svelte.d.ts +7 -0
  31. package/dist/index.d.ts +16 -1
  32. package/dist/index.js +26 -1
  33. package/dist/registry.d.ts +43 -0
  34. package/dist/registry.js +374 -0
  35. package/dist/types.d.ts +137 -23
  36. package/dist/types.js +30 -1
  37. package/package.json +2 -1
  38. package/dist/components/blocks/TextBlock.svelte +0 -8
  39. package/dist/components/blocks/TextBlock.svelte.d.ts +0 -7
  40. package/dist/resolve.d.ts +0 -15
  41. package/dist/resolve.js +0 -15
@@ -0,0 +1,100 @@
1
+ <script lang="ts">
2
+ import { marked } from 'marked';
3
+ import type { HowToBlock } from '../../types.js';
4
+
5
+ interface Props {
6
+ block: HowToBlock;
7
+ }
8
+
9
+ let { block }: Props = $props();
10
+ </script>
11
+
12
+ <section class="csm-howto">
13
+ {#if block.title}
14
+ <h2 class="csm-howto-title">{block.title}</h2>
15
+ {/if}
16
+
17
+ <ol class="csm-howto-steps">
18
+ {#each block.steps as step, i}
19
+ <li class="csm-howto-step">
20
+ <div class="csm-howto-step-header">
21
+ <span class="csm-howto-step-number">{i + 1}</span>
22
+ <h3 class="csm-howto-step-title">{step.title}</h3>
23
+ </div>
24
+ <div class="csm-howto-step-content">
25
+ {@html marked.parse(step.description)}
26
+ </div>
27
+ </li>
28
+ {/each}
29
+ </ol>
30
+ </section>
31
+
32
+ <style>
33
+ .csm-howto {
34
+ margin: 0;
35
+ }
36
+
37
+ .csm-howto-title {
38
+ font-size: 1.5rem;
39
+ font-weight: 600;
40
+ margin: 0 0 1rem;
41
+ }
42
+
43
+ .csm-howto-steps {
44
+ list-style: none;
45
+ margin: 0;
46
+ padding: 0;
47
+ display: flex;
48
+ flex-direction: column;
49
+ gap: 1rem;
50
+ }
51
+
52
+ .csm-howto-step {
53
+ padding: 1rem 1.25rem;
54
+ background: var(--csm-card-bg, #ffffff);
55
+ border: 1px solid var(--csm-border-color, #e2e8f0);
56
+ border-radius: 0.75rem;
57
+ }
58
+
59
+ .csm-howto-step-header {
60
+ display: flex;
61
+ align-items: center;
62
+ gap: 0.75rem;
63
+ margin-bottom: 0.5rem;
64
+ }
65
+
66
+ .csm-howto-step-number {
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ width: 1.75rem;
71
+ height: 1.75rem;
72
+ background: var(--csm-primary-color, #3b82f6);
73
+ color: white;
74
+ border-radius: 50%;
75
+ font-size: 0.875rem;
76
+ font-weight: 600;
77
+ flex-shrink: 0;
78
+ }
79
+
80
+ .csm-howto-step-title {
81
+ font-size: 1rem;
82
+ font-weight: 600;
83
+ margin: 0;
84
+ }
85
+
86
+ .csm-howto-step-content {
87
+ font-size: 0.9375rem;
88
+ color: var(--csm-muted-color, #64748b);
89
+ line-height: 1.6;
90
+ padding-left: 2.5rem;
91
+ }
92
+
93
+ .csm-howto-step-content :global(p) {
94
+ margin: 0 0 0.5rem;
95
+ }
96
+
97
+ .csm-howto-step-content :global(p:last-child) {
98
+ margin-bottom: 0;
99
+ }
100
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { HowToBlock } from '../../types.ts';
2
+ interface Props {
3
+ block: HowToBlock;
4
+ }
5
+ declare const HowToBlock: import("svelte").Component<Props, {}, "">;
6
+ type HowToBlock = ReturnType<typeof HowToBlock>;
7
+ export default HowToBlock;
@@ -1,6 +1,45 @@
1
1
  <script lang="ts">
2
- import type { ImageBlock } from '../../types.js';
3
- let { block } = $props<{ block: ImageBlock }>();
2
+ import type { ImageBlock } from '../../types.js';
3
+
4
+ interface Props {
5
+ block: ImageBlock;
6
+ }
7
+
8
+ let { block }: Props = $props();
4
9
  </script>
5
10
 
6
- <img src={block.src} alt={block.alt ?? ''} class="my-4 rounded-lg shadow-md" />
11
+ <figure class="csm-image">
12
+ <img
13
+ src={block.src}
14
+ alt={block.alt ?? ''}
15
+ class="csm-image-img"
16
+ loading="lazy"
17
+ />
18
+ {#if block.caption}
19
+ <figcaption class="csm-image-caption">
20
+ {block.caption}
21
+ </figcaption>
22
+ {/if}
23
+ </figure>
24
+
25
+ <style>
26
+ .csm-image {
27
+ margin: 0;
28
+ }
29
+
30
+ .csm-image-img {
31
+ width: 100%;
32
+ max-width: 100%;
33
+ height: auto;
34
+ border-radius: 0.5rem;
35
+ border: 1px solid var(--csm-border-color, #e2e8f0);
36
+ }
37
+
38
+ .csm-image-caption {
39
+ margin-top: 0.5rem;
40
+ text-align: center;
41
+ font-size: 0.875rem;
42
+ color: var(--csm-muted-color, #64748b);
43
+ font-style: italic;
44
+ }
45
+ </style>
@@ -1,7 +1,7 @@
1
1
  import type { ImageBlock } from '../../types.ts';
2
- type $$ComponentProps = {
2
+ interface Props {
3
3
  block: ImageBlock;
4
- };
5
- declare const ImageBlock: import("svelte").Component<$$ComponentProps, {}, "">;
4
+ }
5
+ declare const ImageBlock: import("svelte").Component<Props, {}, "">;
6
6
  type ImageBlock = ReturnType<typeof ImageBlock>;
7
7
  export default ImageBlock;
@@ -0,0 +1,66 @@
1
+ <script lang="ts">
2
+ import type { LinksBlock } from '../../types.js';
3
+
4
+ interface Props {
5
+ block: LinksBlock;
6
+ }
7
+
8
+ let { block }: Props = $props();
9
+ </script>
10
+
11
+ <section class="csm-links">
12
+ {#if block.title}
13
+ <h2 class="csm-links-title">{block.title}</h2>
14
+ {/if}
15
+
16
+ <ul class="csm-links-list">
17
+ {#each block.items as item}
18
+ <li>
19
+ <a href={item.href} class="csm-link-item">
20
+ {#if item.icon}
21
+ <span class="csm-link-icon">{item.icon}</span>
22
+ {/if}
23
+ <span class="csm-link-label">{item.label}</span>
24
+ </a>
25
+ </li>
26
+ {/each}
27
+ </ul>
28
+ </section>
29
+
30
+ <style>
31
+ .csm-links {
32
+ margin: 0;
33
+ }
34
+
35
+ .csm-links-title {
36
+ font-size: 1.25rem;
37
+ font-weight: 600;
38
+ margin: 0 0 0.75rem;
39
+ }
40
+
41
+ .csm-links-list {
42
+ list-style: none;
43
+ margin: 0;
44
+ padding: 0;
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: 0.5rem;
48
+ }
49
+
50
+ .csm-link-item {
51
+ display: inline-flex;
52
+ align-items: center;
53
+ gap: 0.5rem;
54
+ color: var(--csm-link-color, #3b82f6);
55
+ text-decoration: none;
56
+ font-size: 0.9375rem;
57
+ }
58
+
59
+ .csm-link-item:hover {
60
+ text-decoration: underline;
61
+ }
62
+
63
+ .csm-link-icon {
64
+ font-size: 1.125rem;
65
+ }
66
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { LinksBlock } from '../../types.ts';
2
+ interface Props {
3
+ block: LinksBlock;
4
+ }
5
+ declare const LinksBlock: import("svelte").Component<Props, {}, "">;
6
+ type LinksBlock = ReturnType<typeof LinksBlock>;
7
+ export default LinksBlock;
@@ -0,0 +1,118 @@
1
+ <script lang="ts">
2
+ import { marked } from 'marked';
3
+ import type { MarkdownBlock } from '../../types.js';
4
+
5
+ interface Props {
6
+ block: MarkdownBlock;
7
+ }
8
+
9
+ let { block }: Props = $props();
10
+
11
+ // Configure marked
12
+ marked.setOptions({
13
+ gfm: true,
14
+ breaks: false
15
+ });
16
+
17
+ const html = $derived(marked.parse(block.content) as string);
18
+ </script>
19
+
20
+ <div class="csm-markdown">
21
+ {@html html}
22
+ </div>
23
+
24
+ <style>
25
+ .csm-markdown {
26
+ line-height: 1.7;
27
+ }
28
+
29
+ .csm-markdown :global(h1),
30
+ .csm-markdown :global(h2),
31
+ .csm-markdown :global(h3),
32
+ .csm-markdown :global(h4),
33
+ .csm-markdown :global(h5),
34
+ .csm-markdown :global(h6) {
35
+ margin: 1.5rem 0 0.75rem;
36
+ line-height: 1.3;
37
+ }
38
+
39
+ .csm-markdown :global(h1) { font-size: 1.875rem; font-weight: 700; }
40
+ .csm-markdown :global(h2) { font-size: 1.5rem; font-weight: 600; }
41
+ .csm-markdown :global(h3) { font-size: 1.25rem; font-weight: 600; }
42
+
43
+ .csm-markdown :global(p) {
44
+ margin: 0 0 1rem;
45
+ }
46
+
47
+ .csm-markdown :global(ul),
48
+ .csm-markdown :global(ol) {
49
+ margin: 0 0 1rem;
50
+ padding-left: 1.5rem;
51
+ }
52
+
53
+ .csm-markdown :global(li) {
54
+ margin-bottom: 0.5rem;
55
+ }
56
+
57
+ .csm-markdown :global(strong) {
58
+ font-weight: 600;
59
+ }
60
+
61
+ .csm-markdown :global(a) {
62
+ color: var(--csm-link-color, #3b82f6);
63
+ text-decoration: underline;
64
+ }
65
+
66
+ .csm-markdown :global(blockquote) {
67
+ margin: 1rem 0;
68
+ padding: 1rem 1.25rem;
69
+ border-left: 4px solid var(--csm-border-color, #e2e8f0);
70
+ background: var(--csm-muted-bg, #f8fafc);
71
+ border-radius: 0 0.5rem 0.5rem 0;
72
+ }
73
+
74
+ .csm-markdown :global(code) {
75
+ background: var(--csm-muted-bg, #f1f5f9);
76
+ padding: 0.125rem 0.375rem;
77
+ border-radius: 0.25rem;
78
+ font-size: 0.875em;
79
+ font-family: ui-monospace, monospace;
80
+ }
81
+
82
+ .csm-markdown :global(pre) {
83
+ background: var(--csm-muted-bg, #f1f5f9);
84
+ padding: 1rem;
85
+ border-radius: 0.5rem;
86
+ overflow-x: auto;
87
+ margin: 1rem 0;
88
+ }
89
+
90
+ .csm-markdown :global(pre code) {
91
+ background: none;
92
+ padding: 0;
93
+ }
94
+
95
+ .csm-markdown :global(table) {
96
+ width: 100%;
97
+ border-collapse: collapse;
98
+ margin: 1rem 0;
99
+ }
100
+
101
+ .csm-markdown :global(th),
102
+ .csm-markdown :global(td) {
103
+ padding: 0.75rem;
104
+ border: 1px solid var(--csm-border-color, #e2e8f0);
105
+ text-align: left;
106
+ }
107
+
108
+ .csm-markdown :global(th) {
109
+ background: var(--csm-muted-bg, #f8fafc);
110
+ font-weight: 600;
111
+ }
112
+
113
+ .csm-markdown :global(hr) {
114
+ border: none;
115
+ border-top: 1px solid var(--csm-border-color, #e2e8f0);
116
+ margin: 1.5rem 0;
117
+ }
118
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { MarkdownBlock } from '../../types.ts';
2
+ interface Props {
3
+ block: MarkdownBlock;
4
+ }
5
+ declare const MarkdownBlock: import("svelte").Component<Props, {}, "">;
6
+ type MarkdownBlock = ReturnType<typeof MarkdownBlock>;
7
+ export default MarkdownBlock;
@@ -0,0 +1,59 @@
1
+ <script lang="ts">
2
+ import { marked } from 'marked';
3
+ import type { NoteBlock } from '../../types.js';
4
+
5
+ interface Props {
6
+ block: NoteBlock;
7
+ }
8
+
9
+ let { block }: Props = $props();
10
+
11
+ const html = $derived(marked.parseInline(block.content) as string);
12
+ </script>
13
+
14
+ <div class="csm-note csm-note-{block.variant}">
15
+ {@html html}
16
+ </div>
17
+
18
+ <style>
19
+ .csm-note {
20
+ padding: 1rem 1.25rem;
21
+ border-radius: 0 0.5rem 0.5rem 0;
22
+ font-size: 0.9375rem;
23
+ line-height: 1.6;
24
+ border-left: 4px solid;
25
+ }
26
+
27
+ .csm-note-info {
28
+ background: #eff6ff;
29
+ border-left-color: #3b82f6;
30
+ color: #1e40af;
31
+ }
32
+
33
+ .csm-note-warning {
34
+ background: #fffbeb;
35
+ border-left-color: #f59e0b;
36
+ color: #92400e;
37
+ }
38
+
39
+ .csm-note-tip {
40
+ background: #f0fdf4;
41
+ border-left-color: #22c55e;
42
+ color: #166534;
43
+ }
44
+
45
+ .csm-note-danger {
46
+ background: #fef2f2;
47
+ border-left-color: #ef4444;
48
+ color: #991b1b;
49
+ }
50
+
51
+ .csm-note :global(a) {
52
+ color: inherit;
53
+ text-decoration: underline;
54
+ }
55
+
56
+ .csm-note :global(strong) {
57
+ font-weight: 600;
58
+ }
59
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { NoteBlock } from '../../types.ts';
2
+ interface Props {
3
+ block: NoteBlock;
4
+ }
5
+ declare const NoteBlock: import("svelte").Component<Props, {}, "">;
6
+ type NoteBlock = ReturnType<typeof NoteBlock>;
7
+ export default NoteBlock;
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ import { marked } from 'marked';
3
+ import type { QuoteBlock } from '../../types.js';
4
+
5
+ interface Props {
6
+ block: QuoteBlock;
7
+ }
8
+
9
+ let { block }: Props = $props();
10
+
11
+ const html = $derived(marked.parseInline(block.content) as string);
12
+ </script>
13
+
14
+ <blockquote class="csm-quote">
15
+ <div class="csm-quote-content">
16
+ {@html html}
17
+ </div>
18
+ {#if block.source}
19
+ <cite class="csm-quote-source">— {block.source}</cite>
20
+ {/if}
21
+ </blockquote>
22
+
23
+ <style>
24
+ .csm-quote {
25
+ margin: 0;
26
+ padding: 1rem 1.25rem;
27
+ background: var(--csm-muted-bg, #f8fafc);
28
+ border-left: 4px solid var(--csm-border-color, #94a3b8);
29
+ border-radius: 0 0.5rem 0.5rem 0;
30
+ }
31
+
32
+ .csm-quote-content {
33
+ font-style: italic;
34
+ line-height: 1.6;
35
+ }
36
+
37
+ .csm-quote-source {
38
+ display: block;
39
+ margin-top: 0.75rem;
40
+ font-size: 0.875rem;
41
+ font-style: normal;
42
+ color: var(--csm-muted-color, #64748b);
43
+ }
44
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { QuoteBlock } from '../../types.ts';
2
+ interface Props {
3
+ block: QuoteBlock;
4
+ }
5
+ declare const QuoteBlock: import("svelte").Component<Props, {}, "">;
6
+ type QuoteBlock = ReturnType<typeof QuoteBlock>;
7
+ export default QuoteBlock;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,17 @@
1
- export * from './types';
1
+ export * from './types.ts';
2
+ export * from './registry.ts';
2
3
  export { default as BlockRenderer } from './components/BlockRenderer.svelte';
4
+ export { default as MarkdownBlock } from './components/blocks/MarkdownBlock.svelte';
5
+ export { default as HeadingBlock } from './components/blocks/HeadingBlock.svelte';
6
+ export { default as ImageBlock } from './components/blocks/ImageBlock.svelte';
7
+ export { default as QuoteBlock } from './components/blocks/QuoteBlock.svelte';
8
+ export { default as DividerBlock } from './components/blocks/DividerBlock.svelte';
9
+ export { default as NoteBlock } from './components/blocks/NoteBlock.svelte';
10
+ export { default as FaqBlock } from './components/blocks/FaqBlock.svelte';
11
+ export { default as HowToBlock } from './components/blocks/HowToBlock.svelte';
12
+ export { default as HeroBlock } from './components/blocks/HeroBlock.svelte';
13
+ export { default as ChildrenBlock } from './components/blocks/ChildrenBlock.svelte';
14
+ export { default as LinksBlock } from './components/blocks/LinksBlock.svelte';
15
+ export { default as BreadcrumbBlock } from './components/blocks/BreadcrumbBlock.svelte';
16
+ export { default as AffiliateBlock } from './components/blocks/AffiliateBlock.svelte';
17
+ export { default as AdBlock } from './components/blocks/AdBlock.svelte';
package/dist/index.js CHANGED
@@ -1,2 +1,27 @@
1
- export * from './types';
1
+ // =============================================================================
2
+ // CSM-RUNTIME
3
+ // =============================================================================
4
+ // Content System Manager Runtime
5
+ // Zentrale Library für Types und Komponenten
6
+ // =============================================================================
7
+ // Types
8
+ export * from "./types.js";
9
+ // Registry (Block-Definitionen für Editor)
10
+ export * from "./registry.js";
11
+ // Components
2
12
  export { default as BlockRenderer } from './components/BlockRenderer.svelte';
13
+ // Individual Block Components (für Custom Rendering)
14
+ export { default as MarkdownBlock } from './components/blocks/MarkdownBlock.svelte';
15
+ export { default as HeadingBlock } from './components/blocks/HeadingBlock.svelte';
16
+ export { default as ImageBlock } from './components/blocks/ImageBlock.svelte';
17
+ export { default as QuoteBlock } from './components/blocks/QuoteBlock.svelte';
18
+ export { default as DividerBlock } from './components/blocks/DividerBlock.svelte';
19
+ export { default as NoteBlock } from './components/blocks/NoteBlock.svelte';
20
+ export { default as FaqBlock } from './components/blocks/FaqBlock.svelte';
21
+ export { default as HowToBlock } from './components/blocks/HowToBlock.svelte';
22
+ export { default as HeroBlock } from './components/blocks/HeroBlock.svelte';
23
+ export { default as ChildrenBlock } from './components/blocks/ChildrenBlock.svelte';
24
+ export { default as LinksBlock } from './components/blocks/LinksBlock.svelte';
25
+ export { default as BreadcrumbBlock } from './components/blocks/BreadcrumbBlock.svelte';
26
+ export { default as AffiliateBlock } from './components/blocks/AffiliateBlock.svelte';
27
+ export { default as AdBlock } from './components/blocks/AdBlock.svelte';
@@ -0,0 +1,43 @@
1
+ import type { BlockType, Block } from './types.ts';
2
+ export interface BlockDefinition {
3
+ /** Block-Typ */
4
+ type: BlockType;
5
+ /** Anzeigename im Editor */
6
+ label: string;
7
+ /** Icon (Emoji) */
8
+ icon: string;
9
+ /** Kurzbeschreibung */
10
+ description: string;
11
+ /** Kategorie für Gruppierung im Editor */
12
+ category: 'content' | 'layout' | 'media' | 'monetization';
13
+ /** Default-Werte beim Erstellen */
14
+ defaults: Partial<Block>;
15
+ /** Felder die im Editor bearbeitet werden können */
16
+ fields: FieldDefinition[];
17
+ }
18
+ export interface FieldDefinition {
19
+ /** Feld-Name (Property-Key) */
20
+ name: string;
21
+ /** Anzeigename */
22
+ label: string;
23
+ /** Feld-Typ */
24
+ type: 'text' | 'textarea' | 'markdown' | 'number' | 'select' | 'image' | 'list';
25
+ /** Pflichtfeld? */
26
+ required?: boolean;
27
+ /** Placeholder-Text */
28
+ placeholder?: string;
29
+ /** Optionen für Select */
30
+ options?: {
31
+ value: string;
32
+ label: string;
33
+ }[];
34
+ /** Für Listen: Definition der Einträge */
35
+ listFields?: FieldDefinition[];
36
+ }
37
+ export declare const blockRegistry: BlockDefinition[];
38
+ /** Holt Block-Definition by Type */
39
+ export declare function getBlockDefinition(type: BlockType): BlockDefinition | undefined;
40
+ /** Gruppiert Blocks nach Kategorie */
41
+ export declare function getBlocksByCategory(): Record<string, BlockDefinition[]>;
42
+ /** Erstellt einen neuen Block mit Default-Werten */
43
+ export declare function createBlockFromDefinition(type: BlockType): Block | undefined;