@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,15 +1,19 @@
|
|
|
1
1
|
export * from '@ng-doc/app/components/api-list';
|
|
2
2
|
export * from '@ng-doc/app/components/breadcrumb';
|
|
3
3
|
export * from '@ng-doc/app/components/code';
|
|
4
|
+
export * from '@ng-doc/app/components/command-palette';
|
|
4
5
|
export * from '@ng-doc/app/components/copy-button';
|
|
5
6
|
export * from '@ng-doc/app/components/demo';
|
|
6
7
|
export * from '@ng-doc/app/components/demo-displayer';
|
|
8
|
+
export * from '@ng-doc/app/components/demo-frame';
|
|
7
9
|
export * from '@ng-doc/app/components/demo-pane';
|
|
8
10
|
export * from '@ng-doc/app/components/fullscreen-button';
|
|
11
|
+
export * from '@ng-doc/app/components/fullscreen-toggle';
|
|
9
12
|
export * from '@ng-doc/app/components/heading-anchor';
|
|
10
13
|
export * from '@ng-doc/app/components/image-viewer';
|
|
11
14
|
export * from '@ng-doc/app/components/kind-icon';
|
|
12
15
|
export * from '@ng-doc/app/components/link';
|
|
16
|
+
export * from '@ng-doc/app/components/members';
|
|
13
17
|
export * from '@ng-doc/app/components/mermaid-viewer';
|
|
14
18
|
export * from '@ng-doc/app/components/navbar';
|
|
15
19
|
export * from '@ng-doc/app/components/page';
|
|
@@ -20,7 +24,6 @@ export * from '@ng-doc/app/components/page-wrapper';
|
|
|
20
24
|
export * from '@ng-doc/app/components/playground';
|
|
21
25
|
export * from '@ng-doc/app/components/root';
|
|
22
26
|
export * from '@ng-doc/app/components/search';
|
|
23
|
-
export * from '@ng-doc/app/components/search-dialog';
|
|
24
27
|
export * from '@ng-doc/app/components/search-result';
|
|
25
28
|
export * from '@ng-doc/app/components/sidebar';
|
|
26
29
|
export * from '@ng-doc/app/components/tabs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components.mjs","sources":["../../../../libs/app/components/ng-doc-app-components.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components.mjs","sources":["../../../../libs/app/components/ng-doc-app-components.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { linkProcessor, iconProcessor, headingAnchorProcessor, blockquoteProcessor, tooltipProcessor, mermaidProcessor, codeProcessor, demoProcessor, demoPaneProcessor, playgroundProcessor, tabsProcessor, imageProcessor } from '@ng-doc/app/processors/processors';
|
|
1
|
+
import { linkProcessor, iconProcessor, headingAnchorProcessor, blockquoteProcessor, tooltipProcessor, mermaidProcessor, codeProcessor, demoProcessor, demoPaneProcessor, playgroundProcessor, tabsProcessor, imageProcessor, membersProcessor } from '@ng-doc/app/processors/processors';
|
|
2
2
|
|
|
3
3
|
const NG_DOC_DEFAULT_PAGE_PROCESSORS = [
|
|
4
4
|
/**
|
|
@@ -17,6 +17,7 @@ const NG_DOC_DEFAULT_PAGE_PROCESSORS = [
|
|
|
17
17
|
playgroundProcessor,
|
|
18
18
|
tabsProcessor,
|
|
19
19
|
imageProcessor,
|
|
20
|
+
membersProcessor,
|
|
20
21
|
];
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-defaults-default-processors.mjs","sources":["../../../../libs/app/defaults/default-processors/default-processors.ts","../../../../libs/app/defaults/default-processors/ng-doc-app-defaults-default-processors.ts"],"sourcesContent":["import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport {\n blockquoteProcessor,\n codeProcessor,\n demoPaneProcessor,\n demoProcessor,\n headingAnchorProcessor,\n iconProcessor,\n imageProcessor,\n linkProcessor,\n mermaidProcessor,\n playgroundProcessor,\n tabsProcessor,\n tooltipProcessor,\n} from '@ng-doc/app/processors/processors';\n\nexport const NG_DOC_DEFAULT_PAGE_PROCESSORS: NgDocPageProcessor[] = [\n /**\n * The order of the directives is important.\n * The higher the directive is in the list, the earlier it will be run.\n */\n linkProcessor,\n iconProcessor,\n headingAnchorProcessor,\n blockquoteProcessor,\n tooltipProcessor,\n mermaidProcessor,\n codeProcessor,\n demoProcessor,\n demoPaneProcessor,\n playgroundProcessor,\n tabsProcessor,\n imageProcessor,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ng-doc-app-defaults-default-processors.mjs","sources":["../../../../libs/app/defaults/default-processors/default-processors.ts","../../../../libs/app/defaults/default-processors/ng-doc-app-defaults-default-processors.ts"],"sourcesContent":["import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport {\n blockquoteProcessor,\n codeProcessor,\n demoPaneProcessor,\n demoProcessor,\n headingAnchorProcessor,\n iconProcessor,\n imageProcessor,\n linkProcessor,\n membersProcessor,\n mermaidProcessor,\n playgroundProcessor,\n tabsProcessor,\n tooltipProcessor,\n} from '@ng-doc/app/processors/processors';\n\nexport const NG_DOC_DEFAULT_PAGE_PROCESSORS: NgDocPageProcessor[] = [\n /**\n * The order of the directives is important.\n * The higher the directive is in the list, the earlier it will be run.\n */\n linkProcessor,\n iconProcessor,\n headingAnchorProcessor,\n blockquoteProcessor,\n tooltipProcessor,\n mermaidProcessor,\n codeProcessor,\n demoProcessor,\n demoPaneProcessor,\n playgroundProcessor,\n tabsProcessor,\n imageProcessor,\n membersProcessor,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAiBO,MAAM,8BAA8B,GAAyB;AAClE;;;AAGG;IACH,aAAa;IACb,aAAa;IACb,sBAAsB;IACtB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,mBAAmB;IACnB,aAAa;IACb,cAAc;IACd,gBAAgB;;;AClClB;;AAEG;;;;"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { isPlatformBrowser, NgComponentOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, DOCUMENT, DestroyRef, ElementRef, ChangeDetectionStrategy, Component, provideZoneChangeDetection, provideZonelessChangeDetection } from '@angular/core';
|
|
4
|
+
import { RouterOutlet, ActivatedRoute, provideRouter } from '@angular/router';
|
|
5
|
+
import { NG_DOC_STORE_THEME_KEY } from '@ng-doc/app/constants';
|
|
6
|
+
import { provideClientHydration, withNoIncrementalHydration } from '@angular/platform-browser';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The `source` of every message the demo application sends to the page that embeds it.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
const ɵNG_DOC_DEMO_MESSAGE_SOURCE = 'ng-doc-demo';
|
|
13
|
+
/**
|
|
14
|
+
* Whether a message is a size message of the demo application.
|
|
15
|
+
* @param value - The data of a `message` event.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
function ɵisNgDocDemoSizeMessage(value) {
|
|
19
|
+
const message = value;
|
|
20
|
+
return (typeof message === 'object' &&
|
|
21
|
+
message !== null &&
|
|
22
|
+
message.source === ɵNG_DOC_DEMO_MESSAGE_SOURCE &&
|
|
23
|
+
message.version === 1 &&
|
|
24
|
+
message.type === 'size' &&
|
|
25
|
+
typeof message.height === 'number' &&
|
|
26
|
+
Number.isFinite(message.height) &&
|
|
27
|
+
message.height >= 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The root of the demo application, which shows one demo per page with only Angular and that
|
|
32
|
+
* demo loaded. In an iframe it reports the height of its content to the page that embeds it (a
|
|
33
|
+
* `ResizeObserver` on its border box), and it follows the theme the reader picks on the
|
|
34
|
+
* documentation site, which stores it in `localStorage`.
|
|
35
|
+
*/
|
|
36
|
+
class NgDocDemoAppComponent {
|
|
37
|
+
constructor() {
|
|
38
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
39
|
+
return;
|
|
40
|
+
const document = inject(DOCUMENT);
|
|
41
|
+
const window = document.defaultView;
|
|
42
|
+
const destroyRef = inject(DestroyRef);
|
|
43
|
+
if (!window)
|
|
44
|
+
return;
|
|
45
|
+
if (window.parent !== window) {
|
|
46
|
+
const host = inject(ElementRef).nativeElement;
|
|
47
|
+
let reported = -1;
|
|
48
|
+
const observer = new ResizeObserver(() => {
|
|
49
|
+
const height = Math.ceil(host.getBoundingClientRect().height);
|
|
50
|
+
if (height === reported)
|
|
51
|
+
return;
|
|
52
|
+
reported = height;
|
|
53
|
+
const message = {
|
|
54
|
+
source: ɵNG_DOC_DEMO_MESSAGE_SOURCE,
|
|
55
|
+
version: 1,
|
|
56
|
+
type: 'size',
|
|
57
|
+
height,
|
|
58
|
+
};
|
|
59
|
+
// Only a page of the same origin may receive it: the demo pages are part of the site.
|
|
60
|
+
window.parent.postMessage(message, window.location.origin);
|
|
61
|
+
});
|
|
62
|
+
observer.observe(host, { box: 'border-box' });
|
|
63
|
+
destroyRef.onDestroy(() => observer.disconnect());
|
|
64
|
+
}
|
|
65
|
+
// The documentation page and the demo page share the origin, so a theme the reader picks
|
|
66
|
+
// reaches this page as a storage event. An empty id is the light theme, as in the restore
|
|
67
|
+
// script that applies the stored theme before the application starts.
|
|
68
|
+
const onStorage = (event) => {
|
|
69
|
+
if (event.key !== NG_DOC_STORE_THEME_KEY || event.newValue === null)
|
|
70
|
+
return;
|
|
71
|
+
if (event.newValue) {
|
|
72
|
+
document.documentElement.setAttribute('data-theme', event.newValue);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
document.documentElement.removeAttribute('data-theme');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
window.addEventListener('storage', onStorage);
|
|
79
|
+
destroyRef.onDestroy(() => window.removeEventListener('storage', onStorage));
|
|
80
|
+
}
|
|
81
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoAppComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
82
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.1", type: NgDocDemoAppComponent, isStandalone: true, selector: "ng-doc-demo-app", ngImport: i0, template: '<router-outlet />', isInline: true, styles: [":host{display:flow-root}\n"], dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoAppComponent, decorators: [{
|
|
85
|
+
type: Component,
|
|
86
|
+
args: [{ selector: 'ng-doc-demo-app', imports: [RouterOutlet], template: '<router-outlet />', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flow-root}\n"] }]
|
|
87
|
+
}], ctorParameters: () => [] });
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Shows the demo of a demo page: the component in the route's `ngDocDemo` data, with the inputs
|
|
91
|
+
* of the `inputs` query parameter (the JSON of the `inputs` option of the `demo` action).
|
|
92
|
+
*
|
|
93
|
+
* The demo application hydrates its server-rendered page, but not the demo: a demo is the user's
|
|
94
|
+
* component and need not be hydration-safe, and the server renders it without the inputs of the
|
|
95
|
+
* query, which only the browser has. So the host skips hydration, as documentation pages do for
|
|
96
|
+
* their content, and the browser renders the demo again.
|
|
97
|
+
*/
|
|
98
|
+
class NgDocDemoHostComponent {
|
|
99
|
+
constructor() {
|
|
100
|
+
this.route = inject(ActivatedRoute);
|
|
101
|
+
/** The demo component, or undefined on the page of a demo that does not exist. */
|
|
102
|
+
this.demo = this.route.snapshot.data['ngDocDemo'];
|
|
103
|
+
/** The inputs of the demo. */
|
|
104
|
+
this.inputs = demoInputs(this.route.snapshot.queryParamMap.get('inputs'));
|
|
105
|
+
}
|
|
106
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
107
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocDemoHostComponent, isStandalone: true, selector: "ng-doc-demo-host", host: { attributes: { "ngSkipHydration": "true" } }, ngImport: i0, template: `
|
|
108
|
+
@if (demo) {
|
|
109
|
+
<ng-container *ngComponentOutlet="demo; inputs: inputs" />
|
|
110
|
+
} @else {
|
|
111
|
+
<p role="alert">This demo does not exist.</p>
|
|
112
|
+
}
|
|
113
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
114
|
+
}
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoHostComponent, decorators: [{
|
|
116
|
+
type: Component,
|
|
117
|
+
args: [{
|
|
118
|
+
selector: 'ng-doc-demo-host',
|
|
119
|
+
imports: [NgComponentOutlet],
|
|
120
|
+
template: `
|
|
121
|
+
@if (demo) {
|
|
122
|
+
<ng-container *ngComponentOutlet="demo; inputs: inputs" />
|
|
123
|
+
} @else {
|
|
124
|
+
<p role="alert">This demo does not exist.</p>
|
|
125
|
+
}
|
|
126
|
+
`,
|
|
127
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
128
|
+
host: { ngSkipHydration: 'true' },
|
|
129
|
+
}]
|
|
130
|
+
}] });
|
|
131
|
+
/**
|
|
132
|
+
* The inputs of the `inputs` query parameter: a JSON object, or none.
|
|
133
|
+
* @param value - The parameter.
|
|
134
|
+
*/
|
|
135
|
+
function demoInputs(value) {
|
|
136
|
+
if (!value)
|
|
137
|
+
return {};
|
|
138
|
+
try {
|
|
139
|
+
const parsed = JSON.parse(value);
|
|
140
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
141
|
+
? parsed
|
|
142
|
+
: {};
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return {};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The configuration of the demo application: change detection, the router with the demo pages
|
|
151
|
+
* (and a page for unknown demos), hydration, and the providers of `demoProviders`. The generated entries of
|
|
152
|
+
* the demo application bootstrap `NgDocDemoAppComponent` with it, in the browser and on the server.
|
|
153
|
+
* @param routes - The generated demo routes.
|
|
154
|
+
* @param demoProviders - The generated import of the `demoProviders` module, if any.
|
|
155
|
+
* @param options - How the application starts.
|
|
156
|
+
* @internal
|
|
157
|
+
*/
|
|
158
|
+
async function ɵngDocDemoApplicationConfig(routes, demoProviders, options = {}) {
|
|
159
|
+
const providers = demoProviders ? (await demoProviders()).default : [];
|
|
160
|
+
return {
|
|
161
|
+
providers: [
|
|
162
|
+
options.zone ? provideZoneChangeDetection() : provideZonelessChangeDetection(),
|
|
163
|
+
...(options.hydration ? [provideClientHydration(withNoIncrementalHydration())] : []),
|
|
164
|
+
provideRouter([...routes, { path: '**', component: NgDocDemoHostComponent }]),
|
|
165
|
+
...providers,
|
|
166
|
+
...(options.providers ?? []),
|
|
167
|
+
],
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Generated bundle index. Do not edit.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
export { NgDocDemoAppComponent, NgDocDemoHostComponent, ɵNG_DOC_DEMO_MESSAGE_SOURCE, ɵisNgDocDemoSizeMessage, ɵngDocDemoApplicationConfig };
|
|
176
|
+
//# sourceMappingURL=ng-doc-app-demo-app.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-doc-app-demo-app.mjs","sources":["../../../../libs/app/demo-app/demo-message.ts","../../../../libs/app/demo-app/demo-app.component.ts","../../../../libs/app/demo-app/demo-host.component.ts","../../../../libs/app/demo-app/demo-application.ts","../../../../libs/app/demo-app/ng-doc-app-demo-app.ts"],"sourcesContent":["/**\n * The `source` of every message the demo application sends to the page that embeds it.\n * @internal\n */\nexport const ɵNG_DOC_DEMO_MESSAGE_SOURCE = 'ng-doc-demo';\n\n/**\n * The message an isolated demo sends to the page that shows it in an iframe whenever the height\n * of its content changes, so that the iframe takes that height.\n * @internal\n */\nexport interface ɵNgDocDemoSizeMessage {\n readonly source: typeof ɵNG_DOC_DEMO_MESSAGE_SOURCE;\n readonly version: 1;\n readonly type: 'size';\n /** The height of the demo's content, in CSS pixels, rounded up. */\n readonly height: number;\n}\n\n/**\n * Whether a message is a size message of the demo application.\n * @param value - The data of a `message` event.\n * @internal\n */\nexport function ɵisNgDocDemoSizeMessage(value: unknown): value is ɵNgDocDemoSizeMessage {\n const message = value as Partial<ɵNgDocDemoSizeMessage> | null;\n return (\n typeof message === 'object' &&\n message !== null &&\n message.source === ɵNG_DOC_DEMO_MESSAGE_SOURCE &&\n message.version === 1 &&\n message.type === 'size' &&\n typeof message.height === 'number' &&\n Number.isFinite(message.height) &&\n message.height >= 0\n );\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n DOCUMENT,\n ElementRef,\n inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport { NG_DOC_STORE_THEME_KEY } from '@ng-doc/app/constants';\n\nimport { ɵNG_DOC_DEMO_MESSAGE_SOURCE, ɵNgDocDemoSizeMessage } from './demo-message';\n\n/**\n * The root of the demo application, which shows one demo per page with only Angular and that\n * demo loaded. In an iframe it reports the height of its content to the page that embeds it (a\n * `ResizeObserver` on its border box), and it follows the theme the reader picks on the\n * documentation site, which stores it in `localStorage`.\n */\n@Component({\n selector: 'ng-doc-demo-app',\n imports: [RouterOutlet],\n template: '<router-outlet />',\n // `flow-root`: the margins of the demo stay inside the measured box.\n styles: ':host { display: flow-root; }',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgDocDemoAppComponent {\n constructor() {\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n const document = inject(DOCUMENT);\n const window = document.defaultView;\n const destroyRef = inject(DestroyRef);\n\n if (!window) return;\n if (window.parent !== window) {\n const host: HTMLElement = inject(ElementRef).nativeElement;\n let reported = -1;\n const observer = new ResizeObserver(() => {\n const height = Math.ceil(host.getBoundingClientRect().height);\n\n if (height === reported) return;\n reported = height;\n const message: ɵNgDocDemoSizeMessage = {\n source: ɵNG_DOC_DEMO_MESSAGE_SOURCE,\n version: 1,\n type: 'size',\n height,\n };\n // Only a page of the same origin may receive it: the demo pages are part of the site.\n window.parent.postMessage(message, window.location.origin);\n });\n\n observer.observe(host, { box: 'border-box' });\n destroyRef.onDestroy(() => observer.disconnect());\n }\n\n // The documentation page and the demo page share the origin, so a theme the reader picks\n // reaches this page as a storage event. An empty id is the light theme, as in the restore\n // script that applies the stored theme before the application starts.\n const onStorage = (event: StorageEvent) => {\n if (event.key !== NG_DOC_STORE_THEME_KEY || event.newValue === null) return;\n if (event.newValue) {\n document.documentElement.setAttribute('data-theme', event.newValue);\n } else {\n document.documentElement.removeAttribute('data-theme');\n }\n };\n\n window.addEventListener('storage', onStorage);\n destroyRef.onDestroy(() => window.removeEventListener('storage', onStorage));\n }\n}\n","import { NgComponentOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject, Type } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\n\n/**\n * Shows the demo of a demo page: the component in the route's `ngDocDemo` data, with the inputs\n * of the `inputs` query parameter (the JSON of the `inputs` option of the `demo` action).\n *\n * The demo application hydrates its server-rendered page, but not the demo: a demo is the user's\n * component and need not be hydration-safe, and the server renders it without the inputs of the\n * query, which only the browser has. So the host skips hydration, as documentation pages do for\n * their content, and the browser renders the demo again.\n */\n@Component({\n selector: 'ng-doc-demo-host',\n imports: [NgComponentOutlet],\n template: `\n @if (demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: inputs\" />\n } @else {\n <p role=\"alert\">This demo does not exist.</p>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { ngSkipHydration: 'true' },\n})\nexport class NgDocDemoHostComponent {\n private readonly route = inject(ActivatedRoute);\n\n /** The demo component, or undefined on the page of a demo that does not exist. */\n protected readonly demo: Type<unknown> | undefined = this.route.snapshot.data['ngDocDemo'];\n\n /** The inputs of the demo. */\n protected readonly inputs: Record<string, unknown> = demoInputs(\n this.route.snapshot.queryParamMap.get('inputs'),\n );\n}\n\n/**\n * The inputs of the `inputs` query parameter: a JSON object, or none.\n * @param value - The parameter.\n */\nfunction demoInputs(value: string | null): Record<string, unknown> {\n if (!value) return {};\n try {\n const parsed: unknown = JSON.parse(value);\n\n return parsed && typeof parsed === 'object' && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n","import {\n ApplicationConfig,\n EnvironmentProviders,\n Provider,\n provideZoneChangeDetection,\n provideZonelessChangeDetection,\n} from '@angular/core';\nimport { provideClientHydration, withNoIncrementalHydration } from '@angular/platform-browser';\nimport { provideRouter, Routes } from '@angular/router';\nimport type { NgDocDemoProvidersImport } from '@ng-doc/core/interfaces';\n\nimport { NgDocDemoHostComponent } from './demo-host.component';\n\n/**\n * How the demo application starts.\n * @internal\n */\nexport interface ɵNgDocDemoApplicationOptions {\n /** Change detection with zone.js, when the application's polyfills load it. */\n readonly zone?: boolean;\n /**\n * Hydration of the server-rendered page: always on the server, which then writes the hydration\n * data, and in the browser only for a page the server rendered (a page without it, such as the\n * page of a demo that failed to prerender or the development server's, has nothing to hydrate).\n */\n readonly hydration?: boolean;\n /** Providers added after the others, for example server rendering. */\n readonly providers?: Array<Provider | EnvironmentProviders>;\n}\n\n/**\n * The configuration of the demo application: change detection, the router with the demo pages\n * (and a page for unknown demos), hydration, and the providers of `demoProviders`. The generated entries of\n * the demo application bootstrap `NgDocDemoAppComponent` with it, in the browser and on the server.\n * @param routes - The generated demo routes.\n * @param demoProviders - The generated import of the `demoProviders` module, if any.\n * @param options - How the application starts.\n * @internal\n */\nexport async function ɵngDocDemoApplicationConfig(\n routes: Routes,\n demoProviders: NgDocDemoProvidersImport | undefined,\n options: ɵNgDocDemoApplicationOptions = {},\n): Promise<ApplicationConfig> {\n const providers = demoProviders ? (await demoProviders()).default : [];\n\n return {\n providers: [\n options.zone ? provideZoneChangeDetection() : provideZonelessChangeDetection(),\n ...(options.hydration ? [provideClientHydration(withNoIncrementalHydration())] : []),\n provideRouter([...routes, { path: '**', component: NgDocDemoHostComponent }]),\n ...providers,\n ...(options.providers ?? []),\n ],\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -3,28 +3,34 @@ import { input, inject, ElementRef, computed, Directive } from '@angular/core';
|
|
|
3
3
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
4
|
import { NgDocHighlighterService } from '@ng-doc/app/services';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Renders the given Angular HTML code, highlighted by `NgDocHighlighterService`, into its host
|
|
8
|
+
* element.
|
|
9
|
+
*/
|
|
6
10
|
class NgDocCodeHighlighterDirective {
|
|
7
11
|
constructor() {
|
|
12
|
+
/** The code to highlight. */
|
|
8
13
|
this.code = input.required({ ...(ngDevMode ? { debugName: "code" } : /* istanbul ignore next */ {}), alias: 'ngDocHighlighter' });
|
|
9
14
|
this.element = inject((ElementRef)).nativeElement;
|
|
10
15
|
this.highlighter = inject(NgDocHighlighterService);
|
|
11
16
|
this.sanitizer = inject(DomSanitizer);
|
|
17
|
+
// `highlight` reads the highlighter's `ready` signal, so the code is highlighted again once
|
|
18
|
+
// Shiki has loaded.
|
|
12
19
|
this.highlightedCode = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.highlighter.highlight(this.code())), /* @ts-ignore */
|
|
13
20
|
...(ngDevMode ? [{ debugName: "highlightedCode" }] : /* istanbul ignore next */ []));
|
|
14
21
|
}
|
|
15
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
16
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
22
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocCodeHighlighterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
23
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: NgDocCodeHighlighterDirective, isStandalone: true, selector: "[ngDocHighlighter]", inputs: { code: { classPropertyName: "code", publicName: "ngDocHighlighter", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "innerHTML": "highlightedCode()" } }, ngImport: i0 }); }
|
|
17
24
|
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocCodeHighlighterDirective, decorators: [{
|
|
19
26
|
type: Directive,
|
|
20
27
|
args: [{
|
|
21
28
|
selector: '[ngDocHighlighter]',
|
|
22
|
-
standalone: true,
|
|
23
29
|
host: {
|
|
24
30
|
'[innerHTML]': 'highlightedCode()',
|
|
25
31
|
},
|
|
26
32
|
}]
|
|
27
|
-
}],
|
|
33
|
+
}], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngDocHighlighter", required: true }] }] } });
|
|
28
34
|
|
|
29
35
|
/**
|
|
30
36
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-directives-code-highlighter.mjs","sources":["../../../../libs/app/directives/code-highlighter/code-highlighter.directive.ts","../../../../libs/app/directives/code-highlighter/ng-doc-app-directives-code-highlighter.ts"],"sourcesContent":["import { computed, Directive, ElementRef, inject, input, Signal } from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { NgDocHighlighterService } from '@ng-doc/app/services';\n\n@Directive({\n selector: '[ngDocHighlighter]',\n
|
|
1
|
+
{"version":3,"file":"ng-doc-app-directives-code-highlighter.mjs","sources":["../../../../libs/app/directives/code-highlighter/code-highlighter.directive.ts","../../../../libs/app/directives/code-highlighter/ng-doc-app-directives-code-highlighter.ts"],"sourcesContent":["import { computed, Directive, ElementRef, inject, input, Signal } from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { NgDocHighlighterService } from '@ng-doc/app/services';\n\n/**\n * Renders the given Angular HTML code, highlighted by `NgDocHighlighterService`, into its host\n * element.\n */\n@Directive({\n selector: '[ngDocHighlighter]',\n host: {\n '[innerHTML]': 'highlightedCode()',\n },\n})\nexport class NgDocCodeHighlighterDirective {\n /** The code to highlight. */\n readonly code = input.required<string>({ alias: 'ngDocHighlighter' });\n\n protected readonly element = inject(ElementRef<HTMLElement>).nativeElement;\n protected readonly highlighter = inject(NgDocHighlighterService);\n protected readonly sanitizer = inject(DomSanitizer);\n\n // `highlight` reads the highlighter's `ready` signal, so the code is highlighted again once\n // Shiki has loaded.\n protected readonly highlightedCode: Signal<SafeHtml> = computed(() =>\n this.sanitizer.bypassSecurityTrustHtml(this.highlighter.highlight(this.code())),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIA;;;AAGG;MAOU,6BAA6B,CAAA;AAN1C,IAAA,WAAA,GAAA;;QAQW,IAAA,CAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,2EAAW,KAAK,EAAE,kBAAkB,EAAA,CAAG;QAElD,IAAA,CAAA,OAAO,GAAG,MAAM,EAAC,UAAuB,EAAC,CAAC,aAAa;AACvD,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC7C,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;;;QAIhC,IAAA,CAAA,eAAe,GAAqB,QAAQ,CAAC,MAC9D,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;4FAChF;AACF,IAAA;8GAbY,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA7B,6BAA6B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,WAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBANzC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,IAAI,EAAE;AACJ,wBAAA,aAAa,EAAE,mBAAmB;AACnC,qBAAA;AACF,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, Injector, signal, DestroyRef, NgZone, DOCUMENT, afterNextRender, untracked, createComponent, EnvironmentInjector, ApplicationRef, Directive } from '@angular/core';
|
|
3
|
+
import { NgDocShortcutsService } from '@ng-doc/app/services/shortcuts';
|
|
4
|
+
import { NgDocSelectionHostDirective, NgDocSelectionComponent } from '@ng-doc/ui-kit/components/selection';
|
|
5
|
+
|
|
6
|
+
const TAB = '[data-ng-doc-members-tab]';
|
|
7
|
+
const FILTER = 'input[data-ng-doc-members-filter]';
|
|
8
|
+
const MEMBER = '.ng-doc-member[data-group]';
|
|
9
|
+
const GROUP = '.ng-doc-members-group[data-group]';
|
|
10
|
+
const EXPAND = '.ng-doc-member-expand[aria-controls]';
|
|
11
|
+
const COUNT = '.ng-doc-members-count';
|
|
12
|
+
const EMPTY = '.ng-doc-members-empty';
|
|
13
|
+
const ALL = 'all';
|
|
14
|
+
const INHERITED = 'inherited';
|
|
15
|
+
/**
|
|
16
|
+
* Adds the member tabs, the name filter and the expandable method rows to the members table of
|
|
17
|
+
* an API page. The page renders every member, so the table reads well without it (on the server
|
|
18
|
+
* and before hydration); the directive only hides rows.
|
|
19
|
+
*
|
|
20
|
+
* It reads this markup inside its host: tab buttons with a data-ng-doc-members-tab attribute
|
|
21
|
+
* ("all", "inherited" or a group name, each with an optional .ng-doc-members-count), a text input
|
|
22
|
+
* with a data-ng-doc-members-filter attribute, group rows (.ng-doc-members-group with data-group)
|
|
23
|
+
* and member rows (.ng-doc-member with data-group, data-name and, for inherited members,
|
|
24
|
+
* data-inherited). A .ng-doc-member-expand button in a member row shows and hides the detail row
|
|
25
|
+
* its aria-controls names, and an optional .ng-doc-members-empty element shows when no member
|
|
26
|
+
* matches. F focuses the filter while single-key shortcuts are on.
|
|
27
|
+
*
|
|
28
|
+
* In the browser it inserts an `ng-doc-selection` as the first child of the row of tabs, the
|
|
29
|
+
* highlight that slides to the selected tab as in the code-block tabs. Until it is placed, the
|
|
30
|
+
* selected tab draws its own background, so the server-rendered page looks the same.
|
|
31
|
+
*/
|
|
32
|
+
class NgDocMembersFilterDirective {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.host = inject(ElementRef).nativeElement;
|
|
35
|
+
// The tabs are plain HTML, so no element can carry ngDocSelectionOrigin: the directive selects
|
|
36
|
+
// the tab on the host of the highlight itself.
|
|
37
|
+
this.selectionInjector = Injector.create({
|
|
38
|
+
providers: [NgDocSelectionHostDirective],
|
|
39
|
+
parent: inject(Injector),
|
|
40
|
+
});
|
|
41
|
+
this.selection = this.selectionInjector.get(NgDocSelectionHostDirective);
|
|
42
|
+
this.selectedTab = signal(ALL, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "selectedTab" }] : /* istanbul ignore next */ []));
|
|
44
|
+
this.filterQuery = signal('', /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "filterQuery" }] : /* istanbul ignore next */ []));
|
|
46
|
+
this.ready = false;
|
|
47
|
+
/** The selected tab: "all", "inherited" or a group name. */
|
|
48
|
+
this.tab = this.selectedTab.asReadonly();
|
|
49
|
+
/** The text the member names are filtered by. */
|
|
50
|
+
this.query = this.filterQuery.asReadonly();
|
|
51
|
+
const destroyRef = inject(DestroyRef);
|
|
52
|
+
const ngZone = inject(NgZone);
|
|
53
|
+
const window = inject(DOCUMENT).defaultView;
|
|
54
|
+
const removeShortcut = inject(NgDocShortcutsService).register({
|
|
55
|
+
key: 'f',
|
|
56
|
+
handler: () => this.host.querySelector(FILTER)?.focus(),
|
|
57
|
+
});
|
|
58
|
+
destroyRef.onDestroy(removeShortcut);
|
|
59
|
+
// The markup is rendered by the page, so the directive only starts working in the browser.
|
|
60
|
+
afterNextRender(() => {
|
|
61
|
+
this.ready = true;
|
|
62
|
+
// The counts change the width of the tabs, so they are final before the highlight measures.
|
|
63
|
+
this.countTabs();
|
|
64
|
+
const highlight = this.createHighlight();
|
|
65
|
+
destroyRef.onDestroy(() => {
|
|
66
|
+
highlight?.destroy();
|
|
67
|
+
highlight?.location.nativeElement.remove();
|
|
68
|
+
});
|
|
69
|
+
const selected = this.tabs().find((tab) => tab.getAttribute('aria-selected') === 'true');
|
|
70
|
+
this.select(selected?.dataset['ngDocMembersTab'] ?? ALL);
|
|
71
|
+
// Rows of tabs that scroll inside themselves fade on the edge that still hides tabs.
|
|
72
|
+
const fade = () => this.fade();
|
|
73
|
+
const onScroll = (event) => {
|
|
74
|
+
if (event.target instanceof Element && event.target.querySelector(TAB)) {
|
|
75
|
+
this.fade();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
ngZone.runOutsideAngular(() => {
|
|
79
|
+
this.host.addEventListener('scroll', onScroll, true);
|
|
80
|
+
window?.addEventListener('resize', fade);
|
|
81
|
+
});
|
|
82
|
+
destroyRef.onDestroy(() => {
|
|
83
|
+
this.host.removeEventListener('scroll', onScroll, true);
|
|
84
|
+
window?.removeEventListener('resize', fade);
|
|
85
|
+
});
|
|
86
|
+
this.fade();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Shows the members of a tab.
|
|
91
|
+
* @param tab - "all", "inherited" or a group name.
|
|
92
|
+
*/
|
|
93
|
+
select(tab) {
|
|
94
|
+
untracked(() => {
|
|
95
|
+
this.selectedTab.set(tab);
|
|
96
|
+
const button = this.tabs().find((candidate) => candidate.dataset['ngDocMembersTab'] === tab);
|
|
97
|
+
for (const candidate of this.tabs()) {
|
|
98
|
+
candidate.setAttribute('aria-selected', String(candidate === button));
|
|
99
|
+
candidate.tabIndex = candidate === button ? 0 : -1;
|
|
100
|
+
}
|
|
101
|
+
this.selection.select(button);
|
|
102
|
+
this.apply();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Shows the members whose name contains the text.
|
|
107
|
+
* @param query - The text; case is ignored.
|
|
108
|
+
*/
|
|
109
|
+
filter(query) {
|
|
110
|
+
untracked(() => {
|
|
111
|
+
this.filterQuery.set(query);
|
|
112
|
+
const input = this.host.querySelector(FILTER);
|
|
113
|
+
if (input && input.value !== query) {
|
|
114
|
+
input.value = query;
|
|
115
|
+
}
|
|
116
|
+
this.apply();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
onClick(event) {
|
|
120
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
121
|
+
const tab = target?.closest(TAB);
|
|
122
|
+
const expand = target?.closest(EXPAND);
|
|
123
|
+
if (tab && this.host.contains(tab) && !tab.hasAttribute('disabled')) {
|
|
124
|
+
this.select(tab.dataset['ngDocMembersTab'] ?? ALL);
|
|
125
|
+
}
|
|
126
|
+
else if (expand && this.host.contains(expand)) {
|
|
127
|
+
expand.setAttribute('aria-expanded', String(expand.getAttribute('aria-expanded') !== 'true'));
|
|
128
|
+
this.apply();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
onInput(event) {
|
|
132
|
+
if (event.target instanceof HTMLInputElement && event.target.matches(FILTER)) {
|
|
133
|
+
this.filter(event.target.value);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
onKeydown(event) {
|
|
137
|
+
const tab = event.target instanceof Element ? event.target.closest(TAB) : null;
|
|
138
|
+
if (!tab) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const tabs = this.tabs().filter((button) => !button.hasAttribute('disabled'));
|
|
142
|
+
const index = tabs.indexOf(tab);
|
|
143
|
+
const next = event.key === 'ArrowRight'
|
|
144
|
+
? tabs[(index + 1) % tabs.length]
|
|
145
|
+
: event.key === 'ArrowLeft'
|
|
146
|
+
? tabs[(index - 1 + tabs.length) % tabs.length]
|
|
147
|
+
: event.key === 'Home'
|
|
148
|
+
? tabs[0]
|
|
149
|
+
: event.key === 'End'
|
|
150
|
+
? tabs[tabs.length - 1]
|
|
151
|
+
: undefined;
|
|
152
|
+
if (next) {
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
next.focus();
|
|
155
|
+
this.select(next.dataset['ngDocMembersTab'] ?? ALL);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Inserts the highlight of the selected tab into the row of tabs. It is the same component as in
|
|
160
|
+
* the code-block tabs, so it measures, follows resizes and animates the same way; the row is its
|
|
161
|
+
* offset parent, so it scrolls with the tabs.
|
|
162
|
+
*/
|
|
163
|
+
createHighlight() {
|
|
164
|
+
const row = this.tabs()[0]?.parentElement;
|
|
165
|
+
if (!row) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const hostElement = this.host.ownerDocument.createElement('ng-doc-selection');
|
|
169
|
+
row.prepend(hostElement);
|
|
170
|
+
const highlight = createComponent(NgDocSelectionComponent, {
|
|
171
|
+
environmentInjector: this.selectionInjector.get(EnvironmentInjector),
|
|
172
|
+
elementInjector: this.selectionInjector,
|
|
173
|
+
hostElement,
|
|
174
|
+
});
|
|
175
|
+
highlight.setInput('align', null);
|
|
176
|
+
this.selectionInjector.get(ApplicationRef).attachView(highlight.hostView);
|
|
177
|
+
return highlight;
|
|
178
|
+
}
|
|
179
|
+
tabs() {
|
|
180
|
+
return Array.from(this.host.querySelectorAll(TAB));
|
|
181
|
+
}
|
|
182
|
+
members() {
|
|
183
|
+
return Array.from(this.host.querySelectorAll(MEMBER));
|
|
184
|
+
}
|
|
185
|
+
countTabs() {
|
|
186
|
+
const members = this.members();
|
|
187
|
+
for (const button of this.tabs()) {
|
|
188
|
+
const tab = button.dataset['ngDocMembersTab'] ?? ALL;
|
|
189
|
+
const count = members.filter((member) => inTab(member, tab)).length;
|
|
190
|
+
const counter = button.querySelector(COUNT);
|
|
191
|
+
if (counter) {
|
|
192
|
+
counter.textContent = String(count);
|
|
193
|
+
}
|
|
194
|
+
button.toggleAttribute('disabled', tab !== ALL && count === 0);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
apply() {
|
|
198
|
+
if (!this.ready) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const tab = this.selectedTab();
|
|
202
|
+
const query = this.filterQuery().trim().toLowerCase();
|
|
203
|
+
const visible = new Map();
|
|
204
|
+
for (const member of this.members()) {
|
|
205
|
+
const group = member.dataset['group'] ?? '';
|
|
206
|
+
const name = (member.dataset['name'] ?? member.textContent ?? '').toLowerCase();
|
|
207
|
+
const shown = inTab(member, tab) && (!query || name.includes(query));
|
|
208
|
+
member.hidden = !shown;
|
|
209
|
+
visible.set(group, (visible.get(group) ?? 0) + (shown ? 1 : 0));
|
|
210
|
+
for (const expand of Array.from(member.querySelectorAll(EXPAND))) {
|
|
211
|
+
const detail = this.host.ownerDocument.getElementById(expand.getAttribute('aria-controls') ?? '');
|
|
212
|
+
if (detail && this.host.contains(detail)) {
|
|
213
|
+
detail.hidden = !shown || expand.getAttribute('aria-expanded') !== 'true';
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
for (const group of Array.from(this.host.querySelectorAll(GROUP))) {
|
|
218
|
+
const count = visible.get(group.dataset['group'] ?? '') ?? 0;
|
|
219
|
+
const counter = group.querySelector(COUNT);
|
|
220
|
+
group.hidden = count === 0;
|
|
221
|
+
if (counter) {
|
|
222
|
+
counter.textContent = String(count);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const empty = this.host.querySelector(EMPTY);
|
|
226
|
+
if (empty) {
|
|
227
|
+
empty.hidden = this.members().some((member) => !member.hidden);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
fade() {
|
|
231
|
+
const list = this.tabs()[0]?.parentElement;
|
|
232
|
+
if (!list) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const max = list.scrollWidth - list.clientWidth;
|
|
236
|
+
const edges = [
|
|
237
|
+
...(max > 1 && list.scrollLeft > 1 ? ['start'] : []),
|
|
238
|
+
...(max > 1 && list.scrollLeft < max - 1 ? ['end'] : []),
|
|
239
|
+
];
|
|
240
|
+
if (edges.length) {
|
|
241
|
+
list.dataset['fade'] = edges.join(' ');
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
delete list.dataset['fade'];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocMembersFilterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
248
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.1", type: NgDocMembersFilterDirective, isStandalone: true, selector: "[ngDocMembersFilter]", host: { listeners: { "click": "onClick($event)", "input": "onInput($event)", "keydown": "onKeydown($event)" } }, ngImport: i0 }); }
|
|
249
|
+
}
|
|
250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocMembersFilterDirective, decorators: [{
|
|
251
|
+
type: Directive,
|
|
252
|
+
args: [{
|
|
253
|
+
selector: '[ngDocMembersFilter]',
|
|
254
|
+
host: {
|
|
255
|
+
'(click)': 'onClick($event)',
|
|
256
|
+
'(input)': 'onInput($event)',
|
|
257
|
+
'(keydown)': 'onKeydown($event)',
|
|
258
|
+
},
|
|
259
|
+
}]
|
|
260
|
+
}], ctorParameters: () => [] });
|
|
261
|
+
/**
|
|
262
|
+
* Whether a member row belongs to a tab.
|
|
263
|
+
* @param member - The member row.
|
|
264
|
+
* @param tab - "all", "inherited" or a group name.
|
|
265
|
+
*/
|
|
266
|
+
function inTab(member, tab) {
|
|
267
|
+
return (tab === ALL ||
|
|
268
|
+
(tab === INHERITED ? member.hasAttribute('data-inherited') : member.dataset['group'] === tab));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Generated bundle index. Do not edit.
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
export { NgDocMembersFilterDirective };
|
|
276
|
+
//# sourceMappingURL=ng-doc-app-directives-members-filter.mjs.map
|