Skip to content
This repository was archived by the owner on Aug 24, 2020. It is now read-only.

Commit ca317e3

Browse files
Fix build without hammerjs
1 parent 56eb7ad commit ca317e3

File tree

5 files changed

+14
-36
lines changed

5 files changed

+14
-36
lines changed

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"@angular/core": "^4.0.0",
3030
"@angular/platform-browser": "^4.0.0",
3131
"@angular/platform-browser-dynamic": "^4.0.0",
32-
"@types/hammerjs": "^2.0.34",
3332
"@types/jasmine": "2.5.38",
3433
"@types/node": "~6.0.60",
3534
"codelyzer": "~2.0.0",
@@ -45,20 +44,20 @@
4544
"karma-coverage-istanbul-reporter": "^0.2.0",
4645
"karma-jasmine": "~1.1.0",
4746
"karma-jasmine-html-reporter": "^0.2.2",
47+
"lodash": "^4.6.1",
4848
"node-watch": "^0.5.2",
4949
"protractor": "~5.1.0",
50+
"raf": "^3.1.0",
51+
"rebound": "^0.0.13",
5052
"rollup": "^0.41.6",
5153
"run-sequence": "^1.2.2",
5254
"rxjs": "^5.1.0",
55+
"sister": "^3.0.0",
5356
"ts-node": "~2.0.0",
5457
"tslint": "~4.5.0",
5558
"typescript": "~2.2.0",
56-
"zone.js": "^0.8.4",
57-
"lodash": "^4.6.1",
58-
"raf": "^3.1.0",
59-
"rebound": "^0.0.13",
60-
"sister": "^3.0.0",
61-
"vendor-prefix": "^0.1.0"
59+
"vendor-prefix": "^0.1.0",
60+
"zone.js": "^0.8.4"
6261
},
6362
"engines": {
6463
"node": ">=6.0.0"

src/angular2-swing/swing-stack-component.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
declare var require: any;
2-
31
import {Component, Input,
42
AfterContentInit, EventEmitter } from '@angular/core';
53

6-
import { Direction, ThrowEvent, DragEvent, Stack, Card, StackConfig } from './swing';
74
import {SwingCardComponent} from './swing-card-component';
85

9-
const Swing = require('swing');
6+
import {StackConfig, ThrowEvent, DragEvent} from './swing';
7+
8+
import Stack from '../swing/stack';
109

1110
@Component({
1211
selector: '[swing-stack]',
@@ -45,7 +44,7 @@ export class SwingStackComponent implements AfterContentInit {
4544
dragend: EventEmitter<DragEvent> = new EventEmitter<DragEvent>();
4645

4746
cards: SwingCardComponent[];
48-
stack: Stack;
47+
stack: any;
4948

5049
constructor() {
5150
this.cards = [];
@@ -59,7 +58,7 @@ export class SwingStackComponent implements AfterContentInit {
5958
}
6059

6160
ngAfterContentInit() {
62-
this.stack = Swing.Stack(this.stackConfig || {});
61+
this.stack = Stack(this.stackConfig || {});
6362
this.cards.forEach((c) => this.stack.createCard(c.getNativeElement()));
6463

6564
// Hook various events

src/angular2-swing/swing.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,6 @@ export interface Card {
7272
on(eventName: DragEventName, callabck: (event: DragEvent) => void): void;
7373
}
7474

75-
export interface Stack {
76-
77-
/**
78-
* Creates an instance of Card and associates it with an element.
79-
*
80-
* @param {HTMLElement} element
81-
* @return {Card}
82-
*/
83-
createCard(elment: HTMLElement): void;
84-
85-
/**
86-
* Returns an instance of Card associated with an element.
87-
*
88-
* @param {HTMLElement} element
89-
* @return {Card|null}
90-
*/
91-
getCard(element: HTMLElement): Card;
92-
93-
on(eventName: ThrowEventName, callabck: (event: ThrowEvent) => void): void;
94-
on(eventName: DragEventName, callabck: (event: DragEvent) => void): void;
95-
}
96-
9775
export interface StackConfig {
9876

9977
minThrowOutDistance?: number;

src/swing/card.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import rebound from 'rebound';
44
import vendorPrefix from 'vendor-prefix';
55
import raf from 'raf';
66
import Direction from './Direction';
7+
78
import {
89
elementChildren,
910
isTouchDevice
1011
} from './utilities';
1112

1213
declare var global: any;
14+
declare var Hammer: any;
1315

1416
/**
1517
* @param {number} fromX

src/swing/stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Card from './card';
77
* @param {Object} config Stack configuration.
88
* @returns {Object} An instance of Stack object.
99
*/
10-
const Stack = (config) => {
10+
export const Stack = (config) => {
1111
let eventEmitter;
1212
let index;
1313
let springSystem;

0 commit comments

Comments
 (0)