UNPKG

@dotglitch/ngx-lazy-loader

Version:

A hackable lazy loader for Angular components

1 lines 54.5 kB
{"version":3,"file":"dotglitch-ngx-lazy-loader.mjs","sources":["../../src/lib/lazy-loader/types.ts","../../src/utils/index.ts","../../src/utils/logger.ts","../../src/lib/lazy-loader/ngx-lazy-loader.service.ts","../../src/lib/lazy-loader/ngx-lazy-loader.component.ts","../../src/lib/lazy-loader/ngx-lazy-loader.component.html","../../src/lib/lazy-loader/ngx-lazy-loader.module.ts","../../src/index.ts","../../src/dotglitch-ngx-lazy-loader.ts"],"sourcesContent":["import { ComponentType } from '@angular/cdk/portal';\nimport { TemplateRef } from '@angular/core';\n\nexport enum ComponentResolveStrategy {\n /**\n * Match the fist component we find\n * (best used for standalone components)\n * @default\n */\n PickFirst,\n /**\n * Perform an Exact ID to Classname of the Component\n * case sensitive, zero tolerance.\n */\n MatchIdToClassName,\n /**\n * Perform a fuzzy ID to classname match\n * case insensitive, mutes symbols\n * ignores \"Component\" and \"Module\" postfixes on class\n * names\n */\n FuzzyIdClassName,\n\n /**\n * Use a user-provided component match function\n */\n Custom\n}\n\nexport type NgxLazyLoaderConfig = Partial<{\n entries: ComponentRegistration[],\n\n notFoundTemplate: TemplateRef<any>,\n notFoundComponent: ComponentType<any>,\n\n errorTemplate: TemplateRef<any>,\n errorComponent: ComponentType<any>,\n\n loaderDistractorTemplate: TemplateRef<any>,\n loaderDistractorComponent: ComponentType<any>,\n\n logger: {\n log: (...args: any) => void,\n warn: (...args: any) => void,\n err: (...args: any) => void;\n },\n /**\n * What strategy should be used to resolve components\n * @default ComponentResolveStrategy.FuzzyIdClassName\n */\n componentResolveStrategy: ComponentResolveStrategy,\n customResolver: (registry: (CompiledComponent | CompiledModule)[]) => Object\n}>;\n\ntype RegistrationConfig = {\n /**\n * Specify a group to categorize components. If not specified,\n * will default to the `default` group.\n */\n group?: string,\n /**\n * load: () => import('./pages/my-page/my-page.component')\n */\n load: () => any,\n\n /**\n * Called before a component is loaded.\n * If it returns `false` the component will not be loaded.\n */\n // canActivate: () => boolean\n\n [key: string]: any\n}\n\nexport type ComponentRegistration = (\n ({ id: string } & RegistrationConfig) |\n ({ matcher: string[] | RegExp | ((value: string) => boolean); } & RegistrationConfig)\n);\n\nexport type DynamicRegistrationArgs<T = any> = {\n id: string,\n group?: string,\n matcher?: string[] | RegExp | ((val: string) => boolean),\n component?: T,\n load?: () => any;\n}\n\n/**\n * This is roughly a compiled component\n */\nexport type CompiledComponent = {\n (): CompiledComponent,\n ɵfac: Function,\n ɵcmp: {\n consts;\n contentQueries;\n data;\n declaredInputs;\n decls;\n dependencies;\n directiveDefs;\n encapsulation;\n exportAs;\n factory;\n features;\n findHostDirectiveDefs;\n getStandaloneInjector;\n hostAttrs;\n hostBindings;\n hostDirectives;\n hostVars;\n id: string;\n inputs;\n ngContentSelectors;\n onPush: boolean;\n outputs;\n pipeDefs;\n providersResolver;\n schemas;\n selectors: string[];\n setInput;\n standalone: boolean;\n styles: string[];\n tView;\n template;\n type: Function;\n vars: number;\n viewQuery;\n };\n};\n\n/**\n * This is roughly a compiled module\n */\nexport type CompiledModule = {\n (): CompiledModule,\n ɵfac: Function,\n ɵinj: {\n providers: any[],\n imports: any[];\n },\n ɵmod: {\n bootstrap: any[],\n declarations: Function[],\n exports: any[],\n id: unknown,\n imports: any[],\n schemas: unknown,\n transitiveCompileScopes: unknown,\n type: Function;\n };\n};\n\nexport type CompiledBundle = { [key: string]: CompiledComponent | CompiledModule; };\n\n\n","\n/**\n * Convert a string `fooBAR baz_160054''\"1]\"` into a slug: `foobar-baz-1600541`\n */\nexport const stringToSlug = (text: string) =>\n (text || '')\n .trim()\n .toLowerCase()\n .replace(/[\\-_+ ]/g, '-')\n .replace(/[^a-z0-9\\-]/g, '');\n\n","\nexport const Logger = (context: string, contextColor: string, textColor: string = \"#03a9f4\") => ({\n\n log: (message: string, ...args) => {\n console.log(`%c[${context}] %c${message}`, 'color: ' + contextColor, 'color: ' + textColor, ...args);\n },\n warn: (message: string, ...args) => {\n console.warn(`%c[${context}] %c${message}`, 'color: ' + contextColor, 'color: ' + textColor, ...args);\n },\n\n err: (message: string, ...args) => {\n console.error(`%c[${context}] %c${message}`, 'color: ' + contextColor, 'color: ' + textColor, ...args);\n },\n error: (message: string, ...args) => {\n console.error(`%c[${context}] %c${message}`, 'color: ' + contextColor, 'color: ' + textColor, ...args);\n }\n\n});\n","import { Inject, Injectable, InjectionToken, isDevMode } from '@angular/core';\nimport { CompiledComponent, CompiledModule, ComponentRegistration, ComponentResolveStrategy, DynamicRegistrationArgs, NgxLazyLoaderConfig } from './types';\nimport { stringToSlug } from '../../utils';\nimport { Logger } from '../../utils/logger';\n\n// Monkey-patch the type of these symbols.\nconst $id = Symbol(\"id\") as any as string;\nconst $group = Symbol(\"group\") as any as string;\n\nexport const NGX_LAZY_LOADER_CONFIG = new InjectionToken<NgxLazyLoaderConfig>('config');\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxLazyLoaderService {\n private get err() { return NgxLazyLoaderService.config.logger.err; }\n private get log() { return NgxLazyLoaderService.config.logger.log; }\n private get warn() { return NgxLazyLoaderService.config.logger.warn; }\n\n // A proxied registry that mutates reference keys\n private static registry: {\n [key: string]: ComponentRegistration[];\n } = {};\n\n public static config: NgxLazyLoaderConfig;\n\n constructor(@Inject(NGX_LAZY_LOADER_CONFIG) config: NgxLazyLoaderConfig = {}) {\n // Ensure this is singleton and works regardless of special instancing requirements.\n NgxLazyLoaderService.configure(config);\n }\n\n private static configure(config: NgxLazyLoaderConfig) {\n const { log, warn, err } = Logger(\"ngx-lazy-loader\", \"#009688\");\n\n this.config = {\n componentResolveStrategy: ComponentResolveStrategy.PickFirst,\n logger: {\n log,\n warn,\n err\n },\n ...config\n };\n\n config.entries?.forEach(e => this.addComponentToRegistry(e))\n\n // If a custom resolution strategy is provided but no resolution function is passed,\n // we throw an error\n if (\n this.config.componentResolveStrategy == ComponentResolveStrategy.Custom &&\n !this.config.customResolver\n ) {\n throw new Error(\"Cannot initialize. Configuration specifies a custom resolve matcher but none was provided\");\n }\n\n if (this.config.loaderDistractorComponent && this.config.loaderDistractorTemplate)\n throw new Error(\"Cannot have both a Component and Template for Distractor view.\")\n if (this.config.errorComponent && this.config.errorTemplate)\n throw new Error(\"Cannot have both a Component and Template for Error view.\")\n if (this.config.notFoundComponent && this.config.notFoundTemplate)\n throw new Error(\"Cannot have both a Component and Template for NotFound view.\")\n\n }\n\n private static addComponentToRegistry(registration: ComponentRegistration) {\n if (!registration)\n throw new Error(\"Cannot add <undefined> component into registry.\");\n\n // Clone the object into our repository and transfer the id into a standardized slug format\n\n const id = stringToSlug(registration.id ?? Date.now().toString()); // purge non-basic ASCII chars\n const group = registration.group || \"default\";\n\n registration[$id] = id;\n registration[$group] = id;\n\n\n if (!this.registry[group])\n this.registry[group] = [];\n\n // Check if we already have a registration for the component\n // if (this.registry[group] && typeof this.registry[group]['load'] == \"function\") {\n // // Warn the developer that the state is problematic\n // this.config.logger.warn(\n // `A previous entry already exists for ${id}! The old registration will be overridden.` +\n // `Please ensure you use groups if you intend to have duplicate component ids. ` +\n // `If this was intentional, first remove the old component from the registry before adding a new instance`\n // );\n\n // // If we're in dev mode, break the loader surface\n // if (isDevMode())\n // return;\n // }\n\n this.registry[group].push(registration);\n }\n\n /**\n * Register an Angular component\n * @param id identifier that is used to resolve the component\n * @param group\n * @param component Angular Component Class constructor\n */\n public registerComponent<T extends { new(...args: any[]): InstanceType<T>; }>(args: DynamicRegistrationArgs<T>) {\n if (this.isComponentRegistered(args.id, args.group)) {\n this.log(`Will not re-register component '${args.id}' in group '${args.group || 'default'}' `);\n return;\n }\n\n NgxLazyLoaderService.addComponentToRegistry({\n id: stringToSlug(args.id),\n matcher: args.matcher,\n group: stringToSlug(args.group || \"default\"),\n load: args.load || (() => args.component)\n });\n }\n\n /**\n *\n * @param id\n * @param group\n */\n public unregisterComponent(id: string, group = \"default\") {\n const _id = stringToSlug(id);\n const _group = stringToSlug(group);\n\n if (!this.resolveRegistrationEntry(id, group))\n throw new Error(\"Cannot unregister component ${}! Component is not present in registry\")\n\n // TODO: handle clearing running instances\n delete NgxLazyLoaderService.registry[_group][_id];\n }\n\n\n /**\n * Get the registration entry for a component.\n * Returns null if component is not in the registry.\n */\n public resolveRegistrationEntry(value: string, group = \"default\") {\n const _id = stringToSlug(value);\n const _group = stringToSlug(group);\n\n const targetGroup = (NgxLazyLoaderService.registry[_group] || []);\n\n let items = targetGroup.filter(t => {\n if (!t) return false;\n\n // No matcher, check id\n if (!t.matcher)\n return t[$id] == _id;\n\n // Matcher is regex\n if (t.matcher instanceof RegExp)\n return t.matcher.test(_id) || t.matcher.test(value);\n\n // Matcher is string => regex\n if (typeof t.matcher == 'string') {\n const rx = new RegExp(t.matcher, 'ui');\n return rx.test(_id) || rx.test(value);\n }\n\n // Matcher is array\n if (Array.isArray(t.matcher)) {\n return !!t.matcher.find(e => stringToSlug(e) == _id);\n }\n\n // Custom matcher function\n if (typeof t.matcher == \"function\")\n return t.matcher(_id);\n\n return false;\n });\n\n if (items.length > 1) {\n this.warn(\"Resolved multiple components for the provided `[component]` binding. This may cause UI conflicts.\");\n }\n if (items.length == 0) {\n return null;\n }\n\n const out = items[0];\n\n if (out.matcher instanceof RegExp) {\n const result = _id.match(out.matcher) || value.match(out.matcher);\n\n return {\n entry: out,\n matchGroups: result?.groups\n };\n }\n\n return { entry: out };\n }\n\n /**\n * Check if a component is currently registered\n * Can be used to validate regex matchers and aliases.\n */\n public isComponentRegistered(value: string, group = \"default\") {\n return !!this.resolveRegistrationEntry(value, group);\n }\n\n /**\n *\n * @param bundle\n * @returns The component `Object` if a component was resolved, `null` if no component was found\n * `false` if the specified strategy was an invalid selection\n */\n public resolveComponent(id: string, group: string, modules: (CompiledComponent | CompiledModule)[]): Object | null | false {\n\n switch (NgxLazyLoaderService.config.componentResolveStrategy) {\n case ComponentResolveStrategy.PickFirst: {\n\n return modules[0];\n }\n\n // Exact id -> classname match\n case ComponentResolveStrategy.MatchIdToClassName: {\n const matches =\n modules\n .filter(k => k.name == id);\n\n if (matches.length == 0)\n return null;\n\n return matches[0];\n }\n // Fuzzy id -> classname match\n case ComponentResolveStrategy.FuzzyIdClassName: {\n const _id = id.replace(/[^a-z0-9_\\-]/ig, '');\n\n if (_id.length == 0) {\n NgxLazyLoaderService.config.logger.err(\"Fuzzy classname matching stripped all symbols from the ID specified!\");\n return false;\n }\n\n const rx = new RegExp(`^${id}(component|module)?$`, \"i\");\n\n const matches = modules\n .filter(mod => {\n let kid = mod.name.replace(/[^a-z0-9_\\-]/ig, '');\n\n return rx.test(kid);\n });\n\n if (matches.length > 1) {\n NgxLazyLoaderService.config.logger.err(\"Fuzzy classname matching resolved multiple targets!\");\n return false;\n }\n\n if (matches.length == 0) {\n NgxLazyLoaderService.config.logger.err(\"Fuzzy classname matching resolved no targets!\");\n return null;\n }\n\n return matches[0];\n }\n case ComponentResolveStrategy.Custom: {\n return NgxLazyLoaderService.config.customResolver(modules as any);\n }\n default: {\n return false;\n }\n }\n }\n}\n","import { Input, ViewContainerRef, isDevMode, ComponentRef, EventEmitter, Optional, ViewChild, Component, Inject, Output, NgModule, AfterViewInit, OnInit } from '@angular/core';\nimport { NgComponentOutlet, NgIf, NgTemplateOutlet } from '@angular/common';\nimport { MAT_DIALOG_DATA, } from '@angular/material/dialog';\nimport { DialogRef } from '@angular/cdk/dialog';\nimport { BehaviorSubject, debounceTime, Subscription } from 'rxjs';\nimport { NgxLazyLoaderService } from './ngx-lazy-loader.service';\nimport { stringToSlug } from '../../utils';\nimport { CompiledBundle, NgxLazyLoaderConfig } from './types';\n\n\n@Component({\n selector: 'ngx-lazy-loader',\n templateUrl: './ngx-lazy-loader.component.html',\n styleUrls: [ './ngx-lazy-loader.component.scss' ],\n imports: [ NgIf, NgComponentOutlet, NgTemplateOutlet ],\n standalone: true\n})\nexport class NgxLazyLoaderComponent implements AfterViewInit {\n @ViewChild(\"content\", { read: ViewContainerRef }) targetContainer: ViewContainerRef;\n\n /**\n * ! Here be dragons.\n * Only the bravest of Adventurers can survive the battles below,\n * and they must be trained and ready for the gruelling journey ahead.\n * Many a soul has tried to best these Dragons, yet only one has\n * succeeded since our founding.\n *\n * TL;DR -- Don't mess with this unless you know what you're doing.\n * This is central to a ton of moving parts -- breaking it will\n * cause more collateral damage than you may realize.\n */\n\n private _id: string;\n /**\n * The id of the component that will be lazy loaded\n */\n @Input(\"component\") set id(data: string) {\n const id = stringToSlug(data);\n\n // Check if there is a change to the loaded component's id\n // if it's updated, we destroy and rehydrate the entire container\n if (this.initialized && this._id != id) {\n this._id = id;\n this.ngAfterViewInit();\n }\n else {\n this._id = id;\n }\n };\n\n\n private _group = \"default\";\n @Input(\"group\") set group(data: string) {\n const group = stringToSlug(data);\n\n if (typeof group != \"string\" || !group) return;\n\n // If the group was updated, retry to bootstrap something into the container.\n if (this.initialized && this._group != group) {\n this._group = group;\n\n this.ngAfterViewInit();\n return;\n }\n\n this._group = group;\n }\n get group() { return this._group }\n\n private _matchGroups: { [key: string]: string };\n private _inputs: { [key: string]: any; };\n /**\n * A map of inputs to bind to the child.\n * Supports change detection. (May fail on deep JSON changes)\n *\n * ```html\n * <lazy-loader component=\"MyLazyComponent\"\n * [inputs]=\"{\n * prop1: true,\n * prop2: false,\n * complex: {\n * a: true,\n * b: 0\n * }\n * }\"\n * >\n * </lazy-loader>\n * ```\n */\n @Input(\"inputs\") set inputs(data: { [key: string]: any; }) {\n if (data == undefined) return;\n\n let previous = this._inputs;\n this._inputs = data;\n if (data == undefined)\n console.trace(data);\n\n if (this.targetComponentFactory) {\n const { inputs } = this.targetComponentFactory.ɵcmp;\n\n const currentKeys = Object.keys(inputs);\n\n const oldKeys = Object.keys(previous).filter(key => currentKeys.includes(key));\n const newKeys = Object.keys(data).filter(key => currentKeys.includes(key));\n\n const removed = oldKeys.filter(key => !newKeys.includes(key));\n\n // ? perhaps set to null or undefined instead\n removed.forEach(k => this.targetComponentInstance[k] = null);\n\n this.bindInputs();\n }\n }\n\n\n private outputSubscriptions: { [key: string]: Subscription; } = {};\n private _outputs: { [key: string]: Function; };\n /**\n * A map of outputs to bind from the child.\n * Should support change detection.\n * ```html\n * <lazy-loader component=\"MyLazyComponent\"\n * [outputs]=\"{\n * prop3: onOutputFire\n * }\"\n * >\n * </lazy-loader>\n * ```\n */\n @Input(\"outputs\") set outputs(data: { [key: string]: Function; }) {\n let previous = this._outputs;\n this._outputs = data;\n\n if (this.targetComponentFactory) {\n const { inputs } = this.targetComponentFactory.ɵcmp;\n\n const currentKeys = Object.keys(inputs);\n const removed = Object.keys(previous).filter(key => !currentKeys.includes(key));\n\n removed.forEach(k => {\n // Unsubscribe from observable\n this.outputSubscriptions[k]?.unsubscribe();\n delete this.targetComponentInstance[k];\n });\n\n this.bindOutputs();\n }\n }\n\n /**\n * Emits errors encountered when loading components\n */\n @Output() componentLoadError = new EventEmitter();\n\n /**\n * Emits when the component is fully constructed\n * and had it's inputs and outputs bound\n * > before `OnInit`\n *\n * Returns the active class instance of the lazy-loaded component\n */\n @Output() componentLoaded = new EventEmitter();\n\n\n /**\n * This is an instance of the component that is currently loaded.\n */\n public instance: any;\n\n\n /**\n * Container that provides the component data\n */\n private targetModule: CompiledBundle;\n\n /**\n * Component definition\n */\n private targetComponentFactory: any;\n\n /**\n * Active component container reference\n */\n private targetComponentContainerRef: ComponentRef<any>;\n private targetRef: any;\n /**\n * Reference to the component class instance\n */\n private targetComponentInstance: any;\n\n /**\n * Subscription with true/false state on whether the distractor should be\n */\n private distractorSubscription: Subscription;\n\n public config: NgxLazyLoaderConfig;\n private err;\n private warn;\n private log;\n\n // Force 500ms delay before revealing the spinner\n private loaderEmitter = new EventEmitter();\n private clearLoader$ = this.loaderEmitter.pipe(debounceTime(300));\n private loaderSub: Subscription;\n showLoader = true; // whether we render the DOM for the spinner\n isClearingLoader = false; // should the spinner start fading out\n\n constructor(\n private service: NgxLazyLoaderService,\n @Optional() private viewContainerRef: ViewContainerRef,\n @Optional() public dialog: DialogRef,\n @Optional() @Inject(MAT_DIALOG_DATA) public dialogArguments\n ) {\n this.config = NgxLazyLoaderService.config;\n this.err = NgxLazyLoaderService.config.logger.err;\n this.warn = NgxLazyLoaderService.config.logger.warn;\n this.log = NgxLazyLoaderService.config.logger.log;\n\n // First, check for dialog arguments\n if (this.dialogArguments) {\n this.inputs = this.dialogArguments.inputs || this.dialogArguments.data;\n this.outputs = this.dialogArguments.outputs;\n this.id = this.dialogArguments.id;\n this.group = this.dialogArguments.group;\n }\n\n this.loaderSub = this.clearLoader$.subscribe(() => {\n this.showLoader = false;\n });\n }\n\n private initialized = false;\n async ngAfterViewInit() {\n this.ngOnDestroy(false);\n this.isClearingLoader = false;\n this.showLoader = true;\n\n this.initialized = true;\n\n if (!this._id) {\n this.warn(\"No component was specified!\");\n return this.loadDefault();\n }\n\n try {\n const _entry = this.service.resolveRegistrationEntry(this._id, this._group);\n if (!_entry || !_entry.entry) {\n this.err(`Failed to find Component '${this._id}' in group '${this._group}' in registry!`);\n return this.loadDefault();\n }\n\n const { entry, matchGroups } = _entry;\n this._matchGroups = matchGroups;\n\n // Download the \"module\" (the standalone component)\n const bundle: CompiledBundle = this.targetModule = await entry.load();\n\n\n // Check if there is some corruption on the bundle.\n if (!bundle || typeof bundle != 'object' || bundle['__esModule'] as any !== true || bundle.toString() != \"[object Module]\") {\n this.err(`Failed to load component/module for '${this._id}'! Parsed resource is invalid.`);\n return this.loadError();\n }\n\n const modules = Object.keys(bundle)\n .map(k => {\n const entry = bundle[k];\n\n // Strictly check for exported modules or standalone components\n if (typeof entry == \"function\" && typeof entry[\"ɵfac\"] == \"function\")\n return entry;\n return null;\n })\n .filter(e => e != null)\n .filter(entry => {\n entry['_isModule'] = !!entry['ɵmod']; // module\n entry['_isComponent'] = !!entry['ɵcmp']; // component\n\n return (entry['_isModule'] || entry['_isComponent']);\n });\n\n if (modules.length == 0) {\n this.err(`Component/Module loaded for '${this._id}' has no exported components or modules!`);\n return this.loadError();\n }\n\n const component = this.targetComponentFactory = this.service.resolveComponent(this._id, \"default\", modules);\n\n if (!component) {\n this.err(`Component '${this._id}' is invalid or corrupted!`);\n return this.loadError();\n }\n\n\n // Bootstrap the component into the container\n const componentRef = this.targetComponentContainerRef = this.targetContainer.createComponent(component as any);\n this.targetRef = this.targetContainer.insert(this.targetComponentContainerRef.hostView);\n\n const instance: any = this.targetComponentInstance = componentRef['instance'];\n\n this.bindInputs();\n this.bindOutputs();\n\n this.componentLoaded.next(instance);\n this.instance = instance;\n\n // Look for an observable called isLoading$ that will make us show/hide\n // the same distractor that is used on basic loading\n const isLoading$ = instance['ngxShowDistractor$'] as BehaviorSubject<boolean>;\n\n if (isLoading$ && typeof isLoading$.subscribe == \"function\") {\n this.distractorSubscription = isLoading$.subscribe(loading => {\n if (!loading) {\n this.isClearingLoader = true;\n this.loaderEmitter.emit();\n }\n else {\n this.showLoader = true;\n this.isClearingLoader = false;\n }\n });\n }\n else {\n this.isClearingLoader = true;\n }\n\n const name = Object.keys(bundle)[0];\n this.log(`Loaded '${name}'`);\n this.loaderEmitter.emit();\n\n return componentRef;\n }\n catch (ex) {\n\n if (isDevMode()) {\n console.warn(\"Component \" + this._id + \" threw an error on mount!\");\n console.warn(\"This will cause you to see a 404 panel.\");\n console.error(ex);\n }\n\n // Network errors throw a toast and return an error component\n if (ex && !isDevMode()) {\n console.error(\"Uncaught error when loading component\");\n throw ex;\n }\n\n return this.loadDefault();\n }\n }\n\n ngOnDestroy(clearAll = true) {\n // unsubscribe from all subscriptions\n Object.entries(this.outputSubscriptions).forEach(([key, sub]) => {\n sub.unsubscribe();\n });\n this.outputSubscriptions = {};\n\n // Clear all things\n if (clearAll) {\n this.loaderSub?.unsubscribe();\n }\n\n this.distractorSubscription?.unsubscribe();\n\n // Clear target container\n this.targetRef?.destroy();\n this.targetComponentContainerRef?.destroy();\n this.targetContainer?.clear();\n\n // Wipe the rest of the state clean\n this.targetRef = null;\n this.targetComponentContainerRef = null;\n }\n\n /**\n * Bind the input values to the child component.\n */\n private bindInputs() {\n if (!this._inputs || !this.targetComponentInstance) return;\n\n // Merge match groups\n if (typeof this._matchGroups == \"object\") {\n Object.entries(this._matchGroups).forEach(([key, val]) => {\n if (typeof this._inputs[key] == 'undefined')\n this._inputs[key] = val;\n });\n }\n\n // forward-bind inputs\n const { inputs } = this.targetComponentFactory.ɵcmp;\n\n // Returns a list of entries that need to be set\n // This makes it so that unnecessary setters are not invoked.\n const updated = Object.entries(inputs).filter(([parentKey, childKey]: [string, string]) => {\n return this.targetComponentInstance[childKey] != this._inputs[parentKey];\n });\n\n updated.forEach(([parentKey, childKey]: [string, string]) => {\n if (this._inputs.hasOwnProperty(parentKey))\n this.targetComponentInstance[childKey] = this._inputs[parentKey];\n });\n }\n\n /**\n * Bind the output handlers to the loaded child component\n */\n private bindOutputs() {\n if (!this._outputs || !this.targetComponentInstance) return;\n\n const { outputs } = this.targetComponentFactory.ɵcmp;\n\n // Get a list of unregistered outputs\n const newOutputs = Object.entries(outputs).filter(([parentKey, childKey]: [string, string]) => {\n return !this.outputSubscriptions[parentKey];\n });\n\n // Reverse bind via subscription\n newOutputs.forEach(([parentKey, childKey]: [string, string]) => {\n if (this._outputs.hasOwnProperty(parentKey)) {\n const target: EventEmitter<unknown> = this.targetComponentInstance[childKey];\n const outputs = this._outputs;\n\n // Angular folks, stop making this so difficult.\n const ctx = this.viewContainerRef['_hostLView'][8];\n const sub = target.subscribe(outputs[parentKey].bind(ctx)); // Subscription\n\n this.outputSubscriptions[parentKey] = sub;\n }\n });\n }\n\n /**\n * Load the \"Default\" component (404) screen normally.\n * This is shown when the component id isn't in the\n * registry or otherwise doesn't match\n *\n * This\n */\n private loadDefault() {\n if (this.config.notFoundComponent)\n this.targetContainer.createComponent(this.config.notFoundComponent);\n\n this.showLoader = false;\n }\n\n /**\n * Load the \"Error\" component.\n * This is shown when we are able to resolve the component\n * in the registry, but have some issue boostrapping the\n * component into the viewContainer\n */\n private loadError() {\n if (this.config.errorComponent)\n this.targetContainer.createComponent(this.config.errorComponent);\n\n this.showLoader = false;\n }\n}\n","<ng-container #content></ng-container>\n\n<div class=\"ngx-lazy-loader-distractor\" [class.destroying]=\"isClearingLoader\">\n <ng-container *ngIf=\"config.loaderDistractorComponent\" [ngComponentOutlet]=\"config.loaderDistractorComponent\"></ng-container>\n <ng-container *ngIf=\"config.loaderDistractorTemplate\" [ngTemplateOutlet]=\"config.loaderDistractorTemplate\" [ngTemplateOutletContext]=\"{ '$implicit': inputs }\"></ng-container>\n</div>\n","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { NgxLazyLoaderConfig } from './types';\nimport { NgxLazyLoaderComponent } from './ngx-lazy-loader.component';\nimport { NgxLazyLoaderService, NGX_LAZY_LOADER_CONFIG } from './ngx-lazy-loader.service';\n\n@NgModule({\n imports: [NgxLazyLoaderComponent],\n exports: [NgxLazyLoaderComponent]\n})\nexport class NgxLazyLoaderModule {\n public static forRoot(config: NgxLazyLoaderConfig): ModuleWithProviders<NgxLazyLoaderModule> {\n return ({\n ngModule: NgxLazyLoaderModule,\n providers: [\n NgxLazyLoaderService,\n {\n provide: NGX_LAZY_LOADER_CONFIG,\n useValue: config\n }\n ]\n });\n }\n}\n","/*\n * Public API Surface of ngx-lazy-loader\n */\n\nexport * from './lib/lazy-loader/ngx-lazy-loader.service';\nexport * from './lib/lazy-loader/ngx-lazy-loader.module';\nexport * from './lib/lazy-loader/ngx-lazy-loader.component';\nexport * from './lib/lazy-loader/types';\n\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAGY,IAAA,yBAwBX;AAxBD,CAAA,UAAY,wBAAwB,EAAA;AAChC;;;;AAIG;IACH,wBAAA,CAAA,wBAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT;;;AAGG;IACH,wBAAA,CAAA,wBAAA,CAAA,oBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,oBAAkB,CAAA;AAClB;;;;;AAKG;IACH,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