From b997e81749b87e4bdcef8e0fa1fa4b444cb78434 Mon Sep 17 00:00:00 2001 From: sculove Date: Wed, 19 Jul 2017 15:52:48 +0900 Subject: [PATCH] chore(version): bumping 2.0.0 --- .gitignore | 2 + demo/release/2.0.0-rc2/dist/pauseresume.js | 593 ------------------ .../release/2.0.0-rc2/dist/pauseresume.min.js | 10 - demo/release/latest/dist/pauseresume.js | 593 ------------------ demo/release/latest/dist/pauseresume.min.js | 10 - package.json | 2 +- 6 files changed, 3 insertions(+), 1207 deletions(-) delete mode 100644 demo/release/2.0.0-rc2/dist/pauseresume.js delete mode 100644 demo/release/2.0.0-rc2/dist/pauseresume.min.js delete mode 100644 demo/release/latest/dist/pauseresume.js delete mode 100644 demo/release/latest/dist/pauseresume.min.js diff --git a/.gitignore b/.gitignore index 3b68d5e..392b67a 100644 --- a/.gitignore +++ b/.gitignore @@ -161,6 +161,7 @@ fabric.properties _site/ demo/dist demo/doc +demo/release .sass-cache/ .jekyll-metadata @@ -207,3 +208,4 @@ report/ temp/ doc/ demo/_data/version.yml +dist diff --git a/demo/release/2.0.0-rc2/dist/pauseresume.js b/demo/release/2.0.0-rc2/dist/pauseresume.js deleted file mode 100644 index 02a2b21..0000000 --- a/demo/release/2.0.0-rc2/dist/pauseresume.js +++ /dev/null @@ -1,593 +0,0 @@ -/*! - * Copyright (c) 2017 NAVER Corp. - * @egjs/pauseresume project is licensed under the MIT license - * - * @egjs/pauseresume JavaScript library - * - * - * @version 2.0.0-rc2 - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("jquery")); - else if(typeof define === 'function' && define.amd) - define(["jquery"], factory); - else { - var a = typeof exports === 'object' ? factory(require("jquery")) : factory(root["jQuery"]); - for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; - } -})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 4); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_0__; - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _AniProperty = __webpack_require__(3); - -var _AniProperty2 = _interopRequireDefault(_AniProperty); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var AniPropertyManager = function () { - function AniPropertyManager() { - _classCallCheck(this, AniPropertyManager); - } - - AniPropertyManager.addAniProperty = function addAniProperty(type, el, prop, optall) { - var newProp = new _AniProperty2.default(type, el, prop, optall); - - el.__aniProps = el.__aniProps || []; - - // Animation is excuted immediately. - if (el.__aniProps.length === 0) { - newProp.init(); - } - el.__aniProps.push(newProp); - }; - - AniPropertyManager.removeAniProperty = function removeAniProperty(el) { - var removeProp = el.__aniProps.shift(); - - removeProp && removeProp.clearEasingFn(); - el.__aniProps[0] && el.__aniProps[0].init(); - }; - - AniPropertyManager.prepareNextAniProp = function prepareNextAniProp(el) { - // Dequeue animation property that was ended. - var removeProp = el.__aniProps.shift(); - var userCallback = removeProp.opt.old; - - removeProp.clearEasingFn(); - - // Callback should be called before aniProps.init() - if (userCallback && typeof userCallback === "function") { - userCallback.call(el); - } - - // If next ani property exists - el.__aniProps[0] && el.__aniProps[0].init(); - return el.__aniProps[0]; - }; - - // Check if this element can be paused/resume. - - - AniPropertyManager.getStatus = function getStatus(el) { - if (!el.__aniProps || el.__aniProps.length === 0) { - // Current element doesn't have animation information. - // Check 'animate' is applied to this element. - return "empty"; - } - - return el.__aniProps[0].paused ? "paused" : "inprogress"; - }; - - return AniPropertyManager; -}(); - -exports.default = AniPropertyManager; -module.exports = exports["default"]; - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var MathUtil = function () { - function MathUtil() { - _classCallCheck(this, MathUtil); - } - - MathUtil.interpolateNumber = function interpolateNumber(a, b) { - var numA = +a; - var numB = +b; - - return function (t) { - return numA * (1 - t) + numB * t; - }; - }; - - MathUtil.uninterpolateNumber = function uninterpolateNumber(a, b) { - var numA = +a; - var numB = b - numA; - - numB = numB || 1 / numB; - - return function (x) { - return (x - numA) / numB; - }; - }; - - // Adopt linear scale from d3 - - - MathUtil.scaler = function scaler(domain, range) { - var u = MathUtil.uninterpolateNumber(domain[0], domain[1]); - var i = MathUtil.interpolateNumber(range[0], range[1]); - - return function (x) { - return i(u(x)); - }; - }; - - return MathUtil; -}(); - -exports.default = MathUtil; -module.exports = exports["default"]; - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _jquery = __webpack_require__(0); - -var _jquery2 = _interopRequireDefault(_jquery); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var $ = _jquery2.default; -var uuid = 1; - -var AniProperty = function () { - function AniProperty(type, el, prop, optall) { - _classCallCheck(this, AniProperty); - - this.el = el; - this.opt = optall; - this.start = -1; - this.elapsed = 0; - this.paused = false; - this.uuid = uuid++; - this.easingNames = []; - this.prop = prop; - this.type = type; - } - - AniProperty.prototype.init = function init() { - this.start = $.now(); - this.elapsed = 0; - - for (var propName in this.prop) { - var propValue = this.prop[propName]; - - // DO NOT SUPPORT TRANSFORM YET - // TODO: convert from relative value to absolute value on transform - if (propName === "transform") { - continue; - } - - if (typeof propValue !== "string") { - continue; - } - - // If it has a absoulte value. - var markIndex = propValue.search(/[+|-]=/); - - if (markIndex < 0) { - // this.prop[propName] = propValue; - continue; - } - - // If it has a relative value - var sign = propValue.charAt(markIndex) === "-" ? -1 : 1; - - // Current value - var currValue = $.css(this.el, propName); - - // CurrValue + (relativeValue) - this.prop[propName] = propValue.replace(/([-|+])*([\d|.])+/g, AniProperty.generateAbsoluteValMaker(currValue, propName, sign)).replace(/[-|+]+=/g, ""); - } - }; - - AniProperty.prototype.addEasingFn = function addEasingFn(easingName) { - this.easingNames.push(easingName); - }; - - AniProperty.prototype.clearEasingFn = function clearEasingFn() { - var easing = void 0; - - easing = this.easingNames.shift(); - while (easing) { - delete $.easing[easing]; - easing = this.easingNames.shift(); - } - this.easingNames = []; - }; - - /** - * Generate a new absolute value maker. - * - * function to avoid JS Hint error "Don't make functions within a loop" - */ - - - AniProperty.generateAbsoluteValMaker = function generateAbsoluteValMaker(prevValue, propName, sign) { - var prev = prevValue; - - return function absoluteValMaker(match) { - if (!prev || prev === "auto") { - // Empty strings, null, undefined and "auto" are converted to 0. - // This solution is somewhat extracted from jQuery Tween.propHooks._default.get - // TODO: Should we consider adopting a Tween.propHooks? - prev = 0; - } else { - prev = parseFloat(prev); - } - return prev + match * sign; - }; - }; - - return AniProperty; -}(); - -exports.default = AniProperty; -module.exports = exports["default"]; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _jquery = __webpack_require__(0); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _AniPropertyManager = __webpack_require__(1); - -var _AniPropertyManager2 = _interopRequireDefault(_AniPropertyManager); - -var _MathUtil = __webpack_require__(2); - -var _MathUtil2 = _interopRequireDefault(_MathUtil); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @namespace jQuery - */ -exports.default = function ($) { - var animateFn = $.fn.animate; - var stopFn = $.fn.stop; - var delayFn = $.fn.delay; - - /** - * Generate a new easing function. - * - * function to avoid JS Hint error "Don't make functions within a loop" - */ - function generateNewEasingFunc(resumePercent, remainPercent, scale, originalEasing) { - return function easingFunc(percent) { - var newPercent = resumePercent + remainPercent * percent; - - return scale(originalEasing(newPercent)); - }; - } - - $.fn.animate = function (prop, speed, easing, callback) { - return this.each(function () { - // optall should be made for each elements. - var optall = $.speed(speed, easing, callback); - - // prepare next animation when current animation completed. - optall.complete = function () { - _AniPropertyManager2.default.prepareNextAniProp(this); - }; - - // Queue animation property to recover the current animation. - _AniPropertyManager2.default.addAniProperty("animate", this, prop, optall); - animateFn.call($(this), prop, optall); - }); - - // TODO: Below code is more reasonable? - // return animateFn.call(this, prop, optall); // and declare optall at outside this.each loop. - }; - - /** - * Set a timer to delay execution of subsequent items in the queue. - * And it internally manages "fx"queue to support pause/resume if "fx" type. - * - * @param {Number} An integer indicating the number of milliseconds to delay execution of the next item in the queue. - * @param {String} A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - $.fn.delay = function (time, type) { - var t = void 0; - var isCallByResume = arguments.length <= 2 ? undefined : arguments[2]; // internal used value. - - if (type && type !== "fx") { - return delayFn.call(this, time, type); - } - - t = parseInt(time, 10); - t = isNaN(t) ? 0 : t; - - return this.each(function () { - var _this = this; - - if (!isCallByResume) { - // Queue delay property to recover the current animation. - // Don't add property when delay is called by resume. - _AniPropertyManager2.default.addAniProperty("delay", this, null, { duration: t }); - } - - delayFn.call($(this), time).queue(function (next) { - next(); - - // Remove delay property when delay has been expired. - _AniPropertyManager2.default.removeAniProperty(_this); - }); - }); - }; - - /** - * Pauses the animation executed through a call to the jQuery .animate() method. - * @ko jQuery의animate() 메서드가 실행한 애니메이션을 일시 정지한다 - * - * @name jQuery#pause - * @method - * @support {"ie": "10+", "ch" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} - * @example - * $("#box").pause(); //paused the current animation - */ - $.fn.pause = function () { - return this.each(function () { - var p = void 0; - - if (_AniPropertyManager2.default.getStatus(this) !== "inprogress") { - return; - } - // Clear fx-queue except 1 dummy function - // for promise not to be expired when calling stop() - $.queue(this, "fx", [$.noop]); - stopFn.call($(this)); - - // Remember current animation property - p = this.__aniProps[0]; - if (p) { - p.elapsed += $.now() - p.start; - - // Complement native timer's inaccuracy (complete timer can be different from your request.) - // (eg. your request:400ms -> real :396 ~ 415 ms )) - if (p.elapsed >= p.opt.duration) { - p = _AniPropertyManager2.default.prepareNextAniProp(this); - } - - p && (p.paused = true); - } - }); - }; - - /** - * Resumes the animation paused through a call to the pause() method. - * @ko pause() 메서드가 일시 정지한 애니메이션을 다시 실행한다 - * - * @name jQuery#resume - * @alias eg.Pause - * @method - * @support {"ie": "10+", "ch" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} - * @example - * $("#box").resume(); //resume the paused animation - */ - $.fn.resume = function () { - return this.each(function () { - var type = "fx"; - var p = void 0; - var i = void 0; - - if (_AniPropertyManager2.default.getStatus(this) !== "paused") { - return; - } - - // Clear fx-queue, - // And this queue will be initialized by animate call. - $.queue(this, type || "fx", []); - - // Restore __aniProps - i = 0; - p = this.__aniProps[i]; - - while (p) { - // Restore easing status - if (p.elapsed > 0 && p.opt.easing) { - var resumePercent = p.elapsed / p.opt.duration; - var remainPercent = 1 - resumePercent; - var originalEasing = $.easing[p.opt.easing]; - var startEasingValue = originalEasing(resumePercent); - var scale = _MathUtil2.default.scaler([startEasingValue, 1], [0, 1]); - var newEasingName = p.opt.easing + "_" + p.uuid; - - // Make new easing function that continues from pause point. - $.easing[newEasingName] = generateNewEasingFunc(resumePercent, remainPercent, scale, originalEasing); - p.opt.easing = newEasingName; - - // Store new easing function to clear it later. - p.addEasingFn(newEasingName); - } - - p.paused = false; - p.opt.duration -= p.elapsed; - - // If duration remains, request 'animate' with storing aniProps - if (p.opt.duration > 0 || p.elapsed === 0) { - i === 0 && p.init(); - - if (p.type === "delay") { - // pass last parameter 'true' not to add an aniProperty. - $(this).delay(p.opt.duration, "fx", true); - } else { - animateFn.call($(this), p.prop, p.opt); - } - } - - i++; - p = this.__aniProps[i]; - } - }); - }; - - $.fn.stop = function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var type = args[0]; - var clearQ = args[1]; - - stopFn.apply(this, args); - - if (typeof type !== "string") { - clearQ = type; - } - - return this.each(function () { - var p = void 0; - - // When this element was not animated properly, do nothing. - if (_AniPropertyManager2.default.getStatus(this) === "empty") { - return; - } - - if (!clearQ) { - p = this.__aniProps.shift(); - p && p.clearEasingFn(); - } else { - // If clearQueue is requested, - // then all properties must be initialized - // for element not to be resumed. - p = this.__aniProps.shift(); - while (p) { - p.clearEasingFn(); - p = this.__aniProps.shift(); - } - this.__aniProps = []; - } - }); - }; - - $.expr.filters.paused = function (elem) { - return _AniPropertyManager2.default.getStatus(elem) === "paused"; - }; -}(_jquery2.default); - -module.exports = exports["default"]; - -/***/ }) -/******/ ]); -}); \ No newline at end of file diff --git a/demo/release/2.0.0-rc2/dist/pauseresume.min.js b/demo/release/2.0.0-rc2/dist/pauseresume.min.js deleted file mode 100644 index c04bc4e..0000000 --- a/demo/release/2.0.0-rc2/dist/pauseresume.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - * Copyright (c) 2017 NAVER Corp. - * @egjs/pauseresume project is licensed under the MIT license - * - * @egjs/pauseresume JavaScript library - * - * - * @version 2.0.0-rc2 - */ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("jquery"));else if("function"==typeof define&&define.amd)define(["jquery"],t);else{var r=t("object"==typeof exports?require("jquery"):e.jQuery);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e){return function(e){function __webpack_require__(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,__webpack_require__),n.l=!0,n.exports}var t={};return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.i=function(e){return e},__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=4)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=r(3),i=function(e){return e&&e.__esModule?e:{"default":e}}(n),a=function(){function AniPropertyManager(){_classCallCheck(this,AniPropertyManager)}return AniPropertyManager.addAniProperty=function(e,t,r,n){var a=new i.default(e,t,r,n);t.__aniProps=t.__aniProps||[],0===t.__aniProps.length&&a.init(),t.__aniProps.push(a)},AniPropertyManager.removeAniProperty=function(e){var t=e.__aniProps.shift();t&&t.clearEasingFn(),e.__aniProps[0]&&e.__aniProps[0].init()},AniPropertyManager.prepareNextAniProp=function(e){var t=e.__aniProps.shift(),r=t.opt.old;return t.clearEasingFn(),r&&"function"==typeof r&&r.call(e),e.__aniProps[0]&&e.__aniProps[0].init(),e.__aniProps[0]},AniPropertyManager.getStatus=function(e){return e.__aniProps&&0!==e.__aniProps.length?e.__aniProps[0].paused?"paused":"inprogress":"empty"},AniPropertyManager}();t.default=a,e.exports=t.default},function(e,t,r){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=function(){function MathUtil(){_classCallCheck(this,MathUtil)}return MathUtil.interpolateNumber=function(e,t){var r=+e,n=+t;return function(e){return r*(1-e)+n*e}},MathUtil.uninterpolateNumber=function(e,t){var r=+e,n=t-r;return n=n||1/n,function(e){return(e-r)/n}},MathUtil.scaler=function(e,t){var r=MathUtil.uninterpolateNumber(e[0],e[1]),n=MathUtil.interpolateNumber(t[0],t[1]);return function(e){return n(r(e))}},MathUtil}();t.default=n,e.exports=t.default},function(e,t,r){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=r(0),i=function(e){return e&&e.__esModule?e:{"default":e}}(n),a=i.default,o=1,s=function(){function AniProperty(e,t,r,n){_classCallCheck(this,AniProperty),this.el=t,this.opt=n,this.start=-1,this.elapsed=0,this.paused=!1,this.uuid=o++,this.easingNames=[],this.prop=r,this.type=e}return AniProperty.prototype.init=function(){this.start=a.now(),this.elapsed=0;for(var e in this.prop){var t=this.prop[e];if("transform"!==e&&"string"==typeof t){var r=t.search(/[+|-]=/);if(!(r<0)){var n="-"===t.charAt(r)?-1:1,i=a.css(this.el,e);this.prop[e]=t.replace(/([-|+])*([\d|.])+/g,AniProperty.generateAbsoluteValMaker(i,e,n)).replace(/[-|+]+=/g,"")}}}},AniProperty.prototype.addEasingFn=function(e){this.easingNames.push(e)},AniProperty.prototype.clearEasingFn=function(){var e=void 0;for(e=this.easingNames.shift();e;)delete a.easing[e],e=this.easingNames.shift();this.easingNames=[]},AniProperty.generateAbsoluteValMaker=function(e,t,r){var n=e;return function(e){return(n=n&&"auto"!==n?parseFloat(n):0)+e*r}},AniProperty}();t.default=s,e.exports=t.default},function(e,t,r){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var n=r(0),i=_interopRequireDefault(n),a=r(1),o=_interopRequireDefault(a),s=r(2),u=_interopRequireDefault(s);t.default=function(e){function generateNewEasingFunc(e,t,r,n){return function(i){return r(n(e+t*i))}}var t=e.fn.animate,r=e.fn.stop,n=e.fn.delay;e.fn.animate=function(r,n,i,a){return this.each(function(){var s=e.speed(n,i,a);s.complete=function(){o.default.prepareNextAniProp(this)},o.default.addAniProperty("animate",this,r,s),t.call(e(this),r,s)})},e.fn.delay=function(t,r){var i=void 0,a=arguments.length<=2?void 0:arguments[2];return r&&"fx"!==r?n.call(this,t,r):(i=parseInt(t,10),i=isNaN(i)?0:i,this.each(function(){var r=this;a||o.default.addAniProperty("delay",this,null,{duration:i}),n.call(e(this),t).queue(function(e){e(),o.default.removeAniProperty(r)})}))},e.fn.pause=function(){return this.each(function(){var t=void 0;"inprogress"===o.default.getStatus(this)&&(e.queue(this,"fx",[e.noop]),r.call(e(this)),(t=this.__aniProps[0])&&(t.elapsed+=e.now()-t.start,t.elapsed>=t.opt.duration&&(t=o.default.prepareNextAniProp(this)),t&&(t.paused=!0)))})},e.fn.resume=function(){return this.each(function(){var r=void 0,n=void 0;if("paused"===o.default.getStatus(this))for(e.queue(this,"fx",[]),n=0,r=this.__aniProps[n];r;){if(r.elapsed>0&&r.opt.easing){var i=r.elapsed/r.opt.duration,a=1-i,s=e.easing[r.opt.easing],p=s(i),f=u.default.scaler([p,1],[0,1]),l=r.opt.easing+"_"+r.uuid;e.easing[l]=generateNewEasingFunc(i,a,f,s),r.opt.easing=l,r.addEasingFn(l)}r.paused=!1,r.opt.duration-=r.elapsed,(r.opt.duration>0||0===r.elapsed)&&(0===n&&r.init(),"delay"===r.type?e(this).delay(r.opt.duration,"fx",!0):t.call(e(this),r.prop,r.opt)),n++,r=this.__aniProps[n]}})},e.fn.stop=function(){for(var e=arguments.length,t=Array(e),n=0;n.animate() method. - * @ko jQuery의animate() 메서드가 실행한 애니메이션을 일시 정지한다 - * - * @name jQuery#pause - * @method - * @support {"ie": "10+", "ch" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} - * @example - * $("#box").pause(); //paused the current animation - */ - $.fn.pause = function () { - return this.each(function () { - var p = void 0; - - if (_AniPropertyManager2.default.getStatus(this) !== "inprogress") { - return; - } - // Clear fx-queue except 1 dummy function - // for promise not to be expired when calling stop() - $.queue(this, "fx", [$.noop]); - stopFn.call($(this)); - - // Remember current animation property - p = this.__aniProps[0]; - if (p) { - p.elapsed += $.now() - p.start; - - // Complement native timer's inaccuracy (complete timer can be different from your request.) - // (eg. your request:400ms -> real :396 ~ 415 ms )) - if (p.elapsed >= p.opt.duration) { - p = _AniPropertyManager2.default.prepareNextAniProp(this); - } - - p && (p.paused = true); - } - }); - }; - - /** - * Resumes the animation paused through a call to the pause() method. - * @ko pause() 메서드가 일시 정지한 애니메이션을 다시 실행한다 - * - * @name jQuery#resume - * @alias eg.Pause - * @method - * @support {"ie": "10+", "ch" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} - * @example - * $("#box").resume(); //resume the paused animation - */ - $.fn.resume = function () { - return this.each(function () { - var type = "fx"; - var p = void 0; - var i = void 0; - - if (_AniPropertyManager2.default.getStatus(this) !== "paused") { - return; - } - - // Clear fx-queue, - // And this queue will be initialized by animate call. - $.queue(this, type || "fx", []); - - // Restore __aniProps - i = 0; - p = this.__aniProps[i]; - - while (p) { - // Restore easing status - if (p.elapsed > 0 && p.opt.easing) { - var resumePercent = p.elapsed / p.opt.duration; - var remainPercent = 1 - resumePercent; - var originalEasing = $.easing[p.opt.easing]; - var startEasingValue = originalEasing(resumePercent); - var scale = _MathUtil2.default.scaler([startEasingValue, 1], [0, 1]); - var newEasingName = p.opt.easing + "_" + p.uuid; - - // Make new easing function that continues from pause point. - $.easing[newEasingName] = generateNewEasingFunc(resumePercent, remainPercent, scale, originalEasing); - p.opt.easing = newEasingName; - - // Store new easing function to clear it later. - p.addEasingFn(newEasingName); - } - - p.paused = false; - p.opt.duration -= p.elapsed; - - // If duration remains, request 'animate' with storing aniProps - if (p.opt.duration > 0 || p.elapsed === 0) { - i === 0 && p.init(); - - if (p.type === "delay") { - // pass last parameter 'true' not to add an aniProperty. - $(this).delay(p.opt.duration, "fx", true); - } else { - animateFn.call($(this), p.prop, p.opt); - } - } - - i++; - p = this.__aniProps[i]; - } - }); - }; - - $.fn.stop = function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var type = args[0]; - var clearQ = args[1]; - - stopFn.apply(this, args); - - if (typeof type !== "string") { - clearQ = type; - } - - return this.each(function () { - var p = void 0; - - // When this element was not animated properly, do nothing. - if (_AniPropertyManager2.default.getStatus(this) === "empty") { - return; - } - - if (!clearQ) { - p = this.__aniProps.shift(); - p && p.clearEasingFn(); - } else { - // If clearQueue is requested, - // then all properties must be initialized - // for element not to be resumed. - p = this.__aniProps.shift(); - while (p) { - p.clearEasingFn(); - p = this.__aniProps.shift(); - } - this.__aniProps = []; - } - }); - }; - - $.expr.filters.paused = function (elem) { - return _AniPropertyManager2.default.getStatus(elem) === "paused"; - }; -}(_jquery2.default); - -module.exports = exports["default"]; - -/***/ }) -/******/ ]); -}); \ No newline at end of file diff --git a/demo/release/latest/dist/pauseresume.min.js b/demo/release/latest/dist/pauseresume.min.js deleted file mode 100644 index c04bc4e..0000000 --- a/demo/release/latest/dist/pauseresume.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - * Copyright (c) 2017 NAVER Corp. - * @egjs/pauseresume project is licensed under the MIT license - * - * @egjs/pauseresume JavaScript library - * - * - * @version 2.0.0-rc2 - */ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("jquery"));else if("function"==typeof define&&define.amd)define(["jquery"],t);else{var r=t("object"==typeof exports?require("jquery"):e.jQuery);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e){return function(e){function __webpack_require__(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,__webpack_require__),n.l=!0,n.exports}var t={};return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.i=function(e){return e},__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=4)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=r(3),i=function(e){return e&&e.__esModule?e:{"default":e}}(n),a=function(){function AniPropertyManager(){_classCallCheck(this,AniPropertyManager)}return AniPropertyManager.addAniProperty=function(e,t,r,n){var a=new i.default(e,t,r,n);t.__aniProps=t.__aniProps||[],0===t.__aniProps.length&&a.init(),t.__aniProps.push(a)},AniPropertyManager.removeAniProperty=function(e){var t=e.__aniProps.shift();t&&t.clearEasingFn(),e.__aniProps[0]&&e.__aniProps[0].init()},AniPropertyManager.prepareNextAniProp=function(e){var t=e.__aniProps.shift(),r=t.opt.old;return t.clearEasingFn(),r&&"function"==typeof r&&r.call(e),e.__aniProps[0]&&e.__aniProps[0].init(),e.__aniProps[0]},AniPropertyManager.getStatus=function(e){return e.__aniProps&&0!==e.__aniProps.length?e.__aniProps[0].paused?"paused":"inprogress":"empty"},AniPropertyManager}();t.default=a,e.exports=t.default},function(e,t,r){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=function(){function MathUtil(){_classCallCheck(this,MathUtil)}return MathUtil.interpolateNumber=function(e,t){var r=+e,n=+t;return function(e){return r*(1-e)+n*e}},MathUtil.uninterpolateNumber=function(e,t){var r=+e,n=t-r;return n=n||1/n,function(e){return(e-r)/n}},MathUtil.scaler=function(e,t){var r=MathUtil.uninterpolateNumber(e[0],e[1]),n=MathUtil.interpolateNumber(t[0],t[1]);return function(e){return n(r(e))}},MathUtil}();t.default=n,e.exports=t.default},function(e,t,r){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=r(0),i=function(e){return e&&e.__esModule?e:{"default":e}}(n),a=i.default,o=1,s=function(){function AniProperty(e,t,r,n){_classCallCheck(this,AniProperty),this.el=t,this.opt=n,this.start=-1,this.elapsed=0,this.paused=!1,this.uuid=o++,this.easingNames=[],this.prop=r,this.type=e}return AniProperty.prototype.init=function(){this.start=a.now(),this.elapsed=0;for(var e in this.prop){var t=this.prop[e];if("transform"!==e&&"string"==typeof t){var r=t.search(/[+|-]=/);if(!(r<0)){var n="-"===t.charAt(r)?-1:1,i=a.css(this.el,e);this.prop[e]=t.replace(/([-|+])*([\d|.])+/g,AniProperty.generateAbsoluteValMaker(i,e,n)).replace(/[-|+]+=/g,"")}}}},AniProperty.prototype.addEasingFn=function(e){this.easingNames.push(e)},AniProperty.prototype.clearEasingFn=function(){var e=void 0;for(e=this.easingNames.shift();e;)delete a.easing[e],e=this.easingNames.shift();this.easingNames=[]},AniProperty.generateAbsoluteValMaker=function(e,t,r){var n=e;return function(e){return(n=n&&"auto"!==n?parseFloat(n):0)+e*r}},AniProperty}();t.default=s,e.exports=t.default},function(e,t,r){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var n=r(0),i=_interopRequireDefault(n),a=r(1),o=_interopRequireDefault(a),s=r(2),u=_interopRequireDefault(s);t.default=function(e){function generateNewEasingFunc(e,t,r,n){return function(i){return r(n(e+t*i))}}var t=e.fn.animate,r=e.fn.stop,n=e.fn.delay;e.fn.animate=function(r,n,i,a){return this.each(function(){var s=e.speed(n,i,a);s.complete=function(){o.default.prepareNextAniProp(this)},o.default.addAniProperty("animate",this,r,s),t.call(e(this),r,s)})},e.fn.delay=function(t,r){var i=void 0,a=arguments.length<=2?void 0:arguments[2];return r&&"fx"!==r?n.call(this,t,r):(i=parseInt(t,10),i=isNaN(i)?0:i,this.each(function(){var r=this;a||o.default.addAniProperty("delay",this,null,{duration:i}),n.call(e(this),t).queue(function(e){e(),o.default.removeAniProperty(r)})}))},e.fn.pause=function(){return this.each(function(){var t=void 0;"inprogress"===o.default.getStatus(this)&&(e.queue(this,"fx",[e.noop]),r.call(e(this)),(t=this.__aniProps[0])&&(t.elapsed+=e.now()-t.start,t.elapsed>=t.opt.duration&&(t=o.default.prepareNextAniProp(this)),t&&(t.paused=!0)))})},e.fn.resume=function(){return this.each(function(){var r=void 0,n=void 0;if("paused"===o.default.getStatus(this))for(e.queue(this,"fx",[]),n=0,r=this.__aniProps[n];r;){if(r.elapsed>0&&r.opt.easing){var i=r.elapsed/r.opt.duration,a=1-i,s=e.easing[r.opt.easing],p=s(i),f=u.default.scaler([p,1],[0,1]),l=r.opt.easing+"_"+r.uuid;e.easing[l]=generateNewEasingFunc(i,a,f,s),r.opt.easing=l,r.addEasingFn(l)}r.paused=!1,r.opt.duration-=r.elapsed,(r.opt.duration>0||0===r.elapsed)&&(0===n&&r.init(),"delay"===r.type?e(this).delay(r.opt.duration,"fx",!0):t.call(e(this),r.prop,r.opt)),n++,r=this.__aniProps[n]}})},e.fn.stop=function(){for(var e=arguments.length,t=Array(e),n=0;n