@schneiderelli/cms-runtime 0.0.4 → 0.0.5
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/dist/types.d.ts +117 -1
- package/dist/types.js +149 -0
- package/package.json +1 -1
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;
|
|
@@ -153,9 +197,81 @@ export interface AdBlock extends BaseBlock {
|
|
|
153
197
|
/** Darstellung */
|
|
154
198
|
variant?: 'inline' | 'banner' | 'sidebar';
|
|
155
199
|
}
|
|
156
|
-
|
|
200
|
+
/** Container Block - Grid/Flex Container für Layout */
|
|
201
|
+
export interface ContainerBlock extends BaseBlock {
|
|
202
|
+
type: 'container';
|
|
203
|
+
/** Blöcke im Container */
|
|
204
|
+
blocks: Block[];
|
|
205
|
+
/** Layout-Typ */
|
|
206
|
+
layout: 'grid' | 'flex' | 'stack';
|
|
207
|
+
/** Grid-Konfiguration (nur bei layout: 'grid') */
|
|
208
|
+
grid?: {
|
|
209
|
+
columns?: string;
|
|
210
|
+
rows?: string;
|
|
211
|
+
gap?: string;
|
|
212
|
+
};
|
|
213
|
+
/** Flex-Konfiguration (nur bei layout: 'flex') */
|
|
214
|
+
flex?: {
|
|
215
|
+
direction?: 'row' | 'column';
|
|
216
|
+
wrap?: boolean;
|
|
217
|
+
gap?: string;
|
|
218
|
+
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
219
|
+
justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';
|
|
220
|
+
};
|
|
221
|
+
/** Stack-Konfiguration (nur bei layout: 'stack') */
|
|
222
|
+
stack?: {
|
|
223
|
+
gap?: string;
|
|
224
|
+
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/** Logo Block - Für Header/Branding */
|
|
228
|
+
export interface LogoBlock extends BaseBlock {
|
|
229
|
+
type: 'logo';
|
|
230
|
+
/** Logo-Bild URL */
|
|
231
|
+
src?: string;
|
|
232
|
+
/** Text/Name (wenn kein Bild) */
|
|
233
|
+
text?: string;
|
|
234
|
+
/** Alt-Text */
|
|
235
|
+
alt?: string;
|
|
236
|
+
/** Link-Ziel */
|
|
237
|
+
href?: string;
|
|
238
|
+
}
|
|
239
|
+
/** Navigation Block - Menü */
|
|
240
|
+
export interface NavigationBlock extends BaseBlock {
|
|
241
|
+
type: 'navigation';
|
|
242
|
+
/** Navigations-Items */
|
|
243
|
+
items: NavItem[];
|
|
244
|
+
/** Darstellung */
|
|
245
|
+
variant?: 'horizontal' | 'vertical' | 'dropdown';
|
|
246
|
+
/** Zeige Icons? */
|
|
247
|
+
showIcons?: boolean;
|
|
248
|
+
}
|
|
249
|
+
export interface NavItem {
|
|
250
|
+
/** Label */
|
|
251
|
+
label: string;
|
|
252
|
+
/** Link */
|
|
253
|
+
href: string;
|
|
254
|
+
/** Icon (Emoji) */
|
|
255
|
+
icon?: string;
|
|
256
|
+
/** Kinder (für Dropdown) */
|
|
257
|
+
children?: NavItem[];
|
|
258
|
+
}
|
|
259
|
+
/** Search Block - Suchleiste */
|
|
260
|
+
export interface SearchBlock extends BaseBlock {
|
|
261
|
+
type: 'search';
|
|
262
|
+
/** Placeholder-Text */
|
|
263
|
+
placeholder?: string;
|
|
264
|
+
/** Action URL */
|
|
265
|
+
action?: string;
|
|
266
|
+
}
|
|
267
|
+
export type Block = MarkdownBlock | HeadingBlock | ImageBlock | QuoteBlock | DividerBlock | NoteBlock | FaqBlock | HowToBlock | HeroBlock | ChildrenBlock | LinksBlock | BreadcrumbBlock | AffiliateBlock | AdBlock | ContainerBlock | LogoBlock | NavigationBlock | SearchBlock;
|
|
157
268
|
export type BlockType = Block['type'];
|
|
158
269
|
export declare function createBlock<T extends Block>(type: T['type'], data: Omit<T, 'id' | 'type'>): T;
|
|
159
270
|
export declare function createPage(data: Omit<Page, 'id' | 'blocks' | 'createdAt' | 'updatedAt'> & {
|
|
160
271
|
blocks?: Block[];
|
|
161
272
|
}): Page;
|
|
273
|
+
export declare function createLayout(data: Omit<Layout, 'id' | 'createdAt' | 'updatedAt'>): Layout;
|
|
274
|
+
export declare function createSimpleLayout(): Layout;
|
|
275
|
+
export declare function createTwoColumnLayout(): Layout;
|
|
276
|
+
export declare function createThreeColumnLayout(): Layout;
|
|
277
|
+
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