@ng-doc/app 22.0.0-beta.2 → 22.0.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.
- package/README.md +20 -29
- package/fesm2022/ng-doc-app-classes-content-anchor-controller.mjs +363 -0
- package/fesm2022/ng-doc-app-classes-content-anchor-controller.mjs.map +1 -0
- package/fesm2022/ng-doc-app-classes-content-controller.mjs +299 -0
- package/fesm2022/ng-doc-app-classes-content-controller.mjs.map +1 -0
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs +51 -35
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-root-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-search-engine.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes.mjs +2 -0
- package/fesm2022/ng-doc-app-classes.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-api-list.mjs +173 -69
- package/fesm2022/ng-doc-app-components-api-list.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs +13 -10
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-code.mjs +152 -25
- package/fesm2022/ng-doc-app-components-code.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-command-palette.mjs +498 -0
- package/fesm2022/ng-doc-app-components-command-palette.mjs.map +1 -0
- package/fesm2022/ng-doc-app-components-copy-button.mjs +38 -21
- package/fesm2022/ng-doc-app-components-copy-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs +36 -29
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-pane.mjs +39 -36
- package/fesm2022/ng-doc-app-components-demo-pane.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo.mjs +129 -44
- package/fesm2022/ng-doc-app-components-demo.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs +12 -9
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs +79 -0
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs.map +1 -0
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs +54 -21
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-image-viewer.mjs +183 -89
- package/fesm2022/ng-doc-app-components-image-viewer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-kind-icon.mjs +42 -25
- package/fesm2022/ng-doc-app-components-kind-icon.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-link.mjs +12 -9
- package/fesm2022/ng-doc-app-components-link.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-members.mjs +30 -0
- package/fesm2022/ng-doc-app-components-members.mjs.map +1 -0
- package/fesm2022/ng-doc-app-components-mermaid-viewer.mjs +61 -20
- package/fesm2022/ng-doc-app-components-mermaid-viewer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-navbar.mjs +39 -49
- package/fesm2022/ng-doc-app-components-navbar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-header.mjs +73 -10
- package/fesm2022/ng-doc-app-components-page-header.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-link.mjs +123 -31
- package/fesm2022/ng-doc-app-components-page-link.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-navigation.mjs +17 -19
- package/fesm2022/ng-doc-app-components-page-navigation.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs +56 -35
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page.mjs +168 -24
- package/fesm2022/ng-doc-app-components-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-playground.mjs +392 -263
- package/fesm2022/ng-doc-app-components-playground.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-root.mjs +48 -31
- package/fesm2022/ng-doc-app-components-root.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search-result.mjs +22 -21
- package/fesm2022/ng-doc-app-components-search-result.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search.mjs +64 -33
- package/fesm2022/ng-doc-app-components-search.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-sidebar.mjs +86 -61
- package/fesm2022/ng-doc-app-components-sidebar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-tabs.mjs +18 -12
- package/fesm2022/ng-doc-app-components-tabs.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs +33 -21
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-toc.mjs +267 -90
- package/fesm2022/ng-doc-app-components-toc.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components.mjs +3 -1
- package/fesm2022/ng-doc-app-components.mjs.map +1 -1
- package/fesm2022/ng-doc-app-defaults-default-processors.mjs +2 -1
- package/fesm2022/ng-doc-app-defaults-default-processors.mjs.map +1 -1
- package/fesm2022/ng-doc-app-directives-code-highlighter.mjs +11 -5
- package/fesm2022/ng-doc-app-directives-code-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-app-directives-members-filter.mjs +276 -0
- package/fesm2022/ng-doc-app-directives-members-filter.mjs.map +1 -0
- package/fesm2022/ng-doc-app-directives-route-active.mjs +34 -30
- package/fesm2022/ng-doc-app-directives-route-active.mjs.map +1 -1
- package/fesm2022/ng-doc-app-directives.mjs +1 -0
- package/fesm2022/ng-doc-app-directives.mjs.map +1 -1
- package/fesm2022/ng-doc-app-helpers.mjs +285 -1
- package/fesm2022/ng-doc-app-helpers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-pipes-decode-uri-component.mjs +6 -4
- package/fesm2022/ng-doc-app-pipes-decode-uri-component.mjs.map +1 -1
- package/fesm2022/ng-doc-app-pipes-extract-value.mjs +6 -4
- package/fesm2022/ng-doc-app-pipes-extract-value.mjs.map +1 -1
- package/fesm2022/ng-doc-app-pipes-filter-by-text.mjs +7 -4
- package/fesm2022/ng-doc-app-pipes-filter-by-text.mjs.map +1 -1
- package/fesm2022/ng-doc-app-pipes-sanitize-html.mjs +8 -5
- package/fesm2022/ng-doc-app-pipes-sanitize-html.mjs.map +1 -1
- package/fesm2022/ng-doc-app-processors-page-processor.mjs +86 -23
- package/fesm2022/ng-doc-app-processors-page-processor.mjs.map +1 -1
- package/fesm2022/ng-doc-app-processors-processors-tooltip.mjs +26 -25
- package/fesm2022/ng-doc-app-processors-processors-tooltip.mjs.map +1 -1
- package/fesm2022/ng-doc-app-processors-processors.mjs +12 -1
- package/fesm2022/ng-doc-app-processors-processors.mjs.map +1 -1
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs +31 -2
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs +122 -0
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs.map +1 -0
- package/fesm2022/ng-doc-app-services-content-state.mjs +57 -0
- package/fesm2022/ng-doc-app-services-content-state.mjs.map +1 -0
- package/fesm2022/ng-doc-app-services-fullscreen-route.mjs +74 -0
- package/fesm2022/ng-doc-app-services-fullscreen-route.mjs.map +1 -0
- package/fesm2022/ng-doc-app-services-highlighter.mjs +83 -14
- package/fesm2022/ng-doc-app-services-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-route-preloader.mjs +360 -0
- package/fesm2022/ng-doc-app-services-route-preloader.mjs.map +1 -0
- package/fesm2022/ng-doc-app-services-shortcuts.mjs +214 -0
- package/fesm2022/ng-doc-app-services-shortcuts.mjs.map +1 -0
- package/fesm2022/ng-doc-app-services-sidebar.mjs +59 -25
- package/fesm2022/ng-doc-app-services-sidebar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-store.mjs +8 -8
- package/fesm2022/ng-doc-app-services-store.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-theme.mjs +32 -12
- package/fesm2022/ng-doc-app-services-theme.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services.mjs +143 -0
- package/fesm2022/ng-doc-app-services.mjs.map +1 -1
- package/fesm2022/ng-doc-app-tokens.mjs +7 -28
- package/fesm2022/ng-doc-app-tokens.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls-boolean-control.mjs +18 -9
- package/fesm2022/ng-doc-app-type-controls-boolean-control.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls-number-control.mjs +12 -9
- package/fesm2022/ng-doc-app-type-controls-number-control.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls-string-control.mjs +12 -9
- package/fesm2022/ng-doc-app-type-controls-string-control.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs +22 -16
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
- package/package.json +69 -28
- package/styles/global.css +1125 -201
- package/styles/main.css +1125 -201
- package/styles/themes/dark.css +78 -56
- package/types/ng-doc-app-classes-content-anchor-controller.d.ts +54 -0
- package/types/ng-doc-app-classes-content-controller.d.ts +94 -0
- package/types/ng-doc-app-classes-default-search-engine.d.ts +9 -1
- package/types/ng-doc-app-classes-root-page.d.ts +6 -1
- package/types/ng-doc-app-classes-search-engine.d.ts +5 -0
- package/types/ng-doc-app-classes.d.ts +2 -0
- package/types/ng-doc-app-components-api-list.d.ts +69 -20
- package/types/ng-doc-app-components-breadcrumb.d.ts +8 -3
- package/types/ng-doc-app-components-code.d.ts +46 -12
- package/types/ng-doc-app-components-command-palette.d.ts +147 -0
- package/types/ng-doc-app-components-copy-button.d.ts +18 -6
- package/types/ng-doc-app-components-demo-displayer.d.ts +23 -10
- package/types/ng-doc-app-components-demo-pane.d.ts +19 -15
- package/types/ng-doc-app-components-demo.d.ts +62 -15
- package/types/ng-doc-app-components-fullscreen-button.d.ts +4 -2
- package/types/ng-doc-app-components-fullscreen-toggle.d.ts +24 -0
- package/types/ng-doc-app-components-heading-anchor.d.ts +26 -7
- package/types/ng-doc-app-components-image-viewer.d.ts +71 -7
- package/types/ng-doc-app-components-kind-icon.d.ts +28 -7
- package/types/ng-doc-app-components-link.d.ts +6 -2
- package/types/ng-doc-app-components-members.d.ts +13 -0
- package/types/ng-doc-app-components-mermaid-viewer.d.ts +21 -6
- package/types/ng-doc-app-components-navbar.d.ts +25 -15
- package/types/ng-doc-app-components-page-header.d.ts +28 -4
- package/types/ng-doc-app-components-page-link.d.ts +34 -15
- package/types/ng-doc-app-components-page-navigation.d.ts +10 -5
- package/types/ng-doc-app-components-page-wrapper.d.ts +35 -11
- package/types/ng-doc-app-components-page.d.ts +57 -6
- package/types/ng-doc-app-components-playground.d.ts +146 -78
- package/types/ng-doc-app-components-root.d.ts +28 -7
- package/types/ng-doc-app-components-search-result.d.ts +14 -6
- package/types/ng-doc-app-components-search.d.ts +19 -7
- package/types/ng-doc-app-components-tabs.d.ts +13 -4
- package/types/ng-doc-app-components-theme-toggle.d.ts +18 -5
- package/types/ng-doc-app-components-toc.d.ts +76 -29
- package/types/ng-doc-app-components.d.ts +3 -1
- package/types/ng-doc-app-directives-code-highlighter.d.ts +8 -4
- package/types/ng-doc-app-directives-members-filter.d.ts +61 -0
- package/types/ng-doc-app-directives-route-active.d.ts +21 -7
- package/types/ng-doc-app-directives.d.ts +1 -0
- package/types/ng-doc-app-helpers.d.ts +124 -3
- package/types/ng-doc-app-interfaces.d.ts +48 -28
- package/types/ng-doc-app-pipes-decode-uri-component.d.ts +3 -0
- package/types/ng-doc-app-pipes-extract-value.d.ts +3 -0
- package/types/ng-doc-app-pipes-filter-by-text.d.ts +4 -0
- package/types/ng-doc-app-pipes-sanitize-html.d.ts +4 -2
- package/types/ng-doc-app-processors-page-processor.d.ts +39 -10
- package/types/ng-doc-app-processors-processors-tooltip.d.ts +11 -10
- package/types/ng-doc-app-processors-processors.d.ts +5 -1
- package/types/ng-doc-app-providers-ng-doc-app.d.ts +17 -0
- package/types/ng-doc-app-services-content-scroll-intent.d.ts +52 -0
- package/types/ng-doc-app-services-content-state.d.ts +40 -0
- package/types/ng-doc-app-services-fullscreen-route.d.ts +35 -0
- package/types/ng-doc-app-services-highlighter.d.ts +40 -5
- package/types/ng-doc-app-services-route-preloader.d.ts +109 -0
- package/types/ng-doc-app-services-shortcuts.d.ts +96 -0
- package/types/ng-doc-app-services-sidebar.d.ts +24 -4
- package/types/ng-doc-app-services-store.d.ts +24 -1
- package/types/ng-doc-app-services-theme.d.ts +19 -3
- package/types/ng-doc-app-services.d.ts +77 -0
- package/types/ng-doc-app-tokens.d.ts +10 -30
- package/types/ng-doc-app-type-controls-boolean-control.d.ts +11 -6
- package/types/ng-doc-app-type-controls-number-control.d.ts +5 -3
- package/types/ng-doc-app-type-controls-string-control.d.ts +5 -3
- package/types/ng-doc-app-type-controls-type-alias-control.d.ts +13 -6
- package/fesm2022/ng-doc-app-components-search-dialog.mjs +0 -78
- package/fesm2022/ng-doc-app-components-search-dialog.mjs.map +0 -1
- package/types/ng-doc-app-components-search-dialog.d.ts +0 -28
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, output, inject, ElementRef, ViewContainerRef, ApplicationRef, Injector, Renderer2, ErrorHandler, effect, untracked, DestroyRef, SecurityContext, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { outputFromObservable } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
5
|
import { NG_DOC_PAGE_PROCESSOR, NG_DOC_PAGE_CUSTOM_PROCESSOR } from '@ng-doc/app/tokens';
|
|
4
6
|
import { asArray } from '@ng-doc/core/helpers/as-array';
|
|
5
7
|
import { objectKeys } from '@ng-doc/core/helpers/object-keys';
|
|
8
|
+
import { Subject } from 'rxjs';
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
11
|
+
* Renders HTML into its host element and replaces the nodes that the page processors
|
|
12
|
+
* (`NG_DOC_PAGE_PROCESSOR`, `NG_DOC_PAGE_CUSTOM_PROCESSOR`) select with Angular components.
|
|
13
|
+
*
|
|
14
|
+
* Each change of the HTML or of `contentVersion` destroys the components of the previous pass
|
|
15
|
+
* and schedules a new pass for the next microtask, after the HTML is in the DOM. A pass that a
|
|
16
|
+
* newer change superseded, or that ends after the component is destroyed, emits nothing.
|
|
10
17
|
*/
|
|
11
18
|
class NgDocPageProcessorComponent {
|
|
12
19
|
constructor() {
|
|
13
|
-
|
|
14
|
-
this.
|
|
20
|
+
/** The HTML to render and process. */
|
|
21
|
+
this.html = input('', { ...(ngDevMode ? { debugName: "html" } : /* istanbul ignore next */ {}), alias: 'ngDocPageProcessor' });
|
|
22
|
+
/** Version of the HTML. A new version processes the HTML again, even when it is unchanged. */
|
|
23
|
+
this.contentVersion = input(0, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "contentVersion" }] : /* istanbul ignore next */ []));
|
|
25
|
+
/**
|
|
26
|
+
* Emits the version of a pass after its components are created and before they render, in the
|
|
27
|
+
* same task, so that a listener can reveal the content they will measure.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
this.beforeRender = output();
|
|
31
|
+
/** Emits after a pass has created its components and rendered them. */
|
|
32
|
+
this.afterRender = output();
|
|
33
|
+
/** Emits the version of each pass that completed. */
|
|
34
|
+
this.contentProcessed = output();
|
|
35
|
+
this.processingErrors = new Subject();
|
|
36
|
+
/**
|
|
37
|
+
* Emits the version and the error of a pass that a processor failed. Without a listener, the
|
|
38
|
+
* error goes to the `ErrorHandler` instead.
|
|
39
|
+
*/
|
|
40
|
+
// Built from a subject so the component can tell whether anything listens, which an
|
|
41
|
+
// `output()` does not expose.
|
|
42
|
+
this.processingError = outputFromObservable(this.processingErrors);
|
|
15
43
|
this.processors = inject(NG_DOC_PAGE_PROCESSOR, { optional: true }) ?? [];
|
|
16
44
|
this.customProcessors = inject(NG_DOC_PAGE_CUSTOM_PROCESSOR, { optional: true }) ??
|
|
17
45
|
[];
|
|
@@ -20,15 +48,56 @@ class NgDocPageProcessorComponent {
|
|
|
20
48
|
this.applicationRef = inject(ApplicationRef);
|
|
21
49
|
this.injector = inject(Injector);
|
|
22
50
|
this.renderer = inject(Renderer2);
|
|
51
|
+
this.errorHandler = inject(ErrorHandler);
|
|
52
|
+
this.sanitizer = inject(DomSanitizer);
|
|
53
|
+
this.scheduledVersion = 0;
|
|
54
|
+
this.destroyed = false;
|
|
55
|
+
effect(() => {
|
|
56
|
+
const html = this.html();
|
|
57
|
+
const version = this.contentVersion();
|
|
58
|
+
untracked(() => this.schedule(html, version));
|
|
59
|
+
});
|
|
60
|
+
inject(DestroyRef).onDestroy(() => {
|
|
61
|
+
this.destroyed = true;
|
|
62
|
+
this.scheduledVersion++;
|
|
63
|
+
this.viewContainerRef.clear();
|
|
64
|
+
});
|
|
23
65
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
66
|
+
schedule(html, version) {
|
|
67
|
+
const scheduled = ++this.scheduledVersion;
|
|
68
|
+
const unchanged = this.scheduledHtml !== undefined && this.scheduledHtml.value === html;
|
|
69
|
+
this.scheduledHtml = { value: html };
|
|
70
|
+
// Clearing destroys the components of the previous pass, and with them the nodes they
|
|
71
|
+
// replaced in the HTML.
|
|
72
|
+
this.viewContainerRef.clear();
|
|
73
|
+
if (unchanged) {
|
|
74
|
+
// A new version of the same HTML (a retry): the host binding does not write an unchanged
|
|
75
|
+
// value again, so restore the HTML here, sanitized the way the binding sanitizes it.
|
|
76
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', this.sanitizer.sanitize(SecurityContext.HTML, html) ?? '');
|
|
77
|
+
}
|
|
78
|
+
// A changed HTML is written by the host binding later in this change detection pass, so the
|
|
79
|
+
// processors run once it is done.
|
|
80
|
+
void Promise.resolve().then(() => {
|
|
81
|
+
if (this.destroyed || scheduled !== this.scheduledVersion)
|
|
82
|
+
return;
|
|
83
|
+
try {
|
|
27
84
|
asArray(this.processors, this.customProcessors).forEach(this.process.bind(this));
|
|
85
|
+
if (this.destroyed || scheduled !== this.scheduledVersion)
|
|
86
|
+
return;
|
|
87
|
+
this.beforeRender.emit(version);
|
|
28
88
|
this.applicationRef.tick();
|
|
29
89
|
this.afterRender.emit();
|
|
30
|
-
|
|
31
|
-
|
|
90
|
+
this.contentProcessed.emit(version);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
if (!this.destroyed && scheduled === this.scheduledVersion) {
|
|
94
|
+
if (this.processingErrors.observed)
|
|
95
|
+
this.processingErrors.next({ version, error });
|
|
96
|
+
else
|
|
97
|
+
this.errorHandler.handleError(error);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
32
101
|
}
|
|
33
102
|
process(processor) {
|
|
34
103
|
Array.from(this.elementRef.nativeElement.querySelectorAll(processor.selector)).forEach((elementNode) => {
|
|
@@ -52,26 +121,20 @@ class NgDocPageProcessorComponent {
|
|
|
52
121
|
}
|
|
53
122
|
});
|
|
54
123
|
}
|
|
55
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
56
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
124
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocPageProcessorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
125
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.1", type: NgDocPageProcessorComponent, isStandalone: true, selector: "[ngDocPageProcessor]", inputs: { html: { classPropertyName: "html", publicName: "ngDocPageProcessor", isSignal: true, isRequired: false, transformFunction: null }, contentVersion: { classPropertyName: "contentVersion", publicName: "contentVersion", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { beforeRender: "beforeRender", afterRender: "afterRender", contentProcessed: "contentProcessed", processingError: "processingError" }, host: { properties: { "innerHTML": "html()" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
57
126
|
}
|
|
58
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocPageProcessorComponent, decorators: [{
|
|
59
128
|
type: Component,
|
|
60
129
|
args: [{
|
|
61
130
|
selector: '[ngDocPageProcessor]',
|
|
62
|
-
standalone: true,
|
|
63
131
|
template: '<ng-content></ng-content>',
|
|
64
132
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
133
|
+
host: {
|
|
134
|
+
'[innerHTML]': 'html()',
|
|
135
|
+
},
|
|
65
136
|
}]
|
|
66
|
-
}], propDecorators: { html: [{
|
|
67
|
-
type: Input,
|
|
68
|
-
args: [{ required: true, alias: 'ngDocPageProcessor' }]
|
|
69
|
-
}, {
|
|
70
|
-
type: HostBinding,
|
|
71
|
-
args: ['innerHTML']
|
|
72
|
-
}], afterRender: [{
|
|
73
|
-
type: Output
|
|
74
|
-
}] } });
|
|
137
|
+
}], ctorParameters: () => [], propDecorators: { html: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngDocPageProcessor", required: false }] }], contentVersion: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentVersion", required: false }] }], beforeRender: [{ type: i0.Output, args: ["beforeRender"] }], afterRender: [{ type: i0.Output, args: ["afterRender"] }], contentProcessed: [{ type: i0.Output, args: ["contentProcessed"] }], processingError: [{ type: i0.Output, args: ["processingError"] }] } });
|
|
75
138
|
|
|
76
139
|
/**
|
|
77
140
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-processors-page-processor.mjs","sources":["../../../../libs/app/processors/page-processor/page-processor.component.ts","../../../../libs/app/processors/page-processor/ng-doc-app-processors-page-processor.ts"],"sourcesContent":["import {\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n ElementRef,\n EventEmitter,\n HostBinding,\n inject,\n Injector,\n Input,\n OnChanges,\n Output,\n Renderer2,\n SimpleChanges,\n ViewContainerRef,\n} from '@angular/core';\nimport { SafeHtml } from '@angular/platform-browser';\nimport { NgDocPageProcessor, NgDocProcessorOptions } from '@ng-doc/app/interfaces';\nimport { NG_DOC_PAGE_CUSTOM_PROCESSOR, NG_DOC_PAGE_PROCESSOR } from '@ng-doc/app/tokens';\nimport { asArray } from '@ng-doc/core/helpers/as-array';\nimport { objectKeys } from '@ng-doc/core/helpers/object-keys';\n\n/**\n * Base processor class to create a processor directive that will be used to replace\n * html nodes with an Angular component.\n */\n@Component({\n selector: '[ngDocPageProcessor]',\n standalone: true,\n template: '<ng-content></ng-content>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgDocPageProcessorComponent implements OnChanges {\n @Input({ required: true, alias: 'ngDocPageProcessor' })\n @HostBinding('innerHTML')\n html: SafeHtml = '';\n\n @Output()\n afterRender: EventEmitter<void> = new EventEmitter<void>();\n\n processors: Array<NgDocPageProcessor<unknown>> =\n inject<Array<NgDocPageProcessor<unknown>>>(NG_DOC_PAGE_PROCESSOR, { optional: true }) ?? [];\n customProcessors: Array<NgDocPageProcessor<unknown>> =\n inject<Array<NgDocPageProcessor<unknown>>>(NG_DOC_PAGE_CUSTOM_PROCESSOR, { optional: true }) ??\n [];\n\n protected readonly elementRef: ElementRef<HTMLElement> = inject(ElementRef);\n protected readonly viewContainerRef: ViewContainerRef = inject(ViewContainerRef);\n protected readonly applicationRef = inject(ApplicationRef);\n protected readonly injector: Injector = inject(Injector);\n protected readonly renderer: Renderer2 = inject(Renderer2);\n\n ngOnChanges({ html }: SimpleChanges): void {\n if (html) {\n Promise.resolve().then(() => {\n asArray(this.processors, this.customProcessors).forEach(this.process.bind(this));\n this.applicationRef.tick();\n this.afterRender.emit();\n });\n }\n }\n\n private process<T>(processor: NgDocPageProcessor<T>): void {\n Array.from(this.elementRef.nativeElement.querySelectorAll(processor.selector)).forEach(\n (elementNode: Element) => {\n // check if element node has a parent node because it can be removed by another processor\n if (elementNode.parentNode) {\n const replaceElement: Element =\n (processor.nodeToReplace && processor.nodeToReplace(elementNode, this.injector)) ??\n elementNode;\n const options: NgDocProcessorOptions<T> = processor.extractOptions(\n elementNode,\n this.elementRef.nativeElement,\n );\n\n // create component\n const componentRef: ComponentRef<T> = this.viewContainerRef.createComponent(\n processor.component,\n {\n projectableNodes: options.content,\n injector: this.injector,\n },\n );\n\n // set component options\n if (options.inputs) {\n objectKeys(options.inputs).forEach(\n (key: keyof T) =>\n options.inputs && componentRef.setInput(key as string, options.inputs[key]),\n );\n }\n\n // replace element node with component node\n replaceElement.parentNode?.replaceChild(\n componentRef.location.nativeElement,\n replaceElement,\n );\n\n componentRef.changeDetectorRef.markForCheck();\n }\n },\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAuBA;;;AAGG;MAOU,2BAA2B,CAAA;AANxC,IAAA,WAAA,GAAA;QASE,IAAA,CAAA,IAAI,GAAa,EAAE;AAGnB,QAAA,IAAA,CAAA,WAAW,GAAuB,IAAI,YAAY,EAAQ;AAE1D,QAAA,IAAA,CAAA,UAAU,GACR,MAAM,CAAqC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE;QAC7F,IAAA,CAAA,gBAAgB,GACd,MAAM,CAAqC,4BAA4B,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5F,YAAA,EAAE;AAEe,QAAA,IAAA,CAAA,UAAU,GAA4B,MAAM,CAAC,UAAU,CAAC;AACxD,QAAA,IAAA,CAAA,gBAAgB,GAAqB,MAAM,CAAC,gBAAgB,CAAC;AAC7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|
+
{"version":3,"file":"ng-doc-app-processors-page-processor.mjs","sources":["../../../../libs/app/processors/page-processor/page-processor.component.ts","../../../../libs/app/processors/page-processor/ng-doc-app-processors-page-processor.ts"],"sourcesContent":["import {\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n DestroyRef,\n effect,\n ElementRef,\n ErrorHandler,\n inject,\n Injector,\n input,\n output,\n OutputRef,\n Renderer2,\n SecurityContext,\n untracked,\n ViewContainerRef,\n} from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport type { NgDocContentRenderFailure } from '@ng-doc/app/classes/content-controller';\nimport type { NgDocPageProcessor, NgDocProcessorOptions } from '@ng-doc/app/interfaces';\nimport { NG_DOC_PAGE_CUSTOM_PROCESSOR, NG_DOC_PAGE_PROCESSOR } from '@ng-doc/app/tokens';\nimport { asArray } from '@ng-doc/core/helpers/as-array';\nimport { objectKeys } from '@ng-doc/core/helpers/object-keys';\nimport { Subject } from 'rxjs';\n\n/**\n * Renders HTML into its host element and replaces the nodes that the page processors\n * (`NG_DOC_PAGE_PROCESSOR`, `NG_DOC_PAGE_CUSTOM_PROCESSOR`) select with Angular components.\n *\n * Each change of the HTML or of `contentVersion` destroys the components of the previous pass\n * and schedules a new pass for the next microtask, after the HTML is in the DOM. A pass that a\n * newer change superseded, or that ends after the component is destroyed, emits nothing.\n */\n@Component({\n selector: '[ngDocPageProcessor]',\n template: '<ng-content></ng-content>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[innerHTML]': 'html()',\n },\n})\nexport class NgDocPageProcessorComponent {\n /** The HTML to render and process. */\n readonly html = input<SafeHtml>('', { alias: 'ngDocPageProcessor' });\n\n /** Version of the HTML. A new version processes the HTML again, even when it is unchanged. */\n readonly contentVersion = input(0);\n\n /**\n * Emits the version of a pass after its components are created and before they render, in the\n * same task, so that a listener can reveal the content they will measure.\n * @internal\n */\n readonly beforeRender = output<number>();\n\n /** Emits after a pass has created its components and rendered them. */\n readonly afterRender = output<void>();\n\n /** Emits the version of each pass that completed. */\n readonly contentProcessed = output<number>();\n\n private readonly processingErrors = new Subject<NgDocContentRenderFailure>();\n\n /**\n * Emits the version and the error of a pass that a processor failed. Without a listener, the\n * error goes to the `ErrorHandler` instead.\n */\n // Built from a subject so the component can tell whether anything listens, which an\n // `output()` does not expose.\n readonly processingError: OutputRef<NgDocContentRenderFailure> = outputFromObservable(\n this.processingErrors,\n );\n\n processors: Array<NgDocPageProcessor<unknown>> =\n inject<Array<NgDocPageProcessor<unknown>>>(NG_DOC_PAGE_PROCESSOR, { optional: true }) ?? [];\n customProcessors: Array<NgDocPageProcessor<unknown>> =\n inject<Array<NgDocPageProcessor<unknown>>>(NG_DOC_PAGE_CUSTOM_PROCESSOR, { optional: true }) ??\n [];\n\n protected readonly elementRef: ElementRef<HTMLElement> = inject(ElementRef);\n protected readonly viewContainerRef: ViewContainerRef = inject(ViewContainerRef);\n protected readonly applicationRef = inject(ApplicationRef);\n protected readonly injector: Injector = inject(Injector);\n protected readonly renderer: Renderer2 = inject(Renderer2);\n protected readonly errorHandler = inject(ErrorHandler);\n\n private readonly sanitizer = inject(DomSanitizer);\n private scheduledVersion = 0;\n private scheduledHtml?: { readonly value: SafeHtml };\n private destroyed = false;\n\n constructor() {\n effect(() => {\n const html = this.html();\n const version = this.contentVersion();\n\n untracked(() => this.schedule(html, version));\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.destroyed = true;\n this.scheduledVersion++;\n this.viewContainerRef.clear();\n });\n }\n\n private schedule(html: SafeHtml, version: number): void {\n const scheduled = ++this.scheduledVersion;\n const unchanged = this.scheduledHtml !== undefined && this.scheduledHtml.value === html;\n this.scheduledHtml = { value: html };\n // Clearing destroys the components of the previous pass, and with them the nodes they\n // replaced in the HTML.\n this.viewContainerRef.clear();\n if (unchanged) {\n // A new version of the same HTML (a retry): the host binding does not write an unchanged\n // value again, so restore the HTML here, sanitized the way the binding sanitizes it.\n this.renderer.setProperty(\n this.elementRef.nativeElement,\n 'innerHTML',\n this.sanitizer.sanitize(SecurityContext.HTML, html) ?? '',\n );\n }\n // A changed HTML is written by the host binding later in this change detection pass, so the\n // processors run once it is done.\n void Promise.resolve().then(() => {\n if (this.destroyed || scheduled !== this.scheduledVersion) return;\n try {\n asArray(this.processors, this.customProcessors).forEach(this.process.bind(this));\n if (this.destroyed || scheduled !== this.scheduledVersion) return;\n this.beforeRender.emit(version);\n this.applicationRef.tick();\n this.afterRender.emit();\n this.contentProcessed.emit(version);\n } catch (error) {\n if (!this.destroyed && scheduled === this.scheduledVersion) {\n if (this.processingErrors.observed) this.processingErrors.next({ version, error });\n else this.errorHandler.handleError(error);\n }\n }\n });\n }\n\n private process<T>(processor: NgDocPageProcessor<T>): void {\n Array.from(this.elementRef.nativeElement.querySelectorAll(processor.selector)).forEach(\n (elementNode: Element) => {\n // check if element node has a parent node because it can be removed by another processor\n if (elementNode.parentNode) {\n const replaceElement: Element =\n (processor.nodeToReplace && processor.nodeToReplace(elementNode, this.injector)) ??\n elementNode;\n const options: NgDocProcessorOptions<T> = processor.extractOptions(\n elementNode,\n this.elementRef.nativeElement,\n );\n\n // create component\n const componentRef: ComponentRef<T> = this.viewContainerRef.createComponent(\n processor.component,\n {\n projectableNodes: options.content,\n injector: this.injector,\n },\n );\n\n // set component options\n if (options.inputs) {\n objectKeys(options.inputs).forEach(\n (key: keyof T) =>\n options.inputs && componentRef.setInput(key as string, options.inputs[key]),\n );\n }\n\n // replace element node with component node\n replaceElement.parentNode?.replaceChild(\n componentRef.location.nativeElement,\n replaceElement,\n );\n\n componentRef.changeDetectorRef.markForCheck();\n }\n },\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AA4BA;;;;;;;AAOG;MASU,2BAA2B,CAAA;AAkDtC,IAAA,WAAA,GAAA;;QAhDS,IAAA,CAAA,IAAI,GAAG,KAAK,CAA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2
|
-
import {
|
|
2
|
+
import { input, signal, viewChild, ElementRef, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { NgDocTooltipDirective } from '@ng-doc/ui-kit';
|
|
4
4
|
|
|
5
5
|
class NgDocTooltipWrapperComponent {
|
|
6
6
|
constructor() {
|
|
7
|
-
this.
|
|
8
|
-
|
|
7
|
+
this.content = input(/* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [undefined, { debugName: "content" }] : /* istanbul ignore next */ []));
|
|
9
|
+
this.tooltipElement = signal(null, /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "tooltipElement" }] : /* istanbul ignore next */ []));
|
|
11
|
+
this.contentProjection = viewChild.required('contentProjection', { ...(ngDevMode ? { debugName: "contentProjection" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
12
|
+
// The tooltip points at the projected element, which is only in the DOM after the first
|
|
13
|
+
// render. On the server nothing opens a tooltip, so the wrapper is origin enough there.
|
|
14
|
+
afterNextRender(() => {
|
|
15
|
+
const element = this.contentProjection().nativeElement.querySelector('[ngDocTooltip]');
|
|
16
|
+
this.tooltipElement.set(element instanceof HTMLElement ? element : null);
|
|
17
|
+
});
|
|
9
18
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const element = this.contentProjection.nativeElement.querySelector('[ngDocTooltip]');
|
|
13
|
-
this.tooltipElement = element instanceof HTMLElement ? element : null;
|
|
14
|
-
this.changeDetectorRef.detectChanges();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgDocTooltipWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: NgDocTooltipWrapperComponent, isStandalone: true, selector: "ng-doc-tooltip-wrapper", inputs: { content: "content" }, viewQueries: [{ propertyName: "contentProjection", first: true, predicate: ["contentProjection"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: `
|
|
19
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocTooltipWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
20
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.1", type: NgDocTooltipWrapperComponent, isStandalone: true, selector: "ng-doc-tooltip-wrapper", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "contentProjection", first: true, predicate: ["contentProjection"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
|
|
19
21
|
<div
|
|
20
22
|
class="content-projection"
|
|
21
|
-
[ngDocTooltip]="content ?? ''"
|
|
22
|
-
[displayOrigin]="tooltipElement ?? contentProjection"
|
|
23
|
-
[pointerOrigin]="tooltipElement ?? contentProjection"
|
|
23
|
+
[ngDocTooltip]="content() ?? ''"
|
|
24
|
+
[displayOrigin]="tooltipElement() ?? contentProjection"
|
|
25
|
+
[pointerOrigin]="tooltipElement() ?? contentProjection"
|
|
24
26
|
#contentProjection>
|
|
25
27
|
<ng-content></ng-content>
|
|
26
28
|
</div>
|
|
27
29
|
`, isInline: true, styles: [".content-projection{display:unset}\n"], dependencies: [{ kind: "directive", type: NgDocTooltipDirective, selector: "[ngDocTooltip]", inputs: ["ngDocTooltip", "delay", "displayOrigin", "pointerOrigin", "positions", "canOpen", "panelClass", "minHeight", "maxHeight", "height", "minWidth", "maxWidth", "width"], outputs: ["beforeOpen", "afterOpen", "beforeClose", "afterClose"], exportAs: ["ngDocTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
28
30
|
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocTooltipWrapperComponent, decorators: [{
|
|
30
32
|
type: Component,
|
|
31
33
|
args: [{ selector: 'ng-doc-tooltip-wrapper', template: `
|
|
32
34
|
<div
|
|
33
35
|
class="content-projection"
|
|
34
|
-
[ngDocTooltip]="content ?? ''"
|
|
35
|
-
[displayOrigin]="tooltipElement ?? contentProjection"
|
|
36
|
-
[pointerOrigin]="tooltipElement ?? contentProjection"
|
|
36
|
+
[ngDocTooltip]="content() ?? ''"
|
|
37
|
+
[displayOrigin]="tooltipElement() ?? contentProjection"
|
|
38
|
+
[pointerOrigin]="tooltipElement() ?? contentProjection"
|
|
37
39
|
#contentProjection>
|
|
38
40
|
<ng-content></ng-content>
|
|
39
41
|
</div>
|
|
40
42
|
`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgDocTooltipDirective], styles: [".content-projection{display:unset}\n"] }]
|
|
41
|
-
}], ctorParameters: () => [], propDecorators: { content: [{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}] } });
|
|
43
|
+
}], ctorParameters: () => [], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], contentProjection: [{ type: i0.ViewChild, args: ['contentProjection', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
44
|
+
/**
|
|
45
|
+
* Wraps an element with an `ngDocTooltip` attribute in a component that shows the attribute's
|
|
46
|
+
* value as a tooltip.
|
|
47
|
+
*/
|
|
47
48
|
const tooltipProcessor = {
|
|
48
49
|
component: NgDocTooltipWrapperComponent,
|
|
49
50
|
selector: '[ngDocTooltip]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-processors-processors-tooltip.mjs","sources":["../../../../libs/app/processors/processors/tooltip/tooltip.processor.ts","../../../../libs/app/processors/processors/tooltip/ng-doc-app-processors-processors-tooltip.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"ng-doc-app-processors-processors-tooltip.mjs","sources":["../../../../libs/app/processors/processors/tooltip/tooltip.processor.ts","../../../../libs/app/processors/processors/tooltip/ng-doc-app-processors-processors-tooltip.ts"],"sourcesContent":["import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocTooltipDirective } from '@ng-doc/ui-kit';\n\n@Component({\n selector: 'ng-doc-tooltip-wrapper',\n template: `\n <div\n class=\"content-projection\"\n [ngDocTooltip]=\"content() ?? ''\"\n [displayOrigin]=\"tooltipElement() ?? contentProjection\"\n [pointerOrigin]=\"tooltipElement() ?? contentProjection\"\n #contentProjection>\n <ng-content></ng-content>\n </div>\n `,\n styles: [\n `\n .content-projection {\n display: unset;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgDocTooltipDirective],\n})\nclass NgDocTooltipWrapperComponent {\n readonly content = input<string>();\n\n protected readonly tooltipElement = signal<HTMLElement | null>(null);\n\n private readonly contentProjection = viewChild.required<string, ElementRef<HTMLElement>>(\n 'contentProjection',\n { read: ElementRef },\n );\n\n constructor() {\n // The tooltip points at the projected element, which is only in the DOM after the first\n // render. On the server nothing opens a tooltip, so the wrapper is origin enough there.\n afterNextRender(() => {\n const element = this.contentProjection().nativeElement.querySelector('[ngDocTooltip]');\n\n this.tooltipElement.set(element instanceof HTMLElement ? element : null);\n });\n }\n}\n\n/**\n * Wraps an element with an `ngDocTooltip` attribute in a component that shows the attribute's\n * value as a tooltip.\n */\nexport const tooltipProcessor: NgDocPageProcessor<NgDocTooltipWrapperComponent> = {\n component: NgDocTooltipWrapperComponent,\n selector: '[ngDocTooltip]',\n extractOptions: (element: Element) => ({\n inputs: {\n content: element.getAttribute('ngDocTooltip') ?? '',\n },\n content: [[element.cloneNode(true)]],\n }),\n};\n","/**\n * Generated bundle index. Do not edit.\n */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,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;AAcxB;;;AAGG;AACI,MAAM,gBAAgB,GAAqD;AAChF,IAAA,SAAS,EAAE,4BAA4B;AACvC,IAAA,QAAQ,EAAE,gBAAgB;AAC1B,IAAA,cAAc,EAAE,CAAC,OAAgB,MAAM;AACrC,QAAA,MAAM,EAAE;YACN,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,EAAE;AACpD,SAAA;QACD,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;KACrC,CAAC;;;ACnEJ;;AAEG;;;;"}
|
|
@@ -5,6 +5,7 @@ import { NgDocDemoPaneComponent } from '@ng-doc/app/components/demo-pane';
|
|
|
5
5
|
import { NgDocHeadingAnchorComponent } from '@ng-doc/app/components/heading-anchor';
|
|
6
6
|
import { Renderer2 } from '@angular/core';
|
|
7
7
|
import { NgDocImageViewerComponent } from '@ng-doc/app/components/image-viewer';
|
|
8
|
+
import { NgDocMembersComponent } from '@ng-doc/app/components/members';
|
|
8
9
|
import { NgDocMermaidViewerComponent } from '@ng-doc/app/components/mermaid-viewer';
|
|
9
10
|
import { NgDocPlaygroundComponent } from '@ng-doc/app/components/playground';
|
|
10
11
|
import { isPresent } from '@ng-doc/core/helpers/is-present';
|
|
@@ -20,6 +21,7 @@ const blockquoteProcessor = {
|
|
|
20
21
|
inputs: {
|
|
21
22
|
type: element.getAttribute('type') || 'default',
|
|
22
23
|
icon: element.getAttribute('icon') ?? undefined,
|
|
24
|
+
label: element.getAttribute('label') ?? undefined,
|
|
23
25
|
},
|
|
24
26
|
}),
|
|
25
27
|
};
|
|
@@ -98,6 +100,15 @@ const imageProcessor = {
|
|
|
98
100
|
}),
|
|
99
101
|
};
|
|
100
102
|
|
|
103
|
+
/** Adds the member filter to the members table of an API page (`<ng-doc-members>`). */
|
|
104
|
+
const membersProcessor = {
|
|
105
|
+
component: NgDocMembersComponent,
|
|
106
|
+
selector: 'ng-doc-members',
|
|
107
|
+
extractOptions: (element) => ({
|
|
108
|
+
content: [Array.from(element.childNodes)],
|
|
109
|
+
}),
|
|
110
|
+
};
|
|
111
|
+
|
|
101
112
|
const mermaidProcessor = {
|
|
102
113
|
component: NgDocMermaidViewerComponent,
|
|
103
114
|
selector: 'pre.mermaid',
|
|
@@ -156,5 +167,5 @@ const tabsProcessor = {
|
|
|
156
167
|
* Generated bundle index. Do not edit.
|
|
157
168
|
*/
|
|
158
169
|
|
|
159
|
-
export { blockquoteProcessor, codeProcessor, demoPaneProcessor, demoProcessor, headingAnchorProcessor, iconProcessor, imageProcessor, mermaidProcessor, playgroundProcessor, tabsProcessor };
|
|
170
|
+
export { blockquoteProcessor, codeProcessor, demoPaneProcessor, demoProcessor, headingAnchorProcessor, iconProcessor, imageProcessor, membersProcessor, mermaidProcessor, playgroundProcessor, tabsProcessor };
|
|
160
171
|
//# sourceMappingURL=ng-doc-app-processors-processors.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-processors-processors.mjs","sources":["../../../../libs/app/processors/processors/blockquote.processor.ts","../../../../libs/app/processors/processors/code.processor.ts","../../../../libs/app/processors/processors/demo.processor.ts","../../../../libs/app/processors/processors/demo-pane.processor.ts","../../../../libs/app/processors/processors/heading-anchor.processor.ts","../../../../libs/app/processors/processors/icon.processor.ts","../../../../libs/app/processors/processors/image.processor.ts","../../../../libs/app/processors/processors/mermaid.processor.ts","../../../../libs/app/processors/processors/playground.processor.ts","../../../../libs/app/processors/processors/tabs.processor.ts","../../../../libs/app/processors/processors/ng-doc-app-processors-processors.ts"],"sourcesContent":["import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocBlockquoteComponent, NgDocBlockquoteType } from '@ng-doc/ui-kit';\n\nexport const blockquoteProcessor: NgDocPageProcessor<NgDocBlockquoteComponent> = {\n component: NgDocBlockquoteComponent,\n selector: 'ng-doc-blockquote',\n extractOptions: (element: Element) => ({\n content: [Array.from(element.childNodes)],\n inputs: {\n type: (element.getAttribute('type') as NgDocBlockquoteType) || 'default',\n icon: element.getAttribute('icon') ?? undefined,\n },\n }),\n};\n","import { NgDocCodeComponent } from '@ng-doc/app/components/code';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const codeProcessor: NgDocPageProcessor<NgDocCodeComponent> = {\n component: NgDocCodeComponent,\n selector: 'pre code',\n nodeToReplace: (element: Element) => element.closest('pre') ?? element,\n extractOptions: (element: Element) => ({\n inputs: {\n name: element.parentElement?.getAttribute('name') || undefined,\n icon: element.parentElement?.getAttribute('icon') || undefined,\n },\n content: [[element.closest('pre') ?? element]],\n }),\n};\n","import { NgDocDemoComponent } from '@ng-doc/app/components/demo';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoProcessor: NgDocPageProcessor<NgDocDemoComponent> = {\n component: NgDocDemoComponent,\n selector: 'ng-doc-demo',\n extractOptions: (element: Element) => ({\n inputs: {\n componentName: element.getAttribute('componentName') || undefined,\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '{}'),\n },\n }),\n};\n","import { NgDocDemoPaneComponent } from '@ng-doc/app/components/demo-pane';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoPaneProcessor: NgDocPageProcessor<NgDocDemoPaneComponent> = {\n\tcomponent: NgDocDemoPaneComponent,\n\tselector: 'ng-doc-demo-pane',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\tcomponentName: element.getAttribute('componentName') || undefined,\n\t\t\toptions: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n\t\t},\n\t}),\n};\n","import { NgDocHeadingAnchorComponent } from '@ng-doc/app/components/heading-anchor';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const headingAnchorProcessor: NgDocPageProcessor<NgDocHeadingAnchorComponent> = {\n component: NgDocHeadingAnchorComponent,\n selector: 'ng-doc-heading-anchor',\n extractOptions: (element: Element) => ({\n inputs: {\n classes: element.getAttribute('class')?.split(' ') || [],\n anchor: element.getAttribute('anchor') || '',\n },\n }),\n};\n","import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocIconComponent, NgDocIconSize } from '@ng-doc/ui-kit';\n\nexport const iconProcessor: NgDocPageProcessor<NgDocIconComponent> = {\n\tcomponent: NgDocIconComponent,\n\tselector: 'ng-doc-icon',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\ticon: element.getAttribute('icon') ?? '',\n\t\t\tsize: (Number(element.getAttribute('size')) as NgDocIconSize) || 16,\n\t\t},\n\t}),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocImageViewerComponent } from '@ng-doc/app/components/image-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const imageProcessor: NgDocPageProcessor<NgDocImageViewerComponent> = {\n component: NgDocImageViewerComponent,\n selector: 'img:not([zoom=\"false\"])',\n nodeToReplace: (element: Element, injector: Injector) => {\n const renderer: Renderer2 = injector.get(Renderer2);\n const anchor: Element = renderer.createElement('div');\n\n return element.parentNode?.insertBefore(anchor, element) ?? element;\n },\n extractOptions: (element: Element) => ({\n inputs: {\n src: element.getAttribute('src') ?? '',\n alt: element.getAttribute('alt') ?? '',\n },\n content: [[element]],\n }),\n};\n","import { NgDocMermaidViewerComponent } from '@ng-doc/app/components/mermaid-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const mermaidProcessor: NgDocPageProcessor<NgDocMermaidViewerComponent> = {\n component: NgDocMermaidViewerComponent,\n selector: 'pre.mermaid',\n extractOptions: (element: Element) => ({\n inputs: {\n graph: element.textContent ?? '',\n },\n }),\n};\n","import { NgDocPlaygroundComponent } from '@ng-doc/app/components/playground';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { isPresent } from '@ng-doc/core/helpers/is-present';\n\nexport const playgroundProcessor: NgDocPageProcessor<NgDocPlaygroundComponent> = {\n component: NgDocPlaygroundComponent,\n selector: 'ng-doc-playground',\n extractOptions: (element: Element) => ({\n inputs: {\n id: element.getAttribute('id') || undefined,\n properties:\n JSON.parse(element.querySelector('#data')?.textContent?.replace(/\\n/g, '\\\\n') ?? '') ||\n undefined,\n pipeName: element.querySelector('#pipeName')?.textContent || undefined,\n selectors: (element.querySelector('#selectors')?.textContent || '')\n .split(',')\n .map((selector: string) => selector.trim())\n .filter(isPresent),\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n },\n }),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocTabsComponent } from '@ng-doc/app/components/tabs';\nimport { NgDocPageProcessor, NgDocTab } from '@ng-doc/app/interfaces';\n\nexport const tabsProcessor: NgDocPageProcessor<NgDocTabsComponent> = {\n\tcomponent: NgDocTabsComponent,\n\tselector: 'ng-doc-tab',\n\tnodeToReplace: (element: Element, injector: Injector) => {\n\t\tconst renderer: Renderer2 = injector.get(Renderer2);\n\t\tconst anchor: Element = renderer.createElement('div');\n\n\t\treturn element.parentNode?.insertBefore(anchor, element) ?? element;\n\t},\n\textractOptions: (element: Element, root: Element) => {\n\t\tconst group: string | null = element.getAttribute('group') ?? '';\n\t\tconst tabs: Element[] = Array.from(root.querySelectorAll(`ng-doc-tab[group=\"${group}\"]`));\n\t\tconst mappedTabs: NgDocTab[] = tabs.map((tab: Element) => ({\n\t\t\ttitle: tab.getAttribute('name') ?? '',\n\t\t\tcontent: tab,\n\t\t\ticon: tab.getAttribute('icon') || undefined,\n\t\t\tactive: tab.hasAttribute('active'),\n\t\t}));\n\n\t\ttabs.forEach((tab: Element) => tab.remove());\n\n\t\treturn {\n\t\t\tinputs: {\n\t\t\t\ttabs: mappedTabs,\n\t\t\t},\n\t\t};\n\t},\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAGO,MAAM,mBAAmB,GAAiD;AAC/E,IAAA,SAAS,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AE,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC;AAClC,SAAA,CAAC,CAAC;AAEH,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,GAAY,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QAE5C,OAAO;AACN,YAAA,MAAM,EAAE;AACP,gBAAA,IAAI,EAAE,UAAU;AAChB,aAAA;SACD;IACF,CAAC;;;AC9BF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-doc-app-processors-processors.mjs","sources":["../../../../libs/app/processors/processors/blockquote.processor.ts","../../../../libs/app/processors/processors/code.processor.ts","../../../../libs/app/processors/processors/demo.processor.ts","../../../../libs/app/processors/processors/demo-pane.processor.ts","../../../../libs/app/processors/processors/heading-anchor.processor.ts","../../../../libs/app/processors/processors/icon.processor.ts","../../../../libs/app/processors/processors/image.processor.ts","../../../../libs/app/processors/processors/members.processor.ts","../../../../libs/app/processors/processors/mermaid.processor.ts","../../../../libs/app/processors/processors/playground.processor.ts","../../../../libs/app/processors/processors/tabs.processor.ts","../../../../libs/app/processors/processors/ng-doc-app-processors-processors.ts"],"sourcesContent":["import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocBlockquoteComponent, NgDocBlockquoteType } from '@ng-doc/ui-kit';\n\nexport const blockquoteProcessor: NgDocPageProcessor<NgDocBlockquoteComponent> = {\n component: NgDocBlockquoteComponent,\n selector: 'ng-doc-blockquote',\n extractOptions: (element: Element) => ({\n content: [Array.from(element.childNodes)],\n inputs: {\n type: (element.getAttribute('type') as NgDocBlockquoteType) || 'default',\n icon: element.getAttribute('icon') ?? undefined,\n label: element.getAttribute('label') ?? undefined,\n },\n }),\n};\n","import { NgDocCodeComponent } from '@ng-doc/app/components/code';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const codeProcessor: NgDocPageProcessor<NgDocCodeComponent> = {\n component: NgDocCodeComponent,\n selector: 'pre code',\n nodeToReplace: (element: Element) => element.closest('pre') ?? element,\n extractOptions: (element: Element) => ({\n inputs: {\n name: element.parentElement?.getAttribute('name') || undefined,\n icon: element.parentElement?.getAttribute('icon') || undefined,\n },\n content: [[element.closest('pre') ?? element]],\n }),\n};\n","import { NgDocDemoComponent } from '@ng-doc/app/components/demo';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoProcessor: NgDocPageProcessor<NgDocDemoComponent> = {\n component: NgDocDemoComponent,\n selector: 'ng-doc-demo',\n extractOptions: (element: Element) => ({\n inputs: {\n componentName: element.getAttribute('componentName') || undefined,\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '{}'),\n },\n }),\n};\n","import { NgDocDemoPaneComponent } from '@ng-doc/app/components/demo-pane';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoPaneProcessor: NgDocPageProcessor<NgDocDemoPaneComponent> = {\n\tcomponent: NgDocDemoPaneComponent,\n\tselector: 'ng-doc-demo-pane',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\tcomponentName: element.getAttribute('componentName') || undefined,\n\t\t\toptions: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n\t\t},\n\t}),\n};\n","import { NgDocHeadingAnchorComponent } from '@ng-doc/app/components/heading-anchor';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const headingAnchorProcessor: NgDocPageProcessor<NgDocHeadingAnchorComponent> = {\n component: NgDocHeadingAnchorComponent,\n selector: 'ng-doc-heading-anchor',\n extractOptions: (element: Element) => ({\n inputs: {\n classes: element.getAttribute('class')?.split(' ') || [],\n anchor: element.getAttribute('anchor') || '',\n },\n }),\n};\n","import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocIconComponent, NgDocIconSize } from '@ng-doc/ui-kit';\n\nexport const iconProcessor: NgDocPageProcessor<NgDocIconComponent> = {\n\tcomponent: NgDocIconComponent,\n\tselector: 'ng-doc-icon',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\ticon: element.getAttribute('icon') ?? '',\n\t\t\tsize: (Number(element.getAttribute('size')) as NgDocIconSize) || 16,\n\t\t},\n\t}),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocImageViewerComponent } from '@ng-doc/app/components/image-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const imageProcessor: NgDocPageProcessor<NgDocImageViewerComponent> = {\n component: NgDocImageViewerComponent,\n selector: 'img:not([zoom=\"false\"])',\n nodeToReplace: (element: Element, injector: Injector) => {\n const renderer: Renderer2 = injector.get(Renderer2);\n const anchor: Element = renderer.createElement('div');\n\n return element.parentNode?.insertBefore(anchor, element) ?? element;\n },\n extractOptions: (element: Element) => ({\n inputs: {\n src: element.getAttribute('src') ?? '',\n alt: element.getAttribute('alt') ?? '',\n },\n content: [[element]],\n }),\n};\n","import { NgDocMembersComponent } from '@ng-doc/app/components/members';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\n/** Adds the member filter to the members table of an API page (`<ng-doc-members>`). */\nexport const membersProcessor: NgDocPageProcessor<NgDocMembersComponent> = {\n component: NgDocMembersComponent,\n selector: 'ng-doc-members',\n extractOptions: (element: Element) => ({\n content: [Array.from(element.childNodes)],\n }),\n};\n","import { NgDocMermaidViewerComponent } from '@ng-doc/app/components/mermaid-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const mermaidProcessor: NgDocPageProcessor<NgDocMermaidViewerComponent> = {\n component: NgDocMermaidViewerComponent,\n selector: 'pre.mermaid',\n extractOptions: (element: Element) => ({\n inputs: {\n graph: element.textContent ?? '',\n },\n }),\n};\n","import { NgDocPlaygroundComponent } from '@ng-doc/app/components/playground';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { isPresent } from '@ng-doc/core/helpers/is-present';\n\nexport const playgroundProcessor: NgDocPageProcessor<NgDocPlaygroundComponent> = {\n component: NgDocPlaygroundComponent,\n selector: 'ng-doc-playground',\n extractOptions: (element: Element) => ({\n inputs: {\n id: element.getAttribute('id') || undefined,\n properties:\n JSON.parse(element.querySelector('#data')?.textContent?.replace(/\\n/g, '\\\\n') ?? '') ||\n undefined,\n pipeName: element.querySelector('#pipeName')?.textContent || undefined,\n selectors: (element.querySelector('#selectors')?.textContent || '')\n .split(',')\n .map((selector: string) => selector.trim())\n .filter(isPresent),\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n },\n }),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocTabsComponent } from '@ng-doc/app/components/tabs';\nimport { NgDocPageProcessor, NgDocTab } from '@ng-doc/app/interfaces';\n\nexport const tabsProcessor: NgDocPageProcessor<NgDocTabsComponent> = {\n\tcomponent: NgDocTabsComponent,\n\tselector: 'ng-doc-tab',\n\tnodeToReplace: (element: Element, injector: Injector) => {\n\t\tconst renderer: Renderer2 = injector.get(Renderer2);\n\t\tconst anchor: Element = renderer.createElement('div');\n\n\t\treturn element.parentNode?.insertBefore(anchor, element) ?? element;\n\t},\n\textractOptions: (element: Element, root: Element) => {\n\t\tconst group: string | null = element.getAttribute('group') ?? '';\n\t\tconst tabs: Element[] = Array.from(root.querySelectorAll(`ng-doc-tab[group=\"${group}\"]`));\n\t\tconst mappedTabs: NgDocTab[] = tabs.map((tab: Element) => ({\n\t\t\ttitle: tab.getAttribute('name') ?? '',\n\t\t\tcontent: tab,\n\t\t\ticon: tab.getAttribute('icon') || undefined,\n\t\t\tactive: tab.hasAttribute('active'),\n\t\t}));\n\n\t\ttabs.forEach((tab: Element) => tab.remove());\n\n\t\treturn {\n\t\t\tinputs: {\n\t\t\t\ttabs: mappedTabs,\n\t\t\t},\n\t\t};\n\t},\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGO,MAAM,mBAAmB,GAAiD;AAC/E,IAAA,SAAS,EAAE,wBAAwB;AACnC,IAAA,QAAQ,EAAE,mBAAmB;AAC7B,IAAA,c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AM,UAAU,GAAe,IAAI,CAAC,GAAG,CAAC,CAAC,GAAY,MAAM;YAC1D,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE;AACrC,YAAA,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,SAAS;AAC3C,YAAA,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC;AAClC,SAAA,CAAC,CAAC;AAEH,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,GAAY,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QAE5C,OAAO;AACN,YAAA,MAAM,EAAE;AACP,gBAAA,IAAI,EAAE,UAAU;AAChB,aAAA;SACD;IACF,CAAC;;;AC9BF;;AAEG;;;;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { ViewportScroller } from '@angular/common';
|
|
2
|
-
import { provideAppInitializer, inject } from '@angular/core';
|
|
1
|
+
import { isPlatformBrowser, ViewportScroller } from '@angular/common';
|
|
2
|
+
import { provideAppInitializer, inject, PLATFORM_ID, DOCUMENT } from '@angular/core';
|
|
3
|
+
import { ɵcaptureNgDocHydrationSnapshots as _captureNgDocHydrationSnapshots } from '@ng-doc/app/helpers';
|
|
4
|
+
import { NgDocContentScrollIntent } from '@ng-doc/app/services/content-scroll-intent';
|
|
3
5
|
import { NgDocHighlighterService } from '@ng-doc/app/services/highlighter';
|
|
6
|
+
import { NG_DOC_SHORTCUTS, NgDocShortcutsService } from '@ng-doc/app/services/shortcuts';
|
|
7
|
+
import { NG_DOC_CONTENT_ANCHOR_SCROLLING, NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION } from '@ng-doc/app/tokens';
|
|
4
8
|
import { provideNgDocUiKitConfig } from '@ng-doc/ui-kit';
|
|
5
9
|
|
|
6
10
|
/**
|
|
@@ -9,6 +13,31 @@ import { provideNgDocUiKitConfig } from '@ng-doc/ui-kit';
|
|
|
9
13
|
*/
|
|
10
14
|
function provideNgDocApp(config) {
|
|
11
15
|
return [
|
|
16
|
+
{ provide: NG_DOC_CONTENT_ANCHOR_SCROLLING, useValue: config?.contentAnchorScrolling ?? false },
|
|
17
|
+
{
|
|
18
|
+
provide: NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION,
|
|
19
|
+
useValue: config?.contentScrollPositionRestoration ?? 'disabled',
|
|
20
|
+
},
|
|
21
|
+
...(config?.contentAnchorScrolling || config?.contentScrollPositionRestoration === 'enabled'
|
|
22
|
+
? [
|
|
23
|
+
provideAppInitializer(() => {
|
|
24
|
+
inject(NgDocContentScrollIntent).start();
|
|
25
|
+
}),
|
|
26
|
+
]
|
|
27
|
+
: []),
|
|
28
|
+
/* --- Hydration --- */
|
|
29
|
+
// Before the application renders: the pages and headers that skip hydration show their
|
|
30
|
+
// server-rendered content until their own is rendered, instead of a blank page.
|
|
31
|
+
provideAppInitializer(() => {
|
|
32
|
+
if (isPlatformBrowser(inject(PLATFORM_ID)))
|
|
33
|
+
_captureNgDocHydrationSnapshots(inject(DOCUMENT));
|
|
34
|
+
}),
|
|
35
|
+
/* --- Keyboard shortcuts --- */
|
|
36
|
+
{ provide: NG_DOC_SHORTCUTS, useValue: config?.shortcuts ?? true },
|
|
37
|
+
// Created at start-up so the built-in shortcuts work on every page.
|
|
38
|
+
provideAppInitializer(() => {
|
|
39
|
+
inject(NgDocShortcutsService);
|
|
40
|
+
}),
|
|
12
41
|
/* --- Viewport Scroller --- */
|
|
13
42
|
provideAppInitializer(() => {
|
|
14
43
|
inject(ViewportScroller).setOffset([0, 120]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-providers-ng-doc-app.mjs","sources":["../../../../libs/app/providers/ng-doc-app/provide-ng-doc-app.ts","../../../../libs/app/providers/ng-doc-app/ng-doc-app-providers-ng-doc-app.ts"],"sourcesContent":["import { ViewportScroller } from '@angular/common';\nimport {
|
|
1
|
+
{"version":3,"file":"ng-doc-app-providers-ng-doc-app.mjs","sources":["../../../../libs/app/providers/ng-doc-app/provide-ng-doc-app.ts","../../../../libs/app/providers/ng-doc-app/ng-doc-app-providers-ng-doc-app.ts"],"sourcesContent":["import { isPlatformBrowser, ViewportScroller } from '@angular/common';\nimport {\n DOCUMENT,\n EnvironmentProviders,\n inject,\n PLATFORM_ID,\n provideAppInitializer,\n Provider,\n} from '@angular/core';\nimport { ɵcaptureNgDocHydrationSnapshots } from '@ng-doc/app/helpers';\nimport { NgDocContentScrollIntent } from '@ng-doc/app/services/content-scroll-intent';\nimport type { NgDocHighlighterConfig } from '@ng-doc/app/services/highlighter';\nimport { NgDocHighlighterService } from '@ng-doc/app/services/highlighter';\nimport { NG_DOC_SHORTCUTS, NgDocShortcutsService } from '@ng-doc/app/services/shortcuts';\nimport type { NgDocContentScrollPositionRestoration } from '@ng-doc/app/tokens';\nimport {\n NG_DOC_CONTENT_ANCHOR_SCROLLING,\n NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION,\n} from '@ng-doc/app/tokens';\nimport type { NgDocUiConfig } from '@ng-doc/ui-kit';\nimport { provideNgDocUiKitConfig } from '@ng-doc/ui-kit';\n\n/**\n * NgDoc application config.\n */\nexport interface NgDocApplicationConfig {\n /**\n * Replays a router anchor scroll once asynchronous NgDoc content has been processed.\n * Enable this beside Angular router anchor scrolling.\n */\n contentAnchorScrolling?: boolean;\n /**\n * Replays a saved router position after asynchronous NgDoc content is processed.\n * Select the same intent as Angular router scroll position restoration.\n */\n contentScrollPositionRestoration?: NgDocContentScrollPositionRestoration;\n /**\n * UI Kit configuration.\n */\n uiKit?: NgDocUiConfig;\n /**\n * Shiki theme.\n */\n shiki?: NgDocHighlighterConfig;\n /**\n * Whether single-key shortcuts (slash, the square brackets, F, L and T) are on for readers who\n * have not turned them on or off themselves. Readers can always change it with the switch in\n * the search palette. Command+K (Control+K) opens the search either way. Defaults to true.\n */\n shortcuts?: boolean;\n}\n\n/**\n * Provides the NgDoc application configuration.\n * @param config - The optional application configuration.\n */\nexport function provideNgDocApp(\n config?: NgDocApplicationConfig,\n): Array<EnvironmentProviders | Provider> {\n return [\n { provide: NG_DOC_CONTENT_ANCHOR_SCROLLING, useValue: config?.contentAnchorScrolling ?? false },\n {\n provide: NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION,\n useValue: config?.contentScrollPositionRestoration ?? 'disabled',\n },\n ...(config?.contentAnchorScrolling || config?.contentScrollPositionRestoration === 'enabled'\n ? [\n provideAppInitializer(() => {\n inject(NgDocContentScrollIntent).start();\n }),\n ]\n : []),\n\n /* --- Hydration --- */\n // Before the application renders: the pages and headers that skip hydration show their\n // server-rendered content until their own is rendered, instead of a blank page.\n provideAppInitializer(() => {\n if (isPlatformBrowser(inject(PLATFORM_ID))) ɵcaptureNgDocHydrationSnapshots(inject(DOCUMENT));\n }),\n\n /* --- Keyboard shortcuts --- */\n { provide: NG_DOC_SHORTCUTS, useValue: config?.shortcuts ?? true },\n // Created at start-up so the built-in shortcuts work on every page.\n provideAppInitializer(() => {\n inject(NgDocShortcutsService);\n }),\n\n /* --- Viewport Scroller --- */\n provideAppInitializer(() => {\n inject(ViewportScroller).setOffset([0, 120]);\n }),\n\n /* --- Shiki --- */\n provideAppInitializer(async () => {\n await inject(NgDocHighlighterService).initialize(config?.shiki);\n }),\n\n /* --- UiKit --- */\n ...provideNgDocUiKitConfig(config?.uiKit),\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵcaptureNgDocHydrationSnapshots"],"mappings":";;;;;;;;;AAoDA;;;AAGG;AACG,SAAU,eAAe,CAC7B,MAA+B,EAAA;IAE/B,OAAO;QACL,EAAE,OAAO,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,EAAE,sBAAsB,IAAI,KAAK,EAAE;AAC/F,QAAA;AACE,YAAA,OAAO,EAAE,0CAA0C;AACnD,YAAA,QAAQ,EAAE,MAAM,EAAE,gCAAgC,IAAI,UAAU;AACjE,SAAA;QACD,IAAI,MAAM,EAAE,sBAAsB,IAAI,MAAM,EAAE,gCAAgC,KAAK;AACjF,cAAE;gBACE,qBAAqB,CAAC,MAAK;AACzB,oBAAA,MAAM,CAAC,wBAAwB,CAAC,CAAC,KAAK,EAAE;AAC1C,gBAAA,CAAC,CAAC;AACH;cACD,EAAE,CAAC;;;;QAKP,qBAAqB,CAAC,MAAK;AACzB,YAAA,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAAE,gBAAAA,+BAA+B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC/F,QAAA,CAAC,CAAC;;QAGF,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,IAAI,IAAI,EAAE;;QAElE,qBAAqB,CAAC,MAAK;YACzB,MAAM,CAAC,qBAAqB,CAAC;AAC/B,QAAA,CAAC,CAAC;;QAGF,qBAAqB,CAAC,MAAK;AACzB,YAAA,MAAM,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,QAAA,CAAC,CAAC;;QAGF,qBAAqB,CAAC,YAAW;YAC/B,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC;AACjE,QAAA,CAAC,CAAC;;AAGF,QAAA,GAAG,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC;KAC1C;AACH;;ACpGA;;AAEG;;;;"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, signal, DestroyRef, Service } from '@angular/core';
|
|
4
|
+
import { Router, NavigationStart, NavigationEnd, Scroll, NavigationCancel, NavigationError, NavigationSkipped } from '@angular/router';
|
|
5
|
+
|
|
6
|
+
/** Captures the public initial-navigation facts that are unavailable after component activation. */
|
|
7
|
+
class NgDocContentScrollIntent {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.browser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
10
|
+
this.router = inject(Router);
|
|
11
|
+
this.listeners = new Set();
|
|
12
|
+
this.started = false;
|
|
13
|
+
this.successful = false;
|
|
14
|
+
this.intentState = signal(undefined, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "intentState" }] : /* istanbul ignore next */ []));
|
|
16
|
+
/**
|
|
17
|
+
* The pending initial intent as a signal, the same value `subscribe()` listeners receive.
|
|
18
|
+
*/
|
|
19
|
+
this.currentIntent = this.intentState.asReadonly();
|
|
20
|
+
inject(DestroyRef).onDestroy(() => this.destroy());
|
|
21
|
+
}
|
|
22
|
+
/** Starts following router events. Does nothing on the server or when already started. */
|
|
23
|
+
start() {
|
|
24
|
+
if (this.started || !this.browser)
|
|
25
|
+
return;
|
|
26
|
+
this.started = true;
|
|
27
|
+
this.subscription = this.router.events.subscribe((event) => {
|
|
28
|
+
if (event instanceof NavigationStart)
|
|
29
|
+
this.navigationStarted(event);
|
|
30
|
+
else if (event instanceof NavigationEnd)
|
|
31
|
+
this.navigationEnded(event);
|
|
32
|
+
else if (event instanceof Scroll)
|
|
33
|
+
this.scrolled(event);
|
|
34
|
+
else if (event instanceof NavigationCancel ||
|
|
35
|
+
event instanceof NavigationError ||
|
|
36
|
+
event instanceof NavigationSkipped) {
|
|
37
|
+
if (this.candidate && event.id >= this.candidate.navigationId)
|
|
38
|
+
this.candidate = undefined;
|
|
39
|
+
if (this.intent && event.id >= this.intent.navigationId)
|
|
40
|
+
this.publish(undefined);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Calls the listener with every change of the intent, and at once with the pending one.
|
|
46
|
+
* @param listener - Receives the intent, or `undefined` once it is consumed or cancelled.
|
|
47
|
+
* @returns A function that removes the listener.
|
|
48
|
+
*/
|
|
49
|
+
subscribe(listener) {
|
|
50
|
+
this.listeners.add(listener);
|
|
51
|
+
if (this.intent)
|
|
52
|
+
listener(this.intent);
|
|
53
|
+
return () => this.listeners.delete(listener);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Consumes the current fallback after its page has either replayed or explicitly yielded it.
|
|
57
|
+
* @param navigationId - The navigation of the intent to consume.
|
|
58
|
+
*/
|
|
59
|
+
settle(navigationId) {
|
|
60
|
+
if (this.intent?.navigationId === navigationId)
|
|
61
|
+
this.publish(undefined);
|
|
62
|
+
}
|
|
63
|
+
navigationStarted(event) {
|
|
64
|
+
this.publish(undefined);
|
|
65
|
+
const navigation = this.router.currentNavigation();
|
|
66
|
+
this.candidate = {
|
|
67
|
+
navigationId: event.id,
|
|
68
|
+
eligible: !this.successful &&
|
|
69
|
+
event.navigationTrigger === 'imperative' &&
|
|
70
|
+
event.restoredState == null &&
|
|
71
|
+
navigation?.id === event.id &&
|
|
72
|
+
navigation.previousNavigation === null &&
|
|
73
|
+
navigation.extras.scroll !== 'manual',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
navigationEnded(event) {
|
|
77
|
+
const candidate = this.candidate;
|
|
78
|
+
this.candidate = undefined;
|
|
79
|
+
this.successful = true;
|
|
80
|
+
if (!candidate?.eligible || candidate.navigationId !== event.id)
|
|
81
|
+
return;
|
|
82
|
+
const anchor = this.router.parseUrl(event.urlAfterRedirects).fragment;
|
|
83
|
+
if (anchor) {
|
|
84
|
+
this.publish({ anchor, navigationId: event.id, url: event.urlAfterRedirects });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
scrolled(event) {
|
|
88
|
+
if (this.intent && event.routerEvent.id >= this.intent.navigationId)
|
|
89
|
+
this.publish(undefined);
|
|
90
|
+
if (this.candidate && event.routerEvent.id >= this.candidate.navigationId) {
|
|
91
|
+
this.candidate = undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
publish(intent) {
|
|
95
|
+
if (this.intent === intent)
|
|
96
|
+
return;
|
|
97
|
+
this.intent = intent;
|
|
98
|
+
this.intentState.set(intent);
|
|
99
|
+
for (const listener of [...this.listeners])
|
|
100
|
+
listener(intent);
|
|
101
|
+
}
|
|
102
|
+
destroy() {
|
|
103
|
+
this.subscription?.unsubscribe();
|
|
104
|
+
this.subscription = undefined;
|
|
105
|
+
this.candidate = undefined;
|
|
106
|
+
this.intent = undefined;
|
|
107
|
+
this.intentState.set(undefined);
|
|
108
|
+
this.listeners.clear();
|
|
109
|
+
}
|
|
110
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocContentScrollIntent, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
|
|
111
|
+
static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.2.1", ngImport: i0, type: NgDocContentScrollIntent }); }
|
|
112
|
+
}
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocContentScrollIntent, decorators: [{
|
|
114
|
+
type: Service
|
|
115
|
+
}], ctorParameters: () => [] });
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Generated bundle index. Do not edit.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export { NgDocContentScrollIntent };
|
|
122
|
+
//# sourceMappingURL=ng-doc-app-services-content-scroll-intent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-doc-app-services-content-scroll-intent.mjs","sources":["../../../../libs/app/services/content-scroll-intent/content-scroll-intent.service.ts","../../../../libs/app/services/content-scroll-intent/ng-doc-app-services-content-scroll-intent.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, inject, PLATFORM_ID, Service, Signal, signal } from '@angular/core';\nimport {\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationSkipped,\n NavigationStart,\n Router,\n Scroll,\n} from '@angular/router';\nimport { Subscription } from 'rxjs';\n\n/** The fragment of the application's first navigation, kept until a page replays or drops it. */\nexport interface NgDocInitialContentScrollIntent {\n /** The decoded fragment of the navigation. */\n readonly anchor: string;\n /** Id of the navigation that produced the fragment. */\n readonly navigationId: number;\n /** The URL after redirects. */\n readonly url: string;\n}\n\n/** Captures the public initial-navigation facts that are unavailable after component activation. */\n@Service()\nexport class NgDocContentScrollIntent {\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly router = inject(Router);\n private candidate?: { eligible: boolean; navigationId: number };\n private intent?: NgDocInitialContentScrollIntent;\n private readonly listeners = new Set<\n (intent: NgDocInitialContentScrollIntent | undefined) => void\n >();\n private started = false;\n private successful = false;\n private subscription?: Subscription;\n private readonly intentState = signal<NgDocInitialContentScrollIntent | undefined>(undefined);\n\n /**\n * The pending initial intent as a signal, the same value `subscribe()` listeners receive.\n */\n readonly currentIntent: Signal<NgDocInitialContentScrollIntent | undefined> =\n this.intentState.asReadonly();\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.destroy());\n }\n\n /** Starts following router events. Does nothing on the server or when already started. */\n start(): void {\n if (this.started || !this.browser) return;\n this.started = true;\n this.subscription = this.router.events.subscribe((event) => {\n if (event instanceof NavigationStart) this.navigationStarted(event);\n else if (event instanceof NavigationEnd) this.navigationEnded(event);\n else if (event instanceof Scroll) this.scrolled(event);\n else if (\n event instanceof NavigationCancel ||\n event instanceof NavigationError ||\n event instanceof NavigationSkipped\n ) {\n if (this.candidate && event.id >= this.candidate.navigationId) this.candidate = undefined;\n if (this.intent && event.id >= this.intent.navigationId) this.publish(undefined);\n }\n });\n }\n\n /**\n * Calls the listener with every change of the intent, and at once with the pending one.\n * @param listener - Receives the intent, or `undefined` once it is consumed or cancelled.\n * @returns A function that removes the listener.\n */\n subscribe(listener: (intent: NgDocInitialContentScrollIntent | undefined) => void): () => void {\n this.listeners.add(listener);\n if (this.intent) listener(this.intent);\n return () => this.listeners.delete(listener);\n }\n\n /**\n * Consumes the current fallback after its page has either replayed or explicitly yielded it.\n * @param navigationId - The navigation of the intent to consume.\n */\n settle(navigationId: number): void {\n if (this.intent?.navigationId === navigationId) this.publish(undefined);\n }\n\n private navigationStarted(event: NavigationStart): void {\n this.publish(undefined);\n const navigation = this.router.currentNavigation();\n this.candidate = {\n navigationId: event.id,\n eligible:\n !this.successful &&\n event.navigationTrigger === 'imperative' &&\n event.restoredState == null &&\n navigation?.id === event.id &&\n navigation.previousNavigation === null &&\n navigation.extras.scroll !== 'manual',\n };\n }\n\n private navigationEnded(event: NavigationEnd): void {\n const candidate = this.candidate;\n this.candidate = undefined;\n this.successful = true;\n if (!candidate?.eligible || candidate.navigationId !== event.id) return;\n const anchor = this.router.parseUrl(event.urlAfterRedirects).fragment;\n if (anchor) {\n this.publish({ anchor, navigationId: event.id, url: event.urlAfterRedirects });\n }\n }\n\n private scrolled(event: Scroll): void {\n if (this.intent && event.routerEvent.id >= this.intent.navigationId) this.publish(undefined);\n if (this.candidate && event.routerEvent.id >= this.candidate.navigationId) {\n this.candidate = undefined;\n }\n }\n\n private publish(intent: NgDocInitialContentScrollIntent | undefined): void {\n if (this.intent === intent) return;\n this.intent = intent;\n this.intentState.set(intent);\n for (const listener of [...this.listeners]) listener(intent);\n }\n\n private destroy(): void {\n this.subscription?.unsubscribe();\n this.subscription = undefined;\n this.candidate = undefined;\n this.intent = undefined;\n this.intentState.set(undefined);\n this.listeners.clear();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAuBA;MAEa,wBAAwB,CAAA;AAmBnC,IAAA,WAAA,GAAA;QAlBiB,IAAA,CAAA,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAChD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAGvB,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,GAAG,EAEjC;QACK,IAAA,CAAA,OAAO,GAAG,KAAK;QAC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