@angular/upgrade 19.0.0-next.0 → 19.0.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/fesm2022/static/testing.mjs +5 -5
- package/fesm2022/static/testing.mjs.map +1 -1
- package/fesm2022/static.mjs +70 -21
- package/fesm2022/static.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +68 -18
- package/fesm2022/upgrade.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +5 -11
- package/static/index.d.ts +28 -4
- package/static/testing/index.d.ts +1 -1
- package/esm2022/index.mjs +0 -13
- package/esm2022/public_api.mjs +0 -17
- package/esm2022/src/common/src/angular1.mjs +0 -73
- package/esm2022/src/common/src/component_info.mjs +0 -27
- package/esm2022/src/common/src/constants.mjs +0 -33
- package/esm2022/src/common/src/downgrade_component.mjs +0 -203
- package/esm2022/src/common/src/downgrade_component_adapter.mjs +0 -284
- package/esm2022/src/common/src/downgrade_injectable.mjs +0 -87
- package/esm2022/src/common/src/promise_util.mjs +0 -58
- package/esm2022/src/common/src/upgrade_helper.mjs +0 -244
- package/esm2022/src/common/src/util.mjs +0 -151
- package/esm2022/src/common/src/version.mjs +0 -18
- package/esm2022/src/dynamic/src/upgrade_adapter.mjs +0 -657
- package/esm2022/src/dynamic/src/upgrade_ng1_adapter.mjs +0 -229
- package/esm2022/static/common.mjs +0 -22
- package/esm2022/static/index.mjs +0 -13
- package/esm2022/static/public_api.mjs +0 -17
- package/esm2022/static/src/angular1_providers.mjs +0 -43
- package/esm2022/static/src/downgrade_module.mjs +0 -190
- package/esm2022/static/src/upgrade_component.mjs +0 -250
- package/esm2022/static/src/upgrade_module.mjs +0 -294
- package/esm2022/static/src/util.mjs +0 -24
- package/esm2022/static/static.mjs +0 -5
- package/esm2022/static/testing/index.mjs +0 -9
- package/esm2022/static/testing/public_api.mjs +0 -10
- package/esm2022/static/testing/src/create_angular_testing_module.mjs +0 -101
- package/esm2022/static/testing/src/create_angularjs_testing_module.mjs +0 -93
- package/esm2022/static/testing/testing.mjs +0 -5
- package/esm2022/upgrade.mjs +0 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-2024 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.
|
package/README.md
CHANGED
|
@@ -3,6 +3,6 @@ Angular
|
|
|
3
3
|
|
|
4
4
|
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.
|
|
5
5
|
|
|
6
|
-
Usage information and reference details can be found in [Angular documentation](https://angular.
|
|
6
|
+
Usage information and reference details can be found in [Angular documentation](https://angular.dev/overview).
|
|
7
7
|
|
|
8
8
|
License: MIT
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.0.0-next.
|
|
2
|
+
* @license Angular v19.0.0-next.10
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -18,11 +18,11 @@ class AngularTestingModule {
|
|
|
18
18
|
constructor(i) {
|
|
19
19
|
injector = i;
|
|
20
20
|
}
|
|
21
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
22
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.
|
|
23
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
21
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: AngularTestingModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
22
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.10", ngImport: i0, type: AngularTestingModule }); }
|
|
23
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: AngularTestingModule, providers: [{ provide: ɵconstants.$INJECTOR, useFactory: $injectorFactory }] }); }
|
|
24
24
|
}
|
|
25
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: AngularTestingModule, decorators: [{
|
|
26
26
|
type: NgModule,
|
|
27
27
|
args: [{ providers: [{ provide: ɵconstants.$INJECTOR, useFactory: $injectorFactory }] }]
|
|
28
28
|
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../../packages/upgrade/static/testing/src/create_angular_testing_module.ts","../../../../../../../packages/upgrade/static/testing/src/create_angularjs_testing_module.ts","../../../../../../../packages/upgrade/static/testing/testing.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.
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../../packages/upgrade/static/testing/src/create_angular_testing_module.ts","../../../../../../../packages/upgrade/static/testing/src/create_angularjs_testing_module.ts","../../../../../../../packages/upgrade/static/testing/testing.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 '@angular/upgrade/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 * <code-example path=\"upgrade/static/ts/full/module.spec.ts\" region=\"angular-setup\"></code-example>\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 * <code-example path=\"upgrade/static/ts/full/module.spec.ts\" region=\"angular-spec\"></code-example>\n *\n * <div class=\"alert is-important\">\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 * </div>\n *\n * <div class=\"alert is-important\">\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 * </div>\n *\n * <div class=\"alert is-important\">\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 * </div>\n *\n * Here is the example application and its unit tests that use `createAngularTestingModule`\n * and `createAngularJSTestingModule`.\n *\n * <code-tabs>\n * <code-pane header=\"module.spec.ts\" path=\"upgrade/static/ts/full/module.spec.ts\"></code-pane>\n * <code-pane header=\"module.ts\" path=\"upgrade/static/ts/full/module.ts\"></code-pane>\n * </code-tabs>\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<any> {\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 '@angular/upgrade/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 * <code-example path=\"upgrade/static/ts/full/module.spec.ts\"\n * region=\"angularjs-setup\"></code-example>\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 * <code-example path=\"upgrade/static/ts/full/module.spec.ts\"\n * region=\"angularjs-spec\"></code-example>\n *\n * <div class=\"alert is-important\">\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 * </div>\n *\n * <div class=\"alert is-important\">\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 * </div>\n *\n * <div class=\"alert is-important\">\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 * </div>\n *\n * Here is the example application and its unit tests that use `createAngularTestingModule`\n * and `createAngularJSTestingModule`.\n *\n * <code-tabs>\n * <code-pane header=\"module.spec.ts\" path=\"upgrade/static/ts/full/module.spec.ts\"></code-pane>\n * <code-pane header=\"module.ts\" path=\"upgrade/static/ts/full/module.ts\"></code-pane>\n * </code-tabs>\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["angular","ng"],"mappings":";;;;;;;;;;;AAaA,IAAI,SAAS,GAAoC,IAAI,CAAC;AACtD,IAAI,QAAkB,CAAC;SAEP,gBAAgB,GAAA;AAC9B,IAAA,OAAO,SAAS,CAAC;AACnB,CAAC;MAGY,oBAAoB,CAAA;AAC/B,IAAA,WAAA,CAAY,CAAW,EAAA;QACrB,QAAQ,GAAG,CAAC,CAAC;KACd;yHAHU,oBAAoB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,QAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;0HAApB,oBAAoB,EAAA,CAAA,CAAA,EAAA;AAApB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,EADX,SAAA,EAAA,CAAC,EAAC,OAAO,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAC,CAAC,EAAA,CAAA,CAAA,EAAA;;sGACxE,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA,EAAC,SAAS,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAC,CAAC,EAAC,CAAA;;AAOtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEG;AACa,SAAA,0BAA0B,CACxC,gBAA0B,EAC1B,QAAkB,EAAA;IAElBA,SAAO;AACJ,SAAA,OAAO,CAAC,0BAA0B,EAAE,gBAAgB,CAAC;AACrD,SAAA,QAAQ,CAAC,UAAU,CAAC,oBAAoB,EAAwB,CAAA,6BAAA;SAChE,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,QAAQ,CAAC,CAAC;AACpD,IAAA,SAAS,GAAGA,SAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,0BAA0B,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC3E,IAAA,OAAO,oBAAoB,CAAC;AAC9B;;ACxFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEG;AACG,SAAU,4BAA4B,CAAC,cAAqB,EAAA;AAChE,IAAA,OAAOC,SAAE;AACN,SAAA,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC;AACvC,SAAA,QAAQ,CAAC,UAAU,CAAC,oBAAoB,EAAwB,CAAA,6BAAA;AAChE,SAAA,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE;AAChC,QAAA,UAAU,CAAC,SAAS;QACpB,CAAC,SAA8B,KAAI;YACjC,OAAO,CAAC,sBAAsB,CAAC;AAC7B,gBAAA,OAAO,EAAE,cAAc;AACvB,gBAAA,SAAS,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAC,CAAC;AAClE,aAAA,CAAC,CAAC;AACH,YAAA,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SACjC;KACF,CAAC,CAAC,IAAI,CAAC;AACZ;;AC/FA;;AAEG;;;;"}
|
package/fesm2022/static.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.0.0-next.
|
|
2
|
+
* @license Angular v19.0.0-next.10
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { ɵNG_MOD_DEF, Injector, ChangeDetectorRef, Testability, TestabilityRegistry, ApplicationRef, SimpleChange, NgZone, ComponentFactoryResolver, Version, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, PlatformRef, EventEmitter, Directive, NgModule } from '@angular/core';
|
|
8
|
+
import { ɵNG_MOD_DEF, Injector, ChangeDetectorRef, Testability, TestabilityRegistry, ApplicationRef, SimpleChange, ɵSIGNAL, NgZone, ComponentFactoryResolver, Version, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, PlatformRef, EventEmitter, Directive, NgModule } from '@angular/core';
|
|
9
9
|
import { platformBrowser } from '@angular/platform-browser';
|
|
10
10
|
|
|
11
11
|
function noNg() {
|
|
@@ -326,7 +326,7 @@ const INITIAL_VALUE$1 = {
|
|
|
326
326
|
__UNINITIALIZED__: true,
|
|
327
327
|
};
|
|
328
328
|
class DowngradeComponentAdapter {
|
|
329
|
-
constructor(element, attrs, scope, ngModel, parentInjector, $compile, $parse, componentFactory, wrapCallback) {
|
|
329
|
+
constructor(element, attrs, scope, ngModel, parentInjector, $compile, $parse, componentFactory, wrapCallback, unsafelyOverwriteSignalInputs) {
|
|
330
330
|
this.element = element;
|
|
331
331
|
this.attrs = attrs;
|
|
332
332
|
this.scope = scope;
|
|
@@ -336,6 +336,7 @@ class DowngradeComponentAdapter {
|
|
|
336
336
|
this.$parse = $parse;
|
|
337
337
|
this.componentFactory = componentFactory;
|
|
338
338
|
this.wrapCallback = wrapCallback;
|
|
339
|
+
this.unsafelyOverwriteSignalInputs = unsafelyOverwriteSignalInputs;
|
|
339
340
|
this.implementsOnChanges = false;
|
|
340
341
|
this.inputChangeCount = 0;
|
|
341
342
|
this.inputChanges = {};
|
|
@@ -391,7 +392,7 @@ class DowngradeComponentAdapter {
|
|
|
391
392
|
const inputBinding = new PropertyBinding(input.propName, input.templateName);
|
|
392
393
|
let expr = null;
|
|
393
394
|
if (attrs.hasOwnProperty(inputBinding.attr)) {
|
|
394
|
-
const observeFn = ((prop) => {
|
|
395
|
+
const observeFn = ((prop, isSignal) => {
|
|
395
396
|
let prevValue = INITIAL_VALUE$1;
|
|
396
397
|
return (currValue) => {
|
|
397
398
|
// Initially, both `$observe()` and `$watch()` will call this function.
|
|
@@ -399,11 +400,11 @@ class DowngradeComponentAdapter {
|
|
|
399
400
|
if (prevValue === INITIAL_VALUE$1) {
|
|
400
401
|
prevValue = currValue;
|
|
401
402
|
}
|
|
402
|
-
this.updateInput(componentRef, prop, prevValue, currValue);
|
|
403
|
+
this.updateInput(componentRef, prop, prevValue, currValue, isSignal);
|
|
403
404
|
prevValue = currValue;
|
|
404
405
|
}
|
|
405
406
|
};
|
|
406
|
-
})(inputBinding.prop);
|
|
407
|
+
})(inputBinding.prop, input.isSignal);
|
|
407
408
|
attrs.$observe(inputBinding.attr, observeFn);
|
|
408
409
|
// Use `$watch()` (in addition to `$observe()`) in order to initialize the input in time
|
|
409
410
|
// for `ngOnChanges()`. This is necessary if we are already in a `$digest`, which means that
|
|
@@ -427,7 +428,7 @@ class DowngradeComponentAdapter {
|
|
|
427
428
|
expr = attrs[inputBinding.bracketParenAttr];
|
|
428
429
|
}
|
|
429
430
|
if (expr != null) {
|
|
430
|
-
const watchFn = ((prop) => (currValue, prevValue) => this.updateInput(componentRef, prop, prevValue, currValue))(inputBinding.prop);
|
|
431
|
+
const watchFn = ((prop, isSignal) => (currValue, prevValue) => this.updateInput(componentRef, prop, prevValue, currValue, isSignal))(inputBinding.prop, input.isSignal);
|
|
431
432
|
this.componentScope.$watch(expr, watchFn);
|
|
432
433
|
}
|
|
433
434
|
}
|
|
@@ -538,12 +539,18 @@ class DowngradeComponentAdapter {
|
|
|
538
539
|
}
|
|
539
540
|
});
|
|
540
541
|
}
|
|
541
|
-
updateInput(componentRef, prop, prevValue, currValue) {
|
|
542
|
+
updateInput(componentRef, prop, prevValue, currValue, isSignal) {
|
|
542
543
|
if (this.implementsOnChanges) {
|
|
543
544
|
this.inputChanges[prop] = new SimpleChange(prevValue, currValue, prevValue === currValue);
|
|
544
545
|
}
|
|
545
546
|
this.inputChangeCount++;
|
|
546
|
-
|
|
547
|
+
if (isSignal && !this.unsafelyOverwriteSignalInputs) {
|
|
548
|
+
const node = componentRef.instance[prop][ɵSIGNAL];
|
|
549
|
+
node.applyValueToInputSignal(node, currValue);
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
componentRef.instance[prop] = currValue;
|
|
553
|
+
}
|
|
547
554
|
}
|
|
548
555
|
groupProjectableNodes() {
|
|
549
556
|
let ngContentSelectors = this.componentFactory.ngContentSelectors;
|
|
@@ -696,6 +703,7 @@ class SyncPromise {
|
|
|
696
703
|
*/
|
|
697
704
|
function downgradeComponent(info) {
|
|
698
705
|
const directiveFactory = function ($compile, $injector, $parse) {
|
|
706
|
+
const unsafelyOverwriteSignalInputs = info.unsafelyOverwriteSignalInputs ?? false;
|
|
699
707
|
// When using `downgradeModule()`, we need to handle certain things specially. For example:
|
|
700
708
|
// - We always need to attach the component view to the `ApplicationRef` for it to be
|
|
701
709
|
// dirty-checked.
|
|
@@ -783,7 +791,7 @@ function downgradeComponent(info) {
|
|
|
783
791
|
throw new Error(`Expecting ComponentFactory for: ${getTypeName(info.component)}`);
|
|
784
792
|
}
|
|
785
793
|
const injectorPromise = new ParentInjectorPromise(element);
|
|
786
|
-
const facade = new DowngradeComponentAdapter(element, attrs, scope, ngModel, injector, $compile, $parse, componentFactory, wrapCallback);
|
|
794
|
+
const facade = new DowngradeComponentAdapter(element, attrs, scope, ngModel, injector, $compile, $parse, componentFactory, wrapCallback, unsafelyOverwriteSignalInputs);
|
|
787
795
|
const projectableNodes = facade.compileContents();
|
|
788
796
|
const componentRef = facade.createComponentAndSetup(projectableNodes, isNgUpgradeLite, info.propagateDigest);
|
|
789
797
|
injectorPromise.resolve(componentRef.injector);
|
|
@@ -922,7 +930,48 @@ function downgradeInjectable(token, downgradedModule = '') {
|
|
|
922
930
|
/**
|
|
923
931
|
* @publicApi
|
|
924
932
|
*/
|
|
925
|
-
const VERSION = new Version('19.0.0-next.
|
|
933
|
+
const VERSION = new Version('19.0.0-next.10');
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* The Trusted Types policy, or null if Trusted Types are not
|
|
937
|
+
* enabled/supported, or undefined if the policy has not been created yet.
|
|
938
|
+
*/
|
|
939
|
+
let policy;
|
|
940
|
+
/**
|
|
941
|
+
* Returns the Trusted Types policy, or null if Trusted Types are not
|
|
942
|
+
* enabled/supported. The first call to this function will create the policy.
|
|
943
|
+
*/
|
|
944
|
+
function getPolicy() {
|
|
945
|
+
if (policy === undefined) {
|
|
946
|
+
policy = null;
|
|
947
|
+
const windowWithTrustedTypes = window;
|
|
948
|
+
if (windowWithTrustedTypes.trustedTypes) {
|
|
949
|
+
try {
|
|
950
|
+
policy = windowWithTrustedTypes.trustedTypes.createPolicy('angular#unsafe-upgrade', {
|
|
951
|
+
createHTML: (s) => s,
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
catch {
|
|
955
|
+
// trustedTypes.createPolicy throws if called with a name that is
|
|
956
|
+
// already registered, even in report-only mode. Until the API changes,
|
|
957
|
+
// catch the error not to break the applications functionally. In such
|
|
958
|
+
// cases, the code will fall back to using strings.
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
return policy;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Unsafely promote a legacy AngularJS template to a TrustedHTML, falling back
|
|
966
|
+
* to strings when Trusted Types are not available.
|
|
967
|
+
* @security This is a security-sensitive function; any use of this function
|
|
968
|
+
* must go through security review. In particular, the template string should
|
|
969
|
+
* always be under full control of the application author, as untrusted input
|
|
970
|
+
* can cause an XSS vulnerability.
|
|
971
|
+
*/
|
|
972
|
+
function trustedHTMLFromLegacyTemplate(html) {
|
|
973
|
+
return getPolicy()?.createHTML(html) || html;
|
|
974
|
+
}
|
|
926
975
|
|
|
927
976
|
// Constants
|
|
928
977
|
const REQUIRE_PREFIX_RE = /^(\^\^?)?(\?)?(\^\^?)?/;
|
|
@@ -955,14 +1004,14 @@ class UpgradeHelper {
|
|
|
955
1004
|
}
|
|
956
1005
|
static getTemplate($injector, directive, fetchRemoteTemplate = false, $element) {
|
|
957
1006
|
if (directive.template !== undefined) {
|
|
958
|
-
return getOrCall(directive.template, $element);
|
|
1007
|
+
return trustedHTMLFromLegacyTemplate(getOrCall(directive.template, $element));
|
|
959
1008
|
}
|
|
960
1009
|
else if (directive.templateUrl) {
|
|
961
1010
|
const $templateCache = $injector.get($TEMPLATE_CACHE);
|
|
962
1011
|
const url = getOrCall(directive.templateUrl, $element);
|
|
963
1012
|
const template = $templateCache.get(url);
|
|
964
1013
|
if (template !== undefined) {
|
|
965
|
-
return template;
|
|
1014
|
+
return trustedHTMLFromLegacyTemplate(template);
|
|
966
1015
|
}
|
|
967
1016
|
else if (!fetchRemoteTemplate) {
|
|
968
1017
|
throw new Error('loading directive templates asynchronously is not supported');
|
|
@@ -971,7 +1020,7 @@ class UpgradeHelper {
|
|
|
971
1020
|
const $httpBackend = $injector.get($HTTP_BACKEND);
|
|
972
1021
|
$httpBackend('GET', url, null, (status, response) => {
|
|
973
1022
|
if (status === 200) {
|
|
974
|
-
resolve($templateCache.put(url, response));
|
|
1023
|
+
resolve(trustedHTMLFromLegacyTemplate($templateCache.put(url, response)));
|
|
975
1024
|
}
|
|
976
1025
|
else {
|
|
977
1026
|
reject(`GET component template from '${url}' returned '${status}: ${response}'`);
|
|
@@ -1631,10 +1680,10 @@ class UpgradeComponent {
|
|
|
1631
1680
|
bindingDestination.$onChanges(changes);
|
|
1632
1681
|
}
|
|
1633
1682
|
}
|
|
1634
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
1635
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0-next.
|
|
1683
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: UpgradeComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1684
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0-next.10", type: UpgradeComponent, isStandalone: true, usesOnChanges: true, ngImport: i0 }); }
|
|
1636
1685
|
}
|
|
1637
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
1686
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: UpgradeComponent, decorators: [{
|
|
1638
1687
|
type: Directive
|
|
1639
1688
|
}], ctorParameters: () => [{ type: undefined }, { type: i0.ElementRef }, { type: i0.Injector }] });
|
|
1640
1689
|
|
|
@@ -1910,11 +1959,11 @@ class UpgradeModule {
|
|
|
1910
1959
|
}
|
|
1911
1960
|
return returnValue;
|
|
1912
1961
|
}
|
|
1913
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
1914
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.
|
|
1915
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
1962
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: UpgradeModule, deps: [{ token: i0.Injector }, { token: i0.NgZone }, { token: i0.PlatformRef }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1963
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.10", ngImport: i0, type: UpgradeModule }); }
|
|
1964
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: UpgradeModule, providers: [angular1Providers] }); }
|
|
1916
1965
|
}
|
|
1917
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
1966
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: UpgradeModule, decorators: [{
|
|
1918
1967
|
type: NgModule,
|
|
1919
1968
|
args: [{ providers: [angular1Providers] }]
|
|
1920
1969
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: i0.NgZone }, { type: i0.PlatformRef }] });
|