@schneiderelli/cms-runtime 0.0.4 → 0.0.6

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.
@@ -9,17 +9,17 @@
9
9
  </script>
10
10
 
11
11
  {#if block.level === 1}
12
- <h1 class="csm-heading csm-h1">{block.text}</h1>
12
+ <h1 class="csm-heading csm-h1" style:color={block.color || undefined}>{block.text}</h1>
13
13
  {:else if block.level === 2}
14
- <h2 class="csm-heading csm-h2">{block.text}</h2>
14
+ <h2 class="csm-heading csm-h2" style:color={block.color || undefined}>{block.text}</h2>
15
15
  {:else if block.level === 3}
16
- <h3 class="csm-heading csm-h3">{block.text}</h3>
16
+ <h3 class="csm-heading csm-h3" style:color={block.color || undefined}>{block.text}</h3>
17
17
  {:else if block.level === 4}
18
- <h4 class="csm-heading csm-h4">{block.text}</h4>
18
+ <h4 class="csm-heading csm-h4" style:color={block.color || undefined}>{block.text}</h4>
19
19
  {:else if block.level === 5}
20
- <h5 class="csm-heading csm-h5">{block.text}</h5>
20
+ <h5 class="csm-heading csm-h5" style:color={block.color || undefined}>{block.text}</h5>
21
21
  {:else}
22
- <h6 class="csm-heading csm-h6">{block.text}</h6>
22
+ <h6 class="csm-heading csm-h6" style:color={block.color || undefined}>{block.text}</h6>
23
23
  {/if}
24
24
 
25
25
  <style>
@@ -7,7 +7,11 @@
7
7
  let { block }: Props = $props();
8
8
  </script>
9
9
 
10
- <header class="csm-hero">
10
+ <header
11
+ class="csm-hero"
12
+ style:background-color={block.backgroundColor || undefined}
13
+ style:color={block.textColor || undefined}
14
+ >
11
15
  <h1 class="csm-hero-title">{block.title}</h1>
12
16
  {#if block.subtitle}
13
17
  <p class="csm-hero-subtitle">{block.subtitle}</p>
@@ -11,7 +11,11 @@
11
11
  const html = $derived(marked.parseInline(block.content) as string);
12
12
  </script>
13
13
 
14
- <div class="csm-note csm-note-{block.variant}">
14
+ <div
15
+ class="csm-note csm-note-{block.variant}"
16
+ style:background-color={block.backgroundColor || undefined}
17
+ style:color={block.textColor || undefined}
18
+ >
15
19
  {@html html}
16
20
  </div>
17
21
 
package/dist/types.d.ts CHANGED
@@ -17,12 +17,56 @@ export interface Page {
17
17
  showInNav?: boolean;
18
18
  /** Kurzname für Navigation */
19
19
  navTitle?: string;
20
+ /** Layout-ID (optional) */
21
+ layoutId?: string;
20
22
  /** Die Inhalte */
21
23
  blocks: Block[];
22
24
  /** Metadata */
23
25
  createdAt?: string;
24
26
  updatedAt?: string;
25
27
  }
28
+ /** Layout Region Key - Vordefinierte Bereiche */
29
+ export type LayoutRegionKey = 'header' | 'sidebar' | 'content' | 'aside' | 'footer';
30
+ /** Layout Region - Ein Bereich im Layout */
31
+ export interface LayoutRegion {
32
+ /** Region-Name */
33
+ name: string;
34
+ /** Grid-Area Name für CSS Grid */
35
+ gridArea: LayoutRegionKey;
36
+ /** Blöcke in dieser Region (nur für header/sidebar/footer) */
37
+ blocks: Block[];
38
+ /** Sticky Position? */
39
+ sticky?: boolean;
40
+ }
41
+ /** Grid Konfiguration für Layout */
42
+ export interface LayoutGridConfig {
43
+ /** CSS Grid template-areas */
44
+ areas: string;
45
+ /** CSS Grid template-columns */
46
+ columns: string;
47
+ /** CSS Grid template-rows */
48
+ rows: string;
49
+ /** Gap zwischen Grid-Items */
50
+ gap?: string;
51
+ }
52
+ /** Layout - Template für mehrere Seiten */
53
+ export interface Layout {
54
+ /** Eindeutige ID */
55
+ id: string;
56
+ /** Layout-Name */
57
+ name: string;
58
+ /** Beschreibung */
59
+ description?: string;
60
+ /** Grid-Konfiguration */
61
+ grid: LayoutGridConfig;
62
+ /** Regionen */
63
+ regions: {
64
+ [K in LayoutRegionKey]?: LayoutRegion;
65
+ };
66
+ /** Metadata */
67
+ createdAt?: string;
68
+ updatedAt?: string;
69
+ }
26
70
  export interface BaseBlock {
27
71
  /** Eindeutige Block-ID */
28
72
  id: string;
@@ -42,6 +86,8 @@ export interface HeadingBlock extends BaseBlock {
42
86
  text: string;
43
87
  /** Level: 1-6 */
44
88
  level: 1 | 2 | 3 | 4 | 5 | 6;
89
+ /** Textfarbe (optional) */
90
+ color?: string;
45
91
  }
46
92
  /** Image Block */
47
93
  export interface ImageBlock extends BaseBlock {
@@ -72,6 +118,10 @@ export interface NoteBlock extends BaseBlock {
72
118
  content: string;
73
119
  /** Variante */
74
120
  variant: 'info' | 'warning' | 'tip' | 'danger';
121
+ /** Hintergrundfarbe (optional, überschreibt variant) */
122
+ backgroundColor?: string;
123
+ /** Textfarbe (optional) */
124
+ textColor?: string;
75
125
  }
76
126
  /** FAQ Block */
77
127
  export interface FaqBlock extends BaseBlock {
@@ -108,6 +158,10 @@ export interface HeroBlock extends BaseBlock {
108
158
  title: string;
109
159
  /** Untertitel */
110
160
  subtitle?: string;
161
+ /** Hintergrundfarbe (optional) */
162
+ backgroundColor?: string;
163
+ /** Textfarbe (optional) */
164
+ textColor?: string;
111
165
  }
112
166
  /** Children Block - Zeigt Kind-Seiten */
113
167
  export interface ChildrenBlock extends BaseBlock {
@@ -153,9 +207,81 @@ export interface AdBlock extends BaseBlock {
153
207
  /** Darstellung */
154
208
  variant?: 'inline' | 'banner' | 'sidebar';
155
209
  }
156
- export type Block = MarkdownBlock | HeadingBlock | ImageBlock | QuoteBlock | DividerBlock | NoteBlock | FaqBlock | HowToBlock | HeroBlock | ChildrenBlock | LinksBlock | BreadcrumbBlock | AffiliateBlock | AdBlock;
210
+ /** Container Block - Grid/Flex Container für Layout */
211
+ export interface ContainerBlock extends BaseBlock {
212
+ type: 'container';
213
+ /** Blöcke im Container */
214
+ blocks: Block[];
215
+ /** Layout-Typ */
216
+ layout: 'grid' | 'flex' | 'stack';
217
+ /** Grid-Konfiguration (nur bei layout: 'grid') */
218
+ grid?: {
219
+ columns?: string;
220
+ rows?: string;
221
+ gap?: string;
222
+ };
223
+ /** Flex-Konfiguration (nur bei layout: 'flex') */
224
+ flex?: {
225
+ direction?: 'row' | 'column';
226
+ wrap?: boolean;
227
+ gap?: string;
228
+ align?: 'start' | 'center' | 'end' | 'stretch';
229
+ justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';
230
+ };
231
+ /** Stack-Konfiguration (nur bei layout: 'stack') */
232
+ stack?: {
233
+ gap?: string;
234
+ align?: 'start' | 'center' | 'end' | 'stretch';
235
+ };
236
+ }
237
+ /** Logo Block - Für Header/Branding */
238
+ export interface LogoBlock extends BaseBlock {
239
+ type: 'logo';
240
+ /** Logo-Bild URL */
241
+ src?: string;
242
+ /** Text/Name (wenn kein Bild) */
243
+ text?: string;
244
+ /** Alt-Text */
245
+ alt?: string;
246
+ /** Link-Ziel */
247
+ href?: string;
248
+ }
249
+ /** Navigation Block - Menü */
250
+ export interface NavigationBlock extends BaseBlock {
251
+ type: 'navigation';
252
+ /** Navigations-Items */
253
+ items: NavItem[];
254
+ /** Darstellung */
255
+ variant?: 'horizontal' | 'vertical' | 'dropdown';
256
+ /** Zeige Icons? */
257
+ showIcons?: boolean;
258
+ }
259
+ export interface NavItem {
260
+ /** Label */
261
+ label: string;
262
+ /** Link */
263
+ href: string;
264
+ /** Icon (Emoji) */
265
+ icon?: string;
266
+ /** Kinder (für Dropdown) */
267
+ children?: NavItem[];
268
+ }
269
+ /** Search Block - Suchleiste */
270
+ export interface SearchBlock extends BaseBlock {
271
+ type: 'search';
272
+ /** Placeholder-Text */
273
+ placeholder?: string;
274
+ /** Action URL */
275
+ action?: string;
276
+ }
277
+ export type Block = MarkdownBlock | HeadingBlock | ImageBlock | QuoteBlock | DividerBlock | NoteBlock | FaqBlock | HowToBlock | HeroBlock | ChildrenBlock | LinksBlock | BreadcrumbBlock | AffiliateBlock | AdBlock | ContainerBlock | LogoBlock | NavigationBlock | SearchBlock;
157
278
  export type BlockType = Block['type'];
158
279
  export declare function createBlock<T extends Block>(type: T['type'], data: Omit<T, 'id' | 'type'>): T;
159
280
  export declare function createPage(data: Omit<Page, 'id' | 'blocks' | 'createdAt' | 'updatedAt'> & {
160
281
  blocks?: Block[];
161
282
  }): Page;
283
+ export declare function createLayout(data: Omit<Layout, 'id' | 'createdAt' | 'updatedAt'>): Layout;
284
+ export declare function createSimpleLayout(): Layout;
285
+ export declare function createTwoColumnLayout(): Layout;
286
+ export declare function createThreeColumnLayout(): Layout;
287
+ export declare function createFullWidthLayout(): Layout;
package/dist/types.js CHANGED
@@ -28,3 +28,152 @@ export function createPage(data) {
28
28
  ...data
29
29
  };
30
30
  }
31
+ // -----------------------------------------------------------------------------
32
+ // HELPER: Layout erstellen
33
+ // -----------------------------------------------------------------------------
34
+ let layoutIdCounter = 0;
35
+ export function createLayout(data) {
36
+ const now = new Date().toISOString();
37
+ return {
38
+ id: `layout-${Date.now()}-${++layoutIdCounter}`,
39
+ createdAt: now,
40
+ updatedAt: now,
41
+ ...data
42
+ };
43
+ }
44
+ // -----------------------------------------------------------------------------
45
+ // LAYOUT PRESETS - Vordefinierte Layouts
46
+ // -----------------------------------------------------------------------------
47
+ export function createSimpleLayout() {
48
+ return createLayout({
49
+ name: 'Einfaches Layout',
50
+ description: 'Header + Content',
51
+ grid: {
52
+ areas: `
53
+ "header"
54
+ "content"
55
+ `,
56
+ columns: '1fr',
57
+ rows: 'auto 1fr',
58
+ gap: '0'
59
+ },
60
+ regions: {
61
+ header: {
62
+ name: 'Header',
63
+ gridArea: 'header',
64
+ blocks: [],
65
+ sticky: true
66
+ },
67
+ content: {
68
+ name: 'Hauptinhalt',
69
+ gridArea: 'content',
70
+ blocks: []
71
+ }
72
+ }
73
+ });
74
+ }
75
+ export function createTwoColumnLayout() {
76
+ return createLayout({
77
+ name: '2-Spalten Layout',
78
+ description: 'Header + Sidebar + Content',
79
+ grid: {
80
+ areas: `
81
+ "header header"
82
+ "sidebar content"
83
+ `,
84
+ columns: '280px 1fr',
85
+ rows: 'auto 1fr',
86
+ gap: '0'
87
+ },
88
+ regions: {
89
+ header: {
90
+ name: 'Header',
91
+ gridArea: 'header',
92
+ blocks: [],
93
+ sticky: true
94
+ },
95
+ sidebar: {
96
+ name: 'Sidebar',
97
+ gridArea: 'sidebar',
98
+ blocks: []
99
+ },
100
+ content: {
101
+ name: 'Hauptinhalt',
102
+ gridArea: 'content',
103
+ blocks: []
104
+ }
105
+ }
106
+ });
107
+ }
108
+ export function createThreeColumnLayout() {
109
+ return createLayout({
110
+ name: '3-Spalten Layout',
111
+ description: 'Header + Sidebar + Content + Aside',
112
+ grid: {
113
+ areas: `
114
+ "header header header"
115
+ "sidebar content aside"
116
+ `,
117
+ columns: '280px 1fr 300px',
118
+ rows: 'auto 1fr',
119
+ gap: '0'
120
+ },
121
+ regions: {
122
+ header: {
123
+ name: 'Header',
124
+ gridArea: 'header',
125
+ blocks: [],
126
+ sticky: true
127
+ },
128
+ sidebar: {
129
+ name: 'Linke Sidebar',
130
+ gridArea: 'sidebar',
131
+ blocks: []
132
+ },
133
+ content: {
134
+ name: 'Hauptinhalt',
135
+ gridArea: 'content',
136
+ blocks: []
137
+ },
138
+ aside: {
139
+ name: 'Rechte Sidebar',
140
+ gridArea: 'aside',
141
+ blocks: []
142
+ }
143
+ }
144
+ });
145
+ }
146
+ export function createFullWidthLayout() {
147
+ return createLayout({
148
+ name: 'Full-Width Layout',
149
+ description: 'Header + Content + Footer',
150
+ grid: {
151
+ areas: `
152
+ "header"
153
+ "content"
154
+ "footer"
155
+ `,
156
+ columns: '1fr',
157
+ rows: 'auto 1fr auto',
158
+ gap: '0'
159
+ },
160
+ regions: {
161
+ header: {
162
+ name: 'Header',
163
+ gridArea: 'header',
164
+ blocks: [],
165
+ sticky: true
166
+ },
167
+ content: {
168
+ name: 'Hauptinhalt',
169
+ gridArea: 'content',
170
+ blocks: []
171
+ },
172
+ footer: {
173
+ name: 'Footer',
174
+ gridArea: 'footer',
175
+ blocks: []
176
+ }
177
+ }
178
+ });
179
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schneiderelli/cms-runtime",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Content System Manager Runtime - Shared types and components for CMS editor and website framework",
5
5
  "scripts": {
6
6
  "dev": "vite dev",