valtech-components 2.0.433 → 2.0.435
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/esm2022/lib/components/atoms/fab/fab.component.mjs +5 -4
- package/esm2022/lib/components/molecules/comment-input/comment-input.component.mjs +13 -5
- package/esm2022/lib/components/molecules/comment-input/types.mjs +2 -0
- package/esm2022/lib/components/molecules/date-input/date-input.component.mjs +23 -4
- package/esm2022/lib/components/molecules/date-input/types.mjs +2 -0
- package/esm2022/lib/components/molecules/feedback-form/feedback-form.component.mjs +352 -0
- package/esm2022/lib/components/molecules/feedback-form/types.mjs +2 -0
- package/esm2022/lib/components/molecules/file-input/file-input.component.mjs +7 -7
- package/esm2022/lib/components/molecules/file-input/types.mjs +2 -0
- package/esm2022/lib/components/molecules/number-from-to/number-from-to.component.mjs +23 -9
- package/esm2022/lib/components/molecules/number-from-to/types.mjs +2 -0
- package/esm2022/lib/components/molecules/pin-input/pin-input.component.mjs +2 -2
- package/esm2022/lib/components/molecules/pin-input/types.mjs +2 -0
- package/esm2022/lib/components/organisms/article/article.component.mjs +3 -3
- package/esm2022/lib/components/organisms/form/form.component.mjs +108 -30
- package/esm2022/lib/services/content/content-types/blog.mjs +275 -0
- package/esm2022/lib/services/content/content-types/documentation.mjs +303 -0
- package/esm2022/lib/services/content/content-types/news.mjs +277 -0
- package/esm2022/lib/services/content/index.mjs +51 -0
- package/esm2022/lib/services/content/transformer.mjs +265 -0
- package/esm2022/lib/services/content/types.mjs +41 -0
- package/esm2022/lib/services/feedback/config.mjs +49 -0
- package/esm2022/lib/services/feedback/feedback.service.mjs +174 -0
- package/esm2022/lib/services/feedback/index.mjs +44 -0
- package/esm2022/lib/services/feedback/types.mjs +30 -0
- package/esm2022/lib/services/firebase/index.mjs +3 -1
- package/esm2022/lib/services/firebase/shared-config.mjs +132 -0
- package/esm2022/public-api.mjs +14 -1
- package/fesm2022/valtech-components.mjs +2227 -179
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/atoms/fab/fab.component.d.ts +2 -0
- package/lib/components/molecules/comment-input/comment-input.component.d.ts +4 -4
- package/lib/components/molecules/comment-input/types.d.ts +59 -0
- package/lib/components/molecules/date-input/date-input.component.d.ts +4 -3
- package/lib/components/molecules/date-input/types.d.ts +74 -0
- package/lib/components/molecules/feedback-form/feedback-form.component.d.ts +56 -0
- package/lib/components/molecules/feedback-form/types.d.ts +54 -0
- package/lib/components/molecules/file-input/file-input.component.d.ts +5 -3
- package/lib/components/molecules/file-input/types.d.ts +72 -0
- package/lib/components/molecules/number-from-to/number-from-to.component.d.ts +8 -2
- package/lib/components/molecules/number-from-to/types.d.ts +76 -0
- package/lib/components/molecules/pin-input/pin-input.component.d.ts +4 -3
- package/lib/components/molecules/pin-input/types.d.ts +63 -0
- package/lib/components/organisms/form/form.component.d.ts +16 -2
- package/lib/services/content/content-types/blog.d.ts +148 -0
- package/lib/services/content/content-types/documentation.d.ts +183 -0
- package/lib/services/content/content-types/news.d.ts +162 -0
- package/lib/services/content/index.d.ts +49 -0
- package/lib/services/content/transformer.d.ts +96 -0
- package/lib/services/content/types.d.ts +220 -0
- package/lib/services/feedback/config.d.ts +35 -0
- package/lib/services/feedback/feedback.service.d.ts +76 -0
- package/lib/services/feedback/index.d.ts +40 -0
- package/lib/services/feedback/types.d.ts +107 -0
- package/lib/services/firebase/index.d.ts +1 -0
- package/lib/services/firebase/shared-config.d.ts +120 -0
- package/package.json +1 -1
- package/public-api.d.ts +9 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blog Post Content Type
|
|
3
|
+
*
|
|
4
|
+
* Represents a blog post with title, excerpt, cover image,
|
|
5
|
+
* and structured content blocks.
|
|
6
|
+
*/
|
|
7
|
+
import { ArticleMetadata } from '../../../components/organisms/article/types';
|
|
8
|
+
import { ContentDocument, ContentConfig } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Blog post document interface
|
|
11
|
+
*/
|
|
12
|
+
export interface BlogPost extends ContentDocument<'blog'> {
|
|
13
|
+
/** Blog post title */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Short excerpt/summary for listings */
|
|
16
|
+
excerpt: string;
|
|
17
|
+
/** Cover image URL */
|
|
18
|
+
coverImage?: string;
|
|
19
|
+
/** Estimated reading time in minutes */
|
|
20
|
+
readingTime?: number;
|
|
21
|
+
/** Featured post flag */
|
|
22
|
+
featured?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* BlogPostBuilder provides a fluent API for creating blog posts.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const post = new BlogPostBuilder()
|
|
30
|
+
* .title('My First Post')
|
|
31
|
+
* .excerpt('A brief introduction...')
|
|
32
|
+
* .author('John Doe', '/avatars/john.jpg')
|
|
33
|
+
* .coverImage('/images/post-cover.jpg')
|
|
34
|
+
* .heading('Introduction')
|
|
35
|
+
* .paragraph('Welcome to my blog...')
|
|
36
|
+
* .build();
|
|
37
|
+
*
|
|
38
|
+
* // Convert to ArticleMetadata
|
|
39
|
+
* const article = post.toArticle();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class BlogPostBuilder {
|
|
43
|
+
private post;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the blog post title
|
|
46
|
+
*/
|
|
47
|
+
title(title: string): this;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the blog post excerpt
|
|
50
|
+
*/
|
|
51
|
+
excerpt(excerpt: string): this;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the cover image URL
|
|
54
|
+
*/
|
|
55
|
+
coverImage(url: string): this;
|
|
56
|
+
/**
|
|
57
|
+
* Marks the post as featured
|
|
58
|
+
*/
|
|
59
|
+
featured(value?: boolean): this;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the post author
|
|
62
|
+
*/
|
|
63
|
+
author(name: string, avatar?: string, role?: string): this;
|
|
64
|
+
/**
|
|
65
|
+
* Sets the publication date
|
|
66
|
+
*/
|
|
67
|
+
publishedAt(date: Date | string): this;
|
|
68
|
+
/**
|
|
69
|
+
* Sets tags for the post
|
|
70
|
+
*/
|
|
71
|
+
tags(...tags: string[]): this;
|
|
72
|
+
/**
|
|
73
|
+
* Sets the category
|
|
74
|
+
*/
|
|
75
|
+
category(category: string): this;
|
|
76
|
+
/**
|
|
77
|
+
* Sets the slug
|
|
78
|
+
*/
|
|
79
|
+
slug(slug: string): this;
|
|
80
|
+
/**
|
|
81
|
+
* Sets the ID
|
|
82
|
+
*/
|
|
83
|
+
id(id: string): this;
|
|
84
|
+
/**
|
|
85
|
+
* Adds a heading block
|
|
86
|
+
*/
|
|
87
|
+
heading(text: string, level?: 1 | 2 | 3): this;
|
|
88
|
+
/**
|
|
89
|
+
* Adds a paragraph block
|
|
90
|
+
*/
|
|
91
|
+
paragraph(text: string, emphasis?: boolean): this;
|
|
92
|
+
/**
|
|
93
|
+
* Adds a quote block
|
|
94
|
+
*/
|
|
95
|
+
quote(text: string, author?: string, source?: string): this;
|
|
96
|
+
/**
|
|
97
|
+
* Adds a code block
|
|
98
|
+
*/
|
|
99
|
+
code(code: string, language?: string): this;
|
|
100
|
+
/**
|
|
101
|
+
* Adds an unordered list
|
|
102
|
+
*/
|
|
103
|
+
list(items: string[]): this;
|
|
104
|
+
/**
|
|
105
|
+
* Adds an ordered/numbered list
|
|
106
|
+
*/
|
|
107
|
+
orderedList(items: string[]): this;
|
|
108
|
+
/**
|
|
109
|
+
* Adds a checklist
|
|
110
|
+
*/
|
|
111
|
+
checklist(items: string[]): this;
|
|
112
|
+
/**
|
|
113
|
+
* Adds an image block
|
|
114
|
+
*/
|
|
115
|
+
image(src: string, alt: string, caption?: string): this;
|
|
116
|
+
/**
|
|
117
|
+
* Adds a callout/note block
|
|
118
|
+
*/
|
|
119
|
+
callout(text: string, variant?: 'info' | 'warning' | 'success' | 'error', title?: string): this;
|
|
120
|
+
/**
|
|
121
|
+
* Adds a divider
|
|
122
|
+
*/
|
|
123
|
+
divider(style?: 'line' | 'dots' | 'space'): this;
|
|
124
|
+
/**
|
|
125
|
+
* Adds a button/CTA
|
|
126
|
+
*/
|
|
127
|
+
button(text: string, href?: string, color?: 'primary' | 'secondary' | 'success'): this;
|
|
128
|
+
/**
|
|
129
|
+
* Configures rendering options
|
|
130
|
+
*/
|
|
131
|
+
config(config: Partial<ContentConfig>): this;
|
|
132
|
+
/**
|
|
133
|
+
* Builds the final BlogPost object
|
|
134
|
+
*/
|
|
135
|
+
build(): BlogPost;
|
|
136
|
+
/**
|
|
137
|
+
* Builds and converts to ArticleMetadata
|
|
138
|
+
*/
|
|
139
|
+
toArticle(): ArticleMetadata;
|
|
140
|
+
/**
|
|
141
|
+
* Resets the builder for reuse
|
|
142
|
+
*/
|
|
143
|
+
clear(): this;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new BlogPostBuilder instance
|
|
147
|
+
*/
|
|
148
|
+
export declare function blogPost(): BlogPostBuilder;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documentation Content Type
|
|
3
|
+
*
|
|
4
|
+
* Represents technical documentation with navigation,
|
|
5
|
+
* sections, and structured content blocks.
|
|
6
|
+
*/
|
|
7
|
+
import { ArticleMetadata } from '../../../components/organisms/article/types';
|
|
8
|
+
import { ContentDocument, ContentConfig } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Navigation link for prev/next page navigation
|
|
11
|
+
*/
|
|
12
|
+
export interface DocNavLink {
|
|
13
|
+
/** Page title */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Page slug/URL */
|
|
16
|
+
slug: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Documentation document interface
|
|
20
|
+
*/
|
|
21
|
+
export interface Documentation extends ContentDocument<'docs'> {
|
|
22
|
+
/** Documentation page title */
|
|
23
|
+
title: string;
|
|
24
|
+
/** Section name (e.g., "Getting Started", "API Reference") */
|
|
25
|
+
section?: string;
|
|
26
|
+
/** Version of the documentation */
|
|
27
|
+
version?: string;
|
|
28
|
+
/** Previous page navigation */
|
|
29
|
+
prevPage?: DocNavLink;
|
|
30
|
+
/** Next page navigation */
|
|
31
|
+
nextPage?: DocNavLink;
|
|
32
|
+
/** Table of contents items (auto-generated from headings if not provided) */
|
|
33
|
+
toc?: {
|
|
34
|
+
text: string;
|
|
35
|
+
level: number;
|
|
36
|
+
id: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* DocsBuilder provides a fluent API for creating documentation pages.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const docs = new DocsBuilder()
|
|
45
|
+
* .title('Installation Guide')
|
|
46
|
+
* .section('Getting Started')
|
|
47
|
+
* .version('1.0.0')
|
|
48
|
+
* .heading('Prerequisites', 1)
|
|
49
|
+
* .paragraph('Before you begin, ensure you have...')
|
|
50
|
+
* .callout('Node.js 18+ is required', 'warning')
|
|
51
|
+
* .heading('Installation', 1)
|
|
52
|
+
* .code('npm install valtech-components', 'bash')
|
|
53
|
+
* .prevPage('Introduction', '/docs/intro')
|
|
54
|
+
* .nextPage('Configuration', '/docs/config')
|
|
55
|
+
* .build();
|
|
56
|
+
*
|
|
57
|
+
* // Convert to ArticleMetadata
|
|
58
|
+
* const article = docs.toArticle();
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare class DocsBuilder {
|
|
62
|
+
private doc;
|
|
63
|
+
/**
|
|
64
|
+
* Sets the documentation page title
|
|
65
|
+
*/
|
|
66
|
+
title(title: string): this;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the section name
|
|
69
|
+
*/
|
|
70
|
+
section(section: string): this;
|
|
71
|
+
/**
|
|
72
|
+
* Sets the documentation version
|
|
73
|
+
*/
|
|
74
|
+
version(version: string): this;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the previous page navigation
|
|
77
|
+
*/
|
|
78
|
+
prevPage(title: string, slug: string): this;
|
|
79
|
+
/**
|
|
80
|
+
* Sets the next page navigation
|
|
81
|
+
*/
|
|
82
|
+
nextPage(title: string, slug: string): this;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the slug for the page
|
|
85
|
+
*/
|
|
86
|
+
slug(slug: string): this;
|
|
87
|
+
/**
|
|
88
|
+
* Sets the ID for the page
|
|
89
|
+
*/
|
|
90
|
+
id(id: string): this;
|
|
91
|
+
/**
|
|
92
|
+
* Sets tags for the documentation page
|
|
93
|
+
*/
|
|
94
|
+
tags(...tags: string[]): this;
|
|
95
|
+
/**
|
|
96
|
+
* Sets the category
|
|
97
|
+
*/
|
|
98
|
+
category(category: string): this;
|
|
99
|
+
/**
|
|
100
|
+
* Adds a heading block
|
|
101
|
+
*/
|
|
102
|
+
heading(text: string, level?: 1 | 2 | 3): this;
|
|
103
|
+
/**
|
|
104
|
+
* Adds a paragraph block
|
|
105
|
+
*/
|
|
106
|
+
paragraph(text: string, emphasis?: boolean): this;
|
|
107
|
+
/**
|
|
108
|
+
* Adds a code block
|
|
109
|
+
*/
|
|
110
|
+
code(code: string, language?: string): this;
|
|
111
|
+
/**
|
|
112
|
+
* Adds a command/terminal block
|
|
113
|
+
*/
|
|
114
|
+
command(command: string): this;
|
|
115
|
+
/**
|
|
116
|
+
* Adds a callout/note block
|
|
117
|
+
*/
|
|
118
|
+
callout(text: string, variant?: 'info' | 'warning' | 'success' | 'error', title?: string): this;
|
|
119
|
+
/**
|
|
120
|
+
* Adds an info callout (alias for callout with info variant)
|
|
121
|
+
*/
|
|
122
|
+
info(text: string, title?: string): this;
|
|
123
|
+
/**
|
|
124
|
+
* Adds a warning callout
|
|
125
|
+
*/
|
|
126
|
+
warning(text: string, title?: string): this;
|
|
127
|
+
/**
|
|
128
|
+
* Adds an error callout
|
|
129
|
+
*/
|
|
130
|
+
error(text: string, title?: string): this;
|
|
131
|
+
/**
|
|
132
|
+
* Adds a success callout
|
|
133
|
+
*/
|
|
134
|
+
success(text: string, title?: string): this;
|
|
135
|
+
/**
|
|
136
|
+
* Adds an unordered list
|
|
137
|
+
*/
|
|
138
|
+
list(items: string[]): this;
|
|
139
|
+
/**
|
|
140
|
+
* Adds an ordered/numbered list
|
|
141
|
+
*/
|
|
142
|
+
orderedList(items: string[]): this;
|
|
143
|
+
/**
|
|
144
|
+
* Adds a checklist
|
|
145
|
+
*/
|
|
146
|
+
checklist(items: string[]): this;
|
|
147
|
+
/**
|
|
148
|
+
* Adds an image block
|
|
149
|
+
*/
|
|
150
|
+
image(src: string, alt: string, caption?: string): this;
|
|
151
|
+
/**
|
|
152
|
+
* Adds a quote block
|
|
153
|
+
*/
|
|
154
|
+
quote(text: string, author?: string, source?: string): this;
|
|
155
|
+
/**
|
|
156
|
+
* Adds a divider
|
|
157
|
+
*/
|
|
158
|
+
divider(style?: 'line' | 'dots' | 'space'): this;
|
|
159
|
+
/**
|
|
160
|
+
* Adds a button/CTA
|
|
161
|
+
*/
|
|
162
|
+
button(text: string, href?: string, color?: 'primary' | 'secondary' | 'success'): this;
|
|
163
|
+
/**
|
|
164
|
+
* Configures rendering options
|
|
165
|
+
*/
|
|
166
|
+
config(config: Partial<ContentConfig>): this;
|
|
167
|
+
/**
|
|
168
|
+
* Builds the final Documentation object
|
|
169
|
+
*/
|
|
170
|
+
build(): Documentation;
|
|
171
|
+
/**
|
|
172
|
+
* Builds and converts to ArticleMetadata
|
|
173
|
+
*/
|
|
174
|
+
toArticle(): ArticleMetadata;
|
|
175
|
+
/**
|
|
176
|
+
* Resets the builder for reuse
|
|
177
|
+
*/
|
|
178
|
+
clear(): this;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Creates a new DocsBuilder instance
|
|
182
|
+
*/
|
|
183
|
+
export declare function docs(): DocsBuilder;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* News Article Content Type
|
|
3
|
+
*
|
|
4
|
+
* Represents a news article or announcement with headline,
|
|
5
|
+
* summary, featured image, and structured content blocks.
|
|
6
|
+
*/
|
|
7
|
+
import { ArticleMetadata } from '../../../components/organisms/article/types';
|
|
8
|
+
import { ContentDocument, ContentConfig } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* News article document interface
|
|
11
|
+
*/
|
|
12
|
+
export interface NewsArticle extends ContentDocument<'news'> {
|
|
13
|
+
/** News headline */
|
|
14
|
+
headline: string;
|
|
15
|
+
/** Short summary for listings */
|
|
16
|
+
summary: string;
|
|
17
|
+
/** Featured image URL */
|
|
18
|
+
featuredImage?: string;
|
|
19
|
+
/** Breaking news flag */
|
|
20
|
+
breaking?: boolean;
|
|
21
|
+
/** News source/outlet */
|
|
22
|
+
source?: string;
|
|
23
|
+
/** Related articles */
|
|
24
|
+
relatedArticles?: {
|
|
25
|
+
title: string;
|
|
26
|
+
slug: string;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* NewsBuilder provides a fluent API for creating news articles.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const news = new NewsBuilder()
|
|
35
|
+
* .headline('New Product Launch Announced')
|
|
36
|
+
* .summary('Company reveals groundbreaking new product...')
|
|
37
|
+
* .author('Jane Smith', '/avatars/jane.jpg', 'Technology Reporter')
|
|
38
|
+
* .publishedAt(new Date())
|
|
39
|
+
* .breaking()
|
|
40
|
+
* .featuredImage('/images/product-launch.jpg')
|
|
41
|
+
* .paragraph('In a surprise announcement today...')
|
|
42
|
+
* .quote('This is our most innovative product yet', 'CEO John Doe')
|
|
43
|
+
* .build();
|
|
44
|
+
*
|
|
45
|
+
* // Convert to ArticleMetadata
|
|
46
|
+
* const article = news.toArticle();
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare class NewsBuilder {
|
|
50
|
+
private article;
|
|
51
|
+
/**
|
|
52
|
+
* Sets the news headline
|
|
53
|
+
*/
|
|
54
|
+
headline(headline: string): this;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the news summary
|
|
57
|
+
*/
|
|
58
|
+
summary(summary: string): this;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the featured image URL
|
|
61
|
+
*/
|
|
62
|
+
featuredImage(url: string): this;
|
|
63
|
+
/**
|
|
64
|
+
* Marks the article as breaking news
|
|
65
|
+
*/
|
|
66
|
+
breaking(value?: boolean): this;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the news source/outlet
|
|
69
|
+
*/
|
|
70
|
+
source(source: string): this;
|
|
71
|
+
/**
|
|
72
|
+
* Sets the article author
|
|
73
|
+
*/
|
|
74
|
+
author(name: string, avatar?: string, role?: string): this;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the publication date
|
|
77
|
+
*/
|
|
78
|
+
publishedAt(date: Date | string): this;
|
|
79
|
+
/**
|
|
80
|
+
* Sets tags for the article
|
|
81
|
+
*/
|
|
82
|
+
tags(...tags: string[]): this;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the category
|
|
85
|
+
*/
|
|
86
|
+
category(category: string): this;
|
|
87
|
+
/**
|
|
88
|
+
* Sets the slug
|
|
89
|
+
*/
|
|
90
|
+
slug(slug: string): this;
|
|
91
|
+
/**
|
|
92
|
+
* Sets the ID
|
|
93
|
+
*/
|
|
94
|
+
id(id: string): this;
|
|
95
|
+
/**
|
|
96
|
+
* Adds related articles
|
|
97
|
+
*/
|
|
98
|
+
relatedArticles(articles: {
|
|
99
|
+
title: string;
|
|
100
|
+
slug: string;
|
|
101
|
+
}[]): this;
|
|
102
|
+
/**
|
|
103
|
+
* Adds a heading block
|
|
104
|
+
*/
|
|
105
|
+
heading(text: string, level?: 1 | 2 | 3): this;
|
|
106
|
+
/**
|
|
107
|
+
* Adds a paragraph block
|
|
108
|
+
*/
|
|
109
|
+
paragraph(text: string, emphasis?: boolean): this;
|
|
110
|
+
/**
|
|
111
|
+
* Adds a quote block
|
|
112
|
+
*/
|
|
113
|
+
quote(text: string, author?: string, source?: string): this;
|
|
114
|
+
/**
|
|
115
|
+
* Adds an image block
|
|
116
|
+
*/
|
|
117
|
+
image(src: string, alt: string, caption?: string): this;
|
|
118
|
+
/**
|
|
119
|
+
* Adds an unordered list
|
|
120
|
+
*/
|
|
121
|
+
list(items: string[]): this;
|
|
122
|
+
/**
|
|
123
|
+
* Adds an ordered/numbered list
|
|
124
|
+
*/
|
|
125
|
+
orderedList(items: string[]): this;
|
|
126
|
+
/**
|
|
127
|
+
* Adds a callout/note block
|
|
128
|
+
*/
|
|
129
|
+
callout(text: string, variant?: 'info' | 'warning' | 'success' | 'error', title?: string): this;
|
|
130
|
+
/**
|
|
131
|
+
* Adds a divider
|
|
132
|
+
*/
|
|
133
|
+
divider(style?: 'line' | 'dots' | 'space'): this;
|
|
134
|
+
/**
|
|
135
|
+
* Adds a button/CTA
|
|
136
|
+
*/
|
|
137
|
+
button(text: string, href?: string, color?: 'primary' | 'secondary' | 'success'): this;
|
|
138
|
+
/**
|
|
139
|
+
* Configures rendering options
|
|
140
|
+
*/
|
|
141
|
+
config(config: Partial<ContentConfig>): this;
|
|
142
|
+
/**
|
|
143
|
+
* Builds the final NewsArticle object
|
|
144
|
+
*/
|
|
145
|
+
build(): NewsArticle;
|
|
146
|
+
/**
|
|
147
|
+
* Builds and converts to ArticleMetadata
|
|
148
|
+
*/
|
|
149
|
+
toArticle(): ArticleMetadata;
|
|
150
|
+
/**
|
|
151
|
+
* Gets the estimated reading time in minutes
|
|
152
|
+
*/
|
|
153
|
+
getReadingTime(): number;
|
|
154
|
+
/**
|
|
155
|
+
* Resets the builder for reuse
|
|
156
|
+
*/
|
|
157
|
+
clear(): this;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Creates a new NewsBuilder instance
|
|
161
|
+
*/
|
|
162
|
+
export declare function news(): NewsBuilder;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Types Module
|
|
3
|
+
*
|
|
4
|
+
* Provides a flexible content abstraction layer that transforms
|
|
5
|
+
* structured content documents into ArticleMetadata for rendering
|
|
6
|
+
* with the val-article component.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Using BlogPostBuilder
|
|
11
|
+
* import { blogPost } from 'valtech-components';
|
|
12
|
+
*
|
|
13
|
+
* const post = blogPost()
|
|
14
|
+
* .title('My First Post')
|
|
15
|
+
* .author('John Doe')
|
|
16
|
+
* .heading('Introduction')
|
|
17
|
+
* .paragraph('Welcome to my blog...')
|
|
18
|
+
* .toArticle();
|
|
19
|
+
*
|
|
20
|
+
* // Using DocsBuilder
|
|
21
|
+
* import { docs } from 'valtech-components';
|
|
22
|
+
*
|
|
23
|
+
* const page = docs()
|
|
24
|
+
* .title('Installation')
|
|
25
|
+
* .section('Getting Started')
|
|
26
|
+
* .code('npm install valtech-components', 'bash')
|
|
27
|
+
* .toArticle();
|
|
28
|
+
*
|
|
29
|
+
* // Using NewsBuilder
|
|
30
|
+
* import { news } from 'valtech-components';
|
|
31
|
+
*
|
|
32
|
+
* const article = news()
|
|
33
|
+
* .headline('Breaking News')
|
|
34
|
+
* .summary('Important announcement...')
|
|
35
|
+
* .breaking()
|
|
36
|
+
* .toArticle();
|
|
37
|
+
*
|
|
38
|
+
* // From JSON/API response
|
|
39
|
+
* import { ContentTransformer, BlogPost } from 'valtech-components';
|
|
40
|
+
*
|
|
41
|
+
* const json: BlogPost = await fetch('/api/posts/1').then(r => r.json());
|
|
42
|
+
* const article = ContentTransformer.toArticle(json);
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export { ContentAuthor, ContentMeta, ContentConfig, ContentDocument, ContentBlock, HeadingBlock, ParagraphBlock, QuoteBlock, CodeBlock, ListBlock, ImageBlock, CalloutBlock, DividerBlock, ButtonBlock, CommandBlock, } from './types';
|
|
46
|
+
export { ContentTransformer, toArticle } from './transformer';
|
|
47
|
+
export { BlogPost, BlogPostBuilder, blogPost } from './content-types/blog';
|
|
48
|
+
export { Documentation, DocNavLink, DocsBuilder, docs } from './content-types/documentation';
|
|
49
|
+
export { NewsArticle, NewsBuilder, news } from './content-types/news';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Transformer
|
|
3
|
+
*
|
|
4
|
+
* Transforms ContentDocument instances into ArticleMetadata
|
|
5
|
+
* for rendering with the val-article component.
|
|
6
|
+
*/
|
|
7
|
+
import { ArticleMetadata } from '../../components/organisms/article/types';
|
|
8
|
+
import { ContentDocument } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* ContentTransformer converts ContentDocument objects into ArticleMetadata
|
|
11
|
+
* that can be rendered by the val-article component.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const doc: BlogPost = { ... };
|
|
16
|
+
* const article = ContentTransformer.toArticle(doc);
|
|
17
|
+
* // Use article with <val-article [props]="article">
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class ContentTransformer {
|
|
21
|
+
/**
|
|
22
|
+
* Transforms a ContentDocument into ArticleMetadata
|
|
23
|
+
*
|
|
24
|
+
* @param doc - The content document to transform
|
|
25
|
+
* @returns ArticleMetadata ready for val-article component
|
|
26
|
+
*/
|
|
27
|
+
static toArticle(doc: ContentDocument): ArticleMetadata;
|
|
28
|
+
/**
|
|
29
|
+
* Adds header elements based on document type and metadata
|
|
30
|
+
*/
|
|
31
|
+
private static addHeader;
|
|
32
|
+
/**
|
|
33
|
+
* Adds footer elements based on document type
|
|
34
|
+
*/
|
|
35
|
+
private static addFooter;
|
|
36
|
+
/**
|
|
37
|
+
* Adds author information block
|
|
38
|
+
*/
|
|
39
|
+
private static addAuthorBlock;
|
|
40
|
+
/**
|
|
41
|
+
* Transforms a single content block and adds it to the builder
|
|
42
|
+
*/
|
|
43
|
+
private static addBlock;
|
|
44
|
+
/**
|
|
45
|
+
* Adds a heading block
|
|
46
|
+
*/
|
|
47
|
+
private static addHeading;
|
|
48
|
+
/**
|
|
49
|
+
* Adds a paragraph block
|
|
50
|
+
*/
|
|
51
|
+
private static addParagraph;
|
|
52
|
+
/**
|
|
53
|
+
* Adds a quote block
|
|
54
|
+
*/
|
|
55
|
+
private static addQuote;
|
|
56
|
+
/**
|
|
57
|
+
* Adds a code block
|
|
58
|
+
*/
|
|
59
|
+
private static addCode;
|
|
60
|
+
/**
|
|
61
|
+
* Adds a list block
|
|
62
|
+
*/
|
|
63
|
+
private static addList;
|
|
64
|
+
/**
|
|
65
|
+
* Adds an image block
|
|
66
|
+
*/
|
|
67
|
+
private static addImage;
|
|
68
|
+
/**
|
|
69
|
+
* Adds a callout/note block
|
|
70
|
+
*/
|
|
71
|
+
private static addCallout;
|
|
72
|
+
/**
|
|
73
|
+
* Adds a divider/separator block
|
|
74
|
+
*/
|
|
75
|
+
private static addDivider;
|
|
76
|
+
/**
|
|
77
|
+
* Adds a button block
|
|
78
|
+
*/
|
|
79
|
+
private static addButton;
|
|
80
|
+
/**
|
|
81
|
+
* Adds a command/terminal block
|
|
82
|
+
*/
|
|
83
|
+
private static addCommand;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Convenience function to transform a ContentDocument to ArticleMetadata
|
|
87
|
+
*
|
|
88
|
+
* @param doc - The content document to transform
|
|
89
|
+
* @returns ArticleMetadata ready for val-article component
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const article = toArticle(myBlogPost);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function toArticle(doc: ContentDocument): ArticleMetadata;
|