valtech-components 2.0.711 → 2.0.713

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.
@@ -0,0 +1,220 @@
1
+ /**
2
+ * Content Types System
3
+ *
4
+ * This module provides a content abstraction layer that transforms
5
+ * structured content documents (blog posts, documentation, news articles)
6
+ * into ArticleMetadata for rendering with val-article component.
7
+ */
8
+ /**
9
+ * Author information for content documents
10
+ */
11
+ export interface ContentAuthor {
12
+ /** Author's display name */
13
+ name: string;
14
+ /** URL to author's avatar image */
15
+ avatar?: string;
16
+ /** Author's role or title */
17
+ role?: string;
18
+ /** Link to author's profile */
19
+ profileUrl?: string;
20
+ }
21
+ /**
22
+ * Common metadata for all content documents
23
+ */
24
+ export interface ContentMeta {
25
+ /** Unique identifier */
26
+ id?: string;
27
+ /** URL-friendly slug */
28
+ slug?: string;
29
+ /** Creation date */
30
+ createdAt?: Date | string;
31
+ /** Last update date */
32
+ updatedAt?: Date | string;
33
+ /** Publication date */
34
+ publishedAt?: Date | string;
35
+ /** Content author */
36
+ author?: ContentAuthor;
37
+ /** Tags for categorization */
38
+ tags?: string[];
39
+ /** Primary category */
40
+ category?: string;
41
+ /** Content locale (e.g., 'es', 'en') */
42
+ locale?: string;
43
+ }
44
+ /**
45
+ * Heading block - renders as title or subtitle
46
+ */
47
+ export interface HeadingBlock {
48
+ type: 'heading';
49
+ /** Heading level: 1 = title, 2-3 = subtitle */
50
+ level: 1 | 2 | 3;
51
+ /** Heading text */
52
+ text: string;
53
+ }
54
+ /**
55
+ * Paragraph block - renders as text
56
+ */
57
+ export interface ParagraphBlock {
58
+ type: 'paragraph';
59
+ /** Paragraph text content */
60
+ text: string;
61
+ /** Apply emphasis styling */
62
+ emphasis?: boolean;
63
+ }
64
+ /**
65
+ * Quote block - renders as blockquote
66
+ */
67
+ export interface QuoteBlock {
68
+ type: 'quote';
69
+ /** Quote text */
70
+ text: string;
71
+ /** Quote author name */
72
+ author?: string;
73
+ /** Quote source */
74
+ source?: string;
75
+ }
76
+ /**
77
+ * Code block - renders as syntax-highlighted code
78
+ */
79
+ export interface CodeBlock {
80
+ type: 'code';
81
+ /** Code content */
82
+ code: string;
83
+ /** Programming language for syntax highlighting */
84
+ language?: string;
85
+ /** Code block title/filename */
86
+ title?: string;
87
+ }
88
+ /**
89
+ * List block - renders as ordered, unordered, or checklist
90
+ */
91
+ export interface ListBlock {
92
+ type: 'list';
93
+ /** List items (simple strings) */
94
+ items: string[];
95
+ /** Render as numbered list */
96
+ ordered?: boolean;
97
+ /** Render as checklist with checkmarks */
98
+ checklist?: boolean;
99
+ }
100
+ /**
101
+ * Image block - renders as image with optional caption
102
+ */
103
+ export interface ImageBlock {
104
+ type: 'image';
105
+ /** Image source URL */
106
+ src: string;
107
+ /** Alt text for accessibility */
108
+ alt: string;
109
+ /** Image caption */
110
+ caption?: string;
111
+ /** Image alignment */
112
+ alignment?: 'left' | 'center' | 'right';
113
+ }
114
+ /**
115
+ * Callout block - renders as highlighted note/warning
116
+ */
117
+ export interface CalloutBlock {
118
+ type: 'callout';
119
+ /** Callout text content */
120
+ text: string;
121
+ /** Callout variant determines styling */
122
+ variant: 'info' | 'warning' | 'success' | 'error';
123
+ /** Optional title/prefix */
124
+ title?: string;
125
+ }
126
+ /**
127
+ * Divider block - renders as separator line
128
+ */
129
+ export interface DividerBlock {
130
+ type: 'divider';
131
+ /** Divider style */
132
+ style?: 'line' | 'dots' | 'space';
133
+ }
134
+ /**
135
+ * Button block - renders as call-to-action button
136
+ */
137
+ export interface ButtonBlock {
138
+ type: 'button';
139
+ /** Button text */
140
+ text: string;
141
+ /** Link URL (for navigation) */
142
+ href?: string;
143
+ /** Action identifier (for event handling) */
144
+ action?: string;
145
+ /** Button color */
146
+ color?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
147
+ /** Button alignment */
148
+ alignment?: 'left' | 'center' | 'right';
149
+ }
150
+ /**
151
+ * Command block - renders as terminal/CLI command
152
+ */
153
+ export interface CommandBlock {
154
+ type: 'command';
155
+ /** Command to display */
156
+ command: string;
157
+ /** Show copy button */
158
+ copyable?: boolean;
159
+ }
160
+ /**
161
+ * Union type of all content blocks
162
+ */
163
+ export type ContentBlock = HeadingBlock | ParagraphBlock | QuoteBlock | CodeBlock | ListBlock | ImageBlock | CalloutBlock | DividerBlock | ButtonBlock | CommandBlock;
164
+ /**
165
+ * Configuration options for content rendering
166
+ */
167
+ export interface ContentConfig {
168
+ /** Article theme */
169
+ theme?: 'light' | 'dark' | 'auto';
170
+ /** Maximum width of the content container */
171
+ maxWidth?: string;
172
+ /** Show metadata (author, date, etc.) */
173
+ showMeta?: boolean;
174
+ /** Show table of contents */
175
+ showTableOfContents?: boolean;
176
+ /** Center the content container */
177
+ centered?: boolean;
178
+ }
179
+ /**
180
+ * Base interface for all content documents.
181
+ * Generic type T represents the document type discriminator.
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * interface BlogPost extends ContentDocument<'blog'> {
186
+ * title: string;
187
+ * excerpt: string;
188
+ * }
189
+ * ```
190
+ */
191
+ export interface ContentDocument<T extends string = string> {
192
+ /** Document type discriminator */
193
+ type: T;
194
+ /** Document metadata */
195
+ meta: ContentMeta;
196
+ /** Array of content blocks */
197
+ content: ContentBlock[];
198
+ /** Rendering configuration */
199
+ config?: ContentConfig;
200
+ }
201
+ /**
202
+ * Type guard to check if a block is a heading
203
+ */
204
+ export declare function isHeadingBlock(block: ContentBlock): block is HeadingBlock;
205
+ /**
206
+ * Type guard to check if a block is a paragraph
207
+ */
208
+ export declare function isParagraphBlock(block: ContentBlock): block is ParagraphBlock;
209
+ /**
210
+ * Type guard to check if a block is a code block
211
+ */
212
+ export declare function isCodeBlock(block: ContentBlock): block is CodeBlock;
213
+ /**
214
+ * Type guard to check if a block is a list
215
+ */
216
+ export declare function isListBlock(block: ContentBlock): block is ListBlock;
217
+ /**
218
+ * Type guard to check if a block is a callout
219
+ */
220
+ export declare function isCalloutBlock(block: ContentBlock): block is CalloutBlock;
@@ -99,8 +99,8 @@ export declare class TypedCollection<T extends FirestoreDocument> {
99
99
  */
100
100
  getFirst(options?: QueryOptions): Promise<T | null>;
101
101
  /**
102
- * Cuenta los documentos que coinciden con la query.
103
- * Nota: Esto carga todos los documentos, usar con cuidado en colecciones grandes.
102
+ * Cuenta los documentos que coinciden con la query (server-side aggregation).
103
+ * No descarga documentos usa getCountFromServer() de Firestore.
104
104
  */
105
105
  count(options?: QueryOptions): Promise<number>;
106
106
  /**
@@ -80,6 +80,11 @@ export declare class FirestoreService {
80
80
  * ```
81
81
  */
82
82
  getDocs<T extends FirestoreDocument>(collectionPath: string, options?: QueryOptions): Promise<T[]>;
83
+ /**
84
+ * Cuenta documentos usando aggregation query del servidor.
85
+ * No descarga los documentos — mucho más eficiente para conteos y badges.
86
+ */
87
+ countDocs(collectionPath: string, options?: QueryOptions): Promise<number>;
83
88
  /**
84
89
  * Obtiene documentos con paginación basada en cursores.
85
90
  *
@@ -54,6 +54,7 @@ export declare class NotificationsService {
54
54
  private collectionFactory;
55
55
  private collection;
56
56
  private currentUserId;
57
+ private collectionReady$;
57
58
  private authService;
58
59
  constructor(injector: Injector, collectionFactory: FirestoreCollectionFactory);
59
60
  /**
@@ -98,8 +99,8 @@ export declare class NotificationsService {
98
99
  */
99
100
  getUnread(limit?: number): Observable<NotificationDocument[]>;
100
101
  /**
101
- * Cuenta notificaciones no leídas (real-time, filtrado server-side).
102
- * Útil para badges en UI.
102
+ * Cuenta notificaciones no leídas usando server-side aggregation query.
103
+ * No descarga documentos — eficiente para badges en UI.
103
104
  */
104
105
  getUnreadCount(): Observable<number>;
105
106
  /**
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "2.0.711";
5
+ export declare const VERSION = "2.0.713";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.711",
3
+ "version": "2.0.713",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
@@ -19,10 +19,7 @@
19
19
  "@ionic/angular": "^8.0.0",
20
20
  "firebase": "^10.0.0",
21
21
  "ionicons": "^7.2.1",
22
- "prismjs": "^1.30.0",
23
- "qr-code-styling": "^1.9.0",
24
- "rxjs": "~7.8.0",
25
- "swiper": "^11.2.8"
22
+ "rxjs": "~7.8.0"
26
23
  },
27
24
  "peerDependenciesMeta": {
28
25
  "@capacitor/app": {
@@ -33,6 +30,9 @@
33
30
  "@capacitor/browser": "^6.0.3",
34
31
  "ng-otp-input": "^1.9.3",
35
32
  "ngx-image-cropper": "^9.0.0",
33
+ "prismjs": "^1.30.0",
34
+ "qr-code-styling": "^1.9.0",
35
+ "swiper": "^11.2.8",
36
36
  "tslib": "^2.3.0"
37
37
  },
38
38
  "sideEffects": false,
package/public-api.d.ts CHANGED
@@ -258,6 +258,7 @@ export * from './lib/services/pagination';
258
258
  export * from './lib/services/image';
259
259
  export * from './lib/services/ads';
260
260
  export * from './lib/components/molecules/ad-slot/ad-slot.component';
261
+ export * from './lib/services/content';
261
262
  export * from './lib/services/feedback';
262
263
  export * from './lib/components/molecules/feedback-form/feedback-form.component';
263
264
  export * from './lib/components/molecules/feedback-form/types';