@angular/core 12.0.0-rc.3 → 12.0.3

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/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.0.0-rc.3
2
+ * @license Angular v12.0.3
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1318,6 +1318,13 @@ export declare interface ContentChildDecorator {
1318
1318
  * * **static** - True to resolve query results before change detection runs,
1319
1319
  * false to resolve after change detection. Defaults to false.
1320
1320
  *
1321
+ * The following values are supported by `read`:
1322
+ * * Any class with the `@Component` or `@Directive` decorator
1323
+ * * Any provider defined on the injector of the component that is matched by the `selector` of
1324
+ * this query
1325
+ * * Any provider defined through a string token (e.g. `{provide: 'token', useValue: 'val'}`)
1326
+ * * `TemplateRef`, `ElementRef`, and `ViewContainerRef`
1327
+ *
1321
1328
  * @usageNotes
1322
1329
  *
1323
1330
  * {@example core/di/ts/contentChild/content_child_howto.ts region='HowTo'}
@@ -1387,6 +1394,13 @@ export declare interface ContentChildrenDecorator {
1387
1394
  * removed in future versions of Angular.
1388
1395
  * * **read** - Used to read a different token from the queried elements.
1389
1396
  *
1397
+ * The following values are supported by `read`:
1398
+ * * Any class with the `@Component` or `@Directive` decorator
1399
+ * * Any provider defined on the injector of the component that is matched by the `selector` of
1400
+ * this query
1401
+ * * Any provider defined through a string token (e.g. `{provide: 'token', useValue: 'val'}`)
1402
+ * * `TemplateRef`, `ElementRef`, and `ViewContainerRef`
1403
+ *
1390
1404
  * @usageNotes
1391
1405
  *
1392
1406
  * Here is a simple demonstration of how the `ContentChildren` decorator can be used.
@@ -1560,27 +1574,98 @@ export declare const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata;
1560
1574
 
1561
1575
  /**
1562
1576
  * @publicApi
1577
+ *
1578
+ * @see [Component testing scenarios](guide/testing-components-scenarios)
1579
+ * @see [Basics of testing components](guide/testing-components-basics)
1580
+ * @see [Testing utility APIs](guide/testing-utility-apis)
1563
1581
  */
1564
1582
  export declare interface DebugElement extends DebugNode {
1583
+ /**
1584
+ * The element tag name, if it is an element.
1585
+ */
1565
1586
  readonly name: string;
1587
+ /**
1588
+ * A map of property names to property values for an element.
1589
+ *
1590
+ * This map includes:
1591
+ * - Regular property bindings (e.g. `[id]="id"`)
1592
+ * - Host property bindings (e.g. `host: { '[id]': "id" }`)
1593
+ * - Interpolated property bindings (e.g. `id="{{ value }}")
1594
+ *
1595
+ * It does not include:
1596
+ * - input property bindings (e.g. `[myCustomInput]="value"`)
1597
+ * - attribute bindings (e.g. `[attr.role]="menu"`)
1598
+ */
1566
1599
  readonly properties: {
1567
1600
  [key: string]: any;
1568
1601
  };
1602
+ /**
1603
+ * A map of attribute names to attribute values for an element.
1604
+ */
1569
1605
  readonly attributes: {
1570
1606
  [key: string]: string | null;
1571
1607
  };
1608
+ /**
1609
+ * A map containing the class names on the element as keys.
1610
+ *
1611
+ * This map is derived from the `className` property of the DOM element.
1612
+ *
1613
+ * Note: The values of this object will always be `true`. The class key will not appear in the KV
1614
+ * object if it does not exist on the element.
1615
+ *
1616
+ * @see [Element.className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
1617
+ */
1572
1618
  readonly classes: {
1573
1619
  [key: string]: boolean;
1574
1620
  };
1621
+ /**
1622
+ * The inline styles of the DOM element.
1623
+ *
1624
+ * Will be `null` if there is no `style` property on the underlying DOM element.
1625
+ *
1626
+ * @see [ElementCSSInlineStyle](https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style)
1627
+ */
1575
1628
  readonly styles: {
1576
1629
  [key: string]: string | null;
1577
1630
  };
1631
+ /**
1632
+ * The `childNodes` of the DOM element as a `DebugNode` array.
1633
+ *
1634
+ * @see [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
1635
+ */
1578
1636
  readonly childNodes: DebugNode[];
1637
+ /**
1638
+ * The underlying DOM element at the root of the component.
1639
+ */
1579
1640
  readonly nativeElement: any;
1641
+ /**
1642
+ * The immediate `DebugElement` children. Walk the tree by descending through `children`.
1643
+ */
1580
1644
  readonly children: DebugElement[];
1645
+ /**
1646
+ * @returns the first `DebugElement` that matches the predicate at any depth in the subtree.
1647
+ */
1581
1648
  query(predicate: Predicate<DebugElement>): DebugElement;
1649
+ /**
1650
+ * @returns All `DebugElement` matches for the predicate at any depth in the subtree.
1651
+ */
1582
1652
  queryAll(predicate: Predicate<DebugElement>): DebugElement[];
1653
+ /**
1654
+ * @returns All `DebugNode` matches for the predicate at any depth in the subtree.
1655
+ */
1583
1656
  queryAllNodes(predicate: Predicate<DebugNode>): DebugNode[];
1657
+ /**
1658
+ * Triggers the event by its name if there is a corresponding listener in the element's
1659
+ * `listeners` collection.
1660
+ *
1661
+ * If the event lacks a listener or there's some other problem, consider
1662
+ * calling `nativeElement.dispatchEvent(eventObject)`.
1663
+ *
1664
+ * @param eventName The name of the event to trigger
1665
+ * @param eventObj The _event object_ expected by the handler
1666
+ *
1667
+ * @see [Testing components scenarios](guide/testing-components-scenarios#trigger-event-handler)
1668
+ */
1584
1669
  triggerEventHandler(eventName: string, eventObj: any): void;
1585
1670
  }
1586
1671
 
@@ -1640,15 +1725,47 @@ export declare class DebugEventListener {
1640
1725
  * @publicApi
1641
1726
  */
1642
1727
  export declare interface DebugNode {
1728
+ /**
1729
+ * The callbacks attached to the component's @Output properties and/or the element's event
1730
+ * properties.
1731
+ */
1643
1732
  readonly listeners: DebugEventListener[];
1733
+ /**
1734
+ * The `DebugElement` parent. Will be `null` if this is the root element.
1735
+ */
1644
1736
  readonly parent: DebugElement | null;
1737
+ /**
1738
+ * The underlying DOM node.
1739
+ */
1645
1740
  readonly nativeNode: any;
1741
+ /**
1742
+ * The host dependency injector. For example, the root element's component instance injector.
1743
+ */
1646
1744
  readonly injector: Injector;
1745
+ /**
1746
+ * The element's own component instance, if it has one.
1747
+ */
1647
1748
  readonly componentInstance: any;
1749
+ /**
1750
+ * An object that provides parent context for this element. Often an ancestor component instance
1751
+ * that governs this element.
1752
+ *
1753
+ * When an element is repeated within *ngFor, the context is an `NgForOf` whose `$implicit`
1754
+ * property is the value of the row instance value. For example, the `hero` in `*ngFor="let hero
1755
+ * of heroes"`.
1756
+ */
1648
1757
  readonly context: any;
1758
+ /**
1759
+ * Dictionary of objects associated with template local variables (e.g. #foo), keyed by the local
1760
+ * variable name.
1761
+ */
1649
1762
  readonly references: {
1650
1763
  [key: string]: any;
1651
1764
  };
1765
+ /**
1766
+ * This component's injector lookup tokens. Includes the component itself plus the tokens that the
1767
+ * component lists in its providers metadata.
1768
+ */
1652
1769
  readonly providerTokens: any[];
1653
1770
  }
1654
1771
 
@@ -2162,8 +2279,8 @@ declare interface DisposableFn {
2162
2279
 
2163
2280
  /**
2164
2281
  * @description
2165
- * Hook for manual bootstrapping of the application instead of using bootstrap array in @NgModule
2166
- * annotation.
2282
+ * Hook for manual bootstrapping of the application instead of using `bootstrap` array in @NgModule
2283
+ * annotation. This hook is invoked only when the `bootstrap` array is empty or not provided.
2167
2284
  *
2168
2285
  * Reference to the current application is provided as a parameter.
2169
2286
  *
@@ -3256,9 +3373,15 @@ export declare const inject: typeof ɵɵinject;
3256
3373
  */
3257
3374
  export declare interface Injectable {
3258
3375
  /**
3259
- * Determines which injectors will provide the injectable,
3260
- * by either associating it with an `@NgModule` or other `InjectorType`,
3261
- * or by specifying that this injectable should be provided in one of the following injectors:
3376
+ * Determines which injectors will provide the injectable.
3377
+ *
3378
+ * - `Type<any>` - associates the injectable with an `@NgModule` or other `InjectorType`,
3379
+ * - 'null' : Equivalent to `undefined`. The injectable is not provided in any scope automatically
3380
+ * and must be added to a `providers` array of an [@NgModule](api/core/NgModule#providers),
3381
+ * [@Component](api/core/Directive#providers) or [@Directive](api/core/Directive#providers).
3382
+ *
3383
+ * The following options specify that this injectable should be provided in one of the following
3384
+ * injectors:
3262
3385
  * - 'root' : The application-level injector in most apps.
3263
3386
  * - 'platform' : A special singleton platform injector shared by all
3264
3387
  * applications on the page.
@@ -7837,14 +7960,54 @@ declare interface TQueryMetadata {
7837
7960
  }
7838
7961
 
7839
7962
  /**
7840
- * An optional function passed into the `NgForOf` directive that defines how to track
7841
- * changes for items in an iterable.
7842
- * The function takes the iteration index and item ID.
7843
- * When supplied, Angular tracks changes by the return value of the function.
7963
+ * A function optionally passed into the `NgForOf` directive to customize how `NgForOf` uniquely
7964
+ * identifies items in an iterable.
7965
+ *
7966
+ * `NgForOf` needs to uniquely identify items in the iterable to correctly perform DOM updates
7967
+ * when items in the iterable are reordered, new items are added, or existing items are removed.
7968
+ *
7969
+ *
7970
+ * In all of these scenarios it is usually desirable to only update the DOM elements associated
7971
+ * with the items affected by the change. This behavior is important to:
7844
7972
  *
7973
+ * - preserve any DOM-specific UI state (like cursor position, focus, text selection) when the
7974
+ * iterable is modified
7975
+ * - enable animation of item addition, removal, and iterable reordering
7976
+ * - preserve the value of the `<select>` element when nested `<option>` elements are dynamically
7977
+ * populated using `NgForOf` and the bound iterable is updated
7978
+ *
7979
+ * A common use for custom `trackBy` functions is when the model that `NgForOf` iterates over
7980
+ * contains a property with a unique identifier. For example, given a model:
7981
+ *
7982
+ * ```ts
7983
+ * class User {
7984
+ * id: number;
7985
+ * name: string;
7986
+ * ...
7987
+ * }
7988
+ * ```
7989
+ * a custom `trackBy` function could look like the following:
7990
+ * ```ts
7991
+ * function userTrackBy(index, user) {
7992
+ * return user.id;
7993
+ * }
7994
+ * ```
7995
+ *
7996
+ * A custom `trackBy` function must have several properties:
7997
+ *
7998
+ * - be [idempotent](https://en.wikipedia.org/wiki/Idempotence) (be without side effects, and always
7999
+ * return the same value for a given input)
8000
+ * - return unique value for all unique inputs
8001
+ * - be fast
8002
+ *
8003
+ * @see [`NgForOf#ngForTrackBy`](api/common/NgForOf#ngForTrackBy)
7845
8004
  * @publicApi
7846
8005
  */
7847
8006
  export declare interface TrackByFunction<T> {
8007
+ /**
8008
+ * @param index The index of the item within the iterable.
8009
+ * @param item The item in the iterable.
8010
+ */
7848
8011
  (index: number, item: T): any;
7849
8012
  }
7850
8013
 
@@ -8488,6 +8651,13 @@ export declare interface ViewChildDecorator {
8488
8651
  * * A `TemplateRef` (e.g. query `<ng-template></ng-template>` with `@ViewChild(TemplateRef)
8489
8652
  * template;`)
8490
8653
  *
8654
+ * The following values are supported by `read`:
8655
+ * * Any class with the `@Component` or `@Directive` decorator
8656
+ * * Any provider defined on the injector of the component that is matched by the `selector` of
8657
+ * this query
8658
+ * * Any provider defined through a string token (e.g. `{provide: 'token', useValue: 'val'}`)
8659
+ * * `TemplateRef`, `ElementRef`, and `ViewContainerRef`
8660
+ *
8491
8661
  * @usageNotes
8492
8662
  *
8493
8663
  * {@example core/di/ts/viewChild/view_child_example.ts region='Component'}
@@ -8550,6 +8720,13 @@ export declare interface ViewChildrenDecorator {
8550
8720
  * ** Note: *** This config option is **deprecated**, it will be permanently set to `true` and
8551
8721
  * removed in future versions of Angular.
8552
8722
  *
8723
+ * The following values are supported by `read`:
8724
+ * * Any class with the `@Component` or `@Directive` decorator
8725
+ * * Any provider defined on the injector of the component that is matched by the `selector` of
8726
+ * this query
8727
+ * * Any provider defined through a string token (e.g. `{provide: 'token', useValue: 'val'}`)
8728
+ * * `TemplateRef`, `ElementRef`, and `ViewContainerRef`
8729
+ *
8553
8730
  * @usageNotes
8554
8731
  *
8555
8732
  * {@example core/di/ts/viewChildren/view_children_howto.ts region='HowTo'}
@@ -8839,7 +9016,7 @@ declare class ViewRef_2<T> implements EmbeddedViewRef<T>, InternalViewRef, viewE
8839
9016
  *
8840
9017
  * ```typescript
8841
9018
  * @Component({
8842
- * selector: 'my-app',
9019
+ * selector: 'app-root',
8843
9020
  * template: `Number of ticks: {{numberOfTicks}}`
8844
9021
  * changeDetection: ChangeDetectionStrategy.OnPush,
8845
9022
  * })
@@ -8955,7 +9132,7 @@ declare class ViewRef_2<T> implements EmbeddedViewRef<T>, InternalViewRef, viewE
8955
9132
  * }
8956
9133
  *
8957
9134
  * @Component({
8958
- * selector: 'my-app',
9135
+ * selector: 'app-root',
8959
9136
  * providers: [DataProvider],
8960
9137
  * template: `
8961
9138
  * Live Update: <input type="checkbox" [(ngModel)]="live">
@@ -10520,12 +10697,14 @@ export declare const ɵgetDebugNodeR2: (nativeNode: any) => DebugNode | null;
10520
10697
  *
10521
10698
  * @usageNotes
10522
10699
  * Given the following DOM structure:
10523
- * ```
10524
- * <my-app>
10700
+ *
10701
+ * ```html
10702
+ * <app-root>
10525
10703
  * <button my-button></button>
10526
10704
  * <my-comp></my-comp>
10527
- * </my-app>
10705
+ * </app-root>
10528
10706
  * ```
10707
+ *
10529
10708
  * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
10530
10709
  * directive that is associated with the DOM node.
10531
10710
  *