@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/fesm2015/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.
|
|
2
|
+
* @license Angular v14.0.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -181,9 +181,12 @@ function formatRuntimeError(code, message) {
|
|
|
181
181
|
// Error code might be a negative number, which is a special marker that instructs the logic to
|
|
182
182
|
// generate a link to the error details page on angular.io.
|
|
183
183
|
const fullCode = `NG0${Math.abs(code)}`;
|
|
184
|
-
let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
|
|
184
|
+
let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
|
|
185
185
|
if (ngDevMode && code < 0) {
|
|
186
|
-
|
|
186
|
+
const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
|
|
187
|
+
const separator = addPeriodSeparator ? '.' : '';
|
|
188
|
+
errorMessage =
|
|
189
|
+
`${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
|
|
187
190
|
}
|
|
188
191
|
return errorMessage;
|
|
189
192
|
}
|
|
@@ -864,7 +867,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
|
|
|
864
867
|
* Use of this source code is governed by an MIT-style license that can be
|
|
865
868
|
* found in the LICENSE file at https://angular.io/license
|
|
866
869
|
*/
|
|
867
|
-
|
|
870
|
+
/** Counter used to generate unique IDs for component definitions. */
|
|
871
|
+
let componentDefCount = 0;
|
|
868
872
|
/**
|
|
869
873
|
* Create a component definition object.
|
|
870
874
|
*
|
|
@@ -917,7 +921,7 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
917
921
|
features: componentDefinition.features || null,
|
|
918
922
|
data: componentDefinition.data || {},
|
|
919
923
|
encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
|
|
920
|
-
id:
|
|
924
|
+
id: `c${componentDefCount++}`,
|
|
921
925
|
styles: componentDefinition.styles || EMPTY_ARRAY,
|
|
922
926
|
_: null,
|
|
923
927
|
setInput: null,
|
|
@@ -926,7 +930,6 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
926
930
|
};
|
|
927
931
|
const dependencies = componentDefinition.dependencies;
|
|
928
932
|
const feature = componentDefinition.features;
|
|
929
|
-
def.id += _renderCompCount++;
|
|
930
933
|
def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
|
|
931
934
|
def.outputs = invertObject(componentDefinition.outputs),
|
|
932
935
|
feature && feature.forEach((fn) => fn(def));
|
|
@@ -1933,7 +1936,6 @@ function getLView() {
|
|
|
1933
1936
|
function getTView() {
|
|
1934
1937
|
return instructionState.lFrame.tView;
|
|
1935
1938
|
}
|
|
1936
|
-
// TODO(crisbeto): revert the @noinline once Closure issue is resolved.
|
|
1937
1939
|
/**
|
|
1938
1940
|
* Restores `contextViewData` to the given OpaqueViewState instance.
|
|
1939
1941
|
*
|
|
@@ -1945,7 +1947,6 @@ function getTView() {
|
|
|
1945
1947
|
* @returns Context of the restored OpaqueViewState instance.
|
|
1946
1948
|
*
|
|
1947
1949
|
* @codeGenApi
|
|
1948
|
-
* @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
|
|
1949
1950
|
*/
|
|
1950
1951
|
function ɵɵrestoreView(viewToRestore) {
|
|
1951
1952
|
instructionState.lFrame.contextLView = viewToRestore;
|
|
@@ -6334,6 +6335,155 @@ function getSanitizer() {
|
|
|
6334
6335
|
return lView && lView[SANITIZER];
|
|
6335
6336
|
}
|
|
6336
6337
|
|
|
6338
|
+
/**
|
|
6339
|
+
* @license
|
|
6340
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6341
|
+
*
|
|
6342
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6343
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6344
|
+
*/
|
|
6345
|
+
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
6346
|
+
function wrappedError(message, originalError) {
|
|
6347
|
+
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
6348
|
+
const error = Error(msg);
|
|
6349
|
+
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
6350
|
+
return error;
|
|
6351
|
+
}
|
|
6352
|
+
function getOriginalError(error) {
|
|
6353
|
+
return error[ERROR_ORIGINAL_ERROR];
|
|
6354
|
+
}
|
|
6355
|
+
|
|
6356
|
+
/**
|
|
6357
|
+
* @license
|
|
6358
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6359
|
+
*
|
|
6360
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6361
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6362
|
+
*/
|
|
6363
|
+
/**
|
|
6364
|
+
* Provides a hook for centralized exception handling.
|
|
6365
|
+
*
|
|
6366
|
+
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
6367
|
+
* intercept error handling, write a custom exception handler that replaces this default as
|
|
6368
|
+
* appropriate for your app.
|
|
6369
|
+
*
|
|
6370
|
+
* @usageNotes
|
|
6371
|
+
* ### Example
|
|
6372
|
+
*
|
|
6373
|
+
* ```
|
|
6374
|
+
* class MyErrorHandler implements ErrorHandler {
|
|
6375
|
+
* handleError(error) {
|
|
6376
|
+
* // do something with the exception
|
|
6377
|
+
* }
|
|
6378
|
+
* }
|
|
6379
|
+
*
|
|
6380
|
+
* @NgModule({
|
|
6381
|
+
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
6382
|
+
* })
|
|
6383
|
+
* class MyModule {}
|
|
6384
|
+
* ```
|
|
6385
|
+
*
|
|
6386
|
+
* @publicApi
|
|
6387
|
+
*/
|
|
6388
|
+
class ErrorHandler {
|
|
6389
|
+
constructor() {
|
|
6390
|
+
/**
|
|
6391
|
+
* @internal
|
|
6392
|
+
*/
|
|
6393
|
+
this._console = console;
|
|
6394
|
+
}
|
|
6395
|
+
handleError(error) {
|
|
6396
|
+
const originalError = this._findOriginalError(error);
|
|
6397
|
+
this._console.error('ERROR', error);
|
|
6398
|
+
if (originalError) {
|
|
6399
|
+
this._console.error('ORIGINAL ERROR', originalError);
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
/** @internal */
|
|
6403
|
+
_findOriginalError(error) {
|
|
6404
|
+
let e = error && getOriginalError(error);
|
|
6405
|
+
while (e && getOriginalError(e)) {
|
|
6406
|
+
e = getOriginalError(e);
|
|
6407
|
+
}
|
|
6408
|
+
return e || null;
|
|
6409
|
+
}
|
|
6410
|
+
}
|
|
6411
|
+
|
|
6412
|
+
/**
|
|
6413
|
+
* @license
|
|
6414
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6415
|
+
*
|
|
6416
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6417
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6418
|
+
*/
|
|
6419
|
+
/**
|
|
6420
|
+
* Disallowed strings in the comment.
|
|
6421
|
+
*
|
|
6422
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6423
|
+
*/
|
|
6424
|
+
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
6425
|
+
/**
|
|
6426
|
+
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
6427
|
+
*/
|
|
6428
|
+
const COMMENT_DELIMITER = /(<|>)/;
|
|
6429
|
+
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
6430
|
+
/**
|
|
6431
|
+
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
6432
|
+
*
|
|
6433
|
+
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
6434
|
+
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
6435
|
+
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
6436
|
+
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
6437
|
+
*
|
|
6438
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6439
|
+
*
|
|
6440
|
+
* ```
|
|
6441
|
+
* div.innerHTML = div.innerHTML
|
|
6442
|
+
* ```
|
|
6443
|
+
*
|
|
6444
|
+
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
6445
|
+
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
6446
|
+
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
6447
|
+
* may contain such text and expect them to be safe.)
|
|
6448
|
+
*
|
|
6449
|
+
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
6450
|
+
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
6451
|
+
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
6452
|
+
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
6453
|
+
*
|
|
6454
|
+
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
6455
|
+
* sequence.
|
|
6456
|
+
*/
|
|
6457
|
+
function escapeCommentText(value) {
|
|
6458
|
+
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
6459
|
+
}
|
|
6460
|
+
|
|
6461
|
+
/**
|
|
6462
|
+
* @license
|
|
6463
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6464
|
+
*
|
|
6465
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6466
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6467
|
+
*/
|
|
6468
|
+
function normalizeDebugBindingName(name) {
|
|
6469
|
+
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
6470
|
+
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
6471
|
+
return `ng-reflect-${name}`;
|
|
6472
|
+
}
|
|
6473
|
+
const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
|
6474
|
+
function camelCaseToDashCase(input) {
|
|
6475
|
+
return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
|
6476
|
+
}
|
|
6477
|
+
function normalizeDebugBindingValue(value) {
|
|
6478
|
+
try {
|
|
6479
|
+
// Limit the size of the value as otherwise the DOM just gets polluted.
|
|
6480
|
+
return value != null ? value.toString().slice(0, 30) : value;
|
|
6481
|
+
}
|
|
6482
|
+
catch (e) {
|
|
6483
|
+
return '[ERROR] Exception while trying to serialize the value';
|
|
6484
|
+
}
|
|
6485
|
+
}
|
|
6486
|
+
|
|
6337
6487
|
/**
|
|
6338
6488
|
* @license
|
|
6339
6489
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6682,223 +6832,33 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
|
|
6682
6832
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6683
6833
|
let directiveStartIndex = tNode.directiveStart;
|
|
6684
6834
|
if (directiveStartIndex == 0)
|
|
6685
|
-
return EMPTY_ARRAY;
|
|
6686
|
-
const directiveEndIndex = tNode.directiveEnd;
|
|
6687
|
-
if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
6688
|
-
directiveStartIndex++;
|
|
6689
|
-
return lView.slice(directiveStartIndex, directiveEndIndex);
|
|
6690
|
-
}
|
|
6691
|
-
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
6692
|
-
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6693
|
-
let directiveStartIndex = tNode.directiveStart;
|
|
6694
|
-
return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
|
|
6695
|
-
}
|
|
6696
|
-
/**
|
|
6697
|
-
* Returns a map of local references (local reference name => element or directive instance) that
|
|
6698
|
-
* exist on a given element.
|
|
6699
|
-
*/
|
|
6700
|
-
function discoverLocalRefs(lView, nodeIndex) {
|
|
6701
|
-
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6702
|
-
if (tNode && tNode.localNames) {
|
|
6703
|
-
const result = {};
|
|
6704
|
-
let localIndex = tNode.index + 1;
|
|
6705
|
-
for (let i = 0; i < tNode.localNames.length; i += 2) {
|
|
6706
|
-
result[tNode.localNames[i]] = lView[localIndex];
|
|
6707
|
-
localIndex++;
|
|
6708
|
-
}
|
|
6709
|
-
return result;
|
|
6710
|
-
}
|
|
6711
|
-
return null;
|
|
6712
|
-
}
|
|
6713
|
-
|
|
6714
|
-
/**
|
|
6715
|
-
* @license
|
|
6716
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6717
|
-
*
|
|
6718
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6719
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6720
|
-
*/
|
|
6721
|
-
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
6722
|
-
const ERROR_LOGGER = 'ngErrorLogger';
|
|
6723
|
-
function wrappedError(message, originalError) {
|
|
6724
|
-
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
6725
|
-
const error = Error(msg);
|
|
6726
|
-
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
6727
|
-
return error;
|
|
6728
|
-
}
|
|
6729
|
-
function getOriginalError(error) {
|
|
6730
|
-
return error[ERROR_ORIGINAL_ERROR];
|
|
6731
|
-
}
|
|
6732
|
-
function getErrorLogger(error) {
|
|
6733
|
-
return error && error[ERROR_LOGGER] || defaultErrorLogger;
|
|
6734
|
-
}
|
|
6735
|
-
function defaultErrorLogger(console, ...values) {
|
|
6736
|
-
console.error(...values);
|
|
6737
|
-
}
|
|
6738
|
-
|
|
6739
|
-
/**
|
|
6740
|
-
* @license
|
|
6741
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6742
|
-
*
|
|
6743
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6744
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6745
|
-
*/
|
|
6746
|
-
/**
|
|
6747
|
-
* Provides a hook for centralized exception handling.
|
|
6748
|
-
*
|
|
6749
|
-
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
6750
|
-
* intercept error handling, write a custom exception handler that replaces this default as
|
|
6751
|
-
* appropriate for your app.
|
|
6752
|
-
*
|
|
6753
|
-
* @usageNotes
|
|
6754
|
-
* ### Example
|
|
6755
|
-
*
|
|
6756
|
-
* ```
|
|
6757
|
-
* class MyErrorHandler implements ErrorHandler {
|
|
6758
|
-
* handleError(error) {
|
|
6759
|
-
* // do something with the exception
|
|
6760
|
-
* }
|
|
6761
|
-
* }
|
|
6762
|
-
*
|
|
6763
|
-
* @NgModule({
|
|
6764
|
-
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
6765
|
-
* })
|
|
6766
|
-
* class MyModule {}
|
|
6767
|
-
* ```
|
|
6768
|
-
*
|
|
6769
|
-
* @publicApi
|
|
6770
|
-
*/
|
|
6771
|
-
class ErrorHandler {
|
|
6772
|
-
constructor() {
|
|
6773
|
-
/**
|
|
6774
|
-
* @internal
|
|
6775
|
-
*/
|
|
6776
|
-
this._console = console;
|
|
6777
|
-
}
|
|
6778
|
-
handleError(error) {
|
|
6779
|
-
const originalError = this._findOriginalError(error);
|
|
6780
|
-
// Note: Browser consoles show the place from where console.error was called.
|
|
6781
|
-
// We can use this to give users additional information about the error.
|
|
6782
|
-
const errorLogger = getErrorLogger(error);
|
|
6783
|
-
errorLogger(this._console, `ERROR`, error);
|
|
6784
|
-
if (originalError) {
|
|
6785
|
-
errorLogger(this._console, `ORIGINAL ERROR`, originalError);
|
|
6786
|
-
}
|
|
6787
|
-
}
|
|
6788
|
-
/** @internal */
|
|
6789
|
-
_findOriginalError(error) {
|
|
6790
|
-
let e = error && getOriginalError(error);
|
|
6791
|
-
while (e && getOriginalError(e)) {
|
|
6792
|
-
e = getOriginalError(e);
|
|
6793
|
-
}
|
|
6794
|
-
return e || null;
|
|
6795
|
-
}
|
|
6796
|
-
}
|
|
6797
|
-
|
|
6798
|
-
/**
|
|
6799
|
-
* @license
|
|
6800
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6801
|
-
*
|
|
6802
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6803
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6804
|
-
*/
|
|
6805
|
-
/**
|
|
6806
|
-
* Defines a schema that allows an NgModule to contain the following:
|
|
6807
|
-
* - Non-Angular elements named with dash case (`-`).
|
|
6808
|
-
* - Element properties named with dash case (`-`).
|
|
6809
|
-
* Dash case is the naming convention for custom elements.
|
|
6810
|
-
*
|
|
6811
|
-
* @publicApi
|
|
6812
|
-
*/
|
|
6813
|
-
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
6814
|
-
name: 'custom-elements'
|
|
6815
|
-
};
|
|
6816
|
-
/**
|
|
6817
|
-
* Defines a schema that allows any property on any element.
|
|
6818
|
-
*
|
|
6819
|
-
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
6820
|
-
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
6821
|
-
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
6822
|
-
*
|
|
6823
|
-
* @publicApi
|
|
6824
|
-
*/
|
|
6825
|
-
const NO_ERRORS_SCHEMA = {
|
|
6826
|
-
name: 'no-errors-schema'
|
|
6827
|
-
};
|
|
6828
|
-
|
|
6829
|
-
/**
|
|
6830
|
-
* @license
|
|
6831
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6832
|
-
*
|
|
6833
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6834
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6835
|
-
*/
|
|
6836
|
-
/**
|
|
6837
|
-
* Disallowed strings in the comment.
|
|
6838
|
-
*
|
|
6839
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6840
|
-
*/
|
|
6841
|
-
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
6842
|
-
/**
|
|
6843
|
-
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
6844
|
-
*/
|
|
6845
|
-
const COMMENT_DELIMITER = /(<|>)/;
|
|
6846
|
-
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
6847
|
-
/**
|
|
6848
|
-
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
6849
|
-
*
|
|
6850
|
-
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
6851
|
-
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
6852
|
-
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
6853
|
-
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
6854
|
-
*
|
|
6855
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
6856
|
-
*
|
|
6857
|
-
* ```
|
|
6858
|
-
* div.innerHTML = div.innerHTML
|
|
6859
|
-
* ```
|
|
6860
|
-
*
|
|
6861
|
-
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
6862
|
-
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
6863
|
-
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
6864
|
-
* may contain such text and expect them to be safe.)
|
|
6865
|
-
*
|
|
6866
|
-
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
6867
|
-
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
6868
|
-
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
6869
|
-
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
6870
|
-
*
|
|
6871
|
-
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
6872
|
-
* sequence.
|
|
6873
|
-
*/
|
|
6874
|
-
function escapeCommentText(value) {
|
|
6875
|
-
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
6876
|
-
}
|
|
6877
|
-
|
|
6878
|
-
/**
|
|
6879
|
-
* @license
|
|
6880
|
-
* Copyright Google LLC All Rights Reserved.
|
|
6881
|
-
*
|
|
6882
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6883
|
-
* found in the LICENSE file at https://angular.io/license
|
|
6884
|
-
*/
|
|
6885
|
-
function normalizeDebugBindingName(name) {
|
|
6886
|
-
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
6887
|
-
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
6888
|
-
return `ng-reflect-${name}`;
|
|
6835
|
+
return EMPTY_ARRAY;
|
|
6836
|
+
const directiveEndIndex = tNode.directiveEnd;
|
|
6837
|
+
if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
6838
|
+
directiveStartIndex++;
|
|
6839
|
+
return lView.slice(directiveStartIndex, directiveEndIndex);
|
|
6889
6840
|
}
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6841
|
+
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
6842
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6843
|
+
let directiveStartIndex = tNode.directiveStart;
|
|
6844
|
+
return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
|
|
6893
6845
|
}
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6846
|
+
/**
|
|
6847
|
+
* Returns a map of local references (local reference name => element or directive instance) that
|
|
6848
|
+
* exist on a given element.
|
|
6849
|
+
*/
|
|
6850
|
+
function discoverLocalRefs(lView, nodeIndex) {
|
|
6851
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
6852
|
+
if (tNode && tNode.localNames) {
|
|
6853
|
+
const result = {};
|
|
6854
|
+
let localIndex = tNode.index + 1;
|
|
6855
|
+
for (let i = 0; i < tNode.localNames.length; i += 2) {
|
|
6856
|
+
result[tNode.localNames[i]] = lView[localIndex];
|
|
6857
|
+
localIndex++;
|
|
6858
|
+
}
|
|
6859
|
+
return result;
|
|
6901
6860
|
}
|
|
6861
|
+
return null;
|
|
6902
6862
|
}
|
|
6903
6863
|
|
|
6904
6864
|
/**
|
|
@@ -10340,113 +10300,403 @@ class ReflectiveInjector_ {
|
|
|
10340
10300
|
return this.objs[i];
|
|
10341
10301
|
}
|
|
10342
10302
|
}
|
|
10343
|
-
return UNDEFINED;
|
|
10303
|
+
return UNDEFINED;
|
|
10304
|
+
}
|
|
10305
|
+
/** @internal */
|
|
10306
|
+
_throwOrNull(key, notFoundValue) {
|
|
10307
|
+
if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
|
10308
|
+
return notFoundValue;
|
|
10309
|
+
}
|
|
10310
|
+
else {
|
|
10311
|
+
throw noProviderError(this, key);
|
|
10312
|
+
}
|
|
10313
|
+
}
|
|
10314
|
+
/** @internal */
|
|
10315
|
+
_getByKeySelf(key, notFoundValue) {
|
|
10316
|
+
const obj = this._getObjByKeyId(key.id);
|
|
10317
|
+
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
|
10318
|
+
}
|
|
10319
|
+
/** @internal */
|
|
10320
|
+
_getByKeyDefault(key, notFoundValue, visibility) {
|
|
10321
|
+
let inj;
|
|
10322
|
+
if (visibility instanceof SkipSelf) {
|
|
10323
|
+
inj = this.parent;
|
|
10324
|
+
}
|
|
10325
|
+
else {
|
|
10326
|
+
inj = this;
|
|
10327
|
+
}
|
|
10328
|
+
while (inj instanceof ReflectiveInjector_) {
|
|
10329
|
+
const inj_ = inj;
|
|
10330
|
+
const obj = inj_._getObjByKeyId(key.id);
|
|
10331
|
+
if (obj !== UNDEFINED)
|
|
10332
|
+
return obj;
|
|
10333
|
+
inj = inj_.parent;
|
|
10334
|
+
}
|
|
10335
|
+
if (inj !== null) {
|
|
10336
|
+
return inj.get(key.token, notFoundValue);
|
|
10337
|
+
}
|
|
10338
|
+
else {
|
|
10339
|
+
return this._throwOrNull(key, notFoundValue);
|
|
10340
|
+
}
|
|
10341
|
+
}
|
|
10342
|
+
get displayName() {
|
|
10343
|
+
const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
|
|
10344
|
+
.join(', ');
|
|
10345
|
+
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10346
|
+
}
|
|
10347
|
+
toString() {
|
|
10348
|
+
return this.displayName;
|
|
10349
|
+
}
|
|
10350
|
+
}
|
|
10351
|
+
ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
|
|
10352
|
+
function _mapProviders(injector, fn) {
|
|
10353
|
+
const res = [];
|
|
10354
|
+
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10355
|
+
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10356
|
+
}
|
|
10357
|
+
return res;
|
|
10358
|
+
}
|
|
10359
|
+
|
|
10360
|
+
/**
|
|
10361
|
+
* @license
|
|
10362
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10363
|
+
*
|
|
10364
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10365
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10366
|
+
*/
|
|
10367
|
+
|
|
10368
|
+
/**
|
|
10369
|
+
* @license
|
|
10370
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10371
|
+
*
|
|
10372
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10373
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10374
|
+
*/
|
|
10375
|
+
|
|
10376
|
+
/**
|
|
10377
|
+
* @license
|
|
10378
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10379
|
+
*
|
|
10380
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10381
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10382
|
+
*/
|
|
10383
|
+
function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
|
10384
|
+
const lView = getLView();
|
|
10385
|
+
// Fall back to inject() if view hasn't been created. This situation can happen in tests
|
|
10386
|
+
// if inject utilities are used before bootstrapping.
|
|
10387
|
+
if (lView === null) {
|
|
10388
|
+
// Verify that we will not get into infinite loop.
|
|
10389
|
+
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10390
|
+
return ɵɵinject(token, flags);
|
|
10391
|
+
}
|
|
10392
|
+
const tNode = getCurrentTNode();
|
|
10393
|
+
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10394
|
+
}
|
|
10395
|
+
/**
|
|
10396
|
+
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
10397
|
+
* particular class.
|
|
10398
|
+
*
|
|
10399
|
+
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10400
|
+
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10401
|
+
*
|
|
10402
|
+
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
10403
|
+
* and thus in the stack trace.
|
|
10404
|
+
*
|
|
10405
|
+
* @codeGenApi
|
|
10406
|
+
*/
|
|
10407
|
+
function ɵɵinvalidFactory() {
|
|
10408
|
+
const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
|
|
10409
|
+
throw new Error(msg);
|
|
10410
|
+
}
|
|
10411
|
+
|
|
10412
|
+
/**
|
|
10413
|
+
* @license
|
|
10414
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10415
|
+
*
|
|
10416
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10417
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10418
|
+
*/
|
|
10419
|
+
/**
|
|
10420
|
+
* Defines a schema that allows an NgModule to contain the following:
|
|
10421
|
+
* - Non-Angular elements named with dash case (`-`).
|
|
10422
|
+
* - Element properties named with dash case (`-`).
|
|
10423
|
+
* Dash case is the naming convention for custom elements.
|
|
10424
|
+
*
|
|
10425
|
+
* @publicApi
|
|
10426
|
+
*/
|
|
10427
|
+
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
10428
|
+
name: 'custom-elements'
|
|
10429
|
+
};
|
|
10430
|
+
/**
|
|
10431
|
+
* Defines a schema that allows any property on any element.
|
|
10432
|
+
*
|
|
10433
|
+
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
10434
|
+
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
10435
|
+
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
10436
|
+
*
|
|
10437
|
+
* @publicApi
|
|
10438
|
+
*/
|
|
10439
|
+
const NO_ERRORS_SCHEMA = {
|
|
10440
|
+
name: 'no-errors-schema'
|
|
10441
|
+
};
|
|
10442
|
+
|
|
10443
|
+
/**
|
|
10444
|
+
* @license
|
|
10445
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10446
|
+
*
|
|
10447
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10448
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10449
|
+
*/
|
|
10450
|
+
let shouldThrowErrorOnUnknownElement = false;
|
|
10451
|
+
/**
|
|
10452
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
10453
|
+
* instead of just logging the error.
|
|
10454
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10455
|
+
*/
|
|
10456
|
+
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
10457
|
+
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
10458
|
+
}
|
|
10459
|
+
/**
|
|
10460
|
+
* Gets the current value of the strict mode.
|
|
10461
|
+
*/
|
|
10462
|
+
function ɵgetUnknownElementStrictMode() {
|
|
10463
|
+
return shouldThrowErrorOnUnknownElement;
|
|
10464
|
+
}
|
|
10465
|
+
let shouldThrowErrorOnUnknownProperty = false;
|
|
10466
|
+
/**
|
|
10467
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
10468
|
+
* instead of just logging the error.
|
|
10469
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
10470
|
+
*/
|
|
10471
|
+
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
10472
|
+
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
10473
|
+
}
|
|
10474
|
+
/**
|
|
10475
|
+
* Gets the current value of the strict mode.
|
|
10476
|
+
*/
|
|
10477
|
+
function ɵgetUnknownPropertyStrictMode() {
|
|
10478
|
+
return shouldThrowErrorOnUnknownProperty;
|
|
10479
|
+
}
|
|
10480
|
+
/**
|
|
10481
|
+
* Validates that the element is known at runtime and produces
|
|
10482
|
+
* an error if it's not the case.
|
|
10483
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10484
|
+
* ones this check happens at build time).
|
|
10485
|
+
*
|
|
10486
|
+
* The element is considered known if either:
|
|
10487
|
+
* - it's a known HTML element
|
|
10488
|
+
* - it's a known custom element
|
|
10489
|
+
* - the element matches any directive
|
|
10490
|
+
* - the element is allowed by one of the schemas
|
|
10491
|
+
*
|
|
10492
|
+
* @param element Element to validate
|
|
10493
|
+
* @param lView An `LView` that represents a current component that is being rendered
|
|
10494
|
+
* @param tagName Name of the tag to check
|
|
10495
|
+
* @param schemas Array of schemas
|
|
10496
|
+
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
10497
|
+
*/
|
|
10498
|
+
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
10499
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10500
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10501
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10502
|
+
// execute the check below.
|
|
10503
|
+
if (schemas === null)
|
|
10504
|
+
return;
|
|
10505
|
+
// If the element matches any directive, it's considered as valid.
|
|
10506
|
+
if (!hasDirectives && tagName !== null) {
|
|
10507
|
+
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
10508
|
+
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
10509
|
+
// of HTMLUnknownElement in browsers that support web components.
|
|
10510
|
+
const isUnknown =
|
|
10511
|
+
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
10512
|
+
// because while most browsers return 'function', IE returns 'object'.
|
|
10513
|
+
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
10514
|
+
element instanceof HTMLUnknownElement) ||
|
|
10515
|
+
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
10516
|
+
!customElements.get(tagName));
|
|
10517
|
+
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
10518
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10519
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10520
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10521
|
+
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
10522
|
+
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
10523
|
+
'a part of an @NgModule where this component is declared'}.\n`;
|
|
10524
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10525
|
+
message +=
|
|
10526
|
+
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
10527
|
+
}
|
|
10528
|
+
else {
|
|
10529
|
+
message +=
|
|
10530
|
+
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
10531
|
+
}
|
|
10532
|
+
if (shouldThrowErrorOnUnknownElement) {
|
|
10533
|
+
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
10534
|
+
}
|
|
10535
|
+
else {
|
|
10536
|
+
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
10537
|
+
}
|
|
10538
|
+
}
|
|
10344
10539
|
}
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10540
|
+
}
|
|
10541
|
+
/**
|
|
10542
|
+
* Validates that the property of the element is known at runtime and returns
|
|
10543
|
+
* false if it's not the case.
|
|
10544
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
10545
|
+
* ones this check happens at build time).
|
|
10546
|
+
*
|
|
10547
|
+
* The property is considered known if either:
|
|
10548
|
+
* - it's a known property of the element
|
|
10549
|
+
* - the element is allowed by one of the schemas
|
|
10550
|
+
* - the property is used for animations
|
|
10551
|
+
*
|
|
10552
|
+
* @param element Element to validate
|
|
10553
|
+
* @param propName Name of the property to check
|
|
10554
|
+
* @param tagName Name of the tag hosting the property
|
|
10555
|
+
* @param schemas Array of schemas
|
|
10556
|
+
*/
|
|
10557
|
+
function isPropertyValid(element, propName, tagName, schemas) {
|
|
10558
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
10559
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
10560
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
10561
|
+
// execute the check below.
|
|
10562
|
+
if (schemas === null)
|
|
10563
|
+
return true;
|
|
10564
|
+
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
10565
|
+
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
10566
|
+
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
10567
|
+
return true;
|
|
10353
10568
|
}
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10569
|
+
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
10570
|
+
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
10571
|
+
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
10572
|
+
}
|
|
10573
|
+
/**
|
|
10574
|
+
* Logs or throws an error that a property is not supported on an element.
|
|
10575
|
+
*
|
|
10576
|
+
* @param propName Name of the invalid property
|
|
10577
|
+
* @param tagName Name of the tag hosting the property
|
|
10578
|
+
* @param nodeType Type of the node hosting the property
|
|
10579
|
+
* @param lView An `LView` that represents a current component
|
|
10580
|
+
*/
|
|
10581
|
+
function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
|
|
10582
|
+
// Special-case a situation when a structural directive is applied to
|
|
10583
|
+
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
10584
|
+
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
10585
|
+
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
10586
|
+
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
10587
|
+
// a default value of the `tNode.value` is not feasible at this moment.
|
|
10588
|
+
if (!tagName && nodeType === 4 /* TNodeType.Container */) {
|
|
10589
|
+
tagName = 'ng-template';
|
|
10358
10590
|
}
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
}
|
|
10375
|
-
|
|
10376
|
-
|
|
10591
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
10592
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
10593
|
+
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
10594
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
10595
|
+
const importLocation = isHostStandalone ?
|
|
10596
|
+
'included in the \'@Component.imports\' of this component' :
|
|
10597
|
+
'a part of an @NgModule where this component is declared';
|
|
10598
|
+
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
10599
|
+
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
10600
|
+
// a template, but the `CommonModule` is not imported.
|
|
10601
|
+
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
10602
|
+
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
10603
|
+
}
|
|
10604
|
+
else {
|
|
10605
|
+
// May be an Angular component, which is not imported/declared?
|
|
10606
|
+
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
10607
|
+
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
10608
|
+
// May be a Web Component?
|
|
10609
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
10610
|
+
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
10611
|
+
`to the ${schemas} of this component to suppress this message.`;
|
|
10612
|
+
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10613
|
+
`the ${schemas} of this component.`;
|
|
10377
10614
|
}
|
|
10378
10615
|
else {
|
|
10379
|
-
|
|
10616
|
+
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
10617
|
+
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
10618
|
+
`the ${schemas} of this component.`;
|
|
10380
10619
|
}
|
|
10381
10620
|
}
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
.join(', ');
|
|
10385
|
-
return `ReflectiveInjector(providers: [${providers}])`;
|
|
10386
|
-
}
|
|
10387
|
-
toString() {
|
|
10388
|
-
return this.displayName;
|
|
10621
|
+
if (shouldThrowErrorOnUnknownProperty) {
|
|
10622
|
+
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
10389
10623
|
}
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
function _mapProviders(injector, fn) {
|
|
10393
|
-
const res = [];
|
|
10394
|
-
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10395
|
-
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10624
|
+
else {
|
|
10625
|
+
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
10396
10626
|
}
|
|
10397
|
-
return res;
|
|
10398
10627
|
}
|
|
10399
|
-
|
|
10400
10628
|
/**
|
|
10401
|
-
*
|
|
10402
|
-
*
|
|
10629
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10630
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10631
|
+
* be too slow for production mode and also it relies on the constructor function being available.
|
|
10403
10632
|
*
|
|
10404
|
-
*
|
|
10405
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10406
|
-
*/
|
|
10407
|
-
|
|
10408
|
-
/**
|
|
10409
|
-
* @license
|
|
10410
|
-
* Copyright Google LLC All Rights Reserved.
|
|
10633
|
+
* Gets a reference to the host component def (where a current component is declared).
|
|
10411
10634
|
*
|
|
10412
|
-
*
|
|
10413
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10635
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10414
10636
|
*/
|
|
10415
|
-
|
|
10637
|
+
function getDeclarationComponentDef(lView) {
|
|
10638
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10639
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
10640
|
+
const context = declarationLView[CONTEXT];
|
|
10641
|
+
// Unable to obtain a context.
|
|
10642
|
+
if (!context)
|
|
10643
|
+
return null;
|
|
10644
|
+
return context.constructor ? getComponentDef(context.constructor) : null;
|
|
10645
|
+
}
|
|
10416
10646
|
/**
|
|
10417
|
-
*
|
|
10418
|
-
*
|
|
10647
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10648
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10649
|
+
* be too slow for production mode.
|
|
10419
10650
|
*
|
|
10420
|
-
*
|
|
10421
|
-
*
|
|
10651
|
+
* Checks if the current component is declared inside of a standalone component template.
|
|
10652
|
+
*
|
|
10653
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10422
10654
|
*/
|
|
10423
|
-
function
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
// if
|
|
10427
|
-
|
|
10428
|
-
// Verify that we will not get into infinite loop.
|
|
10429
|
-
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10430
|
-
return ɵɵinject(token, flags);
|
|
10431
|
-
}
|
|
10432
|
-
const tNode = getCurrentTNode();
|
|
10433
|
-
return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
|
10655
|
+
function isHostComponentStandalone(lView) {
|
|
10656
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10657
|
+
const componentDef = getDeclarationComponentDef(lView);
|
|
10658
|
+
// Treat host component as non-standalone if we can't obtain the def.
|
|
10659
|
+
return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
|
|
10434
10660
|
}
|
|
10435
10661
|
/**
|
|
10436
|
-
*
|
|
10437
|
-
*
|
|
10438
|
-
*
|
|
10439
|
-
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10440
|
-
* off, saving bytes of generated code while still providing a good experience in dev mode.
|
|
10662
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
10663
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
10664
|
+
* be too slow for production mode.
|
|
10441
10665
|
*
|
|
10442
|
-
*
|
|
10443
|
-
*
|
|
10666
|
+
* Constructs a string describing the location of the host component template. The function is used
|
|
10667
|
+
* in dev mode to produce error messages.
|
|
10444
10668
|
*
|
|
10445
|
-
* @
|
|
10669
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10446
10670
|
*/
|
|
10447
|
-
function
|
|
10448
|
-
|
|
10449
|
-
|
|
10671
|
+
function getTemplateLocationDetails(lView) {
|
|
10672
|
+
var _a;
|
|
10673
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
10674
|
+
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
10675
|
+
const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
|
|
10676
|
+
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
10677
|
+
}
|
|
10678
|
+
/**
|
|
10679
|
+
* The set of known control flow directives.
|
|
10680
|
+
* We use this set to produce a more precises error message with a note
|
|
10681
|
+
* that the `CommonModule` should also be included.
|
|
10682
|
+
*/
|
|
10683
|
+
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
10684
|
+
/**
|
|
10685
|
+
* Returns true if the tag name is allowed by specified schemas.
|
|
10686
|
+
* @param schemas Array of schemas
|
|
10687
|
+
* @param tagName Name of the tag
|
|
10688
|
+
*/
|
|
10689
|
+
function matchingSchemas(schemas, tagName) {
|
|
10690
|
+
if (schemas !== null) {
|
|
10691
|
+
for (let i = 0; i < schemas.length; i++) {
|
|
10692
|
+
const schema = schemas[i];
|
|
10693
|
+
if (schema === NO_ERRORS_SCHEMA ||
|
|
10694
|
+
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
10695
|
+
return true;
|
|
10696
|
+
}
|
|
10697
|
+
}
|
|
10698
|
+
}
|
|
10699
|
+
return false;
|
|
10450
10700
|
}
|
|
10451
10701
|
|
|
10452
10702
|
/**
|
|
@@ -11242,34 +11492,19 @@ class LContainerDebug {
|
|
|
11242
11492
|
return toDebug(this._raw_lContainer[PARENT]);
|
|
11243
11493
|
}
|
|
11244
11494
|
get movedViews() {
|
|
11245
|
-
return this._raw_lContainer[MOVED_VIEWS];
|
|
11246
|
-
}
|
|
11247
|
-
get host() {
|
|
11248
|
-
return this._raw_lContainer[HOST];
|
|
11249
|
-
}
|
|
11250
|
-
get native() {
|
|
11251
|
-
return this._raw_lContainer[NATIVE];
|
|
11252
|
-
}
|
|
11253
|
-
get next() {
|
|
11254
|
-
return toDebug(this._raw_lContainer[NEXT]);
|
|
11255
|
-
}
|
|
11256
|
-
}
|
|
11257
|
-
|
|
11258
|
-
let shouldThrowErrorOnUnknownProperty = false;
|
|
11259
|
-
/**
|
|
11260
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
11261
|
-
* instead of just logging the error.
|
|
11262
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
11263
|
-
*/
|
|
11264
|
-
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
11265
|
-
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
11266
|
-
}
|
|
11267
|
-
/**
|
|
11268
|
-
* Gets the current value of the strict mode.
|
|
11269
|
-
*/
|
|
11270
|
-
function ɵgetUnknownPropertyStrictMode() {
|
|
11271
|
-
return shouldThrowErrorOnUnknownProperty;
|
|
11495
|
+
return this._raw_lContainer[MOVED_VIEWS];
|
|
11496
|
+
}
|
|
11497
|
+
get host() {
|
|
11498
|
+
return this._raw_lContainer[HOST];
|
|
11499
|
+
}
|
|
11500
|
+
get native() {
|
|
11501
|
+
return this._raw_lContainer[NATIVE];
|
|
11502
|
+
}
|
|
11503
|
+
get next() {
|
|
11504
|
+
return toDebug(this._raw_lContainer[NEXT]);
|
|
11505
|
+
}
|
|
11272
11506
|
}
|
|
11507
|
+
|
|
11273
11508
|
/**
|
|
11274
11509
|
* A permanent marker promise which signifies that the current CD tree is
|
|
11275
11510
|
* clean.
|
|
@@ -11428,56 +11663,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
|
|
|
11428
11663
|
}
|
|
11429
11664
|
return tNode;
|
|
11430
11665
|
}
|
|
11431
|
-
/**
|
|
11432
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11433
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11434
|
-
* be too slow for production mode and also it relies on the constructor function being available.
|
|
11435
|
-
*
|
|
11436
|
-
* Gets a reference to the host component def (where a current component is declared).
|
|
11437
|
-
*
|
|
11438
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11439
|
-
*/
|
|
11440
|
-
function getDeclarationComponentDef(lView) {
|
|
11441
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11442
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
11443
|
-
const context = declarationLView[CONTEXT];
|
|
11444
|
-
// Unable to obtain a context.
|
|
11445
|
-
if (!context)
|
|
11446
|
-
return null;
|
|
11447
|
-
return context.constructor ? getComponentDef(context.constructor) : null;
|
|
11448
|
-
}
|
|
11449
|
-
/**
|
|
11450
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11451
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11452
|
-
* be too slow for production mode.
|
|
11453
|
-
*
|
|
11454
|
-
* Checks if the current component is declared inside of a standalone component template.
|
|
11455
|
-
*
|
|
11456
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11457
|
-
*/
|
|
11458
|
-
function isHostComponentStandalone(lView) {
|
|
11459
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11460
|
-
const componentDef = getDeclarationComponentDef(lView);
|
|
11461
|
-
// Treat host component as non-standalone if we can't obtain the def.
|
|
11462
|
-
return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
|
|
11463
|
-
}
|
|
11464
|
-
/**
|
|
11465
|
-
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
11466
|
-
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
11467
|
-
* be too slow for production mode.
|
|
11468
|
-
*
|
|
11469
|
-
* Constructs a string describing the location of the host component template. The function is used
|
|
11470
|
-
* in dev mode to produce error messages.
|
|
11471
|
-
*
|
|
11472
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11473
|
-
*/
|
|
11474
|
-
function getTemplateLocationDetails(lView) {
|
|
11475
|
-
var _a;
|
|
11476
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11477
|
-
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
11478
|
-
const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
|
|
11479
|
-
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
11480
|
-
}
|
|
11481
11666
|
/**
|
|
11482
11667
|
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
11483
11668
|
* i18nApply()), we need to adjust the blueprint for future
|
|
@@ -12144,10 +12329,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12144
12329
|
propName = mapPropName(propName);
|
|
12145
12330
|
if (ngDevMode) {
|
|
12146
12331
|
validateAgainstEventProperties(propName);
|
|
12147
|
-
if (!
|
|
12148
|
-
|
|
12149
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12150
|
-
return;
|
|
12332
|
+
if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
|
|
12333
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12151
12334
|
}
|
|
12152
12335
|
ngDevMode.rendererSetProperty++;
|
|
12153
12336
|
}
|
|
@@ -12166,7 +12349,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12166
12349
|
// If the node is a container and the property didn't
|
|
12167
12350
|
// match any of the inputs or schemas we should throw.
|
|
12168
12351
|
if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
|
|
12169
|
-
handleUnknownPropertyError(propName, tNode, lView);
|
|
12352
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12170
12353
|
}
|
|
12171
12354
|
}
|
|
12172
12355
|
}
|
|
@@ -12218,116 +12401,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
|
|
|
12218
12401
|
}
|
|
12219
12402
|
}
|
|
12220
12403
|
}
|
|
12221
|
-
/**
|
|
12222
|
-
* Validates that the property of the element is known at runtime and returns
|
|
12223
|
-
* false if it's not the case.
|
|
12224
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
12225
|
-
* ones this check happens at build time).
|
|
12226
|
-
*
|
|
12227
|
-
* The property is considered known if either:
|
|
12228
|
-
* - it's a known property of the element
|
|
12229
|
-
* - the element is allowed by one of the schemas
|
|
12230
|
-
* - the property is used for animations
|
|
12231
|
-
*
|
|
12232
|
-
* @param element Element to validate
|
|
12233
|
-
* @param tagName Name of the tag to check
|
|
12234
|
-
* @param propName Name of the property to check
|
|
12235
|
-
* @param schemas Array of schemas
|
|
12236
|
-
*/
|
|
12237
|
-
function validateProperty(element, tagName, propName, schemas) {
|
|
12238
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
12239
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
12240
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
12241
|
-
// execute the check below.
|
|
12242
|
-
if (schemas === null)
|
|
12243
|
-
return true;
|
|
12244
|
-
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
12245
|
-
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
12246
|
-
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
12247
|
-
return true;
|
|
12248
|
-
}
|
|
12249
|
-
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
12250
|
-
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
12251
|
-
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
12252
|
-
}
|
|
12253
|
-
/**
|
|
12254
|
-
* Returns true if the tag name is allowed by specified schemas.
|
|
12255
|
-
* @param schemas Array of schemas
|
|
12256
|
-
* @param tagName Name of the tag
|
|
12257
|
-
*/
|
|
12258
|
-
function matchingSchemas(schemas, tagName) {
|
|
12259
|
-
if (schemas !== null) {
|
|
12260
|
-
for (let i = 0; i < schemas.length; i++) {
|
|
12261
|
-
const schema = schemas[i];
|
|
12262
|
-
if (schema === NO_ERRORS_SCHEMA ||
|
|
12263
|
-
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
12264
|
-
return true;
|
|
12265
|
-
}
|
|
12266
|
-
}
|
|
12267
|
-
}
|
|
12268
|
-
return false;
|
|
12269
|
-
}
|
|
12270
|
-
/**
|
|
12271
|
-
* The set of known control flow directives.
|
|
12272
|
-
* We use this set to produce a more precises error message with a note
|
|
12273
|
-
* that the `CommonModule` should also be included.
|
|
12274
|
-
*/
|
|
12275
|
-
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
|
|
12276
|
-
/**
|
|
12277
|
-
* Logs or throws an error that a property is not supported on an element.
|
|
12278
|
-
*
|
|
12279
|
-
* @param propName Name of the invalid property.
|
|
12280
|
-
* @param tNode A `TNode` that represents a current component that is being rendered.
|
|
12281
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
12282
|
-
*/
|
|
12283
|
-
function handleUnknownPropertyError(propName, tNode, lView) {
|
|
12284
|
-
let tagName = tNode.value;
|
|
12285
|
-
// Special-case a situation when a structural directive is applied to
|
|
12286
|
-
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
12287
|
-
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
12288
|
-
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
12289
|
-
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
12290
|
-
// a default value of the `tNode.value` is not feasible at this moment.
|
|
12291
|
-
if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
|
|
12292
|
-
tagName = 'ng-template';
|
|
12293
|
-
}
|
|
12294
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
12295
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
12296
|
-
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
12297
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
12298
|
-
const importLocation = isHostStandalone ?
|
|
12299
|
-
'included in the \'@Component.imports\' of this component' :
|
|
12300
|
-
'a part of an @NgModule where this component is declared';
|
|
12301
|
-
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
12302
|
-
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
12303
|
-
// a template, but the `CommonModule` is not imported.
|
|
12304
|
-
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
12305
|
-
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
12306
|
-
}
|
|
12307
|
-
else {
|
|
12308
|
-
// May be an Angular component, which is not imported/declared?
|
|
12309
|
-
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
12310
|
-
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
12311
|
-
// May be a Web Component?
|
|
12312
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
12313
|
-
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
12314
|
-
`to the ${schemas} of this component to suppress this message.`;
|
|
12315
|
-
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12316
|
-
`the ${schemas} of this component.`;
|
|
12317
|
-
}
|
|
12318
|
-
else {
|
|
12319
|
-
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
12320
|
-
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
12321
|
-
`the ${schemas} of this component.`;
|
|
12322
|
-
}
|
|
12323
|
-
}
|
|
12324
|
-
if (shouldThrowErrorOnUnknownProperty) {
|
|
12325
|
-
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
12326
|
-
}
|
|
12327
|
-
else {
|
|
12328
|
-
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
12329
|
-
}
|
|
12330
|
-
}
|
|
12331
12404
|
/**
|
|
12332
12405
|
* Instantiate a root component.
|
|
12333
12406
|
*/
|
|
@@ -13901,7 +13974,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
13901
13974
|
const component = instantiateRootComponent(tView, rootLView, componentDef);
|
|
13902
13975
|
rootContext.components.push(component);
|
|
13903
13976
|
componentView[CONTEXT] = component;
|
|
13904
|
-
hostFeatures
|
|
13977
|
+
if (hostFeatures !== null) {
|
|
13978
|
+
for (const feature of hostFeatures) {
|
|
13979
|
+
feature(component, componentDef);
|
|
13980
|
+
}
|
|
13981
|
+
}
|
|
13905
13982
|
// We want to generate an empty QueryList for root content queries for backwards
|
|
13906
13983
|
// compatibility with ViewEngine.
|
|
13907
13984
|
if (componentDef.contentQueries) {
|
|
@@ -13942,13 +14019,10 @@ function createRootContext(scheduler, playerHandler) {
|
|
|
13942
14019
|
* renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
|
|
13943
14020
|
* ```
|
|
13944
14021
|
*/
|
|
13945
|
-
function LifecycleHooksFeature(
|
|
13946
|
-
const lView = readPatchedLView(component);
|
|
13947
|
-
ngDevMode && assertDefined(lView, 'LView is required');
|
|
13948
|
-
const tView = lView[TVIEW];
|
|
14022
|
+
function LifecycleHooksFeature() {
|
|
13949
14023
|
const tNode = getCurrentTNode();
|
|
13950
14024
|
ngDevMode && assertDefined(tNode, 'TNode is required');
|
|
13951
|
-
registerPostOrderHooks(
|
|
14025
|
+
registerPostOrderHooks(getLView()[TVIEW], tNode);
|
|
13952
14026
|
}
|
|
13953
14027
|
/**
|
|
13954
14028
|
* Wait on component until it is rendered.
|
|
@@ -15083,21 +15157,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
|
|
|
15083
15157
|
* Use of this source code is governed by an MIT-style license that can be
|
|
15084
15158
|
* found in the LICENSE file at https://angular.io/license
|
|
15085
15159
|
*/
|
|
15086
|
-
let shouldThrowErrorOnUnknownElement = false;
|
|
15087
|
-
/**
|
|
15088
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
15089
|
-
* instead of just logging the error.
|
|
15090
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
15091
|
-
*/
|
|
15092
|
-
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
15093
|
-
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
15094
|
-
}
|
|
15095
|
-
/**
|
|
15096
|
-
* Gets the current value of the strict mode.
|
|
15097
|
-
*/
|
|
15098
|
-
function ɵgetUnknownElementStrictMode() {
|
|
15099
|
-
return shouldThrowErrorOnUnknownElement;
|
|
15100
|
-
}
|
|
15101
15160
|
function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
|
|
15102
15161
|
ngDevMode && assertFirstCreatePass(tView);
|
|
15103
15162
|
ngDevMode && ngDevMode.firstCreatePass++;
|
|
@@ -15231,67 +15290,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
15231
15290
|
ɵɵelementEnd();
|
|
15232
15291
|
return ɵɵelement;
|
|
15233
15292
|
}
|
|
15234
|
-
/**
|
|
15235
|
-
* Validates that the element is known at runtime and produces
|
|
15236
|
-
* an error if it's not the case.
|
|
15237
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
15238
|
-
* ones this check happens at build time).
|
|
15239
|
-
*
|
|
15240
|
-
* The element is considered known if either:
|
|
15241
|
-
* - it's a known HTML element
|
|
15242
|
-
* - it's a known custom element
|
|
15243
|
-
* - the element matches any directive
|
|
15244
|
-
* - the element is allowed by one of the schemas
|
|
15245
|
-
*
|
|
15246
|
-
* @param element Element to validate
|
|
15247
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
15248
|
-
* @param tagName Name of the tag to check
|
|
15249
|
-
* @param schemas Array of schemas
|
|
15250
|
-
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
15251
|
-
*/
|
|
15252
|
-
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
15253
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
15254
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
15255
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
15256
|
-
// execute the check below.
|
|
15257
|
-
if (schemas === null)
|
|
15258
|
-
return;
|
|
15259
|
-
// If the element matches any directive, it's considered as valid.
|
|
15260
|
-
if (!hasDirectives && tagName !== null) {
|
|
15261
|
-
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
15262
|
-
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
15263
|
-
// of HTMLUnknownElement in browsers that support web components.
|
|
15264
|
-
const isUnknown =
|
|
15265
|
-
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
15266
|
-
// because while most browsers return 'function', IE returns 'object'.
|
|
15267
|
-
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
15268
|
-
element instanceof HTMLUnknownElement) ||
|
|
15269
|
-
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
15270
|
-
!customElements.get(tagName));
|
|
15271
|
-
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
15272
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
15273
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
15274
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
15275
|
-
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
15276
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
15277
|
-
'a part of an @NgModule where this component is declared'}.\n`;
|
|
15278
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
15279
|
-
message +=
|
|
15280
|
-
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
15281
|
-
}
|
|
15282
|
-
else {
|
|
15283
|
-
message +=
|
|
15284
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
15285
|
-
}
|
|
15286
|
-
if (shouldThrowErrorOnUnknownElement) {
|
|
15287
|
-
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
15288
|
-
}
|
|
15289
|
-
else {
|
|
15290
|
-
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
15291
|
-
}
|
|
15292
|
-
}
|
|
15293
|
-
}
|
|
15294
|
-
}
|
|
15295
15293
|
|
|
15296
15294
|
/**
|
|
15297
15295
|
* @license
|
|
@@ -21774,7 +21772,7 @@ class Version {
|
|
|
21774
21772
|
/**
|
|
21775
21773
|
* @publicApi
|
|
21776
21774
|
*/
|
|
21777
|
-
const VERSION = new Version('14.0.
|
|
21775
|
+
const VERSION = new Version('14.0.1');
|
|
21778
21776
|
|
|
21779
21777
|
/**
|
|
21780
21778
|
* @license
|
|
@@ -22474,14 +22472,14 @@ class StandaloneService {
|
|
|
22474
22472
|
if (!componentDef.standalone) {
|
|
22475
22473
|
return null;
|
|
22476
22474
|
}
|
|
22477
|
-
if (!this.cachedInjectors.has(componentDef)) {
|
|
22475
|
+
if (!this.cachedInjectors.has(componentDef.id)) {
|
|
22478
22476
|
const providers = internalImportProvidersFrom(false, componentDef.type);
|
|
22479
22477
|
const standaloneInjector = providers.length > 0 ?
|
|
22480
22478
|
createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
|
|
22481
22479
|
null;
|
|
22482
|
-
this.cachedInjectors.set(componentDef, standaloneInjector);
|
|
22480
|
+
this.cachedInjectors.set(componentDef.id, standaloneInjector);
|
|
22483
22481
|
}
|
|
22484
|
-
return this.cachedInjectors.get(componentDef);
|
|
22482
|
+
return this.cachedInjectors.get(componentDef.id);
|
|
22485
22483
|
}
|
|
22486
22484
|
ngOnDestroy() {
|
|
22487
22485
|
try {
|
|
@@ -22981,13 +22979,26 @@ function getPipeDef(name, registry) {
|
|
|
22981
22979
|
}
|
|
22982
22980
|
}
|
|
22983
22981
|
if (ngDevMode) {
|
|
22984
|
-
|
|
22985
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
22986
|
-
const context = declarationLView[CONTEXT];
|
|
22987
|
-
const component = context ? ` in the '${context.constructor.name}' component` : '';
|
|
22988
|
-
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
|
|
22982
|
+
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
|
|
22989
22983
|
}
|
|
22990
22984
|
}
|
|
22985
|
+
/**
|
|
22986
|
+
* Generates a helpful error message for the user when a pipe is not found.
|
|
22987
|
+
*
|
|
22988
|
+
* @param name Name of the missing pipe
|
|
22989
|
+
* @returns The error message
|
|
22990
|
+
*/
|
|
22991
|
+
function getPipeNotFoundErrorMessage(name) {
|
|
22992
|
+
const lView = getLView();
|
|
22993
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
22994
|
+
const context = declarationLView[CONTEXT];
|
|
22995
|
+
const hostIsStandalone = isHostComponentStandalone(lView);
|
|
22996
|
+
const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
|
|
22997
|
+
const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
22998
|
+
'declared or imported in this module'}`;
|
|
22999
|
+
const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
|
|
23000
|
+
return errorMessage;
|
|
23001
|
+
}
|
|
22991
23002
|
/**
|
|
22992
23003
|
* Invokes a pipe with 1 arguments.
|
|
22993
23004
|
*
|
|
@@ -24832,7 +24843,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
|
|
24832
24843
|
}
|
|
24833
24844
|
/**
|
|
24834
24845
|
* Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
|
|
24835
|
-
* (
|
|
24846
|
+
* (either a NgModule or a standalone component / directive / pipe).
|
|
24836
24847
|
*/
|
|
24837
24848
|
function transitiveScopesFor(type) {
|
|
24838
24849
|
if (isNgModule(type)) {
|