Skip to content

Commit

Permalink
env: move to babel-loader, mojs.coffee -> mojs.babel.js
Browse files Browse the repository at this point in the history
  • Loading branch information
legomushroom committed Feb 16, 2016
1 parent 46bd25a commit 7c7ef69
Show file tree
Hide file tree
Showing 19 changed files with 6,442 additions and 6,878 deletions.
12,668 changes: 5,870 additions & 6,798 deletions build/mo.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions build/mo.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gulpfile.js
Expand Up @@ -73,7 +73,7 @@ gulp.task('lib', function(e){
gulp.task('babel-lib', function(e){
return gulp.src(paths.src.babel)
.pipe(plumber())
.pipe(babel())
.pipe(babel({ presets: ['es2015'] }))
.pipe(rename(function (path) {
return path.basename = path.basename.replace('.babel', '');
})
Expand Down
35 changes: 35 additions & 0 deletions js/mojs.babel.js
@@ -0,0 +1,35 @@
import h from './h';
import shapesMap from './shapes/shapesMap';
import Burst from './burst';
import Transit from './transit';
import Swirl from './swirl';
import Stagger from './stagger';
import Spriter from './spriter';
import MotionPath from './motion-path';
import Tween from './tween/tween';
import Timeline from './tween/timeline';
import Tweener from './tween/tweener';
import tweener from './tween/tweener';
import easing from './easing/easing';

window.mojs = {
revision: '0.169.2', isDebug: true,
helpers: h,
Transit, Swirl, Burst, Stagger, Spriter, MotionPath,
Tween, Timeline, tweener,
easing, shapesMap
}

mojs.h = mojs.helpers;
mojs.delta = mojs.h.delta;

// ### istanbul ignore next ###
if ( (typeof define === "function") && define.amd ) {
define("mojs", [], function () { return mojs; });
}
// ### istanbul ignore next ###
if ( (typeof module === "object") && (typeof module.exports === "object") ) {
module.exports = mojs;
}
// # ### istanbul ignore next ###
// # window?.mojs = mojs
27 changes: 0 additions & 27 deletions js/mojs.coffee

This file was deleted.

4 changes: 2 additions & 2 deletions js/motion-path.coffee
Expand Up @@ -4,8 +4,8 @@
# @class MotionPath
h = require './h'
resize = require './vendor/resize'
Tween = require './tween/tween'
Timeline = require './tween/timeline'
Tween = require('./tween/tween').default
Timeline = require('./tween/timeline').default

class MotionPath
# ---
Expand Down
17 changes: 8 additions & 9 deletions js/stagger.babel.js
Expand Up @@ -41,20 +41,19 @@ class Stagger {
*/
_getChildQuantity (name, store) {
// if number was set
if (typeof name === 'number')
return name;
if (typeof name === 'number') { return name; }

var quantifier = store[name];
if (h.isArray(quantifier))
return quantifier.length;
else if (quantifier + '' === '[object NodeList]')
return quantifier.length;
else if (quantifier + '' === '[object HTMLCollection]')
if (h.isArray(quantifier)) { return quantifier.length; }
else if (quantifier + '' === '[object NodeList]') {
return quantifier.length;
} else if (quantifier + '' === '[object HTMLCollection]') {
return Array.prototype.slice.call(quantifier, 0).length;
else if (quantifier instanceof HTMLElement)
} else if (quantifier instanceof HTMLElement) {
return 1;
else if (typeof quantifier == 'string')
} else if (typeof quantifier == 'string') {
return 1;
}
}

/*
Expand Down
8 changes: 4 additions & 4 deletions js/transit.coffee
Expand Up @@ -3,13 +3,14 @@
h = require './h'
Bit = require './shapes/bit'
shapesMap = require './shapes/shapesMap'
Tween = require './tween/tween'
Timeline = require './tween/timeline'
Tween = require('./tween/tween').default
Timeline = require('./tween/timeline').default

# TODO
# - don't run by default
# - tween properties
# - properties signatures
# - Stagger -> stagger

class Transit extends Bit
progress: 0
Expand Down Expand Up @@ -344,8 +345,7 @@ class Transit extends Bit
opts.onUpdate = (p)=> @setProgress p
opts.onStart = => @props.onStart?.apply(@)
opts.onComplete = => @props.onComplete?.apply @
opts.onFirstUpdate = ->
it.tuneOptions it.history[@index]
opts.onFirstUpdate = -> it.tuneOptions it.history[@index]
opts.isChained = !o.delay
@timeline.append new Tween(opts)
@
Expand Down
20 changes: 10 additions & 10 deletions js/tween/tween.babel.js
Expand Up @@ -7,7 +7,7 @@ var Tween = class Tween {
Method do declare defaults with this._defaults object.
@private
*/
_declareDefaults() {
_declareDefaults () {
// DEFAULTS
this._defaults = {
/* duration of the tween [0..∞] */
Expand Down Expand Up @@ -63,7 +63,7 @@ var Tween = class Tween {
@param {Number} Shift time in milliseconds.
@return {Object} Self.
*/
play (shift = 0) {
play ( shift = 0 ) {
if ( this._state === 'play' && this._isRunning ) { return false; }
this._props.isReversed = false;
this._subPlay( shift, 'play' );
Expand All @@ -76,7 +76,7 @@ var Tween = class Tween {
@param {Number} Shift time in milliseconds.
@return {Object} Self.
*/
playBackward (shift = 0) {
playBackward ( shift = 0 ) {
if ( this._state === 'reverse' && this._isRunning) { return false; }
this._props.isReversed = true;
this._subPlay( shift, 'reverse' );
Expand Down Expand Up @@ -120,7 +120,7 @@ var Tween = class Tween {
@param {Number} Progress to set.
@returns {Object} Self.
*/
setProgress (progress) {
setProgress ( progress ) {
var p = this._props;
// set start time if there is no one yet.
!p.startTime && this._setStartTime();
Expand Down Expand Up @@ -307,7 +307,7 @@ var Tween = class Tween {
0 = no edge jump.
1 = edge jump in positive direction.
*/
_update (time, timelinePrevTime, wasYoyo, onEdge) {
_update ( time, timelinePrevTime, wasYoyo, onEdge ) {
var p = this._props;
// if we don't the _prevTime thus the direction we are heading to,
// but prevTime was passed thus we are child of a Timeline
Expand Down Expand Up @@ -413,7 +413,7 @@ var Tween = class Tween {
@private
@param {Number} Current update time.
*/
_updateInInactiveArea (time) {
_updateInInactiveArea ( time ) {
if ( !this._isInActiveArea ) { return; }
var p = this._props;

Expand Down Expand Up @@ -444,7 +444,7 @@ var Tween = class Tween {
@private
@param {Number} Current update time.
*/
_updateInActiveArea (time) {
_updateInActiveArea ( time ) {

var props = this._props,
delayDuration = props.delay + props.duration,
Expand Down Expand Up @@ -641,7 +641,7 @@ var Tween = class Tween {
@param {Object, String} Hash object of key/value pairs, or property name
@param {_} Property's value to set
*/
_setProp(obj, value) {
_setProp( obj, value ) {
// handle hash object case
if (typeof obj === 'object') {
for (var key in obj) {
Expand Down Expand Up @@ -707,7 +707,7 @@ var Tween = class Tween {
@param {Boolean} Is yoyo perido. Used in Timeline to pass to Tween.
@returns {Object} Self.
*/
_setProgress (p, time, isYoyo) {
_setProgress ( p, time, isYoyo ) {
var props = this._props,
isYoyoChanged = props.wasYoyo !== isYoyo;
this.progress = p;
Expand Down Expand Up @@ -802,7 +802,7 @@ var Tween = class Tween {
@private
@param {Number} Progress to set.
*/
_progress (progress, time) {
_progress ( progress, time ) {
if (this._props.onProgress != null && typeof this._props.onProgress === 'function') {
this._props.onProgress.call(this, progress, time > this._prevTime );
}
Expand Down
4 changes: 2 additions & 2 deletions js/tween/tweener.babel.js
@@ -1,5 +1,5 @@
require('../polyfills/raf');
require('../polyfills/performance');
import '../polyfills/raf';
import '../polyfills/performance';
import h from '../h';

class Tweener {
Expand Down

0 comments on commit 7c7ef69

Please sign in to comment.