@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,26 +1,29 @@
|
|
|
1
1
|
import { KeyValuePipe } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { RouterLink } from '@angular/router';
|
|
5
5
|
import { NgDocKindIconComponent } from '@ng-doc/app/components/kind-icon';
|
|
6
6
|
import { NgDocTextComponent, NgDocTooltipDirective } from '@ng-doc/ui-kit';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A list of pages grouped by their type (guides and API).
|
|
10
|
+
*/
|
|
8
11
|
class NgDocSearchResultComponent {
|
|
9
12
|
constructor() {
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
grouped[item.type].push(item);
|
|
20
|
-
return grouped;
|
|
21
|
-
}, {});
|
|
22
|
-
}
|
|
13
|
+
/** The pages to list. */
|
|
14
|
+
this.result = input([], /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "result" }] : /* istanbul ignore next */ []));
|
|
16
|
+
/** The pages grouped by their type. */
|
|
17
|
+
this.groupedResult = computed(() => (this.result() ?? []).reduce((grouped, item) => {
|
|
18
|
+
(grouped[item.type] ??= []).push(item);
|
|
19
|
+
return grouped;
|
|
20
|
+
}, {}), /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "groupedResult" }] : /* istanbul ignore next */ []));
|
|
23
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns the heading of a group.
|
|
25
|
+
* @param type - The page type of the group.
|
|
26
|
+
*/
|
|
24
27
|
typeToLabel(type) {
|
|
25
28
|
switch (type) {
|
|
26
29
|
case 'api':
|
|
@@ -31,10 +34,10 @@ class NgDocSearchResultComponent {
|
|
|
31
34
|
return 'Unknown';
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
35
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
37
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocSearchResultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
38
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocSearchResultComponent, isStandalone: true, selector: "ng-doc-search-result", inputs: { result: { classPropertyName: "result", publicName: "result", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (groupedResult() | keyvalue; as results) {\n <div class=\"ng-doc-search-result-wrapper\">\n @if (results.length) {\n @for (item of results; track item) {\n <div class=\"ng-doc-search-result-category\">\n <h4 class=\"ng-doc-search-result-title\" ng-doc-text>{{ typeToLabel(item.key) }}</h4>\n <ul class=\"ng-doc-search-result-pages\">\n @for (page of item.value; track page) {\n <li class=\"ng-doc-search-result-page\">\n <a class=\"ng-doc-search-result-page-link\" [routerLink]=\"[page.route]\">\n @if (page.kind) {\n <ng-doc-kind-icon\n [kind]=\"page.kind\"\n [ngDocTooltip]=\"page.kind\"></ng-doc-kind-icon>\n }\n {{ page.title }}\n </a>\n </li>\n }\n </ul>\n </div>\n }\n } @else {\n <div ng-doc-text color=\"muted\">Nothing was found...</div>\n }\n </div>\n}\n", styles: [":host{display:block}:host .ng-doc-search-result-wrapper{display:flex;flex-direction:row}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category:not(:last-child){margin-right:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-title{margin:0 0 calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages{list-style:none;padding:0;margin:0}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page{margin-bottom:var(--ng-doc-base-gutter)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page .ng-doc-search-result-page-link{display:flex;align-items:center;text-decoration:none;color:var(--ng-doc-text)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page .ng-doc-search-result-page-link ng-doc-kind-icon{margin-right:var(--ng-doc-base-gutter)}\n"], dependencies: [{ kind: "component", type: NgDocTextComponent, selector: "[ng-doc-text]", inputs: ["size", "color", "align", "absoluteContent"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: NgDocKindIconComponent, selector: "ng-doc-kind-icon", inputs: ["kind", "type", "size"] }, { 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"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
36
39
|
}
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocSearchResultComponent, decorators: [{
|
|
38
41
|
type: Component,
|
|
39
42
|
args: [{ selector: 'ng-doc-search-result', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
40
43
|
NgDocTextComponent,
|
|
@@ -42,10 +45,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
42
45
|
NgDocKindIconComponent,
|
|
43
46
|
NgDocTooltipDirective,
|
|
44
47
|
KeyValuePipe,
|
|
45
|
-
], template: "@if (groupedResult | keyvalue; as results) {\n <div class=\"ng-doc-search-result-wrapper\">\n @if (results.length) {\n @for (item of results; track item) {\n <div class=\"ng-doc-search-result-category\">\n <h4 class=\"ng-doc-search-result-title\" ng-doc-text>{{ typeToLabel(item.key) }}</h4>\n <ul class=\"ng-doc-search-result-pages\">\n @for (page of item.value; track page) {\n <li class=\"ng-doc-search-result-page\">\n <a class=\"ng-doc-search-result-page-link\" [routerLink]=\"[page.route]\">\n @if (page.kind) {\n <ng-doc-kind-icon\n [kind]=\"page.kind\"\n [ngDocTooltip]=\"page.kind\"></ng-doc-kind-icon>\n }\n {{ page.title }}\n </a>\n </li>\n }\n </ul>\n </div>\n }\n } @else {\n <div ng-doc-text color=\"muted\">Nothing was found...</div>\n }\n </div>\n}\n", styles: [":host{display:block}:host .ng-doc-search-result-wrapper{display:flex;flex-direction:row}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category:not(:last-child){margin-right:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-title{margin:0 0 calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages{list-style:none;padding:0;margin:0}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page{margin-bottom:var(--ng-doc-base-gutter)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page .ng-doc-search-result-page-link{display:flex;align-items:center;text-decoration:none;color:var(--ng-doc-text)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page .ng-doc-search-result-page-link ng-doc-kind-icon{margin-right:var(--ng-doc-base-gutter)}\n"] }]
|
|
46
|
-
}], propDecorators: { result: [{
|
|
47
|
-
type: Input
|
|
48
|
-
}] } });
|
|
48
|
+
], template: "@if (groupedResult() | keyvalue; as results) {\n <div class=\"ng-doc-search-result-wrapper\">\n @if (results.length) {\n @for (item of results; track item) {\n <div class=\"ng-doc-search-result-category\">\n <h4 class=\"ng-doc-search-result-title\" ng-doc-text>{{ typeToLabel(item.key) }}</h4>\n <ul class=\"ng-doc-search-result-pages\">\n @for (page of item.value; track page) {\n <li class=\"ng-doc-search-result-page\">\n <a class=\"ng-doc-search-result-page-link\" [routerLink]=\"[page.route]\">\n @if (page.kind) {\n <ng-doc-kind-icon\n [kind]=\"page.kind\"\n [ngDocTooltip]=\"page.kind\"></ng-doc-kind-icon>\n }\n {{ page.title }}\n </a>\n </li>\n }\n </ul>\n </div>\n }\n } @else {\n <div ng-doc-text color=\"muted\">Nothing was found...</div>\n }\n </div>\n}\n", styles: [":host{display:block}:host .ng-doc-search-result-wrapper{display:flex;flex-direction:row}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category:not(:last-child){margin-right:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-title{margin:0 0 calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages{list-style:none;padding:0;margin:0}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page{margin-bottom:var(--ng-doc-base-gutter)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page .ng-doc-search-result-page-link{display:flex;align-items:center;text-decoration:none;color:var(--ng-doc-text)}:host .ng-doc-search-result-wrapper .ng-doc-search-result-category .ng-doc-search-result-pages .ng-doc-search-result-page .ng-doc-search-result-page-link ng-doc-kind-icon{margin-right:var(--ng-doc-base-gutter)}\n"] }]
|
|
49
|
+
}], propDecorators: { result: [{ type: i0.Input, args: [{ isSignal: true, alias: "result", required: false }] }] } });
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components-search-result.mjs","sources":["../../../../libs/app/components/search-result/search-result.component.ts","../../../../libs/app/components/search-result/search-result.component.html","../../../../libs/app/components/search-result/ng-doc-app-components-search-result.ts"],"sourcesContent":["import { KeyValuePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component,
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-search-result.mjs","sources":["../../../../libs/app/components/search-result/search-result.component.ts","../../../../libs/app/components/search-result/search-result.component.html","../../../../libs/app/components/search-result/ng-doc-app-components-search-result.ts"],"sourcesContent":["import { KeyValuePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, input, Signal } from '@angular/core';\nimport { RouterLink } from '@angular/router';\nimport { NgDocKindIconComponent } from '@ng-doc/app/components/kind-icon';\nimport { NgDocPageInfo } from '@ng-doc/core/interfaces';\nimport { NgDocTextComponent, NgDocTooltipDirective } from '@ng-doc/ui-kit';\n\n/**\n * A list of pages grouped by their type (guides and API).\n */\n@Component({\n selector: 'ng-doc-search-result',\n templateUrl: './search-result.component.html',\n styleUrls: ['./search-result.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n NgDocTextComponent,\n RouterLink,\n NgDocKindIconComponent,\n NgDocTooltipDirective,\n KeyValuePipe,\n ],\n})\nexport class NgDocSearchResultComponent {\n /** The pages to list. */\n readonly result = input<NgDocPageInfo[] | null>([]);\n\n /** The pages grouped by their type. */\n readonly groupedResult: Signal<Record<string, NgDocPageInfo[]>> = computed(() =>\n (this.result() ?? []).reduce(\n (grouped: Record<string, NgDocPageInfo[]>, item: NgDocPageInfo) => {\n (grouped[item.type] ??= []).push(item);\n\n return grouped;\n },\n {},\n ),\n );\n\n /**\n * Returns the heading of a group.\n * @param type - The page type of the group.\n */\n typeToLabel(type: string): string {\n switch (type) {\n case 'api':\n return 'API';\n case 'guide':\n return 'Guides';\n default:\n return 'Unknown';\n }\n }\n}\n","@if (groupedResult() | keyvalue; as results) {\n <div class=\"ng-doc-search-result-wrapper\">\n @if (results.length) {\n @for (item of results; track item) {\n <div class=\"ng-doc-search-result-category\">\n <h4 class=\"ng-doc-search-result-title\" ng-doc-text>{{ typeToLabel(item.key) }}</h4>\n <ul class=\"ng-doc-search-result-pages\">\n @for (page of item.value; track page) {\n <li class=\"ng-doc-search-result-page\">\n <a class=\"ng-doc-search-result-page-link\" [routerLink]=\"[page.route]\">\n @if (page.kind) {\n <ng-doc-kind-icon\n [kind]=\"page.kind\"\n [ngDocTooltip]=\"page.kind\"></ng-doc-kind-icon>\n }\n {{ page.title }}\n </a>\n </li>\n }\n </ul>\n </div>\n }\n } @else {\n <div ng-doc-text color=\"muted\">Nothing was found...</div>\n }\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAOA;;AAEG;MAcU,0BAA0B,CAAA;AAbvC,IAAA,WAAA,GAAA;;QAeW,IAAA,CAAA,MAAM,GAAG,KAAK,CAAyB,EAAE;mFAAC;;QAG1C,IAAA,CAAA,aAAa,GAA4C,QAAQ,CAAC,MACzE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,MAAM,CAC1B,CAAC,OAAwC,EAAE,IAAmB,KAAI;AAChE,YAAA,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC;AAEtC,YAAA,OAAO,OAAO;QAChB,CAAC,EACD,EAAE,CACH;0FACF;AAgBF,IAAA;AAdC;;;AAGG;AACH,IAAA,WAAW,CAAC,IAAY,EAAA;QACtB,QAAQ,IAAI;AACV,YAAA,KAAK,KAAK;AACR,gBAAA,OAAO,KAAK;AACd,YAAA,KAAK,OAAO;AACV,gBAAA,OAAO,QAAQ;AACjB,YAAA;AACE,gBAAA,OAAO,SAAS;;IAEtB;8GA7BW,0BAA0B,EAAA,IAAA,EAAA,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,OAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,EAAA,WAAA,EAAA,aAAA,EAAA,YAAA,CAAA,EAAA,QAAA,EAAA,CAAA,cAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EACrB,YAAY,EAAA,IAAA,EAAA,UAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAGH,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAbtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,eAAA,EAGf,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC;wBACP,kBAAkB;wBAClB,UAAU;wBACV,sBAAsB;wBACtB,qBAAqB;wBACrB,YAAY;AACb,qBAAA,EAAA,QAAA,EAAA,mgCAAA,EAAA,MAAA,EAAA,CAAA,6kCAAA,CAAA,EAAA;;;AErBH;;AAEG;;;;"}
|
|
@@ -1,53 +1,84 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
-
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { inject, signal, DOCUMENT, PLATFORM_ID, DestroyRef, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
4
|
import { NgDocSearchEngine } from '@ng-doc/app/classes';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { skip, switchMap, shareReplay } from 'rxjs/operators';
|
|
5
|
+
import { NgDocCommandPaletteComponent } from '@ng-doc/app/components/command-palette';
|
|
6
|
+
import { NgDocShortcutsService } from '@ng-doc/app/services/shortcuts';
|
|
7
|
+
import { NgDocDialogService, NgDocComponentContent, NgDocButtonIconComponent } from '@ng-doc/ui-kit';
|
|
10
8
|
|
|
9
|
+
/**
|
|
10
|
+
* The search button of the navbar. It opens the search palette on click, with Command+K
|
|
11
|
+
* (Control+K) and, while single-key shortcuts are on, with the slash key. Wide screens show a
|
|
12
|
+
* search field with the key hint; narrow screens show an icon button.
|
|
13
|
+
*/
|
|
11
14
|
class NgDocSearchComponent {
|
|
12
15
|
constructor() {
|
|
13
|
-
this.query = new BehaviorSubject('');
|
|
14
16
|
this.dialog = inject(NgDocDialogService);
|
|
15
17
|
this.searchEngine = inject(NgDocSearchEngine, { optional: true });
|
|
18
|
+
this.shortcuts = inject(NgDocShortcutsService);
|
|
19
|
+
/** The chord that opens the search, as the reader's platform labels it. */
|
|
20
|
+
this.chord = signal('⌘K', /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "chord" }] : /* istanbul ignore next */ []));
|
|
22
|
+
this.document = inject(DOCUMENT);
|
|
23
|
+
this.browser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
16
24
|
if (!this.searchEngine) {
|
|
17
25
|
throw new Error(`NgDoc: Search engine is not provided,
|
|
18
|
-
please check this article: https://ng-doc.com/docs/
|
|
26
|
+
please check this article: https://ng-doc.com/docs/get-started/installation#4-add-the-providers
|
|
19
27
|
to learn how to provide it.`);
|
|
20
28
|
}
|
|
21
|
-
|
|
29
|
+
const removeSlash = this.shortcuts.register({ key: '/', handler: () => this.open() });
|
|
30
|
+
const removeChord = this.shortcuts.register({
|
|
31
|
+
key: 'k',
|
|
32
|
+
chord: true,
|
|
33
|
+
handler: () => (this.dialogRef ? this.dialogRef.close() : this.open()),
|
|
34
|
+
});
|
|
35
|
+
inject(DestroyRef).onDestroy(() => {
|
|
36
|
+
removeSlash();
|
|
37
|
+
removeChord();
|
|
38
|
+
this.dialogRef?.close();
|
|
39
|
+
});
|
|
40
|
+
// The platform is known only in the browser; the server renders the macOS label.
|
|
41
|
+
afterNextRender(() => {
|
|
42
|
+
if (!/Mac|iPhone|iPad/i.test(this.document.defaultView?.navigator.platform ?? '')) {
|
|
43
|
+
this.chord.set('Ctrl K');
|
|
44
|
+
}
|
|
45
|
+
});
|
|
22
46
|
}
|
|
23
|
-
|
|
24
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Opens the search palette. Focus returns to the element that had it when the palette closes.
|
|
49
|
+
* @param query - The text the search field starts with.
|
|
50
|
+
*/
|
|
51
|
+
open(query = '') {
|
|
52
|
+
if (this.dialogRef || !this.browser) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const opener = this.document.activeElement;
|
|
56
|
+
const narrow = !!this.document.defaultView?.matchMedia?.('(max-width: 640px)').matches;
|
|
57
|
+
const data = { query };
|
|
58
|
+
const dialogRef = this.dialog.open(new NgDocComponentContent(NgDocCommandPaletteComponent), {
|
|
25
59
|
hasBackdrop: true,
|
|
26
|
-
backdropClass: 'ng-doc-
|
|
27
|
-
panelClass: 'ng-doc-transparent-dialog',
|
|
28
|
-
positionStrategy: this.dialog
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
60
|
+
backdropClass: 'ng-doc-command-palette-backdrop',
|
|
61
|
+
panelClass: ['ng-doc-transparent-dialog', 'ng-doc-command-palette-pane'],
|
|
62
|
+
positionStrategy: this.dialog
|
|
63
|
+
.positionStrategy()
|
|
64
|
+
.centerHorizontally()
|
|
65
|
+
.top(narrow ? '8px' : '10vh'),
|
|
66
|
+
data,
|
|
67
|
+
});
|
|
68
|
+
this.dialogRef = dialogRef;
|
|
69
|
+
dialogRef.afterClose().subscribe(() => {
|
|
70
|
+
this.dialogRef = undefined;
|
|
71
|
+
if (opener instanceof HTMLElement && opener.isConnected && opener !== this.document.body) {
|
|
72
|
+
opener.focus({ preventScroll: true });
|
|
73
|
+
}
|
|
34
74
|
});
|
|
35
75
|
}
|
|
36
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
37
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
77
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.1", type: NgDocSearchComponent, isStandalone: true, selector: "ng-doc-search", ngImport: i0, template: "<button\n class=\"ng-doc-search-field\"\n type=\"button\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'Search (' + chord() + ')'\"\n aria-keyshortcuts=\"Meta+K Control+K\"\n (click)=\"open()\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n <span class=\"ng-doc-search-placeholder\">Search docs\u2026</span>\n <kbd>{{ chord() }}</kbd>\n</button>\n<button\n class=\"ng-doc-search-button\"\n type=\"button\"\n ng-doc-button-icon\n size=\"large\"\n [rounded]=\"false\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'Search (' + chord() + ')'\"\n aria-keyshortcuts=\"Meta+K Control+K\"\n (click)=\"open()\">\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n</button>\n", styles: [":host{display:flex;align-items:center}.ng-doc-search-field{display:flex;align-items:center;gap:var(--ng-doc-space-2);width:220px;height:36px;padding:0 var(--ng-doc-space-2) 0 var(--ng-doc-space-3);border:1px solid var(--ng-doc-border-color);border-radius:var(--ng-doc-radius-md);background:var(--ng-doc-base-1);color:var(--ng-doc-text-muted);font:400 var(--ng-doc-text-sm-size)/20px var(--ng-doc-font-family);text-align:left;cursor:pointer;transition:border-color var(--ng-doc-transition)}.ng-doc-search-field:hover{border-color:var(--ng-doc-border-hover-color)}.ng-doc-search-field:focus-visible{outline:none;box-shadow:var(--ng-doc-focus-ring)}.ng-doc-search-field svg{flex:none}.ng-doc-search-field kbd{margin-left:auto;padding:0 6px;border:1px solid var(--ng-doc-kbd-border-color);border-radius:var(--ng-doc-radius-xs);background:var(--ng-doc-kbd-background);font:500 11px/18px var(--ng-doc-font-family);color:var(--ng-doc-text-muted)}.ng-doc-search-placeholder{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ng-doc-search-button{display:none!important}@media(max-width:1024px){.ng-doc-search-field{display:none}.ng-doc-search-button{display:inline-flex!important}}\n"], dependencies: [{ kind: "component", type: NgDocButtonIconComponent, selector: "button[ng-doc-button-icon], a[ng-doc-button-icon], button[ng-doc-button-icon-raised], a[ng-doc-button-icon-raised], button[ng-doc-button-icon-transparent], a[ng-doc-button-icon-transparent]", inputs: ["size", "rounded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
38
78
|
}
|
|
39
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocSearchComponent, decorators: [{
|
|
40
80
|
type: Component,
|
|
41
|
-
args: [{ selector: 'ng-doc-search', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
42
|
-
NgDocButtonIconComponent,
|
|
43
|
-
NgDocDropdownOriginDirective,
|
|
44
|
-
NgDocIconComponent,
|
|
45
|
-
NgDocInputWrapperComponent,
|
|
46
|
-
NgDocInputStringDirective,
|
|
47
|
-
FormsModule,
|
|
48
|
-
NgDocHotkeyDirective,
|
|
49
|
-
NgDocTagComponent,
|
|
50
|
-
], template: "<ng-container\n [ngDocHotkey]=\"{ ctrlKey: false, altKey: false, shiftKey: false, code: 'Slash' }\"\n (ngDocHotkey)=\"open()\">\n <button ng-doc-button-icon size=\"large\" (click)=\"open()\" ngDocDropdownOrigin>\n <ng-doc-icon icon=\"search\" [size]=\"24\"></ng-doc-icon>\n </button>\n\n <ng-doc-input-wrapper ngDocDropdownOrigin>\n <ng-doc-icon icon=\"search\" ngDocInputWrapperLeft></ng-doc-icon>\n <input ngDocInputString readonly placeholder=\"Search...\" (click)=\"open()\" />\n <ng-doc-tag class=\"search-hotkey\" ngDocInputWrapperRight>/</ng-doc-tag>\n </ng-doc-input-wrapper>\n</ng-container>\n", styles: [":host{--ng-doc-floated-border-radius: var(--ng-doc-base-gutter);--ng-doc-input-background-color: var(--ng-doc-base-1);--ng-doc-input-border: none;--ng-doc-input-border-hover: none;--ng-doc-icon-color: var(--ng-doc-base-7)}:host ng-doc-input-wrapper{cursor:pointer}:host ng-doc-input-wrapper ng-doc-icon,:host ng-doc-input-wrapper ng-doc-tag{cursor:pointer}@media(max-width:1024px){:host ng-doc-input-wrapper{display:none}}@media(min-width:1024px){:host{width:240px}:host button[ng-doc-button-icon]{display:none}}.search-hotkey{display:flex;align-items:center;justify-content:center;width:calc(var(--ng-doc-base-gutter) * 3);height:calc(var(--ng-doc-base-gutter) * 3);margin-right:var(--ng-doc-base-gutter);--ng-doc-tag-border: 1px solid var(--ng-doc-base-6);--ng-doc-tag-color: var(--ng-doc-base-6);--ng-doc-tag-background: transparent}\n"] }]
|
|
81
|
+
args: [{ selector: 'ng-doc-search', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgDocButtonIconComponent], template: "<button\n class=\"ng-doc-search-field\"\n type=\"button\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'Search (' + chord() + ')'\"\n aria-keyshortcuts=\"Meta+K Control+K\"\n (click)=\"open()\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n <span class=\"ng-doc-search-placeholder\">Search docs\u2026</span>\n <kbd>{{ chord() }}</kbd>\n</button>\n<button\n class=\"ng-doc-search-button\"\n type=\"button\"\n ng-doc-button-icon\n size=\"large\"\n [rounded]=\"false\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'Search (' + chord() + ')'\"\n aria-keyshortcuts=\"Meta+K Control+K\"\n (click)=\"open()\">\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n</button>\n", styles: [":host{display:flex;align-items:center}.ng-doc-search-field{display:flex;align-items:center;gap:var(--ng-doc-space-2);width:220px;height:36px;padding:0 var(--ng-doc-space-2) 0 var(--ng-doc-space-3);border:1px solid var(--ng-doc-border-color);border-radius:var(--ng-doc-radius-md);background:var(--ng-doc-base-1);color:var(--ng-doc-text-muted);font:400 var(--ng-doc-text-sm-size)/20px var(--ng-doc-font-family);text-align:left;cursor:pointer;transition:border-color var(--ng-doc-transition)}.ng-doc-search-field:hover{border-color:var(--ng-doc-border-hover-color)}.ng-doc-search-field:focus-visible{outline:none;box-shadow:var(--ng-doc-focus-ring)}.ng-doc-search-field svg{flex:none}.ng-doc-search-field kbd{margin-left:auto;padding:0 6px;border:1px solid var(--ng-doc-kbd-border-color);border-radius:var(--ng-doc-radius-xs);background:var(--ng-doc-kbd-background);font:500 11px/18px var(--ng-doc-font-family);color:var(--ng-doc-text-muted)}.ng-doc-search-placeholder{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ng-doc-search-button{display:none!important}@media(max-width:1024px){.ng-doc-search-field{display:none}.ng-doc-search-button{display:inline-flex!important}}\n"] }]
|
|
51
82
|
}], ctorParameters: () => [] });
|
|
52
83
|
|
|
53
84
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components-search.mjs","sources":["../../../../libs/app/components/search/search.component.ts","../../../../libs/app/components/search/search.component.html","../../../../libs/app/components/search/ng-doc-app-components-search.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-search.mjs","sources":["../../../../libs/app/components/search/search.component.ts","../../../../libs/app/components/search/search.component.html","../../../../libs/app/components/search/ng-doc-app-components-search.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n DOCUMENT,\n inject,\n PLATFORM_ID,\n signal,\n} from '@angular/core';\nimport { NgDocSearchEngine } from '@ng-doc/app/classes';\nimport {\n NgDocCommandPaletteComponent,\n NgDocCommandPaletteData,\n} from '@ng-doc/app/components/command-palette';\nimport { NgDocShortcutsService } from '@ng-doc/app/services/shortcuts';\nimport {\n NgDocButtonIconComponent,\n NgDocComponentContent,\n NgDocDialogService,\n} from '@ng-doc/ui-kit';\nimport { NgDocOverlayRef } from '@ng-doc/ui-kit/classes';\n\n/**\n * The search button of the navbar. It opens the search palette on click, with Command+K\n * (Control+K) and, while single-key shortcuts are on, with the slash key. Wide screens show a\n * search field with the key hint; narrow screens show an icon button.\n */\n@Component({\n selector: 'ng-doc-search',\n templateUrl: './search.component.html',\n styleUrls: ['./search.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgDocButtonIconComponent],\n})\nexport class NgDocSearchComponent {\n protected readonly dialog = inject(NgDocDialogService);\n protected readonly searchEngine = inject(NgDocSearchEngine, { optional: true });\n protected readonly shortcuts = inject(NgDocShortcutsService);\n /** The chord that opens the search, as the reader's platform labels it. */\n protected readonly chord = signal('⌘K');\n\n private readonly document = inject(DOCUMENT);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n private dialogRef?: NgDocOverlayRef;\n\n constructor() {\n if (!this.searchEngine) {\n throw new Error(`NgDoc: Search engine is not provided,\n\t\t\tplease check this article: https://ng-doc.com/docs/get-started/installation#4-add-the-providers\n\t\t\tto learn how to provide it.`);\n }\n\n const removeSlash = this.shortcuts.register({ key: '/', handler: () => this.open() });\n const removeChord = this.shortcuts.register({\n key: 'k',\n chord: true,\n handler: () => (this.dialogRef ? this.dialogRef.close() : this.open()),\n });\n\n inject(DestroyRef).onDestroy(() => {\n removeSlash();\n removeChord();\n this.dialogRef?.close();\n });\n\n // The platform is known only in the browser; the server renders the macOS label.\n afterNextRender(() => {\n if (!/Mac|iPhone|iPad/i.test(this.document.defaultView?.navigator.platform ?? '')) {\n this.chord.set('Ctrl K');\n }\n });\n }\n\n /**\n * Opens the search palette. Focus returns to the element that had it when the palette closes.\n * @param query - The text the search field starts with.\n */\n open(query: string = ''): void {\n if (this.dialogRef || !this.browser) {\n return;\n }\n\n const opener = this.document.activeElement;\n const narrow = !!this.document.defaultView?.matchMedia?.('(max-width: 640px)').matches;\n const data: NgDocCommandPaletteData = { query };\n const dialogRef = this.dialog.open(new NgDocComponentContent(NgDocCommandPaletteComponent), {\n hasBackdrop: true,\n backdropClass: 'ng-doc-command-palette-backdrop',\n panelClass: ['ng-doc-transparent-dialog', 'ng-doc-command-palette-pane'],\n positionStrategy: this.dialog\n .positionStrategy()\n .centerHorizontally()\n .top(narrow ? '8px' : '10vh'),\n data,\n });\n\n this.dialogRef = dialogRef;\n dialogRef.afterClose().subscribe(() => {\n this.dialogRef = undefined;\n\n if (opener instanceof HTMLElement && opener.isConnected && opener !== this.document.body) {\n opener.focus({ preventScroll: true });\n }\n });\n }\n}\n","<button\n class=\"ng-doc-search-field\"\n type=\"button\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'Search (' + chord() + ')'\"\n aria-keyshortcuts=\"Meta+K Control+K\"\n (click)=\"open()\">\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n <span class=\"ng-doc-search-placeholder\">Search docs…</span>\n <kbd>{{ chord() }}</kbd>\n</button>\n<button\n class=\"ng-doc-search-button\"\n type=\"button\"\n ng-doc-button-icon\n size=\"large\"\n [rounded]=\"false\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'Search (' + chord() + ')'\"\n aria-keyshortcuts=\"Meta+K Control+K\"\n (click)=\"open()\">\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n</button>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAwBA;;;;AAIG;MAQU,oBAAoB,CAAA;AAW/B,IAAA,WAAA,GAAA;AAVmB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,kBAAkB,CAAC;QACnC,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5D,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC;;QAEzC,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,IAAI;kFAAC;AAEtB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC3B,IAAA,CAAA,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AA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