@ng-doc/app 22.0.0-beta.2 → 22.1.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-frame.mjs +96 -0
- package/fesm2022/ng-doc-app-components-demo-frame.mjs.map +1 -0
- 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 +175 -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 +477 -286
- 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 +35 -11
- 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 +4 -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-demo-app.mjs +176 -0
- package/fesm2022/ng-doc-app-demo-app.mjs.map +1 -0
- 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 +307 -2
- 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 +42 -10
- 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-providers-title.mjs +129 -0
- package/fesm2022/ng-doc-app-providers-title.mjs.map +1 -0
- package/fesm2022/ng-doc-app-providers.mjs +1 -0
- package/fesm2022/ng-doc-app-providers.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 +90 -17
- package/fesm2022/ng-doc-app-services-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-route-preloader.mjs +384 -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 +59 -18
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
- package/package.json +82 -28
- package/styles/global.css +1128 -201
- package/styles/main.css +1128 -201
- package/styles/themes/dark.css +88 -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 +14 -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-frame.d.ts +48 -0
- package/types/ng-doc-app-components-demo-pane.d.ts +19 -15
- package/types/ng-doc-app-components-demo.d.ts +80 -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 +167 -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 +24 -5
- 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 +4 -1
- package/types/ng-doc-app-demo-app.d.ts +89 -0
- 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 +142 -3
- package/types/ng-doc-app-interfaces.d.ts +62 -31
- 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 +10 -1
- package/types/ng-doc-app-providers-ng-doc-app.d.ts +18 -1
- package/types/ng-doc-app-providers-title.d.ts +59 -0
- package/types/ng-doc-app-providers.d.ts +1 -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 +47 -5
- package/types/ng-doc-app-services-route-preloader.d.ts +121 -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 +35 -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,6 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Pipe } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Decodes a URI component, and returns the value unchanged when it is not a valid encoding.
|
|
6
|
+
*/
|
|
4
7
|
class NgDocDecodeUriComponentPipe {
|
|
5
8
|
transform(value) {
|
|
6
9
|
try {
|
|
@@ -10,14 +13,13 @@ class NgDocDecodeUriComponentPipe {
|
|
|
10
13
|
return value;
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
14
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.
|
|
16
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDecodeUriComponentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
17
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.2.1", ngImport: i0, type: NgDocDecodeUriComponentPipe, isStandalone: true, name: "decodeUriComponent" }); }
|
|
15
18
|
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDecodeUriComponentPipe, decorators: [{
|
|
17
20
|
type: Pipe,
|
|
18
21
|
args: [{
|
|
19
22
|
name: 'decodeUriComponent',
|
|
20
|
-
standalone: true,
|
|
21
23
|
}]
|
|
22
24
|
}] });
|
|
23
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-pipes-decode-uri-component.mjs","sources":["../../../../libs/app/pipes/decode-uri-component/decode-uri-component.pipe.ts","../../../../libs/app/pipes/decode-uri-component/ng-doc-app-pipes-decode-uri-component.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'decodeUriComponent',\n
|
|
1
|
+
{"version":3,"file":"ng-doc-app-pipes-decode-uri-component.mjs","sources":["../../../../libs/app/pipes/decode-uri-component/decode-uri-component.pipe.ts","../../../../libs/app/pipes/decode-uri-component/ng-doc-app-pipes-decode-uri-component.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Decodes a URI component, and returns the value unchanged when it is not a valid encoding.\n */\n@Pipe({\n name: 'decodeUriComponent',\n})\nexport class NgDocDecodeUriComponentPipe implements PipeTransform {\n transform(value: string): string {\n try {\n return decodeURIComponent(value);\n } catch {\n return value;\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;AAEG;MAIU,2BAA2B,CAAA;AACtC,IAAA,SAAS,CAAC,KAAa,EAAA;AACrB,QAAA,IAAI;AACF,YAAA,OAAO,kBAAkB,CAAC,KAAK,CAAC;QAClC;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,KAAK;QACd;IACF;8GAPW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4GAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,oBAAA,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAHvC,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,oBAAoB;AAC3B,iBAAA;;;ACPD;;AAEG;;;;"}
|
|
@@ -2,18 +2,20 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Pipe } from '@angular/core';
|
|
3
3
|
import { extractValue } from '@ng-doc/core/helpers/extract-value';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Parses the string form of a value (for example a default value of a playground property).
|
|
7
|
+
*/
|
|
5
8
|
class NgDocExtractValuePipe {
|
|
6
9
|
transform(value) {
|
|
7
10
|
return extractValue(value);
|
|
8
11
|
}
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
10
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocExtractValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
13
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.2.1", ngImport: i0, type: NgDocExtractValuePipe, isStandalone: true, name: "ngDocExtractValue" }); }
|
|
11
14
|
}
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocExtractValuePipe, decorators: [{
|
|
13
16
|
type: Pipe,
|
|
14
17
|
args: [{
|
|
15
18
|
name: 'ngDocExtractValue',
|
|
16
|
-
standalone: true,
|
|
17
19
|
}]
|
|
18
20
|
}] });
|
|
19
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-pipes-extract-value.mjs","sources":["../../../../libs/app/pipes/extract-value/extract-value.pipe.ts","../../../../libs/app/pipes/extract-value/ng-doc-app-pipes-extract-value.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { extractValue } from '@ng-doc/core/helpers/extract-value';\nimport { NgDocExtractedValue } from '@ng-doc/core/types/extracted-value';\n\n@Pipe({\n
|
|
1
|
+
{"version":3,"file":"ng-doc-app-pipes-extract-value.mjs","sources":["../../../../libs/app/pipes/extract-value/extract-value.pipe.ts","../../../../libs/app/pipes/extract-value/ng-doc-app-pipes-extract-value.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { extractValue } from '@ng-doc/core/helpers/extract-value';\nimport { NgDocExtractedValue } from '@ng-doc/core/types/extracted-value';\n\n/**\n * Parses the string form of a value (for example a default value of a playground property).\n */\n@Pipe({\n name: 'ngDocExtractValue',\n})\nexport class NgDocExtractValuePipe implements PipeTransform {\n transform(value: string): NgDocExtractedValue {\n return extractValue(value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAIA;;AAEG;MAIU,qBAAqB,CAAA;AAChC,IAAA,SAAS,CAAC,KAAa,EAAA;AACrB,QAAA,OAAO,YAAY,CAAC,KAAK,CAAC;IAC5B;8GAHW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4GAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,mBAAA,EAAA,CAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,mBAAmB;AAC1B,iBAAA;;;ACTD;;AAEG;;;;"}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Pipe } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Keeps the items that match a search term. By default an item matches when its string form
|
|
6
|
+
* equals the term.
|
|
7
|
+
*/
|
|
4
8
|
class NgDocFilterByTextPipe {
|
|
5
9
|
transform(items, searchTerm, matcher = (item, s) => String(item) === s) {
|
|
6
10
|
return items?.filter((item) => matcher(item, searchTerm)) ?? [];
|
|
7
11
|
}
|
|
8
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
9
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocFilterByTextPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
13
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.2.1", ngImport: i0, type: NgDocFilterByTextPipe, isStandalone: true, name: "ngDocFilterByText" }); }
|
|
10
14
|
}
|
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocFilterByTextPipe, decorators: [{
|
|
12
16
|
type: Pipe,
|
|
13
17
|
args: [{
|
|
14
18
|
name: 'ngDocFilterByText',
|
|
15
|
-
standalone: true,
|
|
16
19
|
}]
|
|
17
20
|
}] });
|
|
18
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-pipes-filter-by-text.mjs","sources":["../../../../libs/app/pipes/filter-by-text/filter-by-text.pipe.ts","../../../../libs/app/pipes/filter-by-text/ng-doc-app-pipes-filter-by-text.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n
|
|
1
|
+
{"version":3,"file":"ng-doc-app-pipes-filter-by-text.mjs","sources":["../../../../libs/app/pipes/filter-by-text/filter-by-text.pipe.ts","../../../../libs/app/pipes/filter-by-text/ng-doc-app-pipes-filter-by-text.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Keeps the items that match a search term. By default an item matches when its string form\n * equals the term.\n */\n@Pipe({\n name: 'ngDocFilterByText',\n})\nexport class NgDocFilterByTextPipe<T> implements PipeTransform {\n transform(\n items: readonly T[],\n searchTerm: string,\n matcher: (item: T, searchTerm: string) => boolean = (item: T, s: string) => String(item) === s,\n ): readonly T[] {\n return items?.filter((item: T) => matcher(item, searchTerm)) ?? [];\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;AAGG;MAIU,qBAAqB,CAAA;AAChC,IAAA,SAAS,CACP,KAAmB,EACnB,UAAkB,EAClB,OAAA,GAAoD,CAAC,IAAO,EAAE,CAAS,KAAK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAA;AAE9F,QAAA,OAAO,KAAK,EAAE,MAAM,CAAC,CAAC,IAAO,KAAK,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE;IACpE;8GAPW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4GAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,mBAAA,EAAA,CAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,mBAAmB;AAC1B,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -2,6 +2,10 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, Pipe } from '@angular/core';
|
|
3
3
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Marks HTML as trusted, so it can be bound to `innerHTML` without sanitization. Use it only for
|
|
7
|
+
* HTML that NgDoc generated.
|
|
8
|
+
*/
|
|
5
9
|
class NgDocSanitizeHtmlPipe {
|
|
6
10
|
constructor() {
|
|
7
11
|
this.sanitizer = inject(DomSanitizer);
|
|
@@ -9,16 +13,15 @@ class NgDocSanitizeHtmlPipe {
|
|
|
9
13
|
transform(value) {
|
|
10
14
|
return this.sanitizer.bypassSecurityTrustHtml(value);
|
|
11
15
|
}
|
|
12
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
13
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.
|
|
16
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocSanitizeHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
17
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.2.1", ngImport: i0, type: NgDocSanitizeHtmlPipe, isStandalone: true, name: "ngDocSanitizeHtml" }); }
|
|
14
18
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocSanitizeHtmlPipe, decorators: [{
|
|
16
20
|
type: Pipe,
|
|
17
21
|
args: [{
|
|
18
22
|
name: 'ngDocSanitizeHtml',
|
|
19
|
-
standalone: true,
|
|
20
23
|
}]
|
|
21
|
-
}]
|
|
24
|
+
}] });
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-pipes-sanitize-html.mjs","sources":["../../../../libs/app/pipes/sanitize-html/sanitize-html.pipe.ts","../../../../libs/app/pipes/sanitize-html/ng-doc-app-pipes-sanitize-html.ts"],"sourcesContent":["import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\n\n@Pipe({\n name: 'ngDocSanitizeHtml',\n
|
|
1
|
+
{"version":3,"file":"ng-doc-app-pipes-sanitize-html.mjs","sources":["../../../../libs/app/pipes/sanitize-html/sanitize-html.pipe.ts","../../../../libs/app/pipes/sanitize-html/ng-doc-app-pipes-sanitize-html.ts"],"sourcesContent":["import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\n\n/**\n * Marks HTML as trusted, so it can be bound to `innerHTML` without sanitization. Use it only for\n * HTML that NgDoc generated.\n */\n@Pipe({\n name: 'ngDocSanitizeHtml',\n})\nexport class NgDocSanitizeHtmlPipe implements PipeTransform {\n private readonly sanitizer = inject(DomSanitizer);\n\n transform(value: string): SafeHtml {\n return this.sanitizer.bypassSecurityTrustHtml(value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;;AAGG;MAIU,qBAAqB,CAAA;AAHlC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;AAKlD,IAAA;AAHC,IAAA,SAAS,CAAC,KAAa,EAAA;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC;IACtD;8GALW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4GAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,mBAAA,EAAA,CAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,mBAAmB;AAC1B,iBAAA;;;ACTD;;AAEG;;;;"}
|
|
@@ -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,IA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EE,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,oBAAoB,EAAE;;sBACrD,WAAW;uBAAC,WAAW;;sBAGvB;;;ACtCH;;AAEG;;;;"}
|
|
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 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 * Gener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C/C,oBAAA,IAAI,EAAE;AACJ,wBAAA,aAAa,EAAE,QAAQ;AACxB,qBAAA;AACF,iBAAA;;;AC3CD;;AAEG;;;;"}
|
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
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 */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAYA,MAsBM,4BAA4B,CAAA;AAUhC,IAAA,WAAA,GAAA;AATS,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK;+FAAU;QAEf,IAAA,CAAA,cAAc,GAAG,MAAM,CAAqB,IAAI;2FAAC;QAEnD,IAAA,CAAA,iBAAiB,GAAG,SAAS,CAAC,QAAQ,CACrD,mBAAmB,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,8BAAA,EAAA,CAAA,EACjB,IAAI,EAAE,UAAU,EAAA,CACnB;;;QAKC,eAAe,CAAC,MAAK;AACnB,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC,aAAa,CAAC,aAAa,CAAC,gBAAgB,CAAC;AAEtF,YAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,YAAY,WAAW,GAAG,OAAO,GAAG,IAAI,CAAC;AAC1E,QAAA,CAAC,CAAC;IACJ;8GAlBI,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA5B,4BAA4B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,WAAA,EAAA,CAAA,EAAA,YAAA,EAAA,mBAAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EA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A,EAAA,iBAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,mBAAmB,EAAA,EAAA,GACnB,EAAE,IAAI,EAAE,UAAU,EAAE,EAAA,QAAA,EAAA,IAAA,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',
|
|
@@ -126,6 +137,11 @@ const playgroundProcessor = {
|
|
|
126
137
|
}),
|
|
127
138
|
};
|
|
128
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Turns the `<ng-doc-tab group="…" name="…">` elements of a page into tabs: every tab of a group
|
|
142
|
+
* becomes one `NgDocTabsComponent`, where the first tab of the group was. Code groups are made of
|
|
143
|
+
* them, and Markdown can wrap any content in them.
|
|
144
|
+
*/
|
|
129
145
|
const tabsProcessor = {
|
|
130
146
|
component: NgDocTabsComponent,
|
|
131
147
|
selector: 'ng-doc-tab',
|
|
@@ -136,17 +152,33 @@ const tabsProcessor = {
|
|
|
136
152
|
},
|
|
137
153
|
extractOptions: (element, root) => {
|
|
138
154
|
const group = element.getAttribute('group') ?? '';
|
|
139
|
-
const tabs = Array.from(root.querySelectorAll(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
tabs
|
|
155
|
+
const tabs = Array.from(root.querySelectorAll('ng-doc-tab')).filter((tab) => (tab.getAttribute('group') ?? '') === group);
|
|
156
|
+
if (!tabs.includes(element)) {
|
|
157
|
+
tabs.unshift(element);
|
|
158
|
+
}
|
|
159
|
+
// The tabs stay on the page until the component first renders (`NgDocTabsComponent`), so
|
|
160
|
+
// the processors after this one, the page's own included, still reach their content. The
|
|
161
|
+
// page processor skips elements that have left the page, so the other tabs of the group are
|
|
162
|
+
// swapped for copies that hold their content: otherwise each would get tabs of its own.
|
|
163
|
+
const contents = tabs.map((tab) => {
|
|
164
|
+
if (tab === element || !tab.parentNode) {
|
|
165
|
+
return tab;
|
|
166
|
+
}
|
|
167
|
+
const copy = tab.cloneNode(false);
|
|
168
|
+
while (tab.firstChild) {
|
|
169
|
+
copy.appendChild(tab.firstChild);
|
|
170
|
+
}
|
|
171
|
+
tab.parentNode.replaceChild(copy, tab);
|
|
172
|
+
return copy;
|
|
173
|
+
});
|
|
147
174
|
return {
|
|
148
175
|
inputs: {
|
|
149
|
-
tabs:
|
|
176
|
+
tabs: tabs.map((tab, index) => ({
|
|
177
|
+
title: tab.getAttribute('name') ?? '',
|
|
178
|
+
content: contents[index],
|
|
179
|
+
icon: tab.getAttribute('icon') || undefined,
|
|
180
|
+
active: tab.hasAttribute('active'),
|
|
181
|
+
})),
|
|
150
182
|
},
|
|
151
183
|
};
|
|
152
184
|
},
|
|
@@ -156,5 +188,5 @@ const tabsProcessor = {
|
|
|
156
188
|
* Generated bundle index. Do not edit.
|
|
157
189
|
*/
|
|
158
190
|
|
|
159
|
-
export { blockquoteProcessor, codeProcessor, demoPaneProcessor, demoProcessor, headingAnchorProcessor, iconProcessor, imageProcessor, mermaidProcessor, playgroundProcessor, tabsProcessor };
|
|
191
|
+
export { blockquoteProcessor, codeProcessor, demoPaneProcessor, demoProcessor, headingAnchorProcessor, iconProcessor, imageProcessor, membersProcessor, mermaidProcessor, playgroundProcessor, tabsProcessor };
|
|
160
192
|
//# sourceMappingURL=ng-doc-app-processors-processors.mjs.map
|