fix: public api surface fixes + stability markers

- ts-api-guardian will now error if a new public symbol is added with a stability marker (`@stable`, `@experimental`, `@deprecated`)
- DomEventsPlugin and KeyEventsPlugin were removed from public api surface - these classes is an implementation detail
- deprecated BROWSER_PROVIDERS was removed completely
- `@angular/compiler` was removed from the ts-api-guardian check since this package shouldn't contain anything that users need to directly import
- the rest of the api surface was conservatively marked as stable or experimental

BREAKING CHANGES: DomEventsPlugin and KeyEventsPlugin previously exported from core are no longer public - these classes are implementation detail.

Previously deprecated BROWSER_PROVIDERS was completely removed from platform-browser.

Closes #9236
Closes #9235
Ref #9234
This commit is contained in:
Igor Minar
2016-06-27 12:27:23 -07:00
parent fcfddbf79c
commit 24eb8389d2
102 changed files with 685 additions and 103 deletions

View File

@ -30,6 +30,8 @@ import {NG_VALIDATORS, Validators} from '../validators';
* }
* }
* ```
*
* @experimental
*/
export interface Validator { validate(c: AbstractControl): {[key: string]: any}; }

View File

@ -53,8 +53,11 @@ export abstract class PlatformLocation {
/**
* A serializable version of the event from onPopState or onHashChange
*
* @stable
* @experimental
*/
export interface UrlChangeEvent { type: string; }
/**
* @experimental
*/
export interface UrlChangeListener { (e: UrlChangeEvent): any; }

View File

@ -15,6 +15,8 @@ import {LocationStrategy} from '../src/location/location_strategy';
/**
* A spy for {@link Location} that allows tests to fire simulated location events.
*
* @experimental
*/
@Injectable()
export class SpyLocation implements Location {

View File

@ -9,7 +9,7 @@
/**
* @module
* @description
* Starting point to import all public core APIs.
* Entry point from which you should import all public core APIs.
*/
export * from './src/metadata';
export * from './src/util';

View File

@ -75,10 +75,10 @@ export declare namespace __core_private_types__ {
export var ValueUnwrapper: typeof change_detection_util.ValueUnwrapper;
export type RenderDebugInfo = api.RenderDebugInfo;
export var RenderDebugInfo: typeof api.RenderDebugInfo;
export var SecurityContext: typeof security.SecurityContext;
export type SecurityContext = security.SecurityContext;
export var SanitizationService: typeof security.SanitizationService;
export var SecurityContext: typeof security.SecurityContext;
export type SanitizationService = security.SanitizationService;
export var SanitizationService: typeof security.SanitizationService;
export type TemplateRef_<C> = template_ref.TemplateRef_<C>;
export var TemplateRef_: typeof template_ref.TemplateRef_;
export var wtfInit: typeof wtf_init.wtfInit;

View File

@ -9,6 +9,10 @@
import {BaseException} from '../facade/exceptions';
import {scheduleMicroTask} from '../facade/lang';
/**
* @experimental Animation support is experimental.
*/
export abstract class AnimationPlayer {
abstract onDone(fn: Function): void;
abstract play(): void;

View File

@ -7,25 +7,35 @@
*/
import {BaseException} from '../facade/exceptions';
import {NumberWrapper, isArray, isPresent, isString, isStringMap} from '../facade/lang';
import {NumberWrapper, isArray, isPresent, isString} from '../facade/lang';
/**
* @experimental Animation support is experimental.
*/
export const AUTO_STYLE = '*';
/**
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the {@link trigger trigger
* animation function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationEntryMetadata {
constructor(public name: string, public definitions: AnimationStateMetadata[]) {}
}
/**
* @experimental Animation support is experimental.
*/
export abstract class AnimationStateMetadata {}
/**
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the {@link state state animation
* function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationStateDeclarationMetadata extends AnimationStateMetadata {
constructor(public stateNameExpr: string, public styles: AnimationStyleMetadata) { super(); }
@ -35,17 +45,24 @@ export class AnimationStateDeclarationMetadata extends AnimationStateMetadata {
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the
* {@link transition transition animation function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationStateTransitionMetadata extends AnimationStateMetadata {
constructor(public stateChangeExpr: string, public steps: AnimationMetadata) { super(); }
}
/**
* @experimental Animation support is experimental.
*/
export abstract class AnimationMetadata {}
/**
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the {@link keyframes keyframes
* animation function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationKeyframesSequenceMetadata extends AnimationMetadata {
constructor(public steps: AnimationStyleMetadata[]) { super(); }
@ -55,6 +72,8 @@ export class AnimationKeyframesSequenceMetadata extends AnimationMetadata {
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the {@link style style animation
* function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationStyleMetadata extends AnimationMetadata {
constructor(
@ -67,6 +86,8 @@ export class AnimationStyleMetadata extends AnimationMetadata {
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the {@link animate animate
* animation function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationAnimateMetadata extends AnimationMetadata {
constructor(
@ -76,6 +97,9 @@ export class AnimationAnimateMetadata extends AnimationMetadata {
}
}
/**
* @experimental Animation support is experimental.
*/
export abstract class AnimationWithStepsMetadata extends AnimationMetadata {
constructor() { super(); }
get steps(): AnimationMetadata[] { throw new BaseException('NOT IMPLEMENTED: Base Class'); }
@ -85,6 +109,8 @@ export abstract class AnimationWithStepsMetadata extends AnimationMetadata {
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the {@link sequence sequence
* animation function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationSequenceMetadata extends AnimationWithStepsMetadata {
constructor(private _steps: AnimationMetadata[]) { super(); }
@ -95,6 +121,8 @@ export class AnimationSequenceMetadata extends AnimationWithStepsMetadata {
* Metadata representing the entry of animations.
* Instances of this class are provided via the animation DSL when the {@link group group animation
* function} is called.
*
* @experimental Animation support is experimental.
*/
export class AnimationGroupMetadata extends AnimationWithStepsMetadata {
constructor(private _steps: AnimationMetadata[]) { super(); }
@ -150,6 +178,8 @@ export class AnimationGroupMetadata extends AnimationWithStepsMetadata {
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function animate(
timing: string | number, styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata =
@ -197,6 +227,8 @@ export function animate(
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function group(steps: AnimationMetadata[]): AnimationGroupMetadata {
return new AnimationGroupMetadata(steps);
@ -238,6 +270,8 @@ export function group(steps: AnimationMetadata[]): AnimationGroupMetadata {
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata {
return new AnimationSequenceMetadata(steps);
@ -287,6 +321,8 @@ export function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function style(
tokens: string | {[key: string]: string | number} |
@ -362,6 +398,8 @@ export function style(
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function state(
stateNameExpr: string, styles: AnimationStyleMetadata): AnimationStateDeclarationMetadata {
@ -414,6 +452,8 @@ export function state(
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata {
return new AnimationKeyframesSequenceMetadata(steps);
@ -504,6 +544,8 @@ export function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSe
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function transition(stateChangeExpr: string, steps: AnimationMetadata | AnimationMetadata[]):
AnimationStateTransitionMetadata {
@ -565,6 +607,8 @@ export function transition(stateChangeExpr: string, steps: AnimationMetadata | A
* ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
*
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* @experimental Animation support is experimental.
*/
export function trigger(name: string, animation: AnimationMetadata[]): AnimationEntryMetadata {
return new AnimationEntryMetadata(name, animation);

View File

@ -41,7 +41,8 @@ var _inPlatformCreate: boolean = false;
* 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
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function enableProdMode(): void {
if (_runModeLocked) {
@ -56,6 +57,8 @@ export function enableProdMode(): void {
* This can only be read after `lockRunMode` has been called.
*
* By default, this is true, unless a user calls `enableProdMode`.
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function isDevMode(): boolean {
if (!_runModeLocked) {
@ -68,6 +71,8 @@ export function isDevMode(): boolean {
* Locks the run mode of Angular. After this has been called,
* it can't be changed any more. I.e. `isDevMode()` will always
* return the same value.
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function lockRunMode(): void {
_runModeLocked = true;
@ -76,7 +81,8 @@ export function lockRunMode(): void {
/**
* Creates a platform.
* Platforms have to be eagerly created via this function.
* @experimental
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function createPlatform(injector: Injector): PlatformRef {
if (_inPlatformCreate) {
@ -99,7 +105,8 @@ export function createPlatform(injector: Injector): PlatformRef {
/**
* Checks that there currently is a platform
* which contains the given token as a provider.
* @experimental
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function assertPlatform(requiredToken: any): PlatformRef {
var platform = getPlatform();
@ -115,7 +122,8 @@ export function assertPlatform(requiredToken: any): PlatformRef {
/**
* Dispose the existing platform.
* @experimental
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function disposePlatform(): void {
if (isPresent(_platform) && !_platform.disposed) {
@ -125,7 +133,8 @@ export function disposePlatform(): void {
/**
* Returns the current platform.
* @experimental
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function getPlatform(): PlatformRef {
return isPresent(_platform) && !_platform.disposed ? _platform : null;
@ -134,7 +143,8 @@ export function getPlatform(): PlatformRef {
/**
* Shortcut for ApplicationRef.bootstrap.
* Requires a platform to be created first.
* @experimental
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function coreBootstrap<C>(
componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C> {
@ -146,7 +156,8 @@ export function coreBootstrap<C>(
* Resolves the componentFactory for the given component,
* waits for asynchronous initializers and bootstraps the component.
* Requires a platform to be created first.
* @experimental
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function coreLoadAndBootstrap(
componentType: Type, injector: Injector): Promise<ComponentRef<any>> {
@ -166,7 +177,8 @@ export function coreLoadAndBootstrap(
*
* A page's platform is initialized implicitly when {@link bootstrap}() is called, or
* explicitly by calling {@link createPlatform}().
* @stable
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export abstract class PlatformRef {
/**
@ -228,7 +240,8 @@ 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
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export abstract class ApplicationRef {
/**

View File

@ -25,14 +25,18 @@ export interface IterableDiffer {
}
/**
* An optional function passed into {@link NgFor} that defines how to track
* items in an iterable (e.g. by index or id)
* An optional function passed into {@link NgFor} that defines how to track
* items in an iterable (e.g. by index or id)
*
* @stable
*/
export interface TrackByFn { (index: number, item: any): any; }
/**
* Provides a factory for {@link IterableDiffer}.
*
* @stable
*/
export interface IterableDifferFactory {
supports(objects: any): boolean;

View File

@ -15,6 +15,8 @@ import {ChangeDetectorRef} from '../change_detector_ref';
/**
* A differ that tracks changes made to an object over time.
*
* @stable
*/
export interface KeyValueDiffer {
diff(object: any): any /** TODO #9100 */;
@ -23,6 +25,8 @@ export interface KeyValueDiffer {
/**
* Provides a factory for {@link KeyValueDiffer}.
*
* @stable
*/
export interface KeyValueDifferFactory {
supports(objects: any): boolean;

View File

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

View File

@ -14,7 +14,7 @@ import {RenderDebugInfo} from '../render/api';
export class EventListener { constructor(public name: string, public callback: Function){}; }
/**
* @experimental
* @experimental All debugging apis are currently experimental.
*/
export class DebugNode {
nativeNode: any;
@ -58,7 +58,7 @@ export class DebugNode {
}
/**
* @experimental
* @experimental All debugging apis are currently experimental.
*/
export class DebugElement extends DebugNode {
name: string;

View File

@ -15,6 +15,7 @@ import {Type, isFunction, stringify} from '../facade/lang';
* ### Example
*
* {@example core/di/ts/forward_ref/forward_ref.ts region='forward_ref_fn'}
* @experimental
*/
export interface ForwardRefFn { (): any; }

View File

@ -355,6 +355,8 @@ export class ReflectiveInjectorDynamicStrategy implements ReflectiveInjectorStra
*
* Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
* resolve all of the object's dependencies automatically.
*
* @stable
*/
export abstract class ReflectiveInjector implements Injector {
/**

View File

@ -47,6 +47,8 @@ const _EMPTY_LIST: any[] /** TODO #9100 */ = /*@ts2dart_const*/[];
*
* expect(injector.get('message')).toEqual('Hello');
* ```
*
* @experimental
*/
export interface ResolvedReflectiveProvider {
/**

View File

@ -86,6 +86,10 @@ export class ComponentRef_<C> extends ComponentRef<C> {
* @ts2dart_const
*/
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
/**
* @stable
*/
export class ComponentFactory<C> {
constructor(
public selector: string, private _viewFactory: Function, private _componentType: Type) {}

View File

@ -12,6 +12,10 @@ import {ClassWithConstructor, stringify} from '../facade/lang';
import {ComponentFactory} from './component_factory';
/**
* @stable
*/
export class NoComponentFactoryError extends BaseException {
constructor(public component: Function) {
super(`No component factory found for ${stringify(component)}`);
@ -24,6 +28,9 @@ class _NullComponentFactoryResolver implements ComponentFactoryResolver {
}
}
/**
* @stable
*/
export abstract class ComponentFactoryResolver {
static NULL: ComponentFactoryResolver = new _NullComponentFactoryResolver();
abstract resolveComponentFactory<T>(component: ClassWithConstructor<T>): ComponentFactory<T>;

View File

@ -11,6 +11,8 @@
*
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
* element.
*
* @stable
*/
// 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

@ -30,6 +30,8 @@ import {Type} from '../src/facade/lang';
* Interface for the {@link DirectiveMetadata} decorator function.
*
* See {@link DirectiveFactory}.
*
* @stable
*/
export interface DirectiveDecorator extends TypeDecorator {}
@ -37,6 +39,8 @@ export interface DirectiveDecorator extends TypeDecorator {}
* Interface for the {@link ComponentMetadata} decorator function.
*
* See {@link ComponentFactory}.
*
* @stable
*/
export interface ComponentDecorator extends TypeDecorator {
/**
@ -59,6 +63,8 @@ export interface ComponentDecorator extends TypeDecorator {
* Interface for the {@link ViewMetadata} decorator function.
*
* See {@link ViewFactory}.
*
* @experimental
*/
export interface ViewDecorator extends TypeDecorator {
/**
@ -107,6 +113,8 @@ export interface ViewDecorator extends TypeDecorator {
* new ng.Directive({...})
* ]
* ```
*
* @stable
*/
export interface DirectiveMetadataFactory {
(obj: {
@ -163,6 +171,8 @@ export interface DirectiveMetadataFactory {
* new ng.Component({...})
* ]
* ```
*
* @stable
*/
export interface ComponentMetadataFactory {
(obj: {
@ -256,6 +266,8 @@ export interface ComponentMetadataFactory {
* new ng.View({...})
* ]
* ```
*
* @experimental You should most likely use ComponentMetadataFactory instead
*/
export interface ViewMetadataFactory {
(obj: {
@ -315,6 +327,8 @@ export interface ViewMetadataFactory {
* [new ng.Attribute('title')]
* ]
* ```
*
* @stable
*/
export interface AttributeMetadataFactory {
(name: string): TypeDecorator;

View File

@ -72,6 +72,8 @@ export var VIEW_ENCAPSULATION_VALUES =
* }
* ```
* @ts2dart_const
*
* @experimental You should most likely be using ComponentMetadata instead.
*/
export class ViewMetadata {
/**

View File

@ -10,6 +10,8 @@ import {global} from '../facade/lang';
/**
* A scope function for the Web Tracing Framework (WTF).
*
* @experimental
*/
export interface WtfScopeFn { (arg0?: any, arg1?: any): any; }

View File

@ -12,6 +12,8 @@
* handled.
*
* See DomSanitizationService for more details on security in Angular applications.
*
* @stable
*/
export enum SecurityContext {
NONE,
@ -25,6 +27,8 @@ export enum SecurityContext {
/**
* SanitizationService is used by the views to sanitize potentially dangerous values. This is a
* private API, use code should only refer to DomSanitizationService.
*
* @stable
*/
export abstract class SanitizationService {
abstract sanitize(context: SecurityContext, value: string): string;

View File

@ -138,6 +138,9 @@ export class TestabilityRegistry {
/**
* Adapter interface for retrieving the `Testability` service associated for a
* particular context.
*
* @experimental Testability apis are primarily intended to be used by e2e test tool vendors like
* the Protractor team.
*/
export interface GetTestability {
addToWindow(registry: TestabilityRegistry): void;

View File

@ -12,6 +12,8 @@ var _nextClassId = 0;
/**
* Declares the interface to be used with {@link Class}.
*
* @stable
*/
export interface ClassDefinition {
/**
@ -58,6 +60,7 @@ export interface ClassDefinition {
* @ng.View({...})
* class MyClass {...}
* ```
* @stable
*/
export interface TypeDecorator {
/**

View File

@ -15,8 +15,8 @@ import {CompilerConfig} from '@angular/compiler';
import {Component, ViewMetadata} from '@angular/core/src/metadata';
import {IS_DART} from '../../src/facade/lang';
import {el} from '@angular/platform-browser/testing/browser_util';
import {DomSanitizationService} from '@angular/platform-browser/src/security/dom_sanitization_service';
import {DomSanitizationService} from '@angular/platform-browser';
const ANCHOR_ELEMENT = /*@ts2dart_const*/ new OpaqueToken('AnchorElement');

View File

@ -24,6 +24,8 @@ var _global = <any>(typeof window === 'undefined' ? global : window);
* })
* });
* ```
*
* @stable
*/
export function async(fn: Function): (done: any) => any {
// If we're running using the Jasmine test framework, adapt to call the 'done'

View File

@ -16,6 +16,8 @@ import {tick} from './fake_async';
/**
* Fixture for debugging and testing a component.
*
* @stable
*/
export class ComponentFixture<T> {
/**

View File

@ -25,6 +25,8 @@ let _FakeAsyncTestZoneSpecType = (Zone as any /** TODO #9100 */)['FakeAsyncTestZ
*
* @param fn
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
*
* @experimental
*/
export function fakeAsync(fn: Function): (...args: any[]) => any {
if (Zone.current.get('FakeAsyncTestZoneSpec') != null) {
@ -73,6 +75,7 @@ function _getFakeAsyncZoneSpec(): any {
*
* {@example testing/ts/fake_async.ts region='basic'}
*
* @experimental
*/
export function tick(millis: number = 0): void {
_getFakeAsyncZoneSpec().tick(millis);
@ -80,6 +83,8 @@ export function tick(millis: number = 0): void {
/**
* Discard all remaining periodic tasks.
*
* @experimental
*/
export function discardPeriodicTasks(): void {
let zoneSpec = _getFakeAsyncZoneSpec();
@ -89,6 +94,8 @@ export function discardPeriodicTasks(): void {
/**
* Flush any pending microtasks.
*
* @experimental
*/
export function flushMicrotasks(): void {
_getFakeAsyncZoneSpec().flushMicrotasks();

View File

@ -16,18 +16,28 @@ import {tick} from './fake_async';
/**
* An abstract class for inserting the root test component element in a platform independent way.
*
* @experimental
*/
export class TestComponentRenderer {
insertRootElement(rootElementId: string) {}
}
/**
* @experimental
*/
export var ComponentFixtureAutoDetect = new OpaqueToken('ComponentFixtureAutoDetect');
/**
* @experimental
*/
export var ComponentFixtureNoNgZone = new OpaqueToken('ComponentFixtureNoNgZone');
var _nextRootElementId = 0;
/**
* Builds a ComponentFixture for use in component level tests.
* @stable
*/
@Injectable()
export class TestComponentBuilder {

View File

@ -13,6 +13,9 @@ import {BaseException} from '../src/facade/exceptions';
import {FunctionWrapper, isPresent} from '../src/facade/lang';
import {AsyncTestCompleter} from './async_test_completer';
/**
* @experimental
*/
export class TestInjector {
private _instantiated: boolean = false;
@ -64,6 +67,9 @@ export class TestInjector {
var _testInjector: TestInjector = null;
/**
* @experimental
*/
export function getTestInjector() {
if (_testInjector == null) {
_testInjector = new TestInjector();
@ -81,6 +87,8 @@ export function getTestInjector() {
*
* Test Providers for individual platforms are available from
* 'angular2/platform/testing/<platform_name>'.
*
* @experimental
*/
export function setBaseTestProviders(
platformProviders: Array<Type|Provider|any[]>,
@ -101,6 +109,8 @@ export function setBaseTestProviders(
/**
* Reset the providers for the test injector.
*
* @experimental
*/
export function resetBaseTestProviders() {
var testInjector = getTestInjector();
@ -131,6 +141,7 @@ export function resetBaseTestProviders() {
* eventually
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
*
* @stable
*/
export function inject(tokens: any[], fn: Function): () => any {
let testInjector = getTestInjector();
@ -148,6 +159,9 @@ export function inject(tokens: any[], fn: Function): () => any {
}
}
/**
* @experimental
*/
export class InjectSetupWrapper {
constructor(private _providers: () => any) {}
@ -166,6 +180,9 @@ export class InjectSetupWrapper {
}
}
/**
* @experimental
*/
export function withProviders(providers: () => any) {
return new InjectSetupWrapper(providers);
}

View File

@ -117,6 +117,8 @@ if (_global.beforeEach) {
/**
* Allows overriding default providers of the test injector,
* which are defined in test_injector.js
*
* @stable
*/
export function addProviders(providers: Array<any>): void {
if (!providers) return;

View File

@ -7,7 +7,6 @@
*/
import {Component} from '@angular/core';
import {ELEMENT_PROBE_PROVIDERS} from '@angular/platform-browser';
import {bootstrap} from '@angular/platform-browser-dynamic';
@Component({selector: 'my-component'})
@ -15,5 +14,5 @@ class MyAppComponent {
}
// #docregion providers
bootstrap(MyAppComponent, [ELEMENT_PROBE_PROVIDERS]);
bootstrap(MyAppComponent);
// #enddocregion

View File

@ -59,6 +59,9 @@ var _global: BrowserNodeGlobal = globalScope;
export {_global as global};
/**
* @stable
*/
export var Type = Function;
/**
@ -66,6 +69,8 @@ export var Type = Function;
*
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
* the `MyCustomComponent` constructor function.
*
* @stable
*/
export interface Type extends Function {}

View File

@ -73,7 +73,10 @@ export const FORM_DIRECTIVES: Type[] = /*@ts2dart_const*/[
RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator
];
/**
* @experimental
*/
export const REACTIVE_FORM_DIRECTIVES: Type[] =
/*@ts2dart_const*/[
FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName
];
];

View File

@ -30,6 +30,8 @@ import {NG_VALIDATORS, Validators} from '../validators';
* }
* }
* ```
*
* @experimental
*/
export interface Validator { validate(c: AbstractControl): {[key: string]: any}; }
@ -60,7 +62,14 @@ export const REQUIRED_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/
export class RequiredValidator {
}
/**
* @experimental
*/
export interface ValidatorFn { (c: AbstractControl): {[key: string]: any}; }
/**
* @experimental
*/
export interface AsyncValidatorFn {
(c: AbstractControl): any /*Promise<{[key: string]: any}>|Observable<{[key: string]: any}>*/;
}

View File

@ -18,7 +18,7 @@ import {FormBuilder as NewFormBuilder} from './form_builder';
/*
/**
* Shorthand set of providers used for building Angular forms.
*
* ### Example
@ -43,6 +43,10 @@ function flatten(platformDirectives: any[]): any[] {
return flattenedDirectives;
}
/**
* @experimental
*/
export function disableDeprecatedForms(): any[] {
return [{
provide: CompilerConfig,
@ -55,6 +59,9 @@ export function disableDeprecatedForms(): any[] {
}];
}
/**
* @experimental
*/
export function provideForms(): any[] {
return [
{provide: PLATFORM_DIRECTIVES, useValue: NEW_FORM_DIRECTIVES, multi: true}, FORM_PROVIDERS

View File

@ -179,6 +179,8 @@ export {URLSearchParams} from './src/url_search_params';
* useValue: new CookieXSRFStrategy('MY-XSRF-COOKIE-NAME', 'X-MY-XSRF-HEADER-NAME')}])
* .catch(err => console.error(err));
* ```
*
* @experimental
*/
export const HTTP_PROVIDERS: any[] = [
// TODO(pascal): use factory type annotations once supported in DI
@ -191,6 +193,10 @@ export const HTTP_PROVIDERS: any[] = [
{provide: XSRFStrategy, useValue: new CookieXSRFStrategy()},
];
/**
* @experimental
*/
export function httpFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions): Http {
return new Http(xhrBackend, requestOptions);
}
@ -308,6 +314,8 @@ export const HTTP_BINDINGS = HTTP_PROVIDERS;
* }
* });
* ```
*
* @experimental
*/
export const JSONP_PROVIDERS: any[] = [
// TODO(pascal): use factory type annotations once supported in DI

View File

@ -12,6 +12,8 @@ import {Injectable} from '@angular/core';
* A backend for http that uses the `XMLHttpRequest` browser API.
*
* Take care not to evaluate this in non-browser contexts.
*
* @experimental
*/
@Injectable()
export class BrowserXhr {

View File

@ -25,6 +25,8 @@ const JSONP_ERR_WRONG_METHOD = 'JSONP requests must use GET request method.';
/**
* Abstract base class for an in-flight JSONP request.
*
* @experimental
*/
export abstract class JSONPConnection implements Connection {
/**
@ -143,6 +145,8 @@ export class JSONPConnection_ extends JSONPConnection {
/**
* A {@link ConnectionBackend} that uses the JSONP strategy of making requests.
*
* @experimental
*/
export abstract class JSONPBackend extends ConnectionBackend {}

View File

@ -31,6 +31,8 @@ const XSSI_PREFIX = /^\)\]\}',?\n/;
*
* This class would typically not be created or interacted with directly inside applications, though
* the {@link MockConnection} may be interacted with in tests.
*
* @experimental
*/
export class XHRConnection implements Connection {
request: Request;
@ -156,6 +158,8 @@ export class XHRConnection implements Connection {
* Applications can configure custom cookie and header names by binding an instance of this class
* with different `cookieName` and `headerName` values. See the main HTTP documentation for more
* details.
*
* @experimental
*/
export class CookieXSRFStrategy implements XSRFStrategy {
constructor(
@ -193,7 +197,8 @@ export class CookieXSRFStrategy implements XSRFStrategy {
* }
* }
* ```
**/
* @experimental
*/
@Injectable()
export class XHRBackend implements ConnectionBackend {
constructor(

View File

@ -40,6 +40,8 @@ import {URLSearchParams} from './url_search_params';
* console.log('req.method:', RequestMethod[req.method]); // Post
* console.log('options.url:', options.url); // https://google.com
* ```
*
* @experimental
*/
export class RequestOptions {
/**
@ -164,6 +166,8 @@ export class RequestOptions {
* console.log('options.url:', options.url); // null
* console.log('req.url:', req.url); // https://google.com
* ```
*
* @experimental
*/
@Injectable()
export class BaseRequestOptions extends RequestOptions {

View File

@ -40,6 +40,8 @@ import {ResponseOptionsArgs} from './interfaces';
*
* console.log('res.json():', res.json()); // Object {name: "Jeff"}
* ```
*
* @experimental
*/
export class ResponseOptions {
// TODO: ArrayBuffer | FormData | Blob
@ -155,6 +157,8 @@ export class ResponseOptions {
* console.log('res.headers.get("framework"):', res.headers.get('framework')); // angular
* console.log('res.text():', res.text()); // Angular;
* ```
*
* @experimental
*/
@Injectable()
export class BaseResponseOptions extends ResponseOptions {

View File

@ -8,6 +8,7 @@
/**
* Supported http methods.
* @experimental
*/
export enum RequestMethod {
Get,
@ -23,6 +24,7 @@ export enum RequestMethod {
* All possible states in which a connection can be, based on
* [States](http://www.w3.org/TR/XMLHttpRequest/#states) from the `XMLHttpRequest` spec, but with an
* additional "CANCELLED" state.
* @experimental
*/
export enum ReadyState {
Unsent,
@ -36,6 +38,7 @@ export enum ReadyState {
/**
* Acceptable response types to be associated with a {@link Response}, based on
* [ResponseType](https://fetch.spec.whatwg.org/#responsetype) from the Fetch spec.
* @experimental
*/
export enum ResponseType {
Basic,
@ -47,6 +50,7 @@ export enum ResponseType {
/**
* Supported content type to be automatically associated with a {@link Request}.
* @experimental
*/
export enum ContentType {
NONE,

View File

@ -36,6 +36,8 @@ import {isListLikeIterable, iterateListLike, Map, MapWrapper, StringMapWrapper,
* var thirdHeaders = new Headers(secondHeaders);
* console.log(thirdHeaders.get('X-My-Custom-Header')); //'Angular'
* ```
*
* @experimental
*/
export class Headers {
/** @internal */

View File

@ -103,7 +103,8 @@ function mergeOptions(
* http.get('request-from-mock-backend.json').subscribe((res:Response) => doSomething(res));
* ```
*
**/
* @experimental
*/
@Injectable()
export class Http {
constructor(protected _backend: ConnectionBackend, protected _defaultOptions: RequestOptions) {}
@ -186,6 +187,10 @@ export class Http {
}
}
/**
* @experimental
*/
@Injectable()
export class Jsonp extends Http {
constructor(backend: ConnectionBackend, defaultOptions: RequestOptions) {

View File

@ -16,11 +16,15 @@ import {URLSearchParams} from './url_search_params';
*
* The primary purpose of a `ConnectionBackend` is to create new connections to fulfill a given
* {@link Request}.
*
* @experimental
*/
export abstract class ConnectionBackend { abstract createConnection(request: any): Connection; }
/**
* Abstract class from which real connections are derived.
*
* @experimental
*/
export abstract class Connection {
readyState: ReadyState;
@ -28,12 +32,18 @@ export abstract class Connection {
response: any; // TODO: generic of <Response>;
}
/** An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request. */
/**
* An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request.
*
* @experimental
*/
export abstract class XSRFStrategy { abstract configureRequest(req: Request): void; }
/**
* Interface for options to construct a RequestOptions, based on
* [RequestInit](https://fetch.spec.whatwg.org/#requestinit) from the Fetch spec.
*
* @experimental
*/
export interface RequestOptionsArgs {
url?: string;
@ -52,6 +62,8 @@ export interface RequestArgs extends RequestOptionsArgs { url: string; }
/**
* Interface for options to construct a Response, based on
* [ResponseInit](https://fetch.spec.whatwg.org/#responseinit) from the Fetch spec.
*
* @experimental
*/
export type ResponseOptionsArgs = {
// TODO: Support Blob, ArrayBuffer, JSON

View File

@ -52,6 +52,8 @@ import {URLSearchParams} from './url_search_params';
* console.log('people', res.json());
* });
* ```
*
* @experimental
*/
export class Request {
/**

View File

@ -32,6 +32,8 @@ import {isJsObject} from './http_utils';
* Spec](https://fetch.spec.whatwg.org/#response-class), but is considered a static value whose body
* can be accessed many times. There are other differences in the implementation, but this is the
* most significant.
*
* @experimental
*/
export class Response {
/**

View File

@ -32,6 +32,8 @@ function paramParser(rawParams: string = ''): Map<string, string[]> {
* - setAll()
* - appendAll()
* - replaceAll()
*
* @experimental
*/
export class URLSearchParams {
paramsMap: Map<string, string[]>;

View File

@ -23,7 +23,8 @@ import {Response} from '../src/static_response';
*
* Mock Connection to represent a {@link Connection} for tests.
*
**/
* @experimental
*/
export class MockConnection implements Connection {
// TODO Name `readyState` should change to be more generic, and states could be made to be more
// descriptive than XHR states.
@ -141,7 +142,9 @@ export class MockConnection implements Connection {
* ```
*
* This method only exists in the mock implementation, not in real Backends.
**/
*
* @experimental
*/
@Injectable()
export class MockBackend implements ConnectionBackend {
/**

View File

@ -18,6 +18,9 @@ import {CachedXHR} from './src/xhr/xhr_cache';
import {XHRImpl} from './src/xhr/xhr_impl';
/**
* @experimental
*/
export const BROWSER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
COMPILER_PROVIDERS, {
provide: CompilerConfig,
@ -32,6 +35,9 @@ export const BROWSER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]
];
/**
* @experimental
*/
export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
[{provide: XHR, useClass: CachedXHR}];
@ -104,6 +110,9 @@ export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
* app injector to override default injection behavior.
*
* Returns a `Promise` of {@link ComponentRef}.
*
* @experimental This api cannot be used with the offline compiler and thus is still subject to
* change.
*/
export function bootstrap(
appComponentType: Type,

View File

@ -18,12 +18,16 @@ export * from './private_export_testing'
/**
* Default platform providers for testing.
*
* @stable
*/
export const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
[TEST_BROWSER_PLATFORM_PROVIDERS];
/**
* Default application providers for testing.
*
* @stable
*/
export const TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
TEST_BROWSER_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS,

View File

@ -16,6 +16,10 @@ export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES =
r.VIEW_ENCAPSULATION_VALUES;
export type DebugDomRootRenderer = t.DebugDomRootRenderer;
export var DebugDomRootRenderer: typeof t.DebugDomRootRenderer = r.DebugDomRootRenderer;
/**
* @experimental bogus marker to pass the ts-api-guardian's check - this api should be public so
* this line will go away when that happens
*/
export var SecurityContext: typeof t.SecurityContext = r.SecurityContext;
export type SecurityContext = t.SecurityContext;
export var SanitizationService: typeof t.SanitizationService = r.SanitizationService;

View File

@ -10,12 +10,9 @@ export {BrowserPlatformLocation} from './src/browser/location/browser_platform_l
export {Title} from './src/browser/title';
export {disableDebugTools, enableDebugTools} from './src/browser/tools/tools';
export {By} from './src/dom/debug/by';
export {ELEMENT_PROBE_PROVIDERS} from './src/dom/debug/ng_probe';
export {DOCUMENT} from './src/dom/dom_tokens';
export {DomEventsPlugin} from './src/dom/events/dom_events';
export {EVENT_MANAGER_PLUGINS, EventManager} from './src/dom/events/event_manager';
export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './src/dom/events/hammer_gestures';
export {KeyEventsPlugin} from './src/dom/events/key_events';
export {DomSanitizationService, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl, SecurityContext} from './src/security/dom_sanitization_service';
export * from './src/browser';
@ -32,8 +29,3 @@ export * from './src/worker_render';
export * from './src/worker_app';
export * from './private_export';
import {BROWSER_PLATFORM_PROVIDERS} from './src/browser';
/* @deprecated use BROWSER_PLATFORM_PROVIDERS */
export const BROWSER_PROVIDERS: any[] = BROWSER_PLATFORM_PROVIDERS;

View File

@ -6,8 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import * as ng_proble from './src/dom/debug/ng_probe';
import * as dom_adapter from './src/dom/dom_adapter';
import * as dom_renderer from './src/dom/dom_renderer';
import * as dom_events from './src/dom/events/dom_events';
import * as shared_styles_host from './src/dom/shared_styles_host';
export declare namespace __platform_browser_private_types__ {
@ -23,6 +25,9 @@ export declare namespace __platform_browser_private_types__ {
export var DomSharedStylesHost: typeof shared_styles_host.DomSharedStylesHost;
export type SharedStylesHost = shared_styles_host.SharedStylesHost;
export var SharedStylesHost: typeof shared_styles_host.SharedStylesHost;
export var ELEMENT_PROBE_PROVIDERS: typeof ng_proble.ELEMENT_PROBE_PROVIDERS;
export type DomEventsPlugin = dom_events.DomEventsPlugin;
export var DomEventsPlugin: typeof dom_events.DomEventsPlugin;
}
export var __platform_browser_private__ = {
@ -32,5 +37,7 @@ export var __platform_browser_private__ = {
DomRootRenderer: dom_renderer.DomRootRenderer,
DomRootRenderer_: dom_renderer.DomRootRenderer_,
DomSharedStylesHost: shared_styles_host.DomSharedStylesHost,
SharedStylesHost: shared_styles_host.SharedStylesHost
SharedStylesHost: shared_styles_host.SharedStylesHost,
ELEMENT_PROBE_PROVIDERS: ng_proble.ELEMENT_PROBE_PROVIDERS,
DomEventsPlugin: dom_events.DomEventsPlugin
};

View File

@ -34,6 +34,8 @@ const BROWSER_PLATFORM_MARKER = new OpaqueToken('BrowserPlatformMarker');
* A set of providers to initialize the Angular platform in a web browser.
*
* Used automatically by `bootstrap`, or can be passed to {@link platform}.
*
* @experimental API related to bootstrapping are still under review.
*/
export const BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
{provide: BROWSER_PLATFORM_MARKER, useValue: true}, PLATFORM_COMMON_PROVIDERS,
@ -41,6 +43,9 @@ export const BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/>
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
];
/**
* @experimental
*/
export const BROWSER_SANITIZATION_PROVIDERS: Array<any> = [
{provide: SanitizationService, useExisting: DomSanitizationService},
{provide: DomSanitizationService, useClass: DomSanitizationServiceImpl},
@ -50,6 +55,8 @@ export const BROWSER_SANITIZATION_PROVIDERS: Array<any> = [
* A set of providers to initialize an Angular application in a web browser.
*
* Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}.
*
* @experimental API related to bootstrapping are still under review.
*/
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
APPLICATION_COMMON_PROVIDERS, FORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS,
@ -66,6 +73,9 @@ export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
Testability, EventManager, ELEMENT_PROBE_PROVIDERS
];
/**
* @experimental API related to bootstrapping are still under review.
*/
export function browserPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PLATFORM_PROVIDERS));

View File

@ -20,6 +20,8 @@ import {supportsState} from './history';
* `PlatformLocation` encapsulates all of the direct calls to platform APIs.
* This class should not be used directly by an application developer. Instead, use
* {@link Location}.
*
* @stable
*/
@Injectable()
export class BrowserPlatformLocation extends PlatformLocation {

View File

@ -15,6 +15,8 @@ import 'common_tools.dart' show AngularTools;
* 1. Type `ng.` (usually the console will show auto-complete suggestion)
* 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
* then hit Enter.
*
* @experimental All debugging apis are currently experimental.
*/
void enableDebugTools(ComponentRef<dynamic> ref) {
final tools = new AngularTools(ref);
@ -29,6 +31,8 @@ void enableDebugTools(ComponentRef<dynamic> ref) {
/**
* Disables Angular 2 tools.
*
* @experimental All debugging apis are currently experimental.
*/
void disableDebugTools() {
context.deleteProperty('ng');

View File

@ -23,6 +23,8 @@ var context = <any>global;
* 1. Type `ng.` (usually the console will show auto-complete suggestion)
* 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
* then hit Enter.
*
* @experimental All debugging apis are currently experimental.
*/
export function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T> {
context.ng = new AngularTools(ref);
@ -31,6 +33,8 @@ export function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T> {
/**
* Disables Angular 2 tools.
*
* @experimental All debugging apis are currently experimental.
*/
export function disableDebugTools(): void {
delete context.ng;

View File

@ -16,6 +16,8 @@ import {Type, isPresent} from '../../facade/lang';
/**
* Predicates for use with {@link DebugElement}'s query functions.
*
* @experimental All debugging apis are currently experimental.
*/
export class By {
/**

View File

@ -13,5 +13,7 @@ import {OpaqueToken} from '@angular/core';
*
* Note: Document might not be available in the Application Context when Application and Rendering
* Contexts are not the same (e.g. when running the application into a Web Worker).
*
* @stable
*/
export const DOCUMENT: OpaqueToken = new OpaqueToken('DocumentToken');

View File

@ -12,8 +12,14 @@ import {ListWrapper} from '../../facade/collection';
import {BaseException} from '../../facade/exceptions';
/**
* @stable
*/
export const EVENT_MANAGER_PLUGINS: OpaqueToken = new OpaqueToken('EventManagerPlugins');
/**
* @stable
*/
@Injectable()
export class EventManager {
private _plugins: EventManagerPlugin[];

View File

@ -13,6 +13,12 @@ import {isPresent} from '../../facade/lang';
import {HammerGesturesPluginCommon} from './hammer_common';
/**
* A DI token that you can use to provide{@link HammerGestureConfig} to Angular. Use it to configure
* Hammer gestures.
*
* @experimental
*/
export const HAMMER_GESTURE_CONFIG: OpaqueToken = new OpaqueToken('HammerGestureConfig');
export interface HammerInstance {
@ -20,6 +26,9 @@ export interface HammerInstance {
off(eventName: string, callback: Function): void;
}
/**
* @experimental
*/
@Injectable()
export class HammerGestureConfig {
events: string[] = [];

View File

@ -23,6 +23,10 @@ var modifierKeyGetters: {[key: string]: (event: KeyboardEvent) => boolean} = {
'shift': (event: KeyboardEvent) => event.shiftKey
};
/**
* @experimental
*/
@Injectable()
export class KeyEventsPlugin extends EventManagerPlugin {
constructor() { super(); }

View File

@ -19,17 +19,44 @@ export {SecurityContext};
/**
* Marker interface for a value that's safe to use in a particular context.
*
* @stable
*/
export interface SafeValue {}
/** Marker interface for a value that's safe to use as HTML. */
/**
* Marker interface for a value that's safe to use as HTML.
*
* @stable
*/
export interface SafeHtml extends SafeValue {}
/** Marker interface for a value that's safe to use as style (CSS). */
/**
* Marker interface for a value that's safe to use as style (CSS).
*
* @stable
*/
export interface SafeStyle extends SafeValue {}
/** Marker interface for a value that's safe to use as JavaScript. */
/**
* Marker interface for a value that's safe to use as JavaScript.
*
* @stable
*/
export interface SafeScript extends SafeValue {}
/** Marker interface for a value that's safe to use as a URL linking to a document. */
/**
* Marker interface for a value that's safe to use as a URL linking to a document.
*
* @stable
*/
export interface SafeUrl extends SafeValue {}
/** Marker interface for a value that's safe to use as a URL to load executable code from. */
/**
* Marker interface for a value that's safe to use as a URL to load executable code from.
*
* @stable
*/
export interface SafeResourceUrl extends SafeValue {}
/**
@ -55,6 +82,8 @@ export interface SafeResourceUrl extends SafeValue {}
* It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
* does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
* code. The sanitizer leaves safe values intact.
*
* @stable
*/
export abstract class DomSanitizationService implements SanitizationService {
/**

View File

@ -16,7 +16,7 @@ import {MessageBus} from './message_bus';
import {Serializer} from './serializer';
/**
* @experimental
* @experimental WebWorker support in Angular is experimental.
*/
export abstract class ClientMessageBrokerFactory {
/**
@ -44,7 +44,7 @@ export class ClientMessageBrokerFactory_ extends ClientMessageBrokerFactory {
}
/**
* @experimental
* @experimental WebWorker support in Angular is experimental.
*/
export abstract class ClientMessageBroker {
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
@ -163,14 +163,14 @@ class MessageData {
}
/**
* @experimental
* @experimental WebWorker support in Angular is experimental.
*/
export class FnArg {
constructor(public value: any /** TODO #9100 */, public type: Type) {}
}
/**
* @experimental
* @experimental WebWorker support in Angular is experimental.
*/
export class UiArguments {
constructor(public method: string, public args?: FnArg[]) {}

View File

@ -16,7 +16,8 @@ import {EventEmitter} from '../../facade/async';
* Communication is based on a channel abstraction. Messages published in a
* given channel to one MessageBusSink are received on the same channel
* by the corresponding MessageBusSource.
* @experimental
*
* @experimental WebWorker support in Angular is currenlty experimental.
*/
export abstract class MessageBus implements MessageBusSource, MessageBusSink {
/**
@ -51,7 +52,7 @@ export abstract class MessageBus implements MessageBusSource, MessageBusSink {
}
/**
* @experimental
* @experimental WebWorker support in Angular is currenlty experimental.
*/
export interface MessageBusSource {
/**
@ -77,7 +78,7 @@ export interface MessageBusSource {
}
/**
* @experimental
* @experimental WebWorker support in Angular is currenlty experimental.
*/
export interface MessageBusSink {
/**

View File

@ -20,7 +20,7 @@ import {LocationType} from './serialized_types';
// PRIMITIVE is any type that does not need to be serialized (string, number, boolean)
// We set it to String so that it is considered a Type.
/**
* @experimental
* @experimental WebWorker support in Angular is currently experimental.
*/
export const PRIMITIVE: Type = String;

View File

@ -14,6 +14,9 @@ import {FunctionWrapper, Type, isPresent} from '../../facade/lang';
import {MessageBus} from '../shared/message_bus';
import {Serializer} from '../shared/serializer';
/**
* @experimental WebWorker support in Angular is currently experimental.
*/
export abstract class ServiceMessageBrokerFactory {
/**
* Initializes the given channel and attaches a new {@link ServiceMessageBroker} to it.
@ -38,19 +41,18 @@ export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
}
/**
* @experimental
* Helper class for UIComponents that allows components to register methods.
* If a registered method message is received from the broker on the worker,
* the UIMessageBroker deserializes its arguments and calls the registered method.
* If that method returns a promise, the UIMessageBroker returns the result to the worker.
*
* @experimental WebWorker support in Angular is currently experimental.
*/
export abstract class ServiceMessageBroker {
abstract registerMethod(
methodName: string, signature: Type[], method: Function, returnType?: Type): void;
}
/**
* Helper class for UIComponents that allows components to register methods.
* If a registered method message is received from the broker on the worker,
* the UIMessageBroker deserializes its arguments and calls the registered method.
* If that method returns a promise, the UIMessageBroker returns the result to the worker.
*/
export class ServiceMessageBroker_ extends ServiceMessageBroker {
private _sink: EventEmitter<any>;
private _methods: Map<string, Function> = new Map<string, Function>();
@ -100,7 +102,7 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
}
/**
* @experimental
* @experimental WebWorker support in Angular is currently experimental.
*/
export class ReceivedMessage {
method: string;

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {APPLICATION_COMMON_PROVIDERS, APP_INITIALIZER, ApplicationRef, ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, getPlatform} from '@angular/core';
import {APPLICATION_COMMON_PROVIDERS, APP_INITIALIZER, ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, getPlatform} from '@angular/core';
import {AnimationDriver, NoOpAnimationDriver, wtfInit} from '../core_private';
@ -37,7 +37,8 @@ const WORKER_RENDER_PLATFORM_MARKER = new OpaqueToken('WorkerRenderPlatformMarke
/**
* Wrapper class that exposes the Worker
* and underlying {@link MessageBus} for lower level message passing.
* @experimental
*
* @experimental WebWorker support is currently experimental.
*/
@Injectable()
export class WebWorkerInstance {
@ -52,7 +53,7 @@ export class WebWorkerInstance {
}
/**
* @experimental
* @experimental WebWorker support is currently experimental.
*/
export const WORKER_SCRIPT: OpaqueToken = new OpaqueToken('WebWorkerScript');
@ -61,13 +62,13 @@ export const WORKER_SCRIPT: OpaqueToken = new OpaqueToken('WebWorkerScript');
* created.
*
* TODO(vicb): create an interface for startable services to implement
* @experimental
* @experimental WebWorker support is currently experimental.
*/
export const WORKER_UI_STARTABLE_MESSAGING_SERVICE =
new OpaqueToken('WorkerRenderStartableMsgService');
/**
* @experimental
* @experimental WebWorker support is currently experimental.
*/
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
PLATFORM_COMMON_PROVIDERS, {provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true},
@ -75,7 +76,7 @@ export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/
];
/**
* @experimental
* @experimental WebWorker support is currently experimental.
*/
export const WORKER_UI_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
APPLICATION_COMMON_PROVIDERS,
@ -128,7 +129,7 @@ function initWebWorkerRenderPlatform(): void {
}
/**
* @experimental
* @experimental WebWorker support is currently experimental.
*/
export function workerUiPlatform(): PlatformRef {
if (isBlank(getPlatform())) {

View File

@ -44,12 +44,16 @@ function createNgZone(): NgZone {
/**
* Default platform providers for testing.
*
* @stable
*/
export const TEST_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
TEST_BROWSER_STATIC_PLATFORM_PROVIDERS;
/**
* Default application providers for testing without a compiler.
*
* @stable
*/
export const TEST_BROWSER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
[BROWSER_APP_PROVIDERS, ADDITIONAL_TEST_BROWSER_STATIC_PROVIDERS];

View File

@ -12,6 +12,9 @@ import * as webdriver from 'selenium-webdriver';
declare var browser: any;
declare var expect: any;
/**
* @experimental This API will be moved to Protractor.
*/
export function verifyNoBrowserErrors() {
// TODO(tbosch): Bug in ChromeDriver: Need to execute at least one command
// so that the browser logs can be read out!

View File

@ -20,3 +20,7 @@ export type DomSharedStylesHost = typeof t.DomSharedStylesHost;
export var DomSharedStylesHost: typeof t.DomSharedStylesHost = r.DomSharedStylesHost;
export type SharedStylesHost = typeof t.SharedStylesHost;
export var SharedStylesHost: typeof t.SharedStylesHost = r.SharedStylesHost;
export type ELEMENT_PROBE_PROVIDERS = typeof t.ELEMENT_PROBE_PROVIDERS;
export var ELEMENT_PROBE_PROVIDERS: typeof t.ELEMENT_PROBE_PROVIDERS = r.ELEMENT_PROBE_PROVIDERS;
export type DomEventsPlugin = typeof t.DomEventsPlugin;
export var DomEventsPlugin: typeof t.DomEventsPlugin = r.DomEventsPlugin;

View File

@ -10,21 +10,21 @@ import {COMPILER_PROVIDERS, DirectiveResolver, ViewResolver, XHR} from '@angular
import {MockDirectiveResolver, MockViewResolver, OverridingTestComponentBuilder} from '@angular/compiler/testing';
import {APPLICATION_COMMON_PROVIDERS, APP_ID, NgZone, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, RootRenderer} from '@angular/core';
import {TestComponentBuilder, TestComponentRenderer} from '@angular/core/testing';
import {BROWSER_SANITIZATION_PROVIDERS, DOCUMENT, EVENT_MANAGER_PLUGINS, EventManager} from '@angular/platform-browser';
import {AnimationDriver, NoOpAnimationDriver} from '../core_private';
import {DOMTestComponentRenderer} from '../platform_browser_dynamic_testing_private';
import {DomEventsPlugin, DomRootRenderer, DomRootRenderer_, DomSharedStylesHost, ELEMENT_PROBE_PROVIDERS, SharedStylesHost, getDOM} from '../platform_browser_private';
import {Parse5DomAdapter} from '../src/parse5_adapter';
import {DOCUMENT, BROWSER_SANITIZATION_PROVIDERS, EventManager, EVENT_MANAGER_PLUGINS, ELEMENT_PROBE_PROVIDERS, DomEventsPlugin,} from '@angular/platform-browser';
import {getDOM, DomRootRenderer, DomRootRenderer_, DomSharedStylesHost, SharedStylesHost} from '../platform_browser_private';
import {LocationStrategy} from '@angular/common';
function initServerTests() {
Parse5DomAdapter.makeCurrent();
}
/**
* Default platform providers for testing.
*
* @experimental
*/
export const TEST_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[
@ -52,6 +52,8 @@ function createNgZone(): NgZone {
/**
* Default application providers for testing.
*
* @experimental
*/
export const TEST_SERVER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[

View File

@ -20,4 +20,8 @@ export {ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot
export {PRIMARY_OUTLET, Params} from './src/shared';
export {DefaultUrlSerializer, UrlPathWithParams, UrlSerializer, UrlTree} from './src/url_tree';
export const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive];
/**
* @experimental
*/
export const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive];

View File

@ -18,6 +18,9 @@ import {DefaultUrlSerializer, UrlSerializer} from './url_tree';
export const ROUTER_CONFIG = new OpaqueToken('ROUTER_CONFIG');
export const ROUTER_OPTIONS = new OpaqueToken('ROUTER_OPTIONS');
/**
* @experimental
*/
export interface ExtraOptions { enableTracing?: boolean; }
export function setupRouter(
@ -76,6 +79,8 @@ export function setupRouterInitializer(injector: Injector) {
*
* bootstrap(AppCmp, [provideRouter(router)]);
* ```
*
* @experimental
*/
export function provideRouter(_config: RouterConfig, _opts: ExtraOptions): any[] {
return [

View File

@ -8,14 +8,29 @@
import {Type} from '@angular/core';
/**
* @experimental
*/
export type RouterConfig = Route[];
/**
* @experimental
*/
export type Data = {
[name: string]: any
};
/**
* @experimental
*/
export type ResolveData = {
[name: string]: any
};
/**
* @experimental
*/
export interface Route {
path?: string;
@ -65,4 +80,4 @@ function validateNode(route: Route): void {
throw new Error(
`Invalid route configuration of route '{path: "${route.path}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
}
}
}

View File

@ -11,6 +11,8 @@ import {ActivatedRouteSnapshot, RouterStateSnapshot} from './router_state';
/**
* An interface a class can implement to be a guard deciding if a route can be activated.
*
* @experimental
*/
export interface CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
@ -19,12 +21,17 @@ export interface CanActivate {
/**
* An interface a class can implement to be a guard deciding if a route can be deactivated.
*
* @experimental
*/
export interface CanDeactivate<T> {
canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
Observable<boolean>|boolean;
}
/**
* @experimental
*/
export interface Resolve<T> {
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any>|any;
}
}

View File

@ -43,6 +43,8 @@ export interface NavigationExtras {
/**
* An event triggered when a navigation starts
*
* @experimental
*/
export class NavigationStart {
constructor(public id: number, public url: string) {}
@ -52,6 +54,8 @@ export class NavigationStart {
/**
* An event triggered when a navigation ends successfully
*
* @experimental
*/
export class NavigationEnd {
constructor(public id: number, public url: string, public urlAfterRedirects: string) {}
@ -63,6 +67,8 @@ export class NavigationEnd {
/**
* An event triggered when a navigation is canceled
*
* @experimental
*/
export class NavigationCancel {
constructor(public id: number, public url: string) {}
@ -72,6 +78,8 @@ export class NavigationCancel {
/**
* An event triggered when a navigation fails due to unexpected error
*
* @experimental
*/
export class NavigationError {
constructor(public id: number, public url: string, public error: any) {}
@ -83,6 +91,8 @@ export class NavigationError {
/**
* An event triggered when routes are recognized
*
* @experimental
*/
export class RoutesRecognized {
constructor(
@ -94,10 +104,15 @@ export class RoutesRecognized {
}
}
/**
* @experimental
*/
export type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError;
/**
* The `Router` is responsible for mapping URLs to components.
*
* @experimental
*/
export class Router {
private currentUrlTree: UrlTree;
@ -350,9 +365,16 @@ export class Router {
}
}
/**
* @experimental
*/
class CanActivate {
constructor(public route: ActivatedRouteSnapshot) {}
}
/**
* @experimental
*/
class CanDeactivate {
constructor(public component: Object, public route: ActivatedRouteSnapshot) {}
}

View File

@ -8,6 +8,9 @@
import {RouterOutlet} from './directives/router_outlet';
/**
* @experimental
*/
export class RouterOutletMap {
/** @internal */
_outlets: {[name: string]: RouterOutlet} = {};

View File

@ -30,6 +30,8 @@ import {RouterConfig} from './config';
*
* bootstrap(AppCmp, [provideRouter(router)]);
* ```
*
* @experimental
*/
export function provideRouter(config: RouterConfig, opts: ExtraOptions = {}): any[] {
return [

View File

@ -31,6 +31,8 @@ import {Tree, TreeNode} from './utils/tree';
* }
* }
* ```
*
* @experimental
*/
export class RouterState extends Tree<ActivatedRoute> {
/**
@ -85,6 +87,8 @@ function createEmptyStateSnapshot(urlTree: UrlTree, rootComponent: Type): Router
* }
* }
* ```
*
* @experimental
*/
export class ActivatedRoute {
/** @internal */
@ -137,6 +141,8 @@ export class InheritedResolve {
* }
* }
* ```
*
* @experimental
*/
export class ActivatedRouteSnapshot {
/**
@ -188,6 +194,8 @@ export class ActivatedRouteSnapshot {
* }
* }
* ```
*
* @experimental
*/
export class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> {
/**
@ -227,4 +235,4 @@ export function advanceActivatedRoute(route: ActivatedRoute): void {
route.snapshot = route._futureSnapshot;
(<any>route.data).next(route._futureSnapshot.data);
}
}
}

View File

@ -9,11 +9,15 @@
/**
* Name of the primary outlet.
* @type {string}
*
* @experimental
*/
export const PRIMARY_OUTLET = 'PRIMARY_OUTLET';
/**
* A collection of parameters.
*
* @experimental
*/
export type Params = {
[key: string]: any

View File

@ -62,6 +62,8 @@ function containsSegmentHelper(
/**
* A URL in the tree form.
*
* @experimental
*/
export class UrlTree {
/**
@ -96,6 +98,10 @@ export class UrlSegment {
toString(): string { return serializePaths(this); }
}
/**
* @experimental
*/
export class UrlPathWithParams {
constructor(public path: string, public parameters: {[key: string]: string}) {}
toString(): string { return serializePath(this); }
@ -153,6 +159,8 @@ export function mapChildrenIntoArray<T>(
/**
* Defines a way to serialize/deserialize a url tree.
*
* @experimental
*/
export abstract class UrlSerializer {
/**
@ -168,6 +176,8 @@ export abstract class UrlSerializer {
/**
* A default implementation of the serialization.
*
* @experimental
*/
export class DefaultUrlSerializer implements UrlSerializer {
parse(url: string): UrlTree {
@ -427,4 +437,4 @@ class UrlParser {
return segments;
}
}
}

View File

@ -87,6 +87,8 @@ var upgradeCount: number = 0;
* "ng2[ng1[Hello World!](transclude)](project)");
* });
* ```
*
* @experimental
*/
export class UpgradeAdapter {
/* @internal */
@ -567,6 +569,8 @@ function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function
/**
* Use `UgradeAdapterRef` to control a hybrid AngularJS v1 / Angular v2 application.
*
* @experimental
*/
export class UpgradeAdapterRef {
/* @internal */

View File

@ -8,7 +8,8 @@
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Component} from '@angular/core';
import {KeyEventsPlugin} from '@angular/platform-browser';
// TODO: remove deep import by reimplementing the event name serialization
import {KeyEventsPlugin} from "@angular/platform-browser/src/dom/events/key_events";
@Component({
selector: 'key-events-app',