@angular/core 19.1.5 → 19.2.0-next.0
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 +1060 -833
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -2
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +28 -17
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +4 -4
- package/index.d.ts +82 -30
- 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 +3 -3
- package/schematics/bundles/{apply_import_manager-57619f3c.js → apply_import_manager-deecd687.js} +3 -3
- package/schematics/bundles/{checker-ce908760.js → checker-78667e44.js} +391 -99
- package/schematics/bundles/cleanup-unused-imports.js +6 -6
- package/schematics/bundles/{compiler_host-33b24174.js → compiler_host-38c8eab2.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-31a38653.js → imports-abe29092.js} +1 -1
- package/schematics/bundles/{index-d6e51169.js → index-6713e562.js} +4 -4
- package/schematics/bundles/{index-59a1204f.js → index-de135c2f.js} +4 -4
- package/schematics/bundles/inject-migration.js +6 -6
- package/schematics/bundles/{leading_space-6e7a8ec6.js → leading_space-d190b83b.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-2c37e645.js → migrate_ts_type_references-e6411f51.js} +6 -6
- package/schematics/bundles/{nodes-88c2157f.js → nodes-a9f0b985.js} +2 -2
- package/schematics/bundles/output-migration.js +6 -6
- package/schematics/bundles/pending-tasks.js +5 -5
- package/schematics/bundles/{program-5512058c.js → program-b0d98952.js} +26 -100
- package/schematics/bundles/{project_tsconfig_paths-6c9cde78.js → project_tsconfig_paths-e9ccccbf.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 +8 -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.
|
|
2
|
+
* @license Angular v19.2.0-next.0
|
|
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, 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,
|
|
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, clearAppScopedEarlyEventContract, EventContract, EventContractContainer, getAppScopedQueuedEventInfos, EventDispatcher, registerDispatcher, isEarlyEventType, isCaptureEventType, EventPhase } from '@angular/core/primitives/event-dispatch';
|
|
@@ -2963,7 +2963,6 @@ function isComponentDef(def) {
|
|
|
2963
2963
|
return !!def.template;
|
|
2964
2964
|
}
|
|
2965
2965
|
function isRootView(target) {
|
|
2966
|
-
// Determines whether a given LView is marked as a root view.
|
|
2967
2966
|
return (target[FLAGS] & 512 /* LViewFlags.IsRoot */) !== 0;
|
|
2968
2967
|
}
|
|
2969
2968
|
function isProjectionTNode(tNode) {
|
|
@@ -3067,7 +3066,7 @@ function assertProjectionSlots(lView, errMessage) {
|
|
|
3067
3066
|
function assertParentView(lView, errMessage) {
|
|
3068
3067
|
assertDefined(lView, errMessage || "Component views should always have a parent view (component's host view)");
|
|
3069
3068
|
}
|
|
3070
|
-
function assertNoDuplicateDirectives
|
|
3069
|
+
function assertNoDuplicateDirectives(directives) {
|
|
3071
3070
|
// The array needs at least two elements in order to have duplicates.
|
|
3072
3071
|
if (directives.length < 2) {
|
|
3073
3072
|
return;
|
|
@@ -3244,7 +3243,7 @@ const setProfiler = (profiler) => {
|
|
|
3244
3243
|
* execution context
|
|
3245
3244
|
* @returns
|
|
3246
3245
|
*/
|
|
3247
|
-
const profiler = function (event, instance, hookOrListener) {
|
|
3246
|
+
const profiler = function (event, instance = null, hookOrListener) {
|
|
3248
3247
|
if (profilerCallback != null /* both `null` and `undefined` */) {
|
|
3249
3248
|
profilerCallback(event, instance, hookOrListener);
|
|
3250
3249
|
}
|
|
@@ -4060,7 +4059,7 @@ function ɵɵnamespaceHTML() {
|
|
|
4060
4059
|
function namespaceHTMLInternal() {
|
|
4061
4060
|
instructionState.lFrame.currentNamespace = null;
|
|
4062
4061
|
}
|
|
4063
|
-
function getNamespace() {
|
|
4062
|
+
function getNamespace$1() {
|
|
4064
4063
|
return instructionState.lFrame.currentNamespace;
|
|
4065
4064
|
}
|
|
4066
4065
|
let _wasLastNodeCreated = true;
|
|
@@ -5618,7 +5617,7 @@ function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundVa
|
|
|
5618
5617
|
while (currentTNode !== null &&
|
|
5619
5618
|
currentLView !== null &&
|
|
5620
5619
|
currentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ &&
|
|
5621
|
-
!
|
|
5620
|
+
!(currentLView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
|
|
5622
5621
|
ngDevMode && assertTNodeForLView(currentTNode, currentLView);
|
|
5623
5622
|
// Note that this lookup on the node injector is using the `Self` flag, because
|
|
5624
5623
|
// we don't want the node injector to look at any parent injectors since we
|
|
@@ -7800,7 +7799,8 @@ function getDirectivesAtNodeIndex(nodeIndex, lView) {
|
|
|
7800
7799
|
}
|
|
7801
7800
|
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
7802
7801
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
7803
|
-
|
|
7802
|
+
const { directiveStart, componentOffset } = tNode;
|
|
7803
|
+
return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
|
|
7804
7804
|
}
|
|
7805
7805
|
/**
|
|
7806
7806
|
* Returns a map of local references (local reference name => element or directive instance) that
|
|
@@ -7829,7 +7829,7 @@ function discoverLocalRefs(lView, nodeIndex) {
|
|
|
7829
7829
|
function getRootView(componentOrLView) {
|
|
7830
7830
|
ngDevMode && assertDefined(componentOrLView, 'component');
|
|
7831
7831
|
let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
|
|
7832
|
-
while (lView && !
|
|
7832
|
+
while (lView && !(lView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
|
|
7833
7833
|
lView = getLViewParent(lView);
|
|
7834
7834
|
}
|
|
7835
7835
|
ngDevMode && assertLView(lView);
|
|
@@ -7947,7 +7947,7 @@ function getOwningComponent(elementOrDir) {
|
|
|
7947
7947
|
while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
|
|
7948
7948
|
lView = parent;
|
|
7949
7949
|
}
|
|
7950
|
-
return
|
|
7950
|
+
return lView[FLAGS] & 512 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
|
|
7951
7951
|
}
|
|
7952
7952
|
/**
|
|
7953
7953
|
* Retrieves all root components associated with a DOM element, directive or component instance.
|
|
@@ -8756,6 +8756,10 @@ class AfterRenderImpl {
|
|
|
8756
8756
|
* might be scheduled.
|
|
8757
8757
|
*/
|
|
8758
8758
|
execute() {
|
|
8759
|
+
const hasSequencesToExecute = this.sequences.size > 0;
|
|
8760
|
+
if (hasSequencesToExecute) {
|
|
8761
|
+
profiler(16 /* ProfilerEvent.AfterRenderHooksStart */);
|
|
8762
|
+
}
|
|
8759
8763
|
this.executing = true;
|
|
8760
8764
|
for (const phase of AFTER_RENDER_PHASES) {
|
|
8761
8765
|
for (const sequence of this.sequences) {
|
|
@@ -8763,7 +8767,11 @@ class AfterRenderImpl {
|
|
|
8763
8767
|
continue;
|
|
8764
8768
|
}
|
|
8765
8769
|
try {
|
|
8766
|
-
sequence.pipelinedValue = this.ngZone.runOutsideAngular(() => this.maybeTrace(() =>
|
|
8770
|
+
sequence.pipelinedValue = this.ngZone.runOutsideAngular(() => this.maybeTrace(() => {
|
|
8771
|
+
const hookFn = sequence.hooks[phase];
|
|
8772
|
+
const value = hookFn(sequence.pipelinedValue);
|
|
8773
|
+
return value;
|
|
8774
|
+
}, sequence.snapshot));
|
|
8767
8775
|
}
|
|
8768
8776
|
catch (err) {
|
|
8769
8777
|
sequence.erroredOrDestroyed = true;
|
|
@@ -8789,6 +8797,9 @@ class AfterRenderImpl {
|
|
|
8789
8797
|
this.scheduler.notify(8 /* NotificationSource.DeferredRenderHook */);
|
|
8790
8798
|
}
|
|
8791
8799
|
this.deferredRegistrations.clear();
|
|
8800
|
+
if (hasSequencesToExecute) {
|
|
8801
|
+
profiler(17 /* ProfilerEvent.AfterRenderHooksEnd */);
|
|
8802
|
+
}
|
|
8792
8803
|
}
|
|
8793
8804
|
register(sequence) {
|
|
8794
8805
|
if (!this.executing) {
|
|
@@ -11637,6 +11648,14 @@ function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValu
|
|
|
11637
11648
|
return { propName: undefined, oldValue, newValue };
|
|
11638
11649
|
}
|
|
11639
11650
|
|
|
11651
|
+
/** Flags describing an input for a directive. */
|
|
11652
|
+
var InputFlags;
|
|
11653
|
+
(function (InputFlags) {
|
|
11654
|
+
InputFlags[InputFlags["None"] = 0] = "None";
|
|
11655
|
+
InputFlags[InputFlags["SignalBased"] = 1] = "SignalBased";
|
|
11656
|
+
InputFlags[InputFlags["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
|
|
11657
|
+
})(InputFlags || (InputFlags = {}));
|
|
11658
|
+
|
|
11640
11659
|
/**
|
|
11641
11660
|
* Returns an index of `classToSearch` in `className` taking token boundaries into account.
|
|
11642
11661
|
*
|
|
@@ -12068,15 +12087,131 @@ function extractAttrsAndClassesFromSelector(selector) {
|
|
|
12068
12087
|
}
|
|
12069
12088
|
i++;
|
|
12070
12089
|
}
|
|
12071
|
-
|
|
12072
|
-
attrs.push(1 /* AttributeMarker.Classes */, ...classes);
|
|
12073
|
-
}
|
|
12074
|
-
return attrs;
|
|
12090
|
+
return { attrs, classes };
|
|
12075
12091
|
}
|
|
12076
12092
|
|
|
12077
12093
|
/** A special value which designates that a value has not changed. */
|
|
12078
12094
|
const NO_CHANGE = typeof ngDevMode === 'undefined' || ngDevMode ? { __brand__: 'NO_CHANGE' } : {};
|
|
12079
12095
|
|
|
12096
|
+
/**
|
|
12097
|
+
* Advances to an element for later binding instructions.
|
|
12098
|
+
*
|
|
12099
|
+
* Used in conjunction with instructions like {@link property} to act on elements with specified
|
|
12100
|
+
* indices, for example those created with {@link element} or {@link elementStart}.
|
|
12101
|
+
*
|
|
12102
|
+
* ```ts
|
|
12103
|
+
* (rf: RenderFlags, ctx: any) => {
|
|
12104
|
+
* if (rf & 1) {
|
|
12105
|
+
* text(0, 'Hello');
|
|
12106
|
+
* text(1, 'Goodbye')
|
|
12107
|
+
* element(2, 'div');
|
|
12108
|
+
* }
|
|
12109
|
+
* if (rf & 2) {
|
|
12110
|
+
* advance(2); // Advance twice to the <div>.
|
|
12111
|
+
* property('title', 'test');
|
|
12112
|
+
* }
|
|
12113
|
+
* }
|
|
12114
|
+
* ```
|
|
12115
|
+
* @param delta Number of elements to advance forwards by.
|
|
12116
|
+
*
|
|
12117
|
+
* @codeGenApi
|
|
12118
|
+
*/
|
|
12119
|
+
function ɵɵadvance(delta = 1) {
|
|
12120
|
+
ngDevMode && assertGreaterThan(delta, 0, 'Can only advance forward');
|
|
12121
|
+
selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode());
|
|
12122
|
+
}
|
|
12123
|
+
function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
|
|
12124
|
+
ngDevMode && assertIndexInDeclRange(lView[TVIEW], index);
|
|
12125
|
+
// Flush the initial hooks for elements in the view that have been added up to this point.
|
|
12126
|
+
// PERF WARNING: do NOT extract this to a separate function without running benchmarks
|
|
12127
|
+
if (!checkNoChangesMode) {
|
|
12128
|
+
const hooksInitPhaseCompleted = (lView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === 3 /* InitPhaseState.InitPhaseCompleted */;
|
|
12129
|
+
if (hooksInitPhaseCompleted) {
|
|
12130
|
+
const preOrderCheckHooks = tView.preOrderCheckHooks;
|
|
12131
|
+
if (preOrderCheckHooks !== null) {
|
|
12132
|
+
executeCheckHooks(lView, preOrderCheckHooks, index);
|
|
12133
|
+
}
|
|
12134
|
+
}
|
|
12135
|
+
else {
|
|
12136
|
+
const preOrderHooks = tView.preOrderHooks;
|
|
12137
|
+
if (preOrderHooks !== null) {
|
|
12138
|
+
executeInitAndCheckHooks(lView, preOrderHooks, 0 /* InitPhaseState.OnInitHooksToBeRun */, index);
|
|
12139
|
+
}
|
|
12140
|
+
}
|
|
12141
|
+
}
|
|
12142
|
+
// We must set the selected index *after* running the hooks, because hooks may have side-effects
|
|
12143
|
+
// that cause other template functions to run, thus updating the selected index, which is global
|
|
12144
|
+
// state. If we run `setSelectedIndex` *before* we run the hooks, in some cases the selected index
|
|
12145
|
+
// will be altered by the time we leave the `ɵɵadvance` instruction.
|
|
12146
|
+
setSelectedIndex(index);
|
|
12147
|
+
}
|
|
12148
|
+
|
|
12149
|
+
function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
|
12150
|
+
const lView = getLView();
|
|
12151
|
+
// Fall back to inject() if view hasn't been created. This situation can happen in tests
|
|
12152
|
+
// if inject utilities are used before bootstrapping.
|
|
12153
|
+
if (lView === null) {
|
|
12154
|
+
// Verify that we will not get into infinite loop.
|
|
12155
|
+
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
12156
|
+
return ɵɵinject(token, flags);
|
|
12157
|
+
}
|
|
12158
|
+
const tNode = getCurrentTNode();
|
|
12159
|
+
const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
12160
|
+
ngDevMode && emitInjectEvent(token, value, flags);
|
|
12161
|
+
return value;
|
|
12162
|
+
}
|
|
12163
|
+
/**
|
|
12164
|
+
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
12165
|
+
* particular class.
|
|
12166
|
+
*
|
|
12167
|
+
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
12168
|
+
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
12169
|
+
*
|
|
12170
|
+
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
12171
|
+
* and thus in the stack trace.
|
|
12172
|
+
*
|
|
12173
|
+
* @codeGenApi
|
|
12174
|
+
*/
|
|
12175
|
+
function ɵɵinvalidFactory() {
|
|
12176
|
+
const msg = ngDevMode
|
|
12177
|
+
? `This constructor was not compatible with Dependency Injection.`
|
|
12178
|
+
: 'invalid';
|
|
12179
|
+
throw new Error(msg);
|
|
12180
|
+
}
|
|
12181
|
+
|
|
12182
|
+
function writeToDirectiveInput(def, instance, publicName, privateName, flags, value) {
|
|
12183
|
+
const prevConsumer = setActiveConsumer$1(null);
|
|
12184
|
+
try {
|
|
12185
|
+
// If we know we are dealing with a signal input, we cache its reference
|
|
12186
|
+
// in a tree-shakable way. The input signal node can then be used for
|
|
12187
|
+
// value transform execution or actual value updates without introducing
|
|
12188
|
+
// additional megamorphic accesses for accessing the instance field.
|
|
12189
|
+
let inputSignalNode = null;
|
|
12190
|
+
if ((flags & InputFlags.SignalBased) !== 0) {
|
|
12191
|
+
const field = instance[privateName];
|
|
12192
|
+
inputSignalNode = field[SIGNAL$1];
|
|
12193
|
+
}
|
|
12194
|
+
// If there is a signal node and a transform, run it before potentially
|
|
12195
|
+
// delegating to features like `NgOnChanges`.
|
|
12196
|
+
if (inputSignalNode !== null && inputSignalNode.transformFn !== undefined) {
|
|
12197
|
+
value = inputSignalNode.transformFn(value);
|
|
12198
|
+
}
|
|
12199
|
+
// If there is a decorator input transform, run it.
|
|
12200
|
+
if ((flags & InputFlags.HasDecoratorInputTransform) !== 0) {
|
|
12201
|
+
value = def.inputTransforms[privateName].call(instance, value);
|
|
12202
|
+
}
|
|
12203
|
+
if (def.setInput !== null) {
|
|
12204
|
+
def.setInput(instance, inputSignalNode, value, publicName, privateName);
|
|
12205
|
+
}
|
|
12206
|
+
else {
|
|
12207
|
+
applyValueToInputField(instance, inputSignalNode, privateName, value);
|
|
12208
|
+
}
|
|
12209
|
+
}
|
|
12210
|
+
finally {
|
|
12211
|
+
setActiveConsumer$1(prevConsumer);
|
|
12212
|
+
}
|
|
12213
|
+
}
|
|
12214
|
+
|
|
12080
12215
|
function createTextNode(renderer, value) {
|
|
12081
12216
|
ngDevMode && ngDevMode.rendererCreateTextNode++;
|
|
12082
12217
|
ngDevMode && ngDevMode.rendererSetText++;
|
|
@@ -12193,100 +12328,6 @@ function setupStaticAttributes(renderer, element, tNode) {
|
|
|
12193
12328
|
}
|
|
12194
12329
|
}
|
|
12195
12330
|
|
|
12196
|
-
/**
|
|
12197
|
-
* Advances to an element for later binding instructions.
|
|
12198
|
-
*
|
|
12199
|
-
* Used in conjunction with instructions like {@link property} to act on elements with specified
|
|
12200
|
-
* indices, for example those created with {@link element} or {@link elementStart}.
|
|
12201
|
-
*
|
|
12202
|
-
* ```ts
|
|
12203
|
-
* (rf: RenderFlags, ctx: any) => {
|
|
12204
|
-
* if (rf & 1) {
|
|
12205
|
-
* text(0, 'Hello');
|
|
12206
|
-
* text(1, 'Goodbye')
|
|
12207
|
-
* element(2, 'div');
|
|
12208
|
-
* }
|
|
12209
|
-
* if (rf & 2) {
|
|
12210
|
-
* advance(2); // Advance twice to the <div>.
|
|
12211
|
-
* property('title', 'test');
|
|
12212
|
-
* }
|
|
12213
|
-
* }
|
|
12214
|
-
* ```
|
|
12215
|
-
* @param delta Number of elements to advance forwards by.
|
|
12216
|
-
*
|
|
12217
|
-
* @codeGenApi
|
|
12218
|
-
*/
|
|
12219
|
-
function ɵɵadvance(delta = 1) {
|
|
12220
|
-
ngDevMode && assertGreaterThan(delta, 0, 'Can only advance forward');
|
|
12221
|
-
selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode());
|
|
12222
|
-
}
|
|
12223
|
-
function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
|
|
12224
|
-
ngDevMode && assertIndexInDeclRange(lView[TVIEW], index);
|
|
12225
|
-
// Flush the initial hooks for elements in the view that have been added up to this point.
|
|
12226
|
-
// PERF WARNING: do NOT extract this to a separate function without running benchmarks
|
|
12227
|
-
if (!checkNoChangesMode) {
|
|
12228
|
-
const hooksInitPhaseCompleted = (lView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === 3 /* InitPhaseState.InitPhaseCompleted */;
|
|
12229
|
-
if (hooksInitPhaseCompleted) {
|
|
12230
|
-
const preOrderCheckHooks = tView.preOrderCheckHooks;
|
|
12231
|
-
if (preOrderCheckHooks !== null) {
|
|
12232
|
-
executeCheckHooks(lView, preOrderCheckHooks, index);
|
|
12233
|
-
}
|
|
12234
|
-
}
|
|
12235
|
-
else {
|
|
12236
|
-
const preOrderHooks = tView.preOrderHooks;
|
|
12237
|
-
if (preOrderHooks !== null) {
|
|
12238
|
-
executeInitAndCheckHooks(lView, preOrderHooks, 0 /* InitPhaseState.OnInitHooksToBeRun */, index);
|
|
12239
|
-
}
|
|
12240
|
-
}
|
|
12241
|
-
}
|
|
12242
|
-
// We must set the selected index *after* running the hooks, because hooks may have side-effects
|
|
12243
|
-
// that cause other template functions to run, thus updating the selected index, which is global
|
|
12244
|
-
// state. If we run `setSelectedIndex` *before* we run the hooks, in some cases the selected index
|
|
12245
|
-
// will be altered by the time we leave the `ɵɵadvance` instruction.
|
|
12246
|
-
setSelectedIndex(index);
|
|
12247
|
-
}
|
|
12248
|
-
|
|
12249
|
-
/** Flags describing an input for a directive. */
|
|
12250
|
-
var InputFlags;
|
|
12251
|
-
(function (InputFlags) {
|
|
12252
|
-
InputFlags[InputFlags["None"] = 0] = "None";
|
|
12253
|
-
InputFlags[InputFlags["SignalBased"] = 1] = "SignalBased";
|
|
12254
|
-
InputFlags[InputFlags["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
|
|
12255
|
-
})(InputFlags || (InputFlags = {}));
|
|
12256
|
-
|
|
12257
|
-
function writeToDirectiveInput(def, instance, publicName, privateName, flags, value) {
|
|
12258
|
-
const prevConsumer = setActiveConsumer$1(null);
|
|
12259
|
-
try {
|
|
12260
|
-
// If we know we are dealing with a signal input, we cache its reference
|
|
12261
|
-
// in a tree-shakable way. The input signal node can then be used for
|
|
12262
|
-
// value transform execution or actual value updates without introducing
|
|
12263
|
-
// additional megamorphic accesses for accessing the instance field.
|
|
12264
|
-
let inputSignalNode = null;
|
|
12265
|
-
if ((flags & InputFlags.SignalBased) !== 0) {
|
|
12266
|
-
const field = instance[privateName];
|
|
12267
|
-
inputSignalNode = field[SIGNAL$1];
|
|
12268
|
-
}
|
|
12269
|
-
// If there is a signal node and a transform, run it before potentially
|
|
12270
|
-
// delegating to features like `NgOnChanges`.
|
|
12271
|
-
if (inputSignalNode !== null && inputSignalNode.transformFn !== undefined) {
|
|
12272
|
-
value = inputSignalNode.transformFn(value);
|
|
12273
|
-
}
|
|
12274
|
-
// If there is a decorator input transform, run it.
|
|
12275
|
-
if ((flags & InputFlags.HasDecoratorInputTransform) !== 0) {
|
|
12276
|
-
value = def.inputTransforms[privateName].call(instance, value);
|
|
12277
|
-
}
|
|
12278
|
-
if (def.setInput !== null) {
|
|
12279
|
-
def.setInput(instance, inputSignalNode, value, publicName, privateName);
|
|
12280
|
-
}
|
|
12281
|
-
else {
|
|
12282
|
-
applyValueToInputField(instance, inputSignalNode, privateName, value);
|
|
12283
|
-
}
|
|
12284
|
-
}
|
|
12285
|
-
finally {
|
|
12286
|
-
setActiveConsumer$1(prevConsumer);
|
|
12287
|
-
}
|
|
12288
|
-
}
|
|
12289
|
-
|
|
12290
12331
|
function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
|
|
12291
12332
|
const lView = tView.blueprint.slice();
|
|
12292
12333
|
lView[HOST] = host;
|
|
@@ -12320,6 +12361,34 @@ function createLView(parentLView, tView, context, flags, host, tHostNode, enviro
|
|
|
12320
12361
|
tView.type == 2 /* TViewType.Embedded */ ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
|
|
12321
12362
|
return lView;
|
|
12322
12363
|
}
|
|
12364
|
+
/**
|
|
12365
|
+
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
12366
|
+
* i18nApply()), we need to adjust the blueprint for future
|
|
12367
|
+
* template passes.
|
|
12368
|
+
*
|
|
12369
|
+
* @param tView `TView` associated with `LView`
|
|
12370
|
+
* @param lView The `LView` containing the blueprint to adjust
|
|
12371
|
+
* @param numSlotsToAlloc The number of slots to alloc in the LView, should be >0
|
|
12372
|
+
* @param initialValue Initial value to store in blueprint
|
|
12373
|
+
*/
|
|
12374
|
+
function allocExpando(tView, lView, numSlotsToAlloc, initialValue) {
|
|
12375
|
+
if (numSlotsToAlloc === 0)
|
|
12376
|
+
return -1;
|
|
12377
|
+
if (ngDevMode) {
|
|
12378
|
+
assertFirstCreatePass(tView);
|
|
12379
|
+
assertSame(tView, lView[TVIEW], '`LView` must be associated with `TView`!');
|
|
12380
|
+
assertEqual(tView.data.length, lView.length, 'Expecting LView to be same size as TView');
|
|
12381
|
+
assertEqual(tView.data.length, tView.blueprint.length, 'Expecting Blueprint to be same size as TView');
|
|
12382
|
+
assertFirstUpdatePass(tView);
|
|
12383
|
+
}
|
|
12384
|
+
const allocIdx = lView.length;
|
|
12385
|
+
for (let i = 0; i < numSlotsToAlloc; i++) {
|
|
12386
|
+
lView.push(initialValue);
|
|
12387
|
+
tView.blueprint.push(initialValue);
|
|
12388
|
+
tView.data.push(null);
|
|
12389
|
+
}
|
|
12390
|
+
return allocIdx;
|
|
12391
|
+
}
|
|
12323
12392
|
function executeTemplate(tView, lView, templateFn, rf, context) {
|
|
12324
12393
|
const prevSelectedIndex = getSelectedIndex();
|
|
12325
12394
|
const isUpdatePhase = rf & 2 /* RenderFlags.Update */;
|
|
@@ -12347,17 +12416,10 @@ function executeTemplate(tView, lView, templateFn, rf, context) {
|
|
|
12347
12416
|
/**
|
|
12348
12417
|
* Creates directive instances.
|
|
12349
12418
|
*/
|
|
12350
|
-
function
|
|
12419
|
+
function createDirectivesInstances(tView, lView, tNode) {
|
|
12351
12420
|
if (!getBindingsEnabled())
|
|
12352
12421
|
return;
|
|
12353
|
-
|
|
12354
|
-
createDirectivesInstances(tView, lView, tNode);
|
|
12355
|
-
}
|
|
12356
|
-
/**
|
|
12357
|
-
* Creates directive instances.
|
|
12358
|
-
*/
|
|
12359
|
-
function createDirectivesInstances(tView, lView, tNode) {
|
|
12360
|
-
instantiateAllDirectives(tView, lView, tNode);
|
|
12422
|
+
instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
|
|
12361
12423
|
if ((tNode.flags & 64 /* TNodeFlags.hasHostBindings */) === 64 /* TNodeFlags.hasHostBindings */) {
|
|
12362
12424
|
invokeDirectivesHostBindings(tView, lView, tNode);
|
|
12363
12425
|
}
|
|
@@ -12532,6 +12594,106 @@ function applyRootElementTransformImpl(rootElement) {
|
|
|
12532
12594
|
function enableApplyRootElementTransformImpl() {
|
|
12533
12595
|
_applyRootElementTransformImpl = applyRootElementTransformImpl;
|
|
12534
12596
|
}
|
|
12597
|
+
function captureNodeBindings(mode, aliasMap, directiveIndex, bindingsResult, hostDirectiveAliasMap) {
|
|
12598
|
+
for (let publicName in aliasMap) {
|
|
12599
|
+
if (!aliasMap.hasOwnProperty(publicName)) {
|
|
12600
|
+
continue;
|
|
12601
|
+
}
|
|
12602
|
+
const value = aliasMap[publicName];
|
|
12603
|
+
if (value === undefined) {
|
|
12604
|
+
continue;
|
|
12605
|
+
}
|
|
12606
|
+
bindingsResult ??= {};
|
|
12607
|
+
let internalName;
|
|
12608
|
+
let inputFlags = InputFlags.None;
|
|
12609
|
+
// For inputs, the value might be an array capturing additional
|
|
12610
|
+
// input flags.
|
|
12611
|
+
if (Array.isArray(value)) {
|
|
12612
|
+
internalName = value[0];
|
|
12613
|
+
inputFlags = value[1];
|
|
12614
|
+
}
|
|
12615
|
+
else {
|
|
12616
|
+
internalName = value;
|
|
12617
|
+
}
|
|
12618
|
+
// If there are no host directive mappings, we want to remap using the alias map from the
|
|
12619
|
+
// definition itself. If there is an alias map, it has two functions:
|
|
12620
|
+
// 1. It serves as an allowlist of bindings that are exposed by the host directives. Only the
|
|
12621
|
+
// ones inside the host directive map will be exposed on the host.
|
|
12622
|
+
// 2. The public name of the property is aliased using the host directive alias map, rather
|
|
12623
|
+
// than the alias map from the definition.
|
|
12624
|
+
let finalPublicName = publicName;
|
|
12625
|
+
if (hostDirectiveAliasMap !== null) {
|
|
12626
|
+
// If there is no mapping, it's not part of the allowlist and this input/output
|
|
12627
|
+
// is not captured and should be ignored.
|
|
12628
|
+
if (!hostDirectiveAliasMap.hasOwnProperty(publicName)) {
|
|
12629
|
+
continue;
|
|
12630
|
+
}
|
|
12631
|
+
finalPublicName = hostDirectiveAliasMap[publicName];
|
|
12632
|
+
}
|
|
12633
|
+
if (mode === 0 /* CaptureNodeBindingMode.Inputs */) {
|
|
12634
|
+
addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName, inputFlags);
|
|
12635
|
+
}
|
|
12636
|
+
else {
|
|
12637
|
+
addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName);
|
|
12638
|
+
}
|
|
12639
|
+
}
|
|
12640
|
+
return bindingsResult;
|
|
12641
|
+
}
|
|
12642
|
+
function addPropertyBinding(bindings, directiveIndex, publicName, internalName, inputFlags) {
|
|
12643
|
+
let values;
|
|
12644
|
+
if (bindings.hasOwnProperty(publicName)) {
|
|
12645
|
+
(values = bindings[publicName]).push(directiveIndex, internalName);
|
|
12646
|
+
}
|
|
12647
|
+
else {
|
|
12648
|
+
values = bindings[publicName] = [directiveIndex, internalName];
|
|
12649
|
+
}
|
|
12650
|
+
if (inputFlags !== undefined) {
|
|
12651
|
+
values.push(inputFlags);
|
|
12652
|
+
}
|
|
12653
|
+
}
|
|
12654
|
+
/**
|
|
12655
|
+
* Initializes data structures required to work with directive inputs and outputs.
|
|
12656
|
+
* Initialization is done for all directives matched on a given TNode.
|
|
12657
|
+
*/
|
|
12658
|
+
function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMap) {
|
|
12659
|
+
ngDevMode && assertFirstCreatePass(tView);
|
|
12660
|
+
const start = tNode.directiveStart;
|
|
12661
|
+
const end = tNode.directiveEnd;
|
|
12662
|
+
const tViewData = tView.data;
|
|
12663
|
+
const tNodeAttrs = tNode.attrs;
|
|
12664
|
+
const inputsFromAttrs = [];
|
|
12665
|
+
let inputsStore = null;
|
|
12666
|
+
let outputsStore = null;
|
|
12667
|
+
for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
|
12668
|
+
const directiveDef = tViewData[directiveIndex];
|
|
12669
|
+
const aliasData = hostDirectiveDefinitionMap
|
|
12670
|
+
? hostDirectiveDefinitionMap.get(directiveDef)
|
|
12671
|
+
: null;
|
|
12672
|
+
const aliasedInputs = aliasData ? aliasData.inputs : null;
|
|
12673
|
+
const aliasedOutputs = aliasData ? aliasData.outputs : null;
|
|
12674
|
+
inputsStore = captureNodeBindings(0 /* CaptureNodeBindingMode.Inputs */, directiveDef.inputs, directiveIndex, inputsStore, aliasedInputs);
|
|
12675
|
+
outputsStore = captureNodeBindings(1 /* CaptureNodeBindingMode.Outputs */, directiveDef.outputs, directiveIndex, outputsStore, aliasedOutputs);
|
|
12676
|
+
// Do not use unbound attributes as inputs to structural directives, since structural
|
|
12677
|
+
// directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
|
|
12678
|
+
// TODO(FW-1930): microsyntax expressions may also contain unbound/static attributes, which
|
|
12679
|
+
// should be set for inline templates.
|
|
12680
|
+
const initialInputs = inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)
|
|
12681
|
+
? generateInitialInputs(inputsStore, directiveIndex, tNodeAttrs)
|
|
12682
|
+
: null;
|
|
12683
|
+
inputsFromAttrs.push(initialInputs);
|
|
12684
|
+
}
|
|
12685
|
+
if (inputsStore !== null) {
|
|
12686
|
+
if (inputsStore.hasOwnProperty('class')) {
|
|
12687
|
+
tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
|
|
12688
|
+
}
|
|
12689
|
+
if (inputsStore.hasOwnProperty('style')) {
|
|
12690
|
+
tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
|
|
12691
|
+
}
|
|
12692
|
+
}
|
|
12693
|
+
tNode.initialInputs = inputsFromAttrs;
|
|
12694
|
+
tNode.inputs = inputsStore;
|
|
12695
|
+
tNode.outputs = outputsStore;
|
|
12696
|
+
}
|
|
12535
12697
|
/**
|
|
12536
12698
|
* Mapping between attributes names that don't correspond to their element property names.
|
|
12537
12699
|
*
|
|
@@ -12632,21 +12794,149 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
|
|
|
12632
12794
|
}
|
|
12633
12795
|
}
|
|
12634
12796
|
}
|
|
12797
|
+
/**
|
|
12798
|
+
* Resolve the matched directives on a node.
|
|
12799
|
+
*/
|
|
12800
|
+
function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
12801
|
+
// Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in
|
|
12802
|
+
// tsickle.
|
|
12803
|
+
ngDevMode && assertFirstCreatePass(tView);
|
|
12804
|
+
if (getBindingsEnabled()) {
|
|
12805
|
+
const exportsMap = localRefs === null ? null : { '': -1 };
|
|
12806
|
+
const matchResult = findDirectiveDefMatches(tView, tNode);
|
|
12807
|
+
let directiveDefs;
|
|
12808
|
+
let hostDirectiveDefs;
|
|
12809
|
+
if (matchResult === null) {
|
|
12810
|
+
directiveDefs = hostDirectiveDefs = null;
|
|
12811
|
+
}
|
|
12812
|
+
else {
|
|
12813
|
+
[directiveDefs, hostDirectiveDefs] = matchResult;
|
|
12814
|
+
}
|
|
12815
|
+
if (directiveDefs !== null) {
|
|
12816
|
+
initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs);
|
|
12817
|
+
}
|
|
12818
|
+
if (exportsMap)
|
|
12819
|
+
cacheMatchingLocalNames(tNode, localRefs, exportsMap);
|
|
12820
|
+
}
|
|
12821
|
+
// Merge the template attrs last so that they have the highest priority.
|
|
12822
|
+
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
|
|
12823
|
+
}
|
|
12824
|
+
/** Initializes the data structures necessary for a list of directives to be instantiated. */
|
|
12825
|
+
function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs) {
|
|
12826
|
+
ngDevMode && assertFirstCreatePass(tView);
|
|
12827
|
+
// Publishes the directive types to DI so they can be injected. Needs to
|
|
12828
|
+
// happen in a separate pass before the TNode flags have been initialized.
|
|
12829
|
+
for (let i = 0; i < directives.length; i++) {
|
|
12830
|
+
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directives[i].type);
|
|
12831
|
+
}
|
|
12832
|
+
initTNodeFlags(tNode, tView.data.length, directives.length);
|
|
12833
|
+
// When the same token is provided by several directives on the same node, some rules apply in
|
|
12834
|
+
// the viewEngine:
|
|
12835
|
+
// - viewProviders have priority over providers
|
|
12836
|
+
// - the last directive in NgModule.declarations has priority over the previous one
|
|
12837
|
+
// So to match these rules, the order in which providers are added in the arrays is very
|
|
12838
|
+
// important.
|
|
12839
|
+
for (let i = 0; i < directives.length; i++) {
|
|
12840
|
+
const def = directives[i];
|
|
12841
|
+
if (def.providersResolver)
|
|
12842
|
+
def.providersResolver(def);
|
|
12843
|
+
}
|
|
12844
|
+
let preOrderHooksFound = false;
|
|
12845
|
+
let preOrderCheckHooksFound = false;
|
|
12846
|
+
let directiveIdx = allocExpando(tView, lView, directives.length, null);
|
|
12847
|
+
ngDevMode &&
|
|
12848
|
+
assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
|
|
12849
|
+
for (let i = 0; i < directives.length; i++) {
|
|
12850
|
+
const def = directives[i];
|
|
12851
|
+
// Merge the attrs in the order of matches. This assumes that the first directive is the
|
|
12852
|
+
// component itself, so that the component has the least priority.
|
|
12853
|
+
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
|
|
12854
|
+
configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
|
12855
|
+
saveNameToExportMap(directiveIdx, def, exportsMap);
|
|
12856
|
+
if (def.contentQueries !== null)
|
|
12857
|
+
tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
|
|
12858
|
+
if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
|
12859
|
+
tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
|
|
12860
|
+
const lifeCycleHooks = def.type.prototype;
|
|
12861
|
+
// Only push a node index into the preOrderHooks array if this is the first
|
|
12862
|
+
// pre-order hook found on this node.
|
|
12863
|
+
if (!preOrderHooksFound &&
|
|
12864
|
+
(lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
|
|
12865
|
+
// We will push the actual hook function into this array later during dir instantiation.
|
|
12866
|
+
// We cannot do it now because we must ensure hooks are registered in the same
|
|
12867
|
+
// order that directives are created (i.e. injection order).
|
|
12868
|
+
(tView.preOrderHooks ??= []).push(tNode.index);
|
|
12869
|
+
preOrderHooksFound = true;
|
|
12870
|
+
}
|
|
12871
|
+
if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
|
|
12872
|
+
(tView.preOrderCheckHooks ??= []).push(tNode.index);
|
|
12873
|
+
preOrderCheckHooksFound = true;
|
|
12874
|
+
}
|
|
12875
|
+
directiveIdx++;
|
|
12876
|
+
}
|
|
12877
|
+
initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs);
|
|
12878
|
+
}
|
|
12879
|
+
/**
|
|
12880
|
+
* Add `hostBindings` to the `TView.hostBindingOpCodes`.
|
|
12881
|
+
*
|
|
12882
|
+
* @param tView `TView` to which the `hostBindings` should be added.
|
|
12883
|
+
* @param tNode `TNode` the element which contains the directive
|
|
12884
|
+
* @param directiveIdx Directive index in view.
|
|
12885
|
+
* @param directiveVarsIdx Where will the directive's vars be stored
|
|
12886
|
+
* @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
|
|
12887
|
+
*/
|
|
12888
|
+
function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
|
|
12889
|
+
ngDevMode && assertFirstCreatePass(tView);
|
|
12890
|
+
const hostBindings = def.hostBindings;
|
|
12891
|
+
if (hostBindings) {
|
|
12892
|
+
let hostBindingOpCodes = tView.hostBindingOpCodes;
|
|
12893
|
+
if (hostBindingOpCodes === null) {
|
|
12894
|
+
hostBindingOpCodes = tView.hostBindingOpCodes = [];
|
|
12895
|
+
}
|
|
12896
|
+
const elementIndx = ~tNode.index;
|
|
12897
|
+
if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) {
|
|
12898
|
+
// Conditionally add select element so that we are more efficient in execution.
|
|
12899
|
+
// NOTE: this is strictly not necessary and it trades code size for runtime perf.
|
|
12900
|
+
// (We could just always add it.)
|
|
12901
|
+
hostBindingOpCodes.push(elementIndx);
|
|
12902
|
+
}
|
|
12903
|
+
hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings);
|
|
12904
|
+
}
|
|
12905
|
+
}
|
|
12906
|
+
/**
|
|
12907
|
+
* Returns the last selected element index in the `HostBindingOpCodes`
|
|
12908
|
+
*
|
|
12909
|
+
* For perf reasons we don't need to update the selected element index in `HostBindingOpCodes` only
|
|
12910
|
+
* if it changes. This method returns the last index (or '0' if not found.)
|
|
12911
|
+
*
|
|
12912
|
+
* Selected element index are only the ones which are negative.
|
|
12913
|
+
*/
|
|
12914
|
+
function lastSelectedElementIdx(hostBindingOpCodes) {
|
|
12915
|
+
let i = hostBindingOpCodes.length;
|
|
12916
|
+
while (i > 0) {
|
|
12917
|
+
const value = hostBindingOpCodes[--i];
|
|
12918
|
+
if (typeof value === 'number' && value < 0) {
|
|
12919
|
+
return value;
|
|
12920
|
+
}
|
|
12921
|
+
}
|
|
12922
|
+
return 0;
|
|
12923
|
+
}
|
|
12635
12924
|
/**
|
|
12636
12925
|
* Instantiate all the directives that were previously resolved on the current node.
|
|
12637
12926
|
*/
|
|
12638
|
-
function instantiateAllDirectives(tView, lView, tNode) {
|
|
12927
|
+
function instantiateAllDirectives(tView, lView, tNode, native) {
|
|
12639
12928
|
const start = tNode.directiveStart;
|
|
12640
12929
|
const end = tNode.directiveEnd;
|
|
12641
12930
|
// The component view needs to be created before creating the node injector
|
|
12642
12931
|
// since it is used to inject some special symbols like `ChangeDetectorRef`.
|
|
12643
12932
|
if (isComponentHost(tNode)) {
|
|
12644
12933
|
ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */);
|
|
12645
|
-
|
|
12934
|
+
addComponentLogic(lView, tNode, tView.data[start + tNode.componentOffset]);
|
|
12646
12935
|
}
|
|
12647
12936
|
if (!tView.firstCreatePass) {
|
|
12648
12937
|
getOrCreateNodeInjectorForNode(tNode, lView);
|
|
12649
12938
|
}
|
|
12939
|
+
attachPatchData(native, lView);
|
|
12650
12940
|
const initialInputs = tNode.initialInputs;
|
|
12651
12941
|
for (let i = start; i < end; i++) {
|
|
12652
12942
|
const def = tView.data[i];
|
|
@@ -12702,28 +12992,140 @@ function findDirectiveDefMatches(tView, tNode) {
|
|
|
12702
12992
|
ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
|
|
12703
12993
|
const registry = tView.directiveRegistry;
|
|
12704
12994
|
let matches = null;
|
|
12995
|
+
let hostDirectiveDefs = null;
|
|
12705
12996
|
if (registry) {
|
|
12706
12997
|
for (let i = 0; i < registry.length; i++) {
|
|
12707
12998
|
const def = registry[i];
|
|
12708
12999
|
if (isNodeMatchingSelectorList(tNode, def.selectors, /* isProjectionMode */ false)) {
|
|
12709
|
-
matches
|
|
13000
|
+
matches || (matches = []);
|
|
12710
13001
|
if (isComponentDef(def)) {
|
|
12711
13002
|
if (ngDevMode) {
|
|
12712
13003
|
assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
|
|
12713
13004
|
`Please use a different tag to activate the ${stringify(def.type)} component.`);
|
|
12714
|
-
if (
|
|
13005
|
+
if (isComponentHost(tNode)) {
|
|
12715
13006
|
throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
|
|
12716
13007
|
}
|
|
12717
13008
|
}
|
|
12718
|
-
matches
|
|
13009
|
+
// Components are inserted at the front of the matches array so that their lifecycle
|
|
13010
|
+
// hooks run before any directive lifecycle hooks. This appears to be for ViewEngine
|
|
13011
|
+
// compatibility. This logic doesn't make sense with host directives, because it
|
|
13012
|
+
// would allow the host directives to undo any overrides the host may have made.
|
|
13013
|
+
// To handle this case, the host directives of components are inserted at the beginning
|
|
13014
|
+
// of the array, followed by the component. As such, the insertion order is as follows:
|
|
13015
|
+
// 1. Host directives belonging to the selector-matched component.
|
|
13016
|
+
// 2. Selector-matched component.
|
|
13017
|
+
// 3. Host directives belonging to selector-matched directives.
|
|
13018
|
+
// 4. Selector-matched directives.
|
|
13019
|
+
if (def.findHostDirectiveDefs !== null) {
|
|
13020
|
+
const hostDirectiveMatches = [];
|
|
13021
|
+
hostDirectiveDefs = hostDirectiveDefs || new Map();
|
|
13022
|
+
def.findHostDirectiveDefs(def, hostDirectiveMatches, hostDirectiveDefs);
|
|
13023
|
+
// Add all host directives declared on this component, followed by the component itself.
|
|
13024
|
+
// Host directives should execute first so the host has a chance to override changes
|
|
13025
|
+
// to the DOM made by them.
|
|
13026
|
+
matches.unshift(...hostDirectiveMatches, def);
|
|
13027
|
+
// Component is offset starting from the beginning of the host directives array.
|
|
13028
|
+
const componentOffset = hostDirectiveMatches.length;
|
|
13029
|
+
markAsComponentHost(tView, tNode, componentOffset);
|
|
13030
|
+
}
|
|
13031
|
+
else {
|
|
13032
|
+
// No host directives on this component, just add the
|
|
13033
|
+
// component def to the beginning of the matches.
|
|
13034
|
+
matches.unshift(def);
|
|
13035
|
+
markAsComponentHost(tView, tNode, 0);
|
|
13036
|
+
}
|
|
12719
13037
|
}
|
|
12720
13038
|
else {
|
|
13039
|
+
// Append any host directives to the matches first.
|
|
13040
|
+
hostDirectiveDefs = hostDirectiveDefs || new Map();
|
|
13041
|
+
def.findHostDirectiveDefs?.(def, matches, hostDirectiveDefs);
|
|
12721
13042
|
matches.push(def);
|
|
12722
13043
|
}
|
|
12723
13044
|
}
|
|
12724
13045
|
}
|
|
12725
13046
|
}
|
|
12726
|
-
|
|
13047
|
+
ngDevMode && matches !== null && assertNoDuplicateDirectives(matches);
|
|
13048
|
+
return matches === null ? null : [matches, hostDirectiveDefs];
|
|
13049
|
+
}
|
|
13050
|
+
/**
|
|
13051
|
+
* Marks a given TNode as a component's host. This consists of:
|
|
13052
|
+
* - setting the component offset on the TNode.
|
|
13053
|
+
* - storing index of component's host element so it will be queued for view refresh during CD.
|
|
13054
|
+
*/
|
|
13055
|
+
function markAsComponentHost(tView, hostTNode, componentOffset) {
|
|
13056
|
+
ngDevMode && assertFirstCreatePass(tView);
|
|
13057
|
+
ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
|
|
13058
|
+
hostTNode.componentOffset = componentOffset;
|
|
13059
|
+
(tView.components ??= []).push(hostTNode.index);
|
|
13060
|
+
}
|
|
13061
|
+
/** Caches local names and their matching directive indices for query and template lookups. */
|
|
13062
|
+
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
13063
|
+
if (localRefs) {
|
|
13064
|
+
const localNames = (tNode.localNames = []);
|
|
13065
|
+
// Local names must be stored in tNode in the same order that localRefs are defined
|
|
13066
|
+
// in the template to ensure the data is loaded in the same slots as their refs
|
|
13067
|
+
// in the template (for template queries).
|
|
13068
|
+
for (let i = 0; i < localRefs.length; i += 2) {
|
|
13069
|
+
const index = exportsMap[localRefs[i + 1]];
|
|
13070
|
+
if (index == null)
|
|
13071
|
+
throw new RuntimeError(-301 /* RuntimeErrorCode.EXPORT_NOT_FOUND */, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
|
|
13072
|
+
localNames.push(localRefs[i], index);
|
|
13073
|
+
}
|
|
13074
|
+
}
|
|
13075
|
+
}
|
|
13076
|
+
/**
|
|
13077
|
+
* Builds up an export map as directives are created, so local refs can be quickly mapped
|
|
13078
|
+
* to their directive instances.
|
|
13079
|
+
*/
|
|
13080
|
+
function saveNameToExportMap(directiveIdx, def, exportsMap) {
|
|
13081
|
+
if (exportsMap) {
|
|
13082
|
+
if (def.exportAs) {
|
|
13083
|
+
for (let i = 0; i < def.exportAs.length; i++) {
|
|
13084
|
+
exportsMap[def.exportAs[i]] = directiveIdx;
|
|
13085
|
+
}
|
|
13086
|
+
}
|
|
13087
|
+
if (isComponentDef(def))
|
|
13088
|
+
exportsMap[''] = directiveIdx;
|
|
13089
|
+
}
|
|
13090
|
+
}
|
|
13091
|
+
/**
|
|
13092
|
+
* Initializes the flags on the current node, setting all indices to the initial index,
|
|
13093
|
+
* the directive count to 0, and adding the isComponent flag.
|
|
13094
|
+
* @param index the initial index
|
|
13095
|
+
*/
|
|
13096
|
+
function initTNodeFlags(tNode, index, numberOfDirectives) {
|
|
13097
|
+
ngDevMode &&
|
|
13098
|
+
assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, 'Reached the max number of directives');
|
|
13099
|
+
tNode.flags |= 1 /* TNodeFlags.isDirectiveHost */;
|
|
13100
|
+
// When the first directive is created on a node, save the index
|
|
13101
|
+
tNode.directiveStart = index;
|
|
13102
|
+
tNode.directiveEnd = index + numberOfDirectives;
|
|
13103
|
+
tNode.providerIndexes = index;
|
|
13104
|
+
}
|
|
13105
|
+
/**
|
|
13106
|
+
* Setup directive for instantiation.
|
|
13107
|
+
*
|
|
13108
|
+
* We need to create a `NodeInjectorFactory` which is then inserted in both the `Blueprint` as well
|
|
13109
|
+
* as `LView`. `TView` gets the `DirectiveDef`.
|
|
13110
|
+
*
|
|
13111
|
+
* @param tView `TView`
|
|
13112
|
+
* @param tNode `TNode`
|
|
13113
|
+
* @param lView `LView`
|
|
13114
|
+
* @param directiveIndex Index where the directive will be stored in the Expando.
|
|
13115
|
+
* @param def `DirectiveDef`
|
|
13116
|
+
*/
|
|
13117
|
+
function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
|
|
13118
|
+
ngDevMode &&
|
|
13119
|
+
assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, 'Must be in Expando section');
|
|
13120
|
+
tView.data[directiveIndex] = def;
|
|
13121
|
+
const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
|
|
13122
|
+
// Even though `directiveFactory` will already be using `ɵɵdirectiveInject` in its generated code,
|
|
13123
|
+
// we also want to support `inject()` directly from the directive constructor context so we set
|
|
13124
|
+
// `ɵɵdirectiveInject` as the inject implementation here too.
|
|
13125
|
+
const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
|
|
13126
|
+
tView.blueprint[directiveIndex] = nodeInjectorFactory;
|
|
13127
|
+
lView[directiveIndex] = nodeInjectorFactory;
|
|
13128
|
+
registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
|
|
12727
13129
|
}
|
|
12728
13130
|
/**
|
|
12729
13131
|
* Gets the initial set of LView flags based on the component definition that the LView represents.
|
|
@@ -12739,7 +13141,7 @@ function getInitialLViewFlagsFromDef(def) {
|
|
|
12739
13141
|
}
|
|
12740
13142
|
return flags;
|
|
12741
13143
|
}
|
|
12742
|
-
function
|
|
13144
|
+
function addComponentLogic(lView, hostTNode, def) {
|
|
12743
13145
|
const native = getNativeByTNode(hostTNode, lView);
|
|
12744
13146
|
const tView = getOrCreateComponentTView(def);
|
|
12745
13147
|
// Only component views should be added to the view tree directly. Embedded views are
|
|
@@ -12748,7 +13150,7 @@ function createComponentLView(lView, hostTNode, def) {
|
|
|
12748
13150
|
const componentView = addToEndOfViewTree(lView, createLView(lView, tView, null, getInitialLViewFlagsFromDef(def), native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
|
|
12749
13151
|
// Component view will always be created before any injected LContainers,
|
|
12750
13152
|
// so this is a regular element, wrap it with the component view
|
|
12751
|
-
|
|
13153
|
+
lView[hostTNode.index] = componentView;
|
|
12752
13154
|
}
|
|
12753
13155
|
function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace) {
|
|
12754
13156
|
if (ngDevMode) {
|
|
@@ -12796,6 +13198,58 @@ function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initial
|
|
|
12796
13198
|
}
|
|
12797
13199
|
}
|
|
12798
13200
|
}
|
|
13201
|
+
/**
|
|
13202
|
+
* Generates initialInputData for a node and stores it in the template's static storage
|
|
13203
|
+
* so subsequent template invocations don't have to recalculate it.
|
|
13204
|
+
*
|
|
13205
|
+
* initialInputData is an array containing values that need to be set as input properties
|
|
13206
|
+
* for directives on this node, but only once on creation. We need this array to support
|
|
13207
|
+
* the case where you set an @Input property of a directive using attribute-like syntax.
|
|
13208
|
+
* e.g. if you have a `name` @Input, you can set it once like this:
|
|
13209
|
+
*
|
|
13210
|
+
* <my-component name="Bess"></my-component>
|
|
13211
|
+
*
|
|
13212
|
+
* @param inputs Input alias map that was generated from the directive def inputs.
|
|
13213
|
+
* @param directiveIndex Index of the directive that is currently being processed.
|
|
13214
|
+
* @param attrs Static attrs on this node.
|
|
13215
|
+
*/
|
|
13216
|
+
function generateInitialInputs(inputs, directiveIndex, attrs) {
|
|
13217
|
+
let inputsToStore = null;
|
|
13218
|
+
let i = 0;
|
|
13219
|
+
while (i < attrs.length) {
|
|
13220
|
+
const attrName = attrs[i];
|
|
13221
|
+
if (attrName === 0 /* AttributeMarker.NamespaceURI */) {
|
|
13222
|
+
// We do not allow inputs on namespaced attributes.
|
|
13223
|
+
i += 4;
|
|
13224
|
+
continue;
|
|
13225
|
+
}
|
|
13226
|
+
else if (attrName === 5 /* AttributeMarker.ProjectAs */) {
|
|
13227
|
+
// Skip over the `ngProjectAs` value.
|
|
13228
|
+
i += 2;
|
|
13229
|
+
continue;
|
|
13230
|
+
}
|
|
13231
|
+
// If we hit any other attribute markers, we're done anyway. None of those are valid inputs.
|
|
13232
|
+
if (typeof attrName === 'number')
|
|
13233
|
+
break;
|
|
13234
|
+
if (inputs.hasOwnProperty(attrName)) {
|
|
13235
|
+
if (inputsToStore === null)
|
|
13236
|
+
inputsToStore = [];
|
|
13237
|
+
// Find the input's public name from the input store. Note that we can be found easier
|
|
13238
|
+
// through the directive def, but we want to do it using the inputs store so that it can
|
|
13239
|
+
// account for host directive aliases.
|
|
13240
|
+
const inputConfig = inputs[attrName];
|
|
13241
|
+
for (let j = 0; j < inputConfig.length; j += 3) {
|
|
13242
|
+
if (inputConfig[j] === directiveIndex) {
|
|
13243
|
+
inputsToStore.push(attrName, inputConfig[j + 1], inputConfig[j + 2], attrs[i + 1]);
|
|
13244
|
+
// A directive can't have multiple inputs with the same name so we can break here.
|
|
13245
|
+
break;
|
|
13246
|
+
}
|
|
13247
|
+
}
|
|
13248
|
+
}
|
|
13249
|
+
i += 2;
|
|
13250
|
+
}
|
|
13251
|
+
return inputsToStore;
|
|
13252
|
+
}
|
|
12799
13253
|
//////////////////////////
|
|
12800
13254
|
//// ViewContainer & View
|
|
12801
13255
|
//////////////////////////
|
|
@@ -12946,7 +13400,9 @@ function renderComponent(hostLView, componentHostIdx) {
|
|
|
12946
13400
|
if (hostRNode !== null && componentView[HYDRATION] === null) {
|
|
12947
13401
|
componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR]);
|
|
12948
13402
|
}
|
|
13403
|
+
profiler(18 /* ProfilerEvent.ComponentStart */);
|
|
12949
13404
|
renderView(componentTView, componentView, componentView[CONTEXT]);
|
|
13405
|
+
profiler(19 /* ProfilerEvent.ComponentEnd */, componentView[CONTEXT]);
|
|
12950
13406
|
}
|
|
12951
13407
|
/**
|
|
12952
13408
|
* Syncs an LView instance with its blueprint if they have gotten out of sync.
|
|
@@ -13092,15 +13548,6 @@ function ensureIcuContainerVisitorLoaded(loader) {
|
|
|
13092
13548
|
}
|
|
13093
13549
|
}
|
|
13094
13550
|
|
|
13095
|
-
/**
|
|
13096
|
-
* Checks whether a TNode is considered detached, i.e. not present in the
|
|
13097
|
-
* translated i18n template. We should not attempt hydration for such nodes
|
|
13098
|
-
* and instead, use a regular "creation mode".
|
|
13099
|
-
*/
|
|
13100
|
-
function isDetachedByI18n(tNode) {
|
|
13101
|
-
return (tNode.flags & 32 /* TNodeFlags.isDetached */) === 32 /* TNodeFlags.isDetached */;
|
|
13102
|
-
}
|
|
13103
|
-
|
|
13104
13551
|
/**
|
|
13105
13552
|
* NOTE: for performance reasons, the possible actions are inlined within the function instead of
|
|
13106
13553
|
* being passed as an argument.
|
|
@@ -13577,9 +14024,10 @@ function getClosestRElement(tView, tNode, lView) {
|
|
|
13577
14024
|
}
|
|
13578
14025
|
else {
|
|
13579
14026
|
ngDevMode && assertTNodeType(parentTNode, 3 /* TNodeType.AnyRNode */ | 4 /* TNodeType.Container */);
|
|
13580
|
-
|
|
14027
|
+
const { componentOffset } = parentTNode;
|
|
14028
|
+
if (componentOffset > -1) {
|
|
13581
14029
|
ngDevMode && assertTNodeForLView(parentTNode, lView);
|
|
13582
|
-
const { encapsulation } = tView.data[parentTNode.directiveStart +
|
|
14030
|
+
const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset];
|
|
13583
14031
|
// We've got a parent which is an element in the current view. We just need to verify if the
|
|
13584
14032
|
// parent element is not a component. Component's content nodes are not inserted immediately
|
|
13585
14033
|
// because they will be projected, and so doing insert at this point would be wasteful.
|
|
@@ -13770,7 +14218,7 @@ function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode,
|
|
|
13770
14218
|
tNode.flags |= 2 /* TNodeFlags.isProjected */;
|
|
13771
14219
|
}
|
|
13772
14220
|
}
|
|
13773
|
-
if (
|
|
14221
|
+
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
13774
14222
|
if (tNodeType & 8 /* TNodeType.ElementContainer */) {
|
|
13775
14223
|
applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
|
|
13776
14224
|
applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
|
|
@@ -14487,8 +14935,10 @@ function markTransplantedViewsForRefresh(lView) {
|
|
|
14487
14935
|
*/
|
|
14488
14936
|
function detectChangesInComponent(hostLView, componentHostIdx, mode) {
|
|
14489
14937
|
ngDevMode && assertEqual(isCreationMode(hostLView), false, 'Should be run in update mode');
|
|
14938
|
+
profiler(18 /* ProfilerEvent.ComponentStart */);
|
|
14490
14939
|
const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
|
|
14491
14940
|
detectChangesInViewIfAttached(componentView, mode);
|
|
14941
|
+
profiler(19 /* ProfilerEvent.ComponentEnd */, componentView[CONTEXT]);
|
|
14492
14942
|
}
|
|
14493
14943
|
/**
|
|
14494
14944
|
* Visits a view as part of change detection traversal.
|
|
@@ -17330,492 +17780,6 @@ function computeStaticStyling(tNode, attrs, writeToHost) {
|
|
|
17330
17780
|
writeToHost ? (tNode.classes = classes) : (tNode.classesWithoutHost = classes);
|
|
17331
17781
|
}
|
|
17332
17782
|
|
|
17333
|
-
function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
|
17334
|
-
const lView = getLView();
|
|
17335
|
-
// Fall back to inject() if view hasn't been created. This situation can happen in tests
|
|
17336
|
-
// if inject utilities are used before bootstrapping.
|
|
17337
|
-
if (lView === null) {
|
|
17338
|
-
// Verify that we will not get into infinite loop.
|
|
17339
|
-
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
17340
|
-
return ɵɵinject(token, flags);
|
|
17341
|
-
}
|
|
17342
|
-
const tNode = getCurrentTNode();
|
|
17343
|
-
const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
17344
|
-
ngDevMode && emitInjectEvent(token, value, flags);
|
|
17345
|
-
return value;
|
|
17346
|
-
}
|
|
17347
|
-
/**
|
|
17348
|
-
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
17349
|
-
* particular class.
|
|
17350
|
-
*
|
|
17351
|
-
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
17352
|
-
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
17353
|
-
*
|
|
17354
|
-
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
17355
|
-
* and thus in the stack trace.
|
|
17356
|
-
*
|
|
17357
|
-
* @codeGenApi
|
|
17358
|
-
*/
|
|
17359
|
-
function ɵɵinvalidFactory() {
|
|
17360
|
-
const msg = ngDevMode
|
|
17361
|
-
? `This constructor was not compatible with Dependency Injection.`
|
|
17362
|
-
: 'invalid';
|
|
17363
|
-
throw new Error(msg);
|
|
17364
|
-
}
|
|
17365
|
-
|
|
17366
|
-
/**
|
|
17367
|
-
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
17368
|
-
* i18nApply()), we need to adjust the blueprint for future template passes.
|
|
17369
|
-
*
|
|
17370
|
-
* @param tView `TView` associated with `LView`
|
|
17371
|
-
* @param lView The `LView` containing the blueprint to adjust
|
|
17372
|
-
* @param numSlotsToAlloc The number of slots to alloc in the LView, should be >0
|
|
17373
|
-
* @param initialValue Initial value to store in blueprint
|
|
17374
|
-
*/
|
|
17375
|
-
function allocExpando(tView, lView, numSlotsToAlloc, initialValue) {
|
|
17376
|
-
if (numSlotsToAlloc === 0)
|
|
17377
|
-
return -1;
|
|
17378
|
-
if (ngDevMode) {
|
|
17379
|
-
assertFirstCreatePass(tView);
|
|
17380
|
-
assertSame(tView, lView[TVIEW], '`LView` must be associated with `TView`!');
|
|
17381
|
-
assertEqual(tView.data.length, lView.length, 'Expecting LView to be same size as TView');
|
|
17382
|
-
assertEqual(tView.data.length, tView.blueprint.length, 'Expecting Blueprint to be same size as TView');
|
|
17383
|
-
assertFirstUpdatePass(tView);
|
|
17384
|
-
}
|
|
17385
|
-
const allocIdx = lView.length;
|
|
17386
|
-
for (let i = 0; i < numSlotsToAlloc; i++) {
|
|
17387
|
-
lView.push(initialValue);
|
|
17388
|
-
tView.blueprint.push(initialValue);
|
|
17389
|
-
tView.data.push(null);
|
|
17390
|
-
}
|
|
17391
|
-
return allocIdx;
|
|
17392
|
-
}
|
|
17393
|
-
|
|
17394
|
-
/**
|
|
17395
|
-
* Resolve the matched directives on a node.
|
|
17396
|
-
*/
|
|
17397
|
-
function resolveDirectives(tView, lView, tNode, localRefs, directiveMatcher) {
|
|
17398
|
-
// Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in
|
|
17399
|
-
// tsickle.
|
|
17400
|
-
ngDevMode && assertFirstCreatePass(tView);
|
|
17401
|
-
const exportsMap = localRefs === null ? null : { '': -1 };
|
|
17402
|
-
const matchedDirectiveDefs = directiveMatcher(tView, tNode);
|
|
17403
|
-
if (matchedDirectiveDefs !== null) {
|
|
17404
|
-
const [directiveDefs, hostDirectiveDefs] = resolveHostDirectives(tView, tNode, matchedDirectiveDefs);
|
|
17405
|
-
initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs);
|
|
17406
|
-
}
|
|
17407
|
-
if (exportsMap !== null && localRefs !== null) {
|
|
17408
|
-
cacheMatchingLocalNames(tNode, localRefs, exportsMap);
|
|
17409
|
-
}
|
|
17410
|
-
}
|
|
17411
|
-
/** Caches local names and their matching directive indices for query and template lookups. */
|
|
17412
|
-
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
17413
|
-
const localNames = (tNode.localNames = []);
|
|
17414
|
-
// Local names must be stored in tNode in the same order that localRefs are defined
|
|
17415
|
-
// in the template to ensure the data is loaded in the same slots as their refs
|
|
17416
|
-
// in the template (for template queries).
|
|
17417
|
-
for (let i = 0; i < localRefs.length; i += 2) {
|
|
17418
|
-
const index = exportsMap[localRefs[i + 1]];
|
|
17419
|
-
if (index == null)
|
|
17420
|
-
throw new RuntimeError(-301 /* RuntimeErrorCode.EXPORT_NOT_FOUND */, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
|
|
17421
|
-
localNames.push(localRefs[i], index);
|
|
17422
|
-
}
|
|
17423
|
-
}
|
|
17424
|
-
function resolveHostDirectives(tView, tNode, matches) {
|
|
17425
|
-
const allDirectiveDefs = [];
|
|
17426
|
-
let hostDirectiveDefs = null;
|
|
17427
|
-
for (const def of matches) {
|
|
17428
|
-
if (def.findHostDirectiveDefs !== null) {
|
|
17429
|
-
// TODO(pk): probably could return matches instead of taking in an array to fill in?
|
|
17430
|
-
hostDirectiveDefs ??= new Map();
|
|
17431
|
-
// Components are inserted at the front of the matches array so that their lifecycle
|
|
17432
|
-
// hooks run before any directive lifecycle hooks. This appears to be for ViewEngine
|
|
17433
|
-
// compatibility. This logic doesn't make sense with host directives, because it
|
|
17434
|
-
// would allow the host directives to undo any overrides the host may have made.
|
|
17435
|
-
// To handle this case, the host directives of components are inserted at the beginning
|
|
17436
|
-
// of the array, followed by the component. As such, the insertion order is as follows:
|
|
17437
|
-
// 1. Host directives belonging to the selector-matched component.
|
|
17438
|
-
// 2. Selector-matched component.
|
|
17439
|
-
// 3. Host directives belonging to selector-matched directives.
|
|
17440
|
-
// 4. Selector-matched directives.
|
|
17441
|
-
def.findHostDirectiveDefs(def, allDirectiveDefs, hostDirectiveDefs);
|
|
17442
|
-
}
|
|
17443
|
-
if (isComponentDef(def)) {
|
|
17444
|
-
allDirectiveDefs.push(def);
|
|
17445
|
-
markAsComponentHost(tView, tNode, allDirectiveDefs.length - 1);
|
|
17446
|
-
}
|
|
17447
|
-
}
|
|
17448
|
-
if (isComponentHost(tNode)) {
|
|
17449
|
-
allDirectiveDefs.push(...matches.slice(1));
|
|
17450
|
-
}
|
|
17451
|
-
else {
|
|
17452
|
-
allDirectiveDefs.push(...matches);
|
|
17453
|
-
}
|
|
17454
|
-
if (ngDevMode) {
|
|
17455
|
-
assertNoDuplicateDirectives(allDirectiveDefs);
|
|
17456
|
-
}
|
|
17457
|
-
return [allDirectiveDefs, hostDirectiveDefs];
|
|
17458
|
-
}
|
|
17459
|
-
/**
|
|
17460
|
-
* Marks a given TNode as a component's host. This consists of:
|
|
17461
|
-
* - setting the component offset on the TNode.
|
|
17462
|
-
* - storing index of component's host element so it will be queued for view refresh during CD.
|
|
17463
|
-
*/
|
|
17464
|
-
function markAsComponentHost(tView, hostTNode, componentOffset) {
|
|
17465
|
-
ngDevMode && assertFirstCreatePass(tView);
|
|
17466
|
-
ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
|
|
17467
|
-
hostTNode.componentOffset = componentOffset;
|
|
17468
|
-
(tView.components ??= []).push(hostTNode.index);
|
|
17469
|
-
}
|
|
17470
|
-
/** Initializes the data structures necessary for a list of directives to be instantiated. */
|
|
17471
|
-
function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs) {
|
|
17472
|
-
ngDevMode && assertFirstCreatePass(tView);
|
|
17473
|
-
// Publishes the directive types to DI so they can be injected. Needs to
|
|
17474
|
-
// happen in a separate pass before the TNode flags have been initialized.
|
|
17475
|
-
for (let i = 0; i < directives.length; i++) {
|
|
17476
|
-
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directives[i].type);
|
|
17477
|
-
}
|
|
17478
|
-
initTNodeFlags(tNode, tView.data.length, directives.length);
|
|
17479
|
-
// When the same token is provided by several directives on the same node, some rules apply in
|
|
17480
|
-
// the viewEngine:
|
|
17481
|
-
// - viewProviders have priority over providers
|
|
17482
|
-
// - the last directive in NgModule.declarations has priority over the previous one
|
|
17483
|
-
// So to match these rules, the order in which providers are added in the arrays is very
|
|
17484
|
-
// important.
|
|
17485
|
-
for (let i = 0; i < directives.length; i++) {
|
|
17486
|
-
const def = directives[i];
|
|
17487
|
-
if (def.providersResolver)
|
|
17488
|
-
def.providersResolver(def);
|
|
17489
|
-
}
|
|
17490
|
-
let preOrderHooksFound = false;
|
|
17491
|
-
let preOrderCheckHooksFound = false;
|
|
17492
|
-
let directiveIdx = allocExpando(tView, lView, directives.length, null);
|
|
17493
|
-
ngDevMode &&
|
|
17494
|
-
assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
|
|
17495
|
-
for (let i = 0; i < directives.length; i++) {
|
|
17496
|
-
const def = directives[i];
|
|
17497
|
-
// Merge the attrs in the order of matches. This assumes that the first directive is the
|
|
17498
|
-
// component itself, so that the component has the least priority.
|
|
17499
|
-
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
|
|
17500
|
-
configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
|
17501
|
-
saveNameToExportMap(directiveIdx, def, exportsMap);
|
|
17502
|
-
if (def.contentQueries !== null)
|
|
17503
|
-
tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
|
|
17504
|
-
if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
|
17505
|
-
tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
|
|
17506
|
-
const lifeCycleHooks = def.type.prototype;
|
|
17507
|
-
// Only push a node index into the preOrderHooks array if this is the first
|
|
17508
|
-
// pre-order hook found on this node.
|
|
17509
|
-
if (!preOrderHooksFound &&
|
|
17510
|
-
(lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
|
|
17511
|
-
// We will push the actual hook function into this array later during dir instantiation.
|
|
17512
|
-
// We cannot do it now because we must ensure hooks are registered in the same
|
|
17513
|
-
// order that directives are created (i.e. injection order).
|
|
17514
|
-
(tView.preOrderHooks ??= []).push(tNode.index);
|
|
17515
|
-
preOrderHooksFound = true;
|
|
17516
|
-
}
|
|
17517
|
-
if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
|
|
17518
|
-
(tView.preOrderCheckHooks ??= []).push(tNode.index);
|
|
17519
|
-
preOrderCheckHooksFound = true;
|
|
17520
|
-
}
|
|
17521
|
-
directiveIdx++;
|
|
17522
|
-
}
|
|
17523
|
-
initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs);
|
|
17524
|
-
}
|
|
17525
|
-
/**
|
|
17526
|
-
* Initializes data structures required to work with directive inputs and outputs.
|
|
17527
|
-
* Initialization is done for all directives matched on a given TNode.
|
|
17528
|
-
*/
|
|
17529
|
-
function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMap) {
|
|
17530
|
-
ngDevMode && assertFirstCreatePass(tView);
|
|
17531
|
-
const start = tNode.directiveStart;
|
|
17532
|
-
const end = tNode.directiveEnd;
|
|
17533
|
-
const tViewData = tView.data;
|
|
17534
|
-
const tNodeAttrs = tNode.attrs;
|
|
17535
|
-
const inputsFromAttrs = [];
|
|
17536
|
-
let inputsStore = null;
|
|
17537
|
-
let outputsStore = null;
|
|
17538
|
-
for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
|
17539
|
-
const directiveDef = tViewData[directiveIndex];
|
|
17540
|
-
const aliasData = hostDirectiveDefinitionMap
|
|
17541
|
-
? hostDirectiveDefinitionMap.get(directiveDef)
|
|
17542
|
-
: null;
|
|
17543
|
-
const aliasedInputs = aliasData ? aliasData.inputs : null;
|
|
17544
|
-
const aliasedOutputs = aliasData ? aliasData.outputs : null;
|
|
17545
|
-
inputsStore = captureNodeBindings(0 /* CaptureNodeBindingMode.Inputs */, directiveDef.inputs, directiveIndex, inputsStore, aliasedInputs);
|
|
17546
|
-
outputsStore = captureNodeBindings(1 /* CaptureNodeBindingMode.Outputs */, directiveDef.outputs, directiveIndex, outputsStore, aliasedOutputs);
|
|
17547
|
-
// Do not use unbound attributes as inputs to structural directives, since structural
|
|
17548
|
-
// directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
|
|
17549
|
-
const initialInputs = inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)
|
|
17550
|
-
? generateInitialInputs(inputsStore, directiveIndex, tNodeAttrs)
|
|
17551
|
-
: null;
|
|
17552
|
-
inputsFromAttrs.push(initialInputs);
|
|
17553
|
-
}
|
|
17554
|
-
if (inputsStore !== null) {
|
|
17555
|
-
if (inputsStore.hasOwnProperty('class')) {
|
|
17556
|
-
tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
|
|
17557
|
-
}
|
|
17558
|
-
if (inputsStore.hasOwnProperty('style')) {
|
|
17559
|
-
tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
|
|
17560
|
-
}
|
|
17561
|
-
}
|
|
17562
|
-
tNode.initialInputs = inputsFromAttrs;
|
|
17563
|
-
tNode.inputs = inputsStore;
|
|
17564
|
-
tNode.outputs = outputsStore;
|
|
17565
|
-
}
|
|
17566
|
-
function captureNodeBindings(mode, aliasMap, directiveIndex, bindingsResult, hostDirectiveAliasMap) {
|
|
17567
|
-
for (let publicName in aliasMap) {
|
|
17568
|
-
if (!aliasMap.hasOwnProperty(publicName)) {
|
|
17569
|
-
continue;
|
|
17570
|
-
}
|
|
17571
|
-
const value = aliasMap[publicName];
|
|
17572
|
-
if (value === undefined) {
|
|
17573
|
-
continue;
|
|
17574
|
-
}
|
|
17575
|
-
bindingsResult ??= {};
|
|
17576
|
-
let internalName;
|
|
17577
|
-
let inputFlags = InputFlags.None;
|
|
17578
|
-
// For inputs, the value might be an array capturing additional
|
|
17579
|
-
// input flags.
|
|
17580
|
-
if (Array.isArray(value)) {
|
|
17581
|
-
internalName = value[0];
|
|
17582
|
-
inputFlags = value[1];
|
|
17583
|
-
}
|
|
17584
|
-
else {
|
|
17585
|
-
internalName = value;
|
|
17586
|
-
}
|
|
17587
|
-
// If there are no host directive mappings, we want to remap using the alias map from the
|
|
17588
|
-
// definition itself. If there is an alias map, it has two functions:
|
|
17589
|
-
// 1. It serves as an allowlist of bindings that are exposed by the host directives. Only the
|
|
17590
|
-
// ones inside the host directive map will be exposed on the host.
|
|
17591
|
-
// 2. The public name of the property is aliased using the host directive alias map, rather
|
|
17592
|
-
// than the alias map from the definition.
|
|
17593
|
-
let finalPublicName = publicName;
|
|
17594
|
-
if (hostDirectiveAliasMap !== null) {
|
|
17595
|
-
// If there is no mapping, it's not part of the allowlist and this input/output
|
|
17596
|
-
// is not captured and should be ignored.
|
|
17597
|
-
if (!hostDirectiveAliasMap.hasOwnProperty(publicName)) {
|
|
17598
|
-
continue;
|
|
17599
|
-
}
|
|
17600
|
-
finalPublicName = hostDirectiveAliasMap[publicName];
|
|
17601
|
-
}
|
|
17602
|
-
if (mode === 0 /* CaptureNodeBindingMode.Inputs */) {
|
|
17603
|
-
addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName, inputFlags);
|
|
17604
|
-
}
|
|
17605
|
-
else {
|
|
17606
|
-
addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName);
|
|
17607
|
-
}
|
|
17608
|
-
}
|
|
17609
|
-
return bindingsResult;
|
|
17610
|
-
}
|
|
17611
|
-
function addPropertyBinding(bindings, directiveIndex, publicName, internalName, inputFlags) {
|
|
17612
|
-
let values;
|
|
17613
|
-
if (bindings.hasOwnProperty(publicName)) {
|
|
17614
|
-
(values = bindings[publicName]).push(directiveIndex, internalName);
|
|
17615
|
-
}
|
|
17616
|
-
else {
|
|
17617
|
-
values = bindings[publicName] = [directiveIndex, internalName];
|
|
17618
|
-
}
|
|
17619
|
-
if (inputFlags !== undefined) {
|
|
17620
|
-
values.push(inputFlags);
|
|
17621
|
-
}
|
|
17622
|
-
}
|
|
17623
|
-
/**
|
|
17624
|
-
* Generates initialInputData for a node and stores it in the template's static storage
|
|
17625
|
-
* so subsequent template invocations don't have to recalculate it.
|
|
17626
|
-
*
|
|
17627
|
-
* initialInputData is an array containing values that need to be set as input properties
|
|
17628
|
-
* for directives on this node, but only once on creation. We need this array to support
|
|
17629
|
-
* the case where you set an @Input property of a directive using attribute-like syntax.
|
|
17630
|
-
* e.g. if you have a `name` @Input, you can set it once like this:
|
|
17631
|
-
*
|
|
17632
|
-
* <my-component name="Bess"></my-component>
|
|
17633
|
-
*
|
|
17634
|
-
* @param inputs Input alias map that was generated from the directive def inputs.
|
|
17635
|
-
* @param directiveIndex Index of the directive that is currently being processed.
|
|
17636
|
-
* @param attrs Static attrs on this node.
|
|
17637
|
-
*/
|
|
17638
|
-
function generateInitialInputs(inputs, directiveIndex, attrs) {
|
|
17639
|
-
let inputsToStore = null;
|
|
17640
|
-
let i = 0;
|
|
17641
|
-
while (i < attrs.length) {
|
|
17642
|
-
const attrName = attrs[i];
|
|
17643
|
-
if (attrName === 0 /* AttributeMarker.NamespaceURI */) {
|
|
17644
|
-
// We do not allow inputs on namespaced attributes.
|
|
17645
|
-
i += 4;
|
|
17646
|
-
continue;
|
|
17647
|
-
}
|
|
17648
|
-
else if (attrName === 5 /* AttributeMarker.ProjectAs */) {
|
|
17649
|
-
// Skip over the `ngProjectAs` value.
|
|
17650
|
-
i += 2;
|
|
17651
|
-
continue;
|
|
17652
|
-
}
|
|
17653
|
-
// If we hit any other attribute markers, we're done anyway. None of those are valid inputs.
|
|
17654
|
-
if (typeof attrName === 'number')
|
|
17655
|
-
break;
|
|
17656
|
-
if (inputs.hasOwnProperty(attrName)) {
|
|
17657
|
-
if (inputsToStore === null)
|
|
17658
|
-
inputsToStore = [];
|
|
17659
|
-
// Find the input's public name from the input store. Note that we can be found easier
|
|
17660
|
-
// through the directive def, but we want to do it using the inputs store so that it can
|
|
17661
|
-
// account for host directive aliases.
|
|
17662
|
-
const inputConfig = inputs[attrName];
|
|
17663
|
-
for (let j = 0; j < inputConfig.length; j += 3) {
|
|
17664
|
-
if (inputConfig[j] === directiveIndex) {
|
|
17665
|
-
inputsToStore.push(attrName, inputConfig[j + 1], inputConfig[j + 2], attrs[i + 1]);
|
|
17666
|
-
// A directive can't have multiple inputs with the same name so we can break here.
|
|
17667
|
-
break;
|
|
17668
|
-
}
|
|
17669
|
-
}
|
|
17670
|
-
}
|
|
17671
|
-
i += 2;
|
|
17672
|
-
}
|
|
17673
|
-
return inputsToStore;
|
|
17674
|
-
}
|
|
17675
|
-
/**
|
|
17676
|
-
* Setup directive for instantiation.
|
|
17677
|
-
*
|
|
17678
|
-
* We need to create a `NodeInjectorFactory` which is then inserted in both the `Blueprint` as well
|
|
17679
|
-
* as `LView`. `TView` gets the `DirectiveDef`.
|
|
17680
|
-
*
|
|
17681
|
-
* @param tView `TView`
|
|
17682
|
-
* @param tNode `TNode`
|
|
17683
|
-
* @param lView `LView`
|
|
17684
|
-
* @param directiveIndex Index where the directive will be stored in the Expando.
|
|
17685
|
-
* @param def `DirectiveDef`
|
|
17686
|
-
*/
|
|
17687
|
-
function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
|
|
17688
|
-
ngDevMode &&
|
|
17689
|
-
assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, 'Must be in Expando section');
|
|
17690
|
-
tView.data[directiveIndex] = def;
|
|
17691
|
-
const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
|
|
17692
|
-
// Even though `directiveFactory` will already be using `ɵɵdirectiveInject` in its generated code,
|
|
17693
|
-
// we also want to support `inject()` directly from the directive constructor context so we set
|
|
17694
|
-
// `ɵɵdirectiveInject` as the inject implementation here too.
|
|
17695
|
-
const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
|
|
17696
|
-
tView.blueprint[directiveIndex] = nodeInjectorFactory;
|
|
17697
|
-
lView[directiveIndex] = nodeInjectorFactory;
|
|
17698
|
-
registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
|
|
17699
|
-
}
|
|
17700
|
-
/**
|
|
17701
|
-
* Add `hostBindings` to the `TView.hostBindingOpCodes`.
|
|
17702
|
-
*
|
|
17703
|
-
* @param tView `TView` to which the `hostBindings` should be added.
|
|
17704
|
-
* @param tNode `TNode` the element which contains the directive
|
|
17705
|
-
* @param directiveIdx Directive index in view.
|
|
17706
|
-
* @param directiveVarsIdx Where will the directive's vars be stored
|
|
17707
|
-
* @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
|
|
17708
|
-
*/
|
|
17709
|
-
function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
|
|
17710
|
-
ngDevMode && assertFirstCreatePass(tView);
|
|
17711
|
-
const hostBindings = def.hostBindings;
|
|
17712
|
-
if (hostBindings) {
|
|
17713
|
-
let hostBindingOpCodes = tView.hostBindingOpCodes;
|
|
17714
|
-
if (hostBindingOpCodes === null) {
|
|
17715
|
-
hostBindingOpCodes = tView.hostBindingOpCodes = [];
|
|
17716
|
-
}
|
|
17717
|
-
const elementIndx = ~tNode.index;
|
|
17718
|
-
if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) {
|
|
17719
|
-
// Conditionally add select element so that we are more efficient in execution.
|
|
17720
|
-
// NOTE: this is strictly not necessary and it trades code size for runtime perf.
|
|
17721
|
-
// (We could just always add it.)
|
|
17722
|
-
hostBindingOpCodes.push(elementIndx);
|
|
17723
|
-
}
|
|
17724
|
-
hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings);
|
|
17725
|
-
}
|
|
17726
|
-
}
|
|
17727
|
-
/**
|
|
17728
|
-
* Returns the last selected element index in the `HostBindingOpCodes`
|
|
17729
|
-
*
|
|
17730
|
-
* For perf reasons we don't need to update the selected element index in `HostBindingOpCodes` only
|
|
17731
|
-
* if it changes. This method returns the last index (or '0' if not found.)
|
|
17732
|
-
*
|
|
17733
|
-
* Selected element index are only the ones which are negative.
|
|
17734
|
-
*/
|
|
17735
|
-
function lastSelectedElementIdx(hostBindingOpCodes) {
|
|
17736
|
-
let i = hostBindingOpCodes.length;
|
|
17737
|
-
while (i > 0) {
|
|
17738
|
-
const value = hostBindingOpCodes[--i];
|
|
17739
|
-
if (typeof value === 'number' && value < 0) {
|
|
17740
|
-
return value;
|
|
17741
|
-
}
|
|
17742
|
-
}
|
|
17743
|
-
return 0;
|
|
17744
|
-
}
|
|
17745
|
-
/**
|
|
17746
|
-
* Builds up an export map as directives are created, so local refs can be quickly mapped
|
|
17747
|
-
* to their directive instances.
|
|
17748
|
-
*/
|
|
17749
|
-
function saveNameToExportMap(directiveIdx, def, exportsMap) {
|
|
17750
|
-
if (exportsMap) {
|
|
17751
|
-
if (def.exportAs) {
|
|
17752
|
-
for (let i = 0; i < def.exportAs.length; i++) {
|
|
17753
|
-
exportsMap[def.exportAs[i]] = directiveIdx;
|
|
17754
|
-
}
|
|
17755
|
-
}
|
|
17756
|
-
if (isComponentDef(def))
|
|
17757
|
-
exportsMap[''] = directiveIdx;
|
|
17758
|
-
}
|
|
17759
|
-
}
|
|
17760
|
-
/**
|
|
17761
|
-
* Initializes the flags on the current node, setting all indices to the initial index,
|
|
17762
|
-
* the directive count to 0, and adding the isComponent flag.
|
|
17763
|
-
* @param index the initial index
|
|
17764
|
-
*/
|
|
17765
|
-
function initTNodeFlags(tNode, index, numberOfDirectives) {
|
|
17766
|
-
ngDevMode &&
|
|
17767
|
-
assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, 'Reached the max number of directives');
|
|
17768
|
-
tNode.flags |= 1 /* TNodeFlags.isDirectiveHost */;
|
|
17769
|
-
// When the first directive is created on a node, save the index
|
|
17770
|
-
tNode.directiveStart = index;
|
|
17771
|
-
tNode.directiveEnd = index + numberOfDirectives;
|
|
17772
|
-
tNode.providerIndexes = index;
|
|
17773
|
-
}
|
|
17774
|
-
function assertNoDuplicateDirectives(directives) {
|
|
17775
|
-
// The array needs at least two elements in order to have duplicates.
|
|
17776
|
-
if (directives.length < 2) {
|
|
17777
|
-
return;
|
|
17778
|
-
}
|
|
17779
|
-
const seenDirectives = new Set();
|
|
17780
|
-
for (const current of directives) {
|
|
17781
|
-
if (seenDirectives.has(current)) {
|
|
17782
|
-
throw new RuntimeError(309 /* RuntimeErrorCode.DUPLICATE_DIRECTIVE */, `Directive ${current.type.name} matches multiple times on the same element. ` +
|
|
17783
|
-
`Directives can only match an element once.`);
|
|
17784
|
-
}
|
|
17785
|
-
seenDirectives.add(current);
|
|
17786
|
-
}
|
|
17787
|
-
}
|
|
17788
|
-
|
|
17789
|
-
function elementStartFirstCreatePass(index, tView, lView, name, directiveMatcher, bindingsEnabled, attrsIndex, localRefsIndex) {
|
|
17790
|
-
ngDevMode && assertFirstCreatePass(tView);
|
|
17791
|
-
ngDevMode && ngDevMode.firstCreatePass++;
|
|
17792
|
-
const tViewConsts = tView.consts;
|
|
17793
|
-
const attrs = getConstant(tViewConsts, attrsIndex);
|
|
17794
|
-
const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
|
|
17795
|
-
if (bindingsEnabled) {
|
|
17796
|
-
resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), directiveMatcher);
|
|
17797
|
-
}
|
|
17798
|
-
// Merge the template attrs last so that they have the highest priority.
|
|
17799
|
-
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
|
|
17800
|
-
if (tNode.attrs !== null) {
|
|
17801
|
-
computeStaticStyling(tNode, tNode.attrs, false);
|
|
17802
|
-
}
|
|
17803
|
-
if (tNode.mergedAttrs !== null) {
|
|
17804
|
-
computeStaticStyling(tNode, tNode.mergedAttrs, true);
|
|
17805
|
-
}
|
|
17806
|
-
if (tView.queries !== null) {
|
|
17807
|
-
tView.queries.elementStart(tView, tNode);
|
|
17808
|
-
}
|
|
17809
|
-
return tNode;
|
|
17810
|
-
}
|
|
17811
|
-
function elementEndFirstCreatePass(tView, tNode) {
|
|
17812
|
-
ngDevMode && assertFirstCreatePass(tView);
|
|
17813
|
-
registerPostOrderHooks(tView, tNode);
|
|
17814
|
-
if (isContentQueryHost(tNode)) {
|
|
17815
|
-
tView.queries.elementEnd(tNode);
|
|
17816
|
-
}
|
|
17817
|
-
}
|
|
17818
|
-
|
|
17819
17783
|
class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
|
|
17820
17784
|
ngModule;
|
|
17821
17785
|
/**
|
|
@@ -17860,51 +17824,18 @@ function toRefArray(map, isInputMap) {
|
|
|
17860
17824
|
}
|
|
17861
17825
|
return array;
|
|
17862
17826
|
}
|
|
17863
|
-
function
|
|
17864
|
-
|
|
17865
|
-
|
|
17866
|
-
componentDef.debugInfo?.forbidOrphanRendering) {
|
|
17867
|
-
if (depsTracker.isOrphanComponent(componentDef.type)) {
|
|
17868
|
-
throw new RuntimeError(981 /* RuntimeErrorCode.RUNTIME_DEPS_ORPHAN_COMPONENT */, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(componentDef.type)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`);
|
|
17869
|
-
}
|
|
17870
|
-
}
|
|
17871
|
-
}
|
|
17872
|
-
function createRootViewInjector(componentDef, environmentInjector, injector) {
|
|
17873
|
-
let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector
|
|
17874
|
-
? environmentInjector
|
|
17875
|
-
: environmentInjector?.injector;
|
|
17876
|
-
if (realEnvironmentInjector && componentDef.getStandaloneInjector !== null) {
|
|
17877
|
-
realEnvironmentInjector =
|
|
17878
|
-
componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector;
|
|
17879
|
-
}
|
|
17880
|
-
const rootViewInjector = realEnvironmentInjector
|
|
17881
|
-
? new ChainedInjector(injector, realEnvironmentInjector)
|
|
17882
|
-
: injector;
|
|
17883
|
-
return rootViewInjector;
|
|
17884
|
-
}
|
|
17885
|
-
function createRootLViewEnvironment(rootLViewInjector) {
|
|
17886
|
-
const rendererFactory = rootLViewInjector.get(RendererFactory2, null);
|
|
17887
|
-
if (rendererFactory === null) {
|
|
17888
|
-
throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
|
|
17889
|
-
'Angular was not able to inject a renderer (RendererFactory2). ' +
|
|
17890
|
-
'Likely this is due to a broken DI hierarchy. ' +
|
|
17891
|
-
'Make sure that any injector used to create this component has a correct parent.');
|
|
17892
|
-
}
|
|
17893
|
-
const sanitizer = rootLViewInjector.get(Sanitizer, null);
|
|
17894
|
-
const changeDetectionScheduler = rootLViewInjector.get(ChangeDetectionScheduler, null);
|
|
17895
|
-
return {
|
|
17896
|
-
rendererFactory,
|
|
17897
|
-
sanitizer,
|
|
17898
|
-
changeDetectionScheduler,
|
|
17899
|
-
};
|
|
17827
|
+
function getNamespace(elementName) {
|
|
17828
|
+
const name = elementName.toLowerCase();
|
|
17829
|
+
return name === 'svg' ? SVG_NAMESPACE : name === 'math' ? MATH_ML_NAMESPACE : null;
|
|
17900
17830
|
}
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17831
|
+
// TODO(pk): change the extractAttrsAndClassesFromSelector so it returns TAttributes already?
|
|
17832
|
+
function getRootTAttributesFromSelector(selector) {
|
|
17833
|
+
const { attrs, classes } = extractAttrsAndClassesFromSelector(selector);
|
|
17834
|
+
const tAtts = attrs;
|
|
17835
|
+
if (classes.length) {
|
|
17836
|
+
tAtts.push(1 /* AttributeMarker.Classes */, ...classes);
|
|
17837
|
+
}
|
|
17838
|
+
return tAtts;
|
|
17908
17839
|
}
|
|
17909
17840
|
/**
|
|
17910
17841
|
* ComponentFactory interface implementation.
|
|
@@ -17942,55 +17873,119 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
17942
17873
|
this.ngModule = ngModule;
|
|
17943
17874
|
this.componentType = componentDef.type;
|
|
17944
17875
|
this.selector = stringifyCSSSelectorList(componentDef.selectors);
|
|
17945
|
-
this.ngContentSelectors = componentDef.ngContentSelectors
|
|
17876
|
+
this.ngContentSelectors = componentDef.ngContentSelectors
|
|
17877
|
+
? componentDef.ngContentSelectors
|
|
17878
|
+
: [];
|
|
17946
17879
|
this.isBoundToModule = !!ngModule;
|
|
17947
17880
|
}
|
|
17948
17881
|
create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
|
|
17882
|
+
profiler(22 /* ProfilerEvent.DynamicComponentStart */);
|
|
17949
17883
|
const prevConsumer = setActiveConsumer$1(null);
|
|
17950
17884
|
try {
|
|
17951
|
-
|
|
17952
|
-
ngDevMode &&
|
|
17953
|
-
|
|
17954
|
-
|
|
17955
|
-
|
|
17956
|
-
|
|
17885
|
+
// Check if the component is orphan
|
|
17886
|
+
if (ngDevMode &&
|
|
17887
|
+
(typeof ngJitMode === 'undefined' || ngJitMode) &&
|
|
17888
|
+
this.componentDef.debugInfo?.forbidOrphanRendering) {
|
|
17889
|
+
if (depsTracker.isOrphanComponent(this.componentType)) {
|
|
17890
|
+
throw new RuntimeError(981 /* RuntimeErrorCode.RUNTIME_DEPS_ORPHAN_COMPONENT */, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(this.componentType)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`);
|
|
17891
|
+
}
|
|
17892
|
+
}
|
|
17893
|
+
environmentInjector = environmentInjector || this.ngModule;
|
|
17894
|
+
let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector
|
|
17895
|
+
? environmentInjector
|
|
17896
|
+
: environmentInjector?.injector;
|
|
17897
|
+
if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
|
|
17898
|
+
realEnvironmentInjector =
|
|
17899
|
+
this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
|
|
17900
|
+
realEnvironmentInjector;
|
|
17901
|
+
}
|
|
17902
|
+
const rootViewInjector = realEnvironmentInjector
|
|
17903
|
+
? new ChainedInjector(injector, realEnvironmentInjector)
|
|
17904
|
+
: injector;
|
|
17905
|
+
const rendererFactory = rootViewInjector.get(RendererFactory2, null);
|
|
17906
|
+
if (rendererFactory === null) {
|
|
17907
|
+
throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
|
|
17908
|
+
'Angular was not able to inject a renderer (RendererFactory2). ' +
|
|
17909
|
+
'Likely this is due to a broken DI hierarchy. ' +
|
|
17910
|
+
'Make sure that any injector used to create this component has a correct parent.');
|
|
17911
|
+
}
|
|
17912
|
+
const sanitizer = rootViewInjector.get(Sanitizer, null);
|
|
17913
|
+
const changeDetectionScheduler = rootViewInjector.get(ChangeDetectionScheduler, null);
|
|
17914
|
+
const environment = {
|
|
17915
|
+
rendererFactory,
|
|
17916
|
+
sanitizer,
|
|
17917
|
+
changeDetectionScheduler,
|
|
17918
|
+
};
|
|
17919
|
+
const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
|
|
17920
|
+
// Determine a tag name used for creating host elements when this component is created
|
|
17921
|
+
// dynamically. Default to 'div' if this component did not specify any tag name in its
|
|
17922
|
+
// selector.
|
|
17923
|
+
const elementName = this.componentDef.selectors[0][0] || 'div';
|
|
17924
|
+
const hostRNode = rootSelectorOrNode
|
|
17925
|
+
? locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation, rootViewInjector)
|
|
17926
|
+
: createElementNode(hostRenderer, elementName, getNamespace(elementName));
|
|
17927
|
+
let rootFlags = 512 /* LViewFlags.IsRoot */;
|
|
17928
|
+
if (this.componentDef.signals) {
|
|
17929
|
+
rootFlags |= 4096 /* LViewFlags.SignalView */;
|
|
17930
|
+
}
|
|
17931
|
+
else if (!this.componentDef.onPush) {
|
|
17932
|
+
rootFlags |= 16 /* LViewFlags.CheckAlways */;
|
|
17933
|
+
}
|
|
17934
|
+
let hydrationInfo = null;
|
|
17935
|
+
if (hostRNode !== null) {
|
|
17936
|
+
hydrationInfo = retrieveHydrationInfo(hostRNode, rootViewInjector, true /* isRootView */);
|
|
17937
|
+
}
|
|
17957
17938
|
// Create the root view. Uses empty TView and ContentTemplate.
|
|
17958
|
-
const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null,
|
|
17959
|
-
const
|
|
17960
|
-
|
|
17961
|
-
const hostRenderer = environment.rendererFactory.createRenderer(null, cmpDef);
|
|
17962
|
-
const hostElement = rootSelectorOrNode
|
|
17963
|
-
? locateHostElement(hostRenderer, rootSelectorOrNode, cmpDef.encapsulation, rootViewInjector)
|
|
17964
|
-
: createHostElement(cmpDef, hostRenderer);
|
|
17965
|
-
const rootLView = createLView(null, rootTView, null, 512 /* LViewFlags.IsRoot */ | getInitialLViewFlagsFromDef(cmpDef), null, null, environment, hostRenderer, rootViewInjector, null, retrieveHydrationInfo(hostElement, rootViewInjector, true /* isRootView */));
|
|
17966
|
-
rootLView[HEADER_OFFSET] = hostElement;
|
|
17939
|
+
const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null, null);
|
|
17940
|
+
const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, hydrationInfo);
|
|
17941
|
+
rootLView[HEADER_OFFSET] = hostRNode;
|
|
17967
17942
|
// rootView is the parent when bootstrapping
|
|
17968
17943
|
// TODO(misko): it looks like we are entering view here but we don't really need to as
|
|
17969
17944
|
// `renderView` does that. However as the code is written it is needed because
|
|
17970
17945
|
// `createRootComponentView` and `createRootComponent` both read global state. Fixing those
|
|
17971
17946
|
// issues would allow us to drop this.
|
|
17972
17947
|
enterView(rootLView);
|
|
17948
|
+
let component;
|
|
17973
17949
|
let componentView = null;
|
|
17974
17950
|
try {
|
|
17975
|
-
const
|
|
17976
|
-
|
|
17951
|
+
const rootComponentDef = this.componentDef;
|
|
17952
|
+
let rootDirectives;
|
|
17953
|
+
let hostDirectiveDefs = null;
|
|
17954
|
+
if (rootComponentDef.findHostDirectiveDefs) {
|
|
17955
|
+
rootDirectives = [];
|
|
17956
|
+
hostDirectiveDefs = new Map();
|
|
17957
|
+
rootComponentDef.findHostDirectiveDefs(rootComponentDef, rootDirectives, hostDirectiveDefs);
|
|
17958
|
+
rootDirectives.push(rootComponentDef);
|
|
17959
|
+
ngDevMode && assertNoDuplicateDirectives(rootDirectives);
|
|
17960
|
+
}
|
|
17961
|
+
else {
|
|
17962
|
+
rootDirectives = [rootComponentDef];
|
|
17963
|
+
}
|
|
17964
|
+
// If host dom element is created (instead of being provided as part of the dynamic component creation), also apply attributes and classes extracted from component selector.
|
|
17965
|
+
const tAttributes = rootSelectorOrNode
|
|
17966
|
+
? ['ng-version', '19.2.0-next.0']
|
|
17967
|
+
: // Extract attributes and classes from the first selector only to match VE behavior.
|
|
17968
|
+
getRootTAttributesFromSelector(this.componentDef.selectors[0]);
|
|
17969
|
+
// TODO: this logic is shared with the element instruction first create pass
|
|
17970
|
+
const hostTNode = getOrCreateTNode(rootTView, HEADER_OFFSET, 2 /* TNodeType.Element */, '#host', tAttributes);
|
|
17971
|
+
for (const def of rootDirectives) {
|
|
17972
|
+
hostTNode.mergedAttrs = mergeHostAttrs(hostTNode.mergedAttrs, def.hostAttrs);
|
|
17973
|
+
}
|
|
17974
|
+
hostTNode.mergedAttrs = mergeHostAttrs(hostTNode.mergedAttrs, tAttributes);
|
|
17975
|
+
computeStaticStyling(hostTNode, hostTNode.mergedAttrs, true);
|
|
17977
17976
|
// TODO(crisbeto): in practice `hostRNode` should always be defined, but there are some
|
|
17978
17977
|
// tests where the renderer is mocked out and `undefined` is returned. We should update the
|
|
17979
17978
|
// tests so that this check can be removed.
|
|
17980
|
-
if (
|
|
17981
|
-
setupStaticAttributes(hostRenderer,
|
|
17982
|
-
attachPatchData(hostElement, rootLView);
|
|
17979
|
+
if (hostRNode) {
|
|
17980
|
+
setupStaticAttributes(hostRenderer, hostRNode, hostTNode);
|
|
17983
17981
|
}
|
|
17984
|
-
|
|
17985
|
-
createDirectivesInstances(rootTView, rootLView, hostTNode);
|
|
17986
|
-
executeContentQueries(rootTView, hostTNode, rootLView);
|
|
17987
|
-
elementEndFirstCreatePass(rootTView, hostTNode);
|
|
17982
|
+
componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, environment);
|
|
17988
17983
|
if (projectableNodes !== undefined) {
|
|
17989
17984
|
projectNodes(hostTNode, this.ngContentSelectors, projectableNodes);
|
|
17990
17985
|
}
|
|
17991
|
-
|
|
17992
|
-
//
|
|
17993
|
-
|
|
17986
|
+
// TODO: should LifecycleHooksFeature and other host features be generated by the compiler
|
|
17987
|
+
// and executed here? Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
|
|
17988
|
+
component = createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, [LifecycleHooksFeature]);
|
|
17994
17989
|
renderView(rootTView, rootLView, null);
|
|
17995
17990
|
}
|
|
17996
17991
|
catch (e) {
|
|
@@ -18003,9 +17998,11 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
18003
17998
|
throw e;
|
|
18004
17999
|
}
|
|
18005
18000
|
finally {
|
|
18001
|
+
profiler(23 /* ProfilerEvent.DynamicComponentEnd */);
|
|
18006
18002
|
leaveView();
|
|
18007
18003
|
}
|
|
18008
|
-
|
|
18004
|
+
const hostTNode = getTNode(rootTView, HEADER_OFFSET);
|
|
18005
|
+
return new ComponentRef(this.componentType, component, createElementRef(hostTNode, rootLView), rootLView, hostTNode);
|
|
18009
18006
|
}
|
|
18010
18007
|
finally {
|
|
18011
18008
|
setActiveConsumer$1(prevConsumer);
|
|
@@ -18021,20 +18018,20 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
18021
18018
|
*
|
|
18022
18019
|
*/
|
|
18023
18020
|
class ComponentRef extends ComponentRef$1 {
|
|
18021
|
+
location;
|
|
18024
18022
|
_rootLView;
|
|
18023
|
+
_tNode;
|
|
18025
18024
|
instance;
|
|
18026
18025
|
hostView;
|
|
18027
18026
|
changeDetectorRef;
|
|
18028
18027
|
componentType;
|
|
18029
|
-
location;
|
|
18030
18028
|
previousInputValues = null;
|
|
18031
|
-
_tNode
|
|
18032
|
-
constructor(componentType, _rootLView) {
|
|
18029
|
+
constructor(componentType, instance, location, _rootLView, _tNode) {
|
|
18033
18030
|
super();
|
|
18031
|
+
this.location = location;
|
|
18034
18032
|
this._rootLView = _rootLView;
|
|
18035
|
-
this._tNode =
|
|
18036
|
-
this.
|
|
18037
|
-
this.instance = getComponentLViewByIndex(this._tNode.index, _rootLView)[CONTEXT];
|
|
18033
|
+
this._tNode = _tNode;
|
|
18034
|
+
this.instance = instance;
|
|
18038
18035
|
this.hostView = this.changeDetectorRef = new ViewRef$1(_rootLView, undefined /* _cdRefInjectingView */, false /* notifyErrorHandler */);
|
|
18039
18036
|
this.componentType = componentType;
|
|
18040
18037
|
}
|
|
@@ -18074,6 +18071,70 @@ class ComponentRef extends ComponentRef$1 {
|
|
|
18074
18071
|
this.hostView.onDestroy(callback);
|
|
18075
18072
|
}
|
|
18076
18073
|
}
|
|
18074
|
+
/**
|
|
18075
|
+
* Creates the root component view and the root component node.
|
|
18076
|
+
*
|
|
18077
|
+
* @param hostRNode Render host element.
|
|
18078
|
+
* @param rootComponentDef ComponentDef
|
|
18079
|
+
* @param rootView The parent view where the host node is stored
|
|
18080
|
+
* @param rendererFactory Factory to be used for creating child renderers.
|
|
18081
|
+
* @param hostRenderer The current renderer
|
|
18082
|
+
* @param sanitizer The sanitizer, if provided
|
|
18083
|
+
*
|
|
18084
|
+
* @returns Component view created
|
|
18085
|
+
*/
|
|
18086
|
+
function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirectives, rootView, environment) {
|
|
18087
|
+
const tView = rootView[TVIEW];
|
|
18088
|
+
// Hydration info is on the host element and needs to be retrieved
|
|
18089
|
+
// and passed to the component LView.
|
|
18090
|
+
let hydrationInfo = null;
|
|
18091
|
+
if (hostRNode !== null) {
|
|
18092
|
+
hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR]);
|
|
18093
|
+
}
|
|
18094
|
+
const viewRenderer = environment.rendererFactory.createRenderer(hostRNode, rootComponentDef);
|
|
18095
|
+
const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, getInitialLViewFlagsFromDef(rootComponentDef), rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
|
|
18096
|
+
if (tView.firstCreatePass) {
|
|
18097
|
+
markAsComponentHost(tView, tNode, rootDirectives.length - 1);
|
|
18098
|
+
}
|
|
18099
|
+
addToEndOfViewTree(rootView, componentView);
|
|
18100
|
+
// Store component view at node index, with node as the HOST
|
|
18101
|
+
return (rootView[tNode.index] = componentView);
|
|
18102
|
+
}
|
|
18103
|
+
/**
|
|
18104
|
+
* Creates a root component and sets it up with features and host bindings.Shared by
|
|
18105
|
+
* renderComponent() and ViewContainerRef.createComponent().
|
|
18106
|
+
*/
|
|
18107
|
+
function createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, hostFeatures) {
|
|
18108
|
+
const rootTNode = getCurrentTNode();
|
|
18109
|
+
ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
|
|
18110
|
+
const tView = rootLView[TVIEW];
|
|
18111
|
+
const native = getNativeByTNode(rootTNode, rootLView);
|
|
18112
|
+
initializeDirectives(tView, rootLView, rootTNode, rootDirectives, null, hostDirectiveDefs);
|
|
18113
|
+
for (let i = 0; i < rootDirectives.length; i++) {
|
|
18114
|
+
const directiveIndex = rootTNode.directiveStart + i;
|
|
18115
|
+
const directiveInstance = getNodeInjectable(rootLView, tView, directiveIndex, rootTNode);
|
|
18116
|
+
attachPatchData(directiveInstance, rootLView);
|
|
18117
|
+
}
|
|
18118
|
+
invokeDirectivesHostBindings(tView, rootLView, rootTNode);
|
|
18119
|
+
if (native) {
|
|
18120
|
+
attachPatchData(native, rootLView);
|
|
18121
|
+
}
|
|
18122
|
+
// We're guaranteed for the `componentOffset` to be positive here
|
|
18123
|
+
// since a root component always matches a component def.
|
|
18124
|
+
ngDevMode &&
|
|
18125
|
+
assertGreaterThan(rootTNode.componentOffset, -1, 'componentOffset must be great than -1');
|
|
18126
|
+
const component = getNodeInjectable(rootLView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
|
|
18127
|
+
componentView[CONTEXT] = rootLView[CONTEXT] = component;
|
|
18128
|
+
if (hostFeatures !== null) {
|
|
18129
|
+
for (const feature of hostFeatures) {
|
|
18130
|
+
feature(component, rootComponentDef);
|
|
18131
|
+
}
|
|
18132
|
+
}
|
|
18133
|
+
// We want to generate an empty QueryList for root content queries for backwards
|
|
18134
|
+
// compatibility with ViewEngine.
|
|
18135
|
+
executeContentQueries(tView, rootTNode, rootLView);
|
|
18136
|
+
return component;
|
|
18137
|
+
}
|
|
18077
18138
|
/** Projects the `projectableNodes` that were specified when creating a root component. */
|
|
18078
18139
|
function projectNodes(tNode, ngContentSelectors, projectableNodes) {
|
|
18079
18140
|
const projection = (tNode.projection = []);
|
|
@@ -18087,6 +18148,24 @@ function projectNodes(tNode, ngContentSelectors, projectableNodes) {
|
|
|
18087
18148
|
projection.push(nodesforSlot != null && nodesforSlot.length ? Array.from(nodesforSlot) : null);
|
|
18088
18149
|
}
|
|
18089
18150
|
}
|
|
18151
|
+
/**
|
|
18152
|
+
* Used to enable lifecycle hooks on the root component.
|
|
18153
|
+
*
|
|
18154
|
+
* Include this feature when calling `renderComponent` if the root component
|
|
18155
|
+
* you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
|
|
18156
|
+
* be called properly.
|
|
18157
|
+
*
|
|
18158
|
+
* Example:
|
|
18159
|
+
*
|
|
18160
|
+
* ```ts
|
|
18161
|
+
* renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
|
|
18162
|
+
* ```
|
|
18163
|
+
*/
|
|
18164
|
+
function LifecycleHooksFeature() {
|
|
18165
|
+
const tNode = getCurrentTNode();
|
|
18166
|
+
ngDevMode && assertDefined(tNode, 'TNode is required');
|
|
18167
|
+
registerPostOrderHooks(getLView()[TVIEW], tNode);
|
|
18168
|
+
}
|
|
18090
18169
|
|
|
18091
18170
|
/**
|
|
18092
18171
|
* Represents a container where one or more views can be attached to a component.
|
|
@@ -20596,17 +20675,22 @@ function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
|
|
|
20596
20675
|
return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
|
|
20597
20676
|
}
|
|
20598
20677
|
|
|
20678
|
+
/**
|
|
20679
|
+
* Checks whether a TNode is considered detached, i.e. not present in the
|
|
20680
|
+
* translated i18n template. We should not attempt hydration for such nodes
|
|
20681
|
+
* and instead, use a regular "creation mode".
|
|
20682
|
+
*/
|
|
20683
|
+
function isDetachedByI18n(tNode) {
|
|
20684
|
+
return (tNode.flags & 32 /* TNodeFlags.isDetached */) === 32 /* TNodeFlags.isDetached */;
|
|
20685
|
+
}
|
|
20686
|
+
|
|
20599
20687
|
function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrs, localRefsIndex) {
|
|
20600
20688
|
ngDevMode && assertFirstCreatePass(tView);
|
|
20601
20689
|
ngDevMode && ngDevMode.firstCreatePass++;
|
|
20602
20690
|
const tViewConsts = tView.consts;
|
|
20603
20691
|
// TODO(pk): refactor getOrCreateTNode to have the "create" only version
|
|
20604
20692
|
const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, attrs || null);
|
|
20605
|
-
|
|
20606
|
-
resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), findDirectiveDefMatches);
|
|
20607
|
-
}
|
|
20608
|
-
// Merge the template attrs last so that they have the highest priority.
|
|
20609
|
-
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
|
|
20693
|
+
resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
|
20610
20694
|
registerPostOrderHooks(tView, tNode);
|
|
20611
20695
|
const embeddedTView = (tNode.tView = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts, null /* ssrId */));
|
|
20612
20696
|
if (tView.queries !== null) {
|
|
@@ -20649,7 +20733,7 @@ function declareTemplate(declarationLView, declarationTView, index, templateFn,
|
|
|
20649
20733
|
// In client-only mode, this function is a noop.
|
|
20650
20734
|
populateDehydratedViewsInLContainer(lContainer, tNode, declarationLView);
|
|
20651
20735
|
if (isDirectiveHost(tNode)) {
|
|
20652
|
-
|
|
20736
|
+
createDirectivesInstances(declarationTView, declarationLView, tNode);
|
|
20653
20737
|
}
|
|
20654
20738
|
if (localRefsIndex != null) {
|
|
20655
20739
|
saveResolvedLocalsInData(declarationLView, tNode, localRefExtractor);
|
|
@@ -21191,6 +21275,7 @@ function findMatchingDehydratedViewForDeferBlock(lContainer, lDetails) {
|
|
|
21191
21275
|
* Applies changes to the DOM to reflect a given state.
|
|
21192
21276
|
*/
|
|
21193
21277
|
function applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView) {
|
|
21278
|
+
profiler(20 /* ProfilerEvent.DeferBlockStateStart */);
|
|
21194
21279
|
const stateTmplIndex = getTemplateIndexForState(newState, hostLView, tNode);
|
|
21195
21280
|
if (stateTmplIndex !== null) {
|
|
21196
21281
|
lDetails[DEFER_BLOCK_STATE] = newState;
|
|
@@ -21239,6 +21324,7 @@ function applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView)
|
|
|
21239
21324
|
lDetails[ON_COMPLETE_FNS] = null;
|
|
21240
21325
|
}
|
|
21241
21326
|
}
|
|
21327
|
+
profiler(21 /* ProfilerEvent.DeferBlockStateEnd */);
|
|
21242
21328
|
}
|
|
21243
21329
|
/**
|
|
21244
21330
|
* Extends the `applyDeferBlockState` with timer-based scheduling.
|
|
@@ -23278,6 +23364,24 @@ class NgProbeToken {
|
|
|
23278
23364
|
}
|
|
23279
23365
|
/** Maximum number of times ApplicationRef will refresh all attached views in a single tick. */
|
|
23280
23366
|
const MAXIMUM_REFRESH_RERUNS = 10;
|
|
23367
|
+
function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
|
|
23368
|
+
try {
|
|
23369
|
+
const result = callback();
|
|
23370
|
+
if (isPromise(result)) {
|
|
23371
|
+
return result.catch((e) => {
|
|
23372
|
+
ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
|
23373
|
+
// rethrow as the exception handler might not do it
|
|
23374
|
+
throw e;
|
|
23375
|
+
});
|
|
23376
|
+
}
|
|
23377
|
+
return result;
|
|
23378
|
+
}
|
|
23379
|
+
catch (e) {
|
|
23380
|
+
ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
|
23381
|
+
// rethrow as the exception handler might not do it
|
|
23382
|
+
throw e;
|
|
23383
|
+
}
|
|
23384
|
+
}
|
|
23281
23385
|
function optionsReducer(dst, objs) {
|
|
23282
23386
|
if (Array.isArray(objs)) {
|
|
23283
23387
|
return objs.reduce(optionsReducer, dst);
|
|
@@ -23506,6 +23610,7 @@ class ApplicationRef {
|
|
|
23506
23610
|
* {@example core/ts/platform/platform.ts region='domNode'}
|
|
23507
23611
|
*/
|
|
23508
23612
|
bootstrap(componentOrFactory, rootSelectorOrNode) {
|
|
23613
|
+
profiler(10 /* ProfilerEvent.BootstrapComponentStart */);
|
|
23509
23614
|
(typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
|
|
23510
23615
|
const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
|
|
23511
23616
|
const initStatus = this._injector.get(ApplicationInitStatus);
|
|
@@ -23546,6 +23651,7 @@ class ApplicationRef {
|
|
|
23546
23651
|
const _console = this._injector.get(Console);
|
|
23547
23652
|
_console.log(`Angular is running in development mode.`);
|
|
23548
23653
|
}
|
|
23654
|
+
profiler(11 /* ProfilerEvent.BootstrapComponentEnd */, compRef);
|
|
23549
23655
|
return compRef;
|
|
23550
23656
|
}
|
|
23551
23657
|
/**
|
|
@@ -23566,6 +23672,7 @@ class ApplicationRef {
|
|
|
23566
23672
|
}
|
|
23567
23673
|
/** @internal */
|
|
23568
23674
|
_tick = () => {
|
|
23675
|
+
profiler(12 /* ProfilerEvent.ChangeDetectionStart */);
|
|
23569
23676
|
if (this.tracingSnapshot !== null) {
|
|
23570
23677
|
const snapshot = this.tracingSnapshot;
|
|
23571
23678
|
this.tracingSnapshot = null;
|
|
@@ -23598,6 +23705,7 @@ class ApplicationRef {
|
|
|
23598
23705
|
this._runningTick = false;
|
|
23599
23706
|
setActiveConsumer$1(prevConsumer);
|
|
23600
23707
|
this.afterTick.next();
|
|
23708
|
+
profiler(13 /* ProfilerEvent.ChangeDetectionEnd */);
|
|
23601
23709
|
}
|
|
23602
23710
|
};
|
|
23603
23711
|
/**
|
|
@@ -23613,7 +23721,9 @@ class ApplicationRef {
|
|
|
23613
23721
|
this.deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
|
|
23614
23722
|
let runs = 0;
|
|
23615
23723
|
while (this.dirtyFlags !== 0 /* ApplicationRefDirtyFlags.None */ && runs++ < MAXIMUM_REFRESH_RERUNS) {
|
|
23724
|
+
profiler(14 /* ProfilerEvent.ChangeDetectionSyncStart */);
|
|
23616
23725
|
this.synchronizeOnce();
|
|
23726
|
+
profiler(15 /* ProfilerEvent.ChangeDetectionSyncEnd */);
|
|
23617
23727
|
}
|
|
23618
23728
|
if ((typeof ngDevMode === 'undefined' || ngDevMode) && runs >= MAXIMUM_REFRESH_RERUNS) {
|
|
23619
23729
|
throw new RuntimeError(103 /* RuntimeErrorCode.INFINITE_CHANGE_DETECTION */, ngDevMode &&
|
|
@@ -27964,6 +28074,24 @@ function getExistingTNode(tView, index) {
|
|
|
27964
28074
|
return tNode;
|
|
27965
28075
|
}
|
|
27966
28076
|
|
|
28077
|
+
function elementStartFirstCreatePass(index, tView, lView, name, attrsIndex, localRefsIndex) {
|
|
28078
|
+
ngDevMode && assertFirstCreatePass(tView);
|
|
28079
|
+
ngDevMode && ngDevMode.firstCreatePass++;
|
|
28080
|
+
const tViewConsts = tView.consts;
|
|
28081
|
+
const attrs = getConstant(tViewConsts, attrsIndex);
|
|
28082
|
+
const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
|
|
28083
|
+
resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
|
28084
|
+
if (tNode.attrs !== null) {
|
|
28085
|
+
computeStaticStyling(tNode, tNode.attrs, false);
|
|
28086
|
+
}
|
|
28087
|
+
if (tNode.mergedAttrs !== null) {
|
|
28088
|
+
computeStaticStyling(tNode, tNode.mergedAttrs, true);
|
|
28089
|
+
}
|
|
28090
|
+
if (tView.queries !== null) {
|
|
28091
|
+
tView.queries.elementStart(tView, tNode);
|
|
28092
|
+
}
|
|
28093
|
+
return tNode;
|
|
28094
|
+
}
|
|
27967
28095
|
/**
|
|
27968
28096
|
* Create DOM element. The instruction must later be followed by `elementEnd()` call.
|
|
27969
28097
|
*
|
|
@@ -27988,7 +28116,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
27988
28116
|
ngDevMode && assertIndexInRange(lView, adjustedIndex);
|
|
27989
28117
|
const renderer = lView[RENDERER];
|
|
27990
28118
|
const tNode = tView.firstCreatePass
|
|
27991
|
-
? elementStartFirstCreatePass(adjustedIndex, tView, lView, name,
|
|
28119
|
+
? elementStartFirstCreatePass(adjustedIndex, tView, lView, name, attrsIndex, localRefsIndex)
|
|
27992
28120
|
: tView.data[adjustedIndex];
|
|
27993
28121
|
const native = _locateOrCreateElementNode(tView, lView, tNode, renderer, name, index);
|
|
27994
28122
|
lView[adjustedIndex] = native;
|
|
@@ -28011,7 +28139,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
28011
28139
|
}
|
|
28012
28140
|
increaseElementDepthCount();
|
|
28013
28141
|
if (hasDirectives) {
|
|
28014
|
-
|
|
28142
|
+
createDirectivesInstances(tView, lView, tNode);
|
|
28015
28143
|
executeContentQueries(tView, tNode, lView);
|
|
28016
28144
|
}
|
|
28017
28145
|
if (localRefsIndex !== null) {
|
|
@@ -28044,7 +28172,10 @@ function ɵɵelementEnd() {
|
|
|
28044
28172
|
decreaseElementDepthCount();
|
|
28045
28173
|
const tView = getTView();
|
|
28046
28174
|
if (tView.firstCreatePass) {
|
|
28047
|
-
|
|
28175
|
+
registerPostOrderHooks(tView, currentTNode);
|
|
28176
|
+
if (isContentQueryHost(currentTNode)) {
|
|
28177
|
+
tView.queries.elementEnd(currentTNode);
|
|
28178
|
+
}
|
|
28048
28179
|
}
|
|
28049
28180
|
if (tNode.classesWithoutHost != null && hasClassInput(tNode)) {
|
|
28050
28181
|
setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.classesWithoutHost, true);
|
|
@@ -28072,7 +28203,7 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
28072
28203
|
}
|
|
28073
28204
|
let _locateOrCreateElementNode = (tView, lView, tNode, renderer, name, index) => {
|
|
28074
28205
|
lastNodeWasCreated(true);
|
|
28075
|
-
return createElementNode(renderer, name, getNamespace());
|
|
28206
|
+
return createElementNode(renderer, name, getNamespace$1());
|
|
28076
28207
|
};
|
|
28077
28208
|
/**
|
|
28078
28209
|
* Enables hydration code path (to lookup existing elements in DOM)
|
|
@@ -28087,7 +28218,7 @@ function locateOrCreateElementNodeImpl(tView, lView, tNode, renderer, name, inde
|
|
|
28087
28218
|
lastNodeWasCreated(isNodeCreationMode);
|
|
28088
28219
|
// Regular creation mode.
|
|
28089
28220
|
if (isNodeCreationMode) {
|
|
28090
|
-
return createElementNode(renderer, name, getNamespace());
|
|
28221
|
+
return createElementNode(renderer, name, getNamespace$1());
|
|
28091
28222
|
}
|
|
28092
28223
|
// Hydration mode, looking up an existing element in DOM.
|
|
28093
28224
|
const native = locateNextRNode(hydrationInfo, tView, lView, tNode);
|
|
@@ -28140,11 +28271,7 @@ function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, l
|
|
|
28140
28271
|
computeStaticStyling(tNode, attrs, true);
|
|
28141
28272
|
}
|
|
28142
28273
|
const localRefs = getConstant(tViewConsts, localRefsIndex);
|
|
28143
|
-
|
|
28144
|
-
resolveDirectives(tView, lView, tNode, localRefs, findDirectiveDefMatches);
|
|
28145
|
-
}
|
|
28146
|
-
// Merge the template attrs last so that they have the highest priority.
|
|
28147
|
-
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
|
|
28274
|
+
resolveDirectives(tView, lView, tNode, localRefs);
|
|
28148
28275
|
if (tView.queries !== null) {
|
|
28149
28276
|
tView.queries.elementStart(tView, tNode);
|
|
28150
28277
|
}
|
|
@@ -28183,7 +28310,7 @@ function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
|
|
|
28183
28310
|
}
|
|
28184
28311
|
attachPatchData(comment, lView);
|
|
28185
28312
|
if (isDirectiveHost(tNode)) {
|
|
28186
|
-
|
|
28313
|
+
createDirectivesInstances(tView, lView, tNode);
|
|
28187
28314
|
executeContentQueries(tView, tNode, lView);
|
|
28188
28315
|
}
|
|
28189
28316
|
if (localRefsIndex != null) {
|
|
@@ -30363,7 +30490,7 @@ function wrapListener(tNode, lView, context, listenerFn) {
|
|
|
30363
30490
|
}
|
|
30364
30491
|
// In order to be backwards compatible with View Engine, events on component host nodes
|
|
30365
30492
|
// must also mark the component view itself dirty (i.e. the view that it owns).
|
|
30366
|
-
const startView =
|
|
30493
|
+
const startView = tNode.componentOffset > -1 ? getComponentLViewByIndex(tNode.index, lView) : lView;
|
|
30367
30494
|
markViewDirty(startView, 5 /* NotificationSource.Listener */);
|
|
30368
30495
|
let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
|
|
30369
30496
|
// A just-invoked listener function might have coalesced listeners so we need to check for
|
|
@@ -30527,7 +30654,8 @@ function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs, fallbackTemplateFn,
|
|
|
30527
30654
|
if (isEmpty && fallbackIndex !== null) {
|
|
30528
30655
|
insertFallbackContent(lView, tView, fallbackIndex);
|
|
30529
30656
|
}
|
|
30530
|
-
else if (isNodeCreationMode &&
|
|
30657
|
+
else if (isNodeCreationMode &&
|
|
30658
|
+
(tProjectionNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
30531
30659
|
// re-distribution of projectable nodes is stored on a component's view level
|
|
30532
30660
|
applyProjection(tView, lView, tProjectionNode);
|
|
30533
30661
|
}
|
|
@@ -33328,7 +33456,7 @@ function ɵɵreplaceMetadata(type, applyMetadata, namespaces, locals) {
|
|
|
33328
33456
|
for (const root of trackedViews) {
|
|
33329
33457
|
// Note: we have the additional check, because `IsRoot` can also indicate
|
|
33330
33458
|
// a component created through something like `createComponent`.
|
|
33331
|
-
if (
|
|
33459
|
+
if (root[FLAGS] & 512 /* LViewFlags.IsRoot */ && root[PARENT] === null) {
|
|
33332
33460
|
recreateMatchingLViews(newDef, oldDef, root);
|
|
33333
33461
|
}
|
|
33334
33462
|
}
|
|
@@ -33355,10 +33483,6 @@ function mergeWithExistingDefinition(currentDef, newDef) {
|
|
|
33355
33483
|
// Preserve the old `setInput` function, because it has some state.
|
|
33356
33484
|
// This is fine, because the component instance is preserved as well.
|
|
33357
33485
|
setInput: clone.setInput,
|
|
33358
|
-
// Externally this is redundant since we redeclare the definition using the original type.
|
|
33359
|
-
// Internally we may receive a definition with an alternate, but identical, type so we have
|
|
33360
|
-
// to ensure that the original one is preserved.
|
|
33361
|
-
type: clone.type,
|
|
33362
33486
|
});
|
|
33363
33487
|
ngDevMode && assertEqual(replacement, currentDef, 'Expected definition to be merged in place');
|
|
33364
33488
|
return { newDef: replacement, oldDef: clone };
|
|
@@ -34897,7 +35021,7 @@ class Version {
|
|
|
34897
35021
|
/**
|
|
34898
35022
|
* @publicApi
|
|
34899
35023
|
*/
|
|
34900
|
-
const VERSION = new Version('19.
|
|
35024
|
+
const VERSION = new Version('19.2.0-next.0');
|
|
34901
35025
|
|
|
34902
35026
|
/**
|
|
34903
35027
|
* Combination of NgModuleFactory and ComponentFactories.
|
|
@@ -36046,24 +36170,6 @@ function moduleDoBootstrap(moduleRef, allPlatformModules) {
|
|
|
36046
36170
|
}
|
|
36047
36171
|
allPlatformModules.push(moduleRef);
|
|
36048
36172
|
}
|
|
36049
|
-
function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
|
|
36050
|
-
try {
|
|
36051
|
-
const result = callback();
|
|
36052
|
-
if (isPromise(result)) {
|
|
36053
|
-
return result.catch((e) => {
|
|
36054
|
-
ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
|
36055
|
-
// rethrow as the exception handler might not do it
|
|
36056
|
-
throw e;
|
|
36057
|
-
});
|
|
36058
|
-
}
|
|
36059
|
-
return result;
|
|
36060
|
-
}
|
|
36061
|
-
catch (e) {
|
|
36062
|
-
ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
|
36063
|
-
// rethrow as the exception handler might not do it
|
|
36064
|
-
throw e;
|
|
36065
|
-
}
|
|
36066
|
-
}
|
|
36067
36173
|
|
|
36068
36174
|
/**
|
|
36069
36175
|
* The Angular platform is the entry point for Angular on a web page.
|
|
@@ -38666,7 +38772,7 @@ function createComputed(computation) {
|
|
|
38666
38772
|
producerUpdateValueVersion(node);
|
|
38667
38773
|
// Record that someone looked at this signal.
|
|
38668
38774
|
producerAccessed(node);
|
|
38669
|
-
if (node.value === ERRORED) {
|
|
38775
|
+
if (node.value === ERRORED$1) {
|
|
38670
38776
|
throw node.error;
|
|
38671
38777
|
}
|
|
38672
38778
|
return node.value;
|
|
@@ -38678,26 +38784,26 @@ function createComputed(computation) {
|
|
|
38678
38784
|
* A dedicated symbol used before a computed value has been calculated for the first time.
|
|
38679
38785
|
* Explicitly typed as `any` so we can use it as signal's value.
|
|
38680
38786
|
*/
|
|
38681
|
-
const UNSET = /* @__PURE__ */ Symbol('UNSET');
|
|
38787
|
+
const UNSET$1 = /* @__PURE__ */ Symbol('UNSET');
|
|
38682
38788
|
/**
|
|
38683
38789
|
* A dedicated symbol used in place of a computed signal value to indicate that a given computation
|
|
38684
38790
|
* is in progress. Used to detect cycles in computation chains.
|
|
38685
38791
|
* Explicitly typed as `any` so we can use it as signal's value.
|
|
38686
38792
|
*/
|
|
38687
|
-
const COMPUTING = /* @__PURE__ */ Symbol('COMPUTING');
|
|
38793
|
+
const COMPUTING$1 = /* @__PURE__ */ Symbol('COMPUTING');
|
|
38688
38794
|
/**
|
|
38689
38795
|
* A dedicated symbol used in place of a computed signal value to indicate that a given computation
|
|
38690
38796
|
* failed. The thrown error is cached until the computation gets dirty again.
|
|
38691
38797
|
* Explicitly typed as `any` so we can use it as signal's value.
|
|
38692
38798
|
*/
|
|
38693
|
-
const ERRORED = /* @__PURE__ */ Symbol('ERRORED');
|
|
38799
|
+
const ERRORED$1 = /* @__PURE__ */ Symbol('ERRORED');
|
|
38694
38800
|
// Note: Using an IIFE here to ensure that the spread assignment is not considered
|
|
38695
38801
|
// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.
|
|
38696
38802
|
// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
|
|
38697
38803
|
const COMPUTED_NODE = /* @__PURE__ */ (() => {
|
|
38698
38804
|
return {
|
|
38699
38805
|
...REACTIVE_NODE,
|
|
38700
|
-
value: UNSET,
|
|
38806
|
+
value: UNSET$1,
|
|
38701
38807
|
dirty: true,
|
|
38702
38808
|
error: null,
|
|
38703
38809
|
equal: defaultEquals,
|
|
@@ -38705,15 +38811,15 @@ const COMPUTED_NODE = /* @__PURE__ */ (() => {
|
|
|
38705
38811
|
producerMustRecompute(node) {
|
|
38706
38812
|
// Force a recomputation if there's no current value, or if the current value is in the
|
|
38707
38813
|
// process of being calculated (which should throw an error).
|
|
38708
|
-
return node.value === UNSET || node.value === COMPUTING;
|
|
38814
|
+
return node.value === UNSET$1 || node.value === COMPUTING$1;
|
|
38709
38815
|
},
|
|
38710
38816
|
producerRecomputeValue(node) {
|
|
38711
|
-
if (node.value === COMPUTING) {
|
|
38817
|
+
if (node.value === COMPUTING$1) {
|
|
38712
38818
|
// Our computation somehow led to a cyclic read of itself.
|
|
38713
38819
|
throw new Error('Detected cycle in computations.');
|
|
38714
38820
|
}
|
|
38715
38821
|
const oldValue = node.value;
|
|
38716
|
-
node.value = COMPUTING;
|
|
38822
|
+
node.value = COMPUTING$1;
|
|
38717
38823
|
const prevConsumer = consumerBeforeComputation(node);
|
|
38718
38824
|
let newValue;
|
|
38719
38825
|
let wasEqual = false;
|
|
@@ -38723,13 +38829,13 @@ const COMPUTED_NODE = /* @__PURE__ */ (() => {
|
|
|
38723
38829
|
// to track any reactive reads inside `equal`.
|
|
38724
38830
|
setActiveConsumer(null);
|
|
38725
38831
|
wasEqual =
|
|
38726
|
-
oldValue !== UNSET &&
|
|
38727
|
-
oldValue !== ERRORED &&
|
|
38728
|
-
newValue !== ERRORED &&
|
|
38832
|
+
oldValue !== UNSET$1 &&
|
|
38833
|
+
oldValue !== ERRORED$1 &&
|
|
38834
|
+
newValue !== ERRORED$1 &&
|
|
38729
38835
|
node.equal(oldValue, newValue);
|
|
38730
38836
|
}
|
|
38731
38837
|
catch (err) {
|
|
38732
|
-
newValue = ERRORED;
|
|
38838
|
+
newValue = ERRORED$1;
|
|
38733
38839
|
node.error = err;
|
|
38734
38840
|
}
|
|
38735
38841
|
finally {
|
|
@@ -38823,8 +38929,8 @@ function signalValueChanged(node) {
|
|
|
38823
38929
|
postSignalSetFn?.();
|
|
38824
38930
|
}
|
|
38825
38931
|
|
|
38826
|
-
function createLinkedSignal(sourceFn, computationFn, equalityFn) {
|
|
38827
|
-
const node = Object.create(LINKED_SIGNAL_NODE);
|
|
38932
|
+
function createLinkedSignal$1(sourceFn, computationFn, equalityFn) {
|
|
38933
|
+
const node = Object.create(LINKED_SIGNAL_NODE$1);
|
|
38828
38934
|
node.source = sourceFn;
|
|
38829
38935
|
node.computation = computationFn;
|
|
38830
38936
|
if (equalityFn != undefined) {
|
|
@@ -38835,7 +38941,7 @@ function createLinkedSignal(sourceFn, computationFn, equalityFn) {
|
|
|
38835
38941
|
producerUpdateValueVersion(node);
|
|
38836
38942
|
// Record that someone looked at this signal.
|
|
38837
38943
|
producerAccessed(node);
|
|
38838
|
-
if (node.value === ERRORED) {
|
|
38944
|
+
if (node.value === ERRORED$1) {
|
|
38839
38945
|
throw node.error;
|
|
38840
38946
|
}
|
|
38841
38947
|
return node.value;
|
|
@@ -38857,30 +38963,30 @@ function linkedSignalUpdateFn(node, updater) {
|
|
|
38857
38963
|
// Note: Using an IIFE here to ensure that the spread assignment is not considered
|
|
38858
38964
|
// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.
|
|
38859
38965
|
// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
|
|
38860
|
-
const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
|
|
38966
|
+
const LINKED_SIGNAL_NODE$1 = /* @__PURE__ */ (() => {
|
|
38861
38967
|
return {
|
|
38862
38968
|
...REACTIVE_NODE,
|
|
38863
|
-
value: UNSET,
|
|
38969
|
+
value: UNSET$1,
|
|
38864
38970
|
dirty: true,
|
|
38865
38971
|
error: null,
|
|
38866
38972
|
equal: defaultEquals,
|
|
38867
38973
|
producerMustRecompute(node) {
|
|
38868
38974
|
// Force a recomputation if there's no current value, or if the current value is in the
|
|
38869
38975
|
// process of being calculated (which should throw an error).
|
|
38870
|
-
return node.value === UNSET || node.value === COMPUTING;
|
|
38976
|
+
return node.value === UNSET$1 || node.value === COMPUTING$1;
|
|
38871
38977
|
},
|
|
38872
38978
|
producerRecomputeValue(node) {
|
|
38873
|
-
if (node.value === COMPUTING) {
|
|
38979
|
+
if (node.value === COMPUTING$1) {
|
|
38874
38980
|
// Our computation somehow led to a cyclic read of itself.
|
|
38875
38981
|
throw new Error('Detected cycle in computations.');
|
|
38876
38982
|
}
|
|
38877
38983
|
const oldValue = node.value;
|
|
38878
|
-
node.value = COMPUTING;
|
|
38984
|
+
node.value = COMPUTING$1;
|
|
38879
38985
|
const prevConsumer = consumerBeforeComputation(node);
|
|
38880
38986
|
let newValue;
|
|
38881
38987
|
try {
|
|
38882
38988
|
const newSourceValue = node.source();
|
|
38883
|
-
const prev = oldValue === UNSET || oldValue === ERRORED
|
|
38989
|
+
const prev = oldValue === UNSET$1 || oldValue === ERRORED$1
|
|
38884
38990
|
? undefined
|
|
38885
38991
|
: {
|
|
38886
38992
|
source: node.sourceValue,
|
|
@@ -38890,13 +38996,13 @@ const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
|
|
|
38890
38996
|
node.sourceValue = newSourceValue;
|
|
38891
38997
|
}
|
|
38892
38998
|
catch (err) {
|
|
38893
|
-
newValue = ERRORED;
|
|
38999
|
+
newValue = ERRORED$1;
|
|
38894
39000
|
node.error = err;
|
|
38895
39001
|
}
|
|
38896
39002
|
finally {
|
|
38897
39003
|
consumerAfterComputation(node, prevConsumer);
|
|
38898
39004
|
}
|
|
38899
|
-
if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
|
|
39005
|
+
if (oldValue !== UNSET$1 && newValue !== ERRORED$1 && node.equal(oldValue, newValue)) {
|
|
38900
39006
|
// No change to `valueVersion` - old and new values are
|
|
38901
39007
|
// semantically equivalent.
|
|
38902
39008
|
node.value = oldValue;
|
|
@@ -38998,6 +39104,7 @@ function setAlternateWeakRefImpl(impl) {
|
|
|
38998
39104
|
* @returns A promise that returns an `ApplicationRef` instance once resolved.
|
|
38999
39105
|
*/
|
|
39000
39106
|
function internalCreateApplication(config) {
|
|
39107
|
+
profiler(8 /* ProfilerEvent.BootstrapApplicationStart */);
|
|
39001
39108
|
try {
|
|
39002
39109
|
const { rootComponent, appProviders, platformProviders } = config;
|
|
39003
39110
|
if ((typeof ngDevMode === 'undefined' || ngDevMode) && rootComponent !== undefined) {
|
|
@@ -39028,6 +39135,9 @@ function internalCreateApplication(config) {
|
|
|
39028
39135
|
catch (e) {
|
|
39029
39136
|
return Promise.reject(e);
|
|
39030
39137
|
}
|
|
39138
|
+
finally {
|
|
39139
|
+
profiler(9 /* ProfilerEvent.BootstrapApplicationEnd */);
|
|
39140
|
+
}
|
|
39031
39141
|
}
|
|
39032
39142
|
|
|
39033
39143
|
/** Apps in which we've enabled event replay.
|
|
@@ -39992,12 +40102,12 @@ function printHydrationStats(injector) {
|
|
|
39992
40102
|
/**
|
|
39993
40103
|
* Returns a Promise that is resolved when an application becomes stable.
|
|
39994
40104
|
*/
|
|
39995
|
-
function whenStableWithTimeout(appRef) {
|
|
40105
|
+
function whenStableWithTimeout(appRef, injector) {
|
|
39996
40106
|
const whenStablePromise = appRef.whenStable();
|
|
39997
40107
|
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
39998
40108
|
const timeoutTime = APPLICATION_IS_STABLE_TIMEOUT;
|
|
39999
|
-
const console =
|
|
40000
|
-
const ngZone =
|
|
40109
|
+
const console = injector.get(Console);
|
|
40110
|
+
const ngZone = injector.get(NgZone);
|
|
40001
40111
|
// The following call should not and does not prevent the app to become stable
|
|
40002
40112
|
// We cannot use RxJS timer here because the app would remain unstable.
|
|
40003
40113
|
// This also avoids an extra change detection cycle.
|
|
@@ -40095,6 +40205,7 @@ function withDomHydration() {
|
|
|
40095
40205
|
useFactory: () => {
|
|
40096
40206
|
if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
|
|
40097
40207
|
const appRef = inject(ApplicationRef);
|
|
40208
|
+
const injector = inject(Injector);
|
|
40098
40209
|
return () => {
|
|
40099
40210
|
// Wait until an app becomes stable and cleanup all views that
|
|
40100
40211
|
// were not claimed during the application bootstrap process.
|
|
@@ -40103,20 +40214,11 @@ function withDomHydration() {
|
|
|
40103
40214
|
//
|
|
40104
40215
|
// Note: the cleanup task *MUST* be scheduled within the Angular zone in Zone apps
|
|
40105
40216
|
// to ensure that change detection is properly run afterward.
|
|
40106
|
-
whenStableWithTimeout(appRef).then(() => {
|
|
40107
|
-
// Note: we have to check whether the application is destroyed before
|
|
40108
|
-
// performing other operations with the `injector`.
|
|
40109
|
-
// The application may be destroyed **before** it becomes stable, so when
|
|
40110
|
-
// the `whenStableWithTimeout` resolves, the injector might already be in
|
|
40111
|
-
// a destroyed state. Thus, calling `injector.get` would throw an error
|
|
40112
|
-
// indicating that the injector has already been destroyed.
|
|
40113
|
-
if (appRef.destroyed) {
|
|
40114
|
-
return;
|
|
40115
|
-
}
|
|
40217
|
+
whenStableWithTimeout(appRef, injector).then(() => {
|
|
40116
40218
|
cleanupDehydratedViews(appRef);
|
|
40117
40219
|
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
40118
|
-
countBlocksSkippedByHydration(
|
|
40119
|
-
printHydrationStats(
|
|
40220
|
+
countBlocksSkippedByHydration(injector);
|
|
40221
|
+
printHydrationStats(injector);
|
|
40120
40222
|
}
|
|
40121
40223
|
});
|
|
40122
40224
|
};
|
|
@@ -40518,28 +40620,123 @@ function computed(computation, options) {
|
|
|
40518
40620
|
}
|
|
40519
40621
|
|
|
40520
40622
|
const identityFn = (v) => v;
|
|
40623
|
+
/**
|
|
40624
|
+
* Create a linked signal which represents state that is (re)set from a linked reactive expression.
|
|
40625
|
+
*/
|
|
40626
|
+
function createLinkedSignal(node) {
|
|
40627
|
+
const linkedSignalGetter = () => {
|
|
40628
|
+
// Check if the value needs updating before returning it.
|
|
40629
|
+
producerUpdateValueVersion$1(node);
|
|
40630
|
+
// Record that someone looked at this signal.
|
|
40631
|
+
producerAccessed$1(node);
|
|
40632
|
+
if (node.value === ERRORED) {
|
|
40633
|
+
throw node.error;
|
|
40634
|
+
}
|
|
40635
|
+
return node.value;
|
|
40636
|
+
};
|
|
40637
|
+
const getter = linkedSignalGetter;
|
|
40638
|
+
getter[SIGNAL$1] = node;
|
|
40639
|
+
if (ngDevMode) {
|
|
40640
|
+
getter.toString = () => `[LinkedSignal: ${getter()}]`;
|
|
40641
|
+
}
|
|
40642
|
+
getter.set = (newValue) => {
|
|
40643
|
+
producerUpdateValueVersion$1(node);
|
|
40644
|
+
signalSetFn$1(node, newValue);
|
|
40645
|
+
producerMarkClean$1(node);
|
|
40646
|
+
};
|
|
40647
|
+
getter.update = (updateFn) => {
|
|
40648
|
+
producerUpdateValueVersion$1(node);
|
|
40649
|
+
signalUpdateFn$1(node, updateFn);
|
|
40650
|
+
producerMarkClean$1(node);
|
|
40651
|
+
};
|
|
40652
|
+
getter.asReadonly = signalAsReadonlyFn.bind(getter);
|
|
40653
|
+
return getter;
|
|
40654
|
+
}
|
|
40521
40655
|
function linkedSignal(optionsOrComputation, options) {
|
|
40522
40656
|
performanceMarkFeature('NgSignals');
|
|
40523
|
-
|
|
40524
|
-
|
|
40525
|
-
|
|
40526
|
-
|
|
40527
|
-
|
|
40528
|
-
const getter = createLinkedSignal$1(optionsOrComputation.source, optionsOrComputation.computation, optionsOrComputation.equal);
|
|
40529
|
-
return upgradeLinkedSignalGetter(getter);
|
|
40657
|
+
const isShorthand = typeof optionsOrComputation === 'function';
|
|
40658
|
+
const node = Object.create(LINKED_SIGNAL_NODE);
|
|
40659
|
+
node.source = isShorthand ? optionsOrComputation : optionsOrComputation.source;
|
|
40660
|
+
if (!isShorthand) {
|
|
40661
|
+
node.computation = optionsOrComputation.computation;
|
|
40530
40662
|
}
|
|
40531
|
-
|
|
40532
|
-
|
|
40533
|
-
|
|
40534
|
-
getter.toString = () => `[LinkedSignal: ${getter()}]`;
|
|
40663
|
+
const equal = isShorthand ? options?.equal : optionsOrComputation.equal;
|
|
40664
|
+
if (equal) {
|
|
40665
|
+
node.equal = equal;
|
|
40535
40666
|
}
|
|
40536
|
-
|
|
40537
|
-
const upgradedGetter = getter;
|
|
40538
|
-
upgradedGetter.set = (newValue) => linkedSignalSetFn$1(node, newValue);
|
|
40539
|
-
upgradedGetter.update = (updateFn) => linkedSignalUpdateFn$1(node, updateFn);
|
|
40540
|
-
upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter);
|
|
40541
|
-
return upgradedGetter;
|
|
40667
|
+
return createLinkedSignal(node);
|
|
40542
40668
|
}
|
|
40669
|
+
/**
|
|
40670
|
+
* A dedicated symbol used before a state value has been set / calculated for the first time.
|
|
40671
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
40672
|
+
*/
|
|
40673
|
+
const UNSET = /* @__PURE__ */ Symbol('UNSET');
|
|
40674
|
+
/**
|
|
40675
|
+
* A dedicated symbol used in place of a linked signal value to indicate that a given computation
|
|
40676
|
+
* is in progress. Used to detect cycles in computation chains.
|
|
40677
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
40678
|
+
*/
|
|
40679
|
+
const COMPUTING = /* @__PURE__ */ Symbol('COMPUTING');
|
|
40680
|
+
/**
|
|
40681
|
+
* A dedicated symbol used in place of a linked signal value to indicate that a given computation
|
|
40682
|
+
* failed. The thrown error is cached until the computation gets dirty again or the state is set.
|
|
40683
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
40684
|
+
*/
|
|
40685
|
+
const ERRORED = /* @__PURE__ */ Symbol('ERRORED');
|
|
40686
|
+
// Note: Using an IIFE here to ensure that the spread assignment is not considered
|
|
40687
|
+
// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.
|
|
40688
|
+
// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
|
|
40689
|
+
const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
|
|
40690
|
+
return {
|
|
40691
|
+
...REACTIVE_NODE$1,
|
|
40692
|
+
value: UNSET,
|
|
40693
|
+
dirty: true,
|
|
40694
|
+
error: null,
|
|
40695
|
+
equal: defaultEquals$1,
|
|
40696
|
+
computation: identityFn,
|
|
40697
|
+
producerMustRecompute(node) {
|
|
40698
|
+
// Force a recomputation if there's no current value, or if the current value is in the
|
|
40699
|
+
// process of being calculated (which should throw an error).
|
|
40700
|
+
return node.value === UNSET || node.value === COMPUTING;
|
|
40701
|
+
},
|
|
40702
|
+
producerRecomputeValue(node) {
|
|
40703
|
+
if (node.value === COMPUTING) {
|
|
40704
|
+
// Our computation somehow led to a cyclic read of itself.
|
|
40705
|
+
throw new Error('Detected cycle in computations.');
|
|
40706
|
+
}
|
|
40707
|
+
const oldValue = node.value;
|
|
40708
|
+
node.value = COMPUTING;
|
|
40709
|
+
const prevConsumer = consumerBeforeComputation$1(node);
|
|
40710
|
+
let newValue;
|
|
40711
|
+
try {
|
|
40712
|
+
const newSourceValue = node.source();
|
|
40713
|
+
const prev = oldValue === UNSET || oldValue === ERRORED
|
|
40714
|
+
? undefined
|
|
40715
|
+
: {
|
|
40716
|
+
source: node.sourceValue,
|
|
40717
|
+
value: oldValue,
|
|
40718
|
+
};
|
|
40719
|
+
newValue = node.computation(newSourceValue, prev);
|
|
40720
|
+
node.sourceValue = newSourceValue;
|
|
40721
|
+
}
|
|
40722
|
+
catch (err) {
|
|
40723
|
+
newValue = ERRORED;
|
|
40724
|
+
node.error = err;
|
|
40725
|
+
}
|
|
40726
|
+
finally {
|
|
40727
|
+
consumerAfterComputation$1(node, prevConsumer);
|
|
40728
|
+
}
|
|
40729
|
+
if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
|
|
40730
|
+
// No change to `valueVersion` - old and new values are
|
|
40731
|
+
// semantically equivalent.
|
|
40732
|
+
node.value = oldValue;
|
|
40733
|
+
return;
|
|
40734
|
+
}
|
|
40735
|
+
node.value = newValue;
|
|
40736
|
+
node.version++;
|
|
40737
|
+
},
|
|
40738
|
+
};
|
|
40739
|
+
})();
|
|
40543
40740
|
|
|
40544
40741
|
/**
|
|
40545
40742
|
* Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
|
|
@@ -41097,7 +41294,7 @@ var ResourceStatus;
|
|
|
41097
41294
|
function resource(options) {
|
|
41098
41295
|
options?.injector || assertInInjectionContext(resource);
|
|
41099
41296
|
const request = (options.request ?? (() => null));
|
|
41100
|
-
return new ResourceImpl(request, options
|
|
41297
|
+
return new ResourceImpl(request, getLoader(options), undefined, options.equal ? wrapEqualityFn(options.equal) : undefined, options.injector ?? inject(Injector));
|
|
41101
41298
|
}
|
|
41102
41299
|
/**
|
|
41103
41300
|
* Base class which implements `.value` as a `WritableSignal` by delegating `.set` and `.update`.
|
|
@@ -41143,9 +41340,13 @@ class ResourceImpl extends BaseWritableResource {
|
|
|
41143
41340
|
resolvePendingTask = undefined;
|
|
41144
41341
|
destroyed = false;
|
|
41145
41342
|
constructor(request, loaderFn, defaultValue, equal, injector) {
|
|
41343
|
+
super(
|
|
41146
41344
|
// Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a
|
|
41147
41345
|
// `WritableSignal` that delegates to `ResourceImpl.set`.
|
|
41148
|
-
|
|
41346
|
+
computed(() => {
|
|
41347
|
+
const stream = this.state()?.stream?.();
|
|
41348
|
+
return stream && isResolved(stream) ? stream.value : this.defaultValue;
|
|
41349
|
+
}, { equal }));
|
|
41149
41350
|
this.loaderFn = loaderFn;
|
|
41150
41351
|
this.defaultValue = defaultValue;
|
|
41151
41352
|
this.equal = equal;
|
|
@@ -41174,13 +41375,10 @@ class ResourceImpl extends BaseWritableResource {
|
|
|
41174
41375
|
status,
|
|
41175
41376
|
// When the state of the resource changes due to the request, remember the previous status
|
|
41176
41377
|
// for the loader to consider.
|
|
41177
|
-
previousStatus: previous?.value
|
|
41378
|
+
previousStatus: computeStatusOfState(previous?.value),
|
|
41178
41379
|
// In `Reloading` state, we keep the previous value if there is one, since the identity of
|
|
41179
41380
|
// the request hasn't changed. Otherwise, we switch back to the default value.
|
|
41180
|
-
|
|
41181
|
-
? previous.value.value
|
|
41182
|
-
: this.defaultValue,
|
|
41183
|
-
error: undefined,
|
|
41381
|
+
stream: previous && status === ResourceStatus.Reloading ? previous.value.stream : undefined,
|
|
41184
41382
|
}),
|
|
41185
41383
|
});
|
|
41186
41384
|
this.effectRef = effect(this.loadEffect.bind(this), {
|
|
@@ -41190,8 +41388,16 @@ class ResourceImpl extends BaseWritableResource {
|
|
|
41190
41388
|
// Cancel any pending request when the resource itself is destroyed.
|
|
41191
41389
|
injector.get(DestroyRef).onDestroy(() => this.destroy());
|
|
41192
41390
|
}
|
|
41193
|
-
status = computed(() =>
|
|
41194
|
-
|
|
41391
|
+
status = computed(() => {
|
|
41392
|
+
if (this.state().status !== ResourceStatus.Resolved) {
|
|
41393
|
+
return this.state().status;
|
|
41394
|
+
}
|
|
41395
|
+
return isResolved(this.state().stream()) ? ResourceStatus.Resolved : ResourceStatus.Error;
|
|
41396
|
+
});
|
|
41397
|
+
error = computed(() => {
|
|
41398
|
+
const stream = this.state().stream?.();
|
|
41399
|
+
return stream && !isResolved(stream) ? stream.error : undefined;
|
|
41400
|
+
});
|
|
41195
41401
|
/**
|
|
41196
41402
|
* Called either directly via `WritableResource.set` or via `.value.set()`.
|
|
41197
41403
|
*/
|
|
@@ -41199,16 +41405,15 @@ class ResourceImpl extends BaseWritableResource {
|
|
|
41199
41405
|
if (this.destroyed) {
|
|
41200
41406
|
return;
|
|
41201
41407
|
}
|
|
41202
|
-
const
|
|
41203
|
-
if (this.equal ? this.equal(
|
|
41408
|
+
const current = untracked(this.value);
|
|
41409
|
+
if (this.equal ? this.equal(current, value) : current === value) {
|
|
41204
41410
|
return;
|
|
41205
41411
|
}
|
|
41206
41412
|
// Enter Local state with the user-defined value.
|
|
41207
41413
|
this.state.set({
|
|
41208
41414
|
status: ResourceStatus.Local,
|
|
41209
41415
|
previousStatus: ResourceStatus.Local,
|
|
41210
|
-
value,
|
|
41211
|
-
error: undefined,
|
|
41416
|
+
stream: signal({ value }),
|
|
41212
41417
|
});
|
|
41213
41418
|
// We're departing from whatever state the resource was in previously, so cancel any in-progress
|
|
41214
41419
|
// loading operations.
|
|
@@ -41234,8 +41439,7 @@ class ResourceImpl extends BaseWritableResource {
|
|
|
41234
41439
|
this.state.set({
|
|
41235
41440
|
status: ResourceStatus.Idle,
|
|
41236
41441
|
previousStatus: ResourceStatus.Idle,
|
|
41237
|
-
|
|
41238
|
-
error: undefined,
|
|
41442
|
+
stream: undefined,
|
|
41239
41443
|
});
|
|
41240
41444
|
}
|
|
41241
41445
|
async loadEffect() {
|
|
@@ -41268,49 +41472,43 @@ class ResourceImpl extends BaseWritableResource {
|
|
|
41268
41472
|
// After the loading operation is cancelled, `this.resolvePendingTask` no longer represents this
|
|
41269
41473
|
// particular task, but this `await` may eventually resolve/reject. Thus, when we cancel in
|
|
41270
41474
|
// response to (1) below, we need to cancel the locally saved task.
|
|
41271
|
-
|
|
41475
|
+
let resolvePendingTask = (this.resolvePendingTask =
|
|
41476
|
+
this.pendingTasks.add());
|
|
41272
41477
|
const { signal: abortSignal } = (this.pendingController = new AbortController());
|
|
41273
41478
|
try {
|
|
41274
41479
|
// The actual loading is run through `untracked` - only the request side of `resource` is
|
|
41275
41480
|
// reactive. This avoids any confusion with signals tracking or not tracking depending on
|
|
41276
41481
|
// which side of the `await` they are.
|
|
41277
|
-
const
|
|
41278
|
-
abortSignal,
|
|
41482
|
+
const stream = await untracked(() => this.loaderFn({
|
|
41279
41483
|
request: request,
|
|
41484
|
+
abortSignal,
|
|
41280
41485
|
previous: {
|
|
41281
41486
|
status: previousStatus,
|
|
41282
41487
|
},
|
|
41283
41488
|
}));
|
|
41284
41489
|
if (abortSignal.aborted) {
|
|
41285
|
-
// This load operation was cancelled.
|
|
41286
41490
|
return;
|
|
41287
41491
|
}
|
|
41288
|
-
// Success :)
|
|
41289
41492
|
this.state.set({
|
|
41290
41493
|
status: ResourceStatus.Resolved,
|
|
41291
41494
|
previousStatus: ResourceStatus.Resolved,
|
|
41292
|
-
|
|
41293
|
-
error: undefined,
|
|
41495
|
+
stream,
|
|
41294
41496
|
});
|
|
41295
41497
|
}
|
|
41296
41498
|
catch (err) {
|
|
41297
41499
|
if (abortSignal.aborted) {
|
|
41298
|
-
// This load operation was cancelled.
|
|
41299
41500
|
return;
|
|
41300
41501
|
}
|
|
41301
|
-
// Fail :(
|
|
41302
41502
|
this.state.set({
|
|
41303
|
-
status: ResourceStatus.
|
|
41503
|
+
status: ResourceStatus.Resolved,
|
|
41304
41504
|
previousStatus: ResourceStatus.Error,
|
|
41305
|
-
|
|
41306
|
-
error: err,
|
|
41505
|
+
stream: signal({ error: err }),
|
|
41307
41506
|
});
|
|
41308
41507
|
}
|
|
41309
41508
|
finally {
|
|
41310
|
-
// Resolve the pending task now that
|
|
41311
|
-
resolvePendingTask();
|
|
41312
|
-
|
|
41313
|
-
this.pendingController = undefined;
|
|
41509
|
+
// Resolve the pending task now that the resource has a value.
|
|
41510
|
+
resolvePendingTask?.();
|
|
41511
|
+
resolvePendingTask = undefined;
|
|
41314
41512
|
}
|
|
41315
41513
|
}
|
|
41316
41514
|
abortInProgressLoad() {
|
|
@@ -41327,6 +41525,35 @@ class ResourceImpl extends BaseWritableResource {
|
|
|
41327
41525
|
function wrapEqualityFn(equal) {
|
|
41328
41526
|
return (a, b) => (a === undefined || b === undefined ? a === b : equal(a, b));
|
|
41329
41527
|
}
|
|
41528
|
+
function getLoader(options) {
|
|
41529
|
+
if (isStreamingResourceOptions(options)) {
|
|
41530
|
+
return options.stream;
|
|
41531
|
+
}
|
|
41532
|
+
return async (params) => {
|
|
41533
|
+
try {
|
|
41534
|
+
return signal({ value: await options.loader(params) });
|
|
41535
|
+
}
|
|
41536
|
+
catch (err) {
|
|
41537
|
+
return signal({ error: err });
|
|
41538
|
+
}
|
|
41539
|
+
};
|
|
41540
|
+
}
|
|
41541
|
+
function isStreamingResourceOptions(options) {
|
|
41542
|
+
return !!options.stream;
|
|
41543
|
+
}
|
|
41544
|
+
function computeStatusOfState(state) {
|
|
41545
|
+
switch (state?.status) {
|
|
41546
|
+
case undefined:
|
|
41547
|
+
return ResourceStatus.Idle;
|
|
41548
|
+
case ResourceStatus.Resolved:
|
|
41549
|
+
return isResolved(untracked(state.stream)) ? ResourceStatus.Resolved : ResourceStatus.Error;
|
|
41550
|
+
default:
|
|
41551
|
+
return state.status;
|
|
41552
|
+
}
|
|
41553
|
+
}
|
|
41554
|
+
function isResolved(state) {
|
|
41555
|
+
return state.error === undefined;
|
|
41556
|
+
}
|
|
41330
41557
|
|
|
41331
41558
|
/**
|
|
41332
41559
|
* Creates a `ComponentRef` instance based on provided component type and a set of options.
|
|
@@ -41574,5 +41801,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
|
41574
41801
|
* Generated bundle index. Do not edit.
|
|
41575
41802
|
*/
|
|
41576
41803
|
|
|
41577
|
-
export { ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, AfterRenderPhase, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CSP_NONCE, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, HOST_TAG_NAME, Host, HostAttributeToken, HostBinding, HostListener, INJECTOR$1 as INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, OutputEmitterRef, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, PendingTasks, Pipe, PlatformRef, Query, QueryList, REQUEST, REQUEST_CONTEXT, RESPONSE_INIT, Renderer2, RendererFactory2, RendererStyleFlags2, ResourceStatus, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, TransferState, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation, ViewRef, afterNextRender, afterRender, afterRenderEffect, asNativeElements, assertInInjectionContext, assertNotInReactiveContext, assertPlatform, booleanAttribute, computed, contentChild, contentChildren, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, input, isDevMode, isSignal, isStandalone, linkedSignal, makeEnvironmentProviders, makeStateKey, mergeApplicationConfig, model, numberAttribute, output, platformCore, provideAppInitializer, provideEnvironmentInitializer, provideExperimentalCheckNoChangesForDebug, provideExperimentalZonelessChangeDetection, providePlatformInitializer, provideZoneChangeDetection, reflectComponentType, resolveForwardRef, resource, runInInjectionContext, setTestabilityGetter, signal, untracked, viewChild, viewChildren, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, AfterRenderManager as ɵAfterRenderManager, CONTAINER_HEADER_OFFSET as ɵCONTAINER_HEADER_OFFSET, ChangeDetectionScheduler as ɵChangeDetectionScheduler, ChangeDetectionSchedulerImpl as ɵChangeDetectionSchedulerImpl, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, DEFER_BLOCK_CONFIG as ɵDEFER_BLOCK_CONFIG, DEFER_BLOCK_DEPENDENCY_INTERCEPTOR as ɵDEFER_BLOCK_DEPENDENCY_INTERCEPTOR, DeferBlockBehavior as ɵDeferBlockBehavior, DeferBlockState as ɵDeferBlockState, ENABLE_ROOT_COMPONENT_BOOTSTRAP as ɵENABLE_ROOT_COMPONENT_BOOTSTRAP, EffectScheduler as ɵEffectScheduler, IMAGE_CONFIG as ɵIMAGE_CONFIG, IMAGE_CONFIG_DEFAULTS as ɵIMAGE_CONFIG_DEFAULTS, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, ɵINPUT_SIGNAL_BRAND_WRITE_TYPE, INTERNAL_APPLICATION_ERROR_HANDLER as ɵINTERNAL_APPLICATION_ERROR_HANDLER, IS_HYDRATION_DOM_REUSE_ENABLED as ɵIS_HYDRATION_DOM_REUSE_ENABLED, IS_INCREMENTAL_HYDRATION_ENABLED as ɵIS_INCREMENTAL_HYDRATION_ENABLED, JSACTION_EVENT_CONTRACT as ɵJSACTION_EVENT_CONTRACT, LContext as ɵLContext, LocaleDataIndex as ɵLocaleDataIndex, MicrotaskEffectScheduler as ɵMicrotaskEffectScheduler, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, PERFORMANCE_MARK_PREFIX as ɵPERFORMANCE_MARK_PREFIX, PROVIDED_NG_ZONE as ɵPROVIDED_NG_ZONE, PendingTasksInternal as ɵPendingTasksInternal, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, SSR_CONTENT_INTEGRITY_MARKER as ɵSSR_CONTENT_INTEGRITY_MARKER, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, TracingAction as ɵTracingAction, TracingService as ɵTracingService, USE_RUNTIME_DEPS_TRACKER_FOR_JIT as ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, ZONELESS_ENABLED as ɵZONELESS_ENABLED, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, annotateForHydration as ɵannotateForHydration, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, depsTracker as ɵdepsTracker, detectChangesInViewIfRequired as ɵdetectChangesInViewIfRequired, devModeEqual as ɵdevModeEqual, disableProfiling as ɵdisableProfiling, enableProfiling as ɵenableProfiling, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, generateStandaloneInDeclarationsError as ɵgenerateStandaloneInDeclarationsError, getAsyncClassMetadataFn as ɵgetAsyncClassMetadataFn, getClosestComponentName as ɵgetClosestComponentName, getDebugNode as ɵgetDebugNode, getDeferBlocks$1 as ɵgetDeferBlocks, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getOutputDestroyRef as ɵgetOutputDestroyRef, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, internalProvideZoneChangeDetection as ɵinternalProvideZoneChangeDetection, isBoundToModule as ɵisBoundToModule, isComponentDefPendingResolution as ɵisComponentDefPendingResolution, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isNgModule as ɵisNgModule, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, microtaskEffect as ɵmicrotaskEffect, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, performanceMarkFeature as ɵperformanceMarkFeature, publishExternalGlobalUtil as ɵpublishExternalGlobalUtil, readHydrationInfo as ɵreadHydrationInfo, registerLocaleData as ɵregisterLocaleData, renderDeferBlockState as ɵrenderDeferBlockState, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, restoreComponentResolutionQueue as ɵrestoreComponentResolutionQueue, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setAlternateWeakRefImpl as ɵsetAlternateWeakRefImpl, ɵsetClassDebugInfo, setClassMetadata as ɵsetClassMetadata, setClassMetadataAsync as ɵsetClassMetadataAsync, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setInjectorProfilerContext as ɵsetInjectorProfilerContext, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, startMeasuring as ɵstartMeasuring, stopMeasuring as ɵstopMeasuring, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, triggerResourceLoading as ɵtriggerResourceLoading, truncateMiddle as ɵtruncateMiddle, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵunwrapWritableSignal, withDomHydration as ɵwithDomHydration, withEventReplay as ɵwithEventReplay, withI18nSupport as ɵwithI18nSupport, withIncrementalHydration as ɵwithIncrementalHydration, ɵɵCopyDefinitionFeature, ɵɵExternalStylesFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵInputTransformsFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵadvance, ɵɵattachSourceLocations, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcomponentInstance, ɵɵconditional, ɵɵcontentQuery, ɵɵcontentQuerySignal, ɵɵdeclareLet, ɵɵdefer, ɵɵdeferEnableTimerScheduling, ɵɵdeferHydrateNever, ɵɵdeferHydrateOnHover, ɵɵdeferHydrateOnIdle, ɵɵdeferHydrateOnImmediate, ɵɵdeferHydrateOnInteraction, ɵɵdeferHydrateOnTimer, ɵɵdeferHydrateOnViewport, ɵɵdeferHydrateWhen, ɵɵdeferOnHover, ɵɵdeferOnIdle, ɵɵdeferOnImmediate, ɵɵdeferOnInteraction, ɵɵdeferOnTimer, ɵɵdeferOnViewport, ɵɵdeferPrefetchOnHover, ɵɵdeferPrefetchOnIdle, ɵɵdeferPrefetchOnImmediate, ɵɵdeferPrefetchOnInteraction, ɵɵdeferPrefetchOnTimer, ɵɵdeferPrefetchOnViewport, ɵɵdeferPrefetchWhen, ɵɵdeferWhen, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetComponentDepsFactory, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareClassMetadataAsync, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryAdvance, ɵɵqueryRefresh, ɵɵreadContextLet, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵrepeater, ɵɵrepeaterCreate, ɵɵrepeaterTrackByIdentity, ɵɵrepeaterTrackByIndex, ɵɵreplaceMetadata, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstoreLet, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵtwoWayBindingSet, ɵɵtwoWayListener, ɵɵtwoWayProperty, ɵɵvalidateIframeAttribute, ɵɵviewQuery, ɵɵviewQuerySignal };
|
|
41804
|
+
export { ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, AfterRenderPhase, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CSP_NONCE, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, HOST_TAG_NAME, Host, HostAttributeToken, HostBinding, HostListener, INJECTOR$1 as INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, OutputEmitterRef, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, PendingTasks, Pipe, PlatformRef, Query, QueryList, REQUEST, REQUEST_CONTEXT, RESPONSE_INIT, Renderer2, RendererFactory2, RendererStyleFlags2, ResourceStatus, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, TransferState, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation, ViewRef, afterNextRender, afterRender, afterRenderEffect, asNativeElements, assertInInjectionContext, assertNotInReactiveContext, assertPlatform, booleanAttribute, computed, contentChild, contentChildren, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, input, isDevMode, isSignal, isStandalone, linkedSignal, makeEnvironmentProviders, makeStateKey, mergeApplicationConfig, model, numberAttribute, output, platformCore, provideAppInitializer, provideEnvironmentInitializer, provideExperimentalCheckNoChangesForDebug, provideExperimentalZonelessChangeDetection, providePlatformInitializer, provideZoneChangeDetection, reflectComponentType, resolveForwardRef, resource, runInInjectionContext, setTestabilityGetter, signal, untracked, viewChild, viewChildren, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, AfterRenderManager as ɵAfterRenderManager, CONTAINER_HEADER_OFFSET as ɵCONTAINER_HEADER_OFFSET, ChangeDetectionScheduler as ɵChangeDetectionScheduler, ChangeDetectionSchedulerImpl as ɵChangeDetectionSchedulerImpl, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, DEFER_BLOCK_CONFIG as ɵDEFER_BLOCK_CONFIG, DEFER_BLOCK_DEPENDENCY_INTERCEPTOR as ɵDEFER_BLOCK_DEPENDENCY_INTERCEPTOR, DeferBlockBehavior as ɵDeferBlockBehavior, DeferBlockState as ɵDeferBlockState, ENABLE_ROOT_COMPONENT_BOOTSTRAP as ɵENABLE_ROOT_COMPONENT_BOOTSTRAP, EffectScheduler as ɵEffectScheduler, IMAGE_CONFIG as ɵIMAGE_CONFIG, IMAGE_CONFIG_DEFAULTS as ɵIMAGE_CONFIG_DEFAULTS, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, ɵINPUT_SIGNAL_BRAND_WRITE_TYPE, INTERNAL_APPLICATION_ERROR_HANDLER as ɵINTERNAL_APPLICATION_ERROR_HANDLER, IS_HYDRATION_DOM_REUSE_ENABLED as ɵIS_HYDRATION_DOM_REUSE_ENABLED, IS_INCREMENTAL_HYDRATION_ENABLED as ɵIS_INCREMENTAL_HYDRATION_ENABLED, JSACTION_EVENT_CONTRACT as ɵJSACTION_EVENT_CONTRACT, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, MicrotaskEffectScheduler as ɵMicrotaskEffectScheduler, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, PERFORMANCE_MARK_PREFIX as ɵPERFORMANCE_MARK_PREFIX, PROVIDED_NG_ZONE as ɵPROVIDED_NG_ZONE, PendingTasksInternal as ɵPendingTasksInternal, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, SSR_CONTENT_INTEGRITY_MARKER as ɵSSR_CONTENT_INTEGRITY_MARKER, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, TracingAction as ɵTracingAction, TracingService as ɵTracingService, USE_RUNTIME_DEPS_TRACKER_FOR_JIT as ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, ZONELESS_ENABLED as ɵZONELESS_ENABLED, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, annotateForHydration as ɵannotateForHydration, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, depsTracker as ɵdepsTracker, detectChangesInViewIfRequired as ɵdetectChangesInViewIfRequired, devModeEqual as ɵdevModeEqual, disableProfiling as ɵdisableProfiling, enableProfiling as ɵenableProfiling, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, generateStandaloneInDeclarationsError as ɵgenerateStandaloneInDeclarationsError, getAsyncClassMetadataFn as ɵgetAsyncClassMetadataFn, getClosestComponentName as ɵgetClosestComponentName, getDebugNode as ɵgetDebugNode, getDeferBlocks$1 as ɵgetDeferBlocks, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getOutputDestroyRef as ɵgetOutputDestroyRef, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, internalProvideZoneChangeDetection as ɵinternalProvideZoneChangeDetection, isBoundToModule as ɵisBoundToModule, isComponentDefPendingResolution as ɵisComponentDefPendingResolution, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isNgModule as ɵisNgModule, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, microtaskEffect as ɵmicrotaskEffect, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, performanceMarkFeature as ɵperformanceMarkFeature, publishExternalGlobalUtil as ɵpublishExternalGlobalUtil, readHydrationInfo as ɵreadHydrationInfo, registerLocaleData as ɵregisterLocaleData, renderDeferBlockState as ɵrenderDeferBlockState, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, restoreComponentResolutionQueue as ɵrestoreComponentResolutionQueue, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setAlternateWeakRefImpl as ɵsetAlternateWeakRefImpl, ɵsetClassDebugInfo, setClassMetadata as ɵsetClassMetadata, setClassMetadataAsync as ɵsetClassMetadataAsync, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setInjectorProfilerContext as ɵsetInjectorProfilerContext, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, startMeasuring as ɵstartMeasuring, stopMeasuring as ɵstopMeasuring, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, triggerResourceLoading as ɵtriggerResourceLoading, truncateMiddle as ɵtruncateMiddle, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵunwrapWritableSignal, withDomHydration as ɵwithDomHydration, withEventReplay as ɵwithEventReplay, withI18nSupport as ɵwithI18nSupport, withIncrementalHydration as ɵwithIncrementalHydration, ɵɵCopyDefinitionFeature, ɵɵExternalStylesFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵInputTransformsFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵadvance, ɵɵattachSourceLocations, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcomponentInstance, ɵɵconditional, ɵɵcontentQuery, ɵɵcontentQuerySignal, ɵɵdeclareLet, ɵɵdefer, ɵɵdeferEnableTimerScheduling, ɵɵdeferHydrateNever, ɵɵdeferHydrateOnHover, ɵɵdeferHydrateOnIdle, ɵɵdeferHydrateOnImmediate, ɵɵdeferHydrateOnInteraction, ɵɵdeferHydrateOnTimer, ɵɵdeferHydrateOnViewport, ɵɵdeferHydrateWhen, ɵɵdeferOnHover, ɵɵdeferOnIdle, ɵɵdeferOnImmediate, ɵɵdeferOnInteraction, ɵɵdeferOnTimer, ɵɵdeferOnViewport, ɵɵdeferPrefetchOnHover, ɵɵdeferPrefetchOnIdle, ɵɵdeferPrefetchOnImmediate, ɵɵdeferPrefetchOnInteraction, ɵɵdeferPrefetchOnTimer, ɵɵdeferPrefetchOnViewport, ɵɵdeferPrefetchWhen, ɵɵdeferWhen, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetComponentDepsFactory, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareClassMetadataAsync, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryAdvance, ɵɵqueryRefresh, ɵɵreadContextLet, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵrepeater, ɵɵrepeaterCreate, ɵɵrepeaterTrackByIdentity, ɵɵrepeaterTrackByIndex, ɵɵreplaceMetadata, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstoreLet, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵtwoWayBindingSet, ɵɵtwoWayListener, ɵɵtwoWayProperty, ɵɵvalidateIframeAttribute, ɵɵviewQuery, ɵɵviewQuerySignal };
|
|
41578
41805
|
//# sourceMappingURL=core.mjs.map
|