@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components-image-viewer.mjs","sources":["../../../../libs/app/components/image-viewer/image-viewer.component.ts","../../../../libs/app/components/image-viewer/image-viewer.component.html","../../../../libs/app/components/image-viewer/ng-doc-app-components-image-viewer.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostListener,\n inject,\n input,\n TemplateRef,\n viewChild,\n} from '@angular/core';\nimport { NgDocOverlayContainerComponent, NgDocOverlayService } from '@ng-doc/ui-kit';\nimport { NgDocOverlayRef } from '@ng-doc/ui-kit/classes';\n\n@Component({\n selector: 'ng-doc-image-viewer',\n imports: [],\n templateUrl: './image-viewer.component.html',\n styleUrl: './image-viewer.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-opened]': '!!overlayRef',\n },\n})\nexport class NgDocImageViewerComponent {\n src = input.required<string>();\n alt = input.required<string>();\n\n protected readonly image = viewChild('image', { read: TemplateRef });\n protected readonly overlay = inject(NgDocOverlayService);\n protected readonly element = inject(ElementRef<HTMLElement>).nativeElement;\n protected readonly changeDetectorRef = inject(ChangeDetectorRef);\n protected overlayRef?: NgDocOverlayRef;\n\n @HostListener('click')\n clickEvent(): void {\n this.overlayRef?.close();\n\n const { width, height, top, left } = this.element.getBoundingClientRect();\n const windowWidth = window.innerWidth;\n const windowHeight = window.innerHeight;\n const ratio = Math.min(windowWidth / width, windowHeight / height);\n const newWidth = width * ratio;\n const newHeight = height * ratio;\n\n this.overlayRef = this.overlay.open(this.image(), {\n overlayContainer: NgDocOverlayContainerComponent,\n positionStrategy: this.overlay\n .globalPositionStrategy()\n .centerHorizontally()\n .centerVertically(),\n scrollStrategy: this.overlay.scrollStrategy().block(),\n hasBackdrop: true,\n backdropClass: 'ng-doc-blur-backdrop',\n openAnimation: [\n [\n {\n position: 'fixed',\n width: `${width}px`,\n height: `${height}px`,\n top: `${top}px`,\n left: `${left}px`,\n transform: 'translate(0%, 0)',\n },\n {\n position: 'fixed',\n width: `${newWidth}px`,\n height: `${newHeight}px`,\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n ],\n {\n duration: 300,\n easing: 'cubic-bezier(0.25, 0.8, 0.25, 1)',\n },\n //\n // group([\n // animate(\n // '300ms cubic-bezier(0.25, 0.8, 0.25, 1)',\n // style({\n // width: `${newWidth}px`,\n // height: `${newHeight}px`,\n // top: '50%',\n // left: '50%',\n // transform: 'translate(-50%, -50%)',\n // }),\n // ),\n // query('.ng-doc-image-container', [\n // style({ padding: 0 }),\n // animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({ padding: '16px' })),\n // ]),\n // ]),\n ],\n // closeAnimation: [\n // style({\n // position: 'fixed',\n // width: `${newWidth}px`,\n // height: `${newHeight}px`,\n // top: '50%',\n // left: '50%',\n // transform: 'translate(-50%, -50%)',\n // }),\n // group([\n // animate(\n // '300ms cubic-bezier(0.25, 0.8, 0.25, 1)',\n // style({ width, height, top, left, transform: 'translate(0%, 0)' }),\n // ),\n // query(\n // '.ng-doc-image-container',\n // animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({ padding: 0 })),\n // ),\n // ]),\n // ],\n });\n\n this.overlayRef.afterClose().subscribe(() => {\n this.overlayRef = undefined;\n this.changeDetectorRef.markForCheck();\n });\n }\n\n protected enterContainer(element: HTMLElement): void {\n console.log('enterContainer');\n element.animate([{ padding: 0 }, { padding: '16px' }], {\n duration: 300,\n easing: 'cubic-bezier(0.25, 0.8, 0.25, 1)',\n });\n }\n}\n","<ng-content></ng-content>\n\n<ng-template #image>\n <div\n class=\"ng-doc-image-container\"\n (click)=\"overlayRef?.close()\"\n (animate.enter)=\"enterContainer(element)\"\n #element>\n <img class=\"ng-doc-scaled-image\" [src]=\"src()\" [alt]=\"alt()\" />\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAwBa,yBAAyB,CAAA;AAVtC,IAAA,WAAA,GAAA;QAWE,IAAA,CAAA,GAAG,GAAG,KAAK,CAAC,QAAQ;gFAA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,6SAAA,EAAA,MAAA,EAAA,CAAA,ydAAA,CAAA,EAAA;AAMoC,SAAA,CAAA,EAAA,cAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,KAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,GAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,KAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,OAAO,EAAA,EAAA,GAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,UAAA,EAAA,CAAA;sBAMlE,YAAY;uBAAC,OAAO;;;AElCvB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-image-viewer.mjs","sources":["../../../../libs/app/components/image-viewer/image-viewer.component.ts","../../../../libs/app/components/image-viewer/image-viewer.component.html","../../../../libs/app/components/image-viewer/ng-doc-app-components-image-viewer.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n DOCUMENT,\n ElementRef,\n inject,\n input,\n signal,\n TemplateRef,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { NgDocOverlayContainerComponent, NgDocOverlayService } from '@ng-doc/ui-kit';\nimport { NgDocOverlayRef } from '@ng-doc/ui-kit/classes';\n\n/** The size of the opened image, in CSS pixels. */\ninterface ZoomSize {\n width: number;\n height: number;\n}\n\n/** Easing of the zoom: fast at first, settling into the final size. */\nconst ZOOM_EASING: string = 'cubic-bezier(0.2, 0, 0, 1)';\n\n/**\n * Wraps an image of the page: clicking it, or pressing Enter or Space on it, opens the image at\n * its natural size, scaled down to fit the window.\n *\n * An image inside a link keeps the link's behaviour, and an image with an empty `alt` is\n * decorative: neither becomes a button.\n */\n@Component({\n selector: 'ng-doc-image-viewer',\n imports: [],\n templateUrl: './image-viewer.component.html',\n styleUrl: './image-viewer.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.role]': 'isInteractive() ? \"button\" : null',\n '[attr.tabindex]': 'isInteractive() ? 0 : null',\n '[attr.aria-label]': 'isInteractive() ? \"Open image: \" + alt() : null',\n '[attr.data-interactive]': 'isInteractive()',\n '[attr.data-opened]': 'opened()',\n '(click)': 'clickEvent()',\n '(keydown.enter)': 'clickEvent()',\n '(keydown.space)': 'onSpace($event)',\n },\n})\nexport class NgDocImageViewerComponent {\n /** Source of the image. */\n readonly src = input.required<string>();\n\n /** Alternative text of the image. */\n readonly alt = input.required<string>();\n\n protected readonly image = viewChild.required('image', { read: TemplateRef });\n protected readonly overlay = inject(NgDocOverlayService);\n protected readonly element: HTMLElement = inject(ElementRef<HTMLElement>).nativeElement;\n protected readonly window: Window | null = inject(DOCUMENT).defaultView;\n\n /** Whether the scaled image is open. */\n protected readonly opened = signal<boolean>(false);\n\n /** The size of the opened image. */\n protected readonly size = signal<ZoomSize>({ width: 0, height: 0 });\n\n protected overlayRef?: NgDocOverlayRef;\n\n private attempt: number = 0;\n private destroyed: boolean = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.destroyed = true;\n this.overlayRef?.close();\n });\n }\n\n /**\n * Opens the image at its natural size, scaled down to fit the window, unless the image is not\n * interactive. The image grows from its place on the page.\n */\n clickEvent(): void {\n untracked(() => {\n if (this.isInteractive()) {\n void this.open();\n }\n });\n }\n\n /**\n * Whether the image opens: it has a text alternative and is not inside a link. The page\n * processor moves the host into place before change detection, so the check reads the DOM\n * where the image ends up.\n */\n protected isInteractive(): boolean {\n return !!this.alt().trim() && !this.element.parentElement?.closest('a');\n }\n\n /**\n * Opens the image on Space without scrolling the page.\n * @param event - The key press.\n */\n protected onSpace(event: Event): void {\n if (this.isInteractive()) {\n event.preventDefault();\n this.clickEvent();\n }\n }\n\n private async open(): Promise<void> {\n this.overlayRef?.close();\n\n const attempt: number = ++this.attempt;\n const thumbnail: HTMLImageElement | null = this.element.querySelector('img');\n\n await this.decode(thumbnail);\n\n // The reader may have opened the image again, pressed Escape or left the page while it\n // decoded.\n if (attempt !== this.attempt || this.destroyed) {\n return;\n }\n\n // The size is known before anything moves, so the image grows straight to it.\n const source: ZoomSize = this.sourceSize(thumbnail);\n const size: ZoomSize = this.fit(source);\n const zoomedFrame: Keyframe = { transformOrigin: '0 0', transform: 'none' };\n // The close animation reads its keyframes when it runs; a refit updates them in place.\n const closeFrames: Keyframe[] = [zoomedFrame, this.thumbnailFrame(thumbnail, size)];\n const animate: boolean = !this.window?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n\n this.size.set(size);\n\n const overlayRef: NgDocOverlayRef = this.overlay.open(this.image(), {\n overlayContainer: NgDocOverlayContainerComponent,\n positionStrategy: this.overlay\n .globalPositionStrategy()\n .centerHorizontally()\n .centerVertically(),\n scrollStrategy: this.overlay.scrollStrategy().block(),\n hasBackdrop: true,\n backdropClass: 'ng-doc-blur-backdrop',\n width: `${size.width}px`,\n height: `${size.height}px`,\n openAnimation: animate\n ? [[closeFrames[1], zoomedFrame], { duration: 300, easing: ZOOM_EASING }]\n : undefined,\n closeAnimation: animate\n ? [closeFrames, { duration: 200, easing: ZOOM_EASING, fill: 'forwards' }]\n : undefined,\n });\n const listeners: AbortController = new AbortController();\n // A resized or rotated window fits the image again.\n const refit = (): void => {\n const fitted: ZoomSize = this.fit(source);\n\n this.size.set(fitted);\n overlayRef.overlayRef.updateSize({\n width: `${fitted.width}px`,\n height: `${fitted.height}px`,\n });\n closeFrames[1] = this.thumbnailFrame(thumbnail, fitted);\n };\n\n this.window?.addEventListener('resize', refit, { signal: listeners.signal });\n this.window?.addEventListener('orientationchange', refit, { signal: listeners.signal });\n\n this.overlayRef = overlayRef;\n this.opened.set(true);\n\n overlayRef.afterClose().subscribe(() => {\n listeners.abort();\n\n if (this.overlayRef === overlayRef) {\n this.overlayRef = undefined;\n this.opened.set(false);\n this.element.focus();\n }\n });\n }\n\n /**\n * Waits until the image is decoded, so its natural size is known. Escape cancels the open\n * meanwhile, as it closes the opened image. A failed decode (a broken or not yet available\n * image) leaves the sizes that are known.\n * @param thumbnail - The image on the page.\n */\n private async decode(thumbnail: HTMLImageElement | null): Promise<void> {\n const listeners: AbortController = new AbortController();\n\n this.window?.document.addEventListener(\n 'keydown',\n (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.attempt++;\n }\n },\n { capture: true, signal: listeners.signal },\n );\n\n try {\n await thumbnail?.decode?.().catch(() => undefined);\n } finally {\n listeners.abort();\n }\n }\n\n /**\n * The size to scale: the natural size of the image, or the size of the thumbnail for an image\n * without one (an SVG without dimensions), which may then grow to fill the window.\n * @param thumbnail - The image on the page.\n */\n private sourceSize(thumbnail: HTMLImageElement | null): ZoomSize & { natural: boolean } {\n const naturalWidth: number = thumbnail?.naturalWidth ?? 0;\n const naturalHeight: number = thumbnail?.naturalHeight ?? 0;\n\n if (naturalWidth > 0 && naturalHeight > 0) {\n return { width: naturalWidth, height: naturalHeight, natural: true };\n }\n\n const rect: DOMRect = (thumbnail ?? this.element).getBoundingClientRect();\n\n return { width: rect.width, height: rect.height, natural: false };\n }\n\n /**\n * The size the image opens at: its natural size, scaled down to fit the viewport with a margin\n * and never scaled up. An image without a natural size fills the available space with the\n * proportions of its thumbnail.\n * @param source - The size to scale.\n */\n private fit(source: ZoomSize & { natural?: boolean }): ZoomSize {\n const viewport: HTMLElement | undefined = this.window?.document.documentElement;\n const viewportWidth: number = viewport?.clientWidth || this.window?.innerWidth || 0;\n const viewportHeight: number = viewport?.clientHeight || this.window?.innerHeight || 0;\n const margin: number = viewportWidth <= 640 ? 16 : 48;\n const maxWidth: number = Math.max(viewportWidth - margin * 2, 1);\n const maxHeight: number = Math.max(viewportHeight - margin * 2, 1);\n const width: number = source.width || maxWidth;\n const height: number = source.height || maxHeight;\n const scale: number = Math.min(\n source.natural ? 1 : Number.POSITIVE_INFINITY,\n maxWidth / width,\n maxHeight / height,\n );\n\n return { width: Math.round(width * scale), height: Math.round(height * scale) };\n }\n\n /**\n * The keyframe that puts the opened image over its thumbnail. The overlay centres the image in\n * the viewport; the frame scales it uniformly to fit the thumbnail's box and centres it there,\n * so an image whose proportions differ from its box's is not distorted.\n * @param thumbnail - The image on the page.\n * @param size - The size of the opened image.\n */\n private thumbnailFrame(thumbnail: HTMLImageElement | null, size: ZoomSize): Keyframe {\n const from: DOMRect = (thumbnail ?? this.element).getBoundingClientRect();\n const viewport: HTMLElement | undefined = this.window?.document.documentElement;\n const left: number = ((viewport?.clientWidth ?? size.width) - size.width) / 2;\n const top: number = ((viewport?.clientHeight ?? size.height) - size.height) / 2;\n const scale: number = Math.min(from.width / size.width, from.height / size.height) || 0;\n const x: number = from.left + (from.width - size.width * scale) / 2 - left;\n const y: number = from.top + (from.height - size.height * scale) / 2 - top;\n\n return { transformOrigin: '0 0', transform: `translate(${x}px, ${y}px) scale(${scale})` };\n }\n}\n","<ng-content></ng-content>\n\n<ng-template #image>\n <div\n class=\"ng-doc-image-container\"\n [style.width.px]=\"size().width\"\n [style.height.px]=\"size().height\"\n (click)=\"overlayRef?.close()\">\n <img class=\"ng-doc-scaled-image\" [src]=\"src()\" [alt]=\"alt()\" />\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAsBA;AACA,MAAM,WAAW,GAAW,4BAA4B;AAExD;;;;;;AAMG;MAkBU,yBAAyB,CAAA;AAuBpC,IAAA,WAAA,GAAA;;QArBS,IAAA,CAAA,GAAG,GAAG,KAAK,CAAC,QAAQ;gFAAU;;QAG9B,IAAA,CAAA,GAAG,GAAG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4
|
+
/**
|
|
5
|
+
* Words the kind chips show for declaration kinds whose name is not already a readable word.
|
|
6
|
+
* Other kinds (and value types) are shown as they are.
|
|
7
|
+
*/
|
|
8
|
+
const NG_DOC_KIND_LABELS = {
|
|
9
|
+
TypeAlias: 'Type alias',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The label a kind chip shows for a kind.
|
|
13
|
+
* @param kind - Declaration kind (for example `Class` or `TypeAlias`) or value type (`string`).
|
|
14
|
+
* @returns The word to show, for example "Type alias".
|
|
15
|
+
*/
|
|
16
|
+
function ngDocKindLabel(kind) {
|
|
17
|
+
return NG_DOC_KIND_LABELS[kind] ?? kind;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A word chip for a declaration kind (`Class`, `Component`, `Type alias`, ...) or a value type
|
|
21
|
+
* (`string`, `boolean`, ...), coloured by the kind.
|
|
22
|
+
*/
|
|
4
23
|
class NgDocKindIconComponent {
|
|
5
24
|
constructor() {
|
|
6
|
-
|
|
7
|
-
this.
|
|
8
|
-
|
|
25
|
+
/** Declaration kind or value type. */
|
|
26
|
+
this.kind = input('', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "kind" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/** Whether `kind` is a declaration kind or a value type; it selects the colours. */
|
|
29
|
+
this.type = input('declaration', /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/** `small` is the compact chip; `medium` the regular one. */
|
|
32
|
+
this.size = input('small', /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/** The word the chip shows. */
|
|
35
|
+
this.label = computed(() => ngDocKindLabel(this.kind()), /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
9
37
|
}
|
|
10
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
11
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocKindIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
39
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.1", type: NgDocKindIconComponent, isStandalone: true, selector: "ng-doc-kind-icon", inputs: { kind: { classPropertyName: "kind", publicName: "kind", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-ng-doc-kind": "kind()", "attr.data-ng-doc-type": "type()", "attr.data-ng-doc-size": "size()" } }, ngImport: i0, template: '{{ label() }}', isInline: true, styles: [":host{display:inline-flex;align-items:center;flex:none;height:20px;padding:0 7px;border-radius:var(--ng-doc-radius-sm);font-family:var(--ng-doc-font-family);font-size:11.5px;font-weight:600;line-height:1;white-space:nowrap;color:color-mix(in oklab,var(--ng-doc-kind-icon-background, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-strong),var(--ng-doc-heading-color));background:color-mix(in oklab,var(--ng-doc-kind-icon-background, var(--ng-doc-hue-neutral)) var(--ng-doc-kind-icon-background-opacity, var(--ng-doc-mix-chip)),var(--ng-doc-background));box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--ng-doc-kind-icon-background, var(--ng-doc-hue-neutral)) 24%,transparent)}:host[data-ng-doc-size=small]{height:18px;padding:0 5px;font-size:10.5px}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Class]{--ng-doc-kind-icon-background: var(--ng-doc-class-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Interface]{--ng-doc-kind-icon-background: var(--ng-doc-interface-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Enum]{--ng-doc-kind-icon-background: var(--ng-doc-enum-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Variable]{--ng-doc-kind-icon-background: var(--ng-doc-variable-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Function]{--ng-doc-kind-icon-background: var(--ng-doc-function-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=TypeAlias]{--ng-doc-kind-icon-background: var(--ng-doc-type-alias-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Component]{--ng-doc-kind-icon-background: var(--ng-doc-component-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Directive]{--ng-doc-kind-icon-background: var(--ng-doc-directive-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Injectable]{--ng-doc-kind-icon-background: var(--ng-doc-injectable-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Pipe]{--ng-doc-kind-icon-background: var(--ng-doc-pipe-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=NgModule]{--ng-doc-kind-icon-background: var(--ng-doc-ng-module-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=ng-doc-tag-selector]{--ng-doc-kind-icon-background: var(--ng-doc-selector-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=string]{--ng-doc-kind-icon-background: var(--ng-doc-string-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=number]{--ng-doc-kind-icon-background: var(--ng-doc-number-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=boolean]{--ng-doc-kind-icon-background: var(--ng-doc-boolean-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=null]{--ng-doc-kind-icon-background: var(--ng-doc-null-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=undefined]{--ng-doc-kind-icon-background: var(--ng-doc-undefined-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=object]{--ng-doc-kind-icon-background: var(--ng-doc-object-background)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
12
40
|
}
|
|
13
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocKindIconComponent, decorators: [{
|
|
14
42
|
type: Component,
|
|
15
|
-
args: [{ selector: 'ng-doc-kind-icon', template: '{{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}], type: [{
|
|
22
|
-
type: Input
|
|
23
|
-
}, {
|
|
24
|
-
type: HostBinding,
|
|
25
|
-
args: ['attr.data-ng-doc-type']
|
|
26
|
-
}], size: [{
|
|
27
|
-
type: Input
|
|
28
|
-
}, {
|
|
29
|
-
type: HostBinding,
|
|
30
|
-
args: ['attr.data-ng-doc-size']
|
|
31
|
-
}] } });
|
|
43
|
+
args: [{ selector: 'ng-doc-kind-icon', template: '{{ label() }}', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
44
|
+
'[attr.data-ng-doc-kind]': 'kind()',
|
|
45
|
+
'[attr.data-ng-doc-type]': 'type()',
|
|
46
|
+
'[attr.data-ng-doc-size]': 'size()',
|
|
47
|
+
}, styles: [":host{display:inline-flex;align-items:center;flex:none;height:20px;padding:0 7px;border-radius:var(--ng-doc-radius-sm);font-family:var(--ng-doc-font-family);font-size:11.5px;font-weight:600;line-height:1;white-space:nowrap;color:color-mix(in oklab,var(--ng-doc-kind-icon-background, var(--ng-doc-hue-neutral)) var(--ng-doc-mix-strong),var(--ng-doc-heading-color));background:color-mix(in oklab,var(--ng-doc-kind-icon-background, var(--ng-doc-hue-neutral)) var(--ng-doc-kind-icon-background-opacity, var(--ng-doc-mix-chip)),var(--ng-doc-background));box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--ng-doc-kind-icon-background, var(--ng-doc-hue-neutral)) 24%,transparent)}:host[data-ng-doc-size=small]{height:18px;padding:0 5px;font-size:10.5px}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Class]{--ng-doc-kind-icon-background: var(--ng-doc-class-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Interface]{--ng-doc-kind-icon-background: var(--ng-doc-interface-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Enum]{--ng-doc-kind-icon-background: var(--ng-doc-enum-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Variable]{--ng-doc-kind-icon-background: var(--ng-doc-variable-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Function]{--ng-doc-kind-icon-background: var(--ng-doc-function-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=TypeAlias]{--ng-doc-kind-icon-background: var(--ng-doc-type-alias-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Component]{--ng-doc-kind-icon-background: var(--ng-doc-component-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Directive]{--ng-doc-kind-icon-background: var(--ng-doc-directive-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Injectable]{--ng-doc-kind-icon-background: var(--ng-doc-injectable-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=Pipe]{--ng-doc-kind-icon-background: var(--ng-doc-pipe-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=NgModule]{--ng-doc-kind-icon-background: var(--ng-doc-ng-module-decorator-background)}:host[data-ng-doc-type=declaration][data-ng-doc-kind=ng-doc-tag-selector]{--ng-doc-kind-icon-background: var(--ng-doc-selector-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=string]{--ng-doc-kind-icon-background: var(--ng-doc-string-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=number]{--ng-doc-kind-icon-background: var(--ng-doc-number-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=boolean]{--ng-doc-kind-icon-background: var(--ng-doc-boolean-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=null]{--ng-doc-kind-icon-background: var(--ng-doc-null-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=undefined]{--ng-doc-kind-icon-background: var(--ng-doc-undefined-background)}:host[data-ng-doc-type=type][data-ng-doc-kind=object]{--ng-doc-kind-icon-background: var(--ng-doc-object-background)}\n"] }]
|
|
48
|
+
}], propDecorators: { kind: [{ type: i0.Input, args: [{ isSignal: true, alias: "kind", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
32
49
|
|
|
33
50
|
/**
|
|
34
51
|
* Generated bundle index. Do not edit.
|
|
35
52
|
*/
|
|
36
53
|
|
|
37
|
-
export { NgDocKindIconComponent };
|
|
54
|
+
export { NG_DOC_KIND_LABELS, NgDocKindIconComponent, ngDocKindLabel };
|
|
38
55
|
//# sourceMappingURL=ng-doc-app-components-kind-icon.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components-kind-icon.mjs","sources":["../../../../libs/app/components/kind-icon/kind-icon.component.ts","../../../../libs/app/components/kind-icon/ng-doc-app-components-kind-icon.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component,
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-kind-icon.mjs","sources":["../../../../libs/app/components/kind-icon/kind-icon.component.ts","../../../../libs/app/components/kind-icon/ng-doc-app-components-kind-icon.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, Signal } from '@angular/core';\n\n/**\n * Words the kind chips show for declaration kinds whose name is not already a readable word.\n * Other kinds (and value types) are shown as they are.\n */\nexport const NG_DOC_KIND_LABELS: Readonly<Record<string, string>> = {\n TypeAlias: 'Type alias',\n};\n\n/**\n * The label a kind chip shows for a kind.\n * @param kind - Declaration kind (for example `Class` or `TypeAlias`) or value type (`string`).\n * @returns The word to show, for example \"Type alias\".\n */\nexport function ngDocKindLabel(kind: string): string {\n return NG_DOC_KIND_LABELS[kind] ?? kind;\n}\n\n/**\n * A word chip for a declaration kind (`Class`, `Component`, `Type alias`, ...) or a value type\n * (`string`, `boolean`, ...), coloured by the kind.\n */\n@Component({\n selector: 'ng-doc-kind-icon',\n template: '{{ label() }}',\n styleUrls: ['./kind-icon.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-ng-doc-kind]': 'kind()',\n '[attr.data-ng-doc-type]': 'type()',\n '[attr.data-ng-doc-size]': 'size()',\n },\n})\nexport class NgDocKindIconComponent {\n /** Declaration kind or value type. */\n readonly kind = input<string>('');\n\n /** Whether `kind` is a declaration kind or a value type; it selects the colours. */\n readonly type = input<'declaration' | 'type'>('declaration');\n\n /** `small` is the compact chip; `medium` the regular one. */\n readonly size = input<'small' | 'medium'>('small');\n\n /** The word the chip shows. */\n protected readonly label: Signal<string> = computed(() => ngDocKindLabel(this.kind()));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;AAGG;AACI,MAAM,kBAAkB,GAAqC;AAClE,IAAA,SAAS,EAAE,YAAY;;AAGzB;;;;AAIG;AACG,SAAU,cAAc,CAAC,IAAY,EAAA;AACzC,IAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,IAAI;AACzC;AAEA;;;AAGG;MAYU,sBAAsB,CAAA;AAXnC,IAAA,WAAA,GAAA;;QAaW,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE;iFAAC;;QAGxB,IAAA,CAAA,IAAI,GAAG,KAAK,CAAyB,aAAa;iFAAC;;QAGnD,IAAA,CAAA,IAAI,GAAG,KAAK,CAAqB,OAAO;iFAAC;;AAG/B,QAAA,IAAA,CAAA,KAAK,GAAmB,QAAQ,CAAC,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;kFAAC;AACvF,IAAA;8GAZY,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAtB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,sBAAsB,0jBATvB,eAAe,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,s+FAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FASd,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAXlC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,YAClB,eAAe,EAAA,eAAA,EAER,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,yBAAyB,EAAE,QAAQ;AACnC,wBAAA,yBAAyB,EAAE,QAAQ;AACnC,wBAAA,yBAAyB,EAAE,QAAQ;AACpC,qBAAA,EAAA,MAAA,EAAA,CAAA,s+FAAA,CAAA,EAAA;;;AChCH;;AAEG;;;;"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { RouterLink } from '@angular/router';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Router link to a path of the application.
|
|
7
|
+
*/
|
|
5
8
|
class NgDocLinkComponent {
|
|
6
9
|
constructor() {
|
|
7
|
-
|
|
10
|
+
/** The path to link to. */
|
|
11
|
+
this.path = input('', /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "path" }] : /* istanbul ignore next */ []));
|
|
8
13
|
}
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
10
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
14
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocLinkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
15
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.1", type: NgDocLinkComponent, isStandalone: true, selector: "ng-doc-link", inputs: { path: { classPropertyName: "path", publicName: "path", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<a [routerLink]=\"[path()]\">\n <ng-content></ng-content>\n</a>\n", styles: [""], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
11
16
|
}
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocLinkComponent, decorators: [{
|
|
13
18
|
type: Component,
|
|
14
|
-
args: [{ selector: 'ng-doc-link', changeDetection: ChangeDetectionStrategy.OnPush, imports: [RouterLink], template: "<a [routerLink]=\"[path]\">\n
|
|
15
|
-
}], propDecorators: { path: [{
|
|
16
|
-
type: Input
|
|
17
|
-
}] } });
|
|
19
|
+
args: [{ selector: 'ng-doc-link', changeDetection: ChangeDetectionStrategy.OnPush, imports: [RouterLink], template: "<a [routerLink]=\"[path()]\">\n <ng-content></ng-content>\n</a>\n" }]
|
|
20
|
+
}], propDecorators: { path: [{ type: i0.Input, args: [{ isSignal: true, alias: "path", required: false }] }] } });
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components-link.mjs","sources":["../../../../libs/app/components/link/link.component.ts","../../../../libs/app/components/link/link.component.html","../../../../libs/app/components/link/ng-doc-app-components-link.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component,
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-link.mjs","sources":["../../../../libs/app/components/link/link.component.ts","../../../../libs/app/components/link/link.component.html","../../../../libs/app/components/link/ng-doc-app-components-link.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { RouterLink } from '@angular/router';\n\n/**\n * Router link to a path of the application.\n */\n@Component({\n selector: 'ng-doc-link',\n templateUrl: './link.component.html',\n styleUrls: ['./link.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [RouterLink],\n})\nexport class NgDocLinkComponent {\n /** The path to link to. */\n readonly path = input<string>('');\n}\n","<a [routerLink]=\"[path()]\">\n <ng-content></ng-content>\n</a>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;AAEG;MAQU,kBAAkB,CAAA;AAP/B,IAAA,WAAA,GAAA;;QASW,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE;iFAAC;AAClC,IAAA;8GAHY,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECb/B,oEAGA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDQY,UAAU,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,aAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,OAAA,EAAA,MAAA,EAAA,YAAA,EAAA,kBAAA,EAAA,oBAAA,EAAA,YAAA,EAAA,YAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAET,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,mBAGN,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,UAAU,CAAC,EAAA,QAAA,EAAA,oEAAA,EAAA;;;AEXvB;;AAEG;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@ng-doc/app/directives/members-filter';
|
|
4
|
+
import { NgDocMembersFilterDirective } from '@ng-doc/app/directives/members-filter';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The members table of an API page in the symbol view. The builder renders its tabs, filter and
|
|
8
|
+
* rows as the component's content, and the component adds the member filter to them.
|
|
9
|
+
*/
|
|
10
|
+
class NgDocMembersComponent {
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocMembersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
12
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.1", type: NgDocMembersComponent, isStandalone: true, selector: "ng-doc-members", host: { classAttribute: "ng-doc-members" }, hostDirectives: [{ directive: i1.NgDocMembersFilterDirective }], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
13
|
+
}
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocMembersComponent, decorators: [{
|
|
15
|
+
type: Component,
|
|
16
|
+
args: [{
|
|
17
|
+
selector: 'ng-doc-members',
|
|
18
|
+
template: '<ng-content></ng-content>',
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
hostDirectives: [NgDocMembersFilterDirective],
|
|
21
|
+
host: { class: 'ng-doc-members' },
|
|
22
|
+
}]
|
|
23
|
+
}] });
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generated bundle index. Do not edit.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export { NgDocMembersComponent };
|
|
30
|
+
//# sourceMappingURL=ng-doc-app-components-members.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-members.mjs","sources":["../../../../libs/app/components/members/members.component.ts","../../../../libs/app/components/members/ng-doc-app-components-members.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { NgDocMembersFilterDirective } from '@ng-doc/app/directives/members-filter';\n\n/**\n * The members table of an API page in the symbol view. The builder renders its tabs, filter and\n * rows as the component's content, and the component adds the member filter to them.\n */\n@Component({\n selector: 'ng-doc-members',\n template: '<ng-content></ng-content>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n hostDirectives: [NgDocMembersFilterDirective],\n host: { class: 'ng-doc-members' },\n})\nexport class NgDocMembersComponent {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGA;;;AAGG;MAQU,qBAAqB,CAAA;8GAArB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,uLALtB,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAK1B,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAPjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,QAAQ,EAAE,2BAA2B;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,cAAc,EAAE,CAAC,2BAA2B,CAAC;AAC7C,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE;AAClC,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
1
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, signal, inject,
|
|
3
|
+
import { input, signal, inject, PLATFORM_ID, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
5
|
import { NgDocSanitizeHtmlPipe } from '@ng-doc/app/pipes';
|
|
5
6
|
import { NgDocThemeService } from '@ng-doc/app/services/theme';
|
|
6
7
|
import { NG_DOC_MERMAID } from '@ng-doc/app/tokens';
|
|
7
8
|
import { NgDocMagnifierComponent, MagnifierControllerComponent, NgDocSpinnerComponent } from '@ng-doc/ui-kit';
|
|
8
9
|
|
|
9
10
|
let id = 0;
|
|
11
|
+
/** The init directive that renders one graph with Mermaid's dark theme. */
|
|
12
|
+
const DARK_THEME_DIRECTIVE = '%%{init: {"theme": "dark"}}%%\n';
|
|
13
|
+
/**
|
|
14
|
+
* Renders a Mermaid graph in a zoomable, pannable viewer. The graph is rendered in the browser
|
|
15
|
+
* only, again when it changes and when the theme changes.
|
|
16
|
+
*
|
|
17
|
+
* In the dark theme (or `auto` with a dark OS theme) the graph uses Mermaid's dark theme, unless
|
|
18
|
+
* the graph or `provideMermaid` chooses a theme of its own.
|
|
19
|
+
*/
|
|
10
20
|
class NgDocMermaidViewerComponent {
|
|
11
21
|
constructor() {
|
|
22
|
+
/** Source of the Mermaid graph. */
|
|
12
23
|
this.graph = input.required(/* @ts-ignore */
|
|
13
24
|
...(ngDevMode ? [{ debugName: "graph" }] : /* istanbul ignore next */ []));
|
|
14
25
|
this.html = signal('', /* @ts-ignore */
|
|
@@ -17,45 +28,75 @@ class NgDocMermaidViewerComponent {
|
|
|
17
28
|
...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
|
|
18
29
|
this.error = signal(null, /* @ts-ignore */
|
|
19
30
|
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
20
|
-
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
21
|
-
this.platform = inject(PLATFORM_ID);
|
|
22
31
|
this.id = `ng-doc-mermaid-viewer-${id++}`;
|
|
32
|
+
// Renders are asynchronous: only the result of the latest one is shown.
|
|
33
|
+
this.renderId = 0;
|
|
34
|
+
this.document = inject(DOCUMENT);
|
|
35
|
+
this.themeService = inject(NgDocThemeService);
|
|
23
36
|
const mermaid = inject(NG_DOC_MERMAID, { optional: true });
|
|
24
37
|
if (!mermaid) {
|
|
25
38
|
throw new Error('Mermaid is not provided. Make sure that you provided mermaid using "provideMermaid" function.');
|
|
26
39
|
}
|
|
27
40
|
this.mermaid = mermaid;
|
|
28
|
-
inject(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
if (isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
42
|
+
effect(() => {
|
|
43
|
+
const graph = this.graph();
|
|
44
|
+
untracked(() => void this.render(graph));
|
|
45
|
+
});
|
|
46
|
+
this.themeService
|
|
47
|
+
.themeChanges()
|
|
48
|
+
.pipe(takeUntilDestroyed())
|
|
49
|
+
.subscribe(() => void this.render(untracked(this.graph)));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Adds Mermaid's dark theme to the graph when the page is dark. A graph with front matter or an
|
|
54
|
+
* init directive, and a theme set in `provideMermaid`, are left as they are.
|
|
55
|
+
* @param graph - The graph source.
|
|
56
|
+
* @returns The graph to render.
|
|
57
|
+
*/
|
|
58
|
+
themed(graph) {
|
|
59
|
+
const theme = this.themeService.currentTheme;
|
|
60
|
+
const dark = theme === 'dark' ||
|
|
61
|
+
(theme === 'auto' &&
|
|
62
|
+
!!this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)').matches);
|
|
63
|
+
const configuredTheme = this.mermaid.mermaidAPI?.getSiteConfig?.().theme;
|
|
64
|
+
const ownTheme = /^\s*---/.test(graph) || /%%\{\s*init/.test(graph);
|
|
65
|
+
return dark && !ownTheme && (!configuredTheme || configuredTheme === 'default')
|
|
66
|
+
? DARK_THEME_DIRECTIVE + graph
|
|
67
|
+
: graph;
|
|
34
68
|
}
|
|
35
|
-
async
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
69
|
+
async render(graph) {
|
|
70
|
+
const renderId = ++this.renderId;
|
|
71
|
+
try {
|
|
72
|
+
const { svg } = await this.mermaid.render(this.id, this.themed(graph));
|
|
73
|
+
if (renderId === this.renderId) {
|
|
39
74
|
this.html.set(svg);
|
|
40
|
-
this.
|
|
75
|
+
this.error.set(null);
|
|
41
76
|
}
|
|
42
|
-
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (renderId === this.renderId) {
|
|
43
80
|
this.error.set(error);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
if (renderId === this.renderId) {
|
|
44
85
|
this.pending.set(false);
|
|
45
86
|
}
|
|
46
87
|
}
|
|
47
88
|
}
|
|
48
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
49
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
89
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocMermaidViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
90
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocMermaidViewerComponent, isStandalone: true, selector: "ng-doc-mermaid-viewer", inputs: { graph: { classPropertyName: "graph", publicName: "graph", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (pending()) {\n <div class=\"ng-doc-mermaid-preloader\">\n <ng-doc-spinner></ng-doc-spinner>\n </div>\n} @else if (error()) {\n <div class=\"ng-doc-mermaid-error\">{{ error() }}</div>\n} @else {\n <ng-doc-magnifier #magnifier>\n <div class=\"ng-doc-mermaid-container\" [innerHTML]=\"html() | ngDocSanitizeHtml\"></div>\n </ng-doc-magnifier>\n\n <ng-doc-magnifier-controller [magnifier]=\"magnifier\" />\n}\n", styles: [":host{position:relative;display:block;border:var(--ng-doc-mermaid-viewer-border, 1px solid var(--ng-doc-border-color));margin:var(--ng-doc-mermaid-viewer-margin, var(--ng-doc-page-block-margin));background:var(--ng-doc-mermaid-viewer-background, var(--ng-doc-code-background));border-radius:var(--ng-doc-mermaid-viewer-border-radius, var(--ng-doc-radius-lg));overflow:hidden;min-height:150px}:host ng-doc-magnifier-controller{position:absolute;bottom:var(--ng-doc-space-4);right:var(--ng-doc-space-4);opacity:0;transition:opacity var(--ng-doc-transition)}@media(prefers-reduced-motion:reduce){:host ng-doc-magnifier-controller{transition:none}}@media(hover:none){:host ng-doc-magnifier-controller{opacity:1}}:host:hover ng-doc-magnifier-controller,:host:focus-within ng-doc-magnifier-controller{opacity:1}:host .ng-doc-mermaid-container{display:flex;justify-content:center;align-items:center;padding:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-mermaid-preloader{display:flex;justify-content:center;align-items:center;width:100%;height:120px}:host .ng-doc-mermaid-error{display:flex;justify-content:center;align-items:center;height:120px;color:var(--ng-doc-alert)}\n"], dependencies: [{ kind: "component", type: NgDocMagnifierComponent, selector: "ng-doc-magnifier" }, { kind: "component", type: MagnifierControllerComponent, selector: "ng-doc-magnifier-controller", inputs: ["magnifier"] }, { kind: "component", type: NgDocSpinnerComponent, selector: "ng-doc-spinner", inputs: ["size"] }, { kind: "pipe", type: NgDocSanitizeHtmlPipe, name: "ngDocSanitizeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
50
91
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocMermaidViewerComponent, decorators: [{
|
|
52
93
|
type: Component,
|
|
53
94
|
args: [{ selector: 'ng-doc-mermaid-viewer', imports: [
|
|
54
95
|
NgDocMagnifierComponent,
|
|
55
96
|
MagnifierControllerComponent,
|
|
56
97
|
NgDocSanitizeHtmlPipe,
|
|
57
98
|
NgDocSpinnerComponent,
|
|
58
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (pending()) {\n <div class=\"ng-doc-mermaid-preloader\">\n <ng-doc-spinner></ng-doc-spinner>\n </div>\n} @else if (error()) {\n <div class=\"ng-doc-mermaid-error\">{{ error() }}</div>\n} @else {\n <ng-doc-magnifier #magnifier>\n <div class=\"ng-doc-mermaid-container\" [innerHTML]=\"html() | ngDocSanitizeHtml\"></div>\n </ng-doc-magnifier>\n\n <ng-doc-magnifier-controller [magnifier]=\"magnifier\" />\n}\n", styles: [":host{position:relative;display:block;border:var(--ng-doc-mermaid-viewer-border, 1px solid var(--ng-doc-border-color));margin:var(--ng-doc-mermaid-viewer-margin, var(--ng-doc-page-block-margin));background:var(--ng-doc-mermaid-viewer-background, var(--ng-doc-
|
|
99
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (pending()) {\n <div class=\"ng-doc-mermaid-preloader\">\n <ng-doc-spinner></ng-doc-spinner>\n </div>\n} @else if (error()) {\n <div class=\"ng-doc-mermaid-error\">{{ error() }}</div>\n} @else {\n <ng-doc-magnifier #magnifier>\n <div class=\"ng-doc-mermaid-container\" [innerHTML]=\"html() | ngDocSanitizeHtml\"></div>\n </ng-doc-magnifier>\n\n <ng-doc-magnifier-controller [magnifier]=\"magnifier\" />\n}\n", styles: [":host{position:relative;display:block;border:var(--ng-doc-mermaid-viewer-border, 1px solid var(--ng-doc-border-color));margin:var(--ng-doc-mermaid-viewer-margin, var(--ng-doc-page-block-margin));background:var(--ng-doc-mermaid-viewer-background, var(--ng-doc-code-background));border-radius:var(--ng-doc-mermaid-viewer-border-radius, var(--ng-doc-radius-lg));overflow:hidden;min-height:150px}:host ng-doc-magnifier-controller{position:absolute;bottom:var(--ng-doc-space-4);right:var(--ng-doc-space-4);opacity:0;transition:opacity var(--ng-doc-transition)}@media(prefers-reduced-motion:reduce){:host ng-doc-magnifier-controller{transition:none}}@media(hover:none){:host ng-doc-magnifier-controller{opacity:1}}:host:hover ng-doc-magnifier-controller,:host:focus-within ng-doc-magnifier-controller{opacity:1}:host .ng-doc-mermaid-container{display:flex;justify-content:center;align-items:center;padding:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-mermaid-preloader{display:flex;justify-content:center;align-items:center;width:100%;height:120px}:host .ng-doc-mermaid-error{display:flex;justify-content:center;align-items:center;height:120px;color:var(--ng-doc-alert)}\n"] }]
|
|
59
100
|
}], ctorParameters: () => [], propDecorators: { graph: [{ type: i0.Input, args: [{ isSignal: true, alias: "graph", required: true }] }] } });
|
|
60
101
|
|
|
61
102
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components-mermaid-viewer.mjs","sources":["../../../../libs/app/components/mermaid-viewer/mermaid-viewer.component.ts","../../../../libs/app/components/mermaid-viewer/mermaid-viewer.component.html","../../../../libs/app/components/mermaid-viewer/ng-doc-app-components-mermaid-viewer.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-mermaid-viewer.mjs","sources":["../../../../libs/app/components/mermaid-viewer/mermaid-viewer.component.ts","../../../../libs/app/components/mermaid-viewer/mermaid-viewer.component.html","../../../../libs/app/components/mermaid-viewer/ng-doc-app-components-mermaid-viewer.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n effect,\n inject,\n input,\n PLATFORM_ID,\n signal,\n untracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { NgDocSanitizeHtmlPipe } from '@ng-doc/app/pipes';\nimport { NgDocThemeService } from '@ng-doc/app/services/theme';\nimport { NG_DOC_MERMAID } from '@ng-doc/app/tokens';\nimport {\n MagnifierControllerComponent,\n NgDocMagnifierComponent,\n NgDocSpinnerComponent,\n} from '@ng-doc/ui-kit';\nimport type { Mermaid } from 'mermaid';\n\nlet id = 0;\n\n/** The init directive that renders one graph with Mermaid's dark theme. */\nconst DARK_THEME_DIRECTIVE = '%%{init: {\"theme\": \"dark\"}}%%\\n';\n\n/**\n * Renders a Mermaid graph in a zoomable, pannable viewer. The graph is rendered in the browser\n * only, again when it changes and when the theme changes.\n *\n * In the dark theme (or `auto` with a dark OS theme) the graph uses Mermaid's dark theme, unless\n * the graph or `provideMermaid` chooses a theme of its own.\n */\n@Component({\n selector: 'ng-doc-mermaid-viewer',\n imports: [\n NgDocMagnifierComponent,\n MagnifierControllerComponent,\n NgDocSanitizeHtmlPipe,\n NgDocSpinnerComponent,\n ],\n templateUrl: './mermaid-viewer.component.html',\n styleUrl: './mermaid-viewer.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgDocMermaidViewerComponent {\n /** Source of the Mermaid graph. */\n readonly graph = input.required<string>();\n\n protected readonly html = signal('');\n protected readonly pending = signal(true);\n protected readonly error = signal<Error | null>(null);\n protected readonly mermaid: Mermaid;\n\n protected readonly id = `ng-doc-mermaid-viewer-${id++}`;\n\n // Renders are asynchronous: only the result of the latest one is shown.\n private renderId = 0;\n\n private readonly document = inject(DOCUMENT);\n private readonly themeService = inject(NgDocThemeService);\n\n constructor() {\n const mermaid = inject(NG_DOC_MERMAID, { optional: true });\n\n if (!mermaid) {\n throw new Error(\n 'Mermaid is not provided. Make sure that you provided mermaid using \"provideMermaid\" function.',\n );\n }\n\n this.mermaid = mermaid;\n\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n effect(() => {\n const graph: string = this.graph();\n\n untracked(() => void this.render(graph));\n });\n\n this.themeService\n .themeChanges()\n .pipe(takeUntilDestroyed())\n .subscribe(() => void this.render(untracked(this.graph)));\n }\n }\n\n /**\n * Adds Mermaid's dark theme to the graph when the page is dark. A graph with front matter or an\n * init directive, and a theme set in `provideMermaid`, are left as they are.\n * @param graph - The graph source.\n * @returns The graph to render.\n */\n private themed(graph: string): string {\n const theme = this.themeService.currentTheme;\n const dark =\n theme === 'dark' ||\n (theme === 'auto' &&\n !!this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)').matches);\n const configuredTheme = this.mermaid.mermaidAPI?.getSiteConfig?.().theme;\n const ownTheme = /^\\s*---/.test(graph) || /%%\\{\\s*init/.test(graph);\n\n return dark && !ownTheme && (!configuredTheme || configuredTheme === 'default')\n ? DARK_THEME_DIRECTIVE + graph\n : graph;\n }\n\n private async render(graph: string): Promise<void> {\n const renderId: number = ++this.renderId;\n\n try {\n const { svg } = await this.mermaid.render(this.id, this.themed(graph));\n\n if (renderId === this.renderId) {\n this.html.set(svg);\n this.error.set(null);\n }\n } catch (error: unknown) {\n if (renderId === this.renderId) {\n this.error.set(error as Error);\n }\n } finally {\n if (renderId === this.renderId) {\n this.pending.set(false);\n }\n }\n }\n}\n","@if (pending()) {\n <div class=\"ng-doc-mermaid-preloader\">\n <ng-doc-spinner></ng-doc-spinner>\n </div>\n} @else if (error()) {\n <div class=\"ng-doc-mermaid-error\">{{ error() }}</div>\n} @else {\n <ng-doc-magnifier #magnifier>\n <div class=\"ng-doc-mermaid-container\" [innerHTML]=\"html() | ngDocSanitizeHtml\"></div>\n </ng-doc-magnifier>\n\n <ng-doc-magnifier-controller [magnifier]=\"magnifier\" />\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAsBA,IAAI,EAAE,GAAG,CAAC;AAEV;AACA,MAAM,oBAAoB,GAAG,iCAAiC;AAE9D;;;;;;AAMG;MAaU,2BAA2B,CAAA;AAiBtC,IAAA,WAAA,GAAA;;QAfS,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ;kFAAU;QAEtB,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,EAAE;iFAAC;QACjB,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,IAAI;oFAAC;QACtB,IAAA,CAAA,KAAK,GAAG,MAAM,CAAe,IAAI;kFAAC;AAGlC,QAAA,IAAA,CAAA,EAAE,GAAG,CAAA,sBAAA,EAAyB,EAAE,EAAE,EAAE;;QAG/C,IAAA,CAAA,QAAQ,GAAG,CAAC;AAEH,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAGvD,QAAA,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAE1D,IAAI,CAAC,OAAO,EAAE;AACZ,YAAA,MAAM,IAAI,KAAK,CACb,+FAA+F,CAChG;QACH;AAEA,QAAA,IAAI,CAAC,OAAO,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