This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
src_app_custom-elements_api_api-list_module_ts.09814a06e37fcf2b.js.map
1 lines (1 loc) · 14.8 KB
/
src_app_custom-elements_api_api-list_module_ts.09814a06e37fcf2b.js.map
1
{"version":3,"mappings":"oTA2BO,IAAMA,EAAb,MAAM,QA+BJC,YAAoBC,EAA0BC,GAA1BC,YAA0BA,cA7BtCA,aAAUC,KAAyB,OACnCD,wBAAqB,gBACrBA,gBAAY,EACZA,eAAY,IAAIE,IAChBF,qBAAkB,IAAIG,IAA4B,GAClDH,eAAYA,KAAKI,gBAAgBC,MAAK,OAAUL,KAAKM,YAMzDC,eAEF,OAAIP,KAAKQ,YACPR,KAAKQ,WAAY,EACjBR,KAAKS,gBAGLT,KAAKU,UAAUC,UAAUb,GAAYE,KAAKY,OAAOC,IAAI,sBAAsBf,EAASgB,uBAG/Ed,KAAKU,UAAUL,MAAK,OAAIP,IAC7BA,EAASiB,QAAQhB,IACfA,EAAQiB,aAAejB,EAAQkB,OAC3BlB,EAAQkB,MAAMC,MAAMC,GAA2B,eAAnBA,EAAKC,gBAO3CC,cACErB,KAAKM,UAAUgB,OAUjBb,cAAcX,GAEZ,MAAMC,EAAMC,KAAKuB,SAAWzB,GAAOE,KAAKwB,oBACxCxB,KAAKyB,KAAKC,IAAkB3B,GACzBM,QACCsB,KAAU3B,KAAKM,YACf,OAAI,IAAMN,KAAKY,OAAOC,IAAI,yBAAyBd,OAEpDY,UACCQ,GAAYnB,KAAKI,gBAAgBkB,KAAKH,GACrCA,IAEC,WAAKP,OAAOgB,MAAMT,GACZA,kDAzDHU,GAAUC,mDAAVD,EAAUE,QAAVF,EAAU,YAAVA,GAAb,sECHIC,cAA0BA,gBAA0EA,SAAiBA,QAAIA,wCAAtEA,mDAAtBA,2BAAuEA,kDAElGA,SACEA,iBACEA,gBACEA,gBACAA,SACFA,QACFA,QACFA,kCAL0BA,iEAAnBA,2BACKA,uC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OK,SAAQG,QAAQvD,KAAK6E,eAOnC7E,KAAKsE,gBAAgBS,UAAU,mBANhB,CACbhC,MAAQjD,QAAgB,EACxBsD,OAAmB,QAAXrD,EAAmBA,OAAS,EACpCwD,KAAmB,QAAXpC,EAAmBA,OAAS,IAMhC2B,kBAAkBhD,GACxBE,KAAKuC,gBAAgBjB,KAAKoB,OAAOsC,OAAOhF,KAAK6E,eAAgB/E,IAC7DE,KAAK8E,kEAzIIjD,GAAgBC,8CAAhBD,EAAgBoD,imBD5B7BnD,iBAEEA,wBAAYA,kCAAU/B,sBAKtB+B,QAEAA,wBAAYA,kCAAU/B,wBAKtB+B,QAEAA,iBACEA,qBAAgCA,iCAAS/B,6BAAzC+B,QACAA,eAA0BA,kBAAMA,QAClCA,QACFA,QAEAA,qBACEA,yCAaFA,eAjCcA,kCAAiB,kBAAjBA,CAAiB,iBAOjBA,qCAAoB,oBAApBA,CAAoB,qCAaPA,qHCKdD,GAAb,GCdaqD,EAAb,MAAM,QANNrF,cAOEG,4BAAoCgC,gDADzBH,6DAFA,CAAEjC,GAAYuF,SAHhB,CAAEC,KAAcC,IAAcC,SAK5BzD,GAAb","names":["d","constructor","e","i","this","C","T","m","sectionsSubject","pipe","onDestroy","sections","firstTime","fetchSections","_sections","subscribe","logger","log","length","forEach","deprecated","items","every","a","stability","ngOnDestroy","next","apiBase","apiListJsonDefault","http","get","f","error","s","t","factory","O","Q","value","title","ngOnInit","filteredSections","apiService","criteriaSubject","criteria","map","Object","filterSection","initializeSearchCriteria","setQuery","setSearchCriteria","query","toLowerCase","trim","setStatus","toggleStatusMenu","status","setType","toggleTypeMenu","type","showStatusMenu","showTypeMenu","r","name","indexOf","y","filter","c","o","docType","E","securityRisk","Y","w","locationService","search","queryEl","nativeElement","statuses","find","types","searchCriteria","setLocationSearch","setSearch","assign","selectors","N","imports","p","S","h"],"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"],"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\n private apiBase = DOC_CONTENT_URL_PREFIX + 'api/';\n private apiListJsonDefault = 'api-list.json';\n private firstTime = true;\n private onDestroy = new Subject<void>();\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\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 => this.logger.log(`ApiService got API ${sections.length} section(s)`));\n }\n\n return this._sections.pipe(tap(sections => {\n sections.forEach(section => {\n section.deprecated = !!section.items &&\n section.items.every(item => item.stability === 'deprecated');\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 [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.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=\"类型:\">\n </aio-select>\n\n <aio-select (change)=\"setStatus($event.option)\"\n [options]=\"statuses\"\n [selected]=\"status\"\n [disabled]=\"type.value === 'package'\"\n label=\"状态:\">\n </aio-select>\n\n <div class=\"form-search\">\n <input #filter placeholder=\"过滤\" (input)=\"setQuery($any($event.target).value)\" aria-label=\"Filter Search\">\n <i class=\"material-icons\">search</i>\n </div>\n</div>\n\n<article class=\"api-list-container\">\n <div *ngFor=\"let section of filteredSections | async\" >\n <h2 *ngIf=\"section.items\"><a [href]=\"section.path\" [class.deprecated-api-item]=\"section.deprecated\">{{section.title}}</a></h2>\n <ul class=\"api-list\" *ngIf=\"section.items && 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 { ApiItem, ApiSection, ApiService } from './api.service';\n\nimport { Option } from 'app/shared/select/select.component';\nimport { map } from 'rxjs/operators';\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\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: '全部' },\n { value: 'class', title: '类' },\n { value: 'const', title: '常量'},\n { value: 'decorator', title: '装饰器' },\n { value: 'directive', title: '指令' },\n { value: 'element', title: 'Element'},\n { value: 'enum', title: '枚举' },\n { value: 'function', title: '函数' },\n { value: 'interface', title: '接口' },\n { value: 'package', title: 'Package'},\n { value: 'pipe', title: '管道'},\n { value: 'ngmodule', title: 'NgModule'},\n { value: 'type-alias', title: '类型别名' },\n ];\n\n statuses: Option[] = [\n { value: 'all', title: '全部' },\n { value: 'stable', title: '稳定'},\n { value: 'deprecated', title: '弃用' },\n { value: 'security-risk', title: '安全风险' }\n ];\n\n @ViewChild('filter', { static: true }) queryEl: ElementRef;\n\n constructor(\n private apiService: ApiService,\n private locationService: LocationService) { }\n\n ngOnInit() {\n this.filteredSections =\n combineLatest([\n this.apiService.sections,\n this.criteriaSubject,\n ]).pipe(\n map( results => ({ sections: results[0], criteria: results[1]})),\n map( results => (\n results.sections\n .map(section => ({ ...section, items: this.filterSection(section, results.criteria) }))\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(section: ApiSection, { query, status, type }: SearchCriteria) {\n const sectionNameMatches = !query || section.name.indexOf(query) !== -1;\n\n const matchesQuery = (item: ApiItem) =>\n sectionNameMatches || item.name.indexOf(query) !== -1;\n const matchesStatus = (item: ApiItem) =>\n status === 'all' || status === item.stability || (status === 'security-risk' && item.securityRisk);\n const matchesType = (item: ApiItem) =>\n type === 'all' || type === item.docType;\n\n const items: ApiItem[] = (section.items || []).filter(item =>\n matchesType(item) && matchesStatus(item) && matchesQuery(item));\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 ? items : (sectionNameMatches && type === 'package') ? [] : 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 = 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 搜索', params);\n }\n\n private setSearchCriteria(criteria: Partial<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:///","file":"src_app_custom-elements_api_api-list_module_ts.09814a06e37fcf2b.js"}