@bespunky/angular-zen
Version:
The Angular tools you always wished were there.
1 lines • 50.3 kB
Source Map (JSON)
{"version":3,"file":"bespunky-angular-zen-router-x.mjs","sources":["../../../../libs/angular-zen/router-x/src/config/router-x-config.provider.ts","../../../../libs/angular-zen/router-x/src/outlet/router-outlet-component-bus.service.ts","../../../../libs/angular-zen/router-x/src/outlet/publish-component.directive.ts","../../../../libs/angular-zen/router-x/src/router-x.module.ts","../../../../libs/angular-zen/router-x/src/services/route-aware.service.ts","../../../../libs/angular-zen/router-x/src/services/url-reflection.service.ts","../../../../libs/angular-zen/router-x/src/bespunky-angular-zen-router-x.ts"],"sourcesContent":["import { InjectionToken, Provider } from '@angular/core';\n\nimport { RouterXConfig } from './router-x-config';\n\n/**\n * An injection token for the provided router configuration.\n * `RouterExModule.forRoot()` facilitates the injection of this token. No need to inject directly.\n */\nexport const RouterX = new InjectionToken<RouterXConfig>('RouterX.Config');\n\n/** The default configuration for the router-x module. */\nexport const DefaultRouterXConfig: RouterXConfig = {};\n\n/**\n * Creates a provider for the router-x module configuration.\n * Options not provided will be replaced with their default values according to `DefaultRouterXConfig`.\n *\n * @export\n * @param {RouterXConfig} config\n * @returns {Provider}\n */\nexport function provideRouterXConfig(config?: RouterXConfig): Provider \n{\n config = Object.assign({}, DefaultRouterXConfig, config);\n\n return { provide: RouterX, useValue: config }\n}","import { BehaviorSubject } from 'rxjs';\nimport { EventEmitter, Injectable } from '@angular/core';\nimport { PRIMARY_OUTLET } from '@angular/router';\nimport { AnyObject } from '@bespunky/typescript-utils';\n\n/**\n * Holds data related with a router outlet event.\n *\n * @export\n * @class RouterOutletEventData\n */\nexport class RouterOutletEventData\n{\n /**\n * Creates an instance of RouterOutletEventData.\n * \n * @param {string} outletName The name of the outlet which triggered the event. For the primary unnamed outlet, this will be angular's PRIMARY_OUTLET.\n */\n constructor(public readonly outletName: string) { }\n \n /**\n * `true` if the event was triggered by the primary unnamed outlet; otherwise `false`.\n *\n * @readonly\n * @type {boolean}\n */\n public get isPrimaryOutlet(): boolean\n {\n return this.outletName === PRIMARY_OUTLET;\n }\n}\n\n/**\n * Holds data related with component publishing triggered by outlet activation.\n *\n * @export\n * @class ComponentPublishEventData\n * @extends {RouterOutletEventData}\n */\nexport class ComponentPublishEventData extends RouterOutletEventData\n{\n /**\n * Creates an instance of ComponentPublishEventData.\n * \n * @param {BehaviorSubject<AnyObject | null>} changes The observable used to track changes to the activated component of the triggering outlet.\n * @param {string} outletName The name of the outlet which triggered the event. For the primary unnamed outlet, this will be angular's PRIMARY_OUTLET.\n */\n constructor(public readonly changes: BehaviorSubject<AnyObject | null>, outletName: string)\n {\n super(outletName);\n }\n\n /**\n * The instance of the last component activated by the outlet which triggered the event.\n * This will be null if the outlet has deactivated the component.\n * \n * @readonly\n * @type {(AnyObject | null)}\n */\n public get componentInstance(): AnyObject | null\n {\n return this.changes.value;\n }\n}\n\n/**\n * Provides a publish bus for the currently rendered component.\n * \n * **Why?** \n * Angular's router only provides the type of component being rendered for a specific route, but not the instance it has created for it.\n * This service is a bridge which allows other services to get a hold of the instance of a currently rendered component.\n * \n * **How to use:** \n * Use the [`publishComponent`](/directives/PublishComponentDirective.html) directive on your `<router-outlet>` element. This will hook into the outlet's `activate` event and pass\n * the activated component to the bus service:\n\n * @example\n * <!-- Component template -->\n * <router-outlet publishComponent name=\"header\"></router-outlet>\n * <router-outlet publishComponent ></router-outlet>\n * <router-outlet publishComponent name=\"footer\"></router-outlet>\n * \n * @export\n * @class RouterOutletComponentBus\n */\n@Injectable({ providedIn: 'root' })\nexport class RouterOutletComponentBus\n{\n private _outletsState = new Map<string, AnyObject | null>();\n\n /**\n * Gets a shallow clone of the current state outlet state.\n *\n * @readonly\n * @type {(Map<string, AnyObject | null>)}\n */\n public get outletsState(): Map<string, AnyObject | null>\n {\n return new Map(this._outletsState);\n }\n\n /**\n * A map of the currently instantiated components by outlet name.\n * Users can either subscribe to changes, or get the current value of a component.\n * \n * The primary unnamed outlet component will be accessible via PRIMARY_OUTLET, but for scalability it is better to access it via the `instance()` method.\n *\n * @private\n */\n private readonly components = new Map<string, BehaviorSubject<AnyObject | null>>();\n\n /**\n * Emits whenever a router outlet marked with the `publishComponent` directive activates a component.\n * When an outlet deactivates a component, the published component instance will be `null`.\n * \n * @type {EventEmitter<ComponentPublishEventData>}\n */\n public readonly componentPublished : EventEmitter<ComponentPublishEventData> = new EventEmitter();\n /**\n * Emits whenever a router outlet marked with the `publishComponent` directive is removed from the DOM.\n *\n * @type {EventEmitter<ComponentPublishEventData>}\n */\n public readonly componentUnpublished: EventEmitter<RouterOutletEventData> = new EventEmitter();\n\n /**\n * Publishes the instance of a currently activated or deactivated component by the specified outlet.\n * When an outlet first publishes, this will create an observable for tracking the outlet's changes.\n * The observable can be fetched using the `changes()` method.\n * Following calls to publish a component by the same outlet will subscribers.\n * \n * The last published component of an outlet can be fetched using the `instance()` method.\n * \n * @param {AnyObject | null} instance The instance of the activated component. For publishing deactivation of a component pass `null`.\n * @param {string} [outletName=PRIMARY_OUTLET] (Optional) The name of the outlet which activated or deactivated the component. The primary unnamed outlet will be used when not specified.\n */\n public publishComponent(instance: AnyObject | null, outletName: string = PRIMARY_OUTLET): void\n {\n const components = this.components;\n\n let componentChanges = components.get(outletName);\n\n if (!componentChanges)\n {\n componentChanges = new BehaviorSubject(instance);\n components.set(outletName, componentChanges);\n }\n \n this._outletsState.set(outletName, instance);\n componentChanges.next(instance);\n\n this.componentPublished.emit(new ComponentPublishEventData(componentChanges, outletName));\n }\n\n /**\n * Notifies any subscribers to the outlet's changes observable that the outlet is being removed by completing\n * the observable and removes the observable from the service.\n *\n * @param {string} [outletName=PRIMARY_OUTLET] (Optional) The name of the outlet to unpublish. The primary unnamed outlet will be used when not specified.\n */\n public unpublishComponent(outletName: string = PRIMARY_OUTLET): void\n {\n const components = this.components;\n\n if (components.has(outletName))\n {\n // Notify any subscribers that the outlet will stop emitting\n components.get(outletName)?.complete();\n // Make sure the outlet is no longer present on the bus\n components.delete(outletName);\n this._outletsState.delete(outletName);\n\n this.componentUnpublished.emit(new RouterOutletEventData(outletName));\n }\n }\n\n /**\n * Checks whether the outlet by the given name is present in the DOM and has already activated at least one component.\n * This will be `true` even if the outlet currently has no active component (component is `null`).\n * \n * A `false` value can either mean the outlet hasn't been marked with `publishComponent`, or that the outlet is not currently rendered (not present in the DOM).\n * \n * When `true`, the user can subscribe to changes of that outlet through the `changes()` method.\n * \n * @param {string} [outletName=PRIMARY_OUTLET] (Optional) The name of the outlet to check. The primary unnamed outlet will be checked if no name is provided.\n * @returns {boolean} `true` if the outlet has published a component at least once; otherwise `false`.\n */\n public isComponentPublished(outletName: string = PRIMARY_OUTLET): boolean\n {\n return this.components.has(outletName);\n }\n\n /**\n * Gets an observable which can be used to track changes to the activated component of the specified outlet.\n * If the outlet is not rendered (present in the DOM), or hasn't been marked with `publishComponent`, this will be `null`.\n *\n * @param {string} [outletName=PRIMARY_OUTLET] (Optional) The name of the outlet to track changes for. The primary unnamed outlet will be used when not specified.\n * @returns {(BehaviorSubject<AnyObject | null> | null)} An observable to use for tracking changes to the activated component for the specified outlet, or `null` if no such outlet exists.\n */\n public changes(outletName: string = PRIMARY_OUTLET): BehaviorSubject<AnyObject | null> | null\n {\n return this.components.get(outletName) ?? null;\n }\n \n /**\n * Gets the current instance of the component created by the specified outlet.\n *\n * @param {string} [outletName=PRIMARY_OUTLET] (Optional) The name of the outlet to fetch the component instance for. If not provided, the primary unnamed outlet's component will be fetched.\n * @returns {(AnyObject | null)} The instance of the component created by the specified outlet. If the outlet doesn't exist, or there is no component instance for the requested outlet, returns `null`.\n */\n public instance(outletName: string = PRIMARY_OUTLET): AnyObject | null\n {\n return this.components.get(outletName)?.value ?? null;\n }\n}","import { Attribute, Directive, OnDestroy, OnInit } from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\n\nimport { Destroyable } from '@bespunky/angular-zen/core';\nimport { AnyObject } from '@bespunky/typescript-utils';\nimport { RouterOutletComponentBus } from './router-outlet-component-bus.service';\n\n/**\n * Hooks into a router outlet's events and publishes the current component to the [`RouterOutletComponentBus`](/injectables/RouterOutletComponentBus.html) to create a mapping\n * of component instances by outlet name.\n * \n * Components instantiated by outlets marked with `publishComponent` will be accessible by outlet name in the bus service.\n * \n * @example\n * <!-- Component template -->\n * <router-outlet publishComponent name=\"header\"></router-outlet>\n * <router-outlet publishComponent ></router-outlet>\n * <router-outlet publishComponent name=\"footer\"></router-outlet>\n * \n * @See `RouterOutletComponentBus` for more details.\n * \n * @export\n * @class PublishComponentDirective\n * @extends {Destroyable}\n * @implements {OnInit}\n */\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'router-outlet[publishComponent]'\n})\nexport class PublishComponentDirective extends Destroyable implements OnInit, OnDestroy\n{\n constructor(\n private outlet: RouterOutlet,\n private componentBus: RouterOutletComponentBus,\n @Attribute('name')\n private outletName: string\n ) { super(); }\n\n /**\n * Registers to outlet events to publish the activated and deactivated components to the bus. *\n */\n ngOnInit()\n {\n // When the outlet activates a new instance, update the component on the bus\n this.subscribe(this.outlet.activateEvents, this.updateComponentOnBus.bind(this));\n // When the outlet deactivates an instance, set the component to null on the bus.\n this.subscribe(this.outlet.deactivateEvents, () => this.updateComponentOnBus(null));\n }\n\n /**\n * Unpublishes the outlet from the bus.\n */\n override ngOnDestroy()\n {\n // An outlet might be kept alive while its component is switched. So when the outlet is completely destroyed,\n // it will be completely removed from the bus, even though its value on the bus is null.\n\n this.componentBus.unpublishComponent(this.outletName);\n\n super.ngOnDestroy();\n }\n\n private updateComponentOnBus(instance: AnyObject | null): void\n {\n this.componentBus.publishComponent(instance, this.outletName); \n }\n}","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\n\nimport { CoreModule } from '@bespunky/angular-zen/core';\nimport { RouterXConfig } from './config/router-x-config';\nimport { provideRouterXConfig } from './config/router-x-config.provider';\nimport { PublishComponentDirective } from './outlet/publish-component.directive';\n\n/**\n * Provides services for libraries requiring integration with their user's language services.\n *\n * @export\n * @class RouterXModule\n */\n@NgModule({\n imports : [CoreModule],\n declarations: [PublishComponentDirective],\n exports : [PublishComponentDirective]\n})\nexport class RouterXModule\n{\n constructor(@Optional() @SkipSelf() parentModule: RouterXModule)\n {\n if (parentModule) throw new Error('`RouterXModule` has already been loaded. Import it only once, in your app module using, `forRoot()`.');\n }\n\n /**\n * Generates the router-x module with the appropriate providers.\n *\n * @static\n * @param {RouterXConfig} config (Optional) The configuration for the router extension module.\n */\n static forRoot(config?: RouterXConfig): ModuleWithProviders<RouterXModule>\n {\n return {\n ngModule : RouterXModule,\n providers: [provideRouterXConfig(config)]\n };\n }\n\n /**\n * Generates the router-x module for child modules.\n *\n * @static\n */\n static forChild(): ModuleWithProviders<RouterXModule>\n {\n return { ngModule : RouterXModule };\n }\n}\n","import { from, InteropObservable, Observable, of } from 'rxjs';\nimport { concatAll, filter, finalize, takeUntil, toArray } from 'rxjs/operators';\nimport { Directive, Type, Injectable } from '@angular/core';\nimport { Router, ActivatedRoute, ActivatedRouteSnapshot, Event, ActivationEnd, ActivationStart, ChildActivationEnd, ChildActivationStart, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RoutesRecognized, Scroll } from '@angular/router';\n\nimport { Destroyable } from '@bespunky/angular-zen/core';\nimport { RouterOutletComponentBus } from '../outlet/router-outlet-component-bus.service';\n\ndeclare const Zone: any;\n\n/**\n * Hard-codes event names as strings.\n * When AOT compilation is run and constructor names change, the dispatcher will still be able to get a hold\n * of the correct event name using this map.\n */\nconst EventMap = {\n [NavigationStart .prototype.constructor.name]: 'NavigationStart',\n [RouteConfigLoadStart.prototype.constructor.name]: 'RouteConfigLoadStart',\n [RouteConfigLoadEnd .prototype.constructor.name]: 'RouteConfigLoadEnd',\n [RoutesRecognized .prototype.constructor.name]: 'RoutesRecognized',\n [GuardsCheckStart .prototype.constructor.name]: 'GuardsCheckStart',\n [ChildActivationStart.prototype.constructor.name]: 'ChildActivationStart',\n [ActivationStart .prototype.constructor.name]: 'ActivationStart',\n [GuardsCheckEnd .prototype.constructor.name]: 'GuardsCheckEnd',\n [ResolveStart .prototype.constructor.name]: 'ResolveStart',\n [ResolveEnd .prototype.constructor.name]: 'ResolveEnd',\n [ChildActivationEnd .prototype.constructor.name]: 'ChildActivationEnd',\n [ActivationEnd .prototype.constructor.name]: 'ActivationEnd',\n [NavigationEnd .prototype.constructor.name]: 'NavigationEnd',\n [NavigationCancel .prototype.constructor.name]: 'NavigationCancel',\n [NavigationError .prototype.constructor.name]: 'NavigationError',\n [Scroll .prototype.constructor.name]: 'Scroll'\n};\n\n/** Represents a function that creates an async task to be run (normally on a component). */\nexport type Resolver = (component: any, ...resolverArgs: any[]) => Observable<any> | InteropObservable<any> | Promise<any>;\n\n/**\n * The prefix of the id generated for zone macro tasks when calling `RouteAware.resolveInMacroTask()`.\n * \n * Generated ids will confrom to a `{prefix}-{random number}` format.\n */\nexport const ResolverMacroTaskIdPrefix = 'route-aware-resolver';\n\n/**\n * Provides functionality for extending class to easily work with routes and process changes.\n *\n * @export\n * @abstract\n * @class RouteAware\n * @extends {Destroyable}\n */\n@Directive() // Originally this was decorated with `Directive` only so angular accepts it as base for both services and components.\n@Injectable() // However, compodoc fails to collect abstract classes marked with `Directive` so I marked it as both. Tests pass, POC stackblitz doesn't show side effects.\n// eslint-disable-next-line @angular-eslint/directive-class-suffix\nexport abstract class RouteAware extends Destroyable\n{ \n /**\n * Creates an instance of RouteAware.\n * \n * @param {Router} router The instance of Angular's router service.\n * @param {ActivatedRoute} route The instance of Angular's active route service.\n * @param {RouterOutletComponentBus} [componentBus] (Optional) The component bus for router-x functionality.\n * Provide this when you want your route-aware service to have access to the instance(s) of the activated component(s).\n */\n constructor(\n protected router : Router,\n protected route : ActivatedRoute,\n protected componentBus?: RouterOutletComponentBus\n )\n {\n super();\n\n // TODO: Scan class and only subscribe if handlers were defined\n this.subscribe(this.router.events, this.dispatchRouterEvent.bind(this));\n }\n \n /**\n * Checks if a handler method for the specific event type exists on the service and calls it.\n * Handler methods should comply with `onEventType` naming (lowercase 'on', first-upper event type).\n * \n * @private\n * @param {Event} event The event data received from the router.\n */\n private dispatchRouterEvent(event: Event): void\n {\n // AOT compilation changes class names, causing the dispacher to look for a handler methods with\n // wrong names (e.g. `onJ`). The EventMap is used to restore the original names.\n const typeName = event.constructor.name;\n const handlerName = `on${EventMap[typeName]}`;\n const handle = (this as any)[handlerName];\n\n if (handle) handle.call(this, event);\n }\n\n /**\n * Creates an observable that emits only the specified router events and is automatically destroyed when the service/component is destroyed.\n *\n * @protected\n * @template TEvent The type of router event to emit.\n * @param {Type<TEvent>} eventType The type of router event to emit.\n * @param {boolean} [autoUnsubscribe=true] (Optional) `true` to make the observable complete when the service/component is destroyed; otherwise `false`. Default is `true`.\n * @returns {Observable<TEvent>}\n */\n protected observeRouterEvent<TEvent extends Event>(eventType: Type<TEvent>, autoUnsubscribe: boolean = true): Observable<TEvent>\n {\n let observable = this.router.events;\n\n if (autoUnsubscribe) observable = observable.pipe(takeUntil(this.destroyed));\n \n return observable.pipe(filter(event => event.constructor === eventType)) as Observable<TEvent>;\n }\n\n /**\n * Recoursively runs a processing function on the route and its children.\n * Scan is done from parent to child, meaning the parent is the first to process.\n *\n * @ignore\n * @protected\n * @param {ActivatedRouteSnapshot} route The top route on which to apply the processing function.\n * @param {(route: ActivatedRouteSnapshot, component: any) => boolean} process The function to run on the route and its children. The function receives a `route` argument which reflects the route being processed,\n * and a `component` argument which reflects the component that was loaded for the route's outlet.\n * If the corresponding outlet wasn't marked with the `publishComponent` directive, the `component` argument will be null.\n * \n * Returning `true` from the process function is equal to saying 'work has completed' and will stop propogation to the route's children.\n * @param {number} [levels=-1] (Optional) The number of levels (excluding the parent) to dive deeper into the route tree.\n * A value of 1 for example, will process the route and its first-level children only. By default, scans all levels of the route tree.\n */\n protected deepScanRoute(route: ActivatedRouteSnapshot, process: (route: ActivatedRouteSnapshot, component: any) => boolean , levels?: number): void;\n /**\n * Recoursively runs a processing function on the route and its children.\n * Scan is done from parent to child, meaning the parent is the first to process.\n *\n * @ignore\n * @protected\n * @param {ActivatedRouteSnapshot} route The top route on which to apply the processing function.\n * @param {(route: ActivatedRouteSnapshot, component: any) => void} process The function to run on the route and its children. The function receives a `route` argument which reflects the route being processed,\n * and a `component` argument which reflects the component that was loaded for the route's outlet.\n * If the corresponding outlet wasn't marked with the `publishComponent` directive, the `component` argument will be null.\n * \n * Returning `true` from the process function is equal to saying 'work has completed' and will stop propogation to the route's children.\n * @param {number} [levels=-1] (Optional) The number of levels (excluding the parent) to dive deeper into the route tree.\n * A value of 1 for example, will process the route and its first-level children only. By default, scans all levels of the route tree.\n */\n protected deepScanRoute(route: ActivatedRouteSnapshot, process: (route: ActivatedRouteSnapshot, component: any) => void, levels?: number): void;\n /**\n * Recoursively runs a processing function on the route and its children.\n * Scan is done from parent to child, meaning the parent is the first to process.\n * \n * @protected\n * @param {ActivatedRouteSnapshot} route The top route on which to apply the processing function.\n * @param {(route: ActivatedRouteSnapshot, component: any) => boolean | void} process The function to run on the route and its children. The function receives a `route` argument which reflects the route being processed,\n * and a `component` argument which reflects the component that was loaded for the route's outlet.\n * If the corresponding outlet wasn't marked with the `publishComponent` directive, the `component` argument will be null.\n * \n * Returning `true` from the process function is equal to saying 'work has completed' and will stop propogation to the route's children.\n * @param {number} [levels=-1] (Optional) The number of levels (excluding the parent) to dive deeper into the route tree.\n * A value of 1 for example, will process the route and its first-level children only. By default, scans all levels of the route tree.\n */\n protected deepScanRoute(route: ActivatedRouteSnapshot, process: (route: ActivatedRouteSnapshot, component: any) => boolean | void, levels: number = -1): void\n {\n // Make sure the caller wants scan to proceed, then make sure level limit wasn't reached.\n const processingConcluded = process(route, this.componentBus?.instance(route.outlet));\n // Negative values will scan all, positives will scan until reaching zero.\n const shouldScanChildren = !processingConcluded && levels !== 0;\n\n if (shouldScanChildren && route.children) route.children.forEach(childRoute => this.deepScanRoute(childRoute, process, levels - 1));\n }\n \n /**\n * Creates an observable that runs all the specified resolvers and concats their results as an array.\n * The resolvers will be passed with the instance of the component for the currently activated route.\n *\n * @protected\n * @param {(Resolver | Resolver[])} resolvers The resolver(s) to concat.\n * @param {...any[]} resolverArgs (Optional) Any arguments to pass into the resolvers in addition to the component.\n * @returns {Observable<any[]>} An array with the concatenated results of the resolvers.\n */\n protected resolve(resolvers: Resolver | Resolver[], ...resolverArgs: any[]): Observable<any[]>\n {\n if (!resolvers) return of([]);\n\n // Cast array\n if (!Array.isArray(resolvers)) resolvers = [resolvers];\n\n // Run resolvers to create observable tasks\n const observables = resolvers.map(resolve => resolve(this.activatedRouteComponent, ...resolverArgs));\n \n // Run tasks and output their returned data as an array\n return from(observables).pipe(concatAll(), toArray());\n }\n\n /**\n * Creates an observable that runs all the specified resolvers and concats their results as an array.\n * The resolvers will be passed with the instance of the component for the currently activated route.\n * \n * **Angular Universal:**\n * In SSR, the server doesn't wait for async code to complete. The result is scrapers and search engines receiving a page without resolved data,\n * which is bad in case you need them to read some resolved metadata tags for example.\n * \n * Using `Zone` directly, this method creates a macro task and completes it when resolves are done or have errored.\n * This makes the server block and wait until everything is resolved or errors before returning the rendered page.\n * \n * > *ℹ Make sure your resolves and process function are fast enough so that the server won't hang too much trying to render.*\n *\n * @see https://stackoverflow.com/a/50065783/4371525 for the discussion.\n *\n * @see {ResolverMacroTaskIdPrefix} if you need to identify the created macro task in your code.\n * \n * @protected\n * @param {(Resolver | Resolver[])} resolvers The resolver(s) to concat.\n * @param {...any[]} resolverArgs (Optional) Any arguments to pass into the resolvers in addition to the component.\n */\n protected resolveInMacroTask(resolvers: Resolver | Resolver[], ...resolverArgs: any[]): Observable<any[]>\n {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const macroTask = Zone.current.scheduleMacroTask(`${ResolverMacroTaskIdPrefix}-${Math.random()}`, () => { }, {}, () => { }, () => { });\n\n return this.resolve(resolvers, ...resolverArgs)\n // Signal end of macro task on completion or error and allow server to return\n .pipe(finalize(() => macroTask.invoke())\n );\n }\n\n /**\n * The instance of the component created for the currently activated route.\n * If no component bus was supplied at construction time, this will be `undefined`.\n *\n * @readonly\n * @protected\n * @type {(any | null)}\n */\n protected get activatedRouteComponent(): any | null\n {\n return this.componentBus?.instance(this.route.outlet);\n }\n}\n","import { Inject, Injectable, Optional } from '@angular/core';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\n\nimport { DocumentRef } from '@bespunky/angular-zen/core';\nimport { RouterXConfig } from '../config/router-x-config';\nimport { RouterX } from '../config/router-x-config.provider';\n\n/**\n * Provides tools for breaking the current and any url to their different parts.\n *\n * @export\n * @class UrlReflectionService\n */\n@Injectable({ providedIn: 'root'})\nexport class UrlReflectionService\n{\n /**\n * A regular expression to match the route part of a url. The url can be fully qualified or start at the route.\n * The extracted group will be named 'route'.\n * \n * @example\n * The regex will extract '/this/is/the/route' for all of the following:\n *\n * Fully qualified urls:\n * `https://some.website.com/this/is/the/route?a=1&b=2&c=3`\n * `https://some.website.com/this/is/the/route#someFragment`\n * `https://some.website.com/this/is/the/route?debug=true#fragment`\n * \n * Relative routes:\n * `/this/is/the/route?a=1&b=2&c=3`\n * `/this/is/the/route#someFragment`\n * `/this/is/the/route?debug=true#fragment`\n * \n * The regex will extract 'this/is/the/route' (no head slash) for all of the following:\n * `this/is/the/route?a=1&b=2&c=3`\n * `this/is/the/route#someFragment`\n * `this/is/the/route?debug=true#fragment`\n **/\n public readonly RouteRegex = /^(?:http[s]?:\\/\\/[^/]+)?(?<route>[^?#]+)(?=[?#]|$)/;\n /**\n * A regular expression to match all segments of a route.\n * Looks for `/<segment>/` parts and extract them without the slashes.\n * The extracted groups will be named 'segment'.\n */\n public readonly RouteSegmentsRegex = /(?!\\/)(?<segment>[^/]+)/g;\n /**\n * A regular expression to match the question mark and everything that follows in a url.\n * The extracted group will be named 'queryString'.\n * \n * @example\n * The regex will extract '?a=1&b=2&c=3' for all of the following:\n * https://some.website.com/some/route?a=1&b=2&c=3\n * https://some.website.com/some/route?a=1&b=2&c=3#fragment\n * /some/route?a=1&b=2&c=3#fragment\n * ?a=1&b=2&c=3#fragment\n */\n public readonly QueryStringRegex = /(?<queryString>\\?[^#]*)/;\n /**\n * A regular expression to match the hash sign and everything that follows in a url.\n * The extracted group will be named 'fragment'.\n * \n * @example\n * The regex will extract '#fragment' for all of the following:\n * https://some.website.com/some/route?a=1&b=2&c=3#fragment\n * /some/route?a=1&b=2&c=3#fragment\n * some/route?a=1&b=2&c=3#fragment\n */\n public readonly FragmentRegex = /(?<fragment>#.*)$/;\n\n /**\n * The complete host portion (e.g. https://www.example.com) of the currently navigated url as fetched from the `document.location` object.\n * If the `hostUrl` option was provided when importing the language integration module, it will be used instead.\n *\n * @type {string}\n */\n public readonly hostUrl: string;\n\n constructor(\n private document: DocumentRef,\n public readonly router : Router,\n public readonly route : ActivatedRoute,\n @Optional() @Inject(RouterX) private config? : RouterXConfig\n )\n {\n const hostUrl = this.config?.hostUrl;\n\n // If the hostUrl has been provided by the user, use it; otherwise, fetch from the location service\n this.hostUrl = hostUrl || this.document.nativeDocument.location.origin;\n }\n \n /**\n * Extracts the route portion of a given url.\n * \n * @example\n * routeOf('https://some.website.com/some/route?a=1&b=2&c=3') === '/some/route'\n *\n * @param {string} url The url for which to extract the route portion.\n * @returns {string} The route portion of the url.\n */\n public routeOf(url: string): string\n {\n return url.match(this.RouteRegex)?.groups?.['route'] || '';\n }\n \n /**\n * Extracts the route portion of a url as an array of route segments, not including the empty root segment.\n *\n * @example\n * routeSegmentsOf('https://some.website.com/some/route?a=1&b=2&c=3') === ['some', 'route']\n * routeSegmentsOf('/some/route') === ['some', 'route']\n *\n * @param {string} routeOrUrl The route or complete url from which to extract the route segments.\n * @returns {string[]} The segments of the route.\n */\n public routeSegmentsOf(routeOrUrl: string): string[]\n {\n // Extract the route portion only, then match with the regex to extract the array of segments\n return this.routeOf(routeOrUrl).match(this.RouteSegmentsRegex) || [];\n }\n\n /**\n * Extracts the query string of a specified url.\n *\n * @example\n * queryStringOf('https://some.website.com/some/route?a=1&b=2&c=3') === '?a=1&b=2&c=3'\n *\n * @param {string} url The url from which to extract the query string.\n * @returns {string} The query string extracted from the url.\n */\n public queryStringOf(url: string): string\n {\n const matches = url.match(this.QueryStringRegex) || [''];\n\n return matches[0];\n }\n\n /**\n * Removes the query portion of a url.\n *\n * @example\n * stripQuery('https://some.website.com/some/route?a=1&b=2&c=3#fragment') === 'https://some.website.com/some/route#fragment'\n *\n * @param {string} url The url from which to remove the query.\n * @returns {string} The specified url without the query portion.\n */\n public stripQuery(url: string): string\n {\n return url.replace(this.QueryStringRegex, '');\n }\n \n /**\n * Extracts the fragment from a url.\n *\n * @example\n * fragmentOf('https://some.website.com/some/route?a=1&b=2&c=3#fragment') === '#fragment'\n *\n * @param {string} url The url from which to extract the fragment.\n * @returns {string} The fragment extracted from the url.\n */\n public fragmentOf(url: string): string\n {\n const matches = url.match(this.FragmentRegex) || [''];\n\n return matches[0];\n }\n\n /**\n * Removes the fragment portion of a url.\n *\n * @example\n * stripFragment('https://some.website.com/some/route?a=1&b=2&c=3#fragment') === 'https://some.website.com/some/route?a=1&b=2&c=3'\n * \n * @param {string} url The url to remove the fragment.\n * @returns {string} The url without the fragment portion.\n */\n public stripFragment(url: string): string\n {\n return url.replace(this.FragmentRegex, '');\n }\n\n /**\n * Makes sure the url is prefixed with https instead of http.\n *\n * @param {string} url The url to secure.\n * @returns {string} The secure url.\n */\n public forceHttps(url: string): string\n {\n return url.replace(/^http:\\/\\//, 'https://');\n }\n\n /**\n * The fully qualified url of the currently navigated route (e.g. 'https://some.website.com/some/route?a=1&b=2&c=3#fragment').\n *\n * @readonly\n * @type {string}\n */\n public get fullUrl(): string\n {\n return `${this.hostUrl}${this.router.url}`;\n }\n \n /**\n * The route url of the currently navigated route (e.g. '/some/route').\n *\n * @readonly\n * @type {string}\n */\n public get routeUrl(): string\n {\n return this.routeOf(this.router.url);\n }\n \n /**\n * The segments of the currently navigated route (e.g. ['some', 'route']).\n *\n * @readonly\n * @type {string[]}\n */\n public get routeSegments(): string[]\n {\n return this.routeSegmentsOf(this.routeUrl);\n }\n\n /**\n * The object representing the query params in the currently navigated route.\n *\n * @readonly\n * @type {*}\n */\n public get queryParams(): Params\n {\n return { ...this.route.snapshot.queryParams };\n }\n\n /**\n * The query string portion of the currently navigated route (e.g. '?a=1&b=2&c=3').\n *\n * @readonly\n * @type {string}\n */\n public get queryString(): string\n {\n return this.queryStringOf(this.router.url);\n }\n\n /**\n * The fragment portion of the currently navigated route, without the hash sign (e.g. 'fragment').\n *\n * @readonly\n * @type {string}\n */\n public get fragment(): string\n {\n return this.route.snapshot.fragment || '';\n }\n\n /**\n * The fragment portion of the currently navigated route, with the hash sign (e.g. '#fragment').\n *\n * @readonly\n * @type {string}\n */\n public get fragmentString(): string\n {\n return `#${this.fragment}`;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.RouterOutletComponentBus"],"mappings":";;;;;;;;;AAIA;;;AAGG;AACI,MAAM,OAAO,GAAG,IAAI,cAAc,CAAgB,gBAAgB,CAAC,CAAC;AAE3E;AACO,MAAM,oBAAoB,GAAkB,EAAE,CAAC;AAEtD;;;;;;;AAOG;AACG,SAAU,oBAAoB,CAAC,MAAsB,EAAA;IAEvD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAEzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;AACjD;;ACrBA;;;;;AAKG;MACU,qBAAqB,CAAA;AAE9B;;;;AAIG;AACH,IAAA,WAAA,CAA4B,UAAkB,EAAA;QAAlB,IAAU,CAAA,UAAA,GAAV,UAAU,CAAQ;KAAK;AAEnD;;;;;AAKG;AACH,IAAA,IAAW,eAAe,GAAA;AAEtB,QAAA,OAAO,IAAI,CAAC,UAAU,KAAK,cAAc,CAAC;KAC7C;AACJ,CA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