@angular/core 14.0.0 → 14.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/esm2020/src/di/provider_collection.mjs +1 -1
- package/esm2020/src/error_handler.mjs +4 -7
- package/esm2020/src/errors.mjs +6 -3
- package/esm2020/src/render3/component.mjs +9 -9
- package/esm2020/src/render3/definition.mjs +4 -4
- package/esm2020/src/render3/features/standalone_feature.mjs +4 -4
- package/esm2020/src/render3/instructions/all.mjs +2 -2
- package/esm2020/src/render3/instructions/element.mjs +3 -79
- package/esm2020/src/render3/instructions/element_validation.mjs +264 -0
- package/esm2020/src/render3/instructions/shared.mjs +7 -184
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/jit/module.mjs +2 -2
- package/esm2020/src/render3/pipe.mjs +20 -6
- package/esm2020/src/render3/state.mjs +1 -3
- package/esm2020/src/util/errors.mjs +1 -8
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/fesm2015/core.mjs +602 -591
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +602 -591
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +603 -592
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +603 -592
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +7 -6
- package/package.json +1 -1
- package/testing/index.d.ts +1 -1
package/fesm2020/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.
|
|
2
|
+
* @license Angular v14.0.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -181,9 +181,12 @@ function formatRuntimeError(code, message) {
|
|
|
181
181
|
// Error code might be a negative number, which is a special marker that instructs the logic to
|
|
182
182
|
// generate a link to the error details page on angular.io.
|
|
183
183
|
const fullCode = `NG0${Math.abs(code)}`;
|
|
184
|
-
let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
|
|
184
|
+
let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
|
|
185
185
|
if (ngDevMode && code < 0) {
|
|
186
|
-
|
|
186
|
+
const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
|
|
187
|
+
const separator = addPeriodSeparator ? '.' : '';
|
|
188
|
+
errorMessage =
|
|
189
|
+
`${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
|
|
187
190
|
}
|
|
188
191
|
return errorMessage;
|
|
189
192
|
}
|
|
@@ -864,7 +867,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
|
|
|
864
867
|
* Use of this source code is governed by an MIT-style license that can be
|
|
865
868
|
* found in the LICENSE file at https://angular.io/license
|
|
866
869
|
*/
|
|
867
|
-
|
|
870
|
+
/** Counter used to generate unique IDs for component definitions. */
|
|
871
|
+
let componentDefCount = 0;
|
|
868
872
|
/**
|
|
869
873
|
* Create a component definition object.
|
|
870
874
|
*
|
|
@@ -917,7 +921,7 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
917
921
|
features: componentDefinition.features || null,
|
|
918
922
|
data: componentDefinition.data || {},
|
|
919
923
|
encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
|
|
920
|
-
id:
|
|
924
|
+
id: `c${componentDefCount++}`,
|
|
921
925
|
styles: componentDefinition.styles || EMPTY_ARRAY,
|
|
922
926
|
_: null,
|
|
923
927
|
setInput: null,
|
|
@@ -926,7 +930,6 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
926
930
|
};
|
|
927
931
|
const dependencies = componentDefinition.dependencies;
|
|
928
932
|
const feature = componentDefinition.features;
|
|
929
|
-
def.id += _renderCompCount++;
|
|
930
933
|
def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
|
|
931
934
|
def.outputs = invertObject(componentDefinition.outputs),
|
|
932
935
|
feature && feature.forEach((fn) => fn(def));
|
|
@@ -1940,7 +1943,6 @@ function getLView() {
|
|
|
1940
1943
|
function getTView() {
|
|
1941
1944
|
return instructionState.lFrame.tView;
|
|
1942
1945
|
}
|
|
1943
|
-
// TODO(crisbeto): revert the @noinline once Closure issue is resolved.
|
|
1944
1946
|
/**
|
|
1945
1947
|
* Restores `contextViewData` to the given OpaqueViewState instance.
|
|
1946
1948
|
*
|
|
@@ -1952,7 +1954,6 @@ function getTView() {
|
|
|
1952
1954
|
* @returns Context of the restored OpaqueViewState instance.
|
|
1953
1955
|
*
|
|
1954
1956
|
* @codeGenApi
|
|
1955
|
-
* @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
|
|
1956
1957
|
*/
|
|
1957
1958
|
function ɵɵrestoreView(viewToRestore) {
|
|
1958
1959
|
instructionState.lFrame.contextLView = viewToRestore;
|
|
@@ -6349,6 +6350,155 @@ function getSanitizer() {
|
|
|
6349
6350
|
return lView && lView[SANITIZER];
|
|
6350
6351
|
}
|
|
6351
6352
|
|
|
6353
|
+
/**
|
|
6354
|
+
* @license
|
|
6355
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6356
|
+
*
|
|
6357
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6358
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6359
|
+
*/
|
|
6360
|
+
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
6361
|
+
function wrappedError(message, originalError) {
|
|
6362
|
+
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
6363
|
+
const error = Error(msg);
|
|
6364
|
+
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
6365
|
+
return error;
|
|
6366
|
+
}
|
|
6367
|
+
function getOriginalError(error) {
|
|
6368
|
+
return error[ERROR_ORIGINAL_ERROR];
|
|
6369
|
+
}
|
|
6370
|
+
|
|
6371
|
+
/**
|
|
6372
|
+
* @license
|
|
6373
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6374
|
+
*
|
|
6375
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6376
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6377
|
+
*/
|
|
6378
|
+
/**
|
|
6379
|
+
* Provides a hook for centralized exception handling.
|
|
6380
|
+
*
|
|
6381
|
+
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
6382
|
+
* intercept error handling, write a custom exception handler that replaces this default as
|
|
6383
|
+
* appropriate for your app.
|
|
6384
|
+
*
|
|
6385
|
+
* @usageNotes
|
|
6386
|
+
* ### Example
|
|
6387
|
+
*
|
|
6388
|
+
* ```
|
|
6389
|
+
* class MyErrorHandler implements ErrorHandler {
|
|
6390
|
+
* handleError(error) {
|
|
6391
|
+
* // do something with the exception
|
|
6392
|
+
* }
|
|
6393
|
+
* }
|
|
6394
|
+
*
|
|
6395
|
+
* @NgModule({
|
|
6396
|
+
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
6397
|
+
* })
|
|
6398
|
+
* class MyModule {}
|
|
6399
|
+
* ```
|
|
6400
|
+
*
|
|
6401
|
+
* @publicApi
|
|
6402
|
+
*/
|
|
6403
|
+
class ErrorHandler {
|
|
6404
|
+
constructor() {
|
|
6405
|
+
/**
|
|
6406
|
+
* @internal
|
|
6407
|
+
*/
|
|
6408
|
+
this._console = console;
|
|
6409
|
+
}
|
|
6410
|
+
handleError(error) {
|
|
6411
|
+
const originalError = this._findOriginalError(error);
|
|
6412
|
+
this._console.error('ERROR', error);
|
|
6413
|
+
if (originalError) {
|
|
6414
|
+
this._console.error('ORIGINAL ERROR', originalError);
|
|
6415
|
+
}
|
|
6416
|
+
}
|
|
6417
|
+
/** @internal */
|
|
6418
|
+
_findOriginalError(error) {
|
|
6419
|
+
let e = error && getOriginalError(error);
|
|
6420
|
+
while (e && getOriginalError(e)) {
|
|
6421
|
+
e = getOriginalError(e);
|
|
6422
|
+
}
|
|
6423
|
+
return e || null;
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6427
|
+
/**
|
|
6428
|
+
* @license
|
|
6429
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6430
|
+
*
|
|
6431
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6432
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6433
|
+
*/
|
|
6434
|
+
/**
|
|
6435
|
+
* Disallowed strings in the comment.
|
|
6436
|
+
*
|
|
6437
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6438
|
+
*/
|
|
6439
|
+
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
6440
|
+
/**
|
|
6441
|
+
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
6442
|
+
*/
|
|
6443
|
+
const COMMENT_DELIMITER = /(<|>)/;
|
|
6444
|
+
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
6445
|
+
/**
|
|
6446
|
+
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
6447
|
+
*
|
|
6448
|
+
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
6449
|
+
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
6450
|
+
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
6451
|
+
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
6452
|
+
*
|
|
6453
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6454
|
+
*
|
|
6455
|
+
* ```
|
|
6456
|
+
* div.innerHTML = div.innerHTML
|
|
6457
|
+
* ```
|
|
6458
|
+
*
|
|
6459
|
+
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
6460
|
+
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
6461
|
+
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
6462
|
+
* may contain such text and expect them to be safe.)
|
|
6463
|
+
*
|
|
6464
|
+
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
6465
|
+
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
6466
|
+
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
6467
|
+
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
6468
|
+
*
|
|
6469
|
+
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
6470
|
+
* sequence.
|
|
6471
|
+
*/
|
|
6472
|
+
function escapeCommentText(value) {
|
|
6473
|
+
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
6474
|
+
}
|
|
6475
|
+
|
|
6476
|
+
/**
|
|
6477
|
+
* @license
|
|
6478
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6479
|
+
*
|
|
6480
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6481
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6482
|
+
*/
|
|
6483
|
+
function normalizeDebugBindingName(name) {
|
|
6484
|
+
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
6485
|
+
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
6486
|
+
return `ng-reflect-${name}`;
|
|
6487
|
+
}
|
|
6488
|
+
const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
|
6489
|
+
function camelCaseToDashCase(input) {
|
|
6490
|
+
return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
|
6491
|
+
}
|
|
6492
|
+
function normalizeDebugBindingValue(value) {
|
|
6493
|
+
try {
|
|
6494
|
+
// Limit the size of the value as otherwise the DOM just gets polluted.
|
|
6495
|
+
return value != null ? value.toString().slice(0, 30) : value;
|
|
6496
|
+
}
|
|
6497
|
+
catch (e) {
|
|
6498
|
+
return '[ERROR] Exception while trying to serialize the value';
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
|
|
6352
6502
|
/**
|
|
6353
6503
|
* @license
|
|
6354
6504
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6697,223 +6847,33 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
|
|
6697
6847
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6698
6848
|
let directiveStartIndex = tNode.directiveStart;
|
|
6699
6849
|
if (directiveStartIndex == 0)
|
|
6700
|
-
return EMPTY_ARRAY;
|
|
6701
|
-
const directiveEndIndex = tNode.directiveEnd;
|
|
6702
|
-
if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
6703
|
-
directiveStartIndex++;
|
|
6704
|
-
return lView.slice(directiveStartIndex, directiveEndIndex);
|
|
6705
|
-
}
|
|
6706
|
-
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
6707
|
-
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6708
|
-
let directiveStartIndex = tNode.directiveStart;
|
|
6709
|
-
return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
|
|
6710
|
-
}
|
|
6711
|
-
/**
|
|
6712
|
-
* Returns a map of local references (local reference name => element or directive instance) that
|
|
6713
|
-
* exist on a given element.
|
|
6714
|
-
*/
|
|
6715
|
-
function discoverLocalRefs(lView, nodeIndex) {
|
|
6716
|
-
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6717
|
-
if (tNode && tNode.localNames) {
|
|
6718
|
-
const result = {};
|
|
6719
|
-
let localIndex = tNode.index + 1;
|
|
6720
|
-
for (let i = 0; i < tNode.localNames.length; i += 2) {
|
|
6721
|
-
result[tNode.localNames[i]] = lView[localIndex];
|
|
6722
|
-
localIndex++;
|
|
6723
|
-
}
|
|
6724
|
-
return result;
|
|
6725
|
-
}
|
|
6726
|
-
return null;
|
|
6727
|
-
}
|
|
6728
|
-
|
|
6729
|
-
/**
|
|
6730
|
-
* @license
|
|
6731
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6732
|
-
*
|
|
6733
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6734
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6735
|
-
*/
|
|
6736
|
-
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
6737
|
-
const ERROR_LOGGER = 'ngErrorLogger';
|
|
6738
|
-
function wrappedError(message, originalError) {
|
|
6739
|
-
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
6740
|
-
const error = Error(msg);
|
|
6741
|
-
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
6742
|
-
return error;
|
|
6743
|
-
}
|
|
6744
|
-
function getOriginalError(error) {
|
|
6745
|
-
return error[ERROR_ORIGINAL_ERROR];
|
|
6746
|
-
}
|
|
6747
|
-
function getErrorLogger(error) {
|
|
6748
|
-
return error && error[ERROR_LOGGER] || defaultErrorLogger;
|
|
6749
|
-
}
|
|
6750
|
-
function defaultErrorLogger(console, ...values) {
|
|
6751
|
-
console.error(...values);
|
|
6752
|
-
}
|
|
6753
|
-
|
|
6754
|
-
/**
|
|
6755
|
-
* @license
|
|
6756
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6757
|
-
*
|
|
6758
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6759
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6760
|
-
*/
|
|
6761
|
-
/**
|
|
6762
|
-
* Provides a hook for centralized exception handling.
|
|
6763
|
-
*
|
|
6764
|
-
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
6765
|
-
* intercept error handling, write a custom exception handler that replaces this default as
|
|
6766
|
-
* appropriate for your app.
|
|
6767
|
-
*
|
|
6768
|
-
* @usageNotes
|
|
6769
|
-
* ### Example
|
|
6770
|
-
*
|
|
6771
|
-
* ```
|
|
6772
|
-
* class MyErrorHandler implements ErrorHandler {
|
|
6773
|
-
* handleError(error) {
|
|
6774
|
-
* // do something with the exception
|
|
6775
|
-
* }
|
|
6776
|
-
* }
|
|
6777
|
-
*
|
|
6778
|
-
* @NgModule({
|
|
6779
|
-
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
6780
|
-
* })
|
|
6781
|
-
* class MyModule {}
|
|
6782
|
-
* ```
|
|
6783
|
-
*
|
|
6784
|
-
* @publicApi
|
|
6785
|
-
*/
|
|
6786
|
-
class ErrorHandler {
|
|
6787
|
-
constructor() {
|
|
6788
|
-
/**
|
|
6789
|
-
* @internal
|
|
6790
|
-
*/
|
|
6791
|
-
this._console = console;
|
|
6792
|
-
}
|
|
6793
|
-
handleError(error) {
|
|
6794
|
-
const originalError = this._findOriginalError(error);
|
|
6795
|
-
// Note: Browser consoles show the place from where console.error was called.
|
|
6796
|
-
// We can use this to give users additional information about the error.
|
|
6797
|
-
const errorLogger = getErrorLogger(error);
|
|
6798
|
-
errorLogger(this._console, `ERROR`, error);
|
|
6799
|
-
if (originalError) {
|
|
6800
|
-
errorLogger(this._console, `ORIGINAL ERROR`, originalError);
|
|
6801
|
-
}
|
|
6802
|
-
}
|
|
6803
|
-
/** @internal */
|
|
6804
|
-
_findOriginalError(error) {
|
|
6805
|
-
let e = error && getOriginalError(error);
|
|
6806
|
-
while (e && getOriginalError(e)) {
|
|
6807
|
-
e = getOriginalError(e);
|
|
6808
|
-
}
|
|
6809
|
-
return e || null;
|
|
6810
|
-
}
|
|
6811
|
-
}
|
|
6812
|
-
|
|
6813
|
-
/**
|
|
6814
|
-
* @license
|
|
6815
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6816
|
-
*
|
|
6817
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6818
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6819
|
-
*/
|
|
6820
|
-
/**
|
|
6821
|
-
* Defines a schema that allows an NgModule to contain the following:
|
|
6822
|
-
* - Non-Angular elements named with dash case (`-`).
|
|
6823
|
-
* - Element properties named with dash case (`-`).
|
|
6824
|
-
* Dash case is the naming convention for custom elements.
|
|
6825
|
-
*
|
|
6826
|
-
* @publicApi
|
|
6827
|
-
*/
|
|
6828
|
-
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
6829
|
-
name: 'custom-elements'
|
|
6830
|
-
};
|
|
6831
|
-
/**
|
|
6832
|
-
* Defines a schema that allows any property on any element.
|
|
6833
|
-
*
|
|
6834
|
-
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
6835
|
-
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
6836
|
-
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
6837
|
-
*
|
|
6838
|
-
* @publicApi
|
|
6839
|
-
*/
|
|
6840
|
-
const NO_ERRORS_SCHEMA = {
|
|
6841
|
-
name: 'no-errors-schema'
|
|
6842
|
-
};
|
|
6843
|
-
|
|
6844
|
-
/**
|
|
6845
|
-
* @license
|
|
6846
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6847
|
-
*
|
|
6848
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6849
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6850
|
-
*/
|
|
6851
|
-
/**
|
|
6852
|
-
* Disallowed strings in the comment.
|
|
6853
|
-
*
|
|
6854
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6855
|
-
*/
|
|
6856
|
-
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
6857
|
-
/**
|
|
6858
|
-
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
6859
|
-
*/
|
|
6860
|
-
const COMMENT_DELIMITER = /(<|>)/;
|
|
6861
|
-
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
6862
|
-
/**
|
|
6863
|
-
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
6864
|
-
*
|
|
6865
|
-
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
6866
|
-
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
6867
|
-
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
6868
|
-
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
6869
|
-
*
|
|
6870
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6871
|
-
*
|
|
6872
|
-
* ```
|
|
6873
|
-
* div.innerHTML = div.innerHTML
|
|
6874
|
-
* ```
|
|
6875
|
-
*
|
|
6876
|
-
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
6877
|
-
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
6878
|
-
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
6879
|
-
* may contain such text and expect them to be safe.)
|
|
6880
|
-
*
|
|
6881
|
-
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
6882
|
-
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
6883
|
-
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
6884
|
-
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
6885
|
-
*
|
|
6886
|
-
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
6887
|
-
* sequence.
|
|
6888
|
-
*/
|
|
6889
|
-
function escapeCommentText(value) {
|
|
6890
|
-
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
6891
|
-
}
|
|
6892
|
-
|
|
6893
|
-
/**
|
|
6894
|
-
* @license
|
|
6895
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6896
|
-
*
|
|
6897
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6898
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6899
|
-
*/
|
|
6900
|
-
function normalizeDebugBindingName(name) {
|
|
6901
|
-
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
6902
|
-
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
6903
|
-
return `ng-reflect-${name}`;
|
|
6850
|
+
return EMPTY_ARRAY;
|
|
6851
|
+
const directiveEndIndex = tNode.directiveEnd;
|
|
6852
|
+
if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
6853
|
+
directiveStartIndex++;
|
|
6854
|
+
return lView.slice(directiveStartIndex, directiveEndIndex);
|
|
6904
6855
|
}
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6856
|
+
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
6857
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6858
|
+
let directiveStartIndex = tNode.directiveStart;
|
|
6859
|
+
return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
|
|
6908
6860
|
}
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6861
|
+
/**
|
|
6862
|
+
* Returns a map of local references (local reference name => element or directive instance) that
|
|
6863
|
+
* exist on a given element.
|
|
6864
|
+
*/
|
|
6865
|
+
function discoverLocalRefs(lView, nodeIndex) {
|
|
6866
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6867
|
+
if (tNode && tNode.localNames) {
|
|
6868
|
+
const result = {};
|
|
6869
|
+
let localIndex = tNode.index + 1;
|
|
6870
|
+
for (let i = 0; i < tNode.localNames.length; i += 2) {
|
|
6871
|
+
result[tNode.localNames[i]] = lView[localIndex];
|
|
6872
|
+
localIndex++;
|
|
6873
|
+
}
|
|
6874
|
+
return result;
|
|
6916
6875
|
}
|
|
6876
|
+
return null;
|
|
6917
6877
|
}
|
|
6918
6878
|
|
|
6919
6879
|
/**
|
|
@@ -10354,113 +10314,402 @@ class ReflectiveInjector_ {
|
|
|
10354
10314
|
return this.objs[i];
|
|
10355
10315
|
}
|
|
10356
10316
|
}
|
|
10357
|
-
return UNDEFINED;
|
|
10317
|
+
return UNDEFINED;
|
|
10318
|
+
}
|
|
10319
|
+
/** @internal */
|
|
10320
|
+
_throwOrNull(key, notFoundValue) {
|
|
10321
|
+
if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
|
10322
|
+
return notFoundValue;
|
|
10323
|
+
}
|
|
10324
|
+
else {
|
|
10325
|
+
throw noProviderError(this, key);
|
|
10326
|
+
}
|
|
10327
|
+
}
|
|
10328
|
+
/** @internal */
|
|
10329
|
+
_getByKeySelf(key, notFoundValue) {
|
|
10330
|
+
const obj = this._getObjByKeyId(key.id);
|
|
10331
|
+
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
|
10332
|
+
}
|
|
10333
|
+
/** @internal */
|
|
10334
|
+
_getByKeyDefault(key, notFoundValue, visibility) {
|
|
10335
|
+
let inj;
|
|
10336
|
+
if (visibility instanceof SkipSelf) {
|
|
10337
|
+
inj = this.parent;
|
|
10338
|
+
}
|
|
10339
|
+
else {
|
|
10340
|
+
inj = this;
|
|
10341
|
+
}
|
|
10342
|
+
while (inj instanceof ReflectiveInjector_) {
|
|
10343
|
+
const inj_ = inj;
|
|
10344
|
+
const obj = inj_._getObjByKeyId(key.id);
|
|
10345
|
+
if (obj !== UNDEFINED)
|
|
10346
|
+
return obj;
|
|
10347
|
+
inj = inj_.parent;
|
|
10348
|
+
}
|
|
10349
|
+
if (inj !== null) {
|
|
10350
|
+
return inj.get(key.token, notFoundValue);
|
|
10351
|
+
}
|
|
10352
|
+
else {
|
|
10353
|
+
return this._throwOrNull(key, notFoundValue);
|
|
10354
|
+
}
|
|
10355
|
+
}
|
|
10356
|
+
get displayName() {
|
|
10357
|
+
const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
|
|
10358
|
+
.join(', ');
|
|
10359
|
+
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10360
|
+
}
|
|
10361
|
+
toString() {
|
|
10362
|
+
return this.displayName;
|
|
10363
|
+
}
|
|
10364
|
+
}
|
|
10365
|
+
ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
|
|
10366
|
+
function _mapProviders(injector, fn) {
|
|
10367
|
+
const res = [];
|
|
10368
|
+
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10369
|
+
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10370
|
+
}
|
|
10371
|
+
return res;
|
|
10372
|
+
}
|
|
10373
|
+
|
|
10374
|
+
/**
|
|
10375
|
+
* @license
|
|
10376
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10377
|
+
*
|
|
10378
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10379
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10380
|
+
*/
|
|
10381
|
+
|
|
10382
|
+
/**
|
|
10383
|
+
* @license
|
|
10384
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10385
|
+
*
|
|
10386
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10387
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10388
|
+
*/
|
|
10389
|
+
|
|
10390
|
+
/**
|
|
10391
|
+
* @license
|
|
10392
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10393
|
+
*
|
|
10394
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10395
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10396
|
+
*/
|
|
10397
|
+
function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
|
10398
|
+
const lView = getLView();
|
|
10399
|
+
// Fall back to inject() if view hasn't been created. This situation can happen in tests
|
|
10400
|
+
// if inject utilities are used before bootstrapping.
|
|
10401
|
+
if (lView === null) {
|
|
10402
|
+
// Verify that we will not get into infinite loop.
|
|
10403
|
+
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10404
|
+
return ɵɵinject(token, flags);
|
|
10405
|
+
}
|
|
10406
|
+
const tNode = getCurrentTNode();
|
|
10407
|
+
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10408
|
+
}
|
|
10409
|
+
/**
|
|
10410
|
+
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
10411
|
+
* particular class.
|
|
10412
|
+
*
|
|
10413
|
+
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10414
|
+
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10415
|
+
*
|
|
10416
|
+
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
10417
|
+
* and thus in the stack trace.
|
|
10418
|
+
*
|
|
10419
|
+
* @codeGenApi
|
|
10420
|
+
*/
|
|
10421
|
+
function ɵɵinvalidFactory() {
|
|
10422
|
+
const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
|
|
10423
|
+
throw new Error(msg);
|
|
10424
|
+
}
|
|
10425
|
+
|
|
10426
|
+
/**
|
|
10427
|
+
* @license
|
|
10428
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10429
|
+
*
|
|
10430
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10431
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10432
|
+
*/
|
|
10433
|
+
/**
|
|
10434
|
+
* Defines a schema that allows an NgModule to contain the following:
|
|
10435
|
+
* - Non-Angular elements named with dash case (`-`).
|
|
10436
|
+
* - Element properties named with dash case (`-`).
|
|
10437
|
+
* Dash case is the naming convention for custom elements.
|
|
10438
|
+
*
|
|
10439
|
+
* @publicApi
|
|
10440
|
+
*/
|
|
10441
|
+
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
10442
|
+
name: 'custom-elements'
|
|
10443
|
+
};
|
|
10444
|
+
/**
|
|
10445
|
+
* Defines a schema that allows any property on any element.
|
|
10446
|
+
*
|
|
10447
|
+
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
10448
|
+
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
10449
|
+
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
10450
|
+
*
|
|
10451
|
+
* @publicApi
|
|
10452
|
+
*/
|
|
10453
|
+
const NO_ERRORS_SCHEMA = {
|
|
10454
|
+
name: 'no-errors-schema'
|
|
10455
|
+
};
|
|
10456
|
+
|
|
10457
|
+
/**
|
|
10458
|
+
* @license
|
|
10459
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10460
|
+
*
|
|
10461
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10462
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10463
|
+
*/
|
|
10464
|
+
let shouldThrowErrorOnUnknownElement = false;
|
|
10465
|
+
/**
|
|
10466
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
10467
|
+
* instead of just logging the error.
|
|
10468
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10469
|
+
*/
|
|
10470
|
+
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
10471
|
+
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
10472
|
+
}
|
|
10473
|
+
/**
|
|
10474
|
+
* Gets the current value of the strict mode.
|
|
10475
|
+
*/
|
|
10476
|
+
function ɵgetUnknownElementStrictMode() {
|
|
10477
|
+
return shouldThrowErrorOnUnknownElement;
|
|
10478
|
+
}
|
|
10479
|
+
let shouldThrowErrorOnUnknownProperty = false;
|
|
10480
|
+
/**
|
|
10481
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
10482
|
+
* instead of just logging the error.
|
|
10483
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10484
|
+
*/
|
|
10485
|
+
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
10486
|
+
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
10487
|
+
}
|
|
10488
|
+
/**
|
|
10489
|
+
* Gets the current value of the strict mode.
|
|
10490
|
+
*/
|
|
10491
|
+
function ɵgetUnknownPropertyStrictMode() {
|
|
10492
|
+
return shouldThrowErrorOnUnknownProperty;
|
|
10493
|
+
}
|
|
10494
|
+
/**
|
|
10495
|
+
* Validates that the element is known at runtime and produces
|
|
10496
|
+
* an error if it's not the case.
|
|
10497
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10498
|
+
* ones this check happens at build time).
|
|
10499
|
+
*
|
|
10500
|
+
* The element is considered known if either:
|
|
10501
|
+
* - it's a known HTML element
|
|
10502
|
+
* - it's a known custom element
|
|
10503
|
+
* - the element matches any directive
|
|
10504
|
+
* - the element is allowed by one of the schemas
|
|
10505
|
+
*
|
|
10506
|
+
* @param element Element to validate
|
|
10507
|
+
* @param lView An `LView` that represents a current component that is being rendered
|
|
10508
|
+
* @param tagName Name of the tag to check
|
|
10509
|
+
* @param schemas Array of schemas
|
|
10510
|
+
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
10511
|
+
*/
|
|
10512
|
+
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
10513
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10514
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10515
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10516
|
+
// execute the check below.
|
|
10517
|
+
if (schemas === null)
|
|
10518
|
+
return;
|
|
10519
|
+
// If the element matches any directive, it's considered as valid.
|
|
10520
|
+
if (!hasDirectives && tagName !== null) {
|
|
10521
|
+
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
10522
|
+
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
10523
|
+
// of HTMLUnknownElement in browsers that support web components.
|
|
10524
|
+
const isUnknown =
|
|
10525
|
+
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
10526
|
+
// because while most browsers return 'function', IE returns 'object'.
|
|
10527
|
+
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
10528
|
+
element instanceof HTMLUnknownElement) ||
|
|
10529
|
+
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
10530
|
+
!customElements.get(tagName));
|
|
10531
|
+
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
10532
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10533
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10534
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10535
|
+
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
10536
|
+
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
10537
|
+
'a part of an @NgModule where this component is declared'}.\n`;
|
|
10538
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10539
|
+
message +=
|
|
10540
|
+
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
10541
|
+
}
|
|
10542
|
+
else {
|
|
10543
|
+
message +=
|
|
10544
|
+
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
10545
|
+
}
|
|
10546
|
+
if (shouldThrowErrorOnUnknownElement) {
|
|
10547
|
+
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
10548
|
+
}
|
|
10549
|
+
else {
|
|
10550
|
+
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
10551
|
+
}
|
|
10552
|
+
}
|
|
10358
10553
|
}
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10554
|
+
}
|
|
10555
|
+
/**
|
|
10556
|
+
* Validates that the property of the element is known at runtime and returns
|
|
10557
|
+
* false if it's not the case.
|
|
10558
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10559
|
+
* ones this check happens at build time).
|
|
10560
|
+
*
|
|
10561
|
+
* The property is considered known if either:
|
|
10562
|
+
* - it's a known property of the element
|
|
10563
|
+
* - the element is allowed by one of the schemas
|
|
10564
|
+
* - the property is used for animations
|
|
10565
|
+
*
|
|
10566
|
+
* @param element Element to validate
|
|
10567
|
+
* @param propName Name of the property to check
|
|
10568
|
+
* @param tagName Name of the tag hosting the property
|
|
10569
|
+
* @param schemas Array of schemas
|
|
10570
|
+
*/
|
|
10571
|
+
function isPropertyValid(element, propName, tagName, schemas) {
|
|
10572
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10573
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10574
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10575
|
+
// execute the check below.
|
|
10576
|
+
if (schemas === null)
|
|
10577
|
+
return true;
|
|
10578
|
+
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
10579
|
+
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
10580
|
+
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
10581
|
+
return true;
|
|
10367
10582
|
}
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10583
|
+
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
10584
|
+
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
10585
|
+
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
10586
|
+
}
|
|
10587
|
+
/**
|
|
10588
|
+
* Logs or throws an error that a property is not supported on an element.
|
|
10589
|
+
*
|
|
10590
|
+
* @param propName Name of the invalid property
|
|
10591
|
+
* @param tagName Name of the tag hosting the property
|
|
10592
|
+
* @param nodeType Type of the node hosting the property
|
|
10593
|
+
* @param lView An `LView` that represents a current component
|
|
10594
|
+
*/
|
|
10595
|
+
function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
|
|
10596
|
+
// Special-case a situation when a structural directive is applied to
|
|
10597
|
+
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
10598
|
+
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
10599
|
+
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
10600
|
+
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
10601
|
+
// a default value of the `tNode.value` is not feasible at this moment.
|
|
10602
|
+
if (!tagName && nodeType === 4 /* TNodeType.Container */) {
|
|
10603
|
+
tagName = 'ng-template';
|
|
10372
10604
|
}
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
}
|
|
10389
|
-
|
|
10390
|
-
|
|
10605
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10606
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10607
|
+
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
10608
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10609
|
+
const importLocation = isHostStandalone ?
|
|
10610
|
+
'included in the \'@Component.imports\' of this component' :
|
|
10611
|
+
'a part of an @NgModule where this component is declared';
|
|
10612
|
+
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
10613
|
+
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
10614
|
+
// a template, but the `CommonModule` is not imported.
|
|
10615
|
+
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
10616
|
+
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
10617
|
+
}
|
|
10618
|
+
else {
|
|
10619
|
+
// May be an Angular component, which is not imported/declared?
|
|
10620
|
+
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
10621
|
+
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
10622
|
+
// May be a Web Component?
|
|
10623
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10624
|
+
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
10625
|
+
`to the ${schemas} of this component to suppress this message.`;
|
|
10626
|
+
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10627
|
+
`the ${schemas} of this component.`;
|
|
10391
10628
|
}
|
|
10392
10629
|
else {
|
|
10393
|
-
|
|
10630
|
+
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
10631
|
+
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10632
|
+
`the ${schemas} of this component.`;
|
|
10394
10633
|
}
|
|
10395
10634
|
}
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
.join(', ');
|
|
10399
|
-
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10400
|
-
}
|
|
10401
|
-
toString() {
|
|
10402
|
-
return this.displayName;
|
|
10635
|
+
if (shouldThrowErrorOnUnknownProperty) {
|
|
10636
|
+
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
10403
10637
|
}
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
function _mapProviders(injector, fn) {
|
|
10407
|
-
const res = [];
|
|
10408
|
-
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10409
|
-
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10638
|
+
else {
|
|
10639
|
+
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
10410
10640
|
}
|
|
10411
|
-
return res;
|
|
10412
10641
|
}
|
|
10413
|
-
|
|
10414
10642
|
/**
|
|
10415
|
-
*
|
|
10416
|
-
*
|
|
10643
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10644
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10645
|
+
* be too slow for production mode and also it relies on the constructor function being available.
|
|
10417
10646
|
*
|
|
10418
|
-
*
|
|
10419
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10420
|
-
*/
|
|
10421
|
-
|
|
10422
|
-
/**
|
|
10423
|
-
* @license
|
|
10424
|
-
* Copyright Google LLC All Rights Reserved.
|
|
10647
|
+
* Gets a reference to the host component def (where a current component is declared).
|
|
10425
10648
|
*
|
|
10426
|
-
*
|
|
10427
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10649
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10428
10650
|
*/
|
|
10429
|
-
|
|
10651
|
+
function getDeclarationComponentDef(lView) {
|
|
10652
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10653
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
10654
|
+
const context = declarationLView[CONTEXT];
|
|
10655
|
+
// Unable to obtain a context.
|
|
10656
|
+
if (!context)
|
|
10657
|
+
return null;
|
|
10658
|
+
return context.constructor ? getComponentDef(context.constructor) : null;
|
|
10659
|
+
}
|
|
10430
10660
|
/**
|
|
10431
|
-
*
|
|
10432
|
-
*
|
|
10661
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10662
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10663
|
+
* be too slow for production mode.
|
|
10433
10664
|
*
|
|
10434
|
-
*
|
|
10435
|
-
*
|
|
10665
|
+
* Checks if the current component is declared inside of a standalone component template.
|
|
10666
|
+
*
|
|
10667
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10436
10668
|
*/
|
|
10437
|
-
function
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
// if
|
|
10441
|
-
|
|
10442
|
-
// Verify that we will not get into infinite loop.
|
|
10443
|
-
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10444
|
-
return ɵɵinject(token, flags);
|
|
10445
|
-
}
|
|
10446
|
-
const tNode = getCurrentTNode();
|
|
10447
|
-
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10669
|
+
function isHostComponentStandalone(lView) {
|
|
10670
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10671
|
+
const componentDef = getDeclarationComponentDef(lView);
|
|
10672
|
+
// Treat host component as non-standalone if we can't obtain the def.
|
|
10673
|
+
return !!componentDef?.standalone;
|
|
10448
10674
|
}
|
|
10449
10675
|
/**
|
|
10450
|
-
*
|
|
10451
|
-
*
|
|
10452
|
-
*
|
|
10453
|
-
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10454
|
-
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10676
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10677
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10678
|
+
* be too slow for production mode.
|
|
10455
10679
|
*
|
|
10456
|
-
*
|
|
10457
|
-
*
|
|
10680
|
+
* Constructs a string describing the location of the host component template. The function is used
|
|
10681
|
+
* in dev mode to produce error messages.
|
|
10458
10682
|
*
|
|
10459
|
-
* @
|
|
10683
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10460
10684
|
*/
|
|
10461
|
-
function
|
|
10462
|
-
|
|
10463
|
-
|
|
10685
|
+
function getTemplateLocationDetails(lView) {
|
|
10686
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10687
|
+
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
10688
|
+
const componentClassName = hostComponentDef?.type?.name;
|
|
10689
|
+
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
10690
|
+
}
|
|
10691
|
+
/**
|
|
10692
|
+
* The set of known control flow directives.
|
|
10693
|
+
* We use this set to produce a more precises error message with a note
|
|
10694
|
+
* that the `CommonModule` should also be included.
|
|
10695
|
+
*/
|
|
10696
|
+
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
10697
|
+
/**
|
|
10698
|
+
* Returns true if the tag name is allowed by specified schemas.
|
|
10699
|
+
* @param schemas Array of schemas
|
|
10700
|
+
* @param tagName Name of the tag
|
|
10701
|
+
*/
|
|
10702
|
+
function matchingSchemas(schemas, tagName) {
|
|
10703
|
+
if (schemas !== null) {
|
|
10704
|
+
for (let i = 0; i < schemas.length; i++) {
|
|
10705
|
+
const schema = schemas[i];
|
|
10706
|
+
if (schema === NO_ERRORS_SCHEMA ||
|
|
10707
|
+
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
10708
|
+
return true;
|
|
10709
|
+
}
|
|
10710
|
+
}
|
|
10711
|
+
}
|
|
10712
|
+
return false;
|
|
10464
10713
|
}
|
|
10465
10714
|
|
|
10466
10715
|
/**
|
|
@@ -11254,36 +11503,21 @@ class LContainerDebug {
|
|
|
11254
11503
|
}
|
|
11255
11504
|
get parent() {
|
|
11256
11505
|
return toDebug(this._raw_lContainer[PARENT]);
|
|
11257
|
-
}
|
|
11258
|
-
get movedViews() {
|
|
11259
|
-
return this._raw_lContainer[MOVED_VIEWS];
|
|
11260
|
-
}
|
|
11261
|
-
get host() {
|
|
11262
|
-
return this._raw_lContainer[HOST];
|
|
11263
|
-
}
|
|
11264
|
-
get native() {
|
|
11265
|
-
return this._raw_lContainer[NATIVE];
|
|
11266
|
-
}
|
|
11267
|
-
get next() {
|
|
11268
|
-
return toDebug(this._raw_lContainer[NEXT]);
|
|
11269
|
-
}
|
|
11270
|
-
}
|
|
11271
|
-
|
|
11272
|
-
let shouldThrowErrorOnUnknownProperty = false;
|
|
11273
|
-
/**
|
|
11274
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
11275
|
-
* instead of just logging the error.
|
|
11276
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
11277
|
-
*/
|
|
11278
|
-
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
11279
|
-
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
11280
|
-
}
|
|
11281
|
-
/**
|
|
11282
|
-
* Gets the current value of the strict mode.
|
|
11283
|
-
*/
|
|
11284
|
-
function ɵgetUnknownPropertyStrictMode() {
|
|
11285
|
-
return shouldThrowErrorOnUnknownProperty;
|
|
11506
|
+
}
|
|
11507
|
+
get movedViews() {
|
|
11508
|
+
return this._raw_lContainer[MOVED_VIEWS];
|
|
11509
|
+
}
|
|
11510
|
+
get host() {
|
|
11511
|
+
return this._raw_lContainer[HOST];
|
|
11512
|
+
}
|
|
11513
|
+
get native() {
|
|
11514
|
+
return this._raw_lContainer[NATIVE];
|
|
11515
|
+
}
|
|
11516
|
+
get next() {
|
|
11517
|
+
return toDebug(this._raw_lContainer[NEXT]);
|
|
11518
|
+
}
|
|
11286
11519
|
}
|
|
11520
|
+
|
|
11287
11521
|
/**
|
|
11288
11522
|
* A permanent marker promise which signifies that the current CD tree is
|
|
11289
11523
|
* clean.
|
|
@@ -11442,55 +11676,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
|
|
|
11442
11676
|
}
|
|
11443
11677
|
return tNode;
|
|
11444
11678
|
}
|
|
11445
|
-
/**
|
|
11446
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11447
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11448
|
-
* be too slow for production mode and also it relies on the constructor function being available.
|
|
11449
|
-
*
|
|
11450
|
-
* Gets a reference to the host component def (where a current component is declared).
|
|
11451
|
-
*
|
|
11452
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11453
|
-
*/
|
|
11454
|
-
function getDeclarationComponentDef(lView) {
|
|
11455
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11456
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
11457
|
-
const context = declarationLView[CONTEXT];
|
|
11458
|
-
// Unable to obtain a context.
|
|
11459
|
-
if (!context)
|
|
11460
|
-
return null;
|
|
11461
|
-
return context.constructor ? getComponentDef(context.constructor) : null;
|
|
11462
|
-
}
|
|
11463
|
-
/**
|
|
11464
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11465
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11466
|
-
* be too slow for production mode.
|
|
11467
|
-
*
|
|
11468
|
-
* Checks if the current component is declared inside of a standalone component template.
|
|
11469
|
-
*
|
|
11470
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11471
|
-
*/
|
|
11472
|
-
function isHostComponentStandalone(lView) {
|
|
11473
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11474
|
-
const componentDef = getDeclarationComponentDef(lView);
|
|
11475
|
-
// Treat host component as non-standalone if we can't obtain the def.
|
|
11476
|
-
return !!(componentDef?.standalone);
|
|
11477
|
-
}
|
|
11478
|
-
/**
|
|
11479
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11480
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11481
|
-
* be too slow for production mode.
|
|
11482
|
-
*
|
|
11483
|
-
* Constructs a string describing the location of the host component template. The function is used
|
|
11484
|
-
* in dev mode to produce error messages.
|
|
11485
|
-
*
|
|
11486
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11487
|
-
*/
|
|
11488
|
-
function getTemplateLocationDetails(lView) {
|
|
11489
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11490
|
-
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
11491
|
-
const componentClassName = hostComponentDef?.type?.name;
|
|
11492
|
-
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
11493
|
-
}
|
|
11494
11679
|
/**
|
|
11495
11680
|
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
11496
11681
|
* i18nApply()), we need to adjust the blueprint for future
|
|
@@ -12157,10 +12342,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12157
12342
|
propName = mapPropName(propName);
|
|
12158
12343
|
if (ngDevMode) {
|
|
12159
12344
|
validateAgainstEventProperties(propName);
|
|
12160
|
-
if (!
|
|
12161
|
-
|
|
12162
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12163
|
-
return;
|
|
12345
|
+
if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
|
|
12346
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12164
12347
|
}
|
|
12165
12348
|
ngDevMode.rendererSetProperty++;
|
|
12166
12349
|
}
|
|
@@ -12179,7 +12362,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12179
12362
|
// If the node is a container and the property didn't
|
|
12180
12363
|
// match any of the inputs or schemas we should throw.
|
|
12181
12364
|
if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
|
|
12182
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12365
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12183
12366
|
}
|
|
12184
12367
|
}
|
|
12185
12368
|
}
|
|
@@ -12231,116 +12414,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
|
|
|
12231
12414
|
}
|
|
12232
12415
|
}
|
|
12233
12416
|
}
|
|
12234
|
-
/**
|
|
12235
|
-
* Validates that the property of the element is known at runtime and returns
|
|
12236
|
-
* false if it's not the case.
|
|
12237
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
12238
|
-
* ones this check happens at build time).
|
|
12239
|
-
*
|
|
12240
|
-
* The property is considered known if either:
|
|
12241
|
-
* - it's a known property of the element
|
|
12242
|
-
* - the element is allowed by one of the schemas
|
|
12243
|
-
* - the property is used for animations
|
|
12244
|
-
*
|
|
12245
|
-
* @param element Element to validate
|
|
12246
|
-
* @param tagName Name of the tag to check
|
|
12247
|
-
* @param propName Name of the property to check
|
|
12248
|
-
* @param schemas Array of schemas
|
|
12249
|
-
*/
|
|
12250
|
-
function validateProperty(element, tagName, propName, schemas) {
|
|
12251
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
12252
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
12253
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
12254
|
-
// execute the check below.
|
|
12255
|
-
if (schemas === null)
|
|
12256
|
-
return true;
|
|
12257
|
-
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
12258
|
-
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
12259
|
-
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
12260
|
-
return true;
|
|
12261
|
-
}
|
|
12262
|
-
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
12263
|
-
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
12264
|
-
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
12265
|
-
}
|
|
12266
|
-
/**
|
|
12267
|
-
* Returns true if the tag name is allowed by specified schemas.
|
|
12268
|
-
* @param schemas Array of schemas
|
|
12269
|
-
* @param tagName Name of the tag
|
|
12270
|
-
*/
|
|
12271
|
-
function matchingSchemas(schemas, tagName) {
|
|
12272
|
-
if (schemas !== null) {
|
|
12273
|
-
for (let i = 0; i < schemas.length; i++) {
|
|
12274
|
-
const schema = schemas[i];
|
|
12275
|
-
if (schema === NO_ERRORS_SCHEMA ||
|
|
12276
|
-
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
12277
|
-
return true;
|
|
12278
|
-
}
|
|
12279
|
-
}
|
|
12280
|
-
}
|
|
12281
|
-
return false;
|
|
12282
|
-
}
|
|
12283
|
-
/**
|
|
12284
|
-
* The set of known control flow directives.
|
|
12285
|
-
* We use this set to produce a more precises error message with a note
|
|
12286
|
-
* that the `CommonModule` should also be included.
|
|
12287
|
-
*/
|
|
12288
|
-
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
12289
|
-
/**
|
|
12290
|
-
* Logs or throws an error that a property is not supported on an element.
|
|
12291
|
-
*
|
|
12292
|
-
* @param propName Name of the invalid property.
|
|
12293
|
-
* @param tNode A `TNode` that represents a current component that is being rendered.
|
|
12294
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
12295
|
-
*/
|
|
12296
|
-
function handleUnknownPropertyError(propName, tNode, lView) {
|
|
12297
|
-
let tagName = tNode.value;
|
|
12298
|
-
// Special-case a situation when a structural directive is applied to
|
|
12299
|
-
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
12300
|
-
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
12301
|
-
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
12302
|
-
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
12303
|
-
// a default value of the `tNode.value` is not feasible at this moment.
|
|
12304
|
-
if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
|
|
12305
|
-
tagName = 'ng-template';
|
|
12306
|
-
}
|
|
12307
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
12308
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
12309
|
-
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
12310
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
12311
|
-
const importLocation = isHostStandalone ?
|
|
12312
|
-
'included in the \'@Component.imports\' of this component' :
|
|
12313
|
-
'a part of an @NgModule where this component is declared';
|
|
12314
|
-
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
12315
|
-
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
12316
|
-
// a template, but the `CommonModule` is not imported.
|
|
12317
|
-
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
12318
|
-
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
12319
|
-
}
|
|
12320
|
-
else {
|
|
12321
|
-
// May be an Angular component, which is not imported/declared?
|
|
12322
|
-
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
12323
|
-
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
12324
|
-
// May be a Web Component?
|
|
12325
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
12326
|
-
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
12327
|
-
`to the ${schemas} of this component to suppress this message.`;
|
|
12328
|
-
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12329
|
-
`the ${schemas} of this component.`;
|
|
12330
|
-
}
|
|
12331
|
-
else {
|
|
12332
|
-
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
12333
|
-
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12334
|
-
`the ${schemas} of this component.`;
|
|
12335
|
-
}
|
|
12336
|
-
}
|
|
12337
|
-
if (shouldThrowErrorOnUnknownProperty) {
|
|
12338
|
-
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
12339
|
-
}
|
|
12340
|
-
else {
|
|
12341
|
-
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
12342
|
-
}
|
|
12343
|
-
}
|
|
12344
12417
|
/**
|
|
12345
12418
|
* Instantiate a root component.
|
|
12346
12419
|
*/
|
|
@@ -13914,7 +13987,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
13914
13987
|
const component = instantiateRootComponent(tView, rootLView, componentDef);
|
|
13915
13988
|
rootContext.components.push(component);
|
|
13916
13989
|
componentView[CONTEXT] = component;
|
|
13917
|
-
hostFeatures
|
|
13990
|
+
if (hostFeatures !== null) {
|
|
13991
|
+
for (const feature of hostFeatures) {
|
|
13992
|
+
feature(component, componentDef);
|
|
13993
|
+
}
|
|
13994
|
+
}
|
|
13918
13995
|
// We want to generate an empty QueryList for root content queries for backwards
|
|
13919
13996
|
// compatibility with ViewEngine.
|
|
13920
13997
|
if (componentDef.contentQueries) {
|
|
@@ -13955,13 +14032,10 @@ function createRootContext(scheduler, playerHandler) {
|
|
|
13955
14032
|
* renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
|
|
13956
14033
|
* ```
|
|
13957
14034
|
*/
|
|
13958
|
-
function LifecycleHooksFeature(
|
|
13959
|
-
const lView = readPatchedLView(component);
|
|
13960
|
-
ngDevMode && assertDefined(lView, 'LView is required');
|
|
13961
|
-
const tView = lView[TVIEW];
|
|
14035
|
+
function LifecycleHooksFeature() {
|
|
13962
14036
|
const tNode = getCurrentTNode();
|
|
13963
14037
|
ngDevMode && assertDefined(tNode, 'TNode is required');
|
|
13964
|
-
registerPostOrderHooks(
|
|
14038
|
+
registerPostOrderHooks(getLView()[TVIEW], tNode);
|
|
13965
14039
|
}
|
|
13966
14040
|
/**
|
|
13967
14041
|
* Wait on component until it is rendered.
|
|
@@ -15096,21 +15170,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
|
|
|
15096
15170
|
* Use of this source code is governed by an MIT-style license that can be
|
|
15097
15171
|
* found in the LICENSE file at https://angular.io/license
|
|
15098
15172
|
*/
|
|
15099
|
-
let shouldThrowErrorOnUnknownElement = false;
|
|
15100
|
-
/**
|
|
15101
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
15102
|
-
* instead of just logging the error.
|
|
15103
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
15104
|
-
*/
|
|
15105
|
-
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
15106
|
-
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
15107
|
-
}
|
|
15108
|
-
/**
|
|
15109
|
-
* Gets the current value of the strict mode.
|
|
15110
|
-
*/
|
|
15111
|
-
function ɵgetUnknownElementStrictMode() {
|
|
15112
|
-
return shouldThrowErrorOnUnknownElement;
|
|
15113
|
-
}
|
|
15114
15173
|
function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
|
|
15115
15174
|
ngDevMode && assertFirstCreatePass(tView);
|
|
15116
15175
|
ngDevMode && ngDevMode.firstCreatePass++;
|
|
@@ -15244,67 +15303,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
15244
15303
|
ɵɵelementEnd();
|
|
15245
15304
|
return ɵɵelement;
|
|
15246
15305
|
}
|
|
15247
|
-
/**
|
|
15248
|
-
* Validates that the element is known at runtime and produces
|
|
15249
|
-
* an error if it's not the case.
|
|
15250
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
15251
|
-
* ones this check happens at build time).
|
|
15252
|
-
*
|
|
15253
|
-
* The element is considered known if either:
|
|
15254
|
-
* - it's a known HTML element
|
|
15255
|
-
* - it's a known custom element
|
|
15256
|
-
* - the element matches any directive
|
|
15257
|
-
* - the element is allowed by one of the schemas
|
|
15258
|
-
*
|
|
15259
|
-
* @param element Element to validate
|
|
15260
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
15261
|
-
* @param tagName Name of the tag to check
|
|
15262
|
-
* @param schemas Array of schemas
|
|
15263
|
-
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
15264
|
-
*/
|
|
15265
|
-
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
15266
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
15267
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
15268
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
15269
|
-
// execute the check below.
|
|
15270
|
-
if (schemas === null)
|
|
15271
|
-
return;
|
|
15272
|
-
// If the element matches any directive, it's considered as valid.
|
|
15273
|
-
if (!hasDirectives && tagName !== null) {
|
|
15274
|
-
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
15275
|
-
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
15276
|
-
// of HTMLUnknownElement in browsers that support web components.
|
|
15277
|
-
const isUnknown =
|
|
15278
|
-
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
15279
|
-
// because while most browsers return 'function', IE returns 'object'.
|
|
15280
|
-
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
15281
|
-
element instanceof HTMLUnknownElement) ||
|
|
15282
|
-
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
15283
|
-
!customElements.get(tagName));
|
|
15284
|
-
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
15285
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
15286
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
15287
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
15288
|
-
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
15289
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
15290
|
-
'a part of an @NgModule where this component is declared'}.\n`;
|
|
15291
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
15292
|
-
message +=
|
|
15293
|
-
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
15294
|
-
}
|
|
15295
|
-
else {
|
|
15296
|
-
message +=
|
|
15297
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
15298
|
-
}
|
|
15299
|
-
if (shouldThrowErrorOnUnknownElement) {
|
|
15300
|
-
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
15301
|
-
}
|
|
15302
|
-
else {
|
|
15303
|
-
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
15304
|
-
}
|
|
15305
|
-
}
|
|
15306
|
-
}
|
|
15307
|
-
}
|
|
15308
15306
|
|
|
15309
15307
|
/**
|
|
15310
15308
|
* @license
|
|
@@ -21787,7 +21785,7 @@ class Version {
|
|
|
21787
21785
|
/**
|
|
21788
21786
|
* @publicApi
|
|
21789
21787
|
*/
|
|
21790
|
-
const VERSION = new Version('14.0.
|
|
21788
|
+
const VERSION = new Version('14.0.1');
|
|
21791
21789
|
|
|
21792
21790
|
/**
|
|
21793
21791
|
* @license
|
|
@@ -22487,14 +22485,14 @@ class StandaloneService {
|
|
|
22487
22485
|
if (!componentDef.standalone) {
|
|
22488
22486
|
return null;
|
|
22489
22487
|
}
|
|
22490
|
-
if (!this.cachedInjectors.has(componentDef)) {
|
|
22488
|
+
if (!this.cachedInjectors.has(componentDef.id)) {
|
|
22491
22489
|
const providers = internalImportProvidersFrom(false, componentDef.type);
|
|
22492
22490
|
const standaloneInjector = providers.length > 0 ?
|
|
22493
22491
|
createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
|
|
22494
22492
|
null;
|
|
22495
|
-
this.cachedInjectors.set(componentDef, standaloneInjector);
|
|
22493
|
+
this.cachedInjectors.set(componentDef.id, standaloneInjector);
|
|
22496
22494
|
}
|
|
22497
|
-
return this.cachedInjectors.get(componentDef);
|
|
22495
|
+
return this.cachedInjectors.get(componentDef.id);
|
|
22498
22496
|
}
|
|
22499
22497
|
ngOnDestroy() {
|
|
22500
22498
|
try {
|
|
@@ -22994,13 +22992,26 @@ function getPipeDef(name, registry) {
|
|
|
22994
22992
|
}
|
|
22995
22993
|
}
|
|
22996
22994
|
if (ngDevMode) {
|
|
22997
|
-
|
|
22998
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
22999
|
-
const context = declarationLView[CONTEXT];
|
|
23000
|
-
const component = context ? ` in the '${context.constructor.name}' component` : '';
|
|
23001
|
-
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
|
|
22995
|
+
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
|
|
23002
22996
|
}
|
|
23003
22997
|
}
|
|
22998
|
+
/**
|
|
22999
|
+
* Generates a helpful error message for the user when a pipe is not found.
|
|
23000
|
+
*
|
|
23001
|
+
* @param name Name of the missing pipe
|
|
23002
|
+
* @returns The error message
|
|
23003
|
+
*/
|
|
23004
|
+
function getPipeNotFoundErrorMessage(name) {
|
|
23005
|
+
const lView = getLView();
|
|
23006
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
23007
|
+
const context = declarationLView[CONTEXT];
|
|
23008
|
+
const hostIsStandalone = isHostComponentStandalone(lView);
|
|
23009
|
+
const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
|
|
23010
|
+
const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
23011
|
+
'declared or imported in this module'}`;
|
|
23012
|
+
const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
|
|
23013
|
+
return errorMessage;
|
|
23014
|
+
}
|
|
23004
23015
|
/**
|
|
23005
23016
|
* Invokes a pipe with 1 arguments.
|
|
23006
23017
|
*
|
|
@@ -24844,7 +24855,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
|
|
24844
24855
|
}
|
|
24845
24856
|
/**
|
|
24846
24857
|
* Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
|
|
24847
|
-
* (
|
|
24858
|
+
* (either a NgModule or a standalone component / directive / pipe).
|
|
24848
24859
|
*/
|
|
24849
24860
|
function transitiveScopesFor(type) {
|
|
24850
24861
|
if (isNgModule(type)) {
|