-
Notifications
You must be signed in to change notification settings - Fork 1
/
src_app_custom-elements_live-example_live-example_module_ts.fa1cca39151839ea.js.map
1 lines (1 loc) · 14.1 KB
/
src_app_custom-elements_live-example_live-example_module_ts.fa1cca39151839ea.js.map
1
{"version":3,"file":"src_app_custom-elements_live-example_live-example_module_ts.fa1cca39151839ea.js","mappings":"+NAyBM,SAAUA,EAAaC,EAAgBC,GACzC,MAAMC,EAAuB,iBAATD,EACdA,EACAA,EAAKE,KAAKC,GAAKJ,EAAMK,eAAeD,EAAEE,gBAE5C,YAAgBC,IAARL,OAAqBK,EAAYP,EAAME,EAAII,cACvD,CAOM,SAAUE,EAAcC,EAA+BC,GAAM,GAC/D,YAAqBH,IAAdE,EAA0BC,EAA2B,UAArBD,EAAUE,MACrD,8CChCIC,MAAA,OACEA,MAAA,oBAAaA,MAAA,SAAkDA,MAAA,2BAAqBA,QAAIA,MAAA,QAC1FA,+BADkBA,MAAA,GAAAA,MAAA,OAAAC,EAAAC,IAAAF,iCALpBA,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,SAAkDA,MAAA,sBAAgBA,iCAA/DA,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,EAAA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,SAAW,IAE7C,CAEQZ,kBAAkB7C,GACtB,MAAMS,GAAaV,EAAaC,EAAO,eAAiB,IAAIW,OAC5D,OAAOF,GAAa,GAAGA,IAC3B,CAEQ0C,SAASnD,GACb,OAAQD,EAAaC,EAAO,UAAY,gBAAgBW,MAC5D,CAEQuC,OAAOV,EAAoBI,GAC/B,MAAMc,EAAUlB,EAAWmB,MAAM,KAAK,GACtC,MAAO,GAAGjC,IAAWc,KAAcI,IAAiBc,OACxD,WAhFS/B,0CAAoBf,mBAAAgD,MAAA,0BAApBjC,EAAoBkC,UAAA,mBAAAC,UAAA,SAAAC,EAAAC,MAAA,EAAAD,0YDlEjCnD,MAAA,cAAqCA,MAAA,GAAyBA,QAE9DA,MAAA,YACEA,MAAA,EAAAqD,EAAA,aAAArD,CAOO,EAAAsD,EAAA,aAPPtD,CAOO,EAAAuD,EAAA,cAUTvD,eAlBMA,MAAA,GAAAA,MAAA,WAAAoD,EAAAlB,MACGlC,cAAA,2BAQAA,cAAA,uECyJIwD,GAA2BC,cAAA,IAlG3B1C,CAAoB,KAkGpByC,EAA2B,UAAAE,EAAlC,MAAOF,EAKTG,kBAIQ9B,KAAK+B,SAGL/B,KAAK+B,OAAOrC,cAAcsC,IAAMhC,KAAKgC,IAE7C,WAdSL,yCAA2B,0BAA3BA,EAA2BP,UAAA,8BAAAC,UAAA,SAAAC,EAAAC,MAAA,EAAAD,wMARzBnD,MAAA,wJAQFwD,CAA2B,KC5J3BM,EAAiB,UAAAC,EAAxB,MAAOD,EAJb7C,cAKIY,KAAAmC,uBAAoCjD,YAD3B+C,yCAAiB,0BAAjBA,gCAHCG,QAGDH,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","_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","i1","selectors","viewQuery","rf","ctx","LiveExampleComponent_span_4_Template","LiveExampleComponent_span_5_Template","LiveExampleComponent_span_6_Template","EmbeddedStackblitzComponent","encapsulation","_EmbeddedStackblitzComponent","ngAfterViewInit","iframe","src","LiveExampleModule","_LiveExampleModule","customElementComponent","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 * @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 * @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 * @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 = false) {\n return attrValue === undefined ? def : attrValue.trim() !== 'false';\n}\n\n/**\n * Return the boolean state of attribute from an element\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 = 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 You can also <a [href]=\"zip\" download title=\"Download example\">download this example</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=\"Download example\">download example</a>\n </span>\n </span>\n</span>\n","/* eslint-disable @angular-eslint/component-selector */\nimport {\n AfterContentInit,\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n ViewChild,\n} from '@angular/core';\nimport { Location } from '@angular/common';\nimport { CONTENT_URL_PREFIX } from 'app/documents/document.service';\nimport {\n AttrMap,\n boolFromValue,\n getAttrs,\n getAttrValue,\n} from 'app/shared/attribute-utils';\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 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(\n exampleDir,\n stackblitzName,\n this.mode === 'embedded'\n );\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(\n this: LiveExampleComponent,\n attrs: AttrMap\n ): typeof this.mode {\n const downloadOnly = boolFromValue(getAttrValue(attrs, 'downloadOnly'));\n const isEmbedded = boolFromValue(getAttrValue(attrs, 'embedded'));\n\n return downloadOnly ? 'downloadOnly' : isEmbedded ? 'embedded' : 'default';\n }\n\n private getStackblitz(\n exampleDir: string,\n stackblitzName: string,\n isEmbedded: boolean\n ) {\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') || 'live example').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\n #iframe\n frameborder=\"0\"\n width=\"100%\"\n height=\"100%\"\n ></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":[]}