-
Notifications
You must be signed in to change notification settings - Fork 0
/
src_app_custom-elements_live-example_live-example_module_ts.68aa802423639362.js.map
1 lines (1 loc) · 13.9 KB
/
src_app_custom-elements_live-example_live-example_module_ts.68aa802423639362.js.map
1
{"version":3,"file":"src_app_custom-elements_live-example_live-example_module_ts.68aa802423639362.js","mappings":"+NA2BM,SAAUA,EAAaC,EAAgBC,GAC3C,MAAMC,EAAuB,iBAATD,EACdA,EACAA,EAAKE,KAAKC,GAAKJ,EAAMK,eAAeD,EAAEE,gBAE5C,YAAgBC,IAARL,OAAqBK,EAAYP,EAAME,EAAII,cACrD,CAQM,SAAUE,EAAcC,EAA+BC,GAAe,GAC1E,YAAqBH,IAAdE,EAA0BC,EAA2B,UAArBD,EAAUE,MACnD,8CCnCIC,MAAA,OACEA,MAAA,gCAAKA,MAAA,SAAsCA,MAAA,0CAAMA,QAAIA,MAAA,aACvDA,+BADUA,MAAA,GAAAA,MAAA,OAAAC,EAAAC,IAAAF,iCALZA,MAAA,SAAAA,CAAiC,WAE7BA,MAAA,+BACFA,QACAA,MAAA,EAAAG,EAAA,WAGFH,8BANOA,cAAA,QAAAI,EAAAC,OACsBL,cAAA,MAAAI,EAAAE,YAEvBN,cAAA,OAAAI,EAAAG,0CAINP,MAAA,SAAAA,CAAqC,SACQA,MAAA,GAASA,gCAA3BA,cAAA,QAAAQ,EAAAH,OAAtBL,MAAA,OAAAQ,EAAAN,IAAAF,OAAwCA,cAAAQ,EAAAH,iCAI3CL,MAAA,UACEA,MAAA,SAAEA,MAAA,SAAsCA,MAAA,8BAAIA,iCAAvCA,MAAA,GAAAA,MAAA,OAAAS,EAAAP,IAAAF,iCAHTA,MAAA,SAAAA,CAAuB,UACoCA,MAAA,GAASA,QAClEA,MAAA,EAAAU,EAAA,cAGFV,8BAJyCA,cAAA,QAAAW,EAAAN,OAApCL,MAAA,OAAAW,EAAAL,WAAAN,OAAsDA,cAAAW,EAAAN,OAClDL,cAAA,OAAAW,EAAAJ,4CCVLK,EA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AA,UAHjBC,eAGAJ,CAAiB","names":["getAttrValue","attrs","attr","key","find","a","hasOwnProperty","toLowerCase","undefined","boolFromValue","attrValue","def","trim","i0","ctx_r4","zip","LiveExampleComponent_span_4_p_3_Template","ctx_r1","title","stackblitz","enableDownload","ctx_r2","ctx_r5","LiveExampleComponent_span_6_span_3_Template","ctx_r3","LIVE_EXAMPLE_BASE","CONTENT_URL_PREFIX","ZIP_BASE","LiveExampleComponent","constructor","elementRef","location","getAttrs","el","ElementRef","nativeElement","attributes","attrMap","name","value","exampleDir","this","getExampleDir","path","stackblitzName","getStackblitzName","mode","getMode","getEnableDownload","getStackblitz","getZip","getTitle","ngAfterContentInit","textContent","content","match","downloadOnly","isEmbedded","zipName","split","static","t","i1","core","In1","selectors","viewQuery","rf","ctx","LiveExampleComponent_span_4_Template","LiveExampleComponent_span_5_Template","LiveExampleComponent_span_6_Template","EmbeddedStackblitzComponent","encapsulation","ngAfterViewInit","iframe","src","LiveExampleModule","customElementComponent","a4G","s3X","CommonModule"],"sourceRoot":"webpack:///","sources":["./src/app/shared/attribute-utils.ts","./src/app/custom-elements/live-example/live-example.component.html","./src/app/custom-elements/live-example/live-example.component.ts","./src/app/custom-elements/live-example/live-example.module.ts"],"sourcesContent":["// Utilities for processing HTML element attributes\nimport { ElementRef } from '@angular/core';\n\nexport interface AttrMap {\n [key: string]: string;\n}\n\n/**\n * Get attribute map from element or ElementRef `attributes`.\n * Attribute map keys are forced lowercase for case-insensitive lookup.\n *\n * @param el The source of the attributes.\n */\nexport function getAttrs(el: HTMLElement | ElementRef): AttrMap {\n const attrs: NamedNodeMap = el instanceof ElementRef ? el.nativeElement.attributes : el.attributes;\n const attrMap: AttrMap = {};\n for (const attr of attrs as any as Attr[] /* cast due to https://github.com/Microsoft/TypeScript/issues/2695 */) {\n attrMap[attr.name.toLowerCase()] = attr.value;\n }\n return attrMap;\n}\n\n/**\n * Return the attribute that matches `attr`.\n *\n * @param attr Name of the attribute or a string of candidate attribute names.\n */\nexport function getAttrValue(attrs: AttrMap, attr: string | string[]): string | undefined {\n const key = (typeof attr === 'string')\n ? attr\n : attr.find(a => attrs.hasOwnProperty(a.toLowerCase()));\n\n return (key === undefined) ? undefined : attrs[key.toLowerCase()];\n}\n\n/**\n * Return the boolean state of an attribute value (if supplied).\n *\n * @param attrValue The string value of some attribute (or undefined if attribute not present).\n * @param def Default boolean value when attribute is undefined.\n */\nexport function boolFromValue(attrValue: string | undefined, def: boolean = false) {\n return attrValue === undefined ? def : attrValue.trim() !== 'false';\n}\n\n/**\n * Return the boolean state of attribute from an element.\n *\n * @param el The source of the attributes.\n * @param atty Name of the attribute or a string of candidate attribute names.\n * @param def Default boolean value when attribute is undefined.\n */\nexport function getBoolFromAttribute(\n el: HTMLElement | ElementRef,\n attr: string | string[],\n def: boolean = false): boolean {\n return boolFromValue(getAttrValue(getAttrs(el), attr), def);\n}\n","<!-- Content projection is used to get the content HTML provided to the component. -->\n<span #content style=\"display: none\"><ng-content></ng-content></span>\n\n<span [ngSwitch]=\"mode\">\n <span *ngSwitchCase=\"'embedded'\">\n <div title=\"{{title}}\">\n <aio-embedded-stackblitz [src]=\"stackblitz\"></aio-embedded-stackblitz>\n </div>\n <p *ngIf=\"enableDownload\">\n 你还可以 <a [href]=\"zip\" download title=\"下载范例\">下载这个例子</a>。\n </p>\n </span>\n <span *ngSwitchCase=\"'downloadOnly'\">\n <a [href]=\"zip\" download title=\"{{title}}\">{{title}}</a>\n </span>\n <span *ngSwitchDefault>\n <a [href]=\"stackblitz\" target=\"_blank\" title=\"{{title}}\">{{title}}</a>\n <span *ngIf=\"enableDownload\">\n / <a [href]=\"zip\" download title=\"下载范例\">下载范例</a>\n </span>\n </span>\n</span>\n","/* eslint-disable @angular-eslint/component-selector */\nimport { AfterContentInit, AfterViewInit, Component, ElementRef, Input, ViewChild } from '@angular/core';\nimport { Location } from '@angular/common';\nimport { CONTENT_URL_PREFIX } from 'app/documents/document.service';\nimport { AttrMap, boolFromValue, getAttrs, getAttrValue } from 'app/shared/attribute-utils';\n\n\nconst LIVE_EXAMPLE_BASE = CONTENT_URL_PREFIX + 'live-examples/';\nconst ZIP_BASE = CONTENT_URL_PREFIX + 'zips/';\n\n/**\n * Angular.io Live Example Embedded Component\n *\n * Renders a link to a live/host example of the doc page.\n *\n * All attributes and the text content are optional\n *\n * Usage:\n * <live-example\n * [name=\"...\"] // name of the example directory\n * [stackblitz=\"...\"\"] // name of the stackblitz file (becomes part of zip file name as well)\n * [embedded] // embed the stackblitz in the doc page, else display in new browser tab (default)\n * [noDownload] // no downloadable zip option\n * [downloadOnly] // just the zip\n * [title=\"...\"]> // text for live example link and tooltip\n * text // higher precedence way to specify text for live example link and tooltip\n * </live-example>\n * Example:\n * <p>Run <live-example>Try the live example</live-example></p>.\n * // ~/resources/live-examples/{page}/stackblitz.json\n *\n * <p>Run <live-example name=\"toh-pt1\">this example</live-example></p>.\n * // ~/resources/live-examples/toh-pt1/stackblitz.json\n *\n * // Link to the default stackblitz in the toh-pt1 sample\n * // The title overrides default (\"live example\") with \"Tour of Heroes - Part 1\"\n * <p>Run <live-example name=\"toh-pt1\" title=\"Tour of Heroes - Part 1\"></live-example></p>.\n * // ~/resources/live-examples/toh-pt1/stackblitz.json\n *\n * <p>Run <live-example stackblitz=\"minimal\"></live-example></p>.\n * // ~/resources/live-examples/{page}/minimal.stackblitz.json\n *\n * // Embed the current page's default stackblitz\n * // Text within tag is \"live example\"\n * // No title (no tooltip)\n * <live-example embedded title=\"\"></live-example>\n * // ~/resources/live-examples/{page}/stackblitz.json\n *\n * // Displays within the document page as an embedded style stackblitz editor\n * <live-example name=\"toh-pt1\" embedded stackblitz=\"minimal\">Tour of Heroes - Part 1</live-example>\n * // ~/resources/live-examples/toh-pt1/minimal.stackblitz.json\n */\n@Component({\n selector: 'live-example',\n templateUrl: 'live-example.component.html'\n})\nexport class LiveExampleComponent implements AfterContentInit {\n\n readonly mode: 'default' | 'embedded' | 'downloadOnly';\n readonly enableDownload: boolean;\n readonly stackblitz: string;\n readonly zip: string;\n title: string;\n\n @ViewChild('content', { static: true })\n private content: ElementRef;\n\n constructor(elementRef: ElementRef, location: Location) {\n const attrs = getAttrs(elementRef);\n const exampleDir = this.getExampleDir(attrs, location.path(false));\n const stackblitzName = this.getStackblitzName(attrs);\n\n this.mode = this.getMode(attrs);\n this.enableDownload = this.getEnableDownload(attrs);\n this.stackblitz = this.getStackblitz(exampleDir, stackblitzName, this.mode === 'embedded');\n this.zip = this.getZip(exampleDir, stackblitzName);\n this.title = this.getTitle(attrs);\n }\n\n ngAfterContentInit() {\n // Angular will sanitize this title when displayed, so it should be plain text.\n const textContent = this.content.nativeElement.textContent.trim();\n if (textContent) {\n this.title = textContent;\n }\n }\n\n private getEnableDownload(attrs: AttrMap) {\n const downloadDisabled = boolFromValue(getAttrValue(attrs, 'noDownload'));\n return !downloadDisabled;\n }\n\n private getExampleDir(attrs: AttrMap, path: string) {\n let exampleDir = getAttrValue(attrs, 'name');\n if (!exampleDir) {\n // Take the last path segment, excluding query params and hash fragment.\n const match = path.match(/[^/?#]+(?=\\/?(?:\\?|#|$))/);\n exampleDir = match ? match[0] : 'index';\n }\n return exampleDir.trim();\n }\n\n private getMode(this: LiveExampleComponent, attrs: AttrMap): typeof this.mode {\n const downloadOnly = boolFromValue(getAttrValue(attrs, 'downloadOnly'));\n const isEmbedded = boolFromValue(getAttrValue(attrs, 'embedded'));\n\n return downloadOnly ? 'downloadOnly'\n : isEmbedded ? 'embedded' :\n 'default';\n }\n\n private getStackblitz(exampleDir: string, stackblitzName: string, isEmbedded: boolean) {\n const urlQuery = isEmbedded ? '?ctl=1' : '';\n return `${LIVE_EXAMPLE_BASE}${exampleDir}/${stackblitzName}stackblitz.html${urlQuery}`;\n }\n\n private getStackblitzName(attrs: AttrMap) {\n const attrValue = (getAttrValue(attrs, 'stackblitz') || '').trim();\n return attrValue && `${attrValue}.`;\n }\n\n private getTitle(attrs: AttrMap) {\n return (getAttrValue(attrs, 'title') || '现场演练').trim();\n }\n\n private getZip(exampleDir: string, stackblitzName: string) {\n const zipName = exampleDir.split('/')[0];\n return `${ZIP_BASE}${exampleDir}/${stackblitzName}${zipName}.zip`;\n }\n}\n\n///// EmbeddedStackblitzComponent ///\n/**\n * Hides the <iframe> so we can test LiveExampleComponent without actually triggering\n * a call to stackblitz to load the iframe\n */\n@Component({\n selector: 'aio-embedded-stackblitz',\n template: '<iframe #iframe style=\"border: 0\" width=\"100%\" height=\"100%\" title=\"现场演练\"></iframe>',\n styles: [ 'iframe { min-height: 400px; }' ]\n})\nexport class EmbeddedStackblitzComponent implements AfterViewInit {\n @Input() src: string;\n\n @ViewChild('iframe', { static: true }) iframe: ElementRef;\n\n ngAfterViewInit() {\n // DEVELOPMENT TESTING ONLY\n // this.src = 'https://angular.io/resources/live-examples/quickstart/ts/stackblitz.json';\n\n if (this.iframe) {\n // security: the `src` is always authored by the documentation team\n // and is considered to be safe\n this.iframe.nativeElement.src = this.src;\n }\n }\n}\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { EmbeddedStackblitzComponent, LiveExampleComponent } from './live-example.component';\nimport { WithCustomElementComponent } from '../element-registry';\n\n@NgModule({\n imports: [ CommonModule ],\n declarations: [ LiveExampleComponent, EmbeddedStackblitzComponent ]\n})\nexport class LiveExampleModule implements WithCustomElementComponent {\n customElementComponent: Type<any> = LiveExampleComponent;\n}\n"],"x_google_ignoreList":[]}