Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r0.9.5 #487

Merged
merged 7 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ npm install muuri

Or download:

- [muuri.js](https://cdn.jsdelivr.net/npm/muuri@0.9.4/dist/muuri.js) - for development (not minified, with comments).
- [muuri.min.js](https://cdn.jsdelivr.net/npm/muuri@0.9.4/dist/muuri.min.js) - for production (minified, no comments).
- [muuri.js](https://cdn.jsdelivr.net/npm/muuri@0.9.5/dist/muuri.js) - for development (not minified, with comments).
- [muuri.min.js](https://cdn.jsdelivr.net/npm/muuri@0.9.5/dist/muuri.min.js) - for production (minified, no comments).

Or link directly:

```html
<script src="https://cdn.jsdelivr.net/npm/muuri@0.9.4/dist/muuri.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/muuri@0.9.5/dist/muuri.min.js"></script>
```

<h3><a id="getting-started-2" href="#getting-started-2" aria-hidden="true">#</a> 2. Get Web Animations Polyfill (if needed)</h3>
Expand Down
66 changes: 20 additions & 46 deletions dist/muuri.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Muuri v0.9.3
* Muuri v0.9.5
* https://muuri.dev/
* Copyright (c) 2015-present, Haltu Oy
* Released under the MIT license
Expand Down Expand Up @@ -374,7 +374,7 @@

// Playing it safe here, test all potential prefixes capitalized and lowercase.
var vendorPrefixes = ['', 'webkit', 'moz', 'ms', 'o', 'Webkit', 'Moz', 'MS', 'O'];
var cache = {};
var cache$2 = {};

/**
* Get prefixed CSS property name when given a non-prefixed CSS property name.
Expand All @@ -385,15 +385,15 @@
* @returns {String}
*/
function getPrefixedPropName(style, prop) {
var prefixedProp = cache[prop] || '';
var prefixedProp = cache$2[prop] || '';
if (prefixedProp) return prefixedProp;

var camelProp = prop[0].toUpperCase() + prop.slice(1);
var i = 0;
while (i < vendorPrefixes.length) {
prefixedProp = vendorPrefixes[i] ? vendorPrefixes[i] + camelProp : prop;
if (prefixedProp in style) {
cache[prop] = prefixedProp;
cache$2[prop] = prefixedProp;
return prefixedProp;
}
++i;
Expand Down Expand Up @@ -1220,19 +1220,7 @@
return typeof val === functionType;
}

var isWeakMapSupported = typeof WeakMap === 'function';
var cache$1 = isWeakMapSupported ? new WeakMap() : null;
var cacheInterval = 3000;
var cacheTimer;
var canClearCache = true;
var clearCache = function () {
if (canClearCache) {
cacheTimer = window.clearInterval(cacheTimer);
cache$1 = isWeakMapSupported ? new WeakMap() : null;
} else {
canClearCache = true;
}
};
var cache$1 = typeof WeakMap === 'function' ? new WeakMap() : null;

/**
* Returns the computed value of an element's style property as a string.
Expand All @@ -1249,14 +1237,6 @@
if (cache$1) cache$1.set(element, styles);
}

if (cache$1) {
if (!cacheTimer) {
cacheTimer = window.setInterval(clearCache, cacheInterval);
} else {
canClearCache = false;
}
}

return styles.getPropertyValue(style);
}

Expand Down Expand Up @@ -2494,7 +2474,7 @@

var transformStyle = getStyleName(transformProp);

var transformNone = 'none';
var transformNone$1 = 'none';
var displayInline = 'inline';
var displayNone = 'none';
var displayStyle = 'display';
Expand All @@ -2513,7 +2493,7 @@
*/
function isTransformed(element) {
var transform = getStyle(element, transformStyle);
if (!transform || transform === transformNone) return false;
if (!transform || transform === transformNone$1) return false;

var display = getStyle(element, displayStyle);
if (display === displayInline || display === displayNone) return false;
Expand Down Expand Up @@ -2684,7 +2664,7 @@
}

var translateValue = {};
var transformNone$1 = 'none';
var transformNone = 'none';
var rxMat3d = /^matrix3d/;
var rxMatTx = /([^,]*,){4}/;
var rxMat3dTx = /([^,]*,){12}/;
Expand All @@ -2703,7 +2683,7 @@
translateValue.y = 0;

var transform = getStyle(element, transformStyle);
if (!transform || transform === transformNone$1) {
if (!transform || transform === transformNone) {
return translateValue;
}

Expand Down Expand Up @@ -4073,9 +4053,6 @@
var element = item._element;
var grid = this._getGrid();
var gridContainer = grid._element;
var axis = grid._settings.dragAxis;
var moveX = axis !== 'y';
var moveY = axis !== 'x';
var rect = element.getBoundingClientRect();

// Update container diff.
Expand All @@ -4086,18 +4063,14 @@
}

// Update horizontal position data.
if (moveX) {
var scrollDiffX = this._clientX - this._moveDiffX - this._scrollDiffX - rect.left;
this._left = this._left - this._scrollDiffX + scrollDiffX;
this._scrollDiffX = scrollDiffX;
}
var scrollDiffX = this._clientX - this._moveDiffX - rect.left;
this._left = this._left - this._scrollDiffX + scrollDiffX;
this._scrollDiffX = scrollDiffX;

// Update vertical position data.
if (moveY) {
var scrollDiffY = this._clientY - this._moveDiffY - this._scrollDiffY - rect.top;
this._top = this._top - this._scrollDiffY + scrollDiffY;
this._scrollDiffY = scrollDiffY;
}
var scrollDiffY = this._clientY - this._moveDiffY - rect.top;
this._top = this._top - this._scrollDiffY + scrollDiffY;
this._scrollDiffY = scrollDiffY;

// Update grid position.
this._gridX = this._left - this._containerDiffX;
Expand Down Expand Up @@ -4223,7 +4196,7 @@
}

var unprefixRegEx = /^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/;
var cache$2 = {};
var cache = {};

/**
* Remove any potential vendor prefixes from a property name.
Expand All @@ -4232,7 +4205,7 @@
* @returns {String}
*/
function getUnprefixedPropName(prop) {
var result = cache$2[prop];
var result = cache[prop];
if (result) return result;

result = prop.replace(unprefixRegEx, '');
Expand All @@ -4241,7 +4214,7 @@
result = result[0].toLowerCase() + result.slice(1);
}

cache$2[prop] = result;
cache[prop] = result;

return result;
}
Expand Down Expand Up @@ -6481,6 +6454,7 @@
this.slotSizes.length = 0;
this.currentRects.length = 0;
this.nextRects.length = 0;
this.rectStore.length = 0;
this.rectId = 0;
this.slotIndex = -1;

Expand Down Expand Up @@ -7003,7 +6977,7 @@
var callback = this._layoutCallbacks[layoutId];
var worker = this._layoutWorkers[layoutId];

if (layout) delete this._layoutCallbacks[layoutId];
if (layout) delete this._layouts[layoutId];
if (callback) delete this._layoutCallbacks[layoutId];
if (worker) delete this._layoutWorkers[layoutId];

Expand Down
4 changes: 2 additions & 2 deletions dist/muuri.min.js

Large diffs are not rendered by default.

66 changes: 20 additions & 46 deletions dist/muuri.module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Muuri v0.9.3
* Muuri v0.9.5
* https://muuri.dev/
* Copyright (c) 2015-present, Haltu Oy
* Released under the MIT license
Expand Down Expand Up @@ -368,7 +368,7 @@ EdgeHack.prototype.destroy = function () {

// Playing it safe here, test all potential prefixes capitalized and lowercase.
var vendorPrefixes = ['', 'webkit', 'moz', 'ms', 'o', 'Webkit', 'Moz', 'MS', 'O'];
var cache = {};
var cache$2 = {};

/**
* Get prefixed CSS property name when given a non-prefixed CSS property name.
Expand All @@ -379,15 +379,15 @@ var cache = {};
* @returns {String}
*/
function getPrefixedPropName(style, prop) {
var prefixedProp = cache[prop] || '';
var prefixedProp = cache$2[prop] || '';
if (prefixedProp) return prefixedProp;

var camelProp = prop[0].toUpperCase() + prop.slice(1);
var i = 0;
while (i < vendorPrefixes.length) {
prefixedProp = vendorPrefixes[i] ? vendorPrefixes[i] + camelProp : prop;
if (prefixedProp in style) {
cache[prop] = prefixedProp;
cache$2[prop] = prefixedProp;
return prefixedProp;
}
++i;
Expand Down Expand Up @@ -1214,19 +1214,7 @@ function isFunction(val) {
return typeof val === functionType;
}

var isWeakMapSupported = typeof WeakMap === 'function';
var cache$1 = isWeakMapSupported ? new WeakMap() : null;
var cacheInterval = 3000;
var cacheTimer;
var canClearCache = true;
var clearCache = function () {
if (canClearCache) {
cacheTimer = window.clearInterval(cacheTimer);
cache$1 = isWeakMapSupported ? new WeakMap() : null;
} else {
canClearCache = true;
}
};
var cache$1 = typeof WeakMap === 'function' ? new WeakMap() : null;

/**
* Returns the computed value of an element's style property as a string.
Expand All @@ -1243,14 +1231,6 @@ function getStyle(element, style) {
if (cache$1) cache$1.set(element, styles);
}

if (cache$1) {
if (!cacheTimer) {
cacheTimer = window.setInterval(clearCache, cacheInterval);
} else {
canClearCache = false;
}
}

return styles.getPropertyValue(style);
}

Expand Down Expand Up @@ -2488,7 +2468,7 @@ function getStyleName(property) {

var transformStyle = getStyleName(transformProp);

var transformNone = 'none';
var transformNone$1 = 'none';
var displayInline = 'inline';
var displayNone = 'none';
var displayStyle = 'display';
Expand All @@ -2507,7 +2487,7 @@ var displayStyle = 'display';
*/
function isTransformed(element) {
var transform = getStyle(element, transformStyle);
if (!transform || transform === transformNone) return false;
if (!transform || transform === transformNone$1) return false;

var display = getStyle(element, displayStyle);
if (display === displayInline || display === displayNone) return false;
Expand Down Expand Up @@ -2678,7 +2658,7 @@ function getScrollableAncestors(element, result) {
}

var translateValue = {};
var transformNone$1 = 'none';
var transformNone = 'none';
var rxMat3d = /^matrix3d/;
var rxMatTx = /([^,]*,){4}/;
var rxMat3dTx = /([^,]*,){12}/;
Expand All @@ -2697,7 +2677,7 @@ function getTranslate(element) {
translateValue.y = 0;

var transform = getStyle(element, transformStyle);
if (!transform || transform === transformNone$1) {
if (!transform || transform === transformNone) {
return translateValue;
}

Expand Down Expand Up @@ -4067,9 +4047,6 @@ ItemDrag.prototype._prepareScroll = function () {
var element = item._element;
var grid = this._getGrid();
var gridContainer = grid._element;
var axis = grid._settings.dragAxis;
var moveX = axis !== 'y';
var moveY = axis !== 'x';
var rect = element.getBoundingClientRect();

// Update container diff.
Expand All @@ -4080,18 +4057,14 @@ ItemDrag.prototype._prepareScroll = function () {
}

// Update horizontal position data.
if (moveX) {
var scrollDiffX = this._clientX - this._moveDiffX - this._scrollDiffX - rect.left;
this._left = this._left - this._scrollDiffX + scrollDiffX;
this._scrollDiffX = scrollDiffX;
}
var scrollDiffX = this._clientX - this._moveDiffX - rect.left;
this._left = this._left - this._scrollDiffX + scrollDiffX;
this._scrollDiffX = scrollDiffX;

// Update vertical position data.
if (moveY) {
var scrollDiffY = this._clientY - this._moveDiffY - this._scrollDiffY - rect.top;
this._top = this._top - this._scrollDiffY + scrollDiffY;
this._scrollDiffY = scrollDiffY;
}
var scrollDiffY = this._clientY - this._moveDiffY - rect.top;
this._top = this._top - this._scrollDiffY + scrollDiffY;
this._scrollDiffY = scrollDiffY;

// Update grid position.
this._gridX = this._left - this._containerDiffX;
Expand Down Expand Up @@ -4217,7 +4190,7 @@ function getCurrentStyles(element, styles) {
}

var unprefixRegEx = /^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/;
var cache$2 = {};
var cache = {};

/**
* Remove any potential vendor prefixes from a property name.
Expand All @@ -4226,7 +4199,7 @@ var cache$2 = {};
* @returns {String}
*/
function getUnprefixedPropName(prop) {
var result = cache$2[prop];
var result = cache[prop];
if (result) return result;

result = prop.replace(unprefixRegEx, '');
Expand All @@ -4235,7 +4208,7 @@ function getUnprefixedPropName(prop) {
result = result[0].toLowerCase() + result.slice(1);
}

cache$2[prop] = result;
cache[prop] = result;

return result;
}
Expand Down Expand Up @@ -6475,6 +6448,7 @@ function createPackerProcessor(isWorker) {
this.slotSizes.length = 0;
this.currentRects.length = 0;
this.nextRects.length = 0;
this.rectStore.length = 0;
this.rectId = 0;
this.slotIndex = -1;

Expand Down Expand Up @@ -6997,7 +6971,7 @@ Packer.prototype._onWorkerMessage = function (msg) {
var callback = this._layoutCallbacks[layoutId];
var worker = this._layoutWorkers[layoutId];

if (layout) delete this._layoutCallbacks[layoutId];
if (layout) delete this._layouts[layoutId];
if (callback) delete this._layoutCallbacks[layoutId];
if (worker) delete this._layoutWorkers[layoutId];

Expand Down
Loading