From a5f8f3f76e3ed572bae9b86f1dc7a7033472d78b Mon Sep 17 00:00:00 2001 From: Chen Fengyuan Date: Sun, 15 Apr 2018 14:44:15 +0800 Subject: [PATCH] build: release 1.3.5 --- CHANGELOG.md | 2 +- dist/cropper.common.js | 55 ++++++------------------ dist/cropper.css | 4 +- dist/cropper.esm.js | 55 ++++++------------------ dist/cropper.js | 55 ++++++------------------ dist/cropper.min.css | 4 +- dist/cropper.min.js | 6 +-- docs/css/cropper.css | 4 +- docs/index.html | 2 +- docs/js/cropper.js | 55 ++++++------------------ package-lock.json | 95 +++++++++++++++++++++++++++++------------- package.json | 14 +++---- 12 files changed, 133 insertions(+), 218 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08d5a2f8f..def770e4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## next +## 1.3.5 (Apr 15, 2018) - Ensure the cloned image loads completely before trigger the `ready` event to avoid side effect (#303). - Add namespace to data attribute names (from `data-*` to `data-cropper-*`) to avoid side effect (#319). diff --git a/dist/cropper.common.js b/dist/cropper.common.js index 4ff68e30e..31b33c1d9 100644 --- a/dist/cropper.common.js +++ b/dist/cropper.common.js @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:16.394Z + * Date: 2018-04-15T06:20:44.574Z */ 'use strict'; @@ -38,8 +38,8 @@ var CLASS_MODAL = NAMESPACE + '-modal'; var CLASS_MOVE = NAMESPACE + '-move'; // Data keys -var DATA_ACTION = 'action'; -var DATA_PREVIEW = 'preview'; +var DATA_ACTION = NAMESPACE + 'Action'; +var DATA_PREVIEW = NAMESPACE + 'Preview'; // Drag modes var DRAG_MODE_CROP = 'crop'; @@ -52,7 +52,6 @@ var EVENT_CROP_END = 'cropend'; var EVENT_CROP_MOVE = 'cropmove'; var EVENT_CROP_START = 'cropstart'; var EVENT_DBLCLICK = 'dblclick'; -var EVENT_LOAD = 'load'; var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown'; var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove'; var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup'; @@ -163,7 +162,7 @@ var DEFAULTS = { zoom: null }; -var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; +var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; @@ -3443,42 +3442,21 @@ var Cropper = function () { } image.src = crossOriginUrl || url; - - var start = this.start.bind(this); - var stop = this.stop.bind(this); - this.image = image; - this.onStart = start; - this.onStop = stop; - - if (this.isImg) { - if (element.complete) { - // start asynchronously to keep `this.cropper` is accessible in `ready` event handler. - this.timeout = setTimeout(start, 0); - } else { - addListener(element, EVENT_LOAD, start, { - once: true - }); - } - } else { - image.onload = start; - image.onerror = stop; - addClass(image, CLASS_HIDE); - element.parentNode.insertBefore(image, element.nextSibling); - } + image.onload = this.start.bind(this); + image.onerror = this.stop.bind(this); + addClass(image, CLASS_HIDE); + element.parentNode.insertBefore(image, element.nextSibling); } }, { key: 'start', - value: function start(event) { + value: function start() { var _this2 = this; var image = this.isImg ? this.element : this.image; - if (event) { - image.onload = null; - image.onerror = null; - } - + image.onload = null; + image.onerror = null; this.sizing = true; var IS_SAFARI = WINDOW.navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(WINDOW.navigator.userAgent); @@ -3645,9 +3623,6 @@ var Cropper = function () { }, { key: 'uncreate', value: function uncreate() { - var element = this.element; - - if (this.ready) { this.unbuild(); this.ready = false; @@ -3658,12 +3633,6 @@ var Cropper = function () { this.sized = false; } else if (this.reloading) { this.xhr.abort(); - } else if (this.isImg) { - if (element.complete) { - clearTimeout(this.timeout); - } else { - removeListener(element, EVENT_LOAD, this.onStart); - } } else if (this.image) { this.stop(); } diff --git a/dist/cropper.css b/dist/cropper.css index 373d88d6f..75a46b82a 100644 --- a/dist/cropper.css +++ b/dist/cropper.css @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:06.196Z + * Date: 2018-04-15T06:19:56.029Z */ .cropper-container { diff --git a/dist/cropper.esm.js b/dist/cropper.esm.js index 47f60d55e..197c60c27 100644 --- a/dist/cropper.esm.js +++ b/dist/cropper.esm.js @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:16.394Z + * Date: 2018-04-15T06:20:44.574Z */ var IN_BROWSER = typeof window !== 'undefined'; @@ -36,8 +36,8 @@ var CLASS_MODAL = NAMESPACE + '-modal'; var CLASS_MOVE = NAMESPACE + '-move'; // Data keys -var DATA_ACTION = 'action'; -var DATA_PREVIEW = 'preview'; +var DATA_ACTION = NAMESPACE + 'Action'; +var DATA_PREVIEW = NAMESPACE + 'Preview'; // Drag modes var DRAG_MODE_CROP = 'crop'; @@ -50,7 +50,6 @@ var EVENT_CROP_END = 'cropend'; var EVENT_CROP_MOVE = 'cropmove'; var EVENT_CROP_START = 'cropstart'; var EVENT_DBLCLICK = 'dblclick'; -var EVENT_LOAD = 'load'; var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown'; var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove'; var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup'; @@ -161,7 +160,7 @@ var DEFAULTS = { zoom: null }; -var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; +var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; @@ -3441,42 +3440,21 @@ var Cropper = function () { } image.src = crossOriginUrl || url; - - var start = this.start.bind(this); - var stop = this.stop.bind(this); - this.image = image; - this.onStart = start; - this.onStop = stop; - - if (this.isImg) { - if (element.complete) { - // start asynchronously to keep `this.cropper` is accessible in `ready` event handler. - this.timeout = setTimeout(start, 0); - } else { - addListener(element, EVENT_LOAD, start, { - once: true - }); - } - } else { - image.onload = start; - image.onerror = stop; - addClass(image, CLASS_HIDE); - element.parentNode.insertBefore(image, element.nextSibling); - } + image.onload = this.start.bind(this); + image.onerror = this.stop.bind(this); + addClass(image, CLASS_HIDE); + element.parentNode.insertBefore(image, element.nextSibling); } }, { key: 'start', - value: function start(event) { + value: function start() { var _this2 = this; var image = this.isImg ? this.element : this.image; - if (event) { - image.onload = null; - image.onerror = null; - } - + image.onload = null; + image.onerror = null; this.sizing = true; var IS_SAFARI = WINDOW.navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(WINDOW.navigator.userAgent); @@ -3643,9 +3621,6 @@ var Cropper = function () { }, { key: 'uncreate', value: function uncreate() { - var element = this.element; - - if (this.ready) { this.unbuild(); this.ready = false; @@ -3656,12 +3631,6 @@ var Cropper = function () { this.sized = false; } else if (this.reloading) { this.xhr.abort(); - } else if (this.isImg) { - if (element.complete) { - clearTimeout(this.timeout); - } else { - removeListener(element, EVENT_LOAD, this.onStart); - } } else if (this.image) { this.stop(); } diff --git a/dist/cropper.js b/dist/cropper.js index 184f99d06..be7e5774c 100644 --- a/dist/cropper.js +++ b/dist/cropper.js @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:16.394Z + * Date: 2018-04-15T06:20:44.574Z */ (function (global, factory) { @@ -42,8 +42,8 @@ var CLASS_MOVE = NAMESPACE + '-move'; // Data keys - var DATA_ACTION = 'action'; - var DATA_PREVIEW = 'preview'; + var DATA_ACTION = NAMESPACE + 'Action'; + var DATA_PREVIEW = NAMESPACE + 'Preview'; // Drag modes var DRAG_MODE_CROP = 'crop'; @@ -56,7 +56,6 @@ var EVENT_CROP_MOVE = 'cropmove'; var EVENT_CROP_START = 'cropstart'; var EVENT_DBLCLICK = 'dblclick'; - var EVENT_LOAD = 'load'; var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown'; var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove'; var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup'; @@ -167,7 +166,7 @@ zoom: null }; - var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; + var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; @@ -3447,42 +3446,21 @@ } image.src = crossOriginUrl || url; - - var start = this.start.bind(this); - var stop = this.stop.bind(this); - this.image = image; - this.onStart = start; - this.onStop = stop; - - if (this.isImg) { - if (element.complete) { - // start asynchronously to keep `this.cropper` is accessible in `ready` event handler. - this.timeout = setTimeout(start, 0); - } else { - addListener(element, EVENT_LOAD, start, { - once: true - }); - } - } else { - image.onload = start; - image.onerror = stop; - addClass(image, CLASS_HIDE); - element.parentNode.insertBefore(image, element.nextSibling); - } + image.onload = this.start.bind(this); + image.onerror = this.stop.bind(this); + addClass(image, CLASS_HIDE); + element.parentNode.insertBefore(image, element.nextSibling); } }, { key: 'start', - value: function start(event) { + value: function start() { var _this2 = this; var image = this.isImg ? this.element : this.image; - if (event) { - image.onload = null; - image.onerror = null; - } - + image.onload = null; + image.onerror = null; this.sizing = true; var IS_SAFARI = WINDOW.navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(WINDOW.navigator.userAgent); @@ -3649,9 +3627,6 @@ }, { key: 'uncreate', value: function uncreate() { - var element = this.element; - - if (this.ready) { this.unbuild(); this.ready = false; @@ -3662,12 +3637,6 @@ this.sized = false; } else if (this.reloading) { this.xhr.abort(); - } else if (this.isImg) { - if (element.complete) { - clearTimeout(this.timeout); - } else { - removeListener(element, EVENT_LOAD, this.onStart); - } } else if (this.image) { this.stop(); } diff --git a/dist/cropper.min.css b/dist/cropper.min.css index 7419f6d0a..8d410c0b2 100644 --- a/dist/cropper.min.css +++ b/dist/cropper.min.css @@ -1,9 +1,9 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:06.196Z + * Date: 2018-04-15T06:19:56.029Z */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline-color:rgba(51,153,255,.75);outline:1px solid #39f;overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed} \ No newline at end of file diff --git a/dist/cropper.min.js b/dist/cropper.min.js index 2231eae97..68cb0b785 100644 --- a/dist/cropper.min.js +++ b/dist/cropper.min.js @@ -1,10 +1,10 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:16.394Z + * Date: 2018-04-15T06:20:44.574Z */ -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Cropper=i()}(this,function(){"use strict";var n="undefined"!=typeof window,r=n?window:{},c="cropper",k="all",T="crop",W="move",E="zoom",H="e",N="w",L="s",z="n",O="ne",Y="nw",X="se",R="sw",h=c+"-crop",t=c+"-disabled",S=c+"-hidden",l=c+"-hide",o=c+"-modal",p=c+"-move",m="action",g="preview",s="crop",d="move",u="none",a="crop",f="cropend",v="cropmove",w="cropstart",b="dblclick",x="load",y=r.PointerEvent?"pointerdown":"touchstart mousedown",M=r.PointerEvent?"pointermove":"touchmove mousemove",C=r.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",D="ready",B="resize",I="wheel mousewheel DOMMouseScroll",A="zoom",U=/^(?:e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,j=/^data:/,P=/^data:image\/jpeg;base64,/,q=/^(?:img|canvas)$/i,$={viewMode:0,dragMode:s,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},Z=function(){function a(t,i){for(var e=0;et.width?3===e?r=t.height*h:s=t.width/h:3===e?s=t.width/h:r=t.height*h;var d={aspectRatio:h,naturalWidth:n,naturalHeight:o,width:r,height:s};d.left=(t.width-r)/2,d.top=(t.height-s)/2,d.oldLeft=d.left,d.oldTop=d.top,this.canvasData=d,this.limited=1===e||2===e,this.limitCanvas(!0,!0),this.initialImageData=it({},i),this.initialCanvasData=it({},d)},limitCanvas:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=e.viewMode,r=n.aspectRatio,s=this.cropped&&o;if(t){var d=Number(e.minCanvasWidth)||0,c=Number(e.minCanvasHeight)||0;1=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,m),n.maxTop=Math.max(0,m))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,i){var e=this.canvasData,a=this.imageData;if(i){var n=function(t){var i=t.width,e=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:e,height:i};var n=a%90*Math.PI/180,o=Math.sin(n),h=Math.cos(n),r=i*h+e*o,s=i*o+e*h;return 90e.maxWidth||e.widthe.maxHeight||e.heighti.width?n.height=n.width/e:n.width=n.height*e),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=i.left+(i.width-n.width)/2,n.top=i.top+(i.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=it({},n)},limitCropBox:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=this.limited,r=e.aspectRatio;if(t){var s=Number(e.minCropBoxWidth)||0,d=Number(e.minCropBoxHeight)||0,c=Math.min(a.width,h?n.width:a.width),l=Math.min(a.height,h?n.height:a.height);s=Math.min(s,a.width),d=Math.min(d,a.height),r&&(s&&d?se.maxWidth||e.widthe.maxHeight||e.height=i.width&&e.height>=i.height?W:k),nt(this.cropBox,it({width:e.width,height:e.height},Bt({translateX:e.left,translateY:e.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),vt(this.element,a,this.getData())}},zt={initPreview:function(){var e=this.crossOrigin,t=this.options.preview,a=e?this.crossOriginUrl:this.url,i=document.createElement("img");if(e&&(i.crossOrigin=e),i.src=a,this.viewBox.appendChild(i),this.viewBoxImage=i,t){var n=t;"string"==typeof t?n=this.element.ownerDocument.querySelectorAll(t):t.querySelector&&(n=[t]),tt(this.previews=n,function(t){var i=document.createElement("img");lt(t,g,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=a,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)})}},resetPreview:function(){tt(this.previews,function(t){var i=ct(t,g);nt(t,{width:i.width,height:i.height}),t.innerHTML=i.html,pt(t,g)})},preview:function(){var r=this.imageData,t=this.canvasData,i=this.cropBoxData,s=i.width,d=i.height,c=r.width,l=r.height,p=i.left-t.left-r.left,m=i.top-t.top-r.top;this.cropped&&!this.disabled&&(nt(this.viewBoxImage,it({width:c,height:l},Bt(it({translateX:-p,translateY:-m},r)))),tt(this.previews,function(t){var i=ct(t,g),e=i.width,a=i.height,n=e,o=a,h=1;s&&(o=d*(h=e/s)),d&&af&&(D.x=f-p);break;case N:s+D.xv&&(D.y=v-m)}};switch(h){case k:s+=D.x,d+=D.y;break;case H:if(0<=D.x&&(f<=p||r&&(d<=u||v<=m))){w=!1;break}B(H),c+=D.x,r&&(l=c/r,d-=D.x/r/2),c<0&&(h=N,c=0);break;case z:if(D.y<=0&&(d<=u||r&&(s<=g||f<=p))){w=!1;break}B(z),l-=D.y,d+=D.y,r&&(c=l*r,s+=D.y*r/2),l<0&&(h=L,l=0);break;case N:if(D.x<=0&&(s<=g||r&&(d<=u||v<=m))){w=!1;break}B(N),c-=D.x,s+=D.x,r&&(l=c/r,d+=D.x/r/2),c<0&&(h=H,c=0);break;case L:if(0<=D.y&&(v<=m||r&&(s<=g||f<=p))){w=!1;break}B(L),l+=D.y,r&&(c=l*r,s-=D.y*r/2),l<0&&(h=z,l=0);break;case O:if(r){if(D.y<=0&&(d<=u||f<=p)){w=!1;break}B(z),l-=D.y,d+=D.y,c=l*r}else B(z),B(H),0<=D.x?p or element.");this.element=t,this.options=it({},$,J(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return Z(e,[{key:"init",value:function(){var t=this.element,i=t.tagName.toLowerCase(),e=void 0;if(!ct(t,c)){if(lt(t,c,this),"img"===i){if(this.isImg=!0,e=t.getAttribute("src")||"",!(this.originalUrl=e))return;e=t.src}else"canvas"===i&&window.HTMLCanvasElement&&(e=t.toDataURL());this.load(e)}}},{key:"load",value:function(t){var i=this;if(t){this.url=t,this.imageData={};var e=this.element,a=this.options;if(a.checkOrientation&&window.ArrayBuffer)if(j.test(t))P.test(t)?this.read((n=t.replace(Ht,""),o=atob(n),h=new ArrayBuffer(o.length),tt(r=new Uint8Array(h),function(t,i){r[i]=o.charCodeAt(i)}),h)):this.clone();else{var n,o,h,r,s=new XMLHttpRequest;this.reloading=!0,this.xhr=s;var d=function(){i.reloading=!1,i.xhr=null};s.ontimeout=d,s.onabort=d,s.onerror=function(){d(),i.clone()},s.onload=function(){d(),i.read(s.response)},a.checkCrossOrigin&&Ct(t)&&e.crossOrigin&&(t=Dt(t)),s.open("get",t),s.responseType="arraybuffer",s.withCredentials="use-credentials"===e.crossOrigin,s.send()}else this.clone()}}},{key:"read",value:function(t){var i,e,a,n=this.options,o=this.imageData,h=Nt(t),r=0,s=1,d=1;if(1
';var o=n.querySelector("."+c+"-container"),h=o.querySelector("."+c+"-canvas"),r=o.querySelector("."+c+"-drag-box"),s=o.querySelector("."+c+"-crop-box"),d=s.querySelector("."+c+"-face");this.container=a,this.cropper=o,this.canvas=h,this.dragBox=r,this.cropBox=s,this.viewBox=o.querySelector("."+c+"-view-box"),this.face=d,h.appendChild(e),ot(t,S),a.insertBefore(o,t.nextSibling),this.isImg||ht(e,l),this.initPreview(),this.bind(),i.aspectRatio=Math.max(0,i.aspectRatio)||NaN,i.viewMode=Math.max(0,Math.min(3,Math.round(i.viewMode)))||0,ot(s,S),i.guides||ot(s.getElementsByClassName(c+"-dashed"),S),i.center||ot(s.getElementsByClassName(c+"-center"),S),i.background&&ot(o,c+"-bg"),i.highlight||ot(d,"cropper-invisible"),i.cropBoxMovable&&(ot(d,p),lt(d,m,k)),i.cropBoxResizable||(ot(s.getElementsByClassName(c+"-line"),S),ot(s.getElementsByClassName(c+"-point"),S)),this.render(),this.ready=!0,this.setDragMode(i.dragMode),i.autoCrop&&this.crop(),this.setData(i.data),_(i.ready)&&ft(t,D,i.ready,{once:!0}),vt(t,D)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),ht(this.element,S))}},{key:"uncreate",value:function(){var t=this.element;this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?this.xhr.abort():this.isImg?t.complete?clearTimeout(this.timeout):ut(t,x,this.onStart):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=St,e}},{key:"setDefaults",value:function(t){it($,J(t)&&t)}}]),e}();return it(It.prototype,Lt,zt,Ot,Yt,Xt,Rt),It}); \ No newline at end of file +!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Cropper=i()}(this,function(){"use strict";var n="undefined"!=typeof window,h=n?window:{},d="cropper",k="all",T="crop",W="move",E="zoom",H="e",N="w",L="s",z="n",O="ne",Y="nw",X="se",R="sw",r=d+"-crop",t=d+"-disabled",S=d+"-hidden",l=d+"-hide",o=d+"-modal",p=d+"-move",m=d+"Action",g=d+"Preview",s="crop",c="move",u="none",a="crop",f="cropend",v="cropmove",w="cropstart",b="dblclick",x=h.PointerEvent?"pointerdown":"touchstart mousedown",y=h.PointerEvent?"pointermove":"touchmove mousemove",M=h.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",C="ready",D="resize",B="wheel mousewheel DOMMouseScroll",A="zoom",I=/^(?:e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,U=/^data:/,j=/^data:image\/jpeg;base64,/,P=/^(?:img|canvas)$/i,q={viewMode:0,dragMode:s,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},Q=function(){function a(t,i){for(var e=0;et.width?3===e?r=t.height*h:s=t.width/h:3===e?s=t.width/h:r=t.height*h;var c={aspectRatio:h,naturalWidth:n,naturalHeight:o,width:r,height:s};c.left=(t.width-r)/2,c.top=(t.height-s)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===e||2===e,this.limitCanvas(!0,!0),this.initialImageData=tt({},i),this.initialCanvasData=tt({},c)},limitCanvas:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=e.viewMode,r=n.aspectRatio,s=this.cropped&&o;if(t){var c=Number(e.minCanvasWidth)||0,d=Number(e.minCanvasHeight)||0;1=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,m),n.maxTop=Math.max(0,m))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,i){var e=this.canvasData,a=this.imageData;if(i){var n=function(t){var i=t.width,e=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:e,height:i};var n=a%90*Math.PI/180,o=Math.sin(n),h=Math.cos(n),r=i*h+e*o,s=i*o+e*h;return 90e.maxWidth||e.widthe.maxHeight||e.heighti.width?n.height=n.width/e:n.width=n.height*e),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=i.left+(i.width-n.width)/2,n.top=i.top+(i.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=tt({},n)},limitCropBox:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=this.limited,r=e.aspectRatio;if(t){var s=Number(e.minCropBoxWidth)||0,c=Number(e.minCropBoxHeight)||0,d=Math.min(a.width,h?n.width:a.width),l=Math.min(a.height,h?n.height:a.height);s=Math.min(s,a.width),c=Math.min(c,a.height),r&&(s&&c?se.maxWidth||e.widthe.maxHeight||e.height=i.width&&e.height>=i.height?W:k),at(this.cropBox,tt({width:e.width,height:e.height},Dt({translateX:e.left,translateY:e.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ft(this.element,a,this.getData())}},Lt={initPreview:function(){var e=this.crossOrigin,t=this.options.preview,a=e?this.crossOriginUrl:this.url,i=document.createElement("img");if(e&&(i.crossOrigin=e),i.src=a,this.viewBox.appendChild(i),this.viewBoxImage=i,t){var n=t;"string"==typeof t?n=this.element.ownerDocument.querySelectorAll(t):t.querySelector&&(n=[t]),_(this.previews=n,function(t){var i=document.createElement("img");dt(t,g,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=a,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)})}},resetPreview:function(){_(this.previews,function(t){var i=ct(t,g);at(t,{width:i.width,height:i.height}),t.innerHTML=i.html,lt(t,g)})},preview:function(){var r=this.imageData,t=this.canvasData,i=this.cropBoxData,s=i.width,c=i.height,d=r.width,l=r.height,p=i.left-t.left-r.left,m=i.top-t.top-r.top;this.cropped&&!this.disabled&&(at(this.viewBoxImage,tt({width:d,height:l},Dt(tt({translateX:-p,translateY:-m},r)))),_(this.previews,function(t){var i=ct(t,g),e=i.width,a=i.height,n=e,o=a,h=1;s&&(o=c*(h=e/s)),c&&af&&(D.x=f-p);break;case N:s+D.xv&&(D.y=v-m)}};switch(h){case k:s+=D.x,c+=D.y;break;case H:if(0<=D.x&&(f<=p||r&&(c<=u||v<=m))){w=!1;break}B(H),d+=D.x,r&&(l=d/r,c-=D.x/r/2),d<0&&(h=N,d=0);break;case z:if(D.y<=0&&(c<=u||r&&(s<=g||f<=p))){w=!1;break}B(z),l-=D.y,c+=D.y,r&&(d=l*r,s+=D.y*r/2),l<0&&(h=L,l=0);break;case N:if(D.x<=0&&(s<=g||r&&(c<=u||v<=m))){w=!1;break}B(N),d-=D.x,s+=D.x,r&&(l=d/r,c+=D.x/r/2),d<0&&(h=H,d=0);break;case L:if(0<=D.y&&(v<=m||r&&(s<=g||f<=p))){w=!1;break}B(L),l+=D.y,r&&(d=l*r,s-=D.y*r/2),l<0&&(h=z,l=0);break;case O:if(r){if(D.y<=0&&(c<=u||f<=p)){w=!1;break}B(z),l-=D.y,c+=D.y,d=l*r}else B(z),B(H),0<=D.x?p or element.");this.element=t,this.options=tt({},q,G(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return Q(e,[{key:"init",value:function(){var t=this.element,i=t.tagName.toLowerCase(),e=void 0;if(!ct(t,d)){if(dt(t,d,this),"img"===i){if(this.isImg=!0,e=t.getAttribute("src")||"",!(this.originalUrl=e))return;e=t.src}else"canvas"===i&&window.HTMLCanvasElement&&(e=t.toDataURL());this.load(e)}}},{key:"load",value:function(t){var i=this;if(t){this.url=t,this.imageData={};var e=this.element,a=this.options;if(a.checkOrientation&&window.ArrayBuffer)if(U.test(t))j.test(t)?this.read((n=t.replace(Et,""),o=atob(n),h=new ArrayBuffer(o.length),_(r=new Uint8Array(h),function(t,i){r[i]=o.charCodeAt(i)}),h)):this.clone();else{var n,o,h,r,s=new XMLHttpRequest;this.reloading=!0,this.xhr=s;var c=function(){i.reloading=!1,i.xhr=null};s.ontimeout=c,s.onabort=c,s.onerror=function(){c(),i.clone()},s.onload=function(){c(),i.read(s.response)},a.checkCrossOrigin&&Mt(t)&&e.crossOrigin&&(t=Ct(t)),s.open("get",t),s.responseType="arraybuffer",s.withCredentials="use-credentials"===e.crossOrigin,s.send()}else this.clone()}}},{key:"read",value:function(t){var i,e,a,n=this.options,o=this.imageData,h=Ht(t),r=0,s=1,c=1;if(1
';var o=n.querySelector("."+d+"-container"),h=o.querySelector("."+d+"-canvas"),r=o.querySelector("."+d+"-drag-box"),s=o.querySelector("."+d+"-crop-box"),c=s.querySelector("."+d+"-face");this.container=a,this.cropper=o,this.canvas=h,this.dragBox=r,this.cropBox=s,this.viewBox=o.querySelector("."+d+"-view-box"),this.face=c,h.appendChild(e),nt(t,S),a.insertBefore(o,t.nextSibling),this.isImg||ot(e,l),this.initPreview(),this.bind(),i.aspectRatio=Math.max(0,i.aspectRatio)||NaN,i.viewMode=Math.max(0,Math.min(3,Math.round(i.viewMode)))||0,nt(s,S),i.guides||nt(s.getElementsByClassName(d+"-dashed"),S),i.center||nt(s.getElementsByClassName(d+"-center"),S),i.background&&nt(o,d+"-bg"),i.highlight||nt(c,"cropper-invisible"),i.cropBoxMovable&&(nt(c,p),dt(c,m,k)),i.cropBoxResizable||(nt(s.getElementsByClassName(d+"-line"),S),nt(s.getElementsByClassName(d+"-point"),S)),this.render(),this.ready=!0,this.setDragMode(i.dragMode),i.autoCrop&&this.crop(),this.setData(i.data),J(i.ready)&&ut(t,C,i.ready,{once:!0}),ft(t,C)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),ot(this.element,S))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?this.xhr.abort():this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=Rt,e}},{key:"setDefaults",value:function(t){tt(q,G(t)&&t)}}]),e}();return tt(St.prototype,Nt,Lt,zt,Ot,Yt,Xt),St}); \ No newline at end of file diff --git a/docs/css/cropper.css b/docs/css/cropper.css index 373d88d6f..75a46b82a 100644 --- a/docs/css/cropper.css +++ b/docs/css/cropper.css @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:06.196Z + * Date: 2018-04-15T06:19:56.029Z */ .cropper-container { diff --git a/docs/index.html b/docs/index.html index 60f51a334..089268d78 100644 --- a/docs/index.html +++ b/docs/index.html @@ -46,7 +46,7 @@
-

Cropper.js v1.3.4

+

Cropper.js v1.3.5

JavaScript image cropper.

diff --git a/docs/js/cropper.js b/docs/js/cropper.js index 184f99d06..be7e5774c 100644 --- a/docs/js/cropper.js +++ b/docs/js/cropper.js @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.3.4 + * Cropper.js v1.3.5 * https://github.com/fengyuanchen/cropperjs * * Copyright (c) 2015-2018 Chen Fengyuan * Released under the MIT license * - * Date: 2018-03-31T06:49:16.394Z + * Date: 2018-04-15T06:20:44.574Z */ (function (global, factory) { @@ -42,8 +42,8 @@ var CLASS_MOVE = NAMESPACE + '-move'; // Data keys - var DATA_ACTION = 'action'; - var DATA_PREVIEW = 'preview'; + var DATA_ACTION = NAMESPACE + 'Action'; + var DATA_PREVIEW = NAMESPACE + 'Preview'; // Drag modes var DRAG_MODE_CROP = 'crop'; @@ -56,7 +56,6 @@ var EVENT_CROP_MOVE = 'cropmove'; var EVENT_CROP_START = 'cropstart'; var EVENT_DBLCLICK = 'dblclick'; - var EVENT_LOAD = 'load'; var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown'; var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove'; var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup'; @@ -167,7 +166,7 @@ zoom: null }; - var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; + var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; @@ -3447,42 +3446,21 @@ } image.src = crossOriginUrl || url; - - var start = this.start.bind(this); - var stop = this.stop.bind(this); - this.image = image; - this.onStart = start; - this.onStop = stop; - - if (this.isImg) { - if (element.complete) { - // start asynchronously to keep `this.cropper` is accessible in `ready` event handler. - this.timeout = setTimeout(start, 0); - } else { - addListener(element, EVENT_LOAD, start, { - once: true - }); - } - } else { - image.onload = start; - image.onerror = stop; - addClass(image, CLASS_HIDE); - element.parentNode.insertBefore(image, element.nextSibling); - } + image.onload = this.start.bind(this); + image.onerror = this.stop.bind(this); + addClass(image, CLASS_HIDE); + element.parentNode.insertBefore(image, element.nextSibling); } }, { key: 'start', - value: function start(event) { + value: function start() { var _this2 = this; var image = this.isImg ? this.element : this.image; - if (event) { - image.onload = null; - image.onerror = null; - } - + image.onload = null; + image.onerror = null; this.sizing = true; var IS_SAFARI = WINDOW.navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(WINDOW.navigator.userAgent); @@ -3649,9 +3627,6 @@ }, { key: 'uncreate', value: function uncreate() { - var element = this.element; - - if (this.ready) { this.unbuild(); this.ready = false; @@ -3662,12 +3637,6 @@ this.sized = false; } else if (this.reloading) { this.xhr.abort(); - } else if (this.isImg) { - if (element.complete) { - clearTimeout(this.timeout); - } else { - removeListener(element, EVENT_LOAD, this.onStart); - } } else if (this.image) { this.stop(); } diff --git a/package-lock.json b/package-lock.json index 86212a4ca..301860e10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cropperjs", - "version": "1.3.4", + "version": "1.3.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3900,12 +3900,11 @@ } }, "eslint-plugin-import": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.10.0.tgz", - "integrity": "sha1-+gkIPVp1KI35xsfQn+EiVZhWVec=", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.11.0.tgz", + "integrity": "sha1-Fa7qN6Z0mdhI6OmBgG1GJ7VQOBY=", "dev": true, "requires": { - "builtin-modules": "1.1.1", "contains-path": "0.1.0", "debug": "2.6.9", "doctrine": "1.5.0", @@ -3914,7 +3913,8 @@ "has": "1.0.1", "lodash": "4.17.5", "minimatch": "3.0.4", - "read-pkg-up": "2.0.0" + "read-pkg-up": "2.0.0", + "resolve": "1.7.1" }, "dependencies": { "doctrine": { @@ -3983,6 +3983,15 @@ "find-up": "2.1.0", "read-pkg": "2.0.0" } + }, + "resolve": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } } } }, @@ -8436,9 +8445,9 @@ } }, "mocha": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.5.tgz", - "integrity": "sha512-3MM3UjZ5p8EJrYpG7s+29HAI9G7sTzKEe4+w37Dg0QP7qL4XGsV+Q2xet2cE37AqdgN1OtYQB6Vl98YiPV3PgA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.1.0.tgz", + "integrity": "sha512-d6RWgYPILd+AoWVOxiD0UwUqRicnE1inTxMr40CXOgqYve1MvnKntoLAtLIcxjEeVjEoYYTe5QAq3mUc6/ySjQ==", "dev": true, "requires": { "browser-stdout": "1.3.1", @@ -8449,6 +8458,7 @@ "glob": "7.1.2", "growl": "1.10.3", "he": "1.1.1", + "minimatch": "3.0.4", "mkdirp": "0.5.1", "supports-color": "4.4.0" }, @@ -11374,27 +11384,47 @@ } }, "postcss-url": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-7.3.1.tgz", - "integrity": "sha512-Ya5KIjGptgz0OtrVYfi2UbLxVAZ6Emc4Of+Grx4Sf1deWlRpFwLr8FrtkUxfqh+XiZIVkXbjQrddE10ESpNmdA==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-7.3.2.tgz", + "integrity": "sha512-QMV5mA+pCYZQcUEPQkmor9vcPQ2MT+Ipuu8qdi1gVxbNiIiErEGft+eny1ak19qALoBkccS5AHaCaCDzh7b9MA==", "dev": true, "requires": { "mime": "1.6.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", - "postcss": "6.0.19", + "postcss": "6.0.21", "xxhashjs": "0.2.2" }, "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.3.0" + } + }, "postcss": { - "version": "6.0.19", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.19.tgz", - "integrity": "sha512-f13HRz0HtVwVaEuW6J6cOUCBLFtymhgyLPV7t4QEk2UD3twRI9IluDcQNdzQdBpiixkXj2OmzejhhTbSbDxNTg==", + "version": "6.0.21", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.21.tgz", + "integrity": "sha512-y/bKfbQz2Nn/QBC08bwvYUxEFOVGfPIUOTsJ2CK5inzlXW9SdYR1x4pEsG9blRAF/PX+wRNdOah+gx/hv4q7dw==", "dev": true, "requires": { - "chalk": "2.3.1", + "chalk": "2.3.2", "source-map": "0.6.1", - "supports-color": "5.2.0" + "supports-color": "5.3.0" } }, "source-map": { @@ -11402,6 +11432,15 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true + }, + "supports-color": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } } } }, @@ -11547,14 +11586,14 @@ "dev": true }, "puppeteer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0.tgz", - "integrity": "sha512-4sY/6mB7+kNPGAzPGKq65tH0VG3ohUEkXHuOReB9K/tw3m1TqifYmxnMR/uDeci/UPwyk5K1gWYh8rw0U0Zscw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0.tgz", + "integrity": "sha512-wx10aPQPpGJVxdB6yoDSLm9p4rCwARUSLMVV0bx++owuqkvviXKyiFM3EWsywaFmjOKNPXacIjplF7xhHiFP3w==", "dev": true, "requires": { "debug": "2.6.9", "extract-zip": "1.6.6", - "https-proxy-agent": "2.2.0", + "https-proxy-agent": "2.2.1", "mime": "1.6.0", "progress": "2.0.0", "proxy-from-env": "1.0.0", @@ -11572,9 +11611,9 @@ } }, "https-proxy-agent": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.0.tgz", - "integrity": "sha512-uUWcfXHvy/dwfM9bqa6AozvAjS32dZSTUYd/4SEpYKRg6LEcPLshksnQYRudM9AyNvUARMfAg5TLjUDyX/K4vA==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", "dev": true, "requires": { "agent-base": "4.2.0", @@ -13854,9 +13893,9 @@ "dev": true }, "uglify-js": { - "version": "3.3.17", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.17.tgz", - "integrity": "sha512-GvY3Ojzk0UwMn1dlLGAihJSQdg4QUMcaJJ3noBnroQfge0vIlKc6B2keNDSNw20UswaCsnyj32BIWv5Lm4YYtA==", + "version": "3.3.21", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.21.tgz", + "integrity": "sha512-uy82472lH8tshK3jS3c5IFb5MmNKd/5qyBd0ih8sM42L3jWvxnE339U9gZU1zufnLVs98Stib9twq8dLm2XYCA==", "dev": true, "requires": { "commander": "2.15.1", diff --git a/package.json b/package.json index 38bb97875..51aaed81c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cropperjs", "description": "JavaScript image cropper.", - "version": "1.3.4", + "version": "1.3.5", "main": "dist/cropper.common.js", "module": "dist/cropper.esm.js", "unpkg": "dist/cropper.js", @@ -46,7 +46,7 @@ "compress:css": "postcss dist/cropper.css -u cssnano -o dist/cropper.min.css --no-map", "compress:js": "uglifyjs dist/cropper.js -o dist/cropper.min.js -c -m --comments /^!/", "copy": "cpy dist/cropper.css docs/css", - "lint": "eslint src test --fix", + "lint": "eslint src test *.js --fix", "release": "npm run clear && npm run lint && npm run build && npm run compress && npm run copy && npm test", "start": "npm-run-all --parallel watch:*", "test": "karma start test/karma.conf.js", @@ -65,7 +65,7 @@ "del-cli": "^1.1.0", "eslint": "^4.19.1", "eslint-config-airbnb-base": "^12.1.0", - "eslint-plugin-import": "^2.10.0", + "eslint-plugin-import": "^2.11.0", "husky": "^0.14.3", "karma": "^2.0.0", "karma-chai": "^0.1.0", @@ -73,18 +73,18 @@ "karma-mocha": "^1.3.0", "karma-mocha-reporter": "^2.2.5", "karma-rollup-preprocessor": "^5.1.1", - "mocha": "^5.0.5", + "mocha": "^5.1.0", "npm-run-all": "^4.1.2", "postcss-cli": "^5.0.0", "postcss-cssnext": "^3.1.0", "postcss-header": "^1.0.0", "postcss-import": "^11.1.0", - "postcss-url": "^7.3.1", - "puppeteer": "^1.2.0", + "postcss-url": "^7.3.2", + "puppeteer": "^1.3.0", "rollup": "^0.57.1", "rollup-plugin-babel": "^3.0.3", "rollup-watch": "^4.3.1", "stylefmt": "^6.0.0", - "uglify-js": "^3.3.17" + "uglify-js": "^3.3.21" } }