@angular/core 15.1.0-next.0 → 15.1.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/esm2020/src/application_ref.mjs +13 -13
  2. package/esm2020/src/core.mjs +2 -1
  3. package/esm2020/src/core_render3_private_export.mjs +1 -2
  4. package/esm2020/src/di/create_injector.mjs +1 -1
  5. package/esm2020/src/di/r3_injector.mjs +7 -7
  6. package/esm2020/src/linker/query_list.mjs +7 -7
  7. package/esm2020/src/render/api.mjs +1 -3
  8. package/esm2020/src/render3/assert.mjs +1 -10
  9. package/esm2020/src/render3/component_ref.mjs +7 -18
  10. package/esm2020/src/render3/definition.mjs +9 -1
  11. package/esm2020/src/render3/index.mjs +2 -2
  12. package/esm2020/src/render3/instructions/shared.mjs +95 -169
  13. package/esm2020/src/render3/interfaces/context.mjs +5 -5
  14. package/esm2020/src/render3/interfaces/view.mjs +1 -10
  15. package/esm2020/src/render3/jit/module.mjs +2 -3
  16. package/esm2020/src/render3/namespaces.mjs +1 -8
  17. package/esm2020/src/render3/node_manipulation.mjs +3 -7
  18. package/esm2020/src/render3/node_selector_matcher.mjs +1 -4
  19. package/esm2020/src/render3/query.mjs +1 -6
  20. package/esm2020/src/render3/state.mjs +1 -4
  21. package/esm2020/src/render3/util/discovery_utils.mjs +3 -32
  22. package/esm2020/src/render3/util/view_utils.mjs +1 -15
  23. package/esm2020/src/render3/view_ref.mjs +6 -6
  24. package/esm2020/src/util/array_utils.mjs +3 -71
  25. package/esm2020/src/version.mjs +1 -1
  26. package/esm2020/testing/src/logger.mjs +3 -3
  27. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  28. package/fesm2015/core.mjs +282 -1253
  29. package/fesm2015/core.mjs.map +1 -1
  30. package/fesm2015/testing.mjs +287 -1258
  31. package/fesm2015/testing.mjs.map +1 -1
  32. package/fesm2020/core.mjs +282 -1253
  33. package/fesm2020/core.mjs.map +1 -1
  34. package/fesm2020/testing.mjs +287 -1258
  35. package/fesm2020/testing.mjs.map +1 -1
  36. package/index.d.ts +11 -224
  37. package/package.json +1 -1
  38. package/schematics/migrations/relative-link-resolution/util.d.ts +1 -1
  39. package/schematics/migrations/router-link-with-href/util.d.ts +1 -1
  40. package/schematics/migrations/typed-forms/util.d.ts +1 -1
  41. package/schematics/utils/import_manager.js +23 -3
  42. package/schematics/utils/ng_decorators.d.ts +1 -1
  43. package/schematics/utils/typescript/compiler_host.d.ts +1 -1
  44. package/schematics/utils/typescript/imports.d.ts +1 -1
  45. package/schematics/utils/typescript/property_name.d.ts +1 -1
  46. package/testing/index.d.ts +1 -1
  47. package/esm2020/src/render3/instructions/lview_debug.mjs +0 -684
  48. package/esm2020/src/util/named_array_type.mjs +0 -40
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Angular v15.1.0-next.0
2
+ * @license Angular v15.1.0-next.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { getDebugNode as getDebugNode$1, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ɵisEnvironmentProviders, ModuleWithComponentFactories, ɵconvertToBitFlags, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, EnvironmentInjector as EnvironmentInjector$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
7
+ import { getDebugNode, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ɵisEnvironmentProviders, ModuleWithComponentFactories, ɵconvertToBitFlags, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, EnvironmentInjector as EnvironmentInjector$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
8
8
  import { ResourceLoader } from '@angular/compiler';
9
9
  import { Subject, Subscription } from 'rxjs';
10
10
 
@@ -85,7 +85,7 @@ class ComponentFixture {
85
85
  this._onErrorSubscription = null;
86
86
  this.changeDetectorRef = componentRef.changeDetectorRef;
87
87
  this.elementRef = componentRef.location;
88
- this.debugElement = getDebugNode$1(this.elementRef.nativeElement);
88
+ this.debugElement = getDebugNode(this.elementRef.nativeElement);
89
89
  this.componentInstance = componentRef.instance;
90
90
  this.nativeElement = this.elementRef.nativeElement;
91
91
  this.componentRef = componentRef;
@@ -1094,17 +1094,6 @@ function assertOneOf(value, ...validValues) {
1094
1094
  * Use of this source code is governed by an MIT-style license that can be
1095
1095
  * found in the LICENSE file at https://angular.io/license
1096
1096
  */
1097
- /**
1098
- * Equivalent to ES6 spread, add each item to an array.
1099
- *
1100
- * @param items The items to add
1101
- * @param arr The array to which you want to add the items
1102
- */
1103
- function addAllToArray(items, arr) {
1104
- for (let i = 0; i < items.length; i++) {
1105
- arr.push(items[i]);
1106
- }
1107
- }
1108
1097
  /**
1109
1098
  * Determines if the contents of two arrays is identical
1110
1099
  *
@@ -1132,25 +1121,8 @@ function arrayEquals(a, b, identityAccessor) {
1132
1121
  /**
1133
1122
  * Flattens an array.
1134
1123
  */
1135
- function flatten$1(list, dst) {
1136
- if (dst === undefined)
1137
- dst = list;
1138
- for (let i = 0; i < list.length; i++) {
1139
- let item = list[i];
1140
- if (Array.isArray(item)) {
1141
- // we need to inline it.
1142
- if (dst === list) {
1143
- // Our assumption that the list was already flat was wrong and
1144
- // we need to clone flat since we need to write to it.
1145
- dst = list.slice(0, i);
1146
- }
1147
- flatten$1(item, dst);
1148
- }
1149
- else if (dst !== list) {
1150
- dst.push(item);
1151
- }
1152
- }
1153
- return dst;
1124
+ function flatten$1(list) {
1125
+ return list.flat(Number.POSITIVE_INFINITY);
1154
1126
  }
1155
1127
  function deepForEach(input, fn) {
1156
1128
  input.forEach(value => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
@@ -1260,46 +1232,6 @@ function arrayInsert2(array, index, value1, value2) {
1260
1232
  array[index + 1] = value2;
1261
1233
  }
1262
1234
  }
1263
- /**
1264
- * Insert a `value` into an `array` so that the array remains sorted.
1265
- *
1266
- * NOTE:
1267
- * - Duplicates are not allowed, and are ignored.
1268
- * - This uses binary search algorithm for fast inserts.
1269
- *
1270
- * @param array A sorted array to insert into.
1271
- * @param value The value to insert.
1272
- * @returns index of the inserted value.
1273
- */
1274
- function arrayInsertSorted(array, value) {
1275
- let index = arrayIndexOfSorted(array, value);
1276
- if (index < 0) {
1277
- // if we did not find it insert it.
1278
- index = ~index;
1279
- arrayInsert(array, index, value);
1280
- }
1281
- return index;
1282
- }
1283
- /**
1284
- * Remove `value` from a sorted `array`.
1285
- *
1286
- * NOTE:
1287
- * - This uses binary search algorithm for fast removals.
1288
- *
1289
- * @param array A sorted array to remove from.
1290
- * @param value The value to remove.
1291
- * @returns index of the removed value.
1292
- * - positive index if value found and removed.
1293
- * - negative index if value not found. (`~index` to get the value where it should have been
1294
- * inserted)
1295
- */
1296
- function arrayRemoveSorted(array, value) {
1297
- const index = arrayIndexOfSorted(array, value);
1298
- if (index >= 0) {
1299
- arraySplice(array, index, 1);
1300
- }
1301
- return index;
1302
- }
1303
1235
  /**
1304
1236
  * Get an index of an `value` in a sorted `array`.
1305
1237
  *
@@ -2802,6 +2734,14 @@ function getDirectiveDef(type) {
2802
2734
  function getPipeDef$1(type) {
2803
2735
  return type[NG_PIPE_DEF] || null;
2804
2736
  }
2737
+ /**
2738
+ * Checks whether a given Component, Directive or Pipe is marked as standalone.
2739
+ * This will return false if passed anything other than a Component, Directive, or Pipe class
2740
+ * See this guide for additional information: https://angular.io/guide/standalone-components
2741
+ *
2742
+ * @param type A reference to a Component, Directive or Pipe.
2743
+ * @publicApi
2744
+ */
2805
2745
  function isStandalone(type) {
2806
2746
  const def = getComponentDef$1(type) || getDirectiveDef(type) || getPipeDef$1(type);
2807
2747
  return def !== null ? def.standalone : false;
@@ -2855,18 +2795,9 @@ const EMBEDDED_VIEW_INJECTOR = 21;
2855
2795
  * there should be no need to refer to `HEADER_OFFSET` anywhere else.
2856
2796
  */
2857
2797
  const HEADER_OFFSET = 22;
2858
- /**
2859
- * Converts `TViewType` into human readable text.
2860
- * Make sure this matches with `TViewType`
2861
- */
2862
- const TViewTypeAsString = [
2863
- 'Root',
2864
- 'Component',
2865
- 'Embedded', // 2
2866
- ];
2867
2798
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2868
2799
  // failure based on types.
2869
- const unusedValueExportToPlacateAjd$8 = 1;
2800
+ const unusedValueExportToPlacateAjd$4 = 1;
2870
2801
 
2871
2802
  /**
2872
2803
  * @license
@@ -2911,7 +2842,7 @@ const MOVED_VIEWS = 9;
2911
2842
  const CONTAINER_HEADER_OFFSET = 10;
2912
2843
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2913
2844
  // failure based on types.
2914
- const unusedValueExportToPlacateAjd$7 = 1;
2845
+ const unusedValueExportToPlacateAjd$3 = 1;
2915
2846
 
2916
2847
  /**
2917
2848
  * @license
@@ -2996,11 +2927,6 @@ function assertHasParent(tNode) {
2996
2927
  assertDefined(tNode, 'currentTNode should exist!');
2997
2928
  assertDefined(tNode.parent, 'currentTNode should have a parent');
2998
2929
  }
2999
- function assertDataNext(lView, index, arr) {
3000
- if (arr == null)
3001
- arr = lView;
3002
- assertEqual(arr.length, index, `index ${index} expected to be at the end of arr (length ${arr.length})`);
3003
- }
3004
2930
  function assertLContainer(value) {
3005
2931
  assertDefined(value, 'LContainer must be defined');
3006
2932
  assertEqual(isLContainer(value), true, 'Expecting LContainer');
@@ -3031,10 +2957,6 @@ function assertIndexInDeclRange(lView, index) {
3031
2957
  const tView = lView[1];
3032
2958
  assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
3033
2959
  }
3034
- function assertIndexInVarsRange(lView, index) {
3035
- const tView = lView[1];
3036
- assertBetween(tView.bindingStartIndex, tView.expandoStartIndex, index);
3037
- }
3038
2960
  function assertIndexInExpandoRange(lView, index) {
3039
2961
  const tView = lView[1];
3040
2962
  assertBetween(tView.expandoStartIndex, lView.length, index);
@@ -3253,14 +3175,7 @@ const profiler = function (event, instance, hookOrListener) {
3253
3175
  * found in the LICENSE file at https://angular.io/license
3254
3176
  */
3255
3177
  const SVG_NAMESPACE = 'svg';
3256
- const SVG_NAMESPACE_URI = 'http://www.w3.org/2000/svg';
3257
3178
  const MATH_ML_NAMESPACE = 'math';
3258
- const MATH_ML_NAMESPACE_URI = 'http://www.w3.org/1998/MathML/';
3259
- function getNamespaceUri(namespace) {
3260
- const name = namespace.toLowerCase();
3261
- return name === SVG_NAMESPACE ? SVG_NAMESPACE_URI :
3262
- (name === MATH_ML_NAMESPACE ? MATH_ML_NAMESPACE_URI : null);
3263
- }
3264
3179
 
3265
3180
  /**
3266
3181
  * @license
@@ -3309,20 +3224,6 @@ function unwrapLView(value) {
3309
3224
  }
3310
3225
  return null;
3311
3226
  }
3312
- /**
3313
- * Returns `LContainer` or `null` if not found.
3314
- * @param value wrapped value of `RNode`, `LView`, `LContainer`
3315
- */
3316
- function unwrapLContainer(value) {
3317
- while (Array.isArray(value)) {
3318
- // This check is same as `isLContainer()` but we don't call at as we don't want to call
3319
- // `Array.isArray()` twice and give JITer more work for inlining.
3320
- if (value[TYPE] === true)
3321
- return value;
3322
- value = value[HOST];
3323
- }
3324
- return null;
3325
- }
3326
3227
  /**
3327
3228
  * Retrieves an element value from the provided `viewData`, by unwrapping
3328
3229
  * from any containers, component views, or style contexts.
@@ -3582,9 +3483,6 @@ function isCurrentTNodeParent() {
3582
3483
  function setCurrentTNodeAsNotParent() {
3583
3484
  instructionState.lFrame.isParent = false;
3584
3485
  }
3585
- function setCurrentTNodeAsParent() {
3586
- instructionState.lFrame.isParent = true;
3587
- }
3588
3486
  function getContextLView() {
3589
3487
  const contextLView = instructionState.lFrame.contextLView;
3590
3488
  ngDevMode && assertDefined(contextLView, 'contextLView must be defined.');
@@ -4307,7 +4205,7 @@ function isFactory(obj) {
4307
4205
  }
4308
4206
  // Note: This hack is necessary so we don't erroneously get a circular dependency
4309
4207
  // failure based on types.
4310
- const unusedValueExportToPlacateAjd$6 = 1;
4208
+ const unusedValueExportToPlacateAjd$2 = 1;
4311
4209
 
4312
4210
  /**
4313
4211
  * Converts `TNodeType` into human readable text.
@@ -4326,7 +4224,7 @@ function toTNodeTypeAsString(tNodeType) {
4326
4224
  }
4327
4225
  // Note: This hack is necessary so we don't erroneously get a circular dependency
4328
4226
  // failure based on types.
4329
- const unusedValueExportToPlacateAjd$5 = 1;
4227
+ const unusedValueExportToPlacateAjd$1 = 1;
4330
4228
  /**
4331
4229
  * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.
4332
4230
  *
@@ -6007,6 +5905,10 @@ function unregisterLView(lView) {
6007
5905
  * of the context.
6008
5906
  */
6009
5907
  class LContext {
5908
+ /** Component's parent view data. */
5909
+ get lView() {
5910
+ return getLViewById(this.lViewId);
5911
+ }
6010
5912
  constructor(
6011
5913
  /**
6012
5914
  * ID of the component's parent view data.
@@ -6024,10 +5926,6 @@ class LContext {
6024
5926
  this.nodeIndex = nodeIndex;
6025
5927
  this.native = native;
6026
5928
  }
6027
- /** Component's parent view data. */
6028
- get lView() {
6029
- return getLViewById(this.lViewId);
6030
- }
6031
5929
  }
6032
5930
 
6033
5931
  /**
@@ -6366,28 +6264,6 @@ function ensureIcuContainerVisitorLoaded(loader) {
6366
6264
  }
6367
6265
  }
6368
6266
 
6369
- /**
6370
- * @license
6371
- * Copyright Google LLC All Rights Reserved.
6372
- *
6373
- * Use of this source code is governed by an MIT-style license that can be
6374
- * found in the LICENSE file at https://angular.io/license
6375
- */
6376
- // Note: This hack is necessary so we don't erroneously get a circular dependency
6377
- // failure based on types.
6378
- const unusedValueExportToPlacateAjd$4 = 1;
6379
-
6380
- /**
6381
- * @license
6382
- * Copyright Google LLC All Rights Reserved.
6383
- *
6384
- * Use of this source code is governed by an MIT-style license that can be
6385
- * found in the LICENSE file at https://angular.io/license
6386
- */
6387
- // Note: This hack is necessary so we don't erroneously get a circular dependency
6388
- // failure based on types.
6389
- const unusedValueExportToPlacateAjd$3 = 1;
6390
-
6391
6267
  /**
6392
6268
  * @license
6393
6269
  * Copyright Google LLC All Rights Reserved.
@@ -6459,7 +6335,6 @@ function getNearestLContainer(viewOrContainer) {
6459
6335
  * Use of this source code is governed by an MIT-style license that can be
6460
6336
  * found in the LICENSE file at https://angular.io/license
6461
6337
  */
6462
- const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$8;
6463
6338
  /**
6464
6339
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
6465
6340
  * being passed as an argument.
@@ -8942,6 +8817,12 @@ function getNullInjector() {
8942
8817
  class EnvironmentInjector {
8943
8818
  }
8944
8819
  class R3Injector extends EnvironmentInjector {
8820
+ /**
8821
+ * Flag indicating that this injector was previously destroyed.
8822
+ */
8823
+ get destroyed() {
8824
+ return this._destroyed;
8825
+ }
8945
8826
  constructor(providers, parent, source, scopes) {
8946
8827
  super();
8947
8828
  this.parent = parent;
@@ -8976,12 +8857,6 @@ class R3Injector extends EnvironmentInjector {
8976
8857
  this.injectorDefTypes =
8977
8858
  new Set(this.get(INJECTOR_DEF_TYPES.multi, EMPTY_ARRAY, InjectFlags.Self));
8978
8859
  }
8979
- /**
8980
- * Flag indicating that this injector was previously destroyed.
8981
- */
8982
- get destroyed() {
8983
- return this._destroyed;
8984
- }
8985
8860
  /**
8986
8861
  * Destroy the injector and release references to every instance or provider associated with it.
8987
8862
  *
@@ -9441,7 +9316,6 @@ function unwrapElementRef(value) {
9441
9316
  * Use of this source code is governed by an MIT-style license that can be
9442
9317
  * found in the LICENSE file at https://angular.io/license
9443
9318
  */
9444
- const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
9445
9319
  /**
9446
9320
  * Creates and initializes a custom renderer that implements the `Renderer2` base class.
9447
9321
  *
@@ -9525,7 +9399,7 @@ class Version {
9525
9399
  /**
9526
9400
  * @publicApi
9527
9401
  */
9528
- const VERSION = new Version('15.1.0-next.0');
9402
+ const VERSION = new Version('15.1.0-next.2');
9529
9403
 
9530
9404
  /**
9531
9405
  * @license
@@ -9791,7 +9665,6 @@ function classIndexOf(className, classToSearch, startingIndex) {
9791
9665
  * Use of this source code is governed by an MIT-style license that can be
9792
9666
  * found in the LICENSE file at https://angular.io/license
9793
9667
  */
9794
- const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4;
9795
9668
  const NG_TEMPLATE_SELECTOR = 'ng-template';
9796
9669
  /**
9797
9670
  * Search the `TAttributes` to see if it contains `cssClassToMatch` (case insensitive)
@@ -11254,874 +11127,68 @@ class ReflectiveInjector_ {
11254
11127
  return `ReflectiveInjector(providers: [${providers}])`;
11255
11128
  }
11256
11129
  toString() {
11257
- return this.displayName;
11258
- }
11259
- }
11260
- ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
11261
- function _mapProviders(injector, fn) {
11262
- const res = [];
11263
- for (let i = 0; i < injector._providers.length; ++i) {
11264
- res[i] = fn(injector.getProviderAtIndex(i));
11265
- }
11266
- return res;
11267
- }
11268
-
11269
- /**
11270
- * @license
11271
- * Copyright Google LLC All Rights Reserved.
11272
- *
11273
- * Use of this source code is governed by an MIT-style license that can be
11274
- * found in the LICENSE file at https://angular.io/license
11275
- */
11276
-
11277
- /**
11278
- * @license
11279
- * Copyright Google LLC All Rights Reserved.
11280
- *
11281
- * Use of this source code is governed by an MIT-style license that can be
11282
- * found in the LICENSE file at https://angular.io/license
11283
- */
11284
-
11285
- /**
11286
- * @license
11287
- * Copyright Google LLC All Rights Reserved.
11288
- *
11289
- * Use of this source code is governed by an MIT-style license that can be
11290
- * found in the LICENSE file at https://angular.io/license
11291
- */
11292
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
11293
- const lView = getLView();
11294
- // Fall back to inject() if view hasn't been created. This situation can happen in tests
11295
- // if inject utilities are used before bootstrapping.
11296
- if (lView === null) {
11297
- // Verify that we will not get into infinite loop.
11298
- ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
11299
- return ɵɵinject(token, flags);
11300
- }
11301
- const tNode = getCurrentTNode();
11302
- return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
11303
- }
11304
- /**
11305
- * Throws an error indicating that a factory function could not be generated by the compiler for a
11306
- * particular class.
11307
- *
11308
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
11309
- * off, saving bytes of generated code while still providing a good experience in dev mode.
11310
- *
11311
- * The name of the class is not mentioned here, but will be in the generated factory function name
11312
- * and thus in the stack trace.
11313
- *
11314
- * @codeGenApi
11315
- */
11316
- function ɵɵinvalidFactory() {
11317
- const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
11318
- throw new Error(msg);
11319
- }
11320
-
11321
- /**
11322
- * @license
11323
- * Copyright Google LLC All Rights Reserved.
11324
- *
11325
- * Use of this source code is governed by an MIT-style license that can be
11326
- * found in the LICENSE file at https://angular.io/license
11327
- */
11328
- /**
11329
- * THIS FILE CONTAINS CODE WHICH SHOULD BE TREE SHAKEN AND NEVER CALLED FROM PRODUCTION CODE!!!
11330
- */
11331
- /**
11332
- * Creates an `Array` construction with a given name. This is useful when
11333
- * looking for memory consumption to see what time of array it is.
11334
- *
11335
- *
11336
- * @param name Name to give to the constructor
11337
- * @returns A subclass of `Array` if possible. This can only be done in
11338
- * environments which support `class` construct.
11339
- */
11340
- function createNamedArrayType(name) {
11341
- // This should never be called in prod mode, so let's verify that is the case.
11342
- if (ngDevMode) {
11343
- try {
11344
- // If this function were compromised the following could lead to arbitrary
11345
- // script execution. We bless it with Trusted Types anyway since this
11346
- // function is stripped out of production binaries.
11347
- return (newTrustedFunctionForDev('Array', `return class ${name} extends Array{}`))(Array);
11348
- }
11349
- catch (e) {
11350
- // If it does not work just give up and fall back to regular Array.
11351
- return Array;
11352
- }
11353
- }
11354
- else {
11355
- throw new Error('Looks like we are in \'prod mode\', but we are creating a named Array type, which is wrong! Check your code');
11356
- }
11357
- }
11358
-
11359
- /**
11360
- * @license
11361
- * Copyright Google LLC All Rights Reserved.
11362
- *
11363
- * Use of this source code is governed by an MIT-style license that can be
11364
- * found in the LICENSE file at https://angular.io/license
11365
- */
11366
- function toTStylingRange(prev, next) {
11367
- ngDevMode && assertNumberInRange(prev, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
11368
- ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
11369
- return (prev << 17 /* StylingRange.PREV_SHIFT */ | next << 2 /* StylingRange.NEXT_SHIFT */);
11370
- }
11371
- function getTStylingRangePrev(tStylingRange) {
11372
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11373
- return (tStylingRange >> 17 /* StylingRange.PREV_SHIFT */) & 32767 /* StylingRange.UNSIGNED_MASK */;
11374
- }
11375
- function getTStylingRangePrevDuplicate(tStylingRange) {
11376
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11377
- return (tStylingRange & 2 /* StylingRange.PREV_DUPLICATE */) ==
11378
- 2 /* StylingRange.PREV_DUPLICATE */;
11379
- }
11380
- function setTStylingRangePrev(tStylingRange, previous) {
11381
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11382
- ngDevMode && assertNumberInRange(previous, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
11383
- return ((tStylingRange & ~4294836224 /* StylingRange.PREV_MASK */) |
11384
- (previous << 17 /* StylingRange.PREV_SHIFT */));
11385
- }
11386
- function setTStylingRangePrevDuplicate(tStylingRange) {
11387
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11388
- return (tStylingRange | 2 /* StylingRange.PREV_DUPLICATE */);
11389
- }
11390
- function getTStylingRangeNext(tStylingRange) {
11391
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11392
- return (tStylingRange & 131068 /* StylingRange.NEXT_MASK */) >> 2 /* StylingRange.NEXT_SHIFT */;
11393
- }
11394
- function setTStylingRangeNext(tStylingRange, next) {
11395
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11396
- ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
11397
- return ((tStylingRange & ~131068 /* StylingRange.NEXT_MASK */) | //
11398
- next << 2 /* StylingRange.NEXT_SHIFT */);
11399
- }
11400
- function getTStylingRangeNextDuplicate(tStylingRange) {
11401
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11402
- return (tStylingRange & 1 /* StylingRange.NEXT_DUPLICATE */) ===
11403
- 1 /* StylingRange.NEXT_DUPLICATE */;
11404
- }
11405
- function setTStylingRangeNextDuplicate(tStylingRange) {
11406
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11407
- return (tStylingRange | 1 /* StylingRange.NEXT_DUPLICATE */);
11408
- }
11409
- function getTStylingRangeTail(tStylingRange) {
11410
- ngDevMode && assertNumber(tStylingRange, 'expected number');
11411
- const next = getTStylingRangeNext(tStylingRange);
11412
- return next === 0 ? getTStylingRangePrev(tStylingRange) : next;
11413
- }
11414
-
11415
- /**
11416
- * @license
11417
- * Copyright Google LLC All Rights Reserved.
11418
- *
11419
- * Use of this source code is governed by an MIT-style license that can be
11420
- * found in the LICENSE file at https://angular.io/license
11421
- */
11422
- /**
11423
- * Patch a `debug` property on top of the existing object.
11424
- *
11425
- * NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
11426
- *
11427
- * @param obj Object to patch
11428
- * @param debug Value to patch
11429
- */
11430
- function attachDebugObject(obj, debug) {
11431
- if (ngDevMode) {
11432
- Object.defineProperty(obj, 'debug', { value: debug, enumerable: false });
11433
- }
11434
- else {
11435
- throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
11436
- }
11437
- }
11438
- /**
11439
- * Patch a `debug` property getter on top of the existing object.
11440
- *
11441
- * NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
11442
- *
11443
- * @param obj Object to patch
11444
- * @param debugGetter Getter returning a value to patch
11445
- */
11446
- function attachDebugGetter(obj, debugGetter) {
11447
- if (ngDevMode) {
11448
- Object.defineProperty(obj, 'debug', { get: debugGetter, enumerable: false });
11449
- }
11450
- else {
11451
- throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
11452
- }
11453
- }
11454
-
11455
- /**
11456
- * @license
11457
- * Copyright Google LLC All Rights Reserved.
11458
- *
11459
- * Use of this source code is governed by an MIT-style license that can be
11460
- * found in the LICENSE file at https://angular.io/license
11461
- */
11462
- /*
11463
- * This file contains conditionally attached classes which provide human readable (debug) level
11464
- * information for `LView`, `LContainer` and other internal data structures. These data structures
11465
- * are stored internally as array which makes it very difficult during debugging to reason about the
11466
- * current state of the system.
11467
- *
11468
- * Patching the array with extra property does change the array's hidden class' but it does not
11469
- * change the cost of access, therefore this patching should not have significant if any impact in
11470
- * `ngDevMode` mode. (see: https://jsperf.com/array-vs-monkey-patch-array)
11471
- *
11472
- * So instead of seeing:
11473
- * ```
11474
- * Array(30) [Object, 659, null, …]
11475
- * ```
11476
- *
11477
- * You get to see:
11478
- * ```
11479
- * LViewDebug {
11480
- * views: [...],
11481
- * flags: {attached: true, ...}
11482
- * nodes: [
11483
- * {html: '<div id="123">', ..., nodes: [
11484
- * {html: '<span>', ..., nodes: null}
11485
- * ]}
11486
- * ]
11487
- * }
11488
- * ```
11489
- */
11490
- let LVIEW_COMPONENT_CACHE;
11491
- let LVIEW_EMBEDDED_CACHE;
11492
- let LVIEW_ROOT;
11493
- let LVIEW_COMPONENT;
11494
- let LVIEW_EMBEDDED;
11495
- /**
11496
- * This function clones a blueprint and creates LView.
11497
- *
11498
- * Simple slice will keep the same type, and we need it to be LView
11499
- */
11500
- function cloneToLViewFromTViewBlueprint(tView) {
11501
- const debugTView = tView;
11502
- const lView = getLViewToClone(debugTView.type, tView.template && tView.template.name);
11503
- return lView.concat(tView.blueprint);
11504
- }
11505
- class LRootView extends Array {
11506
- }
11507
- class LComponentView extends Array {
11508
- }
11509
- class LEmbeddedView extends Array {
11510
- }
11511
- function getLViewToClone(type, name) {
11512
- switch (type) {
11513
- case 0 /* TViewType.Root */:
11514
- if (LVIEW_ROOT === undefined)
11515
- LVIEW_ROOT = new LRootView();
11516
- return LVIEW_ROOT;
11517
- case 1 /* TViewType.Component */:
11518
- if (!ngDevMode || !ngDevMode.namedConstructors) {
11519
- if (LVIEW_COMPONENT === undefined)
11520
- LVIEW_COMPONENT = new LComponentView();
11521
- return LVIEW_COMPONENT;
11522
- }
11523
- if (LVIEW_COMPONENT_CACHE === undefined)
11524
- LVIEW_COMPONENT_CACHE = new Map();
11525
- let componentArray = LVIEW_COMPONENT_CACHE.get(name);
11526
- if (componentArray === undefined) {
11527
- componentArray = new (createNamedArrayType('LComponentView' + nameSuffix(name)))();
11528
- LVIEW_COMPONENT_CACHE.set(name, componentArray);
11529
- }
11530
- return componentArray;
11531
- case 2 /* TViewType.Embedded */:
11532
- if (!ngDevMode || !ngDevMode.namedConstructors) {
11533
- if (LVIEW_EMBEDDED === undefined)
11534
- LVIEW_EMBEDDED = new LEmbeddedView();
11535
- return LVIEW_EMBEDDED;
11536
- }
11537
- if (LVIEW_EMBEDDED_CACHE === undefined)
11538
- LVIEW_EMBEDDED_CACHE = new Map();
11539
- let embeddedArray = LVIEW_EMBEDDED_CACHE.get(name);
11540
- if (embeddedArray === undefined) {
11541
- embeddedArray = new (createNamedArrayType('LEmbeddedView' + nameSuffix(name)))();
11542
- LVIEW_EMBEDDED_CACHE.set(name, embeddedArray);
11543
- }
11544
- return embeddedArray;
11545
- }
11546
- }
11547
- function nameSuffix(text) {
11548
- if (text == null)
11549
- return '';
11550
- const index = text.lastIndexOf('_Template');
11551
- return '_' + (index === -1 ? text : text.slice(0, index));
11552
- }
11553
- /**
11554
- * This class is a debug version of Object literal so that we can have constructor name show up
11555
- * in
11556
- * debug tools in ngDevMode.
11557
- */
11558
- const TViewConstructor = class TView {
11559
- constructor(type, blueprint, template, queries, viewQuery, declTNode, data, bindingStartIndex, expandoStartIndex, hostBindingOpCodes, firstCreatePass, firstUpdatePass, staticViewQueries, staticContentQueries, preOrderHooks, preOrderCheckHooks, contentHooks, contentCheckHooks, viewHooks, viewCheckHooks, destroyHooks, cleanup, contentQueries, components, directiveRegistry, pipeRegistry, firstChild, schemas, consts, incompleteFirstPass, _decls, _vars) {
11560
- this.type = type;
11561
- this.blueprint = blueprint;
11562
- this.template = template;
11563
- this.queries = queries;
11564
- this.viewQuery = viewQuery;
11565
- this.declTNode = declTNode;
11566
- this.data = data;
11567
- this.bindingStartIndex = bindingStartIndex;
11568
- this.expandoStartIndex = expandoStartIndex;
11569
- this.hostBindingOpCodes = hostBindingOpCodes;
11570
- this.firstCreatePass = firstCreatePass;
11571
- this.firstUpdatePass = firstUpdatePass;
11572
- this.staticViewQueries = staticViewQueries;
11573
- this.staticContentQueries = staticContentQueries;
11574
- this.preOrderHooks = preOrderHooks;
11575
- this.preOrderCheckHooks = preOrderCheckHooks;
11576
- this.contentHooks = contentHooks;
11577
- this.contentCheckHooks = contentCheckHooks;
11578
- this.viewHooks = viewHooks;
11579
- this.viewCheckHooks = viewCheckHooks;
11580
- this.destroyHooks = destroyHooks;
11581
- this.cleanup = cleanup;
11582
- this.contentQueries = contentQueries;
11583
- this.components = components;
11584
- this.directiveRegistry = directiveRegistry;
11585
- this.pipeRegistry = pipeRegistry;
11586
- this.firstChild = firstChild;
11587
- this.schemas = schemas;
11588
- this.consts = consts;
11589
- this.incompleteFirstPass = incompleteFirstPass;
11590
- this._decls = _decls;
11591
- this._vars = _vars;
11592
- }
11593
- get template_() {
11594
- const buf = [];
11595
- processTNodeChildren(this.firstChild, buf);
11596
- return buf.join('');
11597
- }
11598
- get type_() {
11599
- return TViewTypeAsString[this.type] || `TViewType.?${this.type}?`;
11600
- }
11601
- };
11602
- class TNode {
11603
- constructor(tView_, //
11604
- type, //
11605
- index, //
11606
- insertBeforeIndex, //
11607
- injectorIndex, //
11608
- componentOffset, //
11609
- directiveStart, //
11610
- directiveEnd, //
11611
- directiveStylingLast, //
11612
- propertyBindings, //
11613
- flags, //
11614
- providerIndexes, //
11615
- value, //
11616
- attrs, //
11617
- mergedAttrs, //
11618
- localNames, //
11619
- initialInputs, //
11620
- inputs, //
11621
- outputs, //
11622
- tViews, //
11623
- next, //
11624
- projectionNext, //
11625
- child, //
11626
- parent, //
11627
- projection, //
11628
- styles, //
11629
- stylesWithoutHost, //
11630
- residualStyles, //
11631
- classes, //
11632
- classesWithoutHost, //
11633
- residualClasses, //
11634
- classBindings, //
11635
- styleBindings) {
11636
- this.tView_ = tView_;
11637
- this.type = type;
11638
- this.index = index;
11639
- this.insertBeforeIndex = insertBeforeIndex;
11640
- this.injectorIndex = injectorIndex;
11641
- this.componentOffset = componentOffset;
11642
- this.directiveStart = directiveStart;
11643
- this.directiveEnd = directiveEnd;
11644
- this.directiveStylingLast = directiveStylingLast;
11645
- this.propertyBindings = propertyBindings;
11646
- this.flags = flags;
11647
- this.providerIndexes = providerIndexes;
11648
- this.value = value;
11649
- this.attrs = attrs;
11650
- this.mergedAttrs = mergedAttrs;
11651
- this.localNames = localNames;
11652
- this.initialInputs = initialInputs;
11653
- this.inputs = inputs;
11654
- this.outputs = outputs;
11655
- this.tViews = tViews;
11656
- this.next = next;
11657
- this.projectionNext = projectionNext;
11658
- this.child = child;
11659
- this.parent = parent;
11660
- this.projection = projection;
11661
- this.styles = styles;
11662
- this.stylesWithoutHost = stylesWithoutHost;
11663
- this.residualStyles = residualStyles;
11664
- this.classes = classes;
11665
- this.classesWithoutHost = classesWithoutHost;
11666
- this.residualClasses = residualClasses;
11667
- this.classBindings = classBindings;
11668
- this.styleBindings = styleBindings;
11669
- }
11670
- /**
11671
- * Return a human debug version of the set of `NodeInjector`s which will be consulted when
11672
- * resolving tokens from this `TNode`.
11673
- *
11674
- * When debugging applications, it is often difficult to determine which `NodeInjector`s will be
11675
- * consulted. This method shows a list of `DebugNode`s representing the `TNode`s which will be
11676
- * consulted in order when resolving a token starting at this `TNode`.
11677
- *
11678
- * The original data is stored in `LView` and `TView` with a lot of offset indexes, and so it is
11679
- * difficult to reason about.
11680
- *
11681
- * @param lView The `LView` instance for this `TNode`.
11682
- */
11683
- debugNodeInjectorPath(lView) {
11684
- const path = [];
11685
- let injectorIndex = getInjectorIndex(this, lView);
11686
- if (injectorIndex === -1) {
11687
- // Looks like the current `TNode` does not have `NodeInjector` associated with it => look for
11688
- // parent NodeInjector.
11689
- const parentLocation = getParentInjectorLocation(this, lView);
11690
- if (parentLocation !== NO_PARENT_INJECTOR) {
11691
- // We found a parent, so start searching from the parent location.
11692
- injectorIndex = getParentInjectorIndex(parentLocation);
11693
- lView = getParentInjectorView(parentLocation, lView);
11694
- }
11695
- else {
11696
- // No parents have been found, so there are no `NodeInjector`s to consult.
11697
- }
11698
- }
11699
- while (injectorIndex !== -1) {
11700
- ngDevMode && assertNodeInjector(lView, injectorIndex);
11701
- const tNode = lView[TVIEW].data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */];
11702
- path.push(buildDebugNode(tNode, lView));
11703
- const parentLocation = lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];
11704
- if (parentLocation === NO_PARENT_INJECTOR) {
11705
- injectorIndex = -1;
11706
- }
11707
- else {
11708
- injectorIndex = getParentInjectorIndex(parentLocation);
11709
- lView = getParentInjectorView(parentLocation, lView);
11710
- }
11711
- }
11712
- return path;
11713
- }
11714
- get type_() {
11715
- return toTNodeTypeAsString(this.type) || `TNodeType.?${this.type}?`;
11716
- }
11717
- get flags_() {
11718
- const flags = [];
11719
- if (this.flags & 8 /* TNodeFlags.hasClassInput */)
11720
- flags.push('TNodeFlags.hasClassInput');
11721
- if (this.flags & 4 /* TNodeFlags.hasContentQuery */)
11722
- flags.push('TNodeFlags.hasContentQuery');
11723
- if (this.flags & 16 /* TNodeFlags.hasStyleInput */)
11724
- flags.push('TNodeFlags.hasStyleInput');
11725
- if (this.flags & 64 /* TNodeFlags.hasHostBindings */)
11726
- flags.push('TNodeFlags.hasHostBindings');
11727
- if (this.flags & 1 /* TNodeFlags.isDirectiveHost */)
11728
- flags.push('TNodeFlags.isDirectiveHost');
11729
- if (this.flags & 32 /* TNodeFlags.isDetached */)
11730
- flags.push('TNodeFlags.isDetached');
11731
- if (this.flags & 2 /* TNodeFlags.isProjected */)
11732
- flags.push('TNodeFlags.isProjected');
11733
- return flags.join('|');
11734
- }
11735
- get template_() {
11736
- if (this.type & 1 /* TNodeType.Text */)
11737
- return this.value;
11738
- const buf = [];
11739
- const tagName = typeof this.value === 'string' && this.value || this.type_;
11740
- buf.push('<', tagName);
11741
- if (this.flags) {
11742
- buf.push(' ', this.flags_);
11743
- }
11744
- if (this.attrs) {
11745
- for (let i = 0; i < this.attrs.length;) {
11746
- const attrName = this.attrs[i++];
11747
- if (typeof attrName == 'number') {
11748
- break;
11749
- }
11750
- const attrValue = this.attrs[i++];
11751
- buf.push(' ', attrName, '="', attrValue, '"');
11752
- }
11753
- }
11754
- buf.push('>');
11755
- processTNodeChildren(this.child, buf);
11756
- buf.push('</', tagName, '>');
11757
- return buf.join('');
11758
- }
11759
- get styleBindings_() {
11760
- return toDebugStyleBinding(this, false);
11761
- }
11762
- get classBindings_() {
11763
- return toDebugStyleBinding(this, true);
11764
- }
11765
- get providerIndexStart_() {
11766
- return this.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
11767
- }
11768
- get providerIndexEnd_() {
11769
- return this.providerIndexStart_ +
11770
- (this.providerIndexes >>> 20 /* TNodeProviderIndexes.CptViewProvidersCountShift */);
11771
- }
11772
- }
11773
- const TNodeDebug = TNode;
11774
- function toDebugStyleBinding(tNode, isClassBased) {
11775
- const tData = tNode.tView_.data;
11776
- const bindings = [];
11777
- const range = isClassBased ? tNode.classBindings : tNode.styleBindings;
11778
- const prev = getTStylingRangePrev(range);
11779
- const next = getTStylingRangeNext(range);
11780
- let isTemplate = next !== 0;
11781
- let cursor = isTemplate ? next : prev;
11782
- while (cursor !== 0) {
11783
- const itemKey = tData[cursor];
11784
- const itemRange = tData[cursor + 1];
11785
- bindings.unshift({
11786
- key: itemKey,
11787
- index: cursor,
11788
- isTemplate: isTemplate,
11789
- prevDuplicate: getTStylingRangePrevDuplicate(itemRange),
11790
- nextDuplicate: getTStylingRangeNextDuplicate(itemRange),
11791
- nextIndex: getTStylingRangeNext(itemRange),
11792
- prevIndex: getTStylingRangePrev(itemRange),
11793
- });
11794
- if (cursor === prev)
11795
- isTemplate = false;
11796
- cursor = getTStylingRangePrev(itemRange);
11797
- }
11798
- bindings.push((isClassBased ? tNode.residualClasses : tNode.residualStyles) || null);
11799
- return bindings;
11800
- }
11801
- function processTNodeChildren(tNode, buf) {
11802
- while (tNode) {
11803
- buf.push(tNode.template_);
11804
- tNode = tNode.next;
11805
- }
11806
- }
11807
- class TViewData extends Array {
11808
- }
11809
- let TVIEWDATA_EMPTY; // can't initialize here or it will not be tree shaken, because
11810
- // `LView` constructor could have side-effects.
11811
- /**
11812
- * This function clones a blueprint and creates TData.
11813
- *
11814
- * Simple slice will keep the same type, and we need it to be TData
11815
- */
11816
- function cloneToTViewData(list) {
11817
- if (TVIEWDATA_EMPTY === undefined)
11818
- TVIEWDATA_EMPTY = new TViewData();
11819
- return TVIEWDATA_EMPTY.concat(list);
11820
- }
11821
- class LViewBlueprint extends Array {
11822
- }
11823
- class MatchesArray extends Array {
11824
- }
11825
- class TViewComponents extends Array {
11826
- }
11827
- class TNodeLocalNames extends Array {
11828
- }
11829
- class TNodeInitialInputs extends Array {
11830
- }
11831
- class LCleanup extends Array {
11832
- }
11833
- class TCleanup extends Array {
11834
- }
11835
- function attachLViewDebug(lView) {
11836
- attachDebugObject(lView, new LViewDebug(lView));
11837
- }
11838
- function attachLContainerDebug(lContainer) {
11839
- attachDebugObject(lContainer, new LContainerDebug(lContainer));
11840
- }
11841
- function toDebug(obj) {
11842
- if (obj) {
11843
- const debug = obj.debug;
11844
- assertDefined(debug, 'Object does not have a debug representation.');
11845
- return debug;
11846
- }
11847
- else {
11848
- return obj;
11849
- }
11850
- }
11851
- /**
11852
- * Use this method to unwrap a native element in `LView` and convert it into HTML for easier
11853
- * reading.
11854
- *
11855
- * @param value possibly wrapped native DOM node.
11856
- * @param includeChildren If `true` then the serialized HTML form will include child elements
11857
- * (same
11858
- * as `outerHTML`). If `false` then the serialized HTML form will only contain the element
11859
- * itself
11860
- * (will not serialize child elements).
11861
- */
11862
- function toHtml(value, includeChildren = false) {
11863
- const node = unwrapRNode(value);
11864
- if (node) {
11865
- switch (node.nodeType) {
11866
- case Node.TEXT_NODE:
11867
- return node.textContent;
11868
- case Node.COMMENT_NODE:
11869
- return `<!--${node.textContent}-->`;
11870
- case Node.ELEMENT_NODE:
11871
- const outerHTML = node.outerHTML;
11872
- if (includeChildren) {
11873
- return outerHTML;
11874
- }
11875
- else {
11876
- const innerHTML = '>' + node.innerHTML + '<';
11877
- return (outerHTML.split(innerHTML)[0]) + '>';
11878
- }
11879
- }
11880
- }
11881
- return null;
11882
- }
11883
- class LViewDebug {
11884
- constructor(_raw_lView) {
11885
- this._raw_lView = _raw_lView;
11886
- }
11887
- /**
11888
- * Flags associated with the `LView` unpacked into a more readable state.
11889
- */
11890
- get flags() {
11891
- const flags = this._raw_lView[FLAGS];
11892
- return {
11893
- __raw__flags__: flags,
11894
- initPhaseState: flags & 3 /* LViewFlags.InitPhaseStateMask */,
11895
- creationMode: !!(flags & 4 /* LViewFlags.CreationMode */),
11896
- firstViewPass: !!(flags & 8 /* LViewFlags.FirstLViewPass */),
11897
- checkAlways: !!(flags & 16 /* LViewFlags.CheckAlways */),
11898
- dirty: !!(flags & 32 /* LViewFlags.Dirty */),
11899
- attached: !!(flags & 64 /* LViewFlags.Attached */),
11900
- destroyed: !!(flags & 128 /* LViewFlags.Destroyed */),
11901
- isRoot: !!(flags & 256 /* LViewFlags.IsRoot */),
11902
- indexWithinInitPhase: flags >> 11 /* LViewFlags.IndexWithinInitPhaseShift */,
11903
- };
11904
- }
11905
- get parent() {
11906
- return toDebug(this._raw_lView[PARENT]);
11907
- }
11908
- get hostHTML() {
11909
- return toHtml(this._raw_lView[HOST], true);
11910
- }
11911
- get html() {
11912
- return (this.nodes || []).map(mapToHTML).join('');
11913
- }
11914
- get context() {
11915
- return this._raw_lView[CONTEXT];
11916
- }
11917
- /**
11918
- * The tree of nodes associated with the current `LView`. The nodes have been normalized into
11919
- * a tree structure with relevant details pulled out for readability.
11920
- */
11921
- get nodes() {
11922
- const lView = this._raw_lView;
11923
- const tNode = lView[TVIEW].firstChild;
11924
- return toDebugNodes(tNode, lView);
11925
- }
11926
- get template() {
11927
- return this.tView.template_;
11928
- }
11929
- get tView() {
11930
- return this._raw_lView[TVIEW];
11931
- }
11932
- get cleanup() {
11933
- return this._raw_lView[CLEANUP];
11934
- }
11935
- get injector() {
11936
- return this._raw_lView[INJECTOR$1];
11937
- }
11938
- get rendererFactory() {
11939
- return this._raw_lView[RENDERER_FACTORY];
11940
- }
11941
- get renderer() {
11942
- return this._raw_lView[RENDERER];
11943
- }
11944
- get sanitizer() {
11945
- return this._raw_lView[SANITIZER];
11946
- }
11947
- get childHead() {
11948
- return toDebug(this._raw_lView[CHILD_HEAD]);
11949
- }
11950
- get next() {
11951
- return toDebug(this._raw_lView[NEXT]);
11952
- }
11953
- get childTail() {
11954
- return toDebug(this._raw_lView[CHILD_TAIL]);
11955
- }
11956
- get declarationView() {
11957
- return toDebug(this._raw_lView[DECLARATION_VIEW]);
11958
- }
11959
- get queries() {
11960
- return this._raw_lView[QUERIES];
11961
- }
11962
- get tHost() {
11963
- return this._raw_lView[T_HOST];
11964
- }
11965
- get id() {
11966
- return this._raw_lView[ID];
11967
- }
11968
- get decls() {
11969
- return toLViewRange(this.tView, this._raw_lView, HEADER_OFFSET, this.tView.bindingStartIndex);
11970
- }
11971
- get vars() {
11972
- return toLViewRange(this.tView, this._raw_lView, this.tView.bindingStartIndex, this.tView.expandoStartIndex);
11973
- }
11974
- get expando() {
11975
- return toLViewRange(this.tView, this._raw_lView, this.tView.expandoStartIndex, this._raw_lView.length);
11976
- }
11977
- /**
11978
- * Normalized view of child views (and containers) attached at this location.
11979
- */
11980
- get childViews() {
11981
- const childViews = [];
11982
- let child = this.childHead;
11983
- while (child) {
11984
- childViews.push(child);
11985
- child = child.next;
11986
- }
11987
- return childViews;
11988
- }
11989
- }
11990
- function mapToHTML(node) {
11991
- if (node.type === 'ElementContainer') {
11992
- return (node.children || []).map(mapToHTML).join('');
11993
- }
11994
- else if (node.type === 'IcuContainer') {
11995
- throw new Error('Not implemented');
11996
- }
11997
- else {
11998
- return toHtml(node.native, true) || '';
11999
- }
12000
- }
12001
- function toLViewRange(tView, lView, start, end) {
12002
- let content = [];
12003
- for (let index = start; index < end; index++) {
12004
- content.push({ index: index, t: tView.data[index], l: lView[index] });
12005
- }
12006
- return { start: start, end: end, length: end - start, content: content };
12007
- }
12008
- /**
12009
- * Turns a flat list of nodes into a tree by walking the associated `TNode` tree.
12010
- *
12011
- * @param tNode
12012
- * @param lView
12013
- */
12014
- function toDebugNodes(tNode, lView) {
12015
- if (tNode) {
12016
- const debugNodes = [];
12017
- let tNodeCursor = tNode;
12018
- while (tNodeCursor) {
12019
- debugNodes.push(buildDebugNode(tNodeCursor, lView));
12020
- tNodeCursor = tNodeCursor.next;
12021
- }
12022
- return debugNodes;
12023
- }
12024
- else {
12025
- return [];
11130
+ return this.displayName;
12026
11131
  }
12027
11132
  }
12028
- function buildDebugNode(tNode, lView) {
12029
- const rawValue = lView[tNode.index];
12030
- const native = unwrapRNode(rawValue);
12031
- const factories = [];
12032
- const instances = [];
12033
- const tView = lView[TVIEW];
12034
- for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
12035
- const def = tView.data[i];
12036
- factories.push(def.type);
12037
- instances.push(lView[i]);
11133
+ ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
11134
+ function _mapProviders(injector, fn) {
11135
+ const res = [];
11136
+ for (let i = 0; i < injector._providers.length; ++i) {
11137
+ res[i] = fn(injector.getProviderAtIndex(i));
12038
11138
  }
12039
- return {
12040
- html: toHtml(native),
12041
- type: toTNodeTypeAsString(tNode.type),
12042
- tNode,
12043
- native: native,
12044
- children: toDebugNodes(tNode.child, lView),
12045
- factories,
12046
- instances,
12047
- injector: buildNodeInjectorDebug(tNode, tView, lView),
12048
- get injectorResolutionPath() {
12049
- return tNode.debugNodeInjectorPath(lView);
12050
- },
12051
- };
12052
- }
12053
- function buildNodeInjectorDebug(tNode, tView, lView) {
12054
- const viewProviders = [];
12055
- for (let i = tNode.providerIndexStart_; i < tNode.providerIndexEnd_; i++) {
12056
- viewProviders.push(tView.data[i]);
12057
- }
12058
- const providers = [];
12059
- for (let i = tNode.providerIndexEnd_; i < tNode.directiveEnd; i++) {
12060
- providers.push(tView.data[i]);
12061
- }
12062
- const nodeInjectorDebug = {
12063
- bloom: toBloom(lView, tNode.injectorIndex),
12064
- cumulativeBloom: toBloom(tView.data, tNode.injectorIndex),
12065
- providers,
12066
- viewProviders,
12067
- parentInjectorIndex: lView[tNode.providerIndexStart_ - 1],
12068
- };
12069
- return nodeInjectorDebug;
11139
+ return res;
12070
11140
  }
11141
+
12071
11142
  /**
12072
- * Convert a number at `idx` location in `array` into binary representation.
11143
+ * @license
11144
+ * Copyright Google LLC All Rights Reserved.
12073
11145
  *
12074
- * @param array
12075
- * @param idx
11146
+ * Use of this source code is governed by an MIT-style license that can be
11147
+ * found in the LICENSE file at https://angular.io/license
12076
11148
  */
12077
- function binary(array, idx) {
12078
- const value = array[idx];
12079
- // If not a number we print 8 `?` to retain alignment but let user know that it was called on
12080
- // wrong type.
12081
- if (typeof value !== 'number')
12082
- return '????????';
12083
- // We prefix 0s so that we have constant length number
12084
- const text = '00000000' + value.toString(2);
12085
- return text.substring(text.length - 8);
12086
- }
11149
+
11150
+ /**
11151
+ * @license
11152
+ * Copyright Google LLC All Rights Reserved.
11153
+ *
11154
+ * Use of this source code is governed by an MIT-style license that can be
11155
+ * found in the LICENSE file at https://angular.io/license
11156
+ */
11157
+
12087
11158
  /**
12088
- * Convert a bloom filter at location `idx` in `array` into binary representation.
11159
+ * @license
11160
+ * Copyright Google LLC All Rights Reserved.
12089
11161
  *
12090
- * @param array
12091
- * @param idx
11162
+ * Use of this source code is governed by an MIT-style license that can be
11163
+ * found in the LICENSE file at https://angular.io/license
12092
11164
  */
12093
- function toBloom(array, idx) {
12094
- if (idx < 0) {
12095
- return 'NO_NODE_INJECTOR';
11165
+ function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
11166
+ const lView = getLView();
11167
+ // Fall back to inject() if view hasn't been created. This situation can happen in tests
11168
+ // if inject utilities are used before bootstrapping.
11169
+ if (lView === null) {
11170
+ // Verify that we will not get into infinite loop.
11171
+ ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
11172
+ return ɵɵinject(token, flags);
12096
11173
  }
12097
- return `${binary(array, idx + 7)}_${binary(array, idx + 6)}_${binary(array, idx + 5)}_${binary(array, idx + 4)}_${binary(array, idx + 3)}_${binary(array, idx + 2)}_${binary(array, idx + 1)}_${binary(array, idx + 0)}`;
11174
+ const tNode = getCurrentTNode();
11175
+ return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
12098
11176
  }
12099
- class LContainerDebug {
12100
- constructor(_raw_lContainer) {
12101
- this._raw_lContainer = _raw_lContainer;
12102
- }
12103
- get hasTransplantedViews() {
12104
- return this._raw_lContainer[HAS_TRANSPLANTED_VIEWS];
12105
- }
12106
- get views() {
12107
- return this._raw_lContainer.slice(CONTAINER_HEADER_OFFSET)
12108
- .map(toDebug);
12109
- }
12110
- get parent() {
12111
- return toDebug(this._raw_lContainer[PARENT]);
12112
- }
12113
- get movedViews() {
12114
- return this._raw_lContainer[MOVED_VIEWS];
12115
- }
12116
- get host() {
12117
- return this._raw_lContainer[HOST];
12118
- }
12119
- get native() {
12120
- return this._raw_lContainer[NATIVE];
12121
- }
12122
- get next() {
12123
- return toDebug(this._raw_lContainer[NEXT]);
12124
- }
11177
+ /**
11178
+ * Throws an error indicating that a factory function could not be generated by the compiler for a
11179
+ * particular class.
11180
+ *
11181
+ * This instruction allows the actual error message to be optimized away when ngDevMode is turned
11182
+ * off, saving bytes of generated code while still providing a good experience in dev mode.
11183
+ *
11184
+ * The name of the class is not mentioned here, but will be in the generated factory function name
11185
+ * and thus in the stack trace.
11186
+ *
11187
+ * @codeGenApi
11188
+ */
11189
+ function ɵɵinvalidFactory() {
11190
+ const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
11191
+ throw new Error(msg);
12125
11192
  }
12126
11193
 
12127
11194
  /**
@@ -12197,7 +11264,7 @@ function renderChildComponents(hostLView, components) {
12197
11264
  }
12198
11265
  }
12199
11266
  function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector) {
12200
- const lView = ngDevMode ? cloneToLViewFromTViewBlueprint(tView) : tView.blueprint.slice();
11267
+ const lView = tView.blueprint.slice();
12201
11268
  lView[HOST] = host;
12202
11269
  lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 64 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
12203
11270
  if (embeddedViewInjector !== null ||
@@ -12221,7 +11288,6 @@ function createLView(parentLView, tView, context, flags, host, tHostNode, render
12221
11288
  assertEqual(tView.type == 2 /* TViewType.Embedded */ ? parentLView !== null : true, true, 'Embedded views must have parentLView');
12222
11289
  lView[DECLARATION_COMPONENT_VIEW] =
12223
11290
  tView.type == 2 /* TViewType.Embedded */ ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
12224
- ngDevMode && attachLViewDebug(lView);
12225
11291
  return lView;
12226
11292
  }
12227
11293
  function getOrCreateTNode(tView, index, type, name, attrs) {
@@ -12604,73 +11670,38 @@ function createTView(type, declTNode, templateFn, decls, vars, directives, pipes
12604
11670
  const initialViewLength = bindingStartIndex + vars;
12605
11671
  const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
12606
11672
  const consts = typeof constsOrFactory === 'function' ? constsOrFactory() : constsOrFactory;
12607
- const tView = blueprint[TVIEW] = ngDevMode ?
12608
- new TViewConstructor(type, // type: TViewType,
12609
- blueprint, // blueprint: LView,
12610
- templateFn, // template: ComponentTemplate<{}>|null,
12611
- null, // queries: TQueries|null
12612
- viewQuery, // viewQuery: ViewQueriesFunction<{}>|null,
12613
- declTNode, // declTNode: TNode|null,
12614
- cloneToTViewData(blueprint).fill(null, bindingStartIndex), // data: TData,
12615
- bindingStartIndex, // bindingStartIndex: number,
12616
- initialViewLength, // expandoStartIndex: number,
12617
- null, // hostBindingOpCodes: HostBindingOpCodes,
12618
- true, // firstCreatePass: boolean,
12619
- true, // firstUpdatePass: boolean,
12620
- false, // staticViewQueries: boolean,
12621
- false, // staticContentQueries: boolean,
12622
- null, // preOrderHooks: HookData|null,
12623
- null, // preOrderCheckHooks: HookData|null,
12624
- null, // contentHooks: HookData|null,
12625
- null, // contentCheckHooks: HookData|null,
12626
- null, // viewHooks: HookData|null,
12627
- null, // viewCheckHooks: HookData|null,
12628
- null, // destroyHooks: DestroyHookData|null,
12629
- null, // cleanup: any[]|null,
12630
- null, // contentQueries: number[]|null,
12631
- null, // components: number[]|null,
12632
- typeof directives === 'function' ? //
12633
- directives() : //
12634
- directives, // directiveRegistry: DirectiveDefList|null,
12635
- typeof pipes === 'function' ? pipes() : pipes, // pipeRegistry: PipeDefList|null,
12636
- null, // firstChild: TNode|null,
12637
- schemas, // schemas: SchemaMetadata[]|null,
12638
- consts, // consts: TConstants|null
12639
- false, // incompleteFirstPass: boolean
12640
- decls, // ngDevMode only: decls
12641
- vars) :
12642
- {
12643
- type: type,
12644
- blueprint: blueprint,
12645
- template: templateFn,
12646
- queries: null,
12647
- viewQuery: viewQuery,
12648
- declTNode: declTNode,
12649
- data: blueprint.slice().fill(null, bindingStartIndex),
12650
- bindingStartIndex: bindingStartIndex,
12651
- expandoStartIndex: initialViewLength,
12652
- hostBindingOpCodes: null,
12653
- firstCreatePass: true,
12654
- firstUpdatePass: true,
12655
- staticViewQueries: false,
12656
- staticContentQueries: false,
12657
- preOrderHooks: null,
12658
- preOrderCheckHooks: null,
12659
- contentHooks: null,
12660
- contentCheckHooks: null,
12661
- viewHooks: null,
12662
- viewCheckHooks: null,
12663
- destroyHooks: null,
12664
- cleanup: null,
12665
- contentQueries: null,
12666
- components: null,
12667
- directiveRegistry: typeof directives === 'function' ? directives() : directives,
12668
- pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
12669
- firstChild: null,
12670
- schemas: schemas,
12671
- consts: consts,
12672
- incompleteFirstPass: false
12673
- };
11673
+ const tView = blueprint[TVIEW] = {
11674
+ type: type,
11675
+ blueprint: blueprint,
11676
+ template: templateFn,
11677
+ queries: null,
11678
+ viewQuery: viewQuery,
11679
+ declTNode: declTNode,
11680
+ data: blueprint.slice().fill(null, bindingStartIndex),
11681
+ bindingStartIndex: bindingStartIndex,
11682
+ expandoStartIndex: initialViewLength,
11683
+ hostBindingOpCodes: null,
11684
+ firstCreatePass: true,
11685
+ firstUpdatePass: true,
11686
+ staticViewQueries: false,
11687
+ staticContentQueries: false,
11688
+ preOrderHooks: null,
11689
+ preOrderCheckHooks: null,
11690
+ contentHooks: null,
11691
+ contentCheckHooks: null,
11692
+ viewHooks: null,
11693
+ viewCheckHooks: null,
11694
+ destroyHooks: null,
11695
+ cleanup: null,
11696
+ contentQueries: null,
11697
+ components: null,
11698
+ directiveRegistry: typeof directives === 'function' ? directives() : directives,
11699
+ pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
11700
+ firstChild: null,
11701
+ schemas: schemas,
11702
+ consts: consts,
11703
+ incompleteFirstPass: false
11704
+ };
12674
11705
  if (ngDevMode) {
12675
11706
  // For performance reasons it is important that the tView retains the same shape during runtime.
12676
11707
  // (To make sure that all of the code is monomorphic.) For this reason we seal the object to
@@ -12680,7 +11711,7 @@ function createTView(type, declTNode, templateFn, decls, vars, directives, pipes
12680
11711
  return tView;
12681
11712
  }
12682
11713
  function createViewBlueprint(bindingStartIndex, initialViewLength) {
12683
- const blueprint = ngDevMode ? new LViewBlueprint() : [];
11714
+ const blueprint = [];
12684
11715
  for (let i = 0; i < initialViewLength; i++) {
12685
11716
  blueprint.push(i < bindingStartIndex ? null : NO_CHANGE);
12686
11717
  }
@@ -12733,74 +11764,40 @@ function createTNode(tView, tParent, type, index, value, attrs) {
12733
11764
  ngDevMode && ngDevMode.tNode++;
12734
11765
  ngDevMode && tParent && assertTNodeForTView(tParent, tView);
12735
11766
  let injectorIndex = tParent ? tParent.injectorIndex : -1;
12736
- const tNode = ngDevMode ?
12737
- new TNodeDebug(tView, // tView_: TView
12738
- type, // type: TNodeType
12739
- index, // index: number
12740
- null, // insertBeforeIndex: null|-1|number|number[]
12741
- injectorIndex, // injectorIndex: number
12742
- -1, // componentOffset: number
12743
- -1, // directiveStart: number
12744
- -1, // directiveEnd: number
12745
- -1, // directiveStylingLast: number
12746
- null, // propertyBindings: number[]|null
12747
- 0, // flags: TNodeFlags
12748
- 0, // providerIndexes: TNodeProviderIndexes
12749
- value, // value: string|null
12750
- attrs, // attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null
12751
- null, // mergedAttrs
12752
- null, // localNames: (string|number)[]|null
12753
- undefined, // initialInputs: (string[]|null)[]|null|undefined
12754
- null, // inputs: PropertyAliases|null
12755
- null, // outputs: PropertyAliases|null
12756
- null, // tViews: ITView|ITView[]|null
12757
- null, // next: ITNode|null
12758
- null, // projectionNext: ITNode|null
12759
- null, // child: ITNode|null
12760
- tParent, // parent: TElementNode|TContainerNode|null
12761
- null, // projection: number|(ITNode|RNode[])[]|null
12762
- null, // styles: string|null
12763
- null, // stylesWithoutHost: string|null
12764
- undefined, // residualStyles: string|null
12765
- null, // classes: string|null
12766
- null, // classesWithoutHost: string|null
12767
- undefined, // residualClasses: string|null
12768
- 0, // classBindings: TStylingRange;
12769
- 0) :
12770
- {
12771
- type,
12772
- index,
12773
- insertBeforeIndex: null,
12774
- injectorIndex,
12775
- directiveStart: -1,
12776
- directiveEnd: -1,
12777
- directiveStylingLast: -1,
12778
- componentOffset: -1,
12779
- propertyBindings: null,
12780
- flags: 0,
12781
- providerIndexes: 0,
12782
- value: value,
12783
- attrs: attrs,
12784
- mergedAttrs: null,
12785
- localNames: null,
12786
- initialInputs: undefined,
12787
- inputs: null,
12788
- outputs: null,
12789
- tViews: null,
12790
- next: null,
12791
- projectionNext: null,
12792
- child: null,
12793
- parent: tParent,
12794
- projection: null,
12795
- styles: null,
12796
- stylesWithoutHost: null,
12797
- residualStyles: undefined,
12798
- classes: null,
12799
- classesWithoutHost: null,
12800
- residualClasses: undefined,
12801
- classBindings: 0,
12802
- styleBindings: 0,
12803
- };
11767
+ const tNode = {
11768
+ type,
11769
+ index,
11770
+ insertBeforeIndex: null,
11771
+ injectorIndex,
11772
+ directiveStart: -1,
11773
+ directiveEnd: -1,
11774
+ directiveStylingLast: -1,
11775
+ componentOffset: -1,
11776
+ propertyBindings: null,
11777
+ flags: 0,
11778
+ providerIndexes: 0,
11779
+ value: value,
11780
+ attrs: attrs,
11781
+ mergedAttrs: null,
11782
+ localNames: null,
11783
+ initialInputs: undefined,
11784
+ inputs: null,
11785
+ outputs: null,
11786
+ tViews: null,
11787
+ next: null,
11788
+ projectionNext: null,
11789
+ child: null,
11790
+ parent: tParent,
11791
+ projection: null,
11792
+ styles: null,
11793
+ stylesWithoutHost: null,
11794
+ residualStyles: undefined,
11795
+ classes: null,
11796
+ classesWithoutHost: null,
11797
+ residualClasses: undefined,
11798
+ classBindings: 0,
11799
+ styleBindings: 0,
11800
+ };
12804
11801
  if (ngDevMode) {
12805
11802
  // For performance reasons it is important that the tNode retains the same shape during runtime.
12806
11803
  // (To make sure that all of the code is monomorphic.) For this reason we seal the object to
@@ -12857,7 +11854,7 @@ function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMa
12857
11854
  const end = tNode.directiveEnd;
12858
11855
  const tViewData = tView.data;
12859
11856
  const tNodeAttrs = tNode.attrs;
12860
- const inputsFromAttrs = ngDevMode ? new TNodeInitialInputs() : [];
11857
+ const inputsFromAttrs = [];
12861
11858
  let inputsStore = null;
12862
11859
  let outputsStore = null;
12863
11860
  for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
@@ -13126,6 +12123,12 @@ function lastSelectedElementIdx(hostBindingOpCodes) {
13126
12123
  function instantiateAllDirectives(tView, lView, tNode, native) {
13127
12124
  const start = tNode.directiveStart;
13128
12125
  const end = tNode.directiveEnd;
12126
+ // The component view needs to be created before creating the node injector
12127
+ // since it is used to inject some special symbols like `ChangeDetectorRef`.
12128
+ if (isComponentHost(tNode)) {
12129
+ ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */);
12130
+ addComponentLogic(lView, tNode, tView.data[start + tNode.componentOffset]);
12131
+ }
13129
12132
  if (!tView.firstCreatePass) {
13130
12133
  getOrCreateNodeInjectorForNode(tNode, lView);
13131
12134
  }
@@ -13133,19 +12136,14 @@ function instantiateAllDirectives(tView, lView, tNode, native) {
13133
12136
  const initialInputs = tNode.initialInputs;
13134
12137
  for (let i = start; i < end; i++) {
13135
12138
  const def = tView.data[i];
13136
- const isComponent = isComponentDef(def);
13137
- if (isComponent) {
13138
- ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */);
13139
- addComponentLogic(lView, tNode, def);
13140
- }
13141
12139
  const directive = getNodeInjectable(lView, tView, i, tNode);
13142
12140
  attachPatchData(directive, lView);
13143
12141
  if (initialInputs !== null) {
13144
12142
  setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs);
13145
12143
  }
13146
- if (isComponent) {
12144
+ if (isComponentDef(def)) {
13147
12145
  const componentView = getComponentLViewByIndex(tNode.index, lView);
13148
- componentView[CONTEXT] = directive;
12146
+ componentView[CONTEXT] = getNodeInjectable(lView, tView, i, tNode);
13149
12147
  }
13150
12148
  }
13151
12149
  }
@@ -13195,7 +12193,7 @@ function findDirectiveDefMatches(tView, tNode) {
13195
12193
  for (let i = 0; i < registry.length; i++) {
13196
12194
  const def = registry[i];
13197
12195
  if (isNodeMatchingSelectorList(tNode, def.selectors, /* isProjectionMode */ false)) {
13198
- matches || (matches = ngDevMode ? new MatchesArray() : []);
12196
+ matches || (matches = []);
13199
12197
  if (isComponentDef(def)) {
13200
12198
  if (ngDevMode) {
13201
12199
  assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
@@ -13253,13 +12251,12 @@ function markAsComponentHost(tView, hostTNode, componentOffset) {
13253
12251
  ngDevMode && assertFirstCreatePass(tView);
13254
12252
  ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
13255
12253
  hostTNode.componentOffset = componentOffset;
13256
- (tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
13257
- .push(hostTNode.index);
12254
+ (tView.components || (tView.components = [])).push(hostTNode.index);
13258
12255
  }
13259
12256
  /** Caches local names and their matching directive indices for query and template lookups. */
13260
12257
  function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
13261
12258
  if (localRefs) {
13262
- const localNames = tNode.localNames = ngDevMode ? new TNodeLocalNames() : [];
12259
+ const localNames = tNode.localNames = [];
13263
12260
  // Local names must be stored in tNode in the same order that localRefs are defined
13264
12261
  // in the template to ensure the data is loaded in the same slots as their refs
13265
12262
  // in the template (for template queries).
@@ -13442,9 +12439,6 @@ function generateInitialInputs(inputs, directiveIndex, attrs) {
13442
12439
  //////////////////////////
13443
12440
  //// ViewContainer & View
13444
12441
  //////////////////////////
13445
- // Not sure why I need to do `any` here but TS complains later.
13446
- const LContainerArray = class LContainer extends Array {
13447
- };
13448
12442
  /**
13449
12443
  * Creates a LContainer, either from a container instruction, or for a ViewContainerRef.
13450
12444
  *
@@ -13457,20 +12451,20 @@ const LContainerArray = class LContainer extends Array {
13457
12451
  */
13458
12452
  function createLContainer(hostNative, currentView, native, tNode) {
13459
12453
  ngDevMode && assertLView(currentView);
13460
- // https://jsperf.com/array-literal-vs-new-array-really
13461
- const lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative, // host native
13462
- true, // Boolean `true` in this position signifies that this is an `LContainer`
13463
- false, // has transplanted views
13464
- currentView, // parent
13465
- null, // next
13466
- 0, // transplanted views to refresh count
13467
- tNode, // t_host
13468
- native, // native,
13469
- null, // view refs
13470
- null);
12454
+ const lContainer = [
12455
+ hostNative,
12456
+ true,
12457
+ false,
12458
+ currentView,
12459
+ null,
12460
+ 0,
12461
+ tNode,
12462
+ native,
12463
+ null,
12464
+ null, // moved views
12465
+ ];
13471
12466
  ngDevMode &&
13472
12467
  assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, 'Should allocate correct number of slots for LContainer header.');
13473
- ngDevMode && attachLContainerDebug(lContainer);
13474
12468
  return lContainer;
13475
12469
  }
13476
12470
  /**
@@ -13744,10 +12738,10 @@ function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex,
13744
12738
  }
13745
12739
  function getOrCreateLViewCleanup(view) {
13746
12740
  // top level variables should not be exported for performance reasons (PERF_NOTES.md)
13747
- return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new LCleanup() : []);
12741
+ return view[CLEANUP] || (view[CLEANUP] = []);
13748
12742
  }
13749
12743
  function getOrCreateTViewCleanup(tView) {
13750
- return tView.cleanup || (tView.cleanup = ngDevMode ? new TCleanup() : []);
12744
+ return tView.cleanup || (tView.cleanup = []);
13751
12745
  }
13752
12746
  /**
13753
12747
  * There are cases where the sub component's renderer needs to be included
@@ -13913,6 +12907,11 @@ function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
13913
12907
  * found in the LICENSE file at https://angular.io/license
13914
12908
  */
13915
12909
  class ViewRef {
12910
+ get rootNodes() {
12911
+ const lView = this._lView;
12912
+ const tView = lView[TVIEW];
12913
+ return collectNativeNodes(tView, lView, tView.firstChild, []);
12914
+ }
13916
12915
  constructor(
13917
12916
  /**
13918
12917
  * This represents `LView` associated with the component when ViewRef is a ChangeDetectorRef.
@@ -13938,11 +12937,6 @@ class ViewRef {
13938
12937
  this._appRef = null;
13939
12938
  this._attachedToViewContainer = false;
13940
12939
  }
13941
- get rootNodes() {
13942
- const lView = this._lView;
13943
- const tView = lView[TVIEW];
13944
- return collectNativeNodes(tView, lView, tView.firstChild, []);
13945
- }
13946
12940
  get context() {
13947
12941
  return this._lView[CONTEXT];
13948
12942
  }
@@ -14264,6 +13258,12 @@ class ChainedInjector {
14264
13258
  * ComponentFactory interface implementation.
14265
13259
  */
14266
13260
  class ComponentFactory extends ComponentFactory$1 {
13261
+ get inputs() {
13262
+ return toRefArray(this.componentDef.inputs);
13263
+ }
13264
+ get outputs() {
13265
+ return toRefArray(this.componentDef.outputs);
13266
+ }
14267
13267
  /**
14268
13268
  * @param componentDef The component definition.
14269
13269
  * @param ngModule The NgModuleRef to which the factory is bound.
@@ -14278,12 +13278,6 @@ class ComponentFactory extends ComponentFactory$1 {
14278
13278
  componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
14279
13279
  this.isBoundToModule = !!ngModule;
14280
13280
  }
14281
- get inputs() {
14282
- return toRefArray(this.componentDef.inputs);
14283
- }
14284
- get outputs() {
14285
- return toRefArray(this.componentDef.outputs);
14286
- }
14287
13281
  create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
14288
13282
  environmentInjector = environmentInjector || this.ngModule;
14289
13283
  let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
@@ -14359,17 +13353,6 @@ class ComponentFactory extends ComponentFactory$1 {
14359
13353
  return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
14360
13354
  }
14361
13355
  }
14362
- const componentFactoryResolver = new ComponentFactoryResolver();
14363
- /**
14364
- * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
14365
- * ComponentFactoryResolver
14366
- * already exists, retrieves the existing ComponentFactoryResolver.
14367
- *
14368
- * @returns The ComponentFactoryResolver instance to use
14369
- */
14370
- function injectComponentFactoryResolver() {
14371
- return componentFactoryResolver;
14372
- }
14373
13356
  /**
14374
13357
  * Represents an instance of a Component created via a {@link ComponentFactory}.
14375
13358
  *
@@ -16955,6 +15938,62 @@ function ɵɵpropertyInterpolateV(propName, values, sanitizer) {
16955
15938
  return ɵɵpropertyInterpolateV;
16956
15939
  }
16957
15940
 
15941
+ /**
15942
+ * @license
15943
+ * Copyright Google LLC All Rights Reserved.
15944
+ *
15945
+ * Use of this source code is governed by an MIT-style license that can be
15946
+ * found in the LICENSE file at https://angular.io/license
15947
+ */
15948
+ function toTStylingRange(prev, next) {
15949
+ ngDevMode && assertNumberInRange(prev, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
15950
+ ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
15951
+ return (prev << 17 /* StylingRange.PREV_SHIFT */ | next << 2 /* StylingRange.NEXT_SHIFT */);
15952
+ }
15953
+ function getTStylingRangePrev(tStylingRange) {
15954
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15955
+ return (tStylingRange >> 17 /* StylingRange.PREV_SHIFT */) & 32767 /* StylingRange.UNSIGNED_MASK */;
15956
+ }
15957
+ function getTStylingRangePrevDuplicate(tStylingRange) {
15958
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15959
+ return (tStylingRange & 2 /* StylingRange.PREV_DUPLICATE */) ==
15960
+ 2 /* StylingRange.PREV_DUPLICATE */;
15961
+ }
15962
+ function setTStylingRangePrev(tStylingRange, previous) {
15963
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15964
+ ngDevMode && assertNumberInRange(previous, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
15965
+ return ((tStylingRange & ~4294836224 /* StylingRange.PREV_MASK */) |
15966
+ (previous << 17 /* StylingRange.PREV_SHIFT */));
15967
+ }
15968
+ function setTStylingRangePrevDuplicate(tStylingRange) {
15969
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15970
+ return (tStylingRange | 2 /* StylingRange.PREV_DUPLICATE */);
15971
+ }
15972
+ function getTStylingRangeNext(tStylingRange) {
15973
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15974
+ return (tStylingRange & 131068 /* StylingRange.NEXT_MASK */) >> 2 /* StylingRange.NEXT_SHIFT */;
15975
+ }
15976
+ function setTStylingRangeNext(tStylingRange, next) {
15977
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15978
+ ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
15979
+ return ((tStylingRange & ~131068 /* StylingRange.NEXT_MASK */) | //
15980
+ next << 2 /* StylingRange.NEXT_SHIFT */);
15981
+ }
15982
+ function getTStylingRangeNextDuplicate(tStylingRange) {
15983
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15984
+ return (tStylingRange & 1 /* StylingRange.NEXT_DUPLICATE */) ===
15985
+ 1 /* StylingRange.NEXT_DUPLICATE */;
15986
+ }
15987
+ function setTStylingRangeNextDuplicate(tStylingRange) {
15988
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15989
+ return (tStylingRange | 1 /* StylingRange.NEXT_DUPLICATE */);
15990
+ }
15991
+ function getTStylingRangeTail(tStylingRange) {
15992
+ ngDevMode && assertNumber(tStylingRange, 'expected number');
15993
+ const next = getTStylingRangeNext(tStylingRange);
15994
+ return next === 0 ? getTStylingRangePrev(tStylingRange) : next;
15995
+ }
15996
+
16958
15997
  /**
16959
15998
  * @license
16960
15999
  * Copyright Google LLC All Rights Reserved.
@@ -20007,7 +19046,7 @@ var I18nCreateOpCode;
20007
19046
  })(I18nCreateOpCode || (I18nCreateOpCode = {}));
20008
19047
  // Note: This hack is necessary so we don't erroneously get a circular dependency
20009
19048
  // failure based on types.
20010
- const unusedValueExportToPlacateAjd$2 = 1;
19049
+ const unusedValueExportToPlacateAjd = 1;
20011
19050
 
20012
19051
  /**
20013
19052
  * @license
@@ -20776,6 +19815,46 @@ function loadIcuContainerVisitor() {
20776
19815
  return icuContainerIteratorStart;
20777
19816
  }
20778
19817
 
19818
+ /**
19819
+ * @license
19820
+ * Copyright Google LLC All Rights Reserved.
19821
+ *
19822
+ * Use of this source code is governed by an MIT-style license that can be
19823
+ * found in the LICENSE file at https://angular.io/license
19824
+ */
19825
+ /**
19826
+ * Patch a `debug` property on top of the existing object.
19827
+ *
19828
+ * NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
19829
+ *
19830
+ * @param obj Object to patch
19831
+ * @param debug Value to patch
19832
+ */
19833
+ function attachDebugObject(obj, debug) {
19834
+ if (ngDevMode) {
19835
+ Object.defineProperty(obj, 'debug', { value: debug, enumerable: false });
19836
+ }
19837
+ else {
19838
+ throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
19839
+ }
19840
+ }
19841
+ /**
19842
+ * Patch a `debug` property getter on top of the existing object.
19843
+ *
19844
+ * NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
19845
+ *
19846
+ * @param obj Object to patch
19847
+ * @param debugGetter Getter returning a value to patch
19848
+ */
19849
+ function attachDebugGetter(obj, debugGetter) {
19850
+ if (ngDevMode) {
19851
+ Object.defineProperty(obj, 'debug', { get: debugGetter, enumerable: false });
19852
+ }
19853
+ else {
19854
+ throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
19855
+ }
19856
+ }
19857
+
20779
19858
  /**
20780
19859
  * @license
20781
19860
  * Copyright Google LLC All Rights Reserved.
@@ -22745,32 +21824,6 @@ function sortListeners(a, b) {
22745
21824
  function isDirectiveDefHack(obj) {
22746
21825
  return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
22747
21826
  }
22748
- /**
22749
- * Returns the attached `DebugNode` instance for an element in the DOM.
22750
- *
22751
- * @param element DOM element which is owned by an existing component's view.
22752
- */
22753
- function getDebugNode(element) {
22754
- if (ngDevMode && !(element instanceof Node)) {
22755
- throw new Error('Expecting instance of DOM Element');
22756
- }
22757
- const lContext = getLContext(element);
22758
- const lView = lContext ? lContext.lView : null;
22759
- if (lView === null) {
22760
- return null;
22761
- }
22762
- const nodeIndex = lContext.nodeIndex;
22763
- if (nodeIndex !== -1) {
22764
- const valueInLView = lView[nodeIndex];
22765
- // this means that value in the lView is a component with its own
22766
- // data. In this situation the TNode is not accessed at the same spot.
22767
- const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
22768
- ngDevMode &&
22769
- assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
22770
- return buildDebugNode(tNode, lView);
22771
- }
22772
- return null;
22773
- }
22774
21827
  /**
22775
21828
  * Retrieve the component `LView` from component/element.
22776
21829
  *
@@ -23475,6 +22528,12 @@ function symbolIterator() {
23475
22528
  * @publicApi
23476
22529
  */
23477
22530
  class QueryList {
22531
+ /**
22532
+ * Returns `Observable` of `QueryList` notifying the subscriber of changes.
22533
+ */
22534
+ get changes() {
22535
+ return this._changes || (this._changes = new EventEmitter());
22536
+ }
23478
22537
  /**
23479
22538
  * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change
23480
22539
  * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in
@@ -23498,12 +22557,6 @@ class QueryList {
23498
22557
  if (!proto[symbol])
23499
22558
  proto[symbol] = symbolIterator;
23500
22559
  }
23501
- /**
23502
- * Returns `Observable` of `QueryList` notifying the subscriber of changes.
23503
- */
23504
- get changes() {
23505
- return this._changes || (this._changes = new EventEmitter());
23506
- }
23507
22560
  /**
23508
22561
  * Returns the QueryList entry at `index`.
23509
22562
  */
@@ -23990,29 +23043,6 @@ function createContainerRef(hostTNode, hostLView) {
23990
23043
  * Use of this source code is governed by an MIT-style license that can be
23991
23044
  * found in the LICENSE file at https://angular.io/license
23992
23045
  */
23993
- // Note: This hack is necessary so we don't erroneously get a circular dependency
23994
- // failure based on types.
23995
- const unusedValueExportToPlacateAjd$1 = 1;
23996
-
23997
- /**
23998
- * @license
23999
- * Copyright Google LLC All Rights Reserved.
24000
- *
24001
- * Use of this source code is governed by an MIT-style license that can be
24002
- * found in the LICENSE file at https://angular.io/license
24003
- */
24004
- // Note: This hack is necessary so we don't erroneously get a circular dependency
24005
- // failure based on types.
24006
- const unusedValueExportToPlacateAjd = 1;
24007
-
24008
- /**
24009
- * @license
24010
- * Copyright Google LLC All Rights Reserved.
24011
- *
24012
- * Use of this source code is governed by an MIT-style license that can be
24013
- * found in the LICENSE file at https://angular.io/license
24014
- */
24015
- const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd;
24016
23046
  class LQuery_ {
24017
23047
  constructor(queryList) {
24018
23048
  this.queryList = queryList;
@@ -24819,8 +23849,7 @@ function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInR
24819
23849
  Object.defineProperty(moduleType, NG_INJ_DEF, {
24820
23850
  get: () => {
24821
23851
  if (ngInjectorDef === null) {
24822
- ngDevMode &&
24823
- verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot);
23852
+ ngDevMode && verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot);
24824
23853
  const meta = {
24825
23854
  name: moduleType.name,
24826
23855
  type: moduleType,