valtech-components 2.0.727 → 2.0.728
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/services/markdown-article/legal-content.service.mjs +56 -0
- package/esm2022/lib/services/markdown-article/markdown-article-parser.service.mjs +289 -0
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +5 -1
- package/fesm2022/valtech-components.mjs +341 -3
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/markdown-article/legal-content.service.d.ts +31 -0
- package/lib/services/markdown-article/markdown-article-parser.service.d.ts +31 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ArticleMetadata } from '../../components/organisms/article/types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export type LegalSlug = 'terms' | 'privacy' | 'cookies' | 'data-usage' | 'legal-notice' | string;
|
|
5
|
+
export interface LegalLoadOptions {
|
|
6
|
+
/** Two-letter locale code (es, en, pt). Falls back to `es` on 404. */
|
|
7
|
+
locale?: string;
|
|
8
|
+
/** Override base path (default `/assets/legal`). */
|
|
9
|
+
basePath?: string;
|
|
10
|
+
/** Fallback locale tried when the requested one is missing. Set null to disable. */
|
|
11
|
+
fallbackLocale?: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Loads Markdown legal documents from `/assets/legal/{locale}/{slug}.md` and parses them
|
|
15
|
+
* into ArticleMetadata ready for `<val-article>`. Caches parsed results by `locale:slug`
|
|
16
|
+
* so multiple views consuming the same doc share one HTTP request.
|
|
17
|
+
*/
|
|
18
|
+
export declare class LegalContentService {
|
|
19
|
+
private readonly http;
|
|
20
|
+
private readonly parser;
|
|
21
|
+
private readonly DEFAULT_BASE;
|
|
22
|
+
private readonly cache;
|
|
23
|
+
load(slug: LegalSlug, options?: LegalLoadOptions): Observable<ArticleMetadata>;
|
|
24
|
+
/** Returns the raw Markdown string without parsing. Useful for debugging. */
|
|
25
|
+
raw(slug: LegalSlug, options?: LegalLoadOptions): Observable<string>;
|
|
26
|
+
/** Clears the in-memory cache. Call when the user changes locale at runtime. */
|
|
27
|
+
invalidate(): void;
|
|
28
|
+
private fetchAndParse;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LegalContentService, never>;
|
|
30
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LegalContentService>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ArticleMetadata } from '../../components/organisms/article/types';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Converts Markdown documents into ArticleMetadata for the val-article organism.
|
|
5
|
+
*
|
|
6
|
+
* Supported syntax:
|
|
7
|
+
* - Headings (#, ##, ### …) → title / subtitle
|
|
8
|
+
* - Paragraphs → paragraph (with `processLinks` + `allowPartialBold`)
|
|
9
|
+
* - Lists (-, *, 1.) → unordered / ordered list (- [ ] / - [x] for checklist)
|
|
10
|
+
* - Blockquotes (>) → quote, with GitHub callouts `> [!NOTE|TIP|INFO|WARNING|CAUTION|IMPORTANT]` mapped to notes
|
|
11
|
+
* - Code fences (```lang) → code
|
|
12
|
+
* - Box-drawing ASCII art (┌┐└┘│─) auto-wrapped as code
|
|
13
|
+
* - Tables → flattened into paragraphs with bold keys
|
|
14
|
+
* - Horizontal rules (---, ***, ___) → separator
|
|
15
|
+
*/
|
|
16
|
+
export declare class MarkdownArticleParserService {
|
|
17
|
+
parse(markdown: string, config?: Partial<ArticleMetadata>): ArticleMetadata;
|
|
18
|
+
private normalize;
|
|
19
|
+
private startsNewBlock;
|
|
20
|
+
private makeHeading;
|
|
21
|
+
private makeQuoteOrCallout;
|
|
22
|
+
private makeNote;
|
|
23
|
+
/**
|
|
24
|
+
* Tables are flattened into a header subtitle (if present) followed by one paragraph per
|
|
25
|
+
* data row using `**col[0]:** col[1] · **col[2]:** col[3] …` format. val-article has no
|
|
26
|
+
* native table element so this preserves the information without breaking the layout.
|
|
27
|
+
*/
|
|
28
|
+
private makeTable;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownArticleParserService, never>;
|
|
30
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownArticleParserService>;
|
|
31
|
+
}
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -239,6 +239,8 @@ export * from './lib/services/qr-generator/types';
|
|
|
239
239
|
export * from './lib/services/modal/modal.service';
|
|
240
240
|
export * from './lib/services/modal/types';
|
|
241
241
|
export * from './lib/services/meta';
|
|
242
|
+
export * from './lib/services/markdown-article/markdown-article-parser.service';
|
|
243
|
+
export * from './lib/services/markdown-article/legal-content.service';
|
|
242
244
|
export * from './lib/services/firebase';
|
|
243
245
|
export * from './lib/services/auth';
|
|
244
246
|
export * from './lib/services/i18n';
|