{"version":3,"file":"uirouter-angular-hybrid.mjs","sources":["../../src/angular-hybrid.ts","../../src/uirouter-angular-hybrid.ts"],"sourcesContent":["import { Component, ElementRef, Inject, Injector, Input, ModuleWithProviders, NgModule } from '@angular/core';\r\nimport { downgradeComponent, UpgradeModule, getAngularJSGlobal, getAngularLib } from '@angular/upgrade/static';\r\n\r\nimport {\r\n  StateObject,\r\n  forEach,\r\n  PathNode,\r\n  Resolvable,\r\n  StateRegistry,\r\n  UIRouter,\r\n  ViewConfig,\r\n  ViewService,\r\n} from '@uirouter/core';\r\n\r\nimport {\r\n  applyModuleConfig,\r\n  NATIVE_INJECTOR_TOKEN,\r\n  ng2LazyLoadBuilder,\r\n  Ng2ViewConfig,\r\n  UIView,\r\n  _UIROUTER_SERVICE_PROVIDERS,\r\n  Ng2ViewDeclaration,\r\n  ParentUIViewInject,\r\n  StatesModule,\r\n  UIROUTER_MODULE_TOKEN,\r\n  UIROUTER_ROOT_MODULE,\r\n  UIRouterModule,\r\n  makeChildProviders,\r\n} from '@uirouter/angular';\r\n\r\nimport { $InjectorLike, Ng1ViewConfig } from '@uirouter/angularjs';\r\n\r\nimport { UIRouterRx } from '@uirouter/rx';\r\nimport { NgHybridStatesModule } from './interfaces';\r\n\r\nconst getAngularJS = getAngularJSGlobal || getAngularLib;\r\nconst angular = getAngularJS();\r\n\r\nif (!angular) {\r\n  throw new Error(\r\n    'AngularJS not found on window.  https://github.com/ui-router/angular-hybrid/wiki/AngularJS-not-found-on-window'\r\n  );\r\n}\r\n\r\n/**\r\n * Create a ng1 module for the ng1 half of the hybrid application to depend on.\r\n *\r\n * Example:\r\n * const myApp = angular.module('myApp', ['ui.router.upgrade']);\r\n */\r\nexport const upgradeModule = angular.module('ui.router.upgrade', ['ui.router']);\r\n\r\nexport function objectFactory() {\r\n  return {};\r\n}\r\n\r\n/**\r\n * UIViewNgUpgrade is a component bridge from ng1 ui-view to ng2 ui-view\r\n *\r\n * When a ui-router for ng1 is registering a state it checks if a view's\r\n * `component:` is an ng2 Component class. If so, it creates a special ng1 template\r\n * which references this component, i.e., <ui-view-ng-upgrade></ui-view-ng-upgrade>\r\n *\r\n * See that code by searching ng1-to-ng2 source for: \"$stateProvider.decorator\"\r\n *\r\n * ---\r\n *\r\n * ng1-to-ng2 component bridge process:\r\n *\r\n * 1)\r\n * When an ng1 template creates a ui-view which is targeted by a ng2 Component,\r\n *\r\n * ```\r\n * <a ui-sref=\"foo\">Go to foo</a>\r\n * <div ui-view> <!-- ui-view created in ng1 template -->\r\n * </div> <!-- targeted with { component: Ng2RoutedComponent } -->\r\n * ```\r\n *\r\n * the state decorator spits out a custom template.  That template loads this\r\n * ng2 Component adapter as a downgraded-to-ng1 directive.\r\n *\r\n * ```\r\n * <a ui-sref=\"foo\">Go to foo</a>\r\n * <div ui-view> <!-- decorated template references the downgraded component -->\r\n *   <ui-view-ng-upgrade> <!-- downgraded adapter component -->\r\n *   </ui-view-ng-upgrade>\r\n * </div>\r\n * ```\r\n *\r\n * This downgraded ng2 Component then creates a child UIView (ng2 component)\r\n *\r\n * ```\r\n * <a ui-sref=\"foo\">Go to foo</a>\r\n * <div ui-view> <!-- custom template references the downgraded component -->\r\n *   <ui-view-ng-upgrade> <!-- ng2 component adapter downgraded to ng1-->\r\n *     <ui-view> <!-- pure ng2 ui-view -->\r\n *      </ui-view>\r\n *   </ui-view-ng-upgrade>\r\n * </div>\r\n * ```\r\n *\r\n * which in turn is filled with the routed ng2 component.\r\n *\r\n * ```\r\n * <a ui-sref=\"foo\">Go to foo</a>\r\n * <div ui-view> <!-- ng1 ui-view -->\r\n *   <ui-view-ng-upgrade> <!-- ng2 component adapter (downgraded to ng1)-->\r\n *     <ui-view> <!-- pure ng2 ui-view -->\r\n *       <ng2-routed-component> <!-- ng2 component hosted in ng2 ui-view -->\r\n *         <h1>ng2 routed component contents</h1>\r\n *       </ng2-routed-component>\r\n *     </ui-view>\r\n *   </ui-view-ng-upgrade>\r\n * </div>\r\n * ```\r\n *\r\n * This adapter exposes the parent view context (ParentUIViewInject)\r\n * as an ng2 DI Provider, which the nested ng2 UIView requires.\r\n *\r\n * It gets the ParentUIViewContext information (from the parent ng1 ui-view) by walking\r\n * up the DOM and grabbing the .data('$uiView') which the ng1 ui-view directive exposes.\r\n */\r\n@Component({\r\n  selector: 'ui-view-ng-upgrade',\r\n  template: ` <ui-view [name]=\"name\"></ui-view> `,\r\n  // provide a blank object as PARENT_INJECT.\r\n  // The component will add property getters when it is constructed.\r\n  viewProviders: [{ provide: UIView.PARENT_INJECT, useFactory: objectFactory }],\r\n  standalone: false,\r\n})\r\nexport class UIViewNgUpgrade {\r\n  // The ui-view's name (or '$default')\r\n  @Input()\r\n  name: string;\r\n\r\n  constructor(\r\n    ref: ElementRef,\r\n    @Inject(UIView.PARENT_INJECT) parent: ParentUIViewInject,\r\n    registry: StateRegistry // access the root state\r\n  ) {\r\n    // From the ui-view-ng-upgrade component's element ref, walk up the DOM two elements...\r\n    // There will first be an ng1 ui-view which hosts this element, and then that ui-view's parent element.\r\n    // That (parent) element has access to the proper \"parent viewcontext\"\r\n\r\n    // The ng2 ui-view component is inside this ui-view-ng-upgrade directive, which is inside the ng1 \"host\" ui-view.\r\n    // Both ui-views share the same \"view context\" information (the view's fqn and created-by-state context information)\r\n    const ng1elem = angular.element(ref.nativeElement).parent().parent();\r\n\r\n    // Expose getters on PARENT_INJECT for context (creation state) and fqn (view address)\r\n    // These will be used by further nested UIView\r\n    Object.defineProperty(parent, 'context', {\r\n      get: function () {\r\n        const data = ng1elem['inheritedData']('$uiView');\r\n        return data && data.$cfg ? data.$cfg.viewDecl.$context : registry.root();\r\n      },\r\n      enumerable: true,\r\n    });\r\n\r\n    Object.defineProperty(parent, 'fqn', {\r\n      get: function () {\r\n        const data = ng1elem['inheritedData']('$uiView');\r\n        return data && data.$uiView ? data.$uiView.fqn : null;\r\n      },\r\n      enumerable: true,\r\n    });\r\n  }\r\n}\r\n\r\n/**********************************\r\n * Ng2 @NgModule and bootstrap code\r\n **********************************/\r\n\r\n// Register the ng1 DI '$uiRouter' object as an ng2 Provider.\r\nexport function uiRouterUpgradeFactory(router: UIRouter, injector: Injector) {\r\n  const modules: StatesModule[] = injector.get<StatesModule[]>(UIROUTER_MODULE_TOKEN, []);\r\n  modules.forEach((module) => applyModuleConfig(router, injector, module));\r\n  return router;\r\n}\r\n\r\nexport function getUIRouter($injector: any) {\r\n  return $injector.get('$uiRouter');\r\n}\r\n\r\nexport function getParentUIViewInject(r: StateRegistry): ParentUIViewInject {\r\n  return { fqn: null, context: r.root() };\r\n}\r\n\r\n/**\r\n * This NgModule should be added to the root module of the hybrid app.\r\n */\r\n@NgModule({\r\n  imports: [UIRouterModule, UpgradeModule],\r\n  declarations: [UIViewNgUpgrade],\r\n  providers: [\r\n    // @uirouter/angular code will use the ng1 $uiRouter instance instead of creating its own.\r\n    { provide: '$uiRouter', useFactory: getUIRouter, deps: ['$injector'] },\r\n\r\n    { provide: UIRouter, useFactory: uiRouterUpgradeFactory, deps: ['$uiRouter', Injector] },\r\n\r\n    { provide: UIROUTER_ROOT_MODULE, useValue: {}, multi: true },\r\n\r\n    { provide: UIView.PARENT_INJECT, useFactory: getParentUIViewInject, deps: [StateRegistry] },\r\n\r\n    ..._UIROUTER_SERVICE_PROVIDERS,\r\n  ],\r\n  exports: [UIViewNgUpgrade, UIRouterModule],\r\n})\r\nexport class UIRouterUpgradeModule {\r\n  static forRoot(module: NgHybridStatesModule = {}): ModuleWithProviders<UIRouterUpgradeModule> {\r\n    return {\r\n      ngModule: UIRouterUpgradeModule,\r\n      providers: makeChildProviders(module as StatesModule),\r\n    };\r\n  }\r\n\r\n  static forChild(module: NgHybridStatesModule = {}): ModuleWithProviders<UIRouterUpgradeModule> {\r\n    return {\r\n      ngModule: UIRouterModule,\r\n      providers: makeChildProviders(module as StatesModule),\r\n    };\r\n  }\r\n}\r\n\r\n// Downgrade the UIViewNgUpgrade ng2 Component to an ng1 directive.\r\n// The directive is used in a (generated) view template by the (host) ng1 ui-router,\r\n// whenever it finds a view configured with a `component: <Ng2ComponentClass>`\r\nupgradeModule.directive(\r\n  'uiViewNgUpgrade',\r\n  <any>downgradeComponent({\r\n    component: UIViewNgUpgrade,\r\n    inputs: ['name'],\r\n  })\r\n);\r\n\r\nupgradeModule.run([\r\n  '$injector',\r\n  (ng1Injector: $InjectorLike) => {\r\n    const $uiRouter: UIRouter = ng1Injector.get('$uiRouter');\r\n\r\n    /** Add support for observable state and param changes */\r\n    $uiRouter.plugin(UIRouterRx);\r\n\r\n    // Expose a merged ng1/ng2 injector as a Resolvable (on the root state).\r\n    // This mimics how ui-router-ng2 exposes the root ng2 Injector, but\r\n    // it retrieves from ng1 injector first, then ng2 injector if the token isn't found.\r\n    const mergedInjector = {\r\n      get: function (token: any, ng2NotFoundValue?: any) {\r\n        if (ng1Injector.has(token)) {\r\n          return ng1Injector.get(token);\r\n        }\r\n        const ng2Injector = ng1Injector.get('$$angularInjector');\r\n        return ng2Injector.get(token, ng2NotFoundValue);\r\n      },\r\n    };\r\n\r\n    const ng2InjectorResolvable = Resolvable.fromData(NATIVE_INJECTOR_TOKEN, mergedInjector);\r\n    $uiRouter.stateRegistry.root().resolvables.push(ng2InjectorResolvable);\r\n  },\r\n]);\r\n\r\n/** Adds support for `loadChildren`: Angular NgModule lazy loading via @gntools/webpack */\r\nupgradeModule.config([\r\n  '$stateRegistryProvider',\r\n  ($stateRegistry: StateRegistry) => {\r\n    $stateRegistry.decorator('lazyLoad', ng2LazyLoadBuilder);\r\n  },\r\n]);\r\n\r\n/**\r\n * Define a stateProvider `views` builder decorator.\r\n * The decorator first applies the standard views builder function.\r\n * Then it finds any view components which are **actually** a Ng2 Component Class.\r\n * It overwrites that view's config with a ng1-to-ng2 hybrid config.\r\n *\r\n * In place of the template provider, it simply puts a <ui-view-ng-upgrade/> component\r\n * which that provides a ng1 -> ng2 boundary in the component tree.\r\n */\r\nupgradeModule.config([\r\n  '$stateRegistryProvider',\r\n  ($stateRegistry: StateRegistry) => {\r\n    $stateRegistry.decorator('views', function (state: StateObject, parentFn: Function) {\r\n      const views = parentFn(state);\r\n\r\n      forEach(views, (viewDecl: any, viewName: string) => {\r\n        if (viewDecl.$type === 'ng1-to-ng2' || typeof viewDecl.component === 'function') {\r\n          // Update the view config.\r\n          // Override default ng1 `component:` behavior (of defining a templateProvider)\r\n          // with a <ui-view-ng-upgrade> adapter directive template\r\n          viewDecl.$type = 'ng1-to-ng2';\r\n          viewDecl.templateProvider = null;\r\n          viewDecl.template = `<ui-view-ng-upgrade name='${viewDecl.$uiViewName}'></ui-view-ng-upgrade>`;\r\n        }\r\n      });\r\n      return views;\r\n    });\r\n  },\r\n]);\r\n\r\n// UI-Router ViewConfig factories take a view declaration object from a state.views: { foo: <ViewDeclaration> }\r\n// and return a runtime config object (a ViewConfig)\r\nupgradeModule.run([\r\n  '$view',\r\n  '$templateFactory',\r\n  ($view: ViewService, $templateFactory: any) => {\r\n    // Register a ViewConfig factory for views of type `ng2`\r\n    $view._pluginapi._viewConfigFactory(\r\n      'ng2',\r\n      (path: PathNode[], config: Ng2ViewDeclaration) => new Ng2ViewConfig(path, config)\r\n    );\r\n\r\n    // Register a ViewConfig factory for views of type `ng1-to-ng2`.\r\n    // Returns both an ng1 config and an ng2 config allowing either ng1 or ng2 ui-view components to be targeted.\r\n    $view._pluginapi._viewConfigFactory('ng1-to-ng2', (path: PathNode[], config: Ng2ViewDeclaration) => {\r\n      const ng1ViewConfig: ViewConfig = <any>(\r\n        new Ng1ViewConfig(<any>path, <any>Object.assign({}, config, { $type: 'ng1' }), $templateFactory)\r\n      );\r\n      const ng2ViewConfig: ViewConfig = <any>(\r\n        new Ng2ViewConfig(<any>path, <any>Object.assign({}, config, { $type: 'ng2' }))\r\n      );\r\n\r\n      return [ng2ViewConfig, ng1ViewConfig];\r\n    });\r\n  },\r\n]);\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAmCA,MAAM,YAAY,GAAG,kB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