@cisstech/nge
Version:
NG Essentials is a collection of libraries for Angular developers.
21 lines • 9.58 kB
JavaScript
import { ChangeDetectionStrategy, Component } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../../../nge-doc.service";
import * as i2 from "@angular/common";
import * as i3 from "@angular/router";
export class SidenavComponent {
constructor(docService) {
this.docService = docService;
this.state$ = this.docService.stateChanges;
}
trackBy(_, item) {
return item.href;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SidenavComponent, deps: [{ token: i1.NgeDocService }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.1", type: SidenavComponent, selector: "nge-doc-sidenav", ngImport: i0, template: "<ng-container *ngIf=\"state$|async as state\">\n <header>\n <ng-container *ngIf=\"state.meta.logo; else: nologo\">\n <img [src]=\"state.meta.logo\" alt=\"Documentation Logo\">\n </ng-container>\n <ng-template #nologo>\n <img src=\"https://icongr.am/octicons/book.svg?size=48&color=34495e\">\n </ng-template>\n <h1>{{ state.meta.name }}</h1>\n </header>\n <nav *ngIf=\"state.links.length\">\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: state.links }\"></ng-container>\n </nav>\n</ng-container>\n<ng-template #template let-links>\n <ul>\n <ng-container *ngFor=\"let link of links; trackBy: trackBy\">\n <li [class.caption]=\"docService.isExpandable(link)\">\n <a [routerLink]=\"link.href\" [class.active]=\"docService.isActive(link)\">\n <img *ngIf=\"link.icon\" [src]=\"link.icon\">\n {{ link.title }}\n </a>\n </li>\n <ng-container *ngIf=\"docService.isExpandable(link)\">\n <ng-container\n *ngTemplateOutlet=\"template; context: { $implicit: link.children }\">\n </ng-container>\n </ng-container>\n </ng-container>\n </ul>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;line-height:2.3em;padding:1rem}header{display:block}header h1{font-size:1.5rem;font-weight:300;margin:0 auto 1rem}header img{height:48px;width:48px;box-sizing:border-box;object-fit:contain}nav{margin:0;padding:0;box-sizing:border-box;flex:1}ul,li,a{margin:0;padding:0;list-style:none;text-decoration:none}a{display:inline-flex;align-items:center;font-size:1em;text-rendering:optimizeLegibility;position:relative;color:currentColor;text-decoration:none}a:hover,a.active{font-weight:700}a:before{content:\"\";position:absolute;width:100%;height:1px;bottom:-2px;left:0;background-color:var(--nge-doc-primary-color);visibility:hidden;transform:scaleX(0);transition:all .3s ease-in-out 0s}a:hover:before,a.active:before{visibility:visible;transform:scaleX(1)}a img{width:24px;height:24px;margin-right:4px;object-fit:cover}li{margin-bottom:4px}.caption{margin-top:.2rem;font-weight:700;display:flex;align-items:center}.caption+ul{padding-left:1.3em}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SidenavComponent, decorators: [{
type: Component,
args: [{ selector: 'nge-doc-sidenav', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"state$|async as state\">\n <header>\n <ng-container *ngIf=\"state.meta.logo; else: nologo\">\n <img [src]=\"state.meta.logo\" alt=\"Documentation Logo\">\n </ng-container>\n <ng-template #nologo>\n <img src=\"https://icongr.am/octicons/book.svg?size=48&color=34495e\">\n </ng-template>\n <h1>{{ state.meta.name }}</h1>\n </header>\n <nav *ngIf=\"state.links.length\">\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: state.links }\"></ng-container>\n </nav>\n</ng-container>\n<ng-template #template let-links>\n <ul>\n <ng-container *ngFor=\"let link of links; trackBy: trackBy\">\n <li [class.caption]=\"docService.isExpandable(link)\">\n <a [routerLink]=\"link.href\" [class.active]=\"docService.isActive(link)\">\n <img *ngIf=\"link.icon\" [src]=\"link.icon\">\n {{ link.title }}\n </a>\n </li>\n <ng-container *ngIf=\"docService.isExpandable(link)\">\n <ng-container\n *ngTemplateOutlet=\"template; context: { $implicit: link.children }\">\n </ng-container>\n </ng-container>\n </ng-container>\n </ul>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;line-height:2.3em;padding:1rem}header{display:block}header h1{font-size:1.5rem;font-weight:300;margin:0 auto 1rem}header img{height:48px;width:48px;box-sizing:border-box;object-fit:contain}nav{margin:0;padding:0;box-sizing:border-box;flex:1}ul,li,a{margin:0;padding:0;list-style:none;text-decoration:none}a{display:inline-flex;align-items:center;font-size:1em;text-rendering:optimizeLegibility;position:relative;color:currentColor;text-decoration:none}a:hover,a.active{font-weight:700}a:before{content:\"\";position:absolute;width:100%;height:1px;bottom:-2px;left:0;background-color:var(--nge-doc-primary-color);visibility:hidden;transform:scaleX(0);transition:all .3s ease-in-out 0s}a:hover:before,a.active:before{visibility:visible;transform:scaleX(1)}a img{width:24px;height:24px;margin-right:4px;object-fit:cover}li{margin-bottom:4px}.caption{margin-top:.2rem;font-weight:700;display:flex;align-items:center}.caption+ul{padding-left:1.3em}\n"] }]
}], ctorParameters: () => [{ type: i1.NgeDocService }] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lkZW5hdi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9w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