angular2-cloudtasks
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -8,23 +8,25 @@ { | ||
"devDependencies": { | ||
"@angular/common": "^2.0.0-rc.2", | ||
"@angular/compiler": "^2.0.0-rc.2", | ||
"@angular/core": "^2.0.0-rc.2", | ||
"@angular/platform-browser": "^2.0.0-rc.2", | ||
"@angular/platform-browser-dynamic": "^2.0.0-rc.2", | ||
"commitizen": "~2.8.1", | ||
"cz-conventional-changelog": "~1.1.6", | ||
"es6-shim": "^0.35.0", | ||
"jasmine-core": "~2.4.1", | ||
"karma": "~0.13.22", | ||
"karma-chrome-launcher": "~1.0.1", | ||
"karma-jasmine": "~1.0.2", | ||
"@angular/common": "^2.0.0-rc.6", | ||
"@angular/compiler": "^2.0.0-rc.6", | ||
"@angular/core": "^2.0.0-rc.6", | ||
"@angular/platform-browser": "^2.0.0-rc.6", | ||
"@angular/platform-browser-dynamic": "^2.0.0-rc.6", | ||
"@types/core-js": "^0.9.32", | ||
"@types/jasmine": "^2.2.29", | ||
"@types/node": "6.0.38", | ||
"commitizen": "^2.8.1", | ||
"core-js": "^2.4.1", | ||
"cz-conventional-changelog": "^1.1.6", | ||
"jasmine-core": "^2.4.1", | ||
"karma": "^0.13.22", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-typescript-preprocessor": "0.0.21", | ||
"reflect-metadata": "0.1.2", | ||
"rxjs": "5.0.0-beta.6", | ||
"reflect-metadata": "0.1.3", | ||
"rxjs": "5.0.0-beta.11", | ||
"semantic-release": "^4.3.5", | ||
"systemjs": "~0.19.26", | ||
"systemjs": "^0.19.26", | ||
"tslint": "^3.6.0", | ||
"typescript": "~1.8.10", | ||
"typings": "^1.3.0", | ||
"zone.js": "~0.6.12" | ||
"typescript": "2.0.2", | ||
"zone.js": "0.6.17" | ||
}, | ||
@@ -35,3 +37,3 @@ "scripts": { | ||
"commit": "git-cz", | ||
"build": "rm -rf ./typings/ && ./node_modules/.bin/typings install && tsc -d", | ||
"build": "tsc -d", | ||
"semantic-release": "semantic-release pre && npm run build && npm publish && semantic-release post" | ||
@@ -64,3 +66,3 @@ }, | ||
}, | ||
"version": "0.0.14" | ||
"version": "0.0.15" | ||
} |
@@ -38,18 +38,9 @@ # [angular2-cloudtasks](https://cloudtasks.io) | ||
```js | ||
import {bootstrap} from '@angular/platform-browser-dynamic'; | ||
import {CloudtasksService} from 'angular2-cloudtasks'; | ||
// component | ||
import { Component } from '@angular/core'; | ||
import { CloudtasksService, CloudtasksDirective } from 'angular2-cloudtasks'; | ||
bootstrap(AppComponent, [ | ||
CloudtasksService | ||
]); | ||
import {Component, Injectable} from '@angular/core'; | ||
import {CloudtasksService, CloudtasksDirective} from 'angular2-cloudtasks'; | ||
@Injectable() | ||
@Component({ | ||
selector: 'app', | ||
template: `<img [ctSrc]="'http://example.com/image.jpg'" [ctOptions]="{trim: true, smart: 'face', filters: 'blur(10):flip()'}">`, | ||
directives: [CloudtasksDirective] | ||
template: `<img [ctSrc]="'http://example.com/image.jpg'" [ctOptions]="{trim: true, smart: 'face', filters: 'blur(10):flip()'}">` | ||
}) | ||
@@ -69,2 +60,16 @@ export class AppComponent { | ||
} | ||
// bootstrap | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { CloudtasksService, CloudtasksDirective } from 'angular2-cloudtasks'; | ||
@NgModule({ | ||
imports: [ CommonModule ], | ||
declarations: [ AppComponent, CloudtasksDirective ], | ||
bootstrap: [ AppComponent ], | ||
providers: [ | ||
CloudtasksService | ||
] | ||
}) | ||
``` | ||
@@ -71,0 +76,0 @@ |
import { ElementRef, Renderer, OnInit, AfterViewInit } from '@angular/core'; | ||
import { Location } from '@angular/common'; | ||
import { CloudtasksService } from './service'; | ||
export declare class CloudtasksDirective implements OnInit, AfterViewInit { | ||
private document; | ||
private location; | ||
private elRef; | ||
@@ -18,3 +21,3 @@ private renderer; | ||
private tries; | ||
constructor(elRef: ElementRef, renderer: Renderer, cloudtasks: CloudtasksService); | ||
constructor(document: Document, location: Location, elRef: ElementRef, renderer: Renderer, cloudtasks: CloudtasksService); | ||
ngOnInit(): void; | ||
@@ -29,3 +32,3 @@ ngAfterViewInit(): void; | ||
parseOptions(): void; | ||
resolve(url: any): any; | ||
resolve(url: any): string; | ||
} |
@@ -11,7 +11,13 @@ "use strict"; | ||
}; | ||
var __param = (this && this.__param) || function (paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
}; | ||
var core_1 = require('@angular/core'); | ||
var dom_adapter_1 = require('@angular/platform-browser/src/dom/dom_adapter'); | ||
var common_1 = require('@angular/common'); | ||
var platform_browser_1 = require('@angular/platform-browser'); | ||
var service_1 = require('./service'); | ||
var CloudtasksDirective = (function () { | ||
function CloudtasksDirective(elRef, renderer, cloudtasks) { | ||
function CloudtasksDirective(document, location, elRef, renderer, cloudtasks) { | ||
this.document = document; | ||
this.location = location; | ||
this.elRef = elRef; | ||
@@ -39,7 +45,7 @@ this.renderer = renderer; | ||
else { | ||
var rect = dom_adapter_1.getDOM().getBoundingClientRect(this.el); | ||
var rect = this.el.getBoundingClientRect(); | ||
this.width = rect.width; | ||
this.height = rect.height; | ||
if (!this.width && !this.height) { | ||
rect = dom_adapter_1.getDOM().getBoundingClientRect(dom_adapter_1.getDOM().parentElement(this.el)); | ||
rect = this.el.parentElement.getBoundingClientRect(); | ||
this.width = rect.width; | ||
@@ -157,5 +163,5 @@ this.height = rect.height; | ||
CloudtasksDirective.prototype.resolve = function (url) { | ||
var loc = dom_adapter_1.getDOM().getLocation().pathname.split('/'); | ||
var loc = this.location.path().split('/'); | ||
loc.pop(); | ||
var base = dom_adapter_1.getDOM().getLocation().origin + loc.join('/') + '/'; | ||
var base = this.document.location.origin + loc.join('/') + '/'; | ||
if ('string' !== typeof url || !url) { | ||
@@ -171,3 +177,3 @@ return null; | ||
else if ('string' !== typeof base) { | ||
var a = dom_adapter_1.getDOM().createElement('a'); | ||
var a = this.renderer.createElement(this.el, 'a'); | ||
a.href = url; | ||
@@ -185,3 +191,3 @@ if (!a.hostname || !a.protocol || !a.pathname) { | ||
} | ||
var a = dom_adapter_1.getDOM().createElement('a'); | ||
var a = this.renderer.createElement(this.el, 'a'); | ||
a.href = base; | ||
@@ -238,4 +244,5 @@ if (url[0] === '/') { | ||
} | ||
}), | ||
__metadata('design:paramtypes', [core_1.ElementRef, core_1.Renderer, service_1.CloudtasksService]) | ||
}), | ||
__param(0, core_1.Inject(platform_browser_1.DOCUMENT)), | ||
__metadata('design:paramtypes', [Document, common_1.Location, core_1.ElementRef, core_1.Renderer, service_1.CloudtasksService]) | ||
], CloudtasksDirective); | ||
@@ -242,0 +249,0 @@ return CloudtasksDirective; |
27958
364
117
23