docs: update core to use `@publicApi` tags (#26595)

PR Close #26595
This commit is contained in:
Pete Bacon Darwin 2018-10-19 16:27:04 +01:00 committed by Alex Rickabaugh
parent 0918adf39d
commit 3903e5ebe7
46 changed files with 179 additions and 139 deletions

View File

@ -13,11 +13,15 @@ import {Inject, Injectable, InjectionToken, Optional} from './di';
/**
* A function that will be executed when an application is initialized.
*
* @publicApi
*/
export const APP_INITIALIZER = new InjectionToken<Array<() => void>>('Application Initializer');
/**
* A class that reflects the state of running {@link APP_INITIALIZER}s.
*
* @publicApi
*/
@Injectable()
export class ApplicationInitStatus {

View File

@ -171,6 +171,8 @@ export interface BootstrapOptions {
*
* A page's platform is initialized implicitly when a platform is created via a platform factory
* (e.g. {@link platformBrowser}), or explicitly by calling the {@link createPlatform} function.
*
* @publicApi
*/
@Injectable()
export class PlatformRef {
@ -202,8 +204,6 @@ export class PlatformRef {
*
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
* ```
*
* @publicApi
*/
bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>, options?: BootstrapOptions):
Promise<NgModuleRef<M>> {
@ -346,6 +346,8 @@ function optionsReducer<T extends Object>(dst: any, objs: T | T[]): T {
/**
* A reference to an Angular application running on a page.
*
* @publicApi
*/
@Injectable()
export class ApplicationRef {

View File

@ -42,6 +42,7 @@ export function devModeEqual(a: any, b: any): boolean {
* }
* ```
*
* @publicApi
*/
export class WrappedValue {
/** @deprecated from 5.3, use `unwrap()` instead - will switch to protected */
@ -65,6 +66,7 @@ export class WrappedValue {
/**
* Represents a basic change from a previous to a new value.
*
* @publicApi
*/
export class SimpleChange {
constructor(public previousValue: any, public currentValue: any, public firstChange: boolean) {}

View File

@ -48,6 +48,7 @@ import {injectChangeDetectorRef as render3InjectChangeDetectorRef} from '../rend
*
* <code-example path="core/ts/change_detect/change-detection.ts" region="reattach"></code-example>
*
* @publicApi
*/
export abstract class ChangeDetectorRef {
/**

View File

@ -11,6 +11,7 @@
* The strategy that the default change detector uses to detect changes.
* When set, takes effect the next time change detection is triggered.
*
* @publicApi
*/
export enum ChangeDetectionStrategy {
/**
@ -74,7 +75,7 @@ export enum ChangeDetectorStatus {
* @param changeDetectionStrategy The strategy to check.
* @returns True if the given strategy is the current default, false otherwise.
* @see `ChangeDetectorStatus`
* @see `ChangeDetectorRef`
* @see `ChangeDetectorRef`
*/
export function isDefaultChangeDetectionStrategy(changeDetectionStrategy: ChangeDetectionStrategy):
boolean {

View File

@ -24,6 +24,7 @@ const trackByIdentity = (index: number, item: any) => item;
/**
* @deprecated v4.0.0 - Should not be part of public API.
* @publicApi
*/
export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChanges<V> {
public readonly length: number = 0;

View File

@ -15,7 +15,7 @@ import {DefaultIterableDifferFactory} from '../differs/default_iterable_differ';
/**
* A type describing supported iterable types.
*
*
* @publicApi
*/
export type NgIterable<T> = Array<T>| Iterable<T>;
@ -23,7 +23,7 @@ export type NgIterable<T> = Array<T>| Iterable<T>;
* A strategy for tracking changes over time to an iterable. Used by {@link NgForOf} to
* respond to changes in an iterable by effecting equivalent changes in the DOM.
*
*
* @publicApi
*/
export interface IterableDiffer<V> {
/**
@ -40,7 +40,7 @@ export interface IterableDiffer<V> {
* An object describing the changes in the `Iterable` collection since last time
* `IterableDiffer#diff()` was invoked.
*
*
* @publicApi
*/
export interface IterableChanges<V> {
/**
@ -93,7 +93,7 @@ export interface IterableChanges<V> {
/**
* Record representing the item change information.
*
*
* @publicApi
*/
export interface IterableChangeRecord<V> {
/** Current index of the item in `Iterable` or null if removed. */
@ -111,6 +111,7 @@ export interface IterableChangeRecord<V> {
/**
* @deprecated v4.0.0 - Use IterableChangeRecord instead.
* @publicApi
*/
export interface CollectionChangeRecord<V> extends IterableChangeRecord<V> {}
@ -118,14 +119,14 @@ export interface CollectionChangeRecord<V> extends IterableChangeRecord<V> {}
* An optional function passed into {@link NgForOf} that defines how to track
* items in an iterable (e.g. fby index or id)
*
*
* @publicApi
*/
export interface TrackByFunction<T> { (index: number, item: T): any; }
/**
* Provides a factory for {@link IterableDiffer}.
*
*
* @publicApi
*/
export interface IterableDifferFactory {
supports(objects: any): boolean;
@ -135,6 +136,7 @@ export interface IterableDifferFactory {
/**
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
*
* @publicApi
*/
export class IterableDiffers {
static ngInjectableDef = defineInjectable({

View File

@ -12,7 +12,7 @@ import {Optional, SkipSelf, StaticProvider} from '../../di';
/**
* A differ that tracks changes made to an object over time.
*
*
* @publicApi
*/
export interface KeyValueDiffer<K, V> {
/**
@ -40,7 +40,7 @@ export interface KeyValueDiffer<K, V> {
* An object describing the changes in the `Map` or `{[k:string]: string}` since last time
* `KeyValueDiffer#diff()` was invoked.
*
*
* @publicApi
*/
export interface KeyValueChanges<K, V> {
/**
@ -74,7 +74,7 @@ export interface KeyValueChanges<K, V> {
/**
* Record representing the item change information.
*
*
* @publicApi
*/
export interface KeyValueChangeRecord<K, V> {
/**
@ -96,7 +96,7 @@ export interface KeyValueChangeRecord<K, V> {
/**
* Provides a factory for {@link KeyValueDiffer}.
*
*
* @publicApi
*/
export interface KeyValueDifferFactory {
/**
@ -113,6 +113,7 @@ export interface KeyValueDifferFactory {
/**
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
*
* @publicApi
*/
export class KeyValueDiffers {
/**

View File

@ -30,6 +30,6 @@
*
* Invoking `{{ 'ok' | repeat:3 }}` in a template produces `okokok`.
*
*
* @publicApi
*/
export interface PipeTransform { transform(value: any, ...args: any[]): any; }

View File

@ -25,6 +25,8 @@ export type InjectableProvider = ValueSansProvider | ExistingSansProvider |
/**
* Type of the Injectable decorator / constructor function.
*
* @publicApi
*/
export interface InjectableDecorator {
/**
@ -57,10 +59,11 @@ export interface InjectableDecorator {
export interface Injectable { providedIn?: Type<any>|'root'|null; }
/**
* Injectable decorator and metadata.
*
* @Annotation
*/
* Injectable decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const Injectable: InjectableDecorator = makeDecorator(
'Injectable', undefined, undefined, undefined,
(type: Type<any>, meta: Injectable) => SWITCH_COMPILE_INJECTABLE(type as any, meta));

View File

@ -47,6 +47,8 @@ import {defineInjectable} from './defs';
*
* {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}
*
*
* @publicApi
*/
export class InjectionToken<T> {
/** @internal */

View File

@ -57,7 +57,7 @@ export class NullInjector implements Injector {
*
* {@example core/di/ts/injector_spec.ts region='injectInjector'}
*
*
* @publicApi
*/
export abstract class Injector {
static THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
@ -399,6 +399,8 @@ function staticError(text: string, obj: any): Error {
/**
* Injection flags for DI.
*
* @publicApi
*/
export const enum InjectFlags {
Default = 0b0000,

View File

@ -15,6 +15,8 @@ import {EMPTY_ARRAY} from '../view/util';
/**
* Type of the Inject decorator / constructor function.
*
* @publicApi
*/
export interface InjectDecorator {
/**
@ -40,6 +42,8 @@ export interface InjectDecorator {
/**
* Type of the Inject metadata.
*
* @publicApi
*/
export interface Inject {
/**
@ -52,19 +56,22 @@ export interface Inject {
* Inject decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const Inject: InjectDecorator = makeParamDecorator('Inject', (token: any) => ({token}));
/**
* Type of the Optional decorator / constructor function.
*
* @publicApi
*/
export interface OptionalDecorator {
/**
* A constructor parameter decorator that marks a dependency as optional.
*
* The DI framework provides null if the dependency is not found.
* For example, the following code allows the possibility of a null result:
* For example, the following code allows the possibility of a null result:
*
* {@example core/di/ts/metadata_spec.ts region='Optional'}
*
@ -76,6 +83,8 @@ export interface OptionalDecorator {
/**
* Type of the Optional metadata.
*
* @publicApi
*/
export interface Optional {}
@ -83,11 +92,14 @@ export interface Optional {}
* Optional decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const Optional: OptionalDecorator = makeParamDecorator('Optional');
/**
* Type of the Self decorator / constructor function.
*
* @publicApi
*/
export interface SelfDecorator {
/**
@ -110,6 +122,8 @@ export interface SelfDecorator {
/**
* Type of the Self metadata.
*
* @publicApi
*/
export interface Self {}
@ -117,12 +131,15 @@ export interface Self {}
* Self decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const Self: SelfDecorator = makeParamDecorator('Self');
/**
* Type of the SkipSelf decorator / constructor function.
*
* @publicApi
*/
export interface SkipSelfDecorator {
/**
@ -145,7 +162,7 @@ export interface SkipSelfDecorator {
/**
* Type of the SkipSelf metadata.
*
*
* @publicApi
*/
export interface SkipSelf {}
@ -153,11 +170,14 @@ export interface SkipSelf {}
* SkipSelf decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const SkipSelf: SkipSelfDecorator = makeParamDecorator('SkipSelf');
/**
* Type of the Host decorator / constructor function.
*
* @publicApi
*/
export interface HostDecorator {
/**
@ -167,7 +187,7 @@ export interface HostDecorator {
*
* @see ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* @usageNotes
*
* {@example core/di/ts/metadata_spec.ts region='Host'}
*/
@ -177,6 +197,8 @@ export interface HostDecorator {
/**
* Type of the Host metadata.
*
* @publicApi
*/
export interface Host {}
@ -184,5 +206,6 @@ export interface Host {}
* Host decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const Host: HostDecorator = makeParamDecorator('Host');

View File

@ -40,6 +40,8 @@ export interface ValueSansProvider {
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*
* @publicApi
*/
export interface ValueProvider extends ValueSansProvider {
/**
@ -191,6 +193,8 @@ export interface ExistingSansProvider {
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*
* @publicApi
*/
export interface ExistingProvider extends ExistingSansProvider {
/**
@ -248,6 +252,8 @@ export interface FactorySansProvider {
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*
* @publicApi
*/
export interface FactoryProvider extends FactorySansProvider {
/**
@ -270,6 +276,8 @@ export interface FactoryProvider extends FactorySansProvider {
* @see `ValueProvider`
* @see `ExistingProvider`
* @see `FactoryProvider`
*
* @publicApi
*/
export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider |
ConstructorProvider | FactoryProvider | any[];
@ -287,6 +295,8 @@ export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvi
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='TypeProvider'}
*
* @publicApi
*/
export interface TypeProvider extends Type<any> {}
@ -326,6 +336,8 @@ export interface ClassSansProvider {
* ### Multi-value example
*
* {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'}
*
* @publicApi
*/
export interface ClassProvider extends ClassSansProvider {
/**
@ -348,6 +360,8 @@ export interface ClassProvider extends ClassSansProvider {
* @see `TypeProvider`
* @see `ClassProvider`
* @see `StaticProvider`
*
* @publicApi
*/
export type Provider = TypeProvider | ValueProvider | ClassProvider | ConstructorProvider |
ExistingProvider | FactoryProvider | any[];

View File

@ -51,6 +51,7 @@ const UNDEFINED = new Object();
* resolve all of the object's dependencies automatically.
*
* @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
* @publicApi
*/
export abstract class ReflectiveInjector implements Injector {
/**
@ -140,7 +141,6 @@ export abstract class ReflectiveInjector implements Injector {
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
* @publicApi
*/
static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector):
ReflectiveInjector {

View File

@ -24,7 +24,9 @@ import {resolveForwardRef} from './forward_ref';
* `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when
* resolving
* providers.
*
* @deprecated No replacement
* @publicApi
*/
export class ReflectiveKey {
public readonly displayName: string;

View File

@ -32,6 +32,8 @@ import {ERROR_ORIGINAL_ERROR, getDebugContext, getErrorLogger, getOriginalError}
* })
* class MyModule {}
* ```
*
* @publicApi
*/
export class ErrorHandler {
/**

View File

@ -59,6 +59,7 @@ import {Subject, Subscription} from 'rxjs';
*
* Once a reference implementation of the spec is available, switch to it.
*
* @publicApi
*/
export class EventEmitter<T> extends Subject<T> {
// TODO: mark this as internal once all the facades are gone

View File

@ -37,6 +37,8 @@ export function isDevMode(): boolean {
* One important assertion this disables verifies that a change detection pass
* does not result in additional changes to any bindings (also known as
* unidirectional data flow).
*
* @publicApi
*/
export function enableProdMode(): void {
if (_runModeLocked) {

View File

@ -43,6 +43,7 @@ function _throwError() {
* that will use the directives/pipes of the ng module for compilation
* of components.
*
* @publicApi
*/
@Injectable()
export class Compiler {

View File

@ -19,6 +19,7 @@ import {ViewRef} from './view_ref';
* Provides access to the component instance and related objects,
* and provides the means of destroying the instance.
*
* @publicApi
*/
export abstract class ComponentRef<C> {
/**
@ -66,6 +67,9 @@ export abstract class ComponentRef<C> {
abstract onDestroy(callback: Function): void;
}
/**
* @publicApi
*/
export abstract class ComponentFactory<C> {
/**
* The comonent's HTML selector.

View File

@ -33,6 +33,9 @@ class _NullComponentFactoryResolver implements ComponentFactoryResolver {
}
}
/**
* @publicApi
*/
export abstract class ComponentFactoryResolver {
static NULL: ComponentFactoryResolver = new _NullComponentFactoryResolver();
abstract resolveComponentFactory<T>(component: Type<T>): ComponentFactory<T>;

View File

@ -19,7 +19,7 @@ import {noop} from '../util/noop';
* XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
* [Security Guide](http://g.co/ng/security).
*
*
* @publicApi
*/
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
// i.e. users have to ask for what they need. With that, we can build better analysis tools

View File

@ -18,7 +18,7 @@ import {ComponentFactoryResolver} from './component_factory_resolver';
* `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
* NgModule Instance.
*
*
* @publicApi
*/
export abstract class NgModuleRef<T> {
/**

View File

@ -11,6 +11,7 @@ import {NgModuleFactory} from './ng_module_factory';
/**
* Used to load ng module factories.
*
* @publicApi
*/
export abstract class NgModuleFactoryLoader {
abstract load(path: string): Promise<NgModuleFactory<any>>;

View File

@ -35,6 +35,8 @@ import {getSymbolIterator} from '../util';
* @ViewChildren(Item) items:QueryList<Item>;
* }
* ```
*
* @publicApi
*/
export class QueryList<T>/* implements Iterable<T> */ {
public readonly dirty = true;

View File

@ -29,6 +29,7 @@ import {EmbeddedViewRef} from './view_ref';
* @see `ViewContainerRef`
* @see [Navigate the Component Tree with DI](guide/dependency-injection-navtree)
*
* @publicApi
*/
export abstract class TemplateRef<C> {
/**

View File

@ -30,6 +30,7 @@ import {EmbeddedViewRef, ViewRef} from './view_ref';
* @see `ComponentRef`
* @see `EmbeddedViewRef`
*
* @publicApi
*/
export abstract class ViewContainerRef {
/**

View File

@ -16,6 +16,8 @@ import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
* that adds destroy methods for [embedded views](guide/glossary#view-tree).
*
* @see `EmbeddedViewRef`
*
* @publicApi
*/
export abstract class ViewRef extends ChangeDetectorRef {
/**

View File

@ -106,6 +106,7 @@ export interface Attribute { attributeName?: string; }
* Attribute decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const Attribute: AttributeDecorator =
makeParamDecorator('Attribute', (attributeName?: string) => ({attributeName}));
@ -128,6 +129,8 @@ export interface Query {
* @see `ContentChild`.
* @see `ViewChildren`.
* @see `ViewChild`.
*
* @publicApi
*/
export abstract class Query {}
@ -135,6 +138,7 @@ export abstract class Query {}
* Type of the ContentChildren decorator / constructor function.
*
* @see `ContentChildren`.
* @publicApi
*/
export interface ContentChildrenDecorator {
/**
@ -184,7 +188,8 @@ export type ContentChildren = Query;
* ContentChildren decorator and metadata.
*
*
* @Annotation
* @Annotation
* @publicApi
*/
export const ContentChildren: ContentChildrenDecorator = makePropDecorator(
'ContentChildren',
@ -195,8 +200,7 @@ export const ContentChildren: ContentChildrenDecorator = makePropDecorator(
/**
* Type of the ContentChild decorator / constructor function.
*
*
*
* @publicApi
*/
export interface ContentChildDecorator {
/**
@ -242,6 +246,7 @@ export type ContentChild = Query;
*
*
* @Annotation
* @publicApi
*/
export const ContentChild: ContentChildDecorator = makePropDecorator(
'ContentChild', (selector?: any, data: any = {}) =>
@ -253,7 +258,7 @@ export const ContentChild: ContentChildDecorator = makePropDecorator(
*
* @see `ViewChildren`.
*
*
* @publicApi
*/
export interface ViewChildrenDecorator {
/**
@ -295,6 +300,7 @@ export type ViewChildren = Query;
* ViewChildren decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const ViewChildren: ViewChildrenDecorator = makePropDecorator(
'ViewChildren', (selector?: any, data: any = {}) =>
@ -305,6 +311,7 @@ export const ViewChildren: ViewChildrenDecorator = makePropDecorator(
* Type of the ViewChild decorator / constructor function.
*
* @see `ViewChild`.
* @publicApi
*/
export interface ViewChildDecorator {
/**
@ -359,6 +366,7 @@ export type ViewChild = Query;
* ViewChild decorator and metadata.
*
* @Annotation
* @publicApi
*/
export const ViewChild: ViewChildDecorator = makePropDecorator(
'ViewChild', (selector: any, data: any) =>

View File

@ -22,6 +22,7 @@ import {ViewEncapsulation} from './view';
/**
* Type of the Directive decorator / constructor function.
* @publicApi
*/
export interface DirectiveDecorator {
/**
@ -349,6 +350,8 @@ export interface Directive {
/**
* Type of the Directive metadata.
*
* @publicApi
*/
export const Directive: DirectiveDecorator = makeDecorator(
'Directive', (dir: Directive = {}) => dir, undefined, undefined,
@ -357,6 +360,7 @@ export const Directive: DirectiveDecorator = makeDecorator(
/**
* Component decorator interface
*
* @publicApi
*/
export interface ComponentDecorator {
/**
@ -633,6 +637,7 @@ export interface Component extends Directive {
* `ngPreserveWhitespaces` attribute.
*
* @Annotation
* @publicApi
*/
export const Component: ComponentDecorator = makeDecorator(
'Component', (c: Component = {}) => ({changeDetection: ChangeDetectionStrategy.Default, ...c}),
@ -641,6 +646,8 @@ export const Component: ComponentDecorator = makeDecorator(
/**
* Type of the Pipe decorator / constructor function.
*
* @publicApi
*/
export interface PipeDecorator {
/**
@ -679,9 +686,8 @@ export interface Pipe {
}
/**
*
*
* @Annotation
* @publicApi
*/
export const Pipe: PipeDecorator = makeDecorator(
'Pipe', (p: Pipe) => ({pure: true, ...p}), undefined, undefined,
@ -689,7 +695,7 @@ export const Pipe: PipeDecorator = makeDecorator(
/**
*
* @publicApi
*/
export interface InputDecorator {
/**
@ -802,8 +808,8 @@ const updateBaseDefFromIOProp = (getProp: (baseDef: {inputs?: any, outputs?: any
};
/**
*
* @Annotation
* @publicApi
*/
export const Input: InputDecorator = makePropDecorator(
'Input', (bindingPropertyName?: string) => ({bindingPropertyName}), undefined,
@ -811,6 +817,8 @@ export const Input: InputDecorator = makePropDecorator(
/**
* Type of the Output decorator / constructor function.
*
* @publicApi
*/
export interface OutputDecorator {
/**
@ -838,8 +846,8 @@ export interface OutputDecorator {
export interface Output { bindingPropertyName?: string; }
/**
*
* @Annotation
* @publicApi
*/
export const Output: OutputDecorator = makePropDecorator(
'Output', (bindingPropertyName?: string) => ({bindingPropertyName}), undefined,
@ -849,6 +857,8 @@ export const Output: OutputDecorator = makePropDecorator(
/**
* Type of the HostBinding decorator / constructor function.
*
* @publicApi
*/
export interface HostBindingDecorator {
/**
@ -890,8 +900,8 @@ export interface HostBindingDecorator {
export interface HostBinding { hostPropertyName?: string; }
/**
*
* @Annotation
* @publicApi
*/
export const HostBinding: HostBindingDecorator =
makePropDecorator('HostBinding', (hostPropertyName?: string) => ({hostPropertyName}));
@ -899,6 +909,8 @@ export const HostBinding: HostBindingDecorator =
/**
* Type of the HostListener decorator / constructor function.
*
* @publicApi
*/
export interface HostListenerDecorator {
(eventName: string, args?: string[]): any;
@ -949,6 +961,7 @@ export interface HostListener {
* ```
*
* @Annotation
* @publicApi
*/
export const HostListener: HostListenerDecorator =
makePropDecorator('HostListener', (eventName?: string, args?: string[]) => ({eventName, args}));

View File

@ -15,6 +15,7 @@ import {SimpleChange} from '../change_detection/change_detection_util';
*
* @see `OnChanges`
*
* @publicApi
*/
export interface SimpleChanges { [propName: string]: SimpleChange; }
@ -33,6 +34,7 @@ export interface SimpleChanges { [propName: string]: SimpleChange; }
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='OnChanges'}
*
* @publicApi
*/
export interface OnChanges {
/**
@ -60,7 +62,7 @@ export interface OnChanges {
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='OnInit'}
*
*
* @publicApi
*/
export interface OnInit {
/**
@ -76,7 +78,7 @@ export interface OnInit {
/**
* A lifecycle hook that invokes a custom change-detection function for a directive,
* in addition to the check performed by the default change-detector.
*
*
* The default change-detection algorithm looks for differences by comparing
* bound-property values by reference across change detection runs. You can use this
* hook to check for and respond to changes by some other means.
@ -84,17 +86,18 @@ export interface OnInit {
* When the default change detector detects changes, it invokes `ngOnChanges()` if supplied,
* regardless of whether you perform additional change detection.
* Typically, you should not use both `DoCheck` and `OnChanges` to respond to
* changes on the same input.
*
* changes on the same input.
*
* @see `OnChanges`
* @see [Lifecycle Hooks](guide/lifecycle-hooks#onchanges) guide
*
* @usageNotes
* The following snippet shows how a component can implement this interface
* to invoke it own change-detection cycle.
* to invoke it own change-detection cycle.
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='DoCheck'}
*
* @publicApi
*/
export interface DoCheck {
/**
@ -116,9 +119,10 @@ export interface DoCheck {
* @usageNotes
* The following snippet shows how a component can implement this interface
* to define its own custom clean-up method.
*
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='OnDestroy'}
*
* @publicApi
*/
export interface OnDestroy {
/**
@ -144,7 +148,7 @@ export interface OnDestroy {
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterContentInit'}
*
*
* @publicApi
*/
export interface AfterContentInit {
/**
@ -170,7 +174,7 @@ export interface AfterContentInit {
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterContentChecked'}
*
*
* @publicApi
*/
export interface AfterContentChecked {
/**
@ -197,7 +201,7 @@ export interface AfterContentChecked {
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterViewInit'}
*
*
* @publicApi
*/
export interface AfterViewInit {
/**
@ -223,6 +227,7 @@ export interface AfterViewInit {
*
* {@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterViewChecked'}
*
* @publicApi
*/
export interface AfterViewChecked {
/**

View File

@ -72,6 +72,8 @@ export interface NgModuleDef<T> {
*
* @param T the module type. In Ivy applications, this must be explicitly
* provided.
*
* @publicApi
*/
export interface ModuleWithProviders<
T = any /** TODO(alxhub): remove default when callers pass explicit type param */> {
@ -96,7 +98,7 @@ export interface SchemaMetadata { name: string; }
* - Element properties named with dash case (`-`).
* Dash case is the naming convention for custom elements.
*
*
* @publicApi
*/
export const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata = {
name: 'custom-elements'
@ -114,8 +116,6 @@ export const NO_ERRORS_SCHEMA: SchemaMetadata = {
/**
* Type of the NgModule decorator / constructor function.
*
*
*/
export interface NgModuleDecorator {
/**
@ -127,8 +127,6 @@ export interface NgModuleDecorator {
/**
* Type of the NgModule metadata.
*
*
*/
export interface NgModule {
/**
@ -322,6 +320,7 @@ export interface NgModule {
/**
* @Annotation
* @publicApi
*/
export const NgModule: NgModuleDecorator = makeDecorator(
'NgModule', (ngModule: NgModule) => ngModule, undefined, undefined,
@ -356,6 +355,7 @@ export const NgModule: NgModuleDecorator = makeDecorator(
* }
* ```
*
* @publicApi
*/
export interface DoBootstrap { ngDoBootstrap(appRef: ApplicationRef): void; }

View File

@ -13,7 +13,10 @@
*
* @usageNotes
* ### Example
*
* {@example core/ts/metadata/encapsulation.ts region='longform'}
*
* @publicApi
*/
export enum ViewEncapsulation {
/**

View File

@ -15,6 +15,7 @@ import {noop} from '../util/noop';
/**
* @deprecated Use `RendererType2` (and `Renderer2`) instead.
* @publicApi
*/
export class RenderComponentType {
constructor(
@ -48,6 +49,7 @@ export interface DirectRenderer {
/**
* @deprecated Use the `Renderer2` instead.
* @publicApi
*/
export abstract class Renderer {
abstract selectRootElement(selectorOrNode: string|any, debugInfo?: RenderDebugInfo): any;
@ -111,6 +113,7 @@ export const Renderer2Interceptor = new InjectionToken<Renderer2[]>('Renderer2In
* The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
*
* @deprecated Use `RendererFactory2` instead.
* @publicApi
*/
export abstract class RootRenderer {
abstract renderComponent(componentType: RenderComponentType): Renderer;

View File

@ -13,7 +13,7 @@
*
* See DomSanitizer for more details on security in Angular applications.
*
*
* @publicApi
*/
export enum SecurityContext {
NONE = 0,
@ -27,7 +27,7 @@ export enum SecurityContext {
/**
* Sanitizer is used by the views to sanitize potentially dangerous values.
*
*
* @publicApi
*/
export abstract class Sanitizer {
abstract sanitize(context: SecurityContext, value: {}|string|null): string|null;

View File

@ -284,7 +284,6 @@ export class TestabilityRegistry {
* particular context.
*
* @publicApi
* the Protractor team.
*/
export interface GetTestability {
addToWindow(registry: TestabilityRegistry): void;

View File

@ -14,7 +14,7 @@
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
* the `MyCustomComponent` constructor function.
*
*
* @publicApi
*/
export const Type = Function;

View File

@ -20,6 +20,7 @@ import {Type} from '../type';
* class MyClass {...}
* ```
*
* @publicApi
*/
export interface TypeDecorator {
/**

View File

@ -9,7 +9,7 @@
/**
* @description Represents the version of Angular
*
*
* @publicApi
*/
export class Version {
public readonly major: string;
@ -23,4 +23,7 @@ export class Version {
}
}
/**
* @publicApi
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');

View File

@ -23,7 +23,7 @@ import {asyncFallback} from './async_fallback';
* });
* ```
*
*
* @publicApi
*/
export function async(fn: Function): (done: any) => any {
const _Zone: any = typeof Zone !== 'undefined' ? Zone : null;

View File

@ -12,7 +12,7 @@ import {ChangeDetectorRef, ComponentRef, DebugElement, ElementRef, NgZone, Rende
/**
* Fixture for debugging and testing a component.
*
*
* @publicApi
*/
export class ComponentFixture<T> {
/**

View File

@ -635,6 +635,8 @@ export class TestBedViewEngine implements Injector, TestBed {
*
* Note: Use `TestBed` in tests. It will be set to either `TestBedViewEngine` or `TestBedRender3`
* according to the compiler used.
*
* @publicApi
*/
export const TestBed: TestBedStatic =
ivyEnabled ? TestBedRender3 as any as TestBedStatic : TestBedViewEngine as any as TestBedStatic;
@ -676,7 +678,7 @@ function _getTestBedViewEngine(): TestBedViewEngine {
* eventually
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
*
*
* @publicApi
*/
export function inject(tokens: any[], fn: Function): () => any {
const testBed = getTestBed();

View File

@ -45,6 +45,8 @@ export type TestModuleMetadata = {
/**
* Static methods implemented by the `TestBedViewEngine` and `TestBedRender3`
*
* @publicApi
*/
export interface TestBedStatic {
new (...args: any[]): TestBed;
@ -54,8 +56,6 @@ export interface TestBedStatic {
/**
* Reset the providers for the test injector.
*
* @publicApi
*/
resetTestEnvironment(): void;

View File

@ -14,13 +14,10 @@ export interface AfterViewInit {
ngAfterViewInit(): void;
}
/** @experimental */
export declare const ANALYZE_FOR_ENTRY_COMPONENTS: InjectionToken<any>;
/** @experimental */
export declare const APP_BOOTSTRAP_LISTENER: InjectionToken<((compRef: ComponentRef<any>) => void)[]>;
/** @experimental */
export declare const APP_ID: InjectionToken<string>;
export declare const APP_INITIALIZER: InjectionToken<(() => void)[]>;
@ -31,7 +28,6 @@ export declare class ApplicationInitStatus {
constructor(appInits: (() => any)[]);
}
/** @experimental */
export declare class ApplicationModule {
constructor(appRef: ApplicationRef);
}
@ -47,10 +43,8 @@ export declare class ApplicationRef {
tick(): void;
}
/** @experimental */
export declare function asNativeElements(debugEls: DebugElement[]): any;
/** @experimental */
export declare function assertPlatform(requiredToken: any): PlatformRef;
export declare const Attribute: AttributeDecorator;
@ -87,15 +81,12 @@ export declare class Compiler {
getModuleId(moduleType: Type<any>): string | undefined;
}
/** @experimental */
export declare const COMPILER_OPTIONS: InjectionToken<CompilerOptions[]>;
/** @experimental */
export declare abstract class CompilerFactory {
abstract createCompiler(options?: CompilerOptions[]): Compiler;
}
/** @experimental */
export declare type CompilerOptions = {
useJit?: boolean;
defaultEncapsulation?: ViewEncapsulation;
@ -142,7 +133,6 @@ export declare abstract class ComponentRef<C> {
abstract onDestroy(callback: Function): void;
}
/** @experimental */
export interface ConstructorSansProvider {
deps?: any[];
}
@ -171,18 +161,14 @@ export interface ContentChildrenDecorator {
}): Query;
}
/** @experimental */
export declare function createInjector(defType: any, parent?: Injector | null, additionalProviders?: StaticProvider[] | null): Injector;
/** @experimental */
export declare function createPlatform(injector: Injector): PlatformRef;
/** @experimental */
export declare function createPlatformFactory(parentPlatformFactory: ((extraProviders?: StaticProvider[]) => PlatformRef) | null, name: string, providers?: StaticProvider[]): (extraProviders?: StaticProvider[]) => PlatformRef;
export declare const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata;
/** @experimental */
export declare class DebugElement extends DebugNode {
attributes: {
[key: string]: string | null;
@ -211,7 +197,6 @@ export declare class DebugElement extends DebugNode {
triggerEventHandler(eventName: string, eventObj: any): void;
}
/** @experimental */
export declare class DebugNode {
readonly componentInstance: any;
readonly context: any;
@ -244,20 +229,17 @@ export declare class DefaultIterableDiffer<V> implements IterableDiffer<V>, Iter
onDestroy(): void;
}
/** @experimental */
export declare function defineInjectable<T>(opts: {
providedIn?: Type<any> | 'root' | 'any' | null;
factory: () => T;
}): never;
/** @experimental */
export declare function defineInjector(options: {
factory: () => any;
providers?: any[];
imports?: any[];
}): never;
/** @experimental */
export declare function destroyPlatform(): void;
export declare const Directive: DirectiveDecorator;
@ -280,7 +262,6 @@ export declare class ElementRef<T = any> {
constructor(nativeElement: T);
}
/** @experimental */
export declare abstract class EmbeddedViewRef<C> extends ViewRef {
abstract readonly context: C;
abstract readonly rootNodes: any[];
@ -309,24 +290,18 @@ export interface FactoryProvider extends FactorySansProvider {
provide: any;
}
/** @experimental */
export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>;
/** @experimental */
export interface ForwardRefFn {
(): any;
}
/** @experimental */
export declare function getDebugNode(nativeNode: any): DebugNode | null;
/** @experimental */
export declare function getModuleFactory(id: string): NgModuleFactory<any>;
/** @experimental */
export declare function getPlatform(): PlatformRef | null;
/** @experimental */
export interface GetTestability {
addToWindow(registry: TestabilityRegistry): void;
findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean): Testability | null;
@ -343,7 +318,6 @@ export interface HostDecorator {
export declare const HostListener: HostListenerDecorator;
/** @experimental */
export declare function inject<T>(token: Type<T> | InjectionToken<T>): T;
export declare function inject<T>(token: Type<T> | InjectionToken<T>, flags?: InjectFlags): T | null;
@ -362,10 +336,8 @@ export interface InjectableDecorator {
} & InjectableProvider): Injectable;
}
/** @experimental */
export declare type InjectableProvider = ValueSansProvider | ExistingSansProvider | StaticClassSansProvider | ConstructorSansProvider | FactorySansProvider | ClassSansProvider;
/** @experimental */
export interface InjectableType<T> extends Type<T> {
ngInjectableDef: never;
}
@ -407,17 +379,14 @@ export declare abstract class Injector {
}): Injector;
}
/** @experimental */
export declare const INJECTOR: InjectionToken<Injector>;
/** @experimental */
export interface InjectorType<T> extends Type<T> {
ngInjectorDef: never;
}
export declare const Input: InputDecorator;
/** @experimental */
export declare function isDevMode(): boolean;
export interface IterableChangeRecord<V> {
@ -489,17 +458,14 @@ export declare class KeyValueDiffers {
static extend<S>(factories: KeyValueDifferFactory[]): StaticProvider;
}
/** @experimental */
export declare const LOCALE_ID: InjectionToken<string>;
/** @experimental */
export declare enum MissingTranslationStrategy {
Error = 0,
Warning = 1,
Ignore = 2
}
/** @experimental */
export declare class ModuleWithComponentFactories<T> {
componentFactories: ComponentFactory<any>[];
ngModuleFactory: NgModuleFactory<T>;
@ -515,7 +481,6 @@ export declare type NgIterable<T> = Array<T> | Iterable<T>;
export declare const NgModule: NgModuleDecorator;
/** @experimental */
export declare abstract class NgModuleFactory<T> {
abstract readonly moduleType: Type<T>;
abstract create(parentInjector: Injector | null): NgModuleRef<T>;
@ -533,14 +498,12 @@ export declare abstract class NgModuleRef<T> {
abstract onDestroy(callback: () => void): void;
}
/** @experimental */
export declare class NgProbeToken {
name: string;
token: any;
constructor(name: string, token: any);
}
/** @experimental */
export declare class NgZone {
readonly hasPendingMacrotasks: boolean;
readonly hasPendingMicrotasks: boolean;
@ -561,7 +524,6 @@ export declare class NgZone {
static isInAngularZone(): boolean;
}
/** @experimental */
export declare const NO_ERRORS_SCHEMA: SchemaMetadata;
export interface OnChanges {
@ -585,7 +547,6 @@ export interface OptionalDecorator {
export declare const Output: OutputDecorator;
/** @experimental */
export declare const PACKAGE_ROOT_URL: InjectionToken<string>;
export declare const Pipe: PipeDecorator;
@ -594,25 +555,21 @@ export interface PipeTransform {
transform(value: any, ...args: any[]): any;
}
/** @experimental */
export declare const PLATFORM_ID: InjectionToken<Object>;
/** @experimental */
export declare const PLATFORM_INITIALIZER: InjectionToken<(() => void)[]>;
/** @experimental */
export declare const platformCore: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
export declare class PlatformRef {
readonly destroyed: boolean;
readonly injector: Injector;
bootstrapModule<M>(moduleType: Type<M>, compilerOptions?: (CompilerOptions & BootstrapOptions) | Array<CompilerOptions & BootstrapOptions>): Promise<NgModuleRef<M>>;
/** @experimental */ bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>, options?: BootstrapOptions): Promise<NgModuleRef<M>>;
bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>, options?: BootstrapOptions): Promise<NgModuleRef<M>>;
destroy(): void;
onDestroy(callback: () => void): void;
}
/** @experimental */
export interface Predicate<T> {
(value: T): boolean;
}
@ -650,7 +607,7 @@ export declare abstract class ReflectiveInjector implements Injector {
abstract instantiateResolved(provider: ResolvedReflectiveProvider): any;
abstract resolveAndCreateChild(providers: Provider[]): ReflectiveInjector;
abstract resolveAndInstantiate(provider: Provider): any;
/** @experimental */ static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector;
static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector;
static resolve(providers: Provider[]): ResolvedReflectiveProvider[];
static resolveAndCreate(providers: Provider[], parent?: Injector): ReflectiveInjector;
}
@ -699,7 +656,6 @@ export declare abstract class Renderer {
abstract setText(renderNode: any, text: string): void;
}
/** @experimental */
export declare abstract class Renderer2 {
abstract readonly data: {
[key: string]: any;
@ -726,7 +682,6 @@ export declare abstract class Renderer2 {
abstract setValue(node: any, value: string): void;
}
/** @experimental */
export declare abstract class RendererFactory2 {
abstract begin?(): void;
abstract createRenderer(hostElement: any, type: RendererType2 | null): Renderer2;
@ -734,13 +689,11 @@ export declare abstract class RendererFactory2 {
abstract whenRenderingDone?(): Promise<any>;
}
/** @experimental */
export declare enum RendererStyleFlags2 {
Important = 1,
DashCase = 2
}
/** @experimental */
export interface RendererType2 {
data: {
[kind: string]: any;
@ -750,7 +703,6 @@ export interface RendererType2 {
styles: (string | any[])[];
}
/** @experimental */
export declare class ResolvedReflectiveFactory {
dependencies: ReflectiveDependency[];
factory: Function;
@ -759,14 +711,12 @@ export declare class ResolvedReflectiveFactory {
dependencies: ReflectiveDependency[]);
}
/** @experimental */
export interface ResolvedReflectiveProvider {
key: ReflectiveKey;
multiProvider: boolean;
resolvedFactories: ResolvedReflectiveFactory[];
}
/** @experimental */
export declare function resolveForwardRef(type: any): any;
/** @deprecated */
@ -778,7 +728,6 @@ export declare abstract class Sanitizer {
abstract sanitize(context: SecurityContext, value: {} | string | null): string | null;
}
/** @experimental */
export interface SchemaMetadata {
name: string;
}
@ -799,7 +748,6 @@ export interface SelfDecorator {
new (): Self;
}
/** @experimental */
export declare function setTestabilityGetter(getter: GetTestability): void;
export declare class SimpleChange {
@ -823,13 +771,11 @@ export interface SkipSelfDecorator {
export declare type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider | ConstructorProvider | FactoryProvider | any[];
/** @experimental */
export declare class SystemJsNgModuleLoader implements NgModuleFactoryLoader {
constructor(_compiler: Compiler, config?: SystemJsNgModuleLoaderConfig);
load(path: string): Promise<NgModuleFactory<any>>;
}
/** @experimental */
export declare abstract class SystemJsNgModuleLoaderConfig {
factoryPathPrefix: string;
factoryPathSuffix: string;
@ -840,7 +786,6 @@ export declare abstract class TemplateRef<C> {
abstract createEmbeddedView(context: C): EmbeddedViewRef<C>;
}
/** @experimental */
export declare class Testability implements PublicTestability {
constructor(_ngZone: NgZone);
/** @deprecated */ decreasePendingRequestCount(): number;
@ -851,7 +796,6 @@ export declare class Testability implements PublicTestability {
whenStable(doneCb: Function, timeout?: number, updateCb?: Function): void;
}
/** @experimental */
export declare class TestabilityRegistry {
constructor();
findTestabilityInTree(elem: Node, findInAncestors?: boolean): Testability | null;
@ -867,10 +811,8 @@ export interface TrackByFunction<T> {
(index: number, item: T): any;
}
/** @experimental */
export declare const TRANSLATIONS: InjectionToken<string>;
/** @experimental */
export declare const TRANSLATIONS_FORMAT: InjectionToken<string>;
export declare const Type: FunctionConstructor;
@ -957,19 +899,14 @@ export declare class WrappedValue {
static wrap(value: any): WrappedValue;
}
/** @experimental */
export declare const wtfCreateScope: (signature: string, flags?: any) => WtfScopeFn;
/** @experimental */
export declare const wtfEndTimeRange: (range: any) => void;
/** @experimental */
export declare const wtfLeave: <T>(scope: any, returnValue?: T) => T;
/** @experimental */
export interface WtfScopeFn {
(arg0?: any, arg1?: any): any;
}
/** @experimental */
export declare const wtfStartTimeRange: (rangeType: string, action: string) => any;

View File

@ -18,43 +18,33 @@ export declare class ComponentFixture<T> {
whenStable(): Promise<any>;
}
/** @experimental */
export declare const ComponentFixtureAutoDetect: InjectionToken<boolean[]>;
/** @experimental */
export declare const ComponentFixtureNoNgZone: InjectionToken<boolean[]>;
/** @experimental */
export declare function discardPeriodicTasks(): void;
/** @experimental */
export declare function fakeAsync(fn: Function): (...args: any[]) => any;
/** @experimental */
export declare function flush(maxTurns?: number): number;
/** @experimental */
export declare function flushMicrotasks(): void;
/** @experimental */
export declare const getTestBed: () => TestBed;
export declare function inject(tokens: any[], fn: Function): () => any;
/** @experimental */
export declare class InjectSetupWrapper {
constructor(_moduleDef: () => TestModuleMetadata);
inject(tokens: any[], fn: Function): () => any;
}
/** @experimental */
export declare type MetadataOverride<T> = {
add?: Partial<T>;
remove?: Partial<T>;
set?: Partial<T>;
};
/** @experimental */
export declare function resetFakeAsyncZone(): void;
export declare const TestBed: TestBedStatic;
@ -100,16 +90,14 @@ export interface TestBedStatic {
}): TestBedStatic;
overrideTemplate(component: Type<any>, template: string): TestBedStatic;
overrideTemplateUsingTestingModule(component: Type<any>, template: string): TestBedStatic;
/** @experimental */ resetTestEnvironment(): void;
resetTestEnvironment(): void;
resetTestingModule(): TestBedStatic;
}
/** @experimental */
export declare class TestComponentRenderer {
insertRootElement(rootElementId: string): void;
}
/** @experimental */
export declare type TestModuleMetadata = {
providers?: any[];
declarations?: any[];
@ -118,9 +106,7 @@ export declare type TestModuleMetadata = {
aotSummaries?: () => any[];
};
/** @experimental */
export declare function tick(millis?: number): void;
/** @experimental */
export declare function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper;
export declare function withModule(moduleDef: TestModuleMetadata, fn: Function): () => any;