style(lint): re-format modules/@angular
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
import {AnimationPlayer} from './animation_player';
|
||||
import {ListWrapper, Map, StringMapWrapper} from '../facade/collection';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {ListWrapper, StringMapWrapper, Map} from '../facade/collection';
|
||||
|
||||
import {AnimationPlayer} from './animation_player';
|
||||
|
||||
export class ActiveAnimationPlayersMap {
|
||||
private _map = new Map<any, {[key: string]: AnimationPlayer}>();
|
||||
private _allPlayers: AnimationPlayer[] = [];
|
||||
|
||||
get length(): number {
|
||||
return this.getAllPlayers().length;
|
||||
}
|
||||
get length(): number { return this.getAllPlayers().length; }
|
||||
|
||||
find(element: any, animationName: string): AnimationPlayer {
|
||||
var playersByAnimation = this._map.get(element);
|
||||
@ -19,7 +18,8 @@ export class ActiveAnimationPlayersMap {
|
||||
|
||||
findAllPlayersByElement(element: any): AnimationPlayer[] {
|
||||
var players: any[] /** TODO #9100 */ = [];
|
||||
StringMapWrapper.forEach(this._map.get(element), (player: any /** TODO #9100 */) => players.push(player));
|
||||
StringMapWrapper.forEach(
|
||||
this._map.get(element), (player: any /** TODO #9100 */) => players.push(player));
|
||||
return players;
|
||||
}
|
||||
|
||||
@ -37,9 +37,7 @@ export class ActiveAnimationPlayersMap {
|
||||
this._map.set(element, playersByAnimation);
|
||||
}
|
||||
|
||||
getAllPlayers(): AnimationPlayer[] {
|
||||
return this._allPlayers;
|
||||
}
|
||||
getAllPlayers(): AnimationPlayer[] { return this._allPlayers; }
|
||||
|
||||
remove(element: any, animationName: string): void {
|
||||
var playersByAnimation = this._map.get(element);
|
||||
|
@ -1,4 +1,4 @@
|
||||
export const FILL_STYLE_FLAG = 'true'; // TODO (matsko): change to boolean
|
||||
export const FILL_STYLE_FLAG = 'true'; // TODO (matsko): change to boolean
|
||||
export const ANY_STATE = '*';
|
||||
export const DEFAULT_STATE = '*';
|
||||
export const EMPTY_STATE = 'void';
|
||||
|
@ -1,15 +1,17 @@
|
||||
import {NoOpAnimationPlayer, AnimationPlayer} from './animation_player';
|
||||
import {AnimationKeyframe} from './animation_keyframe';
|
||||
import {AnimationPlayer, NoOpAnimationPlayer} from './animation_player';
|
||||
import {AnimationStyles} from './animation_styles';
|
||||
|
||||
export abstract class AnimationDriver {
|
||||
abstract animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number,
|
||||
easing: string): AnimationPlayer;
|
||||
abstract animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
duration: number, delay: number, easing: string): AnimationPlayer;
|
||||
}
|
||||
|
||||
export class NoOpAnimationDriver extends AnimationDriver {
|
||||
animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number,
|
||||
easing: string): AnimationPlayer {
|
||||
animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
duration: number, delay: number, easing: string): AnimationPlayer {
|
||||
return new NoOpAnimationPlayer();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import {AnimationPlayer} from './animation_player';
|
||||
import {isPresent, scheduleMicroTask} from '../facade/lang';
|
||||
import {Math} from '../facade/math';
|
||||
|
||||
import {AnimationPlayer} from './animation_player';
|
||||
|
||||
export class AnimationGroupPlayer implements AnimationPlayer {
|
||||
private _subscriptions: Function[] = [];
|
||||
private _finished = false;
|
||||
@ -56,9 +57,7 @@ export class AnimationGroupPlayer implements AnimationPlayer {
|
||||
reset(): void { this._players.forEach(player => player.reset()); }
|
||||
|
||||
setPosition(p: any /** TODO #9100 */): void {
|
||||
this._players.forEach(player => {
|
||||
player.setPosition(p);
|
||||
});
|
||||
this._players.forEach(player => { player.setPosition(p); });
|
||||
}
|
||||
|
||||
getPosition(): number {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {scheduleMicroTask} from '../facade/lang';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {scheduleMicroTask} from '../facade/lang';
|
||||
|
||||
export abstract class AnimationPlayer {
|
||||
abstract onDone(fn: Function): void;
|
||||
@ -12,16 +12,15 @@ export abstract class AnimationPlayer {
|
||||
abstract setPosition(p: any /** TODO #9100 */): void;
|
||||
abstract getPosition(): number;
|
||||
get parentPlayer(): AnimationPlayer { throw new BaseException('NOT IMPLEMENTED: Base Class'); }
|
||||
set parentPlayer(player: AnimationPlayer) { throw new BaseException('NOT IMPLEMENTED: Base Class'); }
|
||||
set parentPlayer(player: AnimationPlayer) {
|
||||
throw new BaseException('NOT IMPLEMENTED: Base Class');
|
||||
}
|
||||
}
|
||||
|
||||
export class NoOpAnimationPlayer implements AnimationPlayer {
|
||||
|
||||
private _subscriptions: any[] /** TODO #9100 */ = [];
|
||||
public parentPlayer: AnimationPlayer = null;
|
||||
constructor() {
|
||||
scheduleMicroTask(() => this._onFinish());
|
||||
}
|
||||
constructor() { scheduleMicroTask(() => this._onFinish()); }
|
||||
/** @internal */
|
||||
_onFinish() {
|
||||
this._subscriptions.forEach(entry => { entry(); });
|
||||
@ -31,9 +30,7 @@ export class NoOpAnimationPlayer implements AnimationPlayer {
|
||||
play(): void {}
|
||||
pause(): void {}
|
||||
restart(): void {}
|
||||
finish(): void {
|
||||
this._onFinish();
|
||||
}
|
||||
finish(): void { this._onFinish(); }
|
||||
destroy(): void {}
|
||||
reset(): void {}
|
||||
setPosition(p: any /** TODO #9100 */): void {}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {isPresent, scheduleMicroTask} from '../facade/lang';
|
||||
import {NoOpAnimationPlayer, AnimationPlayer} from './animation_player';
|
||||
|
||||
import {AnimationPlayer, NoOpAnimationPlayer} from './animation_player';
|
||||
|
||||
export class AnimationSequencePlayer implements AnimationPlayer {
|
||||
private _currentIndex: number = 0;
|
||||
@ -10,9 +11,7 @@ export class AnimationSequencePlayer implements AnimationPlayer {
|
||||
public parentPlayer: AnimationPlayer = null;
|
||||
|
||||
constructor(private _players: AnimationPlayer[]) {
|
||||
this._players.forEach(player => {
|
||||
player.parentPlayer = this;
|
||||
});
|
||||
this._players.forEach(player => { player.parentPlayer = this; });
|
||||
this._onNext(false);
|
||||
}
|
||||
|
||||
@ -72,11 +71,7 @@ export class AnimationSequencePlayer implements AnimationPlayer {
|
||||
this._players.forEach(player => player.destroy());
|
||||
}
|
||||
|
||||
setPosition(p: any /** TODO #9100 */): void {
|
||||
this._players[0].setPosition(p);
|
||||
}
|
||||
setPosition(p: any /** TODO #9100 */): void { this._players[0].setPosition(p); }
|
||||
|
||||
getPosition(): number {
|
||||
return this._players[0].getPosition();
|
||||
}
|
||||
getPosition(): number { return this._players[0].getPosition(); }
|
||||
}
|
||||
|
@ -1,29 +1,32 @@
|
||||
import {isPresent, isArray} from '../facade/lang';
|
||||
import {ListWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {AUTO_STYLE} from './metadata';
|
||||
import {FILL_STYLE_FLAG} from './animation_constants';
|
||||
import {isArray, isPresent} from '../facade/lang';
|
||||
|
||||
export function balanceAnimationStyles(previousStyles: {[key: string]: string|number},
|
||||
newStyles: {[key: string]: string|number},
|
||||
nullValue: any /** TODO #9100 */ = null): {[key: string]: string} {
|
||||
import {FILL_STYLE_FLAG} from './animation_constants';
|
||||
import {AUTO_STYLE} from './metadata';
|
||||
|
||||
export function balanceAnimationStyles(
|
||||
previousStyles: {[key: string]: string | number}, newStyles: {[key: string]: string | number},
|
||||
nullValue: any /** TODO #9100 */ = null): {[key: string]: string} {
|
||||
var finalStyles: {[key: string]: string} = {};
|
||||
|
||||
StringMapWrapper.forEach(newStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
finalStyles[prop] = value.toString();
|
||||
});
|
||||
StringMapWrapper.forEach(
|
||||
newStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
finalStyles[prop] = value.toString();
|
||||
});
|
||||
|
||||
StringMapWrapper.forEach(previousStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
if (!isPresent(finalStyles[prop])) {
|
||||
finalStyles[prop] = nullValue;
|
||||
}
|
||||
});
|
||||
StringMapWrapper.forEach(
|
||||
previousStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
if (!isPresent(finalStyles[prop])) {
|
||||
finalStyles[prop] = nullValue;
|
||||
}
|
||||
});
|
||||
|
||||
return finalStyles;
|
||||
}
|
||||
|
||||
export function balanceAnimationKeyframes(collectedStyles: {[key: string]: string|number},
|
||||
finalStateStyles: {[key: string]: string|number},
|
||||
keyframes: any[]): any[] {
|
||||
export function balanceAnimationKeyframes(
|
||||
collectedStyles: {[key: string]: string | number},
|
||||
finalStateStyles: {[key: string]: string | number}, keyframes: any[]): any[] {
|
||||
var limit = keyframes.length - 1;
|
||||
var firstKeyframe = keyframes[0];
|
||||
|
||||
@ -32,15 +35,16 @@ export function balanceAnimationKeyframes(collectedStyles: {[key: string]: strin
|
||||
|
||||
var extraFirstKeyframeStyles = {};
|
||||
var hasExtraFirstStyles = false;
|
||||
StringMapWrapper.forEach(collectedStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
// if the style is already defined in the first keyframe then
|
||||
// we do not replace it.
|
||||
if (!(flatenedFirstKeyframeStyles as any /** TODO #9100 */)[prop]) {
|
||||
(flatenedFirstKeyframeStyles as any /** TODO #9100 */)[prop] = value;
|
||||
(extraFirstKeyframeStyles as any /** TODO #9100 */)[prop] = value;
|
||||
hasExtraFirstStyles = true;
|
||||
}
|
||||
});
|
||||
StringMapWrapper.forEach(
|
||||
collectedStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
// if the style is already defined in the first keyframe then
|
||||
// we do not replace it.
|
||||
if (!(flatenedFirstKeyframeStyles as any /** TODO #9100 */)[prop]) {
|
||||
(flatenedFirstKeyframeStyles as any /** TODO #9100 */)[prop] = value;
|
||||
(extraFirstKeyframeStyles as any /** TODO #9100 */)[prop] = value;
|
||||
hasExtraFirstStyles = true;
|
||||
}
|
||||
});
|
||||
|
||||
var keyframeCollectedStyles = StringMapWrapper.merge({}, flatenedFirstKeyframeStyles);
|
||||
|
||||
@ -51,23 +55,25 @@ export function balanceAnimationKeyframes(collectedStyles: {[key: string]: strin
|
||||
var flatenedFinalKeyframeStyles = flattenStyles(finalKeyframe.styles.styles);
|
||||
var extraFinalKeyframeStyles = {};
|
||||
var hasExtraFinalStyles = false;
|
||||
StringMapWrapper.forEach(keyframeCollectedStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
if (!isPresent((flatenedFinalKeyframeStyles as any /** TODO #9100 */)[prop])) {
|
||||
(extraFinalKeyframeStyles as any /** TODO #9100 */)[prop] = AUTO_STYLE;
|
||||
hasExtraFinalStyles = true;
|
||||
}
|
||||
});
|
||||
StringMapWrapper.forEach(
|
||||
keyframeCollectedStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
if (!isPresent((flatenedFinalKeyframeStyles as any /** TODO #9100 */)[prop])) {
|
||||
(extraFinalKeyframeStyles as any /** TODO #9100 */)[prop] = AUTO_STYLE;
|
||||
hasExtraFinalStyles = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (hasExtraFinalStyles) {
|
||||
finalKeyframe.styles.styles.push(extraFinalKeyframeStyles);
|
||||
}
|
||||
|
||||
StringMapWrapper.forEach(flatenedFinalKeyframeStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
if (!isPresent((flatenedFirstKeyframeStyles as any /** TODO #9100 */)[prop])) {
|
||||
(extraFirstKeyframeStyles as any /** TODO #9100 */)[prop] = AUTO_STYLE;
|
||||
hasExtraFirstStyles = true;
|
||||
}
|
||||
});
|
||||
StringMapWrapper.forEach(
|
||||
flatenedFinalKeyframeStyles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
if (!isPresent((flatenedFirstKeyframeStyles as any /** TODO #9100 */)[prop])) {
|
||||
(extraFirstKeyframeStyles as any /** TODO #9100 */)[prop] = AUTO_STYLE;
|
||||
hasExtraFirstStyles = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (hasExtraFirstStyles) {
|
||||
firstKeyframe.styles.styles.push(extraFirstKeyframeStyles);
|
||||
@ -76,15 +82,14 @@ export function balanceAnimationKeyframes(collectedStyles: {[key: string]: strin
|
||||
return keyframes;
|
||||
}
|
||||
|
||||
export function clearStyles(styles: {[key: string]: string|number}): {[key: string]: string} {
|
||||
export function clearStyles(styles: {[key: string]: string | number}): {[key: string]: string} {
|
||||
var finalStyles: {[key: string]: string} = {};
|
||||
StringMapWrapper.keys(styles).forEach(key => {
|
||||
finalStyles[key] = null;
|
||||
});
|
||||
StringMapWrapper.keys(styles).forEach(key => { finalStyles[key] = null; });
|
||||
return finalStyles;
|
||||
}
|
||||
|
||||
export function collectAndResolveStyles(collection: {[key: string]: string|number}, styles: {[key: string]: string|number}[]) {
|
||||
export function collectAndResolveStyles(
|
||||
collection: {[key: string]: string | number}, styles: {[key: string]: string | number}[]) {
|
||||
return styles.map(entry => {
|
||||
var stylesObj = {};
|
||||
StringMapWrapper.forEach(entry, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
@ -101,13 +106,14 @@ export function collectAndResolveStyles(collection: {[key: string]: string|numbe
|
||||
});
|
||||
}
|
||||
|
||||
export function renderStyles(element: any, renderer: any, styles: {[key: string]: string|number}): void {
|
||||
export function renderStyles(
|
||||
element: any, renderer: any, styles: {[key: string]: string | number}): void {
|
||||
StringMapWrapper.forEach(styles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
renderer.setElementStyle(element, prop, value);
|
||||
});
|
||||
}
|
||||
|
||||
export function flattenStyles(styles: {[key: string]: string|number}[]) {
|
||||
export function flattenStyles(styles: {[key: string]: string | number}[]) {
|
||||
var finalStyles = {};
|
||||
styles.forEach(entry => {
|
||||
StringMapWrapper.forEach(entry, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
|
@ -1,11 +1,12 @@
|
||||
import {isPresent, isArray, isString, isStringMap, NumberWrapper} from '../facade/lang';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {NumberWrapper, isArray, isPresent, isString, isStringMap} from '../facade/lang';
|
||||
|
||||
export const AUTO_STYLE = "*";
|
||||
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.
|
||||
* Instances of this class are provided via the animation DSL when the {@link trigger trigger
|
||||
* animation function} is called.
|
||||
*/
|
||||
export class AnimationEntryMetadata {
|
||||
constructor(public name: string, public definitions: AnimationStateMetadata[]) {}
|
||||
@ -15,7 +16,8 @@ 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.
|
||||
* Instances of this class are provided via the animation DSL when the {@link state state animation
|
||||
* function} is called.
|
||||
*/
|
||||
export class AnimationStateDeclarationMetadata extends AnimationStateMetadata {
|
||||
constructor(public stateNameExpr: string, public styles: AnimationStyleMetadata) { super(); }
|
||||
@ -34,29 +36,34 @@ 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.
|
||||
* Instances of this class are provided via the animation DSL when the {@link keyframes keyframes
|
||||
* animation function} is called.
|
||||
*/
|
||||
export class AnimationKeyframesSequenceMetadata extends AnimationMetadata {
|
||||
constructor(public steps: AnimationStyleMetadata[]) {
|
||||
constructor(public steps: AnimationStyleMetadata[]) { super(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export class AnimationStyleMetadata extends AnimationMetadata {
|
||||
constructor(
|
||||
public styles: Array<string|{[key: string]: string | number}>, public offset: number = null) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export class AnimationStyleMetadata extends AnimationMetadata {
|
||||
constructor(public styles: Array<string|{[key: string]: string | number}>, public offset: number = null) { super(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Instances of this class are provided via the animation DSL when the {@link animate animate
|
||||
* animation function} is called.
|
||||
*/
|
||||
export class AnimationAnimateMetadata extends AnimationMetadata {
|
||||
constructor(public timings: string | number,
|
||||
public styles: AnimationStyleMetadata|AnimationKeyframesSequenceMetadata) {
|
||||
constructor(
|
||||
public timings: string|number,
|
||||
public styles: AnimationStyleMetadata|AnimationKeyframesSequenceMetadata) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@ -68,7 +75,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.
|
||||
* Instances of this class are provided via the animation DSL when the {@link sequence sequence
|
||||
* animation function} is called.
|
||||
*/
|
||||
export class AnimationSequenceMetadata extends AnimationWithStepsMetadata {
|
||||
constructor(private _steps: AnimationMetadata[]) { super(); }
|
||||
@ -77,7 +85,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.
|
||||
* Instances of this class are provided via the animation DSL when the {@link group group animation
|
||||
* function} is called.
|
||||
*/
|
||||
export class AnimationGroupMetadata extends AnimationWithStepsMetadata {
|
||||
constructor(private _steps: AnimationMetadata[]) { super(); }
|
||||
@ -85,14 +94,17 @@ export class AnimationGroupMetadata extends AnimationWithStepsMetadata {
|
||||
}
|
||||
|
||||
/**
|
||||
* `animate` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `animate` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
*
|
||||
* `animate` specifies an animation step that will apply the provided `styles` data for a given amount of
|
||||
* `animate` specifies an animation step that will apply the provided `styles` data for a given
|
||||
* amount of
|
||||
* time based on the provided `timing` expression value. Calls to `animate` are expected to be
|
||||
* used within {@link sequence an animation sequence}, {@link group group}, or {@link transition transition}.
|
||||
* used within {@link sequence an animation sequence}, {@link group group}, or {@link transition
|
||||
* transition}.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
@ -100,11 +112,16 @@ export class AnimationGroupMetadata extends AnimationWithStepsMetadata {
|
||||
*
|
||||
* - `timing` is a string based value that can be a combination of a duration with optional
|
||||
* delay and easing values. The format for the expression breaks down to `duration delay easing`
|
||||
* (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000, delay=100, easing=ease-out`.
|
||||
* If a numeric value is provided then that will be used as the `duration` value in millisecond form.
|
||||
* - `styles` is the style input data which can either be a call to {@link style style} or {@link keyframes keyframes}.
|
||||
* If left empty then the styles from the destination state will be collected and used (this is useful when
|
||||
* describing an animation step that will complete an animation by {@link transition#the-final-animate-call animating to the final state}).
|
||||
* (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
|
||||
* delay=100, easing=ease-out`.
|
||||
* If a numeric value is provided then that will be used as the `duration` value in millisecond
|
||||
* form.
|
||||
* - `styles` is the style input data which can either be a call to {@link style style} or {@link
|
||||
* keyframes keyframes}.
|
||||
* If left empty then the styles from the destination state will be collected and used (this is
|
||||
* useful when
|
||||
* describing an animation step that will complete an animation by {@link
|
||||
* transition#the-final-animate-call animating to the final state}).
|
||||
*
|
||||
* ```typescript
|
||||
* // various functions for specifying timing data
|
||||
@ -126,18 +143,20 @@ export class AnimationGroupMetadata extends AnimationWithStepsMetadata {
|
||||
*
|
||||
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
||||
*/
|
||||
export function animate(timing: string | number,
|
||||
styles: AnimationStyleMetadata|AnimationKeyframesSequenceMetadata = null): AnimationAnimateMetadata {
|
||||
export function animate(
|
||||
timing: string | number, styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata =
|
||||
null): AnimationAnimateMetadata {
|
||||
var stylesEntry = styles;
|
||||
if (!isPresent(stylesEntry)) {
|
||||
var EMPTY_STYLE: {[key: string]: string|number} = {};
|
||||
var EMPTY_STYLE: {[key: string]: string | number} = {};
|
||||
stylesEntry = new AnimationStyleMetadata([EMPTY_STYLE], 1);
|
||||
}
|
||||
return new AnimationAnimateMetadata(timing, stylesEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
* `group` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `group` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
@ -146,16 +165,19 @@ export function animate(timing: string | number,
|
||||
* are useful when a series of styles must be animated/closed off
|
||||
* at different statrting/ending times.
|
||||
*
|
||||
* The `group` function can either be used within a {@link sequence sequence} or a {@link transition transition}
|
||||
* The `group` function can either be used within a {@link sequence sequence} or a {@link transition
|
||||
* transition}
|
||||
* and it will only continue to the next instruction once all of the inner animation steps
|
||||
* have completed.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
* The `steps` data that is passed into the `group` animation function can either consist
|
||||
* of {@link style style} or {@link animate animate} function calls. Each call to `style()` or `animate()`
|
||||
* of {@link style style} or {@link animate animate} function calls. Each call to `style()` or
|
||||
* `animate()`
|
||||
* within a group will be executed instantly (use {@link keyframes keyframes} or a
|
||||
* {@link animate#usage animate() with a delay value} to offset styles to be applied at a later time).
|
||||
* {@link animate#usage animate() with a delay value} to offset styles to be applied at a later
|
||||
* time).
|
||||
*
|
||||
* ```typescript
|
||||
* group([
|
||||
@ -173,7 +195,8 @@ export function group(steps: AnimationMetadata[]): AnimationGroupMetadata {
|
||||
}
|
||||
|
||||
/**
|
||||
* `sequence` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `sequence` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
@ -181,7 +204,8 @@ export function group(steps: AnimationMetadata[]): AnimationGroupMetadata {
|
||||
* `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used
|
||||
* by default when an array is passed as animation data into {@link transition transition}.)
|
||||
*
|
||||
* The `sequence` function can either be used within a {@link group group} or a {@link transition transition}
|
||||
* The `sequence` function can either be used within a {@link group group} or a {@link transition
|
||||
* transition}
|
||||
* and it will only continue to the next instruction once each of the inner animation steps
|
||||
* have completed.
|
||||
*
|
||||
@ -191,7 +215,8 @@ export function group(steps: AnimationMetadata[]): AnimationGroupMetadata {
|
||||
* ### Usage
|
||||
*
|
||||
* The `steps` data that is passed into the `sequence` animation function can either consist
|
||||
* of {@link style style} or {@link animate animate} function calls. A call to `style()` will apply the
|
||||
* of {@link style style} or {@link animate animate} function calls. A call to `style()` will apply
|
||||
* the
|
||||
* provided styling data immediately while a call to `animate()` will apply its styling
|
||||
* data over a given time depending on its timing data.
|
||||
*
|
||||
@ -211,13 +236,15 @@ export function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata
|
||||
}
|
||||
|
||||
/**
|
||||
* `style` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `style` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
*
|
||||
* `style` declares a key/value object containing CSS properties/styles that can then
|
||||
* be used for {@link state animation states}, within an {@link sequence animation sequence}, or as styling data for both {@link animate animate} and {@link keyframes keyframes}.
|
||||
* be used for {@link state animation states}, within an {@link sequence animation sequence}, or as
|
||||
* styling data for both {@link animate animate} and {@link keyframes keyframes}.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
@ -234,10 +261,12 @@ export function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata
|
||||
*
|
||||
* #### Auto-styles (using `*`)
|
||||
*
|
||||
* When an asterix (`*`) character is used as a value then it will be detected from the element being animated
|
||||
* When an asterix (`*`) character is used as a value then it will be detected from the element
|
||||
* being animated
|
||||
* and applied as animation data when the animation starts.
|
||||
*
|
||||
* This feature proves useful for a state depending on layout and/or environment factors; in such cases
|
||||
* This feature proves useful for a state depending on layout and/or environment factors; in such
|
||||
* cases
|
||||
* the styles are calculated just before the animation starts.
|
||||
*
|
||||
* ```typescript
|
||||
@ -251,7 +280,9 @@ export function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata
|
||||
*
|
||||
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
||||
*/
|
||||
export function style(tokens: string|{[key: string]: string | number}|Array<string|{[key: string]: string | number}>): AnimationStyleMetadata {
|
||||
export function style(
|
||||
tokens: string | {[key: string]: string | number} |
|
||||
Array<string|{[key: string]: string | number}>): AnimationStyleMetadata {
|
||||
var input: Array<{[key: string]: string | number}|string>;
|
||||
var offset: number = null;
|
||||
if (isString(tokens)) {
|
||||
@ -273,7 +304,8 @@ export function style(tokens: string|{[key: string]: string | number}|Array<stri
|
||||
}
|
||||
|
||||
/**
|
||||
* `state` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `state` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
@ -288,8 +320,10 @@ export function style(tokens: string|{[key: string]: string | number}|Array<stri
|
||||
*
|
||||
* #### The `void` state
|
||||
*
|
||||
* The `void` state value is a reserved word that angular uses to determine when the element is not apart
|
||||
* of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the associated element
|
||||
* The `void` state value is a reserved word that angular uses to determine when the element is not
|
||||
* apart
|
||||
* of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
|
||||
* associated element
|
||||
* is void).
|
||||
*
|
||||
* #### The `*` (default) state
|
||||
@ -303,7 +337,8 @@ export function style(tokens: string|{[key: string]: string | number}|Array<stri
|
||||
* within the given trigger.
|
||||
*
|
||||
* - `stateNameExpr` can be one or more state names separated by commas.
|
||||
* - `styles` refers to the {@link style styling data} that will be persisted on the element once the state
|
||||
* - `styles` refers to the {@link style styling data} that will be persisted on the element once
|
||||
* the state
|
||||
* has been reached.
|
||||
*
|
||||
* ```typescript
|
||||
@ -320,17 +355,20 @@ export function style(tokens: string|{[key: string]: string | number}|Array<stri
|
||||
*
|
||||
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
||||
*/
|
||||
export function state(stateNameExpr: string, styles: AnimationStyleMetadata): AnimationStateDeclarationMetadata {
|
||||
export function state(
|
||||
stateNameExpr: string, styles: AnimationStyleMetadata): AnimationStateDeclarationMetadata {
|
||||
return new AnimationStateDeclarationMetadata(stateNameExpr, styles);
|
||||
}
|
||||
|
||||
/**
|
||||
* `keyframes` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `keyframes` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
*
|
||||
* `keyframes` specifies a collection of {@link style style} entries each optionally characterized by an `offset` value.
|
||||
* `keyframes` specifies a collection of {@link style style} entries each optionally characterized
|
||||
* by an `offset` value.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
@ -352,7 +390,8 @@ export function state(stateNameExpr: string, styles: AnimationStyleMetadata): An
|
||||
* ]))
|
||||
* ```
|
||||
*
|
||||
* Alternatively, if there are no `offset` values used within the style entries then the offsets will
|
||||
* Alternatively, if there are no `offset` values used within the style entries then the offsets
|
||||
* will
|
||||
* be calculated automatically.
|
||||
*
|
||||
* ```typescript
|
||||
@ -373,22 +412,29 @@ export function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSe
|
||||
}
|
||||
|
||||
/**
|
||||
* `transition` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `transition` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
*
|
||||
* `transition` declares the {@link sequence sequence of animation steps} that will be run when the provided
|
||||
* `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => state2` which consists
|
||||
* `transition` declares the {@link sequence sequence of animation steps} that will be run when the
|
||||
* provided
|
||||
* `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => state2`
|
||||
* which consists
|
||||
* of two known states (use an asterix (`*`) to refer to a dynamic starting and/or ending state).
|
||||
*
|
||||
* Animation transitions are placed within an {@link trigger animation trigger}. For an transition to animate to
|
||||
* a state value and persist its styles then one or more {@link state animation states} is expected to be defined.
|
||||
* Animation transitions are placed within an {@link trigger animation trigger}. For an transition
|
||||
* to animate to
|
||||
* a state value and persist its styles then one or more {@link state animation states} is expected
|
||||
* to be defined.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
* An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on what the
|
||||
* previous state is and what the current state has become. In other words, if a transition is defined that
|
||||
* An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
|
||||
* what the
|
||||
* previous state is and what the current state has become. In other words, if a transition is
|
||||
* defined that
|
||||
* matches the old/current state criteria then the associated animation will be triggered.
|
||||
*
|
||||
* ```typescript
|
||||
@ -432,7 +478,8 @@ export function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSe
|
||||
* #### The final `animate` call
|
||||
*
|
||||
* If the final step within the transition steps is a call to `animate()` that **only**
|
||||
* uses a timing value with **no style data** then it will be automatically used as the final animation
|
||||
* uses a timing value with **no style data** then it will be automatically used as the final
|
||||
* animation
|
||||
* arc for the element to animate itself to the final state. This involves an automatic mix of
|
||||
* adding/removing CSS styles so that the element will be in the exact state it should be for the
|
||||
* applied state to be presented correctly.
|
||||
@ -450,20 +497,22 @@ export function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSe
|
||||
*
|
||||
* {@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
||||
*/
|
||||
export function transition(stateChangeExpr: string, steps: AnimationMetadata|AnimationMetadata[]): AnimationStateTransitionMetadata {
|
||||
var animationData = isArray(steps)
|
||||
? new AnimationSequenceMetadata(<AnimationMetadata[]>steps)
|
||||
: <AnimationMetadata>steps;
|
||||
export function transition(stateChangeExpr: string, steps: AnimationMetadata | AnimationMetadata[]):
|
||||
AnimationStateTransitionMetadata {
|
||||
var animationData = isArray(steps) ? new AnimationSequenceMetadata(<AnimationMetadata[]>steps) :
|
||||
<AnimationMetadata>steps;
|
||||
return new AnimationStateTransitionMetadata(stateChangeExpr, animationData);
|
||||
}
|
||||
|
||||
/**
|
||||
* `trigger` is an animation-specific function that is designed to be used inside of Angular2's animation
|
||||
* `trigger` is an animation-specific function that is designed to be used inside of Angular2's
|
||||
* animation
|
||||
* DSL language. If this information is new, please navigate to the
|
||||
* {@link ComponentMetadata#animations-anchor component animations metadata
|
||||
* page} to gain a better understanding of how animations in Angular2 are used.
|
||||
*
|
||||
* `trigger` Creates an animation trigger which will a list of {@link state state} and {@link transition transition}
|
||||
* `trigger` Creates an animation trigger which will a list of {@link state state} and {@link
|
||||
* transition transition}
|
||||
* entries that will be evaluated when the expression bound to the trigger changes.
|
||||
*
|
||||
* Triggers are registered within the component annotation data under the
|
||||
@ -475,7 +524,8 @@ export function transition(stateChangeExpr: string, steps: AnimationMetadata|Ani
|
||||
* ### Usage
|
||||
*
|
||||
* `trigger` will create an animation trigger reference based on the provided `name` value.
|
||||
* The provided `animation` value is expected to be an array consisting of {@link state state} and {@link transition transition}
|
||||
* The provided `animation` value is expected to be an array consisting of {@link state state} and
|
||||
* {@link transition transition}
|
||||
* declarations.
|
||||
*
|
||||
* ```typescript
|
||||
|
@ -1,15 +1,11 @@
|
||||
import {Type} from '../src/facade/lang';
|
||||
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
||||
|
||||
import {APPLICATION_CORE_PROVIDERS} from './application_ref';
|
||||
import {
|
||||
IterableDiffers,
|
||||
defaultIterableDiffers,
|
||||
KeyValueDiffers,
|
||||
defaultKeyValueDiffers
|
||||
} from './change_detection/change_detection';
|
||||
import {ViewUtils} from './linker/view_utils';
|
||||
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
||||
import {IterableDiffers, KeyValueDiffers, defaultIterableDiffers, defaultKeyValueDiffers} from './change_detection/change_detection';
|
||||
import {ComponentResolver, ReflectorComponentResolver} from './linker/component_resolver';
|
||||
import {DynamicComponentLoader, DynamicComponentLoader_} from './linker/dynamic_component_loader';
|
||||
import {ViewUtils} from './linker/view_utils';
|
||||
|
||||
let __unused: Type; // avoid unused import when Type union types are erased
|
||||
|
||||
@ -18,7 +14,7 @@ let __unused: Type; // avoid unused import when Type union types are erased
|
||||
* application, regardless of the platform it runs onto.
|
||||
* @stable
|
||||
*/
|
||||
export const APPLICATION_COMMON_PROVIDERS: Array<Type | {[k: string]: any} | any[]> =
|
||||
export const APPLICATION_COMMON_PROVIDERS: Array<Type|{[k: string]: any}|any[]> =
|
||||
/*@ts2dart_const*/[
|
||||
APPLICATION_CORE_PROVIDERS,
|
||||
/* @ts2dart_Provider */ {provide: ComponentResolver, useClass: ReflectorComponentResolver},
|
||||
@ -26,5 +22,5 @@ export const APPLICATION_COMMON_PROVIDERS: Array<Type | {[k: string]: any} | any
|
||||
ViewUtils,
|
||||
/* @ts2dart_Provider */ {provide: IterableDiffers, useValue: defaultIterableDiffers},
|
||||
/* @ts2dart_Provider */ {provide: KeyValueDiffers, useValue: defaultKeyValueDiffers},
|
||||
/* @ts2dart_Provider */ {provide: DynamicComponentLoader, useClass: DynamicComponentLoader_}
|
||||
/* @ts2dart_Provider */ {provide: DynamicComponentLoader, useClass: DynamicComponentLoader_},
|
||||
];
|
||||
|
@ -1,16 +1,18 @@
|
||||
import {NgZone, NgZoneError} from './zone/ng_zone';
|
||||
import {Type, isBlank, isPresent, assertionsEnabled, lockMode, isPromise, IS_DART} from '../src/facade/lang';
|
||||
import {Injector, Injectable} from './di';
|
||||
import {PLATFORM_INITIALIZER, APP_INITIALIZER} from './application_tokens';
|
||||
import {PromiseWrapper, ObservableWrapper} from '../src/facade/async';
|
||||
import {ObservableWrapper, PromiseWrapper} from '../src/facade/async';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {TestabilityRegistry, Testability} from './testability/testability';
|
||||
import {ComponentResolver} from './linker/component_resolver';
|
||||
import {ComponentRef, ComponentFactory} from './linker/component_factory';
|
||||
import {BaseException, ExceptionHandler, unimplemented} from '../src/facade/exceptions';
|
||||
import {Console} from './console';
|
||||
import {wtfLeave, wtfCreateScope, WtfScopeFn} from './profile/profile';
|
||||
import {IS_DART, Type, assertionsEnabled, isBlank, isPresent, isPromise, lockMode} from '../src/facade/lang';
|
||||
|
||||
import {APP_INITIALIZER, PLATFORM_INITIALIZER} from './application_tokens';
|
||||
import {ChangeDetectorRef} from './change_detection/change_detector_ref';
|
||||
import {Console} from './console';
|
||||
import {Injectable, Injector} from './di';
|
||||
import {ComponentFactory, ComponentRef} from './linker/component_factory';
|
||||
import {ComponentResolver} from './linker/component_resolver';
|
||||
import {WtfScopeFn, wtfCreateScope, wtfLeave} from './profile/profile';
|
||||
import {Testability, TestabilityRegistry} from './testability/testability';
|
||||
import {NgZone, NgZoneError} from './zone/ng_zone';
|
||||
|
||||
|
||||
/**
|
||||
* Create an Angular zone.
|
||||
@ -34,7 +36,7 @@ export function createPlatform(injector: Injector): PlatformRef {
|
||||
}
|
||||
if (isPresent(_platform) && !_platform.disposed) {
|
||||
throw new BaseException(
|
||||
"There can be only one platform. Destroy the previous one to create a new one.");
|
||||
'There can be only one platform. Destroy the previous one to create a new one.');
|
||||
}
|
||||
lockMode();
|
||||
_inPlatformCreate = true;
|
||||
@ -86,8 +88,8 @@ export function getPlatform(): PlatformRef {
|
||||
* Requires a platform to be created first.
|
||||
* @experimental
|
||||
*/
|
||||
export function coreBootstrap<C>(componentFactory: ComponentFactory<C>,
|
||||
injector: Injector): ComponentRef<C> {
|
||||
export function coreBootstrap<C>(
|
||||
componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C> {
|
||||
var appRef: ApplicationRef = injector.get(ApplicationRef);
|
||||
return appRef.bootstrap(componentFactory);
|
||||
}
|
||||
@ -98,8 +100,8 @@ export function coreBootstrap<C>(componentFactory: ComponentFactory<C>,
|
||||
* Requires a platform to be created first.
|
||||
* @experimental
|
||||
*/
|
||||
export function coreLoadAndBootstrap(componentType: Type,
|
||||
injector: Injector): Promise<ComponentRef<any>> {
|
||||
export function coreLoadAndBootstrap(
|
||||
componentType: Type, injector: Injector): Promise<ComponentRef<any>> {
|
||||
var appRef: ApplicationRef = injector.get(ApplicationRef);
|
||||
return appRef.run(() => {
|
||||
var componentResolver: ComponentResolver = injector.get(ComponentResolver);
|
||||
@ -306,8 +308,8 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
ObservableWrapper.subscribe(zone.onError, (error: NgZoneError) => {
|
||||
this._exceptionHandler.call(error.error, error.stackTrace);
|
||||
});
|
||||
ObservableWrapper.subscribe(this._zone.onMicrotaskEmpty,
|
||||
(_) => { this._zone.run(() => { this.tick(); }); });
|
||||
ObservableWrapper.subscribe(
|
||||
this._zone.onMicrotaskEmpty, (_) => { this._zone.run(() => { this.tick(); }); });
|
||||
}
|
||||
|
||||
registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void {
|
||||
@ -339,10 +341,12 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
try {
|
||||
result = callback();
|
||||
if (isPromise(result)) {
|
||||
PromiseWrapper.then(result, (ref) => { completer.resolve(ref); }, (err, stackTrace) => {
|
||||
completer.reject(err, stackTrace);
|
||||
this._exceptionHandler.call(err, stackTrace);
|
||||
});
|
||||
PromiseWrapper.then(
|
||||
result, (ref) => { completer.resolve(ref); },
|
||||
(err, stackTrace) => {
|
||||
completer.reject(err, stackTrace);
|
||||
this._exceptionHandler.call(err, stackTrace);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
this._exceptionHandler.call(e, e.stack);
|
||||
@ -370,8 +374,8 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
this._loadComponent(compRef);
|
||||
let c: Console = this._injector.get(Console);
|
||||
if (assertionsEnabled()) {
|
||||
let prodDescription = IS_DART ? "Production mode is disabled in Dart." :
|
||||
"Call enableProdMode() to enable the production mode.";
|
||||
let prodDescription = IS_DART ? 'Production mode is disabled in Dart.' :
|
||||
'Call enableProdMode() to enable the production mode.';
|
||||
c.log(`Angular 2 is running in the development mode. ${prodDescription}`);
|
||||
}
|
||||
return compRef;
|
||||
@ -401,7 +405,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
|
||||
tick(): void {
|
||||
if (this._runningTick) {
|
||||
throw new BaseException("ApplicationRef.tick is called recursively");
|
||||
throw new BaseException('ApplicationRef.tick is called recursively');
|
||||
}
|
||||
|
||||
var s = ApplicationRef_._tickScope();
|
||||
@ -437,5 +441,5 @@ export const PLATFORM_CORE_PROVIDERS =
|
||||
export const APPLICATION_CORE_PROVIDERS = /*@ts2dart_const*/[
|
||||
/* @ts2dart_Provider */ {provide: NgZone, useFactory: createNgZone, deps: [] as any},
|
||||
ApplicationRef_,
|
||||
/* @ts2dart_Provider */ {provide: ApplicationRef, useExisting: ApplicationRef_}
|
||||
/* @ts2dart_Provider */ {provide: ApplicationRef, useExisting: ApplicationRef_},
|
||||
];
|
||||
|
@ -1,6 +1,8 @@
|
||||
import {OpaqueToken} from './di';
|
||||
import {Math, StringWrapper} from '../src/facade/lang';
|
||||
|
||||
import {OpaqueToken} from './di';
|
||||
|
||||
|
||||
/**
|
||||
* A DI Token representing a unique string id assigned to the application by Angular and used
|
||||
* primarily for prefixing application attributes and CSS styles when
|
||||
@ -37,18 +39,18 @@ function _randomChar(): string {
|
||||
* @experimental
|
||||
*/
|
||||
export const PLATFORM_INITIALIZER: any =
|
||||
/*@ts2dart_const*/ new OpaqueToken("Platform Initializer");
|
||||
/*@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");
|
||||
/*@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");
|
||||
/*@ts2dart_const*/ new OpaqueToken('Application Packages Root URL');
|
||||
|
@ -4,23 +4,4 @@
|
||||
* Change detection enables data binding in Angular.
|
||||
*/
|
||||
|
||||
export {
|
||||
ChangeDetectionStrategy,
|
||||
|
||||
ChangeDetectorRef,
|
||||
|
||||
WrappedValue,
|
||||
SimpleChange,
|
||||
SimpleChanges,
|
||||
PipeTransform,
|
||||
DefaultIterableDiffer,
|
||||
IterableDiffers,
|
||||
IterableDiffer,
|
||||
IterableDifferFactory,
|
||||
KeyValueDiffers,
|
||||
KeyValueDiffer,
|
||||
KeyValueDifferFactory,
|
||||
CollectionChangeRecord,
|
||||
KeyValueChangeRecord,
|
||||
TrackByFn
|
||||
} from './change_detection/change_detection';
|
||||
export {ChangeDetectionStrategy, ChangeDetectorRef, CollectionChangeRecord, DefaultIterableDiffer, IterableDiffer, IterableDifferFactory, IterableDiffers, KeyValueChangeRecord, KeyValueDiffer, KeyValueDifferFactory, KeyValueDiffers, PipeTransform, SimpleChange, SimpleChanges, TrackByFn, WrappedValue} from './change_detection/change_detection';
|
||||
|
@ -1,47 +1,19 @@
|
||||
import {IterableDiffers, IterableDifferFactory} from './differs/iterable_differs';
|
||||
import {DefaultIterableDifferFactory} from './differs/default_iterable_differ';
|
||||
import {KeyValueDiffers, KeyValueDifferFactory} from './differs/keyvalue_differs';
|
||||
import {
|
||||
DefaultKeyValueDifferFactory,
|
||||
KeyValueChangeRecord
|
||||
} from './differs/default_keyvalue_differ';
|
||||
import {DefaultKeyValueDifferFactory, KeyValueChangeRecord} from './differs/default_keyvalue_differ';
|
||||
import {IterableDifferFactory, IterableDiffers} from './differs/iterable_differs';
|
||||
import {KeyValueDifferFactory, KeyValueDiffers} from './differs/keyvalue_differs';
|
||||
|
||||
export {
|
||||
DefaultKeyValueDifferFactory,
|
||||
KeyValueChangeRecord
|
||||
} from './differs/default_keyvalue_differ';
|
||||
export {
|
||||
DefaultIterableDifferFactory,
|
||||
CollectionChangeRecord
|
||||
} from './differs/default_iterable_differ';
|
||||
|
||||
export {
|
||||
ChangeDetectionStrategy,
|
||||
CHANGE_DETECTION_STRATEGY_VALUES,
|
||||
ChangeDetectorState,
|
||||
CHANGE_DETECTOR_STATE_VALUES,
|
||||
isDefaultChangeDetectionStrategy
|
||||
} from './constants';
|
||||
export {SimpleChanges} from '../metadata/lifecycle_hooks';
|
||||
export {SimpleChange, ValueUnwrapper, WrappedValue, devModeEqual, looseIdentical, uninitialized} from './change_detection_util';
|
||||
export {ChangeDetectorRef} from './change_detector_ref';
|
||||
export {
|
||||
IterableDiffers,
|
||||
IterableDiffer,
|
||||
IterableDifferFactory,
|
||||
TrackByFn
|
||||
} from './differs/iterable_differs';
|
||||
export {KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory} from './differs/keyvalue_differs';
|
||||
export {CHANGE_DETECTION_STRATEGY_VALUES, CHANGE_DETECTOR_STATE_VALUES, ChangeDetectionStrategy, ChangeDetectorState, isDefaultChangeDetectionStrategy} from './constants';
|
||||
export {CollectionChangeRecord, DefaultIterableDifferFactory} from './differs/default_iterable_differ';
|
||||
export {DefaultIterableDiffer} from './differs/default_iterable_differ';
|
||||
export {DefaultKeyValueDifferFactory, KeyValueChangeRecord} from './differs/default_keyvalue_differ';
|
||||
export {IterableDiffer, IterableDifferFactory, IterableDiffers, TrackByFn} from './differs/iterable_differs';
|
||||
export {KeyValueDiffer, KeyValueDifferFactory, KeyValueDiffers} from './differs/keyvalue_differs';
|
||||
export {PipeTransform} from './pipe_transform';
|
||||
|
||||
export {
|
||||
WrappedValue,
|
||||
ValueUnwrapper,
|
||||
SimpleChange,
|
||||
devModeEqual,
|
||||
looseIdentical,
|
||||
uninitialized
|
||||
} from './change_detection_util';
|
||||
export {SimpleChanges} from '../metadata/lifecycle_hooks';
|
||||
|
||||
/**
|
||||
* Structural diffing for `Object`s and `Map`s.
|
||||
|
@ -1,15 +1,16 @@
|
||||
import {looseIdentical, isPrimitive} from '../facade/lang';
|
||||
import {isListLikeIterable, areIterablesEqual} from '../facade/collection';
|
||||
import {areIterablesEqual, isListLikeIterable} from '../facade/collection';
|
||||
import {isPrimitive, looseIdentical} from '../facade/lang';
|
||||
|
||||
export {looseIdentical} from '../facade/lang';
|
||||
|
||||
export var uninitialized: Object = /*@ts2dart_const*/ new Object();
|
||||
|
||||
export function devModeEqual(a: any, b: any): boolean {
|
||||
if (isListLikeIterable(a) && isListLikeIterable(b)) {
|
||||
return areIterablesEqual(a, b, devModeEqual);
|
||||
|
||||
} else if (!isListLikeIterable(a) && !isPrimitive(a) && !isListLikeIterable(b) &&
|
||||
!isPrimitive(b)) {
|
||||
} else if (
|
||||
!isListLikeIterable(a) && !isPrimitive(a) && !isListLikeIterable(b) && !isPrimitive(b)) {
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
@ -21,7 +21,7 @@ export enum ChangeDetectorState {
|
||||
* or calling a directive lifecycle method and is now in an inconsistent state. Change
|
||||
* detectors in this state will no longer detect changes.
|
||||
*/
|
||||
Errored
|
||||
Errored,
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ export var CHANGE_DETECTION_STRATEGY_VALUES = [
|
||||
ChangeDetectionStrategy.CheckAlways,
|
||||
ChangeDetectionStrategy.Detached,
|
||||
ChangeDetectionStrategy.OnPush,
|
||||
ChangeDetectionStrategy.Default
|
||||
ChangeDetectionStrategy.Default,
|
||||
];
|
||||
|
||||
/**
|
||||
@ -84,11 +84,11 @@ export var CHANGE_DETECTION_STRATEGY_VALUES = [
|
||||
export var CHANGE_DETECTOR_STATE_VALUES = [
|
||||
ChangeDetectorState.NeverChecked,
|
||||
ChangeDetectorState.CheckedBefore,
|
||||
ChangeDetectorState.Errored
|
||||
ChangeDetectorState.Errored,
|
||||
];
|
||||
|
||||
export function isDefaultChangeDetectionStrategy(
|
||||
changeDetectionStrategy: ChangeDetectionStrategy): boolean {
|
||||
export function isDefaultChangeDetectionStrategy(changeDetectionStrategy: ChangeDetectionStrategy):
|
||||
boolean {
|
||||
return isBlank(changeDetectionStrategy) ||
|
||||
changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
||||
changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
||||
}
|
||||
|
@ -1,18 +1,11 @@
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {isListLikeIterable, iterateListLike} from '../../facade/collection';
|
||||
|
||||
import {
|
||||
isBlank,
|
||||
isPresent,
|
||||
stringify,
|
||||
getMapKey,
|
||||
looseIdentical,
|
||||
isArray
|
||||
} from '../../facade/lang';
|
||||
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {getMapKey, isArray, isBlank, isPresent, looseIdentical, stringify} from '../../facade/lang';
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
|
||||
import {IterableDiffer, IterableDifferFactory, TrackByFn} from './iterable_differs';
|
||||
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class DefaultIterableDifferFactory implements IterableDifferFactory {
|
||||
constructor() {}
|
||||
@ -171,7 +164,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
*/
|
||||
get isDirty(): boolean {
|
||||
return this._additionsHead !== null || this._movesHead !== null ||
|
||||
this._removalsHead !== null || this._identityChangesHead !== null;
|
||||
this._removalsHead !== null || this._identityChangesHead !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,8 +212,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
_mismatch(record: CollectionChangeRecord, item: any, itemTrackBy: any,
|
||||
index: number): CollectionChangeRecord {
|
||||
_mismatch(record: CollectionChangeRecord, item: any, itemTrackBy: any, index: number):
|
||||
CollectionChangeRecord {
|
||||
// The previous record after which we will append the current one.
|
||||
var previousRecord: CollectionChangeRecord;
|
||||
|
||||
@ -285,8 +278,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
_verifyReinsertion(record: CollectionChangeRecord, item: any, itemTrackBy: any,
|
||||
index: number): CollectionChangeRecord {
|
||||
_verifyReinsertion(record: CollectionChangeRecord, item: any, itemTrackBy: any, index: number):
|
||||
CollectionChangeRecord {
|
||||
var reinsertRecord: CollectionChangeRecord =
|
||||
this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy);
|
||||
if (reinsertRecord !== null) {
|
||||
@ -334,8 +327,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
_reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, index: number):
|
||||
CollectionChangeRecord {
|
||||
if (this._unlinkedRecords !== null) {
|
||||
this._unlinkedRecords.remove(record);
|
||||
}
|
||||
@ -359,8 +352,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
_moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, index: number):
|
||||
CollectionChangeRecord {
|
||||
this._unlink(record);
|
||||
this._insertAfter(record, prevRecord, index);
|
||||
this._addToMoves(record, index);
|
||||
@ -368,8 +361,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
_addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, index: number):
|
||||
CollectionChangeRecord {
|
||||
this._insertAfter(record, prevRecord, index);
|
||||
|
||||
if (this._additionsTail === null) {
|
||||
@ -386,8 +379,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
_insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, index: number):
|
||||
CollectionChangeRecord {
|
||||
// todo(vicb)
|
||||
// assert(record != prevRecord);
|
||||
// assert(record._next === null);
|
||||
@ -528,10 +521,12 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
var identityChanges: any[] /** TODO #9100 */ = [];
|
||||
this.forEachIdentityChange((record: any /** TODO #9100 */) => identityChanges.push(record));
|
||||
|
||||
return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
||||
"additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" +
|
||||
"removals: " + removals.join(', ') + "\n" + "identityChanges: " +
|
||||
identityChanges.join(', ') + "\n";
|
||||
return 'collection: ' + list.join(', ') + '\n' +
|
||||
'previous: ' + previous.join(', ') + '\n' +
|
||||
'additions: ' + additions.join(', ') + '\n' +
|
||||
'moves: ' + moves.join(', ') + '\n' +
|
||||
'removals: ' + removals.join(', ') + '\n' +
|
||||
'identityChanges: ' + identityChanges.join(', ') + '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,10 +562,9 @@ export class CollectionChangeRecord {
|
||||
constructor(public item: any, public trackById: any) {}
|
||||
|
||||
toString(): string {
|
||||
return this.previousIndex === this.currentIndex ?
|
||||
stringify(this.item) :
|
||||
stringify(this.item) + '[' + stringify(this.previousIndex) + '->' +
|
||||
stringify(this.currentIndex) + ']';
|
||||
return this.previousIndex === this.currentIndex ? stringify(this.item) :
|
||||
stringify(this.item) + '[' +
|
||||
stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
import {MapWrapper, StringMapWrapper} from '../../facade/collection';
|
||||
import {stringify, looseIdentical, isJsObject, isBlank} from '../../facade/lang';
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {isBlank, isJsObject, looseIdentical, stringify} from '../../facade/lang';
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
|
||||
import {KeyValueDiffer, KeyValueDifferFactory} from './keyvalue_differs';
|
||||
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class DefaultKeyValueDifferFactory implements KeyValueDifferFactory {
|
||||
constructor() {}
|
||||
@ -25,7 +27,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
|
||||
get isDirty(): boolean {
|
||||
return this._additionsHead !== null || this._changesHead !== null ||
|
||||
this._removalsHead !== null;
|
||||
this._removalsHead !== null;
|
||||
}
|
||||
|
||||
forEachItem(fn: Function) {
|
||||
@ -207,7 +209,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
/** @internal */
|
||||
_isInRemovals(record: KeyValueChangeRecord) {
|
||||
return record === this._removalsHead || record._nextRemoved !== null ||
|
||||
record._prevRemoved !== null;
|
||||
record._prevRemoved !== null;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
@ -319,9 +321,11 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
removals.push(stringify(record));
|
||||
}
|
||||
|
||||
return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
||||
"additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" +
|
||||
"removals: " + removals.join(', ') + "\n";
|
||||
return 'map: ' + items.join(', ') + '\n' +
|
||||
'previous: ' + previous.join(', ') + '\n' +
|
||||
'additions: ' + additions.join(', ') + '\n' +
|
||||
'changes: ' + changes.join(', ') + '\n' +
|
||||
'removals: ' + removals.join(', ') + '\n';
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
@ -359,8 +363,8 @@ export class KeyValueChangeRecord {
|
||||
|
||||
toString(): string {
|
||||
return looseIdentical(this.previousValue, this.currentValue) ?
|
||||
stringify(this.key) :
|
||||
(stringify(this.key) + '[' + stringify(this.previousValue) + '->' +
|
||||
stringify(this.currentValue) + ']');
|
||||
stringify(this.key) :
|
||||
(stringify(this.key) + '[' + stringify(this.previousValue) + '->' +
|
||||
stringify(this.currentValue) + ']');
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
import {isBlank, isPresent, getTypeNameForDebugging} from '../../facade/lang';
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {OptionalMetadata, Provider, SkipSelfMetadata} from '../../di';
|
||||
import {ListWrapper} from '../../facade/collection';
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {getTypeNameForDebugging, isBlank, isPresent} from '../../facade/lang';
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
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 {
|
||||
|
@ -1,8 +1,9 @@
|
||||
import {isBlank, isPresent} from '../../facade/lang';
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {OptionalMetadata, Provider, SkipSelfMetadata} from '../../di';
|
||||
import {ListWrapper} from '../../facade/collection';
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {isBlank, isPresent} from '../../facade/lang';
|
||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
import {Provider, SkipSelfMetadata, OptionalMetadata} from '../../di';
|
||||
|
||||
|
||||
/**
|
||||
* A differ that tracks changes made to an object over time.
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {print, warn} from './facade/lang';
|
||||
import {Injectable} from './di/decorators';
|
||||
import {print, warn} from './facade/lang';
|
||||
|
||||
|
||||
// Note: Need to rename warn as in Dart
|
||||
// class members and imports can't use the same name.
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Predicate, ListWrapper, MapWrapper} from '../facade/collection';
|
||||
import {Injector} from '../di';
|
||||
import {ListWrapper, MapWrapper, Predicate} from '../facade/collection';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {RenderDebugInfo} from '../render/api';
|
||||
|
||||
export class EventListener { constructor(public name: string, public callback: Function){}; }
|
||||
@ -146,8 +146,8 @@ export function asNativeElements(debugEls: DebugElement[]): any {
|
||||
return debugEls.map((el) => el.nativeElement);
|
||||
}
|
||||
|
||||
function _queryElementChildren(element: DebugElement, predicate: Predicate<DebugElement>,
|
||||
matches: DebugElement[]) {
|
||||
function _queryElementChildren(
|
||||
element: DebugElement, predicate: Predicate<DebugElement>, matches: DebugElement[]) {
|
||||
element.childNodes.forEach(node => {
|
||||
if (node instanceof DebugElement) {
|
||||
if (predicate(node)) {
|
||||
@ -158,8 +158,8 @@ function _queryElementChildren(element: DebugElement, predicate: Predicate<Debug
|
||||
});
|
||||
}
|
||||
|
||||
function _queryNodeChildren(parentNode: DebugNode, predicate: Predicate<DebugNode>,
|
||||
matches: DebugNode[]) {
|
||||
function _queryNodeChildren(
|
||||
parentNode: DebugNode, predicate: Predicate<DebugNode>, matches: DebugNode[]) {
|
||||
if (parentNode instanceof DebugElement) {
|
||||
parentNode.childNodes.forEach(node => {
|
||||
if (predicate(node)) {
|
||||
|
@ -1,19 +1,11 @@
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Renderer, RootRenderer, RenderComponentType, RenderDebugInfo} from '../render/api';
|
||||
import {
|
||||
DebugNode,
|
||||
DebugElement,
|
||||
EventListener,
|
||||
getDebugNode,
|
||||
indexDebugNode,
|
||||
removeDebugNodeFromIndex
|
||||
} from './debug_node';
|
||||
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
|
||||
import {AnimationKeyframe} from '../animation/animation_keyframe';
|
||||
import {AnimationStyles} from '../animation/animation_styles';
|
||||
import {AnimationPlayer} from '../animation/animation_player';
|
||||
import {AnimationStyles} from '../animation/animation_styles';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {RenderComponentType, RenderDebugInfo, Renderer, RootRenderer} from '../render/api';
|
||||
|
||||
import {DebugElement, DebugNode, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from './debug_node';
|
||||
|
||||
export class DebugDomRootRenderer implements RootRenderer {
|
||||
constructor(private _delegate: RootRenderer) {}
|
||||
@ -26,7 +18,7 @@ export class DebugDomRootRenderer implements RootRenderer {
|
||||
export class DebugDomRenderer implements Renderer {
|
||||
constructor(private _delegate: Renderer) {}
|
||||
|
||||
selectRootElement(selectorOrNode: string | any, debugInfo?: RenderDebugInfo): any {
|
||||
selectRootElement(selectorOrNode: string|any, debugInfo?: RenderDebugInfo): any {
|
||||
var nativeEl = this._delegate.selectRootElement(selectorOrNode, debugInfo);
|
||||
var debugEl = new DebugElement(nativeEl, null, debugInfo);
|
||||
indexDebugNode(debugEl);
|
||||
@ -148,7 +140,9 @@ export class DebugDomRenderer implements Renderer {
|
||||
|
||||
setText(renderNode: any, text: string) { this._delegate.setText(renderNode, text); }
|
||||
|
||||
animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string): AnimationPlayer {
|
||||
animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
duration: number, delay: number, easing: string): AnimationPlayer {
|
||||
return this._delegate.animate(element, startingStyles, keyframes, duration, delay, easing);
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,8 @@
|
||||
* The `di` module provides dependency injection container services.
|
||||
*/
|
||||
|
||||
export {
|
||||
InjectMetadata,
|
||||
OptionalMetadata,
|
||||
InjectableMetadata,
|
||||
SelfMetadata,
|
||||
HostMetadata,
|
||||
SkipSelfMetadata
|
||||
} from './di/metadata';
|
||||
export {HostMetadata, InjectMetadata, InjectableMetadata, OptionalMetadata, SelfMetadata, SkipSelfMetadata} from './di/metadata';
|
||||
|
||||
|
||||
// we have to reexport * because Dart and TS export two different sets of types
|
||||
export * from './di/decorators';
|
||||
@ -20,26 +14,8 @@ export {forwardRef, resolveForwardRef, ForwardRefFn} from './di/forward_ref';
|
||||
|
||||
export {Injector} from './di/injector';
|
||||
export {ReflectiveInjector} from './di/reflective_injector';
|
||||
export {
|
||||
Binding,
|
||||
ProviderBuilder,
|
||||
bind,
|
||||
Provider,
|
||||
provide
|
||||
} from './di/provider';
|
||||
export {
|
||||
ResolvedReflectiveBinding,
|
||||
ResolvedReflectiveFactory,
|
||||
ResolvedReflectiveProvider
|
||||
} from './di/reflective_provider';
|
||||
export {Binding, ProviderBuilder, bind, Provider, provide} from './di/provider';
|
||||
export {ResolvedReflectiveBinding, ResolvedReflectiveFactory, ResolvedReflectiveProvider} from './di/reflective_provider';
|
||||
export {ReflectiveKey} from './di/reflective_key';
|
||||
export {
|
||||
NoProviderError,
|
||||
AbstractProviderError,
|
||||
CyclicDependencyError,
|
||||
InstantiationError,
|
||||
InvalidProviderError,
|
||||
NoAnnotationError,
|
||||
OutOfBoundsError
|
||||
} from './di/reflective_exceptions';
|
||||
export {NoProviderError, AbstractProviderError, CyclicDependencyError, InstantiationError, InvalidProviderError, NoAnnotationError, OutOfBoundsError} from './di/reflective_exceptions';
|
||||
export {OpaqueToken} from './di/opaque_token';
|
||||
|
@ -1,13 +1,8 @@
|
||||
import {
|
||||
InjectMetadata,
|
||||
OptionalMetadata,
|
||||
InjectableMetadata,
|
||||
SelfMetadata,
|
||||
HostMetadata,
|
||||
SkipSelfMetadata
|
||||
} from './metadata';
|
||||
import {makeDecorator, makeParamDecorator} from '../util/decorators';
|
||||
|
||||
import {HostMetadata, InjectMetadata, InjectableMetadata, OptionalMetadata, SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||
|
||||
|
||||
/**
|
||||
* Factory for creating {@link InjectMetadata}.
|
||||
* @stable
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Type, stringify, isFunction} from '../facade/lang';
|
||||
import {Type, isFunction, stringify} from '../facade/lang';
|
||||
|
||||
|
||||
/**
|
||||
* An interface that a function passed into {@link forwardRef} has to implement.
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {normalizeBool, Type, isType, isBlank, isFunction, stringify} from '../facade/lang';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {Type, isBlank, isFunction, isType, normalizeBool, stringify} from '../facade/lang';
|
||||
|
||||
|
||||
/**
|
||||
* Describes how the {@link Injector} should instantiate a given token.
|
||||
@ -148,14 +149,15 @@ export class Provider {
|
||||
/** @internal */
|
||||
_multi: boolean;
|
||||
|
||||
constructor(token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}) {
|
||||
constructor(
|
||||
token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}) {
|
||||
this.token = token;
|
||||
this.useClass = useClass;
|
||||
this.useValue = useValue;
|
||||
@ -388,14 +390,15 @@ export class ProviderBuilder {
|
||||
* <!-- TODO: improve the docs -->
|
||||
* @deprecated
|
||||
*/
|
||||
export function provide(token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}): Provider {
|
||||
export function provide(
|
||||
token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}): Provider {
|
||||
return new Provider(token, {
|
||||
useClass: useClass,
|
||||
useValue: useValue,
|
||||
|
@ -1,8 +1,9 @@
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {stringify, isBlank} from '../facade/lang';
|
||||
import {BaseException, WrappedException} from '../facade/exceptions';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
import {isBlank, stringify} from '../facade/lang';
|
||||
|
||||
import {ReflectiveInjector} from './reflective_injector';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
|
||||
function findFirstClosedCycle(keys: any[]): any[] {
|
||||
var res: any[] /** TODO #9100 */ = [];
|
||||
@ -21,9 +22,9 @@ function constructResolvingPath(keys: any[]): string {
|
||||
if (keys.length > 1) {
|
||||
var reversed = findFirstClosedCycle(ListWrapper.reversed(keys));
|
||||
var tokenStrs = reversed.map(k => stringify(k.token));
|
||||
return " (" + tokenStrs.join(' -> ') + ")";
|
||||
return ' (' + tokenStrs.join(' -> ') + ')';
|
||||
} else {
|
||||
return "";
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,9 +46,9 @@ export class AbstractProviderError extends BaseException {
|
||||
/** @internal */
|
||||
constructResolvingMessage: Function;
|
||||
|
||||
constructor(injector: ReflectiveInjector, key: ReflectiveKey,
|
||||
constructResolvingMessage: Function) {
|
||||
super("DI Exception");
|
||||
constructor(
|
||||
injector: ReflectiveInjector, key: ReflectiveKey, constructResolvingMessage: Function) {
|
||||
super('DI Exception');
|
||||
this.keys = [key];
|
||||
this.injectors = [injector];
|
||||
this.constructResolvingMessage = constructResolvingMessage;
|
||||
@ -146,8 +147,10 @@ export class InstantiationError extends WrappedException {
|
||||
/** @internal */
|
||||
injectors: ReflectiveInjector[];
|
||||
|
||||
constructor(injector: ReflectiveInjector, originalException: any /** TODO #9100 */, originalStack: any /** TODO #9100 */, key: ReflectiveKey) {
|
||||
super("DI Exception", originalException, originalStack, null);
|
||||
constructor(
|
||||
injector: ReflectiveInjector, originalException: any /** TODO #9100 */,
|
||||
originalStack: any /** TODO #9100 */, key: ReflectiveKey) {
|
||||
super('DI Exception', originalException, originalStack, null);
|
||||
this.keys = [key];
|
||||
this.injectors = [injector];
|
||||
}
|
||||
@ -228,10 +231,10 @@ export class NoAnnotationError extends BaseException {
|
||||
signature.push(parameter.map(stringify).join(' '));
|
||||
}
|
||||
}
|
||||
return "Cannot resolve all parameters for '" + stringify(typeOrFunc) + "'(" +
|
||||
signature.join(', ') + "). " +
|
||||
"Make sure that all the parameters are decorated with Inject or have valid type annotations and that '" +
|
||||
stringify(typeOrFunc) + "' is decorated with Injectable.";
|
||||
return 'Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
|
||||
signature.join(', ') + '). ' +
|
||||
'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
|
||||
stringify(typeOrFunc) + '\' is decorated with Injectable.';
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,7 +271,8 @@ export class OutOfBoundsError extends BaseException {
|
||||
*/
|
||||
export class MixingMultiProvidersWithRegularProvidersError extends BaseException {
|
||||
constructor(provider1: any /** TODO #9100 */, provider2: any /** TODO #9100 */) {
|
||||
super("Cannot mix multi providers and regular providers, got: " + provider1.toString() + " " +
|
||||
provider2.toString());
|
||||
super(
|
||||
'Cannot mix multi providers and regular providers, got: ' + provider1.toString() + ' ' +
|
||||
provider2.toString());
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,13 @@
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {Provider} from './provider';
|
||||
import {
|
||||
ResolvedReflectiveProvider,
|
||||
ReflectiveDependency,
|
||||
ResolvedReflectiveFactory,
|
||||
resolveReflectiveProviders
|
||||
} from './reflective_provider';
|
||||
import {
|
||||
AbstractProviderError,
|
||||
NoProviderError,
|
||||
CyclicDependencyError,
|
||||
InstantiationError,
|
||||
OutOfBoundsError
|
||||
} from './reflective_exceptions';
|
||||
import {Type} from '../facade/lang';
|
||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
import {SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||
import {Type} from '../facade/lang';
|
||||
|
||||
import {Injector, THROW_IF_NOT_FOUND} from './injector';
|
||||
import {SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||
import {Provider} from './provider';
|
||||
import {AbstractProviderError, CyclicDependencyError, InstantiationError, NoProviderError, OutOfBoundsError} from './reflective_exceptions';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
import {ReflectiveDependency, ResolvedReflectiveFactory, ResolvedReflectiveProvider, resolveReflectiveProviders} from './reflective_provider';
|
||||
|
||||
var __unused: Type; // avoid unused import when Type union types are erased
|
||||
|
||||
@ -154,8 +144,8 @@ export class ReflectiveProtoInjector {
|
||||
constructor(providers: ResolvedReflectiveProvider[]) {
|
||||
this.numberOfProviders = providers.length;
|
||||
this._strategy = providers.length > _MAX_CONSTRUCTION_COUNTER ?
|
||||
new ReflectiveProtoInjectorDynamicStrategy(this, providers) :
|
||||
new ReflectiveProtoInjectorInlineStrategy(this, providers);
|
||||
new ReflectiveProtoInjectorDynamicStrategy(this, providers) :
|
||||
new ReflectiveProtoInjectorInlineStrategy(this, providers);
|
||||
}
|
||||
|
||||
getProviderAtIndex(index: number): ResolvedReflectiveProvider {
|
||||
@ -186,8 +176,9 @@ export class ReflectiveInjectorInlineStrategy implements ReflectiveInjectorStrat
|
||||
obj8: any = UNDEFINED;
|
||||
obj9: any = UNDEFINED;
|
||||
|
||||
constructor(public injector: ReflectiveInjector_,
|
||||
public protoStrategy: ReflectiveProtoInjectorInlineStrategy) {}
|
||||
constructor(
|
||||
public injector: ReflectiveInjector_,
|
||||
public protoStrategy: ReflectiveProtoInjectorInlineStrategy) {}
|
||||
|
||||
resetConstructionCounter(): void { this.injector._constructionCounter = 0; }
|
||||
|
||||
@ -284,8 +275,9 @@ export class ReflectiveInjectorInlineStrategy implements ReflectiveInjectorStrat
|
||||
export class ReflectiveInjectorDynamicStrategy implements ReflectiveInjectorStrategy {
|
||||
objs: any[];
|
||||
|
||||
constructor(public protoStrategy: ReflectiveProtoInjectorDynamicStrategy,
|
||||
public injector: ReflectiveInjector_) {
|
||||
constructor(
|
||||
public protoStrategy: ReflectiveProtoInjectorDynamicStrategy,
|
||||
public injector: ReflectiveInjector_) {
|
||||
this.objs = ListWrapper.createFixedSize(protoStrategy.providers.length);
|
||||
ListWrapper.fill(this.objs, UNDEFINED);
|
||||
}
|
||||
@ -390,7 +382,7 @@ export abstract class ReflectiveInjector implements Injector {
|
||||
*
|
||||
* See {@link ReflectiveInjector#fromResolvedProviders} for more info.
|
||||
*/
|
||||
static resolve(providers: Array<Type | Provider | {[k: string]: any} | any[]>):
|
||||
static resolve(providers: Array<Type|Provider|{[k: string]: any}|any[]>):
|
||||
ResolvedReflectiveProvider[] {
|
||||
return resolveReflectiveProviders(providers);
|
||||
}
|
||||
@ -421,8 +413,9 @@ export abstract class ReflectiveInjector implements Injector {
|
||||
* because it needs to resolve the passed-in providers first.
|
||||
* See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}.
|
||||
*/
|
||||
static resolveAndCreate(providers: Array<Type | Provider | {[k: string]: any} | any[]>,
|
||||
parent: Injector = null): ReflectiveInjector {
|
||||
static resolveAndCreate(
|
||||
providers: Array<Type|Provider|{[k: string]: any}|any[]>,
|
||||
parent: Injector = null): ReflectiveInjector {
|
||||
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
||||
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
||||
}
|
||||
@ -450,10 +443,10 @@ export abstract class ReflectiveInjector implements Injector {
|
||||
* ```
|
||||
* @experimental
|
||||
*/
|
||||
static fromResolvedProviders(providers: ResolvedReflectiveProvider[],
|
||||
parent: Injector = null): ReflectiveInjector {
|
||||
return new ReflectiveInjector_(ReflectiveProtoInjector.fromResolvedProviders(providers),
|
||||
parent);
|
||||
static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent: Injector = null):
|
||||
ReflectiveInjector {
|
||||
return new ReflectiveInjector_(
|
||||
ReflectiveProtoInjector.fromResolvedProviders(providers), parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -513,8 +506,8 @@ export abstract class ReflectiveInjector implements Injector {
|
||||
* because it needs to resolve the passed-in providers first.
|
||||
* See {@link Injector#resolve} and {@link Injector#createChildFromResolved}.
|
||||
*/
|
||||
resolveAndCreateChild(
|
||||
providers: Array<Type | Provider | {[k: string]: any} | any[]>): ReflectiveInjector {
|
||||
resolveAndCreateChild(providers: Array<Type|Provider|{[k: string]: any}|any[]>):
|
||||
ReflectiveInjector {
|
||||
return unimplemented();
|
||||
}
|
||||
|
||||
@ -571,7 +564,7 @@ export abstract class ReflectiveInjector implements Injector {
|
||||
* expect(car).not.toBe(injector.resolveAndInstantiate(Car));
|
||||
* ```
|
||||
*/
|
||||
resolveAndInstantiate(provider: Type | Provider): any { return unimplemented(); }
|
||||
resolveAndInstantiate(provider: Type|Provider): any { return unimplemented(); }
|
||||
|
||||
/**
|
||||
* Instantiates an object using a resolved provider in the context of the injector.
|
||||
@ -613,8 +606,9 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
/**
|
||||
* Private
|
||||
*/
|
||||
constructor(_proto: any /* ProtoInjector */, _parent: Injector = null,
|
||||
private _debugContext: Function = null) {
|
||||
constructor(
|
||||
_proto: any /* ProtoInjector */, _parent: Injector = null,
|
||||
private _debugContext: Function = null) {
|
||||
this._proto = _proto;
|
||||
this._parent = _parent;
|
||||
this._strategy = _proto._strategy.createInjectorStrategy(this);
|
||||
@ -640,7 +634,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
*/
|
||||
get internalStrategy(): any { return this._strategy; }
|
||||
|
||||
resolveAndCreateChild(providers: Array<Type | Provider | any[]>): ReflectiveInjector {
|
||||
resolveAndCreateChild(providers: Array<Type|Provider|any[]>): ReflectiveInjector {
|
||||
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
||||
return this.createChildFromResolved(ResolvedReflectiveProviders);
|
||||
}
|
||||
@ -652,7 +646,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
return inj;
|
||||
}
|
||||
|
||||
resolveAndInstantiate(provider: Type | Provider): any {
|
||||
resolveAndInstantiate(provider: Type|Provider): any {
|
||||
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
||||
}
|
||||
|
||||
@ -680,8 +674,9 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
}
|
||||
}
|
||||
|
||||
private _instantiate(provider: ResolvedReflectiveProvider,
|
||||
ResolvedReflectiveFactory: ResolvedReflectiveFactory): any {
|
||||
private _instantiate(
|
||||
provider: ResolvedReflectiveProvider,
|
||||
ResolvedReflectiveFactory: ResolvedReflectiveFactory): any {
|
||||
var factory = ResolvedReflectiveFactory.factory;
|
||||
var deps = ResolvedReflectiveFactory.dependencies;
|
||||
var length = deps.length;
|
||||
@ -792,16 +787,17 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16);
|
||||
break;
|
||||
case 18:
|
||||
obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16,
|
||||
d17);
|
||||
obj = factory(
|
||||
d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17);
|
||||
break;
|
||||
case 19:
|
||||
obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16,
|
||||
d17, d18);
|
||||
obj = factory(
|
||||
d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18);
|
||||
break;
|
||||
case 20:
|
||||
obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16,
|
||||
d17, d18, d19);
|
||||
obj = factory(
|
||||
d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18,
|
||||
d19);
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(
|
||||
@ -813,14 +809,16 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
return obj;
|
||||
}
|
||||
|
||||
private _getByReflectiveDependency(provider: ResolvedReflectiveProvider,
|
||||
dep: ReflectiveDependency): any {
|
||||
return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility,
|
||||
dep.optional ? null : THROW_IF_NOT_FOUND);
|
||||
private _getByReflectiveDependency(
|
||||
provider: ResolvedReflectiveProvider, dep: ReflectiveDependency): any {
|
||||
return this._getByKey(
|
||||
dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility,
|
||||
dep.optional ? null : THROW_IF_NOT_FOUND);
|
||||
}
|
||||
|
||||
private _getByKey(key: ReflectiveKey, lowerBoundVisibility: Object, upperBoundVisibility: Object,
|
||||
notFoundValue: any): any {
|
||||
private _getByKey(
|
||||
key: ReflectiveKey, lowerBoundVisibility: Object, upperBoundVisibility: Object,
|
||||
notFoundValue: any): any {
|
||||
if (key === INJECTOR_KEY) {
|
||||
return this;
|
||||
}
|
||||
@ -872,7 +870,10 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
}
|
||||
|
||||
get displayName(): string {
|
||||
return `ReflectiveInjector(providers: [${_mapProviders(this, (b: ResolvedReflectiveProvider) => ` "${b.key.displayName}" `).join(", ")}])`;
|
||||
const providers =
|
||||
_mapProviders(this, (b: ResolvedReflectiveProvider) => ' "' + b.key.displayName + '" ')
|
||||
.join(', ');
|
||||
return `ReflectiveInjector(providers: [${providers}])`;
|
||||
}
|
||||
|
||||
toString(): string { return this.displayName; }
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {stringify, isBlank} from '../facade/lang';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {isBlank, stringify} from '../facade/lang';
|
||||
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
|
||||
|
||||
/**
|
||||
* A unique object used for retrieving items from the {@link ReflectiveInjector}.
|
||||
*
|
||||
|
@ -1,25 +1,9 @@
|
||||
import {
|
||||
Type,
|
||||
isBlank,
|
||||
isPresent,
|
||||
isArray,
|
||||
} from '../facade/lang';
|
||||
import {Type, isBlank, isPresent, isArray,} from '../facade/lang';
|
||||
import {MapWrapper, ListWrapper} from '../facade/collection';
|
||||
import {reflector} from '../reflection/reflection';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
import {
|
||||
InjectMetadata,
|
||||
OptionalMetadata,
|
||||
SelfMetadata,
|
||||
HostMetadata,
|
||||
SkipSelfMetadata,
|
||||
DependencyMetadata
|
||||
} from './metadata';
|
||||
import {
|
||||
NoAnnotationError,
|
||||
MixingMultiProvidersWithRegularProvidersError,
|
||||
InvalidProviderError
|
||||
} from './reflective_exceptions';
|
||||
import {InjectMetadata, OptionalMetadata, SelfMetadata, HostMetadata, SkipSelfMetadata, DependencyMetadata} from './metadata';
|
||||
import {NoAnnotationError, MixingMultiProvidersWithRegularProvidersError, InvalidProviderError} from './reflective_exceptions';
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
import {Provider, ProviderBuilder, provide} from './provider';
|
||||
import {isProviderLiteral, createProvider} from './provider_util';
|
||||
@ -29,8 +13,9 @@ import {isProviderLiteral, createProvider} from './provider_util';
|
||||
* This is internal to Angular and should not be used directly.
|
||||
*/
|
||||
export class ReflectiveDependency {
|
||||
constructor(public key: ReflectiveKey, public optional: boolean, public lowerBoundVisibility: any,
|
||||
public upperBoundVisibility: any, public properties: any[]) {}
|
||||
constructor(
|
||||
public key: ReflectiveKey, public optional: boolean, public lowerBoundVisibility: any,
|
||||
public upperBoundVisibility: any, public properties: any[]) {}
|
||||
|
||||
static fromKey(key: ReflectiveKey): ReflectiveDependency {
|
||||
return new ReflectiveDependency(key, false, null, null, []);
|
||||
@ -80,8 +65,9 @@ export interface ResolvedReflectiveProvider {
|
||||
export interface ResolvedReflectiveBinding extends ResolvedReflectiveProvider {}
|
||||
|
||||
export class ResolvedReflectiveProvider_ implements ResolvedReflectiveBinding {
|
||||
constructor(public key: ReflectiveKey, public resolvedFactories: ResolvedReflectiveFactory[],
|
||||
public multiProvider: boolean) {}
|
||||
constructor(
|
||||
public key: ReflectiveKey, public resolvedFactories: ResolvedReflectiveFactory[],
|
||||
public multiProvider: boolean) {}
|
||||
|
||||
get resolvedFactory(): ResolvedReflectiveFactory { return this.resolvedFactories[0]; }
|
||||
}
|
||||
@ -134,15 +120,15 @@ export function resolveReflectiveFactory(provider: Provider): ResolvedReflective
|
||||
* convenience provider syntax.
|
||||
*/
|
||||
export function resolveReflectiveProvider(provider: Provider): ResolvedReflectiveProvider {
|
||||
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.token),
|
||||
[resolveReflectiveFactory(provider)], provider.multi);
|
||||
return new ResolvedReflectiveProvider_(
|
||||
ReflectiveKey.get(provider.token), [resolveReflectiveFactory(provider)], provider.multi);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a list of Providers.
|
||||
*/
|
||||
export function resolveReflectiveProviders(
|
||||
providers: Array<Type | Provider | {[k: string]: any} | any[]>): ResolvedReflectiveProvider[] {
|
||||
providers: Array<Type|Provider|{[k: string]: any}|any[]>): ResolvedReflectiveProvider[] {
|
||||
var normalized = _normalizeProviders(providers, []);
|
||||
var resolved = normalized.map(resolveReflectiveProvider);
|
||||
return MapWrapper.values(
|
||||
@ -187,7 +173,7 @@ export function mergeResolvedReflectiveProviders(
|
||||
}
|
||||
|
||||
function _normalizeProviders(
|
||||
providers: Array<Type | Provider | {[k: string]: any} | ProviderBuilder | any[]>,
|
||||
providers: Array<Type|Provider|{[k: string]: any}|ProviderBuilder|any[]>,
|
||||
res: Provider[]): Provider[] {
|
||||
providers.forEach(b => {
|
||||
if (b instanceof Type) {
|
||||
@ -213,8 +199,8 @@ function _normalizeProviders(
|
||||
return res;
|
||||
}
|
||||
|
||||
export function constructDependencies(typeOrFunc: any,
|
||||
dependencies: any[]): ReflectiveDependency[] {
|
||||
export function constructDependencies(
|
||||
typeOrFunc: any, dependencies: any[]): ReflectiveDependency[] {
|
||||
if (isBlank(dependencies)) {
|
||||
return _dependenciesFor(typeOrFunc);
|
||||
} else {
|
||||
@ -232,8 +218,9 @@ function _dependenciesFor(typeOrFunc: any): ReflectiveDependency[] {
|
||||
return params.map((p: any[]) => _extractToken(typeOrFunc, p, params));
|
||||
}
|
||||
|
||||
function _extractToken(typeOrFunc: any /** TODO #9100 */, metadata: any /** TODO #9100 */ /*any[] | any*/,
|
||||
params: any[][]): ReflectiveDependency {
|
||||
function _extractToken(
|
||||
typeOrFunc: any /** TODO #9100 */, metadata: any /** TODO #9100 */ /*any[] | any*/,
|
||||
params: any[][]): ReflectiveDependency {
|
||||
var depProps: any[] /** TODO #9100 */ = [];
|
||||
var token: any /** TODO #9100 */ = null;
|
||||
var optional = false;
|
||||
@ -287,8 +274,10 @@ function _extractToken(typeOrFunc: any /** TODO #9100 */, metadata: any /** TODO
|
||||
}
|
||||
}
|
||||
|
||||
function _createDependency(token: any /** TODO #9100 */, optional: any /** TODO #9100 */, lowerBoundVisibility: any /** TODO #9100 */, upperBoundVisibility: any /** TODO #9100 */,
|
||||
depProps: any /** TODO #9100 */): ReflectiveDependency {
|
||||
return new ReflectiveDependency(ReflectiveKey.get(token), optional, lowerBoundVisibility,
|
||||
upperBoundVisibility, depProps);
|
||||
function _createDependency(
|
||||
token: any /** TODO #9100 */, optional: any /** TODO #9100 */,
|
||||
lowerBoundVisibility: any /** TODO #9100 */, upperBoundVisibility: any /** TODO #9100 */,
|
||||
depProps: any /** TODO #9100 */): ReflectiveDependency {
|
||||
return new ReflectiveDependency(
|
||||
ReflectiveKey.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps);
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
// Public API for compiler
|
||||
export {ComponentFactory, ComponentRef} from './linker/component_factory';
|
||||
export {ComponentResolver} from './linker/component_resolver';
|
||||
export {SystemJsComponentResolver} from './linker/systemjs_component_resolver';
|
||||
export {QueryList} from './linker/query_list';
|
||||
export {DynamicComponentLoader} from './linker/dynamic_component_loader';
|
||||
export {ElementRef} from './linker/element_ref';
|
||||
export {TemplateRef} from './linker/template_ref';
|
||||
export {EmbeddedViewRef, ViewRef} from './linker/view_ref';
|
||||
export {ViewContainerRef} from './linker/view_container_ref';
|
||||
export {ComponentRef, ComponentFactory} from './linker/component_factory';
|
||||
export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions';
|
||||
export {QueryList} from './linker/query_list';
|
||||
export {SystemJsComponentResolver} from './linker/systemjs_component_resolver';
|
||||
export {TemplateRef} from './linker/template_ref';
|
||||
export {ViewContainerRef} from './linker/view_container_ref';
|
||||
export {EmbeddedViewRef, ViewRef} from './linker/view_ref';
|
||||
|
@ -1,11 +1,13 @@
|
||||
import {Type, isPresent, isBlank} from '../facade/lang';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {ViewRef, ViewRef_} from './view_ref';
|
||||
import {AppElement} from './element';
|
||||
import {ViewUtils} from './view_utils';
|
||||
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
||||
import {Injector} from '../di/injector';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {Type, isBlank, isPresent} from '../facade/lang';
|
||||
|
||||
import {AppElement} from './element';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {ViewRef, ViewRef_} from './view_ref';
|
||||
import {ViewUtils} from './view_utils';
|
||||
|
||||
|
||||
/**
|
||||
* Represents an instance of a Component created via a {@link ComponentFactory}.
|
||||
@ -77,16 +79,17 @@ export class ComponentRef_<C> extends ComponentRef<C> {
|
||||
*/
|
||||
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
|
||||
export class ComponentFactory<C> {
|
||||
constructor(public selector: string, private _viewFactory: Function,
|
||||
private _componentType: Type) {}
|
||||
constructor(
|
||||
public selector: string, private _viewFactory: Function, private _componentType: Type) {}
|
||||
|
||||
get componentType(): Type { return this._componentType; }
|
||||
|
||||
/**
|
||||
* Creates a new component.
|
||||
*/
|
||||
create(injector: Injector, projectableNodes: any[][] = null,
|
||||
rootSelectorOrNode: string | any = null): ComponentRef<C> {
|
||||
create(
|
||||
injector: Injector, projectableNodes: any[][] = null,
|
||||
rootSelectorOrNode: string|any = null): ComponentRef<C> {
|
||||
var vu: ViewUtils = injector.get(ViewUtils);
|
||||
if (isBlank(projectableNodes)) {
|
||||
projectableNodes = [];
|
||||
|
@ -1,9 +1,11 @@
|
||||
import {Type, isBlank, isString, stringify} from '../facade/lang';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {PromiseWrapper} from '../facade/async';
|
||||
import {reflector} from '../reflection/reflection';
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {Injectable} from '../di/decorators';
|
||||
import {PromiseWrapper} from '../facade/async';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {Type, isBlank, isString, stringify} from '../facade/lang';
|
||||
import {reflector} from '../reflection/reflection';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
|
||||
|
||||
/**
|
||||
* Low-level service for loading {@link ComponentFactory}s, which
|
||||
@ -23,7 +25,8 @@ function _isComponentFactory(type: any): boolean {
|
||||
export class ReflectorComponentResolver extends ComponentResolver {
|
||||
resolveComponent(component: Type|string): Promise<ComponentFactory<any>> {
|
||||
if (isString(component)) {
|
||||
return PromiseWrapper.reject(new BaseException(`Cannot resolve component using '${component}'.`), null);
|
||||
return PromiseWrapper.reject(
|
||||
new BaseException(`Cannot resolve component using '${component}'.`), null);
|
||||
}
|
||||
|
||||
var metadatas = reflector.annotations(<Type>component);
|
||||
|
@ -1,19 +1,23 @@
|
||||
import {isPresent, isBlank} from '../facade/lang';
|
||||
import {ListWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {Injector} from '../di';
|
||||
import {ViewType} from './view_type';
|
||||
import {ListWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {RenderDebugInfo} from '../render/api';
|
||||
|
||||
import {DebugAppView} from './view';
|
||||
import {ViewType} from './view_type';
|
||||
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class StaticNodeDebugInfo {
|
||||
constructor(public providerTokens: any[], public componentToken: any,
|
||||
public refTokens: {[key: string]: any}) {}
|
||||
constructor(
|
||||
public providerTokens: any[], public componentToken: any,
|
||||
public refTokens: {[key: string]: any}) {}
|
||||
}
|
||||
|
||||
export class DebugContext implements RenderDebugInfo {
|
||||
constructor(private _view: DebugAppView<any>, private _nodeIndex: number, private _tplRow: number,
|
||||
private _tplCol: number) {}
|
||||
constructor(
|
||||
private _view: DebugAppView<any>, private _nodeIndex: number, private _tplRow: number,
|
||||
private _tplCol: number) {}
|
||||
|
||||
private get _staticNodeInfo(): StaticNodeDebugInfo {
|
||||
return isPresent(this._nodeIndex) ? this._view.staticNodeDebugInfos[this._nodeIndex] : null;
|
||||
@ -34,8 +38,8 @@ export class DebugContext implements RenderDebugInfo {
|
||||
componentView = <DebugAppView<any>>componentView.declarationAppElement.parentView;
|
||||
}
|
||||
return isPresent(componentView.declarationAppElement) ?
|
||||
componentView.declarationAppElement.nativeElement :
|
||||
null;
|
||||
componentView.declarationAppElement.nativeElement :
|
||||
null;
|
||||
}
|
||||
get injector(): Injector { return this._view.injector(this._nodeIndex); }
|
||||
get renderNode(): any {
|
||||
@ -57,15 +61,17 @@ export class DebugContext implements RenderDebugInfo {
|
||||
var staticNodeInfo = this._staticNodeInfo;
|
||||
if (isPresent(staticNodeInfo)) {
|
||||
var refs = staticNodeInfo.refTokens;
|
||||
StringMapWrapper.forEach(refs, (refToken: any /** TODO #9100 */, refName: any /** TODO #9100 */) => {
|
||||
var varValue: any /** TODO #9100 */;
|
||||
if (isBlank(refToken)) {
|
||||
varValue = isPresent(this._view.allNodes) ? this._view.allNodes[this._nodeIndex] : null;
|
||||
} else {
|
||||
varValue = this._view.injectorGet(refToken, this._nodeIndex, null);
|
||||
}
|
||||
varValues[refName] = varValue;
|
||||
});
|
||||
StringMapWrapper.forEach(
|
||||
refs, (refToken: any /** TODO #9100 */, refName: any /** TODO #9100 */) => {
|
||||
var varValue: any /** TODO #9100 */;
|
||||
if (isBlank(refToken)) {
|
||||
varValue =
|
||||
isPresent(this._view.allNodes) ? this._view.allNodes[this._nodeIndex] : null;
|
||||
} else {
|
||||
varValue = this._view.injectorGet(refToken, this._nodeIndex, null);
|
||||
}
|
||||
varValues[refName] = varValue;
|
||||
});
|
||||
}
|
||||
return varValues;
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
import {Type, isPresent} from '../facade/lang';
|
||||
import {ComponentRef} from './component_factory';
|
||||
import {ViewContainerRef} from './view_container_ref';
|
||||
import {ResolvedReflectiveProvider} from '../di/reflective_provider';
|
||||
import {ReflectiveInjector} from '../di/reflective_injector';
|
||||
import {Injectable} from '../di/decorators';
|
||||
import {Injector} from '../di/injector';
|
||||
import {ReflectiveInjector} from '../di/reflective_injector';
|
||||
import {ResolvedReflectiveProvider} from '../di/reflective_provider';
|
||||
import {Type, isPresent} from '../facade/lang';
|
||||
|
||||
import {ComponentRef} from './component_factory';
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
import {ViewContainerRef} from './view_container_ref';
|
||||
|
||||
|
||||
/**
|
||||
* Use ComponentResolver and ViewContainerRef directly.
|
||||
@ -61,9 +63,9 @@ export abstract class DynamicComponentLoader {
|
||||
* </my-app>
|
||||
* ```
|
||||
*/
|
||||
abstract loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector,
|
||||
onDispose?: () => void,
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
abstract loadAsRoot(
|
||||
type: Type, overrideSelectorOrNode: string|any, injector: Injector, onDispose?: () => void,
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
|
||||
|
||||
/**
|
||||
@ -106,17 +108,18 @@ export abstract class DynamicComponentLoader {
|
||||
* <child-component>Child</child-component>
|
||||
* ```
|
||||
*/
|
||||
abstract loadNextToLocation(type: Type, location: ViewContainerRef,
|
||||
providers?: ResolvedReflectiveProvider[],
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
abstract loadNextToLocation(
|
||||
type: Type, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[],
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
||||
constructor(private _compiler: ComponentResolver) { super(); }
|
||||
|
||||
loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector,
|
||||
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>> {
|
||||
loadAsRoot(
|
||||
type: Type, overrideSelectorOrNode: string|any, injector: Injector, onDispose?: () => void,
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>> {
|
||||
return this._compiler.resolveComponent(type).then(componentFactory => {
|
||||
var componentRef = componentFactory.create(
|
||||
injector, projectableNodes,
|
||||
@ -128,16 +131,16 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
||||
});
|
||||
}
|
||||
|
||||
loadNextToLocation(type: Type, location: ViewContainerRef,
|
||||
providers: ResolvedReflectiveProvider[] = null,
|
||||
projectableNodes: any[][] = null): Promise<ComponentRef<any>> {
|
||||
loadNextToLocation(
|
||||
type: Type, location: ViewContainerRef, providers: ResolvedReflectiveProvider[] = null,
|
||||
projectableNodes: any[][] = null): Promise<ComponentRef<any>> {
|
||||
return this._compiler.resolveComponent(type).then(componentFactory => {
|
||||
var contextInjector = location.parentInjector;
|
||||
var childInjector = isPresent(providers) && providers.length > 0 ?
|
||||
ReflectiveInjector.fromResolvedProviders(providers, contextInjector) :
|
||||
contextInjector;
|
||||
return location.createComponent(componentFactory, location.length, childInjector,
|
||||
projectableNodes);
|
||||
ReflectiveInjector.fromResolvedProviders(providers, contextInjector) :
|
||||
contextInjector;
|
||||
return location.createComponent(
|
||||
componentFactory, location.length, childInjector, projectableNodes);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,14 @@
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Injector} from '../di/injector';
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {isPresent} from '../facade/lang';
|
||||
|
||||
import {AppView} from './view';
|
||||
import {ViewType} from './view_type';
|
||||
import {ElementRef} from './element_ref';
|
||||
|
||||
import {ViewContainerRef_} from './view_container_ref';
|
||||
|
||||
import {QueryList} from './query_list';
|
||||
import {Injector} from '../di/injector';
|
||||
import {AppView} from './view';
|
||||
import {ViewContainerRef_} from './view_container_ref';
|
||||
import {ViewType} from './view_type';
|
||||
|
||||
|
||||
/**
|
||||
* An AppElement is created for elements that have a ViewContainerRef,
|
||||
@ -23,15 +22,16 @@ export class AppElement {
|
||||
public component: any;
|
||||
public componentConstructorViewQueries: QueryList<any>[];
|
||||
|
||||
constructor(public index: number, public parentIndex: number, public parentView: AppView<any>,
|
||||
public nativeElement: any) {}
|
||||
constructor(
|
||||
public index: number, public parentIndex: number, public parentView: AppView<any>,
|
||||
public nativeElement: any) {}
|
||||
|
||||
get elementRef(): ElementRef { return new ElementRef(this.nativeElement); }
|
||||
|
||||
get vcRef(): ViewContainerRef_ { return new ViewContainerRef_(this); }
|
||||
|
||||
initComponent(component: any, componentConstructorViewQueries: QueryList<any>[],
|
||||
view: AppView<any>) {
|
||||
initComponent(
|
||||
component: any, componentConstructorViewQueries: QueryList<any>[], view: AppView<any>) {
|
||||
this.component = component;
|
||||
this.componentConstructorViewQueries = componentConstructorViewQueries;
|
||||
this.componentView = view;
|
||||
|
@ -36,8 +36,9 @@ import {BaseException, WrappedException} from '../facade/exceptions';
|
||||
*/
|
||||
export class ExpressionChangedAfterItHasBeenCheckedException extends BaseException {
|
||||
constructor(oldValue: any, currValue: any, context: any) {
|
||||
super(`Expression has changed after it was checked. ` +
|
||||
`Previous value: '${oldValue}'. Current value: '${currValue}'`);
|
||||
super(
|
||||
`Expression has changed after it was checked. ` +
|
||||
`Previous value: '${oldValue}'. Current value: '${currValue}'`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {EventEmitter, Observable} from '../facade/async';
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {getSymbolIterator} from '../facade/lang';
|
||||
import {Observable, EventEmitter} from '../facade/async';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -61,14 +62,16 @@ export class QueryList<T> {
|
||||
*/
|
||||
toArray(): T[] { return ListWrapper.clone(this._results); }
|
||||
|
||||
[getSymbolIterator()](): any { return (this._results as any /** TODO #???? */)[getSymbolIterator()](); }
|
||||
[getSymbolIterator()](): any {
|
||||
return (this._results as any /** TODO #???? */)[getSymbolIterator()]();
|
||||
}
|
||||
|
||||
toString(): string { return this._results.toString(); }
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
reset(res: Array<T | any[]>): void {
|
||||
reset(res: Array<T|any[]>): void {
|
||||
this._results = ListWrapper.flatten(res);
|
||||
this._dirty = false;
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { ComponentResolver } from './component_resolver';
|
||||
import { Type, isString, global } from '../facade/lang';
|
||||
import { ComponentFactory } from './component_factory';
|
||||
import {Type, global, isString} from '../facade/lang';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
|
||||
|
||||
/**
|
||||
* Component resolver that can load components lazily
|
||||
@ -9,10 +11,11 @@ import { ComponentFactory } from './component_factory';
|
||||
export class SystemJsComponentResolver implements ComponentResolver {
|
||||
constructor(private _resolver: ComponentResolver) {}
|
||||
|
||||
resolveComponent(componentType:string|Type):Promise<ComponentFactory<any>> {
|
||||
resolveComponent(componentType: string|Type): Promise<ComponentFactory<any>> {
|
||||
if (isString(componentType)) {
|
||||
return (<any>global).System.import(componentType).then((module: any /** TODO #9100 */) =>
|
||||
this._resolver.resolveComponent(module.default));
|
||||
return (<any>global)
|
||||
.System.import(componentType)
|
||||
.then((module: any /** TODO #9100 */) => this._resolver.resolveComponent(module.default));
|
||||
} else {
|
||||
return this._resolver.resolveComponent(<Type>componentType);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {isBlank} from '../facade/lang';
|
||||
import {ElementRef} from './element_ref';
|
||||
|
||||
import {AppElement} from './element';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {AppView} from './view';
|
||||
import {EmbeddedViewRef} from './view_ref';
|
||||
|
||||
@ -41,8 +42,8 @@ export class TemplateRef_<C> extends TemplateRef<C> {
|
||||
constructor(private _appElement: AppElement, private _viewFactory: Function) { super(); }
|
||||
|
||||
createEmbeddedView(context: C): EmbeddedViewRef<C> {
|
||||
var view: AppView<C> = this._viewFactory(this._appElement.parentView.viewUtils,
|
||||
this._appElement.parentInjector, this._appElement);
|
||||
var view: AppView<C> = this._viewFactory(
|
||||
this._appElement.parentView.viewUtils, this._appElement.parentInjector, this._appElement);
|
||||
if (isBlank(context)) {
|
||||
context = <any>EMPTY_CONTEXT;
|
||||
}
|
||||
|
@ -1,46 +1,16 @@
|
||||
import {
|
||||
ListWrapper,
|
||||
StringMapWrapper,
|
||||
Map,
|
||||
MapWrapper
|
||||
} from '../facade/collection';
|
||||
import {ObservableWrapper} from '../facade/async';
|
||||
import {ListWrapper, Map, MapWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {Type, assertionsEnabled, isArray, isBlank, isNumber, isPresent, isPrimitive, isString, stringify} from '../facade/lang';
|
||||
import {RenderComponentType, RenderDebugInfo, Renderer, RootRenderer} from '../render/api';
|
||||
|
||||
import {AppElement} from './element';
|
||||
import {
|
||||
assertionsEnabled,
|
||||
isPresent,
|
||||
isBlank,
|
||||
Type,
|
||||
isArray,
|
||||
isNumber,
|
||||
stringify,
|
||||
isPrimitive,
|
||||
isString
|
||||
} from '../facade/lang';
|
||||
|
||||
import {ObservableWrapper} from '../facade/async';
|
||||
import {Renderer, RootRenderer, RenderComponentType, RenderDebugInfo} from '../render/api';
|
||||
import {ViewRef_} from './view_ref';
|
||||
|
||||
import {ViewType} from './view_type';
|
||||
import {
|
||||
ViewUtils,
|
||||
flattenNestedViewRenderNodes,
|
||||
ensureSlotCount,
|
||||
arrayLooseIdentical,
|
||||
mapLooseIdentical
|
||||
} from './view_utils';
|
||||
import {
|
||||
ChangeDetectorRef,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorState,
|
||||
} from '../change_detection/change_detection';
|
||||
import {ViewUtils, arrayLooseIdentical, ensureSlotCount, flattenNestedViewRenderNodes, mapLooseIdentical} from './view_utils';
|
||||
|
||||
import {ChangeDetectorRef, ChangeDetectionStrategy, ChangeDetectorState,} from '../change_detection/change_detection';
|
||||
import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile';
|
||||
import {
|
||||
ExpressionChangedAfterItHasBeenCheckedException,
|
||||
ViewDestroyedException,
|
||||
ViewWrappedException
|
||||
} from './exceptions';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedException, ViewDestroyedException, ViewWrappedException} from './exceptions';
|
||||
import {StaticNodeDebugInfo, DebugContext} from './debug_context';
|
||||
import {ElementInjector} from './element_injector';
|
||||
import {Injector} from '../di/injector';
|
||||
@ -73,7 +43,7 @@ export abstract class AppView<T> {
|
||||
// change detection will fail.
|
||||
cdState: ChangeDetectorState = ChangeDetectorState.NeverChecked;
|
||||
|
||||
projectableNodes: Array<any | any[]>;
|
||||
projectableNodes: Array<any|any[]>;
|
||||
|
||||
destroyed: boolean = false;
|
||||
|
||||
@ -85,9 +55,10 @@ export abstract class AppView<T> {
|
||||
|
||||
public context: T;
|
||||
|
||||
constructor(public clazz: any, public componentType: RenderComponentType, public type: ViewType,
|
||||
public viewUtils: ViewUtils, public parentInjector: Injector,
|
||||
public declarationAppElement: AppElement, public cdMode: ChangeDetectionStrategy) {
|
||||
constructor(
|
||||
public clazz: any, public componentType: RenderComponentType, public type: ViewType,
|
||||
public viewUtils: ViewUtils, public parentInjector: Injector,
|
||||
public declarationAppElement: AppElement, public cdMode: ChangeDetectionStrategy) {
|
||||
this.ref = new ViewRef_(this);
|
||||
if (type === ViewType.COMPONENT || type === ViewType.HOST) {
|
||||
this.renderer = viewUtils.renderComponent(componentType);
|
||||
@ -98,7 +69,8 @@ export abstract class AppView<T> {
|
||||
|
||||
cancelActiveAnimation(element: any, animationName: string, removeAllAnimations: boolean = false) {
|
||||
if (removeAllAnimations) {
|
||||
this.activeAnimationPlayers.findAllPlayersByElement(element).forEach(player => player.destroy());
|
||||
this.activeAnimationPlayers.findAllPlayersByElement(element).forEach(
|
||||
player => player.destroy());
|
||||
} else {
|
||||
var player = this.activeAnimationPlayers.find(element, animationName);
|
||||
if (isPresent(player)) {
|
||||
@ -109,14 +81,12 @@ export abstract class AppView<T> {
|
||||
|
||||
registerAndStartAnimation(element: any, animationName: string, player: AnimationPlayer): void {
|
||||
this.activeAnimationPlayers.set(element, animationName, player);
|
||||
player.onDone(() => {
|
||||
this.activeAnimationPlayers.remove(element, animationName);
|
||||
});
|
||||
player.onDone(() => { this.activeAnimationPlayers.remove(element, animationName); });
|
||||
player.play();
|
||||
}
|
||||
|
||||
create(context: T, givenProjectableNodes: Array<any | any[]>,
|
||||
rootSelectorOrNode: string | any): AppElement {
|
||||
create(context: T, givenProjectableNodes: Array<any|any[]>, rootSelectorOrNode: string|any):
|
||||
AppElement {
|
||||
this.context = context;
|
||||
var projectableNodes: any /** TODO #9100 */;
|
||||
switch (this.type) {
|
||||
@ -141,10 +111,11 @@ export abstract class AppView<T> {
|
||||
* Overwritten by implementations.
|
||||
* Returns the AppElement for the host element for ViewType.HOST.
|
||||
*/
|
||||
createInternal(rootSelectorOrNode: string | any): AppElement { return null; }
|
||||
createInternal(rootSelectorOrNode: string|any): AppElement { return null; }
|
||||
|
||||
init(rootNodesOrAppElements: any[], allNodes: any[], disposables: Function[],
|
||||
subscriptions: any[]) {
|
||||
init(
|
||||
rootNodesOrAppElements: any[], allNodes: any[], disposables: Function[],
|
||||
subscriptions: any[]) {
|
||||
this.rootNodesOrAppElements = rootNodesOrAppElements;
|
||||
this.allNodes = allNodes;
|
||||
this.disposables = disposables;
|
||||
@ -157,8 +128,8 @@ export abstract class AppView<T> {
|
||||
}
|
||||
}
|
||||
|
||||
selectOrCreateHostElement(elementName: string, rootSelectorOrNode: string | any,
|
||||
debugInfo: RenderDebugInfo): any {
|
||||
selectOrCreateHostElement(
|
||||
elementName: string, rootSelectorOrNode: string|any, debugInfo: RenderDebugInfo): any {
|
||||
var hostElement: any /** TODO #9100 */;
|
||||
if (isPresent(rootSelectorOrNode)) {
|
||||
hostElement = this.renderer.selectRootElement(rootSelectorOrNode, debugInfo);
|
||||
@ -229,9 +200,7 @@ export abstract class AppView<T> {
|
||||
this.renderer.destroyView(hostElement, this.allNodes);
|
||||
} else {
|
||||
var player = new AnimationGroupPlayer(this.activeAnimationPlayers.getAllPlayers());
|
||||
player.onDone(() => {
|
||||
this.renderer.destroyView(hostElement, this.allNodes);
|
||||
});
|
||||
player.onDone(() => { this.renderer.destroyView(hostElement, this.allNodes); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,9 +220,7 @@ export abstract class AppView<T> {
|
||||
this.renderer.detachView(this.flatRootNodes);
|
||||
} else {
|
||||
var player = new AnimationGroupPlayer(this.activeAnimationPlayers.getAllPlayers());
|
||||
player.onDone(() => {
|
||||
this.renderer.detachView(this.flatRootNodes);
|
||||
});
|
||||
player.onDone(() => { this.renderer.detachView(this.flatRootNodes); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,8 +234,8 @@ export abstract class AppView<T> {
|
||||
|
||||
get lastRootNode(): any {
|
||||
var lastNode = this.rootNodesOrAppElements.length > 0 ?
|
||||
this.rootNodesOrAppElements[this.rootNodesOrAppElements.length - 1] :
|
||||
null;
|
||||
this.rootNodesOrAppElements[this.rootNodesOrAppElements.length - 1] :
|
||||
null;
|
||||
return _findLastRenderNode(lastNode);
|
||||
}
|
||||
|
||||
@ -351,14 +318,15 @@ export abstract class AppView<T> {
|
||||
export class DebugAppView<T> extends AppView<T> {
|
||||
private _currentDebugContext: DebugContext = null;
|
||||
|
||||
constructor(clazz: any, componentType: RenderComponentType, type: ViewType, viewUtils: ViewUtils,
|
||||
parentInjector: Injector, declarationAppElement: AppElement,
|
||||
cdMode: ChangeDetectionStrategy, public staticNodeDebugInfos: StaticNodeDebugInfo[]) {
|
||||
constructor(
|
||||
clazz: any, componentType: RenderComponentType, type: ViewType, viewUtils: ViewUtils,
|
||||
parentInjector: Injector, declarationAppElement: AppElement, cdMode: ChangeDetectionStrategy,
|
||||
public staticNodeDebugInfos: StaticNodeDebugInfo[]) {
|
||||
super(clazz, componentType, type, viewUtils, parentInjector, declarationAppElement, cdMode);
|
||||
}
|
||||
|
||||
create(context: T, givenProjectableNodes: Array<any | any[]>,
|
||||
rootSelectorOrNode: string | any): AppElement {
|
||||
create(context: T, givenProjectableNodes: Array<any|any[]>, rootSelectorOrNode: string|any):
|
||||
AppElement {
|
||||
this._resetDebug();
|
||||
try {
|
||||
return super.create(context, givenProjectableNodes, rootSelectorOrNode);
|
||||
|
@ -1,15 +1,15 @@
|
||||
import {Injector} from '../di/injector';
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {Injector} from '../di/injector';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile';
|
||||
import {WtfScopeFn, wtfCreateScope, wtfLeave} from '../profile/profile';
|
||||
|
||||
import {ComponentFactory, ComponentRef} from './component_factory';
|
||||
import {AppElement} from './element';
|
||||
|
||||
import {ElementRef} from './element_ref';
|
||||
import {TemplateRef} from './template_ref';
|
||||
import {EmbeddedViewRef, ViewRef, ViewRef_} from './view_ref';
|
||||
import {ComponentFactory, ComponentRef} from './component_factory';
|
||||
|
||||
|
||||
/**
|
||||
* Represents a container where one or more Views can be attached.
|
||||
@ -63,8 +63,8 @@ export abstract class ViewContainerRef {
|
||||
*
|
||||
* Returns the {@link ViewRef} for the newly created View.
|
||||
*/
|
||||
abstract createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C,
|
||||
index?: number): EmbeddedViewRef<C>;
|
||||
abstract createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C, index?: number):
|
||||
EmbeddedViewRef<C>;
|
||||
|
||||
/**
|
||||
* Instantiates a single {@link Component} and inserts its Host View into this container at the
|
||||
@ -79,8 +79,9 @@ export abstract class ViewContainerRef {
|
||||
*
|
||||
* Returns the {@link ComponentRef} of the Host View created for the newly instantiated Component.
|
||||
*/
|
||||
abstract createComponent<C>(componentFactory: ComponentFactory<C>, index?: number,
|
||||
injector?: Injector, projectableNodes?: any[][]): ComponentRef<C>;
|
||||
abstract createComponent<C>(
|
||||
componentFactory: ComponentFactory<C>, index?: number, injector?: Injector,
|
||||
projectableNodes?: any[][]): ComponentRef<C>;
|
||||
|
||||
/**
|
||||
* Inserts a View identified by a {@link ViewRef} into the container at the specified `index`.
|
||||
@ -129,8 +130,8 @@ export class ViewContainerRef_ implements ViewContainerRef {
|
||||
|
||||
// TODO(rado): profile and decide whether bounds checks should be added
|
||||
// to the methods below.
|
||||
createEmbeddedView<C>(templateRef: TemplateRef<C>, context: C = null,
|
||||
index: number = -1): EmbeddedViewRef<C> {
|
||||
createEmbeddedView<C>(templateRef: TemplateRef<C>, context: C = null, index: number = -1):
|
||||
EmbeddedViewRef<C> {
|
||||
var viewRef: EmbeddedViewRef<any> = templateRef.createEmbeddedView(context);
|
||||
this.insert(viewRef, index);
|
||||
return viewRef;
|
||||
@ -140,8 +141,9 @@ export class ViewContainerRef_ implements ViewContainerRef {
|
||||
_createComponentInContainerScope: WtfScopeFn =
|
||||
wtfCreateScope('ViewContainerRef#createComponent()');
|
||||
|
||||
createComponent<C>(componentFactory: ComponentFactory<C>, index: number = -1,
|
||||
injector: Injector = null, projectableNodes: any[][] = null): ComponentRef<C> {
|
||||
createComponent<C>(
|
||||
componentFactory: ComponentFactory<C>, index: number = -1, injector: Injector = null,
|
||||
projectableNodes: any[][] = null): ComponentRef<C> {
|
||||
var s = this._createComponentInContainerScope();
|
||||
var contextInjector = isPresent(injector) ? injector : this._element.parentInjector;
|
||||
var componentRef = componentFactory.create(contextInjector, projectableNodes);
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||
import {AppView} from './view';
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
|
||||
import {AppView} from './view';
|
||||
|
||||
|
||||
/**
|
||||
* @stable
|
||||
|
@ -1,34 +1,36 @@
|
||||
import {SanitizationService} from '../security';
|
||||
import {isBlank, isPresent, looseIdentical} from '../facade/lang';
|
||||
import {APP_ID} from '../application_tokens';
|
||||
import {devModeEqual} from '../change_detection/change_detection';
|
||||
import {uninitialized} from '../change_detection/change_detection_util';
|
||||
import {Inject, Injectable} from '../di/decorators';
|
||||
import {ListWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {isBlank, isPresent, looseIdentical} from '../facade/lang';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {RenderComponentType, Renderer, RootRenderer} from '../render/api';
|
||||
import {SanitizationService} from '../security';
|
||||
|
||||
import {AppElement} from './element';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedException} from './exceptions';
|
||||
import {devModeEqual} from '../change_detection/change_detection';
|
||||
import {RootRenderer, RenderComponentType, Renderer} from '../render/api';
|
||||
import {APP_ID} from '../application_tokens';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {Injectable, Inject} from '../di/decorators';
|
||||
import {uninitialized} from "../change_detection/change_detection_util";
|
||||
|
||||
@Injectable()
|
||||
export class ViewUtils {
|
||||
sanitizer: SanitizationService;
|
||||
private _nextCompTypeId: number = 0;
|
||||
|
||||
constructor(private _renderer: RootRenderer, @Inject(APP_ID) private _appId: string,
|
||||
sanitizer: SanitizationService) {
|
||||
constructor(
|
||||
private _renderer: RootRenderer, @Inject(APP_ID) private _appId: string,
|
||||
sanitizer: SanitizationService) {
|
||||
this.sanitizer = sanitizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the generated code
|
||||
*/
|
||||
createRenderComponentType(templateUrl: string, slotCount: number,
|
||||
encapsulation: ViewEncapsulation,
|
||||
styles: Array<string | any[]>): RenderComponentType {
|
||||
return new RenderComponentType(`${this._appId}-${this._nextCompTypeId++}`, templateUrl,
|
||||
slotCount, encapsulation, styles);
|
||||
createRenderComponentType(
|
||||
templateUrl: string, slotCount: number, encapsulation: ViewEncapsulation,
|
||||
styles: Array<string|any[]>): RenderComponentType {
|
||||
return new RenderComponentType(
|
||||
`${this._appId}-${this._nextCompTypeId++}`, templateUrl, slotCount, encapsulation, styles);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
@ -79,10 +81,10 @@ export function ensureSlotCount(projectableNodes: any[][], expectedSlotCount: nu
|
||||
|
||||
export const MAX_INTERPOLATION_VALUES = 9;
|
||||
|
||||
export function interpolate(valueCount: number, c0: string, a1: any, c1: string, a2?: any,
|
||||
c2?: string, a3?: any, c3?: string, a4?: any, c4?: string, a5?: any,
|
||||
c5?: string, a6?: any, c6?: string, a7?: any, c7?: string, a8?: any,
|
||||
c8?: string, a9?: any, c9?: string): string {
|
||||
export function interpolate(
|
||||
valueCount: number, c0: string, a1: any, c1: string, a2?: any, c2?: string, a3?: any,
|
||||
c3?: string, a4?: any, c4?: string, a5?: any, c5?: string, a6?: any, c6?: string, a7?: any,
|
||||
c7?: string, a8?: any, c8?: string, a9?: any, c9?: string): string {
|
||||
switch (valueCount) {
|
||||
case 1:
|
||||
return c0 + _toStringWithNull(a1) + c1;
|
||||
@ -90,30 +92,28 @@ export function interpolate(valueCount: number, c0: string, a1: any, c1: string,
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
|
||||
case 3:
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
||||
c3;
|
||||
c3;
|
||||
case 4:
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
||||
c3 + _toStringWithNull(a4) + c4;
|
||||
c3 + _toStringWithNull(a4) + c4;
|
||||
case 5:
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
|
||||
case 6:
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
||||
c6;
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
|
||||
case 7:
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
||||
c6 + _toStringWithNull(a7) + c7;
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
||||
c6 + _toStringWithNull(a7) + c7;
|
||||
case 8:
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
||||
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
||||
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
|
||||
case 9:
|
||||
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
||||
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) +
|
||||
c9;
|
||||
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
||||
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
|
||||
default:
|
||||
throw new BaseException(`Does not support more than 9 expressions`);
|
||||
}
|
||||
@ -192,8 +192,8 @@ export function pureProxy2<P0, P1, R>(fn: (p0: P0, p1: P1) => R): (p0: P0, p1: P
|
||||
};
|
||||
}
|
||||
|
||||
export function pureProxy3<P0, P1, P2, R>(fn: (p0: P0, p1: P1, p2: P2) => R): (p0: P0, p1: P1,
|
||||
p2: P2) => R {
|
||||
export function pureProxy3<P0, P1, P2, R>(fn: (p0: P0, p1: P1, p2: P2) => R): (
|
||||
p0: P0, p1: P1, p2: P2) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = uninitialized;
|
||||
@ -211,7 +211,8 @@ export function pureProxy3<P0, P1, P2, R>(fn: (p0: P0, p1: P1, p2: P2) => R): (p
|
||||
export function pureProxy4<P0, P1, P2, P3, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3) => R): (
|
||||
p0: P0, p1: P1, p2: P2, p3: P3) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, v3: any /** TODO #9100 */;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = v3 = uninitialized;
|
||||
return (p0, p1, p2, p3) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
@ -230,7 +231,8 @@ export function pureProxy5<P0, P1, P2, P3, P4, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) =>
|
||||
R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, v3: any /** TODO #9100 */, v4: any /** TODO #9100 */;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = v3 = v4 = uninitialized;
|
||||
return (p0, p1, p2, p3, p4) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
@ -248,10 +250,11 @@ export function pureProxy5<P0, P1, P2, P3, P4, R>(
|
||||
|
||||
|
||||
export function pureProxy6<P0, P1, P2, P3, P4, P5, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p0: P0, p1: P1, p2: P2, p3: P3,
|
||||
p4: P4, p5: P5) => R {
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = uninitialized;
|
||||
return (p0, p1, p2, p3, p4, p5) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
@ -272,7 +275,9 @@ export function pureProxy7<P0, P1, P2, P3, P4, P5, P6, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, v6: any /** TODO #9100 */;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = uninitialized;
|
||||
return (p0, p1, p2, p3, p4, p5, p6) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
@ -295,7 +300,9 @@ export function pureProxy8<P0, P1, P2, P3, P4, P5, P6, P7, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, v6: any /** TODO #9100 */, v7: any /** TODO #9100 */;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */, v7: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = uninitialized;
|
||||
return (p0, p1, p2, p3, p4, p5, p6, p7) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
@ -319,7 +326,9 @@ export function pureProxy9<P0, P1, P2, P3, P4, P5, P6, P7, P8, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = uninitialized;
|
||||
return (p0, p1, p2, p3, p4, p5, p6, p7, p8) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
@ -344,7 +353,10 @@ export function pureProxy10<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, R>(
|
||||
fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) =>
|
||||
R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) => R {
|
||||
var result: R;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */, v9: any /** TODO #9100 */;
|
||||
var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */,
|
||||
v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */,
|
||||
v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */,
|
||||
v9: any /** TODO #9100 */;
|
||||
v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = uninitialized;
|
||||
return (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) => {
|
||||
if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
|
||||
|
@ -3,69 +3,19 @@
|
||||
* to be used by the decorator versions of these annotations.
|
||||
*/
|
||||
|
||||
export {
|
||||
QueryMetadata,
|
||||
ContentChildrenMetadata,
|
||||
ContentChildMetadata,
|
||||
ViewChildrenMetadata,
|
||||
ViewQueryMetadata,
|
||||
ViewChildMetadata,
|
||||
AttributeMetadata
|
||||
} from './metadata/di';
|
||||
|
||||
export {
|
||||
ComponentMetadata,
|
||||
DirectiveMetadata,
|
||||
PipeMetadata,
|
||||
InputMetadata,
|
||||
OutputMetadata,
|
||||
HostBindingMetadata,
|
||||
HostListenerMetadata
|
||||
} from './metadata/directives';
|
||||
|
||||
export {ViewMetadata, ViewEncapsulation} from './metadata/view';
|
||||
|
||||
export {
|
||||
AfterContentInit,
|
||||
AfterContentChecked,
|
||||
AfterViewInit,
|
||||
AfterViewChecked,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
DoCheck
|
||||
} from './metadata/lifecycle_hooks';
|
||||
|
||||
import {
|
||||
QueryMetadata,
|
||||
ContentChildrenMetadata,
|
||||
ContentChildMetadata,
|
||||
ViewChildrenMetadata,
|
||||
ViewChildMetadata,
|
||||
ViewQueryMetadata,
|
||||
AttributeMetadata
|
||||
} from './metadata/di';
|
||||
|
||||
import {
|
||||
ComponentMetadata,
|
||||
DirectiveMetadata,
|
||||
PipeMetadata,
|
||||
InputMetadata,
|
||||
OutputMetadata,
|
||||
HostBindingMetadata,
|
||||
HostListenerMetadata
|
||||
} from './metadata/directives';
|
||||
|
||||
import {ViewMetadata, ViewEncapsulation} from './metadata/view';
|
||||
import {AnimationEntryMetadata} from './animation/metadata';
|
||||
import {ChangeDetectionStrategy} from '../src/change_detection/change_detection';
|
||||
|
||||
import {
|
||||
makeDecorator,
|
||||
makeParamDecorator,
|
||||
makePropDecorator,
|
||||
TypeDecorator,
|
||||
} from './util/decorators';
|
||||
import {AnimationEntryMetadata} from './animation/metadata';
|
||||
import {AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
||||
import {ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, InputMetadata, OutputMetadata, PipeMetadata} from './metadata/directives';
|
||||
import {ViewEncapsulation, ViewMetadata} from './metadata/view';
|
||||
|
||||
export {AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
||||
export {ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, InputMetadata, OutputMetadata, PipeMetadata} from './metadata/directives';
|
||||
export {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit} from './metadata/lifecycle_hooks';
|
||||
export {ViewEncapsulation, ViewMetadata} from './metadata/view';
|
||||
|
||||
import {makeDecorator, makeParamDecorator, makePropDecorator, TypeDecorator,} from './util/decorators';
|
||||
import {Type} from '../src/facade/lang';
|
||||
|
||||
/**
|
||||
@ -87,8 +37,8 @@ export interface ComponentDecorator extends TypeDecorator {
|
||||
View(obj: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
renderer?: string,
|
||||
styles?: string[],
|
||||
styleUrls?: string[],
|
||||
@ -108,8 +58,8 @@ export interface ViewDecorator extends TypeDecorator {
|
||||
View(obj: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
renderer?: string,
|
||||
styles?: string[],
|
||||
styleUrls?: string[],
|
||||
@ -223,8 +173,8 @@ export interface ComponentMetadataFactory {
|
||||
styleUrls?: string[],
|
||||
styles?: string[],
|
||||
animations?: AnimationEntryMetadata[],
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
encapsulation?: ViewEncapsulation
|
||||
}): ComponentDecorator;
|
||||
new (obj: {
|
||||
@ -245,8 +195,8 @@ export interface ComponentMetadataFactory {
|
||||
styleUrls?: string[],
|
||||
styles?: string[],
|
||||
animations?: AnimationEntryMetadata[],
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
encapsulation?: ViewEncapsulation
|
||||
}): ComponentMetadata;
|
||||
}
|
||||
@ -297,8 +247,8 @@ export interface ViewMetadataFactory {
|
||||
(obj: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
encapsulation?: ViewEncapsulation,
|
||||
styles?: string[],
|
||||
styleUrls?: string[],
|
||||
@ -307,8 +257,8 @@ export interface ViewMetadataFactory {
|
||||
new (obj: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
encapsulation?: ViewEncapsulation,
|
||||
styles?: string[],
|
||||
styleUrls?: string[],
|
||||
@ -400,10 +350,10 @@ export interface AttributeMetadataFactory {
|
||||
* @deprecated
|
||||
*/
|
||||
export interface QueryMetadataFactory {
|
||||
(selector: Type | string,
|
||||
(selector: Type|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): ParameterDecorator;
|
||||
new (selector: Type | string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): QueryMetadata;
|
||||
new (selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}):
|
||||
QueryMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -411,9 +361,9 @@ export interface QueryMetadataFactory {
|
||||
* @stable
|
||||
*/
|
||||
export interface ContentChildrenMetadataFactory {
|
||||
(selector: Type | string, {descendants, read}?: {descendants?: boolean, read?: any}): any;
|
||||
new (selector: Type | string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): ContentChildrenMetadata;
|
||||
(selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}): any;
|
||||
new (selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}):
|
||||
ContentChildrenMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,8 +371,8 @@ export interface ContentChildrenMetadataFactory {
|
||||
* @stable
|
||||
*/
|
||||
export interface ContentChildMetadataFactory {
|
||||
(selector: Type | string, {read}?: {read?: any}): any;
|
||||
new (selector: Type | string, {read}?: {read?: any}): ContentChildMetadataFactory;
|
||||
(selector: Type|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type|string, {read}?: {read?: any}): ContentChildMetadataFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -430,8 +380,8 @@ export interface ContentChildMetadataFactory {
|
||||
* @stable
|
||||
*/
|
||||
export interface ViewChildrenMetadataFactory {
|
||||
(selector: Type | string, {read}?: {read?: any}): any;
|
||||
new (selector: Type | string, {read}?: {read?: any}): ViewChildrenMetadata;
|
||||
(selector: Type|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type|string, {read}?: {read?: any}): ViewChildrenMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -439,8 +389,8 @@ export interface ViewChildrenMetadataFactory {
|
||||
* @stable
|
||||
*/
|
||||
export interface ViewChildMetadataFactory {
|
||||
(selector: Type | string, {read}?: {read?: any}): any;
|
||||
new (selector: Type | string, {read}?: {read?: any}): ViewChildMetadataFactory;
|
||||
(selector: Type|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type|string, {read}?: {read?: any}): ViewChildMetadataFactory;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {stringify, isString, Type, StringWrapper} from '../facade/lang';
|
||||
import {DependencyMetadata} from '../di/metadata';
|
||||
import {resolveForwardRef} from '../di/forward_ref';
|
||||
import {DependencyMetadata} from '../di/metadata';
|
||||
import {StringWrapper, Type, isString, stringify} from '../facade/lang';
|
||||
|
||||
|
||||
/**
|
||||
* Specifies that a constant attribute value should be injected.
|
||||
@ -156,9 +157,11 @@ export class QueryMetadata extends DependencyMetadata {
|
||||
*/
|
||||
read: any;
|
||||
|
||||
constructor(private _selector: Type | string,
|
||||
{descendants = false, first = false,
|
||||
read = null}: {descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||
constructor(private _selector: Type|string, {descendants = false, first = false, read = null}: {
|
||||
descendants?: boolean,
|
||||
first?: boolean,
|
||||
read?: any
|
||||
} = {}) {
|
||||
super();
|
||||
this.descendants = descendants;
|
||||
this.first = first;
|
||||
@ -213,8 +216,9 @@ export class QueryMetadata extends DependencyMetadata {
|
||||
* @stable
|
||||
*/
|
||||
export class ContentChildrenMetadata extends QueryMetadata {
|
||||
constructor(_selector: Type | string,
|
||||
{descendants = false, read = null}: {descendants?: boolean, read?: any} = {}) {
|
||||
constructor(
|
||||
_selector: Type|string,
|
||||
{descendants = false, read = null}: {descendants?: boolean, read?: any} = {}) {
|
||||
super(_selector, {descendants: descendants, read: read});
|
||||
}
|
||||
}
|
||||
@ -243,7 +247,7 @@ export class ContentChildrenMetadata extends QueryMetadata {
|
||||
* @stable
|
||||
*/
|
||||
export class ContentChildMetadata extends QueryMetadata {
|
||||
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
|
||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
||||
super(_selector, {descendants: true, first: true, read: read});
|
||||
}
|
||||
}
|
||||
@ -286,9 +290,9 @@ export class ContentChildMetadata extends QueryMetadata {
|
||||
* @deprecated
|
||||
*/
|
||||
export class ViewQueryMetadata extends QueryMetadata {
|
||||
constructor(_selector: Type | string,
|
||||
{descendants = false, first = false,
|
||||
read = null}: {descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||
constructor(
|
||||
_selector: Type|string, {descendants = false, first = false, read = null}:
|
||||
{descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||
super(_selector, {descendants: descendants, first: first, read: read});
|
||||
}
|
||||
|
||||
@ -379,7 +383,7 @@ export class ViewQueryMetadata extends QueryMetadata {
|
||||
* @stable
|
||||
*/
|
||||
export class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
|
||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
||||
super(_selector, {descendants: true, read: read});
|
||||
}
|
||||
}
|
||||
@ -457,7 +461,7 @@ export class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||
* @stable
|
||||
*/
|
||||
export class ViewChildMetadata extends ViewQueryMetadata {
|
||||
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
|
||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
||||
super(_selector, {descendants: true, first: true, read: read});
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
import {isPresent, Type} from '../facade/lang';
|
||||
import {InjectableMetadata} from '../di/metadata';
|
||||
import {ViewEncapsulation} from './view';
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {AnimationEntryMetadata} from '../animation/metadata';
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {InjectableMetadata} from '../di/metadata';
|
||||
import {Type, isPresent} from '../facade/lang';
|
||||
|
||||
import {ViewEncapsulation} from './view';
|
||||
|
||||
|
||||
/**
|
||||
* Directives allow you to attach behavior to elements in the DOM.
|
||||
@ -674,9 +676,7 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
get providers(): any[] {
|
||||
return this._providers;
|
||||
}
|
||||
get providers(): any[] { return this._providers; }
|
||||
private _providers: any[];
|
||||
|
||||
/**
|
||||
@ -739,8 +739,7 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||
*/
|
||||
queries: {[key: string]: any};
|
||||
|
||||
constructor({selector, inputs, outputs, properties, events, host, providers, exportAs,
|
||||
queries}: {
|
||||
constructor({selector, inputs, outputs, properties, events, host, providers, exportAs, queries}: {
|
||||
selector?: string,
|
||||
inputs?: string[],
|
||||
outputs?: string[],
|
||||
@ -842,9 +841,7 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
get viewProviders(): any[] {
|
||||
return this._viewProviders;
|
||||
}
|
||||
get viewProviders(): any[] { return this._viewProviders; }
|
||||
private _viewProviders: any[];
|
||||
|
||||
/**
|
||||
@ -920,7 +917,8 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
* As depicted in the code above, a group of related animation states are all contained within
|
||||
* an animation `trigger` (the code example above called the trigger `myTriggerName`).
|
||||
* When a trigger is created then it can be bound onto an element within the component's
|
||||
* template via a property prefixed by an `@` symbol followed by trigger name and an expression that
|
||||
* template via a property prefixed by an `@` symbol followed by trigger name and an expression
|
||||
* that
|
||||
* is used to determine the state value for that trigger.
|
||||
*
|
||||
* ```html
|
||||
@ -928,7 +926,8 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
* <div @myTriggerName="expression">...</div>
|
||||
* ```
|
||||
*
|
||||
* For state changes to be executed, the `expression` value must change value from its existing value
|
||||
* For state changes to be executed, the `expression` value must change value from its existing
|
||||
* value
|
||||
* to something that we have set an animation to animate on (in the example above we are listening
|
||||
* to a change of state between `on` and `off`). The `expression` value attached to the trigger
|
||||
* must be something that can be evaluated with the template/component context.
|
||||
@ -949,16 +948,32 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
*/
|
||||
animations: AnimationEntryMetadata[];
|
||||
|
||||
directives: Array<Type | any[]>;
|
||||
directives: Array<Type|any[]>;
|
||||
|
||||
pipes: Array<Type | any[]>;
|
||||
pipes: Array<Type|any[]>;
|
||||
|
||||
encapsulation: ViewEncapsulation;
|
||||
|
||||
constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId,
|
||||
providers, viewProviders,
|
||||
changeDetection = ChangeDetectionStrategy.Default, queries, templateUrl, template,
|
||||
styleUrls, styles, animations, directives, pipes, encapsulation}: {
|
||||
constructor({selector,
|
||||
inputs,
|
||||
outputs,
|
||||
properties,
|
||||
events,
|
||||
host,
|
||||
exportAs,
|
||||
moduleId,
|
||||
providers,
|
||||
viewProviders,
|
||||
changeDetection = ChangeDetectionStrategy.Default,
|
||||
queries,
|
||||
templateUrl,
|
||||
template,
|
||||
styleUrls,
|
||||
styles,
|
||||
animations,
|
||||
directives,
|
||||
pipes,
|
||||
encapsulation}: {
|
||||
selector?: string,
|
||||
inputs?: string[],
|
||||
outputs?: string[],
|
||||
@ -976,8 +991,8 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
styleUrls?: string[],
|
||||
styles?: string[],
|
||||
animations?: AnimationEntryMetadata[],
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
encapsulation?: ViewEncapsulation
|
||||
} = {}) {
|
||||
super({
|
||||
|
@ -19,16 +19,11 @@ export enum LifecycleHooks {
|
||||
* values are instances of {@link SimpleChange}. See {@link OnChanges}
|
||||
* @stable
|
||||
*/
|
||||
export interface SimpleChanges {[propName: string]: SimpleChange;}
|
||||
export interface SimpleChanges { [propName: string]: SimpleChange; }
|
||||
|
||||
export var LIFECYCLE_HOOKS_VALUES = [
|
||||
LifecycleHooks.OnInit,
|
||||
LifecycleHooks.OnDestroy,
|
||||
LifecycleHooks.DoCheck,
|
||||
LifecycleHooks.OnChanges,
|
||||
LifecycleHooks.AfterContentInit,
|
||||
LifecycleHooks.AfterContentChecked,
|
||||
LifecycleHooks.AfterViewInit,
|
||||
LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges,
|
||||
LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit,
|
||||
LifecycleHooks.AfterViewChecked
|
||||
];
|
||||
|
||||
@ -83,7 +78,9 @@ export var LIFECYCLE_HOOKS_VALUES = [
|
||||
* ```
|
||||
* @stable
|
||||
*/
|
||||
export abstract class OnChanges { abstract ngOnChanges(changes: SimpleChanges): any /** TODO #9100 */; }
|
||||
export abstract class OnChanges {
|
||||
abstract ngOnChanges(changes: SimpleChanges): any /** TODO #9100 */;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this interface to execute custom initialization logic after your directive's
|
||||
@ -132,17 +129,21 @@ export abstract class OnInit { abstract ngOnInit(): any /** TODO #9100 */; }
|
||||
/**
|
||||
* Implement this interface to supplement the default change detection algorithm in your directive.
|
||||
*
|
||||
* `ngDoCheck` gets called to check the changes in the directives in addition to the default algorithm.
|
||||
* `ngDoCheck` gets called to check the changes in the directives in addition to the default
|
||||
* algorithm.
|
||||
*
|
||||
* The default change detection algorithm looks for differences by comparing bound-property values
|
||||
* by reference across change detection runs.
|
||||
*
|
||||
* Note that a directive typically should not use both `DoCheck` and {@link OnChanges} to respond to
|
||||
* changes on the same input. `ngOnChanges` will continue to be called when the default change detector
|
||||
* detects changes, so it is usually unnecessary to respond to changes on the same input in both hooks.
|
||||
* changes on the same input. `ngOnChanges` will continue to be called when the default change
|
||||
* detector
|
||||
* detects changes, so it is usually unnecessary to respond to changes on the same input in both
|
||||
* hooks.
|
||||
* Reaction to the changes have to be handled from within the `ngDoCheck` callback.
|
||||
*
|
||||
* You can use {@link KeyValueDiffers} and {@link IterableDiffers} to help add your custom check mechanisms.
|
||||
* You can use {@link KeyValueDiffers} and {@link IterableDiffers} to help add your custom check
|
||||
* mechanisms.
|
||||
*
|
||||
* ### Example ([live demo](http://plnkr.co/edit/QpnIlF0CR2i5bcYbHEUJ?p=preview))
|
||||
*
|
||||
@ -387,7 +388,9 @@ export abstract class AfterContentInit { abstract ngAfterContentInit(): any /**
|
||||
* ```
|
||||
* @stable
|
||||
*/
|
||||
export abstract class AfterContentChecked { abstract ngAfterContentChecked(): any /** TODO #9100 */; }
|
||||
export abstract class AfterContentChecked {
|
||||
abstract ngAfterContentChecked(): any /** TODO #9100 */;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this interface to get notified when your component's view has been fully initialized.
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {Type} from '../facade/lang';
|
||||
import {AnimationEntryMetadata} from '../animation/metadata';
|
||||
import {Type} from '../facade/lang';
|
||||
|
||||
|
||||
/**
|
||||
* Defines template and style encapsulation options available for Component's {@link View}.
|
||||
@ -113,9 +114,9 @@ export class ViewMetadata {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
directives: Array<Type | any[]>;
|
||||
directives: Array<Type|any[]>;
|
||||
|
||||
pipes: Array<Type | any[]>;
|
||||
pipes: Array<Type|any[]>;
|
||||
|
||||
/**
|
||||
* Specify how the template and the styles should be encapsulated.
|
||||
@ -127,17 +128,17 @@ export class ViewMetadata {
|
||||
|
||||
animations: AnimationEntryMetadata[];
|
||||
|
||||
constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls,
|
||||
animations}: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: Array<Type | any[]>,
|
||||
pipes?: Array<Type | any[]>,
|
||||
encapsulation?: ViewEncapsulation,
|
||||
styles?: string[],
|
||||
styleUrls?: string[],
|
||||
animations?: AnimationEntryMetadata[]
|
||||
} = {}) {
|
||||
constructor(
|
||||
{templateUrl, template, directives, pipes, encapsulation, styles, styleUrls, animations}: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
encapsulation?: ViewEncapsulation,
|
||||
styles?: string[],
|
||||
styleUrls?: string[],
|
||||
animations?: AnimationEntryMetadata[]
|
||||
} = {}) {
|
||||
this.templateUrl = templateUrl;
|
||||
this.template = template;
|
||||
this.styleUrls = styleUrls;
|
||||
|
@ -1,10 +1,11 @@
|
||||
import {Type} from '../src/facade/lang';
|
||||
import {Provider} from './di';
|
||||
|
||||
import {PLATFORM_CORE_PROVIDERS} from './application_ref';
|
||||
import {Console} from './console';
|
||||
import {Provider} from './di';
|
||||
import {Reflector, reflector} from './reflection/reflection';
|
||||
import {ReflectorReader} from './reflection/reflector_reader';
|
||||
import {TestabilityRegistry} from './testability/testability';
|
||||
import {PLATFORM_CORE_PROVIDERS} from './application_ref';
|
||||
|
||||
function _reflector(): Reflector {
|
||||
return reflector;
|
||||
@ -16,10 +17,9 @@ 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*/[
|
||||
export const PLATFORM_COMMON_PROVIDERS: Array<any|Type|Provider|any[]> = /*@ts2dart_const*/[
|
||||
PLATFORM_CORE_PROVIDERS,
|
||||
/*@ts2dart_Provider*/ {provide: Reflector, useFactory: _reflector, deps: []},
|
||||
/*@ts2dart_Provider*/ {provide: ReflectorReader, useExisting: Reflector},
|
||||
TestabilityRegistry,
|
||||
/*@ts2dart_Provider*/ {provide: ReflectorReader, useExisting: Reflector}, TestabilityRegistry,
|
||||
Console
|
||||
];
|
||||
|
@ -26,7 +26,7 @@ import {OpaqueToken} from './di';
|
||||
* @stable
|
||||
*/
|
||||
export const PLATFORM_DIRECTIVES: OpaqueToken =
|
||||
/*@ts2dart_const*/ new OpaqueToken("Platform Directives");
|
||||
/*@ts2dart_const*/ new OpaqueToken('Platform Directives');
|
||||
|
||||
/**
|
||||
* A token that can be provided when bootstraping an application to make an array of pipes
|
||||
@ -52,4 +52,4 @@ export const PLATFORM_DIRECTIVES: OpaqueToken =
|
||||
* ```
|
||||
* @stable
|
||||
*/
|
||||
export const PLATFORM_PIPES: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken("Platform Pipes");
|
||||
export const PLATFORM_PIPES: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('Platform Pipes');
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as impl from './wtf_impl';
|
||||
|
||||
export {WtfScopeFn} from './wtf_impl';
|
||||
|
||||
import * as impl from './wtf_impl';
|
||||
|
||||
// Change exports to const once https://github.com/angular/ts2dart/issues/150
|
||||
|
||||
@ -55,7 +56,7 @@ export var wtfCreateScope: (signature: string, flags?: any) => impl.WtfScopeFn =
|
||||
* Returns the `returnValue for easy chaining.
|
||||
* @experimental
|
||||
*/
|
||||
export var wtfLeave:<T>(scope: any, returnValue?: T) => T =
|
||||
export var wtfLeave: <T>(scope: any, returnValue?: T) => T =
|
||||
wtfEnabled ? impl.leave : (s: any, r?: any) => r;
|
||||
|
||||
/**
|
||||
@ -80,5 +81,5 @@ export var wtfStartTimeRange: (rangeType: string, action: string) => any =
|
||||
* enabled.
|
||||
* @experimental
|
||||
*/
|
||||
export var wtfEndTimeRange: (range: any) => void = wtfEnabled ? impl.endTimeRange : (r: any) =>
|
||||
null;
|
||||
export var wtfEndTimeRange: (range: any) => void =
|
||||
wtfEnabled ? impl.endTimeRange : (r: any) => null;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {Type} from '../facade/lang';
|
||||
import {GetterFn, SetterFn, MethodFn} from './types';
|
||||
|
||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
||||
export interface PlatformReflectionCapabilities {
|
||||
isReflectionEnabled(): boolean;
|
||||
|
@ -1,10 +1,11 @@
|
||||
import {Reflector} from './reflector';
|
||||
export {Reflector, ReflectionInfo} from './reflector';
|
||||
import {ReflectionCapabilities} from './reflection_capabilities';
|
||||
import {Reflector} from './reflector';
|
||||
|
||||
export {ReflectionInfo, Reflector} from './reflector';
|
||||
|
||||
|
||||
/**
|
||||
* The {@link Reflector} used internally in Angular to access metadata
|
||||
* about symbols.
|
||||
*/
|
||||
export var reflector = new Reflector(new ReflectionCapabilities());
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import {Type, isPresent, isFunction, global, stringify, ConcreteType} from '../facade/lang';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {GetterFn, SetterFn, MethodFn} from './types';
|
||||
import {ConcreteType, Type, global, isFunction, isPresent, stringify} from '../facade/lang';
|
||||
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
||||
export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
private _reflect: any;
|
||||
@ -65,23 +66,29 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
case 17:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
|
||||
a17);
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
|
||||
case 18:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
||||
a18: any) => new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15,
|
||||
a16, a17, a18);
|
||||
a18: any) =>
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
||||
a18);
|
||||
case 19:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
||||
a18: any, a19: any) => new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
|
||||
a14, a15, a16, a17, a18, a19);
|
||||
a18: any, a19: any) =>
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
||||
a18, a19);
|
||||
case 20:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
||||
a18: any, a19: any, a20: any) => new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
|
||||
a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||
a18: any, a19: any, a20: any) =>
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
||||
a18, a19, a20);
|
||||
};
|
||||
|
||||
throw new Error(
|
||||
@ -89,7 +96,8 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_zipTypesAndAnnotations(paramTypes: any /** TODO #9100 */, paramAnnotations: any /** TODO #9100 */): any[][] {
|
||||
_zipTypesAndAnnotations(
|
||||
paramTypes: any /** TODO #9100 */, paramAnnotations: any /** TODO #9100 */): any[][] {
|
||||
var result: any /** TODO #9100 */;
|
||||
|
||||
if (typeof paramTypes === 'undefined') {
|
||||
@ -125,9 +133,11 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
// API of tsickle for lowering decorators to properties on the class.
|
||||
if (isPresent((<any>typeOrFunc).ctorParameters)) {
|
||||
let ctorParameters = (<any>typeOrFunc).ctorParameters;
|
||||
let paramTypes = ctorParameters.map((ctorParam: any /** TODO #9100 */) => ctorParam && ctorParam.type);
|
||||
let paramTypes =
|
||||
ctorParameters.map((ctorParam: any /** TODO #9100 */) => ctorParam && ctorParam.type);
|
||||
let paramAnnotations = ctorParameters.map(
|
||||
(ctorParam: any /** TODO #9100 */) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));
|
||||
(ctorParam: any /** TODO #9100 */) =>
|
||||
ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));
|
||||
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
||||
}
|
||||
|
||||
@ -182,10 +192,9 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
if (isPresent((<any>typeOrFunc).propDecorators)) {
|
||||
let propDecorators = (<any>typeOrFunc).propDecorators;
|
||||
let propMetadata = <{[key: string]: any[]}>{};
|
||||
Object.keys(propDecorators)
|
||||
.forEach(prop => {
|
||||
propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
||||
});
|
||||
Object.keys(propDecorators).forEach(prop => {
|
||||
propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
||||
});
|
||||
return propMetadata;
|
||||
}
|
||||
|
||||
|
@ -1,25 +1,22 @@
|
||||
import {Type, isPresent, stringify} from '../facade/lang';
|
||||
import {ListWrapper, Map, MapWrapper, Set, SetWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {BaseException, WrappedException} from '../facade/exceptions';
|
||||
import {
|
||||
ListWrapper,
|
||||
Map,
|
||||
MapWrapper,
|
||||
Set,
|
||||
SetWrapper,
|
||||
StringMapWrapper
|
||||
} from '../facade/collection';
|
||||
import {SetterFn, GetterFn, MethodFn} from './types';
|
||||
import {ReflectorReader} from './reflector_reader';
|
||||
import {Type, isPresent, stringify} from '../facade/lang';
|
||||
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
export {SetterFn, GetterFn, MethodFn} from './types';
|
||||
import {ReflectorReader} from './reflector_reader';
|
||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
||||
export {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
export {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
||||
|
||||
/**
|
||||
* Reflective information about a symbol, including annotations, interfaces, and other metadata.
|
||||
*/
|
||||
export class ReflectionInfo {
|
||||
constructor(public annotations?: any[], public parameters?: any[][], public factory?: Function,
|
||||
public interfaces?: any[], public propMetadata?: {[key: string]: any[]}) {}
|
||||
constructor(
|
||||
public annotations?: any[], public parameters?: any[][], public factory?: Function,
|
||||
public interfaces?: any[], public propMetadata?: {[key: string]: any[]}) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,2 +1,2 @@
|
||||
// Public API for render
|
||||
export {RootRenderer, Renderer, RenderComponentType} from './render/api';
|
||||
export {RenderComponentType, Renderer, RootRenderer} from './render/api';
|
||||
|
@ -1,16 +1,18 @@
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {Injector} from '../di/injector';
|
||||
import {AnimationKeyframe} from '../../src/animation/animation_keyframe';
|
||||
import {AnimationPlayer} from '../../src/animation/animation_player';
|
||||
import {AnimationStyles} from '../../src/animation/animation_styles';
|
||||
import {Injector} from '../di/injector';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export class RenderComponentType {
|
||||
constructor(public id: string, public templateUrl: string, public slotCount: number,
|
||||
public encapsulation: ViewEncapsulation, public styles: Array<string | any[]>) {}
|
||||
constructor(
|
||||
public id: string, public templateUrl: string, public slotCount: number,
|
||||
public encapsulation: ViewEncapsulation, public styles: Array<string|any[]>) {}
|
||||
}
|
||||
|
||||
export abstract class RenderDebugInfo {
|
||||
@ -26,7 +28,7 @@ export abstract class RenderDebugInfo {
|
||||
* @experimental
|
||||
*/
|
||||
export abstract class Renderer {
|
||||
abstract selectRootElement(selectorOrNode: string | any, debugInfo?: RenderDebugInfo): any;
|
||||
abstract selectRootElement(selectorOrNode: string|any, debugInfo?: RenderDebugInfo): any;
|
||||
|
||||
abstract createElement(parentElement: any, name: string, debugInfo?: RenderDebugInfo): any;
|
||||
|
||||
@ -50,24 +52,29 @@ export abstract class Renderer {
|
||||
|
||||
abstract setElementProperty(renderElement: any, propertyName: string, propertyValue: any): void;
|
||||
|
||||
abstract setElementAttribute(renderElement: any, attributeName: string,
|
||||
attributeValue: string): void;
|
||||
abstract setElementAttribute(renderElement: any, attributeName: string, attributeValue: string):
|
||||
void;
|
||||
|
||||
/**
|
||||
* Used only in debug mode to serialize property changes to dom nodes as attributes.
|
||||
*/
|
||||
abstract setBindingDebugInfo(renderElement: any, propertyName: string,
|
||||
propertyValue: string): void;
|
||||
abstract setBindingDebugInfo(renderElement: any, propertyName: string, propertyValue: string):
|
||||
void;
|
||||
|
||||
abstract setElementClass(renderElement: any, className: string, isAdd: boolean): any /** TODO #9100 */;
|
||||
abstract setElementClass(renderElement: any, className: string, isAdd: boolean): any
|
||||
/** TODO #9100 */;
|
||||
|
||||
abstract setElementStyle(renderElement: any, styleName: string, styleValue: string): any /** TODO #9100 */;
|
||||
abstract setElementStyle(renderElement: any, styleName: string, styleValue: string): any
|
||||
/** TODO #9100 */;
|
||||
|
||||
abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]): any /** TODO #9100 */;
|
||||
abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]): any
|
||||
/** TODO #9100 */;
|
||||
|
||||
abstract setText(renderNode: any, text: string): any /** TODO #9100 */;
|
||||
|
||||
abstract animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string): AnimationPlayer;
|
||||
abstract animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
duration: number, delay: number, easing: string): AnimationPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,9 +1,10 @@
|
||||
import {Map, MapWrapper} from '../facade/collection';
|
||||
import {scheduleMicroTask} from '../facade/lang';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {NgZone} from '../zone/ng_zone';
|
||||
import {ObservableWrapper} from '../facade/async';
|
||||
import {Injectable} from '../di/decorators';
|
||||
import {ObservableWrapper} from '../facade/async';
|
||||
import {Map, MapWrapper} from '../facade/collection';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {scheduleMicroTask} from '../facade/lang';
|
||||
import {NgZone} from '../zone/ng_zone';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -132,15 +133,15 @@ export class TestabilityRegistry {
|
||||
*/
|
||||
export interface GetTestability {
|
||||
addToWindow(registry: TestabilityRegistry): void;
|
||||
findTestabilityInTree(registry: TestabilityRegistry, elem: any,
|
||||
findInAncestors: boolean): Testability;
|
||||
findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean):
|
||||
Testability;
|
||||
}
|
||||
|
||||
/* @ts2dart_const */
|
||||
class _NoopGetTestability implements GetTestability {
|
||||
addToWindow(registry: TestabilityRegistry): void {}
|
||||
findTestabilityInTree(registry: TestabilityRegistry, elem: any,
|
||||
findInAncestors: boolean): Testability {
|
||||
findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean):
|
||||
Testability {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {ConcreteType, global, Type, isFunction, stringify} from '../facade/lang';
|
||||
import {ConcreteType, Type, global, isFunction, stringify} from '../facade/lang';
|
||||
|
||||
var _nextClassId = 0;
|
||||
|
||||
@ -20,13 +20,13 @@ export interface ClassDefinition {
|
||||
*
|
||||
* See {@link Class} for example of usage.
|
||||
*/
|
||||
constructor: Function | any[];
|
||||
constructor: Function|any[];
|
||||
|
||||
/**
|
||||
* Other methods on the class. Note that values should have type 'Function' but TS requires
|
||||
* all properties to have a narrower type than the index signature.
|
||||
*/
|
||||
[x: string]: Type | Function | any[];
|
||||
[x: string]: Type|Function|any[];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ export interface TypeDecorator {
|
||||
// ParameterDecorator is declared in lib.d.ts as a `declare type`
|
||||
// so we cannot declare this interface as a subtype.
|
||||
// see https://github.com/angular/angular/issues/3379#issuecomment-126169417
|
||||
(target: Object, propertyKey?: string | symbol, parameterIndex?: number): void;
|
||||
(target: Object, propertyKey?: string|symbol, parameterIndex?: number): void;
|
||||
|
||||
/**
|
||||
* Storage for the accumulated annotations so far used by the DSL syntax.
|
||||
@ -248,7 +248,8 @@ var Reflect = global.Reflect;
|
||||
})();
|
||||
|
||||
export function makeDecorator(
|
||||
annotationCls: any /** TODO #9100 */, chainFn: (fn: Function) => void = null): (...args: any[]) => (cls: any) => any {
|
||||
annotationCls: any /** TODO #9100 */,
|
||||
chainFn: (fn: Function) => void = null): (...args: any[]) => (cls: any) => any {
|
||||
function DecoratorFactory(objOrType: any /** TODO #9100 */): (cls: any) => any {
|
||||
var annotationInstance = new (<any>annotationCls)(objOrType);
|
||||
if (this instanceof annotationCls) {
|
||||
@ -257,13 +258,14 @@ export function makeDecorator(
|
||||
var chainAnnotation =
|
||||
isFunction(this) && this.annotations instanceof Array ? this.annotations : [];
|
||||
chainAnnotation.push(annotationInstance);
|
||||
var TypeDecorator: TypeDecorator = <TypeDecorator>function TypeDecorator(cls: any /** TODO #9100 */) {
|
||||
var annotations = Reflect.getOwnMetadata('annotations', cls);
|
||||
annotations = annotations || [];
|
||||
annotations.push(annotationInstance);
|
||||
Reflect.defineMetadata('annotations', annotations, cls);
|
||||
return cls;
|
||||
};
|
||||
var TypeDecorator: TypeDecorator =
|
||||
<TypeDecorator>function TypeDecorator(cls: any /** TODO #9100 */) {
|
||||
var annotations = Reflect.getOwnMetadata('annotations', cls);
|
||||
annotations = annotations || [];
|
||||
annotations.push(annotationInstance);
|
||||
Reflect.defineMetadata('annotations', annotations, cls);
|
||||
return cls;
|
||||
};
|
||||
TypeDecorator.annotations = chainAnnotation;
|
||||
TypeDecorator.Class = Class;
|
||||
if (chainFn) chainFn(TypeDecorator);
|
||||
@ -287,7 +289,9 @@ export function makeParamDecorator(annotationCls: any /** TODO #9100 */): any {
|
||||
}
|
||||
|
||||
|
||||
function ParamDecorator(cls: any /** TODO #9100 */, unusedKey: any /** TODO #9100 */, index: any /** TODO #9100 */): any {
|
||||
function ParamDecorator(
|
||||
cls: any /** TODO #9100 */, unusedKey: any /** TODO #9100 */,
|
||||
index: any /** TODO #9100 */): any {
|
||||
var parameters: any[][] = Reflect.getMetadata('parameters', cls);
|
||||
parameters = parameters || [];
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
import {EventEmitter} from '../facade/async';
|
||||
import {NgZoneImpl, NgZoneError} from './ng_zone_impl';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
|
||||
import {NgZoneError, NgZoneImpl} from './ng_zone_impl';
|
||||
|
||||
export {NgZoneError} from './ng_zone_impl';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An injectable service for executing work inside or outside of the Angular zone.
|
||||
*
|
||||
@ -177,7 +180,7 @@ export class NgZone {
|
||||
* Notify that an error has been delivered.
|
||||
*/
|
||||
get onError(): EventEmitter<any> { return this._onErrorEvents; }
|
||||
|
||||
|
||||
/**
|
||||
* Whether there are no outstanding microtasks or microtasks.
|
||||
*/
|
||||
|
@ -45,7 +45,7 @@ export class NgZoneImpl {
|
||||
}
|
||||
this.inner = this.inner.fork({
|
||||
name: 'angular',
|
||||
properties:<any>{'isAngularZone': true},
|
||||
properties: <any>{'isAngularZone': true},
|
||||
onInvokeTask: (delegate: ZoneDelegate, current: Zone, target: Zone, task: Task,
|
||||
applyThis: any, applyArgs: any): any => {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user