@angular/core 19.1.0-rc.0 → 19.1.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/fesm2022/core.mjs +418 -445
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +5 -5
- package/index.d.ts +45 -46
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/{apply_import_manager-6508401d.js → apply_import_manager-5082ccea.js} +3 -3
- package/schematics/bundles/{checker-24b68d23.js → checker-aa999c96.js} +20 -19
- package/schematics/bundles/cleanup-unused-imports.js +7 -7
- package/schematics/bundles/{compiler_host-5f693799.js → compiler_host-f0b570c8.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/explicit-standalone-flag.js +5 -5
- package/schematics/bundles/{imports-abe29092.js → imports-31a38653.js} +1 -1
- package/schematics/bundles/{index-b1033cf0.js → index-02a11f43.js} +4 -4
- package/schematics/bundles/{index-767e341d.js → index-15b61bae.js} +4 -4
- package/schematics/bundles/inject-migration.js +6 -6
- package/schematics/bundles/{leading_space-d190b83b.js → leading_space-6e7a8ec6.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-bc7d8784.js → migrate_ts_type_references-042ca765.js} +6 -6
- package/schematics/bundles/{nodes-a9f0b985.js → nodes-88c2157f.js} +2 -2
- package/schematics/bundles/output-migration.js +6 -6
- package/schematics/bundles/pending-tasks.js +5 -5
- package/schematics/bundles/{program-c810a4c2.js → program-393ca8f3.js} +40 -21
- package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
- package/schematics/bundles/provide-initializer.js +5 -5
- package/schematics/bundles/route-lazy-loading.js +4 -4
- package/schematics/bundles/signal-input-migration.js +8 -8
- package/schematics/bundles/signal-queries-migration.js +14 -8
- package/schematics/bundles/signals.js +8 -8
- package/schematics/bundles/standalone-migration.js +8 -8
- package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.1.
|
|
2
|
+
* @license Angular v19.1.1
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { SIGNAL_NODE as SIGNAL_NODE$1, signalSetFn as signalSetFn$1, producerAccessed as producerAccessed$1, SIGNAL as SIGNAL$1, getActiveConsumer as getActiveConsumer$1, setActiveConsumer as setActiveConsumer$1,
|
|
7
|
+
import { SIGNAL_NODE as SIGNAL_NODE$1, signalSetFn as signalSetFn$1, producerAccessed as producerAccessed$1, SIGNAL as SIGNAL$1, getActiveConsumer as getActiveConsumer$1, setActiveConsumer as setActiveConsumer$1, createSignal as createSignal$1, signalUpdateFn as signalUpdateFn$1, consumerDestroy as consumerDestroy$1, REACTIVE_NODE as REACTIVE_NODE$1, consumerBeforeComputation as consumerBeforeComputation$1, consumerAfterComputation as consumerAfterComputation$1, consumerPollProducersForChange as consumerPollProducersForChange$1, createComputed as createComputed$1, setThrowInvalidWriteToSignalError as setThrowInvalidWriteToSignalError$1, producerUpdateValueVersion as producerUpdateValueVersion$1, producerMarkClean as producerMarkClean$1, defaultEquals as defaultEquals$1, createWatch as createWatch$1, isInNotificationPhase as isInNotificationPhase$1 } from '@angular/core/primitives/signals';
|
|
8
8
|
export { SIGNAL as ɵSIGNAL } from '@angular/core/primitives/signals';
|
|
9
9
|
import { BehaviorSubject, Subject, Subscription } from 'rxjs';
|
|
10
10
|
import { Attribute as Attribute$1, EventContract, EventContractContainer, getAppScopedQueuedEventInfos, clearAppScopedEarlyEventContract, EventDispatcher, registerDispatcher, isEarlyEventType, isCaptureEventType, EventPhase } from '@angular/core/primitives/event-dispatch';
|
|
@@ -2902,7 +2902,6 @@ const ON_DESTROY_HOOKS = 21;
|
|
|
2902
2902
|
const EFFECTS_TO_SCHEDULE = 22;
|
|
2903
2903
|
const EFFECTS = 23;
|
|
2904
2904
|
const REACTIVE_TEMPLATE_CONSUMER = 24;
|
|
2905
|
-
const AFTER_RENDER_SEQUENCES_TO_ADD = 25;
|
|
2906
2905
|
/**
|
|
2907
2906
|
* Size of LView's header. Necessary to adjust for it when setting slots.
|
|
2908
2907
|
*
|
|
@@ -2910,7 +2909,7 @@ const AFTER_RENDER_SEQUENCES_TO_ADD = 25;
|
|
|
2910
2909
|
* instruction index into `LView` index. All other indexes should be in the `LView` index space and
|
|
2911
2910
|
* there should be no need to refer to `HEADER_OFFSET` anywhere else.
|
|
2912
2911
|
*/
|
|
2913
|
-
const HEADER_OFFSET =
|
|
2912
|
+
const HEADER_OFFSET = 25;
|
|
2914
2913
|
|
|
2915
2914
|
/**
|
|
2916
2915
|
* Special location which allows easy identification of type. If we have an array which was
|
|
@@ -2936,18 +2935,6 @@ const MOVED_VIEWS = 9;
|
|
|
2936
2935
|
* remove views from the DOM when they are no longer required.
|
|
2937
2936
|
*/
|
|
2938
2937
|
const CONTAINER_HEADER_OFFSET = 10;
|
|
2939
|
-
/** Flags associated with an LContainer (saved in LContainer[FLAGS]) */
|
|
2940
|
-
var LContainerFlags;
|
|
2941
|
-
(function (LContainerFlags) {
|
|
2942
|
-
LContainerFlags[LContainerFlags["None"] = 0] = "None";
|
|
2943
|
-
/**
|
|
2944
|
-
* Flag to signify that this `LContainer` may have transplanted views which need to be change
|
|
2945
|
-
* detected. (see: `LView[DECLARATION_COMPONENT_VIEW])`.
|
|
2946
|
-
*
|
|
2947
|
-
* This flag, once set, is never unset for the `LContainer`.
|
|
2948
|
-
*/
|
|
2949
|
-
LContainerFlags[LContainerFlags["HasTransplantedViews"] = 2] = "HasTransplantedViews";
|
|
2950
|
-
})(LContainerFlags || (LContainerFlags = {}));
|
|
2951
2938
|
|
|
2952
2939
|
/**
|
|
2953
2940
|
* True if `value` is `LView`.
|
|
@@ -3431,7 +3418,7 @@ function requiresRefreshOrTraversal(lView) {
|
|
|
3431
3418
|
* parents above.
|
|
3432
3419
|
*/
|
|
3433
3420
|
function updateAncestorTraversalFlagsOnAttach(lView) {
|
|
3434
|
-
lView[ENVIRONMENT].changeDetectionScheduler?.notify(
|
|
3421
|
+
lView[ENVIRONMENT].changeDetectionScheduler?.notify(9 /* NotificationSource.ViewAttached */);
|
|
3435
3422
|
if (lView[FLAGS] & 64 /* LViewFlags.Dirty */) {
|
|
3436
3423
|
lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;
|
|
3437
3424
|
}
|
|
@@ -3495,6 +3482,40 @@ function getLViewParent(lView) {
|
|
|
3495
3482
|
const parent = lView[PARENT];
|
|
3496
3483
|
return isLContainer(parent) ? parent[PARENT] : parent;
|
|
3497
3484
|
}
|
|
3485
|
+
function getOrCreateLViewCleanup(view) {
|
|
3486
|
+
// top level variables should not be exported for performance reasons (PERF_NOTES.md)
|
|
3487
|
+
return (view[CLEANUP] ??= []);
|
|
3488
|
+
}
|
|
3489
|
+
function getOrCreateTViewCleanup(tView) {
|
|
3490
|
+
return (tView.cleanup ??= []);
|
|
3491
|
+
}
|
|
3492
|
+
/**
|
|
3493
|
+
* Saves context for this cleanup function in LView.cleanupInstances.
|
|
3494
|
+
*
|
|
3495
|
+
* On the first template pass, saves in TView:
|
|
3496
|
+
* - Cleanup function
|
|
3497
|
+
* - Index of context we just saved in LView.cleanupInstances
|
|
3498
|
+
*/
|
|
3499
|
+
function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
|
3500
|
+
const lCleanup = getOrCreateLViewCleanup(lView);
|
|
3501
|
+
// Historically the `storeCleanupWithContext` was used to register both framework-level and
|
|
3502
|
+
// user-defined cleanup callbacks, but over time those two types of cleanups were separated.
|
|
3503
|
+
// This dev mode checks assures that user-level cleanup callbacks are _not_ stored in data
|
|
3504
|
+
// structures reserved for framework-specific hooks.
|
|
3505
|
+
ngDevMode &&
|
|
3506
|
+
assertDefined(context, 'Cleanup context is mandatory when registering framework-level destroy hooks');
|
|
3507
|
+
lCleanup.push(context);
|
|
3508
|
+
if (tView.firstCreatePass) {
|
|
3509
|
+
getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
|
3510
|
+
}
|
|
3511
|
+
else {
|
|
3512
|
+
// Make sure that no new framework-level cleanup functions are registered after the first
|
|
3513
|
+
// template pass is done (and TView data structures are meant to fully constructed).
|
|
3514
|
+
if (ngDevMode) {
|
|
3515
|
+
Object.freeze(getOrCreateTViewCleanup(tView));
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3498
3519
|
|
|
3499
3520
|
const instructionState = {
|
|
3500
3521
|
lFrame: createLFrame(null),
|
|
@@ -4411,7 +4432,7 @@ class NodeInjectorFactory {
|
|
|
4411
4432
|
* Example:
|
|
4412
4433
|
*
|
|
4413
4434
|
* If we have a component and directive active an a single element as declared here
|
|
4414
|
-
* ```
|
|
4435
|
+
* ```ts
|
|
4415
4436
|
* component:
|
|
4416
4437
|
* providers: [ {provide: String, useValue: 'component', multi: true} ],
|
|
4417
4438
|
* viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ],
|
|
@@ -4422,7 +4443,7 @@ class NodeInjectorFactory {
|
|
|
4422
4443
|
*
|
|
4423
4444
|
* Then the expected results are:
|
|
4424
4445
|
*
|
|
4425
|
-
* ```
|
|
4446
|
+
* ```ts
|
|
4426
4447
|
* providers: ['component', 'directive']
|
|
4427
4448
|
* viewProviders: ['component', 'componentView', 'directive']
|
|
4428
4449
|
* ```
|
|
@@ -4445,7 +4466,7 @@ class NodeInjectorFactory {
|
|
|
4445
4466
|
* Example:
|
|
4446
4467
|
*
|
|
4447
4468
|
* Given:
|
|
4448
|
-
* ```
|
|
4469
|
+
* ```ts
|
|
4449
4470
|
* providers: [ {provide: String, useValue: 'all', multi: true} ],
|
|
4450
4471
|
* viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ],
|
|
4451
4472
|
* ```
|
|
@@ -6140,14 +6161,14 @@ class PendingTasks {
|
|
|
6140
6161
|
return;
|
|
6141
6162
|
}
|
|
6142
6163
|
// Notifying the scheduler will hold application stability open until the next tick.
|
|
6143
|
-
this.scheduler.notify(
|
|
6164
|
+
this.scheduler.notify(12 /* NotificationSource.PendingTaskRemoved */);
|
|
6144
6165
|
this.internalPendingTasks.remove(taskId);
|
|
6145
6166
|
};
|
|
6146
6167
|
}
|
|
6147
6168
|
/**
|
|
6148
6169
|
* Runs an asynchronous function and blocks the application's stability until the function completes.
|
|
6149
6170
|
*
|
|
6150
|
-
* ```
|
|
6171
|
+
* ```ts
|
|
6151
6172
|
* pendingTasks.run(async () => {
|
|
6152
6173
|
* const userData = await fetch('/api/user');
|
|
6153
6174
|
* this.userData.set(userData);
|
|
@@ -6157,7 +6178,7 @@ class PendingTasks {
|
|
|
6157
6178
|
* Application stability is at least delayed until the next tick after the `run` method resolves
|
|
6158
6179
|
* so it is safe to make additional updates to application state that would require UI synchronization:
|
|
6159
6180
|
*
|
|
6160
|
-
* ```
|
|
6181
|
+
* ```ts
|
|
6161
6182
|
* const userData = await pendingTasks.run(() => fetch('/api/user'));
|
|
6162
6183
|
* this.userData.set(userData);
|
|
6163
6184
|
* ```
|
|
@@ -7087,6 +7108,76 @@ function unwrapElementRef(value) {
|
|
|
7087
7108
|
return value instanceof ElementRef ? value.nativeElement : value;
|
|
7088
7109
|
}
|
|
7089
7110
|
|
|
7111
|
+
const markedFeatures = new Set();
|
|
7112
|
+
// tslint:disable:ban
|
|
7113
|
+
/**
|
|
7114
|
+
* A guarded `performance.mark` for feature marking.
|
|
7115
|
+
*
|
|
7116
|
+
* This method exists because while all supported browser and node.js version supported by Angular
|
|
7117
|
+
* support performance.mark API. This is not the case for other environments such as JSDOM and
|
|
7118
|
+
* Cloudflare workers.
|
|
7119
|
+
*/
|
|
7120
|
+
function performanceMarkFeature(feature) {
|
|
7121
|
+
if (markedFeatures.has(feature)) {
|
|
7122
|
+
return;
|
|
7123
|
+
}
|
|
7124
|
+
markedFeatures.add(feature);
|
|
7125
|
+
performance?.mark?.('mark_feature_usage', { detail: { feature } });
|
|
7126
|
+
}
|
|
7127
|
+
|
|
7128
|
+
/**
|
|
7129
|
+
* Checks if the given `value` is a reactive `Signal`.
|
|
7130
|
+
*/
|
|
7131
|
+
function isSignal(value) {
|
|
7132
|
+
return typeof value === 'function' && value[SIGNAL$1] !== undefined;
|
|
7133
|
+
}
|
|
7134
|
+
|
|
7135
|
+
/** Symbol used distinguish `WritableSignal` from other non-writable signals and functions. */
|
|
7136
|
+
const ɵWRITABLE_SIGNAL = /* @__PURE__ */ Symbol('WRITABLE_SIGNAL');
|
|
7137
|
+
/**
|
|
7138
|
+
* Utility function used during template type checking to extract the value from a `WritableSignal`.
|
|
7139
|
+
* @codeGenApi
|
|
7140
|
+
*/
|
|
7141
|
+
function ɵunwrapWritableSignal(value) {
|
|
7142
|
+
// Note: the function uses `WRITABLE_SIGNAL` as a brand instead of `WritableSignal<T>`,
|
|
7143
|
+
// because the latter incorrectly unwraps non-signal getter functions.
|
|
7144
|
+
return null;
|
|
7145
|
+
}
|
|
7146
|
+
/**
|
|
7147
|
+
* Create a `Signal` that can be set or updated directly.
|
|
7148
|
+
*/
|
|
7149
|
+
function signal(initialValue, options) {
|
|
7150
|
+
performanceMarkFeature('NgSignals');
|
|
7151
|
+
const signalFn = createSignal$1(initialValue);
|
|
7152
|
+
const node = signalFn[SIGNAL$1];
|
|
7153
|
+
if (options?.equal) {
|
|
7154
|
+
node.equal = options.equal;
|
|
7155
|
+
}
|
|
7156
|
+
signalFn.set = (newValue) => signalSetFn$1(node, newValue);
|
|
7157
|
+
signalFn.update = (updateFn) => signalUpdateFn$1(node, updateFn);
|
|
7158
|
+
signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn);
|
|
7159
|
+
if (ngDevMode) {
|
|
7160
|
+
signalFn.toString = () => `[Signal: ${signalFn()}]`;
|
|
7161
|
+
node.debugName = options?.debugName;
|
|
7162
|
+
}
|
|
7163
|
+
return signalFn;
|
|
7164
|
+
}
|
|
7165
|
+
function signalAsReadonlyFn() {
|
|
7166
|
+
const node = this[SIGNAL$1];
|
|
7167
|
+
if (node.readonlyFn === undefined) {
|
|
7168
|
+
const readonlyFn = () => this();
|
|
7169
|
+
readonlyFn[SIGNAL$1] = node;
|
|
7170
|
+
node.readonlyFn = readonlyFn;
|
|
7171
|
+
}
|
|
7172
|
+
return node.readonlyFn;
|
|
7173
|
+
}
|
|
7174
|
+
/**
|
|
7175
|
+
* Checks if the given `value` is a writeable signal.
|
|
7176
|
+
*/
|
|
7177
|
+
function isWritableSignal(value) {
|
|
7178
|
+
return isSignal(value) && typeof value.set === 'function';
|
|
7179
|
+
}
|
|
7180
|
+
|
|
7090
7181
|
function symbolIterator() {
|
|
7091
7182
|
// @ts-expect-error accessing a private member
|
|
7092
7183
|
return this._results[Symbol.iterator]();
|
|
@@ -8476,15 +8567,8 @@ function retrieveTransferredState(doc, appId) {
|
|
|
8476
8567
|
const REFERENCE_NODE_HOST = 'h';
|
|
8477
8568
|
/** Encodes that the node lookup should start from the document body node. */
|
|
8478
8569
|
const REFERENCE_NODE_BODY = 'b';
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
* starting from a given (known) element.
|
|
8482
|
-
*/
|
|
8483
|
-
var NodeNavigationStep;
|
|
8484
|
-
(function (NodeNavigationStep) {
|
|
8485
|
-
NodeNavigationStep["FirstChild"] = "f";
|
|
8486
|
-
NodeNavigationStep["NextSibling"] = "n";
|
|
8487
|
-
})(NodeNavigationStep || (NodeNavigationStep = {}));
|
|
8570
|
+
const NODE_NAVIGATION_STEP_FIRST_CHILD = 'f';
|
|
8571
|
+
const NODE_NAVIGATION_STEP_NEXT_SIBLING = 'n';
|
|
8488
8572
|
/**
|
|
8489
8573
|
* Keys within serialized view data structure to represent various
|
|
8490
8574
|
* parts. See the `SerializedView` interface below for additional information.
|
|
@@ -8555,23 +8639,6 @@ var TracingAction;
|
|
|
8555
8639
|
*/
|
|
8556
8640
|
const TracingService = new InjectionToken(ngDevMode ? 'TracingService' : '');
|
|
8557
8641
|
|
|
8558
|
-
const markedFeatures = new Set();
|
|
8559
|
-
// tslint:disable:ban
|
|
8560
|
-
/**
|
|
8561
|
-
* A guarded `performance.mark` for feature marking.
|
|
8562
|
-
*
|
|
8563
|
-
* This method exists because while all supported browser and node.js version supported by Angular
|
|
8564
|
-
* support performance.mark API. This is not the case for other environments such as JSDOM and
|
|
8565
|
-
* Cloudflare workers.
|
|
8566
|
-
*/
|
|
8567
|
-
function performanceMarkFeature(feature) {
|
|
8568
|
-
if (markedFeatures.has(feature)) {
|
|
8569
|
-
return;
|
|
8570
|
-
}
|
|
8571
|
-
markedFeatures.add(feature);
|
|
8572
|
-
performance?.mark?.('mark_feature_usage', { detail: { feature } });
|
|
8573
|
-
}
|
|
8574
|
-
|
|
8575
8642
|
/**
|
|
8576
8643
|
* Asserts that the current stack frame is not within a reactive context. Useful
|
|
8577
8644
|
* to disallow certain code from running inside a reactive context (see {@link toSignal}).
|
|
@@ -8589,23 +8656,6 @@ function assertNotInReactiveContext(debugFn, extraContext) {
|
|
|
8589
8656
|
}
|
|
8590
8657
|
}
|
|
8591
8658
|
|
|
8592
|
-
class ViewContext {
|
|
8593
|
-
view;
|
|
8594
|
-
node;
|
|
8595
|
-
constructor(view, node) {
|
|
8596
|
-
this.view = view;
|
|
8597
|
-
this.node = node;
|
|
8598
|
-
}
|
|
8599
|
-
/**
|
|
8600
|
-
* @internal
|
|
8601
|
-
* @nocollapse
|
|
8602
|
-
*/
|
|
8603
|
-
static __NG_ELEMENT_ID__ = injectViewContext;
|
|
8604
|
-
}
|
|
8605
|
-
function injectViewContext() {
|
|
8606
|
-
return new ViewContext(getLView(), getCurrentTNode());
|
|
8607
|
-
}
|
|
8608
|
-
|
|
8609
8659
|
/**
|
|
8610
8660
|
* The phase to run an `afterRender` or `afterNextRender` callback in.
|
|
8611
8661
|
*
|
|
@@ -8736,32 +8786,21 @@ class AfterRenderImpl {
|
|
|
8736
8786
|
this.sequences.add(sequence);
|
|
8737
8787
|
}
|
|
8738
8788
|
if (this.deferredRegistrations.size > 0) {
|
|
8739
|
-
this.scheduler.notify(
|
|
8789
|
+
this.scheduler.notify(8 /* NotificationSource.DeferredRenderHook */);
|
|
8740
8790
|
}
|
|
8741
8791
|
this.deferredRegistrations.clear();
|
|
8742
8792
|
}
|
|
8743
8793
|
register(sequence) {
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
//
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
markAncestorsForTraversal(view);
|
|
8750
|
-
view[FLAGS] |= 8192 /* LViewFlags.HasChildViewsToRefresh */;
|
|
8751
|
-
}
|
|
8752
|
-
else if (!this.executing) {
|
|
8753
|
-
this.addSequence(sequence);
|
|
8794
|
+
if (!this.executing) {
|
|
8795
|
+
this.sequences.add(sequence);
|
|
8796
|
+
// Trigger an `ApplicationRef.tick()` if one is not already pending/running, because we have a
|
|
8797
|
+
// new render hook that needs to run.
|
|
8798
|
+
this.scheduler.notify(7 /* NotificationSource.RenderHook */);
|
|
8754
8799
|
}
|
|
8755
8800
|
else {
|
|
8756
8801
|
this.deferredRegistrations.add(sequence);
|
|
8757
8802
|
}
|
|
8758
8803
|
}
|
|
8759
|
-
addSequence(sequence) {
|
|
8760
|
-
this.sequences.add(sequence);
|
|
8761
|
-
// Trigger an `ApplicationRef.tick()` if one is not already pending/running, because we have a
|
|
8762
|
-
// new render hook that needs to run.
|
|
8763
|
-
this.scheduler.notify(7 /* NotificationSource.RenderHook */);
|
|
8764
|
-
}
|
|
8765
8804
|
unregister(sequence) {
|
|
8766
8805
|
if (this.executing && this.sequences.has(sequence)) {
|
|
8767
8806
|
// We can't remove an `AfterRenderSequence` in the middle of iteration.
|
|
@@ -8791,7 +8830,6 @@ class AfterRenderImpl {
|
|
|
8791
8830
|
class AfterRenderSequence {
|
|
8792
8831
|
impl;
|
|
8793
8832
|
hooks;
|
|
8794
|
-
view;
|
|
8795
8833
|
once;
|
|
8796
8834
|
snapshot;
|
|
8797
8835
|
/**
|
|
@@ -8805,10 +8843,9 @@ class AfterRenderSequence {
|
|
|
8805
8843
|
*/
|
|
8806
8844
|
pipelinedValue = undefined;
|
|
8807
8845
|
unregisterOnDestroy;
|
|
8808
|
-
constructor(impl, hooks,
|
|
8846
|
+
constructor(impl, hooks, once, destroyRef, snapshot = null) {
|
|
8809
8847
|
this.impl = impl;
|
|
8810
8848
|
this.hooks = hooks;
|
|
8811
|
-
this.view = view;
|
|
8812
8849
|
this.once = once;
|
|
8813
8850
|
this.snapshot = snapshot;
|
|
8814
8851
|
this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
|
|
@@ -8826,10 +8863,6 @@ class AfterRenderSequence {
|
|
|
8826
8863
|
destroy() {
|
|
8827
8864
|
this.impl.unregister(this);
|
|
8828
8865
|
this.unregisterOnDestroy?.();
|
|
8829
|
-
const scheduled = this.view?.[AFTER_RENDER_SEQUENCES_TO_ADD];
|
|
8830
|
-
if (scheduled) {
|
|
8831
|
-
this.view[AFTER_RENDER_SEQUENCES_TO_ADD] = scheduled.filter((s) => s !== this);
|
|
8832
|
-
}
|
|
8833
8866
|
}
|
|
8834
8867
|
}
|
|
8835
8868
|
|
|
@@ -8880,8 +8913,7 @@ function afterRenderImpl(callbackOrSpec, injector, options, once) {
|
|
|
8880
8913
|
const tracing = injector.get(TracingService, null, { optional: true });
|
|
8881
8914
|
const hooks = options?.phase ?? AfterRenderPhase.MixedReadWrite;
|
|
8882
8915
|
const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
|
|
8883
|
-
const
|
|
8884
|
-
const sequence = new AfterRenderSequence(manager.impl, getHooks(callbackOrSpec, hooks), viewContext?.view, once, destroyRef, tracing?.snapshot(null));
|
|
8916
|
+
const sequence = new AfterRenderSequence(manager.impl, getHooks(callbackOrSpec, hooks), once, destroyRef, tracing?.snapshot(null));
|
|
8885
8917
|
manager.impl.register(sequence);
|
|
8886
8918
|
return sequence;
|
|
8887
8919
|
}
|
|
@@ -9353,11 +9385,9 @@ function getTriggerElement(triggerLView, triggerIndex) {
|
|
|
9353
9385
|
function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, registerFn, callback, type) {
|
|
9354
9386
|
const injector = initialLView[INJECTOR];
|
|
9355
9387
|
const zone = injector.get(NgZone);
|
|
9356
|
-
let poll;
|
|
9357
9388
|
function pollDomTrigger() {
|
|
9358
9389
|
// If the initial view was destroyed, we don't need to do anything.
|
|
9359
9390
|
if (isDestroyed(initialLView)) {
|
|
9360
|
-
poll.destroy();
|
|
9361
9391
|
return;
|
|
9362
9392
|
}
|
|
9363
9393
|
const lDetails = getLDeferBlockDetails(initialLView, tNode);
|
|
@@ -9365,16 +9395,14 @@ function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, regi
|
|
|
9365
9395
|
// If the block was loaded before the trigger was resolved, we don't need to do anything.
|
|
9366
9396
|
if (renderedState !== DeferBlockInternalState.Initial &&
|
|
9367
9397
|
renderedState !== DeferBlockState.Placeholder) {
|
|
9368
|
-
poll.destroy();
|
|
9369
9398
|
return;
|
|
9370
9399
|
}
|
|
9371
9400
|
const triggerLView = getTriggerLView(initialLView, tNode, walkUpTimes);
|
|
9372
9401
|
// Keep polling until we resolve the trigger's LView.
|
|
9373
9402
|
if (!triggerLView) {
|
|
9374
|
-
|
|
9403
|
+
afterNextRender({ read: pollDomTrigger }, { injector });
|
|
9375
9404
|
return;
|
|
9376
9405
|
}
|
|
9377
|
-
poll.destroy();
|
|
9378
9406
|
// It's possible that the trigger's view was destroyed before we resolved the trigger element.
|
|
9379
9407
|
if (isDestroyed(triggerLView)) {
|
|
9380
9408
|
return;
|
|
@@ -9401,7 +9429,7 @@ function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, regi
|
|
|
9401
9429
|
storeTriggerCleanupFn(type, lDetails, cleanup);
|
|
9402
9430
|
}
|
|
9403
9431
|
// Begin polling for the trigger.
|
|
9404
|
-
|
|
9432
|
+
afterNextRender({ read: pollDomTrigger }, { injector });
|
|
9405
9433
|
}
|
|
9406
9434
|
|
|
9407
9435
|
const DEFER_BLOCK_SSR_ID_ATTRIBUTE = 'ngb';
|
|
@@ -10066,6 +10094,63 @@ function processBlockData(injector) {
|
|
|
10066
10094
|
return blockDetails;
|
|
10067
10095
|
}
|
|
10068
10096
|
|
|
10097
|
+
/** Refreshes all content queries declared by directives in a given view */
|
|
10098
|
+
function refreshContentQueries(tView, lView) {
|
|
10099
|
+
const contentQueries = tView.contentQueries;
|
|
10100
|
+
if (contentQueries !== null) {
|
|
10101
|
+
const prevConsumer = setActiveConsumer$1(null);
|
|
10102
|
+
try {
|
|
10103
|
+
for (let i = 0; i < contentQueries.length; i += 2) {
|
|
10104
|
+
const queryStartIdx = contentQueries[i];
|
|
10105
|
+
const directiveDefIdx = contentQueries[i + 1];
|
|
10106
|
+
if (directiveDefIdx !== -1) {
|
|
10107
|
+
const directiveDef = tView.data[directiveDefIdx];
|
|
10108
|
+
ngDevMode && assertDefined(directiveDef, 'DirectiveDef not found.');
|
|
10109
|
+
ngDevMode &&
|
|
10110
|
+
assertDefined(directiveDef.contentQueries, 'contentQueries function should be defined');
|
|
10111
|
+
setCurrentQueryIndex(queryStartIdx);
|
|
10112
|
+
directiveDef.contentQueries(2 /* RenderFlags.Update */, lView[directiveDefIdx], directiveDefIdx);
|
|
10113
|
+
}
|
|
10114
|
+
}
|
|
10115
|
+
}
|
|
10116
|
+
finally {
|
|
10117
|
+
setActiveConsumer$1(prevConsumer);
|
|
10118
|
+
}
|
|
10119
|
+
}
|
|
10120
|
+
}
|
|
10121
|
+
function executeViewQueryFn(flags, viewQueryFn, component) {
|
|
10122
|
+
ngDevMode && assertDefined(viewQueryFn, 'View queries function to execute must be defined.');
|
|
10123
|
+
setCurrentQueryIndex(0);
|
|
10124
|
+
const prevConsumer = setActiveConsumer$1(null);
|
|
10125
|
+
try {
|
|
10126
|
+
viewQueryFn(flags, component);
|
|
10127
|
+
}
|
|
10128
|
+
finally {
|
|
10129
|
+
setActiveConsumer$1(prevConsumer);
|
|
10130
|
+
}
|
|
10131
|
+
}
|
|
10132
|
+
function executeContentQueries(tView, tNode, lView) {
|
|
10133
|
+
if (isContentQueryHost(tNode)) {
|
|
10134
|
+
const prevConsumer = setActiveConsumer$1(null);
|
|
10135
|
+
try {
|
|
10136
|
+
const start = tNode.directiveStart;
|
|
10137
|
+
const end = tNode.directiveEnd;
|
|
10138
|
+
for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
|
10139
|
+
const def = tView.data[directiveIndex];
|
|
10140
|
+
if (def.contentQueries) {
|
|
10141
|
+
const directiveInstance = lView[directiveIndex];
|
|
10142
|
+
ngDevMode &&
|
|
10143
|
+
assertDefined(directiveIndex, 'Incorrect reference to a directive defining a content query');
|
|
10144
|
+
def.contentQueries(1 /* RenderFlags.Create */, directiveInstance, directiveIndex);
|
|
10145
|
+
}
|
|
10146
|
+
}
|
|
10147
|
+
}
|
|
10148
|
+
finally {
|
|
10149
|
+
setActiveConsumer$1(prevConsumer);
|
|
10150
|
+
}
|
|
10151
|
+
}
|
|
10152
|
+
}
|
|
10153
|
+
|
|
10069
10154
|
/**
|
|
10070
10155
|
* Defines the CSS styles encapsulation policies for the {@link Component} decorator's
|
|
10071
10156
|
* `encapsulation` option.
|
|
@@ -11715,7 +11800,7 @@ function detachViewFromDOM(tView, lView) {
|
|
|
11715
11800
|
// When we remove a view from the DOM, we need to rerun afterRender hooks
|
|
11716
11801
|
// We don't necessarily needs to run change detection. DOM removal only requires
|
|
11717
11802
|
// change detection if animations are enabled (this notification is handled by animations).
|
|
11718
|
-
lView[ENVIRONMENT].changeDetectionScheduler?.notify(
|
|
11803
|
+
lView[ENVIRONMENT].changeDetectionScheduler?.notify(10 /* NotificationSource.ViewDetachedFromDOM */);
|
|
11719
11804
|
applyView(tView, lView, lView[RENDERER], 2 /* WalkTNodeTreeAction.Detach */, null, null);
|
|
11720
11805
|
}
|
|
11721
11806
|
/**
|
|
@@ -11825,7 +11910,7 @@ function trackMovedView(declarationContainer, lView) {
|
|
|
11825
11910
|
const parent = lView[PARENT];
|
|
11826
11911
|
ngDevMode && assertDefined(parent, 'missing parent');
|
|
11827
11912
|
if (isLView(parent)) {
|
|
11828
|
-
declarationContainer[FLAGS] |= LContainerFlags.HasTransplantedViews
|
|
11913
|
+
declarationContainer[FLAGS] |= 2 /* LContainerFlags.HasTransplantedViews */;
|
|
11829
11914
|
}
|
|
11830
11915
|
else {
|
|
11831
11916
|
const insertedComponentLView = parent[PARENT][DECLARATION_COMPONENT_VIEW];
|
|
@@ -11836,7 +11921,7 @@ function trackMovedView(declarationContainer, lView) {
|
|
|
11836
11921
|
// At this point the declaration-component is not same as insertion-component; this means that
|
|
11837
11922
|
// this is a transplanted view. Mark the declared lView as having transplanted views so that
|
|
11838
11923
|
// those views can participate in CD.
|
|
11839
|
-
declarationContainer[FLAGS] |= LContainerFlags.HasTransplantedViews
|
|
11924
|
+
declarationContainer[FLAGS] |= 2 /* LContainerFlags.HasTransplantedViews */;
|
|
11840
11925
|
}
|
|
11841
11926
|
}
|
|
11842
11927
|
if (movedViews === null) {
|
|
@@ -13117,41 +13202,6 @@ function writeToDirectiveInput(def, instance, publicName, privateName, flags, va
|
|
|
13117
13202
|
}
|
|
13118
13203
|
}
|
|
13119
13204
|
|
|
13120
|
-
/**
|
|
13121
|
-
* Invoke `HostBindingsFunction`s for view.
|
|
13122
|
-
*
|
|
13123
|
-
* This methods executes `TView.hostBindingOpCodes`. It is used to execute the
|
|
13124
|
-
* `HostBindingsFunction`s associated with the current `LView`.
|
|
13125
|
-
*
|
|
13126
|
-
* @param tView Current `TView`.
|
|
13127
|
-
* @param lView Current `LView`.
|
|
13128
|
-
*/
|
|
13129
|
-
function processHostBindingOpCodes(tView, lView) {
|
|
13130
|
-
const hostBindingOpCodes = tView.hostBindingOpCodes;
|
|
13131
|
-
if (hostBindingOpCodes === null)
|
|
13132
|
-
return;
|
|
13133
|
-
try {
|
|
13134
|
-
for (let i = 0; i < hostBindingOpCodes.length; i++) {
|
|
13135
|
-
const opCode = hostBindingOpCodes[i];
|
|
13136
|
-
if (opCode < 0) {
|
|
13137
|
-
// Negative numbers are element indexes.
|
|
13138
|
-
setSelectedIndex(~opCode);
|
|
13139
|
-
}
|
|
13140
|
-
else {
|
|
13141
|
-
// Positive numbers are NumberTuple which store bindingRootIndex and directiveIndex.
|
|
13142
|
-
const directiveIdx = opCode;
|
|
13143
|
-
const bindingRootIndx = hostBindingOpCodes[++i];
|
|
13144
|
-
const hostBindingFn = hostBindingOpCodes[++i];
|
|
13145
|
-
setBindingRootForHostBindings(bindingRootIndx, directiveIdx);
|
|
13146
|
-
const context = lView[directiveIdx];
|
|
13147
|
-
hostBindingFn(2 /* RenderFlags.Update */, context);
|
|
13148
|
-
}
|
|
13149
|
-
}
|
|
13150
|
-
}
|
|
13151
|
-
finally {
|
|
13152
|
-
setSelectedIndex(-1);
|
|
13153
|
-
}
|
|
13154
|
-
}
|
|
13155
13205
|
function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
|
|
13156
13206
|
const lView = tView.blueprint.slice();
|
|
13157
13207
|
lView[HOST] = host;
|
|
@@ -13298,30 +13348,6 @@ function executeTemplate(tView, lView, templateFn, rf, context) {
|
|
|
13298
13348
|
profiler(postHookType, context);
|
|
13299
13349
|
}
|
|
13300
13350
|
}
|
|
13301
|
-
//////////////////////////
|
|
13302
|
-
//// Element
|
|
13303
|
-
//////////////////////////
|
|
13304
|
-
function executeContentQueries(tView, tNode, lView) {
|
|
13305
|
-
if (isContentQueryHost(tNode)) {
|
|
13306
|
-
const prevConsumer = setActiveConsumer$1(null);
|
|
13307
|
-
try {
|
|
13308
|
-
const start = tNode.directiveStart;
|
|
13309
|
-
const end = tNode.directiveEnd;
|
|
13310
|
-
for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
|
13311
|
-
const def = tView.data[directiveIndex];
|
|
13312
|
-
if (def.contentQueries) {
|
|
13313
|
-
const directiveInstance = lView[directiveIndex];
|
|
13314
|
-
ngDevMode &&
|
|
13315
|
-
assertDefined(directiveIndex, 'Incorrect reference to a directive defining a content query');
|
|
13316
|
-
def.contentQueries(1 /* RenderFlags.Create */, directiveInstance, directiveIndex);
|
|
13317
|
-
}
|
|
13318
|
-
}
|
|
13319
|
-
}
|
|
13320
|
-
finally {
|
|
13321
|
-
setActiveConsumer$1(prevConsumer);
|
|
13322
|
-
}
|
|
13323
|
-
}
|
|
13324
|
-
}
|
|
13325
13351
|
/**
|
|
13326
13352
|
* Creates directive instances.
|
|
13327
13353
|
*/
|
|
@@ -13503,33 +13529,6 @@ function applyRootElementTransformImpl(rootElement) {
|
|
|
13503
13529
|
function enableApplyRootElementTransformImpl() {
|
|
13504
13530
|
_applyRootElementTransformImpl = applyRootElementTransformImpl;
|
|
13505
13531
|
}
|
|
13506
|
-
/**
|
|
13507
|
-
* Saves context for this cleanup function in LView.cleanupInstances.
|
|
13508
|
-
*
|
|
13509
|
-
* On the first template pass, saves in TView:
|
|
13510
|
-
* - Cleanup function
|
|
13511
|
-
* - Index of context we just saved in LView.cleanupInstances
|
|
13512
|
-
*/
|
|
13513
|
-
function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
|
13514
|
-
const lCleanup = getOrCreateLViewCleanup(lView);
|
|
13515
|
-
// Historically the `storeCleanupWithContext` was used to register both framework-level and
|
|
13516
|
-
// user-defined cleanup callbacks, but over time those two types of cleanups were separated.
|
|
13517
|
-
// This dev mode checks assures that user-level cleanup callbacks are _not_ stored in data
|
|
13518
|
-
// structures reserved for framework-specific hooks.
|
|
13519
|
-
ngDevMode &&
|
|
13520
|
-
assertDefined(context, 'Cleanup context is mandatory when registering framework-level destroy hooks');
|
|
13521
|
-
lCleanup.push(context);
|
|
13522
|
-
if (tView.firstCreatePass) {
|
|
13523
|
-
getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
|
13524
|
-
}
|
|
13525
|
-
else {
|
|
13526
|
-
// Make sure that no new framework-level cleanup functions are registered after the first
|
|
13527
|
-
// template pass is done (and TView data structures are meant to fully constructed).
|
|
13528
|
-
if (ngDevMode) {
|
|
13529
|
-
Object.freeze(getOrCreateTViewCleanup(tView));
|
|
13530
|
-
}
|
|
13531
|
-
}
|
|
13532
|
-
}
|
|
13533
13532
|
function createTNode(tView, tParent, type, index, value, attrs) {
|
|
13534
13533
|
ngDevMode &&
|
|
13535
13534
|
index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
|
|
@@ -14273,30 +14272,6 @@ function createLContainer(hostNative, currentView, native, tNode) {
|
|
|
14273
14272
|
assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, 'Should allocate correct number of slots for LContainer header.');
|
|
14274
14273
|
return lContainer;
|
|
14275
14274
|
}
|
|
14276
|
-
/** Refreshes all content queries declared by directives in a given view */
|
|
14277
|
-
function refreshContentQueries(tView, lView) {
|
|
14278
|
-
const contentQueries = tView.contentQueries;
|
|
14279
|
-
if (contentQueries !== null) {
|
|
14280
|
-
const prevConsumer = setActiveConsumer$1(null);
|
|
14281
|
-
try {
|
|
14282
|
-
for (let i = 0; i < contentQueries.length; i += 2) {
|
|
14283
|
-
const queryStartIdx = contentQueries[i];
|
|
14284
|
-
const directiveDefIdx = contentQueries[i + 1];
|
|
14285
|
-
if (directiveDefIdx !== -1) {
|
|
14286
|
-
const directiveDef = tView.data[directiveDefIdx];
|
|
14287
|
-
ngDevMode && assertDefined(directiveDef, 'DirectiveDef not found.');
|
|
14288
|
-
ngDevMode &&
|
|
14289
|
-
assertDefined(directiveDef.contentQueries, 'contentQueries function should be defined');
|
|
14290
|
-
setCurrentQueryIndex(queryStartIdx);
|
|
14291
|
-
directiveDef.contentQueries(2 /* RenderFlags.Update */, lView[directiveDefIdx], directiveDefIdx);
|
|
14292
|
-
}
|
|
14293
|
-
}
|
|
14294
|
-
}
|
|
14295
|
-
finally {
|
|
14296
|
-
setActiveConsumer$1(prevConsumer);
|
|
14297
|
-
}
|
|
14298
|
-
}
|
|
14299
|
-
}
|
|
14300
14275
|
/**
|
|
14301
14276
|
* Adds LView or LContainer to the end of the current view tree.
|
|
14302
14277
|
*
|
|
@@ -14323,20 +14298,6 @@ function addToEndOfViewTree(lView, lViewOrLContainer) {
|
|
|
14323
14298
|
return lViewOrLContainer;
|
|
14324
14299
|
}
|
|
14325
14300
|
///////////////////////////////
|
|
14326
|
-
//// Change detection
|
|
14327
|
-
///////////////////////////////
|
|
14328
|
-
function executeViewQueryFn(flags, viewQueryFn, component) {
|
|
14329
|
-
ngDevMode && assertDefined(viewQueryFn, 'View queries function to execute must be defined.');
|
|
14330
|
-
setCurrentQueryIndex(0);
|
|
14331
|
-
const prevConsumer = setActiveConsumer$1(null);
|
|
14332
|
-
try {
|
|
14333
|
-
viewQueryFn(flags, component);
|
|
14334
|
-
}
|
|
14335
|
-
finally {
|
|
14336
|
-
setActiveConsumer$1(prevConsumer);
|
|
14337
|
-
}
|
|
14338
|
-
}
|
|
14339
|
-
///////////////////////////////
|
|
14340
14301
|
//// Bindings & interpolations
|
|
14341
14302
|
///////////////////////////////
|
|
14342
14303
|
/**
|
|
@@ -14377,13 +14338,6 @@ function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex,
|
|
|
14377
14338
|
}
|
|
14378
14339
|
}
|
|
14379
14340
|
}
|
|
14380
|
-
function getOrCreateLViewCleanup(view) {
|
|
14381
|
-
// top level variables should not be exported for performance reasons (PERF_NOTES.md)
|
|
14382
|
-
return (view[CLEANUP] ??= []);
|
|
14383
|
-
}
|
|
14384
|
-
function getOrCreateTViewCleanup(tView) {
|
|
14385
|
-
return (tView.cleanup ??= []);
|
|
14386
|
-
}
|
|
14387
14341
|
/**
|
|
14388
14342
|
* There are cases where the sub component's renderer needs to be included
|
|
14389
14343
|
* instead of the current renderer (see the componentSyntheticHost* instructions).
|
|
@@ -14426,17 +14380,6 @@ function setInputsForProperty(tView, lView, inputs, publicName, value) {
|
|
|
14426
14380
|
writeToDirectiveInput(def, instance, publicName, privateName, flags, value);
|
|
14427
14381
|
}
|
|
14428
14382
|
}
|
|
14429
|
-
/**
|
|
14430
|
-
* Updates a text binding at a given index in a given LView.
|
|
14431
|
-
*/
|
|
14432
|
-
function textBindingInternal(lView, index, value) {
|
|
14433
|
-
ngDevMode && assertString(value, 'Value should be a string');
|
|
14434
|
-
ngDevMode && assertNotSame(value, NO_CHANGE, 'value should not be NO_CHANGE');
|
|
14435
|
-
ngDevMode && assertIndexInRange(lView, index);
|
|
14436
|
-
const element = getNativeByIndex(index, lView);
|
|
14437
|
-
ngDevMode && assertDefined(element, 'native element should exist');
|
|
14438
|
-
updateTextNode(lView[RENDERER], element, value);
|
|
14439
|
-
}
|
|
14440
14383
|
|
|
14441
14384
|
function renderComponent(hostLView, componentHostIdx) {
|
|
14442
14385
|
ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode');
|
|
@@ -14702,15 +14645,6 @@ function collectNativeNodesInLContainer(lContainer, result) {
|
|
|
14702
14645
|
}
|
|
14703
14646
|
}
|
|
14704
14647
|
|
|
14705
|
-
function addAfterRenderSequencesForView(lView) {
|
|
14706
|
-
if (lView[AFTER_RENDER_SEQUENCES_TO_ADD] !== null) {
|
|
14707
|
-
for (const sequence of lView[AFTER_RENDER_SEQUENCES_TO_ADD]) {
|
|
14708
|
-
sequence.impl.addSequence(sequence);
|
|
14709
|
-
}
|
|
14710
|
-
lView[AFTER_RENDER_SEQUENCES_TO_ADD].length = 0;
|
|
14711
|
-
}
|
|
14712
|
-
}
|
|
14713
|
-
|
|
14714
14648
|
let freeConsumers = [];
|
|
14715
14649
|
/**
|
|
14716
14650
|
* Create a new template consumer pointing at the specified LView.
|
|
@@ -15056,7 +14990,6 @@ function refreshView(tView, lView, templateFn, context) {
|
|
|
15056
14990
|
// no changes cycle, the component would be not be dirty for the next update pass. This would
|
|
15057
14991
|
// be different in production mode where the component dirty state is not reset.
|
|
15058
14992
|
if (!isInCheckNoChangesPass) {
|
|
15059
|
-
addAfterRenderSequencesForView(lView);
|
|
15060
14993
|
lView[FLAGS] &= ~(64 /* LViewFlags.Dirty */ | 8 /* LViewFlags.FirstLViewPass */);
|
|
15061
14994
|
}
|
|
15062
14995
|
}
|
|
@@ -15099,7 +15032,7 @@ function detectChangesInEmbeddedViews(lView, mode) {
|
|
|
15099
15032
|
*/
|
|
15100
15033
|
function markTransplantedViewsForRefresh(lView) {
|
|
15101
15034
|
for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
|
15102
|
-
if (!(lContainer[FLAGS] & LContainerFlags.HasTransplantedViews))
|
|
15035
|
+
if (!(lContainer[FLAGS] & 2 /* LContainerFlags.HasTransplantedViews */))
|
|
15103
15036
|
continue;
|
|
15104
15037
|
const movedViews = lContainer[MOVED_VIEWS];
|
|
15105
15038
|
ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
|
|
@@ -15172,17 +15105,12 @@ function detectChangesInView(lView, mode) {
|
|
|
15172
15105
|
refreshView(tView, lView, tView.template, lView[CONTEXT]);
|
|
15173
15106
|
}
|
|
15174
15107
|
else if (flags & 8192 /* LViewFlags.HasChildViewsToRefresh */) {
|
|
15175
|
-
|
|
15176
|
-
runEffectsInView(lView);
|
|
15177
|
-
}
|
|
15108
|
+
runEffectsInView(lView);
|
|
15178
15109
|
detectChangesInEmbeddedViews(lView, 1 /* ChangeDetectionMode.Targeted */);
|
|
15179
15110
|
const components = tView.components;
|
|
15180
15111
|
if (components !== null) {
|
|
15181
15112
|
detectChangesInChildComponents(lView, components, 1 /* ChangeDetectionMode.Targeted */);
|
|
15182
15113
|
}
|
|
15183
|
-
if (!isInCheckNoChangesPass) {
|
|
15184
|
-
addAfterRenderSequencesForView(lView);
|
|
15185
|
-
}
|
|
15186
15114
|
}
|
|
15187
15115
|
}
|
|
15188
15116
|
/** Refreshes child components in the current view (update mode). */
|
|
@@ -15191,6 +15119,43 @@ function detectChangesInChildComponents(hostLView, components, mode) {
|
|
|
15191
15119
|
detectChangesInComponent(hostLView, components[i], mode);
|
|
15192
15120
|
}
|
|
15193
15121
|
}
|
|
15122
|
+
/**
|
|
15123
|
+
* Invoke `HostBindingsFunction`s for view.
|
|
15124
|
+
*
|
|
15125
|
+
* This methods executes `TView.hostBindingOpCodes`. It is used to execute the
|
|
15126
|
+
* `HostBindingsFunction`s associated with the current `LView`.
|
|
15127
|
+
*
|
|
15128
|
+
* @param tView Current `TView`.
|
|
15129
|
+
* @param lView Current `LView`.
|
|
15130
|
+
*/
|
|
15131
|
+
function processHostBindingOpCodes(tView, lView) {
|
|
15132
|
+
const hostBindingOpCodes = tView.hostBindingOpCodes;
|
|
15133
|
+
if (hostBindingOpCodes === null)
|
|
15134
|
+
return;
|
|
15135
|
+
try {
|
|
15136
|
+
for (let i = 0; i < hostBindingOpCodes.length; i++) {
|
|
15137
|
+
const opCode = hostBindingOpCodes[i];
|
|
15138
|
+
if (opCode < 0) {
|
|
15139
|
+
// Negative numbers are element indexes.
|
|
15140
|
+
setSelectedIndex(~opCode);
|
|
15141
|
+
}
|
|
15142
|
+
else {
|
|
15143
|
+
// Positive numbers are NumberTuple which store bindingRootIndex and directiveIndex.
|
|
15144
|
+
const directiveIdx = opCode;
|
|
15145
|
+
const bindingRootIndx = hostBindingOpCodes[++i];
|
|
15146
|
+
const hostBindingFn = hostBindingOpCodes[++i];
|
|
15147
|
+
setBindingRootForHostBindings(bindingRootIndx, directiveIdx);
|
|
15148
|
+
const context = lView[directiveIdx];
|
|
15149
|
+
profiler(24 /* ProfilerEvent.HostBindingsUpdateStart */, context);
|
|
15150
|
+
hostBindingFn(2 /* RenderFlags.Update */, context);
|
|
15151
|
+
profiler(25 /* ProfilerEvent.HostBindingsUpdateEnd */, context);
|
|
15152
|
+
}
|
|
15153
|
+
}
|
|
15154
|
+
}
|
|
15155
|
+
finally {
|
|
15156
|
+
setSelectedIndex(-1);
|
|
15157
|
+
}
|
|
15158
|
+
}
|
|
15194
15159
|
|
|
15195
15160
|
/**
|
|
15196
15161
|
* Marks current view and all ancestors dirty.
|
|
@@ -16285,7 +16250,7 @@ function loadIcuContainerVisitor() {
|
|
|
16285
16250
|
* to determine which root belong to the ICU.
|
|
16286
16251
|
*
|
|
16287
16252
|
* Example of usage.
|
|
16288
|
-
* ```
|
|
16253
|
+
* ```ts
|
|
16289
16254
|
* const nextRNode = icuContainerIteratorStart(tIcuContainerNode, lView);
|
|
16290
16255
|
* let rNode: RNode|null;
|
|
16291
16256
|
* while(rNode = nextRNode()) {
|
|
@@ -16516,7 +16481,7 @@ function stringifyNavigationInstructions(instructions) {
|
|
|
16516
16481
|
const step = instructions[i];
|
|
16517
16482
|
const repeat = instructions[i + 1];
|
|
16518
16483
|
for (let r = 0; r < repeat; r++) {
|
|
16519
|
-
container.push(step ===
|
|
16484
|
+
container.push(step === NODE_NAVIGATION_STEP_FIRST_CHILD ? 'firstChild' : 'nextSibling');
|
|
16520
16485
|
}
|
|
16521
16486
|
}
|
|
16522
16487
|
return container.join('.');
|
|
@@ -16535,10 +16500,10 @@ function navigateToNode(from, instructions) {
|
|
|
16535
16500
|
throw nodeNotFoundAtPathError(from, stringifyNavigationInstructions(instructions));
|
|
16536
16501
|
}
|
|
16537
16502
|
switch (step) {
|
|
16538
|
-
case
|
|
16503
|
+
case NODE_NAVIGATION_STEP_FIRST_CHILD:
|
|
16539
16504
|
node = node.firstChild;
|
|
16540
16505
|
break;
|
|
16541
|
-
case
|
|
16506
|
+
case NODE_NAVIGATION_STEP_NEXT_SIBLING:
|
|
16542
16507
|
node = node.nextSibling;
|
|
16543
16508
|
break;
|
|
16544
16509
|
}
|
|
@@ -16596,7 +16561,7 @@ function navigateBetween(start, finish) {
|
|
|
16596
16561
|
// First navigate to `finish`'s parent
|
|
16597
16562
|
...parentPath,
|
|
16598
16563
|
// Then to its first child.
|
|
16599
|
-
|
|
16564
|
+
NODE_NAVIGATION_STEP_FIRST_CHILD,
|
|
16600
16565
|
// And finally from that node to `finish` (maybe a no-op if we're already there).
|
|
16601
16566
|
...childPath,
|
|
16602
16567
|
];
|
|
@@ -16610,7 +16575,7 @@ function navigateBetweenSiblings(start, finish) {
|
|
|
16610
16575
|
const nav = [];
|
|
16611
16576
|
let node = null;
|
|
16612
16577
|
for (node = start; node != null && node !== finish; node = node.nextSibling) {
|
|
16613
|
-
nav.push(
|
|
16578
|
+
nav.push(NODE_NAVIGATION_STEP_NEXT_SIBLING);
|
|
16614
16579
|
}
|
|
16615
16580
|
// If the `node` becomes `null` or `undefined` at the end, that means that we
|
|
16616
16581
|
// didn't find the `end` node, thus return `null` (which would trigger serialization
|
|
@@ -18167,7 +18132,7 @@ function createRootComponent(componentView, rootComponentDef, rootDirectives, ho
|
|
|
18167
18132
|
function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
|
|
18168
18133
|
if (rootSelectorOrNode) {
|
|
18169
18134
|
// The placeholder will be replaced with the actual version at build time.
|
|
18170
|
-
setUpAttributes(hostRenderer, hostRNode, ['ng-version', '19.1.
|
|
18135
|
+
setUpAttributes(hostRenderer, hostRNode, ['ng-version', '19.1.1']);
|
|
18171
18136
|
}
|
|
18172
18137
|
else {
|
|
18173
18138
|
// If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
|
|
@@ -19079,59 +19044,6 @@ function getQueryResults(lView, queryIndex) {
|
|
|
19079
19044
|
: materializeViewResults(tView, lView, tQuery, queryIndex);
|
|
19080
19045
|
}
|
|
19081
19046
|
|
|
19082
|
-
/**
|
|
19083
|
-
* Checks if the given `value` is a reactive `Signal`.
|
|
19084
|
-
*/
|
|
19085
|
-
function isSignal(value) {
|
|
19086
|
-
return typeof value === 'function' && value[SIGNAL$1] !== undefined;
|
|
19087
|
-
}
|
|
19088
|
-
|
|
19089
|
-
/** Symbol used distinguish `WritableSignal` from other non-writable signals and functions. */
|
|
19090
|
-
const ɵWRITABLE_SIGNAL = /* @__PURE__ */ Symbol('WRITABLE_SIGNAL');
|
|
19091
|
-
/**
|
|
19092
|
-
* Utility function used during template type checking to extract the value from a `WritableSignal`.
|
|
19093
|
-
* @codeGenApi
|
|
19094
|
-
*/
|
|
19095
|
-
function ɵunwrapWritableSignal(value) {
|
|
19096
|
-
// Note: the function uses `WRITABLE_SIGNAL` as a brand instead of `WritableSignal<T>`,
|
|
19097
|
-
// because the latter incorrectly unwraps non-signal getter functions.
|
|
19098
|
-
return null;
|
|
19099
|
-
}
|
|
19100
|
-
/**
|
|
19101
|
-
* Create a `Signal` that can be set or updated directly.
|
|
19102
|
-
*/
|
|
19103
|
-
function signal(initialValue, options) {
|
|
19104
|
-
performanceMarkFeature('NgSignals');
|
|
19105
|
-
const signalFn = createSignal$1(initialValue);
|
|
19106
|
-
const node = signalFn[SIGNAL$1];
|
|
19107
|
-
if (options?.equal) {
|
|
19108
|
-
node.equal = options.equal;
|
|
19109
|
-
}
|
|
19110
|
-
signalFn.set = (newValue) => signalSetFn$1(node, newValue);
|
|
19111
|
-
signalFn.update = (updateFn) => signalUpdateFn$1(node, updateFn);
|
|
19112
|
-
signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn);
|
|
19113
|
-
if (ngDevMode) {
|
|
19114
|
-
signalFn.toString = () => `[Signal: ${signalFn()}]`;
|
|
19115
|
-
node.debugName = options?.debugName;
|
|
19116
|
-
}
|
|
19117
|
-
return signalFn;
|
|
19118
|
-
}
|
|
19119
|
-
function signalAsReadonlyFn() {
|
|
19120
|
-
const node = this[SIGNAL$1];
|
|
19121
|
-
if (node.readonlyFn === undefined) {
|
|
19122
|
-
const readonlyFn = () => this();
|
|
19123
|
-
readonlyFn[SIGNAL$1] = node;
|
|
19124
|
-
node.readonlyFn = readonlyFn;
|
|
19125
|
-
}
|
|
19126
|
-
return node.readonlyFn;
|
|
19127
|
-
}
|
|
19128
|
-
/**
|
|
19129
|
-
* Checks if the given `value` is a writeable signal.
|
|
19130
|
-
*/
|
|
19131
|
-
function isWritableSignal(value) {
|
|
19132
|
-
return isSignal(value) && typeof value.set === 'function';
|
|
19133
|
-
}
|
|
19134
|
-
|
|
19135
19047
|
/**
|
|
19136
19048
|
* A signal factory function in charge of creating a new computed signal capturing query
|
|
19137
19049
|
* results. This centralized creation function is used by all types of queries (child / children,
|
|
@@ -23102,77 +23014,6 @@ function isSubscribable(obj) {
|
|
|
23102
23014
|
return !!obj && typeof obj.subscribe === 'function';
|
|
23103
23015
|
}
|
|
23104
23016
|
|
|
23105
|
-
/**
|
|
23106
|
-
* A scheduler which manages the execution of effects.
|
|
23107
|
-
*/
|
|
23108
|
-
class EffectScheduler {
|
|
23109
|
-
/** @nocollapse */
|
|
23110
|
-
static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({
|
|
23111
|
-
token: EffectScheduler,
|
|
23112
|
-
providedIn: 'root',
|
|
23113
|
-
factory: () => new ZoneAwareEffectScheduler(),
|
|
23114
|
-
});
|
|
23115
|
-
}
|
|
23116
|
-
/**
|
|
23117
|
-
* A wrapper around `ZoneAwareQueueingScheduler` that schedules flushing via the microtask queue
|
|
23118
|
-
* when.
|
|
23119
|
-
*/
|
|
23120
|
-
class ZoneAwareEffectScheduler {
|
|
23121
|
-
queuedEffectCount = 0;
|
|
23122
|
-
queues = new Map();
|
|
23123
|
-
schedule(handle) {
|
|
23124
|
-
this.enqueue(handle);
|
|
23125
|
-
}
|
|
23126
|
-
remove(handle) {
|
|
23127
|
-
const zone = handle.zone;
|
|
23128
|
-
const queue = this.queues.get(zone);
|
|
23129
|
-
if (!queue.has(handle)) {
|
|
23130
|
-
return;
|
|
23131
|
-
}
|
|
23132
|
-
queue.delete(handle);
|
|
23133
|
-
this.queuedEffectCount--;
|
|
23134
|
-
}
|
|
23135
|
-
enqueue(handle) {
|
|
23136
|
-
const zone = handle.zone;
|
|
23137
|
-
if (!this.queues.has(zone)) {
|
|
23138
|
-
this.queues.set(zone, new Set());
|
|
23139
|
-
}
|
|
23140
|
-
const queue = this.queues.get(zone);
|
|
23141
|
-
if (queue.has(handle)) {
|
|
23142
|
-
return;
|
|
23143
|
-
}
|
|
23144
|
-
this.queuedEffectCount++;
|
|
23145
|
-
queue.add(handle);
|
|
23146
|
-
}
|
|
23147
|
-
/**
|
|
23148
|
-
* Run all scheduled effects.
|
|
23149
|
-
*
|
|
23150
|
-
* Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
|
|
23151
|
-
* ordering guarantee between effects scheduled in different zones.
|
|
23152
|
-
*/
|
|
23153
|
-
flush() {
|
|
23154
|
-
while (this.queuedEffectCount > 0) {
|
|
23155
|
-
for (const [zone, queue] of this.queues) {
|
|
23156
|
-
// `zone` here must be defined.
|
|
23157
|
-
if (zone === null) {
|
|
23158
|
-
this.flushQueue(queue);
|
|
23159
|
-
}
|
|
23160
|
-
else {
|
|
23161
|
-
zone.run(() => this.flushQueue(queue));
|
|
23162
|
-
}
|
|
23163
|
-
}
|
|
23164
|
-
}
|
|
23165
|
-
}
|
|
23166
|
-
flushQueue(queue) {
|
|
23167
|
-
for (const handle of queue) {
|
|
23168
|
-
queue.delete(handle);
|
|
23169
|
-
this.queuedEffectCount--;
|
|
23170
|
-
// TODO: what happens if this throws an error?
|
|
23171
|
-
handle.run();
|
|
23172
|
-
}
|
|
23173
|
-
}
|
|
23174
|
-
}
|
|
23175
|
-
|
|
23176
23017
|
/**
|
|
23177
23018
|
* A DI token that you can use to provide
|
|
23178
23019
|
* one or more initialization functions.
|
|
@@ -23417,6 +23258,77 @@ class ApplicationInitStatus {
|
|
|
23417
23258
|
args: [{ providedIn: 'root' }]
|
|
23418
23259
|
}], () => [], null); })();
|
|
23419
23260
|
|
|
23261
|
+
/**
|
|
23262
|
+
* A scheduler which manages the execution of effects.
|
|
23263
|
+
*/
|
|
23264
|
+
class EffectScheduler {
|
|
23265
|
+
/** @nocollapse */
|
|
23266
|
+
static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({
|
|
23267
|
+
token: EffectScheduler,
|
|
23268
|
+
providedIn: 'root',
|
|
23269
|
+
factory: () => new ZoneAwareEffectScheduler(),
|
|
23270
|
+
});
|
|
23271
|
+
}
|
|
23272
|
+
/**
|
|
23273
|
+
* A wrapper around `ZoneAwareQueueingScheduler` that schedules flushing via the microtask queue
|
|
23274
|
+
* when.
|
|
23275
|
+
*/
|
|
23276
|
+
class ZoneAwareEffectScheduler {
|
|
23277
|
+
queuedEffectCount = 0;
|
|
23278
|
+
queues = new Map();
|
|
23279
|
+
schedule(handle) {
|
|
23280
|
+
this.enqueue(handle);
|
|
23281
|
+
}
|
|
23282
|
+
remove(handle) {
|
|
23283
|
+
const zone = handle.zone;
|
|
23284
|
+
const queue = this.queues.get(zone);
|
|
23285
|
+
if (!queue.has(handle)) {
|
|
23286
|
+
return;
|
|
23287
|
+
}
|
|
23288
|
+
queue.delete(handle);
|
|
23289
|
+
this.queuedEffectCount--;
|
|
23290
|
+
}
|
|
23291
|
+
enqueue(handle) {
|
|
23292
|
+
const zone = handle.zone;
|
|
23293
|
+
if (!this.queues.has(zone)) {
|
|
23294
|
+
this.queues.set(zone, new Set());
|
|
23295
|
+
}
|
|
23296
|
+
const queue = this.queues.get(zone);
|
|
23297
|
+
if (queue.has(handle)) {
|
|
23298
|
+
return;
|
|
23299
|
+
}
|
|
23300
|
+
this.queuedEffectCount++;
|
|
23301
|
+
queue.add(handle);
|
|
23302
|
+
}
|
|
23303
|
+
/**
|
|
23304
|
+
* Run all scheduled effects.
|
|
23305
|
+
*
|
|
23306
|
+
* Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
|
|
23307
|
+
* ordering guarantee between effects scheduled in different zones.
|
|
23308
|
+
*/
|
|
23309
|
+
flush() {
|
|
23310
|
+
while (this.queuedEffectCount > 0) {
|
|
23311
|
+
for (const [zone, queue] of this.queues) {
|
|
23312
|
+
// `zone` here must be defined.
|
|
23313
|
+
if (zone === null) {
|
|
23314
|
+
this.flushQueue(queue);
|
|
23315
|
+
}
|
|
23316
|
+
else {
|
|
23317
|
+
zone.run(() => this.flushQueue(queue));
|
|
23318
|
+
}
|
|
23319
|
+
}
|
|
23320
|
+
}
|
|
23321
|
+
}
|
|
23322
|
+
flushQueue(queue) {
|
|
23323
|
+
for (const handle of queue) {
|
|
23324
|
+
queue.delete(handle);
|
|
23325
|
+
this.queuedEffectCount--;
|
|
23326
|
+
// TODO: what happens if this throws an error?
|
|
23327
|
+
handle.run();
|
|
23328
|
+
}
|
|
23329
|
+
}
|
|
23330
|
+
}
|
|
23331
|
+
|
|
23420
23332
|
/**
|
|
23421
23333
|
* A DI token that provides a set of callbacks to
|
|
23422
23334
|
* be called for every component that is bootstrapped.
|
|
@@ -23594,6 +23506,12 @@ class ApplicationRef {
|
|
|
23594
23506
|
* @internal
|
|
23595
23507
|
*/
|
|
23596
23508
|
dirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
|
|
23509
|
+
/**
|
|
23510
|
+
* Like `dirtyFlags` but don't cause `tick()` to loop.
|
|
23511
|
+
*
|
|
23512
|
+
* @internal
|
|
23513
|
+
*/
|
|
23514
|
+
deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
|
|
23597
23515
|
/**
|
|
23598
23516
|
* Most recent snapshot from the `TracingService`, if any.
|
|
23599
23517
|
*
|
|
@@ -23800,6 +23718,9 @@ class ApplicationRef {
|
|
|
23800
23718
|
if (this._rendererFactory === null && !this._injector.destroyed) {
|
|
23801
23719
|
this._rendererFactory = this._injector.get(RendererFactory2, null, { optional: true });
|
|
23802
23720
|
}
|
|
23721
|
+
// When beginning synchronization, all deferred dirtiness becomes active dirtiness.
|
|
23722
|
+
this.dirtyFlags |= this.deferredDirtyFlags;
|
|
23723
|
+
this.deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
|
|
23803
23724
|
let runs = 0;
|
|
23804
23725
|
while (this.dirtyFlags !== 0 /* ApplicationRefDirtyFlags.None */ && runs++ < MAXIMUM_REFRESH_RERUNS) {
|
|
23805
23726
|
this.synchronizeOnce();
|
|
@@ -23815,6 +23736,9 @@ class ApplicationRef {
|
|
|
23815
23736
|
* Perform a single synchronization pass.
|
|
23816
23737
|
*/
|
|
23817
23738
|
synchronizeOnce() {
|
|
23739
|
+
// If we happened to loop, deferred dirtiness can be processed as active dirtiness again.
|
|
23740
|
+
this.dirtyFlags |= this.deferredDirtyFlags;
|
|
23741
|
+
this.deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
|
|
23818
23742
|
// First, process any dirty root effects.
|
|
23819
23743
|
if (this.dirtyFlags & 16 /* ApplicationRefDirtyFlags.RootEffects */) {
|
|
23820
23744
|
this.dirtyFlags &= ~16 /* ApplicationRefDirtyFlags.RootEffects */;
|
|
@@ -32340,6 +32264,17 @@ function ɵɵtextInterpolateV(values) {
|
|
|
32340
32264
|
}
|
|
32341
32265
|
return ɵɵtextInterpolateV;
|
|
32342
32266
|
}
|
|
32267
|
+
/**
|
|
32268
|
+
* Updates a text binding at a given index in a given LView.
|
|
32269
|
+
*/
|
|
32270
|
+
function textBindingInternal(lView, index, value) {
|
|
32271
|
+
ngDevMode && assertString(value, 'Value should be a string');
|
|
32272
|
+
ngDevMode && assertNotSame(value, NO_CHANGE, 'value should not be NO_CHANGE');
|
|
32273
|
+
ngDevMode && assertIndexInRange(lView, index);
|
|
32274
|
+
const element = getNativeByIndex(index, lView);
|
|
32275
|
+
ngDevMode && assertDefined(element, 'native element should exist');
|
|
32276
|
+
updateTextNode(lView[RENDERER], element, value);
|
|
32277
|
+
}
|
|
32343
32278
|
|
|
32344
32279
|
/*!
|
|
32345
32280
|
* @license
|
|
@@ -33524,29 +33459,29 @@ function ɵɵreplaceMetadata(type, applyMetadata, namespaces, locals) {
|
|
|
33524
33459
|
}
|
|
33525
33460
|
/**
|
|
33526
33461
|
* Finds all LViews matching a specific component definition and recreates them.
|
|
33527
|
-
* @param
|
|
33462
|
+
* @param oldDef Component definition to search for.
|
|
33528
33463
|
* @param rootLView View from which to start the search.
|
|
33529
33464
|
*/
|
|
33530
|
-
function recreateMatchingLViews(
|
|
33465
|
+
function recreateMatchingLViews(oldDef, rootLView) {
|
|
33531
33466
|
ngDevMode &&
|
|
33532
|
-
assertDefined(
|
|
33467
|
+
assertDefined(oldDef.tView, 'Expected a component definition that has been instantiated at least once');
|
|
33533
33468
|
const tView = rootLView[TVIEW];
|
|
33534
33469
|
// Use `tView` to match the LView since `instanceof` can
|
|
33535
33470
|
// produce false positives when using inheritance.
|
|
33536
|
-
if (tView ===
|
|
33537
|
-
ngDevMode && assertComponentDef(
|
|
33538
|
-
recreateLView(getComponentDef(
|
|
33471
|
+
if (tView === oldDef.tView) {
|
|
33472
|
+
ngDevMode && assertComponentDef(oldDef.type);
|
|
33473
|
+
recreateLView(getComponentDef(oldDef.type), oldDef, rootLView);
|
|
33539
33474
|
return;
|
|
33540
33475
|
}
|
|
33541
33476
|
for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
|
|
33542
33477
|
const current = rootLView[i];
|
|
33543
33478
|
if (isLContainer(current)) {
|
|
33544
33479
|
for (let i = CONTAINER_HEADER_OFFSET; i < current.length; i++) {
|
|
33545
|
-
recreateMatchingLViews(
|
|
33480
|
+
recreateMatchingLViews(oldDef, current[i]);
|
|
33546
33481
|
}
|
|
33547
33482
|
}
|
|
33548
33483
|
else if (isLView(current)) {
|
|
33549
|
-
recreateMatchingLViews(
|
|
33484
|
+
recreateMatchingLViews(oldDef, current);
|
|
33550
33485
|
}
|
|
33551
33486
|
}
|
|
33552
33487
|
}
|
|
@@ -33565,10 +33500,11 @@ function clearRendererCache(factory, def) {
|
|
|
33565
33500
|
}
|
|
33566
33501
|
/**
|
|
33567
33502
|
* Recreates an LView in-place from a new component definition.
|
|
33568
|
-
* @param
|
|
33503
|
+
* @param newDef Definition from which to recreate the view.
|
|
33504
|
+
* @param oldDef Previous component definition being swapped out.
|
|
33569
33505
|
* @param lView View to be recreated.
|
|
33570
33506
|
*/
|
|
33571
|
-
function recreateLView(
|
|
33507
|
+
function recreateLView(newDef, oldDef, lView) {
|
|
33572
33508
|
const instance = lView[CONTEXT];
|
|
33573
33509
|
const host = lView[HOST];
|
|
33574
33510
|
// In theory the parent can also be an LContainer, but it appears like that's
|
|
@@ -33577,30 +33513,41 @@ function recreateLView(def, lView) {
|
|
|
33577
33513
|
ngDevMode && assertLView(parentLView);
|
|
33578
33514
|
const tNode = lView[T_HOST];
|
|
33579
33515
|
ngDevMode && assertTNodeType(tNode, 2 /* TNodeType.Element */);
|
|
33580
|
-
|
|
33581
|
-
const
|
|
33582
|
-
|
|
33583
|
-
|
|
33584
|
-
|
|
33585
|
-
|
|
33586
|
-
|
|
33587
|
-
|
|
33588
|
-
|
|
33589
|
-
|
|
33590
|
-
|
|
33591
|
-
|
|
33592
|
-
|
|
33593
|
-
|
|
33594
|
-
|
|
33595
|
-
|
|
33596
|
-
|
|
33597
|
-
|
|
33598
|
-
|
|
33599
|
-
|
|
33600
|
-
|
|
33601
|
-
|
|
33602
|
-
|
|
33603
|
-
|
|
33516
|
+
ngDevMode && assertNotEqual(newDef, oldDef, 'Expected different component definition');
|
|
33517
|
+
const zone = lView[INJECTOR].get(NgZone, null);
|
|
33518
|
+
const recreate = () => {
|
|
33519
|
+
// Recreate the TView since the template might've changed.
|
|
33520
|
+
const newTView = getOrCreateComponentTView(newDef);
|
|
33521
|
+
// Always force the creation of a new renderer to ensure state captured during construction
|
|
33522
|
+
// stays consistent with the new component definition by clearing any old cached factories.
|
|
33523
|
+
const rendererFactory = lView[ENVIRONMENT].rendererFactory;
|
|
33524
|
+
clearRendererCache(rendererFactory, oldDef);
|
|
33525
|
+
// Create a new LView from the new TView, but reusing the existing TNode and DOM node.
|
|
33526
|
+
const newLView = createLView(parentLView, newTView, instance, getInitialLViewFlagsFromDef(newDef), host, tNode, null, rendererFactory.createRenderer(host, newDef), null, null, null);
|
|
33527
|
+
// Detach the LView from its current place in the tree so we don't
|
|
33528
|
+
// start traversing any siblings and modifying their structure.
|
|
33529
|
+
replaceLViewInTree(parentLView, lView, newLView, tNode.index);
|
|
33530
|
+
// Destroy the detached LView.
|
|
33531
|
+
destroyLView(lView[TVIEW], lView);
|
|
33532
|
+
// Remove the nodes associated with the destroyed LView. This removes the
|
|
33533
|
+
// descendants, but not the host which we want to stay in place.
|
|
33534
|
+
removeViewFromDOM(lView[TVIEW], lView);
|
|
33535
|
+
// Reset the content projection state of the TNode before the first render.
|
|
33536
|
+
// Note that this has to happen after the LView has been destroyed or we
|
|
33537
|
+
// risk some projected nodes not being removed correctly.
|
|
33538
|
+
resetProjectionState(tNode);
|
|
33539
|
+
// Creation pass for the new view.
|
|
33540
|
+
renderView(newTView, newLView, instance);
|
|
33541
|
+
// Update pass for the new view.
|
|
33542
|
+
refreshView(newTView, newLView, newTView.template, instance);
|
|
33543
|
+
};
|
|
33544
|
+
// The callback isn't guaranteed to be inside the Zone so we need to bring it in ourselves.
|
|
33545
|
+
if (zone === null) {
|
|
33546
|
+
recreate();
|
|
33547
|
+
}
|
|
33548
|
+
else {
|
|
33549
|
+
zone.run(recreate);
|
|
33550
|
+
}
|
|
33604
33551
|
}
|
|
33605
33552
|
/**
|
|
33606
33553
|
* Replaces one LView in the tree with another one.
|
|
@@ -35027,7 +34974,7 @@ class Version {
|
|
|
35027
34974
|
/**
|
|
35028
34975
|
* @publicApi
|
|
35029
34976
|
*/
|
|
35030
|
-
const VERSION = new Version('19.1.
|
|
34977
|
+
const VERSION = new Version('19.1.1');
|
|
35031
34978
|
|
|
35032
34979
|
/**
|
|
35033
34980
|
* Combination of NgModuleFactory and ComponentFactories.
|
|
@@ -35437,6 +35384,13 @@ class ChangeDetectionSchedulerImpl {
|
|
|
35437
35384
|
this.appRef.dirtyFlags |= 4 /* ApplicationRefDirtyFlags.ViewTreeCheck */;
|
|
35438
35385
|
break;
|
|
35439
35386
|
}
|
|
35387
|
+
case 8 /* NotificationSource.DeferredRenderHook */: {
|
|
35388
|
+
// Render hooks are "deferred" when they're triggered from other render hooks. Using the
|
|
35389
|
+
// deferred dirty flags ensures that adding new hooks doesn't automatically trigger a loop
|
|
35390
|
+
// inside tick().
|
|
35391
|
+
this.appRef.deferredDirtyFlags |= 8 /* ApplicationRefDirtyFlags.AfterRender */;
|
|
35392
|
+
break;
|
|
35393
|
+
}
|
|
35440
35394
|
case 6 /* NotificationSource.CustomElement */: {
|
|
35441
35395
|
// We use `ViewTreeTraversal` to ensure we refresh the element even if this is triggered
|
|
35442
35396
|
// during CD. In practice this is a no-op since the elements code also calls via a
|
|
@@ -35445,7 +35399,7 @@ class ChangeDetectionSchedulerImpl {
|
|
|
35445
35399
|
force = true;
|
|
35446
35400
|
break;
|
|
35447
35401
|
}
|
|
35448
|
-
case
|
|
35402
|
+
case 13 /* NotificationSource.RootEffect */: {
|
|
35449
35403
|
this.appRef.dirtyFlags |= 16 /* ApplicationRefDirtyFlags.RootEffects */;
|
|
35450
35404
|
// Root effects still force a CD, even if the scheduler is disabled. This ensures that
|
|
35451
35405
|
// effects always run, even when triggered from outside the zone when the scheduler is
|
|
@@ -35453,7 +35407,7 @@ class ChangeDetectionSchedulerImpl {
|
|
|
35453
35407
|
force = true;
|
|
35454
35408
|
break;
|
|
35455
35409
|
}
|
|
35456
|
-
case
|
|
35410
|
+
case 14 /* NotificationSource.ViewEffect */: {
|
|
35457
35411
|
// This is technically a no-op, since view effects will also send a
|
|
35458
35412
|
// `MarkAncestorsForTraversal` notification. Still, we set this for logical consistency.
|
|
35459
35413
|
this.appRef.dirtyFlags |= 2 /* ApplicationRefDirtyFlags.ViewTreeTraversal */;
|
|
@@ -35463,7 +35417,7 @@ class ChangeDetectionSchedulerImpl {
|
|
|
35463
35417
|
force = true;
|
|
35464
35418
|
break;
|
|
35465
35419
|
}
|
|
35466
|
-
case
|
|
35420
|
+
case 12 /* NotificationSource.PendingTaskRemoved */: {
|
|
35467
35421
|
// Removing a pending task via the public API forces a scheduled tick, ensuring that
|
|
35468
35422
|
// stability is async and delayed until there was at least an opportunity to run
|
|
35469
35423
|
// application synchronization. This prevents some footguns when working with the
|
|
@@ -35472,10 +35426,10 @@ class ChangeDetectionSchedulerImpl {
|
|
|
35472
35426
|
force = true;
|
|
35473
35427
|
break;
|
|
35474
35428
|
}
|
|
35475
|
-
case
|
|
35476
|
-
case
|
|
35429
|
+
case 10 /* NotificationSource.ViewDetachedFromDOM */:
|
|
35430
|
+
case 9 /* NotificationSource.ViewAttached */:
|
|
35477
35431
|
case 7 /* NotificationSource.RenderHook */:
|
|
35478
|
-
case
|
|
35432
|
+
case 11 /* NotificationSource.AsyncAnimationsLoaded */:
|
|
35479
35433
|
default: {
|
|
35480
35434
|
// These notifications only schedule a tick but do not change whether we should refresh
|
|
35481
35435
|
// views. Instead, we only need to run render hooks unless another notification from the
|
|
@@ -38293,7 +38247,7 @@ class IterableDiffers {
|
|
|
38293
38247
|
* which will only be applied to the injector for this component and its children.
|
|
38294
38248
|
* This step is all that's required to make a new {@link IterableDiffer} available.
|
|
38295
38249
|
*
|
|
38296
|
-
* ```
|
|
38250
|
+
* ```ts
|
|
38297
38251
|
* @Component({
|
|
38298
38252
|
* viewProviders: [
|
|
38299
38253
|
* IterableDiffers.extend([new ImmutableListDiffer()])
|
|
@@ -38367,7 +38321,7 @@ class KeyValueDiffers {
|
|
|
38367
38321
|
* which will only be applied to the injector for this component and its children.
|
|
38368
38322
|
* This step is all that's required to make a new {@link KeyValueDiffer} available.
|
|
38369
38323
|
*
|
|
38370
|
-
* ```
|
|
38324
|
+
* ```ts
|
|
38371
38325
|
* @Component({
|
|
38372
38326
|
* viewProviders: [
|
|
38373
38327
|
* KeyValueDiffers.extend([new ImmutableMapDiffer()])
|
|
@@ -39489,7 +39443,6 @@ function serializeLContainer(lContainer, tNode, lView, parentDeferBlockId, conte
|
|
|
39489
39443
|
collectNativeNodesInLContainer(lContainer, rootNodes);
|
|
39490
39444
|
// Add defer block into info context.deferBlocks
|
|
39491
39445
|
const deferBlockInfo = {
|
|
39492
|
-
[DEFER_PARENT_BLOCK_ID]: parentDeferBlockId,
|
|
39493
39446
|
[NUM_ROOT_NODES]: rootNodes.length,
|
|
39494
39447
|
[DEFER_BLOCK_STATE$1]: lDetails[DEFER_BLOCK_STATE],
|
|
39495
39448
|
};
|
|
@@ -39497,6 +39450,10 @@ function serializeLContainer(lContainer, tNode, lView, parentDeferBlockId, conte
|
|
|
39497
39450
|
if (serializedTriggers.length > 0) {
|
|
39498
39451
|
deferBlockInfo[DEFER_HYDRATE_TRIGGERS] = serializedTriggers;
|
|
39499
39452
|
}
|
|
39453
|
+
if (parentDeferBlockId !== null) {
|
|
39454
|
+
// Serialize parent id only when it's present.
|
|
39455
|
+
deferBlockInfo[DEFER_PARENT_BLOCK_ID] = parentDeferBlockId;
|
|
39456
|
+
}
|
|
39500
39457
|
context.deferBlocks.set(deferBlockId, deferBlockInfo);
|
|
39501
39458
|
const node = unwrapRNode(lContainer);
|
|
39502
39459
|
if (node !== undefined) {
|
|
@@ -40641,6 +40598,23 @@ function untracked(nonReactiveReadsFn) {
|
|
|
40641
40598
|
}
|
|
40642
40599
|
}
|
|
40643
40600
|
|
|
40601
|
+
class ViewContext {
|
|
40602
|
+
view;
|
|
40603
|
+
node;
|
|
40604
|
+
constructor(view, node) {
|
|
40605
|
+
this.view = view;
|
|
40606
|
+
this.node = node;
|
|
40607
|
+
}
|
|
40608
|
+
/**
|
|
40609
|
+
* @internal
|
|
40610
|
+
* @nocollapse
|
|
40611
|
+
*/
|
|
40612
|
+
static __NG_ELEMENT_ID__ = injectViewContext;
|
|
40613
|
+
}
|
|
40614
|
+
function injectViewContext() {
|
|
40615
|
+
return new ViewContext(getLView(), getCurrentTNode());
|
|
40616
|
+
}
|
|
40617
|
+
|
|
40644
40618
|
/**
|
|
40645
40619
|
* Controls whether effects use the legacy `microtaskEffect` by default.
|
|
40646
40620
|
*/
|
|
@@ -40908,7 +40882,7 @@ const ROOT_EFFECT_NODE =
|
|
|
40908
40882
|
...BASE_EFFECT_NODE,
|
|
40909
40883
|
consumerMarkedDirty() {
|
|
40910
40884
|
this.scheduler.schedule(this);
|
|
40911
|
-
this.notifier.notify(
|
|
40885
|
+
this.notifier.notify(13 /* NotificationSource.RootEffect */);
|
|
40912
40886
|
},
|
|
40913
40887
|
destroy() {
|
|
40914
40888
|
consumerDestroy$1(this);
|
|
@@ -40923,7 +40897,7 @@ const VIEW_EFFECT_NODE =
|
|
|
40923
40897
|
consumerMarkedDirty() {
|
|
40924
40898
|
this.view[FLAGS] |= 8192 /* LViewFlags.HasChildViewsToRefresh */;
|
|
40925
40899
|
markAncestorsForTraversal(this.view);
|
|
40926
|
-
this.notifier.notify(
|
|
40900
|
+
this.notifier.notify(14 /* NotificationSource.ViewEffect */);
|
|
40927
40901
|
},
|
|
40928
40902
|
destroy() {
|
|
40929
40903
|
consumerDestroy$1(this);
|
|
@@ -40950,7 +40924,7 @@ function createRootEffect(fn, scheduler, notifier) {
|
|
|
40950
40924
|
node.notifier = notifier;
|
|
40951
40925
|
node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
|
|
40952
40926
|
node.scheduler.schedule(node);
|
|
40953
|
-
node.notifier.notify(
|
|
40927
|
+
node.notifier.notify(13 /* NotificationSource.RootEffect */);
|
|
40954
40928
|
return node;
|
|
40955
40929
|
}
|
|
40956
40930
|
|
|
@@ -41041,10 +41015,10 @@ class AfterRenderEffectSequence extends AfterRenderSequence {
|
|
|
41041
41015
|
* These are initialized to `undefined` but set in the constructor.
|
|
41042
41016
|
*/
|
|
41043
41017
|
nodes = [undefined, undefined, undefined, undefined];
|
|
41044
|
-
constructor(impl, effectHooks,
|
|
41018
|
+
constructor(impl, effectHooks, scheduler, destroyRef, snapshot = null) {
|
|
41045
41019
|
// Note that we also initialize the underlying `AfterRenderSequence` hooks to `undefined` and
|
|
41046
41020
|
// populate them as we create reactive nodes below.
|
|
41047
|
-
super(impl, [undefined, undefined, undefined, undefined],
|
|
41021
|
+
super(impl, [undefined, undefined, undefined, undefined], false, destroyRef, snapshot);
|
|
41048
41022
|
this.scheduler = scheduler;
|
|
41049
41023
|
// Setup a reactive node for each phase.
|
|
41050
41024
|
for (const phase of AFTER_RENDER_PHASES) {
|
|
@@ -41103,8 +41077,7 @@ function afterRenderEffect(callbackOrSpec, options) {
|
|
|
41103
41077
|
if (typeof spec === 'function') {
|
|
41104
41078
|
spec = { mixedReadWrite: callbackOrSpec };
|
|
41105
41079
|
}
|
|
41106
|
-
const
|
|
41107
|
-
const sequence = new AfterRenderEffectSequence(manager.impl, [spec.earlyRead, spec.write, spec.mixedReadWrite, spec.read], viewContext?.view, scheduler, injector.get(DestroyRef), tracing?.snapshot(null));
|
|
41080
|
+
const sequence = new AfterRenderEffectSequence(manager.impl, [spec.earlyRead, spec.write, spec.mixedReadWrite, spec.read], scheduler, injector.get(DestroyRef), tracing?.snapshot(null));
|
|
41108
41081
|
manager.impl.register(sequence);
|
|
41109
41082
|
return sequence;
|
|
41110
41083
|
}
|
|
@@ -41520,7 +41493,7 @@ function mergeApplicationConfig(...configs) {
|
|
|
41520
41493
|
*
|
|
41521
41494
|
* @developerPreview
|
|
41522
41495
|
*/
|
|
41523
|
-
const REQUEST = new InjectionToken('REQUEST', {
|
|
41496
|
+
const REQUEST = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'REQUEST' : '', {
|
|
41524
41497
|
providedIn: 'platform',
|
|
41525
41498
|
factory: () => null,
|
|
41526
41499
|
});
|
|
@@ -41542,7 +41515,7 @@ const REQUEST = new InjectionToken('REQUEST', {
|
|
|
41542
41515
|
*
|
|
41543
41516
|
* @developerPreview
|
|
41544
41517
|
*/
|
|
41545
|
-
const RESPONSE_INIT = new InjectionToken('RESPONSE_INIT', {
|
|
41518
|
+
const RESPONSE_INIT = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'RESPONSE_INIT' : '', {
|
|
41546
41519
|
providedIn: 'platform',
|
|
41547
41520
|
factory: () => null,
|
|
41548
41521
|
});
|
|
@@ -41556,7 +41529,7 @@ const RESPONSE_INIT = new InjectionToken('RESPONSE_INIT', {
|
|
|
41556
41529
|
*
|
|
41557
41530
|
* @developerPreview
|
|
41558
41531
|
*/
|
|
41559
|
-
const REQUEST_CONTEXT = new InjectionToken('REQUEST_CONTEXT', {
|
|
41532
|
+
const REQUEST_CONTEXT = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'REQUEST_CONTEXT' : '', {
|
|
41560
41533
|
providedIn: 'platform',
|
|
41561
41534
|
factory: () => null,
|
|
41562
41535
|
});
|