diff --git a/.travis.yml b/.travis.yml
index bddffc90..ac3e224e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: node_js
node_js:
-- '8'
+- '12'
env:
email: false
global:
diff --git a/README.md b/README.md
index 94883881..76188496 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Muuri
-[![gzip size](http://img.badgesize.io/https://unpkg.com/muuri@0.7.1/dist/muuri.min.js?compression=gzip)](https://unpkg.com/muuri@0.7.1/dist/muuri.min.js)
+[![gzip size](http://img.badgesize.io/https://unpkg.com/muuri@0.8.0/dist/muuri.min.js?compression=gzip)](https://unpkg.com/muuri@0.8.0/dist/muuri.min.js)
[![npm](https://img.shields.io/npm/v/muuri.svg)](http://npm.im/muuri)
Muuri is a JavaScript layout engine that allows you to build all kinds of layouts and make them responsive, sortable, filterable, draggable and/or animated. Comparing to what's out there Muuri is a combination of [Packery](http://packery.metafizzy.co/), [Masonry](http://masonry.desandro.com/), [Isotope](http://isotope.metafizzy.co/) and [Sortable](https://github.com/RubaXa/Sortable). Wanna see it in action? Check out the [demo](http://haltu.github.io/muuri/) on the website.
@@ -34,20 +34,18 @@ Muuri uses [Web Animations](https://developer.mozilla.org/en-US/docs/Web/API/Web
### 1. Get Muuri
-Download:
-* [muuri.js](https://unpkg.com/muuri@0.7.1/dist/muuri.js) - for development (not minified, with comments).
-* [muuri.min.js](https://unpkg.com/muuri@0.7.1/dist/muuri.min.js) - for production (minified, no comments).
-
-Or link directly:
-
-```html
-
+Install via [npm](https://www.npmjs.com/):
+```bash
+npm install muuri
```
-Or install with [npm](https://www.npmjs.com/):
+Or download:
+* [muuri.js](https://unpkg.com/muuri@0.8.0/dist/muuri.js) - for development (not minified, with comments).
+* [muuri.min.js](https://unpkg.com/muuri@0.8.0/dist/muuri.min.js) - for production (minified, no comments).
-```bash
-npm install muuri
+Or link directly:
+```html
+
```
### 2. Get Web Animations Polyfill (if needed)
@@ -63,8 +61,8 @@ npm install web-animations-js
Add Muuri on your site and make sure to include the Web Animations Polyfill before Muuri (if needed).
```html
-
-
+
+
```
### 4. Add the markup
@@ -231,7 +229,8 @@ The default options are stored in `Muuri.defaultOptions` object, which in it's d
userSelect: 'none',
userDrag: 'none',
tapHighlightColor: 'rgba(0, 0, 0, 0)',
- touchCallout: 'none'
+ touchCallout: 'none',
+ contentZooming: 'none'
},
dragPlaceholder: {
enabled: false,
@@ -297,6 +296,7 @@ var gridB = new Muuri('.grid-b', {
* [dragSortPredicate](#dragsortpredicate-)
* [dragReleaseDuration](#dragreleaseduration-)
* [dragReleaseEasing](#dragreleaseeasing-)
+* [dragCssProps](#dragcssprops-)
* [dragPlaceholder](#dragplaceholder-)
* [containerClass](#containerclass-)
* [itemClass](#itemclass-)
@@ -905,6 +905,55 @@ var grid = new Muuri(elem, {
});
```
+### dragCssProps
+
+Drag specific CSS properties that Muuri sets to the draggable item elements. Muuri automatically prefixes the properties before applying them to the element. `touchAction` property is required to be always defined, but the other properties are optional and can be omitted by setting their value to an empty string if you want to e.g. define them via CSS only.
+
+* Default value: `{touchAction: 'none', userSelect: 'none', userDrag: 'none', tapHighlightColor: 'rgba(0, 0, 0, 0)', touchCallout: 'none', contentZooming: 'none'}`.
+* Accepted types: object.
+
+You can define the following properties:
+
+* **touchAction** — *string*
+ * Default value: `'none'`.
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action
+* **userSelect** — *string*
+ * Default value: `'none'`.
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
+ * Optional.
+* **userDrag** — *string*
+ * Default value: `'none'`.
+ * http://help.dottoro.com/lcbixvwm.php
+ * Optional.
+* **tapHighlightColor** — *string*
+ * Default value: `'rgba(0, 0, 0, 0)'`.
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-tap-highlight-color
+ * Optional.
+* **touchCallout** — *string*
+ * Default value: `'none'`.
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-touch-callout
+ * Optional.
+* **contentZooming** — *string*
+ * Default value: `'none'`.
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-content-zooming
+ * Optional.
+
+```javascript
+// Only set the required touch-action CSS property via the options if you for
+// example want to set the other props via CSS instead.
+var grid = new Muuri(elem, {
+ dragEnabled: true,
+ dragCssProps: {
+ touchAction: 'pan-y',
+ userSelect: '',
+ userDrag: '',
+ tapHighlightColor: '',
+ touchCallout: '',
+ contentZooming: ''
+ }
+});
+```
+
### dragPlaceholder
If you want a placeholder item to appear for the duration of an item's drag & drop procedure you can enable and configure it here.
diff --git a/dist/muuri.js b/dist/muuri.js
index 3d987d24..f5d3066f 100644
--- a/dist/muuri.js
+++ b/dist/muuri.js
@@ -473,19 +473,6 @@
callback && callback();
};
- var supportsPassive = false;
- try {
- var passiveOpts = Object.defineProperty({}, 'passive', {
- get: function() {
- supportsPassive = true;
- }
- });
- window.addEventListener('testPassive', null, passiveOpts);
- window.removeEventListener('testPassive', null, passiveOpts);
- } catch (e) {}
-
- var isPassiveEventsSupported = supportsPassive;
-
var vendorPrefixes = ['', 'webkit', 'moz', 'ms', 'o', 'Webkit', 'Moz', 'MS', 'O'];
/**
@@ -524,6 +511,20 @@
}
).bind(window);
+ // Detect support for passive events:
+ // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
+ var isPassiveEventsSupported = false;
+ try {
+ var passiveOpts = Object.defineProperty({}, 'passive', {
+ get: function() {
+ isPassiveEventsSupported = true;
+ }
+ });
+ window.addEventListener('testPassive', null, passiveOpts);
+ window.removeEventListener('testPassive', null, passiveOpts);
+ } catch (e) {}
+
+ // Dragger events.
var events = {
start: 'start',
move: 'move',
@@ -1022,27 +1023,30 @@
*
* @public
* @memberof Dragger.prototype
- * @param {Object} [props]
+ * @param {Object} [newProps]
*/
- Dragger.prototype.setCssProps = function(props) {
- if (!props) return;
+ Dragger.prototype.setCssProps = function(newProps) {
+ if (!newProps) return;
- var cssProps = this._cssProps;
+ var currentProps = this._cssProps;
var element = this._element;
var prop;
var prefixedProp;
- // Reset existing props.
- for (prop in cssProps) {
- element.style[prop] = cssProps[prop];
- delete cssProps[prop];
+ // Reset current props.
+ for (prop in currentProps) {
+ element.style[prop] = currentProps[prop];
+ delete currentProps[prop];
}
// Set new props.
- for (prop in props) {
+ for (prop in newProps) {
+ // Make sure we have a value for the prop.
+ if (!newProps[prop]) continue;
+
// Special handling for touch-action.
if (prop === taProp) {
- this.setTouchAction(props[prop]);
+ this.setTouchAction(newProps[prop]);
continue;
}
@@ -1051,8 +1055,8 @@
if (!prefixedProp) continue;
// Store the prop and add the style.
- cssProps[prefixedProp] = '';
- element.style[prefixedProp] = props[prop];
+ currentProps[prefixedProp] = '';
+ element.style[prefixedProp] = newProps[prop];
}
};
@@ -5634,7 +5638,8 @@
userSelect: 'none',
userDrag: 'none',
tapHighlightColor: 'rgba(0, 0, 0, 0)',
- touchCallout: 'none'
+ touchCallout: 'none',
+ contentZooming: 'none'
},
dragPlaceholder: {
enabled: false,
diff --git a/dist/muuri.min.js b/dist/muuri.min.js
index eab205c2..4bd2fc7d 100644
--- a/dist/muuri.min.js
+++ b/dist/muuri.min.js
@@ -14,4 +14,4 @@
* Copyright (c) 2018-present, Niklas Rämö
* @license MIT
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Muuri=e()}(this,function(){"use strict";var t={},e="layoutEnd";function i(){this._events={},this._queue=[],this._counter=0,this._isDestroyed=!1}i.prototype.on=function(t,e){if(this._isDestroyed)return this;var i=this._events[t];return i||(i=this._events[t]=[]),i.push(e),this},i.prototype.off=function(t,e){if(this._isDestroyed)return this;var i=this._events[t];if(!i||!i.length)return this;if(!e)return i.length=0,this;for(var s=i.length;s--;)e===i[s]&&i.splice(s,1);return this},i.prototype.emit=function(t,e,i,s){if(this._isDestroyed)return this;var n=this._events[t];if(!n||!n.length)return this;var r,o=this._queue,h=o.length,a=arguments.length-1;for(r=0;r-1||(T._activeInstances.push(t),T._emitter.on(b,t._onMove),T._emitter.on(E,t._onCancel),T._emitter.on(A,t._onEnd),1===T._activeInstances.length&&T._bindListeners())},T._deactivateInstance=function(t){var e=T._activeInstances.indexOf(t);-1!==e&&(T._activeInstances.splice(e,1),T._emitter.off(b,t._onMove),T._emitter.off(E,t._onCancel),T._emitter.off(A,t._onEnd),T._activeInstances.length||T._unbindListeners())},T._bindListeners=function(){var t=T._events;window.addEventListener(t.move,T._onMove,x),window.addEventListener(t.end,T._onEnd,x),t.cancel&&window.addEventListener(t.cancel,T._onCancel,x)},T._unbindListeners=function(){var t=T._events;window.removeEventListener(t.move,T._onMove,x),window.removeEventListener(t.end,T._onEnd,x),t.cancel&&window.removeEventListener(t.cancel,T._onCancel,x)},T._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},T._getTouchById=function(t,e){if("number"==typeof t.pointerId)return t.pointerId===e?t:null;if(t.changedTouches){for(var i=0;i-1&&(this._queue[n]=void 0),s?this._queue.unshift(t):this._queue.push(t),this._reads[t]=e,this._writes[t]=i,this._nextStep||(this._nextStep=S(this._step))},k.prototype.cancel=function(t){var e=this._queue.indexOf(t);e>-1&&(this._queue[e]=void 0,delete this._reads[t],delete this._writes[t])},k.prototype._step=function(){var t,e,i=this._queue,s=this._reads,n=this._writes,r=this._batch,o=this._batchReads,h=this._batchWrites,a=i.length;for(this._nextStep=null,e=0;en?n:e<0?Math.max(n+e+1,0):e}function Q(t,e,i){if(!(t.length<2)){var s=K(t,e),n=K(t,i);s!==n&&t.splice(n,0,t.splice(s,1)[0])}}function tt(t,e,i){if(!(t.length<2)){var s,n=K(t,e),r=K(t,i);n!==r&&(s=t[n],t[n]=t[r],t[r]=s)}}var et="cancel",it="finish",st="debounce",nt=0;function rt(t,e){var i,s=++nt+st;return e>0?function(n){void 0!==i&&(i=window.clearTimeout(i),X.cancel(s),n===it&&t()),n!==et&&n!==it&&(i=window.setTimeout(function(){i=void 0,X.add(s,t,null,!0)},e))}:function(e){e!==et&&t()}}function ot(t){var e=a(t,"transform");if(!e||"none"===e)return!1;var i=a(t,"display");return"inline"!==i&&"none"!==i}function ht(t,e){for(var i=window.document,s=(e?t:t.parentElement)||i;s&&s!==i&&"static"===a(s,"position")&&!ot(s);)s=s.parentElement||i;return s}function at(t,e){return parseFloat(a(t,e))||0}var _t={},lt={},dt={};function ct(t,e){var i,s=e||{};return s.left=0,s.top=0,t===document?s:(s.left=window.pageXOffset||0,s.top=window.pageYOffset||0,t.self===window.self?s:(i=t.getBoundingClientRect(),s.left+=i.left,s.top+=i.top,s.left+=at(t,"border-left-width"),s.top+=at(t,"border-top-width"),s))}function ut(t,e,i){return dt.left=0,dt.top=0,t===e?dt:i&&(t=ht(t,!0))===(e=ht(e,!0))?dt:(ct(t,_t),ct(e,lt),dt.left=lt.left-_t.left,dt.top=lt.top-_t.top,dt)}var ft="overflow",pt="overflow-x",mt="overflow-y",gt="auto",yt="scroll";function vt(t){var e=a(t,ft);return e===gt||e===yt||((e=a(t,pt))===gt||e===yt||((e=a(t,mt))===gt||e===yt))}function wt(t,e,i){for(var s=i||[],n=e?t:t.parentNode;n&&n!==document;)n.getRootNode&&n instanceof DocumentFragment?n=n.getRootNode().host:(vt(n)&&s.push(n),n=n.parentNode);return s.push(window),s}var St={},Dt="transform",bt="none",At=/^matrix3d/,Et=/([^,]*,){4}/,Ct=/([^,]*,){12}/,Lt=/[^,]*,/;function It(t){St.x=0,St.y=0;var e=a(t,Dt);if(!e||e===bt)return St;var i=At.test(e),s=e.replace(i?Ct:Et,""),n=s.replace(Lt,"");return St.x=parseFloat(s)||0,St.y=parseFloat(n)||0,St}function Rt(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function xt(t,e){t.classList?t.classList.remove(e):j(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim())}var Pt,Mt,Tt,kt,Xt=0;function Yt(t){var e=t._element,i=t.getGrid(),s=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=c(s.dragStartPredicate)?s.dragStartPredicate:Yt.defaultStartPredicate,this._startPredicateState=Xt,this._startPredicateResult=void 0,this._hBlockedIndex=null,this._hX1=0,this._hX2=0,this._hY1=0,this._hY2=0,this._reset(),this._preStartCheck=this._preStartCheck.bind(this),this._preEndCheck=this._preEndCheck.bind(this),this._onScroll=this._onScroll.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._prepareScroll=this._prepareScroll.bind(this),this._applyScroll=this._applyScroll.bind(this),this._checkOverlap=this._checkOverlap.bind(this);var n=s.dragSortHeuristics.sortInterval;this._checkOverlapDebounce=rt(this._checkOverlap,n),this._dragger=new T(e,s.dragCssProps),this._dragger.on("start",this._preStartCheck),this._dragger.on("move",this._preStartCheck),this._dragger.on("cancel",this._preEndCheck),this._dragger.on("end",this._preEndCheck)}function Gt(t,e){return t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top?0:(Math.min(t.left+t.width,e.left+e.width)-Math.max(t.left,e.left))*(Math.min(t.top+t.height,e.top+e.height)-Math.max(t.top,e.top))/(Math.min(t.width,e.width)*Math.min(t.height,e.height))*100}function Ht(t){this._item=t,this._animate=new p,this._element=null,this._className="",this._didMigrate=!1,this._resetAfterLayout=!1,this._currentLeft=0,this._currentTop=0,this._nextLeft=0,this._nextTop=0,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this),this._onLayoutStart=this._onLayoutStart.bind(this),this._onLayoutEnd=this._onLayoutEnd.bind(this),this._onReleaseEnd=this._onReleaseEnd.bind(this),this._onMigrate=this._onMigrate.bind(this)}function Ot(){this._queue=[],this._isDestroyed=!1}function Bt(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isInterrupted=!1,this._currentStyles={},this._targetStyles={},this._currentLeft=0,this._currentTop=0,this._offsetLeft=0,this._offsetTop=0,this._skipNextAnimation=!1,this._animateOptions={onFinish:this._finish.bind(this)},this._queue=new Ot,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}Yt.defaultStartPredicate=function(t,e,i){var s=t._drag,n=s._startPredicateData||s._setupStartPredicate(i);if(!e.isFinal)return!(!n.handleElement&&(n.handleElement=s._getStartPredicateHandle(e),!n.handleElement))&&(n.delay&&(n.event=e,n.delayTimer||(n.delayTimer=window.setTimeout(function(){n.delay=0,s._resolveStartPredicate(n.event)&&(s._forceResolveStartPredicate(n.event),s._resetStartPredicate())},n.delay))),s._resolveStartPredicate(e));s._finishStartPredicate(e)},Yt.defaultSortPredicate=(Pt={},Mt={},Tt={},kt=[],function(t,e){var i=t._drag,s=i._getGrid(),n=e&&"number"==typeof e.threshold?e.threshold:50,r=e&&"swap"===e.action?"swap":"move";Pt.width=t._width,Pt.height=t._height,Pt.left=i._elementClientX,Pt.top=i._elementClientY;var o=function(t,e,i){var s,n,r,o,h=null,a=e._settings.dragSort,_=-1;if(!0===a?(kt[0]=e,n=kt):n=a.call(e,t),!Array.isArray(n))return h;for(o=0;oi&&s>_&&(_=s,h=r));return kt.length=0,h}(t,s,n);if(!o)return!1;var h,a,_,l,d,c=0,u=0,f=-1;for(o===s?(Pt.left=i._gridX+t._marginLeft,Pt.top=i._gridY+t._marginTop):(o._updateBorders(1,0,1,0),c=o._left+o._borderLeft,u=o._top+o._borderTop),d=0;df&&(h=d,f=l));return f=n&&(Tt.grid=o,Tt.index=h,Tt.action=r,Tt)}),Yt.prototype.stop=function(){var t=this._item,e=t._element,i=this._getGrid();return this._isActive?this._isMigrating?(this._finishMigration(),this):(q(t._id),F(t._id),this._unbindScrollListeners(),this._checkOverlapDebounce("cancel"),e.parentNode!==i._element&&(i._element.appendChild(e),e.style[n]=Rt(this._gridX,this._gridY)),xt(e,i._settings.itemDraggingClass),this._reset(),this):this},Yt.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(),this._dragger.destroy(),this._isDestroyed=!0,this)},Yt.prototype._getGrid=function(){return t[this._gridId]||null},Yt.prototype._reset=function(){this._isActive=!1,this._container=null,this._containingBlock=null,this._dragEvent=null,this._scrollEvent=null,this._scrollers=[],this._left=0,this._top=0,this._gridX=0,this._gridY=0,this._elementClientX=0,this._elementClientY=0,this._containerDiffX=0,this._containerDiffY=0},Yt.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,s=this._container,n=this._scrollers;if(n.length=0,wt(this._item._element,!1,n),s!==i)for(wt(i,!0,t=[]),e=0;e=s&&t.pageX=n&&t.pageY3&&e.minBounceBackAngle>0;if(h||(this._hBlockedIndex=null),Math.abs(r)>i||Math.abs(o)>i){if(h){var a=Math.atan2(r,o),_=Math.atan2(this._hX2-this._hX1,this._hY2-this._hY1),l=Math.atan2(Math.sin(a-_),Math.cos(a-_));Math.abs(l)>e.minBounceBackAngle&&(this._hBlockedIndex=null)}return this._hX1=this._hX2,this._hY1=this._hY2,this._hX2=s,this._hY2=n,!0}return!1},Yt.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},Yt.prototype._checkOverlap=function(){if(this._isActive){var t,e,i,s,n,r,o,h=this._item,a=this._getGrid()._settings;(t=c(a.dragSortPredicate)?a.dragSortPredicate(h,this._dragEvent):Yt.defaultSortPredicate(h,a.dragSortPredicate))&&"number"==typeof t.index&&(o=(e=h.getGrid())!==(s=t.grid||e),i=e._items.indexOf(h),n=K(s._items,t.index,o),r="swap"===t.action?"swap":"move",(o||n!==this._hBlockedIndex)&&(o?(this._hBlockedIndex=null,e._hasListeners("beforeSend")&&e._emit("beforeSend",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),s._hasListeners("beforeReceive")&&s._emit("beforeReceive",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),h._gridId=s._id,this._isMigrating=h._gridId!==this._gridId,e._items.splice(i,1),J(s._items,h,n),h._sortData=null,e._hasListeners("send")&&e._emit("send",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),s._hasListeners("receive")&&s._emit("receive",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),e.layout(),s.layout()):i!==n&&(this._hBlockedIndex=i,("swap"===r?tt:Q)(e._items,i,n),e._hasListeners("move")&&e._emit("move",{item:h,fromIndex:i,toIndex:n,action:r}),e.layout())))}},Yt.prototype._finishMigration=function(){var t,e,i=this._item,s=i._release,r=i._element,o=i._isActive,h=i.getGrid(),a=h._element,_=h._settings,l=_.dragContainer||a,d=this._getGrid()._settings,c=r.parentNode;this._isMigrating=!1,this.destroy(),xt(r,d.itemClass),xt(r,d.itemVisibleClass),xt(r,d.itemHiddenClass),U(r,_.itemClass),U(r,o?_.itemVisibleClass:_.itemHiddenClass),l!==c&&(l.appendChild(r),e=ut(c,l,!0),(t=It(r)).x-=e.left,t.y-=e.top),i._refreshDimensions(),i._refreshSortData(),e=ut(l,a,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=_.dragEnabled?new Yt(i):null,l!==c&&(r.style[n]=Rt(t.x,t.y)),i._child.removeAttribute("style"),f(i._child,o?_.visibleStyles:_.hiddenStyles),s.start()},Yt.prototype._preStartCheck=function(t){this._startPredicateState===Xt&&(this._startPredicateState=1),1===this._startPredicateState?(this._startPredicateResult=this._startPredicate(this._item,t),!0===this._startPredicateResult?(this._startPredicateState=2,this._onStart(t)):!1===this._startPredicateResult&&(this._startPredicateState=3)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},Yt.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=Xt,e&&this._isActive&&this._onEnd(t)},Yt.prototype._onStart=function(t){var e=this._item;if(e._isActive){var i,s=e._element,r=this._getGrid(),o=r._settings,h=e._release,a=e._migrate,_=r._element,l=o.dragContainer||_,d=ht(l,!0),c=It(s),u=c.x,f=c.y,p=s.getBoundingClientRect(),m=l!==_;this._resetHeuristics(t),m&&(i=ut(d,_)),e.isPositioning()&&e._layout.stop(!0,{transform:Rt(u,f)}),a._isActive&&(u-=a._containerDiffX,f-=a._containerDiffY,a.stop(!0,{transform:Rt(u,f)})),e.isReleasing()&&h._reset(),this._isActive=!0,this._dragEvent=t,this._container=l,this._containingBlock=d,this._elementClientX=p.left,this._elementClientY=p.top,this._left=this._gridX=u,this._top=this._gridY=f,o.dragPlaceholder.enabled&&e._dragPlaceholder.create(),r._emit("dragInit",e,t),m&&(this._containerDiffX=i.left,this._containerDiffY=i.top,s.parentNode===l?(this._gridX=u-this._containerDiffX,this._gridY=f-this._containerDiffY):(this._left=u+this._containerDiffX,this._top=f+this._containerDiffY,l.appendChild(s),s.style[n]=Rt(this._left,this._top))),U(s,o.itemDraggingClass),this._bindScrollListeners(),r._emit("dragStart",e,t)}},Yt.prototype._onMove=function(t){var e=this._item;if(e._isActive){var i,s,n,r=this._getGrid()._settings.dragAxis;if("y"!==r){var o=t.clientX-this._dragEvent.clientX;this._left+=o,this._gridX+=o,this._elementClientX+=o}if("x"!==r){var h=t.clientY-this._dragEvent.clientY;this._top+=h,this._gridY+=h,this._elementClientY+=h}this._dragEvent=t,i=e._id,s=this._prepareMove,n=this._applyMove,X.add(i+H,s,n,!0)}else this.stop()},Yt.prototype._prepareMove=function(){this._item._isActive&&this._getGrid()._settings.dragSort&&this._checkHeuristics(this._dragEvent)&&this._checkOverlapDebounce()},Yt.prototype._applyMove=function(){var t=this._item;t._isActive&&(t._element.style[n]=Rt(this._left,this._top),this._getGrid()._emit("dragMove",t,this._dragEvent))},Yt.prototype._onScroll=function(t){var e,i,s,n=this._item;n._isActive?(this._scrollEvent=t,e=n._id,i=this._prepareScroll,s=this._applyScroll,X.add(e+O,i,s,!0)):this.stop()},Yt.prototype._prepareScroll=function(){var t=this._item;if(t._isActive){var e,i=t._element,s=this._getGrid(),n=s._settings,r=n.dragAxis,o=s._element,h=i.getBoundingClientRect(),a=this._elementClientX-h.left,_=this._elementClientY-h.top;this._container!==o&&(e=ut(this._containingBlock,o),this._containerDiffX=e.left,this._containerDiffY=e.top),"y"!==r&&(this._left+=a,this._gridX=this._left-this._containerDiffX),"x"!==r&&(this._top+=_,this._gridY=this._top-this._containerDiffY),n.dragSort&&this._checkOverlapDebounce()}},Yt.prototype._applyScroll=function(){var t=this._item;t._isActive&&(t._element.style[n]=Rt(this._left,this._top),this._getGrid()._emit("dragScroll",t,this._scrollEvent))},Yt.prototype._onEnd=function(t){var e=this._item,i=e._element,s=this._getGrid(),n=s._settings,r=e._release;e._isActive?(q(e._id),F(e._id),n.dragSort&&this._checkOverlapDebounce("finish"),this._unbindScrollListeners(),r._containerDiffX=this._containerDiffX,r._containerDiffY=this._containerDiffY,this._reset(),xt(i,n.itemDraggingClass),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():r.start()):this.stop()},Ht.prototype._onLayoutStart=function(){var t=this._item,e=t.getGrid(),i=e._items.indexOf(t),s=e._layout.slots[2*i],n=e._layout.slots[2*i+1];if(this._didMigrate||t._left!==s||t._top!==n){var r,o,h;if(s+=t._marginLeft,n+=t._marginTop,!(e._settings.dragPlaceholder.duration>0)||this._didMigrate){z(t._id);var a={transform:Rt(s,n)};return this._animate.isAnimating()?this._animate.stop(a):f(this._element,a),void(this._didMigrate&&(e.getElement().appendChild(this._element),this._didMigrate=!1))}this._nextLeft=s,this._nextTop=n,r=t._id,o=this._setupAnimation,h=this._startAnimation,X.add(r+B,o,h)}},Ht.prototype._setupAnimation=function(){if(this.isActive()){var t=It(this._element);this._currentLeft=t.x,this._currentTop=t.y}},Ht.prototype._startAnimation=function(){if(this.isActive()){var t=this._animate,e=this._currentLeft,i=this._currentTop,s=this._nextLeft,n=this._nextTop,r={transform:Rt(s,n)};if(e!==s||i!==n){var o=this._item.getGrid()._settings.dragPlaceholder,h={transform:Rt(e,i)};t.start(h,r,{duration:o.duration,easing:o.easing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&t.stop(r)}},Ht.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},Ht.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animate.isAnimating())return void this.reset();this._resetAfterLayout=!0}},Ht.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off("dragReleaseEnd",this._onReleaseEnd),e.off("layoutStart",this._onLayoutStart),e.off("beforeSend",this._onMigrate),i.on("dragReleaseEnd",this._onReleaseEnd),i.on("layoutStart",this._onLayoutStart),i.on("beforeSend",this._onMigrate),this._didMigrate=!0}},Ht.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),s=i._settings,n=this._animate;t=c(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):window.document.createElement("div"),this._element=t,n._element=t,this._className=s.itemPlaceholderClass||"",this._className&&U(t,this._className);var r=e._left+e._marginLeft,o=e._top+e._marginTop;f(t,{display:"block",position:"absolute",left:"0",top:"0",width:e._width+"px",height:e._height+"px",transform:Rt(r,o)}),i.on("layoutStart",this._onLayoutStart),i.on("dragReleaseEnd",this._onReleaseEnd),i.on("beforeSend",this._onMigrate),c(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},Ht.prototype.reset=function(){if(this.isActive()){var t=this._element,e=this._item,i=e.getGrid(),s=i._settings,n=this._animate;this._resetAfterLayout=!1,z(e._id),n.stop(),n._element=null,i.off("dragReleaseEnd",this._onReleaseEnd),i.off("layoutStart",this._onLayoutStart),i.off("beforeSend",this._onMigrate),this._className&&(xt(t,this._className),this._className=""),t.parentNode.removeChild(t),this._element=null,c(s.dragPlaceholder.onRemove)&&s.dragPlaceholder.onRemove(e,t)}},Ht.prototype.updateDimensions=function(t,e){this.isActive()&&f(this._element,{width:t+"px",height:e+"px"})},Ht.prototype.isActive=function(){return!!this._element},Ht.prototype.destroy=function(){this.reset(),this._animate.destroy(),this._item=this._animate=null},Ot.prototype.add=function(t){return this._isDestroyed?this:(this._queue.push(t),this)},Ot.prototype.flush=function(t,e){if(this._isDestroyed)return this;var i,s=this._queue,n=s.length;if(!n)return this;var r=1===n,o=r?s[0]:s.slice(0);if(s.length=0,r)return o(t,e),this;for(i=0;i0;return l&&this._queue.flush(!0,o),d&&(a._isPositioningStarted=!0),c(e)&&this._queue.add(e),m?(this._isActive=!0,this._animateOptions.easing=p,this._animateOptions.duration=u,this._isInterrupted=l,s=o._id,n=this._setupAnimation,r=this._startAnimation,X.add(s+Y,n,r),this):(this._updateOffsets(),this._updateTargetStyles(),i=o._animate.isAnimating(),this.stop(!1,this._targetStyles),!i&&f(h,this._targetStyles),this._skipNextAnimation=!1,this._finish())}},Bt.prototype.stop=function(t,e){if(this._isDestroyed||!this._isActive)return this;var i,s=this._item;return i=s._id,X.cancel(i+Y),s._animate.stop(e),xt(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&this._queue.flush(!0,s),this},Bt.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(!0,{}),this._queue.destroy(),this._item=this._currentStyles=this._targetStyles=this._animateOptions=null,this._isDestroyed=!0,this)},Bt.prototype._updateOffsets=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._release;this._offsetLeft=i._isActive?i._containerDiffX:e._isActive?e._containerDiffX:0,this._offsetTop=i._isActive?i._containerDiffY:e._isActive?e._containerDiffY:0}},Bt.prototype._updateTargetStyles=function(){this._isDestroyed||(this._targetStyles.transform=Rt(this._item._left+this._offsetLeft,this._item._top+this._offsetTop))},Bt.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._release;this._isActive&&(this._isActive=!1,xt(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),this._queue.flush(!1,t)}},Bt.prototype._setupAnimation=function(){var t=It(this._item._element);this._currentLeft=t.x,this._currentTop=t.y},Bt.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings;if(this._updateOffsets(),this._updateTargetStyles(),t._left===this._currentLeft-this._offsetLeft&&t._top===this._currentTop-this._offsetTop)return this._isInterrupted&&this.stop(!1,this._targetStyles),this._isActive=!1,void this._finish();this._isInterrupted||U(t._element,e.itemPositioningClass),this._currentStyles.transform=Rt(this._currentLeft,this._currentTop),t._animate.start(this._currentStyles,this._targetStyles,this._animateOptions)};var Nt={};function qt(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}qt.prototype.start=function(t,e,i){if(this._isDestroyed)return this;var s,r,o,h,a,_,l,d,c=this._item,u=c._element,p=c.isVisible(),m=c.getGrid(),g=m._settings,y=t._settings,v=t._element,w=t._items,S=m._items.indexOf(c),D=i||window.document.body;if("number"==typeof e)s=K(w,e,!0);else{if(!(r=t._getItem(e)))return this;s=w.indexOf(r)}return(c.isPositioning()||this._isActive||c.isReleasing())&&(l=(_=It(u)).x,d=_.y),c.isPositioning()&&c._layout.stop(!0,{transform:Rt(l,d)}),this._isActive&&(l-=this._containerDiffX,d-=this._containerDiffY,this.stop(!0,{transform:Rt(l,d)})),c.isReleasing()&&(l-=c._release._containerDiffX,d-=c._release._containerDiffY,c._release.stop(!0,{transform:Rt(l,d)})),c._visibility._stopAnimation(),c._drag&&c._drag.destroy(),c._visibility._queue.flush(!0,c),m._hasListeners("beforeSend")&&m._emit("beforeSend",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),t._hasListeners("beforeReceive")&&t._emit("beforeReceive",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),xt(u,g.itemClass),xt(u,g.itemVisibleClass),xt(u,g.itemHiddenClass),U(u,y.itemClass),U(u,p?y.itemVisibleClass:y.itemHiddenClass),m._items.splice(S,1),J(w,c,s),c._gridId=t._id,D!==(o=u.parentNode)&&(D.appendChild(u),h=ut(D,o,!0),_||(l=(_=It(u)).x,d=_.y),u.style[n]=Rt(l+h.left,d+h.top)),c._child.removeAttribute("style"),f(c._child,p?y.visibleStyles:y.hiddenStyles),u.style.display=p?"block":"hidden",a=ut(D,v,!0),c._refreshDimensions(),c._refreshSortData(),c._drag=y.dragEnabled?new Yt(c):null,this._isActive=!0,this._container=D,this._containerDiffX=a.left,this._containerDiffY=a.top,m._hasListeners("send")&&m._emit("send",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),t._hasListeners("receive")&&t._emit("receive",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),this},qt.prototype.stop=function(t,e){if(this._isDestroyed||!this._isActive)return this;var i,s=this._item,n=s._element,r=s.getGrid()._element;return this._container!==r&&(e||(t?(i=It(n),Nt.transform=Rt(i.x-this._containerDiffX,i.y-this._containerDiffY)):Nt.transform=Rt(s._left,s._top),e=Nt),r.appendChild(n),f(n,e)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0,this},qt.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(!0),this._item=null,this._isDestroyed=!0,this)};var Ft={};function zt(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}function Vt(t){var e=t._isActive,i=t._element,s=t.getGrid()._settings;this._item=t,this._isDestroyed=!1,this._isHidden=!e,this._isHiding=!1,this._isShowing=!1,this._queue=new Ot,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"block":"none",U(i,e?s.itemVisibleClass:s.itemHiddenClass),f(t._child,e?s.visibleStyles:s.hiddenStyles)}zt.prototype.start=function(){if(this._isDestroyed||this._isActive)return this;var t=this._item,e=t.getGrid();return this._isActive=!0,U(t._element,e._settings.itemReleasingClass),e._emit("dragReleaseStart",t),t._layout.start(!1),this},zt.prototype.stop=function(t,e){if(this._isDestroyed||!this._isActive)return this;var i,s=this._item,n=s._element,r=s.getGrid(),o=r._element;return this._reset(),n.parentNode!==o&&(e||(t?(i=It(n),Ft.transform=Rt(i.x-this._containerDiffX,i.y-this._containerDiffY)):Ft.transform=Rt(s._left,s._top),e=Ft),o.appendChild(n),f(n,e)),t||r._emit("dragReleaseEnd",s),this},zt.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(!0),this._item=null,this._isDestroyed=!0,this)},zt.prototype._reset=function(){if(!this._isDestroyed){var t=this._item;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,xt(t._element,t.getGrid()._settings.itemReleasingClass)}},Vt.prototype.show=function(t,e){if(this._isDestroyed)return this;var i=this._item,s=i._element,n=this._queue,r=c(e)?e:null,o=i.getGrid()._settings;return this._isShowing||this._isHidden?this._isShowing&&!t?(r&&n.add(r),this):(this._isShowing||(n.flush(!0,i),xt(s,o.itemHiddenClass),U(s,o.itemVisibleClass),this._isHiding||(s.style.display="block")),r&&n.add(r),i._isActive=this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow),this):(r&&r(!1,i),this)},Vt.prototype.hide=function(t,e){if(this._isDestroyed)return this;var i=this._item,s=i._element,n=this._queue,r=c(e)?e:null,o=i.getGrid()._settings;return!this._isHiding&&this._isHidden?(r&&r(!1,i),this):this._isHiding&&!t?(r&&n.add(r),this):(this._isHiding||(n.flush(!0,i),U(s,o.itemHiddenClass),xt(s,o.itemVisibleClass)),r&&n.add(r),this._isHidden=this._isHiding=!0,i._isActive=this._isShowing=!1,this._startAnimation(!1,t,this._finishHide),this)},Vt.prototype.destroy=function(){if(this._isDestroyed)return this;var t=this._item,e=t._element,i=t.getGrid(),s=this._queue,n=i._settings;return this._stopAnimation({}),s.flush(!0,t).destroy(),xt(e,n.itemVisibleClass),xt(e,n.itemHiddenClass),this._item=null,this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0,this},Vt.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,r=n.getGrid()._settings,o=t?r.visibleStyles:r.hiddenStyles,h=parseInt(t?r.showDuration:r.hideDuration)||0,_=(t?r.showEasing:r.hideEasing)||"ease",d=e||h<=0;if(o){if(N(n._id),d)return n._animateChild.isAnimating()?n._animateChild.stop(o):f(n._child,o),void(i&&i());var c,u,p;c=n._id,u=function(){s=function(t,e){var i={};for(var s in e)i[s]=a(t,l(s));return i}(n._child,o)},p=function(){n._animateChild.start(s,o,{duration:h,easing:_,onFinish:i})},X.add(c+G,u,p)}else i&&i()}},Vt.prototype._stopAnimation=function(t){if(!this._isDestroyed){var e=this._item;N(e._id),e._animateChild.stop(t)}},Vt.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._queue.flush(!1,this._item))};var Wt={};Vt.prototype._finishHide=function(){if(this._isHidden){var t=this._item;this._isHiding=!1,Wt.transform=Rt(0,0),t._layout.stop(!0,Wt),t._element.style.display="none",this._queue.flush(!1,t)}};var jt,Ut,Zt,$t,Jt=0;function Kt(){return++Jt}function Qt(t,e,i){var s=t._settings;this._id=Kt(),this._gridId=t._id,this._isDestroyed=!1,this._left=0,this._top=0,this._element=e,this._child=e.children[0],e.parentNode!==t._element&&t._element.appendChild(e),U(e,s.itemClass),"boolean"!=typeof i&&(i="none"!==a(e,"display")),this._isActive=i,e.style.left="0",e.style.top="0",e.style[n]=Rt(0,0),this._animate=new p(e),this._animateChild=new p(this._child),this._visibility=new Vt(this),this._layout=new Bt(this),this._migrate=new qt(this),this._release=new zt(this),this._dragPlaceholder=new Ht(this),this._drag=s.dragEnabled?new Yt(this):null,this._refreshDimensions(),this._refreshSortData()}function te(){this._slots=[],this._slotSizes=[],this._freeSlots=[],this._newSlots=[],this._rectItem={},this._rectStore=[],this._rectId=0,this._layout={slots:null,setWidth:!1,setHeight:!1,width:!1,height:!1},this._sortRectsLeftTop=this._sortRectsLeftTop.bind(this),this._sortRectsTopLeft=this._sortRectsTopLeft.bind(this)}Qt.prototype.getGrid=function(){return t[this._gridId]},Qt.prototype.getElement=function(){return this._element},Qt.prototype.getWidth=function(){return this._width},Qt.prototype.getHeight=function(){return this._height},Qt.prototype.getMargin=function(){return{left:this._marginLeft,right:this._marginRight,top:this._marginTop,bottom:this._marginBottom}},Qt.prototype.getPosition=function(){return{left:this._left,top:this._top}},Qt.prototype.isActive=function(){return this._isActive},Qt.prototype.isVisible=function(){return!!this._visibility&&!this._visibility._isHidden},Qt.prototype.isShowing=function(){return!(!this._visibility||!this._visibility._isShowing)},Qt.prototype.isHiding=function(){return!(!this._visibility||!this._visibility._isHiding)},Qt.prototype.isPositioning=function(){return!(!this._layout||!this._layout._isActive)},Qt.prototype.isDragging=function(){return!(!this._drag||!this._drag._isActive)},Qt.prototype.isReleasing=function(){return!(!this._release||!this._release._isActive)},Qt.prototype.isDestroyed=function(){return this._isDestroyed},Qt.prototype._refreshDimensions=function(){if(!this._isDestroyed&&!this._visibility._isHidden){var t=this._element,e=this._dragPlaceholder,i=t.getBoundingClientRect();this._width=i.width,this._height=i.height,this._marginLeft=Math.max(0,at(t,"margin-left")),this._marginRight=Math.max(0,at(t,"margin-right")),this._marginTop=Math.max(0,at(t,"margin-top")),this._marginBottom=Math.max(0,at(t,"margin-bottom")),e&&e.updateDimensions(this._width,this._height)}},Qt.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},Qt.prototype._destroy=function(t){if(!this._isDestroyed){var e=this._element,i=this.getGrid(),s=i._settings,n=i._items.indexOf(this);this._release.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._animate.destroy(),this._animateChild.destroy(),this._dragPlaceholder.destroy(),this._drag&&this._drag.destroy(),e.removeAttribute("style"),this._child.removeAttribute("style"),xt(e,s.itemClass),n>-1&&i._items.splice(n,1),t&&e.parentNode.removeChild(e),this._isActive=!1,this._isDestroyed=!0}},te.prototype.getLayout=function(t,e,i,s,n){var r,o=this._layout,h=!(!n||!n.fillGaps),a=!(!n||!n.horizontal),_=!(!n||!n.alignRight),l=!(!n||!n.alignBottom),d=!(!n||!n.rounding),c=this._slotSizes;if(o.slots=s||this._slots,o.width=a?0:d?Math.round(e):e,o.height=a?d?Math.round(i):i:0,o.setWidth=a,o.setHeight=!a,o.slots.length=0,c.length=0,!t.length)return o;for(r=0;rd.height&&(jt.left>0&&u.push(this._addRect(0,d.height,jt.left,1/0)),jt.left+jt.widthd.width&&(jt.top>0&&u.push(this._addRect(d.width,0,1/0,jt.top)),jt.top+jt.height.49&&r.height>.49&&(!e&&r.tope.left+e.width&&Ut.push(this._addRect(e.left+e.width,t.top,t.left+t.width-(e.left+e.width),t.height)),t.tope.top+e.height&&Ut.push(this._addRect(t.left,e.top+e.height,t.width,t.top+t.height-(e.top+e.height))),Ut):(Ut.push(this._addRect(t.left,t.top,t.width,t.height)),Ut)}),te.prototype._doRectsOverlap=function(t,e){return!(t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top)},te.prototype._isRectWithinRect=function(t,e){return t.left>=e.left&&t.top>=e.top&&t.left+t.width<=e.left+e.width&&t.top+t.height<=e.top+e.height},te.prototype._purgeRects=(Zt={},$t={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this._getRect(t[i],Zt);e--;)if(t[e]&&i!==e&&this._isRectWithinRect(Zt,this._getRect(t[e],$t))){t[i]=0;break}return t}),te.prototype._sortRectsTopLeft=function(){var t={},e={};return function(i,s){return this._getRect(i,t),this._getRect(s,e),t.tope.top?1:t.lefte.left?1:0}}(),te.prototype._sortRectsLeftTop=function(){var t={},e={};return function(i,s){return this._getRect(i,t),this._getRect(s,e),t.lefte.left?1:t.tope.top?1:0}}();var ee="[object HTMLCollection]",ie="[object NodeList]";function se(t){var e=Object.prototype.toString.call(t);return e===ee||e===ie}var ne="object",re="[object Object]",oe=Object.prototype.toString;function he(t){return typeof t===ne&&oe.call(t)===re}function ae(t){return se(t)?Array.prototype.slice.call(t):Array.prototype.concat(t)}var _e=new te,le=function(){},de="number",ce="string";function ue(e,s){var n,r,o,h=this;if(!((e=this._element=typeof e===ce?window.document.querySelector(e):e).getRootNode?e.getRootNode({composed:!0})===document:window.document.body.contains(e))||e===window.document.documentElement)throw new Error("Container element must be an existing DOM element");c((n=this._settings=function(t,e){var i=fe({},t);e&&(i=fe(i,e));return i.visibleStyles=(e||0).visibleStyles||(t||0).visibleStyles,i.hiddenStyles=(e||0).hiddenStyles||(t||0).hiddenStyles,i}(ue.defaultOptions,s)).dragSort)||(n.dragSort=!!n.dragSort),this._id=Kt(),t[this._id]=h,this._isDestroyed=!1,this._layout={id:0,items:[],slots:[],setWidth:!1,setHeight:!1,width:0,height:0},this._emitter=new i,U(e,n.containerClass),this._items=[],typeof(r=n.items)===ce?ae(e.children).forEach(function(t){("*"===r||j(t,r))&&h._items.push(new Qt(h,t))}):(Array.isArray(r)||se(r))&&(this._items=ae(r).map(function(t){return new Qt(h,t)})),typeof(o=n.layoutOnResize)!==de&&(o=!0===o?0:-1),o>=0&&window.addEventListener("resize",h._resizeHandler=rt(function(){h.refreshItems().layout()},o)),n.layoutOnInit&&this.layout(!0)}function fe(t,e){var i,s,n,r=Object.keys(e),o=r.length;for(n=0;n0)){var s=o._layout.id!==l,n=c(t)?t:i;c(n)&&n(s,_.items.slice(0)),!s&&o._hasListeners(e)&&o._emit(e,_.items.slice(0))}}if((_.setHeight&&typeof _.height===de||_.setWidth&&typeof _.width===de)&&(s="border-box"===a(h,"box-sizing")),_.setHeight&&(typeof _.height===de?h.style.height=(s?_.height+this._borderTop+this._borderBottom:_.height)+"px":h.style.height=_.height),_.setWidth&&(typeof _.width===de?h.style.width=(s?_.width+this._borderLeft+this._borderRight:_.width)+"px":h.style.width=_.width),this._hasListeners("layoutStart")&&this._emit("layoutStart",_.items.slice(0)),!d)return f(),this;for(r=0;rl?1:0:ld?1:0)return c;return c||(s||(s=n(i)),c=r(o,h)),c}function h(o,h){var a=t(o,h);return e&&a&&(a=-a),a||(s||(s=n(i)),r(o,h))}return function(n,r){if(this._isDestroyed||this._items.length<2)return this;var a,_=this._items,l=r||0,d=l.layout?l.layout:void 0===l.layout;if(t=n,e=!!l.descending,i=_.slice(0),s=null,c(t))_.sort(h);else if(typeof t===ce)t=n.trim().split(" ").map(function(t){return t.split(":")}),_.sort(o);else{if(!Array.isArray(t))return this;if(t.length!==_.length)throw new Error("[Muuri] sort reference items do not match with grid items.");for(a=0;a<_.length;a++){if(t.indexOf(_[a])<0)throw new Error("[Muuri] sort reference items do not match with grid items.");_[a]=t[a]}e&&_.reverse()}return this._hasListeners("sort")&&this._emit("sort",_.slice(0),i),d&&this.layout("instant"===d,c(d)?d:void 0),this}}(),ue.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var s,n,r=this._items,o=i||0,h=o.layout?o.layout:void 0===o.layout,a="swap"===o.action,_=a?"swap":"move",l=this._getItem(t),d=this._getItem(e);return l&&d&&l!==d&&(s=r.indexOf(l),n=r.indexOf(d),a?tt(r,s,n):Q(r,s,n),this._hasListeners("move")&&this._emit("move",{item:l,fromIndex:s,toIndex:n,action:_}),h&&this.layout("instant"===h,c(h)?h:void 0)),this},ue.prototype.send=function(t,e,i,s){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this._getItem(t)))return this;var n=s||0,r=n.appendTo||window.document.body,o=n.layoutSender?n.layoutSender:void 0===n.layoutSender,h=n.layoutReceiver?n.layoutReceiver:void 0===n.layoutReceiver;return t._migrate.start(e,i,r),t._migrate._isActive&&t._isActive&&(o&&this.layout("instant"===o,c(o)?o:void 0),h&&e.layout("instant"===h,c(h)?h:void 0)),this},ue.prototype.destroy=function(e){if(this._isDestroyed)return this;var i,s=this._element,n=this._items.slice(0);for(this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),i=0;i-1?t:this._items.length+t]||null;if(t instanceof Qt)return t._gridId===this._id?t:null;for(var e=0;e-1||(M._activeInstances.push(t),M._emitter.on(D,t._onMove),M._emitter.on(A,t._onCancel),M._emitter.on(b,t._onEnd),1===M._activeInstances.length&&M._bindListeners())},M._deactivateInstance=function(t){var e=M._activeInstances.indexOf(t);-1!==e&&(M._activeInstances.splice(e,1),M._emitter.off(D,t._onMove),M._emitter.off(A,t._onCancel),M._emitter.off(b,t._onEnd),M._activeInstances.length||M._unbindListeners())},M._bindListeners=function(){var t=M._events;window.addEventListener(t.move,M._onMove,R),window.addEventListener(t.end,M._onEnd,R),t.cancel&&window.addEventListener(t.cancel,M._onCancel,R)},M._unbindListeners=function(){var t=M._events;window.removeEventListener(t.move,M._onMove,R),window.removeEventListener(t.end,M._onEnd,R),t.cancel&&window.removeEventListener(t.cancel,M._onCancel,R)},M._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},M._getTouchById=function(t,e){if("number"==typeof t.pointerId)return t.pointerId===e?t:null;if(t.changedTouches){for(var i=0;i-1&&(this._queue[n]=void 0),s?this._queue.unshift(t):this._queue.push(t),this._reads[t]=e,this._writes[t]=i,this._nextStep||(this._nextStep=y(this._step))},T.prototype.cancel=function(t){var e=this._queue.indexOf(t);e>-1&&(this._queue[e]=void 0,delete this._reads[t],delete this._writes[t])},T.prototype._step=function(){var t,e,i=this._queue,s=this._reads,n=this._writes,r=this._batch,o=this._batchReads,h=this._batchWrites,a=i.length;for(this._nextStep=null,e=0;en?n:e<0?Math.max(n+e+1,0):e}function K(t,e,i){if(!(t.length<2)){var s=J(t,e),n=J(t,i);s!==n&&t.splice(n,0,t.splice(s,1)[0])}}function Q(t,e,i){if(!(t.length<2)){var s,n=J(t,e),r=J(t,i);n!==r&&(s=t[n],t[n]=t[r],t[r]=s)}}var tt="cancel",et="finish",it="debounce",st=0;function nt(t,e){var i,s=++st+it;return e>0?function(n){void 0!==i&&(i=window.clearTimeout(i),k.cancel(s),n===et&&t()),n!==tt&&n!==et&&(i=window.setTimeout(function(){i=void 0,k.add(s,t,null,!0)},e))}:function(e){e!==tt&&t()}}function rt(t){var e=a(t,"transform");if(!e||"none"===e)return!1;var i=a(t,"display");return"inline"!==i&&"none"!==i}function ot(t,e){for(var i=window.document,s=(e?t:t.parentElement)||i;s&&s!==i&&"static"===a(s,"position")&&!rt(s);)s=s.parentElement||i;return s}function ht(t,e){return parseFloat(a(t,e))||0}var at={},_t={},lt={};function dt(t,e){var i,s=e||{};return s.left=0,s.top=0,t===document?s:(s.left=window.pageXOffset||0,s.top=window.pageYOffset||0,t.self===window.self?s:(i=t.getBoundingClientRect(),s.left+=i.left,s.top+=i.top,s.left+=ht(t,"border-left-width"),s.top+=ht(t,"border-top-width"),s))}function ct(t,e,i){return lt.left=0,lt.top=0,t===e?lt:i&&(t=ot(t,!0))===(e=ot(e,!0))?lt:(dt(t,at),dt(e,_t),lt.left=_t.left-at.left,lt.top=_t.top-at.top,lt)}var ut="overflow",ft="overflow-x",pt="overflow-y",mt="auto",gt="scroll";function yt(t){var e=a(t,ut);return e===mt||e===gt||((e=a(t,ft))===mt||e===gt||((e=a(t,pt))===mt||e===gt))}function vt(t,e,i){for(var s=i||[],n=e?t:t.parentNode;n&&n!==document;)n.getRootNode&&n instanceof DocumentFragment?n=n.getRootNode().host:(yt(n)&&s.push(n),n=n.parentNode);return s.push(window),s}var wt={},St="transform",Dt="none",bt=/^matrix3d/,At=/([^,]*,){4}/,Et=/([^,]*,){12}/,Ct=/[^,]*,/;function Lt(t){wt.x=0,wt.y=0;var e=a(t,St);if(!e||e===Dt)return wt;var i=bt.test(e),s=e.replace(i?Et:At,""),n=s.replace(Ct,"");return wt.x=parseFloat(s)||0,wt.y=parseFloat(n)||0,wt}function It(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function Rt(t,e){t.classList?t.classList.remove(e):W(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim())}var xt,Pt,Mt,Tt,kt=0;function Xt(t){var e=t._element,i=t.getGrid(),s=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=c(s.dragStartPredicate)?s.dragStartPredicate:Xt.defaultStartPredicate,this._startPredicateState=kt,this._startPredicateResult=void 0,this._hBlockedIndex=null,this._hX1=0,this._hX2=0,this._hY1=0,this._hY2=0,this._reset(),this._preStartCheck=this._preStartCheck.bind(this),this._preEndCheck=this._preEndCheck.bind(this),this._onScroll=this._onScroll.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._prepareScroll=this._prepareScroll.bind(this),this._applyScroll=this._applyScroll.bind(this),this._checkOverlap=this._checkOverlap.bind(this);var n=s.dragSortHeuristics.sortInterval;this._checkOverlapDebounce=nt(this._checkOverlap,n),this._dragger=new M(e,s.dragCssProps),this._dragger.on("start",this._preStartCheck),this._dragger.on("move",this._preStartCheck),this._dragger.on("cancel",this._preEndCheck),this._dragger.on("end",this._preEndCheck)}function Yt(t,e){return t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top?0:(Math.min(t.left+t.width,e.left+e.width)-Math.max(t.left,e.left))*(Math.min(t.top+t.height,e.top+e.height)-Math.max(t.top,e.top))/(Math.min(t.width,e.width)*Math.min(t.height,e.height))*100}function Gt(t){this._item=t,this._animate=new p,this._element=null,this._className="",this._didMigrate=!1,this._resetAfterLayout=!1,this._currentLeft=0,this._currentTop=0,this._nextLeft=0,this._nextTop=0,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this),this._onLayoutStart=this._onLayoutStart.bind(this),this._onLayoutEnd=this._onLayoutEnd.bind(this),this._onReleaseEnd=this._onReleaseEnd.bind(this),this._onMigrate=this._onMigrate.bind(this)}function Ht(){this._queue=[],this._isDestroyed=!1}function Ot(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isInterrupted=!1,this._currentStyles={},this._targetStyles={},this._currentLeft=0,this._currentTop=0,this._offsetLeft=0,this._offsetTop=0,this._skipNextAnimation=!1,this._animateOptions={onFinish:this._finish.bind(this)},this._queue=new Ht,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}Xt.defaultStartPredicate=function(t,e,i){var s=t._drag,n=s._startPredicateData||s._setupStartPredicate(i);if(!e.isFinal)return!(!n.handleElement&&(n.handleElement=s._getStartPredicateHandle(e),!n.handleElement))&&(n.delay&&(n.event=e,n.delayTimer||(n.delayTimer=window.setTimeout(function(){n.delay=0,s._resolveStartPredicate(n.event)&&(s._forceResolveStartPredicate(n.event),s._resetStartPredicate())},n.delay))),s._resolveStartPredicate(e));s._finishStartPredicate(e)},Xt.defaultSortPredicate=(xt={},Pt={},Mt={},Tt=[],function(t,e){var i=t._drag,s=i._getGrid(),n=e&&"number"==typeof e.threshold?e.threshold:50,r=e&&"swap"===e.action?"swap":"move";xt.width=t._width,xt.height=t._height,xt.left=i._elementClientX,xt.top=i._elementClientY;var o=function(t,e,i){var s,n,r,o,h=null,a=e._settings.dragSort,_=-1;if(!0===a?(Tt[0]=e,n=Tt):n=a.call(e,t),!Array.isArray(n))return h;for(o=0;oi&&s>_&&(_=s,h=r));return Tt.length=0,h}(t,s,n);if(!o)return!1;var h,a,_,l,d,c=0,u=0,f=-1;for(o===s?(xt.left=i._gridX+t._marginLeft,xt.top=i._gridY+t._marginTop):(o._updateBorders(1,0,1,0),c=o._left+o._borderLeft,u=o._top+o._borderTop),d=0;df&&(h=d,f=l));return f=n&&(Mt.grid=o,Mt.index=h,Mt.action=r,Mt)}),Xt.prototype.stop=function(){var t=this._item,e=t._element,i=this._getGrid();return this._isActive?this._isMigrating?(this._finishMigration(),this):(N(t._id),q(t._id),this._unbindScrollListeners(),this._checkOverlapDebounce("cancel"),e.parentNode!==i._element&&(i._element.appendChild(e),e.style[n]=It(this._gridX,this._gridY)),Rt(e,i._settings.itemDraggingClass),this._reset(),this):this},Xt.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(),this._dragger.destroy(),this._isDestroyed=!0,this)},Xt.prototype._getGrid=function(){return t[this._gridId]||null},Xt.prototype._reset=function(){this._isActive=!1,this._container=null,this._containingBlock=null,this._dragEvent=null,this._scrollEvent=null,this._scrollers=[],this._left=0,this._top=0,this._gridX=0,this._gridY=0,this._elementClientX=0,this._elementClientY=0,this._containerDiffX=0,this._containerDiffY=0},Xt.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,s=this._container,n=this._scrollers;if(n.length=0,vt(this._item._element,!1,n),s!==i)for(vt(i,!0,t=[]),e=0;e=s&&t.pageX=n&&t.pageY3&&e.minBounceBackAngle>0;if(h||(this._hBlockedIndex=null),Math.abs(r)>i||Math.abs(o)>i){if(h){var a=Math.atan2(r,o),_=Math.atan2(this._hX2-this._hX1,this._hY2-this._hY1),l=Math.atan2(Math.sin(a-_),Math.cos(a-_));Math.abs(l)>e.minBounceBackAngle&&(this._hBlockedIndex=null)}return this._hX1=this._hX2,this._hY1=this._hY2,this._hX2=s,this._hY2=n,!0}return!1},Xt.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},Xt.prototype._checkOverlap=function(){if(this._isActive){var t,e,i,s,n,r,o,h=this._item,a=this._getGrid()._settings;(t=c(a.dragSortPredicate)?a.dragSortPredicate(h,this._dragEvent):Xt.defaultSortPredicate(h,a.dragSortPredicate))&&"number"==typeof t.index&&(o=(e=h.getGrid())!==(s=t.grid||e),i=e._items.indexOf(h),n=J(s._items,t.index,o),r="swap"===t.action?"swap":"move",(o||n!==this._hBlockedIndex)&&(o?(this._hBlockedIndex=null,e._hasListeners("beforeSend")&&e._emit("beforeSend",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),s._hasListeners("beforeReceive")&&s._emit("beforeReceive",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),h._gridId=s._id,this._isMigrating=h._gridId!==this._gridId,e._items.splice(i,1),$(s._items,h,n),h._sortData=null,e._hasListeners("send")&&e._emit("send",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),s._hasListeners("receive")&&s._emit("receive",{item:h,fromGrid:e,fromIndex:i,toGrid:s,toIndex:n}),e.layout(),s.layout()):i!==n&&(this._hBlockedIndex=i,("swap"===r?Q:K)(e._items,i,n),e._hasListeners("move")&&e._emit("move",{item:h,fromIndex:i,toIndex:n,action:r}),e.layout())))}},Xt.prototype._finishMigration=function(){var t,e,i=this._item,s=i._release,r=i._element,o=i._isActive,h=i.getGrid(),a=h._element,_=h._settings,l=_.dragContainer||a,d=this._getGrid()._settings,c=r.parentNode;this._isMigrating=!1,this.destroy(),Rt(r,d.itemClass),Rt(r,d.itemVisibleClass),Rt(r,d.itemHiddenClass),j(r,_.itemClass),j(r,o?_.itemVisibleClass:_.itemHiddenClass),l!==c&&(l.appendChild(r),e=ct(c,l,!0),(t=Lt(r)).x-=e.left,t.y-=e.top),i._refreshDimensions(),i._refreshSortData(),e=ct(l,a,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=_.dragEnabled?new Xt(i):null,l!==c&&(r.style[n]=It(t.x,t.y)),i._child.removeAttribute("style"),f(i._child,o?_.visibleStyles:_.hiddenStyles),s.start()},Xt.prototype._preStartCheck=function(t){this._startPredicateState===kt&&(this._startPredicateState=1),1===this._startPredicateState?(this._startPredicateResult=this._startPredicate(this._item,t),!0===this._startPredicateResult?(this._startPredicateState=2,this._onStart(t)):!1===this._startPredicateResult&&(this._startPredicateState=3)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},Xt.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=kt,e&&this._isActive&&this._onEnd(t)},Xt.prototype._onStart=function(t){var e=this._item;if(e._isActive){var i,s=e._element,r=this._getGrid(),o=r._settings,h=e._release,a=e._migrate,_=r._element,l=o.dragContainer||_,d=ot(l,!0),c=Lt(s),u=c.x,f=c.y,p=s.getBoundingClientRect(),m=l!==_;this._resetHeuristics(t),m&&(i=ct(d,_)),e.isPositioning()&&e._layout.stop(!0,{transform:It(u,f)}),a._isActive&&(u-=a._containerDiffX,f-=a._containerDiffY,a.stop(!0,{transform:It(u,f)})),e.isReleasing()&&h._reset(),this._isActive=!0,this._dragEvent=t,this._container=l,this._containingBlock=d,this._elementClientX=p.left,this._elementClientY=p.top,this._left=this._gridX=u,this._top=this._gridY=f,o.dragPlaceholder.enabled&&e._dragPlaceholder.create(),r._emit("dragInit",e,t),m&&(this._containerDiffX=i.left,this._containerDiffY=i.top,s.parentNode===l?(this._gridX=u-this._containerDiffX,this._gridY=f-this._containerDiffY):(this._left=u+this._containerDiffX,this._top=f+this._containerDiffY,l.appendChild(s),s.style[n]=It(this._left,this._top))),j(s,o.itemDraggingClass),this._bindScrollListeners(),r._emit("dragStart",e,t)}},Xt.prototype._onMove=function(t){var e=this._item;if(e._isActive){var i,s,n,r=this._getGrid()._settings.dragAxis;if("y"!==r){var o=t.clientX-this._dragEvent.clientX;this._left+=o,this._gridX+=o,this._elementClientX+=o}if("x"!==r){var h=t.clientY-this._dragEvent.clientY;this._top+=h,this._gridY+=h,this._elementClientY+=h}this._dragEvent=t,i=e._id,s=this._prepareMove,n=this._applyMove,k.add(i+G,s,n,!0)}else this.stop()},Xt.prototype._prepareMove=function(){this._item._isActive&&this._getGrid()._settings.dragSort&&this._checkHeuristics(this._dragEvent)&&this._checkOverlapDebounce()},Xt.prototype._applyMove=function(){var t=this._item;t._isActive&&(t._element.style[n]=It(this._left,this._top),this._getGrid()._emit("dragMove",t,this._dragEvent))},Xt.prototype._onScroll=function(t){var e,i,s,n=this._item;n._isActive?(this._scrollEvent=t,e=n._id,i=this._prepareScroll,s=this._applyScroll,k.add(e+H,i,s,!0)):this.stop()},Xt.prototype._prepareScroll=function(){var t=this._item;if(t._isActive){var e,i=t._element,s=this._getGrid(),n=s._settings,r=n.dragAxis,o=s._element,h=i.getBoundingClientRect(),a=this._elementClientX-h.left,_=this._elementClientY-h.top;this._container!==o&&(e=ct(this._containingBlock,o),this._containerDiffX=e.left,this._containerDiffY=e.top),"y"!==r&&(this._left+=a,this._gridX=this._left-this._containerDiffX),"x"!==r&&(this._top+=_,this._gridY=this._top-this._containerDiffY),n.dragSort&&this._checkOverlapDebounce()}},Xt.prototype._applyScroll=function(){var t=this._item;t._isActive&&(t._element.style[n]=It(this._left,this._top),this._getGrid()._emit("dragScroll",t,this._scrollEvent))},Xt.prototype._onEnd=function(t){var e=this._item,i=e._element,s=this._getGrid(),n=s._settings,r=e._release;e._isActive?(N(e._id),q(e._id),n.dragSort&&this._checkOverlapDebounce("finish"),this._unbindScrollListeners(),r._containerDiffX=this._containerDiffX,r._containerDiffY=this._containerDiffY,this._reset(),Rt(i,n.itemDraggingClass),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():r.start()):this.stop()},Gt.prototype._onLayoutStart=function(){var t=this._item,e=t.getGrid(),i=e._items.indexOf(t),s=e._layout.slots[2*i],n=e._layout.slots[2*i+1];if(this._didMigrate||t._left!==s||t._top!==n){var r,o,h;if(s+=t._marginLeft,n+=t._marginTop,!(e._settings.dragPlaceholder.duration>0)||this._didMigrate){F(t._id);var a={transform:It(s,n)};return this._animate.isAnimating()?this._animate.stop(a):f(this._element,a),void(this._didMigrate&&(e.getElement().appendChild(this._element),this._didMigrate=!1))}this._nextLeft=s,this._nextTop=n,r=t._id,o=this._setupAnimation,h=this._startAnimation,k.add(r+O,o,h)}},Gt.prototype._setupAnimation=function(){if(this.isActive()){var t=Lt(this._element);this._currentLeft=t.x,this._currentTop=t.y}},Gt.prototype._startAnimation=function(){if(this.isActive()){var t=this._animate,e=this._currentLeft,i=this._currentTop,s=this._nextLeft,n=this._nextTop,r={transform:It(s,n)};if(e!==s||i!==n){var o=this._item.getGrid()._settings.dragPlaceholder,h={transform:It(e,i)};t.start(h,r,{duration:o.duration,easing:o.easing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&t.stop(r)}},Gt.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},Gt.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animate.isAnimating())return void this.reset();this._resetAfterLayout=!0}},Gt.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off("dragReleaseEnd",this._onReleaseEnd),e.off("layoutStart",this._onLayoutStart),e.off("beforeSend",this._onMigrate),i.on("dragReleaseEnd",this._onReleaseEnd),i.on("layoutStart",this._onLayoutStart),i.on("beforeSend",this._onMigrate),this._didMigrate=!0}},Gt.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),s=i._settings,n=this._animate;t=c(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):window.document.createElement("div"),this._element=t,n._element=t,this._className=s.itemPlaceholderClass||"",this._className&&j(t,this._className);var r=e._left+e._marginLeft,o=e._top+e._marginTop;f(t,{display:"block",position:"absolute",left:"0",top:"0",width:e._width+"px",height:e._height+"px",transform:It(r,o)}),i.on("layoutStart",this._onLayoutStart),i.on("dragReleaseEnd",this._onReleaseEnd),i.on("beforeSend",this._onMigrate),c(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},Gt.prototype.reset=function(){if(this.isActive()){var t=this._element,e=this._item,i=e.getGrid(),s=i._settings,n=this._animate;this._resetAfterLayout=!1,F(e._id),n.stop(),n._element=null,i.off("dragReleaseEnd",this._onReleaseEnd),i.off("layoutStart",this._onLayoutStart),i.off("beforeSend",this._onMigrate),this._className&&(Rt(t,this._className),this._className=""),t.parentNode.removeChild(t),this._element=null,c(s.dragPlaceholder.onRemove)&&s.dragPlaceholder.onRemove(e,t)}},Gt.prototype.updateDimensions=function(t,e){this.isActive()&&f(this._element,{width:t+"px",height:e+"px"})},Gt.prototype.isActive=function(){return!!this._element},Gt.prototype.destroy=function(){this.reset(),this._animate.destroy(),this._item=this._animate=null},Ht.prototype.add=function(t){return this._isDestroyed?this:(this._queue.push(t),this)},Ht.prototype.flush=function(t,e){if(this._isDestroyed)return this;var i,s=this._queue,n=s.length;if(!n)return this;var r=1===n,o=r?s[0]:s.slice(0);if(s.length=0,r)return o(t,e),this;for(i=0;i0;return l&&this._queue.flush(!0,o),d&&(a._isPositioningStarted=!0),c(e)&&this._queue.add(e),m?(this._isActive=!0,this._animateOptions.easing=p,this._animateOptions.duration=u,this._isInterrupted=l,s=o._id,n=this._setupAnimation,r=this._startAnimation,k.add(s+X,n,r),this):(this._updateOffsets(),this._updateTargetStyles(),i=o._animate.isAnimating(),this.stop(!1,this._targetStyles),!i&&f(h,this._targetStyles),this._skipNextAnimation=!1,this._finish())}},Ot.prototype.stop=function(t,e){if(this._isDestroyed||!this._isActive)return this;var i,s=this._item;return i=s._id,k.cancel(i+X),s._animate.stop(e),Rt(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&this._queue.flush(!0,s),this},Ot.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(!0,{}),this._queue.destroy(),this._item=this._currentStyles=this._targetStyles=this._animateOptions=null,this._isDestroyed=!0,this)},Ot.prototype._updateOffsets=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._release;this._offsetLeft=i._isActive?i._containerDiffX:e._isActive?e._containerDiffX:0,this._offsetTop=i._isActive?i._containerDiffY:e._isActive?e._containerDiffY:0}},Ot.prototype._updateTargetStyles=function(){this._isDestroyed||(this._targetStyles.transform=It(this._item._left+this._offsetLeft,this._item._top+this._offsetTop))},Ot.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._release;this._isActive&&(this._isActive=!1,Rt(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),this._queue.flush(!1,t)}},Ot.prototype._setupAnimation=function(){var t=Lt(this._item._element);this._currentLeft=t.x,this._currentTop=t.y},Ot.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings;if(this._updateOffsets(),this._updateTargetStyles(),t._left===this._currentLeft-this._offsetLeft&&t._top===this._currentTop-this._offsetTop)return this._isInterrupted&&this.stop(!1,this._targetStyles),this._isActive=!1,void this._finish();this._isInterrupted||j(t._element,e.itemPositioningClass),this._currentStyles.transform=It(this._currentLeft,this._currentTop),t._animate.start(this._currentStyles,this._targetStyles,this._animateOptions)};var Bt={};function Nt(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}Nt.prototype.start=function(t,e,i){if(this._isDestroyed)return this;var s,r,o,h,a,_,l,d,c=this._item,u=c._element,p=c.isVisible(),m=c.getGrid(),g=m._settings,y=t._settings,v=t._element,w=t._items,S=m._items.indexOf(c),D=i||window.document.body;if("number"==typeof e)s=J(w,e,!0);else{if(!(r=t._getItem(e)))return this;s=w.indexOf(r)}return(c.isPositioning()||this._isActive||c.isReleasing())&&(l=(_=Lt(u)).x,d=_.y),c.isPositioning()&&c._layout.stop(!0,{transform:It(l,d)}),this._isActive&&(l-=this._containerDiffX,d-=this._containerDiffY,this.stop(!0,{transform:It(l,d)})),c.isReleasing()&&(l-=c._release._containerDiffX,d-=c._release._containerDiffY,c._release.stop(!0,{transform:It(l,d)})),c._visibility._stopAnimation(),c._drag&&c._drag.destroy(),c._visibility._queue.flush(!0,c),m._hasListeners("beforeSend")&&m._emit("beforeSend",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),t._hasListeners("beforeReceive")&&t._emit("beforeReceive",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),Rt(u,g.itemClass),Rt(u,g.itemVisibleClass),Rt(u,g.itemHiddenClass),j(u,y.itemClass),j(u,p?y.itemVisibleClass:y.itemHiddenClass),m._items.splice(S,1),$(w,c,s),c._gridId=t._id,D!==(o=u.parentNode)&&(D.appendChild(u),h=ct(D,o,!0),_||(l=(_=Lt(u)).x,d=_.y),u.style[n]=It(l+h.left,d+h.top)),c._child.removeAttribute("style"),f(c._child,p?y.visibleStyles:y.hiddenStyles),u.style.display=p?"block":"hidden",a=ct(D,v,!0),c._refreshDimensions(),c._refreshSortData(),c._drag=y.dragEnabled?new Xt(c):null,this._isActive=!0,this._container=D,this._containerDiffX=a.left,this._containerDiffY=a.top,m._hasListeners("send")&&m._emit("send",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),t._hasListeners("receive")&&t._emit("receive",{item:c,fromGrid:m,fromIndex:S,toGrid:t,toIndex:s}),this},Nt.prototype.stop=function(t,e){if(this._isDestroyed||!this._isActive)return this;var i,s=this._item,n=s._element,r=s.getGrid()._element;return this._container!==r&&(e||(t?(i=Lt(n),Bt.transform=It(i.x-this._containerDiffX,i.y-this._containerDiffY)):Bt.transform=It(s._left,s._top),e=Bt),r.appendChild(n),f(n,e)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0,this},Nt.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(!0),this._item=null,this._isDestroyed=!0,this)};var qt={};function Ft(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}function zt(t){var e=t._isActive,i=t._element,s=t.getGrid()._settings;this._item=t,this._isDestroyed=!1,this._isHidden=!e,this._isHiding=!1,this._isShowing=!1,this._queue=new Ht,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"block":"none",j(i,e?s.itemVisibleClass:s.itemHiddenClass),f(t._child,e?s.visibleStyles:s.hiddenStyles)}Ft.prototype.start=function(){if(this._isDestroyed||this._isActive)return this;var t=this._item,e=t.getGrid();return this._isActive=!0,j(t._element,e._settings.itemReleasingClass),e._emit("dragReleaseStart",t),t._layout.start(!1),this},Ft.prototype.stop=function(t,e){if(this._isDestroyed||!this._isActive)return this;var i,s=this._item,n=s._element,r=s.getGrid(),o=r._element;return this._reset(),n.parentNode!==o&&(e||(t?(i=Lt(n),qt.transform=It(i.x-this._containerDiffX,i.y-this._containerDiffY)):qt.transform=It(s._left,s._top),e=qt),o.appendChild(n),f(n,e)),t||r._emit("dragReleaseEnd",s),this},Ft.prototype.destroy=function(){return this._isDestroyed?this:(this.stop(!0),this._item=null,this._isDestroyed=!0,this)},Ft.prototype._reset=function(){if(!this._isDestroyed){var t=this._item;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,Rt(t._element,t.getGrid()._settings.itemReleasingClass)}},zt.prototype.show=function(t,e){if(this._isDestroyed)return this;var i=this._item,s=i._element,n=this._queue,r=c(e)?e:null,o=i.getGrid()._settings;return this._isShowing||this._isHidden?this._isShowing&&!t?(r&&n.add(r),this):(this._isShowing||(n.flush(!0,i),Rt(s,o.itemHiddenClass),j(s,o.itemVisibleClass),this._isHiding||(s.style.display="block")),r&&n.add(r),i._isActive=this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow),this):(r&&r(!1,i),this)},zt.prototype.hide=function(t,e){if(this._isDestroyed)return this;var i=this._item,s=i._element,n=this._queue,r=c(e)?e:null,o=i.getGrid()._settings;return!this._isHiding&&this._isHidden?(r&&r(!1,i),this):this._isHiding&&!t?(r&&n.add(r),this):(this._isHiding||(n.flush(!0,i),j(s,o.itemHiddenClass),Rt(s,o.itemVisibleClass)),r&&n.add(r),this._isHidden=this._isHiding=!0,i._isActive=this._isShowing=!1,this._startAnimation(!1,t,this._finishHide),this)},zt.prototype.destroy=function(){if(this._isDestroyed)return this;var t=this._item,e=t._element,i=t.getGrid(),s=this._queue,n=i._settings;return this._stopAnimation({}),s.flush(!0,t).destroy(),Rt(e,n.itemVisibleClass),Rt(e,n.itemHiddenClass),this._item=null,this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0,this},zt.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,r=n.getGrid()._settings,o=t?r.visibleStyles:r.hiddenStyles,h=parseInt(t?r.showDuration:r.hideDuration)||0,_=(t?r.showEasing:r.hideEasing)||"ease",d=e||h<=0;if(o){if(B(n._id),d)return n._animateChild.isAnimating()?n._animateChild.stop(o):f(n._child,o),void(i&&i());var c,u,p;c=n._id,u=function(){s=function(t,e){var i={};for(var s in e)i[s]=a(t,l(s));return i}(n._child,o)},p=function(){n._animateChild.start(s,o,{duration:h,easing:_,onFinish:i})},k.add(c+Y,u,p)}else i&&i()}},zt.prototype._stopAnimation=function(t){if(!this._isDestroyed){var e=this._item;B(e._id),e._animateChild.stop(t)}},zt.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._queue.flush(!1,this._item))};var Vt={};zt.prototype._finishHide=function(){if(this._isHidden){var t=this._item;this._isHiding=!1,Vt.transform=It(0,0),t._layout.stop(!0,Vt),t._element.style.display="none",this._queue.flush(!1,t)}};var Wt,jt,Ut,Zt,$t=0;function Jt(){return++$t}function Kt(t,e,i){var s=t._settings;this._id=Jt(),this._gridId=t._id,this._isDestroyed=!1,this._left=0,this._top=0,this._element=e,this._child=e.children[0],e.parentNode!==t._element&&t._element.appendChild(e),j(e,s.itemClass),"boolean"!=typeof i&&(i="none"!==a(e,"display")),this._isActive=i,e.style.left="0",e.style.top="0",e.style[n]=It(0,0),this._animate=new p(e),this._animateChild=new p(this._child),this._visibility=new zt(this),this._layout=new Ot(this),this._migrate=new Nt(this),this._release=new Ft(this),this._dragPlaceholder=new Gt(this),this._drag=s.dragEnabled?new Xt(this):null,this._refreshDimensions(),this._refreshSortData()}function Qt(){this._slots=[],this._slotSizes=[],this._freeSlots=[],this._newSlots=[],this._rectItem={},this._rectStore=[],this._rectId=0,this._layout={slots:null,setWidth:!1,setHeight:!1,width:!1,height:!1},this._sortRectsLeftTop=this._sortRectsLeftTop.bind(this),this._sortRectsTopLeft=this._sortRectsTopLeft.bind(this)}Kt.prototype.getGrid=function(){return t[this._gridId]},Kt.prototype.getElement=function(){return this._element},Kt.prototype.getWidth=function(){return this._width},Kt.prototype.getHeight=function(){return this._height},Kt.prototype.getMargin=function(){return{left:this._marginLeft,right:this._marginRight,top:this._marginTop,bottom:this._marginBottom}},Kt.prototype.getPosition=function(){return{left:this._left,top:this._top}},Kt.prototype.isActive=function(){return this._isActive},Kt.prototype.isVisible=function(){return!!this._visibility&&!this._visibility._isHidden},Kt.prototype.isShowing=function(){return!(!this._visibility||!this._visibility._isShowing)},Kt.prototype.isHiding=function(){return!(!this._visibility||!this._visibility._isHiding)},Kt.prototype.isPositioning=function(){return!(!this._layout||!this._layout._isActive)},Kt.prototype.isDragging=function(){return!(!this._drag||!this._drag._isActive)},Kt.prototype.isReleasing=function(){return!(!this._release||!this._release._isActive)},Kt.prototype.isDestroyed=function(){return this._isDestroyed},Kt.prototype._refreshDimensions=function(){if(!this._isDestroyed&&!this._visibility._isHidden){var t=this._element,e=this._dragPlaceholder,i=t.getBoundingClientRect();this._width=i.width,this._height=i.height,this._marginLeft=Math.max(0,ht(t,"margin-left")),this._marginRight=Math.max(0,ht(t,"margin-right")),this._marginTop=Math.max(0,ht(t,"margin-top")),this._marginBottom=Math.max(0,ht(t,"margin-bottom")),e&&e.updateDimensions(this._width,this._height)}},Kt.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},Kt.prototype._destroy=function(t){if(!this._isDestroyed){var e=this._element,i=this.getGrid(),s=i._settings,n=i._items.indexOf(this);this._release.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._animate.destroy(),this._animateChild.destroy(),this._dragPlaceholder.destroy(),this._drag&&this._drag.destroy(),e.removeAttribute("style"),this._child.removeAttribute("style"),Rt(e,s.itemClass),n>-1&&i._items.splice(n,1),t&&e.parentNode.removeChild(e),this._isActive=!1,this._isDestroyed=!0}},Qt.prototype.getLayout=function(t,e,i,s,n){var r,o=this._layout,h=!(!n||!n.fillGaps),a=!(!n||!n.horizontal),_=!(!n||!n.alignRight),l=!(!n||!n.alignBottom),d=!(!n||!n.rounding),c=this._slotSizes;if(o.slots=s||this._slots,o.width=a?0:d?Math.round(e):e,o.height=a?d?Math.round(i):i:0,o.setWidth=a,o.setHeight=!a,o.slots.length=0,c.length=0,!t.length)return o;for(r=0;rd.height&&(Wt.left>0&&u.push(this._addRect(0,d.height,Wt.left,1/0)),Wt.left+Wt.widthd.width&&(Wt.top>0&&u.push(this._addRect(d.width,0,1/0,Wt.top)),Wt.top+Wt.height.49&&r.height>.49&&(!e&&r.tope.left+e.width&&jt.push(this._addRect(e.left+e.width,t.top,t.left+t.width-(e.left+e.width),t.height)),t.tope.top+e.height&&jt.push(this._addRect(t.left,e.top+e.height,t.width,t.top+t.height-(e.top+e.height))),jt):(jt.push(this._addRect(t.left,t.top,t.width,t.height)),jt)}),Qt.prototype._doRectsOverlap=function(t,e){return!(t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top)},Qt.prototype._isRectWithinRect=function(t,e){return t.left>=e.left&&t.top>=e.top&&t.left+t.width<=e.left+e.width&&t.top+t.height<=e.top+e.height},Qt.prototype._purgeRects=(Ut={},Zt={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this._getRect(t[i],Ut);e--;)if(t[e]&&i!==e&&this._isRectWithinRect(Ut,this._getRect(t[e],Zt))){t[i]=0;break}return t}),Qt.prototype._sortRectsTopLeft=function(){var t={},e={};return function(i,s){return this._getRect(i,t),this._getRect(s,e),t.tope.top?1:t.lefte.left?1:0}}(),Qt.prototype._sortRectsLeftTop=function(){var t={},e={};return function(i,s){return this._getRect(i,t),this._getRect(s,e),t.lefte.left?1:t.tope.top?1:0}}();var te="[object HTMLCollection]",ee="[object NodeList]";function ie(t){var e=Object.prototype.toString.call(t);return e===te||e===ee}var se="object",ne="[object Object]",re=Object.prototype.toString;function oe(t){return typeof t===se&&re.call(t)===ne}function he(t){return ie(t)?Array.prototype.slice.call(t):Array.prototype.concat(t)}var ae=new Qt,_e=function(){},le="number",de="string";function ce(e,s){var n,r,o,h=this;if(!((e=this._element=typeof e===de?window.document.querySelector(e):e).getRootNode?e.getRootNode({composed:!0})===document:window.document.body.contains(e))||e===window.document.documentElement)throw new Error("Container element must be an existing DOM element");c((n=this._settings=function(t,e){var i=ue({},t);e&&(i=ue(i,e));return i.visibleStyles=(e||0).visibleStyles||(t||0).visibleStyles,i.hiddenStyles=(e||0).hiddenStyles||(t||0).hiddenStyles,i}(ce.defaultOptions,s)).dragSort)||(n.dragSort=!!n.dragSort),this._id=Jt(),t[this._id]=h,this._isDestroyed=!1,this._layout={id:0,items:[],slots:[],setWidth:!1,setHeight:!1,width:0,height:0},this._emitter=new i,j(e,n.containerClass),this._items=[],typeof(r=n.items)===de?he(e.children).forEach(function(t){("*"===r||W(t,r))&&h._items.push(new Kt(h,t))}):(Array.isArray(r)||ie(r))&&(this._items=he(r).map(function(t){return new Kt(h,t)})),typeof(o=n.layoutOnResize)!==le&&(o=!0===o?0:-1),o>=0&&window.addEventListener("resize",h._resizeHandler=nt(function(){h.refreshItems().layout()},o)),n.layoutOnInit&&this.layout(!0)}function ue(t,e){var i,s,n,r=Object.keys(e),o=r.length;for(n=0;n0)){var s=o._layout.id!==l,n=c(t)?t:i;c(n)&&n(s,_.items.slice(0)),!s&&o._hasListeners(e)&&o._emit(e,_.items.slice(0))}}if((_.setHeight&&typeof _.height===le||_.setWidth&&typeof _.width===le)&&(s="border-box"===a(h,"box-sizing")),_.setHeight&&(typeof _.height===le?h.style.height=(s?_.height+this._borderTop+this._borderBottom:_.height)+"px":h.style.height=_.height),_.setWidth&&(typeof _.width===le?h.style.width=(s?_.width+this._borderLeft+this._borderRight:_.width)+"px":h.style.width=_.width),this._hasListeners("layoutStart")&&this._emit("layoutStart",_.items.slice(0)),!d)return f(),this;for(r=0;rl?1:0:ld?1:0)return c;return c||(s||(s=n(i)),c=r(o,h)),c}function h(o,h){var a=t(o,h);return e&&a&&(a=-a),a||(s||(s=n(i)),r(o,h))}return function(n,r){if(this._isDestroyed||this._items.length<2)return this;var a,_=this._items,l=r||0,d=l.layout?l.layout:void 0===l.layout;if(t=n,e=!!l.descending,i=_.slice(0),s=null,c(t))_.sort(h);else if(typeof t===de)t=n.trim().split(" ").map(function(t){return t.split(":")}),_.sort(o);else{if(!Array.isArray(t))return this;if(t.length!==_.length)throw new Error("[Muuri] sort reference items do not match with grid items.");for(a=0;a<_.length;a++){if(t.indexOf(_[a])<0)throw new Error("[Muuri] sort reference items do not match with grid items.");_[a]=t[a]}e&&_.reverse()}return this._hasListeners("sort")&&this._emit("sort",_.slice(0),i),d&&this.layout("instant"===d,c(d)?d:void 0),this}}(),ce.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var s,n,r=this._items,o=i||0,h=o.layout?o.layout:void 0===o.layout,a="swap"===o.action,_=a?"swap":"move",l=this._getItem(t),d=this._getItem(e);return l&&d&&l!==d&&(s=r.indexOf(l),n=r.indexOf(d),a?Q(r,s,n):K(r,s,n),this._hasListeners("move")&&this._emit("move",{item:l,fromIndex:s,toIndex:n,action:_}),h&&this.layout("instant"===h,c(h)?h:void 0)),this},ce.prototype.send=function(t,e,i,s){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this._getItem(t)))return this;var n=s||0,r=n.appendTo||window.document.body,o=n.layoutSender?n.layoutSender:void 0===n.layoutSender,h=n.layoutReceiver?n.layoutReceiver:void 0===n.layoutReceiver;return t._migrate.start(e,i,r),t._migrate._isActive&&t._isActive&&(o&&this.layout("instant"===o,c(o)?o:void 0),h&&e.layout("instant"===h,c(h)?h:void 0)),this},ce.prototype.destroy=function(e){if(this._isDestroyed)return this;var i,s=this._element,n=this._items.slice(0);for(this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),i=0;i-1?t:this._items.length+t]||null;if(t instanceof Kt)return t._gridId===this._id?t:null;for(var e=0;e {
return gulp
diff --git a/karma.defaults.js b/karma.defaults.js
index 902227b5..4a3f62b5 100644
--- a/karma.defaults.js
+++ b/karma.defaults.js
@@ -31,11 +31,7 @@ module.exports = {
],
colors: true,
autoWatch: false,
- captureTimeout: 240000,
- browserDisconnectTimeout: 60000,
- browserNoActivityTimeout: 60000,
- browserDisconnectTolerance: 10,
- concurrency: 1,
+ browserDisconnectTolerance: 2,
singleRun: true,
hostname: '127.0.0.1',
sauceLabs: {
diff --git a/package-lock.json b/package-lock.json
index 0943f52b..5693c1d1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4323,7 +4323,7 @@
},
"os-locale": {
"version": "1.4.0",
- "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
+ "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"dev": true,
"requires": {
@@ -6144,7 +6144,7 @@
},
"wrap-ansi": {
"version": "2.1.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
+ "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"dev": true,
"requires": {
diff --git a/src/Dragger/Dragger.js b/src/Dragger/Dragger.js
index f5793af5..4ecf5791 100644
--- a/src/Dragger/Dragger.js
+++ b/src/Dragger/Dragger.js
@@ -7,11 +7,24 @@
import Emitter from '../Emitter/Emitter';
-import isPassiveEventsSupported from '../utils/isPassiveEventsSupported';
import getPrefixedPropName from '../utils/getPrefixedPropName';
import raf from '../utils/raf';
-var events = {
+// Detect support for passive events:
+// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
+var isPassiveEventsSupported = false;
+try {
+ var passiveOpts = Object.defineProperty({}, 'passive', {
+ get: function() {
+ isPassiveEventsSupported = true;
+ }
+ });
+ window.addEventListener('testPassive', null, passiveOpts);
+ window.removeEventListener('testPassive', null, passiveOpts);
+} catch (e) {}
+
+// Dragger events.
+export var events = {
start: 'start',
move: 'move',
end: 'end',
@@ -509,27 +522,30 @@ Dragger.prototype.setTouchAction = function(value) {
*
* @public
* @memberof Dragger.prototype
- * @param {Object} [props]
+ * @param {Object} [newProps]
*/
-Dragger.prototype.setCssProps = function(props) {
- if (!props) return;
+Dragger.prototype.setCssProps = function(newProps) {
+ if (!newProps) return;
- var cssProps = this._cssProps;
+ var currentProps = this._cssProps;
var element = this._element;
var prop;
var prefixedProp;
- // Reset existing props.
- for (prop in cssProps) {
- element.style[prop] = cssProps[prop];
- delete cssProps[prop];
+ // Reset current props.
+ for (prop in currentProps) {
+ element.style[prop] = currentProps[prop];
+ delete currentProps[prop];
}
// Set new props.
- for (prop in props) {
+ for (prop in newProps) {
+ // Make sure we have a value for the prop.
+ if (!newProps[prop]) continue;
+
// Special handling for touch-action.
if (prop === taProp) {
- this.setTouchAction(props[prop]);
+ this.setTouchAction(newProps[prop]);
continue;
}
@@ -538,8 +554,8 @@ Dragger.prototype.setCssProps = function(props) {
if (!prefixedProp) continue;
// Store the prop and add the style.
- cssProps[prefixedProp] = '';
- element.style[prefixedProp] = props[prop];
+ currentProps[prefixedProp] = '';
+ element.style[prefixedProp] = newProps[prop];
}
};
diff --git a/src/Grid/Grid.js b/src/Grid/Grid.js
index a07a0c08..c03b7dd0 100644
--- a/src/Grid/Grid.js
+++ b/src/Grid/Grid.js
@@ -334,7 +334,8 @@ Grid.defaultOptions = {
userSelect: 'none',
userDrag: 'none',
tapHighlightColor: 'rgba(0, 0, 0, 0)',
- touchCallout: 'none'
+ touchCallout: 'none',
+ contentZooming: 'none'
},
dragPlaceholder: {
enabled: false,
diff --git a/src/utils/getPrefixedPropName.js b/src/utils/getPrefixedPropName.js
index c0dc250e..cce2bd09 100644
--- a/src/utils/getPrefixedPropName.js
+++ b/src/utils/getPrefixedPropName.js
@@ -1,9 +1,6 @@
/**
- * Copyright (c) 2015-present, Haltu Oy
- * Released under the MIT license
- * https://github.com/haltu/muuri/blob/master/LICENSE.md
- *
- * Forked from: https://github.com/hammerjs/hammer.js/blob/563b5b1e4bfbb5796798dd286cd57b7c56f1eb9e/src/utils/prefixed.js
+ * Forked from hammer.js:
+ * https://github.com/hammerjs/hammer.js/blob/563b5b1e4bfbb5796798dd286cd57b7c56f1eb9e/src/utils/prefixed.js
*/
var vendorPrefixes = ['', 'webkit', 'moz', 'ms', 'o', 'Webkit', 'Moz', 'MS', 'O'];
diff --git a/src/utils/isPassiveEventsSupported.js b/src/utils/isPassiveEventsSupported.js
deleted file mode 100644
index 11cf978c..00000000
--- a/src/utils/isPassiveEventsSupported.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) 2015-present, Haltu Oy
- * Released under the MIT license
- * https://github.com/haltu/muuri/blob/master/LICENSE.md
- */
-
-var supportsPassive = false;
-try {
- var passiveOpts = Object.defineProperty({}, 'passive', {
- get: function() {
- supportsPassive = true;
- }
- });
- window.addEventListener('testPassive', null, passiveOpts);
- window.removeEventListener('testPassive', null, passiveOpts);
-} catch (e) {}
-
-export default supportsPassive;