valtech-components 2.0.288 → 2.0.290

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.
@@ -17,6 +17,9 @@ export declare class LinkProcessingExampleComponent {
17
17
  customLinksProps: TextMetadata;
18
18
  mixedLinksProps: TextMetadata;
19
19
  sameTabLinksProps: TextMetadata;
20
+ markdownLinksProps: TextMetadata;
21
+ mixedFormatsProps: TextMetadata;
22
+ punctuationTestProps: TextMetadata;
20
23
  static ɵfac: i0.ɵɵFactoryDeclaration<LinkProcessingExampleComponent, never>;
21
24
  static ɵcmp: i0.ɵɵComponentDeclaration<LinkProcessingExampleComponent, "val-link-processing-example", never, {}, {}, never, never, true, never>;
22
25
  }
@@ -11,19 +11,21 @@ export interface LinkProcessorConfig {
11
11
  externalLinkClass?: string;
12
12
  /** Custom CSS classes for internal links */
13
13
  internalLinkClass?: string;
14
+ /** Whether to process Markdown-style links [text](url) (default: true) */
15
+ processMarkdownLinks?: boolean;
14
16
  }
15
17
  /**
16
18
  * LinkProcessorService - Service for processing text content to convert URLs and internal routes into clickable links.
17
19
  *
18
- * This service automatically detects external URLs (http/https) and internal routes (starting with /)
19
- * and converts them into HTML anchor elements with appropriate attributes.
20
+ * This service automatically detects external URLs (http/https), internal routes (starting with /),
21
+ * and Markdown-style links [text](url) and converts them into HTML anchor elements with appropriate attributes.
20
22
  *
21
23
  * @example Basic usage:
22
24
  * ```typescript
23
25
  * constructor(private linkProcessor: LinkProcessorService) {}
24
26
  *
25
27
  * processText() {
26
- * const text = 'Visit https://example.com or go to /profile';
28
+ * const text = 'Visit https://example.com, go to /profile, or [check docs](https://docs.example.com)';
27
29
  * const processed = this.linkProcessor.processLinks(text);
28
30
  * // Returns SafeHtml with clickable links
29
31
  * }
@@ -33,10 +35,11 @@ export declare class LinkProcessorService {
33
35
  private sanitizer;
34
36
  private readonly urlRegex;
35
37
  private readonly internalRouteRegex;
38
+ private readonly markdownLinkRegex;
36
39
  constructor(sanitizer: DomSanitizer);
37
40
  /**
38
41
  * Procesa texto para convertir enlaces en elementos <a> clickeables.
39
- * Detecta automáticamente URLs externas e internas y las convierte en enlaces.
42
+ * Detecta automáticamente URLs externas, rutas internas y enlaces estilo Markdown.
40
43
  *
41
44
  * @param text - Texto a procesar
42
45
  * @param config - Configuración del procesamiento
@@ -45,10 +48,11 @@ export declare class LinkProcessorService {
45
48
  * @example
46
49
  * ```typescript
47
50
  * const result = this.linkProcessor.processLinks(
48
- * 'Visit https://example.com or /profile',
51
+ * 'Visit https://example.com, go to /profile, or [check docs](https://docs.example.com)',
49
52
  * {
50
53
  * openExternalInNewTab: true,
51
54
  * openInternalInNewTab: false,
55
+ * processMarkdownLinks: true,
52
56
  * linkClass: 'custom-link'
53
57
  * }
54
58
  * );
@@ -56,14 +60,14 @@ export declare class LinkProcessorService {
56
60
  */
57
61
  processLinks(text: string, config?: LinkProcessorConfig): SafeHtml | string;
58
62
  /**
59
- * Detecta si un texto contiene enlaces (URLs o rutas internas).
63
+ * Detecta si un texto contiene enlaces (URLs, rutas internas o enlaces Markdown).
60
64
  *
61
65
  * @param text - Texto a analizar
62
66
  * @returns true si contiene enlaces
63
67
  *
64
68
  * @example
65
69
  * ```typescript
66
- * const hasLinks = this.linkProcessor.hasLinks('Visit https://example.com');
70
+ * const hasLinks = this.linkProcessor.hasLinks('Visit https://example.com or [docs](https://docs.com)');
67
71
  * // Returns: true
68
72
  * ```
69
73
  */
@@ -72,20 +76,22 @@ export declare class LinkProcessorService {
72
76
  * Extrae todos los enlaces de un texto.
73
77
  *
74
78
  * @param text - Texto a analizar
75
- * @returns Array de enlaces encontrados con su tipo
79
+ * @returns Array de enlaces encontrados con su tipo y texto (si es Markdown)
76
80
  *
77
81
  * @example
78
82
  * ```typescript
79
- * const links = this.linkProcessor.extractLinks('Visit https://example.com or /profile');
83
+ * const links = this.linkProcessor.extractLinks('Visit https://example.com, /profile, or [docs](https://docs.com)');
80
84
  * // Returns: [
81
- * // { url: 'https://example.com', type: 'external' },
82
- * // { url: '/profile', type: 'internal' }
85
+ * // { url: 'https://example.com', type: 'external', text: 'https://example.com' },
86
+ * // { url: '/profile', type: 'internal', text: '/profile' },
87
+ * // { url: 'https://docs.com', type: 'external', text: 'docs' }
83
88
  * // ]
84
89
  * ```
85
90
  */
86
91
  extractLinks(text: string): Array<{
87
92
  url: string;
88
93
  type: 'external' | 'internal';
94
+ text: string;
89
95
  }>;
90
96
  static ɵfac: i0.ɵɵFactoryDeclaration<LinkProcessorService, never>;
91
97
  static ɵprov: i0.ɵɵInjectableDeclaration<LinkProcessorService>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.288",
3
+ "version": "2.0.290",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.0.0",
6
6
  "@angular/core": "^18.0.0",
@@ -203,3 +203,37 @@ ion-modal.modal-sheet ion-header ion-toolbar:last-of-type {
203
203
  padding: 0 !important;
204
204
  padding-bottom: 0.5rem !important;
205
205
  }
206
+
207
+ // Estilos para enlaces procesados automáticamente
208
+ .processed-link {
209
+ color: var(--ion-color-primary, #3880ff);
210
+ text-decoration: underline;
211
+ text-decoration-thickness: 1px;
212
+ text-underline-offset: 2px;
213
+ transition: color 0.3s ease;
214
+
215
+ &:hover {
216
+ color: var(--ion-color-primary-shade, #3171e0);
217
+ text-decoration-thickness: 2px;
218
+ }
219
+
220
+ &:active {
221
+ color: var(--ion-color-primary-tint, #4c8dff);
222
+ }
223
+ }
224
+
225
+ .external-link {
226
+ &::after {
227
+ content: ' ↗';
228
+ font-size: 0.8em;
229
+ opacity: 0.7;
230
+ }
231
+ }
232
+
233
+ .internal-link {
234
+ color: var(--ion-color-secondary, #0cd1e8);
235
+
236
+ &:hover {
237
+ color: var(--ion-color-secondary-shade, #0bb8cc);
238
+ }
239
+ }