@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/testing.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
|
*/
|
|
@@ -1842,9 +1842,12 @@ function formatRuntimeError(code, message) {
|
|
|
1842
1842
|
// Error code might be a negative number, which is a special marker that instructs the logic to
|
|
1843
1843
|
// generate a link to the error details page on angular.io.
|
|
1844
1844
|
const fullCode = `NG0${Math.abs(code)}`;
|
|
1845
|
-
let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
|
|
1845
|
+
let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
|
|
1846
1846
|
if (ngDevMode && code < 0) {
|
|
1847
|
-
|
|
1847
|
+
const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
|
|
1848
|
+
const separator = addPeriodSeparator ? '.' : '';
|
|
1849
|
+
errorMessage =
|
|
1850
|
+
`${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
|
|
1848
1851
|
}
|
|
1849
1852
|
return errorMessage;
|
|
1850
1853
|
}
|
|
@@ -2470,7 +2473,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
|
|
|
2470
2473
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2471
2474
|
* found in the LICENSE file at https://angular.io/license
|
|
2472
2475
|
*/
|
|
2473
|
-
|
|
2476
|
+
/** Counter used to generate unique IDs for component definitions. */
|
|
2477
|
+
let componentDefCount = 0;
|
|
2474
2478
|
/**
|
|
2475
2479
|
* Create a component definition object.
|
|
2476
2480
|
*
|
|
@@ -2523,7 +2527,7 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2523
2527
|
features: componentDefinition.features || null,
|
|
2524
2528
|
data: componentDefinition.data || {},
|
|
2525
2529
|
encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
|
|
2526
|
-
id:
|
|
2530
|
+
id: `c${componentDefCount++}`,
|
|
2527
2531
|
styles: componentDefinition.styles || EMPTY_ARRAY,
|
|
2528
2532
|
_: null,
|
|
2529
2533
|
setInput: null,
|
|
@@ -2532,7 +2536,6 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2532
2536
|
};
|
|
2533
2537
|
const dependencies = componentDefinition.dependencies;
|
|
2534
2538
|
const feature = componentDefinition.features;
|
|
2535
|
-
def.id += _renderCompCount++;
|
|
2536
2539
|
def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
|
|
2537
2540
|
def.outputs = invertObject(componentDefinition.outputs),
|
|
2538
2541
|
feature && feature.forEach((fn) => fn(def));
|
|
@@ -3546,7 +3549,6 @@ function getLView() {
|
|
|
3546
3549
|
function getTView() {
|
|
3547
3550
|
return instructionState.lFrame.tView;
|
|
3548
3551
|
}
|
|
3549
|
-
// TODO(crisbeto): revert the @noinline once Closure issue is resolved.
|
|
3550
3552
|
/**
|
|
3551
3553
|
* Restores `contextViewData` to the given OpaqueViewState instance.
|
|
3552
3554
|
*
|
|
@@ -3558,7 +3560,6 @@ function getTView() {
|
|
|
3558
3560
|
* @returns Context of the restored OpaqueViewState instance.
|
|
3559
3561
|
*
|
|
3560
3562
|
* @codeGenApi
|
|
3561
|
-
* @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
|
|
3562
3563
|
*/
|
|
3563
3564
|
function ɵɵrestoreView(viewToRestore) {
|
|
3564
3565
|
instructionState.lFrame.contextLView = viewToRestore;
|
|
@@ -6623,6 +6624,155 @@ function getSanitizer() {
|
|
|
6623
6624
|
return lView && lView[SANITIZER];
|
|
6624
6625
|
}
|
|
6625
6626
|
|
|
6627
|
+
/**
|
|
6628
|
+
* @license
|
|
6629
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6630
|
+
*
|
|
6631
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6632
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6633
|
+
*/
|
|
6634
|
+
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
6635
|
+
function wrappedError(message, originalError) {
|
|
6636
|
+
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
6637
|
+
const error = Error(msg);
|
|
6638
|
+
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
6639
|
+
return error;
|
|
6640
|
+
}
|
|
6641
|
+
function getOriginalError(error) {
|
|
6642
|
+
return error[ERROR_ORIGINAL_ERROR];
|
|
6643
|
+
}
|
|
6644
|
+
|
|
6645
|
+
/**
|
|
6646
|
+
* @license
|
|
6647
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6648
|
+
*
|
|
6649
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6650
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6651
|
+
*/
|
|
6652
|
+
/**
|
|
6653
|
+
* Provides a hook for centralized exception handling.
|
|
6654
|
+
*
|
|
6655
|
+
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
6656
|
+
* intercept error handling, write a custom exception handler that replaces this default as
|
|
6657
|
+
* appropriate for your app.
|
|
6658
|
+
*
|
|
6659
|
+
* @usageNotes
|
|
6660
|
+
* ### Example
|
|
6661
|
+
*
|
|
6662
|
+
* ```
|
|
6663
|
+
* class MyErrorHandler implements ErrorHandler {
|
|
6664
|
+
* handleError(error) {
|
|
6665
|
+
* // do something with the exception
|
|
6666
|
+
* }
|
|
6667
|
+
* }
|
|
6668
|
+
*
|
|
6669
|
+
* @NgModule({
|
|
6670
|
+
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
6671
|
+
* })
|
|
6672
|
+
* class MyModule {}
|
|
6673
|
+
* ```
|
|
6674
|
+
*
|
|
6675
|
+
* @publicApi
|
|
6676
|
+
*/
|
|
6677
|
+
class ErrorHandler {
|
|
6678
|
+
constructor() {
|
|
6679
|
+
/**
|
|
6680
|
+
* @internal
|
|
6681
|
+
*/
|
|
6682
|
+
this._console = console;
|
|
6683
|
+
}
|
|
6684
|
+
handleError(error) {
|
|
6685
|
+
const originalError = this._findOriginalError(error);
|
|
6686
|
+
this._console.error('ERROR', error);
|
|
6687
|
+
if (originalError) {
|
|
6688
|
+
this._console.error('ORIGINAL ERROR', originalError);
|
|
6689
|
+
}
|
|
6690
|
+
}
|
|
6691
|
+
/** @internal */
|
|
6692
|
+
_findOriginalError(error) {
|
|
6693
|
+
let e = error && getOriginalError(error);
|
|
6694
|
+
while (e && getOriginalError(e)) {
|
|
6695
|
+
e = getOriginalError(e);
|
|
6696
|
+
}
|
|
6697
|
+
return e || null;
|
|
6698
|
+
}
|
|
6699
|
+
}
|
|
6700
|
+
|
|
6701
|
+
/**
|
|
6702
|
+
* @license
|
|
6703
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6704
|
+
*
|
|
6705
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6706
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6707
|
+
*/
|
|
6708
|
+
/**
|
|
6709
|
+
* Disallowed strings in the comment.
|
|
6710
|
+
*
|
|
6711
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6712
|
+
*/
|
|
6713
|
+
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
6714
|
+
/**
|
|
6715
|
+
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
6716
|
+
*/
|
|
6717
|
+
const COMMENT_DELIMITER = /(<|>)/;
|
|
6718
|
+
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
6719
|
+
/**
|
|
6720
|
+
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
6721
|
+
*
|
|
6722
|
+
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
6723
|
+
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
6724
|
+
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
6725
|
+
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
6726
|
+
*
|
|
6727
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6728
|
+
*
|
|
6729
|
+
* ```
|
|
6730
|
+
* div.innerHTML = div.innerHTML
|
|
6731
|
+
* ```
|
|
6732
|
+
*
|
|
6733
|
+
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
6734
|
+
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
6735
|
+
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
6736
|
+
* may contain such text and expect them to be safe.)
|
|
6737
|
+
*
|
|
6738
|
+
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
6739
|
+
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
6740
|
+
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
6741
|
+
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
6742
|
+
*
|
|
6743
|
+
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
6744
|
+
* sequence.
|
|
6745
|
+
*/
|
|
6746
|
+
function escapeCommentText(value) {
|
|
6747
|
+
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
6748
|
+
}
|
|
6749
|
+
|
|
6750
|
+
/**
|
|
6751
|
+
* @license
|
|
6752
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6753
|
+
*
|
|
6754
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6755
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6756
|
+
*/
|
|
6757
|
+
function normalizeDebugBindingName(name) {
|
|
6758
|
+
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
6759
|
+
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
6760
|
+
return `ng-reflect-${name}`;
|
|
6761
|
+
}
|
|
6762
|
+
const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
|
6763
|
+
function camelCaseToDashCase(input) {
|
|
6764
|
+
return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
|
6765
|
+
}
|
|
6766
|
+
function normalizeDebugBindingValue(value) {
|
|
6767
|
+
try {
|
|
6768
|
+
// Limit the size of the value as otherwise the DOM just gets polluted.
|
|
6769
|
+
return value != null ? value.toString().slice(0, 30) : value;
|
|
6770
|
+
}
|
|
6771
|
+
catch (e) {
|
|
6772
|
+
return '[ERROR] Exception while trying to serialize the value';
|
|
6773
|
+
}
|
|
6774
|
+
}
|
|
6775
|
+
|
|
6626
6776
|
/**
|
|
6627
6777
|
* @license
|
|
6628
6778
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6971,223 +7121,33 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
|
|
6971
7121
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6972
7122
|
let directiveStartIndex = tNode.directiveStart;
|
|
6973
7123
|
if (directiveStartIndex == 0)
|
|
6974
|
-
return EMPTY_ARRAY;
|
|
6975
|
-
const directiveEndIndex = tNode.directiveEnd;
|
|
6976
|
-
if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
6977
|
-
directiveStartIndex++;
|
|
6978
|
-
return lView.slice(directiveStartIndex, directiveEndIndex);
|
|
6979
|
-
}
|
|
6980
|
-
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
6981
|
-
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6982
|
-
let directiveStartIndex = tNode.directiveStart;
|
|
6983
|
-
return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
|
|
6984
|
-
}
|
|
6985
|
-
/**
|
|
6986
|
-
* Returns a map of local references (local reference name => element or directive instance) that
|
|
6987
|
-
* exist on a given element.
|
|
6988
|
-
*/
|
|
6989
|
-
function discoverLocalRefs(lView, nodeIndex) {
|
|
6990
|
-
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6991
|
-
if (tNode && tNode.localNames) {
|
|
6992
|
-
const result = {};
|
|
6993
|
-
let localIndex = tNode.index + 1;
|
|
6994
|
-
for (let i = 0; i < tNode.localNames.length; i += 2) {
|
|
6995
|
-
result[tNode.localNames[i]] = lView[localIndex];
|
|
6996
|
-
localIndex++;
|
|
6997
|
-
}
|
|
6998
|
-
return result;
|
|
6999
|
-
}
|
|
7000
|
-
return null;
|
|
7001
|
-
}
|
|
7002
|
-
|
|
7003
|
-
/**
|
|
7004
|
-
* @license
|
|
7005
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7006
|
-
*
|
|
7007
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7008
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7009
|
-
*/
|
|
7010
|
-
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
7011
|
-
const ERROR_LOGGER = 'ngErrorLogger';
|
|
7012
|
-
function wrappedError(message, originalError) {
|
|
7013
|
-
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
7014
|
-
const error = Error(msg);
|
|
7015
|
-
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
7016
|
-
return error;
|
|
7017
|
-
}
|
|
7018
|
-
function getOriginalError(error) {
|
|
7019
|
-
return error[ERROR_ORIGINAL_ERROR];
|
|
7020
|
-
}
|
|
7021
|
-
function getErrorLogger(error) {
|
|
7022
|
-
return error && error[ERROR_LOGGER] || defaultErrorLogger;
|
|
7023
|
-
}
|
|
7024
|
-
function defaultErrorLogger(console, ...values) {
|
|
7025
|
-
console.error(...values);
|
|
7026
|
-
}
|
|
7027
|
-
|
|
7028
|
-
/**
|
|
7029
|
-
* @license
|
|
7030
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7031
|
-
*
|
|
7032
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7033
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7034
|
-
*/
|
|
7035
|
-
/**
|
|
7036
|
-
* Provides a hook for centralized exception handling.
|
|
7037
|
-
*
|
|
7038
|
-
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
7039
|
-
* intercept error handling, write a custom exception handler that replaces this default as
|
|
7040
|
-
* appropriate for your app.
|
|
7041
|
-
*
|
|
7042
|
-
* @usageNotes
|
|
7043
|
-
* ### Example
|
|
7044
|
-
*
|
|
7045
|
-
* ```
|
|
7046
|
-
* class MyErrorHandler implements ErrorHandler {
|
|
7047
|
-
* handleError(error) {
|
|
7048
|
-
* // do something with the exception
|
|
7049
|
-
* }
|
|
7050
|
-
* }
|
|
7051
|
-
*
|
|
7052
|
-
* @NgModule({
|
|
7053
|
-
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
7054
|
-
* })
|
|
7055
|
-
* class MyModule {}
|
|
7056
|
-
* ```
|
|
7057
|
-
*
|
|
7058
|
-
* @publicApi
|
|
7059
|
-
*/
|
|
7060
|
-
class ErrorHandler {
|
|
7061
|
-
constructor() {
|
|
7062
|
-
/**
|
|
7063
|
-
* @internal
|
|
7064
|
-
*/
|
|
7065
|
-
this._console = console;
|
|
7066
|
-
}
|
|
7067
|
-
handleError(error) {
|
|
7068
|
-
const originalError = this._findOriginalError(error);
|
|
7069
|
-
// Note: Browser consoles show the place from where console.error was called.
|
|
7070
|
-
// We can use this to give users additional information about the error.
|
|
7071
|
-
const errorLogger = getErrorLogger(error);
|
|
7072
|
-
errorLogger(this._console, `ERROR`, error);
|
|
7073
|
-
if (originalError) {
|
|
7074
|
-
errorLogger(this._console, `ORIGINAL ERROR`, originalError);
|
|
7075
|
-
}
|
|
7076
|
-
}
|
|
7077
|
-
/** @internal */
|
|
7078
|
-
_findOriginalError(error) {
|
|
7079
|
-
let e = error && getOriginalError(error);
|
|
7080
|
-
while (e && getOriginalError(e)) {
|
|
7081
|
-
e = getOriginalError(e);
|
|
7082
|
-
}
|
|
7083
|
-
return e || null;
|
|
7084
|
-
}
|
|
7085
|
-
}
|
|
7086
|
-
|
|
7087
|
-
/**
|
|
7088
|
-
* @license
|
|
7089
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7090
|
-
*
|
|
7091
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7092
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7093
|
-
*/
|
|
7094
|
-
/**
|
|
7095
|
-
* Defines a schema that allows an NgModule to contain the following:
|
|
7096
|
-
* - Non-Angular elements named with dash case (`-`).
|
|
7097
|
-
* - Element properties named with dash case (`-`).
|
|
7098
|
-
* Dash case is the naming convention for custom elements.
|
|
7099
|
-
*
|
|
7100
|
-
* @publicApi
|
|
7101
|
-
*/
|
|
7102
|
-
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
7103
|
-
name: 'custom-elements'
|
|
7104
|
-
};
|
|
7105
|
-
/**
|
|
7106
|
-
* Defines a schema that allows any property on any element.
|
|
7107
|
-
*
|
|
7108
|
-
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
7109
|
-
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
7110
|
-
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
7111
|
-
*
|
|
7112
|
-
* @publicApi
|
|
7113
|
-
*/
|
|
7114
|
-
const NO_ERRORS_SCHEMA = {
|
|
7115
|
-
name: 'no-errors-schema'
|
|
7116
|
-
};
|
|
7117
|
-
|
|
7118
|
-
/**
|
|
7119
|
-
* @license
|
|
7120
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7121
|
-
*
|
|
7122
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7123
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7124
|
-
*/
|
|
7125
|
-
/**
|
|
7126
|
-
* Disallowed strings in the comment.
|
|
7127
|
-
*
|
|
7128
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
7129
|
-
*/
|
|
7130
|
-
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
7131
|
-
/**
|
|
7132
|
-
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
7133
|
-
*/
|
|
7134
|
-
const COMMENT_DELIMITER = /(<|>)/;
|
|
7135
|
-
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
7136
|
-
/**
|
|
7137
|
-
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
7138
|
-
*
|
|
7139
|
-
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
7140
|
-
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
7141
|
-
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
7142
|
-
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
7143
|
-
*
|
|
7144
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
7145
|
-
*
|
|
7146
|
-
* ```
|
|
7147
|
-
* div.innerHTML = div.innerHTML
|
|
7148
|
-
* ```
|
|
7149
|
-
*
|
|
7150
|
-
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
7151
|
-
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
7152
|
-
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
7153
|
-
* may contain such text and expect them to be safe.)
|
|
7154
|
-
*
|
|
7155
|
-
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
7156
|
-
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
7157
|
-
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
7158
|
-
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
7159
|
-
*
|
|
7160
|
-
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
7161
|
-
* sequence.
|
|
7162
|
-
*/
|
|
7163
|
-
function escapeCommentText(value) {
|
|
7164
|
-
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
7165
|
-
}
|
|
7166
|
-
|
|
7167
|
-
/**
|
|
7168
|
-
* @license
|
|
7169
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7170
|
-
*
|
|
7171
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7172
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7173
|
-
*/
|
|
7174
|
-
function normalizeDebugBindingName(name) {
|
|
7175
|
-
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
7176
|
-
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
7177
|
-
return `ng-reflect-${name}`;
|
|
7124
|
+
return EMPTY_ARRAY;
|
|
7125
|
+
const directiveEndIndex = tNode.directiveEnd;
|
|
7126
|
+
if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
7127
|
+
directiveStartIndex++;
|
|
7128
|
+
return lView.slice(directiveStartIndex, directiveEndIndex);
|
|
7178
7129
|
}
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7130
|
+
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
7131
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
7132
|
+
let directiveStartIndex = tNode.directiveStart;
|
|
7133
|
+
return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
|
|
7182
7134
|
}
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7135
|
+
/**
|
|
7136
|
+
* Returns a map of local references (local reference name => element or directive instance) that
|
|
7137
|
+
* exist on a given element.
|
|
7138
|
+
*/
|
|
7139
|
+
function discoverLocalRefs(lView, nodeIndex) {
|
|
7140
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
7141
|
+
if (tNode && tNode.localNames) {
|
|
7142
|
+
const result = {};
|
|
7143
|
+
let localIndex = tNode.index + 1;
|
|
7144
|
+
for (let i = 0; i < tNode.localNames.length; i += 2) {
|
|
7145
|
+
result[tNode.localNames[i]] = lView[localIndex];
|
|
7146
|
+
localIndex++;
|
|
7147
|
+
}
|
|
7148
|
+
return result;
|
|
7190
7149
|
}
|
|
7150
|
+
return null;
|
|
7191
7151
|
}
|
|
7192
7152
|
|
|
7193
7153
|
/**
|
|
@@ -10654,113 +10614,402 @@ class ReflectiveInjector_ {
|
|
|
10654
10614
|
return this.objs[i];
|
|
10655
10615
|
}
|
|
10656
10616
|
}
|
|
10657
|
-
return UNDEFINED;
|
|
10617
|
+
return UNDEFINED;
|
|
10618
|
+
}
|
|
10619
|
+
/** @internal */
|
|
10620
|
+
_throwOrNull(key, notFoundValue) {
|
|
10621
|
+
if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
|
10622
|
+
return notFoundValue;
|
|
10623
|
+
}
|
|
10624
|
+
else {
|
|
10625
|
+
throw noProviderError(this, key);
|
|
10626
|
+
}
|
|
10627
|
+
}
|
|
10628
|
+
/** @internal */
|
|
10629
|
+
_getByKeySelf(key, notFoundValue) {
|
|
10630
|
+
const obj = this._getObjByKeyId(key.id);
|
|
10631
|
+
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
|
10632
|
+
}
|
|
10633
|
+
/** @internal */
|
|
10634
|
+
_getByKeyDefault(key, notFoundValue, visibility) {
|
|
10635
|
+
let inj;
|
|
10636
|
+
if (visibility instanceof SkipSelf) {
|
|
10637
|
+
inj = this.parent;
|
|
10638
|
+
}
|
|
10639
|
+
else {
|
|
10640
|
+
inj = this;
|
|
10641
|
+
}
|
|
10642
|
+
while (inj instanceof ReflectiveInjector_) {
|
|
10643
|
+
const inj_ = inj;
|
|
10644
|
+
const obj = inj_._getObjByKeyId(key.id);
|
|
10645
|
+
if (obj !== UNDEFINED)
|
|
10646
|
+
return obj;
|
|
10647
|
+
inj = inj_.parent;
|
|
10648
|
+
}
|
|
10649
|
+
if (inj !== null) {
|
|
10650
|
+
return inj.get(key.token, notFoundValue);
|
|
10651
|
+
}
|
|
10652
|
+
else {
|
|
10653
|
+
return this._throwOrNull(key, notFoundValue);
|
|
10654
|
+
}
|
|
10655
|
+
}
|
|
10656
|
+
get displayName() {
|
|
10657
|
+
const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
|
|
10658
|
+
.join(', ');
|
|
10659
|
+
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10660
|
+
}
|
|
10661
|
+
toString() {
|
|
10662
|
+
return this.displayName;
|
|
10663
|
+
}
|
|
10664
|
+
}
|
|
10665
|
+
ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
|
|
10666
|
+
function _mapProviders(injector, fn) {
|
|
10667
|
+
const res = [];
|
|
10668
|
+
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10669
|
+
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10670
|
+
}
|
|
10671
|
+
return res;
|
|
10672
|
+
}
|
|
10673
|
+
|
|
10674
|
+
/**
|
|
10675
|
+
* @license
|
|
10676
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10677
|
+
*
|
|
10678
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10679
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10680
|
+
*/
|
|
10681
|
+
|
|
10682
|
+
/**
|
|
10683
|
+
* @license
|
|
10684
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10685
|
+
*
|
|
10686
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10687
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10688
|
+
*/
|
|
10689
|
+
|
|
10690
|
+
/**
|
|
10691
|
+
* @license
|
|
10692
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10693
|
+
*
|
|
10694
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10695
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10696
|
+
*/
|
|
10697
|
+
function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
|
10698
|
+
const lView = getLView();
|
|
10699
|
+
// Fall back to inject() if view hasn't been created. This situation can happen in tests
|
|
10700
|
+
// if inject utilities are used before bootstrapping.
|
|
10701
|
+
if (lView === null) {
|
|
10702
|
+
// Verify that we will not get into infinite loop.
|
|
10703
|
+
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10704
|
+
return ɵɵinject(token, flags);
|
|
10705
|
+
}
|
|
10706
|
+
const tNode = getCurrentTNode();
|
|
10707
|
+
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10708
|
+
}
|
|
10709
|
+
/**
|
|
10710
|
+
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
10711
|
+
* particular class.
|
|
10712
|
+
*
|
|
10713
|
+
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10714
|
+
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10715
|
+
*
|
|
10716
|
+
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
10717
|
+
* and thus in the stack trace.
|
|
10718
|
+
*
|
|
10719
|
+
* @codeGenApi
|
|
10720
|
+
*/
|
|
10721
|
+
function ɵɵinvalidFactory() {
|
|
10722
|
+
const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
|
|
10723
|
+
throw new Error(msg);
|
|
10724
|
+
}
|
|
10725
|
+
|
|
10726
|
+
/**
|
|
10727
|
+
* @license
|
|
10728
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10729
|
+
*
|
|
10730
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10731
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10732
|
+
*/
|
|
10733
|
+
/**
|
|
10734
|
+
* Defines a schema that allows an NgModule to contain the following:
|
|
10735
|
+
* - Non-Angular elements named with dash case (`-`).
|
|
10736
|
+
* - Element properties named with dash case (`-`).
|
|
10737
|
+
* Dash case is the naming convention for custom elements.
|
|
10738
|
+
*
|
|
10739
|
+
* @publicApi
|
|
10740
|
+
*/
|
|
10741
|
+
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
10742
|
+
name: 'custom-elements'
|
|
10743
|
+
};
|
|
10744
|
+
/**
|
|
10745
|
+
* Defines a schema that allows any property on any element.
|
|
10746
|
+
*
|
|
10747
|
+
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
10748
|
+
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
10749
|
+
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
10750
|
+
*
|
|
10751
|
+
* @publicApi
|
|
10752
|
+
*/
|
|
10753
|
+
const NO_ERRORS_SCHEMA = {
|
|
10754
|
+
name: 'no-errors-schema'
|
|
10755
|
+
};
|
|
10756
|
+
|
|
10757
|
+
/**
|
|
10758
|
+
* @license
|
|
10759
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10760
|
+
*
|
|
10761
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10762
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10763
|
+
*/
|
|
10764
|
+
let shouldThrowErrorOnUnknownElement = false;
|
|
10765
|
+
/**
|
|
10766
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
10767
|
+
* instead of just logging the error.
|
|
10768
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10769
|
+
*/
|
|
10770
|
+
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
10771
|
+
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
10772
|
+
}
|
|
10773
|
+
/**
|
|
10774
|
+
* Gets the current value of the strict mode.
|
|
10775
|
+
*/
|
|
10776
|
+
function ɵgetUnknownElementStrictMode() {
|
|
10777
|
+
return shouldThrowErrorOnUnknownElement;
|
|
10778
|
+
}
|
|
10779
|
+
let shouldThrowErrorOnUnknownProperty = false;
|
|
10780
|
+
/**
|
|
10781
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
10782
|
+
* instead of just logging the error.
|
|
10783
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10784
|
+
*/
|
|
10785
|
+
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
10786
|
+
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
10787
|
+
}
|
|
10788
|
+
/**
|
|
10789
|
+
* Gets the current value of the strict mode.
|
|
10790
|
+
*/
|
|
10791
|
+
function ɵgetUnknownPropertyStrictMode() {
|
|
10792
|
+
return shouldThrowErrorOnUnknownProperty;
|
|
10793
|
+
}
|
|
10794
|
+
/**
|
|
10795
|
+
* Validates that the element is known at runtime and produces
|
|
10796
|
+
* an error if it's not the case.
|
|
10797
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10798
|
+
* ones this check happens at build time).
|
|
10799
|
+
*
|
|
10800
|
+
* The element is considered known if either:
|
|
10801
|
+
* - it's a known HTML element
|
|
10802
|
+
* - it's a known custom element
|
|
10803
|
+
* - the element matches any directive
|
|
10804
|
+
* - the element is allowed by one of the schemas
|
|
10805
|
+
*
|
|
10806
|
+
* @param element Element to validate
|
|
10807
|
+
* @param lView An `LView` that represents a current component that is being rendered
|
|
10808
|
+
* @param tagName Name of the tag to check
|
|
10809
|
+
* @param schemas Array of schemas
|
|
10810
|
+
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
10811
|
+
*/
|
|
10812
|
+
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
10813
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10814
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10815
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10816
|
+
// execute the check below.
|
|
10817
|
+
if (schemas === null)
|
|
10818
|
+
return;
|
|
10819
|
+
// If the element matches any directive, it's considered as valid.
|
|
10820
|
+
if (!hasDirectives && tagName !== null) {
|
|
10821
|
+
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
10822
|
+
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
10823
|
+
// of HTMLUnknownElement in browsers that support web components.
|
|
10824
|
+
const isUnknown =
|
|
10825
|
+
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
10826
|
+
// because while most browsers return 'function', IE returns 'object'.
|
|
10827
|
+
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
10828
|
+
element instanceof HTMLUnknownElement) ||
|
|
10829
|
+
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
10830
|
+
!customElements.get(tagName));
|
|
10831
|
+
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
10832
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10833
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10834
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10835
|
+
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
10836
|
+
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
10837
|
+
'a part of an @NgModule where this component is declared'}.\n`;
|
|
10838
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10839
|
+
message +=
|
|
10840
|
+
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
10841
|
+
}
|
|
10842
|
+
else {
|
|
10843
|
+
message +=
|
|
10844
|
+
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
10845
|
+
}
|
|
10846
|
+
if (shouldThrowErrorOnUnknownElement) {
|
|
10847
|
+
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
10848
|
+
}
|
|
10849
|
+
else {
|
|
10850
|
+
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
10851
|
+
}
|
|
10852
|
+
}
|
|
10658
10853
|
}
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10854
|
+
}
|
|
10855
|
+
/**
|
|
10856
|
+
* Validates that the property of the element is known at runtime and returns
|
|
10857
|
+
* false if it's not the case.
|
|
10858
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10859
|
+
* ones this check happens at build time).
|
|
10860
|
+
*
|
|
10861
|
+
* The property is considered known if either:
|
|
10862
|
+
* - it's a known property of the element
|
|
10863
|
+
* - the element is allowed by one of the schemas
|
|
10864
|
+
* - the property is used for animations
|
|
10865
|
+
*
|
|
10866
|
+
* @param element Element to validate
|
|
10867
|
+
* @param propName Name of the property to check
|
|
10868
|
+
* @param tagName Name of the tag hosting the property
|
|
10869
|
+
* @param schemas Array of schemas
|
|
10870
|
+
*/
|
|
10871
|
+
function isPropertyValid(element, propName, tagName, schemas) {
|
|
10872
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10873
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10874
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10875
|
+
// execute the check below.
|
|
10876
|
+
if (schemas === null)
|
|
10877
|
+
return true;
|
|
10878
|
+
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
10879
|
+
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
10880
|
+
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
10881
|
+
return true;
|
|
10667
10882
|
}
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10883
|
+
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
10884
|
+
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
10885
|
+
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
10886
|
+
}
|
|
10887
|
+
/**
|
|
10888
|
+
* Logs or throws an error that a property is not supported on an element.
|
|
10889
|
+
*
|
|
10890
|
+
* @param propName Name of the invalid property
|
|
10891
|
+
* @param tagName Name of the tag hosting the property
|
|
10892
|
+
* @param nodeType Type of the node hosting the property
|
|
10893
|
+
* @param lView An `LView` that represents a current component
|
|
10894
|
+
*/
|
|
10895
|
+
function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
|
|
10896
|
+
// Special-case a situation when a structural directive is applied to
|
|
10897
|
+
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
10898
|
+
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
10899
|
+
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
10900
|
+
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
10901
|
+
// a default value of the `tNode.value` is not feasible at this moment.
|
|
10902
|
+
if (!tagName && nodeType === 4 /* TNodeType.Container */) {
|
|
10903
|
+
tagName = 'ng-template';
|
|
10672
10904
|
}
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
}
|
|
10689
|
-
|
|
10690
|
-
|
|
10905
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10906
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10907
|
+
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
10908
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10909
|
+
const importLocation = isHostStandalone ?
|
|
10910
|
+
'included in the \'@Component.imports\' of this component' :
|
|
10911
|
+
'a part of an @NgModule where this component is declared';
|
|
10912
|
+
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
10913
|
+
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
10914
|
+
// a template, but the `CommonModule` is not imported.
|
|
10915
|
+
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
10916
|
+
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
10917
|
+
}
|
|
10918
|
+
else {
|
|
10919
|
+
// May be an Angular component, which is not imported/declared?
|
|
10920
|
+
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
10921
|
+
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
10922
|
+
// May be a Web Component?
|
|
10923
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10924
|
+
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
10925
|
+
`to the ${schemas} of this component to suppress this message.`;
|
|
10926
|
+
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10927
|
+
`the ${schemas} of this component.`;
|
|
10691
10928
|
}
|
|
10692
10929
|
else {
|
|
10693
|
-
|
|
10930
|
+
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
10931
|
+
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10932
|
+
`the ${schemas} of this component.`;
|
|
10694
10933
|
}
|
|
10695
10934
|
}
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
.join(', ');
|
|
10699
|
-
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10700
|
-
}
|
|
10701
|
-
toString() {
|
|
10702
|
-
return this.displayName;
|
|
10935
|
+
if (shouldThrowErrorOnUnknownProperty) {
|
|
10936
|
+
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
10703
10937
|
}
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
function _mapProviders(injector, fn) {
|
|
10707
|
-
const res = [];
|
|
10708
|
-
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10709
|
-
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10938
|
+
else {
|
|
10939
|
+
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
10710
10940
|
}
|
|
10711
|
-
return res;
|
|
10712
10941
|
}
|
|
10713
|
-
|
|
10714
10942
|
/**
|
|
10715
|
-
*
|
|
10716
|
-
*
|
|
10943
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10944
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10945
|
+
* be too slow for production mode and also it relies on the constructor function being available.
|
|
10717
10946
|
*
|
|
10718
|
-
*
|
|
10719
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10720
|
-
*/
|
|
10721
|
-
|
|
10722
|
-
/**
|
|
10723
|
-
* @license
|
|
10724
|
-
* Copyright Google LLC All Rights Reserved.
|
|
10947
|
+
* Gets a reference to the host component def (where a current component is declared).
|
|
10725
10948
|
*
|
|
10726
|
-
*
|
|
10727
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10949
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10728
10950
|
*/
|
|
10729
|
-
|
|
10951
|
+
function getDeclarationComponentDef(lView) {
|
|
10952
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10953
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
10954
|
+
const context = declarationLView[CONTEXT];
|
|
10955
|
+
// Unable to obtain a context.
|
|
10956
|
+
if (!context)
|
|
10957
|
+
return null;
|
|
10958
|
+
return context.constructor ? getComponentDef$1(context.constructor) : null;
|
|
10959
|
+
}
|
|
10730
10960
|
/**
|
|
10731
|
-
*
|
|
10732
|
-
*
|
|
10961
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10962
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10963
|
+
* be too slow for production mode.
|
|
10733
10964
|
*
|
|
10734
|
-
*
|
|
10735
|
-
*
|
|
10965
|
+
* Checks if the current component is declared inside of a standalone component template.
|
|
10966
|
+
*
|
|
10967
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10736
10968
|
*/
|
|
10737
|
-
function
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
// if
|
|
10741
|
-
|
|
10742
|
-
// Verify that we will not get into infinite loop.
|
|
10743
|
-
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10744
|
-
return ɵɵinject(token, flags);
|
|
10745
|
-
}
|
|
10746
|
-
const tNode = getCurrentTNode();
|
|
10747
|
-
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10969
|
+
function isHostComponentStandalone(lView) {
|
|
10970
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10971
|
+
const componentDef = getDeclarationComponentDef(lView);
|
|
10972
|
+
// Treat host component as non-standalone if we can't obtain the def.
|
|
10973
|
+
return !!componentDef?.standalone;
|
|
10748
10974
|
}
|
|
10749
10975
|
/**
|
|
10750
|
-
*
|
|
10751
|
-
*
|
|
10752
|
-
*
|
|
10753
|
-
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10754
|
-
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10976
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10977
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10978
|
+
* be too slow for production mode.
|
|
10755
10979
|
*
|
|
10756
|
-
*
|
|
10757
|
-
*
|
|
10980
|
+
* Constructs a string describing the location of the host component template. The function is used
|
|
10981
|
+
* in dev mode to produce error messages.
|
|
10758
10982
|
*
|
|
10759
|
-
* @
|
|
10983
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10760
10984
|
*/
|
|
10761
|
-
function
|
|
10762
|
-
|
|
10763
|
-
|
|
10985
|
+
function getTemplateLocationDetails(lView) {
|
|
10986
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10987
|
+
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
10988
|
+
const componentClassName = hostComponentDef?.type?.name;
|
|
10989
|
+
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
10990
|
+
}
|
|
10991
|
+
/**
|
|
10992
|
+
* The set of known control flow directives.
|
|
10993
|
+
* We use this set to produce a more precises error message with a note
|
|
10994
|
+
* that the `CommonModule` should also be included.
|
|
10995
|
+
*/
|
|
10996
|
+
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
10997
|
+
/**
|
|
10998
|
+
* Returns true if the tag name is allowed by specified schemas.
|
|
10999
|
+
* @param schemas Array of schemas
|
|
11000
|
+
* @param tagName Name of the tag
|
|
11001
|
+
*/
|
|
11002
|
+
function matchingSchemas(schemas, tagName) {
|
|
11003
|
+
if (schemas !== null) {
|
|
11004
|
+
for (let i = 0; i < schemas.length; i++) {
|
|
11005
|
+
const schema = schemas[i];
|
|
11006
|
+
if (schema === NO_ERRORS_SCHEMA ||
|
|
11007
|
+
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
11008
|
+
return true;
|
|
11009
|
+
}
|
|
11010
|
+
}
|
|
11011
|
+
}
|
|
11012
|
+
return false;
|
|
10764
11013
|
}
|
|
10765
11014
|
|
|
10766
11015
|
/**
|
|
@@ -11554,36 +11803,21 @@ class LContainerDebug {
|
|
|
11554
11803
|
}
|
|
11555
11804
|
get parent() {
|
|
11556
11805
|
return toDebug(this._raw_lContainer[PARENT]);
|
|
11557
|
-
}
|
|
11558
|
-
get movedViews() {
|
|
11559
|
-
return this._raw_lContainer[MOVED_VIEWS];
|
|
11560
|
-
}
|
|
11561
|
-
get host() {
|
|
11562
|
-
return this._raw_lContainer[HOST];
|
|
11563
|
-
}
|
|
11564
|
-
get native() {
|
|
11565
|
-
return this._raw_lContainer[NATIVE];
|
|
11566
|
-
}
|
|
11567
|
-
get next() {
|
|
11568
|
-
return toDebug(this._raw_lContainer[NEXT]);
|
|
11569
|
-
}
|
|
11570
|
-
}
|
|
11571
|
-
|
|
11572
|
-
let shouldThrowErrorOnUnknownProperty = false;
|
|
11573
|
-
/**
|
|
11574
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
11575
|
-
* instead of just logging the error.
|
|
11576
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
11577
|
-
*/
|
|
11578
|
-
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
11579
|
-
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
11580
|
-
}
|
|
11581
|
-
/**
|
|
11582
|
-
* Gets the current value of the strict mode.
|
|
11583
|
-
*/
|
|
11584
|
-
function ɵgetUnknownPropertyStrictMode() {
|
|
11585
|
-
return shouldThrowErrorOnUnknownProperty;
|
|
11806
|
+
}
|
|
11807
|
+
get movedViews() {
|
|
11808
|
+
return this._raw_lContainer[MOVED_VIEWS];
|
|
11809
|
+
}
|
|
11810
|
+
get host() {
|
|
11811
|
+
return this._raw_lContainer[HOST];
|
|
11812
|
+
}
|
|
11813
|
+
get native() {
|
|
11814
|
+
return this._raw_lContainer[NATIVE];
|
|
11815
|
+
}
|
|
11816
|
+
get next() {
|
|
11817
|
+
return toDebug(this._raw_lContainer[NEXT]);
|
|
11818
|
+
}
|
|
11586
11819
|
}
|
|
11820
|
+
|
|
11587
11821
|
/**
|
|
11588
11822
|
* A permanent marker promise which signifies that the current CD tree is
|
|
11589
11823
|
* clean.
|
|
@@ -11742,55 +11976,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
|
|
|
11742
11976
|
}
|
|
11743
11977
|
return tNode;
|
|
11744
11978
|
}
|
|
11745
|
-
/**
|
|
11746
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11747
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11748
|
-
* be too slow for production mode and also it relies on the constructor function being available.
|
|
11749
|
-
*
|
|
11750
|
-
* Gets a reference to the host component def (where a current component is declared).
|
|
11751
|
-
*
|
|
11752
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11753
|
-
*/
|
|
11754
|
-
function getDeclarationComponentDef(lView) {
|
|
11755
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11756
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
11757
|
-
const context = declarationLView[CONTEXT];
|
|
11758
|
-
// Unable to obtain a context.
|
|
11759
|
-
if (!context)
|
|
11760
|
-
return null;
|
|
11761
|
-
return context.constructor ? getComponentDef$1(context.constructor) : null;
|
|
11762
|
-
}
|
|
11763
|
-
/**
|
|
11764
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11765
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11766
|
-
* be too slow for production mode.
|
|
11767
|
-
*
|
|
11768
|
-
* Checks if the current component is declared inside of a standalone component template.
|
|
11769
|
-
*
|
|
11770
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11771
|
-
*/
|
|
11772
|
-
function isHostComponentStandalone(lView) {
|
|
11773
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11774
|
-
const componentDef = getDeclarationComponentDef(lView);
|
|
11775
|
-
// Treat host component as non-standalone if we can't obtain the def.
|
|
11776
|
-
return !!(componentDef?.standalone);
|
|
11777
|
-
}
|
|
11778
|
-
/**
|
|
11779
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11780
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11781
|
-
* be too slow for production mode.
|
|
11782
|
-
*
|
|
11783
|
-
* Constructs a string describing the location of the host component template. The function is used
|
|
11784
|
-
* in dev mode to produce error messages.
|
|
11785
|
-
*
|
|
11786
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11787
|
-
*/
|
|
11788
|
-
function getTemplateLocationDetails(lView) {
|
|
11789
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11790
|
-
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
11791
|
-
const componentClassName = hostComponentDef?.type?.name;
|
|
11792
|
-
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
11793
|
-
}
|
|
11794
11979
|
/**
|
|
11795
11980
|
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
11796
11981
|
* i18nApply()), we need to adjust the blueprint for future
|
|
@@ -12457,10 +12642,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12457
12642
|
propName = mapPropName(propName);
|
|
12458
12643
|
if (ngDevMode) {
|
|
12459
12644
|
validateAgainstEventProperties(propName);
|
|
12460
|
-
if (!
|
|
12461
|
-
|
|
12462
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12463
|
-
return;
|
|
12645
|
+
if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
|
|
12646
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12464
12647
|
}
|
|
12465
12648
|
ngDevMode.rendererSetProperty++;
|
|
12466
12649
|
}
|
|
@@ -12479,7 +12662,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12479
12662
|
// If the node is a container and the property didn't
|
|
12480
12663
|
// match any of the inputs or schemas we should throw.
|
|
12481
12664
|
if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
|
|
12482
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12665
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12483
12666
|
}
|
|
12484
12667
|
}
|
|
12485
12668
|
}
|
|
@@ -12531,116 +12714,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
|
|
|
12531
12714
|
}
|
|
12532
12715
|
}
|
|
12533
12716
|
}
|
|
12534
|
-
/**
|
|
12535
|
-
* Validates that the property of the element is known at runtime and returns
|
|
12536
|
-
* false if it's not the case.
|
|
12537
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
12538
|
-
* ones this check happens at build time).
|
|
12539
|
-
*
|
|
12540
|
-
* The property is considered known if either:
|
|
12541
|
-
* - it's a known property of the element
|
|
12542
|
-
* - the element is allowed by one of the schemas
|
|
12543
|
-
* - the property is used for animations
|
|
12544
|
-
*
|
|
12545
|
-
* @param element Element to validate
|
|
12546
|
-
* @param tagName Name of the tag to check
|
|
12547
|
-
* @param propName Name of the property to check
|
|
12548
|
-
* @param schemas Array of schemas
|
|
12549
|
-
*/
|
|
12550
|
-
function validateProperty(element, tagName, propName, schemas) {
|
|
12551
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
12552
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
12553
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
12554
|
-
// execute the check below.
|
|
12555
|
-
if (schemas === null)
|
|
12556
|
-
return true;
|
|
12557
|
-
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
12558
|
-
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
12559
|
-
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
12560
|
-
return true;
|
|
12561
|
-
}
|
|
12562
|
-
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
12563
|
-
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
12564
|
-
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
12565
|
-
}
|
|
12566
|
-
/**
|
|
12567
|
-
* Returns true if the tag name is allowed by specified schemas.
|
|
12568
|
-
* @param schemas Array of schemas
|
|
12569
|
-
* @param tagName Name of the tag
|
|
12570
|
-
*/
|
|
12571
|
-
function matchingSchemas(schemas, tagName) {
|
|
12572
|
-
if (schemas !== null) {
|
|
12573
|
-
for (let i = 0; i < schemas.length; i++) {
|
|
12574
|
-
const schema = schemas[i];
|
|
12575
|
-
if (schema === NO_ERRORS_SCHEMA ||
|
|
12576
|
-
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
12577
|
-
return true;
|
|
12578
|
-
}
|
|
12579
|
-
}
|
|
12580
|
-
}
|
|
12581
|
-
return false;
|
|
12582
|
-
}
|
|
12583
|
-
/**
|
|
12584
|
-
* The set of known control flow directives.
|
|
12585
|
-
* We use this set to produce a more precises error message with a note
|
|
12586
|
-
* that the `CommonModule` should also be included.
|
|
12587
|
-
*/
|
|
12588
|
-
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
12589
|
-
/**
|
|
12590
|
-
* Logs or throws an error that a property is not supported on an element.
|
|
12591
|
-
*
|
|
12592
|
-
* @param propName Name of the invalid property.
|
|
12593
|
-
* @param tNode A `TNode` that represents a current component that is being rendered.
|
|
12594
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
12595
|
-
*/
|
|
12596
|
-
function handleUnknownPropertyError(propName, tNode, lView) {
|
|
12597
|
-
let tagName = tNode.value;
|
|
12598
|
-
// Special-case a situation when a structural directive is applied to
|
|
12599
|
-
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
12600
|
-
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
12601
|
-
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
12602
|
-
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
12603
|
-
// a default value of the `tNode.value` is not feasible at this moment.
|
|
12604
|
-
if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
|
|
12605
|
-
tagName = 'ng-template';
|
|
12606
|
-
}
|
|
12607
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
12608
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
12609
|
-
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
12610
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
12611
|
-
const importLocation = isHostStandalone ?
|
|
12612
|
-
'included in the \'@Component.imports\' of this component' :
|
|
12613
|
-
'a part of an @NgModule where this component is declared';
|
|
12614
|
-
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
12615
|
-
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
12616
|
-
// a template, but the `CommonModule` is not imported.
|
|
12617
|
-
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
12618
|
-
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
12619
|
-
}
|
|
12620
|
-
else {
|
|
12621
|
-
// May be an Angular component, which is not imported/declared?
|
|
12622
|
-
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
12623
|
-
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
12624
|
-
// May be a Web Component?
|
|
12625
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
12626
|
-
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
12627
|
-
`to the ${schemas} of this component to suppress this message.`;
|
|
12628
|
-
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12629
|
-
`the ${schemas} of this component.`;
|
|
12630
|
-
}
|
|
12631
|
-
else {
|
|
12632
|
-
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
12633
|
-
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12634
|
-
`the ${schemas} of this component.`;
|
|
12635
|
-
}
|
|
12636
|
-
}
|
|
12637
|
-
if (shouldThrowErrorOnUnknownProperty) {
|
|
12638
|
-
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
12639
|
-
}
|
|
12640
|
-
else {
|
|
12641
|
-
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
12642
|
-
}
|
|
12643
|
-
}
|
|
12644
12717
|
/**
|
|
12645
12718
|
* Instantiate a root component.
|
|
12646
12719
|
*/
|
|
@@ -14214,7 +14287,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
14214
14287
|
const component = instantiateRootComponent(tView, rootLView, componentDef);
|
|
14215
14288
|
rootContext.components.push(component);
|
|
14216
14289
|
componentView[CONTEXT] = component;
|
|
14217
|
-
hostFeatures
|
|
14290
|
+
if (hostFeatures !== null) {
|
|
14291
|
+
for (const feature of hostFeatures) {
|
|
14292
|
+
feature(component, componentDef);
|
|
14293
|
+
}
|
|
14294
|
+
}
|
|
14218
14295
|
// We want to generate an empty QueryList for root content queries for backwards
|
|
14219
14296
|
// compatibility with ViewEngine.
|
|
14220
14297
|
if (componentDef.contentQueries) {
|
|
@@ -14255,13 +14332,10 @@ function createRootContext(scheduler, playerHandler) {
|
|
|
14255
14332
|
* renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
|
|
14256
14333
|
* ```
|
|
14257
14334
|
*/
|
|
14258
|
-
function LifecycleHooksFeature(
|
|
14259
|
-
const lView = readPatchedLView(component);
|
|
14260
|
-
ngDevMode && assertDefined(lView, 'LView is required');
|
|
14261
|
-
const tView = lView[TVIEW];
|
|
14335
|
+
function LifecycleHooksFeature() {
|
|
14262
14336
|
const tNode = getCurrentTNode();
|
|
14263
14337
|
ngDevMode && assertDefined(tNode, 'TNode is required');
|
|
14264
|
-
registerPostOrderHooks(
|
|
14338
|
+
registerPostOrderHooks(getLView()[TVIEW], tNode);
|
|
14265
14339
|
}
|
|
14266
14340
|
/**
|
|
14267
14341
|
* Wait on component until it is rendered.
|
|
@@ -15396,21 +15470,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
|
|
|
15396
15470
|
* Use of this source code is governed by an MIT-style license that can be
|
|
15397
15471
|
* found in the LICENSE file at https://angular.io/license
|
|
15398
15472
|
*/
|
|
15399
|
-
let shouldThrowErrorOnUnknownElement = false;
|
|
15400
|
-
/**
|
|
15401
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
15402
|
-
* instead of just logging the error.
|
|
15403
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
15404
|
-
*/
|
|
15405
|
-
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
15406
|
-
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
15407
|
-
}
|
|
15408
|
-
/**
|
|
15409
|
-
* Gets the current value of the strict mode.
|
|
15410
|
-
*/
|
|
15411
|
-
function ɵgetUnknownElementStrictMode() {
|
|
15412
|
-
return shouldThrowErrorOnUnknownElement;
|
|
15413
|
-
}
|
|
15414
15473
|
function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
|
|
15415
15474
|
ngDevMode && assertFirstCreatePass(tView);
|
|
15416
15475
|
ngDevMode && ngDevMode.firstCreatePass++;
|
|
@@ -15544,67 +15603,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
15544
15603
|
ɵɵelementEnd();
|
|
15545
15604
|
return ɵɵelement;
|
|
15546
15605
|
}
|
|
15547
|
-
/**
|
|
15548
|
-
* Validates that the element is known at runtime and produces
|
|
15549
|
-
* an error if it's not the case.
|
|
15550
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
15551
|
-
* ones this check happens at build time).
|
|
15552
|
-
*
|
|
15553
|
-
* The element is considered known if either:
|
|
15554
|
-
* - it's a known HTML element
|
|
15555
|
-
* - it's a known custom element
|
|
15556
|
-
* - the element matches any directive
|
|
15557
|
-
* - the element is allowed by one of the schemas
|
|
15558
|
-
*
|
|
15559
|
-
* @param element Element to validate
|
|
15560
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
15561
|
-
* @param tagName Name of the tag to check
|
|
15562
|
-
* @param schemas Array of schemas
|
|
15563
|
-
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
15564
|
-
*/
|
|
15565
|
-
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
15566
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
15567
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
15568
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
15569
|
-
// execute the check below.
|
|
15570
|
-
if (schemas === null)
|
|
15571
|
-
return;
|
|
15572
|
-
// If the element matches any directive, it's considered as valid.
|
|
15573
|
-
if (!hasDirectives && tagName !== null) {
|
|
15574
|
-
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
15575
|
-
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
15576
|
-
// of HTMLUnknownElement in browsers that support web components.
|
|
15577
|
-
const isUnknown =
|
|
15578
|
-
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
15579
|
-
// because while most browsers return 'function', IE returns 'object'.
|
|
15580
|
-
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
15581
|
-
element instanceof HTMLUnknownElement) ||
|
|
15582
|
-
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
15583
|
-
!customElements.get(tagName));
|
|
15584
|
-
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
15585
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
15586
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
15587
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
15588
|
-
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
15589
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
15590
|
-
'a part of an @NgModule where this component is declared'}.\n`;
|
|
15591
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
15592
|
-
message +=
|
|
15593
|
-
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
15594
|
-
}
|
|
15595
|
-
else {
|
|
15596
|
-
message +=
|
|
15597
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
15598
|
-
}
|
|
15599
|
-
if (shouldThrowErrorOnUnknownElement) {
|
|
15600
|
-
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
15601
|
-
}
|
|
15602
|
-
else {
|
|
15603
|
-
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
15604
|
-
}
|
|
15605
|
-
}
|
|
15606
|
-
}
|
|
15607
|
-
}
|
|
15608
15606
|
|
|
15609
15607
|
/**
|
|
15610
15608
|
* @license
|
|
@@ -22087,7 +22085,7 @@ class Version {
|
|
|
22087
22085
|
/**
|
|
22088
22086
|
* @publicApi
|
|
22089
22087
|
*/
|
|
22090
|
-
const VERSION = new Version('14.0.
|
|
22088
|
+
const VERSION = new Version('14.0.1');
|
|
22091
22089
|
|
|
22092
22090
|
/**
|
|
22093
22091
|
* @license
|
|
@@ -22787,14 +22785,14 @@ class StandaloneService {
|
|
|
22787
22785
|
if (!componentDef.standalone) {
|
|
22788
22786
|
return null;
|
|
22789
22787
|
}
|
|
22790
|
-
if (!this.cachedInjectors.has(componentDef)) {
|
|
22788
|
+
if (!this.cachedInjectors.has(componentDef.id)) {
|
|
22791
22789
|
const providers = internalImportProvidersFrom(false, componentDef.type);
|
|
22792
22790
|
const standaloneInjector = providers.length > 0 ?
|
|
22793
22791
|
createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
|
|
22794
22792
|
null;
|
|
22795
|
-
this.cachedInjectors.set(componentDef, standaloneInjector);
|
|
22793
|
+
this.cachedInjectors.set(componentDef.id, standaloneInjector);
|
|
22796
22794
|
}
|
|
22797
|
-
return this.cachedInjectors.get(componentDef);
|
|
22795
|
+
return this.cachedInjectors.get(componentDef.id);
|
|
22798
22796
|
}
|
|
22799
22797
|
ngOnDestroy() {
|
|
22800
22798
|
try {
|
|
@@ -23294,13 +23292,26 @@ function getPipeDef(name, registry) {
|
|
|
23294
23292
|
}
|
|
23295
23293
|
}
|
|
23296
23294
|
if (ngDevMode) {
|
|
23297
|
-
|
|
23298
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
23299
|
-
const context = declarationLView[CONTEXT];
|
|
23300
|
-
const component = context ? ` in the '${context.constructor.name}' component` : '';
|
|
23301
|
-
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
|
|
23295
|
+
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
|
|
23302
23296
|
}
|
|
23303
23297
|
}
|
|
23298
|
+
/**
|
|
23299
|
+
* Generates a helpful error message for the user when a pipe is not found.
|
|
23300
|
+
*
|
|
23301
|
+
* @param name Name of the missing pipe
|
|
23302
|
+
* @returns The error message
|
|
23303
|
+
*/
|
|
23304
|
+
function getPipeNotFoundErrorMessage(name) {
|
|
23305
|
+
const lView = getLView();
|
|
23306
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
23307
|
+
const context = declarationLView[CONTEXT];
|
|
23308
|
+
const hostIsStandalone = isHostComponentStandalone(lView);
|
|
23309
|
+
const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
|
|
23310
|
+
const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
23311
|
+
'declared or imported in this module'}`;
|
|
23312
|
+
const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
|
|
23313
|
+
return errorMessage;
|
|
23314
|
+
}
|
|
23304
23315
|
/**
|
|
23305
23316
|
* Invokes a pipe with 1 arguments.
|
|
23306
23317
|
*
|
|
@@ -25121,7 +25132,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
|
|
25121
25132
|
}
|
|
25122
25133
|
/**
|
|
25123
25134
|
* Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
|
|
25124
|
-
* (
|
|
25135
|
+
* (either a NgModule or a standalone component / directive / pipe).
|
|
25125
25136
|
*/
|
|
25126
25137
|
function transitiveScopesFor(type) {
|
|
25127
25138
|
if (isNgModule(type)) {
|