@angular/core 15.2.1 → 16.0.0-next.1
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/esm2020/src/application_init.mjs +3 -2
- package/esm2020/src/application_module.mjs +3 -2
- package/esm2020/src/application_ref.mjs +5 -3
- package/esm2020/src/change_detection/change_detector_ref.mjs +3 -2
- package/esm2020/src/change_detection/differs/iterable_differs.mjs +3 -2
- package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +3 -2
- package/esm2020/src/console.mjs +3 -2
- package/esm2020/src/core.mjs +2 -1
- package/esm2020/src/core_private_export.mjs +2 -1
- package/esm2020/src/core_reactivity_export.mjs +11 -0
- package/esm2020/src/core_reactivity_export_internal.mjs +9 -0
- package/esm2020/src/di/injector.mjs +3 -2
- package/esm2020/src/di/r3_injector.mjs +5 -1
- package/esm2020/src/di/reflective_injector.mjs +3 -2
- package/esm2020/src/linker/compiler.mjs +3 -2
- package/esm2020/src/linker/component_factory_resolver.mjs +3 -2
- package/esm2020/src/linker/destroy_ref.mjs +41 -0
- package/esm2020/src/linker/element_ref.mjs +3 -2
- package/esm2020/src/linker/template_ref.mjs +3 -2
- package/esm2020/src/linker/view_container_ref.mjs +3 -2
- package/esm2020/src/linker.mjs +2 -1
- package/esm2020/src/render/api.mjs +3 -2
- package/esm2020/src/render/api_flags.mjs +1 -1
- package/esm2020/src/render3/features/standalone_feature.mjs +1 -1
- package/esm2020/src/render3/fields.mjs +10 -1
- package/esm2020/src/render3/hooks.mjs +3 -2
- package/esm2020/src/render3/instructions/shared.mjs +14 -14
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/interfaces/view.mjs +3 -2
- package/esm2020/src/render3/node_manipulation.mjs +14 -14
- package/esm2020/src/render3/util/view_utils.mjs +11 -2
- package/esm2020/src/render3/view_ref.mjs +4 -3
- package/esm2020/src/sanitization/sanitizer.mjs +3 -2
- package/esm2020/src/signals/index.mjs +15 -0
- package/esm2020/src/signals/src/api.mjs +46 -0
- package/esm2020/src/signals/src/computed.mjs +142 -0
- package/esm2020/src/signals/src/effect.mjs +69 -0
- package/esm2020/src/signals/src/graph.mjs +114 -0
- package/esm2020/src/signals/src/signal.mjs +78 -0
- package/esm2020/src/signals/src/untracked.mjs +26 -0
- package/esm2020/src/signals/src/watch.mjs +54 -0
- package/esm2020/src/signals/src/weak_ref.mjs +11 -0
- package/esm2020/src/testability/testability.mjs +5 -3
- package/esm2020/src/transfer_state.mjs +148 -0
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +6 -5
- package/esm2020/testing/src/ng_zone_mock.mjs +6 -5
- package/esm2020/testing/src/test_bed.mjs +3 -2
- package/fesm2015/core.mjs +699 -31
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +53 -30
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +695 -31
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +53 -30
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +398 -2
- package/package.json +2 -2
- package/schematics/migrations/router-link-with-href/bundle.js.map +2 -2
- package/schematics/ng-generate/standalone-migration/bundle.js +777 -1053
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v16.0.0-next.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2234,6 +2234,15 @@ const NG_FACTORY_DEF = getClosureSafeProperty({ ɵfac: getClosureSafeProperty })
|
|
|
2234
2234
|
*/
|
|
2235
2235
|
// TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified.
|
|
2236
2236
|
const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty });
|
|
2237
|
+
/**
|
|
2238
|
+
* The `NG_ENV_ID` field on a DI token indicates special processing in the `EnvironmentInjector`:
|
|
2239
|
+
* getting such tokens from the `EnvironmentInjector` will bypass the standard DI resolution
|
|
2240
|
+
* strategy and instead will return implementation produced by the `NG_ENV_ID` factory function.
|
|
2241
|
+
*
|
|
2242
|
+
* This particular retrieval of DI tokens is mostly done to eliminate circular dependencies and
|
|
2243
|
+
* improve tree-shaking.
|
|
2244
|
+
*/
|
|
2245
|
+
const NG_ENV_ID = getClosureSafeProperty({ __NG_ENV_ID__: getClosureSafeProperty });
|
|
2237
2246
|
|
|
2238
2247
|
/** Counter used to generate unique IDs for component definitions. */
|
|
2239
2248
|
let componentDefCount = 0;
|
|
@@ -2588,6 +2597,7 @@ const PREORDER_HOOK_FLAGS = 18;
|
|
|
2588
2597
|
const QUERIES = 19;
|
|
2589
2598
|
const ID = 20;
|
|
2590
2599
|
const EMBEDDED_VIEW_INJECTOR = 21;
|
|
2600
|
+
const ON_DESTROY_HOOKS = 22;
|
|
2591
2601
|
/**
|
|
2592
2602
|
* Size of LView's header. Necessary to adjust for it when setting slots.
|
|
2593
2603
|
*
|
|
@@ -2595,7 +2605,7 @@ const EMBEDDED_VIEW_INJECTOR = 21;
|
|
|
2595
2605
|
* instruction index into `LView` index. All other indexes should be in the `LView` index space and
|
|
2596
2606
|
* there should be no need to refer to `HEADER_OFFSET` anywhere else.
|
|
2597
2607
|
*/
|
|
2598
|
-
const HEADER_OFFSET =
|
|
2608
|
+
const HEADER_OFFSET = 23;
|
|
2599
2609
|
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
|
2600
2610
|
// failure based on types.
|
|
2601
2611
|
const unusedValueExportToPlacateAjd$3 = 1;
|
|
@@ -3033,6 +3043,15 @@ function updateTransplantedViewCount(lContainer, amount) {
|
|
|
3033
3043
|
parent = parent[PARENT];
|
|
3034
3044
|
}
|
|
3035
3045
|
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Stores a LView-specific destroy callback.
|
|
3048
|
+
*/
|
|
3049
|
+
function storeLViewOnDestroy(lView, onDestroyCallback) {
|
|
3050
|
+
if (lView[ON_DESTROY_HOOKS] === null) {
|
|
3051
|
+
lView[ON_DESTROY_HOOKS] = [];
|
|
3052
|
+
}
|
|
3053
|
+
lView[ON_DESTROY_HOOKS].push(onDestroyCallback);
|
|
3054
|
+
}
|
|
3036
3055
|
|
|
3037
3056
|
const instructionState = {
|
|
3038
3057
|
lFrame: createLFrame(null),
|
|
@@ -3710,8 +3729,9 @@ function callHooks(currentView, arr, initPhase, currentNodeIndex) {
|
|
|
3710
3729
|
}
|
|
3711
3730
|
else {
|
|
3712
3731
|
const isInitHook = arr[i] < 0;
|
|
3713
|
-
if (isInitHook)
|
|
3732
|
+
if (isInitHook) {
|
|
3714
3733
|
currentView[PREORDER_HOOK_FLAGS] += 65536 /* PreOrderHookFlags.NumberOfInitHooksCalledIncrementer */;
|
|
3734
|
+
}
|
|
3715
3735
|
if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {
|
|
3716
3736
|
callHook(currentView, initPhase, arr, i);
|
|
3717
3737
|
currentView[PREORDER_HOOK_FLAGS] =
|
|
@@ -6243,10 +6263,6 @@ function cleanUpView(tView, lView) {
|
|
|
6243
6263
|
function processCleanups(tView, lView) {
|
|
6244
6264
|
const tCleanup = tView.cleanup;
|
|
6245
6265
|
const lCleanup = lView[CLEANUP];
|
|
6246
|
-
// `LCleanup` contains both share information with `TCleanup` as well as instance specific
|
|
6247
|
-
// information appended at the end. We need to know where the end of the `TCleanup` information
|
|
6248
|
-
// is, and we track this with `lastLCleanupIndex`.
|
|
6249
|
-
let lastLCleanupIndex = -1;
|
|
6250
6266
|
if (tCleanup !== null) {
|
|
6251
6267
|
for (let i = 0; i < tCleanup.length - 1; i += 2) {
|
|
6252
6268
|
if (typeof tCleanup[i] === 'string') {
|
|
@@ -6256,29 +6272,33 @@ function processCleanups(tView, lView) {
|
|
|
6256
6272
|
ngDevMode && assertNumber(targetIdx, 'cleanup target must be a number');
|
|
6257
6273
|
if (targetIdx >= 0) {
|
|
6258
6274
|
// unregister
|
|
6259
|
-
lCleanup[
|
|
6275
|
+
lCleanup[targetIdx]();
|
|
6260
6276
|
}
|
|
6261
6277
|
else {
|
|
6262
6278
|
// Subscription
|
|
6263
|
-
lCleanup[
|
|
6279
|
+
lCleanup[-targetIdx].unsubscribe();
|
|
6264
6280
|
}
|
|
6265
6281
|
i += 2;
|
|
6266
6282
|
}
|
|
6267
6283
|
else {
|
|
6268
6284
|
// This is a cleanup function that is grouped with the index of its context
|
|
6269
|
-
const context = lCleanup[
|
|
6285
|
+
const context = lCleanup[tCleanup[i + 1]];
|
|
6270
6286
|
tCleanup[i].call(context);
|
|
6271
6287
|
}
|
|
6272
6288
|
}
|
|
6273
6289
|
}
|
|
6274
6290
|
if (lCleanup !== null) {
|
|
6275
|
-
for (let i = lastLCleanupIndex + 1; i < lCleanup.length; i++) {
|
|
6276
|
-
const instanceCleanupFn = lCleanup[i];
|
|
6277
|
-
ngDevMode && assertFunction(instanceCleanupFn, 'Expecting instance cleanup function.');
|
|
6278
|
-
instanceCleanupFn();
|
|
6279
|
-
}
|
|
6280
6291
|
lView[CLEANUP] = null;
|
|
6281
6292
|
}
|
|
6293
|
+
const destroyHooks = lView[ON_DESTROY_HOOKS];
|
|
6294
|
+
if (destroyHooks !== null) {
|
|
6295
|
+
for (let i = 0; i < destroyHooks.length; i++) {
|
|
6296
|
+
const destroyHooksFn = destroyHooks[i];
|
|
6297
|
+
ngDevMode && assertFunction(destroyHooksFn, 'Expecting destroy hook to be a function.');
|
|
6298
|
+
destroyHooksFn();
|
|
6299
|
+
}
|
|
6300
|
+
lView[ON_DESTROY_HOOKS] = null;
|
|
6301
|
+
}
|
|
6282
6302
|
}
|
|
6283
6303
|
/** Calls onDestroy hooks for this view */
|
|
6284
6304
|
function executeOnDestroys(tView, lView) {
|
|
@@ -8294,6 +8314,9 @@ class R3Injector extends EnvironmentInjector {
|
|
|
8294
8314
|
}
|
|
8295
8315
|
get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
|
|
8296
8316
|
this.assertNotDestroyed();
|
|
8317
|
+
if (token.hasOwnProperty(NG_ENV_ID)) {
|
|
8318
|
+
return token[NG_ENV_ID](this);
|
|
8319
|
+
}
|
|
8297
8320
|
flags = convertToBitFlags(flags);
|
|
8298
8321
|
// Set the injection context.
|
|
8299
8322
|
const previousInjector = setCurrentInjector(this);
|
|
@@ -8750,7 +8773,7 @@ class Version {
|
|
|
8750
8773
|
/**
|
|
8751
8774
|
* @publicApi
|
|
8752
8775
|
*/
|
|
8753
|
-
const VERSION = new Version('
|
|
8776
|
+
const VERSION = new Version('16.0.0-next.1');
|
|
8754
8777
|
|
|
8755
8778
|
// This default value is when checking the hierarchy for a token.
|
|
8756
8779
|
//
|
|
@@ -10955,24 +10978,24 @@ function locateHostElement(renderer, elementOrSelector, encapsulation) {
|
|
|
10955
10978
|
* On the first template pass, saves in TView:
|
|
10956
10979
|
* - Cleanup function
|
|
10957
10980
|
* - Index of context we just saved in LView.cleanupInstances
|
|
10958
|
-
*
|
|
10959
|
-
* This function can also be used to store instance specific cleanup fns. In that case the `context`
|
|
10960
|
-
* is `null` and the function is store in `LView` (rather than it `TView`).
|
|
10961
10981
|
*/
|
|
10962
10982
|
function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
|
10963
10983
|
const lCleanup = getOrCreateLViewCleanup(lView);
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10984
|
+
// Historically the `storeCleanupWithContext` was used to register both framework-level and
|
|
10985
|
+
// user-defined cleanup callbacks, but over time those two types of cleanups were separated. This
|
|
10986
|
+
// dev mode checks assures that user-level cleanup callbacks are _not_ stored in data structures
|
|
10987
|
+
// reserved for framework-specific hooks.
|
|
10988
|
+
ngDevMode &&
|
|
10989
|
+
assertDefined(context, 'Cleanup context is mandatory when registering framework-level destroy hooks');
|
|
10990
|
+
lCleanup.push(context);
|
|
10991
|
+
if (tView.firstCreatePass) {
|
|
10992
|
+
getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
|
10971
10993
|
}
|
|
10972
10994
|
else {
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10995
|
+
// Make sure that no new framework-level cleanup functions are registered after the first
|
|
10996
|
+
// template pass is done (and TView data structures are meant to fully constructed).
|
|
10997
|
+
if (ngDevMode) {
|
|
10998
|
+
Object.freeze(getOrCreateTViewCleanup(tView));
|
|
10976
10999
|
}
|
|
10977
11000
|
}
|
|
10978
11001
|
}
|
|
@@ -12165,7 +12188,7 @@ class ViewRef {
|
|
|
12165
12188
|
destroyLView(this._lView[TVIEW], this._lView);
|
|
12166
12189
|
}
|
|
12167
12190
|
onDestroy(callback) {
|
|
12168
|
-
|
|
12191
|
+
storeLViewOnDestroy(this._lView, callback);
|
|
12169
12192
|
}
|
|
12170
12193
|
/**
|
|
12171
12194
|
* Marks a view and all of its ancestors dirty.
|