├── BUILD_INFO ├── README.md ├── fesm2022 ├── upgrade.mjs ├── upgrade.mjs.map ├── static-testing.mjs ├── _constants-chunk.mjs ├── static-testing.mjs.map ├── _constants-chunk.mjs.map └── static.mjs ├── types ├── upgrade.d.ts ├── static-testing.d.ts └── static.d.ts ├── LICENSE └── package.json /BUILD_INFO: -------------------------------------------------------------------------------- 1 | Wed Dec 17 01:42:32 UTC 2025 2 | 9fa77af1106578f4fe79e8091df0fab7ed66c096 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular 2 | 3 | The sources for this package are in the main [Angular](https://github.com/angular/angular) repo. Please file issues and pull requests against that repo. 4 | 5 | Usage information and reference details can be found in [Angular documentation](https://angular.dev/overview). 6 | 7 | License: MIT 8 | -------------------------------------------------------------------------------- /fesm2022/upgrade.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v21.1.0-next.3+sha-9fa77af 3 | * (c) 2010-2025 Google LLC. https://angular.dev/ 4 | * License: MIT 5 | */ 6 | 7 | import { Version } from '@angular/core'; 8 | 9 | const VERSION = /* @__PURE__ */new Version('21.1.0-next.3+sha-9fa77af'); 10 | 11 | export { VERSION }; 12 | //# sourceMappingURL=upgrade.mjs.map 13 | -------------------------------------------------------------------------------- /types/upgrade.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v21.1.0-next.3+sha-9fa77af 3 | * (c) 2010-2025 Google LLC. https://angular.dev/ 4 | * License: MIT 5 | */ 6 | 7 | import { Version } from '@angular/core'; 8 | 9 | /** 10 | * @module 11 | * @description 12 | * Entry point for all public APIs of the upgrade package. 13 | */ 14 | 15 | /** 16 | * @publicApi 17 | */ 18 | declare const VERSION: Version; 19 | 20 | export { VERSION }; 21 | -------------------------------------------------------------------------------- /fesm2022/upgrade.mjs.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"upgrade.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/upgrade/src/common/src/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the upgrade package.\n */\n\nimport {Version} from '@angular/core';\n\n/**\n * @publicApi\n */\nexport const VERSION = /* @__PURE__ */ new Version('21.1.0-next.3+sha-9fa77af');\n"],"names":["VERSION","Version"],"mappings":";;;;;;;;AAmBO,MAAMA,OAAO,kBAAmB,IAAIC,OAAO,CAAC,mBAAmB;;;;"} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010-2025 Google LLC. https://angular.dev/license 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@angular/upgrade", 3 | "version": "21.1.0-next.3+sha-9fa77af", 4 | "description": "Angular - the library for easing update from v1 to v2", 5 | "author": "angular", 6 | "license": "MIT", 7 | "engines": { 8 | "node": "^20.19.0 || ^22.12.0 || >=24.0.0" 9 | }, 10 | "dependencies": { 11 | "tslib": "^2.3.0" 12 | }, 13 | "peerDependencies": { 14 | "@angular/core": "21.1.0-next.3+sha-9fa77af", 15 | "@angular/compiler": "21.1.0-next.3+sha-9fa77af", 16 | "@angular/platform-browser": "21.1.0-next.3+sha-9fa77af", 17 | "@angular/platform-browser-dynamic": "21.1.0-next.3+sha-9fa77af" 18 | }, 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/angular/angular.git", 22 | "directory": "packages/upgrade" 23 | }, 24 | "ng-update": { 25 | "packageGroup": [ 26 | "@angular/core", 27 | "@angular/bazel", 28 | "@angular/common", 29 | "@angular/compiler", 30 | "@angular/compiler-cli", 31 | "@angular/animations", 32 | "@angular/elements", 33 | "@angular/platform-browser", 34 | "@angular/platform-browser-dynamic", 35 | "@angular/forms", 36 | "@angular/platform-server", 37 | "@angular/upgrade", 38 | "@angular/router", 39 | "@angular/language-service", 40 | "@angular/localize", 41 | "@angular/service-worker" 42 | ] 43 | }, 44 | "sideEffects": false, 45 | "module": "./fesm2022/upgrade.mjs", 46 | "typings": "./types/upgrade.d.ts", 47 | "type": "module", 48 | "exports": { 49 | "./package.json": { 50 | "default": "./package.json" 51 | }, 52 | ".": { 53 | "types": "./types/upgrade.d.ts", 54 | "default": "./fesm2022/upgrade.mjs" 55 | }, 56 | "./static": { 57 | "types": "./types/static.d.ts", 58 | "default": "./fesm2022/static.mjs" 59 | }, 60 | "./static/testing": { 61 | "types": "./types/static-testing.d.ts", 62 | "default": "./fesm2022/static-testing.mjs" 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /fesm2022/static-testing.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v21.1.0-next.3+sha-9fa77af 3 | * (c) 2010-2025 Google LLC. https://angular.dev/ 4 | * License: MIT 5 | */ 6 | 7 | import * as i0 from '@angular/core'; 8 | import { NgModule, Injector } from '@angular/core'; 9 | import { $INJECTOR, module_, UPGRADE_APP_TYPE_KEY, INJECTOR_KEY, injector as injector$1 } from './_constants-chunk.mjs'; 10 | import { TestBed } from '@angular/core/testing'; 11 | 12 | let $injector = null; 13 | let injector; 14 | function $injectorFactory() { 15 | return $injector; 16 | } 17 | class AngularTestingModule { 18 | constructor(i) { 19 | injector = i; 20 | } 21 | static ɵfac = i0.ɵɵngDeclareFactory({ 22 | minVersion: "12.0.0", 23 | version: "21.1.0-next.3+sha-9fa77af", 24 | ngImport: i0, 25 | type: AngularTestingModule, 26 | deps: [{ 27 | token: i0.Injector 28 | }], 29 | target: i0.ɵɵFactoryTarget.NgModule 30 | }); 31 | static ɵmod = i0.ɵɵngDeclareNgModule({ 32 | minVersion: "14.0.0", 33 | version: "21.1.0-next.3+sha-9fa77af", 34 | ngImport: i0, 35 | type: AngularTestingModule 36 | }); 37 | static ɵinj = i0.ɵɵngDeclareInjector({ 38 | minVersion: "12.0.0", 39 | version: "21.1.0-next.3+sha-9fa77af", 40 | ngImport: i0, 41 | type: AngularTestingModule, 42 | providers: [{ 43 | provide: $INJECTOR, 44 | useFactory: $injectorFactory 45 | }] 46 | }); 47 | } 48 | i0.ɵɵngDeclareClassMetadata({ 49 | minVersion: "12.0.0", 50 | version: "21.1.0-next.3+sha-9fa77af", 51 | ngImport: i0, 52 | type: AngularTestingModule, 53 | decorators: [{ 54 | type: NgModule, 55 | args: [{ 56 | providers: [{ 57 | provide: $INJECTOR, 58 | useFactory: $injectorFactory 59 | }] 60 | }] 61 | }], 62 | ctorParameters: () => [{ 63 | type: i0.Injector 64 | }] 65 | }); 66 | function createAngularTestingModule(angularJSModules, strictDi) { 67 | module_('$$angularJSTestingModule', angularJSModules).constant(UPGRADE_APP_TYPE_KEY, 2).factory(INJECTOR_KEY, () => injector); 68 | $injector = injector$1(['ng', '$$angularJSTestingModule'], strictDi); 69 | return AngularTestingModule; 70 | } 71 | 72 | function createAngularJSTestingModule(angularModules) { 73 | return module_('$$angularJSTestingModule', []).constant(UPGRADE_APP_TYPE_KEY, 2).factory(INJECTOR_KEY, [$INJECTOR, $injector => { 74 | TestBed.configureTestingModule({ 75 | imports: angularModules, 76 | providers: [{ 77 | provide: $INJECTOR, 78 | useValue: $injector 79 | }] 80 | }); 81 | return TestBed.inject(Injector); 82 | }]).name; 83 | } 84 | 85 | export { createAngularJSTestingModule, createAngularTestingModule }; 86 | //# sourceMappingURL=static-testing.mjs.map 87 | -------------------------------------------------------------------------------- /fesm2022/_constants-chunk.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v21.1.0-next.3+sha-9fa77af 3 | * (c) 2010-2025 Google LLC. https://angular.dev/ 4 | * License: MIT 5 | */ 6 | 7 | function noNg() { 8 | throw new Error('AngularJS v1.x is not loaded!'); 9 | } 10 | const noNgElement = () => noNg(); 11 | noNgElement.cleanData = noNg; 12 | let angular = { 13 | bootstrap: noNg, 14 | module: noNg, 15 | element: noNgElement, 16 | injector: noNg, 17 | version: undefined, 18 | resumeBootstrap: noNg, 19 | getTestability: noNg 20 | }; 21 | try { 22 | if (window.hasOwnProperty('angular')) { 23 | angular = window.angular; 24 | } 25 | } catch {} 26 | function setAngularLib(ng) { 27 | setAngularJSGlobal(ng); 28 | } 29 | function getAngularLib() { 30 | return getAngularJSGlobal(); 31 | } 32 | function setAngularJSGlobal(ng) { 33 | angular = ng; 34 | } 35 | function getAngularJSGlobal() { 36 | return angular; 37 | } 38 | const bootstrap = (e, modules, config) => angular.bootstrap(e, modules, config); 39 | const module_ = (prefix, dependencies) => angular.module(prefix, dependencies); 40 | const element = e => angular.element(e); 41 | element.cleanData = nodes => angular.element.cleanData(nodes); 42 | const injector = (modules, strictDi) => angular.injector(modules, strictDi); 43 | const resumeBootstrap = () => angular.resumeBootstrap(); 44 | const getTestability = e => angular.getTestability(e); 45 | 46 | var angular1 = /*#__PURE__*/Object.freeze({ 47 | __proto__: null, 48 | bootstrap: bootstrap, 49 | element: element, 50 | getAngularJSGlobal: getAngularJSGlobal, 51 | getAngularLib: getAngularLib, 52 | getTestability: getTestability, 53 | injector: injector, 54 | module_: module_, 55 | resumeBootstrap: resumeBootstrap, 56 | setAngularJSGlobal: setAngularJSGlobal, 57 | setAngularLib: setAngularLib 58 | }); 59 | 60 | const $COMPILE = '$compile'; 61 | const $CONTROLLER = '$controller'; 62 | const $DELEGATE = '$delegate'; 63 | const $EXCEPTION_HANDLER = '$exceptionHandler'; 64 | const $HTTP_BACKEND = '$httpBackend'; 65 | const $INJECTOR = '$injector'; 66 | const $INTERVAL = '$interval'; 67 | const $PARSE = '$parse'; 68 | const $PROVIDE = '$provide'; 69 | const $ROOT_ELEMENT = '$rootElement'; 70 | const $ROOT_SCOPE = '$rootScope'; 71 | const $SCOPE = '$scope'; 72 | const $TEMPLATE_CACHE = '$templateCache'; 73 | const $TEMPLATE_REQUEST = '$templateRequest'; 74 | const $$TESTABILITY = '$$testability'; 75 | const COMPILER_KEY = '$$angularCompiler'; 76 | const DOWNGRADED_MODULE_COUNT_KEY = '$$angularDowngradedModuleCount'; 77 | const GROUP_PROJECTABLE_NODES_KEY = '$$angularGroupProjectableNodes'; 78 | const INJECTOR_KEY = '$$angularInjector'; 79 | const LAZY_MODULE_REF = '$$angularLazyModuleRef'; 80 | const NG_ZONE_KEY = '$$angularNgZone'; 81 | const UPGRADE_APP_TYPE_KEY = '$$angularUpgradeAppType'; 82 | const REQUIRE_INJECTOR = '?^^' + INJECTOR_KEY; 83 | const REQUIRE_NG_MODEL = '?ngModel'; 84 | const UPGRADE_MODULE_NAME = '$$UpgradeModule'; 85 | 86 | var constants = /*#__PURE__*/Object.freeze({ 87 | __proto__: null, 88 | $$TESTABILITY: $$TESTABILITY, 89 | $COMPILE: $COMPILE, 90 | $CONTROLLER: $CONTROLLER, 91 | $DELEGATE: $DELEGATE, 92 | $EXCEPTION_HANDLER: $EXCEPTION_HANDLER, 93 | $HTTP_BACKEND: $HTTP_BACKEND, 94 | $INJECTOR: $INJECTOR, 95 | $INTERVAL: $INTERVAL, 96 | $PARSE: $PARSE, 97 | $PROVIDE: $PROVIDE, 98 | $ROOT_ELEMENT: $ROOT_ELEMENT, 99 | $ROOT_SCOPE: $ROOT_SCOPE, 100 | $SCOPE: $SCOPE, 101 | $TEMPLATE_CACHE: $TEMPLATE_CACHE, 102 | $TEMPLATE_REQUEST: $TEMPLATE_REQUEST, 103 | COMPILER_KEY: COMPILER_KEY, 104 | DOWNGRADED_MODULE_COUNT_KEY: DOWNGRADED_MODULE_COUNT_KEY, 105 | GROUP_PROJECTABLE_NODES_KEY: GROUP_PROJECTABLE_NODES_KEY, 106 | INJECTOR_KEY: INJECTOR_KEY, 107 | LAZY_MODULE_REF: LAZY_MODULE_REF, 108 | NG_ZONE_KEY: NG_ZONE_KEY, 109 | REQUIRE_INJECTOR: REQUIRE_INJECTOR, 110 | REQUIRE_NG_MODEL: REQUIRE_NG_MODEL, 111 | UPGRADE_APP_TYPE_KEY: UPGRADE_APP_TYPE_KEY, 112 | UPGRADE_MODULE_NAME: UPGRADE_MODULE_NAME 113 | }); 114 | 115 | export { $$TESTABILITY, $COMPILE, $CONTROLLER, $DELEGATE, $HTTP_BACKEND, $INJECTOR, $INTERVAL, $PARSE, $PROVIDE, $ROOT_ELEMENT, $ROOT_SCOPE, $SCOPE, $TEMPLATE_CACHE, DOWNGRADED_MODULE_COUNT_KEY, INJECTOR_KEY, LAZY_MODULE_REF, REQUIRE_INJECTOR, REQUIRE_NG_MODEL, UPGRADE_APP_TYPE_KEY, UPGRADE_MODULE_NAME, angular1, bootstrap, constants, element, getAngularJSGlobal, getAngularLib, injector, module_, setAngularJSGlobal, setAngularLib }; 116 | //# sourceMappingURL=_constants-chunk.mjs.map 117 | -------------------------------------------------------------------------------- /types/static-testing.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v21.1.0-next.3+sha-9fa77af 3 | * (c) 2010-2025 Google LLC. https://angular.dev/ 4 | * License: MIT 5 | */ 6 | 7 | import { Type } from '@angular/core'; 8 | 9 | /** 10 | * A helper function to use when unit testing Angular services that depend upon upgraded AngularJS 11 | * services. 12 | * 13 | * This function returns an `NgModule` decorated class that is configured to wire up the Angular 14 | * and AngularJS injectors without the need to actually bootstrap a hybrid application. 15 | * This makes it simpler and faster to unit test services. 16 | * 17 | * Use the returned class as an "import" when configuring the `TestBed`. 18 | * 19 | * In the following code snippet, we are configuring the TestBed with two imports. 20 | * The `Ng2AppModule` is the Angular part of our hybrid application and the `ng1AppModule` is the 21 | * AngularJS part. 22 | * 23 | * {@example upgrade/static/ts/full/module.spec.ts region='angular-setup'} 24 | * 25 | * Once this is done we can get hold of services via the Angular `Injector` as normal. 26 | * Services that are (or have dependencies on) an upgraded AngularJS service, will be instantiated 27 | * as needed by the AngularJS `$injector`. 28 | * 29 | * In the following code snippet, `HeroesService` is an Angular service that depends upon an 30 | * AngularJS service, `titleCase`. 31 | * 32 | * {@example upgrade/static/ts/full/module.spec.ts region='angular-spec'} 33 | * 34 | *
35 | * 36 | * This helper is for testing services not Components. 37 | * For Component testing you must still bootstrap a hybrid app. See `UpgradeModule` or 38 | * `downgradeModule` for more information. 39 | * 40 | *
41 | * 42 | *
43 | * 44 | * The resulting configuration does not wire up AngularJS digests to Zone hooks. It is the 45 | * responsibility of the test writer to call `$rootScope.$apply`, as necessary, to trigger 46 | * AngularJS handlers of async events from Angular. 47 | * 48 | *
49 | * 50 | *
51 | * 52 | * The helper sets up global variables to hold the shared Angular and AngularJS injectors. 53 | * 54 | * * Only call this helper once per spec. 55 | * * Do not use `createAngularTestingModule` in the same spec as `createAngularJSTestingModule`. 56 | * 57 | *
58 | * 59 | * Here is the example application and its unit tests that use `createAngularTestingModule` 60 | * and `createAngularJSTestingModule`. 61 | * 62 | * 63 | * 64 | * 65 | * 66 | * 67 | * 68 | * @param angularJSModules a collection of the names of AngularJS modules to include in the 69 | * configuration. 70 | * @param [strictDi] whether the AngularJS injector should have `strictDI` enabled. 71 | * 72 | * @publicApi 73 | */ 74 | declare function createAngularTestingModule(angularJSModules: string[], strictDi?: boolean): Type; 75 | 76 | /** 77 | * A helper function to use when unit testing AngularJS services that depend upon downgraded Angular 78 | * services. 79 | * 80 | * This function returns an AngularJS module that is configured to wire up the AngularJS and Angular 81 | * injectors without the need to actually bootstrap a hybrid application. 82 | * This makes it simpler and faster to unit test services. 83 | * 84 | * Use the returned AngularJS module in a call to 85 | * [`angular.mocks.module`](https://docs.angularjs.org/api/ngMock/function/angular.mock.module) to 86 | * include this module in the unit test injector. 87 | * 88 | * In the following code snippet, we are configuring the `$injector` with two modules: 89 | * The AngularJS `ng1AppModule`, which is the AngularJS part of our hybrid application and the 90 | * `Ng2AppModule`, which is the Angular part. 91 | * 92 | * {@example upgrade/static/ts/full/module.spec.ts region='angularjs-setup'} 93 | * 94 | * Once this is done we can get hold of services via the AngularJS `$injector` as normal. 95 | * Services that are (or have dependencies on) a downgraded Angular service, will be instantiated as 96 | * needed by the Angular root `Injector`. 97 | * 98 | * In the following code snippet, `heroesService` is a downgraded Angular service that we are 99 | * accessing from AngularJS. 100 | * 101 | * {@example upgrade/static/ts/full/module.spec.ts region='angularjs-spec'} 102 | * 103 | *
104 | * 105 | * This helper is for testing services not components. 106 | * For Component testing you must still bootstrap a hybrid app. See `UpgradeModule` or 107 | * `downgradeModule` for more information. 108 | * 109 | *
110 | * 111 | *
112 | * 113 | * The resulting configuration does not wire up AngularJS digests to Zone hooks. It is the 114 | * responsibility of the test writer to call `$rootScope.$apply`, as necessary, to trigger 115 | * AngularJS handlers of async events from Angular. 116 | * 117 | *
118 | * 119 | *
120 | * 121 | * The helper sets up global variables to hold the shared Angular and AngularJS injectors. 122 | * 123 | * * Only call this helper once per spec. 124 | * * Do not use `createAngularJSTestingModule` in the same spec as `createAngularTestingModule`. 125 | * 126 | *
127 | * 128 | * Here is the example application and its unit tests that use `createAngularTestingModule` 129 | * and `createAngularJSTestingModule`. 130 | * 131 | * 132 | * 133 | * 134 | * 135 | * 136 | * 137 | * @param angularModules a collection of Angular modules to include in the configuration. 138 | * 139 | * @publicApi 140 | */ 141 | declare function createAngularJSTestingModule(angularModules: any[]): string; 142 | 143 | export { createAngularJSTestingModule, createAngularTestingModule }; 144 | -------------------------------------------------------------------------------- /fesm2022/static-testing.mjs.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"static-testing.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/upgrade/static/testing/src/create_angular_testing_module.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/upgrade/static/testing/src/create_angularjs_testing_module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injector, NgModule, Type} from '@angular/core';\nimport {ɵangular1 as angular, ɵconstants} from '../../../static';\n\nimport {UpgradeAppType} from '../../../src/common/src/util';\n\nlet $injector: angular.IInjectorService | null = null;\nlet injector: Injector;\n\nexport function $injectorFactory() {\n return $injector;\n}\n\n@NgModule({providers: [{provide: ɵconstants.$INJECTOR, useFactory: $injectorFactory}]})\nexport class AngularTestingModule {\n constructor(i: Injector) {\n injector = i;\n }\n}\n\n/**\n * A helper function to use when unit testing Angular services that depend upon upgraded AngularJS\n * services.\n *\n * This function returns an `NgModule` decorated class that is configured to wire up the Angular\n * and AngularJS injectors without the need to actually bootstrap a hybrid application.\n * This makes it simpler and faster to unit test services.\n *\n * Use the returned class as an \"import\" when configuring the `TestBed`.\n *\n * In the following code snippet, we are configuring the TestBed with two imports.\n * The `Ng2AppModule` is the Angular part of our hybrid application and the `ng1AppModule` is the\n * AngularJS part.\n *\n * {@example upgrade/static/ts/full/module.spec.ts region='angular-setup'}\n *\n * Once this is done we can get hold of services via the Angular `Injector` as normal.\n * Services that are (or have dependencies on) an upgraded AngularJS service, will be instantiated\n * as needed by the AngularJS `$injector`.\n *\n * In the following code snippet, `HeroesService` is an Angular service that depends upon an\n * AngularJS service, `titleCase`.\n *\n * {@example upgrade/static/ts/full/module.spec.ts region='angular-spec'}\n *\n *
\n *\n * This helper is for testing services not Components.\n * For Component testing you must still bootstrap a hybrid app. See `UpgradeModule` or\n * `downgradeModule` for more information.\n *\n *
\n *\n *
\n *\n * The resulting configuration does not wire up AngularJS digests to Zone hooks. It is the\n * responsibility of the test writer to call `$rootScope.$apply`, as necessary, to trigger\n * AngularJS handlers of async events from Angular.\n *\n *
\n *\n *
\n *\n * The helper sets up global variables to hold the shared Angular and AngularJS injectors.\n *\n * * Only call this helper once per spec.\n * * Do not use `createAngularTestingModule` in the same spec as `createAngularJSTestingModule`.\n *\n *
\n *\n * Here is the example application and its unit tests that use `createAngularTestingModule`\n * and `createAngularJSTestingModule`.\n *\n * \n * \n * \n * \n *\n *\n * @param angularJSModules a collection of the names of AngularJS modules to include in the\n * configuration.\n * @param [strictDi] whether the AngularJS injector should have `strictDI` enabled.\n *\n * @publicApi\n */\nexport function createAngularTestingModule(\n angularJSModules: string[],\n strictDi?: boolean,\n): Type {\n angular\n .module_('$$angularJSTestingModule', angularJSModules)\n .constant(ɵconstants.UPGRADE_APP_TYPE_KEY, UpgradeAppType.Static)\n .factory(ɵconstants.INJECTOR_KEY, () => injector);\n $injector = angular.injector(['ng', '$$angularJSTestingModule'], strictDi);\n return AngularTestingModule;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injector} from '@angular/core';\nimport {TestBed} from '@angular/core/testing';\nimport {ɵangular1 as ng, ɵconstants} from '../../../static';\n\nimport {UpgradeAppType} from '../../../src/common/src/util';\n\n/**\n * A helper function to use when unit testing AngularJS services that depend upon downgraded Angular\n * services.\n *\n * This function returns an AngularJS module that is configured to wire up the AngularJS and Angular\n * injectors without the need to actually bootstrap a hybrid application.\n * This makes it simpler and faster to unit test services.\n *\n * Use the returned AngularJS module in a call to\n * [`angular.mocks.module`](https://docs.angularjs.org/api/ngMock/function/angular.mock.module) to\n * include this module in the unit test injector.\n *\n * In the following code snippet, we are configuring the `$injector` with two modules:\n * The AngularJS `ng1AppModule`, which is the AngularJS part of our hybrid application and the\n * `Ng2AppModule`, which is the Angular part.\n *\n * {@example upgrade/static/ts/full/module.spec.ts region='angularjs-setup'}\n *\n * Once this is done we can get hold of services via the AngularJS `$injector` as normal.\n * Services that are (or have dependencies on) a downgraded Angular service, will be instantiated as\n * needed by the Angular root `Injector`.\n *\n * In the following code snippet, `heroesService` is a downgraded Angular service that we are\n * accessing from AngularJS.\n *\n * {@example upgrade/static/ts/full/module.spec.ts region='angularjs-spec'}\n *\n *
\n *\n * This helper is for testing services not components.\n * For Component testing you must still bootstrap a hybrid app. See `UpgradeModule` or\n * `downgradeModule` for more information.\n *\n *
\n *\n *
\n *\n * The resulting configuration does not wire up AngularJS digests to Zone hooks. It is the\n * responsibility of the test writer to call `$rootScope.$apply`, as necessary, to trigger\n * AngularJS handlers of async events from Angular.\n *\n *
\n *\n *
\n *\n * The helper sets up global variables to hold the shared Angular and AngularJS injectors.\n *\n * * Only call this helper once per spec.\n * * Do not use `createAngularJSTestingModule` in the same spec as `createAngularTestingModule`.\n *\n *
\n *\n * Here is the example application and its unit tests that use `createAngularTestingModule`\n * and `createAngularJSTestingModule`.\n *\n * \n * \n * \n * \n *\n *\n * @param angularModules a collection of Angular modules to include in the configuration.\n *\n * @publicApi\n */\nexport function createAngularJSTestingModule(angularModules: any[]): string {\n return ng\n .module_('$$angularJSTestingModule', [])\n .constant(ɵconstants.UPGRADE_APP_TYPE_KEY, UpgradeAppType.Static)\n .factory(ɵconstants.INJECTOR_KEY, [\n ɵconstants.$INJECTOR,\n ($injector: ng.IInjectorService) => {\n TestBed.configureTestingModule({\n imports: angularModules,\n providers: [{provide: ɵconstants.$INJECTOR, useValue: $injector}],\n });\n return TestBed.inject(Injector);\n },\n ]).name;\n}\n"],"names":["$injector","injector","$injectorFactory","AngularTestingModule","constructor","i","deps","token","i0","Injector","target","ɵɵFactoryTarget","NgModule","ɵinj","ɵɵngDeclareInjector","minVersion","version","ngImport","type","providers","provide","ɵconstants","useFactory","decorators","args","createAngularTestingModule","angularJSModules","strictDi","angular","constant","factory","createAngularJSTestingModule","angularModules","ng","TestBed","configureTestingModule","imports","useValue","inject","name"],"mappings":";;;;;;;;;;;AAaA,IAAIA,SAAS,GAAoC,IAAI;AACrD,IAAIC,QAAkB;SAENC,gBAAgBA,GAAA;AAC9B,EAAA,OAAOF,SAAS;AAClB;MAGaG,oBAAoB,CAAA;EAC/BC,WAAAA,CAAYC,CAAW,EAAA;AACrBJ,IAAAA,QAAQ,GAAGI,CAAC;AACd;;;;;UAHWF,oBAAoB;AAAAG,IAAAA,IAAA,EAAA,CAAA;MAAAC,KAAA,EAAAC,EAAA,CAAAC;AAAA,KAAA,CAAA;AAAAC,IAAAA,MAAA,EAAAF,EAAA,CAAAG,eAAA,CAAAC;AAAA,GAAA,CAAA;;;;;UAApBT;AAAoB,GAAA,CAAA;AAApB,EAAA,OAAAU,IAAA,GAAAL,EAAA,CAAAM,mBAAA,CAAA;AAAAC,IAAAA,UAAA,EAAA,QAAA;AAAAC,IAAAA,OAAA,EAAA,mBAAA;AAAAC,IAAAA,QAAA,EAAAT,EAAA;AAAAU,IAAAA,IAAA,EAAAf,oBAAoB;AADXgB,IAAAA,SAAA,EAAA,CAAC;MAACC,OAAO,EAAEC,SAAoB;AAAEC,MAAAA,UAAU,EAAEpB;KAAiB;AAAC,GAAA,CAAA;;;;;;QACxEC,oBAAoB;AAAAoB,EAAAA,UAAA,EAAA,CAAA;UADhCX,QAAQ;AAACY,IAAAA,IAAA,EAAA,CAAA;AAACL,MAAAA,SAAS,EAAE,CAAC;QAACC,OAAO,EAAEC,SAAoB;AAAEC,QAAAA,UAAU,EAAEpB;OAAiB;KAAE;;;;;;AAwEtE,SAAAuB,0BAA0BA,CACxCC,gBAA0B,EAC1BC,QAAkB,EAAA;EAElBC,OACU,CAAC,0BAA0B,EAAEF,gBAAgB,CAAA,CACpDG,QAAQ,CAACR,oBAA+B,EAAwB,CAAA,CAAA,CAChES,OAAO,CAACT,YAAuB,EAAE,MAAMpB,QAAQ,CAAC;AACnDD,EAAAA,SAAS,GAAG4B,UAAgB,CAAC,CAAC,IAAI,EAAE,0BAA0B,CAAC,EAAED,QAAQ,CAAC;AAC1E,EAAA,OAAOxB,oBAAoB;AAC7B;;ACvBM,SAAU4B,4BAA4BA,CAACC,cAAqB,EAAA;AAChE,EAAA,OAAOC,OACG,CAAC,0BAA0B,EAAE,EAAE,CAAA,CACtCJ,QAAQ,CAACR,oBAA+B,EAAwB,CAAA,CAAA,CAChES,OAAO,CAACT,YAAuB,EAAE,CAChCA,SAAoB,EACnBrB,SAA8B,IAAI;IACjCkC,OAAO,CAACC,sBAAsB,CAAC;AAC7BC,MAAAA,OAAO,EAAEJ,cAAc;AACvBb,MAAAA,SAAS,EAAE,CAAC;QAACC,OAAO,EAAEC,SAAoB;AAAEgB,QAAAA,QAAQ,EAAErC;OAAU;AACjE,KAAA,CAAC;AACF,IAAA,OAAOkC,OAAO,CAACI,MAAM,CAAC7B,QAAQ,CAAC;GAChC,CACF,CAAC,CAAC8B,IAAI;AACX;;;;"} -------------------------------------------------------------------------------- /fesm2022/_constants-chunk.mjs.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_constants-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/upgrade/src/common/src/angular1.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/upgrade/src/common/src/constants.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport type Ng1Token = string;\n\nexport type Ng1Expression = string | Function;\n\nexport interface IAnnotatedFunction extends Function {\n // Older versions of `@types/angular` typings extend the global `Function` interface with\n // `$inject?: string[]`, which is not compatible with `$inject?: ReadonlyArray` (used in\n // latest versions).\n $inject?: Function extends {$inject?: string[]} ? Ng1Token[] : ReadonlyArray;\n}\n\nexport type IInjectable = (Ng1Token | Function)[] | IAnnotatedFunction;\n\nexport type SingleOrListOrMap = T | T[] | {[key: string]: T};\n\nexport interface IModule {\n name: string;\n requires: (string | IInjectable)[];\n config(fn: IInjectable): IModule;\n directive(selector: string, factory: IInjectable): IModule;\n component(selector: string, component: IComponent): IModule;\n controller(name: string, type: IInjectable): IModule;\n factory(key: Ng1Token, factoryFn: IInjectable): IModule;\n value(key: Ng1Token, value: any): IModule;\n constant(token: Ng1Token, value: any): IModule;\n run(a: IInjectable): IModule;\n}\nexport interface ICompileService {\n (element: Element | NodeList | Node[] | string, transclude?: Function): ILinkFn;\n}\nexport interface ILinkFn {\n (scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ILinkFnOptions): IAugmentedJQuery;\n $$slots?: {[slotName: string]: ILinkFn};\n}\nexport interface ILinkFnOptions {\n parentBoundTranscludeFn?: Function;\n transcludeControllers?: {[key: string]: any};\n futureParentElement?: Node;\n}\nexport interface IRootScopeService {\n $new(isolate?: boolean): IScope;\n $id: string;\n $parent: IScope;\n $root: IScope;\n $watch(exp: Ng1Expression, fn?: (a1?: any, a2?: any) => void): Function;\n $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function;\n $destroy(): any;\n $apply(exp?: Ng1Expression): any;\n $digest(): any;\n $evalAsync(exp: Ng1Expression, locals?: any): void;\n $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function;\n $$childTail: IScope;\n $$childHead: IScope;\n $$nextSibling: IScope;\n $$phase: any;\n [key: string]: any;\n}\nexport interface IScope extends IRootScopeService {}\n\nexport interface IAngularBootstrapConfig {\n strictDi?: boolean;\n}\nexport interface IDirective {\n compile?: IDirectiveCompileFn;\n controller?: IController;\n controllerAs?: string;\n bindToController?: boolean | {[key: string]: string};\n link?: IDirectiveLinkFn | IDirectivePrePost;\n name?: string;\n priority?: number;\n replace?: boolean;\n require?: DirectiveRequireProperty;\n restrict?: string;\n scope?: boolean | {[key: string]: string};\n template?: string | Function;\n templateUrl?: string | Function;\n templateNamespace?: string;\n terminal?: boolean;\n transclude?: DirectiveTranscludeProperty;\n}\nexport type DirectiveRequireProperty = SingleOrListOrMap;\nexport type DirectiveTranscludeProperty = boolean | 'element' | {[key: string]: string};\nexport interface IDirectiveCompileFn {\n (\n templateElement: IAugmentedJQuery,\n templateAttributes: IAttributes,\n transclude: ITranscludeFunction,\n ): IDirectivePrePost;\n}\nexport interface IDirectivePrePost {\n pre?: IDirectiveLinkFn;\n post?: IDirectiveLinkFn;\n}\nexport interface IDirectiveLinkFn {\n (\n scope: IScope,\n instanceElement: IAugmentedJQuery,\n instanceAttributes: IAttributes,\n controller: any,\n transclude: ITranscludeFunction,\n ): void;\n}\nexport interface IComponent {\n bindings?: {[key: string]: string};\n controller?: string | IInjectable;\n controllerAs?: string;\n require?: DirectiveRequireProperty;\n template?: string | Function;\n templateUrl?: string | Function;\n transclude?: DirectiveTranscludeProperty;\n}\nexport interface IAttributes {\n $observe(attr: string, fn: (v: string) => void): void;\n [key: string]: any;\n}\nexport interface ITranscludeFunction {\n // If the scope is provided, then the cloneAttachFn must be as well.\n (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery;\n // If one argument is provided, then it's assumed to be the cloneAttachFn.\n (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;\n}\nexport interface ICloneAttachFunction {\n (clonedElement: IAugmentedJQuery, scope: IScope): any;\n}\nexport type IAugmentedJQuery = Node[] & {\n on?: (name: string, fn: () => void) => void;\n data?: (name: string, value?: any) => any;\n text?: () => string;\n inheritedData?: (name: string, value?: any) => any;\n children?: () => IAugmentedJQuery;\n contents?: () => IAugmentedJQuery;\n parent?: () => IAugmentedJQuery;\n empty?: () => void;\n append?: (content: IAugmentedJQuery | string) => IAugmentedJQuery;\n controller?: (name: string) => any;\n isolateScope?: () => IScope;\n injector?: () => IInjectorService;\n triggerHandler?: (eventTypeOrObject: string | Event, extraParameters?: any[]) => IAugmentedJQuery;\n remove?: () => void;\n removeData?: () => void;\n};\nexport interface IProvider {\n $get: IInjectable;\n}\nexport interface IProvideService {\n provider(token: Ng1Token, provider: IProvider): IProvider;\n factory(token: Ng1Token, factory: IInjectable): IProvider;\n service(token: Ng1Token, type: IInjectable): IProvider;\n value(token: Ng1Token, value: any): IProvider;\n constant(token: Ng1Token, value: any): void;\n decorator(token: Ng1Token, factory: IInjectable): void;\n}\nexport interface IParseService {\n (expression: string): ICompiledExpression;\n}\nexport interface ICompiledExpression {\n (context: any, locals: any): any;\n assign?: (context: any, value: any) => any;\n}\nexport interface IHttpBackendService {\n (\n method: string,\n url: string,\n post?: any,\n callback?: Function,\n headers?: any,\n timeout?: number,\n withCredentials?: boolean,\n ): void;\n}\nexport interface ICacheObject {\n put(key: string, value?: T): T;\n get(key: string): any;\n}\nexport interface ITemplateCacheService extends ICacheObject {}\nexport type IController = string | IInjectable;\nexport interface IControllerService {\n (controllerConstructor: IController, locals?: any, later?: any, ident?: any): any;\n (controllerName: string, locals?: any): any;\n}\n\nexport interface IInjectorService {\n get(key: string): any;\n has(key: string): boolean;\n}\n\nexport interface IIntervalService {\n (\n func: Function,\n delay: number,\n count?: number,\n invokeApply?: boolean,\n ...args: any[]\n ): Promise;\n cancel(promise: Promise): boolean;\n}\n\nexport interface ITestabilityService {\n findBindings(element: Element, expression: string, opt_exactMatch?: boolean): Element[];\n findModels(element: Element, expression: string, opt_exactMatch?: boolean): Element[];\n getLocation(): string;\n setLocation(url: string): void;\n whenStable(callback: Function): void;\n}\n\nexport interface INgModelController {\n $render(): void;\n $isEmpty(value: any): boolean;\n $setValidity(validationErrorKey: string, isValid: boolean): void;\n $setPristine(): void;\n $setDirty(): void;\n $setUntouched(): void;\n $setTouched(): void;\n $rollbackViewValue(): void;\n $validate(): void;\n $commitViewValue(): void;\n $setViewValue(value: any, trigger: string): void;\n\n $viewValue: any;\n $modelValue: any;\n $parsers: Function[];\n $formatters: Function[];\n $validators: {[key: string]: Function};\n $asyncValidators: {[key: string]: Function};\n $viewChangeListeners: Function[];\n $error: Object;\n $pending: Object;\n $untouched: boolean;\n $touched: boolean;\n $pristine: boolean;\n $dirty: boolean;\n $valid: boolean;\n $invalid: boolean;\n $name: string;\n}\n\nfunction noNg(): never {\n throw new Error('AngularJS v1.x is not loaded!');\n}\n\nconst noNgElement: typeof angular.element = (() => noNg()) as any;\nnoNgElement.cleanData = noNg;\n\nlet angular: {\n bootstrap: (\n e: Element,\n modules: (string | IInjectable)[],\n config?: IAngularBootstrapConfig,\n ) => IInjectorService;\n module: (prefix: string, dependencies?: string[]) => IModule;\n element: {\n (e: string | Element | Document | IAugmentedJQuery): IAugmentedJQuery;\n cleanData: (nodes: Node[] | NodeList) => void;\n };\n injector: (modules: Array, strictDi?: boolean) => IInjectorService;\n version: {major: number};\n resumeBootstrap: () => void;\n getTestability: (e: Element) => ITestabilityService;\n} = {\n bootstrap: noNg,\n module: noNg,\n element: noNgElement,\n injector: noNg,\n version: undefined as any,\n resumeBootstrap: noNg,\n getTestability: noNg,\n};\n\ntry {\n if (window.hasOwnProperty('angular')) {\n angular = (window).angular;\n }\n} catch {\n // ignore in CJS mode.\n}\n\n/**\n * @deprecated Use `setAngularJSGlobal` instead.\n *\n * @publicApi\n */\nexport function setAngularLib(ng: any): void {\n setAngularJSGlobal(ng);\n}\n\n/**\n * @deprecated Use `getAngularJSGlobal` instead.\n *\n * @publicApi\n */\nexport function getAngularLib(): any {\n return getAngularJSGlobal();\n}\n\n/**\n * Resets the AngularJS global.\n *\n * Used when AngularJS is loaded lazily, and not available on `window`.\n *\n * @publicApi\n */\nexport function setAngularJSGlobal(ng: any): void {\n angular = ng;\n}\n\n/**\n * Returns the current AngularJS global.\n *\n * @publicApi\n */\nexport function getAngularJSGlobal(): any {\n return angular;\n}\n\nexport const bootstrap: typeof angular.bootstrap = (e, modules, config?) =>\n angular.bootstrap(e, modules, config);\n\n// Do not declare as `module` to avoid webpack bug\n// (see https://github.com/angular/angular/issues/30050).\nexport const module_: typeof angular.module = (prefix, dependencies?) =>\n angular.module(prefix, dependencies);\n\nexport const element: typeof angular.element = ((e) =>\n angular.element(e)) as typeof angular.element;\nelement.cleanData = (nodes) => angular.element.cleanData(nodes);\n\nexport const injector: typeof angular.injector = (\n modules: Array,\n strictDi?: boolean,\n) => angular.injector(modules, strictDi);\n\nexport const resumeBootstrap: typeof angular.resumeBootstrap = () => angular.resumeBootstrap();\n\nexport const getTestability: typeof angular.getTestability = (e) => angular.getTestability(e);\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport const $COMPILE = '$compile';\nexport const $CONTROLLER = '$controller';\nexport const $DELEGATE = '$delegate';\nexport const $EXCEPTION_HANDLER = '$exceptionHandler';\nexport const $HTTP_BACKEND = '$httpBackend';\nexport const $INJECTOR = '$injector';\nexport const $INTERVAL = '$interval';\nexport const $PARSE = '$parse';\nexport const $PROVIDE = '$provide';\nexport const $ROOT_ELEMENT = '$rootElement';\nexport const $ROOT_SCOPE = '$rootScope';\nexport const $SCOPE = '$scope';\nexport const $TEMPLATE_CACHE = '$templateCache';\nexport const $TEMPLATE_REQUEST = '$templateRequest';\n\nexport const $$TESTABILITY = '$$testability';\n\nexport const COMPILER_KEY = '$$angularCompiler';\nexport const DOWNGRADED_MODULE_COUNT_KEY = '$$angularDowngradedModuleCount';\nexport const GROUP_PROJECTABLE_NODES_KEY = '$$angularGroupProjectableNodes';\nexport const INJECTOR_KEY = '$$angularInjector';\nexport const LAZY_MODULE_REF = '$$angularLazyModuleRef';\nexport const NG_ZONE_KEY = '$$angularNgZone';\nexport const UPGRADE_APP_TYPE_KEY = '$$angularUpgradeAppType';\n\nexport const REQUIRE_INJECTOR = '?^^' + INJECTOR_KEY;\nexport const REQUIRE_NG_MODEL = '?ngModel';\n\nexport const UPGRADE_MODULE_NAME = '$$UpgradeModule';\n"],"names":["noNg","Error","noNgElement","cleanData","angular","bootstrap","module","element","injector","version","undefined","resumeBootstrap","getTestability","window","hasOwnProperty","setAngularLib","ng","setAngularJSGlobal","getAngularLib","getAngularJSGlobal","e","modules","config","module_","prefix","dependencies","nodes","strictDi","$COMPILE","$CONTROLLER","$DELEGATE","$EXCEPTION_HANDLER","$HTTP_BACKEND","$INJECTOR","$INTERVAL","$PARSE","$PROVIDE","$ROOT_ELEMENT","$ROOT_SCOPE","$SCOPE","$TEMPLATE_CACHE","$TEMPLATE_REQUEST","$$TESTABILITY","COMPILER_KEY","DOWNGRADED_MODULE_COUNT_KEY","GROUP_PROJECTABLE_NODES_KEY","INJECTOR_KEY","LAZY_MODULE_REF","NG_ZONE_KEY","UPGRADE_APP_TYPE_KEY","REQUIRE_INJECTOR","REQUIRE_NG_MODEL","UPGRADE_MODULE_NAME"],"mappings":";;;;;;AAoPA,SAASA,IAAIA,GAAA;AACX,EAAA,MAAM,IAAIC,KAAK,CAAC,+BAA+B,CAAC;AAClD;AAEA,MAAMC,WAAW,GAA4BA,MAAMF,IAAI,EAAU;AACjEE,WAAW,CAACC,SAAS,GAAGH,IAAI;AAE5B,IAAII,OAAO,GAeP;AACFC,EAAAA,SAAS,EAAEL,IAAI;AACfM,EAAAA,MAAM,EAAEN,IAAI;AACZO,EAAAA,OAAO,EAAEL,WAAW;AACpBM,EAAAA,QAAQ,EAAER,IAAI;AACdS,EAAAA,OAAO,EAAEC,SAAgB;AACzBC,EAAAA,eAAe,EAAEX,IAAI;AACrBY,EAAAA,cAAc,EAAEZ;CACjB;AAED,IAAI;AACF,EAAA,IAAIa,MAAM,CAACC,cAAc,CAAC,SAAS,CAAC,EAAE;IACpCV,OAAO,GAASS,MAAO,CAACT,OAAO;AACjC;AACF,CAAA,CAAE,MAAM;AASF,SAAUW,aAAaA,CAACC,EAAO,EAAA;EACnCC,kBAAkB,CAACD,EAAE,CAAC;AACxB;SAOgBE,aAAaA,GAAA;EAC3B,OAAOC,kBAAkB,EAAE;AAC7B;AASM,SAAUF,kBAAkBA,CAACD,EAAO,EAAA;AACxCZ,EAAAA,OAAO,GAAGY,EAAE;AACd;SAOgBG,kBAAkBA,GAAA;AAChC,EAAA,OAAOf,OAAO;AAChB;MAEaC,SAAS,GAA6BA,CAACe,CAAC,EAAEC,OAAO,EAAEC,MAAO,KACrElB,OAAO,CAACC,SAAS,CAACe,CAAC,EAAEC,OAAO,EAAEC,MAAM;AAIzBC,MAAAA,OAAO,GAA0BA,CAACC,MAAM,EAAEC,YAAa,KAClErB,OAAO,CAACE,MAAM,CAACkB,MAAM,EAAEC,YAAY;AAE9B,MAAMlB,OAAO,GAA6Ba,CAAC,IAChDhB,OAAO,CAACG,OAAO,CAACa,CAAC;AACnBb,OAAO,CAACJ,SAAS,GAAIuB,KAAK,IAAKtB,OAAO,CAACG,OAAO,CAACJ,SAAS,CAACuB,KAAK,CAAC;AAElDlB,MAAAA,QAAQ,GAA4BA,CAC/Ca,OAAoC,EACpCM,QAAkB,KACfvB,OAAO,CAACI,QAAQ,CAACa,OAAO,EAAEM,QAAQ;AAEhC,MAAMhB,eAAe,GAAmCA,MAAMP,OAAO,CAACO,eAAe,EAAE;AAEvF,MAAMC,cAAc,GAAmCQ,CAAC,IAAKhB,OAAO,CAACQ,cAAc,CAACQ,CAAC,CAAC;;;;;;;;;;;;;;;;AC7UtF,MAAMQ,QAAQ,GAAG;AACjB,MAAMC,WAAW,GAAG;AACpB,MAAMC,SAAS,GAAG;AAClB,MAAMC,kBAAkB,GAAG,mBAAmB;AAC9C,MAAMC,aAAa,GAAG;AACtB,MAAMC,SAAS,GAAG;AAClB,MAAMC,SAAS,GAAG;AAClB,MAAMC,MAAM,GAAG;AACf,MAAMC,QAAQ,GAAG;AACjB,MAAMC,aAAa,GAAG;AACtB,MAAMC,WAAW,GAAG;AACpB,MAAMC,MAAM,GAAG;AACf,MAAMC,eAAe,GAAG;AACxB,MAAMC,iBAAiB,GAAG,kBAAkB;AAE5C,MAAMC,aAAa,GAAG;AAEtB,MAAMC,YAAY,GAAG,mBAAmB;AACxC,MAAMC,2BAA2B,GAAG;AACpC,MAAMC,2BAA2B,GAAG,gCAAgC;AACpE,MAAMC,YAAY,GAAG;AACrB,MAAMC,eAAe,GAAG;AACxB,MAAMC,WAAW,GAAG,iBAAiB;AACrC,MAAMC,oBAAoB,GAAG;AAEvBC,MAAAA,gBAAgB,GAAG,KAAK,GAAGJ;AACjC,MAAMK,gBAAgB,GAAG;AAEzB,MAAMC,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} -------------------------------------------------------------------------------- /fesm2022/static.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v21.1.0-next.3+sha-9fa77af 3 | * (c) 2010-2025 Google LLC. https://angular.dev/ 4 | * License: MIT 5 | */ 6 | 7 | import { element, $ROOT_ELEMENT, $ROOT_SCOPE, DOWNGRADED_MODULE_COUNT_KEY, UPGRADE_APP_TYPE_KEY, $SCOPE, $COMPILE, $INJECTOR, $PARSE, REQUIRE_INJECTOR, REQUIRE_NG_MODEL, LAZY_MODULE_REF, INJECTOR_KEY, $CONTROLLER, $TEMPLATE_CACHE, $HTTP_BACKEND, module_, $PROVIDE, UPGRADE_MODULE_NAME, $$TESTABILITY, $DELEGATE, $INTERVAL, bootstrap } from './_constants-chunk.mjs'; 8 | export { getAngularJSGlobal, getAngularLib, setAngularJSGlobal, setAngularLib, angular1 as ɵangular1, constants as ɵconstants } from './_constants-chunk.mjs'; 9 | import * as i0 from '@angular/core'; 10 | import { ɵNG_MOD_DEF as _NG_MOD_DEF, Injector, ChangeDetectorRef, Testability, TestabilityRegistry, ApplicationRef, SimpleChange, ɵSIGNAL as _SIGNAL, NgZone, ComponentFactoryResolver, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as _NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, PlatformRef, ɵinternalProvideZoneChangeDetection as _internalProvideZoneChangeDetection, EventEmitter, Directive, ɵNoopNgZone as _NoopNgZone, NgModule } from '@angular/core'; 11 | export { VERSION } from './upgrade.mjs'; 12 | import { platformBrowser } from '@angular/platform-browser'; 13 | 14 | class PropertyBinding { 15 | prop; 16 | attr; 17 | bracketAttr; 18 | bracketParenAttr; 19 | parenAttr; 20 | onAttr; 21 | bindAttr; 22 | bindonAttr; 23 | constructor(prop, attr) { 24 | this.prop = prop; 25 | this.attr = attr; 26 | this.bracketAttr = `[${this.attr}]`; 27 | this.parenAttr = `(${this.attr})`; 28 | this.bracketParenAttr = `[(${this.attr})]`; 29 | const capitalAttr = this.attr.charAt(0).toUpperCase() + this.attr.slice(1); 30 | this.onAttr = `on${capitalAttr}`; 31 | this.bindAttr = `bind${capitalAttr}`; 32 | this.bindonAttr = `bindon${capitalAttr}`; 33 | } 34 | } 35 | 36 | const DIRECTIVE_PREFIX_REGEXP = /^(?:x|data)[:\-_]/i; 37 | const DIRECTIVE_SPECIAL_CHARS_REGEXP = /[:\-_]+(.)/g; 38 | function onError(e) { 39 | console.error(e, e.stack); 40 | throw e; 41 | } 42 | function cleanData(node) { 43 | element.cleanData([node]); 44 | if (isParentNode(node)) { 45 | element.cleanData(node.querySelectorAll('*')); 46 | } 47 | } 48 | function controllerKey(name) { 49 | return '$' + name + 'Controller'; 50 | } 51 | function destroyApp($injector) { 52 | const $rootElement = $injector.get($ROOT_ELEMENT); 53 | const $rootScope = $injector.get($ROOT_SCOPE); 54 | $rootScope.$destroy(); 55 | cleanData($rootElement[0]); 56 | } 57 | function directiveNormalize(name) { 58 | return name.replace(DIRECTIVE_PREFIX_REGEXP, '').replace(DIRECTIVE_SPECIAL_CHARS_REGEXP, (_, letter) => letter.toUpperCase()); 59 | } 60 | function getTypeName(type) { 61 | return type.overriddenName || type.name || type.toString().split('\n')[0]; 62 | } 63 | function getDowngradedModuleCount($injector) { 64 | return $injector.has(DOWNGRADED_MODULE_COUNT_KEY) ? $injector.get(DOWNGRADED_MODULE_COUNT_KEY) : 0; 65 | } 66 | function getUpgradeAppType($injector) { 67 | return $injector.has(UPGRADE_APP_TYPE_KEY) ? $injector.get(UPGRADE_APP_TYPE_KEY) : 0; 68 | } 69 | function isFunction(value) { 70 | return typeof value === 'function'; 71 | } 72 | function isNgModuleType(value) { 73 | return isFunction(value) && !!value[_NG_MOD_DEF]; 74 | } 75 | function isParentNode(node) { 76 | return isFunction(node.querySelectorAll); 77 | } 78 | function validateInjectionKey($injector, downgradedModule, injectionKey, attemptedAction) { 79 | const upgradeAppType = getUpgradeAppType($injector); 80 | const downgradedModuleCount = getDowngradedModuleCount($injector); 81 | switch (upgradeAppType) { 82 | case 1: 83 | case 2: 84 | if (downgradedModule) { 85 | throw new Error(`Error while ${attemptedAction}: 'downgradedModule' unexpectedly specified.\n` + "You should not specify a value for 'downgradedModule', unless you are downgrading " + "more than one Angular module (via 'downgradeModule()')."); 86 | } 87 | break; 88 | case 3: 89 | if (!downgradedModule && downgradedModuleCount >= 2) { 90 | throw new Error(`Error while ${attemptedAction}: 'downgradedModule' not specified.\n` + 'This application contains more than one downgraded Angular module, thus you need to ' + "always specify 'downgradedModule' when downgrading components and injectables."); 91 | } 92 | if (!$injector.has(injectionKey)) { 93 | throw new Error(`Error while ${attemptedAction}: Unable to find the specified downgraded module.\n` + 'Did you forget to downgrade an Angular module or include it in the AngularJS ' + 'application?'); 94 | } 95 | break; 96 | default: 97 | throw new Error(`Error while ${attemptedAction}: Not a valid '@angular/upgrade' application.\n` + 'Did you forget to downgrade an Angular module or include it in the AngularJS ' + 'application?'); 98 | } 99 | } 100 | class Deferred { 101 | promise; 102 | resolve; 103 | reject; 104 | constructor() { 105 | this.promise = new Promise((res, rej) => { 106 | this.resolve = res; 107 | this.reject = rej; 108 | }); 109 | } 110 | } 111 | function supportsNgModel(component) { 112 | return typeof component.writeValue === 'function' && typeof component.registerOnChange === 'function'; 113 | } 114 | function hookupNgModel(ngModel, component) { 115 | if (ngModel && supportsNgModel(component)) { 116 | ngModel.$render = () => { 117 | component.writeValue(ngModel.$viewValue); 118 | }; 119 | component.registerOnChange(ngModel.$setViewValue.bind(ngModel)); 120 | if (typeof component.registerOnTouched === 'function') { 121 | component.registerOnTouched(ngModel.$setTouched.bind(ngModel)); 122 | } 123 | } 124 | } 125 | function strictEquals(val1, val2) { 126 | return val1 === val2 || val1 !== val1 && val2 !== val2; 127 | } 128 | 129 | var util = /*#__PURE__*/Object.freeze({ 130 | __proto__: null, 131 | Deferred: Deferred, 132 | cleanData: cleanData, 133 | controllerKey: controllerKey, 134 | destroyApp: destroyApp, 135 | directiveNormalize: directiveNormalize, 136 | getDowngradedModuleCount: getDowngradedModuleCount, 137 | getTypeName: getTypeName, 138 | getUpgradeAppType: getUpgradeAppType, 139 | hookupNgModel: hookupNgModel, 140 | isFunction: isFunction, 141 | isNgModuleType: isNgModuleType, 142 | onError: onError, 143 | strictEquals: strictEquals, 144 | validateInjectionKey: validateInjectionKey 145 | }); 146 | 147 | const INITIAL_VALUE$1 = { 148 | __UNINITIALIZED__: true 149 | }; 150 | class DowngradeComponentAdapter { 151 | element; 152 | attrs; 153 | scope; 154 | ngModel; 155 | parentInjector; 156 | $compile; 157 | $parse; 158 | componentFactory; 159 | wrapCallback; 160 | unsafelyOverwriteSignalInputs; 161 | implementsOnChanges = false; 162 | inputChangeCount = 0; 163 | inputChanges = {}; 164 | componentScope; 165 | constructor(element, attrs, scope, ngModel, parentInjector, $compile, $parse, componentFactory, wrapCallback, unsafelyOverwriteSignalInputs) { 166 | this.element = element; 167 | this.attrs = attrs; 168 | this.scope = scope; 169 | this.ngModel = ngModel; 170 | this.parentInjector = parentInjector; 171 | this.$compile = $compile; 172 | this.$parse = $parse; 173 | this.componentFactory = componentFactory; 174 | this.wrapCallback = wrapCallback; 175 | this.unsafelyOverwriteSignalInputs = unsafelyOverwriteSignalInputs; 176 | this.componentScope = scope.$new(); 177 | } 178 | compileContents() { 179 | const compiledProjectableNodes = []; 180 | const projectableNodes = this.groupProjectableNodes(); 181 | const linkFns = projectableNodes.map(nodes => this.$compile(nodes)); 182 | this.element.empty(); 183 | linkFns.forEach(linkFn => { 184 | linkFn(this.scope, clone => { 185 | compiledProjectableNodes.push(clone); 186 | this.element.append(clone); 187 | }); 188 | }); 189 | return compiledProjectableNodes; 190 | } 191 | createComponentAndSetup(projectableNodes, manuallyAttachView = false, propagateDigest = true) { 192 | const component = this.createComponent(projectableNodes); 193 | this.setupInputs(manuallyAttachView, propagateDigest, component); 194 | this.setupOutputs(component.componentRef); 195 | this.registerCleanup(component.componentRef); 196 | return component.componentRef; 197 | } 198 | createComponent(projectableNodes) { 199 | const providers = [{ 200 | provide: $SCOPE, 201 | useValue: this.componentScope 202 | }]; 203 | const childInjector = Injector.create({ 204 | providers: providers, 205 | parent: this.parentInjector, 206 | name: 'DowngradeComponentAdapter' 207 | }); 208 | const componentRef = this.componentFactory.create(childInjector, projectableNodes, this.element[0]); 209 | const viewChangeDetector = componentRef.injector.get(ChangeDetectorRef); 210 | const changeDetector = componentRef.changeDetectorRef; 211 | const testability = componentRef.injector.get(Testability, null); 212 | if (testability) { 213 | componentRef.injector.get(TestabilityRegistry).registerApplication(componentRef.location.nativeElement, testability); 214 | } 215 | hookupNgModel(this.ngModel, componentRef.instance); 216 | return { 217 | viewChangeDetector, 218 | componentRef, 219 | changeDetector 220 | }; 221 | } 222 | setupInputs(manuallyAttachView, propagateDigest = true, { 223 | componentRef, 224 | changeDetector, 225 | viewChangeDetector 226 | }) { 227 | const attrs = this.attrs; 228 | const inputs = this.componentFactory.inputs || []; 229 | for (const input of inputs) { 230 | const inputBinding = new PropertyBinding(input.propName, input.templateName); 231 | let expr = null; 232 | if (attrs.hasOwnProperty(inputBinding.attr)) { 233 | const observeFn = ((prop, isSignal) => { 234 | let prevValue = INITIAL_VALUE$1; 235 | return currValue => { 236 | if (!strictEquals(prevValue, currValue)) { 237 | if (prevValue === INITIAL_VALUE$1) { 238 | prevValue = currValue; 239 | } 240 | this.updateInput(componentRef, prop, prevValue, currValue, isSignal); 241 | prevValue = currValue; 242 | } 243 | }; 244 | })(inputBinding.prop, input.isSignal); 245 | attrs.$observe(inputBinding.attr, observeFn); 246 | let unwatch = this.componentScope.$watch(() => { 247 | unwatch(); 248 | unwatch = null; 249 | observeFn(attrs[inputBinding.attr]); 250 | }); 251 | } else if (attrs.hasOwnProperty(inputBinding.bindAttr)) { 252 | expr = attrs[inputBinding.bindAttr]; 253 | } else if (attrs.hasOwnProperty(inputBinding.bracketAttr)) { 254 | expr = attrs[inputBinding.bracketAttr]; 255 | } else if (attrs.hasOwnProperty(inputBinding.bindonAttr)) { 256 | expr = attrs[inputBinding.bindonAttr]; 257 | } else if (attrs.hasOwnProperty(inputBinding.bracketParenAttr)) { 258 | expr = attrs[inputBinding.bracketParenAttr]; 259 | } 260 | if (expr != null) { 261 | const watchFn = ((prop, isSignal) => (currValue, prevValue) => this.updateInput(componentRef, prop, prevValue, currValue, isSignal))(inputBinding.prop, input.isSignal); 262 | this.componentScope.$watch(expr, watchFn); 263 | } 264 | } 265 | const detectChanges = () => changeDetector.detectChanges(); 266 | const prototype = this.componentFactory.componentType.prototype; 267 | this.implementsOnChanges = !!(prototype && prototype.ngOnChanges); 268 | this.componentScope.$watch(() => this.inputChangeCount, this.wrapCallback(() => { 269 | if (this.implementsOnChanges) { 270 | const inputChanges = this.inputChanges; 271 | this.inputChanges = {}; 272 | componentRef.instance.ngOnChanges(inputChanges); 273 | } 274 | viewChangeDetector.markForCheck(); 275 | if (!propagateDigest) { 276 | detectChanges(); 277 | } 278 | })); 279 | if (propagateDigest) { 280 | this.componentScope.$watch(this.wrapCallback(detectChanges)); 281 | } 282 | if (manuallyAttachView || !propagateDigest) { 283 | let unwatch = this.componentScope.$watch(() => { 284 | unwatch(); 285 | unwatch = null; 286 | const appRef = this.parentInjector.get(ApplicationRef); 287 | appRef.attachView(componentRef.hostView); 288 | }); 289 | } 290 | } 291 | setupOutputs(componentRef) { 292 | const attrs = this.attrs; 293 | const outputs = this.componentFactory.outputs || []; 294 | for (const output of outputs) { 295 | const outputBindings = new PropertyBinding(output.propName, output.templateName); 296 | const bindonAttr = outputBindings.bindonAttr.substring(0, outputBindings.bindonAttr.length - 6); 297 | const bracketParenAttr = `[(${outputBindings.bracketParenAttr.substring(2, outputBindings.bracketParenAttr.length - 8)})]`; 298 | if (attrs.hasOwnProperty(bindonAttr)) { 299 | this.subscribeToOutput(componentRef, outputBindings, attrs[bindonAttr], true); 300 | } 301 | if (attrs.hasOwnProperty(bracketParenAttr)) { 302 | this.subscribeToOutput(componentRef, outputBindings, attrs[bracketParenAttr], true); 303 | } 304 | if (attrs.hasOwnProperty(outputBindings.onAttr)) { 305 | this.subscribeToOutput(componentRef, outputBindings, attrs[outputBindings.onAttr]); 306 | } 307 | if (attrs.hasOwnProperty(outputBindings.parenAttr)) { 308 | this.subscribeToOutput(componentRef, outputBindings, attrs[outputBindings.parenAttr]); 309 | } 310 | } 311 | } 312 | subscribeToOutput(componentRef, output, expr, isAssignment = false) { 313 | const getter = this.$parse(expr); 314 | const setter = getter.assign; 315 | if (isAssignment && !setter) { 316 | throw new Error(`Expression '${expr}' is not assignable!`); 317 | } 318 | const emitter = componentRef.instance[output.prop]; 319 | if (emitter) { 320 | const subscription = emitter.subscribe(isAssignment ? v => setter(this.scope, v) : v => getter(this.scope, { 321 | '$event': v 322 | })); 323 | componentRef.onDestroy(() => subscription.unsubscribe()); 324 | } else { 325 | throw new Error(`Missing emitter '${output.prop}' on component '${getTypeName(this.componentFactory.componentType)}'!`); 326 | } 327 | } 328 | registerCleanup(componentRef) { 329 | const testabilityRegistry = componentRef.injector.get(TestabilityRegistry); 330 | const destroyComponentRef = this.wrapCallback(() => componentRef.destroy()); 331 | let destroyed = false; 332 | this.element.on('$destroy', () => { 333 | if (!destroyed) this.componentScope.$destroy(); 334 | }); 335 | this.componentScope.$on('$destroy', () => { 336 | if (!destroyed) { 337 | destroyed = true; 338 | testabilityRegistry.unregisterApplication(componentRef.location.nativeElement); 339 | cleanData(this.element[0]); 340 | destroyComponentRef(); 341 | } 342 | }); 343 | } 344 | updateInput(componentRef, prop, prevValue, currValue, isSignal) { 345 | if (this.implementsOnChanges) { 346 | this.inputChanges[prop] = new SimpleChange(prevValue, currValue, prevValue === currValue); 347 | } 348 | this.inputChangeCount++; 349 | if (isSignal && !this.unsafelyOverwriteSignalInputs) { 350 | const node = componentRef.instance[prop][_SIGNAL]; 351 | node.applyValueToInputSignal(node, currValue); 352 | } else { 353 | componentRef.instance[prop] = currValue; 354 | } 355 | } 356 | groupProjectableNodes() { 357 | let ngContentSelectors = this.componentFactory.ngContentSelectors; 358 | return groupNodesBySelector(ngContentSelectors, this.element.contents()); 359 | } 360 | } 361 | function groupNodesBySelector(ngContentSelectors, nodes) { 362 | const projectableNodes = []; 363 | for (let i = 0, ii = ngContentSelectors.length; i < ii; ++i) { 364 | projectableNodes[i] = []; 365 | } 366 | for (let j = 0, jj = nodes.length; j < jj; ++j) { 367 | const node = nodes[j]; 368 | const ngContentIndex = findMatchingNgContentIndex(node, ngContentSelectors); 369 | if (ngContentIndex != null) { 370 | projectableNodes[ngContentIndex].push(node); 371 | } 372 | } 373 | return projectableNodes; 374 | } 375 | function findMatchingNgContentIndex(element, ngContentSelectors) { 376 | const ngContentIndices = []; 377 | let wildcardNgContentIndex = -1; 378 | for (let i = 0; i < ngContentSelectors.length; i++) { 379 | const selector = ngContentSelectors[i]; 380 | if (selector === '*') { 381 | wildcardNgContentIndex = i; 382 | } else { 383 | if (matchesSelector(element, selector)) { 384 | ngContentIndices.push(i); 385 | } 386 | } 387 | } 388 | ngContentIndices.sort(); 389 | if (wildcardNgContentIndex !== -1) { 390 | ngContentIndices.push(wildcardNgContentIndex); 391 | } 392 | return ngContentIndices.length ? ngContentIndices[0] : null; 393 | } 394 | function matchesSelector(el, selector) { 395 | const elProto = Element.prototype; 396 | return el.nodeType === Node.ELEMENT_NODE ? (elProto.matches ?? elProto.msMatchesSelector).call(el, selector) : false; 397 | } 398 | 399 | function isThenable(obj) { 400 | return !!obj && isFunction(obj.then); 401 | } 402 | class SyncPromise { 403 | value; 404 | resolved = false; 405 | callbacks = []; 406 | static all(valuesOrPromises) { 407 | const aggrPromise = new SyncPromise(); 408 | let resolvedCount = 0; 409 | const results = []; 410 | const resolve = (idx, value) => { 411 | results[idx] = value; 412 | if (++resolvedCount === valuesOrPromises.length) aggrPromise.resolve(results); 413 | }; 414 | valuesOrPromises.forEach((p, idx) => { 415 | if (isThenable(p)) { 416 | p.then(v => resolve(idx, v)); 417 | } else { 418 | resolve(idx, p); 419 | } 420 | }); 421 | return aggrPromise; 422 | } 423 | resolve(value) { 424 | if (this.resolved) return; 425 | this.value = value; 426 | this.resolved = true; 427 | this.callbacks.forEach(callback => callback(value)); 428 | this.callbacks.length = 0; 429 | } 430 | then(callback) { 431 | if (this.resolved) { 432 | callback(this.value); 433 | } else { 434 | this.callbacks.push(callback); 435 | } 436 | } 437 | } 438 | 439 | function downgradeComponent(info) { 440 | const directiveFactory = function ($compile, $injector, $parse) { 441 | const unsafelyOverwriteSignalInputs = info.unsafelyOverwriteSignalInputs ?? false; 442 | const isNgUpgradeLite = getUpgradeAppType($injector) === 3; 443 | const wrapCallback = !isNgUpgradeLite ? cb => cb : cb => () => NgZone.isInAngularZone() ? cb() : ngZone.run(cb); 444 | let ngZone; 445 | const hasMultipleDowngradedModules = isNgUpgradeLite && getDowngradedModuleCount($injector) > 1; 446 | return { 447 | restrict: 'E', 448 | terminal: true, 449 | require: [REQUIRE_INJECTOR, REQUIRE_NG_MODEL], 450 | controller: function () {}, 451 | link: (scope, element, attrs, required) => { 452 | const ngModel = required[1]; 453 | const parentInjector = required[0]; 454 | let moduleInjector = undefined; 455 | let ranAsync = false; 456 | if (!parentInjector || hasMultipleDowngradedModules) { 457 | const downgradedModule = info.downgradedModule || ''; 458 | const lazyModuleRefKey = `${LAZY_MODULE_REF}${downgradedModule}`; 459 | const attemptedAction = `instantiating component '${getTypeName(info.component)}'`; 460 | validateInjectionKey($injector, downgradedModule, lazyModuleRefKey, attemptedAction); 461 | const lazyModuleRef = $injector.get(lazyModuleRefKey); 462 | moduleInjector = lazyModuleRef.injector ?? lazyModuleRef.promise; 463 | } 464 | const finalParentInjector = parentInjector || moduleInjector; 465 | const finalModuleInjector = moduleInjector || parentInjector; 466 | const doDowngrade = (injector, moduleInjector) => { 467 | const componentFactoryResolver = moduleInjector.get(ComponentFactoryResolver); 468 | const componentFactory = componentFactoryResolver.resolveComponentFactory(info.component); 469 | if (!componentFactory) { 470 | throw new Error(`Expecting ComponentFactory for: ${getTypeName(info.component)}`); 471 | } 472 | const injectorPromise = new ParentInjectorPromise(element); 473 | const facade = new DowngradeComponentAdapter(element, attrs, scope, ngModel, injector, $compile, $parse, componentFactory, wrapCallback, unsafelyOverwriteSignalInputs); 474 | const projectableNodes = facade.compileContents(); 475 | const componentRef = facade.createComponentAndSetup(projectableNodes, isNgUpgradeLite, info.propagateDigest); 476 | injectorPromise.resolve(componentRef.injector); 477 | if (ranAsync) { 478 | scope.$evalAsync(() => {}); 479 | } 480 | }; 481 | const downgradeFn = !isNgUpgradeLite ? doDowngrade : (pInjector, mInjector) => { 482 | if (!ngZone) { 483 | ngZone = pInjector.get(NgZone); 484 | } 485 | wrapCallback(() => doDowngrade(pInjector, mInjector))(); 486 | }; 487 | SyncPromise.all([finalParentInjector, finalModuleInjector]).then(([pInjector, mInjector]) => downgradeFn(pInjector, mInjector)); 488 | ranAsync = true; 489 | } 490 | }; 491 | }; 492 | directiveFactory['$inject'] = [$COMPILE, $INJECTOR, $PARSE]; 493 | return directiveFactory; 494 | } 495 | class ParentInjectorPromise extends SyncPromise { 496 | element; 497 | injectorKey = controllerKey(INJECTOR_KEY); 498 | constructor(element) { 499 | super(); 500 | this.element = element; 501 | element.data(this.injectorKey, this); 502 | } 503 | resolve(injector) { 504 | this.element.data(this.injectorKey, injector); 505 | this.element = null; 506 | super.resolve(injector); 507 | } 508 | } 509 | 510 | function downgradeInjectable(token, downgradedModule = '') { 511 | const factory = function ($injector) { 512 | const injectorKey = `${INJECTOR_KEY}${downgradedModule}`; 513 | const injectableName = isFunction(token) ? getTypeName(token) : String(token); 514 | const attemptedAction = `instantiating injectable '${injectableName}'`; 515 | validateInjectionKey($injector, downgradedModule, injectorKey, attemptedAction); 516 | try { 517 | const injector = $injector.get(injectorKey); 518 | return injector.get(token); 519 | } catch (err) { 520 | throw new Error(`Error while ${attemptedAction}: ${err.message || err}`); 521 | } 522 | }; 523 | factory['$inject'] = [$INJECTOR]; 524 | return factory; 525 | } 526 | 527 | let policy; 528 | function getPolicy() { 529 | if (policy === undefined) { 530 | policy = null; 531 | const windowWithTrustedTypes = window; 532 | if (windowWithTrustedTypes.trustedTypes) { 533 | try { 534 | policy = windowWithTrustedTypes.trustedTypes.createPolicy('angular#unsafe-upgrade', { 535 | createHTML: s => s 536 | }); 537 | } catch {} 538 | } 539 | } 540 | return policy; 541 | } 542 | function trustedHTMLFromLegacyTemplate(html) { 543 | return getPolicy()?.createHTML(html) || html; 544 | } 545 | 546 | const REQUIRE_PREFIX_RE = /^(\^\^?)?(\?)?(\^\^?)?/; 547 | class UpgradeHelper { 548 | name; 549 | $injector; 550 | element; 551 | $element; 552 | directive; 553 | $compile; 554 | $controller; 555 | constructor(injector, name, elementRef, directive) { 556 | this.name = name; 557 | this.$injector = injector.get($INJECTOR); 558 | this.$compile = this.$injector.get($COMPILE); 559 | this.$controller = this.$injector.get($CONTROLLER); 560 | this.element = elementRef.nativeElement; 561 | this.$element = element(this.element); 562 | this.directive = directive ?? UpgradeHelper.getDirective(this.$injector, name); 563 | } 564 | static getDirective($injector, name) { 565 | const directives = $injector.get(name + 'Directive'); 566 | if (directives.length > 1) { 567 | throw new Error(`Only support single directive definition for: ${name}`); 568 | } 569 | const directive = directives[0]; 570 | if (directive.compile && !directive.link) notSupported(name, 'compile'); 571 | if (directive.replace) notSupported(name, 'replace'); 572 | if (directive.terminal) notSupported(name, 'terminal'); 573 | return directive; 574 | } 575 | static getTemplate($injector, directive, fetchRemoteTemplate = false, $element) { 576 | if (directive.template !== undefined) { 577 | return trustedHTMLFromLegacyTemplate(getOrCall(directive.template, $element)); 578 | } else if (directive.templateUrl) { 579 | const $templateCache = $injector.get($TEMPLATE_CACHE); 580 | const url = getOrCall(directive.templateUrl, $element); 581 | const template = $templateCache.get(url); 582 | if (template !== undefined) { 583 | return trustedHTMLFromLegacyTemplate(template); 584 | } else if (!fetchRemoteTemplate) { 585 | throw new Error('loading directive templates asynchronously is not supported'); 586 | } 587 | return new Promise((resolve, reject) => { 588 | const $httpBackend = $injector.get($HTTP_BACKEND); 589 | $httpBackend('GET', url, null, (status, response) => { 590 | if (status === 200) { 591 | resolve(trustedHTMLFromLegacyTemplate($templateCache.put(url, response))); 592 | } else { 593 | reject(`GET component template from '${url}' returned '${status}: ${response}'`); 594 | } 595 | }); 596 | }); 597 | } else { 598 | throw new Error(`Directive '${directive.name}' is not a component, it is missing template.`); 599 | } 600 | } 601 | buildController(controllerType, $scope) { 602 | const locals = { 603 | '$scope': $scope, 604 | '$element': this.$element 605 | }; 606 | const controller = this.$controller(controllerType, locals, null, this.directive.controllerAs); 607 | this.$element.data?.(controllerKey(this.directive.name), controller); 608 | return controller; 609 | } 610 | compileTemplate(template) { 611 | if (template === undefined) { 612 | template = UpgradeHelper.getTemplate(this.$injector, this.directive, false, this.$element); 613 | } 614 | return this.compileHtml(template); 615 | } 616 | onDestroy($scope, controllerInstance) { 617 | if (controllerInstance && isFunction(controllerInstance.$onDestroy)) { 618 | controllerInstance.$onDestroy(); 619 | } 620 | $scope.$destroy(); 621 | cleanData(this.element); 622 | } 623 | prepareTransclusion() { 624 | const transclude = this.directive.transclude; 625 | const contentChildNodes = this.extractChildNodes(); 626 | const attachChildrenFn = (scope, cloneAttachFn) => { 627 | scope = scope || { 628 | $destroy: () => undefined 629 | }; 630 | return cloneAttachFn($template, scope); 631 | }; 632 | let $template = contentChildNodes; 633 | if (transclude) { 634 | const slots = Object.create(null); 635 | if (typeof transclude === 'object') { 636 | $template = []; 637 | const slotMap = Object.create(null); 638 | const filledSlots = Object.create(null); 639 | Object.keys(transclude).forEach(slotName => { 640 | let selector = transclude[slotName]; 641 | const optional = selector.charAt(0) === '?'; 642 | selector = optional ? selector.substring(1) : selector; 643 | slotMap[selector] = slotName; 644 | slots[slotName] = null; 645 | filledSlots[slotName] = optional; 646 | }); 647 | contentChildNodes.forEach(node => { 648 | const slotName = slotMap[directiveNormalize(node.nodeName.toLowerCase())]; 649 | if (slotName) { 650 | filledSlots[slotName] = true; 651 | slots[slotName] = slots[slotName] || []; 652 | slots[slotName].push(node); 653 | } else { 654 | $template.push(node); 655 | } 656 | }); 657 | Object.keys(filledSlots).forEach(slotName => { 658 | if (!filledSlots[slotName]) { 659 | throw new Error(`Required transclusion slot '${slotName}' on directive: ${this.name}`); 660 | } 661 | }); 662 | Object.keys(slots).filter(slotName => slots[slotName]).forEach(slotName => { 663 | const nodes = slots[slotName]; 664 | slots[slotName] = (scope, cloneAttach) => { 665 | return cloneAttach(nodes, scope); 666 | }; 667 | }); 668 | } 669 | attachChildrenFn.$$slots = slots; 670 | $template.forEach(node => { 671 | if (node.nodeType === Node.TEXT_NODE && !node.nodeValue) { 672 | node.nodeValue = '\u200C'; 673 | } 674 | }); 675 | } 676 | return attachChildrenFn; 677 | } 678 | resolveAndBindRequiredControllers(controllerInstance) { 679 | const directiveRequire = this.getDirectiveRequire(); 680 | const requiredControllers = this.resolveRequire(directiveRequire); 681 | if (controllerInstance && this.directive.bindToController && isMap(directiveRequire)) { 682 | const requiredControllersMap = requiredControllers; 683 | Object.keys(requiredControllersMap).forEach(key => { 684 | controllerInstance[key] = requiredControllersMap[key]; 685 | }); 686 | } 687 | return requiredControllers; 688 | } 689 | compileHtml(html) { 690 | this.element.innerHTML = html; 691 | return this.$compile(this.element.childNodes); 692 | } 693 | extractChildNodes() { 694 | const childNodes = []; 695 | let childNode; 696 | while (childNode = this.element.firstChild) { 697 | childNode.remove(); 698 | childNodes.push(childNode); 699 | } 700 | return childNodes; 701 | } 702 | getDirectiveRequire() { 703 | const require = this.directive.require || this.directive.controller && this.directive.name; 704 | if (isMap(require)) { 705 | Object.entries(require).forEach(([key, value]) => { 706 | const match = value.match(REQUIRE_PREFIX_RE); 707 | const name = value.substring(match[0].length); 708 | if (!name) { 709 | require[key] = match[0] + key; 710 | } 711 | }); 712 | } 713 | return require; 714 | } 715 | resolveRequire(require) { 716 | if (!require) { 717 | return null; 718 | } else if (Array.isArray(require)) { 719 | return require.map(req => this.resolveRequire(req)); 720 | } else if (typeof require === 'object') { 721 | const value = {}; 722 | Object.keys(require).forEach(key => value[key] = this.resolveRequire(require[key])); 723 | return value; 724 | } else if (typeof require === 'string') { 725 | const match = require.match(REQUIRE_PREFIX_RE); 726 | const inheritType = match[1] || match[3]; 727 | const name = require.substring(match[0].length); 728 | const isOptional = !!match[2]; 729 | const searchParents = !!inheritType; 730 | const startOnParent = inheritType === '^^'; 731 | const ctrlKey = controllerKey(name); 732 | const elem = startOnParent ? this.$element.parent() : this.$element; 733 | const value = searchParents ? elem.inheritedData(ctrlKey) : elem.data(ctrlKey); 734 | if (!value && !isOptional) { 735 | throw new Error(`Unable to find required '${require}' in upgraded directive '${this.name}'.`); 736 | } 737 | return value; 738 | } else { 739 | throw new Error(`Unrecognized 'require' syntax on upgraded directive '${this.name}': ${require}`); 740 | } 741 | } 742 | } 743 | function getOrCall(property, ...args) { 744 | return isFunction(property) ? property(...args) : property; 745 | } 746 | function isMap(value) { 747 | return value && !Array.isArray(value) && typeof value === 'object'; 748 | } 749 | function notSupported(name, feature) { 750 | throw new Error(`Upgraded directive '${name}' contains unsupported feature: '${feature}'.`); 751 | } 752 | 753 | var upgrade_helper = /*#__PURE__*/Object.freeze({ 754 | __proto__: null, 755 | UpgradeHelper: UpgradeHelper 756 | }); 757 | 758 | let tempInjectorRef = null; 759 | function setTempInjectorRef(injector) { 760 | tempInjectorRef = injector; 761 | } 762 | function injectorFactory() { 763 | if (!tempInjectorRef) { 764 | throw new Error('Trying to get the AngularJS injector before it being set.'); 765 | } 766 | const injector = tempInjectorRef; 767 | tempInjectorRef = null; 768 | return injector; 769 | } 770 | function rootScopeFactory(i) { 771 | return i.get('$rootScope'); 772 | } 773 | function compileFactory(i) { 774 | return i.get('$compile'); 775 | } 776 | function parseFactory(i) { 777 | return i.get('$parse'); 778 | } 779 | const angular1Providers = [{ 780 | provide: '$injector', 781 | useFactory: injectorFactory, 782 | deps: [] 783 | }, { 784 | provide: '$rootScope', 785 | useFactory: rootScopeFactory, 786 | deps: ['$injector'] 787 | }, { 788 | provide: '$compile', 789 | useFactory: compileFactory, 790 | deps: ['$injector'] 791 | }, { 792 | provide: '$parse', 793 | useFactory: parseFactory, 794 | deps: ['$injector'] 795 | }]; 796 | 797 | class NgAdapterInjector { 798 | modInjector; 799 | constructor(modInjector) { 800 | this.modInjector = modInjector; 801 | } 802 | get(token, notFoundValue) { 803 | if (notFoundValue === _NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { 804 | return notFoundValue; 805 | } 806 | return this.modInjector.get(token, notFoundValue); 807 | } 808 | } 809 | 810 | let moduleUid = 0; 811 | function downgradeModule(moduleOrBootstrapFn) { 812 | const lazyModuleName = `${UPGRADE_MODULE_NAME}.lazy${++moduleUid}`; 813 | const lazyModuleRefKey = `${LAZY_MODULE_REF}${lazyModuleName}`; 814 | const lazyInjectorKey = `${INJECTOR_KEY}${lazyModuleName}`; 815 | let bootstrapFn; 816 | if (isNgModuleType(moduleOrBootstrapFn)) { 817 | bootstrapFn = extraProviders => platformBrowser(extraProviders).bootstrapModule(moduleOrBootstrapFn, { 818 | applicationProviders: [_internalProvideZoneChangeDetection({})] 819 | }); 820 | } else if (!isFunction(moduleOrBootstrapFn)) { 821 | bootstrapFn = extraProviders => platformBrowser(extraProviders).bootstrapModuleFactory(moduleOrBootstrapFn, { 822 | applicationProviders: [_internalProvideZoneChangeDetection({})] 823 | }); 824 | } else { 825 | bootstrapFn = moduleOrBootstrapFn; 826 | } 827 | let injector; 828 | module_(lazyModuleName, []).constant(UPGRADE_APP_TYPE_KEY, 3).factory(INJECTOR_KEY, [lazyInjectorKey, identity]).factory(lazyInjectorKey, () => { 829 | if (!injector) { 830 | throw new Error('Trying to get the Angular injector before bootstrapping the corresponding ' + 'Angular module.'); 831 | } 832 | return injector; 833 | }).factory(LAZY_MODULE_REF, [lazyModuleRefKey, identity]).factory(lazyModuleRefKey, [$INJECTOR, $injector => { 834 | setTempInjectorRef($injector); 835 | const result = { 836 | promise: bootstrapFn(angular1Providers).then(ref => { 837 | injector = result.injector = new NgAdapterInjector(ref.injector); 838 | injector.get($INJECTOR); 839 | injector.get(PlatformRef).onDestroy(() => destroyApp($injector)); 840 | return injector; 841 | }) 842 | }; 843 | return result; 844 | }]).config([$INJECTOR, $PROVIDE, ($injector, $provide) => { 845 | $provide.constant(DOWNGRADED_MODULE_COUNT_KEY, getDowngradedModuleCount($injector) + 1); 846 | }]); 847 | return lazyModuleName; 848 | } 849 | function identity(x) { 850 | return x; 851 | } 852 | 853 | const NOT_SUPPORTED = 'NOT_SUPPORTED'; 854 | const INITIAL_VALUE = { 855 | __UNINITIALIZED__: true 856 | }; 857 | class Bindings { 858 | twoWayBoundProperties = []; 859 | twoWayBoundLastValues = []; 860 | expressionBoundProperties = []; 861 | propertyToOutputMap = {}; 862 | } 863 | class UpgradeComponent { 864 | helper; 865 | $element; 866 | $componentScope; 867 | directive; 868 | bindings; 869 | controllerInstance; 870 | bindingDestination; 871 | pendingChanges = null; 872 | unregisterDoCheckWatcher; 873 | constructor(name, elementRef, injector) { 874 | this.helper = new UpgradeHelper(injector, name, elementRef); 875 | this.$element = this.helper.$element; 876 | this.directive = this.helper.directive; 877 | this.bindings = this.initializeBindings(this.directive, name); 878 | const $parentScope = injector.get($SCOPE); 879 | this.$componentScope = $parentScope.$new(!!this.directive.scope); 880 | this.initializeOutputs(); 881 | } 882 | ngOnInit() { 883 | const attachChildNodes = this.helper.prepareTransclusion(); 884 | const linkFn = this.helper.compileTemplate(); 885 | const controllerType = this.directive.controller; 886 | const bindToController = this.directive.bindToController; 887 | let controllerInstance = controllerType ? this.helper.buildController(controllerType, this.$componentScope) : undefined; 888 | let bindingDestination; 889 | if (!bindToController) { 890 | bindingDestination = this.$componentScope; 891 | } else if (controllerType && controllerInstance) { 892 | bindingDestination = controllerInstance; 893 | } else { 894 | throw new Error(`Upgraded directive '${this.directive.name}' specifies 'bindToController' but no controller.`); 895 | } 896 | this.controllerInstance = controllerInstance; 897 | this.bindingDestination = bindingDestination; 898 | this.bindOutputs(bindingDestination); 899 | const requiredControllers = this.helper.resolveAndBindRequiredControllers(controllerInstance); 900 | if (this.pendingChanges) { 901 | this.forwardChanges(this.pendingChanges, bindingDestination); 902 | this.pendingChanges = null; 903 | } 904 | if (this.controllerInstance && isFunction(this.controllerInstance.$onInit)) { 905 | this.controllerInstance.$onInit(); 906 | } 907 | if (controllerInstance && isFunction(controllerInstance.$doCheck)) { 908 | const callDoCheck = () => controllerInstance?.$doCheck?.(); 909 | this.unregisterDoCheckWatcher = this.$componentScope.$parent.$watch(callDoCheck); 910 | callDoCheck(); 911 | } 912 | const link = this.directive.link; 913 | const preLink = typeof link == 'object' && link.pre; 914 | const postLink = typeof link == 'object' ? link.post : link; 915 | const attrs = NOT_SUPPORTED; 916 | const transcludeFn = NOT_SUPPORTED; 917 | if (preLink) { 918 | preLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn); 919 | } 920 | linkFn(this.$componentScope, null, { 921 | parentBoundTranscludeFn: attachChildNodes 922 | }); 923 | if (postLink) { 924 | postLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn); 925 | } 926 | if (this.controllerInstance && isFunction(this.controllerInstance.$postLink)) { 927 | this.controllerInstance.$postLink(); 928 | } 929 | } 930 | ngOnChanges(changes) { 931 | if (!this.bindingDestination) { 932 | this.pendingChanges = changes; 933 | } else { 934 | this.forwardChanges(changes, this.bindingDestination); 935 | } 936 | } 937 | ngDoCheck() { 938 | const twoWayBoundProperties = this.bindings.twoWayBoundProperties; 939 | const twoWayBoundLastValues = this.bindings.twoWayBoundLastValues; 940 | const propertyToOutputMap = this.bindings.propertyToOutputMap; 941 | twoWayBoundProperties.forEach((propName, idx) => { 942 | const newValue = this.bindingDestination?.[propName]; 943 | const oldValue = twoWayBoundLastValues[idx]; 944 | if (!Object.is(newValue, oldValue)) { 945 | const outputName = propertyToOutputMap[propName]; 946 | const eventEmitter = this[outputName]; 947 | eventEmitter.emit(newValue); 948 | twoWayBoundLastValues[idx] = newValue; 949 | } 950 | }); 951 | } 952 | ngOnDestroy() { 953 | if (isFunction(this.unregisterDoCheckWatcher)) { 954 | this.unregisterDoCheckWatcher(); 955 | } 956 | this.helper.onDestroy(this.$componentScope, this.controllerInstance); 957 | } 958 | initializeBindings(directive, name) { 959 | const btcIsObject = typeof directive.bindToController === 'object'; 960 | if (btcIsObject && Object.keys(directive.scope).length) { 961 | throw new Error(`Binding definitions on scope and controller at the same time is not supported.`); 962 | } 963 | const context = btcIsObject ? directive.bindToController : directive.scope; 964 | const bindings = new Bindings(); 965 | if (typeof context == 'object') { 966 | Object.keys(context).forEach(propName => { 967 | const definition = context[propName]; 968 | const bindingType = definition.charAt(0); 969 | switch (bindingType) { 970 | case '@': 971 | case '<': 972 | break; 973 | case '=': 974 | bindings.twoWayBoundProperties.push(propName); 975 | bindings.twoWayBoundLastValues.push(INITIAL_VALUE); 976 | bindings.propertyToOutputMap[propName] = propName + 'Change'; 977 | break; 978 | case '&': 979 | bindings.expressionBoundProperties.push(propName); 980 | bindings.propertyToOutputMap[propName] = propName; 981 | break; 982 | default: 983 | let json = JSON.stringify(context); 984 | throw new Error(`Unexpected mapping '${bindingType}' in '${json}' in '${name}' directive.`); 985 | } 986 | }); 987 | } 988 | return bindings; 989 | } 990 | initializeOutputs() { 991 | this.bindings.twoWayBoundProperties.concat(this.bindings.expressionBoundProperties).forEach(propName => { 992 | const outputName = this.bindings.propertyToOutputMap[propName]; 993 | this[outputName] = new EventEmitter(); 994 | }); 995 | } 996 | bindOutputs(bindingDestination) { 997 | this.bindings.expressionBoundProperties.forEach(propName => { 998 | const outputName = this.bindings.propertyToOutputMap[propName]; 999 | const emitter = this[outputName]; 1000 | bindingDestination[propName] = value => emitter.emit(value); 1001 | }); 1002 | } 1003 | forwardChanges(changes, bindingDestination) { 1004 | Object.keys(changes).forEach(propName => bindingDestination[propName] = changes[propName].currentValue); 1005 | if (isFunction(bindingDestination.$onChanges)) { 1006 | bindingDestination.$onChanges(changes); 1007 | } 1008 | } 1009 | static ɵfac = i0.ɵɵngDeclareFactory({ 1010 | minVersion: "12.0.0", 1011 | version: "21.1.0-next.3+sha-9fa77af", 1012 | ngImport: i0, 1013 | type: UpgradeComponent, 1014 | deps: "invalid", 1015 | target: i0.ɵɵFactoryTarget.Directive 1016 | }); 1017 | static ɵdir = i0.ɵɵngDeclareDirective({ 1018 | minVersion: "14.0.0", 1019 | version: "21.1.0-next.3+sha-9fa77af", 1020 | type: UpgradeComponent, 1021 | isStandalone: true, 1022 | usesOnChanges: true, 1023 | ngImport: i0 1024 | }); 1025 | } 1026 | i0.ɵɵngDeclareClassMetadata({ 1027 | minVersion: "12.0.0", 1028 | version: "21.1.0-next.3+sha-9fa77af", 1029 | ngImport: i0, 1030 | type: UpgradeComponent, 1031 | decorators: [{ 1032 | type: Directive 1033 | }], 1034 | ctorParameters: () => [{ 1035 | type: undefined 1036 | }, { 1037 | type: i0.ElementRef 1038 | }, { 1039 | type: i0.Injector 1040 | }] 1041 | }); 1042 | 1043 | class UpgradeModule { 1044 | ngZone; 1045 | platformRef; 1046 | $injector; 1047 | injector; 1048 | applicationRef; 1049 | constructor(injector, ngZone, platformRef) { 1050 | this.ngZone = ngZone; 1051 | this.platformRef = platformRef; 1052 | this.injector = new NgAdapterInjector(injector); 1053 | this.applicationRef = this.injector.get(ApplicationRef); 1054 | } 1055 | bootstrap(element$1, modules = [], config) { 1056 | const INIT_MODULE_NAME = UPGRADE_MODULE_NAME + '.init'; 1057 | module_(INIT_MODULE_NAME, []).constant(UPGRADE_APP_TYPE_KEY, 2).value(INJECTOR_KEY, this.injector).factory(LAZY_MODULE_REF, [INJECTOR_KEY, injector => ({ 1058 | injector 1059 | })]).config([$PROVIDE, $INJECTOR, ($provide, $injector) => { 1060 | if ($injector.has($$TESTABILITY)) { 1061 | $provide.decorator($$TESTABILITY, [$DELEGATE, testabilityDelegate => { 1062 | const originalWhenStable = testabilityDelegate.whenStable; 1063 | const injector = this.injector; 1064 | const newWhenStable = function (callback) { 1065 | originalWhenStable.call(testabilityDelegate, function () { 1066 | const ng2Testability = injector.get(Testability); 1067 | if (ng2Testability.isStable()) { 1068 | callback(); 1069 | } else { 1070 | ng2Testability.whenStable(newWhenStable.bind(testabilityDelegate, callback)); 1071 | } 1072 | }); 1073 | }; 1074 | testabilityDelegate.whenStable = newWhenStable; 1075 | return testabilityDelegate; 1076 | }]); 1077 | } 1078 | if ($injector.has($INTERVAL)) { 1079 | $provide.decorator($INTERVAL, [$DELEGATE, intervalDelegate => { 1080 | let wrappedInterval = (fn, delay, count, invokeApply, ...pass) => { 1081 | return this.ngZone.runOutsideAngular(() => { 1082 | return intervalDelegate((...args) => { 1083 | setTimeout(() => { 1084 | this.ngZone.run(() => fn(...args)); 1085 | }); 1086 | }, delay, count, invokeApply, ...pass); 1087 | }); 1088 | }; 1089 | Object.keys(intervalDelegate).forEach(prop => wrappedInterval[prop] = intervalDelegate[prop]); 1090 | if (intervalDelegate.hasOwnProperty('flush')) { 1091 | wrappedInterval['flush'] = () => { 1092 | intervalDelegate['flush'](); 1093 | return wrappedInterval; 1094 | }; 1095 | } 1096 | return wrappedInterval; 1097 | }]); 1098 | } 1099 | }]).run([$INJECTOR, $injector => { 1100 | this.$injector = $injector; 1101 | const $rootScope = $injector.get('$rootScope'); 1102 | setTempInjectorRef($injector); 1103 | this.injector.get($INJECTOR); 1104 | element(element$1).data(controllerKey(INJECTOR_KEY), this.injector); 1105 | this.platformRef.onDestroy(() => destroyApp($injector)); 1106 | setTimeout(() => { 1107 | const synchronize = () => { 1108 | this.ngZone.run(() => { 1109 | if ($rootScope.$$phase) { 1110 | if (typeof ngDevMode === 'undefined' || ngDevMode) { 1111 | console.warn('A digest was triggered while one was already in progress. This may mean that something is triggering digests outside the Angular zone.'); 1112 | } 1113 | $rootScope.$evalAsync(); 1114 | } else { 1115 | $rootScope.$digest(); 1116 | } 1117 | }); 1118 | }; 1119 | const subscription = this.ngZone instanceof _NoopNgZone ? this.applicationRef.afterTick.subscribe(() => synchronize()) : this.ngZone.onMicrotaskEmpty.subscribe(() => synchronize()); 1120 | $rootScope.$on('$destroy', () => { 1121 | subscription.unsubscribe(); 1122 | }); 1123 | }, 0); 1124 | }]); 1125 | const upgradeModule = module_(UPGRADE_MODULE_NAME, [INIT_MODULE_NAME].concat(modules)); 1126 | const windowAngular = window['angular']; 1127 | windowAngular.resumeBootstrap = undefined; 1128 | const returnValue = this.ngZone.run(() => bootstrap(element$1, [upgradeModule.name], config)); 1129 | if (windowAngular.resumeBootstrap) { 1130 | const originalResumeBootstrap = windowAngular.resumeBootstrap; 1131 | const ngZone = this.ngZone; 1132 | windowAngular.resumeBootstrap = function () { 1133 | let args = arguments; 1134 | windowAngular.resumeBootstrap = originalResumeBootstrap; 1135 | return ngZone.run(() => windowAngular.resumeBootstrap.apply(this, args)); 1136 | }; 1137 | } 1138 | return returnValue; 1139 | } 1140 | static ɵfac = i0.ɵɵngDeclareFactory({ 1141 | minVersion: "12.0.0", 1142 | version: "21.1.0-next.3+sha-9fa77af", 1143 | ngImport: i0, 1144 | type: UpgradeModule, 1145 | deps: [{ 1146 | token: i0.Injector 1147 | }, { 1148 | token: i0.NgZone 1149 | }, { 1150 | token: i0.PlatformRef 1151 | }], 1152 | target: i0.ɵɵFactoryTarget.NgModule 1153 | }); 1154 | static ɵmod = i0.ɵɵngDeclareNgModule({ 1155 | minVersion: "14.0.0", 1156 | version: "21.1.0-next.3+sha-9fa77af", 1157 | ngImport: i0, 1158 | type: UpgradeModule 1159 | }); 1160 | static ɵinj = i0.ɵɵngDeclareInjector({ 1161 | minVersion: "12.0.0", 1162 | version: "21.1.0-next.3+sha-9fa77af", 1163 | ngImport: i0, 1164 | type: UpgradeModule, 1165 | providers: [angular1Providers, _internalProvideZoneChangeDetection({})] 1166 | }); 1167 | } 1168 | i0.ɵɵngDeclareClassMetadata({ 1169 | minVersion: "12.0.0", 1170 | version: "21.1.0-next.3+sha-9fa77af", 1171 | ngImport: i0, 1172 | type: UpgradeModule, 1173 | decorators: [{ 1174 | type: NgModule, 1175 | args: [{ 1176 | providers: [angular1Providers, _internalProvideZoneChangeDetection({})] 1177 | }] 1178 | }], 1179 | ctorParameters: () => [{ 1180 | type: i0.Injector 1181 | }, { 1182 | type: i0.NgZone 1183 | }, { 1184 | type: i0.PlatformRef 1185 | }] 1186 | }); 1187 | 1188 | export { UpgradeComponent, UpgradeModule, downgradeComponent, downgradeInjectable, downgradeModule, upgrade_helper as ɵupgradeHelper, util as ɵutil }; 1189 | //# sourceMappingURL=static.mjs.map 1190 | -------------------------------------------------------------------------------- /types/static.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v21.1.0-next.3+sha-9fa77af 3 | * (c) 2010-2025 Google LLC. https://angular.dev/ 4 | * License: MIT 5 | */ 6 | 7 | import * as i0 from '@angular/core'; 8 | import { Type, StaticProvider, NgModuleRef, NgModuleFactory, OnInit, OnChanges, DoCheck, OnDestroy, ElementRef, Injector, SimpleChanges, NgZone, PlatformRef } from '@angular/core'; 9 | export { VERSION } from './upgrade.js'; 10 | 11 | type Ng1Token = string; 12 | type Ng1Expression = string | Function; 13 | interface IAnnotatedFunction extends Function { 14 | $inject?: Function extends { 15 | $inject?: string[]; 16 | } ? Ng1Token[] : ReadonlyArray; 17 | } 18 | type IInjectable = (Ng1Token | Function)[] | IAnnotatedFunction; 19 | type SingleOrListOrMap = T | T[] | { 20 | [key: string]: T; 21 | }; 22 | interface IModule { 23 | name: string; 24 | requires: (string | IInjectable)[]; 25 | config(fn: IInjectable): IModule; 26 | directive(selector: string, factory: IInjectable): IModule; 27 | component(selector: string, component: IComponent): IModule; 28 | controller(name: string, type: IInjectable): IModule; 29 | factory(key: Ng1Token, factoryFn: IInjectable): IModule; 30 | value(key: Ng1Token, value: any): IModule; 31 | constant(token: Ng1Token, value: any): IModule; 32 | run(a: IInjectable): IModule; 33 | } 34 | interface ICompileService { 35 | (element: Element | NodeList | Node[] | string, transclude?: Function): ILinkFn; 36 | } 37 | interface ILinkFn { 38 | (scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ILinkFnOptions): IAugmentedJQuery; 39 | $$slots?: { 40 | [slotName: string]: ILinkFn; 41 | }; 42 | } 43 | interface ILinkFnOptions { 44 | parentBoundTranscludeFn?: Function; 45 | transcludeControllers?: { 46 | [key: string]: any; 47 | }; 48 | futureParentElement?: Node; 49 | } 50 | interface IRootScopeService { 51 | $new(isolate?: boolean): IScope; 52 | $id: string; 53 | $parent: IScope; 54 | $root: IScope; 55 | $watch(exp: Ng1Expression, fn?: (a1?: any, a2?: any) => void): Function; 56 | $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function; 57 | $destroy(): any; 58 | $apply(exp?: Ng1Expression): any; 59 | $digest(): any; 60 | $evalAsync(exp: Ng1Expression, locals?: any): void; 61 | $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function; 62 | $$childTail: IScope; 63 | $$childHead: IScope; 64 | $$nextSibling: IScope; 65 | $$phase: any; 66 | [key: string]: any; 67 | } 68 | interface IScope extends IRootScopeService { 69 | } 70 | interface IAngularBootstrapConfig { 71 | strictDi?: boolean; 72 | } 73 | interface IDirective { 74 | compile?: IDirectiveCompileFn; 75 | controller?: IController; 76 | controllerAs?: string; 77 | bindToController?: boolean | { 78 | [key: string]: string; 79 | }; 80 | link?: IDirectiveLinkFn | IDirectivePrePost; 81 | name?: string; 82 | priority?: number; 83 | replace?: boolean; 84 | require?: DirectiveRequireProperty; 85 | restrict?: string; 86 | scope?: boolean | { 87 | [key: string]: string; 88 | }; 89 | template?: string | Function; 90 | templateUrl?: string | Function; 91 | templateNamespace?: string; 92 | terminal?: boolean; 93 | transclude?: DirectiveTranscludeProperty; 94 | } 95 | type DirectiveRequireProperty = SingleOrListOrMap; 96 | type DirectiveTranscludeProperty = boolean | 'element' | { 97 | [key: string]: string; 98 | }; 99 | interface IDirectiveCompileFn { 100 | (templateElement: IAugmentedJQuery, templateAttributes: IAttributes, transclude: ITranscludeFunction): IDirectivePrePost; 101 | } 102 | interface IDirectivePrePost { 103 | pre?: IDirectiveLinkFn; 104 | post?: IDirectiveLinkFn; 105 | } 106 | interface IDirectiveLinkFn { 107 | (scope: IScope, instanceElement: IAugmentedJQuery, instanceAttributes: IAttributes, controller: any, transclude: ITranscludeFunction): void; 108 | } 109 | interface IComponent { 110 | bindings?: { 111 | [key: string]: string; 112 | }; 113 | controller?: string | IInjectable; 114 | controllerAs?: string; 115 | require?: DirectiveRequireProperty; 116 | template?: string | Function; 117 | templateUrl?: string | Function; 118 | transclude?: DirectiveTranscludeProperty; 119 | } 120 | interface IAttributes { 121 | $observe(attr: string, fn: (v: string) => void): void; 122 | [key: string]: any; 123 | } 124 | interface ITranscludeFunction { 125 | (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; 126 | (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; 127 | } 128 | interface ICloneAttachFunction { 129 | (clonedElement: IAugmentedJQuery, scope: IScope): any; 130 | } 131 | type IAugmentedJQuery = Node[] & { 132 | on?: (name: string, fn: () => void) => void; 133 | data?: (name: string, value?: any) => any; 134 | text?: () => string; 135 | inheritedData?: (name: string, value?: any) => any; 136 | children?: () => IAugmentedJQuery; 137 | contents?: () => IAugmentedJQuery; 138 | parent?: () => IAugmentedJQuery; 139 | empty?: () => void; 140 | append?: (content: IAugmentedJQuery | string) => IAugmentedJQuery; 141 | controller?: (name: string) => any; 142 | isolateScope?: () => IScope; 143 | injector?: () => IInjectorService; 144 | triggerHandler?: (eventTypeOrObject: string | Event, extraParameters?: any[]) => IAugmentedJQuery; 145 | remove?: () => void; 146 | removeData?: () => void; 147 | }; 148 | interface IProvider { 149 | $get: IInjectable; 150 | } 151 | interface IProvideService { 152 | provider(token: Ng1Token, provider: IProvider): IProvider; 153 | factory(token: Ng1Token, factory: IInjectable): IProvider; 154 | service(token: Ng1Token, type: IInjectable): IProvider; 155 | value(token: Ng1Token, value: any): IProvider; 156 | constant(token: Ng1Token, value: any): void; 157 | decorator(token: Ng1Token, factory: IInjectable): void; 158 | } 159 | interface IParseService { 160 | (expression: string): ICompiledExpression; 161 | } 162 | interface ICompiledExpression { 163 | (context: any, locals: any): any; 164 | assign?: (context: any, value: any) => any; 165 | } 166 | interface IHttpBackendService { 167 | (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; 168 | } 169 | interface ICacheObject { 170 | put(key: string, value?: T): T; 171 | get(key: string): any; 172 | } 173 | interface ITemplateCacheService extends ICacheObject { 174 | } 175 | type IController = string | IInjectable; 176 | interface IControllerService { 177 | (controllerConstructor: IController, locals?: any, later?: any, ident?: any): any; 178 | (controllerName: string, locals?: any): any; 179 | } 180 | interface IInjectorService { 181 | get(key: string): any; 182 | has(key: string): boolean; 183 | } 184 | interface IIntervalService { 185 | (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): Promise; 186 | cancel(promise: Promise): boolean; 187 | } 188 | interface ITestabilityService { 189 | findBindings(element: Element, expression: string, opt_exactMatch?: boolean): Element[]; 190 | findModels(element: Element, expression: string, opt_exactMatch?: boolean): Element[]; 191 | getLocation(): string; 192 | setLocation(url: string): void; 193 | whenStable(callback: Function): void; 194 | } 195 | interface INgModelController { 196 | $render(): void; 197 | $isEmpty(value: any): boolean; 198 | $setValidity(validationErrorKey: string, isValid: boolean): void; 199 | $setPristine(): void; 200 | $setDirty(): void; 201 | $setUntouched(): void; 202 | $setTouched(): void; 203 | $rollbackViewValue(): void; 204 | $validate(): void; 205 | $commitViewValue(): void; 206 | $setViewValue(value: any, trigger: string): void; 207 | $viewValue: any; 208 | $modelValue: any; 209 | $parsers: Function[]; 210 | $formatters: Function[]; 211 | $validators: { 212 | [key: string]: Function; 213 | }; 214 | $asyncValidators: { 215 | [key: string]: Function; 216 | }; 217 | $viewChangeListeners: Function[]; 218 | $error: Object; 219 | $pending: Object; 220 | $untouched: boolean; 221 | $touched: boolean; 222 | $pristine: boolean; 223 | $dirty: boolean; 224 | $valid: boolean; 225 | $invalid: boolean; 226 | $name: string; 227 | } 228 | declare let angular: { 229 | bootstrap: (e: Element, modules: (string | IInjectable)[], config?: IAngularBootstrapConfig) => IInjectorService; 230 | module: (prefix: string, dependencies?: string[]) => IModule; 231 | element: { 232 | (e: string | Element | Document | IAugmentedJQuery): IAugmentedJQuery; 233 | cleanData: (nodes: Node[] | NodeList) => void; 234 | }; 235 | injector: (modules: Array, strictDi?: boolean) => IInjectorService; 236 | version: { 237 | major: number; 238 | }; 239 | resumeBootstrap: () => void; 240 | getTestability: (e: Element) => ITestabilityService; 241 | }; 242 | /** 243 | * @deprecated Use `setAngularJSGlobal` instead. 244 | * 245 | * @publicApi 246 | */ 247 | declare function setAngularLib(ng: any): void; 248 | /** 249 | * @deprecated Use `getAngularJSGlobal` instead. 250 | * 251 | * @publicApi 252 | */ 253 | declare function getAngularLib(): any; 254 | /** 255 | * Resets the AngularJS global. 256 | * 257 | * Used when AngularJS is loaded lazily, and not available on `window`. 258 | * 259 | * @publicApi 260 | */ 261 | declare function setAngularJSGlobal(ng: any): void; 262 | /** 263 | * Returns the current AngularJS global. 264 | * 265 | * @publicApi 266 | */ 267 | declare function getAngularJSGlobal(): any; 268 | declare const bootstrap: typeof angular.bootstrap; 269 | declare const module_: typeof angular.module; 270 | declare const element: typeof angular.element; 271 | declare const injector: typeof angular.injector; 272 | declare const resumeBootstrap: typeof angular.resumeBootstrap; 273 | declare const getTestability: typeof angular.getTestability; 274 | 275 | type angular1_d_DirectiveRequireProperty = DirectiveRequireProperty; 276 | type angular1_d_DirectiveTranscludeProperty = DirectiveTranscludeProperty; 277 | type angular1_d_IAngularBootstrapConfig = IAngularBootstrapConfig; 278 | type angular1_d_IAnnotatedFunction = IAnnotatedFunction; 279 | type angular1_d_IAttributes = IAttributes; 280 | type angular1_d_IAugmentedJQuery = IAugmentedJQuery; 281 | type angular1_d_ICacheObject = ICacheObject; 282 | type angular1_d_ICloneAttachFunction = ICloneAttachFunction; 283 | type angular1_d_ICompileService = ICompileService; 284 | type angular1_d_ICompiledExpression = ICompiledExpression; 285 | type angular1_d_IComponent = IComponent; 286 | type angular1_d_IController = IController; 287 | type angular1_d_IControllerService = IControllerService; 288 | type angular1_d_IDirective = IDirective; 289 | type angular1_d_IDirectiveCompileFn = IDirectiveCompileFn; 290 | type angular1_d_IDirectiveLinkFn = IDirectiveLinkFn; 291 | type angular1_d_IDirectivePrePost = IDirectivePrePost; 292 | type angular1_d_IHttpBackendService = IHttpBackendService; 293 | type angular1_d_IInjectable = IInjectable; 294 | type angular1_d_IInjectorService = IInjectorService; 295 | type angular1_d_IIntervalService = IIntervalService; 296 | type angular1_d_ILinkFn = ILinkFn; 297 | type angular1_d_ILinkFnOptions = ILinkFnOptions; 298 | type angular1_d_IModule = IModule; 299 | type angular1_d_INgModelController = INgModelController; 300 | type angular1_d_IParseService = IParseService; 301 | type angular1_d_IProvideService = IProvideService; 302 | type angular1_d_IProvider = IProvider; 303 | type angular1_d_IRootScopeService = IRootScopeService; 304 | type angular1_d_IScope = IScope; 305 | type angular1_d_ITemplateCacheService = ITemplateCacheService; 306 | type angular1_d_ITestabilityService = ITestabilityService; 307 | type angular1_d_ITranscludeFunction = ITranscludeFunction; 308 | type angular1_d_Ng1Expression = Ng1Expression; 309 | type angular1_d_Ng1Token = Ng1Token; 310 | type angular1_d_SingleOrListOrMap = SingleOrListOrMap; 311 | declare const angular1_d_bootstrap: typeof bootstrap; 312 | declare const angular1_d_element: typeof element; 313 | declare const angular1_d_getAngularJSGlobal: typeof getAngularJSGlobal; 314 | declare const angular1_d_getAngularLib: typeof getAngularLib; 315 | declare const angular1_d_getTestability: typeof getTestability; 316 | declare const angular1_d_injector: typeof injector; 317 | declare const angular1_d_module_: typeof module_; 318 | declare const angular1_d_resumeBootstrap: typeof resumeBootstrap; 319 | declare const angular1_d_setAngularJSGlobal: typeof setAngularJSGlobal; 320 | declare const angular1_d_setAngularLib: typeof setAngularLib; 321 | declare namespace angular1_d { 322 | export { angular1_d_bootstrap as bootstrap, angular1_d_element as element, angular1_d_getAngularJSGlobal as getAngularJSGlobal, angular1_d_getAngularLib as getAngularLib, angular1_d_getTestability as getTestability, angular1_d_injector as injector, angular1_d_module_ as module_, angular1_d_resumeBootstrap as resumeBootstrap, angular1_d_setAngularJSGlobal as setAngularJSGlobal, angular1_d_setAngularLib as setAngularLib }; 323 | export type { angular1_d_DirectiveRequireProperty as DirectiveRequireProperty, angular1_d_DirectiveTranscludeProperty as DirectiveTranscludeProperty, angular1_d_IAngularBootstrapConfig as IAngularBootstrapConfig, angular1_d_IAnnotatedFunction as IAnnotatedFunction, angular1_d_IAttributes as IAttributes, angular1_d_IAugmentedJQuery as IAugmentedJQuery, angular1_d_ICacheObject as ICacheObject, angular1_d_ICloneAttachFunction as ICloneAttachFunction, angular1_d_ICompileService as ICompileService, angular1_d_ICompiledExpression as ICompiledExpression, angular1_d_IComponent as IComponent, angular1_d_IController as IController, angular1_d_IControllerService as IControllerService, angular1_d_IDirective as IDirective, angular1_d_IDirectiveCompileFn as IDirectiveCompileFn, angular1_d_IDirectiveLinkFn as IDirectiveLinkFn, angular1_d_IDirectivePrePost as IDirectivePrePost, angular1_d_IHttpBackendService as IHttpBackendService, angular1_d_IInjectable as IInjectable, angular1_d_IInjectorService as IInjectorService, angular1_d_IIntervalService as IIntervalService, angular1_d_ILinkFn as ILinkFn, angular1_d_ILinkFnOptions as ILinkFnOptions, angular1_d_IModule as IModule, angular1_d_INgModelController as INgModelController, angular1_d_IParseService as IParseService, angular1_d_IProvideService as IProvideService, angular1_d_IProvider as IProvider, angular1_d_IRootScopeService as IRootScopeService, angular1_d_IScope as IScope, angular1_d_ITemplateCacheService as ITemplateCacheService, angular1_d_ITestabilityService as ITestabilityService, angular1_d_ITranscludeFunction as ITranscludeFunction, angular1_d_Ng1Expression as Ng1Expression, angular1_d_Ng1Token as Ng1Token, angular1_d_SingleOrListOrMap as SingleOrListOrMap }; 324 | } 325 | 326 | /** 327 | * @description 328 | * 329 | * A helper function that allows an Angular component to be used from AngularJS. 330 | * 331 | * *Part of the [upgrade/static](api?query=upgrade%2Fstatic) 332 | * library for hybrid upgrade apps that support AOT compilation* 333 | * 334 | * This helper function returns a factory function to be used for registering 335 | * an AngularJS wrapper directive for "downgrading" an Angular component. 336 | * 337 | * @usageNotes 338 | * ### Examples 339 | * 340 | * Let's assume that you have an Angular component called `ng2Heroes` that needs 341 | * to be made available in AngularJS templates. 342 | * 343 | * {@example upgrade/static/ts/full/module.ts region="ng2-heroes"} 344 | * 345 | * We must create an AngularJS [directive](https://docs.angularjs.org/guide/directive) 346 | * that will make this Angular component available inside AngularJS templates. 347 | * The `downgradeComponent()` function returns a factory function that we 348 | * can use to define the AngularJS directive that wraps the "downgraded" component. 349 | * 350 | * {@example upgrade/static/ts/full/module.ts region="ng2-heroes-wrapper"} 351 | * 352 | * For more details and examples on downgrading Angular components to AngularJS components please 353 | * visit the [Upgrade guide](https://angular.io/guide/upgrade#using-angular-components-from-angularjs-code). 354 | * 355 | * @param info contains information about the Component that is being downgraded: 356 | * 357 | * - `component: Type`: The type of the Component that will be downgraded 358 | * - `downgradedModule?: string`: The name of the downgraded module (if any) that the component 359 | * "belongs to", as returned by a call to `downgradeModule()`. It is the module, whose 360 | * corresponding Angular module will be bootstrapped, when the component needs to be instantiated. 361 | *
362 | * (This option is only necessary when using `downgradeModule()` to downgrade more than one 363 | * Angular module.) 364 | * - `propagateDigest?: boolean`: Whether to perform {@link /api/core/ChangeDetectorRef#detectChanges detectChanges} on the 365 | * component on every {@link https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest $digest}. 366 | * If set to `false`, change detection will still be performed when any of the component's inputs changes. 367 | * (Default: true) 368 | * 369 | * @returns a factory function that can be used to register the component in an 370 | * AngularJS module. 371 | * 372 | * @publicApi 373 | */ 374 | declare function downgradeComponent(info: { 375 | component: Type; 376 | downgradedModule?: string; 377 | propagateDigest?: boolean; 378 | /** @deprecated since v4. This parameter is no longer used */ 379 | inputs?: string[]; 380 | /** @deprecated since v4. This parameter is no longer used */ 381 | outputs?: string[]; 382 | /** @deprecated since v4. This parameter is no longer used */ 383 | selectors?: string[]; 384 | }): any; 385 | 386 | /** 387 | * @description 388 | * 389 | * A helper function to allow an Angular service to be accessible from AngularJS. 390 | * 391 | * *Part of the [upgrade/static](api?query=upgrade%2Fstatic) 392 | * library for hybrid upgrade apps that support AOT compilation* 393 | * 394 | * This helper function returns a factory function that provides access to the Angular 395 | * service identified by the `token` parameter. 396 | * 397 | * @usageNotes 398 | * ### Examples 399 | * 400 | * First ensure that the service to be downgraded is provided in an `NgModule` 401 | * that will be part of the upgrade application. For example, let's assume we have 402 | * defined `HeroesService` 403 | * 404 | * {@example upgrade/static/ts/full/module.ts region="ng2-heroes-service"} 405 | * 406 | * and that we have included this in our upgrade app `NgModule` 407 | * 408 | * {@example upgrade/static/ts/full/module.ts region="ng2-module"} 409 | * 410 | * Now we can register the `downgradeInjectable` factory function for the service 411 | * on an AngularJS module. 412 | * 413 | * {@example upgrade/static/ts/full/module.ts region="downgrade-ng2-heroes-service"} 414 | * 415 | * Inside an AngularJS component's controller we can get hold of the 416 | * downgraded service via the name we gave when downgrading. 417 | * 418 | * {@example upgrade/static/ts/full/module.ts region="example-app"} 419 | * 420 | *
421 | * 422 | * When using `downgradeModule()`, downgraded injectables will not be available until the Angular 423 | * module that provides them is instantiated. In order to be safe, you need to ensure that the 424 | * downgraded injectables are not used anywhere _outside_ the part of the app where it is 425 | * guaranteed that their module has been instantiated. 426 | * 427 | * For example, it is _OK_ to use a downgraded service in an upgraded component that is only used 428 | * from a downgraded Angular component provided by the same Angular module as the injectable, but 429 | * it is _not OK_ to use it in an AngularJS component that may be used independently of Angular or 430 | * use it in a downgraded Angular component from a different module. 431 | * 432 | *
433 | * 434 | * @param token an `InjectionToken` that identifies a service provided from Angular. 435 | * @param downgradedModule the name of the downgraded module (if any) that the injectable 436 | * "belongs to", as returned by a call to `downgradeModule()`. It is the module, whose injector will 437 | * be used for instantiating the injectable.
438 | * (This option is only necessary when using `downgradeModule()` to downgrade more than one Angular 439 | * module.) 440 | * 441 | * @returns a [factory function](https://docs.angularjs.org/guide/di) that can be 442 | * used to register the service on an AngularJS module. 443 | * 444 | * @publicApi 445 | */ 446 | declare function downgradeInjectable(token: any, downgradedModule?: string): Function; 447 | 448 | /** 449 | * @description 450 | * 451 | * A helper function for creating an AngularJS module that can bootstrap an Angular module 452 | * "on-demand" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be 453 | * instantiated. 454 | * 455 | * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that 456 | * support AOT compilation.* 457 | * 458 | * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to 459 | * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for 460 | * specific routes and only instantiate the Angular modules if/when the user visits one of these 461 | * routes. 462 | * 463 | * The Angular module will be bootstrapped once (when requested for the first time) and the same 464 | * reference will be used from that point onwards. 465 | * 466 | * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function: 467 | * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module 468 | * using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}. 469 | * NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a 470 | * bootstrap function instead. 471 | * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module 472 | * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}. 473 | * - `Function`: If you pass a function, it is expected to return a promise resolving to an 474 | * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers} 475 | * that are expected to be available from the returned `NgModuleRef`'s `Injector`. 476 | * 477 | * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to 478 | * declare a dependency in your main AngularJS module. 479 | * 480 | * {@example upgrade/static/ts/lite/module.ts region="basic-how-to"} 481 | * 482 | * For more details on how to use `downgradeModule()` see 483 | * [Upgrading for Performance](https://angular.io/guide/upgrade). 484 | * 485 | * @usageNotes 486 | * 487 | * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to 488 | * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be 489 | * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded 490 | * component. 491 | * 492 | *
493 | * 494 | * You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.
495 | * Use one or the other. 496 | * 497 | *
498 | * 499 | * ### Differences with `UpgradeModule` 500 | * 501 | * Besides their different API, there are two important internal differences between 502 | * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications: 503 | * 504 | * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module 505 | * inside the {@link NgZone Angular zone}. 506 | * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a 507 | * [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are 508 | * detected in the Angular part of the application. 509 | * 510 | * What this means is that applications using `UpgradeModule` will run change detection more 511 | * frequently in order to ensure that both frameworks are properly notified about possible changes. 512 | * This will inevitably result in more change detection runs than necessary. 513 | * 514 | * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as 515 | * tightly, restricting the explicit change detection runs only to cases where it knows it is 516 | * necessary (e.g. when the inputs of a downgraded component change). This improves performance, 517 | * especially in change-detection-heavy applications, but leaves it up to the developer to manually 518 | * notify each framework as needed. 519 | * 520 | * For a more detailed discussion of the differences and their implications, see 521 | * [Upgrading for Performance](https://angular.io/guide/upgrade). 522 | * 523 | *
524 | * 525 | * You can manually trigger a change detection run in AngularJS using 526 | * [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or 527 | * [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest). 528 | * 529 | * You can manually trigger a change detection run in Angular using {@link NgZone#run 530 | * ngZone.run(...)}. 531 | * 532 | *
533 | * 534 | * ### Downgrading multiple modules 535 | * 536 | * It is possible to downgrade multiple modules and include them in an AngularJS application. In 537 | * that case, each downgraded module will be bootstrapped when an associated downgraded component or 538 | * injectable needs to be instantiated. 539 | * 540 | * Things to keep in mind, when downgrading multiple modules: 541 | * 542 | * - Each downgraded component/injectable needs to be explicitly associated with a downgraded 543 | * module. See `downgradeComponent()` and `downgradeInjectable()` for more details. 544 | * 545 | * - If you want some injectables to be shared among all downgraded modules, you can provide them as 546 | * `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or 547 | * `platformBrowserDynamic`). 548 | * 549 | * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or 550 | * {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the 551 | * downgraded modules, each one is considered a "root" module. As a consequence, a new instance 552 | * will be created for every injectable provided in `"root"` (via 553 | * {@link /api/core/Injectable#providedIn providedIn} 554 | * If this is not your intention, you can have a shared module (that will act as act as the "root" 555 | * module) and create all downgraded modules using that module's injector: 556 | * 557 | * {@example upgrade/static/ts/lite-multi-shared/module.ts region="shared-root-module"} 558 | * 559 | * @publicApi 560 | */ 561 | declare function downgradeModule(moduleOrBootstrapFn: Type | ((extraProviders: StaticProvider[]) => Promise>)): string; 562 | /** 563 | * @description 564 | * 565 | * A helper function for creating an AngularJS module that can bootstrap an Angular module 566 | * "on-demand" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be 567 | * instantiated. 568 | * 569 | * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that 570 | * support AOT compilation.* 571 | * 572 | * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to 573 | * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for 574 | * specific routes and only instantiate the Angular modules if/when the user visits one of these 575 | * routes. 576 | * 577 | * The Angular module will be bootstrapped once (when requested for the first time) and the same 578 | * reference will be used from that point onwards. 579 | * 580 | * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function: 581 | * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module 582 | * using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}. 583 | * NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a 584 | * bootstrap function instead. 585 | * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module 586 | * using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}. 587 | * - `Function`: If you pass a function, it is expected to return a promise resolving to an 588 | * `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers} 589 | * that are expected to be available from the returned `NgModuleRef`'s `Injector`. 590 | * 591 | * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to 592 | * declare a dependency in your main AngularJS module. 593 | * 594 | * {@example upgrade/static/ts/lite/module.ts region="basic-how-to"} 595 | * 596 | * For more details on how to use `downgradeModule()` see 597 | * [Upgrading for Performance](https://angular.io/guide/upgrade). 598 | * 599 | * @usageNotes 600 | * 601 | * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to 602 | * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be 603 | * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded 604 | * component. 605 | * 606 | *
607 | * 608 | * You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.
609 | * Use one or the other. 610 | * 611 | *
612 | * 613 | * ### Differences with `UpgradeModule` 614 | * 615 | * Besides their different API, there are two important internal differences between 616 | * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications: 617 | * 618 | * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module 619 | * inside the {@link NgZone Angular zone}. 620 | * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a 621 | * [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are 622 | * detected in the Angular part of the application. 623 | * 624 | * What this means is that applications using `UpgradeModule` will run change detection more 625 | * frequently in order to ensure that both frameworks are properly notified about possible changes. 626 | * This will inevitably result in more change detection runs than necessary. 627 | * 628 | * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as 629 | * tightly, restricting the explicit change detection runs only to cases where it knows it is 630 | * necessary (e.g. when the inputs of a downgraded component change). This improves performance, 631 | * especially in change-detection-heavy applications, but leaves it up to the developer to manually 632 | * notify each framework as needed. 633 | * 634 | * For a more detailed discussion of the differences and their implications, see 635 | * [Upgrading for Performance](https://angular.io/guide/upgrade). 636 | * 637 | *
638 | * 639 | * You can manually trigger a change detection run in AngularJS using 640 | * [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or 641 | * [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest). 642 | * 643 | * You can manually trigger a change detection run in Angular using {@link NgZone#run 644 | * ngZone.run(...)}. 645 | * 646 | *
647 | * 648 | * ### Downgrading multiple modules 649 | * 650 | * It is possible to downgrade multiple modules and include them in an AngularJS application. In 651 | * that case, each downgraded module will be bootstrapped when an associated downgraded component or 652 | * injectable needs to be instantiated. 653 | * 654 | * Things to keep in mind, when downgrading multiple modules: 655 | * 656 | * - Each downgraded component/injectable needs to be explicitly associated with a downgraded 657 | * module. See `downgradeComponent()` and `downgradeInjectable()` for more details. 658 | * 659 | * - If you want some injectables to be shared among all downgraded modules, you can provide them as 660 | * `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or 661 | * `platformBrowserDynamic`). 662 | * 663 | * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or 664 | * {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the 665 | * downgraded modules, each one is considered a "root" module. As a consequence, a new instance 666 | * will be created for every injectable provided in `"root"` (via 667 | * {@link /api/core/Injectable#providedIn providedIn} 668 | * If this is not your intention, you can have a shared module (that will act as act as the "root" 669 | * module) and create all downgraded modules using that module's injector: 670 | * 671 | * {@example upgrade/static/ts/lite-multi-shared/module.ts region="shared-root-module"} 672 | * 673 | * @publicApi 674 | * 675 | * @deprecated Passing `NgModuleFactory` as the `downgradeModule` function argument is deprecated, 676 | * please pass an NgModule class reference instead. 677 | */ 678 | declare function downgradeModule(moduleOrBootstrapFn: NgModuleFactory): string; 679 | 680 | /** 681 | * @description 682 | * 683 | * A helper class that allows an AngularJS component to be used from Angular. 684 | * 685 | * *Part of the [upgrade/static](api?query=upgrade%2Fstatic) 686 | * library for hybrid upgrade apps that support AOT compilation.* 687 | * 688 | * This helper class should be used as a base class for creating Angular directives 689 | * that wrap AngularJS components that need to be "upgraded". 690 | * 691 | * @usageNotes 692 | * ### Examples 693 | * 694 | * Let's assume that you have an AngularJS component called `ng1Hero` that needs 695 | * to be made available in Angular templates. 696 | * 697 | * {@example upgrade/static/ts/full/module.ts region="ng1-hero"} 698 | * 699 | * We must create a `Directive` that will make this AngularJS component 700 | * available inside Angular templates. 701 | * 702 | * {@example upgrade/static/ts/full/module.ts region="ng1-hero-wrapper"} 703 | * 704 | * In this example you can see that we must derive from the `UpgradeComponent` 705 | * base class but also provide an {@link Directive `@Directive`} decorator. This is 706 | * because the AOT compiler requires that this information is statically available at 707 | * compile time. 708 | * 709 | * Note that we must do the following: 710 | * * specify the directive's selector (`ng1-hero`) 711 | * * specify all inputs and outputs that the AngularJS component expects 712 | * * derive from `UpgradeComponent` 713 | * * call the base class from the constructor, passing 714 | * * the AngularJS name of the component (`ng1Hero`) 715 | * * the `ElementRef` and `Injector` for the component wrapper 716 | * 717 | * @publicApi 718 | * @extensible 719 | */ 720 | declare class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy { 721 | private helper; 722 | private $element; 723 | private $componentScope; 724 | private directive; 725 | private bindings; 726 | private controllerInstance?; 727 | private bindingDestination?; 728 | private pendingChanges; 729 | private unregisterDoCheckWatcher?; 730 | /** 731 | * Create a new `UpgradeComponent` instance. You should not normally need to do this. 732 | * Instead you should derive a new class from this one and call the super constructor 733 | * from the base class. 734 | * 735 | * {@example upgrade/static/ts/full/module.ts region="ng1-hero-wrapper" } 736 | * 737 | * * The `name` parameter should be the name of the AngularJS directive. 738 | * * The `elementRef` and `injector` parameters should be acquired from Angular by dependency 739 | * injection into the base class constructor. 740 | */ 741 | constructor(name: string, elementRef: ElementRef, injector: Injector); 742 | /** @docs-private */ 743 | ngOnInit(): void; 744 | /** @docs-private */ 745 | ngOnChanges(changes: SimpleChanges): void; 746 | /** @docs-private */ 747 | ngDoCheck(): void; 748 | /** @docs-private */ 749 | ngOnDestroy(): void; 750 | private initializeBindings; 751 | private initializeOutputs; 752 | private bindOutputs; 753 | private forwardChanges; 754 | static ɵfac: i0.ɵɵFactoryDeclaration; 755 | static ɵdir: i0.ɵɵDirectiveDeclaration; 756 | } 757 | 758 | /** 759 | * @description 760 | * 761 | * An `NgModule`, which you import to provide AngularJS core services, 762 | * and has an instance method used to bootstrap the hybrid upgrade application. 763 | * 764 | * *Part of the [upgrade/static](api?query=upgrade/static) 765 | * library for hybrid upgrade apps that support AOT compilation* 766 | * 767 | * The `upgrade/static` package contains helpers that allow AngularJS and Angular components 768 | * to be used together inside a hybrid upgrade application, which supports AOT compilation. 769 | * 770 | * Specifically, the classes and functions in the `upgrade/static` module allow the following: 771 | * 772 | * 1. Creation of an Angular directive that wraps and exposes an AngularJS component so 773 | * that it can be used in an Angular template. See `UpgradeComponent`. 774 | * 2. Creation of an AngularJS directive that wraps and exposes an Angular component so 775 | * that it can be used in an AngularJS template. See `downgradeComponent`. 776 | * 3. Creation of an Angular root injector provider that wraps and exposes an AngularJS 777 | * service so that it can be injected into an Angular context. See 778 | * {@link UpgradeModule#upgrading-an-angular-1-service Upgrading an AngularJS service} below. 779 | * 4. Creation of an AngularJS service that wraps and exposes an Angular injectable 780 | * so that it can be injected into an AngularJS context. See `downgradeInjectable`. 781 | * 5. Bootstrapping of a hybrid Angular application which contains both of the frameworks 782 | * coexisting in a single application. 783 | * 784 | * @usageNotes 785 | * 786 | * ```ts 787 | * import {UpgradeModule} from '@angular/upgrade/static'; 788 | * ``` 789 | * 790 | * See also the {@link UpgradeModule#examples examples} below. 791 | * 792 | * ### Mental Model 793 | * 794 | * When reasoning about how a hybrid application works it is useful to have a mental model which 795 | * describes what is happening and explains what is happening at the lowest level. 796 | * 797 | * 1. There are two independent frameworks running in a single application, each framework treats 798 | * the other as a black box. 799 | * 2. Each DOM element on the page is owned exactly by one framework. Whichever framework 800 | * instantiated the element is the owner. Each framework only updates/interacts with its own 801 | * DOM elements and ignores others. 802 | * 3. AngularJS directives always execute inside the AngularJS framework codebase regardless of 803 | * where they are instantiated. 804 | * 4. Angular components always execute inside the Angular framework codebase regardless of 805 | * where they are instantiated. 806 | * 5. An AngularJS component can be "upgraded"" to an Angular component. This is achieved by 807 | * defining an Angular directive, which bootstraps the AngularJS component at its location 808 | * in the DOM. See `UpgradeComponent`. 809 | * 6. An Angular component can be "downgraded" to an AngularJS component. This is achieved by 810 | * defining an AngularJS directive, which bootstraps the Angular component at its location 811 | * in the DOM. See `downgradeComponent`. 812 | * 7. Whenever an "upgraded"/"downgraded" component is instantiated the host element is owned by 813 | * the framework doing the instantiation. The other framework then instantiates and owns the 814 | * view for that component. 815 | * 1. This implies that the component bindings will always follow the semantics of the 816 | * instantiation framework. 817 | * 2. The DOM attributes are parsed by the framework that owns the current template. So 818 | * attributes in AngularJS templates must use kebab-case, while AngularJS templates must use 819 | * camelCase. 820 | * 3. However the template binding syntax will always use the Angular style, e.g. square 821 | * brackets (`[...]`) for property binding. 822 | * 8. Angular is bootstrapped first; AngularJS is bootstrapped second. AngularJS always owns the 823 | * root component of the application. 824 | * 9. The new application is running in an Angular zone, and therefore it no longer needs calls to 825 | * `$apply()`. 826 | * 827 | * ### The `UpgradeModule` class 828 | * 829 | * This class is an `NgModule`, which you import to provide AngularJS core services, 830 | * and has an instance method used to bootstrap the hybrid upgrade application. 831 | * 832 | * * Core AngularJS services
833 | * Importing this `NgModule` will add providers for the core 834 | * [AngularJS services](https://docs.angularjs.org/api/ng/service) to the root injector. 835 | * 836 | * * Bootstrap
837 | * The runtime instance of this class contains a {@link UpgradeModule#bootstrap `bootstrap()`} 838 | * method, which you use to bootstrap the top level AngularJS module onto an element in the 839 | * DOM for the hybrid upgrade app. 840 | * 841 | * It also contains properties to access the {@link UpgradeModule#injector root injector}, the 842 | * bootstrap `NgZone` and the 843 | * [AngularJS $injector](https://docs.angularjs.org/api/auto/service/$injector). 844 | * 845 | * ### Examples 846 | * 847 | * Import the `UpgradeModule` into your top level Angular {@link NgModule NgModule}. 848 | * 849 | * {@example upgrade/static/ts/full/module.ts region='ng2-module'} 850 | * 851 | * Then inject `UpgradeModule` into your Angular `NgModule` and use it to bootstrap the top level 852 | * [AngularJS module](https://docs.angularjs.org/api/ng/type/angular.Module) in the 853 | * `ngDoBootstrap()` method. 854 | * 855 | * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng1'} 856 | * 857 | * Finally, kick off the whole process, by bootstrapping your top level Angular `NgModule`. 858 | * 859 | * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng2'} 860 | * 861 | * ### Upgrading an AngularJS service 862 | * 863 | * There is no specific API for upgrading an AngularJS service. Instead you should just follow the 864 | * following recipe: 865 | * 866 | * Let's say you have an AngularJS service: 867 | * 868 | * {@example upgrade/static/ts/full/module.ts region="ng1-text-formatter-service"} 869 | * 870 | * Then you should define an Angular provider to be included in your `NgModule` `providers` 871 | * property. 872 | * 873 | * {@example upgrade/static/ts/full/module.ts region="upgrade-ng1-service"} 874 | * 875 | * Then you can use the "upgraded" AngularJS service by injecting it into an Angular component 876 | * or service. 877 | * 878 | * {@example upgrade/static/ts/full/module.ts region="use-ng1-upgraded-service"} 879 | * 880 | * @publicApi 881 | */ 882 | declare class UpgradeModule { 883 | /** The bootstrap zone for the upgrade application */ 884 | ngZone: NgZone; 885 | /** 886 | * The owning `NgModuleRef`s `PlatformRef` instance. 887 | * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular 888 | * `PlatformRef`. 889 | */ 890 | private platformRef; 891 | /** 892 | * The AngularJS `$injector` for the upgrade application. 893 | */ 894 | $injector: any; 895 | /** The Angular Injector **/ 896 | injector: Injector; 897 | private readonly applicationRef; 898 | constructor( 899 | /** The root `Injector` for the upgrade application. */ 900 | injector: Injector, 901 | /** The bootstrap zone for the upgrade application */ 902 | ngZone: NgZone, 903 | /** 904 | * The owning `NgModuleRef`s `PlatformRef` instance. 905 | * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular 906 | * `PlatformRef`. 907 | */ 908 | platformRef: PlatformRef); 909 | /** 910 | * Bootstrap an AngularJS application from this NgModule 911 | * @param element the element on which to bootstrap the AngularJS application 912 | * @param [modules] the AngularJS modules to bootstrap for this application 913 | * @param [config] optional extra AngularJS bootstrap configuration 914 | * @return The value returned by 915 | * [angular.bootstrap()](https://docs.angularjs.org/api/ng/function/angular.bootstrap). 916 | */ 917 | bootstrap(element: Element, modules?: string[], config?: any): any; 918 | static ɵfac: i0.ɵɵFactoryDeclaration; 919 | static ɵmod: i0.ɵɵNgModuleDeclaration; 920 | static ɵinj: i0.ɵɵInjectorDeclaration; 921 | } 922 | 923 | declare const $COMPILE = "$compile"; 924 | declare const $CONTROLLER = "$controller"; 925 | declare const $DELEGATE = "$delegate"; 926 | declare const $EXCEPTION_HANDLER = "$exceptionHandler"; 927 | declare const $HTTP_BACKEND = "$httpBackend"; 928 | declare const $INJECTOR = "$injector"; 929 | declare const $INTERVAL = "$interval"; 930 | declare const $PARSE = "$parse"; 931 | declare const $PROVIDE = "$provide"; 932 | declare const $ROOT_ELEMENT = "$rootElement"; 933 | declare const $ROOT_SCOPE = "$rootScope"; 934 | declare const $SCOPE = "$scope"; 935 | declare const $TEMPLATE_CACHE = "$templateCache"; 936 | declare const $TEMPLATE_REQUEST = "$templateRequest"; 937 | declare const $$TESTABILITY = "$$testability"; 938 | declare const COMPILER_KEY = "$$angularCompiler"; 939 | declare const DOWNGRADED_MODULE_COUNT_KEY = "$$angularDowngradedModuleCount"; 940 | declare const GROUP_PROJECTABLE_NODES_KEY = "$$angularGroupProjectableNodes"; 941 | declare const INJECTOR_KEY = "$$angularInjector"; 942 | declare const LAZY_MODULE_REF = "$$angularLazyModuleRef"; 943 | declare const NG_ZONE_KEY = "$$angularNgZone"; 944 | declare const UPGRADE_APP_TYPE_KEY = "$$angularUpgradeAppType"; 945 | declare const REQUIRE_INJECTOR: string; 946 | declare const REQUIRE_NG_MODEL = "?ngModel"; 947 | declare const UPGRADE_MODULE_NAME = "$$UpgradeModule"; 948 | 949 | declare const constants_d_$$TESTABILITY: typeof $$TESTABILITY; 950 | declare const constants_d_$COMPILE: typeof $COMPILE; 951 | declare const constants_d_$CONTROLLER: typeof $CONTROLLER; 952 | declare const constants_d_$DELEGATE: typeof $DELEGATE; 953 | declare const constants_d_$EXCEPTION_HANDLER: typeof $EXCEPTION_HANDLER; 954 | declare const constants_d_$HTTP_BACKEND: typeof $HTTP_BACKEND; 955 | declare const constants_d_$INJECTOR: typeof $INJECTOR; 956 | declare const constants_d_$INTERVAL: typeof $INTERVAL; 957 | declare const constants_d_$PARSE: typeof $PARSE; 958 | declare const constants_d_$PROVIDE: typeof $PROVIDE; 959 | declare const constants_d_$ROOT_ELEMENT: typeof $ROOT_ELEMENT; 960 | declare const constants_d_$ROOT_SCOPE: typeof $ROOT_SCOPE; 961 | declare const constants_d_$SCOPE: typeof $SCOPE; 962 | declare const constants_d_$TEMPLATE_CACHE: typeof $TEMPLATE_CACHE; 963 | declare const constants_d_$TEMPLATE_REQUEST: typeof $TEMPLATE_REQUEST; 964 | declare const constants_d_COMPILER_KEY: typeof COMPILER_KEY; 965 | declare const constants_d_DOWNGRADED_MODULE_COUNT_KEY: typeof DOWNGRADED_MODULE_COUNT_KEY; 966 | declare const constants_d_GROUP_PROJECTABLE_NODES_KEY: typeof GROUP_PROJECTABLE_NODES_KEY; 967 | declare const constants_d_INJECTOR_KEY: typeof INJECTOR_KEY; 968 | declare const constants_d_LAZY_MODULE_REF: typeof LAZY_MODULE_REF; 969 | declare const constants_d_NG_ZONE_KEY: typeof NG_ZONE_KEY; 970 | declare const constants_d_REQUIRE_INJECTOR: typeof REQUIRE_INJECTOR; 971 | declare const constants_d_REQUIRE_NG_MODEL: typeof REQUIRE_NG_MODEL; 972 | declare const constants_d_UPGRADE_APP_TYPE_KEY: typeof UPGRADE_APP_TYPE_KEY; 973 | declare const constants_d_UPGRADE_MODULE_NAME: typeof UPGRADE_MODULE_NAME; 974 | declare namespace constants_d { 975 | export { 976 | constants_d_$$TESTABILITY as $$TESTABILITY, 977 | constants_d_$COMPILE as $COMPILE, 978 | constants_d_$CONTROLLER as $CONTROLLER, 979 | constants_d_$DELEGATE as $DELEGATE, 980 | constants_d_$EXCEPTION_HANDLER as $EXCEPTION_HANDLER, 981 | constants_d_$HTTP_BACKEND as $HTTP_BACKEND, 982 | constants_d_$INJECTOR as $INJECTOR, 983 | constants_d_$INTERVAL as $INTERVAL, 984 | constants_d_$PARSE as $PARSE, 985 | constants_d_$PROVIDE as $PROVIDE, 986 | constants_d_$ROOT_ELEMENT as $ROOT_ELEMENT, 987 | constants_d_$ROOT_SCOPE as $ROOT_SCOPE, 988 | constants_d_$SCOPE as $SCOPE, 989 | constants_d_$TEMPLATE_CACHE as $TEMPLATE_CACHE, 990 | constants_d_$TEMPLATE_REQUEST as $TEMPLATE_REQUEST, 991 | constants_d_COMPILER_KEY as COMPILER_KEY, 992 | constants_d_DOWNGRADED_MODULE_COUNT_KEY as DOWNGRADED_MODULE_COUNT_KEY, 993 | constants_d_GROUP_PROJECTABLE_NODES_KEY as GROUP_PROJECTABLE_NODES_KEY, 994 | constants_d_INJECTOR_KEY as INJECTOR_KEY, 995 | constants_d_LAZY_MODULE_REF as LAZY_MODULE_REF, 996 | constants_d_NG_ZONE_KEY as NG_ZONE_KEY, 997 | constants_d_REQUIRE_INJECTOR as REQUIRE_INJECTOR, 998 | constants_d_REQUIRE_NG_MODEL as REQUIRE_NG_MODEL, 999 | constants_d_UPGRADE_APP_TYPE_KEY as UPGRADE_APP_TYPE_KEY, 1000 | constants_d_UPGRADE_MODULE_NAME as UPGRADE_MODULE_NAME, 1001 | }; 1002 | } 1003 | 1004 | /** 1005 | * @fileoverview 1006 | * While Angular only uses Trusted Types internally for the time being, 1007 | * references to Trusted Types could leak into our public API, which would force 1008 | * anyone compiling against @angular/upgrade to provide the @types/trusted-types 1009 | * package in their compilation unit. 1010 | * 1011 | * Until https://github.com/microsoft/TypeScript/issues/30024 is resolved, we 1012 | * will keep Angular's public API surface free of references to Trusted Types. 1013 | * For internal and semi-private APIs that need to reference Trusted Types, the 1014 | * minimal type definitions for the Trusted Types API provided by this module 1015 | * should be used instead. They are marked as "declare" to prevent them from 1016 | * being renamed by compiler optimization. 1017 | * 1018 | * Adapted from 1019 | * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/trusted-types/index.d.ts 1020 | * but restricted to the API surface used within Angular, mimicking the approach 1021 | * in packages/core/src/util/security/trusted_type_defs.ts. 1022 | */ 1023 | type TrustedHTML = string & { 1024 | __brand__: 'TrustedHTML'; 1025 | }; 1026 | 1027 | interface IBindingDestination { 1028 | [key: string]: any; 1029 | $onChanges?: (changes: SimpleChanges) => void; 1030 | } 1031 | interface IControllerInstance extends IBindingDestination { 1032 | $doCheck?: () => void; 1033 | $onDestroy?: () => void; 1034 | $onInit?: () => void; 1035 | $postLink?: () => void; 1036 | } 1037 | declare class UpgradeHelper { 1038 | private name; 1039 | readonly $injector: IInjectorService; 1040 | readonly element: Element; 1041 | readonly $element: IAugmentedJQuery; 1042 | readonly directive: IDirective; 1043 | private readonly $compile; 1044 | private readonly $controller; 1045 | constructor(injector: Injector, name: string, elementRef: ElementRef, directive?: IDirective); 1046 | static getDirective($injector: IInjectorService, name: string): IDirective; 1047 | static getTemplate($injector: IInjectorService, directive: IDirective, fetchRemoteTemplate?: boolean, $element?: IAugmentedJQuery): string | TrustedHTML | Promise; 1048 | buildController(controllerType: IController, $scope: IScope): any; 1049 | compileTemplate(template?: string | TrustedHTML): ILinkFn; 1050 | onDestroy($scope: IScope, controllerInstance?: any): void; 1051 | prepareTransclusion(): ILinkFn | undefined; 1052 | resolveAndBindRequiredControllers(controllerInstance: IControllerInstance | null): SingleOrListOrMap | null; 1053 | private compileHtml; 1054 | private extractChildNodes; 1055 | private getDirectiveRequire; 1056 | private resolveRequire; 1057 | } 1058 | 1059 | type upgrade_helper_d_IBindingDestination = IBindingDestination; 1060 | type upgrade_helper_d_IControllerInstance = IControllerInstance; 1061 | type upgrade_helper_d_UpgradeHelper = UpgradeHelper; 1062 | declare const upgrade_helper_d_UpgradeHelper: typeof UpgradeHelper; 1063 | declare namespace upgrade_helper_d { 1064 | export { upgrade_helper_d_UpgradeHelper as UpgradeHelper }; 1065 | export type { upgrade_helper_d_IBindingDestination as IBindingDestination, upgrade_helper_d_IControllerInstance as IControllerInstance }; 1066 | } 1067 | 1068 | declare function onError(e: any): void; 1069 | /** 1070 | * Clean the jqLite/jQuery data on the element and all its descendants. 1071 | * Equivalent to how jqLite/jQuery invoke `cleanData()` on an Element when removed: 1072 | * https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/jqLite.js#L349-L355 1073 | * https://github.com/jquery/jquery/blob/6984d1747623dbc5e87fd6c261a5b6b1628c107c/src/manipulation.js#L182 1074 | * 1075 | * NOTE: 1076 | * `cleanData()` will also invoke the AngularJS `$destroy` DOM event on the element: 1077 | * https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/Angular.js#L1932-L1945 1078 | * 1079 | * @param node The DOM node whose data needs to be cleaned. 1080 | */ 1081 | declare function cleanData(node: Node): void; 1082 | declare function controllerKey(name: string): string; 1083 | /** 1084 | * Destroy an AngularJS app given the app `$injector`. 1085 | * 1086 | * NOTE: Destroying an app is not officially supported by AngularJS, but try to do our best by 1087 | * destroying `$rootScope` and clean the jqLite/jQuery data on `$rootElement` and all 1088 | * descendants. 1089 | * 1090 | * @param $injector The `$injector` of the AngularJS app to destroy. 1091 | */ 1092 | declare function destroyApp($injector: IInjectorService): void; 1093 | declare function directiveNormalize(name: string): string; 1094 | declare function getTypeName(type: Type): string; 1095 | declare function getDowngradedModuleCount($injector: IInjectorService): number; 1096 | declare function getUpgradeAppType($injector: IInjectorService): UpgradeAppType; 1097 | declare function isFunction(value: any): value is Function; 1098 | declare function isNgModuleType(value: any): value is Type; 1099 | declare function validateInjectionKey($injector: IInjectorService, downgradedModule: string, injectionKey: string, attemptedAction: string): void; 1100 | declare class Deferred { 1101 | promise: Promise; 1102 | resolve: (value: R | PromiseLike) => void; 1103 | reject: (error?: any) => void; 1104 | constructor(); 1105 | } 1106 | interface LazyModuleRef { 1107 | injector?: Injector; 1108 | promise?: Promise; 1109 | } 1110 | declare const enum UpgradeAppType { 1111 | None = 0, 1112 | Dynamic = 1, 1113 | Static = 2, 1114 | Lite = 3 1115 | } 1116 | /** 1117 | * Glue the AngularJS `NgModelController` (if it exists) to the component 1118 | * (if it implements the needed subset of the `ControlValueAccessor` interface). 1119 | */ 1120 | declare function hookupNgModel(ngModel: INgModelController, component: any): void; 1121 | /** 1122 | * Test two values for strict equality, accounting for the fact that `NaN !== NaN`. 1123 | */ 1124 | declare function strictEquals(val1: any, val2: any): boolean; 1125 | 1126 | type util_d_Deferred = Deferred; 1127 | declare const util_d_Deferred: typeof Deferred; 1128 | type util_d_LazyModuleRef = LazyModuleRef; 1129 | type util_d_UpgradeAppType = UpgradeAppType; 1130 | declare const util_d_UpgradeAppType: typeof UpgradeAppType; 1131 | declare const util_d_cleanData: typeof cleanData; 1132 | declare const util_d_controllerKey: typeof controllerKey; 1133 | declare const util_d_destroyApp: typeof destroyApp; 1134 | declare const util_d_directiveNormalize: typeof directiveNormalize; 1135 | declare const util_d_getDowngradedModuleCount: typeof getDowngradedModuleCount; 1136 | declare const util_d_getTypeName: typeof getTypeName; 1137 | declare const util_d_getUpgradeAppType: typeof getUpgradeAppType; 1138 | declare const util_d_hookupNgModel: typeof hookupNgModel; 1139 | declare const util_d_isFunction: typeof isFunction; 1140 | declare const util_d_isNgModuleType: typeof isNgModuleType; 1141 | declare const util_d_onError: typeof onError; 1142 | declare const util_d_strictEquals: typeof strictEquals; 1143 | declare const util_d_validateInjectionKey: typeof validateInjectionKey; 1144 | declare namespace util_d { 1145 | export { util_d_Deferred as Deferred, util_d_UpgradeAppType as UpgradeAppType, util_d_cleanData as cleanData, util_d_controllerKey as controllerKey, util_d_destroyApp as destroyApp, util_d_directiveNormalize as directiveNormalize, util_d_getDowngradedModuleCount as getDowngradedModuleCount, util_d_getTypeName as getTypeName, util_d_getUpgradeAppType as getUpgradeAppType, util_d_hookupNgModel as hookupNgModel, util_d_isFunction as isFunction, util_d_isNgModuleType as isNgModuleType, util_d_onError as onError, util_d_strictEquals as strictEquals, util_d_validateInjectionKey as validateInjectionKey }; 1146 | export type { util_d_LazyModuleRef as LazyModuleRef }; 1147 | } 1148 | 1149 | export { UpgradeComponent, UpgradeModule, downgradeComponent, downgradeInjectable, downgradeModule, getAngularJSGlobal, getAngularLib, setAngularJSGlobal, setAngularLib, angular1_d as ɵangular1, constants_d as ɵconstants, upgrade_helper_d as ɵupgradeHelper, util_d as ɵutil }; 1150 | --------------------------------------------------------------------------------