@angular/core 14.0.0-rc.3 → 14.0.2
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/interface/provider.mjs +1 -1
- package/esm2020/src/di/provider_collection.mjs +32 -2
- package/esm2020/src/di/r3_injector.mjs +3 -1
- package/esm2020/src/error_handler.mjs +4 -7
- package/esm2020/src/errors.mjs +6 -3
- package/esm2020/src/metadata/directives.mjs +1 -1
- 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 +3 -2
- package/esm2020/src/render3/ng_module_ref.mjs +2 -1
- 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 +631 -586
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +632 -587
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +632 -587
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +633 -588
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +48 -7
- package/package.json +1 -1
- package/testing/index.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.
|
|
2
|
+
* @license Angular v14.0.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1843,9 +1843,12 @@ function formatRuntimeError(code, message) {
|
|
|
1843
1843
|
// Error code might be a negative number, which is a special marker that instructs the logic to
|
|
1844
1844
|
// generate a link to the error details page on angular.io.
|
|
1845
1845
|
const fullCode = `NG0${Math.abs(code)}`;
|
|
1846
|
-
let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
|
|
1846
|
+
let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
|
|
1847
1847
|
if (ngDevMode && code < 0) {
|
|
1848
|
-
|
|
1848
|
+
const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
|
|
1849
|
+
const separator = addPeriodSeparator ? '.' : '';
|
|
1850
|
+
errorMessage =
|
|
1851
|
+
`${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
|
|
1849
1852
|
}
|
|
1850
1853
|
return errorMessage;
|
|
1851
1854
|
}
|
|
@@ -2471,7 +2474,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
|
|
|
2471
2474
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2472
2475
|
* found in the LICENSE file at https://angular.io/license
|
|
2473
2476
|
*/
|
|
2474
|
-
|
|
2477
|
+
/** Counter used to generate unique IDs for component definitions. */
|
|
2478
|
+
let componentDefCount = 0;
|
|
2475
2479
|
/**
|
|
2476
2480
|
* Create a component definition object.
|
|
2477
2481
|
*
|
|
@@ -2524,7 +2528,7 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2524
2528
|
features: componentDefinition.features || null,
|
|
2525
2529
|
data: componentDefinition.data || {},
|
|
2526
2530
|
encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
|
|
2527
|
-
id:
|
|
2531
|
+
id: `c${componentDefCount++}`,
|
|
2528
2532
|
styles: componentDefinition.styles || EMPTY_ARRAY,
|
|
2529
2533
|
_: null,
|
|
2530
2534
|
setInput: null,
|
|
@@ -2533,7 +2537,6 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2533
2537
|
};
|
|
2534
2538
|
const dependencies = componentDefinition.dependencies;
|
|
2535
2539
|
const feature = componentDefinition.features;
|
|
2536
|
-
def.id += _renderCompCount++;
|
|
2537
2540
|
def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
|
|
2538
2541
|
def.outputs = invertObject(componentDefinition.outputs),
|
|
2539
2542
|
feature && feature.forEach((fn) => fn(def));
|
|
@@ -3540,7 +3543,6 @@ function getLView() {
|
|
|
3540
3543
|
function getTView() {
|
|
3541
3544
|
return instructionState.lFrame.tView;
|
|
3542
3545
|
}
|
|
3543
|
-
// TODO(crisbeto): revert the @noinline once Closure issue is resolved.
|
|
3544
3546
|
/**
|
|
3545
3547
|
* Restores `contextViewData` to the given OpaqueViewState instance.
|
|
3546
3548
|
*
|
|
@@ -3552,7 +3554,6 @@ function getTView() {
|
|
|
3552
3554
|
* @returns Context of the restored OpaqueViewState instance.
|
|
3553
3555
|
*
|
|
3554
3556
|
* @codeGenApi
|
|
3555
|
-
* @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
|
|
3556
3557
|
*/
|
|
3557
3558
|
function ɵɵrestoreView(viewToRestore) {
|
|
3558
3559
|
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.
|
|
@@ -6978,216 +7128,26 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
|
|
6978
7128
|
return lView.slice(directiveStartIndex, directiveEndIndex);
|
|
6979
7129
|
}
|
|
6980
7130
|
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}`;
|
|
7178
|
-
}
|
|
7179
|
-
const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
|
7180
|
-
function camelCaseToDashCase(input) {
|
|
7181
|
-
return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
|
7182
|
-
}
|
|
7183
|
-
function normalizeDebugBindingValue(value) {
|
|
7184
|
-
try {
|
|
7185
|
-
// Limit the size of the value as otherwise the DOM just gets polluted.
|
|
7186
|
-
return value != null ? value.toString().slice(0, 30) : value;
|
|
7187
|
-
}
|
|
7188
|
-
catch (e) {
|
|
7189
|
-
return '[ERROR] Exception while trying to serialize the value';
|
|
7131
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
7132
|
+
let directiveStartIndex = tNode.directiveStart;
|
|
7133
|
+
return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
|
|
7134
|
+
}
|
|
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
|
/**
|
|
@@ -9173,8 +9133,38 @@ const INJECTOR_DEF_TYPES = new InjectionToken('INJECTOR_DEF_TYPES');
|
|
|
9173
9133
|
* another environment injector (such as a route injector). They should not be used in component
|
|
9174
9134
|
* providers.
|
|
9175
9135
|
*
|
|
9176
|
-
*
|
|
9136
|
+
* More information about standalone components can be found in [this
|
|
9137
|
+
* guide](guide/standalone-components).
|
|
9138
|
+
*
|
|
9139
|
+
* @usageNotes
|
|
9140
|
+
* The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:
|
|
9141
|
+
*
|
|
9142
|
+
* ```typescript
|
|
9143
|
+
* await bootstrapApplication(RootComponent, {
|
|
9144
|
+
* providers: [
|
|
9145
|
+
* importProvidersFrom(NgModuleOne, NgModuleTwo)
|
|
9146
|
+
* ]
|
|
9147
|
+
* });
|
|
9148
|
+
* ```
|
|
9149
|
+
*
|
|
9150
|
+
* You can also use the `importProvidersFrom` results in the `providers` field of a route, when a
|
|
9151
|
+
* standalone component is used:
|
|
9152
|
+
*
|
|
9153
|
+
* ```typescript
|
|
9154
|
+
* export const ROUTES: Route[] = [
|
|
9155
|
+
* {
|
|
9156
|
+
* path: 'foo',
|
|
9157
|
+
* providers: [
|
|
9158
|
+
* importProvidersFrom(NgModuleOne, NgModuleTwo)
|
|
9159
|
+
* ],
|
|
9160
|
+
* component: YourStandaloneComponent
|
|
9161
|
+
* }
|
|
9162
|
+
* ];
|
|
9163
|
+
* ```
|
|
9164
|
+
*
|
|
9165
|
+
* @returns Collected providers from the specified list of types.
|
|
9177
9166
|
* @publicApi
|
|
9167
|
+
* @developerPreview
|
|
9178
9168
|
*/
|
|
9179
9169
|
function importProvidersFrom(...sources) {
|
|
9180
9170
|
return { ɵproviders: internalImportProvidersFrom(true, sources) };
|
|
@@ -9452,6 +9442,8 @@ function getNullInjector() {
|
|
|
9452
9442
|
/**
|
|
9453
9443
|
* An `Injector` that's part of the environment injector hierarchy, which exists outside of the
|
|
9454
9444
|
* component tree.
|
|
9445
|
+
*
|
|
9446
|
+
* @developerPreview
|
|
9455
9447
|
*/
|
|
9456
9448
|
class EnvironmentInjector {
|
|
9457
9449
|
}
|
|
@@ -10623,113 +10615,403 @@ class ReflectiveInjector_ {
|
|
|
10623
10615
|
return this.objs[i];
|
|
10624
10616
|
}
|
|
10625
10617
|
}
|
|
10626
|
-
return UNDEFINED;
|
|
10618
|
+
return UNDEFINED;
|
|
10619
|
+
}
|
|
10620
|
+
/** @internal */
|
|
10621
|
+
_throwOrNull(key, notFoundValue) {
|
|
10622
|
+
if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
|
10623
|
+
return notFoundValue;
|
|
10624
|
+
}
|
|
10625
|
+
else {
|
|
10626
|
+
throw noProviderError(this, key);
|
|
10627
|
+
}
|
|
10628
|
+
}
|
|
10629
|
+
/** @internal */
|
|
10630
|
+
_getByKeySelf(key, notFoundValue) {
|
|
10631
|
+
const obj = this._getObjByKeyId(key.id);
|
|
10632
|
+
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
|
10633
|
+
}
|
|
10634
|
+
/** @internal */
|
|
10635
|
+
_getByKeyDefault(key, notFoundValue, visibility) {
|
|
10636
|
+
let inj;
|
|
10637
|
+
if (visibility instanceof SkipSelf) {
|
|
10638
|
+
inj = this.parent;
|
|
10639
|
+
}
|
|
10640
|
+
else {
|
|
10641
|
+
inj = this;
|
|
10642
|
+
}
|
|
10643
|
+
while (inj instanceof ReflectiveInjector_) {
|
|
10644
|
+
const inj_ = inj;
|
|
10645
|
+
const obj = inj_._getObjByKeyId(key.id);
|
|
10646
|
+
if (obj !== UNDEFINED)
|
|
10647
|
+
return obj;
|
|
10648
|
+
inj = inj_.parent;
|
|
10649
|
+
}
|
|
10650
|
+
if (inj !== null) {
|
|
10651
|
+
return inj.get(key.token, notFoundValue);
|
|
10652
|
+
}
|
|
10653
|
+
else {
|
|
10654
|
+
return this._throwOrNull(key, notFoundValue);
|
|
10655
|
+
}
|
|
10656
|
+
}
|
|
10657
|
+
get displayName() {
|
|
10658
|
+
const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
|
|
10659
|
+
.join(', ');
|
|
10660
|
+
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10661
|
+
}
|
|
10662
|
+
toString() {
|
|
10663
|
+
return this.displayName;
|
|
10664
|
+
}
|
|
10665
|
+
}
|
|
10666
|
+
ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
|
|
10667
|
+
function _mapProviders(injector, fn) {
|
|
10668
|
+
const res = [];
|
|
10669
|
+
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10670
|
+
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10671
|
+
}
|
|
10672
|
+
return res;
|
|
10673
|
+
}
|
|
10674
|
+
|
|
10675
|
+
/**
|
|
10676
|
+
* @license
|
|
10677
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10678
|
+
*
|
|
10679
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10680
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10681
|
+
*/
|
|
10682
|
+
|
|
10683
|
+
/**
|
|
10684
|
+
* @license
|
|
10685
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10686
|
+
*
|
|
10687
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10688
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10689
|
+
*/
|
|
10690
|
+
|
|
10691
|
+
/**
|
|
10692
|
+
* @license
|
|
10693
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10694
|
+
*
|
|
10695
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10696
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10697
|
+
*/
|
|
10698
|
+
function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
|
10699
|
+
const lView = getLView();
|
|
10700
|
+
// Fall back to inject() if view hasn't been created. This situation can happen in tests
|
|
10701
|
+
// if inject utilities are used before bootstrapping.
|
|
10702
|
+
if (lView === null) {
|
|
10703
|
+
// Verify that we will not get into infinite loop.
|
|
10704
|
+
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10705
|
+
return ɵɵinject(token, flags);
|
|
10706
|
+
}
|
|
10707
|
+
const tNode = getCurrentTNode();
|
|
10708
|
+
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10709
|
+
}
|
|
10710
|
+
/**
|
|
10711
|
+
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
10712
|
+
* particular class.
|
|
10713
|
+
*
|
|
10714
|
+
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10715
|
+
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10716
|
+
*
|
|
10717
|
+
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
10718
|
+
* and thus in the stack trace.
|
|
10719
|
+
*
|
|
10720
|
+
* @codeGenApi
|
|
10721
|
+
*/
|
|
10722
|
+
function ɵɵinvalidFactory() {
|
|
10723
|
+
const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
|
|
10724
|
+
throw new Error(msg);
|
|
10725
|
+
}
|
|
10726
|
+
|
|
10727
|
+
/**
|
|
10728
|
+
* @license
|
|
10729
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10730
|
+
*
|
|
10731
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10732
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10733
|
+
*/
|
|
10734
|
+
/**
|
|
10735
|
+
* Defines a schema that allows an NgModule to contain the following:
|
|
10736
|
+
* - Non-Angular elements named with dash case (`-`).
|
|
10737
|
+
* - Element properties named with dash case (`-`).
|
|
10738
|
+
* Dash case is the naming convention for custom elements.
|
|
10739
|
+
*
|
|
10740
|
+
* @publicApi
|
|
10741
|
+
*/
|
|
10742
|
+
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
10743
|
+
name: 'custom-elements'
|
|
10744
|
+
};
|
|
10745
|
+
/**
|
|
10746
|
+
* Defines a schema that allows any property on any element.
|
|
10747
|
+
*
|
|
10748
|
+
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
10749
|
+
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
10750
|
+
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
10751
|
+
*
|
|
10752
|
+
* @publicApi
|
|
10753
|
+
*/
|
|
10754
|
+
const NO_ERRORS_SCHEMA = {
|
|
10755
|
+
name: 'no-errors-schema'
|
|
10756
|
+
};
|
|
10757
|
+
|
|
10758
|
+
/**
|
|
10759
|
+
* @license
|
|
10760
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10761
|
+
*
|
|
10762
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10763
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10764
|
+
*/
|
|
10765
|
+
let shouldThrowErrorOnUnknownElement = false;
|
|
10766
|
+
/**
|
|
10767
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
10768
|
+
* instead of just logging the error.
|
|
10769
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10770
|
+
*/
|
|
10771
|
+
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
10772
|
+
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
10773
|
+
}
|
|
10774
|
+
/**
|
|
10775
|
+
* Gets the current value of the strict mode.
|
|
10776
|
+
*/
|
|
10777
|
+
function ɵgetUnknownElementStrictMode() {
|
|
10778
|
+
return shouldThrowErrorOnUnknownElement;
|
|
10779
|
+
}
|
|
10780
|
+
let shouldThrowErrorOnUnknownProperty = false;
|
|
10781
|
+
/**
|
|
10782
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
10783
|
+
* instead of just logging the error.
|
|
10784
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10785
|
+
*/
|
|
10786
|
+
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
10787
|
+
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
10788
|
+
}
|
|
10789
|
+
/**
|
|
10790
|
+
* Gets the current value of the strict mode.
|
|
10791
|
+
*/
|
|
10792
|
+
function ɵgetUnknownPropertyStrictMode() {
|
|
10793
|
+
return shouldThrowErrorOnUnknownProperty;
|
|
10794
|
+
}
|
|
10795
|
+
/**
|
|
10796
|
+
* Validates that the element is known at runtime and produces
|
|
10797
|
+
* an error if it's not the case.
|
|
10798
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10799
|
+
* ones this check happens at build time).
|
|
10800
|
+
*
|
|
10801
|
+
* The element is considered known if either:
|
|
10802
|
+
* - it's a known HTML element
|
|
10803
|
+
* - it's a known custom element
|
|
10804
|
+
* - the element matches any directive
|
|
10805
|
+
* - the element is allowed by one of the schemas
|
|
10806
|
+
*
|
|
10807
|
+
* @param element Element to validate
|
|
10808
|
+
* @param lView An `LView` that represents a current component that is being rendered
|
|
10809
|
+
* @param tagName Name of the tag to check
|
|
10810
|
+
* @param schemas Array of schemas
|
|
10811
|
+
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
10812
|
+
*/
|
|
10813
|
+
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
10814
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10815
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10816
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10817
|
+
// execute the check below.
|
|
10818
|
+
if (schemas === null)
|
|
10819
|
+
return;
|
|
10820
|
+
// If the element matches any directive, it's considered as valid.
|
|
10821
|
+
if (!hasDirectives && tagName !== null) {
|
|
10822
|
+
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
10823
|
+
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
10824
|
+
// of HTMLUnknownElement in browsers that support web components.
|
|
10825
|
+
const isUnknown =
|
|
10826
|
+
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
10827
|
+
// because while most browsers return 'function', IE returns 'object'.
|
|
10828
|
+
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
10829
|
+
element instanceof HTMLUnknownElement) ||
|
|
10830
|
+
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
10831
|
+
!customElements.get(tagName));
|
|
10832
|
+
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
10833
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10834
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10835
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10836
|
+
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
10837
|
+
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
10838
|
+
'a part of an @NgModule where this component is declared'}.\n`;
|
|
10839
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10840
|
+
message +=
|
|
10841
|
+
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
10842
|
+
}
|
|
10843
|
+
else {
|
|
10844
|
+
message +=
|
|
10845
|
+
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
10846
|
+
}
|
|
10847
|
+
if (shouldThrowErrorOnUnknownElement) {
|
|
10848
|
+
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
10849
|
+
}
|
|
10850
|
+
else {
|
|
10851
|
+
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
10852
|
+
}
|
|
10853
|
+
}
|
|
10627
10854
|
}
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10855
|
+
}
|
|
10856
|
+
/**
|
|
10857
|
+
* Validates that the property of the element is known at runtime and returns
|
|
10858
|
+
* false if it's not the case.
|
|
10859
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10860
|
+
* ones this check happens at build time).
|
|
10861
|
+
*
|
|
10862
|
+
* The property is considered known if either:
|
|
10863
|
+
* - it's a known property of the element
|
|
10864
|
+
* - the element is allowed by one of the schemas
|
|
10865
|
+
* - the property is used for animations
|
|
10866
|
+
*
|
|
10867
|
+
* @param element Element to validate
|
|
10868
|
+
* @param propName Name of the property to check
|
|
10869
|
+
* @param tagName Name of the tag hosting the property
|
|
10870
|
+
* @param schemas Array of schemas
|
|
10871
|
+
*/
|
|
10872
|
+
function isPropertyValid(element, propName, tagName, schemas) {
|
|
10873
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10874
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10875
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10876
|
+
// execute the check below.
|
|
10877
|
+
if (schemas === null)
|
|
10878
|
+
return true;
|
|
10879
|
+
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
10880
|
+
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
10881
|
+
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
10882
|
+
return true;
|
|
10636
10883
|
}
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10884
|
+
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
10885
|
+
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
10886
|
+
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
10887
|
+
}
|
|
10888
|
+
/**
|
|
10889
|
+
* Logs or throws an error that a property is not supported on an element.
|
|
10890
|
+
*
|
|
10891
|
+
* @param propName Name of the invalid property
|
|
10892
|
+
* @param tagName Name of the tag hosting the property
|
|
10893
|
+
* @param nodeType Type of the node hosting the property
|
|
10894
|
+
* @param lView An `LView` that represents a current component
|
|
10895
|
+
*/
|
|
10896
|
+
function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
|
|
10897
|
+
// Special-case a situation when a structural directive is applied to
|
|
10898
|
+
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
10899
|
+
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
10900
|
+
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
10901
|
+
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
10902
|
+
// a default value of the `tNode.value` is not feasible at this moment.
|
|
10903
|
+
if (!tagName && nodeType === 4 /* TNodeType.Container */) {
|
|
10904
|
+
tagName = 'ng-template';
|
|
10641
10905
|
}
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
}
|
|
10658
|
-
|
|
10659
|
-
|
|
10906
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10907
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10908
|
+
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
10909
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10910
|
+
const importLocation = isHostStandalone ?
|
|
10911
|
+
'included in the \'@Component.imports\' of this component' :
|
|
10912
|
+
'a part of an @NgModule where this component is declared';
|
|
10913
|
+
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
10914
|
+
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
10915
|
+
// a template, but the `CommonModule` is not imported.
|
|
10916
|
+
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
10917
|
+
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
10918
|
+
}
|
|
10919
|
+
else {
|
|
10920
|
+
// May be an Angular component, which is not imported/declared?
|
|
10921
|
+
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
10922
|
+
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
10923
|
+
// May be a Web Component?
|
|
10924
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10925
|
+
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
10926
|
+
`to the ${schemas} of this component to suppress this message.`;
|
|
10927
|
+
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10928
|
+
`the ${schemas} of this component.`;
|
|
10660
10929
|
}
|
|
10661
10930
|
else {
|
|
10662
|
-
|
|
10931
|
+
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
10932
|
+
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10933
|
+
`the ${schemas} of this component.`;
|
|
10663
10934
|
}
|
|
10664
10935
|
}
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
.join(', ');
|
|
10668
|
-
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10669
|
-
}
|
|
10670
|
-
toString() {
|
|
10671
|
-
return this.displayName;
|
|
10936
|
+
if (shouldThrowErrorOnUnknownProperty) {
|
|
10937
|
+
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
10672
10938
|
}
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
function _mapProviders(injector, fn) {
|
|
10676
|
-
const res = [];
|
|
10677
|
-
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10678
|
-
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10939
|
+
else {
|
|
10940
|
+
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
10679
10941
|
}
|
|
10680
|
-
return res;
|
|
10681
10942
|
}
|
|
10682
|
-
|
|
10683
10943
|
/**
|
|
10684
|
-
*
|
|
10685
|
-
*
|
|
10944
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10945
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10946
|
+
* be too slow for production mode and also it relies on the constructor function being available.
|
|
10686
10947
|
*
|
|
10687
|
-
*
|
|
10688
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10689
|
-
*/
|
|
10690
|
-
|
|
10691
|
-
/**
|
|
10692
|
-
* @license
|
|
10693
|
-
* Copyright Google LLC All Rights Reserved.
|
|
10948
|
+
* Gets a reference to the host component def (where a current component is declared).
|
|
10694
10949
|
*
|
|
10695
|
-
*
|
|
10696
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10950
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10697
10951
|
*/
|
|
10698
|
-
|
|
10952
|
+
function getDeclarationComponentDef(lView) {
|
|
10953
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10954
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
10955
|
+
const context = declarationLView[CONTEXT];
|
|
10956
|
+
// Unable to obtain a context.
|
|
10957
|
+
if (!context)
|
|
10958
|
+
return null;
|
|
10959
|
+
return context.constructor ? getComponentDef$1(context.constructor) : null;
|
|
10960
|
+
}
|
|
10699
10961
|
/**
|
|
10700
|
-
*
|
|
10701
|
-
*
|
|
10962
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10963
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10964
|
+
* be too slow for production mode.
|
|
10702
10965
|
*
|
|
10703
|
-
*
|
|
10704
|
-
*
|
|
10966
|
+
* Checks if the current component is declared inside of a standalone component template.
|
|
10967
|
+
*
|
|
10968
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10705
10969
|
*/
|
|
10706
|
-
function
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
// if
|
|
10710
|
-
|
|
10711
|
-
// Verify that we will not get into infinite loop.
|
|
10712
|
-
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10713
|
-
return ɵɵinject(token, flags);
|
|
10714
|
-
}
|
|
10715
|
-
const tNode = getCurrentTNode();
|
|
10716
|
-
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10970
|
+
function isHostComponentStandalone(lView) {
|
|
10971
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10972
|
+
const componentDef = getDeclarationComponentDef(lView);
|
|
10973
|
+
// Treat host component as non-standalone if we can't obtain the def.
|
|
10974
|
+
return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
|
|
10717
10975
|
}
|
|
10718
10976
|
/**
|
|
10719
|
-
*
|
|
10720
|
-
*
|
|
10721
|
-
*
|
|
10722
|
-
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10723
|
-
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10977
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10978
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10979
|
+
* be too slow for production mode.
|
|
10724
10980
|
*
|
|
10725
|
-
*
|
|
10726
|
-
*
|
|
10981
|
+
* Constructs a string describing the location of the host component template. The function is used
|
|
10982
|
+
* in dev mode to produce error messages.
|
|
10727
10983
|
*
|
|
10728
|
-
* @
|
|
10984
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10729
10985
|
*/
|
|
10730
|
-
function
|
|
10731
|
-
|
|
10732
|
-
|
|
10986
|
+
function getTemplateLocationDetails(lView) {
|
|
10987
|
+
var _a;
|
|
10988
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10989
|
+
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
10990
|
+
const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
|
|
10991
|
+
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
10992
|
+
}
|
|
10993
|
+
/**
|
|
10994
|
+
* The set of known control flow directives.
|
|
10995
|
+
* We use this set to produce a more precises error message with a note
|
|
10996
|
+
* that the `CommonModule` should also be included.
|
|
10997
|
+
*/
|
|
10998
|
+
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
10999
|
+
/**
|
|
11000
|
+
* Returns true if the tag name is allowed by specified schemas.
|
|
11001
|
+
* @param schemas Array of schemas
|
|
11002
|
+
* @param tagName Name of the tag
|
|
11003
|
+
*/
|
|
11004
|
+
function matchingSchemas(schemas, tagName) {
|
|
11005
|
+
if (schemas !== null) {
|
|
11006
|
+
for (let i = 0; i < schemas.length; i++) {
|
|
11007
|
+
const schema = schemas[i];
|
|
11008
|
+
if (schema === NO_ERRORS_SCHEMA ||
|
|
11009
|
+
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
11010
|
+
return true;
|
|
11011
|
+
}
|
|
11012
|
+
}
|
|
11013
|
+
}
|
|
11014
|
+
return false;
|
|
10733
11015
|
}
|
|
10734
11016
|
|
|
10735
11017
|
/**
|
|
@@ -11525,34 +11807,19 @@ class LContainerDebug {
|
|
|
11525
11807
|
return toDebug(this._raw_lContainer[PARENT]);
|
|
11526
11808
|
}
|
|
11527
11809
|
get movedViews() {
|
|
11528
|
-
return this._raw_lContainer[MOVED_VIEWS];
|
|
11529
|
-
}
|
|
11530
|
-
get host() {
|
|
11531
|
-
return this._raw_lContainer[HOST];
|
|
11532
|
-
}
|
|
11533
|
-
get native() {
|
|
11534
|
-
return this._raw_lContainer[NATIVE];
|
|
11535
|
-
}
|
|
11536
|
-
get next() {
|
|
11537
|
-
return toDebug(this._raw_lContainer[NEXT]);
|
|
11538
|
-
}
|
|
11539
|
-
}
|
|
11540
|
-
|
|
11541
|
-
let shouldThrowErrorOnUnknownProperty = false;
|
|
11542
|
-
/**
|
|
11543
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
11544
|
-
* instead of just logging the error.
|
|
11545
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
11546
|
-
*/
|
|
11547
|
-
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
11548
|
-
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
11549
|
-
}
|
|
11550
|
-
/**
|
|
11551
|
-
* Gets the current value of the strict mode.
|
|
11552
|
-
*/
|
|
11553
|
-
function ɵgetUnknownPropertyStrictMode() {
|
|
11554
|
-
return shouldThrowErrorOnUnknownProperty;
|
|
11810
|
+
return this._raw_lContainer[MOVED_VIEWS];
|
|
11811
|
+
}
|
|
11812
|
+
get host() {
|
|
11813
|
+
return this._raw_lContainer[HOST];
|
|
11814
|
+
}
|
|
11815
|
+
get native() {
|
|
11816
|
+
return this._raw_lContainer[NATIVE];
|
|
11817
|
+
}
|
|
11818
|
+
get next() {
|
|
11819
|
+
return toDebug(this._raw_lContainer[NEXT]);
|
|
11820
|
+
}
|
|
11555
11821
|
}
|
|
11822
|
+
|
|
11556
11823
|
/**
|
|
11557
11824
|
* A permanent marker promise which signifies that the current CD tree is
|
|
11558
11825
|
* clean.
|
|
@@ -11711,56 +11978,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
|
|
|
11711
11978
|
}
|
|
11712
11979
|
return tNode;
|
|
11713
11980
|
}
|
|
11714
|
-
/**
|
|
11715
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11716
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11717
|
-
* be too slow for production mode and also it relies on the constructor function being available.
|
|
11718
|
-
*
|
|
11719
|
-
* Gets a reference to the host component def (where a current component is declared).
|
|
11720
|
-
*
|
|
11721
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11722
|
-
*/
|
|
11723
|
-
function getDeclarationComponentDef(lView) {
|
|
11724
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11725
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
11726
|
-
const context = declarationLView[CONTEXT];
|
|
11727
|
-
// Unable to obtain a context.
|
|
11728
|
-
if (!context)
|
|
11729
|
-
return null;
|
|
11730
|
-
return context.constructor ? getComponentDef$1(context.constructor) : null;
|
|
11731
|
-
}
|
|
11732
|
-
/**
|
|
11733
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11734
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11735
|
-
* be too slow for production mode.
|
|
11736
|
-
*
|
|
11737
|
-
* Checks if the current component is declared inside of a standalone component template.
|
|
11738
|
-
*
|
|
11739
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11740
|
-
*/
|
|
11741
|
-
function isHostComponentStandalone(lView) {
|
|
11742
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11743
|
-
const componentDef = getDeclarationComponentDef(lView);
|
|
11744
|
-
// Treat host component as non-standalone if we can't obtain the def.
|
|
11745
|
-
return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
|
|
11746
|
-
}
|
|
11747
|
-
/**
|
|
11748
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11749
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11750
|
-
* be too slow for production mode.
|
|
11751
|
-
*
|
|
11752
|
-
* Constructs a string describing the location of the host component template. The function is used
|
|
11753
|
-
* in dev mode to produce error messages.
|
|
11754
|
-
*
|
|
11755
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11756
|
-
*/
|
|
11757
|
-
function getTemplateLocationDetails(lView) {
|
|
11758
|
-
var _a;
|
|
11759
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11760
|
-
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
11761
|
-
const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
|
|
11762
|
-
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
11763
|
-
}
|
|
11764
11981
|
/**
|
|
11765
11982
|
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
11766
11983
|
* i18nApply()), we need to adjust the blueprint for future
|
|
@@ -12427,10 +12644,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12427
12644
|
propName = mapPropName(propName);
|
|
12428
12645
|
if (ngDevMode) {
|
|
12429
12646
|
validateAgainstEventProperties(propName);
|
|
12430
|
-
if (!
|
|
12431
|
-
|
|
12432
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12433
|
-
return;
|
|
12647
|
+
if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
|
|
12648
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12434
12649
|
}
|
|
12435
12650
|
ngDevMode.rendererSetProperty++;
|
|
12436
12651
|
}
|
|
@@ -12449,7 +12664,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12449
12664
|
// If the node is a container and the property didn't
|
|
12450
12665
|
// match any of the inputs or schemas we should throw.
|
|
12451
12666
|
if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
|
|
12452
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12667
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12453
12668
|
}
|
|
12454
12669
|
}
|
|
12455
12670
|
}
|
|
@@ -12501,116 +12716,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
|
|
|
12501
12716
|
}
|
|
12502
12717
|
}
|
|
12503
12718
|
}
|
|
12504
|
-
/**
|
|
12505
|
-
* Validates that the property of the element is known at runtime and returns
|
|
12506
|
-
* false if it's not the case.
|
|
12507
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
12508
|
-
* ones this check happens at build time).
|
|
12509
|
-
*
|
|
12510
|
-
* The property is considered known if either:
|
|
12511
|
-
* - it's a known property of the element
|
|
12512
|
-
* - the element is allowed by one of the schemas
|
|
12513
|
-
* - the property is used for animations
|
|
12514
|
-
*
|
|
12515
|
-
* @param element Element to validate
|
|
12516
|
-
* @param tagName Name of the tag to check
|
|
12517
|
-
* @param propName Name of the property to check
|
|
12518
|
-
* @param schemas Array of schemas
|
|
12519
|
-
*/
|
|
12520
|
-
function validateProperty(element, tagName, propName, schemas) {
|
|
12521
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
12522
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
12523
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
12524
|
-
// execute the check below.
|
|
12525
|
-
if (schemas === null)
|
|
12526
|
-
return true;
|
|
12527
|
-
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
12528
|
-
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
12529
|
-
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
12530
|
-
return true;
|
|
12531
|
-
}
|
|
12532
|
-
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
12533
|
-
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
12534
|
-
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
12535
|
-
}
|
|
12536
|
-
/**
|
|
12537
|
-
* Returns true if the tag name is allowed by specified schemas.
|
|
12538
|
-
* @param schemas Array of schemas
|
|
12539
|
-
* @param tagName Name of the tag
|
|
12540
|
-
*/
|
|
12541
|
-
function matchingSchemas(schemas, tagName) {
|
|
12542
|
-
if (schemas !== null) {
|
|
12543
|
-
for (let i = 0; i < schemas.length; i++) {
|
|
12544
|
-
const schema = schemas[i];
|
|
12545
|
-
if (schema === NO_ERRORS_SCHEMA ||
|
|
12546
|
-
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
12547
|
-
return true;
|
|
12548
|
-
}
|
|
12549
|
-
}
|
|
12550
|
-
}
|
|
12551
|
-
return false;
|
|
12552
|
-
}
|
|
12553
|
-
/**
|
|
12554
|
-
* The set of known control flow directives.
|
|
12555
|
-
* We use this set to produce a more precises error message with a note
|
|
12556
|
-
* that the `CommonModule` should also be included.
|
|
12557
|
-
*/
|
|
12558
|
-
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
12559
|
-
/**
|
|
12560
|
-
* Logs or throws an error that a property is not supported on an element.
|
|
12561
|
-
*
|
|
12562
|
-
* @param propName Name of the invalid property.
|
|
12563
|
-
* @param tNode A `TNode` that represents a current component that is being rendered.
|
|
12564
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
12565
|
-
*/
|
|
12566
|
-
function handleUnknownPropertyError(propName, tNode, lView) {
|
|
12567
|
-
let tagName = tNode.value;
|
|
12568
|
-
// Special-case a situation when a structural directive is applied to
|
|
12569
|
-
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
12570
|
-
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
12571
|
-
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
12572
|
-
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
12573
|
-
// a default value of the `tNode.value` is not feasible at this moment.
|
|
12574
|
-
if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
|
|
12575
|
-
tagName = 'ng-template';
|
|
12576
|
-
}
|
|
12577
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
12578
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
12579
|
-
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
12580
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
12581
|
-
const importLocation = isHostStandalone ?
|
|
12582
|
-
'included in the \'@Component.imports\' of this component' :
|
|
12583
|
-
'a part of an @NgModule where this component is declared';
|
|
12584
|
-
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
12585
|
-
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
12586
|
-
// a template, but the `CommonModule` is not imported.
|
|
12587
|
-
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
12588
|
-
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
12589
|
-
}
|
|
12590
|
-
else {
|
|
12591
|
-
// May be an Angular component, which is not imported/declared?
|
|
12592
|
-
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
12593
|
-
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
12594
|
-
// May be a Web Component?
|
|
12595
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
12596
|
-
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
12597
|
-
`to the ${schemas} of this component to suppress this message.`;
|
|
12598
|
-
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12599
|
-
`the ${schemas} of this component.`;
|
|
12600
|
-
}
|
|
12601
|
-
else {
|
|
12602
|
-
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
12603
|
-
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12604
|
-
`the ${schemas} of this component.`;
|
|
12605
|
-
}
|
|
12606
|
-
}
|
|
12607
|
-
if (shouldThrowErrorOnUnknownProperty) {
|
|
12608
|
-
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
12609
|
-
}
|
|
12610
|
-
else {
|
|
12611
|
-
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
12612
|
-
}
|
|
12613
|
-
}
|
|
12614
12719
|
/**
|
|
12615
12720
|
* Instantiate a root component.
|
|
12616
12721
|
*/
|
|
@@ -14184,7 +14289,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
14184
14289
|
const component = instantiateRootComponent(tView, rootLView, componentDef);
|
|
14185
14290
|
rootContext.components.push(component);
|
|
14186
14291
|
componentView[CONTEXT] = component;
|
|
14187
|
-
hostFeatures
|
|
14292
|
+
if (hostFeatures !== null) {
|
|
14293
|
+
for (const feature of hostFeatures) {
|
|
14294
|
+
feature(component, componentDef);
|
|
14295
|
+
}
|
|
14296
|
+
}
|
|
14188
14297
|
// We want to generate an empty QueryList for root content queries for backwards
|
|
14189
14298
|
// compatibility with ViewEngine.
|
|
14190
14299
|
if (componentDef.contentQueries) {
|
|
@@ -14225,13 +14334,10 @@ function createRootContext(scheduler, playerHandler) {
|
|
|
14225
14334
|
* renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
|
|
14226
14335
|
* ```
|
|
14227
14336
|
*/
|
|
14228
|
-
function LifecycleHooksFeature(
|
|
14229
|
-
const lView = readPatchedLView(component);
|
|
14230
|
-
ngDevMode && assertDefined(lView, 'LView is required');
|
|
14231
|
-
const tView = lView[TVIEW];
|
|
14337
|
+
function LifecycleHooksFeature() {
|
|
14232
14338
|
const tNode = getCurrentTNode();
|
|
14233
14339
|
ngDevMode && assertDefined(tNode, 'TNode is required');
|
|
14234
|
-
registerPostOrderHooks(
|
|
14340
|
+
registerPostOrderHooks(getLView()[TVIEW], tNode);
|
|
14235
14341
|
}
|
|
14236
14342
|
/**
|
|
14237
14343
|
* Wait on component until it is rendered.
|
|
@@ -15366,21 +15472,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
|
|
|
15366
15472
|
* Use of this source code is governed by an MIT-style license that can be
|
|
15367
15473
|
* found in the LICENSE file at https://angular.io/license
|
|
15368
15474
|
*/
|
|
15369
|
-
let shouldThrowErrorOnUnknownElement = false;
|
|
15370
|
-
/**
|
|
15371
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
15372
|
-
* instead of just logging the error.
|
|
15373
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
15374
|
-
*/
|
|
15375
|
-
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
15376
|
-
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
15377
|
-
}
|
|
15378
|
-
/**
|
|
15379
|
-
* Gets the current value of the strict mode.
|
|
15380
|
-
*/
|
|
15381
|
-
function ɵgetUnknownElementStrictMode() {
|
|
15382
|
-
return shouldThrowErrorOnUnknownElement;
|
|
15383
|
-
}
|
|
15384
15475
|
function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
|
|
15385
15476
|
ngDevMode && assertFirstCreatePass(tView);
|
|
15386
15477
|
ngDevMode && ngDevMode.firstCreatePass++;
|
|
@@ -15514,67 +15605,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
15514
15605
|
ɵɵelementEnd();
|
|
15515
15606
|
return ɵɵelement;
|
|
15516
15607
|
}
|
|
15517
|
-
/**
|
|
15518
|
-
* Validates that the element is known at runtime and produces
|
|
15519
|
-
* an error if it's not the case.
|
|
15520
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
15521
|
-
* ones this check happens at build time).
|
|
15522
|
-
*
|
|
15523
|
-
* The element is considered known if either:
|
|
15524
|
-
* - it's a known HTML element
|
|
15525
|
-
* - it's a known custom element
|
|
15526
|
-
* - the element matches any directive
|
|
15527
|
-
* - the element is allowed by one of the schemas
|
|
15528
|
-
*
|
|
15529
|
-
* @param element Element to validate
|
|
15530
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
15531
|
-
* @param tagName Name of the tag to check
|
|
15532
|
-
* @param schemas Array of schemas
|
|
15533
|
-
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
15534
|
-
*/
|
|
15535
|
-
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
15536
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
15537
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
15538
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
15539
|
-
// execute the check below.
|
|
15540
|
-
if (schemas === null)
|
|
15541
|
-
return;
|
|
15542
|
-
// If the element matches any directive, it's considered as valid.
|
|
15543
|
-
if (!hasDirectives && tagName !== null) {
|
|
15544
|
-
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
15545
|
-
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
15546
|
-
// of HTMLUnknownElement in browsers that support web components.
|
|
15547
|
-
const isUnknown =
|
|
15548
|
-
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
15549
|
-
// because while most browsers return 'function', IE returns 'object'.
|
|
15550
|
-
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
15551
|
-
element instanceof HTMLUnknownElement) ||
|
|
15552
|
-
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
15553
|
-
!customElements.get(tagName));
|
|
15554
|
-
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
15555
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
15556
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
15557
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
15558
|
-
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
15559
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
15560
|
-
'a part of an @NgModule where this component is declared'}.\n`;
|
|
15561
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
15562
|
-
message +=
|
|
15563
|
-
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
15564
|
-
}
|
|
15565
|
-
else {
|
|
15566
|
-
message +=
|
|
15567
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
15568
|
-
}
|
|
15569
|
-
if (shouldThrowErrorOnUnknownElement) {
|
|
15570
|
-
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
15571
|
-
}
|
|
15572
|
-
else {
|
|
15573
|
-
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
15574
|
-
}
|
|
15575
|
-
}
|
|
15576
|
-
}
|
|
15577
|
-
}
|
|
15578
15608
|
|
|
15579
15609
|
/**
|
|
15580
15610
|
* @license
|
|
@@ -22057,7 +22087,7 @@ class Version {
|
|
|
22057
22087
|
/**
|
|
22058
22088
|
* @publicApi
|
|
22059
22089
|
*/
|
|
22060
|
-
const VERSION = new Version('14.0.
|
|
22090
|
+
const VERSION = new Version('14.0.2');
|
|
22061
22091
|
|
|
22062
22092
|
/**
|
|
22063
22093
|
* @license
|
|
@@ -22729,6 +22759,7 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
|
|
|
22729
22759
|
* Create a new environment injector.
|
|
22730
22760
|
*
|
|
22731
22761
|
* @publicApi
|
|
22762
|
+
* @developerPreview
|
|
22732
22763
|
*/
|
|
22733
22764
|
function createEnvironmentInjector(providers, parent = null, debugName = null) {
|
|
22734
22765
|
const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
|
|
@@ -22756,14 +22787,14 @@ class StandaloneService {
|
|
|
22756
22787
|
if (!componentDef.standalone) {
|
|
22757
22788
|
return null;
|
|
22758
22789
|
}
|
|
22759
|
-
if (!this.cachedInjectors.has(componentDef)) {
|
|
22790
|
+
if (!this.cachedInjectors.has(componentDef.id)) {
|
|
22760
22791
|
const providers = internalImportProvidersFrom(false, componentDef.type);
|
|
22761
22792
|
const standaloneInjector = providers.length > 0 ?
|
|
22762
22793
|
createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
|
|
22763
22794
|
null;
|
|
22764
|
-
this.cachedInjectors.set(componentDef, standaloneInjector);
|
|
22795
|
+
this.cachedInjectors.set(componentDef.id, standaloneInjector);
|
|
22765
22796
|
}
|
|
22766
|
-
return this.cachedInjectors.get(componentDef);
|
|
22797
|
+
return this.cachedInjectors.get(componentDef.id);
|
|
22767
22798
|
}
|
|
22768
22799
|
ngOnDestroy() {
|
|
22769
22800
|
try {
|
|
@@ -23263,13 +23294,26 @@ function getPipeDef(name, registry) {
|
|
|
23263
23294
|
}
|
|
23264
23295
|
}
|
|
23265
23296
|
if (ngDevMode) {
|
|
23266
|
-
|
|
23267
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
23268
|
-
const context = declarationLView[CONTEXT];
|
|
23269
|
-
const component = context ? ` in the '${context.constructor.name}' component` : '';
|
|
23270
|
-
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
|
|
23297
|
+
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
|
|
23271
23298
|
}
|
|
23272
23299
|
}
|
|
23300
|
+
/**
|
|
23301
|
+
* Generates a helpful error message for the user when a pipe is not found.
|
|
23302
|
+
*
|
|
23303
|
+
* @param name Name of the missing pipe
|
|
23304
|
+
* @returns The error message
|
|
23305
|
+
*/
|
|
23306
|
+
function getPipeNotFoundErrorMessage(name) {
|
|
23307
|
+
const lView = getLView();
|
|
23308
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
23309
|
+
const context = declarationLView[CONTEXT];
|
|
23310
|
+
const hostIsStandalone = isHostComponentStandalone(lView);
|
|
23311
|
+
const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
|
|
23312
|
+
const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
23313
|
+
'declared or imported in this module'}`;
|
|
23314
|
+
const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
|
|
23315
|
+
return errorMessage;
|
|
23316
|
+
}
|
|
23273
23317
|
/**
|
|
23274
23318
|
* Invokes a pipe with 1 arguments.
|
|
23275
23319
|
*
|
|
@@ -25061,6 +25105,7 @@ function setScopeOnDeclaredComponents(moduleType, ngModule) {
|
|
|
25061
25105
|
const declarations = flatten$1(ngModule.declarations || EMPTY_ARRAY);
|
|
25062
25106
|
const transitiveScopes = transitiveScopesFor(moduleType);
|
|
25063
25107
|
declarations.forEach(declaration => {
|
|
25108
|
+
declaration = resolveForwardRef(declaration);
|
|
25064
25109
|
if (declaration.hasOwnProperty(NG_COMP_DEF)) {
|
|
25065
25110
|
// A `ɵcmp` field exists - go ahead and patch the component directly.
|
|
25066
25111
|
const component = declaration;
|
|
@@ -25091,7 +25136,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
|
|
25091
25136
|
}
|
|
25092
25137
|
/**
|
|
25093
25138
|
* Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
|
|
25094
|
-
* (
|
|
25139
|
+
* (either a NgModule or a standalone component / directive / pipe).
|
|
25095
25140
|
*/
|
|
25096
25141
|
function transitiveScopesFor(type) {
|
|
25097
25142
|
if (isNgModule(type)) {
|