@analogjs/content 2.8.0-beta.8 → 2.8.0

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.
@@ -1,169 +1,178 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Provider, AfterViewChecked, Signal, Type, AbstractType, ProviderToken } from '@angular/core';
3
- import * as rxjs from 'rxjs';
4
- import { Observable } from 'rxjs';
5
- import * as mermaid from 'mermaid';
6
- import { SafeHtml } from '@angular/platform-browser';
7
- import * as marked from 'marked';
8
- import { marked as marked$1 } from 'marked';
9
-
10
- declare class AnchorNavigationDirective {
11
- private readonly document;
12
- private readonly location;
13
- private readonly router;
14
- handleNavigation(element: EventTarget | null): boolean;
15
- static ɵfac: i0.ɵɵFactoryDeclaration<AnchorNavigationDirective, never>;
16
- static ɵdir: i0.ɵɵDirectiveDeclaration<AnchorNavigationDirective, "[analogAnchorNavigation]", never, {}, {}, never, never, true, never>;
1
+ import * as i0 from "@angular/core";
2
+ import { AbstractType, AfterViewChecked, InjectionToken, Provider, ProviderToken, Signal, Type } from "@angular/core";
3
+ import { Observable } from "rxjs";
4
+ import { SafeHtml } from "@angular/platform-browser";
5
+ import { marked } from "marked";
6
+ declare namespace anchor_navigation_directive_d_exports {
7
+ export { AnchorNavigationDirective };
8
+ }
9
+ export declare class AnchorNavigationDirective {
10
+ private readonly document;
11
+ private readonly location;
12
+ private readonly router;
13
+ handleNavigation(element: EventTarget | null): boolean;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnchorNavigationDirective, never>;
15
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AnchorNavigationDirective, "[analogAnchorNavigation]", never, {}, {}, never, never, true, never>;
17
16
  }
18
-
19
17
  type TableOfContentItem = {
20
- id: string;
21
- level: number;
22
- text: string;
18
+ id: string;
19
+ level: number;
20
+ text: string;
23
21
  };
24
22
  type RenderedContent = {
25
- content: string;
26
- toc: TableOfContentItem[];
23
+ content: string;
24
+ toc: TableOfContentItem[];
27
25
  };
28
- declare abstract class ContentRenderer {
29
- render(content: string): Promise<RenderedContent>;
30
- getContentHeadings(_content: string): TableOfContentItem[];
31
- enhance(): void;
32
- static ɵfac: i0.ɵɵFactoryDeclaration<ContentRenderer, never>;
33
- static ɵprov: i0.ɵɵInjectableDeclaration<ContentRenderer>;
26
+ export declare abstract class ContentRenderer {
27
+ render(content: string): Promise<RenderedContent>;
28
+ getContentHeadings(_content: string): TableOfContentItem[];
29
+ enhance(): void;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContentRenderer, never>;
31
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
34
32
  }
35
- declare class NoopContentRenderer implements ContentRenderer {
36
- private readonly transferState;
37
- private contentId;
38
- /**
39
- * Generates a hash from the content string
40
- * to be used with the transfer state
41
- */
42
- private generateHash;
43
- render(content: string): Promise<RenderedContent>;
44
- enhance(): void;
45
- getContentHeadings(content: string): TableOfContentItem[];
46
- private extractHeadings;
47
- private extractHeadingsFromMarkdown;
48
- private extractHeadingsFromHtml;
49
- private makeSlug;
33
+ export declare class NoopContentRenderer implements ContentRenderer {
34
+ private readonly transferState;
35
+ private contentId;
36
+ /**
37
+ * Generates a hash from the content string
38
+ * to be used with the transfer state
39
+ */
40
+ private generateHash;
41
+ render(content: string): Promise<RenderedContent>;
42
+ enhance(): void;
43
+ getContentHeadings(content: string): TableOfContentItem[];
44
+ private extractHeadings;
45
+ private extractHeadingsFromMarkdown;
46
+ private extractHeadingsFromHtml;
47
+ private makeSlug;
50
48
  }
51
-
52
- interface ContentFile<Attributes extends Record<string, any> = Record<string, any>> {
53
- filename: string;
54
- slug: string;
55
- content?: string | object;
56
- attributes: Attributes;
57
- toc?: TableOfContentItem[];
49
+ export interface ContentFile<Attributes extends Record<string, any> = Record<string, any>> {
50
+ filename: string;
51
+ slug: string;
52
+ content?: string | object;
53
+ attributes: Attributes;
54
+ toc?: TableOfContentItem[];
58
55
  }
59
-
60
56
  /**
61
57
  * Retrieves the static content using the provided param and/or prefix.
62
58
  *
63
59
  * @param param route parameter (default: 'slug')
64
60
  * @param fallback fallback text if content file is not found (default: 'No Content Found')
65
61
  */
66
- declare function injectContent<Attributes extends Record<string, any> = Record<string, any>>(param?: string | {
67
- param: string;
68
- subdirectory: string;
62
+ export declare function injectContent<Attributes extends Record<string, any> = Record<string, any>>(param?: string | {
63
+ param: string;
64
+ subdirectory: string;
69
65
  } | {
70
- customFilename: string;
66
+ customFilename: string;
71
67
  }, fallback?: string): Observable<ContentFile<Attributes | Record<string, never>>>;
72
-
73
- declare function injectContentFiles<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes>): ContentFile<Attributes>[];
74
- type InjectContentFilesFilterFunction<T extends Record<string, any>> = (value: ContentFile<T>, index: number, array: ContentFile<T>[]) => boolean;
75
- declare function injectContentFilesMap(): Record<string, () => Promise<string>>;
76
-
77
- declare class MarkdownContentRendererService implements ContentRenderer {
78
- #private;
79
- render(content: string): Promise<RenderedContent>;
80
- getContentHeadings(content: string): TableOfContentItem[];
81
- enhance(): void;
82
- static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownContentRendererService, never>;
83
- static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownContentRendererService>;
68
+ export declare function injectContentFiles<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes>): ContentFile<Attributes>[];
69
+ export type InjectContentFilesFilterFunction<T extends Record<string, any>> = (value: ContentFile<T>, index: number, array: ContentFile<T>[]) => boolean;
70
+ export declare function injectContentFilesMap(): Record<string, () => Promise<string>>;
71
+ export declare class MarkdownContentRendererService implements ContentRenderer {
72
+ #private;
73
+ render(content: string): Promise<RenderedContent>;
74
+ getContentHeadings(content: string): TableOfContentItem[];
75
+ enhance(): void;
76
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownContentRendererService, never>;
77
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
84
78
  }
85
-
86
79
  interface MarkdownRendererOptions {
87
- loadMermaid?: () => Promise<typeof mermaid>;
80
+ loadMermaid?: () => Promise<typeof import('mermaid')>;
88
81
  }
89
- declare function withMarkdownRenderer(options?: MarkdownRendererOptions): Provider;
90
- declare function provideContent(...features: Provider[]): Provider[];
91
- declare const MERMAID_IMPORT_TOKEN: InjectionToken<Promise<typeof mermaid>>;
92
-
82
+ export declare function withMarkdownRenderer(options?: MarkdownRendererOptions): Provider;
83
+ export declare function provideContent(...features: Provider[]): Provider[];
84
+ export declare const MERMAID_IMPORT_TOKEN: InjectionToken<Promise<typeof import("mermaid")>>;
93
85
  declare class AnalogMarkdownRouteComponent implements AfterViewChecked {
94
- private sanitizer;
95
- private route;
96
- contentRenderer: ContentRenderer;
97
- protected content: SafeHtml;
98
- classes: string;
99
- ngAfterViewChecked(): void;
100
- static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownRouteComponent, never>;
101
- static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownRouteComponent, "analog-markdown-route", never, { "classes": { "alias": "classes"; "required": false; }; }, {}, never, never, true, [{ directive: typeof AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
86
+ private sanitizer;
87
+ private route;
88
+ contentRenderer: ContentRenderer;
89
+ protected content: SafeHtml;
90
+ classes: string;
91
+ ngAfterViewChecked(): void;
92
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownRouteComponent, never>;
93
+ static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownRouteComponent, "analog-markdown-route", never, {
94
+ "classes": {
95
+ "alias": "classes";
96
+ "required": false;
97
+ };
98
+ }, {}, never, never, true, [{
99
+ directive: typeof AnchorNavigationDirective;
100
+ inputs: {};
101
+ outputs: {};
102
+ }]>;
102
103
  }
103
-
104
104
  declare class AnalogMarkdownComponent implements AfterViewChecked {
105
- private sanitizer;
106
- private route;
107
- private zone;
108
- private readonly platformId;
109
- private readonly mermaidImport;
110
- private mermaid;
111
- private contentSource;
112
- readonly htmlContent: Signal<SafeHtml | undefined>;
113
- readonly content: i0.InputSignal<string | object | null | undefined>;
114
- readonly classes: i0.InputSignal<string>;
115
- contentRenderer: ContentRenderer;
116
- constructor();
117
- getContentSource(): rxjs.Observable<string | SafeHtml>;
118
- renderContent(content: string): Promise<string>;
119
- ngAfterViewChecked(): void;
120
- private loadMermaid;
121
- static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownComponent, never>;
122
- static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownComponent, "analog-markdown", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "classes": { "alias": "classes"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
105
+ private sanitizer;
106
+ private route;
107
+ private zone;
108
+ private readonly platformId;
109
+ private readonly mermaidImport;
110
+ private mermaid;
111
+ private contentSource;
112
+ readonly htmlContent: Signal<SafeHtml | undefined>;
113
+ readonly content: import("@angular/core").InputSignal<string | object | null | undefined>;
114
+ readonly classes: import("@angular/core").InputSignal<string>;
115
+ contentRenderer: ContentRenderer;
116
+ constructor();
117
+ getContentSource(): import("rxjs").Observable<string | SafeHtml>;
118
+ renderContent(content: string): Promise<string>;
119
+ ngAfterViewChecked(): void;
120
+ private loadMermaid;
121
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownComponent, never>;
122
+ static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownComponent, "analog-markdown", never, {
123
+ "content": {
124
+ "alias": "content";
125
+ "required": false;
126
+ "isSignal": true;
127
+ };
128
+ "classes": {
129
+ "alias": "classes";
130
+ "required": false;
131
+ "isSignal": true;
132
+ };
133
+ }, {}, never, never, true, [{
134
+ directive: typeof AnchorNavigationDirective;
135
+ inputs: {};
136
+ outputs: {};
137
+ }]>;
123
138
  }
124
-
125
- declare function parseRawContentFile<Attributes extends Record<string, any>>(rawContentFile: string): {
126
- content: string;
127
- attributes: Attributes;
139
+ export declare function parseRawContentFile<Attributes extends Record<string, any>>(rawContentFile: string): {
140
+ content: string;
141
+ attributes: Attributes;
128
142
  };
129
-
130
- declare class MarkedSetupService {
131
- private readonly marked;
132
- private readonly highlighter;
133
- constructor();
134
- getMarkedInstance(): typeof marked$1;
135
- static ɵfac: i0.ɵɵFactoryDeclaration<MarkedSetupService, never>;
136
- static ɵprov: i0.ɵɵInjectableDeclaration<MarkedSetupService>;
143
+ export declare class MarkedSetupService {
144
+ private readonly marked;
145
+ private readonly highlighter;
146
+ constructor();
147
+ getMarkedInstance(): typeof marked;
148
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkedSetupService, never>;
149
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
137
150
  }
138
-
139
- interface MarkedContentHighlighter {
140
- augmentCodeBlock?(code: string, lang: string): string;
151
+ export interface MarkedContentHighlighter {
152
+ augmentCodeBlock?(code: string, lang: string): string;
141
153
  }
142
- declare abstract class MarkedContentHighlighter {
143
- abstract getHighlightExtension(): marked.MarkedExtension;
144
- static ɵfac: i0.ɵɵFactoryDeclaration<MarkedContentHighlighter, never>;
145
- static ɵprov: i0.ɵɵInjectableDeclaration<MarkedContentHighlighter>;
154
+ export declare abstract class MarkedContentHighlighter {
155
+ abstract getHighlightExtension(): import('marked').MarkedExtension;
156
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkedContentHighlighter, never>;
157
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
146
158
  }
147
- declare function withHighlighter(provider: ({
148
- useValue: MarkedContentHighlighter;
159
+ export declare function withHighlighter(provider: ({
160
+ useValue: MarkedContentHighlighter;
149
161
  } | {
150
- useClass: Type<MarkedContentHighlighter> | AbstractType<MarkedContentHighlighter>;
162
+ useClass: Type<MarkedContentHighlighter> | AbstractType<MarkedContentHighlighter>;
151
163
  } | {
152
- useFactory: (...deps: any[]) => MarkedContentHighlighter;
164
+ useFactory: (...deps: any[]) => MarkedContentHighlighter;
153
165
  }) & {
154
- deps?: ProviderToken<any>[];
166
+ deps?: ProviderToken<any>[];
155
167
  }): Provider;
156
-
157
168
  type ContentListLoaderFunction<Attributes extends Record<string, any>> = () => Promise<ContentFile<Attributes>[]>;
158
- declare const CONTENT_LIST_LOADER: InjectionToken<ContentListLoaderFunction<any>>;
159
- declare function injectContentListLoader<Attributes extends Record<string, any>>(): ContentListLoaderFunction<Attributes>;
160
- declare function withContentListLoader(): Provider;
161
-
169
+ export declare const CONTENT_LIST_LOADER: InjectionToken<ContentListLoaderFunction<any>>;
170
+ export declare function injectContentListLoader<Attributes extends Record<string, any>>(): ContentListLoaderFunction<Attributes>;
171
+ export declare function withContentListLoader(): Provider;
162
172
  type ContentFileLoaderFunction = () => Promise<Record<string, () => Promise<string>>>;
163
- declare const CONTENT_FILE_LOADER: InjectionToken<ContentFileLoaderFunction>;
164
- declare function injectContentFileLoader(): ContentFileLoaderFunction;
165
- declare function withContentFileLoader(): Provider;
166
-
173
+ export declare const CONTENT_FILE_LOADER: InjectionToken<ContentFileLoaderFunction>;
174
+ export declare function injectContentFileLoader(): ContentFileLoaderFunction;
175
+ export declare function withContentFileLoader(): Provider;
167
176
  /**
168
177
  * Token for the active content locale.
169
178
  * Provided via `withLocale()` in `provideContent()`.
@@ -171,23 +180,23 @@ declare function withContentFileLoader(): Provider;
171
180
  * When set, `injectContentFiles()` filters to content matching this locale,
172
181
  * and `injectContent()` resolves locale-prefixed content paths first.
173
182
  */
174
- declare const CONTENT_LOCALE: InjectionToken<string>;
183
+ export declare const CONTENT_LOCALE: InjectionToken<string>;
175
184
  /**
176
185
  * Injects the content locale, returning null if not configured.
177
186
  */
178
- declare function injectContentLocale(): string | null;
187
+ export declare function injectContentLocale(): string | null;
179
188
  interface ContentLocaleOptions {
180
- /**
181
- * Function that returns the active locale.
182
- * Runs in injection context so `inject()` can be used to read
183
- * from other tokens (e.g., a LOCALE token from a router package).
184
- *
185
- * ```typescript
186
- * withLocale({ loadLocale: injectLocale })
187
- * withLocale({ loadLocale: () => navigator.language.split('-')[0] })
188
- * ```
189
- */
190
- loadLocale: () => string | null;
189
+ /**
190
+ * Function that returns the active locale.
191
+ * Runs in injection context so `inject()` can be used to read
192
+ * from other tokens (e.g., a LOCALE token from a router package).
193
+ *
194
+ * ```typescript
195
+ * withLocale({ loadLocale: injectLocale })
196
+ * withLocale({ loadLocale: () => navigator.language.split('-')[0] })
197
+ * ```
198
+ */
199
+ loadLocale: () => string | null;
191
200
  }
192
201
  /**
193
202
  * Content feature that sets the active locale for content resolution.
@@ -213,7 +222,7 @@ interface ContentLocaleOptions {
213
222
  * )
214
223
  * ```
215
224
  */
216
- declare function withLocale(locale: string | ContentLocaleOptions): Provider;
225
+ export declare function withLocale(locale: string | ContentLocaleOptions): Provider;
217
226
  /**
218
227
  * Filters content files by locale using map-based key lookup.
219
228
  *
@@ -224,12 +233,10 @@ declare function withLocale(locale: string | ContentLocaleOptions): Provider;
224
233
  *
225
234
  * Files in a different locale's subdirectory are always excluded.
226
235
  */
227
- declare function filterByLocale<T extends Record<string, any>>(files: ContentFile<T>[], locale: string): ContentFile<T>[];
236
+ export declare function filterByLocale<T extends Record<string, any>>(files: ContentFile<T>[], locale: string): ContentFile<T>[];
228
237
  /**
229
238
  * Prepends locale-prefixed candidates before the standard candidates
230
239
  * for content file map key lookup.
231
240
  */
232
- declare function withLocaleCandidates(candidates: string[], locale: string | null | undefined): string[];
233
-
234
- export { AnchorNavigationDirective, CONTENT_FILE_LOADER, CONTENT_LIST_LOADER, CONTENT_LOCALE, ContentRenderer, MERMAID_IMPORT_TOKEN, AnalogMarkdownComponent as MarkdownComponent, MarkdownContentRendererService, AnalogMarkdownRouteComponent as MarkdownRouteComponent, MarkedContentHighlighter, MarkedSetupService, NoopContentRenderer, filterByLocale, injectContent, injectContentFileLoader, injectContentFiles, injectContentFilesMap, injectContentListLoader, injectContentLocale, parseRawContentFile, provideContent, withContentFileLoader, withContentListLoader, withHighlighter, withLocale, withLocaleCandidates, withMarkdownRenderer };
235
- export type { ContentFile, InjectContentFilesFilterFunction };
241
+ export declare function withLocaleCandidates(candidates: string[], locale: string | null | undefined): string[];
242
+ export { AnalogMarkdownComponent as MarkdownComponent, AnalogMarkdownRouteComponent as MarkdownRouteComponent };