-
Notifications
You must be signed in to change notification settings - Fork 1
/
src_app_custom-elements_ngrx_code-block_module_ts.866d717a203a8c41.js.map
1 lines (1 loc) · 6.37 KB
/
src_app_custom-elements_ngrx_code-block_module_ts.866d717a203a8c41.js.map
1
{"version":3,"file":"src_app_custom-elements_ngrx_code-block_module_ts.866d717a203a8c41.js","mappings":"2NAiBO,IAAMA,EAAa,UAAAC,EAApB,MAAOD,EAITE,YAAoBC,GAAAC,KAAAD,SAChBC,KAAKC,kBAAiBC,KAAYF,KAAKG,qBAAqBC,QAAKC,OACrE,CAEQF,oBACJ,MAAMG,EAAOC,OAAeN,eAC5B,OAAOK,EAAME,QAAQC,QAAQH,GAEzBI,EAAAC,EAAA,6BAAAC,KAAAF,EAAAG,EAAAC,KAAAJ,EAAA,SACKE,KACG,IAAOL,OAAeN,eACtBc,IACI,MAAMC,EAAM,uCAAuCD,EAAIE,UACvD,OAAAjB,KAAKD,OAAOmB,MAAM,IAAIC,MAAMH,IAErB,KACH,MAAM,IAAIG,MAAMH,EAAG,CACvB,EAEpB,CAYAI,WAAWC,EAAcC,EAAmBC,GACxC,OAAOvB,KAAKC,eAAeG,QACvBoB,KAAIlB,IACA,IACI,OAAOA,EAAIe,EAAMC,EAAUC,EAC/B,OAASR,GACL,MAAMC,EAAM,sCAAsCK,EAAKI,UAAU,EAAG,WACpEC,cAAQR,MAAMF,EAAKD,GACb,IAAII,MAAMH,EACpB,KACH,EACDW,OAER,WAhDS/B,0CAAagC,MAAAC,KAAA,4BAAbjC,EAAakC,QAAblC,EAAamC,YAAbnC,CAAa,uHCgBnB,IAAMoC,EAAkB,UAAAC,EAAzB,MAAOD,EAOTlC,YAAoBoC,GAAAlC,KAAAkC,SANXlC,KAAAqB,KAAO,GAIhBrB,KAAAmC,cAAgB,EAE4B,CAE5CC,qBAGIpC,KAAKkC,OAAOd,WAFe,YAAdpB,KAAKqB,KAlCF,wLAUG,0HA0BUgB,UAAUF,IACnCnC,KAAKsC,cAAcC,cAAcC,UAAYL,GAErD,WAfSH,0CAAkBJ,MAAAC,KAAA,0BAAlBG,EAAkBS,UAAA,sBAAAC,UAAA,SAAAC,EAAAC,MAAA,EAAAD,aAGSE,4MARpCjB,MAAA,WACEA,MAAA,aACFA,4BAGSI,CAAkB,KCrBlBc,EAAe,UAAAC,EAAtB,MAAOD,EANbhD,cAOIE,KAAAgD,uBAAoChB,YAD3Bc,yCAAe,0BAAfA,iCAFE,CAAClD,KAAcqD,QAAA,CAHhBC,QAKDJ,CAAe","names":["PrettyPrinter","_PrettyPrinter","constructor","logger","this","prettyPrintOne","fromPromise","getPrettyPrintOne","pipe","share","ppo","window","Promise","resolve","__webpack_require__","e","then","t","bind","err","msg","message","error","Error","formatCode","code","language","linenums","map","substring","console","first","i0","i1","factory","ɵfac","CodeBlockComponent","_CodeBlockComponent","pretty","formattedCode","ngAfterContentInit","subscribe","codeContainer","nativeElement","innerHTML","selectors","viewQuery","rf","ctx","ElementRef","CodeBlockModule","_CodeBlockModule","customElementComponent","imports","CommonModule"],"sourceRoot":"webpack:///","sources":["./src/app/custom-elements/code/pretty-printer.service.ts","./src/app/custom-elements/ngrx/code-block.component.ts","./src/app/custom-elements/ngrx/code-block.module.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { from as fromPromise, Observable } from 'rxjs';\nimport { first, map, share } from 'rxjs/operators';\n\nimport { Logger } from 'app/shared/logger.service';\n\ndeclare const System: {\n import(name: string): Promise<any>;\n};\n\ntype PrettyPrintOne = (code: string, language?: string, linenums?: number | boolean) => string;\n\n/**\n * Wrapper around the prettify.js library\n */\n@Injectable()\nexport class PrettyPrinter {\n\n private prettyPrintOne: Observable<PrettyPrintOne>;\n\n constructor(private logger: Logger) {\n this.prettyPrintOne = fromPromise(this.getPrettyPrintOne()).pipe(share());\n }\n\n private getPrettyPrintOne(): Promise<PrettyPrintOne> {\n const ppo = (window as any)['prettyPrintOne'];\n return ppo ? Promise.resolve(ppo) :\n // prettify.js is not in window global; load it with webpack loader\n import('assets/js/prettify.js')\n .then(\n () => (window as any)['prettyPrintOne'],\n err => {\n const msg = `Cannot get prettify.js from server: ${err.message}`;\n this.logger.error(new Error(msg));\n // return a pretty print fn that always fails.\n return () => {\n throw new Error(msg);\n };\n });\n }\n\n /**\n * Format code snippet as HTML\n * @param {string} code - the code snippet to format; should already be HTML encoded\n * @param {string} [language] - The language of the code to render (could be javascript, html, typescript, etc)\n * @param {string|number} [linenums] - Whether to display line numbers:\n * - false: don't display\n * - true: do display\n * - number: do display but start at the given number\n * @returns Observable<string> - Observable of formatted code\n */\n formatCode(code: string, language?: string, linenums?: number | boolean) {\n return this.prettyPrintOne.pipe(\n map(ppo => {\n try {\n return ppo(code, language, linenums);\n } catch (err) {\n const msg = `Could not format code that begins '${code.substring(0, 50)}...'.`;\n console.error(msg, err);\n throw new Error(msg);\n }\n }),\n first(), // complete immediately\n );\n }\n}\n","import {\n Component,\n Input,\n AfterContentInit,\n ViewChild,\n ElementRef,\n} from '@angular/core';\nimport { PrettyPrinter } from '../code/pretty-printer.service';\n\nconst EFFECTS_EXAMPLE = `\nsearch$ = createEffect(() => \n this.actions$.pipe(\n ofType(BookActions.search),\n exhaustMap(action =>\n this.googleBooksService.search(action.query)\n )\n )\n);`;\n\nconst SCHEMATICS_EXAMPLE = `\n$ ng g store State --root --module app.module.ts\n create src/app/reducers/index.ts\n update src/app/app.module.ts\n`;\n\n@Component({\n selector: 'ngrx-code-block',\n template: `\n <div class=\"prettyprint-scroller\">\n <pre class=\"prettyprint\" #codeContainer></pre>\n </div>\n `,\n})\nexport class CodeBlockComponent implements AfterContentInit {\n @Input() code = '';\n\n @ViewChild('codeContainer', { read: ElementRef, static: true }) codeContainer;\n\n formattedCode = '';\n\n constructor(private pretty: PrettyPrinter) {}\n\n ngAfterContentInit() {\n const code = this.code === 'effects' ? EFFECTS_EXAMPLE : SCHEMATICS_EXAMPLE;\n\n this.pretty.formatCode(code).subscribe(formattedCode => {\n this.codeContainer.nativeElement.innerHTML = formattedCode;\n });\n }\n}\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { CodeBlockComponent } from './code-block.component';\nimport { WithCustomElementComponent } from '../element-registry';\nimport { PrettyPrinter } from '../code/pretty-printer.service';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [CodeBlockComponent],\n exports: [CodeBlockComponent],\n providers: [PrettyPrinter],\n})\nexport class CodeBlockModule implements WithCustomElementComponent {\n customElementComponent: Type<any> = CodeBlockComponent;\n}\n"],"x_google_ignoreList":[]}