chore: audit @angular/core API classification (#8808)

This commit is contained in:
Miško Hevery 2016-05-25 15:00:05 -07:00
parent 5e0f8cf3f0
commit 39ecd01b86
72 changed files with 245 additions and 561 deletions

View File

@ -58,7 +58,8 @@ export var pureProxy10: typeof t.pureProxy10 = r.pureProxy10;
export var castByValue: typeof t.castByValue = r.castByValue;
export type Console = t.Console;
export var Console: typeof t.Console = r.Console;
export var reflector: t.Reflector = r.reflector;
export type Reflector = t.Reflector;
export type NoOpAnimationPlayer = t.NoOpAnimationPlayer;
export var NoOpAnimationPlayer: typeof t.NoOpAnimationPlayer = r.NoOpAnimationPlayer;
export type AnimationPlayer = t.AnimationPlayer;

View File

@ -1,4 +1,5 @@
import {ChangeDetectionStrategy, ViewEncapsulation, reflector} from '@angular/core';
import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
import {reflector} from '../core_private';
import {
CHANGE_DETECTION_STRATEGY_VALUES,
VIEW_ENCAPSULATION_VALUES,

View File

@ -7,9 +7,8 @@ import {
AfterContentChecked,
AfterViewInit,
AfterViewChecked,
reflector
} from '@angular/core';
import {LifecycleHooks} from '../core_private';
import {reflector, LifecycleHooks} from '../core_private';
import {Type} from '../src/facade/lang';
import {MapWrapper} from '../src/facade/collection';

View File

@ -11,9 +11,8 @@ import {
ViewChildrenMetadata,
ContentChildMetadata,
ViewChildMetadata,
reflector
} from '@angular/core';
import {ReflectorReader} from '../core_private';
import {ReflectorReader, reflector} from '../core_private';
import {Type, isPresent, stringify} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';

View File

@ -1,6 +1,5 @@
import {
AttributeMetadata,
ReflectiveDependency,
OptionalMetadata,
ComponentMetadata,
SelfMetadata,
@ -9,18 +8,16 @@ import {
Provider,
PLATFORM_DIRECTIVES,
PLATFORM_PIPES,
reflector,
Injectable,
Inject,
Optional,
ViewMetadata,
NoAnnotationError,
QueryMetadata,
resolveForwardRef,
InjectMetadata,
ViewQueryMetadata
} from '@angular/core';
import {constructDependencies, LIFECYCLE_HOOKS_VALUES, ReflectorReader} from '../core_private';
import {LIFECYCLE_HOOKS_VALUES, ReflectorReader, reflector} from '../core_private';
import {
Type,
isBlank,

View File

@ -1,4 +1,4 @@
import {reflector} from '@angular/core';
import {reflector} from '../../core_private';
import {isPresent, IS_DART, FunctionWrapper} from '../../src/facade/lang';
import {ObservableWrapper} from '../../src/facade/async';
import {BaseException, unimplemented} from '../../src/facade/exceptions';

View File

@ -1,6 +1,6 @@
import {resolveForwardRef, Injectable, PipeMetadata, reflector} from '@angular/core';
import {resolveForwardRef, Injectable, PipeMetadata} from '@angular/core';
import {ReflectorReader} from '../core_private';
import {ReflectorReader, reflector} from '../core_private';
import {Type, isPresent, stringify} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';

View File

@ -2,10 +2,9 @@ import {
Injectable,
ViewMetadata,
ComponentMetadata,
reflector,
} from '@angular/core';
import {ReflectorReader} from '../core_private';
import {ReflectorReader, reflector} from '../core_private';
import {Type, stringify, isBlank, isPresent} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';

View File

@ -5,3 +5,5 @@ export var ReflectorReader: typeof t.ReflectorReader = r.ReflectorReader;
export type ReflectionCapabilities = t.ReflectionCapabilities;
export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities;
export var reflector: typeof t.reflector = r.reflector;

View File

@ -1,5 +1,4 @@
import {reflector} from '@angular/core';
import {ReflectionCapabilities} from './core_private';
import {ReflectionCapabilities, reflector} from './core_private';
import {StaticReflector} from './static_reflector';
export class StaticAndDynamicReflectionCapabilities {
@ -39,4 +38,4 @@ export class StaticAndDynamicReflectionCapabilities {
function isStaticType(type: any): boolean {
return typeof type === 'object' && type.name && type.filePath;
}
}

View File

@ -32,7 +32,6 @@ export * from './src/change_detection';
export * from './src/platform_directives_and_pipes';
export * from './src/platform_common_providers';
export * from './src/application_common_providers';
export * from './src/reflection/reflection';
export {
wtfCreateScope,
wtfLeave,

View File

@ -20,6 +20,8 @@ import * as debug from './src/debug/debug_renderer';
import * as provider_util from './src/di/provider_util';
import * as console from './src/console';
import {Provider} from './index';
import * as reflection from './src/reflection/reflection';
import {Reflector} from './src/reflection/reflection';
import {
NoOpAnimationPlayer as NoOpAnimationPlayer_,
@ -103,6 +105,9 @@ export declare namespace __core_private_types__ {
export var castByValue: typeof view_utils.castByValue;
export type Console = console.Console;
export var Console: typeof console.Console;
export var reflector: typeof reflection.reflector;
export type Reflector = reflection.Reflector;
export var Reflector: typeof reflection.Reflector;
export type NoOpAnimationPlayer = NoOpAnimationPlayer_;
export var NoOpAnimationPlayer: typeof NoOpAnimationPlayer_;
export type AnimationPlayer = AnimationPlayer_;
@ -178,6 +183,8 @@ export var __core_private__ = {
pureProxy10: view_utils.pureProxy10,
castByValue: view_utils.castByValue,
Console: console.Console,
reflector: reflection.reflector,
Reflector: reflection.Reflector,
NoOpAnimationPlayer: NoOpAnimationPlayer_,
AnimationPlayer: AnimationPlayer_,
NoOpAnimationDriver: NoOpAnimationDriver_,

View File

@ -16,6 +16,7 @@ let __unused: Type; // avoid unused import when Type union types are erased
/**
* A default set of providers which should be included in any Angular
* application, regardless of the platform it runs onto.
* @stable
*/
export const APPLICATION_COMMON_PROVIDERS: Array<Type | {[k: string]: any} | any[]> =
/*@ts2dart_const*/[

View File

@ -14,6 +14,7 @@ import {ChangeDetectorRef} from './change_detection/change_detector_ref';
/**
* Create an Angular zone.
* @experimental
*/
export function createNgZone(): NgZone {
return new NgZone({enableLongStackTrace: assertionsEnabled()});
@ -25,6 +26,7 @@ var _inPlatformCreate: boolean = false;
/**
* Creates a platform.
* Platforms have to be eagerly created via this function.
* @experimental
*/
export function createPlatform(injector: Injector): PlatformRef {
if (_inPlatformCreate) {
@ -47,6 +49,7 @@ export function createPlatform(injector: Injector): PlatformRef {
/**
* Checks that there currently is a platform
* which contains the given token as a provider.
* @experimental
*/
export function assertPlatform(requiredToken: any): PlatformRef {
var platform = getPlatform();
@ -62,6 +65,7 @@ export function assertPlatform(requiredToken: any): PlatformRef {
/**
* Dispose the existing platform.
* @experimental
*/
export function disposePlatform(): void {
if (isPresent(_platform) && !_platform.disposed) {
@ -71,6 +75,7 @@ export function disposePlatform(): void {
/**
* Returns the current platform.
* @experimental
*/
export function getPlatform(): PlatformRef {
return isPresent(_platform) && !_platform.disposed ? _platform : null;
@ -79,6 +84,7 @@ export function getPlatform(): PlatformRef {
/**
* Shortcut for ApplicationRef.bootstrap.
* Requires a platform to be created first.
* @experimental
*/
export function coreBootstrap<C>(componentFactory: ComponentFactory<C>,
injector: Injector): ComponentRef<C> {
@ -90,6 +96,7 @@ export function coreBootstrap<C>(componentFactory: ComponentFactory<C>,
* Resolves the componentFactory for the given component,
* waits for asynchronous initializers and bootstraps the component.
* Requires a platform to be created first.
* @experimental
*/
export function coreLoadAndBootstrap(componentType: Type,
injector: Injector): Promise<ComponentRef<any>> {
@ -109,6 +116,7 @@ export function coreLoadAndBootstrap(componentType: Type,
*
* A page's platform is initialized implicitly when {@link bootstrap}() is called, or
* explicitly by calling {@link createPlatform}().
* @stable
*/
export abstract class PlatformRef {
/**
@ -170,6 +178,7 @@ export class PlatformRef_ extends PlatformRef {
* A reference to an Angular application running on a page.
*
* For more about Angular applications, see the documentation for {@link bootstrap}.
* @stable
*/
export abstract class ApplicationRef {
/**

View File

@ -9,6 +9,7 @@ import {Math, StringWrapper} from '../src/facade/lang';
* If you need to avoid randomly generated value to be used as an application id, you can provide
* a custom value via a DI provider <!-- TODO: provider --> configuring the root {@link Injector}
* using this token.
* @experimental
*/
export const APP_ID: any = /*@ts2dart_const*/ new OpaqueToken('AppId');
@ -18,6 +19,7 @@ function _appIdRandomProviderFactory() {
/**
* Providers that will generate a random APP_ID_TOKEN.
* @experimental
*/
export const APP_ID_RANDOM_PROVIDER =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
@ -32,18 +34,21 @@ function _randomChar(): string {
/**
* A function that will be executed when a platform is initialized.
* @experimental
*/
export const PLATFORM_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken("Platform Initializer");
/**
* A function that will be executed when an application is initialized.
* @experimental
*/
export const APP_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken("Application Initializer");
/**
* A token which indicates the root directory of the application
* @experimental
*/
export const PACKAGE_ROOT_URL: any =
/*@ts2dart_const*/ new OpaqueToken("Application Packages Root URL");

View File

@ -34,6 +34,7 @@ export function devModeEqual(a: any, b: any): boolean {
* return WrappedValue.wrap(this._latestValue); // this will force update
* }
* ```
* @stable
*/
export class WrappedValue {
constructor(public wrapped: any) {}
@ -60,6 +61,7 @@ export class ValueUnwrapper {
/**
* Represents a basic change from a previous to a new value.
* @stable
*/
export class SimpleChange {
constructor(public previousValue: any, public currentValue: any) {}

View File

@ -1,3 +1,6 @@
/**
* @stable
*/
export abstract class ChangeDetectorRef {
/**
* Marks all {@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.

View File

@ -28,6 +28,7 @@ export enum ChangeDetectorState {
/**
* Describes within the change detector which strategy will be used the next time change
* detection is triggered.
* @stable
*/
export enum ChangeDetectionStrategy {
/**

View File

@ -24,6 +24,9 @@ export class DefaultIterableDifferFactory implements IterableDifferFactory {
var trackByIdentity = (index: number, item: any) => item;
/**
* @stable
*/
export class DefaultIterableDiffer implements IterableDiffer {
private _length: number = null;
private _collection = null;
@ -532,6 +535,9 @@ export class DefaultIterableDiffer implements IterableDiffer {
}
}
/**
* @stable
*/
export class CollectionChangeRecord {
currentIndex: number = null;
previousIndex: number = null;

View File

@ -335,6 +335,9 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
}
/**
* @stable
*/
export class KeyValueChangeRecord {
previousValue: any = null;
currentValue: any = null;

View File

@ -7,6 +7,8 @@ import {Provider, SkipSelfMetadata, OptionalMetadata} from '../../di';
/**
* A strategy for tracking changes over time to an iterable. Used for {@link NgFor} to
* respond to changes in an iterable by effecting equivalent changes in the DOM.
*
* @stable
*/
export interface IterableDiffer {
diff(object: any): any;
@ -31,6 +33,7 @@ export interface IterableDifferFactory {
/**
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
* @ts2dart_const
* @stable
*/
export class IterableDiffers {
/*@ts2dart_const*/

View File

@ -23,6 +23,7 @@ export interface KeyValueDifferFactory {
/**
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
* @ts2dart_const
* @stable
*/
export class KeyValueDiffers {
/*@ts2dart_const*/

View File

@ -5,6 +5,9 @@ import {RenderDebugInfo} from '../render/api';
export class EventListener { constructor(public name: string, public callback: Function){}; }
/**
* @experimental
*/
export class DebugNode {
nativeNode: any;
listeners: EventListener[];
@ -46,6 +49,9 @@ export class DebugNode {
inject(token: any): any { return this.injector.get(token); }
}
/**
* @experimental
*/
export class DebugElement extends DebugNode {
name: string;
properties: {[key: string]: string};
@ -129,6 +135,9 @@ export class DebugElement extends DebugNode {
}
}
/**
* @experimental
*/
export function asNativeElements(debugEls: DebugElement[]): any {
return debugEls.map((el) => el.nativeElement);
}
@ -162,6 +171,9 @@ function _queryNodeChildren(parentNode: DebugNode, predicate: Predicate<DebugNod
// Need to keep the nodes in a global Map so that multiple angular apps are supported.
var _nativeNodeToDebugNode = new Map<any, DebugNode>();
/**
* @experimental
*/
export function getDebugNode(nativeNode: any): DebugNode {
return _nativeNodeToDebugNode.get(nativeNode);
}

View File

@ -10,8 +10,7 @@ export {
InjectableMetadata,
SelfMetadata,
HostMetadata,
SkipSelfMetadata,
DependencyMetadata
SkipSelfMetadata
} from './di/metadata';
// we have to reexport * because Dart and TS export two different sets of types
@ -25,15 +24,12 @@ export {
Binding,
ProviderBuilder,
bind,
Provider,
provide
} from './di/provider';
export {
ResolvedReflectiveBinding,
ResolvedReflectiveFactory,
ReflectiveDependency,
ResolvedReflectiveProvider
} from './di/reflective_provider';
export {ReflectiveKey} from './di/reflective_key';

View File

@ -5,6 +5,7 @@ export 'metadata.dart';
/**
* {@link InjectMetadata}.
* @stable
*/
class Inject extends InjectMetadata {
const Inject(dynamic token) : super(token);
@ -12,6 +13,7 @@ class Inject extends InjectMetadata {
/**
* {@link OptionalMetadata}.
* @stable
*/
class Optional extends OptionalMetadata {
const Optional() : super();
@ -19,6 +21,7 @@ class Optional extends OptionalMetadata {
/**
* {@link InjectableMetadata}.
* @stable
*/
class Injectable extends InjectableMetadata {
const Injectable() : super();
@ -26,6 +29,7 @@ class Injectable extends InjectableMetadata {
/**
* {@link SelfMetadata}.
* @stable
*/
class Self extends SelfMetadata {
const Self() : super();
@ -33,6 +37,7 @@ class Self extends SelfMetadata {
/**
* {@link HostMetadata}.
* @stable
*/
class Host extends HostMetadata {
const Host() : super();
@ -40,6 +45,7 @@ class Host extends HostMetadata {
/**
* {@link SkipSelfMetadata}.
* @stable
*/
class SkipSelf extends SkipSelfMetadata {
const SkipSelf() : super();

View File

@ -10,6 +10,7 @@ import {makeDecorator, makeParamDecorator} from '../util/decorators';
/**
* Factory for creating {@link InjectMetadata}.
* @stable
*/
export interface InjectMetadataFactory {
(token: any): any;
@ -18,6 +19,7 @@ export interface InjectMetadataFactory {
/**
* Factory for creating {@link OptionalMetadata}.
* @stable
*/
export interface OptionalMetadataFactory {
(): any;
@ -26,6 +28,7 @@ export interface OptionalMetadataFactory {
/**
* Factory for creating {@link InjectableMetadata}.
* @stable
*/
export interface InjectableMetadataFactory {
(): any;
@ -34,6 +37,7 @@ export interface InjectableMetadataFactory {
/**
* Factory for creating {@link SelfMetadata}.
* @stable
*/
export interface SelfMetadataFactory {
(): any;
@ -42,6 +46,7 @@ export interface SelfMetadataFactory {
/**
* Factory for creating {@link HostMetadata}.
* @stable
*/
export interface HostMetadataFactory {
(): any;
@ -50,6 +55,7 @@ export interface HostMetadataFactory {
/**
* Factory for creating {@link SkipSelfMetadata}.
* @stable
*/
export interface SkipSelfMetadataFactory {
(): any;
@ -58,31 +64,37 @@ export interface SkipSelfMetadataFactory {
/**
* Factory for creating {@link InjectMetadata}.
* @stable
*/
export var Inject: InjectMetadataFactory = makeParamDecorator(InjectMetadata);
/**
* Factory for creating {@link OptionalMetadata}.
* @stable
*/
export var Optional: OptionalMetadataFactory = makeParamDecorator(OptionalMetadata);
/**
* Factory for creating {@link InjectableMetadata}.
* @stable
*/
export var Injectable: InjectableMetadataFactory =
<InjectableMetadataFactory>makeDecorator(InjectableMetadata);
/**
* Factory for creating {@link SelfMetadata}.
* @stable
*/
export var Self: SelfMetadataFactory = makeParamDecorator(SelfMetadata);
/**
* Factory for creating {@link HostMetadata}.
* @stable
*/
export var Host: HostMetadataFactory = makeParamDecorator(HostMetadata);
/**
* Factory for creating {@link SkipSelfMetadata}.
* @stable
*/
export var SkipSelf: SkipSelfMetadataFactory = makeParamDecorator(SkipSelfMetadata);

View File

@ -19,6 +19,7 @@ export interface ForwardRefFn { (): any; }
*
* ### Example
* {@example core/di/ts/forward_ref/forward_ref.ts region='forward_ref'}
* @experimental
*/
export function forwardRef(forwardRefFn: ForwardRefFn): Type {
(<any>forwardRefFn).__forward_ref__ = forwardRef;
@ -40,6 +41,7 @@ export function forwardRef(forwardRefFn: ForwardRefFn): Type {
* ```
*
* See: {@link forwardRef}
* @experimental
*/
export function resolveForwardRef(type: any): any {
if (isFunction(type) && type.hasOwnProperty('__forward_ref__') &&

View File

@ -3,6 +3,9 @@ import {unimplemented} from '../../src/facade/exceptions';
const _THROW_IF_NOT_FOUND = /*@ts2dart_const*/ new Object();
export const THROW_IF_NOT_FOUND = /*@ts2dart_const*/ _THROW_IF_NOT_FOUND;
/**
* @stable
*/
export abstract class Injector {
static THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;

View File

@ -40,6 +40,7 @@ import {stringify} from '../../src/facade/lang';
* expect(injector.get(Car).engine instanceof Engine).toBe(true);
* ```
* @ts2dart_const
* @stable
*/
export class InjectMetadata {
constructor(public token) {}
@ -67,6 +68,7 @@ export class InjectMetadata {
* expect(injector.get(Car).engine).toBeNull();
* ```
* @ts2dart_const
* @stable
*/
export class OptionalMetadata {
toString(): string { return `@Optional()`; }
@ -76,6 +78,7 @@ export class OptionalMetadata {
* `DependencyMetadata` is used by the framework to extend DI.
* This is internal to Angular and should not be used directly.
* @ts2dart_const
* @stable
*/
export class DependencyMetadata {
get token() { return null; }
@ -112,6 +115,7 @@ export class DependencyMetadata {
* expect(() => injector.get(NeedsService)).toThrowError();
* ```
* @ts2dart_const
* @stable
*/
export class InjectableMetadata {
constructor() {}
@ -144,6 +148,7 @@ export class InjectableMetadata {
* expect(() => child.get(NeedsDependency)).toThrowError();
* ```
* @ts2dart_const
* @stable
*/
export class SelfMetadata {
toString(): string { return `@Self()`; }
@ -174,6 +179,7 @@ export class SelfMetadata {
* expect(() => inj.get(NeedsDependency)).toThrowError();
* ```
* @ts2dart_const
* @stable
*/
export class SkipSelfMetadata {
toString(): string { return `@SkipSelf()`; }
@ -233,6 +239,7 @@ export class SkipSelfMetadata {
* bootstrap(App);
*```
* @ts2dart_const
* @stable
*/
export class HostMetadata {
toString(): string { return `@Host()`; }

View File

@ -19,6 +19,7 @@
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
* error messages.
* @ts2dart_const
* @stable
*/
export class OpaqueToken {
constructor(private _desc: string) {}

View File

@ -16,6 +16,7 @@ import {BaseException} from '../../src/facade/exceptions';
* expect(injector.get("message")).toEqual('Hello');
* ```
* @ts2dart_const
* @deprecated
*/
export class Provider {
/**
@ -259,6 +260,7 @@ export function bind(token): ProviderBuilder {
/**
* Helper class for the {@link bind} function.
* @deprecated
*/
export class ProviderBuilder {
constructor(public token) {}
@ -384,6 +386,7 @@ export class ProviderBuilder {
* See {@link Provider} for more details.
*
* <!-- TODO: improve the docs -->
* @deprecated
*/
export function provide(token, {useClass, useValue, useExisting, useFactory, deps, multi}: {
useClass?: Type,

View File

@ -30,6 +30,7 @@ function constructResolvingPath(keys: any[]): string {
/**
* Base class for all errors arising from misconfigured providers.
* @stable
*/
export class AbstractProviderError extends BaseException {
/** @internal */
@ -75,6 +76,7 @@ export class AbstractProviderError extends BaseException {
*
* expect(() => Injector.resolveAndCreate([A])).toThrowError();
* ```
* @stable
*/
export class NoProviderError extends AbstractProviderError {
constructor(injector: ReflectiveInjector, key: ReflectiveKey) {
@ -100,6 +102,7 @@ export class NoProviderError extends AbstractProviderError {
* ```
*
* Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
* @stable
*/
export class CyclicDependencyError extends AbstractProviderError {
constructor(injector: ReflectiveInjector, key: ReflectiveKey) {
@ -134,6 +137,7 @@ export class CyclicDependencyError extends AbstractProviderError {
* expect(e.originalStack).toBeDefined();
* }
* ```
* @stable
*/
export class InstantiationError extends WrappedException {
/** @internal */
@ -172,6 +176,7 @@ export class InstantiationError extends WrappedException {
* ```typescript
* expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
* ```
* @stable
*/
export class InvalidProviderError extends BaseException {
constructor(provider) {
@ -206,6 +211,7 @@ export class InvalidProviderError extends BaseException {
*
* expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
* ```
* @stable
*/
export class NoAnnotationError extends BaseException {
constructor(typeOrFunc, params: any[][]) {
@ -241,6 +247,7 @@ export class NoAnnotationError extends BaseException {
*
* expect(() => injector.getAt(100)).toThrowError();
* ```
* @stable
*/
export class OutOfBoundsError extends BaseException {
constructor(index) { super(`Index ${index} is out-of-bounds.`); }

View File

@ -448,6 +448,7 @@ export abstract class ReflectiveInjector implements Injector {
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
* @experimental
*/
static fromResolvedProviders(providers: ResolvedReflectiveProvider[],
parent: Injector = null): ReflectiveInjector {

View File

@ -16,6 +16,7 @@ import {resolveForwardRef} from './forward_ref';
* `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when
* resolving
* providers.
* @experimental
*/
export class ReflectiveKey {
/**

View File

@ -88,6 +88,7 @@ export class ResolvedReflectiveProvider_ implements ResolvedReflectiveBinding {
/**
* An internal resolved representation of a factory function created by resolving {@link Provider}.
* @experimental
*/
export class ResolvedReflectiveFactory {
constructor(

View File

@ -13,6 +13,7 @@ import {Injector} from '../di/injector';
* `ComponentRef` provides access to the Component Instance as well other objects related to this
* Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
* method.
* @stable
*/
export abstract class ComponentRef<C> {
/**
@ -69,9 +70,12 @@ export class ComponentRef_<C> extends ComponentRef<C> {
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
}
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
/*@ts2dart_const*/
/**
* @experimental
* @ts2dart_const
*/
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
export class ComponentFactory<C> {
constructor(public selector: string, private _viewFactory: Function,
private _componentType: Type) {}

View File

@ -8,6 +8,7 @@ import {Injectable} from '../di/decorators';
/**
* Low-level service for loading {@link ComponentFactory}s, which
* can later be used to create and render a Component instance.
* @experimental
*/
export abstract class ComponentResolver {
abstract resolveComponent(component: Type|string): Promise<ComponentFactory<any>>;

View File

@ -26,6 +26,7 @@ export class ElementRef {
* web worker.
* </p>
* </div>
* @stable
*/
public nativeElement: any;

View File

@ -32,6 +32,7 @@ import {BaseException, WrappedException} from '../../src/facade/exceptions';
* }
* }
* ```
* @stable
*/
export class ExpressionChangedAfterItHasBeenCheckedException extends BaseException {
constructor(oldValue: any, currValue: any, context: any) {
@ -45,6 +46,7 @@ export class ExpressionChangedAfterItHasBeenCheckedException extends BaseExcepti
*
* This error wraps the original exception to attach additional contextual information that can
* be useful for debugging.
* @stable
*/
export class ViewWrappedException extends WrappedException {
constructor(originalException: any, originalStack: any, context: any) {
@ -58,6 +60,7 @@ export class ViewWrappedException extends WrappedException {
* This error indicates a bug in the framework.
*
* This is an internal Angular error.
* @stable
*/
export class ViewDestroyedException extends BaseException {
constructor(details: string) { super(`Attempt to use a destroyed view: ${details}`); }

View File

@ -26,6 +26,7 @@ import {Observable, EventEmitter} from '../../src/facade/async';
* }
* }
* ```
* @deprecated
*/
export class QueryList<T> {
private _dirty = true;

View File

@ -4,6 +4,7 @@ import { ComponentFactory } from './component_factory';
/**
* Component resolver that can load components lazily
* @experimental
*/
export class SystemJsComponentResolver implements ComponentResolver {
constructor(private _resolver: ComponentResolver) {}

View File

@ -17,6 +17,7 @@ const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
* To instantiate Embedded Views based on a Template, use
* {@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the
* View Container.
* @stable
*/
export abstract class TemplateRef<C> {
/**

View File

@ -27,6 +27,7 @@ import {ComponentFactory, ComponentRef} from './component_factory';
*
* To access a `ViewContainerRef` of an Element, you can either place a {@link Directive} injected
* with `ViewContainerRef` on the Element, or you obtain it via a {@link ViewChild} query.
* @stable
*/
export abstract class ViewContainerRef {
/**

View File

@ -3,6 +3,9 @@ import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
import {AppView} from './view';
import {ChangeDetectionStrategy} from '../change_detection/constants';
/**
* @stable
*/
export abstract class ViewRef {
get destroyed(): boolean { return <boolean>unimplemented(); }
@ -61,6 +64,7 @@ export abstract class ViewRef {
* </ul>
* <!-- /ViewRef: outer-0 -->
* ```
* @experimental
*/
export abstract class EmbeddedViewRef<C> extends ViewRef {
get context(): C { return unimplemented(); }

View File

@ -22,6 +22,7 @@ export './metadata/lifecycle_hooks.dart' show
/**
* See: [DirectiveMetadata] for docs.
* @stable
*/
class Directive extends DirectiveMetadata {
const Directive(
@ -50,6 +51,7 @@ class Directive extends DirectiveMetadata {
/**
* See: [ComponentMetadata] for docs.
* @stable
*/
class Component extends ComponentMetadata {
const Component(
@ -100,6 +102,7 @@ class Component extends ComponentMetadata {
/**
* See: [ViewMetadata] for docs.
* @deprecated
*/
class View extends ViewMetadata {
const View(
@ -124,6 +127,7 @@ class View extends ViewMetadata {
/**
* See: [PipeMetadata] for docs.
* @stable
*/
class Pipe extends PipeMetadata {
const Pipe({name, pure}) : super(name: name, pure: pure);
@ -131,6 +135,7 @@ class Pipe extends PipeMetadata {
/**
* See: [AttributeMetadata] for docs.
* @stable
*/
class Attribute extends AttributeMetadata {
const Attribute(String attributeName) : super(attributeName);
@ -138,8 +143,8 @@ class Attribute extends AttributeMetadata {
/**
* See: [QueryMetadata] for docs.
* @deprecated Use ContentChildren/ContentChild instead
*/
@Deprecated("Use ContentChildren/ContentChild instead")
class Query extends QueryMetadata {
const Query(dynamic /*Type | string*/ selector,
{bool descendants: false, dynamic read: null})
@ -148,6 +153,7 @@ class Query extends QueryMetadata {
/**
* See: [ContentChildrenMetadata] for docs.
* @stable
*/
class ContentChildren extends ContentChildrenMetadata {
const ContentChildren(dynamic /*Type | string*/ selector,
@ -157,6 +163,7 @@ class ContentChildren extends ContentChildrenMetadata {
/**
* See: [ContentChildMetadata] for docs.
* @stable
*/
class ContentChild extends ContentChildMetadata {
const ContentChild(dynamic /*Type | string*/ selector, {dynamic read: null}) : super(selector, read: read);
@ -164,8 +171,8 @@ class ContentChild extends ContentChildMetadata {
/**
* See: [ViewQueryMetadata] for docs.
* @deprecated Use ViewChildren/ViewChild instead
*/
@Deprecated("Use ViewChildren/ViewChild instead")
class ViewQuery extends ViewQueryMetadata {
const ViewQuery(dynamic /*Type | string*/ selector, {dynamic read: null})
: super(selector, descendants: true, read: read);
@ -173,6 +180,7 @@ class ViewQuery extends ViewQueryMetadata {
/**
* See: [ViewChildrenMetadata] for docs.
* @stable
*/
class ViewChildren extends ViewChildrenMetadata {
const ViewChildren(dynamic /*Type | string*/ selector, {dynamic read: null}) : super(selector, read: read);
@ -180,6 +188,7 @@ class ViewChildren extends ViewChildrenMetadata {
/**
* See: [ViewChildMetadata] for docs.
* @stable
*/
class ViewChild extends ViewChildMetadata {
const ViewChild(dynamic /*Type | string*/ selector, {dynamic read: null}) : super(selector, read: read);
@ -187,6 +196,7 @@ class ViewChild extends ViewChildMetadata {
/**
* See: [InputMetadata] for docs.
* @stable
*/
class Input extends InputMetadata {
const Input([String bindingPropertyName]) : super(bindingPropertyName);
@ -194,6 +204,7 @@ class Input extends InputMetadata {
/**
* See: [OutputMetadata] for docs.
* @stable
*/
class Output extends OutputMetadata {
const Output([String bindingPropertyName]) : super(bindingPropertyName);
@ -201,6 +212,7 @@ class Output extends OutputMetadata {
/**
* See: [HostBindingMetadata] for docs.
* @stable
*/
class HostBinding extends HostBindingMetadata {
const HostBinding([String hostPropertyName]) : super(hostPropertyName);
@ -208,6 +220,7 @@ class HostBinding extends HostBindingMetadata {
/**
* See: [HostListenerMetadata] for docs.
* @stable
*/
class HostListener extends HostListenerMetadata {
const HostListener(String eventName, [List<String> args])

View File

@ -397,6 +397,7 @@ export interface AttributeMetadataFactory {
* [new ng.Query(SomeType)]
* ]
* ```
* @deprecated
*/
export interface QueryMetadataFactory {
(selector: Type | string,
@ -407,6 +408,7 @@ export interface QueryMetadataFactory {
/**
* Factory for {@link ContentChildren}.
* @stable
*/
export interface ContentChildrenMetadataFactory {
(selector: Type | string, {descendants, read}?: {descendants?: boolean, read?: any}): any;
@ -416,6 +418,7 @@ export interface ContentChildrenMetadataFactory {
/**
* Factory for {@link ContentChild}.
* @stable
*/
export interface ContentChildMetadataFactory {
(selector: Type | string, {read}?: {read?: any}): any;
@ -424,6 +427,7 @@ export interface ContentChildMetadataFactory {
/**
* Factory for {@link ViewChildren}.
* @stable
*/
export interface ViewChildrenMetadataFactory {
(selector: Type | string, {read}?: {read?: any}): any;
@ -432,6 +436,7 @@ export interface ViewChildrenMetadataFactory {
/**
* Factory for {@link ViewChild}.
* @stable
*/
export interface ViewChildMetadataFactory {
(selector: Type | string, {read}?: {read?: any}): any;
@ -445,6 +450,7 @@ export interface ViewChildMetadataFactory {
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='pipe'}
* @stable
*/
export interface PipeMetadataFactory {
(obj: {name: string, pure?: boolean}): any;
@ -455,6 +461,7 @@ export interface PipeMetadataFactory {
* {@link InputMetadata} factory for creating decorators.
*
* See {@link InputMetadata}.
* @stable
*/
export interface InputMetadataFactory {
(bindingPropertyName?: string): any;
@ -465,6 +472,7 @@ export interface InputMetadataFactory {
* {@link OutputMetadata} factory for creating decorators.
*
* See {@link OutputMetadata}.
* @stable
*/
export interface OutputMetadataFactory {
(bindingPropertyName?: string): any;
@ -473,6 +481,7 @@ export interface OutputMetadataFactory {
/**
* {@link HostBindingMetadata} factory function.
* @stable
*/
export interface HostBindingMetadataFactory {
(hostPropertyName?: string): any;
@ -481,6 +490,7 @@ export interface HostBindingMetadataFactory {
/**
* {@link HostListenerMetadata} factory function.
* @stable
*/
export interface HostListenerMetadataFactory {
(eventName: string, args?: string[]): any;
@ -510,6 +520,7 @@ export interface HostListenerMetadataFactory {
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='component'}
* @stable
*/
export var Component: ComponentMetadataFactory =
<ComponentMetadataFactory>makeDecorator(ComponentMetadata, (fn: any) => fn.View = View);
@ -892,6 +903,7 @@ export var Component: ComponentMetadataFactory =
* Note also that although the `<li></li>` template still exists inside the `<template></template>`,
* the instantiated
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
* @stable
*/
export var Directive: DirectiveMetadataFactory =
<DirectiveMetadataFactory>makeDecorator(DirectiveMetadata);
@ -925,6 +937,7 @@ export var Directive: DirectiveMetadataFactory =
* }
* }
* ```
* @deprecated
*/
var View: ViewMetadataFactory =
<ViewMetadataFactory>makeDecorator(ViewMetadata, (fn: any) => fn.View = View);
@ -945,6 +958,7 @@ var View: ViewMetadataFactory =
* A decorator can inject string literal `text` like so:
*
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
* @stable
*/
export var Attribute: AttributeMetadataFactory = makeParamDecorator(AttributeMetadata);
@ -1055,6 +1069,7 @@ export var Attribute: AttributeMetadataFactory = makeParamDecorator(AttributeMet
*
* The injected object is an unmodifiable live list.
* See {@link QueryList} for more details.
* @deprecated
*/
export var Query: QueryMetadataFactory = makeParamDecorator(QueryMetadata);
@ -1078,6 +1093,7 @@ export var Query: QueryMetadataFactory = makeParamDecorator(QueryMetadata);
* }
* }
* ```
* @stable
*/
export var ContentChildren: ContentChildrenMetadataFactory =
makePropDecorator(ContentChildrenMetadata);
@ -1111,6 +1127,7 @@ export var ContentChildren: ContentChildrenMetadataFactory =
* <item>b</item>
* </container>
* ```
* @stable
*/
export var ContentChild: ContentChildMetadataFactory = makePropDecorator(ContentChildMetadata);
@ -1193,6 +1210,7 @@ export var ContentChild: ContentChildMetadataFactory = makePropDecorator(Content
* ```
*
* See also: [ViewChildrenMetadata]
* @stable
*/
export var ViewChildren: ViewChildrenMetadataFactory = makePropDecorator(ViewChildrenMetadata);
@ -1266,6 +1284,7 @@ export var ViewChildren: ViewChildrenMetadataFactory = makePropDecorator(ViewChi
* }
* ```
* See also: [ViewChildMetadata]
* @stable
*/
export var ViewChild: ViewChildMetadataFactory = makePropDecorator(ViewChildMetadata);
@ -1304,6 +1323,7 @@ export var ViewChild: ViewChildMetadataFactory = makePropDecorator(ViewChildMeta
*
* The injected object is an iterable and observable live list.
* See {@link QueryList} for more details.
* @deprecated
*/
export var ViewQuery: QueryMetadataFactory = makeParamDecorator(ViewQueryMetadata);
@ -1314,6 +1334,7 @@ export var ViewQuery: QueryMetadataFactory = makeParamDecorator(ViewQueryMetadat
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='pipe'}
* @stable
*/
export var Pipe: PipeMetadataFactory = <PipeMetadataFactory>makeDecorator(PipeMetadata);
@ -1358,6 +1379,7 @@ export var Pipe: PipeMetadataFactory = <PipeMetadataFactory>makeDecorator(PipeMe
*
* bootstrap(App);
* ```
* @stable
*/
export var Input: InputMetadataFactory = makePropDecorator(InputMetadata);
@ -1402,6 +1424,7 @@ export var Input: InputMetadataFactory = makePropDecorator(InputMetadata);
* }
* bootstrap(App);
* ```
* @stable
*/
export var Output: OutputMetadataFactory = makePropDecorator(OutputMetadata);
@ -1440,6 +1463,7 @@ export var Output: OutputMetadataFactory = makePropDecorator(OutputMetadata);
*
* bootstrap(App);
* ```
* @stable
*/
export var HostBinding: HostBindingMetadataFactory = makePropDecorator(HostBindingMetadata);
@ -1477,5 +1501,6 @@ export var HostBinding: HostBindingMetadataFactory = makePropDecorator(HostBindi
*
* bootstrap(App);
* ```
* @stable
*/
export var HostListener: HostListenerMetadataFactory = makePropDecorator(HostListenerMetadata);

View File

@ -19,6 +19,7 @@ import {resolveForwardRef} from '../di/forward_ref';
*
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
* @ts2dart_const
* @stable
*/
export class AttributeMetadata extends DependencyMetadata {
constructor(public attributeName: string) { super(); }
@ -141,6 +142,7 @@ export class AttributeMetadata extends DependencyMetadata {
* The injected object is an unmodifiable live list.
* See {@link QueryList} for more details.
* @ts2dart_const
* @deprecated
*/
export class QueryMetadata extends DependencyMetadata {
/**
@ -208,6 +210,7 @@ export class QueryMetadata extends DependencyMetadata {
* }
* ```
* @ts2dart_const
* @stable
*/
export class ContentChildrenMetadata extends QueryMetadata {
constructor(_selector: Type | string,
@ -237,6 +240,7 @@ export class ContentChildrenMetadata extends QueryMetadata {
* }
* ```
* @ts2dart_const
* @stable
*/
export class ContentChildMetadata extends QueryMetadata {
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
@ -279,6 +283,7 @@ export class ContentChildMetadata extends QueryMetadata {
* The injected object is an iterable and observable live list.
* See {@link QueryList} for more details.
* @ts2dart_const
* @deprecated
*/
export class ViewQueryMetadata extends QueryMetadata {
constructor(_selector: Type | string,
@ -371,6 +376,7 @@ export class ViewQueryMetadata extends QueryMetadata {
* }
* ```
* @ts2dart_const
* @stable
*/
export class ViewChildrenMetadata extends ViewQueryMetadata {
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
@ -448,6 +454,7 @@ export class ViewChildrenMetadata extends ViewQueryMetadata {
* }
* ```
* @ts2dart_const
* @stable
*/
export class ViewChildMetadata extends ViewQueryMetadata {
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {

View File

@ -382,6 +382,7 @@ import {AnimationEntryMetadata} from '../animation/metadata';
* the instantiated
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
* @ts2dart_const
* @stable
*/
export class DirectiveMetadata extends InjectableMetadata {
/**
@ -789,6 +790,7 @@ export class DirectiveMetadata extends InjectableMetadata {
*
* {@example core/ts/metadata/metadata.ts region='component'}
* @ts2dart_const
* @stable
*/
export class ComponentMetadata extends DirectiveMetadata {
/**
@ -943,6 +945,7 @@ export class ComponentMetadata extends DirectiveMetadata {
*
* {@example core/ts/metadata/metadata.ts region='pipe'}
* @ts2dart_const
* @stable
*/
export class PipeMetadata extends InjectableMetadata {
name: string;
@ -999,6 +1002,7 @@ export class PipeMetadata extends InjectableMetadata {
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class InputMetadata {
constructor(
@ -1049,6 +1053,7 @@ export class InputMetadata {
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class OutputMetadata {
constructor(public bindingPropertyName?: string) {}
@ -1089,6 +1094,7 @@ export class OutputMetadata {
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class HostBindingMetadata {
constructor(public hostPropertyName?: string) {}
@ -1128,6 +1134,7 @@ export class HostBindingMetadata {
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class HostListenerMetadata {
constructor(public eventName: string, public args?: string[]) {}

View File

@ -1,5 +1,8 @@
import {SimpleChange} from '../change_detection/change_detection_util';
/**
* @stable
*/
export enum LifecycleHooks {
OnInit,
OnDestroy,
@ -14,6 +17,7 @@ export enum LifecycleHooks {
/**
* A `changes` object whose keys are property names and
* values are instances of {@link SimpleChange}. See {@link OnChanges}
* @stable
*/
export interface SimpleChanges {[propName: string]: SimpleChange}
@ -77,6 +81,7 @@ export var LIFECYCLE_HOOKS_VALUES = [
*
* bootstrap(App).catch(err => console.error(err));
* ```
* @stable
*/
export abstract class OnChanges { abstract ngOnChanges(changes: SimpleChanges); }
@ -120,6 +125,7 @@ export abstract class OnChanges { abstract ngOnChanges(changes: SimpleChanges);
*
* bootstrap(App).catch(err => console.error(err));
* ```
* @stable
*/
export abstract class OnInit { abstract ngOnInit(); }
@ -187,6 +193,7 @@ export abstract class OnInit { abstract ngOnInit(); }
* list = [];
* }
* ```
* @stable
*/
export abstract class DoCheck { abstract ngDoCheck(); }
@ -278,6 +285,7 @@ export abstract class DoCheck { abstract ngDoCheck(); }
* Invoking `{{ 10000 | countdown }}` would cause the value to be decremented by 50,
* every 50ms, until it reaches 0.
*
* @stable
*/
export abstract class OnDestroy { abstract ngOnDestroy(); }
@ -331,6 +339,7 @@ export abstract class OnDestroy { abstract ngOnDestroy(); }
*
* bootstrap(App).catch(err => console.error(err));
* ```
* @stable
*/
export abstract class AfterContentInit { abstract ngAfterContentInit(); }
@ -379,6 +388,7 @@ export abstract class AfterContentInit { abstract ngAfterContentInit(); }
*
* bootstrap(App).catch(err => console.error(err));
* ```
* @stable
*/
export abstract class AfterContentChecked { abstract ngAfterContentChecked(); }
@ -426,6 +436,7 @@ export abstract class AfterContentChecked { abstract ngAfterContentChecked(); }
*
* bootstrap(App).catch(err => console.error(err));
* ```
* @stable
*/
export abstract class AfterViewInit { abstract ngAfterViewInit(); }
@ -476,5 +487,6 @@ export abstract class AfterViewInit { abstract ngAfterViewInit(); }
*
* bootstrap(App).catch(err => console.error(err));
* ```
* @stable
*/
export abstract class AfterViewChecked { abstract ngAfterViewChecked(); }

View File

@ -5,6 +5,7 @@ import {AnimationEntryMetadata} from '../animation/metadata';
* Defines template and style encapsulation options available for Component's {@link View}.
*
* See {@link ViewMetadata#encapsulation}.
* @stable
*/
export enum ViewEncapsulation {
/**

View File

@ -14,6 +14,7 @@ var __unused: Type; // prevent missing use Dart warning.
/**
* A default set of providers which should be included in any Angular platform.
* @experimental
*/
export const PLATFORM_COMMON_PROVIDERS: Array<any | Type | Provider | any[]> = /*@ts2dart_const*/[
PLATFORM_CORE_PROVIDERS,

View File

@ -23,6 +23,7 @@ import {OpaqueToken} from './di';
*
* bootstrap(MyComponent, [provide(PLATFORM_DIRECTIVES, {useValue: [OtherDirective], multi:true})]);
* ```
* @stable
*/
export const PLATFORM_DIRECTIVES: OpaqueToken =
/*@ts2dart_const*/ new OpaqueToken("Platform Directives");
@ -49,5 +50,6 @@ export const PLATFORM_DIRECTIVES: OpaqueToken =
*
* bootstrap(MyComponent, [provide(PLATFORM_PIPES, {useValue: [OtherPipe], multi:true})]);
* ```
* @stable
*/
export const PLATFORM_PIPES: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken("Platform Pipes");

View File

@ -41,6 +41,7 @@ function noopScope(arg0?: any, arg1?: any): any {
* needs to be fixed before the app should be profiled. Add try-finally only when you expect that
* an exception is expected during normal execution while profiling.
*
* @experimental
*/
export var wtfCreateScope: (signature: string, flags?: any) => impl.WtfScopeFn =
wtfEnabled ? impl.createScope : (signature: string, flags?: any) => noopScope;
@ -52,6 +53,7 @@ export var wtfCreateScope: (signature: string, flags?: any) => impl.WtfScopeFn =
* - `returnValue` (optional) to be passed to the WTF.
*
* Returns the `returnValue for easy chaining.
* @experimental
*/
export var wtfLeave:<T>(scope: any, returnValue?: T) => T =
wtfEnabled ? impl.leave : (s: any, r?: any) => r;
@ -67,6 +69,7 @@ export var wtfLeave:<T>(scope: any, returnValue?: T) => T =
* wtfEndTimeRange(s);
* });
* }
* @experimental
*/
export var wtfStartTimeRange: (rangeType: string, action: string) => any =
wtfEnabled ? impl.startTimeRange : (rangeType: string, action: string) => null;
@ -75,6 +78,7 @@ export var wtfStartTimeRange: (rangeType: string, action: string) => any =
* Ends a async time range operation.
* [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
* enabled.
* @experimental
*/
export var wtfEndTimeRange: (range: any) => void = wtfEnabled ? impl.endTimeRange : (r: any) =>
null;

View File

@ -5,6 +5,9 @@ import {AnimationKeyframe} from '../../src/animation/animation_keyframe';
import {AnimationPlayer} from '../../src/animation/animation_player';
import {AnimationStyles} from '../../src/animation/animation_styles';
/**
* @experimental
*/
export class RenderComponentType {
constructor(public id: string, public templateUrl: string, public slotCount: number,
public encapsulation: ViewEncapsulation, public styles: Array<string | any[]>) {}
@ -19,6 +22,9 @@ export abstract class RenderDebugInfo {
get source(): string { return unimplemented(); }
}
/**
* @experimental
*/
export abstract class Renderer {
abstract selectRootElement(selectorOrNode: string | any, debugInfo: RenderDebugInfo): any;
@ -77,8 +83,8 @@ export abstract class Renderer {
* If you are implementing a custom renderer, you must implement this interface.
*
* The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
* @experimental
*/
export abstract class RootRenderer {
abstract renderComponent(componentType: RenderComponentType): Renderer;
}

View File

@ -10,6 +10,7 @@ import {Injectable} from '../di/decorators';
* The Testability service provides testing hooks that can be accessed from
* the browser and by services such as Protractor. Each bootstrapped Angular
* application on the page will have an instance of Testability.
* @experimental
*/
@Injectable()
export class Testability {
@ -101,6 +102,7 @@ export class Testability {
/**
* A global registry of {@link Testability} instances for specific elements.
* @experimental
*/
@Injectable()
export class TestabilityRegistry {
@ -145,6 +147,7 @@ class _NoopGetTestability implements GetTestability {
/**
* Set the {@link GetTestability} implementation used by the Angular testing framework.
* @experimental
*/
export function setTestabilityGetter(getter: GetTestability): void {
_testabilityGetter = getter;

View File

@ -206,6 +206,7 @@ function applyParams(fnOrArray: (Function | any[]), key: string): Function {
* }
* });
* ```
* @stable
*/
export function Class(clsDef: ClassDefinition): ConcreteType {
var constructor = applyParams(

View File

@ -74,6 +74,7 @@ export {NgZoneError} from './ng_zone_impl';
* }
* }
* ```
* @experimental
*/
export class NgZone {
static isInAngularZone(): boolean { return NgZoneImpl.isInAngularZone(); }

View File

@ -1,5 +1,6 @@
/**
* Stores error information; delivered via [NgZone.onError] stream.
* @deprecated
*/
export class NgZoneError {
constructor(public error: any, public stackTrace: any) {}

View File

@ -102,6 +102,7 @@ export class ObservableWrapper {
* https://github.com/jhusain/observable-spec
*
* Once a reference implementation of the spec is available, switch to it.
* @stable
*/
export class EventEmitter<T> extends Subject<T> {
// TODO: mark this as internal once all the facades are gone

View File

@ -30,6 +30,7 @@ class _ArrayLogger {
* bootstrap(MyApp, [provide(ExceptionHandler, {useClass: MyExceptionHandler})])
*
* ```
* @stable
*/
export class ExceptionHandler {
constructor(private _logger: any, private _rethrowException: boolean = true) {}

View File

@ -3,6 +3,9 @@ import {ExceptionHandler} from './exception_handler';
export {ExceptionHandler} from './exception_handler';
/**
* @stable
*/
export class BaseException extends Error {
public stack: any;
constructor(public message: string = "--") {
@ -15,6 +18,7 @@ export class BaseException extends Error {
/**
* Wraps an exception and provides additional context or information.
* @stable
*/
export class WrappedException extends BaseWrappedException {
private _wrapperStack: any;

View File

@ -1,470 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var globalScope;
if (typeof window === 'undefined') {
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
// TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
globalScope = self;
}
else {
globalScope = global;
}
}
else {
globalScope = window;
}
function scheduleMicroTask(fn) {
Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
}
exports.scheduleMicroTask = scheduleMicroTask;
exports.IS_DART = false;
// Need to declare a new variable for global here since TypeScript
// exports the original value of the symbol.
var _global = globalScope;
exports.global = _global;
exports.Type = Function;
function getTypeNameForDebugging(type) {
if (type['name']) {
return type['name'];
}
return typeof type;
}
exports.getTypeNameForDebugging = getTypeNameForDebugging;
exports.Math = _global.Math;
exports.Date = _global.Date;
var _devMode = true;
var _modeLocked = false;
function lockMode() {
_modeLocked = true;
}
exports.lockMode = lockMode;
/**
* Disable Angular's development mode, which turns off assertions and other
* checks within the framework.
*
* 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).
*/
function enableProdMode() {
if (_modeLocked) {
// Cannot use BaseException as that ends up importing from facade/lang.
throw 'Cannot enable prod mode after platform setup.';
}
_devMode = false;
}
exports.enableProdMode = enableProdMode;
function assertionsEnabled() {
return _devMode;
}
exports.assertionsEnabled = assertionsEnabled;
// TODO: remove calls to assert in production environment
// Note: Can't just export this and import in in other files
// as `assert` is a reserved keyword in Dart
_global.assert = function assert(condition) {
// TODO: to be fixed properly via #2830, noop for now
};
function isPresent(obj) {
return obj !== undefined && obj !== null;
}
exports.isPresent = isPresent;
function isBlank(obj) {
return obj === undefined || obj === null;
}
exports.isBlank = isBlank;
function isBoolean(obj) {
return typeof obj === "boolean";
}
exports.isBoolean = isBoolean;
function isNumber(obj) {
return typeof obj === "number";
}
exports.isNumber = isNumber;
function isString(obj) {
return typeof obj === "string";
}
exports.isString = isString;
function isFunction(obj) {
return typeof obj === "function";
}
exports.isFunction = isFunction;
function isType(obj) {
return isFunction(obj);
}
exports.isType = isType;
function isStringMap(obj) {
return typeof obj === 'object' && obj !== null;
}
exports.isStringMap = isStringMap;
function isPromise(obj) {
return obj instanceof _global.Promise;
}
exports.isPromise = isPromise;
function isArray(obj) {
return Array.isArray(obj);
}
exports.isArray = isArray;
function isDate(obj) {
return obj instanceof exports.Date && !isNaN(obj.valueOf());
}
exports.isDate = isDate;
function noop() { }
exports.noop = noop;
function stringify(token) {
if (typeof token === 'string') {
return token;
}
if (token === undefined || token === null) {
return '' + token;
}
if (token.name) {
return token.name;
}
if (token.overriddenName) {
return token.overriddenName;
}
var res = token.toString();
var newLineIndex = res.indexOf("\n");
return (newLineIndex === -1) ? res : res.substring(0, newLineIndex);
}
exports.stringify = stringify;
// serialize / deserialize enum exist only for consistency with dart API
// enums in typescript don't need to be serialized
function serializeEnum(val) {
return val;
}
exports.serializeEnum = serializeEnum;
function deserializeEnum(val, values) {
return val;
}
exports.deserializeEnum = deserializeEnum;
function resolveEnumToken(enumValue, val) {
return enumValue[val];
}
exports.resolveEnumToken = resolveEnumToken;
var StringWrapper = (function () {
function StringWrapper() {
}
StringWrapper.fromCharCode = function (code) { return String.fromCharCode(code); };
StringWrapper.charCodeAt = function (s, index) { return s.charCodeAt(index); };
StringWrapper.split = function (s, regExp) { return s.split(regExp); };
StringWrapper.equals = function (s, s2) { return s === s2; };
StringWrapper.stripLeft = function (s, charVal) {
if (s && s.length) {
var pos = 0;
for (var i = 0; i < s.length; i++) {
if (s[i] != charVal)
break;
pos++;
}
s = s.substring(pos);
}
return s;
};
StringWrapper.stripRight = function (s, charVal) {
if (s && s.length) {
var pos = s.length;
for (var i = s.length - 1; i >= 0; i--) {
if (s[i] != charVal)
break;
pos--;
}
s = s.substring(0, pos);
}
return s;
};
StringWrapper.replace = function (s, from, replace) {
return s.replace(from, replace);
};
StringWrapper.replaceAll = function (s, from, replace) {
return s.replace(from, replace);
};
StringWrapper.slice = function (s, from, to) {
if (from === void 0) { from = 0; }
if (to === void 0) { to = null; }
return s.slice(from, to === null ? undefined : to);
};
StringWrapper.replaceAllMapped = function (s, from, cb) {
return s.replace(from, function () {
var matches = [];
for (var _i = 0; _i < arguments.length; _i++) {
matches[_i - 0] = arguments[_i];
}
// Remove offset & string from the result array
matches.splice(-2, 2);
// The callback receives match, p1, ..., pn
return cb(matches);
});
};
StringWrapper.contains = function (s, substr) { return s.indexOf(substr) != -1; };
StringWrapper.compare = function (a, b) {
if (a < b) {
return -1;
}
else if (a > b) {
return 1;
}
else {
return 0;
}
};
return StringWrapper;
}());
exports.StringWrapper = StringWrapper;
var StringJoiner = (function () {
function StringJoiner(parts) {
if (parts === void 0) { parts = []; }
this.parts = parts;
}
StringJoiner.prototype.add = function (part) { this.parts.push(part); };
StringJoiner.prototype.toString = function () { return this.parts.join(""); };
return StringJoiner;
}());
exports.StringJoiner = StringJoiner;
var NumberParseError = (function (_super) {
__extends(NumberParseError, _super);
function NumberParseError(message) {
_super.call(this);
this.message = message;
}
NumberParseError.prototype.toString = function () { return this.message; };
return NumberParseError;
}(Error));
exports.NumberParseError = NumberParseError;
var NumberWrapper = (function () {
function NumberWrapper() {
}
NumberWrapper.toFixed = function (n, fractionDigits) { return n.toFixed(fractionDigits); };
NumberWrapper.equal = function (a, b) { return a === b; };
NumberWrapper.parseIntAutoRadix = function (text) {
var result = parseInt(text);
if (isNaN(result)) {
throw new NumberParseError("Invalid integer literal when parsing " + text);
}
return result;
};
NumberWrapper.parseInt = function (text, radix) {
if (radix == 10) {
if (/^(\-|\+)?[0-9]+$/.test(text)) {
return parseInt(text, radix);
}
}
else if (radix == 16) {
if (/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(text)) {
return parseInt(text, radix);
}
}
else {
var result = parseInt(text, radix);
if (!isNaN(result)) {
return result;
}
}
throw new NumberParseError("Invalid integer literal when parsing " + text + " in base " +
radix);
};
// TODO: NaN is a valid literal but is returned by parseFloat to indicate an error.
NumberWrapper.parseFloat = function (text) { return parseFloat(text); };
Object.defineProperty(NumberWrapper, "NaN", {
get: function () { return NaN; },
enumerable: true,
configurable: true
});
NumberWrapper.isNaN = function (value) { return isNaN(value); };
NumberWrapper.isInteger = function (value) { return Number.isInteger(value); };
return NumberWrapper;
}());
exports.NumberWrapper = NumberWrapper;
exports.RegExp = _global.RegExp;
var RegExpWrapper = (function () {
function RegExpWrapper() {
}
RegExpWrapper.create = function (regExpStr, flags) {
if (flags === void 0) { flags = ''; }
flags = flags.replace(/g/g, '');
return new _global.RegExp(regExpStr, flags + 'g');
};
RegExpWrapper.firstMatch = function (regExp, input) {
// Reset multimatch regex state
regExp.lastIndex = 0;
return regExp.exec(input);
};
RegExpWrapper.test = function (regExp, input) {
regExp.lastIndex = 0;
return regExp.test(input);
};
RegExpWrapper.matcher = function (regExp, input) {
// Reset regex state for the case
// someone did not loop over all matches
// last time.
regExp.lastIndex = 0;
return { re: regExp, input: input };
};
RegExpWrapper.replaceAll = function (regExp, input, replace) {
var c = regExp.exec(input);
var res = '';
regExp.lastIndex = 0;
var prev = 0;
while (c) {
res += input.substring(prev, c.index);
res += replace(c);
prev = c.index + c[0].length;
regExp.lastIndex = prev;
c = regExp.exec(input);
}
res += input.substring(prev);
return res;
};
return RegExpWrapper;
}());
exports.RegExpWrapper = RegExpWrapper;
var RegExpMatcherWrapper = (function () {
function RegExpMatcherWrapper() {
}
RegExpMatcherWrapper.next = function (matcher) {
return matcher.re.exec(matcher.input);
};
return RegExpMatcherWrapper;
}());
exports.RegExpMatcherWrapper = RegExpMatcherWrapper;
var FunctionWrapper = (function () {
function FunctionWrapper() {
}
FunctionWrapper.apply = function (fn, posArgs) { return fn.apply(null, posArgs); };
return FunctionWrapper;
}());
exports.FunctionWrapper = FunctionWrapper;
// JS has NaN !== NaN
function looseIdentical(a, b) {
return a === b || typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b);
}
exports.looseIdentical = looseIdentical;
// JS considers NaN is the same as NaN for map Key (while NaN !== NaN otherwise)
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
function getMapKey(value) {
return value;
}
exports.getMapKey = getMapKey;
function normalizeBlank(obj) {
return isBlank(obj) ? null : obj;
}
exports.normalizeBlank = normalizeBlank;
function normalizeBool(obj) {
return isBlank(obj) ? false : obj;
}
exports.normalizeBool = normalizeBool;
function isJsObject(o) {
return o !== null && (typeof o === "function" || typeof o === "object");
}
exports.isJsObject = isJsObject;
function print(obj) {
console.log(obj);
}
exports.print = print;
// Can't be all uppercase as our transpiler would think it is a special directive...
var Json = (function () {
function Json() {
}
Json.parse = function (s) { return _global.JSON.parse(s); };
Json.stringify = function (data) {
// Dart doesn't take 3 arguments
return _global.JSON.stringify(data, null, 2);
};
return Json;
}());
exports.Json = Json;
var DateWrapper = (function () {
function DateWrapper() {
}
DateWrapper.create = function (year, month, day, hour, minutes, seconds, milliseconds) {
if (month === void 0) { month = 1; }
if (day === void 0) { day = 1; }
if (hour === void 0) { hour = 0; }
if (minutes === void 0) { minutes = 0; }
if (seconds === void 0) { seconds = 0; }
if (milliseconds === void 0) { milliseconds = 0; }
return new exports.Date(year, month - 1, day, hour, minutes, seconds, milliseconds);
};
DateWrapper.fromISOString = function (str) { return new exports.Date(str); };
DateWrapper.fromMillis = function (ms) { return new exports.Date(ms); };
DateWrapper.toMillis = function (date) { return date.getTime(); };
DateWrapper.now = function () { return new exports.Date(); };
DateWrapper.toJson = function (date) { return date.toJSON(); };
return DateWrapper;
}());
exports.DateWrapper = DateWrapper;
function setValueOnPath(global, path, value) {
var parts = path.split('.');
var obj = global;
while (parts.length > 1) {
var name = parts.shift();
if (obj.hasOwnProperty(name) && isPresent(obj[name])) {
obj = obj[name];
}
else {
obj = obj[name] = {};
}
}
if (obj === undefined || obj === null) {
obj = {};
}
obj[parts.shift()] = value;
}
exports.setValueOnPath = setValueOnPath;
var _symbolIterator = null;
function getSymbolIterator() {
if (isBlank(_symbolIterator)) {
if (isPresent(Symbol) && isPresent(Symbol.iterator)) {
_symbolIterator = Symbol.iterator;
}
else {
// es6-shim specific logic
var keys = Object.getOwnPropertyNames(Map.prototype);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (key !== 'entries' && key !== 'size' &&
Map.prototype[key] === Map.prototype['entries']) {
_symbolIterator = key;
}
}
}
}
return _symbolIterator;
}
exports.getSymbolIterator = getSymbolIterator;
function evalExpression(sourceUrl, expr, declarations, vars) {
var fnBody = declarations + "\nreturn " + expr + "\n//# sourceURL=" + sourceUrl;
var fnArgNames = [];
var fnArgValues = [];
for (var argName in vars) {
fnArgNames.push(argName);
fnArgValues.push(vars[argName]);
}
return new (Function.bind.apply(Function, [void 0].concat(fnArgNames.concat(fnBody))))().apply(void 0, fnArgValues);
}
exports.evalExpression = evalExpression;
function isPrimitive(obj) {
return !isJsObject(obj);
}
exports.isPrimitive = isPrimitive;
function hasConstructor(value, type) {
return value.constructor === type;
}
exports.hasConstructor = hasConstructor;
function bitWiseOr(values) {
return values.reduce(function (a, b) { return a | b; });
}
exports.bitWiseOr = bitWiseOr;
function bitWiseAnd(values) {
return values.reduce(function (a, b) { return a & b; });
}
exports.bitWiseAnd = bitWiseAnd;
function escape(s) {
return _global.encodeURI(s);
}
exports.escape = escape;
//# sourceMappingURL=lang.js.map

View File

@ -91,6 +91,7 @@ export function lockMode() {
* 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).
* @stable
*/
export function enableProdMode() {
if (_modeLocked) {

View File

@ -165,6 +165,7 @@ var COMPILER_TESTING: string[] = [
'TestComponentRenderer'
];
// API Classification audited
var CORE: string[] = [
'__core_private__',
'BaseException',
@ -176,7 +177,6 @@ var CORE: string[] = [
'wtfStartTimeRange',
'APP_INITIALIZER',
'APP_ID',
'AngularEntrypoint:dart',
'AbstractProviderError',
'AUTO_STYLE',
'AnimationAnimateMetadata',
@ -210,7 +210,7 @@ var CORE: string[] = [
"CollectionChangeRecord",
'ChangeDetectionStrategy',
'ChangeDetectorRef',
'Class:js',
'Class',
'ComponentResolver',
'SystemJsComponentResolver',
'Component',
@ -224,8 +224,6 @@ var CORE: string[] = [
'PLATFORM_PIPES',
'DebugNode',
'DebugElement',
'ReflectiveDependency',
'DependencyMetadata',
'Directive',
'DirectiveMetadata',
'DynamicComponentLoader',
@ -275,8 +273,6 @@ var CORE: string[] = [
'Renderer',
'RootRenderer',
'RenderComponentType',
'ResolvedReflectiveBinding:dart',
'ResolvedReflectiveProvider:dart',
'ResolvedReflectiveFactory',
'Self',
'SelfMetadata',
@ -286,20 +282,9 @@ var CORE: string[] = [
'TemplateRef',
'Testability',
'TestabilityRegistry',
'GetTestability:dart',
'setTestabilityGetter',
'Type',
'PACKAGE_ROOT_URL',
'View:dart',
/*
'View.directives:dart',
'View.encapsulation:dart',
'View.pipes:dart',
'View.styleUrls:dart',
'View.styles:dart',
'View.template:dart',
'View.templateUrl:dart',
*/
'ViewChild',
'ViewChildMetadata',
'ViewChildren',
@ -315,14 +300,14 @@ var CORE: string[] = [
'bind',
'provide',
'createNgZone',
'forwardRef:js',
'forwardRef',
'coreBootstrap',
'coreLoadAndBootstrap',
'createPlatform',
'disposePlatform',
'getPlatform',
'assertPlatform',
'resolveForwardRef:js',
'resolveForwardRef',
'PLATFORM_COMMON_PROVIDERS',
'PLATFORM_INITIALIZER',
'AfterContentChecked',
@ -330,25 +315,10 @@ var CORE: string[] = [
'AfterViewChecked',
'AfterViewInit',
'DoCheck',
'IterableDifferFactory:dart',
'IterableDiffer:dart',
'KeyValueDifferFactory:dart',
'KeyValueDiffer:dart',
'OnChanges',
'OnDestroy',
'OnInit',
'PipeTransform:dart',
'reflector',
'Stream:dart',
'GetterFn:dart',
'MethodFn:dart',
'NoReflectionCapabilities:dart',
'PlatformReflectionCapabilities:dart',
'ReflectionInfo',
'Reflector',
'SetterFn:dart',
'ViewRef',
'TrackByFn:dart'
];
var CORE_TESTING: string[] = [

View File

@ -12,6 +12,7 @@ export var SecurityContext: typeof t.SecurityContext = r.SecurityContext;
export type SecurityContext = t.SecurityContext;
export var SanitizationService: typeof t.SanitizationService = r.SanitizationService;
export type SanitizationService = t.SanitizationService;
export var reflector: typeof t.reflector = r.reflector;
export type NoOpAnimationPlayer = t.NoOpAnimationPlayer;
export var NoOpAnimationPlayer: typeof t.NoOpAnimationPlayer = r.NoOpAnimationPlayer;

View File

@ -1,3 +1,4 @@
import {__core_private__} from '@angular/core';
import {__core_private__ as _} from '@angular/core';
export var makeDecorator: typeof __core_private__.makeDecorator = __core_private__.makeDecorator;
export var makeDecorator: typeof _.makeDecorator = _.makeDecorator;
export var reflector: typeof _.reflector = _.reflector;

View File

@ -1,6 +1,6 @@
import {Type} from '@angular/core';
import {RouteLifecycleHook, CanActivate} from './lifecycle_annotations_impl';
import {reflector} from '@angular/core';
import {reflector} from '../../core_private';
export function hasLifecycleHook(e: RouteLifecycleHook, type): boolean {
if (!(type instanceof Type)) return false;

View File

@ -13,7 +13,7 @@ import {
getTypeNameForDebugging,
} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';
import {Injectable, Inject, OpaqueToken, reflector} from '@angular/core';
import {Injectable, Inject, OpaqueToken} from '@angular/core';
import {RouteConfig, Route, AuxRoute, RouteDefinition} from './route_config/route_config_impl';
import {PathMatch, RedirectMatch, RouteMatch} from './rules/rules';
import {RuleSet} from './rules/rule_set';
@ -27,6 +27,7 @@ import {
import {normalizeRouteConfig, assertComponentExists} from './route_config/route_config_normalizer';
import {parser, Url, convertUrlParamsToArray} from './url_parser';
import {GeneratedUrl} from './rules/route_paths/route_path';
import {reflector} from '../core_private';
var _resolveToNull = PromiseWrapper.resolve<Instruction>(null);

View File

@ -1,3 +1,4 @@
import {__core_private__} from '@angular/core';
import {__core_private__ as _} from '@angular/core';
export var makeDecorator: typeof __core_private__.makeDecorator = __core_private__.makeDecorator;
export var makeDecorator: typeof _.makeDecorator = _.makeDecorator;
export var reflector: typeof _.reflector = _.reflector;

View File

@ -1,21 +1,6 @@
import {
ResolvedReflectiveProvider,
Directive,
DynamicComponentLoader,
ViewContainerRef,
Attribute,
ComponentRef,
ComponentFactory,
ReflectiveInjector,
OnInit,
HostListener,
HostBinding,
Input,
OnDestroy,
Optional
} from '@angular/core';
import {RouterOutletMap, Router} from '../router';
import {RouteSegment, UrlSegment, Tree} from '../segments';
import {Directive, HostListener, HostBinding, Input, OnDestroy} from '@angular/core';
import {Router} from '../router';
import {RouteSegment} from '../segments';
import {isString, isArray, isPresent} from '../facade/lang';
import {ObservableWrapper} from '../facade/async';

View File

@ -1,13 +1,11 @@
import {
ResolvedReflectiveProvider,
Directive,
DynamicComponentLoader,
ViewContainerRef,
Attribute,
ComponentRef,
ComponentFactory,
ReflectiveInjector,
OnInit
ReflectiveInjector
} from '@angular/core';
import {RouterOutletMap} from '../router';
import {DEFAULT_OUTLET_NAME} from '../constants';

View File

@ -15,7 +15,7 @@ import {PromiseWrapper} from './facade/promise';
import {BaseException, ComponentFactory} from '@angular/core';
import {ComponentResolver} from '@angular/core';
import {DEFAULT_OUTLET_NAME} from './constants';
import {reflector} from '@angular/core';
import {reflector} from './core_private';
export function recognize(componentResolver: ComponentResolver, rootComponent: Type, url: UrlTree,
existingTree: RouteTree): Promise<RouteTree> {