@angular/core 16.0.0 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/src/application_ref.mjs +60 -55
- package/esm2022/src/di/injectable.mjs +2 -1
- package/esm2022/src/di/metadata.mjs +6 -5
- package/esm2022/src/di/metadata_attr.mjs +2 -1
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/hydration/annotate.mjs +1 -1
- package/esm2022/src/hydration/api.mjs +2 -2
- package/esm2022/src/hydration/skip_hydration.mjs +12 -1
- package/esm2022/src/hydration/utils.mjs +9 -3
- package/esm2022/src/linker/element_ref.mjs +1 -1
- package/esm2022/src/linker/view_container_ref.mjs +16 -6
- package/esm2022/src/metadata/di.mjs +5 -4
- package/esm2022/src/metadata/directives.mjs +7 -7
- package/esm2022/src/metadata/ng_module.mjs +2 -1
- package/esm2022/src/render/api.mjs +1 -1
- package/esm2022/src/render3/definition.mjs +6 -3
- package/esm2022/src/render3/instructions/element_validation.mjs +2 -2
- package/esm2022/src/render3/instructions/shared.mjs +7 -3
- package/esm2022/src/render3/interfaces/document.mjs +6 -4
- package/esm2022/src/render3/interfaces/node.mjs +1 -1
- package/esm2022/src/render3/node_manipulation.mjs +7 -1
- package/esm2022/src/transfer_state.mjs +8 -7
- package/esm2022/src/util/assert.mjs +2 -5
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/esm2022/testing/src/test_bed.mjs +4 -4
- package/fesm2022/core.mjs +181 -133
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +112 -71
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +36 -30
- package/package.json +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/guard-and-resolve-interfaces/bundle.js +13 -13
- package/schematics/migrations/remove-module-id/bundle.js +14 -14
- package/schematics/ng-generate/standalone-migration/bundle.js +415 -361
- package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
- package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v16.0.
|
|
2
|
+
* @license Angular v16.0.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -302,10 +302,7 @@ function throwError(msg, actual, expected, comparison) {
|
|
|
302
302
|
(comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
|
|
303
303
|
}
|
|
304
304
|
function assertDomNode(node) {
|
|
305
|
-
|
|
306
|
-
if (!(typeof Node !== 'undefined' && node instanceof Node) &&
|
|
307
|
-
!(typeof node === 'object' && node != null &&
|
|
308
|
-
node.constructor.name === 'WebWorkerRenderNode')) {
|
|
305
|
+
if (!(node instanceof Node)) {
|
|
309
306
|
throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
|
|
310
307
|
}
|
|
311
308
|
}
|
|
@@ -1893,7 +1890,7 @@ function getComponentId(componentDef) {
|
|
|
1893
1890
|
// Example:
|
|
1894
1891
|
// https://github.com/angular/components/blob/d9f82c8f95309e77a6d82fd574c65871e91354c2/src/material/core/option/option.ts#L248
|
|
1895
1892
|
// https://github.com/angular/components/blob/285f46dc2b4c5b127d356cb7c4714b221f03ce50/src/material/legacy-core/option/option.ts#L32
|
|
1896
|
-
const hashSelectors = [
|
|
1893
|
+
const hashSelectors = JSON.stringify([
|
|
1897
1894
|
componentDef.selectors,
|
|
1898
1895
|
componentDef.ngContentSelectors,
|
|
1899
1896
|
componentDef.hostVars,
|
|
@@ -1903,12 +1900,15 @@ function getComponentId(componentDef) {
|
|
|
1903
1900
|
componentDef.decls,
|
|
1904
1901
|
componentDef.encapsulation,
|
|
1905
1902
|
componentDef.standalone,
|
|
1903
|
+
componentDef.exportAs,
|
|
1904
|
+
componentDef.inputs,
|
|
1905
|
+
componentDef.outputs,
|
|
1906
1906
|
// We cannot use 'componentDef.type.name' as the name of the symbol will change and will not
|
|
1907
1907
|
// match in the server and browser bundles.
|
|
1908
1908
|
Object.getOwnPropertyNames(componentDef.type.prototype),
|
|
1909
1909
|
!!componentDef.contentQueries,
|
|
1910
1910
|
!!componentDef.viewQuery,
|
|
1911
|
-
]
|
|
1911
|
+
]);
|
|
1912
1912
|
for (const char of hashSelectors) {
|
|
1913
1913
|
hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;
|
|
1914
1914
|
}
|
|
@@ -4938,6 +4938,7 @@ function makePropDecorator(name, props, parentClass, additionalProcessing) {
|
|
|
4938
4938
|
/**
|
|
4939
4939
|
* Attribute decorator and metadata.
|
|
4940
4940
|
*
|
|
4941
|
+
* @Annotation
|
|
4941
4942
|
* @publicApi
|
|
4942
4943
|
*/
|
|
4943
4944
|
const Attribute = makeParamDecorator('Attribute', (attributeName) => ({ attributeName, __NG_ELEMENT_ID__: () => ɵɵinjectAttribute(attributeName) }));
|
|
@@ -4961,6 +4962,7 @@ class Query {
|
|
|
4961
4962
|
* ContentChildren decorator and metadata.
|
|
4962
4963
|
*
|
|
4963
4964
|
*
|
|
4965
|
+
* @Annotation
|
|
4964
4966
|
* @publicApi
|
|
4965
4967
|
*/
|
|
4966
4968
|
const ContentChildren = makePropDecorator('ContentChildren', (selector, data = {}) => ({
|
|
@@ -4975,7 +4977,7 @@ const ContentChildren = makePropDecorator('ContentChildren', (selector, data = {
|
|
|
4975
4977
|
* ContentChild decorator and metadata.
|
|
4976
4978
|
*
|
|
4977
4979
|
*
|
|
4978
|
-
|
|
4980
|
+
* @Annotation
|
|
4979
4981
|
*
|
|
4980
4982
|
* @publicApi
|
|
4981
4983
|
*/
|
|
@@ -4983,7 +4985,7 @@ const ContentChild = makePropDecorator('ContentChild', (selector, data = {}) =>
|
|
|
4983
4985
|
/**
|
|
4984
4986
|
* ViewChildren decorator and metadata.
|
|
4985
4987
|
*
|
|
4986
|
-
|
|
4988
|
+
* @Annotation
|
|
4987
4989
|
* @publicApi
|
|
4988
4990
|
*/
|
|
4989
4991
|
const ViewChildren = makePropDecorator('ViewChildren', (selector, data = {}) => ({
|
|
@@ -4997,7 +4999,7 @@ const ViewChildren = makePropDecorator('ViewChildren', (selector, data = {}) =>
|
|
|
4997
4999
|
/**
|
|
4998
5000
|
* ViewChild decorator and metadata.
|
|
4999
5001
|
*
|
|
5000
|
-
|
|
5002
|
+
* @Annotation
|
|
5001
5003
|
* @publicApi
|
|
5002
5004
|
*/
|
|
5003
5005
|
const ViewChild = makePropDecorator('ViewChild', (selector, data) => ({ selector, first: true, isViewQuery: true, descendants: true, ...data }), Query);
|
|
@@ -5584,6 +5586,7 @@ function getParentCtor(ctor) {
|
|
|
5584
5586
|
/**
|
|
5585
5587
|
* Inject decorator and metadata.
|
|
5586
5588
|
*
|
|
5589
|
+
* @Annotation
|
|
5587
5590
|
* @publicApi
|
|
5588
5591
|
*/
|
|
5589
5592
|
const Inject = attachInjectFlag(
|
|
@@ -5593,7 +5596,7 @@ makeParamDecorator('Inject', (token) => ({ token })), -1 /* DecoratorFlags.Injec
|
|
|
5593
5596
|
/**
|
|
5594
5597
|
* Optional decorator and metadata.
|
|
5595
5598
|
*
|
|
5596
|
-
|
|
5599
|
+
* @Annotation
|
|
5597
5600
|
* @publicApi
|
|
5598
5601
|
*/
|
|
5599
5602
|
const Optional =
|
|
@@ -5603,7 +5606,7 @@ attachInjectFlag(makeParamDecorator('Optional'), 8 /* InternalInjectFlags.Option
|
|
|
5603
5606
|
/**
|
|
5604
5607
|
* Self decorator and metadata.
|
|
5605
5608
|
*
|
|
5606
|
-
|
|
5609
|
+
* @Annotation
|
|
5607
5610
|
* @publicApi
|
|
5608
5611
|
*/
|
|
5609
5612
|
const Self =
|
|
@@ -5613,7 +5616,7 @@ attachInjectFlag(makeParamDecorator('Self'), 2 /* InternalInjectFlags.Self */);
|
|
|
5613
5616
|
/**
|
|
5614
5617
|
* `SkipSelf` decorator and metadata.
|
|
5615
5618
|
*
|
|
5616
|
-
|
|
5619
|
+
* @Annotation
|
|
5617
5620
|
* @publicApi
|
|
5618
5621
|
*/
|
|
5619
5622
|
const SkipSelf =
|
|
@@ -5623,7 +5626,7 @@ attachInjectFlag(makeParamDecorator('SkipSelf'), 4 /* InternalInjectFlags.SkipSe
|
|
|
5623
5626
|
/**
|
|
5624
5627
|
* Host decorator and metadata.
|
|
5625
5628
|
*
|
|
5626
|
-
|
|
5629
|
+
* @Annotation
|
|
5627
5630
|
* @publicApi
|
|
5628
5631
|
*/
|
|
5629
5632
|
const Host =
|
|
@@ -5986,7 +5989,7 @@ function isPropertyValid(element, propName, tagName, schemas) {
|
|
|
5986
5989
|
if (schemas === null)
|
|
5987
5990
|
return true;
|
|
5988
5991
|
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
5989
|
-
// or it is synthetic
|
|
5992
|
+
// or it is synthetic.
|
|
5990
5993
|
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
5991
5994
|
return true;
|
|
5992
5995
|
}
|
|
@@ -6128,6 +6131,59 @@ function matchingSchemas(schemas, tagName) {
|
|
|
6128
6131
|
return false;
|
|
6129
6132
|
}
|
|
6130
6133
|
|
|
6134
|
+
/**
|
|
6135
|
+
* The name of an attribute that can be added to the hydration boundary node
|
|
6136
|
+
* (component host node) to disable hydration for the content within that boundary.
|
|
6137
|
+
*/
|
|
6138
|
+
const SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration';
|
|
6139
|
+
/**
|
|
6140
|
+
* Helper function to check if a given node has the 'ngSkipHydration' attribute
|
|
6141
|
+
*/
|
|
6142
|
+
function hasNgSkipHydrationAttr(tNode) {
|
|
6143
|
+
const SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = SKIP_HYDRATION_ATTR_NAME.toLowerCase();
|
|
6144
|
+
const attrs = tNode.mergedAttrs;
|
|
6145
|
+
if (attrs === null)
|
|
6146
|
+
return false;
|
|
6147
|
+
// only ever look at the attribute name and skip the values
|
|
6148
|
+
for (let i = 0; i < attrs.length; i += 2) {
|
|
6149
|
+
const value = attrs[i];
|
|
6150
|
+
// This is a marker, which means that the static attributes section is over,
|
|
6151
|
+
// so we can exit early.
|
|
6152
|
+
if (typeof value === 'number')
|
|
6153
|
+
return false;
|
|
6154
|
+
if (typeof value === 'string' && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) {
|
|
6155
|
+
return true;
|
|
6156
|
+
}
|
|
6157
|
+
}
|
|
6158
|
+
return false;
|
|
6159
|
+
}
|
|
6160
|
+
/**
|
|
6161
|
+
* Checks whether a TNode has a flag to indicate that it's a part of
|
|
6162
|
+
* a skip hydration block.
|
|
6163
|
+
*/
|
|
6164
|
+
function hasInSkipHydrationBlockFlag(tNode) {
|
|
6165
|
+
return (tNode.flags & 128 /* TNodeFlags.inSkipHydrationBlock */) === 128 /* TNodeFlags.inSkipHydrationBlock */;
|
|
6166
|
+
}
|
|
6167
|
+
/**
|
|
6168
|
+
* Helper function that determines if a given node is within a skip hydration block
|
|
6169
|
+
* by navigating up the TNode tree to see if any parent nodes have skip hydration
|
|
6170
|
+
* attribute.
|
|
6171
|
+
*
|
|
6172
|
+
* TODO(akushnir): this function should contain the logic of `hasInSkipHydrationBlockFlag`,
|
|
6173
|
+
* there is no need to traverse parent nodes when we have a TNode flag (which would also
|
|
6174
|
+
* make this lookup O(1)).
|
|
6175
|
+
*/
|
|
6176
|
+
function isInSkipHydrationBlock(tNode) {
|
|
6177
|
+
let currentTNode = tNode.parent;
|
|
6178
|
+
while (currentTNode) {
|
|
6179
|
+
if (hasNgSkipHydrationAttr(currentTNode)) {
|
|
6180
|
+
return true;
|
|
6181
|
+
}
|
|
6182
|
+
currentTNode = currentTNode.parent;
|
|
6183
|
+
}
|
|
6184
|
+
return false;
|
|
6185
|
+
}
|
|
6186
|
+
|
|
6131
6187
|
/**
|
|
6132
6188
|
* Flags for renderer-specific style modifiers.
|
|
6133
6189
|
* @publicApi
|
|
@@ -7427,6 +7483,11 @@ function applyProjectionRecursive(renderer, action, lView, tProjectionNode, pare
|
|
|
7427
7483
|
else {
|
|
7428
7484
|
let nodeToProject = nodeToProjectOrRNodes;
|
|
7429
7485
|
const projectedComponentLView = componentLView[PARENT];
|
|
7486
|
+
// If a parent <ng-content> is located within a skip hydration block,
|
|
7487
|
+
// annotate an actual node that is being projected with the same flag too.
|
|
7488
|
+
if (hasInSkipHydrationBlockFlag(tProjectionNode)) {
|
|
7489
|
+
nodeToProject.flags |= 128 /* TNodeFlags.inSkipHydrationBlock */;
|
|
7490
|
+
}
|
|
7430
7491
|
applyNodes(renderer, action, nodeToProject, projectedComponentLView, parentRElement, beforeNode, true);
|
|
7431
7492
|
}
|
|
7432
7493
|
}
|
|
@@ -7727,7 +7788,7 @@ function ɵɵvalidateIframeAttribute(attrValue, tagName, attrName) {
|
|
|
7727
7788
|
* When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
|
|
7728
7789
|
* tell ivy what the global `document` is.
|
|
7729
7790
|
*
|
|
7730
|
-
* Angular does this for us in each of the standard platforms (`Browser
|
|
7791
|
+
* Angular does this for us in each of the standard platforms (`Browser` and `Server`)
|
|
7731
7792
|
* by calling `setDocument()` when providing the `DOCUMENT` token.
|
|
7732
7793
|
*/
|
|
7733
7794
|
let DOCUMENT = undefined;
|
|
@@ -7754,12 +7815,13 @@ function getDocument() {
|
|
|
7754
7815
|
else if (typeof document !== 'undefined') {
|
|
7755
7816
|
return document;
|
|
7756
7817
|
}
|
|
7818
|
+
throw new RuntimeError(210 /* RuntimeErrorCode.MISSING_DOCUMENT */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
7819
|
+
`The document object is not available in this context. Make sure the DOCUMENT injection token is provided.`);
|
|
7757
7820
|
// No "document" can be found. This should only happen if we are running ivy outside Angular and
|
|
7758
7821
|
// the current platform is not a browser. Since this is not a supported scenario at the moment
|
|
7759
7822
|
// this should not happen in Angular apps.
|
|
7760
7823
|
// Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
|
|
7761
|
-
// public API.
|
|
7762
|
-
return undefined;
|
|
7824
|
+
// public API.
|
|
7763
7825
|
}
|
|
7764
7826
|
|
|
7765
7827
|
/**
|
|
@@ -9465,7 +9527,9 @@ function makeStateKey(key) {
|
|
|
9465
9527
|
}
|
|
9466
9528
|
function initTransferState() {
|
|
9467
9529
|
const transferState = new TransferState();
|
|
9468
|
-
|
|
9530
|
+
if (inject(PLATFORM_ID) === 'browser') {
|
|
9531
|
+
transferState.store = retrieveTransferredState(getDocument(), inject(APP_ID));
|
|
9532
|
+
}
|
|
9469
9533
|
return transferState;
|
|
9470
9534
|
}
|
|
9471
9535
|
/**
|
|
@@ -9554,17 +9618,16 @@ function retrieveTransferredState(doc, appId) {
|
|
|
9554
9618
|
// Locate the script tag with the JSON data transferred from the server.
|
|
9555
9619
|
// The id of the script tag is set to the Angular appId + 'state'.
|
|
9556
9620
|
const script = doc.getElementById(appId + '-state');
|
|
9557
|
-
|
|
9558
|
-
if (script && script.textContent) {
|
|
9621
|
+
if (script?.textContent) {
|
|
9559
9622
|
try {
|
|
9560
9623
|
// Avoid using any here as it triggers lint errors in google3 (any is not allowed).
|
|
9561
|
-
|
|
9624
|
+
return JSON.parse(unescapeTransferStateContent(script.textContent));
|
|
9562
9625
|
}
|
|
9563
9626
|
catch (e) {
|
|
9564
9627
|
console.warn('Exception while restoring TransferState for app ' + appId, e);
|
|
9565
9628
|
}
|
|
9566
9629
|
}
|
|
9567
|
-
return
|
|
9630
|
+
return {};
|
|
9568
9631
|
}
|
|
9569
9632
|
|
|
9570
9633
|
/** Encodes that the node lookup should start from the host node of this component. */
|
|
@@ -9683,6 +9746,12 @@ function getComponentLViewForHydration(viewRef) {
|
|
|
9683
9746
|
if (isRootView(lView)) {
|
|
9684
9747
|
lView = lView[HEADER_OFFSET];
|
|
9685
9748
|
}
|
|
9749
|
+
// If a `ViewContainerRef` was injected in a component class, this resulted
|
|
9750
|
+
// in an LContainer creation at that location. In this case, the component
|
|
9751
|
+
// LView is in the LContainer's `HOST` slot.
|
|
9752
|
+
if (isLContainer(lView)) {
|
|
9753
|
+
lView = lView[HOST];
|
|
9754
|
+
}
|
|
9686
9755
|
return lView;
|
|
9687
9756
|
}
|
|
9688
9757
|
function getTextNodeContent(node) {
|
|
@@ -9978,7 +10047,7 @@ class Version {
|
|
|
9978
10047
|
/**
|
|
9979
10048
|
* @publicApi
|
|
9980
10049
|
*/
|
|
9981
|
-
const VERSION = new Version('16.0.
|
|
10050
|
+
const VERSION = new Version('16.0.1');
|
|
9982
10051
|
|
|
9983
10052
|
// This default value is when checking the hierarchy for a token.
|
|
9984
10053
|
//
|
|
@@ -10084,48 +10153,6 @@ class ErrorHandler {
|
|
|
10084
10153
|
}
|
|
10085
10154
|
}
|
|
10086
10155
|
|
|
10087
|
-
/**
|
|
10088
|
-
* The name of an attribute that can be added to the hydration boundary node
|
|
10089
|
-
* (component host node) to disable hydration for the content within that boundary.
|
|
10090
|
-
*/
|
|
10091
|
-
const SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration';
|
|
10092
|
-
/**
|
|
10093
|
-
* Helper function to check if a given node has the 'ngSkipHydration' attribute
|
|
10094
|
-
*/
|
|
10095
|
-
function hasNgSkipHydrationAttr(tNode) {
|
|
10096
|
-
const SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = SKIP_HYDRATION_ATTR_NAME.toLowerCase();
|
|
10097
|
-
const attrs = tNode.mergedAttrs;
|
|
10098
|
-
if (attrs === null)
|
|
10099
|
-
return false;
|
|
10100
|
-
// only ever look at the attribute name and skip the values
|
|
10101
|
-
for (let i = 0; i < attrs.length; i += 2) {
|
|
10102
|
-
const value = attrs[i];
|
|
10103
|
-
// This is a marker, which means that the static attributes section is over,
|
|
10104
|
-
// so we can exit early.
|
|
10105
|
-
if (typeof value === 'number')
|
|
10106
|
-
return false;
|
|
10107
|
-
if (typeof value === 'string' && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) {
|
|
10108
|
-
return true;
|
|
10109
|
-
}
|
|
10110
|
-
}
|
|
10111
|
-
return false;
|
|
10112
|
-
}
|
|
10113
|
-
/**
|
|
10114
|
-
* Helper function that determines if a given node is within a skip hydration block
|
|
10115
|
-
* by navigating up the TNode tree to see if any parent nodes have skip hydration
|
|
10116
|
-
* attribute.
|
|
10117
|
-
*/
|
|
10118
|
-
function isInSkipHydrationBlock(tNode) {
|
|
10119
|
-
let currentTNode = tNode.parent;
|
|
10120
|
-
while (currentTNode) {
|
|
10121
|
-
if (hasNgSkipHydrationAttr(currentTNode)) {
|
|
10122
|
-
return true;
|
|
10123
|
-
}
|
|
10124
|
-
currentTNode = currentTNode.parent;
|
|
10125
|
-
}
|
|
10126
|
-
return false;
|
|
10127
|
-
}
|
|
10128
|
-
|
|
10129
10156
|
/**
|
|
10130
10157
|
* Internal token that specifies whether DOM reuse logic
|
|
10131
10158
|
* during hydration is enabled.
|
|
@@ -10563,6 +10590,7 @@ function getInjectableMetadata(type, srcMeta) {
|
|
|
10563
10590
|
/**
|
|
10564
10591
|
* Injectable decorator and metadata.
|
|
10565
10592
|
*
|
|
10593
|
+
* @Annotation
|
|
10566
10594
|
* @publicApi
|
|
10567
10595
|
*/
|
|
10568
10596
|
const Injectable = makeDecorator('Injectable', undefined, undefined, undefined, (type, meta) => compileInjectable(type, meta));
|
|
@@ -11119,6 +11147,10 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
11119
11147
|
ngDevMode && ngDevMode.tNode++;
|
|
11120
11148
|
ngDevMode && tParent && assertTNodeForTView(tParent, tView);
|
|
11121
11149
|
let injectorIndex = tParent ? tParent.injectorIndex : -1;
|
|
11150
|
+
let flags = 0;
|
|
11151
|
+
if (isInSkipHydrationBlock$1()) {
|
|
11152
|
+
flags |= 128 /* TNodeFlags.inSkipHydrationBlock */;
|
|
11153
|
+
}
|
|
11122
11154
|
const tNode = {
|
|
11123
11155
|
type,
|
|
11124
11156
|
index,
|
|
@@ -11129,7 +11161,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
11129
11161
|
directiveStylingLast: -1,
|
|
11130
11162
|
componentOffset: -1,
|
|
11131
11163
|
propertyBindings: null,
|
|
11132
|
-
flags
|
|
11164
|
+
flags,
|
|
11133
11165
|
providerIndexes: 0,
|
|
11134
11166
|
value: value,
|
|
11135
11167
|
attrs: attrs,
|
|
@@ -23117,7 +23149,11 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
|
|
|
23117
23149
|
}
|
|
23118
23150
|
const hydrationInfo = findMatchingDehydratedView(this._lContainer, templateRef.ssrId);
|
|
23119
23151
|
const viewRef = templateRef.createEmbeddedViewImpl(context || {}, injector, hydrationInfo);
|
|
23120
|
-
|
|
23152
|
+
// If there is a matching dehydrated view, but the host TNode is located in the skip
|
|
23153
|
+
// hydration block, this means that the content was detached (as a part of the skip
|
|
23154
|
+
// hydration logic) and it needs to be appended into the DOM.
|
|
23155
|
+
const skipDomInsertion = !!hydrationInfo && !hasInSkipHydrationBlockFlag(this._hostTNode);
|
|
23156
|
+
this.insertImpl(viewRef, index, skipDomInsertion);
|
|
23121
23157
|
return viewRef;
|
|
23122
23158
|
}
|
|
23123
23159
|
createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, environmentInjector) {
|
|
@@ -23191,7 +23227,11 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
|
|
|
23191
23227
|
const dehydratedView = findMatchingDehydratedView(this._lContainer, componentDef?.id ?? null);
|
|
23192
23228
|
const rNode = dehydratedView?.firstChild ?? null;
|
|
23193
23229
|
const componentRef = componentFactory.create(contextInjector, projectableNodes, rNode, environmentInjector);
|
|
23194
|
-
|
|
23230
|
+
// If there is a matching dehydrated view, but the host TNode is located in the skip
|
|
23231
|
+
// hydration block, this means that the content was detached (as a part of the skip
|
|
23232
|
+
// hydration logic) and it needs to be appended into the DOM.
|
|
23233
|
+
const skipDomInsertion = !!dehydratedView && !hasInSkipHydrationBlockFlag(this._hostTNode);
|
|
23234
|
+
this.insertImpl(componentRef.hostView, index, skipDomInsertion);
|
|
23195
23235
|
return componentRef;
|
|
23196
23236
|
}
|
|
23197
23237
|
insert(viewRef, index) {
|
|
@@ -23365,8 +23405,10 @@ function locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue) {
|
|
|
23365
23405
|
return;
|
|
23366
23406
|
const hydrationInfo = hostLView[HYDRATION];
|
|
23367
23407
|
const noOffsetIndex = hostTNode.index - HEADER_OFFSET;
|
|
23368
|
-
|
|
23369
|
-
|
|
23408
|
+
// TODO(akushnir): this should really be a single condition, refactor the code
|
|
23409
|
+
// to use `hasInSkipHydrationBlockFlag` logic inside `isInSkipHydrationBlock`.
|
|
23410
|
+
const skipHydration = isInSkipHydrationBlock(hostTNode) || hasInSkipHydrationBlockFlag(hostTNode);
|
|
23411
|
+
const isNodeCreationMode = !hydrationInfo || skipHydration || isDisconnectedNode$1(hydrationInfo, noOffsetIndex);
|
|
23370
23412
|
// Regular creation mode.
|
|
23371
23413
|
if (isNodeCreationMode) {
|
|
23372
23414
|
return createAnchorNode(lContainer, hostLView, hostTNode, slotValue);
|
|
@@ -25062,17 +25104,17 @@ const Directive = makeDecorator('Directive', (dir = {}) => dir, undefined, undef
|
|
|
25062
25104
|
/**
|
|
25063
25105
|
* Component decorator and metadata.
|
|
25064
25106
|
*
|
|
25065
|
-
|
|
25107
|
+
* @Annotation
|
|
25066
25108
|
* @publicApi
|
|
25067
25109
|
*/
|
|
25068
25110
|
const Component = makeDecorator('Component', (c = {}) => ({ changeDetection: ChangeDetectionStrategy.Default, ...c }), Directive, undefined, (type, meta) => compileComponent(type, meta));
|
|
25069
25111
|
/**
|
|
25070
|
-
|
|
25112
|
+
* @Annotation
|
|
25071
25113
|
* @publicApi
|
|
25072
25114
|
*/
|
|
25073
25115
|
const Pipe = makeDecorator('Pipe', (p) => ({ pure: true, ...p }), undefined, undefined, (type, meta) => compilePipe(type, meta));
|
|
25074
25116
|
/**
|
|
25075
|
-
|
|
25117
|
+
* @Annotation
|
|
25076
25118
|
* @publicApi
|
|
25077
25119
|
*/
|
|
25078
25120
|
const Input = makePropDecorator('Input', (arg) => {
|
|
@@ -25082,12 +25124,12 @@ const Input = makePropDecorator('Input', (arg) => {
|
|
|
25082
25124
|
return typeof arg === 'string' ? { alias: arg } : arg;
|
|
25083
25125
|
});
|
|
25084
25126
|
/**
|
|
25085
|
-
|
|
25127
|
+
* @Annotation
|
|
25086
25128
|
* @publicApi
|
|
25087
25129
|
*/
|
|
25088
25130
|
const Output = makePropDecorator('Output', (alias) => ({ alias }));
|
|
25089
25131
|
/**
|
|
25090
|
-
|
|
25132
|
+
* @Annotation
|
|
25091
25133
|
* @publicApi
|
|
25092
25134
|
*/
|
|
25093
25135
|
const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ hostPropertyName }));
|
|
@@ -25153,12 +25195,13 @@ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ ho
|
|
|
25153
25195
|
* The global target names that can be used to prefix an event name are
|
|
25154
25196
|
* `document:`, `window:` and `body:`.
|
|
25155
25197
|
*
|
|
25156
|
-
|
|
25198
|
+
* @Annotation
|
|
25157
25199
|
* @publicApi
|
|
25158
25200
|
*/
|
|
25159
25201
|
const HostListener = makePropDecorator('HostListener', (eventName, args) => ({ eventName, args }));
|
|
25160
25202
|
|
|
25161
25203
|
/**
|
|
25204
|
+
* @Annotation
|
|
25162
25205
|
*/
|
|
25163
25206
|
const NgModule = makeDecorator('NgModule', (ngModule) => ngModule, undefined, undefined,
|
|
25164
25207
|
/**
|
|
@@ -26645,64 +26688,69 @@ function runPlatformInitializers(injector) {
|
|
|
26645
26688
|
* @returns A promise that returns an `ApplicationRef` instance once resolved.
|
|
26646
26689
|
*/
|
|
26647
26690
|
function internalCreateApplication(config) {
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
|
|
26664
|
-
|
|
26665
|
-
|
|
26666
|
-
|
|
26667
|
-
const envInjector = adapter.injector;
|
|
26668
|
-
const ngZone = envInjector.get(NgZone);
|
|
26669
|
-
return ngZone.run(() => {
|
|
26670
|
-
envInjector.resolveInjectorInitializers();
|
|
26671
|
-
const exceptionHandler = envInjector.get(ErrorHandler, null);
|
|
26672
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && !exceptionHandler) {
|
|
26673
|
-
throw new RuntimeError(402 /* RuntimeErrorCode.MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP */, 'No `ErrorHandler` found in the Dependency Injection tree.');
|
|
26674
|
-
}
|
|
26675
|
-
let onErrorSubscription;
|
|
26676
|
-
ngZone.runOutsideAngular(() => {
|
|
26677
|
-
onErrorSubscription = ngZone.onError.subscribe({
|
|
26678
|
-
next: (error) => {
|
|
26679
|
-
exceptionHandler.handleError(error);
|
|
26680
|
-
}
|
|
26681
|
-
});
|
|
26682
|
-
});
|
|
26683
|
-
// If the whole platform is destroyed, invoke the `destroy` method
|
|
26684
|
-
// for all bootstrapped applications as well.
|
|
26685
|
-
const destroyListener = () => envInjector.destroy();
|
|
26686
|
-
const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS);
|
|
26687
|
-
onPlatformDestroyListeners.add(destroyListener);
|
|
26688
|
-
envInjector.onDestroy(() => {
|
|
26689
|
-
onErrorSubscription.unsubscribe();
|
|
26690
|
-
onPlatformDestroyListeners.delete(destroyListener);
|
|
26691
|
+
try {
|
|
26692
|
+
const { rootComponent, appProviders, platformProviders } = config;
|
|
26693
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && rootComponent !== undefined) {
|
|
26694
|
+
assertStandaloneComponentType(rootComponent);
|
|
26695
|
+
}
|
|
26696
|
+
const platformInjector = createOrReusePlatformInjector(platformProviders);
|
|
26697
|
+
// Create root application injector based on a set of providers configured at the platform
|
|
26698
|
+
// bootstrap level as well as providers passed to the bootstrap call by a user.
|
|
26699
|
+
const allAppProviders = [
|
|
26700
|
+
provideZoneChangeDetection(),
|
|
26701
|
+
...(appProviders || []),
|
|
26702
|
+
];
|
|
26703
|
+
const adapter = new EnvironmentNgModuleRefAdapter({
|
|
26704
|
+
providers: allAppProviders,
|
|
26705
|
+
parent: platformInjector,
|
|
26706
|
+
debugName: (typeof ngDevMode === 'undefined' || ngDevMode) ? 'Environment Injector' : '',
|
|
26707
|
+
// We skip environment initializers because we need to run them inside the NgZone, which
|
|
26708
|
+
// happens after we get the NgZone instance from the Injector.
|
|
26709
|
+
runEnvironmentInitializers: false,
|
|
26691
26710
|
});
|
|
26692
|
-
|
|
26693
|
-
|
|
26694
|
-
|
|
26695
|
-
|
|
26696
|
-
|
|
26697
|
-
|
|
26698
|
-
|
|
26699
|
-
|
|
26700
|
-
|
|
26701
|
-
|
|
26702
|
-
|
|
26711
|
+
const envInjector = adapter.injector;
|
|
26712
|
+
const ngZone = envInjector.get(NgZone);
|
|
26713
|
+
return ngZone.run(() => {
|
|
26714
|
+
envInjector.resolveInjectorInitializers();
|
|
26715
|
+
const exceptionHandler = envInjector.get(ErrorHandler, null);
|
|
26716
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && !exceptionHandler) {
|
|
26717
|
+
throw new RuntimeError(402 /* RuntimeErrorCode.MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP */, 'No `ErrorHandler` found in the Dependency Injection tree.');
|
|
26718
|
+
}
|
|
26719
|
+
let onErrorSubscription;
|
|
26720
|
+
ngZone.runOutsideAngular(() => {
|
|
26721
|
+
onErrorSubscription = ngZone.onError.subscribe({
|
|
26722
|
+
next: (error) => {
|
|
26723
|
+
exceptionHandler.handleError(error);
|
|
26724
|
+
}
|
|
26725
|
+
});
|
|
26726
|
+
});
|
|
26727
|
+
// If the whole platform is destroyed, invoke the `destroy` method
|
|
26728
|
+
// for all bootstrapped applications as well.
|
|
26729
|
+
const destroyListener = () => envInjector.destroy();
|
|
26730
|
+
const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS);
|
|
26731
|
+
onPlatformDestroyListeners.add(destroyListener);
|
|
26732
|
+
envInjector.onDestroy(() => {
|
|
26733
|
+
onErrorSubscription.unsubscribe();
|
|
26734
|
+
onPlatformDestroyListeners.delete(destroyListener);
|
|
26735
|
+
});
|
|
26736
|
+
return _callAndReportToErrorHandler(exceptionHandler, ngZone, () => {
|
|
26737
|
+
const initStatus = envInjector.get(ApplicationInitStatus);
|
|
26738
|
+
initStatus.runInitializers();
|
|
26739
|
+
return initStatus.donePromise.then(() => {
|
|
26740
|
+
const localeId = envInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
|
|
26741
|
+
setLocaleId(localeId || DEFAULT_LOCALE_ID);
|
|
26742
|
+
const appRef = envInjector.get(ApplicationRef);
|
|
26743
|
+
if (rootComponent !== undefined) {
|
|
26744
|
+
appRef.bootstrap(rootComponent);
|
|
26745
|
+
}
|
|
26746
|
+
return appRef;
|
|
26747
|
+
});
|
|
26703
26748
|
});
|
|
26704
26749
|
});
|
|
26705
|
-
}
|
|
26750
|
+
}
|
|
26751
|
+
catch (e) {
|
|
26752
|
+
return Promise.reject(e);
|
|
26753
|
+
}
|
|
26706
26754
|
}
|
|
26707
26755
|
/**
|
|
26708
26756
|
* Creates a factory for a platform. Can be used to provide or override `Providers` specific to
|
|
@@ -29813,7 +29861,7 @@ function printHydrationStats(injector) {
|
|
|
29813
29861
|
`and ${ngDevMode.hydratedNodes} node(s), ` +
|
|
29814
29862
|
`${ngDevMode.componentsSkippedHydration} component(s) were skipped. ` +
|
|
29815
29863
|
`Note: this feature is in Developer Preview mode. ` +
|
|
29816
|
-
`Learn more at https://
|
|
29864
|
+
`Learn more at https://angular.io/guide/hydration.`;
|
|
29817
29865
|
// tslint:disable-next-line:no-console
|
|
29818
29866
|
console.log(message);
|
|
29819
29867
|
}
|