-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapi-api-list-module.07b912a225c0dd320045.js.map
1 lines (1 loc) · 14.9 KB
/
api-api-list-module.07b912a225c0dd320045.js.map
1
{"version":3,"sources":["./src/app/custom-elements/api/api.service.ts","./src/app/custom-elements/api/api-list.component.html","./src/app/custom-elements/api/api-list.component.ts","./src/app/custom-elements/api/api-list.module.ts"],"names":["http","logger","apiBase","apiListJsonDefault","firstTime","onDestroy","Subject","sectionsSubject","ReplaySubject","_sections","this","pipe","takeUntil","fetchSections","subscribe","sections","log","tap","forEach","section","deprecated","items","every","item","stability","ngOnDestroy","next","src","url","get","err","error","ApiService","query","status","type","apiService","locationService","showStatusMenu","showTypeMenu","criteriaSubject","searchCriteria","SearchCriteria","types","value","title","statuses","ngOnInit","filteredSections","combineLatest","criteria","map","filterSection","initializeSearchCriteria","setQuery","setSearchCriteria","toLowerCase","trim","setStatus","toggleStatusMenu","setType","toggleTypeMenu","filter","docType","securityRisk","name","indexOf","length","q","queryEl","nativeElement","find","x","setLocationSearch","setSearch","undefined","Object","assign","ApiListComponent","customElementComponent","ApiListModule"],"mappings":"sPA0BA,aAmCE,WAAoBA,EAA0BC,GAA1B,KAAAD,OAA0B,KAAAC,SAjCtC,KAAAC,QAAU,IAAyB,OACnC,KAAAC,mBAAqB,gBACrB,KAAAC,WAAY,EACZ,KAAAC,UAAY,IAAIC,EAAA,EAChB,KAAAC,gBAAkB,IAAIC,EAAA,EAA4B,GAClD,KAAAC,UAAYC,KAAKH,gBAAgBI,KAAK,OAAAC,EAAA,GAAUF,KAAKL,Y,OAM7D,sBAAI,uBAAQ,C,IAAZ,sBAWE,OAVIK,KAAKN,YACPM,KAAKN,WAAY,EACjBM,KAAKG,gBAGLH,KAAKD,UAAUK,WAAU,SAAAC,GACvB,SAAKd,OAAOe,IAAI,mCAIbN,KAAKD,UAAUE,KACpB,OAAAM,EAAA,IAAI,SAAAF,GACFA,EAASG,SAAQ,SAAAC,GACfA,EAAQC,aAC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OACF,OAEA,oBACE,sB,iBAaF,Q,MAjCc,gCAAiB,kBAAjB,CAAiB,iBAOjB,mCAAoB,oBAApB,CAAoB,qCAa3B,wD,yDCAP,GCtBA,8CAOA,8BAOE,KAAAyB,uBAAoC,E,8BADzBC,I,oDAAAA,IAAa,UAFb,CAAE,GAAY,SAHhB,CAAE,IAAc,IAAc,Q,EADzC","file":"api-api-list-module.07b912a225c0dd320045.js","sourcesContent":["import { Injectable, OnDestroy } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\n\nimport { ReplaySubject, Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { Logger } from 'app/shared/logger.service';\nimport { DOC_CONTENT_URL_PREFIX } from 'app/documents/document.service';\n\nexport interface ApiItem {\n name: string;\n title: string;\n path: string;\n docType: string;\n stability: string;\n securityRisk: boolean;\n}\n\nexport interface ApiSection {\n path: string;\n name: string;\n title: string;\n deprecated: boolean;\n items: ApiItem[] | null;\n}\n\n@Injectable()\nexport class ApiService implements OnDestroy {\n private apiBase = DOC_CONTENT_URL_PREFIX + 'api/';\n private apiListJsonDefault = 'api-list.json';\n private firstTime = true;\n private onDestroy = new Subject();\n private sectionsSubject = new ReplaySubject<ApiSection[]>(1);\n private _sections = this.sectionsSubject.pipe(takeUntil(this.onDestroy));\n\n /**\n * Return a cached observable of API sections from a JSON file.\n * API sections is an array of Angular top modules and metadata about their API documents (items).\n */\n get sections() {\n if (this.firstTime) {\n this.firstTime = false;\n this.fetchSections(); // TODO: get URL for fetchSections by configuration?\n\n // makes sectionsSubject hot; subscribe ensures stays alive (always refCount > 0);\n this._sections.subscribe(sections =>\n this.logger.log('ApiService got API sections')\n );\n }\n\n return this._sections.pipe(\n tap(sections => {\n sections.forEach(section => {\n section.deprecated =\n !!section.items &&\n section.items.every(item => item.stability === 'deprecated');\n });\n })\n );\n }\n\n constructor(private http: HttpClient, private logger: Logger) {}\n\n ngOnDestroy() {\n this.onDestroy.next();\n }\n\n /**\n * Fetch API sections from a JSON file.\n * API sections is an array of Angular top modules and metadata about their API documents (items).\n * Updates `sections` observable\n *\n * @param {string} [src] - Name of the api list JSON file\n */\n fetchSections(src?: string) {\n // TODO: get URL by configuration?\n const url = this.apiBase + (src || this.apiListJsonDefault);\n this.http\n .get<ApiSection[]>(url)\n .pipe(\n takeUntil(this.onDestroy),\n tap(() => this.logger.log(`Got API sections from ${url}`))\n )\n .subscribe(\n sections => this.sectionsSubject.next(sections),\n (err: HttpErrorResponse) => {\n // TODO: handle error\n this.logger.error(err);\n throw err; // rethrow for now.\n }\n );\n }\n}\n","<div class=\"l-flex-wrap api-filter\">\n\n <aio-select (change)=\"setType($event.option)\"\n [options]=\"types\"\n [selected]=\"type\"\n [showSymbol]=\"true\"\n label=\"Type:\">\n </aio-select>\n\n <aio-select (change)=\"setStatus($event.option)\"\n [options]=\"statuses\"\n [selected]=\"status\"\n [disabled]=\"type.value === 'package'\"\n label=\"Status:\">\n </aio-select>\n\n <div class=\"form-search\">\n <input #filter placeholder=\"Filter\" (input)=\"setQuery($event.target.value)\">\n <i class=\"material-icons\">search</i>\n </div>\n</div>\n\n<article class=\"api-list-container l-content-small docs-content\">\n <div *ngFor=\"let section of filteredSections | async\" >\n <h2 *ngIf=\"section.items\"><a [href]=\"section.path\" [class.deprecated-api-item]=\"section.deprecated\">@ngrx/{{section.title}}</a></h2>\n <ul class=\"api-list\" *ngIf=\"section.items?.length\">\n <ng-container *ngFor=\"let item of section.items\">\n <li class=\"api-item\">\n <a [href]=\"item.path\" [class.deprecated-api-item]=\"item.stability === 'deprecated'\">\n <span class=\"symbol {{item.docType}}\"></span>\n {{item.title}}\n </a>\n </li>\n </ng-container>\n </ul>\n </div>\n</article>\n","/*\n* API List & Filter Component\n*\n* A page that displays a formatted list of the public Angular API entities.\n* Clicking on a list item triggers navigation to the corresponding API entity document.\n* Can add/remove API entity links based on filter settings.\n*/\n\nimport { Component, ElementRef, OnInit, ViewChild } from '@angular/core';\n\nimport { combineLatest, Observable, ReplaySubject } from 'rxjs';\n\nimport { LocationService } from 'app/shared/location.service';\nimport { ApiSection, ApiService } from './api.service';\n\nimport { Option } from 'app/shared/select/select.component';\n\nclass SearchCriteria {\n query? = '';\n status? = 'all';\n type? = 'all';\n}\n\n@Component({\n selector: 'aio-api-list',\n templateUrl: './api-list.component.html',\n})\nexport class ApiListComponent implements OnInit {\n filteredSections: Observable<ApiSection[]>;\n\n showStatusMenu = false;\n showTypeMenu = false;\n\n private criteriaSubject = new ReplaySubject<SearchCriteria>(1);\n private searchCriteria = new SearchCriteria();\n\n status: Option;\n type: Option;\n\n // API types\n types: Option[] = [\n { value: 'all', title: 'All' },\n { value: 'class', title: 'Class' },\n { value: 'const', title: 'Const' },\n { value: 'decorator', title: 'Decorator' },\n { value: 'directive', title: 'Directive' },\n { value: 'enum', title: 'Enum' },\n { value: 'function', title: 'Function' },\n { value: 'interface', title: 'Interface' },\n { value: 'pipe', title: 'Pipe' },\n { value: 'ngmodule', title: 'NgModule' },\n { value: 'type-alias', title: 'Type alias' },\n { value: 'package', title: 'Package' },\n ];\n\n statuses: Option[] = [\n { value: 'all', title: 'All' },\n { value: 'deprecated', title: 'Deprecated' },\n { value: 'security-risk', title: 'Security Risk' },\n ];\n\n @ViewChild('filter', { static: true }) queryEl: ElementRef;\n\n constructor(\n private apiService: ApiService,\n private locationService: LocationService\n ) {}\n\n ngOnInit() {\n this.filteredSections = combineLatest(\n this.apiService.sections,\n this.criteriaSubject,\n (sections, criteria) => {\n return sections.map(section => ({\n ...section,\n items: this.filterSection(section, criteria),\n }));\n }\n );\n\n this.initializeSearchCriteria();\n }\n\n // TODO: may need to debounce as the original did\n // although there shouldn't be any perf consequences if we don't\n setQuery(query: string) {\n this.setSearchCriteria({ query: (query || '').toLowerCase().trim() });\n }\n\n setStatus(status: Option) {\n this.toggleStatusMenu();\n this.status = status;\n this.setSearchCriteria({ status: status.value });\n }\n\n setType(type: Option) {\n this.toggleTypeMenu();\n this.type = type;\n this.setSearchCriteria({ type: type.value });\n }\n\n toggleStatusMenu() {\n this.showStatusMenu = !this.showStatusMenu;\n }\n\n toggleTypeMenu() {\n this.showTypeMenu = !this.showTypeMenu;\n }\n\n //////// Private //////////\n\n private filterSection(\n section: ApiSection,\n { query, status, type }: SearchCriteria\n ) {\n const items = section.items!.filter(item => {\n return matchesType() && matchesStatus() && matchesQuery();\n\n function matchesQuery() {\n return (\n !query ||\n section.name.indexOf(query) !== -1 ||\n item.name.indexOf(query) !== -1\n );\n }\n\n function matchesStatus() {\n return (\n status === 'all' ||\n status === item.stability ||\n (status === 'security-risk' && item.securityRisk)\n );\n }\n\n function matchesType() {\n return type === 'all' || type === item.docType;\n }\n });\n\n // If there are no items we still return an empty array if the section name matches and the type is 'package'\n return items.length\n ? items\n : type === 'package' && (!query || section.name.indexOf(query) !== -1)\n ? []\n : null;\n }\n\n // Get initial search criteria from URL search params\n private initializeSearchCriteria() {\n const { query, status, type } = this.locationService.search();\n\n const q = (query || '').toLowerCase();\n // Hack: can't bind to query because input cursor always forced to end-of-line.\n this.queryEl.nativeElement.value = q;\n\n this.status =\n this.statuses.find(x => x.value === status) || this.statuses[0];\n this.type = this.types.find(x => x.value === type) || this.types[0];\n\n this.searchCriteria = {\n query: q,\n status: this.status.value,\n type: this.type.value,\n };\n\n this.criteriaSubject.next(this.searchCriteria);\n }\n\n private setLocationSearch() {\n const { query, status, type } = this.searchCriteria;\n const params = {\n query: query ? query : undefined,\n status: status !== 'all' ? status : undefined,\n type: type !== 'all' ? type : undefined,\n };\n\n this.locationService.setSearch('API Search', params);\n }\n\n private setSearchCriteria(criteria: SearchCriteria) {\n this.criteriaSubject.next(Object.assign(this.searchCriteria, criteria));\n this.setLocationSearch();\n }\n}\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { SharedModule } from '../../shared/shared.module';\nimport { ApiListComponent } from './api-list.component';\nimport { ApiService } from './api.service';\nimport { WithCustomElementComponent } from '../element-registry';\n\n@NgModule({\n imports: [ CommonModule, SharedModule, HttpClientModule ],\n declarations: [ ApiListComponent ],\n entryComponents: [ ApiListComponent ],\n providers: [ ApiService ]\n})\nexport class ApiListModule implements WithCustomElementComponent {\n customElementComponent: Type<any> = ApiListComponent;\n}\n"],"sourceRoot":"webpack:///"}