@angular/core 14.1.0-rc.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/core.mjs +2 -1
- package/esm2020/src/di/r3_injector.mjs +7 -1
- package/esm2020/src/errors.mjs +1 -1
- package/esm2020/src/linker/component_factory_resolver.mjs +1 -1
- package/esm2020/src/render3/component.mjs +120 -127
- package/esm2020/src/render3/component_ref.mjs +144 -9
- package/esm2020/src/render3/errors.mjs +9 -5
- package/esm2020/src/render3/index.mjs +2 -2
- package/esm2020/src/render3/ng_module_ref.mjs +4 -14
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/esm2020/testing/src/test_bed_common.mjs +1 -1
- package/fesm2015/core.mjs +13078 -12944
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +12969 -12974
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +13078 -12944
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +12969 -12974
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +151 -5
- package/package.json +1 -1
- package/testing/index.d.ts +2 -2
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.0
|
|
2
|
+
* @license Angular v14.1.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1318,6 +1318,46 @@ declare class ComponentFactoryResolver_2 extends ComponentFactoryResolver {
|
|
|
1318
1318
|
|
|
1319
1319
|
declare type ComponentInstance = {};
|
|
1320
1320
|
|
|
1321
|
+
/**
|
|
1322
|
+
* An interface that describes the subset of component metadata
|
|
1323
|
+
* that can be retrieved using the `reflectComponentType` function.
|
|
1324
|
+
*
|
|
1325
|
+
* @publicApi
|
|
1326
|
+
*/
|
|
1327
|
+
export declare interface ComponentMirror<C> {
|
|
1328
|
+
/**
|
|
1329
|
+
* The component's HTML selector.
|
|
1330
|
+
*/
|
|
1331
|
+
get selector(): string;
|
|
1332
|
+
/**
|
|
1333
|
+
* The type of component the factory will create.
|
|
1334
|
+
*/
|
|
1335
|
+
get type(): Type<C>;
|
|
1336
|
+
/**
|
|
1337
|
+
* The inputs of the component.
|
|
1338
|
+
*/
|
|
1339
|
+
get inputs(): ReadonlyArray<{
|
|
1340
|
+
readonly propName: string;
|
|
1341
|
+
readonly templateName: string;
|
|
1342
|
+
}>;
|
|
1343
|
+
/**
|
|
1344
|
+
* The outputs of the component.
|
|
1345
|
+
*/
|
|
1346
|
+
get outputs(): ReadonlyArray<{
|
|
1347
|
+
readonly propName: string;
|
|
1348
|
+
readonly templateName: string;
|
|
1349
|
+
}>;
|
|
1350
|
+
/**
|
|
1351
|
+
* Selector for all <ng-content> elements in the component.
|
|
1352
|
+
*/
|
|
1353
|
+
get ngContentSelectors(): ReadonlyArray<string>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Whether this component is marked as standalone.
|
|
1356
|
+
* Note: an extra flag, not present in `ComponentFactory`.
|
|
1357
|
+
*/
|
|
1358
|
+
get isStandalone(): boolean;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1321
1361
|
/**
|
|
1322
1362
|
* Represents a component created by a `ComponentFactory`.
|
|
1323
1363
|
* Provides access to the component instance and related objects,
|
|
@@ -1618,6 +1658,72 @@ declare type ContentQueriesFunction<T> = <U extends T>(rf: ɵRenderFlags, ctx: U
|
|
|
1618
1658
|
|
|
1619
1659
|
declare const CONTEXT = 8;
|
|
1620
1660
|
|
|
1661
|
+
/**
|
|
1662
|
+
* Creates a `ComponentRef` instance based on provided component type and a set of options.
|
|
1663
|
+
*
|
|
1664
|
+
* @usageNotes
|
|
1665
|
+
*
|
|
1666
|
+
* The example below demonstrates how the `createComponent` function can be used
|
|
1667
|
+
* to create an instance of a ComponentRef dynamically and attach it to an ApplicationRef,
|
|
1668
|
+
* so that it gets included into change detection cycles.
|
|
1669
|
+
*
|
|
1670
|
+
* Note: the example uses standalone components, but the function can also be used for
|
|
1671
|
+
* non-standalone components (declared in an NgModule) as well.
|
|
1672
|
+
*
|
|
1673
|
+
* ```typescript
|
|
1674
|
+
* @Component({
|
|
1675
|
+
* standalone: true,
|
|
1676
|
+
* template: `Hello {{ name }}!`
|
|
1677
|
+
* })
|
|
1678
|
+
* class HelloComponent {
|
|
1679
|
+
* name = 'Angular';
|
|
1680
|
+
* }
|
|
1681
|
+
*
|
|
1682
|
+
* @Component({
|
|
1683
|
+
* standalone: true,
|
|
1684
|
+
* template: `<div id="hello-component-host"></div>`
|
|
1685
|
+
* })
|
|
1686
|
+
* class RootComponent {}
|
|
1687
|
+
*
|
|
1688
|
+
* // Bootstrap an application.
|
|
1689
|
+
* const applicationRef = await bootstrapApplication(RootComponent);
|
|
1690
|
+
*
|
|
1691
|
+
* // Locate a DOM node that would be used as a host.
|
|
1692
|
+
* const host = document.getElementById('hello-component-host');
|
|
1693
|
+
*
|
|
1694
|
+
* // Get an `EnvironmentInjector` instance from the `ApplicationRef`.
|
|
1695
|
+
* const environmentInjector = applicationRef.injector;
|
|
1696
|
+
*
|
|
1697
|
+
* // We can now create a `ComponentRef` instance.
|
|
1698
|
+
* const componentRef = createComponent(HelloComponent, {host, environmentInjector});
|
|
1699
|
+
*
|
|
1700
|
+
* // Last step is to register the newly created ref using the `ApplicationRef` instance
|
|
1701
|
+
* // to include the component view into change detection cycles.
|
|
1702
|
+
* applicationRef.attachView(componentRef.hostView);
|
|
1703
|
+
* ```
|
|
1704
|
+
*
|
|
1705
|
+
* @param component Component class reference.
|
|
1706
|
+
* @param options Set of options to use:
|
|
1707
|
+
* * `environmentInjector`: An `EnvironmentInjector` instance to be used for the component, see
|
|
1708
|
+
* additional info about it at https://angular.io/guide/standalone-components#environment-injectors.
|
|
1709
|
+
* * `hostElement` (optional): A DOM node that should act as a host node for the component. If not
|
|
1710
|
+
* provided, Angular creates one based on the tag name used in the component selector (and falls
|
|
1711
|
+
* back to using `div` if selector doesn't have tag name info).
|
|
1712
|
+
* * `elementInjector` (optional): An `ElementInjector` instance, see additional info about it at
|
|
1713
|
+
* https://angular.io/guide/hierarchical-dependency-injection#elementinjector.
|
|
1714
|
+
* * `projectableNodes` (optional): A list of DOM nodes that should be projected through
|
|
1715
|
+
* [`<ng-content>`](api/core/ng-content) of the new component instance.
|
|
1716
|
+
* @returns ComponentRef instance that represents a given Component.
|
|
1717
|
+
*
|
|
1718
|
+
* @publicApi
|
|
1719
|
+
*/
|
|
1720
|
+
export declare function createComponent<C>(component: Type<C>, options: {
|
|
1721
|
+
environmentInjector: EnvironmentInjector;
|
|
1722
|
+
hostElement?: Element;
|
|
1723
|
+
elementInjector?: Injector;
|
|
1724
|
+
projectableNodes?: Node[][];
|
|
1725
|
+
}): ComponentRef<C>;
|
|
1726
|
+
|
|
1621
1727
|
/**
|
|
1622
1728
|
* Create a new environment injector.
|
|
1623
1729
|
*
|
|
@@ -6342,6 +6448,47 @@ declare interface RDomTokenList {
|
|
|
6342
6448
|
remove(token: string): void;
|
|
6343
6449
|
}
|
|
6344
6450
|
|
|
6451
|
+
/**
|
|
6452
|
+
* Creates an object that allows to retrieve component metadata.
|
|
6453
|
+
*
|
|
6454
|
+
* @usageNotes
|
|
6455
|
+
*
|
|
6456
|
+
* The example below demonstrates how to use the function and how the fields
|
|
6457
|
+
* of the returned object map to the component metadata.
|
|
6458
|
+
*
|
|
6459
|
+
* ```typescript
|
|
6460
|
+
* @Component({
|
|
6461
|
+
* standalone: true,
|
|
6462
|
+
* selector: 'foo-component',
|
|
6463
|
+
* template: `
|
|
6464
|
+
* <ng-content></ng-content>
|
|
6465
|
+
* <ng-content select="content-selector-a"></ng-content>
|
|
6466
|
+
* `,
|
|
6467
|
+
* })
|
|
6468
|
+
* class FooComponent {
|
|
6469
|
+
* @Input('inputName') inputPropName: string;
|
|
6470
|
+
* @Output('outputName') outputPropName = new EventEmitter<void>();
|
|
6471
|
+
* }
|
|
6472
|
+
*
|
|
6473
|
+
* const mirror = reflectComponentType(FooComponent);
|
|
6474
|
+
* expect(mirror.type).toBe(FooComponent);
|
|
6475
|
+
* expect(mirror.selector).toBe('foo-component');
|
|
6476
|
+
* expect(mirror.isStandalone).toBe(true);
|
|
6477
|
+
* expect(mirror.inputs).toEqual([{propName: 'inputName', templateName: 'inputPropName'}]);
|
|
6478
|
+
* expect(mirror.outputs).toEqual([{propName: 'outputName', templateName: 'outputPropName'}]);
|
|
6479
|
+
* expect(mirror.ngContentSelectors).toEqual([
|
|
6480
|
+
* '*', // first `<ng-content>` in a template, the selector defaults to `*`
|
|
6481
|
+
* 'content-selector-a' // second `<ng-content>` in a template
|
|
6482
|
+
* ]);
|
|
6483
|
+
* ```
|
|
6484
|
+
*
|
|
6485
|
+
* @param component Component class reference.
|
|
6486
|
+
* @returns An object that allows to retrieve component metadata.
|
|
6487
|
+
*
|
|
6488
|
+
* @publicApi
|
|
6489
|
+
*/
|
|
6490
|
+
export declare function reflectComponentType<C>(component: Type<C>): ComponentMirror<C> | null;
|
|
6491
|
+
|
|
6345
6492
|
/**
|
|
6346
6493
|
* `Dependency` is used by the framework to extend DI.
|
|
6347
6494
|
* This is internal to Angular and should not be used directly.
|
|
@@ -7083,6 +7230,7 @@ declare const enum RuntimeErrorCode {
|
|
|
7083
7230
|
INJECTOR_ALREADY_DESTROYED = 205,
|
|
7084
7231
|
PROVIDER_IN_WRONG_CONTEXT = 207,
|
|
7085
7232
|
MISSING_INJECTION_TOKEN = 208,
|
|
7233
|
+
INVALID_MULTI_PROVIDER = 209,
|
|
7086
7234
|
MULTIPLE_COMPONENTS_MATCH = -300,
|
|
7087
7235
|
EXPORT_NOT_FOUND = -301,
|
|
7088
7236
|
PIPE_NOT_FOUND = -302,
|
|
@@ -10722,17 +10870,15 @@ export declare class ɵRender3ComponentRef<T> extends ComponentRef<T> {
|
|
|
10722
10870
|
onDestroy(callback: () => void): void;
|
|
10723
10871
|
}
|
|
10724
10872
|
|
|
10725
|
-
export declare class ɵRender3NgModuleRef<T> extends NgModuleRef<T> implements InternalNgModuleRef<T
|
|
10873
|
+
export declare class ɵRender3NgModuleRef<T> extends NgModuleRef<T> implements InternalNgModuleRef<T> {
|
|
10726
10874
|
_parent: Injector | null;
|
|
10727
10875
|
_bootstrapComponents: Type<any>[];
|
|
10728
10876
|
_r3Injector: R3Injector;
|
|
10729
|
-
injector: EnvironmentInjector;
|
|
10730
10877
|
instance: T;
|
|
10731
10878
|
destroyCbs: (() => void)[] | null;
|
|
10732
10879
|
readonly componentFactoryResolver: ComponentFactoryResolver_2;
|
|
10733
10880
|
constructor(ngModuleType: Type<T>, _parent: Injector | null);
|
|
10734
|
-
get(
|
|
10735
|
-
runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
|
|
10881
|
+
get injector(): EnvironmentInjector;
|
|
10736
10882
|
destroy(): void;
|
|
10737
10883
|
onDestroy(callback: () => void): void;
|
|
10738
10884
|
}
|
package/package.json
CHANGED
package/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.0
|
|
2
|
+
* @license Angular v14.1.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -237,7 +237,7 @@ export declare type MetadataOverride<T> = {
|
|
|
237
237
|
* @publicApi
|
|
238
238
|
*/
|
|
239
239
|
export declare interface ModuleTeardownOptions {
|
|
240
|
-
/** Whether the test module should be destroyed after every test. */
|
|
240
|
+
/** Whether the test module should be destroyed after every test. Defaults to `true`. */
|
|
241
241
|
destroyAfterEach: boolean;
|
|
242
242
|
/** Whether errors during test module destruction should be re-thrown. Defaults to `true`. */
|
|
243
243
|
rethrowErrors?: boolean;
|