@angular/core 14.0.0-rc.2 → 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/injector_compatibility.mjs +57 -15
- 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 +6 -6
- 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 +4 -79
- package/esm2020/src/render3/instructions/element_validation.mjs +264 -0
- package/esm2020/src/render3/instructions/shared.mjs +7 -113
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/jit/module.mjs +2 -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/esm2020/testing/src/test_bed.mjs +5 -2
- package/fesm2015/core.mjs +630 -471
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +696 -534
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +626 -468
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +701 -540
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +80 -33
- package/package.json +1 -1
- package/testing/index.d.ts +5 -2
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.
|
|
2
|
+
* @license Angular v14.0.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -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
|
}
|
|
@@ -2044,9 +2047,9 @@ function setCurrentInjector(injector) {
|
|
|
2044
2047
|
function injectInjectorOnly(token, flags = InjectFlags.Default) {
|
|
2045
2048
|
if (_currentInjector === undefined) {
|
|
2046
2049
|
const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
|
|
2047
|
-
`inject() must be called from an injection context` :
|
|
2050
|
+
`inject() must be called from an injection context (a constructor, a factory function or a field initializer)` :
|
|
2048
2051
|
'';
|
|
2049
|
-
throw new RuntimeError(203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
|
|
2052
|
+
throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
|
|
2050
2053
|
}
|
|
2051
2054
|
else if (_currentInjector === null) {
|
|
2052
2055
|
return injectRootLimpMode(token, undefined, flags);
|
|
@@ -2081,29 +2084,71 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
2081
2084
|
}
|
|
2082
2085
|
/**
|
|
2083
2086
|
* Injects a token from the currently active injector.
|
|
2084
|
-
*
|
|
2085
|
-
*
|
|
2086
|
-
* `
|
|
2087
|
-
*
|
|
2088
|
-
*
|
|
2089
|
-
*
|
|
2090
|
-
*
|
|
2091
|
-
*
|
|
2092
|
-
* @param token
|
|
2087
|
+
* `inject` is only supported during instantiation of a dependency by the DI system. It can be used
|
|
2088
|
+
* during:
|
|
2089
|
+
* - Construction (via the `constructor`) of a class being instantiated by the DI system, such
|
|
2090
|
+
* as an `@Injectable` or `@Component`.
|
|
2091
|
+
* - In the initializer for fields of such classes.
|
|
2092
|
+
* - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.
|
|
2093
|
+
* - In the `factory` function specified for an `InjectionToken`.
|
|
2094
|
+
*
|
|
2095
|
+
* @param token A token that represents a dependency that should be injected.
|
|
2093
2096
|
* @param flags Optional flags that control how injection is executed.
|
|
2094
2097
|
* The flags correspond to injection strategies that can be specified with
|
|
2095
2098
|
* parameter decorators `@Host`, `@Self`, `@SkipSef`, and `@Optional`.
|
|
2096
|
-
* @returns the injected value if
|
|
2099
|
+
* @returns the injected value if operation is successful, `null` otherwise.
|
|
2100
|
+
* @throws if called outside of a supported context.
|
|
2097
2101
|
*
|
|
2098
2102
|
* @usageNotes
|
|
2103
|
+
* In practice the `inject()` calls are allowed in a constructor, a constructor parameter and a
|
|
2104
|
+
* field initializer:
|
|
2099
2105
|
*
|
|
2100
|
-
*
|
|
2106
|
+
* ```typescript
|
|
2107
|
+
* @Injectable({providedIn: 'root'})
|
|
2108
|
+
* export class Car {
|
|
2109
|
+
* radio: Radio|undefined;
|
|
2110
|
+
* // OK: field initializer
|
|
2111
|
+
* spareTyre = inject(Tyre);
|
|
2101
2112
|
*
|
|
2102
|
-
* {
|
|
2113
|
+
* constructor() {
|
|
2114
|
+
* // OK: constructor body
|
|
2115
|
+
* this.radio = inject(Radio);
|
|
2116
|
+
* }
|
|
2117
|
+
* }
|
|
2118
|
+
* ```
|
|
2119
|
+
*
|
|
2120
|
+
* It is also legal to call `inject` from a provider's factory:
|
|
2121
|
+
*
|
|
2122
|
+
* ```typescript
|
|
2123
|
+
* providers: [
|
|
2124
|
+
* {provide: Car, useFactory: () => {
|
|
2125
|
+
* // OK: a class factory
|
|
2126
|
+
* const engine = inject(Engine);
|
|
2127
|
+
* return new Car(engine);
|
|
2128
|
+
* }}
|
|
2129
|
+
* ]
|
|
2130
|
+
* ```
|
|
2131
|
+
*
|
|
2132
|
+
* Calls to the `inject()` function outside of the class creation context will result in error. Most
|
|
2133
|
+
* notably, calls to `inject()` are disallowed after a class instance was created, in methods
|
|
2134
|
+
* (including lifecycle hooks):
|
|
2135
|
+
*
|
|
2136
|
+
* ```typescript
|
|
2137
|
+
* @Component({ ... })
|
|
2138
|
+
* export class CarComponent {
|
|
2139
|
+
* ngOnInit() {
|
|
2140
|
+
* // ERROR: too late, the component instance was already created
|
|
2141
|
+
* const engine = inject(Engine);
|
|
2142
|
+
* engine.start();
|
|
2143
|
+
* }
|
|
2144
|
+
* }
|
|
2145
|
+
* ```
|
|
2103
2146
|
*
|
|
2104
2147
|
* @publicApi
|
|
2105
2148
|
*/
|
|
2106
|
-
|
|
2149
|
+
function inject$1(token, flags = InjectFlags.Default) {
|
|
2150
|
+
return ɵɵinject(token, flags);
|
|
2151
|
+
}
|
|
2107
2152
|
function injectArgs(types) {
|
|
2108
2153
|
const args = [];
|
|
2109
2154
|
for (let i = 0; i < types.length; i++) {
|
|
@@ -2429,7 +2474,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
|
|
|
2429
2474
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2430
2475
|
* found in the LICENSE file at https://angular.io/license
|
|
2431
2476
|
*/
|
|
2432
|
-
|
|
2477
|
+
/** Counter used to generate unique IDs for component definitions. */
|
|
2478
|
+
let componentDefCount = 0;
|
|
2433
2479
|
/**
|
|
2434
2480
|
* Create a component definition object.
|
|
2435
2481
|
*
|
|
@@ -2482,7 +2528,7 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2482
2528
|
features: componentDefinition.features || null,
|
|
2483
2529
|
data: componentDefinition.data || {},
|
|
2484
2530
|
encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
|
|
2485
|
-
id:
|
|
2531
|
+
id: `c${componentDefCount++}`,
|
|
2486
2532
|
styles: componentDefinition.styles || EMPTY_ARRAY,
|
|
2487
2533
|
_: null,
|
|
2488
2534
|
setInput: null,
|
|
@@ -2491,7 +2537,6 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2491
2537
|
};
|
|
2492
2538
|
const dependencies = componentDefinition.dependencies;
|
|
2493
2539
|
const feature = componentDefinition.features;
|
|
2494
|
-
def.id += _renderCompCount++;
|
|
2495
2540
|
def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
|
|
2496
2541
|
def.outputs = invertObject(componentDefinition.outputs),
|
|
2497
2542
|
feature && feature.forEach((fn) => fn(def));
|
|
@@ -2519,8 +2564,8 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2519
2564
|
*/
|
|
2520
2565
|
function ɵɵsetComponentScope(type, directives, pipes) {
|
|
2521
2566
|
const def = type.ɵcmp;
|
|
2522
|
-
def.directiveDefs = () => directives.map(extractDirectiveDef);
|
|
2523
|
-
def.pipeDefs = () => pipes.map(getPipeDef$1);
|
|
2567
|
+
def.directiveDefs = () => (typeof directives === 'function' ? directives() : directives).map(extractDirectiveDef);
|
|
2568
|
+
def.pipeDefs = () => (typeof pipes === 'function' ? pipes() : pipes).map(getPipeDef$1);
|
|
2524
2569
|
}
|
|
2525
2570
|
function extractDirectiveDef(type) {
|
|
2526
2571
|
return getComponentDef$1(type) || getDirectiveDef(type);
|
|
@@ -3498,7 +3543,6 @@ function getLView() {
|
|
|
3498
3543
|
function getTView() {
|
|
3499
3544
|
return instructionState.lFrame.tView;
|
|
3500
3545
|
}
|
|
3501
|
-
// TODO(crisbeto): revert the @noinline once Closure issue is resolved.
|
|
3502
3546
|
/**
|
|
3503
3547
|
* Restores `contextViewData` to the given OpaqueViewState instance.
|
|
3504
3548
|
*
|
|
@@ -3510,7 +3554,6 @@ function getTView() {
|
|
|
3510
3554
|
* @returns Context of the restored OpaqueViewState instance.
|
|
3511
3555
|
*
|
|
3512
3556
|
* @codeGenApi
|
|
3513
|
-
* @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
|
|
3514
3557
|
*/
|
|
3515
3558
|
function ɵɵrestoreView(viewToRestore) {
|
|
3516
3559
|
instructionState.lFrame.contextLView = viewToRestore;
|
|
@@ -6581,6 +6624,155 @@ function getSanitizer() {
|
|
|
6581
6624
|
return lView && lView[SANITIZER];
|
|
6582
6625
|
}
|
|
6583
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
|
+
|
|
6584
6776
|
/**
|
|
6585
6777
|
* @license
|
|
6586
6778
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6965,276 +7157,86 @@ function discoverLocalRefs(lView, nodeIndex) {
|
|
|
6965
7157
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6966
7158
|
* found in the LICENSE file at https://angular.io/license
|
|
6967
7159
|
*/
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
7160
|
+
/** Verifies that a given type is a Standalone Component. */
|
|
7161
|
+
function assertStandaloneComponentType(type) {
|
|
7162
|
+
const componentDef = getComponentDef$1(type);
|
|
7163
|
+
if (!componentDef) {
|
|
7164
|
+
throw new RuntimeError(906 /* RuntimeErrorCode.MISSING_GENERATED_DEF */, `The ${stringifyForError(type)} is not an Angular component, ` +
|
|
7165
|
+
`make sure it has the \`@Component\` decorator.`);
|
|
7166
|
+
}
|
|
7167
|
+
if (!componentDef.standalone) {
|
|
7168
|
+
throw new RuntimeError(907 /* RuntimeErrorCode.TYPE_IS_NOT_STANDALONE */, `The ${stringifyForError(type)} component is not marked as standalone, ` +
|
|
7169
|
+
`but Angular expects to have a standalone component here. ` +
|
|
7170
|
+
`Please make sure the ${stringifyForError(type)} component has ` +
|
|
7171
|
+
`the \`standalone: true\` flag in the decorator.`);
|
|
7172
|
+
}
|
|
6975
7173
|
}
|
|
6976
|
-
|
|
6977
|
-
|
|
7174
|
+
/** Called when there are multiple component selectors that match a given node */
|
|
7175
|
+
function throwMultipleComponentError(tNode, first, second) {
|
|
7176
|
+
throw new RuntimeError(-300 /* RuntimeErrorCode.MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}: ` +
|
|
7177
|
+
`${stringifyForError(first)} and ` +
|
|
7178
|
+
`${stringifyForError(second)}`);
|
|
7179
|
+
}
|
|
7180
|
+
/** Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. */
|
|
7181
|
+
function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName) {
|
|
7182
|
+
const field = propName ? ` for '${propName}'` : '';
|
|
7183
|
+
let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${oldValue}'. Current value: '${currValue}'.`;
|
|
7184
|
+
if (creationMode) {
|
|
7185
|
+
msg +=
|
|
7186
|
+
` It seems like the view has been created after its parent and its children have been dirty checked.` +
|
|
7187
|
+
` Has it been created in a change detection hook?`;
|
|
7188
|
+
}
|
|
7189
|
+
throw new RuntimeError(-100 /* RuntimeErrorCode.EXPRESSION_CHANGED_AFTER_CHECKED */, msg);
|
|
6978
7190
|
}
|
|
6979
|
-
function
|
|
6980
|
-
|
|
7191
|
+
function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
|
|
7192
|
+
const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
|
|
7193
|
+
let oldValue = prefix, newValue = prefix;
|
|
7194
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
7195
|
+
const slotIdx = rootIndex + i;
|
|
7196
|
+
oldValue += `${lView[slotIdx]}${chunks[i]}`;
|
|
7197
|
+
newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`;
|
|
7198
|
+
}
|
|
7199
|
+
return { propName, oldValue, newValue };
|
|
6981
7200
|
}
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
*
|
|
6988
|
-
*
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
* @internal
|
|
7022
|
-
*/
|
|
7023
|
-
this._console = console;
|
|
7024
|
-
}
|
|
7025
|
-
handleError(error) {
|
|
7026
|
-
const originalError = this._findOriginalError(error);
|
|
7027
|
-
// Note: Browser consoles show the place from where console.error was called.
|
|
7028
|
-
// We can use this to give users additional information about the error.
|
|
7029
|
-
const errorLogger = getErrorLogger(error);
|
|
7030
|
-
errorLogger(this._console, `ERROR`, error);
|
|
7031
|
-
if (originalError) {
|
|
7032
|
-
errorLogger(this._console, `ORIGINAL ERROR`, originalError);
|
|
7033
|
-
}
|
|
7034
|
-
}
|
|
7035
|
-
/** @internal */
|
|
7036
|
-
_findOriginalError(error) {
|
|
7037
|
-
let e = error && getOriginalError(error);
|
|
7038
|
-
while (e && getOriginalError(e)) {
|
|
7039
|
-
e = getOriginalError(e);
|
|
7040
|
-
}
|
|
7041
|
-
return e || null;
|
|
7042
|
-
}
|
|
7043
|
-
}
|
|
7044
|
-
|
|
7045
|
-
/**
|
|
7046
|
-
* @license
|
|
7047
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7048
|
-
*
|
|
7049
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7050
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7051
|
-
*/
|
|
7052
|
-
/**
|
|
7053
|
-
* Defines a schema that allows an NgModule to contain the following:
|
|
7054
|
-
* - Non-Angular elements named with dash case (`-`).
|
|
7055
|
-
* - Element properties named with dash case (`-`).
|
|
7056
|
-
* Dash case is the naming convention for custom elements.
|
|
7057
|
-
*
|
|
7058
|
-
* @publicApi
|
|
7059
|
-
*/
|
|
7060
|
-
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
7061
|
-
name: 'custom-elements'
|
|
7062
|
-
};
|
|
7063
|
-
/**
|
|
7064
|
-
* Defines a schema that allows any property on any element.
|
|
7065
|
-
*
|
|
7066
|
-
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
7067
|
-
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
7068
|
-
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
7069
|
-
*
|
|
7070
|
-
* @publicApi
|
|
7071
|
-
*/
|
|
7072
|
-
const NO_ERRORS_SCHEMA = {
|
|
7073
|
-
name: 'no-errors-schema'
|
|
7074
|
-
};
|
|
7075
|
-
|
|
7076
|
-
/**
|
|
7077
|
-
* @license
|
|
7078
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7079
|
-
*
|
|
7080
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7081
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7082
|
-
*/
|
|
7083
|
-
/**
|
|
7084
|
-
* Disallowed strings in the comment.
|
|
7085
|
-
*
|
|
7086
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
7087
|
-
*/
|
|
7088
|
-
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
7089
|
-
/**
|
|
7090
|
-
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
7091
|
-
*/
|
|
7092
|
-
const COMMENT_DELIMITER = /(<|>)/;
|
|
7093
|
-
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
7094
|
-
/**
|
|
7095
|
-
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
7096
|
-
*
|
|
7097
|
-
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
7098
|
-
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
7099
|
-
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
7100
|
-
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
7101
|
-
*
|
|
7102
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
7103
|
-
*
|
|
7104
|
-
* ```
|
|
7105
|
-
* div.innerHTML = div.innerHTML
|
|
7106
|
-
* ```
|
|
7107
|
-
*
|
|
7108
|
-
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
7109
|
-
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
7110
|
-
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
7111
|
-
* may contain such text and expect them to be safe.)
|
|
7112
|
-
*
|
|
7113
|
-
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
7114
|
-
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
7115
|
-
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
7116
|
-
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
7117
|
-
*
|
|
7118
|
-
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
7119
|
-
* sequence.
|
|
7120
|
-
*/
|
|
7121
|
-
function escapeCommentText(value) {
|
|
7122
|
-
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
7123
|
-
}
|
|
7124
|
-
|
|
7125
|
-
/**
|
|
7126
|
-
* @license
|
|
7127
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7128
|
-
*
|
|
7129
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7130
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7131
|
-
*/
|
|
7132
|
-
function normalizeDebugBindingName(name) {
|
|
7133
|
-
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
7134
|
-
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
7135
|
-
return `ng-reflect-${name}`;
|
|
7136
|
-
}
|
|
7137
|
-
const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
|
7138
|
-
function camelCaseToDashCase(input) {
|
|
7139
|
-
return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
|
7140
|
-
}
|
|
7141
|
-
function normalizeDebugBindingValue(value) {
|
|
7142
|
-
try {
|
|
7143
|
-
// Limit the size of the value as otherwise the DOM just gets polluted.
|
|
7144
|
-
return value != null ? value.toString().slice(0, 30) : value;
|
|
7145
|
-
}
|
|
7146
|
-
catch (e) {
|
|
7147
|
-
return '[ERROR] Exception while trying to serialize the value';
|
|
7148
|
-
}
|
|
7149
|
-
}
|
|
7150
|
-
|
|
7151
|
-
/**
|
|
7152
|
-
* @license
|
|
7153
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7154
|
-
*
|
|
7155
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7156
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7157
|
-
*/
|
|
7158
|
-
/** Verifies that a given type is a Standalone Component. */
|
|
7159
|
-
function assertStandaloneComponentType(type) {
|
|
7160
|
-
const componentDef = getComponentDef$1(type);
|
|
7161
|
-
if (!componentDef) {
|
|
7162
|
-
throw new RuntimeError(906 /* RuntimeErrorCode.MISSING_GENERATED_DEF */, `The ${stringifyForError(type)} is not an Angular component, ` +
|
|
7163
|
-
`make sure it has the \`@Component\` decorator.`);
|
|
7164
|
-
}
|
|
7165
|
-
if (!componentDef.standalone) {
|
|
7166
|
-
throw new RuntimeError(907 /* RuntimeErrorCode.TYPE_IS_NOT_STANDALONE */, `The ${stringifyForError(type)} component is not marked as standalone, ` +
|
|
7167
|
-
`but Angular expects to have a standalone component here. ` +
|
|
7168
|
-
`Please make sure the ${stringifyForError(type)} component has ` +
|
|
7169
|
-
`the \`standalone: true\` flag in the decorator.`);
|
|
7170
|
-
}
|
|
7171
|
-
}
|
|
7172
|
-
/** Called when there are multiple component selectors that match a given node */
|
|
7173
|
-
function throwMultipleComponentError(tNode, first, second) {
|
|
7174
|
-
throw new RuntimeError(-300 /* RuntimeErrorCode.MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}: ` +
|
|
7175
|
-
`${stringifyForError(first)} and ` +
|
|
7176
|
-
`${stringifyForError(second)}`);
|
|
7177
|
-
}
|
|
7178
|
-
/** Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. */
|
|
7179
|
-
function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName) {
|
|
7180
|
-
const field = propName ? ` for '${propName}'` : '';
|
|
7181
|
-
let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${oldValue}'. Current value: '${currValue}'.`;
|
|
7182
|
-
if (creationMode) {
|
|
7183
|
-
msg +=
|
|
7184
|
-
` It seems like the view has been created after its parent and its children have been dirty checked.` +
|
|
7185
|
-
` Has it been created in a change detection hook?`;
|
|
7186
|
-
}
|
|
7187
|
-
throw new RuntimeError(-100 /* RuntimeErrorCode.EXPRESSION_CHANGED_AFTER_CHECKED */, msg);
|
|
7188
|
-
}
|
|
7189
|
-
function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
|
|
7190
|
-
const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
|
|
7191
|
-
let oldValue = prefix, newValue = prefix;
|
|
7192
|
-
for (let i = 0; i < chunks.length; i++) {
|
|
7193
|
-
const slotIdx = rootIndex + i;
|
|
7194
|
-
oldValue += `${lView[slotIdx]}${chunks[i]}`;
|
|
7195
|
-
newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`;
|
|
7196
|
-
}
|
|
7197
|
-
return { propName, oldValue, newValue };
|
|
7198
|
-
}
|
|
7199
|
-
/**
|
|
7200
|
-
* Constructs an object that contains details for the ExpressionChangedAfterItHasBeenCheckedError:
|
|
7201
|
-
* - property name (for property bindings or interpolations)
|
|
7202
|
-
* - old and new values, enriched using information from metadata
|
|
7203
|
-
*
|
|
7204
|
-
* More information on the metadata storage format can be found in `storePropertyBindingMetadata`
|
|
7205
|
-
* function description.
|
|
7206
|
-
*/
|
|
7207
|
-
function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) {
|
|
7208
|
-
const tData = lView[TVIEW].data;
|
|
7209
|
-
const metadata = tData[bindingIndex];
|
|
7210
|
-
if (typeof metadata === 'string') {
|
|
7211
|
-
// metadata for property interpolation
|
|
7212
|
-
if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) {
|
|
7213
|
-
return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue);
|
|
7214
|
-
}
|
|
7215
|
-
// metadata for property binding
|
|
7216
|
-
return { propName: metadata, oldValue, newValue };
|
|
7217
|
-
}
|
|
7218
|
-
// metadata is not available for this expression, check if this expression is a part of the
|
|
7219
|
-
// property interpolation by going from the current binding index left and look for a string that
|
|
7220
|
-
// contains INTERPOLATION_DELIMITER, the layout in tView.data for this case will look like this:
|
|
7221
|
-
// [..., 'id�Prefix � and � suffix', null, null, null, ...]
|
|
7222
|
-
if (metadata === null) {
|
|
7223
|
-
let idx = bindingIndex - 1;
|
|
7224
|
-
while (typeof tData[idx] !== 'string' && tData[idx + 1] === null) {
|
|
7225
|
-
idx--;
|
|
7226
|
-
}
|
|
7227
|
-
const meta = tData[idx];
|
|
7228
|
-
if (typeof meta === 'string') {
|
|
7229
|
-
const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, 'g'));
|
|
7230
|
-
// first interpolation delimiter separates property name from interpolation parts (in case of
|
|
7231
|
-
// property interpolations), so we subtract one from total number of found delimiters
|
|
7232
|
-
if (matches && (matches.length - 1) > bindingIndex - idx) {
|
|
7233
|
-
return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue);
|
|
7234
|
-
}
|
|
7235
|
-
}
|
|
7236
|
-
}
|
|
7237
|
-
return { propName: undefined, oldValue, newValue };
|
|
7201
|
+
/**
|
|
7202
|
+
* Constructs an object that contains details for the ExpressionChangedAfterItHasBeenCheckedError:
|
|
7203
|
+
* - property name (for property bindings or interpolations)
|
|
7204
|
+
* - old and new values, enriched using information from metadata
|
|
7205
|
+
*
|
|
7206
|
+
* More information on the metadata storage format can be found in `storePropertyBindingMetadata`
|
|
7207
|
+
* function description.
|
|
7208
|
+
*/
|
|
7209
|
+
function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) {
|
|
7210
|
+
const tData = lView[TVIEW].data;
|
|
7211
|
+
const metadata = tData[bindingIndex];
|
|
7212
|
+
if (typeof metadata === 'string') {
|
|
7213
|
+
// metadata for property interpolation
|
|
7214
|
+
if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) {
|
|
7215
|
+
return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue);
|
|
7216
|
+
}
|
|
7217
|
+
// metadata for property binding
|
|
7218
|
+
return { propName: metadata, oldValue, newValue };
|
|
7219
|
+
}
|
|
7220
|
+
// metadata is not available for this expression, check if this expression is a part of the
|
|
7221
|
+
// property interpolation by going from the current binding index left and look for a string that
|
|
7222
|
+
// contains INTERPOLATION_DELIMITER, the layout in tView.data for this case will look like this:
|
|
7223
|
+
// [..., 'id�Prefix � and � suffix', null, null, null, ...]
|
|
7224
|
+
if (metadata === null) {
|
|
7225
|
+
let idx = bindingIndex - 1;
|
|
7226
|
+
while (typeof tData[idx] !== 'string' && tData[idx + 1] === null) {
|
|
7227
|
+
idx--;
|
|
7228
|
+
}
|
|
7229
|
+
const meta = tData[idx];
|
|
7230
|
+
if (typeof meta === 'string') {
|
|
7231
|
+
const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, 'g'));
|
|
7232
|
+
// first interpolation delimiter separates property name from interpolation parts (in case of
|
|
7233
|
+
// property interpolations), so we subtract one from total number of found delimiters
|
|
7234
|
+
if (matches && (matches.length - 1) > bindingIndex - idx) {
|
|
7235
|
+
return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue);
|
|
7236
|
+
}
|
|
7237
|
+
}
|
|
7238
|
+
}
|
|
7239
|
+
return { propName: undefined, oldValue, newValue };
|
|
7238
7240
|
}
|
|
7239
7241
|
|
|
7240
7242
|
/**
|
|
@@ -9131,8 +9133,38 @@ const INJECTOR_DEF_TYPES = new InjectionToken('INJECTOR_DEF_TYPES');
|
|
|
9131
9133
|
* another environment injector (such as a route injector). They should not be used in component
|
|
9132
9134
|
* providers.
|
|
9133
9135
|
*
|
|
9134
|
-
*
|
|
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.
|
|
9135
9166
|
* @publicApi
|
|
9167
|
+
* @developerPreview
|
|
9136
9168
|
*/
|
|
9137
9169
|
function importProvidersFrom(...sources) {
|
|
9138
9170
|
return { ɵproviders: internalImportProvidersFrom(true, sources) };
|
|
@@ -9410,6 +9442,8 @@ function getNullInjector() {
|
|
|
9410
9442
|
/**
|
|
9411
9443
|
* An `Injector` that's part of the environment injector hierarchy, which exists outside of the
|
|
9412
9444
|
* component tree.
|
|
9445
|
+
*
|
|
9446
|
+
* @developerPreview
|
|
9413
9447
|
*/
|
|
9414
9448
|
class EnvironmentInjector {
|
|
9415
9449
|
}
|
|
@@ -10635,59 +10669,349 @@ function _mapProviders(injector, fn) {
|
|
|
10635
10669
|
for (let i = 0; i < injector._providers.length; ++i) {
|
|
10636
10670
|
res[i] = fn(injector.getProviderAtIndex(i));
|
|
10637
10671
|
}
|
|
10638
|
-
return res;
|
|
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
|
+
}
|
|
10854
|
+
}
|
|
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;
|
|
10883
|
+
}
|
|
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';
|
|
10905
|
+
}
|
|
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.`;
|
|
10929
|
+
}
|
|
10930
|
+
else {
|
|
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.`;
|
|
10934
|
+
}
|
|
10935
|
+
}
|
|
10936
|
+
if (shouldThrowErrorOnUnknownProperty) {
|
|
10937
|
+
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
10938
|
+
}
|
|
10939
|
+
else {
|
|
10940
|
+
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
10941
|
+
}
|
|
10639
10942
|
}
|
|
10640
|
-
|
|
10641
10943
|
/**
|
|
10642
|
-
*
|
|
10643
|
-
*
|
|
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.
|
|
10644
10947
|
*
|
|
10645
|
-
*
|
|
10646
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10647
|
-
*/
|
|
10648
|
-
|
|
10649
|
-
/**
|
|
10650
|
-
* @license
|
|
10651
|
-
* Copyright Google LLC All Rights Reserved.
|
|
10948
|
+
* Gets a reference to the host component def (where a current component is declared).
|
|
10652
10949
|
*
|
|
10653
|
-
*
|
|
10654
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10950
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10655
10951
|
*/
|
|
10656
|
-
|
|
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
|
+
}
|
|
10657
10961
|
/**
|
|
10658
|
-
*
|
|
10659
|
-
*
|
|
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.
|
|
10660
10965
|
*
|
|
10661
|
-
*
|
|
10662
|
-
*
|
|
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.
|
|
10663
10969
|
*/
|
|
10664
|
-
function
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
// if
|
|
10668
|
-
|
|
10669
|
-
// Verify that we will not get into infinite loop.
|
|
10670
|
-
ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
|
10671
|
-
return ɵɵinject(token, flags);
|
|
10672
|
-
}
|
|
10673
|
-
const tNode = getCurrentTNode();
|
|
10674
|
-
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);
|
|
10675
10975
|
}
|
|
10676
10976
|
/**
|
|
10677
|
-
*
|
|
10678
|
-
*
|
|
10679
|
-
*
|
|
10680
|
-
* This instruction allows the actual error message to be optimized away when ngDevMode is turned
|
|
10681
|
-
* 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.
|
|
10682
10980
|
*
|
|
10683
|
-
*
|
|
10684
|
-
*
|
|
10981
|
+
* Constructs a string describing the location of the host component template. The function is used
|
|
10982
|
+
* in dev mode to produce error messages.
|
|
10685
10983
|
*
|
|
10686
|
-
* @
|
|
10984
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
10687
10985
|
*/
|
|
10688
|
-
function
|
|
10689
|
-
|
|
10690
|
-
|
|
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;
|
|
10691
11015
|
}
|
|
10692
11016
|
|
|
10693
11017
|
/**
|
|
@@ -11496,21 +11820,6 @@ class LContainerDebug {
|
|
|
11496
11820
|
}
|
|
11497
11821
|
}
|
|
11498
11822
|
|
|
11499
|
-
let shouldThrowErrorOnUnknownProperty = false;
|
|
11500
|
-
/**
|
|
11501
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
11502
|
-
* instead of just logging the error.
|
|
11503
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
11504
|
-
*/
|
|
11505
|
-
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
11506
|
-
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
11507
|
-
}
|
|
11508
|
-
/**
|
|
11509
|
-
* Gets the current value of the strict mode.
|
|
11510
|
-
*/
|
|
11511
|
-
function ɵgetUnknownPropertyStrictMode() {
|
|
11512
|
-
return shouldThrowErrorOnUnknownProperty;
|
|
11513
|
-
}
|
|
11514
11823
|
/**
|
|
11515
11824
|
* A permanent marker promise which signifies that the current CD tree is
|
|
11516
11825
|
* clean.
|
|
@@ -11669,21 +11978,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
|
|
|
11669
11978
|
}
|
|
11670
11979
|
return tNode;
|
|
11671
11980
|
}
|
|
11672
|
-
/**
|
|
11673
|
-
* Checks if the current component is declared inside of a standalone component template.
|
|
11674
|
-
*
|
|
11675
|
-
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11676
|
-
*/
|
|
11677
|
-
function isHostComponentStandalone(lView) {
|
|
11678
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
11679
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
11680
|
-
const context = declarationLView[CONTEXT];
|
|
11681
|
-
// Unable to obtain a context, fall back to the non-standalone scenario.
|
|
11682
|
-
if (!context)
|
|
11683
|
-
return false;
|
|
11684
|
-
const componentDef = getComponentDef$1(context.constructor);
|
|
11685
|
-
return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
|
|
11686
|
-
}
|
|
11687
11981
|
/**
|
|
11688
11982
|
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
11689
11983
|
* i18nApply()), we need to adjust the blueprint for future
|
|
@@ -12350,10 +12644,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12350
12644
|
propName = mapPropName(propName);
|
|
12351
12645
|
if (ngDevMode) {
|
|
12352
12646
|
validateAgainstEventProperties(propName);
|
|
12353
|
-
if (!
|
|
12354
|
-
|
|
12355
|
-
handleUnknownPropertyError(propName, tNode);
|
|
12356
|
-
return;
|
|
12647
|
+
if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
|
|
12648
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12357
12649
|
}
|
|
12358
12650
|
ngDevMode.rendererSetProperty++;
|
|
12359
12651
|
}
|
|
@@ -12372,7 +12664,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12372
12664
|
// If the node is a container and the property didn't
|
|
12373
12665
|
// match any of the inputs or schemas we should throw.
|
|
12374
12666
|
if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
|
|
12375
|
-
handleUnknownPropertyError(propName, tNode);
|
|
12667
|
+
handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
|
|
12376
12668
|
}
|
|
12377
12669
|
}
|
|
12378
12670
|
}
|
|
@@ -12424,79 +12716,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
|
|
|
12424
12716
|
}
|
|
12425
12717
|
}
|
|
12426
12718
|
}
|
|
12427
|
-
/**
|
|
12428
|
-
* Validates that the property of the element is known at runtime and returns
|
|
12429
|
-
* false if it's not the case.
|
|
12430
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
12431
|
-
* ones this check happens at build time).
|
|
12432
|
-
*
|
|
12433
|
-
* The property is considered known if either:
|
|
12434
|
-
* - it's a known property of the element
|
|
12435
|
-
* - the element is allowed by one of the schemas
|
|
12436
|
-
* - the property is used for animations
|
|
12437
|
-
*
|
|
12438
|
-
* @param element Element to validate
|
|
12439
|
-
* @param tagName Name of the tag to check
|
|
12440
|
-
* @param propName Name of the property to check
|
|
12441
|
-
* @param schemas Array of schemas
|
|
12442
|
-
*/
|
|
12443
|
-
function validateProperty(element, tagName, propName, schemas) {
|
|
12444
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
12445
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
12446
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
12447
|
-
// execute the check below.
|
|
12448
|
-
if (schemas === null)
|
|
12449
|
-
return true;
|
|
12450
|
-
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
12451
|
-
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
12452
|
-
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
12453
|
-
return true;
|
|
12454
|
-
}
|
|
12455
|
-
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
12456
|
-
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
12457
|
-
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
12458
|
-
}
|
|
12459
|
-
/**
|
|
12460
|
-
* Returns true if the tag name is allowed by specified schemas.
|
|
12461
|
-
* @param schemas Array of schemas
|
|
12462
|
-
* @param tagName Name of the tag
|
|
12463
|
-
*/
|
|
12464
|
-
function matchingSchemas(schemas, tagName) {
|
|
12465
|
-
if (schemas !== null) {
|
|
12466
|
-
for (let i = 0; i < schemas.length; i++) {
|
|
12467
|
-
const schema = schemas[i];
|
|
12468
|
-
if (schema === NO_ERRORS_SCHEMA ||
|
|
12469
|
-
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
12470
|
-
return true;
|
|
12471
|
-
}
|
|
12472
|
-
}
|
|
12473
|
-
}
|
|
12474
|
-
return false;
|
|
12475
|
-
}
|
|
12476
|
-
/**
|
|
12477
|
-
* Logs or throws an error that a property is not supported on an element.
|
|
12478
|
-
* @param propName Name of the invalid property.
|
|
12479
|
-
* @param tagName Name of the node on which we encountered the property.
|
|
12480
|
-
*/
|
|
12481
|
-
function handleUnknownPropertyError(propName, tNode) {
|
|
12482
|
-
let tagName = tNode.value;
|
|
12483
|
-
// Special-case a situation when a structural directive is applied to
|
|
12484
|
-
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
12485
|
-
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
12486
|
-
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
12487
|
-
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
12488
|
-
// a default value of the `tNode.value` is not feasible at this moment.
|
|
12489
|
-
if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
|
|
12490
|
-
tagName = 'ng-template';
|
|
12491
|
-
}
|
|
12492
|
-
const message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'.`;
|
|
12493
|
-
if (shouldThrowErrorOnUnknownProperty) {
|
|
12494
|
-
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
12495
|
-
}
|
|
12496
|
-
else {
|
|
12497
|
-
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
12498
|
-
}
|
|
12499
|
-
}
|
|
12500
12719
|
/**
|
|
12501
12720
|
* Instantiate a root component.
|
|
12502
12721
|
*/
|
|
@@ -14070,7 +14289,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
14070
14289
|
const component = instantiateRootComponent(tView, rootLView, componentDef);
|
|
14071
14290
|
rootContext.components.push(component);
|
|
14072
14291
|
componentView[CONTEXT] = component;
|
|
14073
|
-
hostFeatures
|
|
14292
|
+
if (hostFeatures !== null) {
|
|
14293
|
+
for (const feature of hostFeatures) {
|
|
14294
|
+
feature(component, componentDef);
|
|
14295
|
+
}
|
|
14296
|
+
}
|
|
14074
14297
|
// We want to generate an empty QueryList for root content queries for backwards
|
|
14075
14298
|
// compatibility with ViewEngine.
|
|
14076
14299
|
if (componentDef.contentQueries) {
|
|
@@ -14111,13 +14334,10 @@ function createRootContext(scheduler, playerHandler) {
|
|
|
14111
14334
|
* renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
|
|
14112
14335
|
* ```
|
|
14113
14336
|
*/
|
|
14114
|
-
function LifecycleHooksFeature(
|
|
14115
|
-
const lView = readPatchedLView(component);
|
|
14116
|
-
ngDevMode && assertDefined(lView, 'LView is required');
|
|
14117
|
-
const tView = lView[TVIEW];
|
|
14337
|
+
function LifecycleHooksFeature() {
|
|
14118
14338
|
const tNode = getCurrentTNode();
|
|
14119
14339
|
ngDevMode && assertDefined(tNode, 'TNode is required');
|
|
14120
|
-
registerPostOrderHooks(
|
|
14340
|
+
registerPostOrderHooks(getLView()[TVIEW], tNode);
|
|
14121
14341
|
}
|
|
14122
14342
|
/**
|
|
14123
14343
|
* Wait on component until it is rendered.
|
|
@@ -15252,21 +15472,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
|
|
|
15252
15472
|
* Use of this source code is governed by an MIT-style license that can be
|
|
15253
15473
|
* found in the LICENSE file at https://angular.io/license
|
|
15254
15474
|
*/
|
|
15255
|
-
let shouldThrowErrorOnUnknownElement = false;
|
|
15256
|
-
/**
|
|
15257
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
15258
|
-
* instead of just logging the error.
|
|
15259
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
15260
|
-
*/
|
|
15261
|
-
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
15262
|
-
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
15263
|
-
}
|
|
15264
|
-
/**
|
|
15265
|
-
* Gets the current value of the strict mode.
|
|
15266
|
-
*/
|
|
15267
|
-
function ɵgetUnknownElementStrictMode() {
|
|
15268
|
-
return shouldThrowErrorOnUnknownElement;
|
|
15269
|
-
}
|
|
15270
15475
|
function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
|
|
15271
15476
|
ngDevMode && assertFirstCreatePass(tView);
|
|
15272
15477
|
ngDevMode && ngDevMode.firstCreatePass++;
|
|
@@ -15275,8 +15480,7 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
|
|
|
15275
15480
|
const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
|
|
15276
15481
|
const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
|
15277
15482
|
if (ngDevMode) {
|
|
15278
|
-
|
|
15279
|
-
validateElementIsKnown(native, tNode.value, tView.schemas, hasDirectives, hostIsStandalone);
|
|
15483
|
+
validateElementIsKnown(native, lView, tNode.value, tView.schemas, hasDirectives);
|
|
15280
15484
|
}
|
|
15281
15485
|
if (tNode.attrs !== null) {
|
|
15282
15486
|
computeStaticStyling(tNode, tNode.attrs, false);
|
|
@@ -15401,65 +15605,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
15401
15605
|
ɵɵelementEnd();
|
|
15402
15606
|
return ɵɵelement;
|
|
15403
15607
|
}
|
|
15404
|
-
/**
|
|
15405
|
-
* Validates that the element is known at runtime and produces
|
|
15406
|
-
* an error if it's not the case.
|
|
15407
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
15408
|
-
* ones this check happens at build time).
|
|
15409
|
-
*
|
|
15410
|
-
* The element is considered known if either:
|
|
15411
|
-
* - it's a known HTML element
|
|
15412
|
-
* - it's a known custom element
|
|
15413
|
-
* - the element matches any directive
|
|
15414
|
-
* - the element is allowed by one of the schemas
|
|
15415
|
-
*
|
|
15416
|
-
* @param element Element to validate
|
|
15417
|
-
* @param tagName Name of the tag to check
|
|
15418
|
-
* @param schemas Array of schemas
|
|
15419
|
-
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
15420
|
-
* @param hostIsStandalone Boolean indicating whether the host is a standalone component
|
|
15421
|
-
*/
|
|
15422
|
-
function validateElementIsKnown(element, tagName, schemas, hasDirectives, hostIsStandalone) {
|
|
15423
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
15424
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
15425
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
15426
|
-
// execute the check below.
|
|
15427
|
-
if (schemas === null)
|
|
15428
|
-
return;
|
|
15429
|
-
// If the element matches any directive, it's considered as valid.
|
|
15430
|
-
if (!hasDirectives && tagName !== null) {
|
|
15431
|
-
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
15432
|
-
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
15433
|
-
// of HTMLUnknownElement in browsers that support web components.
|
|
15434
|
-
const isUnknown =
|
|
15435
|
-
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
15436
|
-
// because while most browsers return 'function', IE returns 'object'.
|
|
15437
|
-
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
15438
|
-
element instanceof HTMLUnknownElement) ||
|
|
15439
|
-
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
15440
|
-
!customElements.get(tagName));
|
|
15441
|
-
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
15442
|
-
const schemas = `'${hostIsStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
15443
|
-
let message = `'${tagName}' is not a known element:\n`;
|
|
15444
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
15445
|
-
'a part of this module'}.\n`;
|
|
15446
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
15447
|
-
message +=
|
|
15448
|
-
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
15449
|
-
}
|
|
15450
|
-
else {
|
|
15451
|
-
message +=
|
|
15452
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
15453
|
-
}
|
|
15454
|
-
if (shouldThrowErrorOnUnknownElement) {
|
|
15455
|
-
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
15456
|
-
}
|
|
15457
|
-
else {
|
|
15458
|
-
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
15459
|
-
}
|
|
15460
|
-
}
|
|
15461
|
-
}
|
|
15462
|
-
}
|
|
15463
15608
|
|
|
15464
15609
|
/**
|
|
15465
15610
|
* @license
|
|
@@ -21942,7 +22087,7 @@ class Version {
|
|
|
21942
22087
|
/**
|
|
21943
22088
|
* @publicApi
|
|
21944
22089
|
*/
|
|
21945
|
-
const VERSION = new Version('14.0.
|
|
22090
|
+
const VERSION = new Version('14.0.1');
|
|
21946
22091
|
|
|
21947
22092
|
/**
|
|
21948
22093
|
* @license
|
|
@@ -22614,6 +22759,7 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
|
|
|
22614
22759
|
* Create a new environment injector.
|
|
22615
22760
|
*
|
|
22616
22761
|
* @publicApi
|
|
22762
|
+
* @developerPreview
|
|
22617
22763
|
*/
|
|
22618
22764
|
function createEnvironmentInjector(providers, parent = null, debugName = null) {
|
|
22619
22765
|
const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
|
|
@@ -22641,14 +22787,14 @@ class StandaloneService {
|
|
|
22641
22787
|
if (!componentDef.standalone) {
|
|
22642
22788
|
return null;
|
|
22643
22789
|
}
|
|
22644
|
-
if (!this.cachedInjectors.has(componentDef)) {
|
|
22790
|
+
if (!this.cachedInjectors.has(componentDef.id)) {
|
|
22645
22791
|
const providers = internalImportProvidersFrom(false, componentDef.type);
|
|
22646
22792
|
const standaloneInjector = providers.length > 0 ?
|
|
22647
22793
|
createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
|
|
22648
22794
|
null;
|
|
22649
|
-
this.cachedInjectors.set(componentDef, standaloneInjector);
|
|
22795
|
+
this.cachedInjectors.set(componentDef.id, standaloneInjector);
|
|
22650
22796
|
}
|
|
22651
|
-
return this.cachedInjectors.get(componentDef);
|
|
22797
|
+
return this.cachedInjectors.get(componentDef.id);
|
|
22652
22798
|
}
|
|
22653
22799
|
ngOnDestroy() {
|
|
22654
22800
|
try {
|
|
@@ -23148,13 +23294,26 @@ function getPipeDef(name, registry) {
|
|
|
23148
23294
|
}
|
|
23149
23295
|
}
|
|
23150
23296
|
if (ngDevMode) {
|
|
23151
|
-
|
|
23152
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
23153
|
-
const context = declarationLView[CONTEXT];
|
|
23154
|
-
const component = context ? ` in the '${context.constructor.name}' component` : '';
|
|
23155
|
-
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));
|
|
23156
23298
|
}
|
|
23157
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
|
+
}
|
|
23158
23317
|
/**
|
|
23159
23318
|
* Invokes a pipe with 1 arguments.
|
|
23160
23319
|
*
|
|
@@ -24976,7 +25135,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
|
|
24976
25135
|
}
|
|
24977
25136
|
/**
|
|
24978
25137
|
* Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
|
|
24979
|
-
* (
|
|
25138
|
+
* (either a NgModule or a standalone component / directive / pipe).
|
|
24980
25139
|
*/
|
|
24981
25140
|
function transitiveScopesFor(type) {
|
|
24982
25141
|
if (isNgModule(type)) {
|
|
@@ -26606,7 +26765,10 @@ const TestBed = TestBedRender3;
|
|
|
26606
26765
|
*/
|
|
26607
26766
|
const getTestBed = _getTestBedRender3;
|
|
26608
26767
|
/**
|
|
26609
|
-
* Allows injecting dependencies in `beforeEach()` and `it()`.
|
|
26768
|
+
* Allows injecting dependencies in `beforeEach()` and `it()`. Note: this function
|
|
26769
|
+
* (imported from the `@angular/core/testing` package) can **only** be used to inject dependencies
|
|
26770
|
+
* in tests. To inject dependencies in your application code, use the [`inject`](api/core/inject)
|
|
26771
|
+
* function from the `@angular/core` package instead.
|
|
26610
26772
|
*
|
|
26611
26773
|
* Example:
|
|
26612
26774
|
*
|