Skip to content

Commit

Permalink
chore(): format
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjulian committed Jul 26, 2019
1 parent 2a1718b commit dc57f7e
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 89 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
10 changes: 8 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"format": "prettier --write \"src/**/*{.ts,.scss}\"",
"format:plugin": "prettier --write \"projects/**/*{.ts,.scss}\"",
"build:plugin": "ng build lottie",
"build:prod:plugin": "ng build lottie --prod && cp README.md dist/@fivethree/lottie/.",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s"
Expand Down Expand Up @@ -58,9 +60,9 @@
"@angular/compiler-cli": "7.2.11",
"@angular/language-service": "7.2.11",
"@ionic/angular-toolkit": "1.5.0",
"@types/node": "10.12.24",
"@types/jasmine": "3.3.10",
"@types/jasminewd2": "2.0.6",
"@types/node": "10.12.24",
"codelyzer": "4.5.0",
"jasmine-core": "3.3.0",
"jasmine-spec-reporter": "4.2.1",
Expand All @@ -70,6 +72,7 @@
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.0",
"ng-packagr": "4.7.1",
"prettier": "~1.18.2",
"protractor": "5.4.2",
"ts-node": "8.0.3",
"tsickle": "0.34.3",
Expand Down
19 changes: 13 additions & 6 deletions projects/lottie/src/lib/lottie.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ import { isPlatformServer } from '@angular/common';
@Component({
selector: 'fiv-lottie',
template: `
<div #lottieContainer [ngStyle]="{'width': viewWidth, 'height': viewHeight, 'overflow':'hidden', 'margin': '0 auto'}">
</div>
<div
#lottieContainer
[ngStyle]="{
width: viewWidth,
height: viewHeight,
overflow: 'hidden',
margin: '0 auto'
}"
></div>
`,
styles: []
})
export class LottieComponent implements OnInit {

@Input() params: LottieParams;
@Input() width: number;
@Input() height: number;
Expand All @@ -36,10 +42,12 @@ export class LottieComponent implements OnInit {

private _params: LottieParams;

constructor(@Inject(PLATFORM_ID) private platformId: string) { }
constructor(@Inject(PLATFORM_ID) private platformId: string) {}

ngOnInit() {
if (isPlatformServer(this.platformId)) { return; }
if (isPlatformServer(this.platformId)) {
return;
}

this._params = {
autoplay: this.params.autoplay,
Expand All @@ -61,5 +69,4 @@ export class LottieComponent implements OnInit {
this.animationCreated.emit(animation);
});
}

}
2 changes: 1 addition & 1 deletion projects/lottie/src/lib/lottie.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ import { LottieComponent } from './lottie.component';
imports: [CommonModule],
exports: [LottieComponent]
})
export class LottieModule { }
export class LottieModule {}
120 changes: 60 additions & 60 deletions projects/lottie/src/lib/symbols.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
export interface LottieParams {
autoplay?: boolean;
animationData?: any;
container?: any;
loop?: boolean | number;
name?: string;
path: string;
renderer?: 'svg' | 'canvas' | 'html';
rendererSettings?: LottieRenderSettings;
autoplay?: boolean;
animationData?: any;
container?: any;
loop?: boolean | number;
name?: string;
path: string;
renderer?: 'svg' | 'canvas' | 'html';
rendererSettings?: LottieRenderSettings;
}

export interface LottieRenderSettings {
context: any;
scaleMode: 'noScale' | string;
clearCanvas: boolean;
progressiveLoad: boolean;
hideOnTransparent: boolean;
className: string;
context: any;
scaleMode: 'noScale' | string;
clearCanvas: boolean;
progressiveLoad: boolean;
hideOnTransparent: boolean;
className: string;
}

export interface LottieAnimation {
/**
* @param name to target a specific animation
*/
play(name?: string): void;
/**
* @param name to target a specific animation
*/
pause(name?: string): void;
/**
* @param name to target a specific animation
*/
stop(name?: string): void;
destroy(): void;
/**
* @param href usually pass as location.href. Its useful when you experience mask issue in safari where your url does not have # symbol.
*/
setLocationHref(href: string);
/**
* @param speed 1 is normal speed, plays reverse if minus
* @param name to target a specific animation
*/
setSpeed(speed: number, name?: string);
/**
* @param value frame value
* @param isFrame defines if first argument is a time based value or a frame based (default false)
*/
goToAndStop(value: number, isFrame?: boolean);
/**
* @param value frame value
* @param isFrame defines if first argument is a time based value or a frame based (default false)
*/
goToAndPlay(value: number, isFrame?: boolean);
/**
* @param direction 1 is forward, -1 is reverse
*/
setDirection(direction: 1 | -1);
/**
* @param inFrames If true, returns duration in frames, if false, in seconds
*/
getDuration(inFrames?: boolean): number;
/**
* @param segments Can contain 2 numeric values that will be used as first and last frame of the animation.
* Or can contain a sequence of arrays each with 2 numeric values.
* @param forceFlag If set to false, it will wait until the current segment is complete. If true, it will update values immediately.
*/
playSegments(segments: any[], forceFlag?: boolean);
/**
* @param name to target a specific animation
*/
play(name?: string): void;
/**
* @param name to target a specific animation
*/
pause(name?: string): void;
/**
* @param name to target a specific animation
*/
stop(name?: string): void;
destroy(): void;
/**
* @param href usually pass as location.href. Its useful when you experience mask issue in safari where your url does not have # symbol.
*/
setLocationHref(href: string);
/**
* @param speed 1 is normal speed, plays reverse if minus
* @param name to target a specific animation
*/
setSpeed(speed: number, name?: string);
/**
* @param value frame value
* @param isFrame defines if first argument is a time based value or a frame based (default false)
*/
goToAndStop(value: number, isFrame?: boolean);
/**
* @param value frame value
* @param isFrame defines if first argument is a time based value or a frame based (default false)
*/
goToAndPlay(value: number, isFrame?: boolean);
/**
* @param direction 1 is forward, -1 is reverse
*/
setDirection(direction: 1 | -1);
/**
* @param inFrames If true, returns duration in frames, if false, in seconds
*/
getDuration(inFrames?: boolean): number;
/**
* @param segments Can contain 2 numeric values that will be used as first and last frame of the animation.
* Or can contain a sequence of arrays each with 2 numeric values.
* @param forceFlag If set to false, it will wait until the current segment is complete. If true, it will update values immediately.
*/
playSegments(segments: any[], forceFlag?: boolean);
}
4 changes: 2 additions & 2 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'home', loadChildren: './home/home.module#HomePageModule' }
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
export class AppRoutingModule {}
6 changes: 2 additions & 4 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';

describe('AppComponent', () => {

let statusBarSpy, splashScreenSpy, platformReadySpy, platformSpy;

beforeEach(async(() => {
Expand All @@ -23,8 +22,8 @@ describe('AppComponent', () => {
providers: [
{ provide: StatusBar, useValue: statusBarSpy },
{ provide: SplashScreen, useValue: splashScreenSpy },
{ provide: Platform, useValue: platformSpy },
],
{ provide: Platform, useValue: platformSpy }
]
}).compileComponents();
}));

Expand All @@ -43,5 +42,4 @@ describe('AppComponent', () => {
});

// TODO: add more tests!

});
3 changes: 1 addition & 2 deletions src/app/home/home.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
Expand All @@ -23,4 +22,4 @@ import { LottieModule } from '@fivethree/lottie';
],
declarations: [HomePage]
})
export class HomePageModule { }
export class HomePageModule {}
1 change: 0 additions & 1 deletion src/app/home/home.page.scss
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

7 changes: 3 additions & 4 deletions src/app/home/home.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ describe('HomePage', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
declarations: [HomePage],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));

beforeEach(() => {
Expand Down
4 changes: 1 addition & 3 deletions src/app/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { LottieAnimation, LottieParams } from '@fivethree/lottie';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
styleUrls: ['home.page.scss']
})
export class HomePage {

lottieParams: LottieParams = {
path: 'assets/lottie/empty_box.json',
renderer: 'svg',
Expand All @@ -19,7 +18,6 @@ export class HomePage {
onAnimationCreated(animation: LottieAnimation) {
// animation.play();
// animation.setSpeed(0.8);

// timer(1000).subscribe(() => animation.pause());
}
}
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch(err => console.log(err));
3 changes: 1 addition & 2 deletions src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.

import 'zone.js/dist/zone'; // Included with Angular CLI.

/***************************************************************************************************
* APPLICATION IMPORTS
Expand Down

0 comments on commit dc57f7e

Please sign in to comment.