@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/fesm2020/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
|
*/
|
|
@@ -2233,6 +2233,15 @@ const NG_FACTORY_DEF = getClosureSafeProperty({ ɵfac: getClosureSafeProperty })
|
|
|
2233
2233
|
*/
|
|
2234
2234
|
// TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified.
|
|
2235
2235
|
const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty });
|
|
2236
|
+
/**
|
|
2237
|
+
* The `NG_ENV_ID` field on a DI token indicates special processing in the `EnvironmentInjector`:
|
|
2238
|
+
* getting such tokens from the `EnvironmentInjector` will bypass the standard DI resolution
|
|
2239
|
+
* strategy and instead will return implementation produced by the `NG_ENV_ID` factory function.
|
|
2240
|
+
*
|
|
2241
|
+
* This particular retrieval of DI tokens is mostly done to eliminate circular dependencies and
|
|
2242
|
+
* improve tree-shaking.
|
|
2243
|
+
*/
|
|
2244
|
+
const NG_ENV_ID = getClosureSafeProperty({ __NG_ENV_ID__: getClosureSafeProperty });
|
|
2236
2245
|
|
|
2237
2246
|
/** Counter used to generate unique IDs for component definitions. */
|
|
2238
2247
|
let componentDefCount = 0;
|
|
@@ -2549,6 +2558,7 @@ const PREORDER_HOOK_FLAGS = 18;
|
|
|
2549
2558
|
const QUERIES = 19;
|
|
2550
2559
|
const ID = 20;
|
|
2551
2560
|
const EMBEDDED_VIEW_INJECTOR = 21;
|
|
2561
|
+
const ON_DESTROY_HOOKS = 22;
|
|
2552
2562
|
/**
|
|
2553
2563
|
* Size of LView's header. Necessary to adjust for it when setting slots.
|
|
2554
2564
|
*
|
|
@@ -2556,7 +2566,7 @@ const EMBEDDED_VIEW_INJECTOR = 21;
|
|
|
2556
2566
|
* instruction index into `LView` index. All other indexes should be in the `LView` index space and
|
|
2557
2567
|
* there should be no need to refer to `HEADER_OFFSET` anywhere else.
|
|
2558
2568
|
*/
|
|
2559
|
-
const HEADER_OFFSET =
|
|
2569
|
+
const HEADER_OFFSET = 23;
|
|
2560
2570
|
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
|
2561
2571
|
// failure based on types.
|
|
2562
2572
|
const unusedValueExportToPlacateAjd$4 = 1;
|
|
@@ -3032,6 +3042,15 @@ function updateTransplantedViewCount(lContainer, amount) {
|
|
|
3032
3042
|
parent = parent[PARENT];
|
|
3033
3043
|
}
|
|
3034
3044
|
}
|
|
3045
|
+
/**
|
|
3046
|
+
* Stores a LView-specific destroy callback.
|
|
3047
|
+
*/
|
|
3048
|
+
function storeLViewOnDestroy(lView, onDestroyCallback) {
|
|
3049
|
+
if (lView[ON_DESTROY_HOOKS] === null) {
|
|
3050
|
+
lView[ON_DESTROY_HOOKS] = [];
|
|
3051
|
+
}
|
|
3052
|
+
lView[ON_DESTROY_HOOKS].push(onDestroyCallback);
|
|
3053
|
+
}
|
|
3035
3054
|
|
|
3036
3055
|
const instructionState = {
|
|
3037
3056
|
lFrame: createLFrame(null),
|
|
@@ -3709,8 +3728,9 @@ function callHooks(currentView, arr, initPhase, currentNodeIndex) {
|
|
|
3709
3728
|
}
|
|
3710
3729
|
else {
|
|
3711
3730
|
const isInitHook = arr[i] < 0;
|
|
3712
|
-
if (isInitHook)
|
|
3731
|
+
if (isInitHook) {
|
|
3713
3732
|
currentView[PREORDER_HOOK_FLAGS] += 65536 /* PreOrderHookFlags.NumberOfInitHooksCalledIncrementer */;
|
|
3733
|
+
}
|
|
3714
3734
|
if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {
|
|
3715
3735
|
callHook(currentView, initPhase, arr, i);
|
|
3716
3736
|
currentView[PREORDER_HOOK_FLAGS] =
|
|
@@ -6241,10 +6261,6 @@ function cleanUpView(tView, lView) {
|
|
|
6241
6261
|
function processCleanups(tView, lView) {
|
|
6242
6262
|
const tCleanup = tView.cleanup;
|
|
6243
6263
|
const lCleanup = lView[CLEANUP];
|
|
6244
|
-
// `LCleanup` contains both share information with `TCleanup` as well as instance specific
|
|
6245
|
-
// information appended at the end. We need to know where the end of the `TCleanup` information
|
|
6246
|
-
// is, and we track this with `lastLCleanupIndex`.
|
|
6247
|
-
let lastLCleanupIndex = -1;
|
|
6248
6264
|
if (tCleanup !== null) {
|
|
6249
6265
|
for (let i = 0; i < tCleanup.length - 1; i += 2) {
|
|
6250
6266
|
if (typeof tCleanup[i] === 'string') {
|
|
@@ -6254,29 +6270,33 @@ function processCleanups(tView, lView) {
|
|
|
6254
6270
|
ngDevMode && assertNumber(targetIdx, 'cleanup target must be a number');
|
|
6255
6271
|
if (targetIdx >= 0) {
|
|
6256
6272
|
// unregister
|
|
6257
|
-
lCleanup[
|
|
6273
|
+
lCleanup[targetIdx]();
|
|
6258
6274
|
}
|
|
6259
6275
|
else {
|
|
6260
6276
|
// Subscription
|
|
6261
|
-
lCleanup[
|
|
6277
|
+
lCleanup[-targetIdx].unsubscribe();
|
|
6262
6278
|
}
|
|
6263
6279
|
i += 2;
|
|
6264
6280
|
}
|
|
6265
6281
|
else {
|
|
6266
6282
|
// This is a cleanup function that is grouped with the index of its context
|
|
6267
|
-
const context = lCleanup[
|
|
6283
|
+
const context = lCleanup[tCleanup[i + 1]];
|
|
6268
6284
|
tCleanup[i].call(context);
|
|
6269
6285
|
}
|
|
6270
6286
|
}
|
|
6271
6287
|
}
|
|
6272
6288
|
if (lCleanup !== null) {
|
|
6273
|
-
for (let i = lastLCleanupIndex + 1; i < lCleanup.length; i++) {
|
|
6274
|
-
const instanceCleanupFn = lCleanup[i];
|
|
6275
|
-
ngDevMode && assertFunction(instanceCleanupFn, 'Expecting instance cleanup function.');
|
|
6276
|
-
instanceCleanupFn();
|
|
6277
|
-
}
|
|
6278
6289
|
lView[CLEANUP] = null;
|
|
6279
6290
|
}
|
|
6291
|
+
const destroyHooks = lView[ON_DESTROY_HOOKS];
|
|
6292
|
+
if (destroyHooks !== null) {
|
|
6293
|
+
for (let i = 0; i < destroyHooks.length; i++) {
|
|
6294
|
+
const destroyHooksFn = destroyHooks[i];
|
|
6295
|
+
ngDevMode && assertFunction(destroyHooksFn, 'Expecting destroy hook to be a function.');
|
|
6296
|
+
destroyHooksFn();
|
|
6297
|
+
}
|
|
6298
|
+
lView[ON_DESTROY_HOOKS] = null;
|
|
6299
|
+
}
|
|
6280
6300
|
}
|
|
6281
6301
|
/** Calls onDestroy hooks for this view */
|
|
6282
6302
|
function executeOnDestroys(tView, lView) {
|
|
@@ -8286,6 +8306,9 @@ class R3Injector extends EnvironmentInjector {
|
|
|
8286
8306
|
}
|
|
8287
8307
|
get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
|
|
8288
8308
|
this.assertNotDestroyed();
|
|
8309
|
+
if (token.hasOwnProperty(NG_ENV_ID)) {
|
|
8310
|
+
return token[NG_ENV_ID](this);
|
|
8311
|
+
}
|
|
8289
8312
|
flags = convertToBitFlags(flags);
|
|
8290
8313
|
// Set the injection context.
|
|
8291
8314
|
const previousInjector = setCurrentInjector(this);
|
|
@@ -8742,7 +8765,7 @@ class Version {
|
|
|
8742
8765
|
/**
|
|
8743
8766
|
* @publicApi
|
|
8744
8767
|
*/
|
|
8745
|
-
const VERSION = new Version('
|
|
8768
|
+
const VERSION = new Version('16.0.0-next.1');
|
|
8746
8769
|
|
|
8747
8770
|
// This default value is when checking the hierarchy for a token.
|
|
8748
8771
|
//
|
|
@@ -10946,24 +10969,24 @@ function locateHostElement(renderer, elementOrSelector, encapsulation) {
|
|
|
10946
10969
|
* On the first template pass, saves in TView:
|
|
10947
10970
|
* - Cleanup function
|
|
10948
10971
|
* - Index of context we just saved in LView.cleanupInstances
|
|
10949
|
-
*
|
|
10950
|
-
* This function can also be used to store instance specific cleanup fns. In that case the `context`
|
|
10951
|
-
* is `null` and the function is store in `LView` (rather than it `TView`).
|
|
10952
10972
|
*/
|
|
10953
10973
|
function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
|
10954
10974
|
const lCleanup = getOrCreateLViewCleanup(lView);
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10975
|
+
// Historically the `storeCleanupWithContext` was used to register both framework-level and
|
|
10976
|
+
// user-defined cleanup callbacks, but over time those two types of cleanups were separated. This
|
|
10977
|
+
// dev mode checks assures that user-level cleanup callbacks are _not_ stored in data structures
|
|
10978
|
+
// reserved for framework-specific hooks.
|
|
10979
|
+
ngDevMode &&
|
|
10980
|
+
assertDefined(context, 'Cleanup context is mandatory when registering framework-level destroy hooks');
|
|
10981
|
+
lCleanup.push(context);
|
|
10982
|
+
if (tView.firstCreatePass) {
|
|
10983
|
+
getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
|
10962
10984
|
}
|
|
10963
10985
|
else {
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10986
|
+
// Make sure that no new framework-level cleanup functions are registered after the first
|
|
10987
|
+
// template pass is done (and TView data structures are meant to fully constructed).
|
|
10988
|
+
if (ngDevMode) {
|
|
10989
|
+
Object.freeze(getOrCreateTViewCleanup(tView));
|
|
10967
10990
|
}
|
|
10968
10991
|
}
|
|
10969
10992
|
}
|
|
@@ -12155,7 +12178,7 @@ class ViewRef {
|
|
|
12155
12178
|
destroyLView(this._lView[TVIEW], this._lView);
|
|
12156
12179
|
}
|
|
12157
12180
|
onDestroy(callback) {
|
|
12158
|
-
|
|
12181
|
+
storeLViewOnDestroy(this._lView, callback);
|
|
12159
12182
|
}
|
|
12160
12183
|
/**
|
|
12161
12184
|
* Marks a view and all of its ancestors dirty.
|