From 7aa6461b4d5c669a739641f21229ae572dc8f959 Mon Sep 17 00:00:00 2001 From: Glen Cheney Date: Tue, 19 Apr 2016 13:30:45 -0700 Subject: [PATCH] Move layout positioning logic to its own file. --- .jshintrc | 5 +- dist/shuffle.js | 279 +++++++++++++++++++++++----------------- dist/shuffle.js.map | 2 +- dist/shuffle.min.js | 2 +- dist/shuffle.min.js.map | 2 +- src/layout.js | 129 +++++++++++++++++++ src/shuffle.js | 123 ++---------------- 7 files changed, 300 insertions(+), 242 deletions(-) create mode 100644 src/layout.js diff --git a/.jshintrc b/.jshintrc index 550e289..8efa884 100644 --- a/.jshintrc +++ b/.jshintrc @@ -7,14 +7,11 @@ // Define globals exposed by modern browsers. "browser": true, - // Define globals exposed by jQuery. - "jquery": false, - // Define globals exposed by Node.js. "node": true, // Allow ES6. - "esnext": true, + "esversion": 6, /* * ENFORCING OPTIONS diff --git a/dist/shuffle.js b/dist/shuffle.js index 1647538..d58592f 100644 --- a/dist/shuffle.js +++ b/dist/shuffle.js @@ -98,6 +98,8 @@ return /******/ (function(modules) { // webpackBootstrap var _onTransitionEnd = __webpack_require__(13); + var _layout2 = __webpack_require__(14); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -110,10 +112,6 @@ return /******/ (function(modules) { // webpackBootstrap return Math.max.apply(Math, array); } - function arrayMin(array) { - return Math.min.apply(Math, array); - } - function arrayIncludes(array, obj) { if (arguments.length === 2) { return arrayIncludes(array)(obj); @@ -718,123 +716,14 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_getItemPosition', value: function _getItemPosition(itemSize) { - var columnSpan = this._getColumnSpan(itemSize.width, this.colWidth, this.cols); - - var setY = this._getColumnSet(columnSpan, this.cols); - - // Finds the index of the smallest number in the set. - var shortColumnIndex = this._getShortColumn(setY, this.options.buffer); - - // Position the item - var point = new _point2.default(Math.round(this.colWidth * shortColumnIndex), Math.round(setY[shortColumnIndex])); - - // Update the columns array with the new values for each column. - // e.g. before the update the columns could be [250, 0, 0, 0] for an item - // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0]. - var setHeight = setY[shortColumnIndex] + itemSize.height; - var setSpan = this.cols + 1 - setY.length; - for (var i = 0; i < setSpan; i++) { - this.positions[shortColumnIndex + i] = setHeight; - } - - return point; - } - - /** - * Determine the number of columns an items spans. - * @param {number} itemWidth Width of the item. - * @param {number} columnWidth Width of the column (includes gutter). - * @param {number} columns Total number of columns - * @return {number} - * @private - */ - - }, { - key: '_getColumnSpan', - value: function _getColumnSpan(itemWidth, columnWidth, columns) { - var columnSpan = itemWidth / columnWidth; - - // If the difference between the rounded column span number and the - // calculated column span number is really small, round the number to - // make it fit. - if (Math.abs(Math.round(columnSpan) - columnSpan) < this.options.columnThreshold) { - // e.g. columnSpan = 4.0089945390298745 - columnSpan = Math.round(columnSpan); - } - - // Ensure the column span is not more than the amount of columns in the whole layout. - return Math.min(Math.ceil(columnSpan), columns); - } - - /** - * Retrieves the column set to use for placement. - * @param {number} columnSpan The number of columns this current item spans. - * @param {number} columns The total columns in the grid. - * @return {Array.} An array of numbers represeting the column set. - * @private - */ - - }, { - key: '_getColumnSet', - value: function _getColumnSet(columnSpan, columns) { - // The item spans only one column. - if (columnSpan === 1) { - return this.positions; - - // The item spans more than one column, figure out how many different - // places it could fit horizontally. - // The group count is the number of places within the positions this block - // could fit, ignoring the current positions of items. - // Imagine a 2 column brick as the second item in a 4 column grid with - // 10px height each. Find the places it would fit: - // [10, 0, 0, 0] - // | | | - // * * * - // - // Then take the places which fit and get the bigger of the two: - // max([10, 0]), max([0, 0]), max([0, 0]) = [10, 0, 0] - // - // Next, find the first smallest number (the short column). - // [10, 0, 0] - // | - // * - // - // And that's where it should be placed! - } else { - var groupCount = columns + 1 - columnSpan; - var groupY = []; - - // For how many possible positions for this item there are. - for (var i = 0; i < groupCount; i++) { - // Find the bigger value for each place it could fit. - groupY[i] = arrayMax(this.positions.slice(i, i + columnSpan)); - } - - return groupY; - } - } - - /** - * Find index of short column, the first from the left where this item will go. - * - * @param {Array.} positions The array to search for the smallest number. - * @param {number} buffer Optional buffer which is very useful when the height - * is a percentage of the width. - * @return {number} Index of the short column. - * @private - */ - - }, { - key: '_getShortColumn', - value: function _getShortColumn(positions, buffer) { - var minPosition = arrayMin(positions); - for (var i = 0, len = positions.length; i < len; i++) { - if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) { - return i; - } - } - - return 0; + return (0, _layout2.getItemPosition)({ + itemSize: itemSize, + positions: this.positions, + gridSize: this.colWidth, + total: this.cols, + threshold: this.options.columnThreshold, + buffer: this.options.buffer + }); } /** @@ -2102,6 +1991,154 @@ return /******/ (function(modules) { // webpackBootstrap return false; } +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getItemPosition = getItemPosition; + + var _point = __webpack_require__(6); + + var _point2 = _interopRequireDefault(_point); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function arrayMax(array) { + return Math.max.apply(Math, array); + } + + function arrayMin(array) { + return Math.min.apply(Math, array); + } + + /** + * Determine the location of the next item, based on its size. + * @param {Object} itemSize Object with width and height. + * @param {Array.} positions Positions of the other current items. + * @param {number} gridSize The column width or row height. + * @param {number} total The total number of columns or rows. + * @param {number} threshold Buffer value for the column to fit. + * @param {number} buffer Vertical buffer for the height of items. + * @return {Point} + */ + function getItemPosition(_ref) { + var itemSize = _ref.itemSize; + var positions = _ref.positions; + var gridSize = _ref.gridSize; + var total = _ref.total; + var threshold = _ref.threshold; + var buffer = _ref.buffer; + + var span = getColumnSpan(itemSize.width, gridSize, total, threshold); + var setY = getAvailablePositions(positions, span, total); + var shortColumnIndex = getShortColumn(setY, buffer); + + // Position the item + var point = new _point2.default(Math.round(gridSize * shortColumnIndex), Math.round(setY[shortColumnIndex])); + + // Update the columns array with the new values for each column. + // e.g. before the update the columns could be [250, 0, 0, 0] for an item + // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0]. + var setHeight = setY[shortColumnIndex] + itemSize.height; + for (var i = 0; i < span; i++) { + positions[shortColumnIndex + i] = setHeight; + } + + return point; + } + + /** + * Determine the number of columns an items spans. + * @param {number} itemWidth Width of the item. + * @param {number} columnWidth Width of the column (includes gutter). + * @param {number} columns Total number of columns + * @param {number} threshold A buffer value for the size of the column to fit. + * @return {number} + */ + function getColumnSpan(itemWidth, columnWidth, columns, threshold) { + var columnSpan = itemWidth / columnWidth; + + // If the difference between the rounded column span number and the + // calculated column span number is really small, round the number to + // make it fit. + if (Math.abs(Math.round(columnSpan) - columnSpan) < threshold) { + // e.g. columnSpan = 4.0089945390298745 + columnSpan = Math.round(columnSpan); + } + + // Ensure the column span is not more than the amount of columns in the whole layout. + return Math.min(Math.ceil(columnSpan), columns); + } + + /** + * Retrieves the column set to use for placement. + * @param {number} columnSpan The number of columns this current item spans. + * @param {number} columns The total columns in the grid. + * @return {Array.} An array of numbers represeting the column set. + */ + function getAvailablePositions(positions, columnSpan, columns) { + // The item spans only one column. + if (columnSpan === 1) { + return positions; + } + + // The item spans more than one column, figure out how many different + // places it could fit horizontally. + // The group count is the number of places within the positions this block + // could fit, ignoring the current positions of items. + // Imagine a 2 column brick as the second item in a 4 column grid with + // 10px height each. Find the places it would fit: + // [20, 10, 10, 0] + // | | | + // * * * + // + // Then take the places which fit and get the bigger of the two: + // max([20, 10]), max([10, 10]), max([10, 0]) = [20, 10, 0] + // + // Next, find the first smallest number (the short column). + // [20, 10, 0] + // | + // * + // + // And that's where it should be placed! + // + // Another example where the second column's item extends past the first: + // [10, 20, 10, 0] => [20, 20, 10] => 10 + var available = []; + + // For how many possible positions for this item there are. + for (var i = 0; i <= columns - columnSpan; i++) { + // Find the bigger value for each place it could fit. + available.push(arrayMax(positions.slice(i, i + columnSpan))); + } + + return available; + } + + /** + * Find index of short column, the first from the left where this item will go. + * + * @param {Array.} positions The array to search for the smallest number. + * @param {number} buffer Optional buffer which is very useful when the height + * is a percentage of the width. + * @return {number} Index of the short column. + */ + function getShortColumn(positions, buffer) { + var minPosition = arrayMin(positions); + for (var i = 0, len = positions.length; i < len; i++) { + if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) { + return i; + } + } + + return 0; + } + /***/ } /******/ ]) }); diff --git a/dist/shuffle.js.map b/dist/shuffle.js.map index b8ed69b..3b211b5 100644 --- a/dist/shuffle.js.map +++ b/dist/shuffle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 8979a5f6a0e7da537f43","webpack:///./src/shuffle.js","webpack:///./~/custom-event-polyfill/custom-event-polyfill.js","webpack:///./~/matches-selector/index.js","webpack:///./~/array-uniq/index.js","webpack:///./~/xtend/immutable.js","webpack:///./~/throttleit/index.js","webpack:///./src/point.js","webpack:///./src/get-number.js","webpack:///./src/shuffle-item.js","webpack:///./src/classes.js","webpack:///./src/get-number-style.js","webpack:///./src/computed-size.js","webpack:///./src/sorter.js","webpack:///./src/on-transition-end.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA;;;;AAEA;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;;;AAEA,UAAS,OAAT,CAAiB,SAAjB,EAA4B;AAC1B,UAAO,MAAM,SAAN,CAAgB,KAAhB,CAAsB,IAAtB,CAA2B,SAA3B,CAAP,CAD0B;EAA5B;;AAIA,UAAS,QAAT,CAAkB,KAAlB,EAA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PsC","file":"shuffle.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"shuffle\"] = factory();\n\telse\n\t\troot[\"shuffle\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 8979a5f6a0e7da537f43\n **/","'use strict';\n\nimport 'custom-event-polyfill';\nimport matches from 'matches-selector';\nimport arrayUnique from 'array-uniq';\nimport xtend from 'xtend';\nimport throttle from 'throttleit';\nimport Point from './point';\nimport ShuffleItem from './shuffle-item';\nimport Classes from './classes';\nimport getNumberStyle from './get-number-style';\nimport sorter from './sorter';\nimport { onTransitionEnd, cancelTransitionEnd } from './on-transition-end';\n\nfunction toArray(arrayLike) {\n return Array.prototype.slice.call(arrayLike);\n}\n\nfunction arrayMax(array) {\n return Math.max.apply(Math, array);\n}\n\nfunction arrayMin(array) {\n return Math.min.apply(Math, array);\n}\n\nfunction arrayIncludes(array, obj) {\n if (arguments.length === 2) {\n return arrayIncludes(array)(obj);\n }\n\n return function (obj) {\n return array.indexOf(obj) > -1;\n };\n}\n\n// Used for unique instance variables\nlet id = 0;\n\nclass Shuffle {\n\n /**\n * Categorize, sort, and filter a responsive grid of items.\n *\n * @param {Element} element An element which is the parent container for the grid items.\n * @param {Object} [options=Shuffle.options] Options object.\n * @constructor\n */\n constructor(element, options = {}) {\n this.options = xtend(Shuffle.options, options);\n\n this.useSizer = false;\n this.lastSort = {};\n this.lastFilter = Shuffle.ALL_ITEMS;\n this.isEnabled = true;\n this.isDestroyed = false;\n this.isInitialized = false;\n this._transitions = [];\n this.isTransitioning = false;\n this._queue = [];\n\n element = this._getElementOption(element);\n\n if (!element) {\n throw new TypeError('Shuffle needs to be initialized with an element.');\n }\n\n this.element = element;\n this.id = 'shuffle_' + id++;\n\n this._init();\n this.isInitialized = true;\n }\n\n _init() {\n this.items = this._getItems();\n\n this.options.sizer = this._getElementOption(this.options.sizer);\n\n if (this.options.sizer) {\n this.useSizer = true;\n }\n\n // Add class and invalidate styles\n this.element.classList.add(Shuffle.Classes.BASE);\n\n // Set initial css for each item\n this._initItems();\n\n // Bind resize events\n this._onResize = this._getResizeFunction();\n window.addEventListener('resize', this._onResize);\n\n // Get container css all in one request. Causes reflow\n var containerCss = window.getComputedStyle(this.element, null);\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // Add styles to the container if it doesn't have them.\n this._validateStyles(containerCss);\n\n // We already got the container's width above, no need to cause another\n // reflow getting it again... Calculate the number of columns there will be\n this._setColumns(containerWidth);\n\n // Kick off!\n this.filter(this.options.group, this.options.initialSort);\n\n // The shuffle items haven't had transitions set on them yet so the user\n // doesn't see the first layout. Set them now that the first layout is done.\n // First, however, a synchronous layout must be caused for the previous\n // styles to be applied without transitions.\n this.element.offsetWidth; // jshint ignore: line\n this._setTransitions();\n this.element.style.transition = 'height ' + this.options.speed + 'ms ' + this.options.easing;\n }\n\n /**\n * Returns a throttled and proxied function for the resize handler.\n * @return {Function}\n * @private\n */\n _getResizeFunction() {\n var resizeFunction = this._handleResize.bind(this);\n return this.options.throttle ?\n this.options.throttle(resizeFunction, this.options.throttleTime) :\n resizeFunction;\n }\n\n /**\n * Retrieve an element from an option.\n * @param {string|jQuery|Element} option The option to check.\n * @return {?Element} The plain element or null.\n * @private\n */\n _getElementOption(option) {\n // If column width is a string, treat is as a selector and search for the\n // sizer element within the outermost container\n if (typeof option === 'string') {\n return this.element.querySelector(option);\n\n // Check for an element\n } else if (option && option.nodeType && option.nodeType === 1) {\n return option;\n\n // Check for jQuery object\n } else if (option && option.jquery) {\n return option[0];\n }\n\n return null;\n }\n\n /**\n * Ensures the shuffle container has the css styles it needs applied to it.\n * @param {Object} styles Key value pairs for position and overflow.\n * @private\n */\n _validateStyles(styles) {\n // Position cannot be static.\n if (styles.position === 'static') {\n this.element.style.position = 'relative';\n }\n\n // Overflow has to be hidden.\n if (styles.overflow !== 'hidden') {\n this.element.style.overflow = 'hidden';\n }\n }\n\n /**\n * Filter the elements by a category.\n * @param {string} [category] Category to filter by. If it's given, the last\n * category will be used to filter the items.\n * @param {Array} [collection] Optionally filter a collection. Defaults to\n * all the items.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _filter(category = this.lastFilter, collection = this.items) {\n var set = this._getFilteredSets(category, collection);\n\n // Individually add/remove hidden/visible classes\n this._toggleFilterClasses(set);\n\n // Save the last filter in case elements are appended.\n this.lastFilter = category;\n\n // This is saved mainly because providing a filter function (like searching)\n // will overwrite the `lastFilter` property every time its called.\n if (typeof category === 'string') {\n this.options.group = category;\n }\n\n return set;\n }\n\n /**\n * Returns an object containing the visible and hidden elements.\n * @param {string|Function} category Category or function to filter by.\n * @param {Array.} items A collection of items to filter.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _getFilteredSets(category, items) {\n let visible = [];\n let hidden = [];\n\n // category === 'all', add visible class to everything\n if (category === Shuffle.ALL_ITEMS) {\n visible = items;\n\n // Loop through each item and use provided function to determine\n // whether to hide it or not.\n } else {\n items.forEach((item) => {\n if (this._doesPassFilter(category, item.element)) {\n visible.push(item);\n } else {\n hidden.push(item);\n }\n });\n }\n\n return {\n visible,\n hidden,\n };\n }\n\n /**\n * Test an item to see if it passes a category.\n * @param {string|Function} category Category or function to filter by.\n * @param {Element} element An element to test.\n * @return {boolean} Whether it passes the category/filter.\n * @private\n */\n _doesPassFilter(category, element) {\n\n if (typeof category === 'function') {\n return category.call(element, element, this);\n\n // Check each element's data-groups attribute against the given category.\n } else {\n let attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);\n let groups = JSON.parse(attr);\n let keys = this.delimeter && !Array.isArray(groups) ?\n groups.split(this.delimeter) :\n groups;\n\n if (Array.isArray(category)) {\n return category.some(arrayIncludes(keys));\n }\n\n return arrayIncludes(keys, category);\n }\n }\n\n /**\n * Toggles the visible and hidden class names.\n * @param {{visible, hidden}} Object with visible and hidden arrays.\n * @private\n */\n _toggleFilterClasses({ visible, hidden }) {\n visible.forEach((item) => {\n item.show();\n });\n\n hidden.forEach((item) => {\n item.hide();\n });\n }\n\n /**\n * Set the initial css for each item\n * @param {Array.} [items] Optionally specifiy at set to initialize.\n * @private\n */\n _initItems(items = this.items) {\n items.forEach((item) => {\n item.init();\n });\n }\n\n /**\n * Remove element reference and styles.\n * @private\n */\n _disposeItems(items = this.items) {\n items.forEach((item) => {\n item.dispose();\n });\n }\n\n /**\n * Updates the visible item count.\n * @private\n */\n _updateItemCount() {\n this.visibleItems = this._getFilteredItems().length;\n }\n\n /**\n * Sets css transform transition on a group of elements. This is not executed\n * at the same time as `item.init` so that transitions don't occur upon\n * initialization of Shuffle.\n * @param {Array.} items Shuffle items to set transitions on.\n * @private\n */\n _setTransitions(items = this.items) {\n let speed = this.options.speed;\n let easing = this.options.easing;\n\n var str;\n if (this.options.useTransforms) {\n str = 'transform ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n } else {\n str = 'top ' + speed + 'ms ' + easing +\n ', left ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n }\n\n items.forEach((item) => {\n item.element.style.transition = str;\n });\n }\n\n _getItems() {\n return toArray(this.element.children)\n .filter(el => matches(el, this.options.itemSelector))\n .map(el => new ShuffleItem(el));\n }\n\n /**\n * When new elements are added to the shuffle container, update the array of\n * items because that is the order `_layout` calls them.\n */\n _updateItemsOrder() {\n let children = this.element.children;\n this.items = sorter(this.items, {\n by(element) {\n return Array.prototype.indexOf.call(children, element);\n },\n });\n }\n\n _getFilteredItems() {\n return this.items.filter(item => item.isVisible);\n }\n\n _getConcealedItems() {\n return this.items.filter(item => !item.isVisible);\n }\n\n /**\n * Returns the column size, based on column width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @param {number} gutterSize Size of the gutters.\n * @return {number}\n * @private\n */\n _getColumnSize(containerWidth, gutterSize) {\n var size;\n\n // If the columnWidth property is a function, then the grid is fluid\n if (typeof this.options.columnWidth === 'function') {\n size = this.options.columnWidth(containerWidth);\n\n // columnWidth option isn't a function, are they using a sizing element?\n } else if (this.useSizer) {\n size = Shuffle.getSize(this.options.sizer).width;\n\n // if not, how about the explicitly set option?\n } else if (this.options.columnWidth) {\n size = this.options.columnWidth;\n\n // or use the size of the first item\n } else if (this.items.length > 0) {\n size = Shuffle.getSize(this.items[0].element, true).width;\n\n // if there's no items, use size of container\n } else {\n size = containerWidth;\n }\n\n // Don't let them set a column width of zero.\n if (size === 0) {\n size = containerWidth;\n }\n\n return size + gutterSize;\n }\n\n /**\n * Returns the gutter size, based on gutter width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @return {number}\n * @private\n */\n _getGutterSize(containerWidth) {\n var size;\n if (typeof this.options.gutterWidth === 'function') {\n size = this.options.gutterWidth(containerWidth);\n } else if (this.useSizer) {\n size = getNumberStyle(this.options.sizer, 'marginLeft');\n } else {\n size = this.options.gutterWidth;\n }\n\n return size;\n }\n\n /**\n * Calculate the number of columns to be used. Gets css if using sizer element.\n * @param {number} [containerWidth] Optionally specify a container width if\n * it's already available.\n */\n _setColumns(containerWidth = Shuffle.getSize(this.element).width) {\n var gutter = this._getGutterSize(containerWidth);\n var columnWidth = this._getColumnSize(containerWidth, gutter);\n var calculatedColumns = (containerWidth + gutter) / columnWidth;\n\n // Widths given from getStyles are not precise enough...\n if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) <\n this.options.columnThreshold) {\n // e.g. calculatedColumns = 11.998876\n calculatedColumns = Math.round(calculatedColumns);\n }\n\n this.cols = Math.max(Math.floor(calculatedColumns), 1);\n this.containerWidth = containerWidth;\n this.colWidth = columnWidth;\n }\n\n /**\n * Adjust the height of the grid\n */\n _setContainerSize() {\n this.element.style.height = this._getContainerSize() + 'px';\n }\n\n /**\n * Based on the column heights, it returns the biggest one.\n * @return {number}\n * @private\n */\n _getContainerSize() {\n return arrayMax(this.positions);\n }\n\n /**\n * Get the clamped stagger amount.\n * @param {number} index Index of the item to be staggered.\n * @return {number}\n */\n _getStaggerAmount(index) {\n return Math.min(index * this.options.staggerAmount, this.options.staggerAmountMax);\n }\n\n /**\n * @return {boolean} Whether the event was prevented or not.\n */\n _dispatch(name, details = {}) {\n if (this.isDestroyed) {\n return;\n }\n\n details.shuffle = this;\n return !this.element.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: false,\n detail: details,\n }));\n }\n\n /**\n * Zeros out the y columns array, which is used to determine item placement.\n * @private\n */\n _resetCols() {\n var i = this.cols;\n this.positions = [];\n while (i--) {\n this.positions.push(0);\n }\n }\n\n /**\n * Loops through each item that should be shown and calculates the x, y position.\n * @param {Array.} items Array of items that will be shown/layed\n * out in order in their array.\n */\n _layout(items) {\n let count = 0;\n items.forEach((item) => {\n var currPos = item.point;\n var currScale = item.scale;\n var itemSize = Shuffle.getSize(item.element, true);\n var pos = this._getItemPosition(itemSize);\n\n function callback() {\n item.applyCss(ShuffleItem.Css.VISIBLE.after);\n }\n\n // If the item will not change its position, do not add it to the render\n // queue. Transitions don't fire when setting a property to the same value.\n if (Point.equals(currPos, pos) && currScale === ShuffleItem.Scale.VISIBLE) {\n callback();\n return;\n }\n\n item.point = pos;\n item.scale = ShuffleItem.Scale.VISIBLE;\n\n let styles = ShuffleItem.Css.VISIBLE.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Determine the location of the next item, based on its size.\n * @param {{width: number, height: number}} itemSize Object with width and height.\n * @return {Point}\n * @private\n */\n _getItemPosition(itemSize) {\n var columnSpan = this._getColumnSpan(itemSize.width, this.colWidth, this.cols);\n\n var setY = this._getColumnSet(columnSpan, this.cols);\n\n // Finds the index of the smallest number in the set.\n var shortColumnIndex = this._getShortColumn(setY, this.options.buffer);\n\n // Position the item\n var point = new Point(\n Math.round(this.colWidth * shortColumnIndex),\n Math.round(setY[shortColumnIndex]));\n\n // Update the columns array with the new values for each column.\n // e.g. before the update the columns could be [250, 0, 0, 0] for an item\n // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0].\n var setHeight = setY[shortColumnIndex] + itemSize.height;\n var setSpan = this.cols + 1 - setY.length;\n for (var i = 0; i < setSpan; i++) {\n this.positions[shortColumnIndex + i] = setHeight;\n }\n\n return point;\n }\n\n /**\n * Determine the number of columns an items spans.\n * @param {number} itemWidth Width of the item.\n * @param {number} columnWidth Width of the column (includes gutter).\n * @param {number} columns Total number of columns\n * @return {number}\n * @private\n */\n _getColumnSpan(itemWidth, columnWidth, columns) {\n var columnSpan = itemWidth / columnWidth;\n\n // If the difference between the rounded column span number and the\n // calculated column span number is really small, round the number to\n // make it fit.\n if (Math.abs(Math.round(columnSpan) - columnSpan) < this.options.columnThreshold) {\n // e.g. columnSpan = 4.0089945390298745\n columnSpan = Math.round(columnSpan);\n }\n\n // Ensure the column span is not more than the amount of columns in the whole layout.\n return Math.min(Math.ceil(columnSpan), columns);\n }\n\n /**\n * Retrieves the column set to use for placement.\n * @param {number} columnSpan The number of columns this current item spans.\n * @param {number} columns The total columns in the grid.\n * @return {Array.} An array of numbers represeting the column set.\n * @private\n */\n _getColumnSet(columnSpan, columns) {\n // The item spans only one column.\n if (columnSpan === 1) {\n return this.positions;\n\n // The item spans more than one column, figure out how many different\n // places it could fit horizontally.\n // The group count is the number of places within the positions this block\n // could fit, ignoring the current positions of items.\n // Imagine a 2 column brick as the second item in a 4 column grid with\n // 10px height each. Find the places it would fit:\n // [10, 0, 0, 0]\n // | | |\n // * * *\n //\n // Then take the places which fit and get the bigger of the two:\n // max([10, 0]), max([0, 0]), max([0, 0]) = [10, 0, 0]\n //\n // Next, find the first smallest number (the short column).\n // [10, 0, 0]\n // |\n // *\n //\n // And that's where it should be placed!\n } else {\n var groupCount = columns + 1 - columnSpan;\n var groupY = [];\n\n // For how many possible positions for this item there are.\n for (var i = 0; i < groupCount; i++) {\n // Find the bigger value for each place it could fit.\n groupY[i] = arrayMax(this.positions.slice(i, i + columnSpan));\n }\n\n return groupY;\n }\n }\n\n /**\n * Find index of short column, the first from the left where this item will go.\n *\n * @param {Array.} positions The array to search for the smallest number.\n * @param {number} buffer Optional buffer which is very useful when the height\n * is a percentage of the width.\n * @return {number} Index of the short column.\n * @private\n */\n _getShortColumn(positions, buffer) {\n var minPosition = arrayMin(positions);\n for (var i = 0, len = positions.length; i < len; i++) {\n if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) {\n return i;\n }\n }\n\n return 0;\n }\n\n /**\n * Hides the elements that don't match our filter.\n * @param {Array.} collection Collection to shrink.\n * @private\n */\n _shrink(collection = this._getConcealedItems()) {\n let count = 0;\n collection.forEach((item) => {\n function callback() {\n item.applyCss(ShuffleItem.Css.HIDDEN.after);\n }\n\n // Continuing would add a transitionend event listener to the element, but\n // that listener would not execute because the transform and opacity would\n // stay the same.\n // The callback is executed here because it is not guaranteed to be called\n // after the transitionend event because the transitionend could be\n // canceled if another animation starts.\n if (item.scale === ShuffleItem.Scale.HIDDEN) {\n callback();\n return;\n }\n\n item.scale = ShuffleItem.Scale.HIDDEN;\n\n let styles = ShuffleItem.Css.HIDDEN.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Resize handler.\n * @private\n */\n _handleResize() {\n // If shuffle is disabled, destroyed, don't do anything\n if (!this.isEnabled || this.isDestroyed) {\n return;\n }\n\n // Will need to check height in the future if it's layed out horizontaly\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // containerWidth hasn't changed, don't do anything\n if (containerWidth === this.containerWidth) {\n return;\n }\n\n this.update();\n }\n\n /**\n * Returns styles which will be applied to the an item for a transition.\n * @param {Object} obj Transition options.\n * @return {!Object} Transforms for transitions, left/top for animate.\n * @private\n */\n _getStylesForTransition({ item, styles }) {\n if (!styles.transitionDelay) {\n styles.transitionDelay = '0ms';\n }\n\n let x = item.point.x;\n let y = item.point.y;\n\n if (this.options.useTransforms) {\n styles.transform = `translate(${x}px, ${y}px) scale(${item.scale})`;\n } else {\n styles.left = x + 'px';\n styles.top = y + 'px';\n }\n\n return styles;\n }\n\n _whenTransitionDone(element, itemCallback) {\n // TODO what happens when the transition is canceled and the promise never resolves?\n return new Promise((resolve) => {\n let id = onTransitionEnd(element, (evt) => {\n evt.currentTarget.style.transitionDelay = '';\n itemCallback();\n resolve();\n });\n this._transitions.push(id);\n });\n }\n\n _transition(opts) {\n opts.item.applyCss(this._getStylesForTransition(opts));\n return this._whenTransitionDone(opts.item.element, opts.callback);\n }\n\n /**\n * Execute the styles gathered in the style queue. This applies styles to elements,\n * triggering transitions.\n * @private\n */\n _processQueue() {\n if (this.isTransitioning) {\n this._cancelMovement();\n }\n\n // Iterate over the queue and keep track of ones that use transitions.\n let immediates = [];\n let transitions = [];\n this._queue.forEach((obj) => {\n if (!this.isInitialized || this.options.speed === 0) {\n immediates.push(obj);\n } else {\n transitions.push(obj);\n }\n });\n\n this._styleImmediately(immediates);\n\n if (transitions.length > 0 && this.options.speed > 0) {\n this._startTransitions(transitions);\n\n // A call to layout happened, but none of the newly visible items will\n // change position. Asynchronously fire the callback here.\n } else {\n setTimeout(this._dispatchLayout.bind(this), 0);\n }\n\n // Remove everything in the style queue\n this._queue.length = 0;\n }\n\n /**\n * Create a promise for each transition and wait for all of them to complete,\n * then emit the layout event.\n * @param {Array.} transitions Array of transition objects.\n */\n _startTransitions(transitions) {\n // Set flag that shuffle is currently in motion.\n this.isTransitioning = true;\n\n let promises = transitions.map(obj => this._transition(obj));\n Promise.all(promises).then(this._movementFinished.bind(this));\n }\n\n _cancelMovement() {\n // Remove the transition end event for each listener.\n this._transitions.forEach(cancelTransitionEnd);\n\n // Reset the array.\n this._transitions.length = 0;\n\n // Show it's no longer active.\n this.isTransitioning = false;\n }\n\n /**\n * Apply styles without a transition.\n * @param {Array.} objects Array of transition objects.\n * @private\n */\n _styleImmediately(objects) {\n if (objects.length) {\n let elements = objects.map(obj => obj.item.element);\n\n Shuffle._skipTransitions(elements, () => {\n objects.forEach((obj) => {\n obj.item.applyCss(this._getStylesForTransition(obj));\n obj.callback();\n });\n });\n }\n }\n\n _movementFinished() {\n this._transitions.length = 0;\n this.isTransitioning = false;\n this._dispatchLayout();\n }\n\n _dispatchLayout() {\n this._dispatch(Shuffle.EventType.LAYOUT);\n }\n\n /**\n * The magic. This is what makes the plugin 'shuffle'\n * @param {string|Function|Array.} [category] Category to filter by.\n * Can be a function, string, or array of strings.\n * @param {Object} [sortObj] A sort object which can sort the visible set\n */\n filter(category, sortObj) {\n if (!this.isEnabled) {\n return;\n }\n\n if (!category || (category && category.length === 0)) {\n category = Shuffle.ALL_ITEMS;\n }\n\n this._filter(category);\n\n // Shrink each hidden item\n this._shrink();\n\n // How many visible elements?\n this._updateItemCount();\n\n // Update transforms on visible elements so they will animate to their new positions.\n this.sort(sortObj);\n }\n\n /**\n * Gets the visible elements, sorts them, and passes them to layout.\n * @param {Object} opts the options object for the sorted plugin\n */\n sort(opts = this.lastSort) {\n if (!this.isEnabled) {\n return;\n }\n\n this._resetCols();\n\n var items = this._getFilteredItems();\n items = sorter(items, opts);\n\n this._layout(items);\n\n // `_layout` always happens after `_shrink`, so it's safe to process the style\n // queue here with styles from the shrink method.\n this._processQueue();\n\n // Adjust the height of the container.\n this._setContainerSize();\n\n this.lastSort = opts;\n }\n\n /**\n * Reposition everything.\n * @param {boolean} isOnlyLayout If true, column and gutter widths won't be\n * recalculated.\n */\n update(isOnlyLayout) {\n if (this.isEnabled) {\n\n if (!isOnlyLayout) {\n // Get updated colCount\n this._setColumns();\n }\n\n // Layout items\n this.sort();\n }\n }\n\n /**\n * Use this instead of `update()` if you don't need the columns and gutters updated\n * Maybe an image inside `shuffle` loaded (and now has a height), which means calculations\n * could be off.\n */\n layout() {\n this.update(true);\n }\n\n /**\n * New items have been appended to shuffle. Mix them in with the current\n * filter or sort status.\n * @param {Array.} newItems Collection of new items.\n */\n add(newItems) {\n newItems = arrayUnique(newItems).map(el => new ShuffleItem(el));\n\n // Add classes and set initial positions.\n this._initItems(newItems);\n\n // Add transition to each item.\n this._setTransitions(newItems);\n\n // Update the list of items.\n this.items = this.items.concat(newItems);\n this._updateItemsOrder();\n this.filter(this.lastFilter);\n }\n\n /**\n * Disables shuffle from updating dimensions and layout on resize\n */\n disable() {\n this.isEnabled = false;\n }\n\n /**\n * Enables shuffle again\n * @param {boolean} [isUpdateLayout=true] if undefined, shuffle will update columns and gutters\n */\n enable(isUpdateLayout) {\n this.isEnabled = true;\n if (isUpdateLayout !== false) {\n this.update();\n }\n }\n\n /**\n * Remove 1 or more shuffle items\n * @param {Array.} collection An array containing one or more\n * elements in shuffle\n * @return {Shuffle} The shuffle object\n */\n remove(collection) {\n if (!collection.length) {\n return;\n }\n\n collection = arrayUnique(collection);\n\n let oldItems = collection\n .map(element => this.getItemByElement(element))\n .filter(item => !!item);\n\n let handleLayout = () => {\n this.element.removeEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n this._disposeItems(oldItems);\n\n // Remove the collection in the callback\n collection.forEach((element) => {\n element.parentNode.removeChild(element);\n });\n\n this._dispatch(Shuffle.EventType.REMOVED, { collection });\n\n // Let it get garbage collected\n collection = null;\n oldItems = null;\n };\n\n // Hide collection first.\n this._toggleFilterClasses({\n visible: [],\n hidden: oldItems,\n });\n\n this._shrink(oldItems);\n\n this.sort();\n\n // Update the list of items here because `remove` could be called again\n // with an item that is in the process of being removed.\n this.items = this.items.filter(item => !arrayIncludes(oldItems, item));\n this._updateItemCount();\n\n this.element.addEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n }\n\n /**\n * Retrieve a shuffle item by its element.\n * @param {Element} element Element to look for.\n * @return {?ShuffleItem} A shuffle item or null if it's not found.\n */\n getItemByElement(element) {\n for (var i = this.items.length - 1; i >= 0; i--) {\n if (this.items[i].element === element) {\n return this.items[i];\n }\n }\n\n return null;\n }\n\n /**\n * Destroys shuffle, removes events, styles, and classes\n */\n destroy() {\n this._cancelMovement();\n window.removeEventListener('resize', this._onResize);\n\n // Reset container styles\n this.element.classList.remove('shuffle');\n this.element.removeAttribute('style');\n\n // Reset individual item styles\n this._disposeItems();\n\n // Null DOM references\n this.items = null;\n this.options.sizer = null;\n this.element = null;\n this._transitions = null;\n\n // Set a flag so if a debounced resize has been triggered,\n // it can first check if it is actually isDestroyed and not doing anything\n this.isDestroyed = true;\n }\n\n /**\n * Returns the outer width of an element, optionally including its margins.\n *\n * There are a few different methods for getting the width of an element, none of\n * which work perfectly for all Shuffle's use cases.\n *\n * 1. getBoundingClientRect() `left` and `right` properties.\n * - Accounts for transform scaled elements, making it useless for Shuffle\n * elements which have shrunk.\n * 2. The `offsetWidth` property.\n * - This value stays the same regardless of the elements transform property,\n * however, it does not return subpixel values.\n * 3. getComputedStyle()\n * - This works great Chrome, Firefox, Safari, but IE<=11 does not include\n * padding and border when box-sizing: border-box is set, requiring a feature\n * test and extra work to add the padding back for IE and other browsers which\n * follow the W3C spec here.\n *\n * @param {Element} element The element.\n * @param {boolean} [includeMargins] Whether to include margins. Default is false.\n * @return {{width: number, height: number}} The width and height.\n */\n static getSize(element, includeMargins) {\n // Store the styles so that they can be used by others without asking for it again.\n var styles = window.getComputedStyle(element, null);\n var width = getNumberStyle(element, 'width', styles);\n var height = getNumberStyle(element, 'height', styles);\n\n if (includeMargins) {\n var marginLeft = getNumberStyle(element, 'marginLeft', styles);\n var marginRight = getNumberStyle(element, 'marginRight', styles);\n var marginTop = getNumberStyle(element, 'marginTop', styles);\n var marginBottom = getNumberStyle(element, 'marginBottom', styles);\n width += marginLeft + marginRight;\n height += marginTop + marginBottom;\n }\n\n return {\n width,\n height,\n };\n }\n\n /**\n * Change a property or execute a function which will not have a transition\n * @param {Array.} elements DOM elements that won't be transitioned.\n * @param {Function} callback A function which will be called while transition\n * is set to 0ms.\n * @private\n */\n static _skipTransitions(elements, callback) {\n let zero = '0ms';\n\n // Save current duration and delay.\n let data = elements.map((element) => {\n let style = element.style;\n let duration = style.transitionDuration;\n let delay = style.transitionDelay;\n\n // Set the duration to zero so it happens immediately\n style.transitionDuration = zero;\n style.transitionDelay = zero;\n\n return {\n duration,\n delay,\n };\n });\n\n callback();\n\n // Cause reflow.\n elements[0].offsetWidth; // jshint ignore:line\n\n // Put the duration back\n elements.forEach((element, i) => {\n element.style.transitionDuration = data[i].duration;\n element.style.transitionDelay = data[i].delay;\n });\n }\n}\n\nShuffle.ALL_ITEMS = 'all';\nShuffle.FILTER_ATTRIBUTE_KEY = 'groups';\n\n/**\n * @enum {string}\n */\nShuffle.EventType = {\n LAYOUT: 'shuffle:layout',\n REMOVED: 'shuffle:removed',\n};\n\n/** @enum {string} */\nShuffle.Classes = Classes;\n\n// Overrideable options\nShuffle.options = {\n // Initial filter group.\n group: Shuffle.ALL_ITEMS,\n\n // Transition/animation speed (milliseconds).\n speed: 250,\n\n // CSS easing function to use.\n easing: 'ease',\n\n // e.g. '.picture-item'.\n itemSelector: '*',\n\n // Element or selector string. Use an element to determine the size of columns\n // and gutters.\n sizer: null,\n\n // A static number or function that tells the plugin how wide the gutters\n // between columns are (in pixels).\n gutterWidth: 0,\n\n // A static number or function that returns a number which tells the plugin\n // how wide the columns are (in pixels).\n columnWidth: 0,\n\n // If your group is not json, and is comma delimeted, you could set delimeter\n // to ','.\n delimeter: null,\n\n // Useful for percentage based heights when they might not always be exactly\n // the same (in pixels).\n buffer: 0,\n\n // Reading the width of elements isn't precise enough and can cause columns to\n // jump between values.\n columnThreshold: 0.01,\n\n // Shuffle can be isInitialized with a sort object. It is the same object\n // given to the sort method.\n initialSort: null,\n\n // By default, shuffle will throttle resize events. This can be changed or\n // removed.\n throttle: throttle,\n\n // How often shuffle can be called on resize (in milliseconds).\n throttleTime: 300,\n\n // Transition delay offset for each item in milliseconds.\n staggerAmount: 15,\n\n // Maximum stagger delay in milliseconds.\n staggerAmountMax: 250,\n\n // Whether to use transforms or absolute positioning.\n useTransforms: true,\n};\n\n// Expose for testing.\nShuffle.Point = Point;\nShuffle.ShuffleItem = ShuffleItem;\nShuffle.sorter = sorter;\n\nmodule.exports = Shuffle;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle.js\n **/","// Polyfill for creating CustomEvents on IE9/10/11\n\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\ntry {\n new window.CustomEvent(\"test\");\n} catch(e) {\n var CustomEvent = function(event, params) {\n var evt;\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n\n evt = document.createEvent(\"CustomEvent\");\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/custom-event-polyfill/custom-event-polyfill.js\n ** module id = 1\n ** module chunks = 0\n **/","'use strict';\n\nvar proto = Element.prototype;\nvar vendor = proto.matches\n || proto.matchesSelector\n || proto.webkitMatchesSelector\n || proto.mozMatchesSelector\n || proto.msMatchesSelector\n || proto.oMatchesSelector;\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n if (vendor) return vendor.call(el, selector);\n var nodes = el.parentNode.querySelectorAll(selector);\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i] == el) return true;\n }\n return false;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/matches-selector/index.js\n ** module id = 2\n ** module chunks = 0\n **/","'use strict';\n\n// there's 3 implementations written in increasing order of efficiency\n\n// 1 - no Set type is defined\nfunction uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}\n\n// 2 - a simple Set type is defined\nfunction uniqSet(arr) {\n\tvar seen = new Set();\n\treturn arr.filter(function (el) {\n\t\tif (!seen.has(el)) {\n\t\t\tseen.add(el);\n\t\t\treturn true;\n\t\t}\n\t});\n}\n\n// 3 - a standard Set type is defined and it has a forEach method\nfunction uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}\n\n// V8 currently has a broken implementation\n// https://github.com/joyent/node/issues/8449\nfunction doesForEachActuallyWork() {\n\tvar ret = false;\n\n\t(new Set([true])).forEach(function (el) {\n\t\tret = el;\n\t});\n\n\treturn ret === true;\n}\n\nif ('Set' in global) {\n\tif (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {\n\t\tmodule.exports = uniqSetWithForEach;\n\t} else {\n\t\tmodule.exports = uniqSet;\n\t}\n} else {\n\tmodule.exports = uniqNoSet;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/array-uniq/index.js\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/xtend/immutable.js\n ** module id = 4\n ** module chunks = 0\n **/","module.exports = throttle;\n\n/**\n * Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.\n *\n * @param {Function} func Function to wrap.\n * @param {Number} wait Number of milliseconds that must elapse between `func` invocations.\n * @return {Function} A new function that wraps the `func` function passed in.\n */\n\nfunction throttle (func, wait) {\n var ctx, args, rtn, timeoutID; // caching\n var last = 0;\n\n return function throttled () {\n ctx = this;\n args = arguments;\n var delta = new Date() - last;\n if (!timeoutID)\n if (delta >= wait) call();\n else timeoutID = setTimeout(call, wait - delta);\n return rtn;\n };\n\n function call () {\n timeoutID = 0;\n last = +new Date();\n rtn = func.apply(ctx, args);\n ctx = null;\n args = null;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/throttleit/index.js\n ** module id = 5\n ** module chunks = 0\n **/","'use strict';\n\nimport getNumber from './get-number';\n\n/**\n * Represents a coordinate pair.\n * @param {number} [x=0] X.\n * @param {number} [y=0] Y.\n */\nconst Point = function (x, y) {\n this.x = getNumber(x);\n this.y = getNumber(y);\n};\n\n/**\n * Whether two points are equal.\n * @param {Point} a Point A.\n * @param {Point} b Point B.\n * @return {boolean}\n */\nPoint.equals = function (a, b) {\n return a.x === b.x && a.y === b.y;\n};\n\nexport default Point;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/point.js\n **/","'use strict';\n\n/**\n * Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.\n * @param {*} value Possibly numeric value.\n * @return {number} `value` or zero if `value` isn't numeric.\n */\nexport default function getNumber(value) {\n return parseFloat(value) || 0;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number.js\n **/","import Point from './point';\nimport Classes from './classes';\n\nlet id = 0;\n\nclass ShuffleItem {\n constructor(element) {\n this.id = id++;\n this.element = element;\n this.isVisible = true;\n }\n\n show() {\n this.isVisible = true;\n this.element.classList.remove(Classes.HIDDEN);\n this.element.classList.add(Classes.VISIBLE);\n }\n\n hide() {\n this.isVisible = false;\n this.element.classList.remove(Classes.VISIBLE);\n this.element.classList.add(Classes.HIDDEN);\n }\n\n init() {\n this.addClasses([Classes.SHUFFLE_ITEM, Classes.VISIBLE]);\n this.applyCss(ShuffleItem.Css.INITIAL);\n this.scale = ShuffleItem.Scale.VISIBLE;\n this.point = new Point();\n }\n\n addClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.add(className);\n });\n }\n\n removeClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.remove(className);\n });\n }\n\n applyCss(obj) {\n for (var key in obj) {\n this.element.style[key] = obj[key];\n }\n }\n\n dispose() {\n this.removeClasses([\n Classes.HIDDEN,\n Classes.VISIBLE,\n Classes.SHUFFLE_ITEM,\n ]);\n\n this.element.removeAttribute('style');\n this.element = null;\n }\n}\n\nShuffleItem.Css = {\n INITIAL: {\n position: 'absolute',\n top: 0,\n left: 0,\n visibility: 'visible',\n 'will-change': 'transform',\n },\n VISIBLE: {\n before: {\n opacity: 1,\n visibility: 'visible',\n },\n after: {},\n },\n HIDDEN: {\n before: {\n opacity: 0,\n },\n after: {\n visibility: 'hidden',\n },\n },\n};\n\nShuffleItem.Scale = {\n VISIBLE: 1,\n HIDDEN: 0.001,\n};\n\nexport default ShuffleItem;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle-item.js\n **/","module.exports = {\n BASE: 'shuffle',\n SHUFFLE_ITEM: 'shuffle-item',\n VISIBLE: 'shuffle-item--visible',\n HIDDEN: 'shuffle-item--hidden',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/classes.js\n **/","'use strict';\n\nimport getNumber from './get-number';\nimport COMPUTED_SIZE_INCLUDES_PADDING from './computed-size';\n\n/**\n * Retrieve the computed style for an element, parsed as a float.\n * @param {Element} element Element to get style for.\n * @param {string} style Style property.\n * @param {CSSStyleDeclaration} [styles] Optionally include clean styles to\n * use instead of asking for them again.\n * @return {number} The parsed computed value or zero if that fails because IE\n * will return 'auto' when the element doesn't have margins instead of\n * the computed style.\n */\nexport default function getNumberStyle(element, style,\n styles = window.getComputedStyle(element, null)) {\n var value = getNumber(styles[style]);\n\n // Support IE<=11 and W3C spec.\n if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'width') {\n value += getNumber(styles.paddingLeft) +\n getNumber(styles.paddingRight) +\n getNumber(styles.borderLeftWidth) +\n getNumber(styles.borderRightWidth);\n } else if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'height') {\n value += getNumber(styles.paddingTop) +\n getNumber(styles.paddingBottom) +\n getNumber(styles.borderTopWidth) +\n getNumber(styles.borderBottomWidth);\n }\n\n return value;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number-style.js\n **/","\nlet element = document.body || document.documentElement;\nlet e = document.createElement('div');\ne.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';\nelement.appendChild(e);\n\nlet width = window.getComputedStyle(e, null).width;\nlet ret = width === '10px';\n\nelement.removeChild(e);\n\nexport default ret;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/computed-size.js\n **/","'use strict';\n\nimport xtend from 'xtend';\n\n// http://stackoverflow.com/a/962890/373422\nfunction randomize(array) {\n var tmp;\n var current;\n let top = array.length;\n\n if (!top) {\n return array;\n }\n\n while (--top) {\n current = Math.floor(Math.random() * (top + 1));\n tmp = array[current];\n array[current] = array[top];\n array[top] = tmp;\n }\n\n return array;\n}\n\nlet defaults = {\n // Use array.reverse() to reverse the results\n reverse: false,\n\n // Sorting function\n by: null,\n\n // If true, this will skip the sorting and return a randomized order in the array\n randomize: false,\n\n // Determines which property of each item in the array is passed to the\n // sorting method.\n key: 'element',\n};\n\n// You can return `undefined` from the `by` function to revert to DOM order.\nexport default function sorter(arr, options) {\n let opts = xtend(defaults, options);\n let original = [].slice.call(arr);\n let revert = false;\n\n if (!arr.length) {\n return [];\n }\n\n if (opts.randomize) {\n return randomize(arr);\n }\n\n // Sort the elements by the opts.by function.\n // If we don't have opts.by, default to DOM order\n if (typeof opts.by === 'function') {\n arr.sort(function (a, b) {\n\n // Exit early if we already know we want to revert\n if (revert) {\n return 0;\n }\n\n let valA = opts.by(a[opts.key]);\n let valB = opts.by(b[opts.key]);\n\n // If both values are undefined, use the DOM order\n if (valA === undefined && valB === undefined) {\n revert = true;\n return 0;\n }\n\n if (valA < valB || valA === 'sortFirst' || valB === 'sortLast') {\n return -1;\n }\n\n if (valA > valB || valA === 'sortLast' || valB === 'sortFirst') {\n return 1;\n }\n\n return 0;\n });\n }\n\n // Revert to the original array if necessary\n if (revert) {\n return original;\n }\n\n if (opts.reverse) {\n arr.reverse();\n }\n\n return arr;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/sorter.js\n **/","'use strict';\n\nlet transitions = {};\nlet eventName = 'transitionend';\nlet count = 0;\n\nfunction uniqueId() {\n return eventName + count++;\n}\n\nexport function onTransitionEnd(element, callback) {\n let id = uniqueId();\n let listener = (evt) => {\n if (evt.currentTarget === evt.target) {\n cancelTransitionEnd(id);\n callback(evt);\n }\n };\n\n element.addEventListener(eventName, listener);\n\n transitions[id] = { element, listener };\n\n return id;\n}\n\nexport function cancelTransitionEnd(id) {\n if (transitions[id]) {\n transitions[id].element.removeEventListener(eventName, transitions[id].listener);\n transitions[id] = null;\n return true;\n }\n\n return false;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/on-transition-end.js\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 5f930eb2b87316570fdf","webpack:///./src/shuffle.js","webpack:///./~/custom-event-polyfill/custom-event-polyfill.js","webpack:///./~/matches-selector/index.js","webpack:///./~/array-uniq/index.js","webpack:///./~/xtend/immutable.js","webpack:///./~/throttleit/index.js","webpack:///./src/point.js","webpack:///./src/get-number.js","webpack:///./src/shuffle-item.js","webpack:///./src/classes.js","webpack:///./src/get-number-style.js","webpack:///./src/computed-size.js","webpack:///./src/sorter.js","webpack:///./src/on-transition-end.js","webpack:///./src/layout.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA;;;;AAEA;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;;;AAEA,UAAS,OAAT,CAAiB,SAAjB,EAA4B;AAC1B,UAAO,MAAM,SAAN,CAAgB,KAAhB,CAAsB,IAAtB,CAA2B,SAA3B,CAAP,CAD0B;EAA5B;;AAIA,UAAS,QAAT,CAAkB,KAAlB,EAAyB;AACvB,UAAO,KAAK,GAAL,CAAS,KAAT,CAAe,IAAf,EAAqB,KAArB,CAAP,CADuB;EAAzB;;AAIA,UAAS,aAAT,CAAuB,KAAvB,EAA8B,GAA9B,EAAmC;AACjC,OAAI,UAAU,MAAV,KAAqB,CAArB,EAAwB;AAC1B,YAAO,cAAc,KAAd,EAAqB,GAArB,CAAP,CAD0B;IAA5B;;AAIA,UAAO,UAAU,GAAV,EAAe;AACpB,YAAO,MAAM,OAAN,CAAc,GAAd,IAAqB,CAAC,CAAD,CADR;IAAf,CAL0B;EAAnC;;;AAWA,KAAI,KAAK,CAAL;;KAEE;;;;;;;;;;AAS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AO,CAAP,CARyC","file":"shuffle.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"shuffle\"] = factory();\n\telse\n\t\troot[\"shuffle\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 5f930eb2b87316570fdf\n **/","'use strict';\n\nimport 'custom-event-polyfill';\nimport matches from 'matches-selector';\nimport arrayUnique from 'array-uniq';\nimport xtend from 'xtend';\nimport throttle from 'throttleit';\nimport Point from './point';\nimport ShuffleItem from './shuffle-item';\nimport Classes from './classes';\nimport getNumberStyle from './get-number-style';\nimport sorter from './sorter';\nimport { onTransitionEnd, cancelTransitionEnd } from './on-transition-end';\nimport { getItemPosition } from './layout';\n\nfunction toArray(arrayLike) {\n return Array.prototype.slice.call(arrayLike);\n}\n\nfunction arrayMax(array) {\n return Math.max.apply(Math, array);\n}\n\nfunction arrayIncludes(array, obj) {\n if (arguments.length === 2) {\n return arrayIncludes(array)(obj);\n }\n\n return function (obj) {\n return array.indexOf(obj) > -1;\n };\n}\n\n// Used for unique instance variables\nlet id = 0;\n\nclass Shuffle {\n\n /**\n * Categorize, sort, and filter a responsive grid of items.\n *\n * @param {Element} element An element which is the parent container for the grid items.\n * @param {Object} [options=Shuffle.options] Options object.\n * @constructor\n */\n constructor(element, options = {}) {\n this.options = xtend(Shuffle.options, options);\n\n this.useSizer = false;\n this.lastSort = {};\n this.lastFilter = Shuffle.ALL_ITEMS;\n this.isEnabled = true;\n this.isDestroyed = false;\n this.isInitialized = false;\n this._transitions = [];\n this.isTransitioning = false;\n this._queue = [];\n\n element = this._getElementOption(element);\n\n if (!element) {\n throw new TypeError('Shuffle needs to be initialized with an element.');\n }\n\n this.element = element;\n this.id = 'shuffle_' + id++;\n\n this._init();\n this.isInitialized = true;\n }\n\n _init() {\n this.items = this._getItems();\n\n this.options.sizer = this._getElementOption(this.options.sizer);\n\n if (this.options.sizer) {\n this.useSizer = true;\n }\n\n // Add class and invalidate styles\n this.element.classList.add(Shuffle.Classes.BASE);\n\n // Set initial css for each item\n this._initItems();\n\n // Bind resize events\n this._onResize = this._getResizeFunction();\n window.addEventListener('resize', this._onResize);\n\n // Get container css all in one request. Causes reflow\n var containerCss = window.getComputedStyle(this.element, null);\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // Add styles to the container if it doesn't have them.\n this._validateStyles(containerCss);\n\n // We already got the container's width above, no need to cause another\n // reflow getting it again... Calculate the number of columns there will be\n this._setColumns(containerWidth);\n\n // Kick off!\n this.filter(this.options.group, this.options.initialSort);\n\n // The shuffle items haven't had transitions set on them yet so the user\n // doesn't see the first layout. Set them now that the first layout is done.\n // First, however, a synchronous layout must be caused for the previous\n // styles to be applied without transitions.\n this.element.offsetWidth; // jshint ignore: line\n this._setTransitions();\n this.element.style.transition = 'height ' + this.options.speed + 'ms ' + this.options.easing;\n }\n\n /**\n * Returns a throttled and proxied function for the resize handler.\n * @return {Function}\n * @private\n */\n _getResizeFunction() {\n var resizeFunction = this._handleResize.bind(this);\n return this.options.throttle ?\n this.options.throttle(resizeFunction, this.options.throttleTime) :\n resizeFunction;\n }\n\n /**\n * Retrieve an element from an option.\n * @param {string|jQuery|Element} option The option to check.\n * @return {?Element} The plain element or null.\n * @private\n */\n _getElementOption(option) {\n // If column width is a string, treat is as a selector and search for the\n // sizer element within the outermost container\n if (typeof option === 'string') {\n return this.element.querySelector(option);\n\n // Check for an element\n } else if (option && option.nodeType && option.nodeType === 1) {\n return option;\n\n // Check for jQuery object\n } else if (option && option.jquery) {\n return option[0];\n }\n\n return null;\n }\n\n /**\n * Ensures the shuffle container has the css styles it needs applied to it.\n * @param {Object} styles Key value pairs for position and overflow.\n * @private\n */\n _validateStyles(styles) {\n // Position cannot be static.\n if (styles.position === 'static') {\n this.element.style.position = 'relative';\n }\n\n // Overflow has to be hidden.\n if (styles.overflow !== 'hidden') {\n this.element.style.overflow = 'hidden';\n }\n }\n\n /**\n * Filter the elements by a category.\n * @param {string} [category] Category to filter by. If it's given, the last\n * category will be used to filter the items.\n * @param {Array} [collection] Optionally filter a collection. Defaults to\n * all the items.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _filter(category = this.lastFilter, collection = this.items) {\n var set = this._getFilteredSets(category, collection);\n\n // Individually add/remove hidden/visible classes\n this._toggleFilterClasses(set);\n\n // Save the last filter in case elements are appended.\n this.lastFilter = category;\n\n // This is saved mainly because providing a filter function (like searching)\n // will overwrite the `lastFilter` property every time its called.\n if (typeof category === 'string') {\n this.options.group = category;\n }\n\n return set;\n }\n\n /**\n * Returns an object containing the visible and hidden elements.\n * @param {string|Function} category Category or function to filter by.\n * @param {Array.} items A collection of items to filter.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _getFilteredSets(category, items) {\n let visible = [];\n let hidden = [];\n\n // category === 'all', add visible class to everything\n if (category === Shuffle.ALL_ITEMS) {\n visible = items;\n\n // Loop through each item and use provided function to determine\n // whether to hide it or not.\n } else {\n items.forEach((item) => {\n if (this._doesPassFilter(category, item.element)) {\n visible.push(item);\n } else {\n hidden.push(item);\n }\n });\n }\n\n return {\n visible,\n hidden,\n };\n }\n\n /**\n * Test an item to see if it passes a category.\n * @param {string|Function} category Category or function to filter by.\n * @param {Element} element An element to test.\n * @return {boolean} Whether it passes the category/filter.\n * @private\n */\n _doesPassFilter(category, element) {\n\n if (typeof category === 'function') {\n return category.call(element, element, this);\n\n // Check each element's data-groups attribute against the given category.\n } else {\n let attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);\n let groups = JSON.parse(attr);\n let keys = this.delimeter && !Array.isArray(groups) ?\n groups.split(this.delimeter) :\n groups;\n\n if (Array.isArray(category)) {\n return category.some(arrayIncludes(keys));\n }\n\n return arrayIncludes(keys, category);\n }\n }\n\n /**\n * Toggles the visible and hidden class names.\n * @param {{visible, hidden}} Object with visible and hidden arrays.\n * @private\n */\n _toggleFilterClasses({ visible, hidden }) {\n visible.forEach((item) => {\n item.show();\n });\n\n hidden.forEach((item) => {\n item.hide();\n });\n }\n\n /**\n * Set the initial css for each item\n * @param {Array.} [items] Optionally specifiy at set to initialize.\n * @private\n */\n _initItems(items = this.items) {\n items.forEach((item) => {\n item.init();\n });\n }\n\n /**\n * Remove element reference and styles.\n * @private\n */\n _disposeItems(items = this.items) {\n items.forEach((item) => {\n item.dispose();\n });\n }\n\n /**\n * Updates the visible item count.\n * @private\n */\n _updateItemCount() {\n this.visibleItems = this._getFilteredItems().length;\n }\n\n /**\n * Sets css transform transition on a group of elements. This is not executed\n * at the same time as `item.init` so that transitions don't occur upon\n * initialization of Shuffle.\n * @param {Array.} items Shuffle items to set transitions on.\n * @private\n */\n _setTransitions(items = this.items) {\n let speed = this.options.speed;\n let easing = this.options.easing;\n\n var str;\n if (this.options.useTransforms) {\n str = 'transform ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n } else {\n str = 'top ' + speed + 'ms ' + easing +\n ', left ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n }\n\n items.forEach((item) => {\n item.element.style.transition = str;\n });\n }\n\n _getItems() {\n return toArray(this.element.children)\n .filter(el => matches(el, this.options.itemSelector))\n .map(el => new ShuffleItem(el));\n }\n\n /**\n * When new elements are added to the shuffle container, update the array of\n * items because that is the order `_layout` calls them.\n */\n _updateItemsOrder() {\n let children = this.element.children;\n this.items = sorter(this.items, {\n by(element) {\n return Array.prototype.indexOf.call(children, element);\n },\n });\n }\n\n _getFilteredItems() {\n return this.items.filter(item => item.isVisible);\n }\n\n _getConcealedItems() {\n return this.items.filter(item => !item.isVisible);\n }\n\n /**\n * Returns the column size, based on column width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @param {number} gutterSize Size of the gutters.\n * @return {number}\n * @private\n */\n _getColumnSize(containerWidth, gutterSize) {\n var size;\n\n // If the columnWidth property is a function, then the grid is fluid\n if (typeof this.options.columnWidth === 'function') {\n size = this.options.columnWidth(containerWidth);\n\n // columnWidth option isn't a function, are they using a sizing element?\n } else if (this.useSizer) {\n size = Shuffle.getSize(this.options.sizer).width;\n\n // if not, how about the explicitly set option?\n } else if (this.options.columnWidth) {\n size = this.options.columnWidth;\n\n // or use the size of the first item\n } else if (this.items.length > 0) {\n size = Shuffle.getSize(this.items[0].element, true).width;\n\n // if there's no items, use size of container\n } else {\n size = containerWidth;\n }\n\n // Don't let them set a column width of zero.\n if (size === 0) {\n size = containerWidth;\n }\n\n return size + gutterSize;\n }\n\n /**\n * Returns the gutter size, based on gutter width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @return {number}\n * @private\n */\n _getGutterSize(containerWidth) {\n var size;\n if (typeof this.options.gutterWidth === 'function') {\n size = this.options.gutterWidth(containerWidth);\n } else if (this.useSizer) {\n size = getNumberStyle(this.options.sizer, 'marginLeft');\n } else {\n size = this.options.gutterWidth;\n }\n\n return size;\n }\n\n /**\n * Calculate the number of columns to be used. Gets css if using sizer element.\n * @param {number} [containerWidth] Optionally specify a container width if\n * it's already available.\n */\n _setColumns(containerWidth = Shuffle.getSize(this.element).width) {\n var gutter = this._getGutterSize(containerWidth);\n var columnWidth = this._getColumnSize(containerWidth, gutter);\n var calculatedColumns = (containerWidth + gutter) / columnWidth;\n\n // Widths given from getStyles are not precise enough...\n if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) <\n this.options.columnThreshold) {\n // e.g. calculatedColumns = 11.998876\n calculatedColumns = Math.round(calculatedColumns);\n }\n\n this.cols = Math.max(Math.floor(calculatedColumns), 1);\n this.containerWidth = containerWidth;\n this.colWidth = columnWidth;\n }\n\n /**\n * Adjust the height of the grid\n */\n _setContainerSize() {\n this.element.style.height = this._getContainerSize() + 'px';\n }\n\n /**\n * Based on the column heights, it returns the biggest one.\n * @return {number}\n * @private\n */\n _getContainerSize() {\n return arrayMax(this.positions);\n }\n\n /**\n * Get the clamped stagger amount.\n * @param {number} index Index of the item to be staggered.\n * @return {number}\n */\n _getStaggerAmount(index) {\n return Math.min(index * this.options.staggerAmount, this.options.staggerAmountMax);\n }\n\n /**\n * @return {boolean} Whether the event was prevented or not.\n */\n _dispatch(name, details = {}) {\n if (this.isDestroyed) {\n return;\n }\n\n details.shuffle = this;\n return !this.element.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: false,\n detail: details,\n }));\n }\n\n /**\n * Zeros out the y columns array, which is used to determine item placement.\n * @private\n */\n _resetCols() {\n var i = this.cols;\n this.positions = [];\n while (i--) {\n this.positions.push(0);\n }\n }\n\n /**\n * Loops through each item that should be shown and calculates the x, y position.\n * @param {Array.} items Array of items that will be shown/layed\n * out in order in their array.\n */\n _layout(items) {\n let count = 0;\n items.forEach((item) => {\n var currPos = item.point;\n var currScale = item.scale;\n var itemSize = Shuffle.getSize(item.element, true);\n var pos = this._getItemPosition(itemSize);\n\n function callback() {\n item.applyCss(ShuffleItem.Css.VISIBLE.after);\n }\n\n // If the item will not change its position, do not add it to the render\n // queue. Transitions don't fire when setting a property to the same value.\n if (Point.equals(currPos, pos) && currScale === ShuffleItem.Scale.VISIBLE) {\n callback();\n return;\n }\n\n item.point = pos;\n item.scale = ShuffleItem.Scale.VISIBLE;\n\n let styles = ShuffleItem.Css.VISIBLE.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Determine the location of the next item, based on its size.\n * @param {{width: number, height: number}} itemSize Object with width and height.\n * @return {Point}\n * @private\n */\n _getItemPosition(itemSize) {\n return getItemPosition({\n itemSize,\n positions: this.positions,\n gridSize: this.colWidth,\n total: this.cols,\n threshold: this.options.columnThreshold,\n buffer: this.options.buffer,\n });\n }\n\n /**\n * Hides the elements that don't match our filter.\n * @param {Array.} collection Collection to shrink.\n * @private\n */\n _shrink(collection = this._getConcealedItems()) {\n let count = 0;\n collection.forEach((item) => {\n function callback() {\n item.applyCss(ShuffleItem.Css.HIDDEN.after);\n }\n\n // Continuing would add a transitionend event listener to the element, but\n // that listener would not execute because the transform and opacity would\n // stay the same.\n // The callback is executed here because it is not guaranteed to be called\n // after the transitionend event because the transitionend could be\n // canceled if another animation starts.\n if (item.scale === ShuffleItem.Scale.HIDDEN) {\n callback();\n return;\n }\n\n item.scale = ShuffleItem.Scale.HIDDEN;\n\n let styles = ShuffleItem.Css.HIDDEN.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Resize handler.\n * @private\n */\n _handleResize() {\n // If shuffle is disabled, destroyed, don't do anything\n if (!this.isEnabled || this.isDestroyed) {\n return;\n }\n\n // Will need to check height in the future if it's layed out horizontaly\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // containerWidth hasn't changed, don't do anything\n if (containerWidth === this.containerWidth) {\n return;\n }\n\n this.update();\n }\n\n /**\n * Returns styles which will be applied to the an item for a transition.\n * @param {Object} obj Transition options.\n * @return {!Object} Transforms for transitions, left/top for animate.\n * @private\n */\n _getStylesForTransition({ item, styles }) {\n if (!styles.transitionDelay) {\n styles.transitionDelay = '0ms';\n }\n\n let x = item.point.x;\n let y = item.point.y;\n\n if (this.options.useTransforms) {\n styles.transform = `translate(${x}px, ${y}px) scale(${item.scale})`;\n } else {\n styles.left = x + 'px';\n styles.top = y + 'px';\n }\n\n return styles;\n }\n\n _whenTransitionDone(element, itemCallback) {\n // TODO what happens when the transition is canceled and the promise never resolves?\n return new Promise((resolve) => {\n let id = onTransitionEnd(element, (evt) => {\n evt.currentTarget.style.transitionDelay = '';\n itemCallback();\n resolve();\n });\n this._transitions.push(id);\n });\n }\n\n _transition(opts) {\n opts.item.applyCss(this._getStylesForTransition(opts));\n return this._whenTransitionDone(opts.item.element, opts.callback);\n }\n\n /**\n * Execute the styles gathered in the style queue. This applies styles to elements,\n * triggering transitions.\n * @private\n */\n _processQueue() {\n if (this.isTransitioning) {\n this._cancelMovement();\n }\n\n // Iterate over the queue and keep track of ones that use transitions.\n let immediates = [];\n let transitions = [];\n this._queue.forEach((obj) => {\n if (!this.isInitialized || this.options.speed === 0) {\n immediates.push(obj);\n } else {\n transitions.push(obj);\n }\n });\n\n this._styleImmediately(immediates);\n\n if (transitions.length > 0 && this.options.speed > 0) {\n this._startTransitions(transitions);\n\n // A call to layout happened, but none of the newly visible items will\n // change position. Asynchronously fire the callback here.\n } else {\n setTimeout(this._dispatchLayout.bind(this), 0);\n }\n\n // Remove everything in the style queue\n this._queue.length = 0;\n }\n\n /**\n * Create a promise for each transition and wait for all of them to complete,\n * then emit the layout event.\n * @param {Array.} transitions Array of transition objects.\n */\n _startTransitions(transitions) {\n // Set flag that shuffle is currently in motion.\n this.isTransitioning = true;\n\n let promises = transitions.map(obj => this._transition(obj));\n Promise.all(promises).then(this._movementFinished.bind(this));\n }\n\n _cancelMovement() {\n // Remove the transition end event for each listener.\n this._transitions.forEach(cancelTransitionEnd);\n\n // Reset the array.\n this._transitions.length = 0;\n\n // Show it's no longer active.\n this.isTransitioning = false;\n }\n\n /**\n * Apply styles without a transition.\n * @param {Array.} objects Array of transition objects.\n * @private\n */\n _styleImmediately(objects) {\n if (objects.length) {\n let elements = objects.map(obj => obj.item.element);\n\n Shuffle._skipTransitions(elements, () => {\n objects.forEach((obj) => {\n obj.item.applyCss(this._getStylesForTransition(obj));\n obj.callback();\n });\n });\n }\n }\n\n _movementFinished() {\n this._transitions.length = 0;\n this.isTransitioning = false;\n this._dispatchLayout();\n }\n\n _dispatchLayout() {\n this._dispatch(Shuffle.EventType.LAYOUT);\n }\n\n /**\n * The magic. This is what makes the plugin 'shuffle'\n * @param {string|Function|Array.} [category] Category to filter by.\n * Can be a function, string, or array of strings.\n * @param {Object} [sortObj] A sort object which can sort the visible set\n */\n filter(category, sortObj) {\n if (!this.isEnabled) {\n return;\n }\n\n if (!category || (category && category.length === 0)) {\n category = Shuffle.ALL_ITEMS;\n }\n\n this._filter(category);\n\n // Shrink each hidden item\n this._shrink();\n\n // How many visible elements?\n this._updateItemCount();\n\n // Update transforms on visible elements so they will animate to their new positions.\n this.sort(sortObj);\n }\n\n /**\n * Gets the visible elements, sorts them, and passes them to layout.\n * @param {Object} opts the options object for the sorted plugin\n */\n sort(opts = this.lastSort) {\n if (!this.isEnabled) {\n return;\n }\n\n this._resetCols();\n\n var items = this._getFilteredItems();\n items = sorter(items, opts);\n\n this._layout(items);\n\n // `_layout` always happens after `_shrink`, so it's safe to process the style\n // queue here with styles from the shrink method.\n this._processQueue();\n\n // Adjust the height of the container.\n this._setContainerSize();\n\n this.lastSort = opts;\n }\n\n /**\n * Reposition everything.\n * @param {boolean} isOnlyLayout If true, column and gutter widths won't be\n * recalculated.\n */\n update(isOnlyLayout) {\n if (this.isEnabled) {\n\n if (!isOnlyLayout) {\n // Get updated colCount\n this._setColumns();\n }\n\n // Layout items\n this.sort();\n }\n }\n\n /**\n * Use this instead of `update()` if you don't need the columns and gutters updated\n * Maybe an image inside `shuffle` loaded (and now has a height), which means calculations\n * could be off.\n */\n layout() {\n this.update(true);\n }\n\n /**\n * New items have been appended to shuffle. Mix them in with the current\n * filter or sort status.\n * @param {Array.} newItems Collection of new items.\n */\n add(newItems) {\n newItems = arrayUnique(newItems).map(el => new ShuffleItem(el));\n\n // Add classes and set initial positions.\n this._initItems(newItems);\n\n // Add transition to each item.\n this._setTransitions(newItems);\n\n // Update the list of items.\n this.items = this.items.concat(newItems);\n this._updateItemsOrder();\n this.filter(this.lastFilter);\n }\n\n /**\n * Disables shuffle from updating dimensions and layout on resize\n */\n disable() {\n this.isEnabled = false;\n }\n\n /**\n * Enables shuffle again\n * @param {boolean} [isUpdateLayout=true] if undefined, shuffle will update columns and gutters\n */\n enable(isUpdateLayout) {\n this.isEnabled = true;\n if (isUpdateLayout !== false) {\n this.update();\n }\n }\n\n /**\n * Remove 1 or more shuffle items\n * @param {Array.} collection An array containing one or more\n * elements in shuffle\n * @return {Shuffle} The shuffle object\n */\n remove(collection) {\n if (!collection.length) {\n return;\n }\n\n collection = arrayUnique(collection);\n\n let oldItems = collection\n .map(element => this.getItemByElement(element))\n .filter(item => !!item);\n\n let handleLayout = () => {\n this.element.removeEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n this._disposeItems(oldItems);\n\n // Remove the collection in the callback\n collection.forEach((element) => {\n element.parentNode.removeChild(element);\n });\n\n this._dispatch(Shuffle.EventType.REMOVED, { collection });\n\n // Let it get garbage collected\n collection = null;\n oldItems = null;\n };\n\n // Hide collection first.\n this._toggleFilterClasses({\n visible: [],\n hidden: oldItems,\n });\n\n this._shrink(oldItems);\n\n this.sort();\n\n // Update the list of items here because `remove` could be called again\n // with an item that is in the process of being removed.\n this.items = this.items.filter(item => !arrayIncludes(oldItems, item));\n this._updateItemCount();\n\n this.element.addEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n }\n\n /**\n * Retrieve a shuffle item by its element.\n * @param {Element} element Element to look for.\n * @return {?ShuffleItem} A shuffle item or null if it's not found.\n */\n getItemByElement(element) {\n for (var i = this.items.length - 1; i >= 0; i--) {\n if (this.items[i].element === element) {\n return this.items[i];\n }\n }\n\n return null;\n }\n\n /**\n * Destroys shuffle, removes events, styles, and classes\n */\n destroy() {\n this._cancelMovement();\n window.removeEventListener('resize', this._onResize);\n\n // Reset container styles\n this.element.classList.remove('shuffle');\n this.element.removeAttribute('style');\n\n // Reset individual item styles\n this._disposeItems();\n\n // Null DOM references\n this.items = null;\n this.options.sizer = null;\n this.element = null;\n this._transitions = null;\n\n // Set a flag so if a debounced resize has been triggered,\n // it can first check if it is actually isDestroyed and not doing anything\n this.isDestroyed = true;\n }\n\n /**\n * Returns the outer width of an element, optionally including its margins.\n *\n * There are a few different methods for getting the width of an element, none of\n * which work perfectly for all Shuffle's use cases.\n *\n * 1. getBoundingClientRect() `left` and `right` properties.\n * - Accounts for transform scaled elements, making it useless for Shuffle\n * elements which have shrunk.\n * 2. The `offsetWidth` property.\n * - This value stays the same regardless of the elements transform property,\n * however, it does not return subpixel values.\n * 3. getComputedStyle()\n * - This works great Chrome, Firefox, Safari, but IE<=11 does not include\n * padding and border when box-sizing: border-box is set, requiring a feature\n * test and extra work to add the padding back for IE and other browsers which\n * follow the W3C spec here.\n *\n * @param {Element} element The element.\n * @param {boolean} [includeMargins] Whether to include margins. Default is false.\n * @return {{width: number, height: number}} The width and height.\n */\n static getSize(element, includeMargins) {\n // Store the styles so that they can be used by others without asking for it again.\n var styles = window.getComputedStyle(element, null);\n var width = getNumberStyle(element, 'width', styles);\n var height = getNumberStyle(element, 'height', styles);\n\n if (includeMargins) {\n var marginLeft = getNumberStyle(element, 'marginLeft', styles);\n var marginRight = getNumberStyle(element, 'marginRight', styles);\n var marginTop = getNumberStyle(element, 'marginTop', styles);\n var marginBottom = getNumberStyle(element, 'marginBottom', styles);\n width += marginLeft + marginRight;\n height += marginTop + marginBottom;\n }\n\n return {\n width,\n height,\n };\n }\n\n /**\n * Change a property or execute a function which will not have a transition\n * @param {Array.} elements DOM elements that won't be transitioned.\n * @param {Function} callback A function which will be called while transition\n * is set to 0ms.\n * @private\n */\n static _skipTransitions(elements, callback) {\n let zero = '0ms';\n\n // Save current duration and delay.\n let data = elements.map((element) => {\n let style = element.style;\n let duration = style.transitionDuration;\n let delay = style.transitionDelay;\n\n // Set the duration to zero so it happens immediately\n style.transitionDuration = zero;\n style.transitionDelay = zero;\n\n return {\n duration,\n delay,\n };\n });\n\n callback();\n\n // Cause reflow.\n elements[0].offsetWidth; // jshint ignore:line\n\n // Put the duration back\n elements.forEach((element, i) => {\n element.style.transitionDuration = data[i].duration;\n element.style.transitionDelay = data[i].delay;\n });\n }\n}\n\nShuffle.ALL_ITEMS = 'all';\nShuffle.FILTER_ATTRIBUTE_KEY = 'groups';\n\n/**\n * @enum {string}\n */\nShuffle.EventType = {\n LAYOUT: 'shuffle:layout',\n REMOVED: 'shuffle:removed',\n};\n\n/** @enum {string} */\nShuffle.Classes = Classes;\n\n// Overrideable options\nShuffle.options = {\n // Initial filter group.\n group: Shuffle.ALL_ITEMS,\n\n // Transition/animation speed (milliseconds).\n speed: 250,\n\n // CSS easing function to use.\n easing: 'ease',\n\n // e.g. '.picture-item'.\n itemSelector: '*',\n\n // Element or selector string. Use an element to determine the size of columns\n // and gutters.\n sizer: null,\n\n // A static number or function that tells the plugin how wide the gutters\n // between columns are (in pixels).\n gutterWidth: 0,\n\n // A static number or function that returns a number which tells the plugin\n // how wide the columns are (in pixels).\n columnWidth: 0,\n\n // If your group is not json, and is comma delimeted, you could set delimeter\n // to ','.\n delimeter: null,\n\n // Useful for percentage based heights when they might not always be exactly\n // the same (in pixels).\n buffer: 0,\n\n // Reading the width of elements isn't precise enough and can cause columns to\n // jump between values.\n columnThreshold: 0.01,\n\n // Shuffle can be isInitialized with a sort object. It is the same object\n // given to the sort method.\n initialSort: null,\n\n // By default, shuffle will throttle resize events. This can be changed or\n // removed.\n throttle: throttle,\n\n // How often shuffle can be called on resize (in milliseconds).\n throttleTime: 300,\n\n // Transition delay offset for each item in milliseconds.\n staggerAmount: 15,\n\n // Maximum stagger delay in milliseconds.\n staggerAmountMax: 250,\n\n // Whether to use transforms or absolute positioning.\n useTransforms: true,\n};\n\n// Expose for testing.\nShuffle.Point = Point;\nShuffle.ShuffleItem = ShuffleItem;\nShuffle.sorter = sorter;\n\nmodule.exports = Shuffle;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle.js\n **/","// Polyfill for creating CustomEvents on IE9/10/11\n\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\ntry {\n new window.CustomEvent(\"test\");\n} catch(e) {\n var CustomEvent = function(event, params) {\n var evt;\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n\n evt = document.createEvent(\"CustomEvent\");\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/custom-event-polyfill/custom-event-polyfill.js\n ** module id = 1\n ** module chunks = 0\n **/","'use strict';\n\nvar proto = Element.prototype;\nvar vendor = proto.matches\n || proto.matchesSelector\n || proto.webkitMatchesSelector\n || proto.mozMatchesSelector\n || proto.msMatchesSelector\n || proto.oMatchesSelector;\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n if (vendor) return vendor.call(el, selector);\n var nodes = el.parentNode.querySelectorAll(selector);\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i] == el) return true;\n }\n return false;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/matches-selector/index.js\n ** module id = 2\n ** module chunks = 0\n **/","'use strict';\n\n// there's 3 implementations written in increasing order of efficiency\n\n// 1 - no Set type is defined\nfunction uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}\n\n// 2 - a simple Set type is defined\nfunction uniqSet(arr) {\n\tvar seen = new Set();\n\treturn arr.filter(function (el) {\n\t\tif (!seen.has(el)) {\n\t\t\tseen.add(el);\n\t\t\treturn true;\n\t\t}\n\t});\n}\n\n// 3 - a standard Set type is defined and it has a forEach method\nfunction uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}\n\n// V8 currently has a broken implementation\n// https://github.com/joyent/node/issues/8449\nfunction doesForEachActuallyWork() {\n\tvar ret = false;\n\n\t(new Set([true])).forEach(function (el) {\n\t\tret = el;\n\t});\n\n\treturn ret === true;\n}\n\nif ('Set' in global) {\n\tif (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {\n\t\tmodule.exports = uniqSetWithForEach;\n\t} else {\n\t\tmodule.exports = uniqSet;\n\t}\n} else {\n\tmodule.exports = uniqNoSet;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/array-uniq/index.js\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/xtend/immutable.js\n ** module id = 4\n ** module chunks = 0\n **/","module.exports = throttle;\n\n/**\n * Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.\n *\n * @param {Function} func Function to wrap.\n * @param {Number} wait Number of milliseconds that must elapse between `func` invocations.\n * @return {Function} A new function that wraps the `func` function passed in.\n */\n\nfunction throttle (func, wait) {\n var ctx, args, rtn, timeoutID; // caching\n var last = 0;\n\n return function throttled () {\n ctx = this;\n args = arguments;\n var delta = new Date() - last;\n if (!timeoutID)\n if (delta >= wait) call();\n else timeoutID = setTimeout(call, wait - delta);\n return rtn;\n };\n\n function call () {\n timeoutID = 0;\n last = +new Date();\n rtn = func.apply(ctx, args);\n ctx = null;\n args = null;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/throttleit/index.js\n ** module id = 5\n ** module chunks = 0\n **/","'use strict';\n\nimport getNumber from './get-number';\n\n/**\n * Represents a coordinate pair.\n * @param {number} [x=0] X.\n * @param {number} [y=0] Y.\n */\nconst Point = function (x, y) {\n this.x = getNumber(x);\n this.y = getNumber(y);\n};\n\n/**\n * Whether two points are equal.\n * @param {Point} a Point A.\n * @param {Point} b Point B.\n * @return {boolean}\n */\nPoint.equals = function (a, b) {\n return a.x === b.x && a.y === b.y;\n};\n\nexport default Point;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/point.js\n **/","'use strict';\n\n/**\n * Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.\n * @param {*} value Possibly numeric value.\n * @return {number} `value` or zero if `value` isn't numeric.\n */\nexport default function getNumber(value) {\n return parseFloat(value) || 0;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number.js\n **/","import Point from './point';\nimport Classes from './classes';\n\nlet id = 0;\n\nclass ShuffleItem {\n constructor(element) {\n this.id = id++;\n this.element = element;\n this.isVisible = true;\n }\n\n show() {\n this.isVisible = true;\n this.element.classList.remove(Classes.HIDDEN);\n this.element.classList.add(Classes.VISIBLE);\n }\n\n hide() {\n this.isVisible = false;\n this.element.classList.remove(Classes.VISIBLE);\n this.element.classList.add(Classes.HIDDEN);\n }\n\n init() {\n this.addClasses([Classes.SHUFFLE_ITEM, Classes.VISIBLE]);\n this.applyCss(ShuffleItem.Css.INITIAL);\n this.scale = ShuffleItem.Scale.VISIBLE;\n this.point = new Point();\n }\n\n addClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.add(className);\n });\n }\n\n removeClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.remove(className);\n });\n }\n\n applyCss(obj) {\n for (var key in obj) {\n this.element.style[key] = obj[key];\n }\n }\n\n dispose() {\n this.removeClasses([\n Classes.HIDDEN,\n Classes.VISIBLE,\n Classes.SHUFFLE_ITEM,\n ]);\n\n this.element.removeAttribute('style');\n this.element = null;\n }\n}\n\nShuffleItem.Css = {\n INITIAL: {\n position: 'absolute',\n top: 0,\n left: 0,\n visibility: 'visible',\n 'will-change': 'transform',\n },\n VISIBLE: {\n before: {\n opacity: 1,\n visibility: 'visible',\n },\n after: {},\n },\n HIDDEN: {\n before: {\n opacity: 0,\n },\n after: {\n visibility: 'hidden',\n },\n },\n};\n\nShuffleItem.Scale = {\n VISIBLE: 1,\n HIDDEN: 0.001,\n};\n\nexport default ShuffleItem;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle-item.js\n **/","module.exports = {\n BASE: 'shuffle',\n SHUFFLE_ITEM: 'shuffle-item',\n VISIBLE: 'shuffle-item--visible',\n HIDDEN: 'shuffle-item--hidden',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/classes.js\n **/","'use strict';\n\nimport getNumber from './get-number';\nimport COMPUTED_SIZE_INCLUDES_PADDING from './computed-size';\n\n/**\n * Retrieve the computed style for an element, parsed as a float.\n * @param {Element} element Element to get style for.\n * @param {string} style Style property.\n * @param {CSSStyleDeclaration} [styles] Optionally include clean styles to\n * use instead of asking for them again.\n * @return {number} The parsed computed value or zero if that fails because IE\n * will return 'auto' when the element doesn't have margins instead of\n * the computed style.\n */\nexport default function getNumberStyle(element, style,\n styles = window.getComputedStyle(element, null)) {\n var value = getNumber(styles[style]);\n\n // Support IE<=11 and W3C spec.\n if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'width') {\n value += getNumber(styles.paddingLeft) +\n getNumber(styles.paddingRight) +\n getNumber(styles.borderLeftWidth) +\n getNumber(styles.borderRightWidth);\n } else if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'height') {\n value += getNumber(styles.paddingTop) +\n getNumber(styles.paddingBottom) +\n getNumber(styles.borderTopWidth) +\n getNumber(styles.borderBottomWidth);\n }\n\n return value;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number-style.js\n **/","\nlet element = document.body || document.documentElement;\nlet e = document.createElement('div');\ne.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';\nelement.appendChild(e);\n\nlet width = window.getComputedStyle(e, null).width;\nlet ret = width === '10px';\n\nelement.removeChild(e);\n\nexport default ret;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/computed-size.js\n **/","'use strict';\n\nimport xtend from 'xtend';\n\n// http://stackoverflow.com/a/962890/373422\nfunction randomize(array) {\n var tmp;\n var current;\n let top = array.length;\n\n if (!top) {\n return array;\n }\n\n while (--top) {\n current = Math.floor(Math.random() * (top + 1));\n tmp = array[current];\n array[current] = array[top];\n array[top] = tmp;\n }\n\n return array;\n}\n\nlet defaults = {\n // Use array.reverse() to reverse the results\n reverse: false,\n\n // Sorting function\n by: null,\n\n // If true, this will skip the sorting and return a randomized order in the array\n randomize: false,\n\n // Determines which property of each item in the array is passed to the\n // sorting method.\n key: 'element',\n};\n\n// You can return `undefined` from the `by` function to revert to DOM order.\nexport default function sorter(arr, options) {\n let opts = xtend(defaults, options);\n let original = [].slice.call(arr);\n let revert = false;\n\n if (!arr.length) {\n return [];\n }\n\n if (opts.randomize) {\n return randomize(arr);\n }\n\n // Sort the elements by the opts.by function.\n // If we don't have opts.by, default to DOM order\n if (typeof opts.by === 'function') {\n arr.sort(function (a, b) {\n\n // Exit early if we already know we want to revert\n if (revert) {\n return 0;\n }\n\n let valA = opts.by(a[opts.key]);\n let valB = opts.by(b[opts.key]);\n\n // If both values are undefined, use the DOM order\n if (valA === undefined && valB === undefined) {\n revert = true;\n return 0;\n }\n\n if (valA < valB || valA === 'sortFirst' || valB === 'sortLast') {\n return -1;\n }\n\n if (valA > valB || valA === 'sortLast' || valB === 'sortFirst') {\n return 1;\n }\n\n return 0;\n });\n }\n\n // Revert to the original array if necessary\n if (revert) {\n return original;\n }\n\n if (opts.reverse) {\n arr.reverse();\n }\n\n return arr;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/sorter.js\n **/","'use strict';\n\nlet transitions = {};\nlet eventName = 'transitionend';\nlet count = 0;\n\nfunction uniqueId() {\n return eventName + count++;\n}\n\nexport function onTransitionEnd(element, callback) {\n let id = uniqueId();\n let listener = (evt) => {\n if (evt.currentTarget === evt.target) {\n cancelTransitionEnd(id);\n callback(evt);\n }\n };\n\n element.addEventListener(eventName, listener);\n\n transitions[id] = { element, listener };\n\n return id;\n}\n\nexport function cancelTransitionEnd(id) {\n if (transitions[id]) {\n transitions[id].element.removeEventListener(eventName, transitions[id].listener);\n transitions[id] = null;\n return true;\n }\n\n return false;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/on-transition-end.js\n **/","'use strict';\n\nimport Point from './point';\n\nfunction arrayMax(array) {\n return Math.max.apply(Math, array);\n}\n\nfunction arrayMin(array) {\n return Math.min.apply(Math, array);\n}\n\n/**\n * Determine the location of the next item, based on its size.\n * @param {Object} itemSize Object with width and height.\n * @param {Array.} positions Positions of the other current items.\n * @param {number} gridSize The column width or row height.\n * @param {number} total The total number of columns or rows.\n * @param {number} threshold Buffer value for the column to fit.\n * @param {number} buffer Vertical buffer for the height of items.\n * @return {Point}\n */\nexport function getItemPosition({ itemSize, positions, gridSize, total, threshold, buffer }) {\n var span = getColumnSpan(itemSize.width, gridSize, total, threshold);\n var setY = getAvailablePositions(positions, span, total);\n var shortColumnIndex = getShortColumn(setY, buffer);\n\n // Position the item\n var point = new Point(\n Math.round(gridSize * shortColumnIndex),\n Math.round(setY[shortColumnIndex]));\n\n // Update the columns array with the new values for each column.\n // e.g. before the update the columns could be [250, 0, 0, 0] for an item\n // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0].\n var setHeight = setY[shortColumnIndex] + itemSize.height;\n for (var i = 0; i < span; i++) {\n positions[shortColumnIndex + i] = setHeight;\n }\n\n return point;\n}\n\n/**\n * Determine the number of columns an items spans.\n * @param {number} itemWidth Width of the item.\n * @param {number} columnWidth Width of the column (includes gutter).\n * @param {number} columns Total number of columns\n * @param {number} threshold A buffer value for the size of the column to fit.\n * @return {number}\n */\nfunction getColumnSpan(itemWidth, columnWidth, columns, threshold) {\n var columnSpan = itemWidth / columnWidth;\n\n // If the difference between the rounded column span number and the\n // calculated column span number is really small, round the number to\n // make it fit.\n if (Math.abs(Math.round(columnSpan) - columnSpan) < threshold) {\n // e.g. columnSpan = 4.0089945390298745\n columnSpan = Math.round(columnSpan);\n }\n\n // Ensure the column span is not more than the amount of columns in the whole layout.\n return Math.min(Math.ceil(columnSpan), columns);\n}\n\n/**\n * Retrieves the column set to use for placement.\n * @param {number} columnSpan The number of columns this current item spans.\n * @param {number} columns The total columns in the grid.\n * @return {Array.} An array of numbers represeting the column set.\n */\nfunction getAvailablePositions(positions, columnSpan, columns) {\n // The item spans only one column.\n if (columnSpan === 1) {\n return positions;\n }\n\n // The item spans more than one column, figure out how many different\n // places it could fit horizontally.\n // The group count is the number of places within the positions this block\n // could fit, ignoring the current positions of items.\n // Imagine a 2 column brick as the second item in a 4 column grid with\n // 10px height each. Find the places it would fit:\n // [20, 10, 10, 0]\n // | | |\n // * * *\n //\n // Then take the places which fit and get the bigger of the two:\n // max([20, 10]), max([10, 10]), max([10, 0]) = [20, 10, 0]\n //\n // Next, find the first smallest number (the short column).\n // [20, 10, 0]\n // |\n // *\n //\n // And that's where it should be placed!\n //\n // Another example where the second column's item extends past the first:\n // [10, 20, 10, 0] => [20, 20, 10] => 10\n var available = [];\n\n // For how many possible positions for this item there are.\n for (var i = 0; i <= columns - columnSpan; i++) {\n // Find the bigger value for each place it could fit.\n available.push(arrayMax(positions.slice(i, i + columnSpan)));\n }\n\n return available;\n}\n\n/**\n * Find index of short column, the first from the left where this item will go.\n *\n * @param {Array.} positions The array to search for the smallest number.\n * @param {number} buffer Optional buffer which is very useful when the height\n * is a percentage of the width.\n * @return {number} Index of the short column.\n */\nfunction getShortColumn(positions, buffer) {\n var minPosition = arrayMin(positions);\n for (var i = 0, len = positions.length; i < len; i++) {\n if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) {\n return i;\n }\n }\n\n return 0;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layout.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/shuffle.min.js b/dist/shuffle.min.js index 9837f3c..3248be8 100644 --- a/dist/shuffle.min.js +++ b/dist/shuffle.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.shuffle=e():t.shuffle=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return t[n].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t){return Array.prototype.slice.call(t)}function r(t){return Math.max.apply(Math,t)}function a(t){return Math.min.apply(Math,t)}function u(t,e){return 2===arguments.length?u(t)(e):function(e){return t.indexOf(e)>-1}}var l=function(){function t(t,e){for(var i=0;i0?t.getSize(this.items[0].element,!0).width:e,0===n&&(n=e),n+i}},{key:"_getGutterSize",value:function(t){var e;return e="function"==typeof this.options.gutterWidth?this.options.gutterWidth(t):this.useSizer?(0,T["default"])(this.options.sizer,"marginLeft"):this.options.gutterWidth}},{key:"_setColumns",value:function(){var e=arguments.length<=0||void 0===arguments[0]?t.getSize(this.element).width:arguments[0],i=this._getGutterSize(e),n=this._getColumnSize(e,i),s=(e+i)/n;Math.abs(Math.round(s)-s)a;a++)this.positions[n+a]=o;return s}},{key:"_getColumnSpan",value:function(t,e,i){var n=t/e;return Math.abs(Math.round(n)-n)s;s++)n[s]=r(this.positions.slice(s,s+t));return n}},{key:"_getShortColumn",value:function(t,e){for(var i=a(t),n=0,s=t.length;s>n;n++)if(t[n]>=i-e&&t[n]<=i+e)return n;return 0}},{key:"_shrink",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?this._getConcealedItems():arguments[0],i=0;e.forEach(function(e){function n(){e.applyCss(b["default"].Css.HIDDEN.after)}if(e.scale===b["default"].Scale.HIDDEN)return void n();e.scale=b["default"].Scale.HIDDEN;var s=b["default"].Css.HIDDEN.before;s.transitionDelay=t._getStaggerAmount(i),t._queue.push({item:e,styles:s,callback:n}),i++})}},{key:"_handleResize",value:function(){if(this.isEnabled&&!this.isDestroyed){var e=t.getSize(this.element).width;e!==this.containerWidth&&this.update()}}},{key:"_getStylesForTransition",value:function(t){var e=t.item,i=t.styles;i.transitionDelay||(i.transitionDelay="0ms");var n=e.point.x,s=e.point.y;return this.options.useTransforms?i.transform="translate("+n+"px, "+s+"px) scale("+e.scale+")":(i.left=n+"px",i.top=s+"px"),i}},{key:"_whenTransitionDone",value:function(t,e){var i=this;return new Promise(function(n){var s=(0,L.onTransitionEnd)(t,function(t){t.currentTarget.style.transitionDelay="",e(),n()});i._transitions.push(s)})}},{key:"_transition",value:function(t){return t.item.applyCss(this._getStylesForTransition(t)),this._whenTransitionDone(t.item.element,t.callback)}},{key:"_processQueue",value:function(){var t=this;this.isTransitioning&&this._cancelMovement();var e=[],i=[];this._queue.forEach(function(n){t.isInitialized&&0!==t.options.speed?i.push(n):e.push(n)}),this._styleImmediately(e),i.length>0&&this.options.speed>0?this._startTransitions(i):setTimeout(this._dispatchLayout.bind(this),0),this._queue.length=0}},{key:"_startTransitions",value:function(t){var e=this;this.isTransitioning=!0;var i=t.map(function(t){return e._transition(t)});Promise.all(i).then(this._movementFinished.bind(this))}},{key:"_cancelMovement",value:function(){this._transitions.forEach(L.cancelTransitionEnd),this._transitions.length=0,this.isTransitioning=!1}},{key:"_styleImmediately",value:function(e){var i=this;if(e.length){var n=e.map(function(t){return t.item.element});t._skipTransitions(n,function(){e.forEach(function(t){t.item.applyCss(i._getStylesForTransition(t)),t.callback()})})}}},{key:"_movementFinished",value:function(){this._transitions.length=0,this.isTransitioning=!1,this._dispatchLayout()}},{key:"_dispatchLayout",value:function(){this._dispatch(t.EventType.LAYOUT)}},{key:"filter",value:function(e,i){this.isEnabled&&((!e||e&&0===e.length)&&(e=t.ALL_ITEMS),this._filter(e),this._shrink(),this._updateItemCount(),this.sort(i))}},{key:"sort",value:function(){var t=arguments.length<=0||void 0===arguments[0]?this.lastSort:arguments[0];if(this.isEnabled){this._resetCols();var e=this._getFilteredItems();e=(0,C["default"])(e,t),this._layout(e),this._processQueue(),this._setContainerSize(),this.lastSort=t}}},{key:"update",value:function(t){this.isEnabled&&(t||this._setColumns(),this.sort())}},{key:"layout",value:function(){this.update(!0)}},{key:"add",value:function(t){t=(0,d["default"])(t).map(function(t){return new b["default"](t)}),this._initItems(t),this._setTransitions(t),this.items=this.items.concat(t),this._updateItemsOrder(),this.filter(this.lastFilter)}},{key:"disable",value:function(){this.isEnabled=!1}},{key:"enable",value:function(t){this.isEnabled=!0,t!==!1&&this.update()}},{key:"remove",value:function(e){var i=this;if(e.length){e=(0,d["default"])(e);var n=e.map(function(t){return i.getItemByElement(t)}).filter(function(t){return!!t}),s=function o(){i.element.removeEventListener(t.EventType.LAYOUT,o),i._disposeItems(n),e.forEach(function(t){t.parentNode.removeChild(t)}),i._dispatch(t.EventType.REMOVED,{collection:e}),e=null,n=null};this._toggleFilterClasses({visible:[],hidden:n}),this._shrink(n),this.sort(),this.items=this.items.filter(function(t){return!u(n,t)}),this._updateItemCount(),this.element.addEventListener(t.EventType.LAYOUT,s)}}},{key:"getItemByElement",value:function(t){for(var e=this.items.length-1;e>=0;e--)if(this.items[e].element===t)return this.items[e];return null}},{key:"destroy",value:function(){this._cancelMovement(),window.removeEventListener("resize",this._onResize),this.element.classList.remove("shuffle"),this.element.removeAttribute("style"),this._disposeItems(),this.items=null,this.options.sizer=null,this.element=null,this._transitions=null,this.isDestroyed=!0}}],[{key:"getSize",value:function(t,e){var i=window.getComputedStyle(t,null),n=(0,T["default"])(t,"width",i),s=(0,T["default"])(t,"height",i);if(e){var o=(0,T["default"])(t,"marginLeft",i),r=(0,T["default"])(t,"marginRight",i),a=(0,T["default"])(t,"marginTop",i),u=(0,T["default"])(t,"marginBottom",i);n+=o+r,s+=a+u}return{width:n,height:s}}},{key:"_skipTransitions",value:function(t,e){var i="0ms",n=t.map(function(t){var e=t.style,n=e.transitionDuration,s=e.transitionDelay;return e.transitionDuration=i,e.transitionDelay=i,{duration:n,delay:s}});e(),t[0].offsetWidth,t.forEach(function(t,e){t.style.transitionDuration=n[e].duration,t.style.transitionDelay=n[e].delay})}}]),t}();z.ALL_ITEMS="all",z.FILTER_ATTRIBUTE_KEY="groups",z.EventType={LAYOUT:"shuffle:layout",REMOVED:"shuffle:removed"},z.Classes=I["default"],z.options={group:z.ALL_ITEMS,speed:250,easing:"ease",itemSelector:"*",sizer:null,gutterWidth:0,columnWidth:0,delimeter:null,buffer:0,columnThreshold:.01,initialSort:null,throttle:y["default"],throttleTime:300,staggerAmount:15,staggerAmountMax:250,useTransforms:!0},z.Point=g["default"],z.ShuffleItem=b["default"],z.sorter=C["default"],t.exports=z},function(t,e){try{new window.CustomEvent("test")}catch(i){var n=function(t,e){var i;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},i=document.createEvent("CustomEvent"),i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};n.prototype=window.Event.prototype,window.CustomEvent=n}},function(t,e){"use strict";function i(t,e){if(s)return s.call(t,e);for(var i=t.parentNode.querySelectorAll(e),n=0;n=e?i():r=setTimeout(i,e-t)),o}}t.exports=i},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var s=i(7),o=n(s),r=function(t,e){this.x=(0,o["default"])(t),this.y=(0,o["default"])(e)};r.equals=function(t,e){return t.x===e.x&&t.y===e.y},e["default"]=r},function(t,e){"use strict";function i(t){return parseFloat(t)||0}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;in||"sortFirst"===n||"sortLast"===s?-1:n>s||"sortLast"===n||"sortFirst"===s?1:0}),o?n:(i.reverse&&t.reverse(),t)):[]}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var r=i(4),a=n(r),u={reverse:!1,by:null,randomize:!1,key:"element"}},function(t,e){"use strict";function i(){return r+a++}function n(t,e){var n=i(),a=function(t){t.currentTarget===t.target&&(s(n),e(t))};return t.addEventListener(r,a),o[n]={element:t,listener:a},n}function s(t){return o[t]?(o[t].element.removeEventListener(r,o[t].listener),o[t]=null,!0):!1}Object.defineProperty(e,"__esModule",{value:!0}),e.onTransitionEnd=n,e.cancelTransitionEnd=s;var o={},r="transitionend",a=0}])}); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.shuffle=e():t.shuffle=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return t[n].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t){return Array.prototype.slice.call(t)}function r(t){return Math.max.apply(Math,t)}function u(t,e){return 2===arguments.length?u(t)(e):function(e){return t.indexOf(e)>-1}}var a=function(){function t(t,e){for(var i=0;i0?t.getSize(this.items[0].element,!0).width:e,0===n&&(n=e),n+i}},{key:"_getGutterSize",value:function(t){var e;return e="function"==typeof this.options.gutterWidth?this.options.gutterWidth(t):this.useSizer?(0,k["default"])(this.options.sizer,"marginLeft"):this.options.gutterWidth}},{key:"_setColumns",value:function(){var e=arguments.length<=0||void 0===arguments[0]?t.getSize(this.element).width:arguments[0],i=this._getGutterSize(e),n=this._getColumnSize(e,i),s=(e+i)/n;Math.abs(Math.round(s)-s)0&&this.options.speed>0?this._startTransitions(i):setTimeout(this._dispatchLayout.bind(this),0),this._queue.length=0}},{key:"_startTransitions",value:function(t){var e=this;this.isTransitioning=!0;var i=t.map(function(t){return e._transition(t)});Promise.all(i).then(this._movementFinished.bind(this))}},{key:"_cancelMovement",value:function(){this._transitions.forEach(L.cancelTransitionEnd),this._transitions.length=0,this.isTransitioning=!1}},{key:"_styleImmediately",value:function(e){var i=this;if(e.length){var n=e.map(function(t){return t.item.element});t._skipTransitions(n,function(){e.forEach(function(t){t.item.applyCss(i._getStylesForTransition(t)),t.callback()})})}}},{key:"_movementFinished",value:function(){this._transitions.length=0,this.isTransitioning=!1,this._dispatchLayout()}},{key:"_dispatchLayout",value:function(){this._dispatch(t.EventType.LAYOUT)}},{key:"filter",value:function(e,i){this.isEnabled&&((!e||e&&0===e.length)&&(e=t.ALL_ITEMS),this._filter(e),this._shrink(),this._updateItemCount(),this.sort(i))}},{key:"sort",value:function(){var t=arguments.length<=0||void 0===arguments[0]?this.lastSort:arguments[0];if(this.isEnabled){this._resetCols();var e=this._getFilteredItems();e=(0,w["default"])(e,t),this._layout(e),this._processQueue(),this._setContainerSize(),this.lastSort=t}}},{key:"update",value:function(t){this.isEnabled&&(t||this._setColumns(),this.sort())}},{key:"layout",value:function(){this.update(!0)}},{key:"add",value:function(t){t=(0,c["default"])(t).map(function(t){return new E["default"](t)}),this._initItems(t),this._setTransitions(t),this.items=this.items.concat(t),this._updateItemsOrder(),this.filter(this.lastFilter)}},{key:"disable",value:function(){this.isEnabled=!1}},{key:"enable",value:function(t){this.isEnabled=!0,t!==!1&&this.update()}},{key:"remove",value:function(e){var i=this;if(e.length){e=(0,c["default"])(e);var n=e.map(function(t){return i.getItemByElement(t)}).filter(function(t){return!!t}),s=function o(){i.element.removeEventListener(t.EventType.LAYOUT,o),i._disposeItems(n),e.forEach(function(t){t.parentNode.removeChild(t)}),i._dispatch(t.EventType.REMOVED,{collection:e}),e=null,n=null};this._toggleFilterClasses({visible:[],hidden:n}),this._shrink(n),this.sort(),this.items=this.items.filter(function(t){return!u(n,t)}),this._updateItemCount(),this.element.addEventListener(t.EventType.LAYOUT,s)}}},{key:"getItemByElement",value:function(t){for(var e=this.items.length-1;e>=0;e--)if(this.items[e].element===t)return this.items[e];return null}},{key:"destroy",value:function(){this._cancelMovement(),window.removeEventListener("resize",this._onResize),this.element.classList.remove("shuffle"),this.element.removeAttribute("style"),this._disposeItems(),this.items=null,this.options.sizer=null,this.element=null,this._transitions=null,this.isDestroyed=!0}}],[{key:"getSize",value:function(t,e){var i=window.getComputedStyle(t,null),n=(0,k["default"])(t,"width",i),s=(0,k["default"])(t,"height",i);if(e){var o=(0,k["default"])(t,"marginLeft",i),r=(0,k["default"])(t,"marginRight",i),u=(0,k["default"])(t,"marginTop",i),a=(0,k["default"])(t,"marginBottom",i);n+=o+r,s+=u+a}return{width:n,height:s}}},{key:"_skipTransitions",value:function(t,e){var i="0ms",n=t.map(function(t){var e=t.style,n=e.transitionDuration,s=e.transitionDelay;return e.transitionDuration=i,e.transitionDelay=i,{duration:n,delay:s}});e(),t[0].offsetWidth,t.forEach(function(t,e){t.style.transitionDuration=n[e].duration,t.style.transitionDelay=n[e].delay})}}]),t}();z.ALL_ITEMS="all",z.FILTER_ATTRIBUTE_KEY="groups",z.EventType={LAYOUT:"shuffle:layout",REMOVED:"shuffle:removed"},z.Classes=S["default"],z.options={group:z.ALL_ITEMS,speed:250,easing:"ease",itemSelector:"*",sizer:null,gutterWidth:0,columnWidth:0,delimeter:null,buffer:0,columnThreshold:.01,initialSort:null,throttle:v["default"],throttleTime:300,staggerAmount:15,staggerAmountMax:250,useTransforms:!0},z.Point=_["default"],z.ShuffleItem=E["default"],z.sorter=w["default"],t.exports=z},function(t,e){try{new window.CustomEvent("test")}catch(i){var n=function(t,e){var i;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},i=document.createEvent("CustomEvent"),i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};n.prototype=window.Event.prototype,window.CustomEvent=n}},function(t,e){"use strict";function i(t,e){if(s)return s.call(t,e);for(var i=t.parentNode.querySelectorAll(e),n=0;n=e?i():r=setTimeout(i,e-t)),o}}t.exports=i},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var s=i(7),o=n(s),r=function(t,e){this.x=(0,o["default"])(t),this.y=(0,o["default"])(e)};r.equals=function(t,e){return t.x===e.x&&t.y===e.y},e["default"]=r},function(t,e){"use strict";function i(t){return parseFloat(t)||0}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;in||"sortFirst"===n||"sortLast"===s?-1:n>s||"sortLast"===n||"sortFirst"===s?1:0}),o?n:(i.reverse&&t.reverse(),t)):[]}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o;var r=i(4),u=n(r),a={reverse:!1,by:null,randomize:!1,key:"element"}},function(t,e){"use strict";function i(){return r+u++}function n(t,e){var n=i(),u=function(t){t.currentTarget===t.target&&(s(n),e(t))};return t.addEventListener(r,u),o[n]={element:t,listener:u},n}function s(t){return o[t]?(o[t].element.removeEventListener(r,o[t].listener),o[t]=null,!0):!1}Object.defineProperty(e,"__esModule",{value:!0}),e.onTransitionEnd=n,e.cancelTransitionEnd=s;var o={},r="transitionend",u=0},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t){return Math.max.apply(Math,t)}function o(t){return Math.min.apply(Math,t)}function r(t){for(var e=t.itemSize,i=t.positions,n=t.gridSize,s=t.total,o=t.threshold,r=t.buffer,h=u(e.width,n,s,o),c=a(i,h,s),d=l(c,r),m=new f["default"](Math.round(n*d),Math.round(c[d])),p=c[d]+e.height,v=0;h>v;v++)i[d+v]=p;return m}function u(t,e,i,n){var s=t/e;return Math.abs(Math.round(s)-s)=o;o++)n.push(s(t.slice(o,o+e)));return n}function l(t,e){for(var i=o(t),n=0,s=t.length;s>n;n++)if(t[n]>=i-e&&t[n]<=i+e)return n;return 0}Object.defineProperty(e,"__esModule",{value:!0}),e.getItemPosition=r;var h=i(6),f=n(h)}])}); //# sourceMappingURL=shuffle.min.js.map \ No newline at end of file diff --git a/dist/shuffle.min.js.map b/dist/shuffle.min.js.map index 41fae4b..5fba411 100644 --- a/dist/shuffle.min.js.map +++ b/dist/shuffle.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///shuffle.min.js","webpack:///webpack/bootstrap 79383518e594c5572654","webpack:///./src/shuffle.js","webpack:///./~/custom-event-polyfill/custom-event-polyfill.js","webpack:///./~/matches-selector/index.js","webpack:///./~/array-uniq/index.js","webpack:///./~/xtend/immutable.js","webpack:///./~/throttleit/index.js","webpack:///./src/point.js","webpack:///./src/get-number.js","webpack:///./src/shuffle-item.js","webpack:///./src/classes.js","webpack:///./src/get-number-style.js","webpack:///./src/computed-size.js","webpack:///./src/sorter.js","webpack:///./src/on-transition-end.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","toArray","arrayLike","Array","prototype","slice","arrayMax","array","Math","max","apply","arrayMin","min","arrayIncludes","arguments","length","indexOf","_createClass","defineProperties","target","props","i","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","_matchesSelector","_matchesSelector2","_arrayUniq","_arrayUniq2","_xtend","_xtend2","_throttleit","_throttleit2","_point","_point2","_shuffleItem","_shuffleItem2","_classes","_classes2","_getNumberStyle","_getNumberStyle2","_sorter","_sorter2","_onTransitionEnd","Shuffle","element","options","undefined","useSizer","lastSort","lastFilter","ALL_ITEMS","isEnabled","isDestroyed","isInitialized","_transitions","isTransitioning","_queue","_getElementOption","_init","value","items","_getItems","sizer","classList","add","Classes","BASE","_initItems","_onResize","_getResizeFunction","window","addEventListener","containerCss","getComputedStyle","containerWidth","getSize","width","_validateStyles","_setColumns","filter","group","initialSort","offsetWidth","_setTransitions","style","transition","speed","easing","resizeFunction","_handleResize","bind","throttle","throttleTime","option","querySelector","nodeType","jquery","styles","position","overflow","category","collection","set","_getFilteredSets","_toggleFilterClasses","_this","visible","hidden","forEach","item","_doesPassFilter","push","attr","getAttribute","FILTER_ATTRIBUTE_KEY","groups","JSON","parse","keys","delimeter","isArray","split","some","_ref","show","hide","init","dispose","visibleItems","_getFilteredItems","str","useTransforms","_this2","children","el","itemSelector","map","by","isVisible","gutterSize","size","columnWidth","gutterWidth","gutter","_getGutterSize","_getColumnSize","calculatedColumns","abs","round","columnThreshold","cols","floor","colWidth","height","_getContainerSize","positions","index","staggerAmount","staggerAmountMax","name","details","shuffle","dispatchEvent","CustomEvent","bubbles","cancelable","detail","_this3","count","callback","applyCss","Css","VISIBLE","after","currPos","point","currScale","scale","itemSize","pos","_getItemPosition","equals","Scale","before","transitionDelay","_getStaggerAmount","columnSpan","_getColumnSpan","setY","_getColumnSet","shortColumnIndex","_getShortColumn","buffer","setHeight","setSpan","itemWidth","columns","ceil","groupCount","groupY","minPosition","len","_this4","_getConcealedItems","HIDDEN","update","_ref2","x","y","transform","left","top","itemCallback","_this5","Promise","resolve","onTransitionEnd","evt","currentTarget","opts","_getStylesForTransition","_whenTransitionDone","_this6","_cancelMovement","immediates","transitions","_styleImmediately","_startTransitions","setTimeout","_dispatchLayout","_this7","promises","_transition","all","then","_movementFinished","cancelTransitionEnd","objects","_this8","elements","_skipTransitions","_dispatch","EventType","LAYOUT","sortObj","_filter","_shrink","_updateItemCount","sort","_resetCols","_layout","_processQueue","_setContainerSize","isOnlyLayout","newItems","concat","_updateItemsOrder","isUpdateLayout","_this9","oldItems","getItemByElement","handleLayout","removeEventListener","_disposeItems","parentNode","removeChild","REMOVED","remove","removeAttribute","includeMargins","marginLeft","marginRight","marginTop","marginBottom","zero","data","duration","transitionDuration","delay","Point","ShuffleItem","sorter","e","event","params","document","createEvent","initCustomEvent","Event","match","selector","vendor","nodes","querySelectorAll","proto","Element","matches","matchesSelector","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","global","uniqNoSet","arr","ret","uniqSet","seen","Set","has","uniqSetWithForEach","doesForEachActuallyWork","extend","source","hasOwnProperty","func","wait","timeoutID","last","Date","rtn","ctx","args","delta","_getNumber","_getNumber2","a","b","getNumber","parseFloat","addClasses","SHUFFLE_ITEM","INITIAL","classes","className","removeClasses","visibility","will-change","opacity","getNumberStyle","_computedSize2","paddingTop","paddingBottom","borderTopWidth","borderBottomWidth","paddingLeft","paddingRight","borderLeftWidth","borderRightWidth","_computedSize","body","documentElement","createElement","cssText","appendChild","randomize","tmp","current","random","defaults","original","revert","valA","valB","reverse","uniqueId","eventName","listener"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAA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AAiC,aAATC,EAClC,GAGLD,EAAOC,GAAiB,aAATD,GAAgC,cAATC,EACjC,EAGF,IAKPF,EACKD,GAGL7I,EAAKiJ,SACP5D,EAAI4D,UAGC5D,Odu0DR7R,OAAOC,eAAejD,EAAS,cAC7BwF,OAAO,IAETxF,ac/3DuBsT,CAtCxB,IAAA7P,GAAAnD,EAAA,Gdy6DKoD,EAAU3C,EAAuB0C,Gcn5DlC2U,GAEFK,SAAS,EAGTnO,GAAI,KAGJ0N,WAAW,EAIX9U,IAAK,Ydy+DD,SAASjD,EAAQD,Ge7gEvB,YAMA,SAAS0Y,KACP,MAAOC,GAAYtM,IAGd,QAASgD,GAAgB5K,EAAS6H,GACvC,GAAI7L,GAAKiY,IACLE,EAAW,SAACtJ,GACVA,EAAIC,gBAAkBD,EAAI7M,SAC5BgO,EAAoBhQ,GACpB6L,EAASgD,IAQb,OAJA7K,GAAQ2B,iBAAiBuS,EAAWC,GAEpC9I,EAAYrP,IAAQgE,UAASmU,YAEtBnY,EAGF,QAASgQ,GAAoBhQ,GAClC,MAAIqP,GAAYrP,IACdqP,EAAYrP,GAAIgE,QAAQ0N,oBAAoBwG,EAAW7I,EAAYrP,GAAImY,UACvE9I,EAAYrP,GAAM,MACX,IAGF,Efg/DRuC,OAAOC,eAAejD,EAAS,cAC7BwF,OAAO,IAETxF,Ee1gEeqP,kBf2gEfrP,Ee3/DeyQ,qBAxBhB,IAAIX,MACA6I,EAAY,gBACZtM,EAAQ","file":"shuffle.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"shuffle\"] = factory();\n\telse\n\t\troot[\"shuffle\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"shuffle\"] = factory();\n\telse\n\t\troot[\"shuffle\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\t__webpack_require__(1);\n\t\n\tvar _matchesSelector = __webpack_require__(2);\n\t\n\tvar _matchesSelector2 = _interopRequireDefault(_matchesSelector);\n\t\n\tvar _arrayUniq = __webpack_require__(3);\n\t\n\tvar _arrayUniq2 = _interopRequireDefault(_arrayUniq);\n\t\n\tvar _xtend = __webpack_require__(4);\n\t\n\tvar _xtend2 = _interopRequireDefault(_xtend);\n\t\n\tvar _throttleit = __webpack_require__(5);\n\t\n\tvar _throttleit2 = _interopRequireDefault(_throttleit);\n\t\n\tvar _point = __webpack_require__(6);\n\t\n\tvar _point2 = _interopRequireDefault(_point);\n\t\n\tvar _shuffleItem = __webpack_require__(8);\n\t\n\tvar _shuffleItem2 = _interopRequireDefault(_shuffleItem);\n\t\n\tvar _classes = __webpack_require__(9);\n\t\n\tvar _classes2 = _interopRequireDefault(_classes);\n\t\n\tvar _getNumberStyle = __webpack_require__(10);\n\t\n\tvar _getNumberStyle2 = _interopRequireDefault(_getNumberStyle);\n\t\n\tvar _sorter = __webpack_require__(12);\n\t\n\tvar _sorter2 = _interopRequireDefault(_sorter);\n\t\n\tvar _onTransitionEnd = __webpack_require__(13);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction toArray(arrayLike) {\n\t return Array.prototype.slice.call(arrayLike);\n\t}\n\t\n\tfunction arrayMax(array) {\n\t return Math.max.apply(Math, array);\n\t}\n\t\n\tfunction arrayMin(array) {\n\t return Math.min.apply(Math, array);\n\t}\n\t\n\tfunction arrayIncludes(array, obj) {\n\t if (arguments.length === 2) {\n\t return arrayIncludes(array)(obj);\n\t }\n\t\n\t return function (obj) {\n\t return array.indexOf(obj) > -1;\n\t };\n\t}\n\t\n\t// Used for unique instance variables\n\tvar id = 0;\n\t\n\tvar Shuffle = function () {\n\t\n\t /**\n\t * Categorize, sort, and filter a responsive grid of items.\n\t *\n\t * @param {Element} element An element which is the parent container for the grid items.\n\t * @param {Object} [options=Shuffle.options] Options object.\n\t * @constructor\n\t */\n\t\n\t function Shuffle(element) {\n\t var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\t\n\t _classCallCheck(this, Shuffle);\n\t\n\t this.options = (0, _xtend2.default)(Shuffle.options, options);\n\t\n\t this.useSizer = false;\n\t this.lastSort = {};\n\t this.lastFilter = Shuffle.ALL_ITEMS;\n\t this.isEnabled = true;\n\t this.isDestroyed = false;\n\t this.isInitialized = false;\n\t this._transitions = [];\n\t this.isTransitioning = false;\n\t this._queue = [];\n\t\n\t element = this._getElementOption(element);\n\t\n\t if (!element) {\n\t throw new TypeError('Shuffle needs to be initialized with an element.');\n\t }\n\t\n\t this.element = element;\n\t this.id = 'shuffle_' + id++;\n\t\n\t this._init();\n\t this.isInitialized = true;\n\t }\n\t\n\t _createClass(Shuffle, [{\n\t key: '_init',\n\t value: function _init() {\n\t this.items = this._getItems();\n\t\n\t this.options.sizer = this._getElementOption(this.options.sizer);\n\t\n\t if (this.options.sizer) {\n\t this.useSizer = true;\n\t }\n\t\n\t // Add class and invalidate styles\n\t this.element.classList.add(Shuffle.Classes.BASE);\n\t\n\t // Set initial css for each item\n\t this._initItems();\n\t\n\t // Bind resize events\n\t this._onResize = this._getResizeFunction();\n\t window.addEventListener('resize', this._onResize);\n\t\n\t // Get container css all in one request. Causes reflow\n\t var containerCss = window.getComputedStyle(this.element, null);\n\t var containerWidth = Shuffle.getSize(this.element).width;\n\t\n\t // Add styles to the container if it doesn't have them.\n\t this._validateStyles(containerCss);\n\t\n\t // We already got the container's width above, no need to cause another\n\t // reflow getting it again... Calculate the number of columns there will be\n\t this._setColumns(containerWidth);\n\t\n\t // Kick off!\n\t this.filter(this.options.group, this.options.initialSort);\n\t\n\t // The shuffle items haven't had transitions set on them yet so the user\n\t // doesn't see the first layout. Set them now that the first layout is done.\n\t // First, however, a synchronous layout must be caused for the previous\n\t // styles to be applied without transitions.\n\t this.element.offsetWidth; // jshint ignore: line\n\t this._setTransitions();\n\t this.element.style.transition = 'height ' + this.options.speed + 'ms ' + this.options.easing;\n\t }\n\t\n\t /**\n\t * Returns a throttled and proxied function for the resize handler.\n\t * @return {Function}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getResizeFunction',\n\t value: function _getResizeFunction() {\n\t var resizeFunction = this._handleResize.bind(this);\n\t return this.options.throttle ? this.options.throttle(resizeFunction, this.options.throttleTime) : resizeFunction;\n\t }\n\t\n\t /**\n\t * Retrieve an element from an option.\n\t * @param {string|jQuery|Element} option The option to check.\n\t * @return {?Element} The plain element or null.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getElementOption',\n\t value: function _getElementOption(option) {\n\t // If column width is a string, treat is as a selector and search for the\n\t // sizer element within the outermost container\n\t if (typeof option === 'string') {\n\t return this.element.querySelector(option);\n\t\n\t // Check for an element\n\t } else if (option && option.nodeType && option.nodeType === 1) {\n\t return option;\n\t\n\t // Check for jQuery object\n\t } else if (option && option.jquery) {\n\t return option[0];\n\t }\n\t\n\t return null;\n\t }\n\t\n\t /**\n\t * Ensures the shuffle container has the css styles it needs applied to it.\n\t * @param {Object} styles Key value pairs for position and overflow.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_validateStyles',\n\t value: function _validateStyles(styles) {\n\t // Position cannot be static.\n\t if (styles.position === 'static') {\n\t this.element.style.position = 'relative';\n\t }\n\t\n\t // Overflow has to be hidden.\n\t if (styles.overflow !== 'hidden') {\n\t this.element.style.overflow = 'hidden';\n\t }\n\t }\n\t\n\t /**\n\t * Filter the elements by a category.\n\t * @param {string} [category] Category to filter by. If it's given, the last\n\t * category will be used to filter the items.\n\t * @param {Array} [collection] Optionally filter a collection. Defaults to\n\t * all the items.\n\t * @return {!{visible: Array, hidden: Array}}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_filter',\n\t value: function _filter() {\n\t var category = arguments.length <= 0 || arguments[0] === undefined ? this.lastFilter : arguments[0];\n\t var collection = arguments.length <= 1 || arguments[1] === undefined ? this.items : arguments[1];\n\t\n\t var set = this._getFilteredSets(category, collection);\n\t\n\t // Individually add/remove hidden/visible classes\n\t this._toggleFilterClasses(set);\n\t\n\t // Save the last filter in case elements are appended.\n\t this.lastFilter = category;\n\t\n\t // This is saved mainly because providing a filter function (like searching)\n\t // will overwrite the `lastFilter` property every time its called.\n\t if (typeof category === 'string') {\n\t this.options.group = category;\n\t }\n\t\n\t return set;\n\t }\n\t\n\t /**\n\t * Returns an object containing the visible and hidden elements.\n\t * @param {string|Function} category Category or function to filter by.\n\t * @param {Array.} items A collection of items to filter.\n\t * @return {!{visible: Array, hidden: Array}}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getFilteredSets',\n\t value: function _getFilteredSets(category, items) {\n\t var _this = this;\n\t\n\t var visible = [];\n\t var hidden = [];\n\t\n\t // category === 'all', add visible class to everything\n\t if (category === Shuffle.ALL_ITEMS) {\n\t visible = items;\n\t\n\t // Loop through each item and use provided function to determine\n\t // whether to hide it or not.\n\t } else {\n\t items.forEach(function (item) {\n\t if (_this._doesPassFilter(category, item.element)) {\n\t visible.push(item);\n\t } else {\n\t hidden.push(item);\n\t }\n\t });\n\t }\n\t\n\t return {\n\t visible: visible,\n\t hidden: hidden\n\t };\n\t }\n\t\n\t /**\n\t * Test an item to see if it passes a category.\n\t * @param {string|Function} category Category or function to filter by.\n\t * @param {Element} element An element to test.\n\t * @return {boolean} Whether it passes the category/filter.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_doesPassFilter',\n\t value: function _doesPassFilter(category, element) {\n\t\n\t if (typeof category === 'function') {\n\t return category.call(element, element, this);\n\t\n\t // Check each element's data-groups attribute against the given category.\n\t } else {\n\t var attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);\n\t var groups = JSON.parse(attr);\n\t var keys = this.delimeter && !Array.isArray(groups) ? groups.split(this.delimeter) : groups;\n\t\n\t if (Array.isArray(category)) {\n\t return category.some(arrayIncludes(keys));\n\t }\n\t\n\t return arrayIncludes(keys, category);\n\t }\n\t }\n\t\n\t /**\n\t * Toggles the visible and hidden class names.\n\t * @param {{visible, hidden}} Object with visible and hidden arrays.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_toggleFilterClasses',\n\t value: function _toggleFilterClasses(_ref) {\n\t var visible = _ref.visible;\n\t var hidden = _ref.hidden;\n\t\n\t visible.forEach(function (item) {\n\t item.show();\n\t });\n\t\n\t hidden.forEach(function (item) {\n\t item.hide();\n\t });\n\t }\n\t\n\t /**\n\t * Set the initial css for each item\n\t * @param {Array.} [items] Optionally specifiy at set to initialize.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_initItems',\n\t value: function _initItems() {\n\t var items = arguments.length <= 0 || arguments[0] === undefined ? this.items : arguments[0];\n\t\n\t items.forEach(function (item) {\n\t item.init();\n\t });\n\t }\n\t\n\t /**\n\t * Remove element reference and styles.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_disposeItems',\n\t value: function _disposeItems() {\n\t var items = arguments.length <= 0 || arguments[0] === undefined ? this.items : arguments[0];\n\t\n\t items.forEach(function (item) {\n\t item.dispose();\n\t });\n\t }\n\t\n\t /**\n\t * Updates the visible item count.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_updateItemCount',\n\t value: function _updateItemCount() {\n\t this.visibleItems = this._getFilteredItems().length;\n\t }\n\t\n\t /**\n\t * Sets css transform transition on a group of elements. This is not executed\n\t * at the same time as `item.init` so that transitions don't occur upon\n\t * initialization of Shuffle.\n\t * @param {Array.} items Shuffle items to set transitions on.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_setTransitions',\n\t value: function _setTransitions() {\n\t var items = arguments.length <= 0 || arguments[0] === undefined ? this.items : arguments[0];\n\t\n\t var speed = this.options.speed;\n\t var easing = this.options.easing;\n\t\n\t var str;\n\t if (this.options.useTransforms) {\n\t str = 'transform ' + speed + 'ms ' + easing + ', opacity ' + speed + 'ms ' + easing;\n\t } else {\n\t str = 'top ' + speed + 'ms ' + easing + ', left ' + speed + 'ms ' + easing + ', opacity ' + speed + 'ms ' + easing;\n\t }\n\t\n\t items.forEach(function (item) {\n\t item.element.style.transition = str;\n\t });\n\t }\n\t }, {\n\t key: '_getItems',\n\t value: function _getItems() {\n\t var _this2 = this;\n\t\n\t return toArray(this.element.children).filter(function (el) {\n\t return (0, _matchesSelector2.default)(el, _this2.options.itemSelector);\n\t }).map(function (el) {\n\t return new _shuffleItem2.default(el);\n\t });\n\t }\n\t\n\t /**\n\t * When new elements are added to the shuffle container, update the array of\n\t * items because that is the order `_layout` calls them.\n\t */\n\t\n\t }, {\n\t key: '_updateItemsOrder',\n\t value: function _updateItemsOrder() {\n\t var children = this.element.children;\n\t this.items = (0, _sorter2.default)(this.items, {\n\t by: function by(element) {\n\t return Array.prototype.indexOf.call(children, element);\n\t }\n\t });\n\t }\n\t }, {\n\t key: '_getFilteredItems',\n\t value: function _getFilteredItems() {\n\t return this.items.filter(function (item) {\n\t return item.isVisible;\n\t });\n\t }\n\t }, {\n\t key: '_getConcealedItems',\n\t value: function _getConcealedItems() {\n\t return this.items.filter(function (item) {\n\t return !item.isVisible;\n\t });\n\t }\n\t\n\t /**\n\t * Returns the column size, based on column width and sizer options.\n\t * @param {number} containerWidth Size of the parent container.\n\t * @param {number} gutterSize Size of the gutters.\n\t * @return {number}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getColumnSize',\n\t value: function _getColumnSize(containerWidth, gutterSize) {\n\t var size;\n\t\n\t // If the columnWidth property is a function, then the grid is fluid\n\t if (typeof this.options.columnWidth === 'function') {\n\t size = this.options.columnWidth(containerWidth);\n\t\n\t // columnWidth option isn't a function, are they using a sizing element?\n\t } else if (this.useSizer) {\n\t size = Shuffle.getSize(this.options.sizer).width;\n\t\n\t // if not, how about the explicitly set option?\n\t } else if (this.options.columnWidth) {\n\t size = this.options.columnWidth;\n\t\n\t // or use the size of the first item\n\t } else if (this.items.length > 0) {\n\t size = Shuffle.getSize(this.items[0].element, true).width;\n\t\n\t // if there's no items, use size of container\n\t } else {\n\t size = containerWidth;\n\t }\n\t\n\t // Don't let them set a column width of zero.\n\t if (size === 0) {\n\t size = containerWidth;\n\t }\n\t\n\t return size + gutterSize;\n\t }\n\t\n\t /**\n\t * Returns the gutter size, based on gutter width and sizer options.\n\t * @param {number} containerWidth Size of the parent container.\n\t * @return {number}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getGutterSize',\n\t value: function _getGutterSize(containerWidth) {\n\t var size;\n\t if (typeof this.options.gutterWidth === 'function') {\n\t size = this.options.gutterWidth(containerWidth);\n\t } else if (this.useSizer) {\n\t size = (0, _getNumberStyle2.default)(this.options.sizer, 'marginLeft');\n\t } else {\n\t size = this.options.gutterWidth;\n\t }\n\t\n\t return size;\n\t }\n\t\n\t /**\n\t * Calculate the number of columns to be used. Gets css if using sizer element.\n\t * @param {number} [containerWidth] Optionally specify a container width if\n\t * it's already available.\n\t */\n\t\n\t }, {\n\t key: '_setColumns',\n\t value: function _setColumns() {\n\t var containerWidth = arguments.length <= 0 || arguments[0] === undefined ? Shuffle.getSize(this.element).width : arguments[0];\n\t\n\t var gutter = this._getGutterSize(containerWidth);\n\t var columnWidth = this._getColumnSize(containerWidth, gutter);\n\t var calculatedColumns = (containerWidth + gutter) / columnWidth;\n\t\n\t // Widths given from getStyles are not precise enough...\n\t if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) < this.options.columnThreshold) {\n\t // e.g. calculatedColumns = 11.998876\n\t calculatedColumns = Math.round(calculatedColumns);\n\t }\n\t\n\t this.cols = Math.max(Math.floor(calculatedColumns), 1);\n\t this.containerWidth = containerWidth;\n\t this.colWidth = columnWidth;\n\t }\n\t\n\t /**\n\t * Adjust the height of the grid\n\t */\n\t\n\t }, {\n\t key: '_setContainerSize',\n\t value: function _setContainerSize() {\n\t this.element.style.height = this._getContainerSize() + 'px';\n\t }\n\t\n\t /**\n\t * Based on the column heights, it returns the biggest one.\n\t * @return {number}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getContainerSize',\n\t value: function _getContainerSize() {\n\t return arrayMax(this.positions);\n\t }\n\t\n\t /**\n\t * Get the clamped stagger amount.\n\t * @param {number} index Index of the item to be staggered.\n\t * @return {number}\n\t */\n\t\n\t }, {\n\t key: '_getStaggerAmount',\n\t value: function _getStaggerAmount(index) {\n\t return Math.min(index * this.options.staggerAmount, this.options.staggerAmountMax);\n\t }\n\t\n\t /**\n\t * @return {boolean} Whether the event was prevented or not.\n\t */\n\t\n\t }, {\n\t key: '_dispatch',\n\t value: function _dispatch(name) {\n\t var details = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\t\n\t if (this.isDestroyed) {\n\t return;\n\t }\n\t\n\t details.shuffle = this;\n\t return !this.element.dispatchEvent(new CustomEvent(name, {\n\t bubbles: true,\n\t cancelable: false,\n\t detail: details\n\t }));\n\t }\n\t\n\t /**\n\t * Zeros out the y columns array, which is used to determine item placement.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_resetCols',\n\t value: function _resetCols() {\n\t var i = this.cols;\n\t this.positions = [];\n\t while (i--) {\n\t this.positions.push(0);\n\t }\n\t }\n\t\n\t /**\n\t * Loops through each item that should be shown and calculates the x, y position.\n\t * @param {Array.} items Array of items that will be shown/layed\n\t * out in order in their array.\n\t */\n\t\n\t }, {\n\t key: '_layout',\n\t value: function _layout(items) {\n\t var _this3 = this;\n\t\n\t var count = 0;\n\t items.forEach(function (item) {\n\t var currPos = item.point;\n\t var currScale = item.scale;\n\t var itemSize = Shuffle.getSize(item.element, true);\n\t var pos = _this3._getItemPosition(itemSize);\n\t\n\t function callback() {\n\t item.applyCss(_shuffleItem2.default.Css.VISIBLE.after);\n\t }\n\t\n\t // If the item will not change its position, do not add it to the render\n\t // queue. Transitions don't fire when setting a property to the same value.\n\t if (_point2.default.equals(currPos, pos) && currScale === _shuffleItem2.default.Scale.VISIBLE) {\n\t callback();\n\t return;\n\t }\n\t\n\t item.point = pos;\n\t item.scale = _shuffleItem2.default.Scale.VISIBLE;\n\t\n\t var styles = _shuffleItem2.default.Css.VISIBLE.before;\n\t styles.transitionDelay = _this3._getStaggerAmount(count);\n\t\n\t _this3._queue.push({\n\t item: item,\n\t styles: styles,\n\t callback: callback\n\t });\n\t\n\t count++;\n\t });\n\t }\n\t\n\t /**\n\t * Determine the location of the next item, based on its size.\n\t * @param {{width: number, height: number}} itemSize Object with width and height.\n\t * @return {Point}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getItemPosition',\n\t value: function _getItemPosition(itemSize) {\n\t var columnSpan = this._getColumnSpan(itemSize.width, this.colWidth, this.cols);\n\t\n\t var setY = this._getColumnSet(columnSpan, this.cols);\n\t\n\t // Finds the index of the smallest number in the set.\n\t var shortColumnIndex = this._getShortColumn(setY, this.options.buffer);\n\t\n\t // Position the item\n\t var point = new _point2.default(Math.round(this.colWidth * shortColumnIndex), Math.round(setY[shortColumnIndex]));\n\t\n\t // Update the columns array with the new values for each column.\n\t // e.g. before the update the columns could be [250, 0, 0, 0] for an item\n\t // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0].\n\t var setHeight = setY[shortColumnIndex] + itemSize.height;\n\t var setSpan = this.cols + 1 - setY.length;\n\t for (var i = 0; i < setSpan; i++) {\n\t this.positions[shortColumnIndex + i] = setHeight;\n\t }\n\t\n\t return point;\n\t }\n\t\n\t /**\n\t * Determine the number of columns an items spans.\n\t * @param {number} itemWidth Width of the item.\n\t * @param {number} columnWidth Width of the column (includes gutter).\n\t * @param {number} columns Total number of columns\n\t * @return {number}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getColumnSpan',\n\t value: function _getColumnSpan(itemWidth, columnWidth, columns) {\n\t var columnSpan = itemWidth / columnWidth;\n\t\n\t // If the difference between the rounded column span number and the\n\t // calculated column span number is really small, round the number to\n\t // make it fit.\n\t if (Math.abs(Math.round(columnSpan) - columnSpan) < this.options.columnThreshold) {\n\t // e.g. columnSpan = 4.0089945390298745\n\t columnSpan = Math.round(columnSpan);\n\t }\n\t\n\t // Ensure the column span is not more than the amount of columns in the whole layout.\n\t return Math.min(Math.ceil(columnSpan), columns);\n\t }\n\t\n\t /**\n\t * Retrieves the column set to use for placement.\n\t * @param {number} columnSpan The number of columns this current item spans.\n\t * @param {number} columns The total columns in the grid.\n\t * @return {Array.} An array of numbers represeting the column set.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getColumnSet',\n\t value: function _getColumnSet(columnSpan, columns) {\n\t // The item spans only one column.\n\t if (columnSpan === 1) {\n\t return this.positions;\n\t\n\t // The item spans more than one column, figure out how many different\n\t // places it could fit horizontally.\n\t // The group count is the number of places within the positions this block\n\t // could fit, ignoring the current positions of items.\n\t // Imagine a 2 column brick as the second item in a 4 column grid with\n\t // 10px height each. Find the places it would fit:\n\t // [10, 0, 0, 0]\n\t // | | |\n\t // * * *\n\t //\n\t // Then take the places which fit and get the bigger of the two:\n\t // max([10, 0]), max([0, 0]), max([0, 0]) = [10, 0, 0]\n\t //\n\t // Next, find the first smallest number (the short column).\n\t // [10, 0, 0]\n\t // |\n\t // *\n\t //\n\t // And that's where it should be placed!\n\t } else {\n\t var groupCount = columns + 1 - columnSpan;\n\t var groupY = [];\n\t\n\t // For how many possible positions for this item there are.\n\t for (var i = 0; i < groupCount; i++) {\n\t // Find the bigger value for each place it could fit.\n\t groupY[i] = arrayMax(this.positions.slice(i, i + columnSpan));\n\t }\n\t\n\t return groupY;\n\t }\n\t }\n\t\n\t /**\n\t * Find index of short column, the first from the left where this item will go.\n\t *\n\t * @param {Array.} positions The array to search for the smallest number.\n\t * @param {number} buffer Optional buffer which is very useful when the height\n\t * is a percentage of the width.\n\t * @return {number} Index of the short column.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getShortColumn',\n\t value: function _getShortColumn(positions, buffer) {\n\t var minPosition = arrayMin(positions);\n\t for (var i = 0, len = positions.length; i < len; i++) {\n\t if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) {\n\t return i;\n\t }\n\t }\n\t\n\t return 0;\n\t }\n\t\n\t /**\n\t * Hides the elements that don't match our filter.\n\t * @param {Array.} collection Collection to shrink.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_shrink',\n\t value: function _shrink() {\n\t var _this4 = this;\n\t\n\t var collection = arguments.length <= 0 || arguments[0] === undefined ? this._getConcealedItems() : arguments[0];\n\t\n\t var count = 0;\n\t collection.forEach(function (item) {\n\t function callback() {\n\t item.applyCss(_shuffleItem2.default.Css.HIDDEN.after);\n\t }\n\t\n\t // Continuing would add a transitionend event listener to the element, but\n\t // that listener would not execute because the transform and opacity would\n\t // stay the same.\n\t // The callback is executed here because it is not guaranteed to be called\n\t // after the transitionend event because the transitionend could be\n\t // canceled if another animation starts.\n\t if (item.scale === _shuffleItem2.default.Scale.HIDDEN) {\n\t callback();\n\t return;\n\t }\n\t\n\t item.scale = _shuffleItem2.default.Scale.HIDDEN;\n\t\n\t var styles = _shuffleItem2.default.Css.HIDDEN.before;\n\t styles.transitionDelay = _this4._getStaggerAmount(count);\n\t\n\t _this4._queue.push({\n\t item: item,\n\t styles: styles,\n\t callback: callback\n\t });\n\t\n\t count++;\n\t });\n\t }\n\t\n\t /**\n\t * Resize handler.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_handleResize',\n\t value: function _handleResize() {\n\t // If shuffle is disabled, destroyed, don't do anything\n\t if (!this.isEnabled || this.isDestroyed) {\n\t return;\n\t }\n\t\n\t // Will need to check height in the future if it's layed out horizontaly\n\t var containerWidth = Shuffle.getSize(this.element).width;\n\t\n\t // containerWidth hasn't changed, don't do anything\n\t if (containerWidth === this.containerWidth) {\n\t return;\n\t }\n\t\n\t this.update();\n\t }\n\t\n\t /**\n\t * Returns styles which will be applied to the an item for a transition.\n\t * @param {Object} obj Transition options.\n\t * @return {!Object} Transforms for transitions, left/top for animate.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getStylesForTransition',\n\t value: function _getStylesForTransition(_ref2) {\n\t var item = _ref2.item;\n\t var styles = _ref2.styles;\n\t\n\t if (!styles.transitionDelay) {\n\t styles.transitionDelay = '0ms';\n\t }\n\t\n\t var x = item.point.x;\n\t var y = item.point.y;\n\t\n\t if (this.options.useTransforms) {\n\t styles.transform = 'translate(' + x + 'px, ' + y + 'px) scale(' + item.scale + ')';\n\t } else {\n\t styles.left = x + 'px';\n\t styles.top = y + 'px';\n\t }\n\t\n\t return styles;\n\t }\n\t }, {\n\t key: '_whenTransitionDone',\n\t value: function _whenTransitionDone(element, itemCallback) {\n\t var _this5 = this;\n\t\n\t // TODO what happens when the transition is canceled and the promise never resolves?\n\t return new Promise(function (resolve) {\n\t var id = (0, _onTransitionEnd.onTransitionEnd)(element, function (evt) {\n\t evt.currentTarget.style.transitionDelay = '';\n\t itemCallback();\n\t resolve();\n\t });\n\t _this5._transitions.push(id);\n\t });\n\t }\n\t }, {\n\t key: '_transition',\n\t value: function _transition(opts) {\n\t opts.item.applyCss(this._getStylesForTransition(opts));\n\t return this._whenTransitionDone(opts.item.element, opts.callback);\n\t }\n\t\n\t /**\n\t * Execute the styles gathered in the style queue. This applies styles to elements,\n\t * triggering transitions.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_processQueue',\n\t value: function _processQueue() {\n\t var _this6 = this;\n\t\n\t if (this.isTransitioning) {\n\t this._cancelMovement();\n\t }\n\t\n\t // Iterate over the queue and keep track of ones that use transitions.\n\t var immediates = [];\n\t var transitions = [];\n\t this._queue.forEach(function (obj) {\n\t if (!_this6.isInitialized || _this6.options.speed === 0) {\n\t immediates.push(obj);\n\t } else {\n\t transitions.push(obj);\n\t }\n\t });\n\t\n\t this._styleImmediately(immediates);\n\t\n\t if (transitions.length > 0 && this.options.speed > 0) {\n\t this._startTransitions(transitions);\n\t\n\t // A call to layout happened, but none of the newly visible items will\n\t // change position. Asynchronously fire the callback here.\n\t } else {\n\t setTimeout(this._dispatchLayout.bind(this), 0);\n\t }\n\t\n\t // Remove everything in the style queue\n\t this._queue.length = 0;\n\t }\n\t\n\t /**\n\t * Create a promise for each transition and wait for all of them to complete,\n\t * then emit the layout event.\n\t * @param {Array.} transitions Array of transition objects.\n\t */\n\t\n\t }, {\n\t key: '_startTransitions',\n\t value: function _startTransitions(transitions) {\n\t var _this7 = this;\n\t\n\t // Set flag that shuffle is currently in motion.\n\t this.isTransitioning = true;\n\t\n\t var promises = transitions.map(function (obj) {\n\t return _this7._transition(obj);\n\t });\n\t Promise.all(promises).then(this._movementFinished.bind(this));\n\t }\n\t }, {\n\t key: '_cancelMovement',\n\t value: function _cancelMovement() {\n\t // Remove the transition end event for each listener.\n\t this._transitions.forEach(_onTransitionEnd.cancelTransitionEnd);\n\t\n\t // Reset the array.\n\t this._transitions.length = 0;\n\t\n\t // Show it's no longer active.\n\t this.isTransitioning = false;\n\t }\n\t\n\t /**\n\t * Apply styles without a transition.\n\t * @param {Array.} objects Array of transition objects.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_styleImmediately',\n\t value: function _styleImmediately(objects) {\n\t var _this8 = this;\n\t\n\t if (objects.length) {\n\t var elements = objects.map(function (obj) {\n\t return obj.item.element;\n\t });\n\t\n\t Shuffle._skipTransitions(elements, function () {\n\t objects.forEach(function (obj) {\n\t obj.item.applyCss(_this8._getStylesForTransition(obj));\n\t obj.callback();\n\t });\n\t });\n\t }\n\t }\n\t }, {\n\t key: '_movementFinished',\n\t value: function _movementFinished() {\n\t this._transitions.length = 0;\n\t this.isTransitioning = false;\n\t this._dispatchLayout();\n\t }\n\t }, {\n\t key: '_dispatchLayout',\n\t value: function _dispatchLayout() {\n\t this._dispatch(Shuffle.EventType.LAYOUT);\n\t }\n\t\n\t /**\n\t * The magic. This is what makes the plugin 'shuffle'\n\t * @param {string|Function|Array.} [category] Category to filter by.\n\t * Can be a function, string, or array of strings.\n\t * @param {Object} [sortObj] A sort object which can sort the visible set\n\t */\n\t\n\t }, {\n\t key: 'filter',\n\t value: function filter(category, sortObj) {\n\t if (!this.isEnabled) {\n\t return;\n\t }\n\t\n\t if (!category || category && category.length === 0) {\n\t category = Shuffle.ALL_ITEMS;\n\t }\n\t\n\t this._filter(category);\n\t\n\t // Shrink each hidden item\n\t this._shrink();\n\t\n\t // How many visible elements?\n\t this._updateItemCount();\n\t\n\t // Update transforms on visible elements so they will animate to their new positions.\n\t this.sort(sortObj);\n\t }\n\t\n\t /**\n\t * Gets the visible elements, sorts them, and passes them to layout.\n\t * @param {Object} opts the options object for the sorted plugin\n\t */\n\t\n\t }, {\n\t key: 'sort',\n\t value: function sort() {\n\t var opts = arguments.length <= 0 || arguments[0] === undefined ? this.lastSort : arguments[0];\n\t\n\t if (!this.isEnabled) {\n\t return;\n\t }\n\t\n\t this._resetCols();\n\t\n\t var items = this._getFilteredItems();\n\t items = (0, _sorter2.default)(items, opts);\n\t\n\t this._layout(items);\n\t\n\t // `_layout` always happens after `_shrink`, so it's safe to process the style\n\t // queue here with styles from the shrink method.\n\t this._processQueue();\n\t\n\t // Adjust the height of the container.\n\t this._setContainerSize();\n\t\n\t this.lastSort = opts;\n\t }\n\t\n\t /**\n\t * Reposition everything.\n\t * @param {boolean} isOnlyLayout If true, column and gutter widths won't be\n\t * recalculated.\n\t */\n\t\n\t }, {\n\t key: 'update',\n\t value: function update(isOnlyLayout) {\n\t if (this.isEnabled) {\n\t\n\t if (!isOnlyLayout) {\n\t // Get updated colCount\n\t this._setColumns();\n\t }\n\t\n\t // Layout items\n\t this.sort();\n\t }\n\t }\n\t\n\t /**\n\t * Use this instead of `update()` if you don't need the columns and gutters updated\n\t * Maybe an image inside `shuffle` loaded (and now has a height), which means calculations\n\t * could be off.\n\t */\n\t\n\t }, {\n\t key: 'layout',\n\t value: function layout() {\n\t this.update(true);\n\t }\n\t\n\t /**\n\t * New items have been appended to shuffle. Mix them in with the current\n\t * filter or sort status.\n\t * @param {Array.} newItems Collection of new items.\n\t */\n\t\n\t }, {\n\t key: 'add',\n\t value: function add(newItems) {\n\t newItems = (0, _arrayUniq2.default)(newItems).map(function (el) {\n\t return new _shuffleItem2.default(el);\n\t });\n\t\n\t // Add classes and set initial positions.\n\t this._initItems(newItems);\n\t\n\t // Add transition to each item.\n\t this._setTransitions(newItems);\n\t\n\t // Update the list of items.\n\t this.items = this.items.concat(newItems);\n\t this._updateItemsOrder();\n\t this.filter(this.lastFilter);\n\t }\n\t\n\t /**\n\t * Disables shuffle from updating dimensions and layout on resize\n\t */\n\t\n\t }, {\n\t key: 'disable',\n\t value: function disable() {\n\t this.isEnabled = false;\n\t }\n\t\n\t /**\n\t * Enables shuffle again\n\t * @param {boolean} [isUpdateLayout=true] if undefined, shuffle will update columns and gutters\n\t */\n\t\n\t }, {\n\t key: 'enable',\n\t value: function enable(isUpdateLayout) {\n\t this.isEnabled = true;\n\t if (isUpdateLayout !== false) {\n\t this.update();\n\t }\n\t }\n\t\n\t /**\n\t * Remove 1 or more shuffle items\n\t * @param {Array.} collection An array containing one or more\n\t * elements in shuffle\n\t * @return {Shuffle} The shuffle object\n\t */\n\t\n\t }, {\n\t key: 'remove',\n\t value: function remove(collection) {\n\t var _this9 = this;\n\t\n\t if (!collection.length) {\n\t return;\n\t }\n\t\n\t collection = (0, _arrayUniq2.default)(collection);\n\t\n\t var oldItems = collection.map(function (element) {\n\t return _this9.getItemByElement(element);\n\t }).filter(function (item) {\n\t return !!item;\n\t });\n\t\n\t var handleLayout = function handleLayout() {\n\t _this9.element.removeEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n\t _this9._disposeItems(oldItems);\n\t\n\t // Remove the collection in the callback\n\t collection.forEach(function (element) {\n\t element.parentNode.removeChild(element);\n\t });\n\t\n\t _this9._dispatch(Shuffle.EventType.REMOVED, { collection: collection });\n\t\n\t // Let it get garbage collected\n\t collection = null;\n\t oldItems = null;\n\t };\n\t\n\t // Hide collection first.\n\t this._toggleFilterClasses({\n\t visible: [],\n\t hidden: oldItems\n\t });\n\t\n\t this._shrink(oldItems);\n\t\n\t this.sort();\n\t\n\t // Update the list of items here because `remove` could be called again\n\t // with an item that is in the process of being removed.\n\t this.items = this.items.filter(function (item) {\n\t return !arrayIncludes(oldItems, item);\n\t });\n\t this._updateItemCount();\n\t\n\t this.element.addEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n\t }\n\t\n\t /**\n\t * Retrieve a shuffle item by its element.\n\t * @param {Element} element Element to look for.\n\t * @return {?ShuffleItem} A shuffle item or null if it's not found.\n\t */\n\t\n\t }, {\n\t key: 'getItemByElement',\n\t value: function getItemByElement(element) {\n\t for (var i = this.items.length - 1; i >= 0; i--) {\n\t if (this.items[i].element === element) {\n\t return this.items[i];\n\t }\n\t }\n\t\n\t return null;\n\t }\n\t\n\t /**\n\t * Destroys shuffle, removes events, styles, and classes\n\t */\n\t\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._cancelMovement();\n\t window.removeEventListener('resize', this._onResize);\n\t\n\t // Reset container styles\n\t this.element.classList.remove('shuffle');\n\t this.element.removeAttribute('style');\n\t\n\t // Reset individual item styles\n\t this._disposeItems();\n\t\n\t // Null DOM references\n\t this.items = null;\n\t this.options.sizer = null;\n\t this.element = null;\n\t this._transitions = null;\n\t\n\t // Set a flag so if a debounced resize has been triggered,\n\t // it can first check if it is actually isDestroyed and not doing anything\n\t this.isDestroyed = true;\n\t }\n\t\n\t /**\n\t * Returns the outer width of an element, optionally including its margins.\n\t *\n\t * There are a few different methods for getting the width of an element, none of\n\t * which work perfectly for all Shuffle's use cases.\n\t *\n\t * 1. getBoundingClientRect() `left` and `right` properties.\n\t * - Accounts for transform scaled elements, making it useless for Shuffle\n\t * elements which have shrunk.\n\t * 2. The `offsetWidth` property.\n\t * - This value stays the same regardless of the elements transform property,\n\t * however, it does not return subpixel values.\n\t * 3. getComputedStyle()\n\t * - This works great Chrome, Firefox, Safari, but IE<=11 does not include\n\t * padding and border when box-sizing: border-box is set, requiring a feature\n\t * test and extra work to add the padding back for IE and other browsers which\n\t * follow the W3C spec here.\n\t *\n\t * @param {Element} element The element.\n\t * @param {boolean} [includeMargins] Whether to include margins. Default is false.\n\t * @return {{width: number, height: number}} The width and height.\n\t */\n\t\n\t }], [{\n\t key: 'getSize',\n\t value: function getSize(element, includeMargins) {\n\t // Store the styles so that they can be used by others without asking for it again.\n\t var styles = window.getComputedStyle(element, null);\n\t var width = (0, _getNumberStyle2.default)(element, 'width', styles);\n\t var height = (0, _getNumberStyle2.default)(element, 'height', styles);\n\t\n\t if (includeMargins) {\n\t var marginLeft = (0, _getNumberStyle2.default)(element, 'marginLeft', styles);\n\t var marginRight = (0, _getNumberStyle2.default)(element, 'marginRight', styles);\n\t var marginTop = (0, _getNumberStyle2.default)(element, 'marginTop', styles);\n\t var marginBottom = (0, _getNumberStyle2.default)(element, 'marginBottom', styles);\n\t width += marginLeft + marginRight;\n\t height += marginTop + marginBottom;\n\t }\n\t\n\t return {\n\t width: width,\n\t height: height\n\t };\n\t }\n\t\n\t /**\n\t * Change a property or execute a function which will not have a transition\n\t * @param {Array.} elements DOM elements that won't be transitioned.\n\t * @param {Function} callback A function which will be called while transition\n\t * is set to 0ms.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_skipTransitions',\n\t value: function _skipTransitions(elements, callback) {\n\t var zero = '0ms';\n\t\n\t // Save current duration and delay.\n\t var data = elements.map(function (element) {\n\t var style = element.style;\n\t var duration = style.transitionDuration;\n\t var delay = style.transitionDelay;\n\t\n\t // Set the duration to zero so it happens immediately\n\t style.transitionDuration = zero;\n\t style.transitionDelay = zero;\n\t\n\t return {\n\t duration: duration,\n\t delay: delay\n\t };\n\t });\n\t\n\t callback();\n\t\n\t // Cause reflow.\n\t elements[0].offsetWidth; // jshint ignore:line\n\t\n\t // Put the duration back\n\t elements.forEach(function (element, i) {\n\t element.style.transitionDuration = data[i].duration;\n\t element.style.transitionDelay = data[i].delay;\n\t });\n\t }\n\t }]);\n\t\n\t return Shuffle;\n\t}();\n\t\n\tShuffle.ALL_ITEMS = 'all';\n\tShuffle.FILTER_ATTRIBUTE_KEY = 'groups';\n\t\n\t/**\n\t * @enum {string}\n\t */\n\tShuffle.EventType = {\n\t LAYOUT: 'shuffle:layout',\n\t REMOVED: 'shuffle:removed'\n\t};\n\t\n\t/** @enum {string} */\n\tShuffle.Classes = _classes2.default;\n\t\n\t// Overrideable options\n\tShuffle.options = {\n\t // Initial filter group.\n\t group: Shuffle.ALL_ITEMS,\n\t\n\t // Transition/animation speed (milliseconds).\n\t speed: 250,\n\t\n\t // CSS easing function to use.\n\t easing: 'ease',\n\t\n\t // e.g. '.picture-item'.\n\t itemSelector: '*',\n\t\n\t // Element or selector string. Use an element to determine the size of columns\n\t // and gutters.\n\t sizer: null,\n\t\n\t // A static number or function that tells the plugin how wide the gutters\n\t // between columns are (in pixels).\n\t gutterWidth: 0,\n\t\n\t // A static number or function that returns a number which tells the plugin\n\t // how wide the columns are (in pixels).\n\t columnWidth: 0,\n\t\n\t // If your group is not json, and is comma delimeted, you could set delimeter\n\t // to ','.\n\t delimeter: null,\n\t\n\t // Useful for percentage based heights when they might not always be exactly\n\t // the same (in pixels).\n\t buffer: 0,\n\t\n\t // Reading the width of elements isn't precise enough and can cause columns to\n\t // jump between values.\n\t columnThreshold: 0.01,\n\t\n\t // Shuffle can be isInitialized with a sort object. It is the same object\n\t // given to the sort method.\n\t initialSort: null,\n\t\n\t // By default, shuffle will throttle resize events. This can be changed or\n\t // removed.\n\t throttle: _throttleit2.default,\n\t\n\t // How often shuffle can be called on resize (in milliseconds).\n\t throttleTime: 300,\n\t\n\t // Transition delay offset for each item in milliseconds.\n\t staggerAmount: 15,\n\t\n\t // Maximum stagger delay in milliseconds.\n\t staggerAmountMax: 250,\n\t\n\t // Whether to use transforms or absolute positioning.\n\t useTransforms: true\n\t};\n\t\n\t// Expose for testing.\n\tShuffle.Point = _point2.default;\n\tShuffle.ShuffleItem = _shuffleItem2.default;\n\tShuffle.sorter = _sorter2.default;\n\t\n\tmodule.exports = Shuffle;\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t// Polyfill for creating CustomEvents on IE9/10/11\n\t\n\t// code pulled from:\n\t// https://github.com/d4tocchini/customevent-polyfill\n\t// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\t\n\ttry {\n\t new window.CustomEvent(\"test\");\n\t} catch(e) {\n\t var CustomEvent = function(event, params) {\n\t var evt;\n\t params = params || {\n\t bubbles: false,\n\t cancelable: false,\n\t detail: undefined\n\t };\n\t\n\t evt = document.createEvent(\"CustomEvent\");\n\t evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t return evt;\n\t };\n\t\n\t CustomEvent.prototype = window.Event.prototype;\n\t window.CustomEvent = CustomEvent; // expose definition to window\n\t}\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar proto = Element.prototype;\n\tvar vendor = proto.matches\n\t || proto.matchesSelector\n\t || proto.webkitMatchesSelector\n\t || proto.mozMatchesSelector\n\t || proto.msMatchesSelector\n\t || proto.oMatchesSelector;\n\t\n\tmodule.exports = match;\n\t\n\t/**\n\t * Match `el` to `selector`.\n\t *\n\t * @param {Element} el\n\t * @param {String} selector\n\t * @return {Boolean}\n\t * @api public\n\t */\n\t\n\tfunction match(el, selector) {\n\t if (vendor) return vendor.call(el, selector);\n\t var nodes = el.parentNode.querySelectorAll(selector);\n\t for (var i = 0; i < nodes.length; i++) {\n\t if (nodes[i] == el) return true;\n\t }\n\t return false;\n\t}\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\t// there's 3 implementations written in increasing order of efficiency\n\t\n\t// 1 - no Set type is defined\n\tfunction uniqNoSet(arr) {\n\t\tvar ret = [];\n\t\n\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\t\tret.push(arr[i]);\n\t\t\t}\n\t\t}\n\t\n\t\treturn ret;\n\t}\n\t\n\t// 2 - a simple Set type is defined\n\tfunction uniqSet(arr) {\n\t\tvar seen = new Set();\n\t\treturn arr.filter(function (el) {\n\t\t\tif (!seen.has(el)) {\n\t\t\t\tseen.add(el);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t}\n\t\n\t// 3 - a standard Set type is defined and it has a forEach method\n\tfunction uniqSetWithForEach(arr) {\n\t\tvar ret = [];\n\t\n\t\t(new Set(arr)).forEach(function (el) {\n\t\t\tret.push(el);\n\t\t});\n\t\n\t\treturn ret;\n\t}\n\t\n\t// V8 currently has a broken implementation\n\t// https://github.com/joyent/node/issues/8449\n\tfunction doesForEachActuallyWork() {\n\t\tvar ret = false;\n\t\n\t\t(new Set([true])).forEach(function (el) {\n\t\t\tret = el;\n\t\t});\n\t\n\t\treturn ret === true;\n\t}\n\t\n\tif ('Set' in global) {\n\t\tif (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {\n\t\t\tmodule.exports = uniqSetWithForEach;\n\t\t} else {\n\t\t\tmodule.exports = uniqSet;\n\t\t}\n\t} else {\n\t\tmodule.exports = uniqNoSet;\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\tmodule.exports = extend\n\t\n\tvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\t\n\tfunction extend() {\n\t var target = {}\n\t\n\t for (var i = 0; i < arguments.length; i++) {\n\t var source = arguments[i]\n\t\n\t for (var key in source) {\n\t if (hasOwnProperty.call(source, key)) {\n\t target[key] = source[key]\n\t }\n\t }\n\t }\n\t\n\t return target\n\t}\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\tmodule.exports = throttle;\n\t\n\t/**\n\t * Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.\n\t *\n\t * @param {Function} func Function to wrap.\n\t * @param {Number} wait Number of milliseconds that must elapse between `func` invocations.\n\t * @return {Function} A new function that wraps the `func` function passed in.\n\t */\n\t\n\tfunction throttle (func, wait) {\n\t var ctx, args, rtn, timeoutID; // caching\n\t var last = 0;\n\t\n\t return function throttled () {\n\t ctx = this;\n\t args = arguments;\n\t var delta = new Date() - last;\n\t if (!timeoutID)\n\t if (delta >= wait) call();\n\t else timeoutID = setTimeout(call, wait - delta);\n\t return rtn;\n\t };\n\t\n\t function call () {\n\t timeoutID = 0;\n\t last = +new Date();\n\t rtn = func.apply(ctx, args);\n\t ctx = null;\n\t args = null;\n\t }\n\t}\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _getNumber = __webpack_require__(7);\n\t\n\tvar _getNumber2 = _interopRequireDefault(_getNumber);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t/**\n\t * Represents a coordinate pair.\n\t * @param {number} [x=0] X.\n\t * @param {number} [y=0] Y.\n\t */\n\tvar Point = function Point(x, y) {\n\t this.x = (0, _getNumber2.default)(x);\n\t this.y = (0, _getNumber2.default)(y);\n\t};\n\t\n\t/**\n\t * Whether two points are equal.\n\t * @param {Point} a Point A.\n\t * @param {Point} b Point B.\n\t * @return {boolean}\n\t */\n\tPoint.equals = function (a, b) {\n\t return a.x === b.x && a.y === b.y;\n\t};\n\t\n\texports.default = Point;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.\n\t * @param {*} value Possibly numeric value.\n\t * @return {number} `value` or zero if `value` isn't numeric.\n\t */\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = getNumber;\n\tfunction getNumber(value) {\n\t return parseFloat(value) || 0;\n\t}\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _point = __webpack_require__(6);\n\t\n\tvar _point2 = _interopRequireDefault(_point);\n\t\n\tvar _classes = __webpack_require__(9);\n\t\n\tvar _classes2 = _interopRequireDefault(_classes);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar id = 0;\n\t\n\tvar ShuffleItem = function () {\n\t function ShuffleItem(element) {\n\t _classCallCheck(this, ShuffleItem);\n\t\n\t this.id = id++;\n\t this.element = element;\n\t this.isVisible = true;\n\t }\n\t\n\t _createClass(ShuffleItem, [{\n\t key: 'show',\n\t value: function show() {\n\t this.isVisible = true;\n\t this.element.classList.remove(_classes2.default.HIDDEN);\n\t this.element.classList.add(_classes2.default.VISIBLE);\n\t }\n\t }, {\n\t key: 'hide',\n\t value: function hide() {\n\t this.isVisible = false;\n\t this.element.classList.remove(_classes2.default.VISIBLE);\n\t this.element.classList.add(_classes2.default.HIDDEN);\n\t }\n\t }, {\n\t key: 'init',\n\t value: function init() {\n\t this.addClasses([_classes2.default.SHUFFLE_ITEM, _classes2.default.VISIBLE]);\n\t this.applyCss(ShuffleItem.Css.INITIAL);\n\t this.scale = ShuffleItem.Scale.VISIBLE;\n\t this.point = new _point2.default();\n\t }\n\t }, {\n\t key: 'addClasses',\n\t value: function addClasses(classes) {\n\t var _this = this;\n\t\n\t classes.forEach(function (className) {\n\t _this.element.classList.add(className);\n\t });\n\t }\n\t }, {\n\t key: 'removeClasses',\n\t value: function removeClasses(classes) {\n\t var _this2 = this;\n\t\n\t classes.forEach(function (className) {\n\t _this2.element.classList.remove(className);\n\t });\n\t }\n\t }, {\n\t key: 'applyCss',\n\t value: function applyCss(obj) {\n\t for (var key in obj) {\n\t this.element.style[key] = obj[key];\n\t }\n\t }\n\t }, {\n\t key: 'dispose',\n\t value: function dispose() {\n\t this.removeClasses([_classes2.default.HIDDEN, _classes2.default.VISIBLE, _classes2.default.SHUFFLE_ITEM]);\n\t\n\t this.element.removeAttribute('style');\n\t this.element = null;\n\t }\n\t }]);\n\t\n\t return ShuffleItem;\n\t}();\n\t\n\tShuffleItem.Css = {\n\t INITIAL: {\n\t position: 'absolute',\n\t top: 0,\n\t left: 0,\n\t visibility: 'visible',\n\t 'will-change': 'transform'\n\t },\n\t VISIBLE: {\n\t before: {\n\t opacity: 1,\n\t visibility: 'visible'\n\t },\n\t after: {}\n\t },\n\t HIDDEN: {\n\t before: {\n\t opacity: 0\n\t },\n\t after: {\n\t visibility: 'hidden'\n\t }\n\t }\n\t};\n\t\n\tShuffleItem.Scale = {\n\t VISIBLE: 1,\n\t HIDDEN: 0.001\n\t};\n\t\n\texports.default = ShuffleItem;\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = {\n\t BASE: 'shuffle',\n\t SHUFFLE_ITEM: 'shuffle-item',\n\t VISIBLE: 'shuffle-item--visible',\n\t HIDDEN: 'shuffle-item--hidden'\n\t};\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = getNumberStyle;\n\t\n\tvar _getNumber = __webpack_require__(7);\n\t\n\tvar _getNumber2 = _interopRequireDefault(_getNumber);\n\t\n\tvar _computedSize = __webpack_require__(11);\n\t\n\tvar _computedSize2 = _interopRequireDefault(_computedSize);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t/**\n\t * Retrieve the computed style for an element, parsed as a float.\n\t * @param {Element} element Element to get style for.\n\t * @param {string} style Style property.\n\t * @param {CSSStyleDeclaration} [styles] Optionally include clean styles to\n\t * use instead of asking for them again.\n\t * @return {number} The parsed computed value or zero if that fails because IE\n\t * will return 'auto' when the element doesn't have margins instead of\n\t * the computed style.\n\t */\n\tfunction getNumberStyle(element, style) {\n\t var styles = arguments.length <= 2 || arguments[2] === undefined ? window.getComputedStyle(element, null) : arguments[2];\n\t\n\t var value = (0, _getNumber2.default)(styles[style]);\n\t\n\t // Support IE<=11 and W3C spec.\n\t if (!_computedSize2.default && style === 'width') {\n\t value += (0, _getNumber2.default)(styles.paddingLeft) + (0, _getNumber2.default)(styles.paddingRight) + (0, _getNumber2.default)(styles.borderLeftWidth) + (0, _getNumber2.default)(styles.borderRightWidth);\n\t } else if (!_computedSize2.default && style === 'height') {\n\t value += (0, _getNumber2.default)(styles.paddingTop) + (0, _getNumber2.default)(styles.paddingBottom) + (0, _getNumber2.default)(styles.borderTopWidth) + (0, _getNumber2.default)(styles.borderBottomWidth);\n\t }\n\t\n\t return value;\n\t}\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar element = document.body || document.documentElement;\n\tvar e = document.createElement('div');\n\te.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';\n\telement.appendChild(e);\n\t\n\tvar width = window.getComputedStyle(e, null).width;\n\tvar ret = width === '10px';\n\t\n\telement.removeChild(e);\n\t\n\texports.default = ret;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = sorter;\n\t\n\tvar _xtend = __webpack_require__(4);\n\t\n\tvar _xtend2 = _interopRequireDefault(_xtend);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t// http://stackoverflow.com/a/962890/373422\n\tfunction randomize(array) {\n\t var tmp;\n\t var current;\n\t var top = array.length;\n\t\n\t if (!top) {\n\t return array;\n\t }\n\t\n\t while (--top) {\n\t current = Math.floor(Math.random() * (top + 1));\n\t tmp = array[current];\n\t array[current] = array[top];\n\t array[top] = tmp;\n\t }\n\t\n\t return array;\n\t}\n\t\n\tvar defaults = {\n\t // Use array.reverse() to reverse the results\n\t reverse: false,\n\t\n\t // Sorting function\n\t by: null,\n\t\n\t // If true, this will skip the sorting and return a randomized order in the array\n\t randomize: false,\n\t\n\t // Determines which property of each item in the array is passed to the\n\t // sorting method.\n\t key: 'element'\n\t};\n\t\n\t// You can return `undefined` from the `by` function to revert to DOM order.\n\tfunction sorter(arr, options) {\n\t var opts = (0, _xtend2.default)(defaults, options);\n\t var original = [].slice.call(arr);\n\t var revert = false;\n\t\n\t if (!arr.length) {\n\t return [];\n\t }\n\t\n\t if (opts.randomize) {\n\t return randomize(arr);\n\t }\n\t\n\t // Sort the elements by the opts.by function.\n\t // If we don't have opts.by, default to DOM order\n\t if (typeof opts.by === 'function') {\n\t arr.sort(function (a, b) {\n\t\n\t // Exit early if we already know we want to revert\n\t if (revert) {\n\t return 0;\n\t }\n\t\n\t var valA = opts.by(a[opts.key]);\n\t var valB = opts.by(b[opts.key]);\n\t\n\t // If both values are undefined, use the DOM order\n\t if (valA === undefined && valB === undefined) {\n\t revert = true;\n\t return 0;\n\t }\n\t\n\t if (valA < valB || valA === 'sortFirst' || valB === 'sortLast') {\n\t return -1;\n\t }\n\t\n\t if (valA > valB || valA === 'sortLast' || valB === 'sortFirst') {\n\t return 1;\n\t }\n\t\n\t return 0;\n\t });\n\t }\n\t\n\t // Revert to the original array if necessary\n\t if (revert) {\n\t return original;\n\t }\n\t\n\t if (opts.reverse) {\n\t arr.reverse();\n\t }\n\t\n\t return arr;\n\t}\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.onTransitionEnd = onTransitionEnd;\n\texports.cancelTransitionEnd = cancelTransitionEnd;\n\tvar transitions = {};\n\tvar eventName = 'transitionend';\n\tvar count = 0;\n\t\n\tfunction uniqueId() {\n\t return eventName + count++;\n\t}\n\t\n\tfunction onTransitionEnd(element, callback) {\n\t var id = uniqueId();\n\t var listener = function listener(evt) {\n\t if (evt.currentTarget === evt.target) {\n\t cancelTransitionEnd(id);\n\t callback(evt);\n\t }\n\t };\n\t\n\t element.addEventListener(eventName, listener);\n\t\n\t transitions[id] = { element: element, listener: listener };\n\t\n\t return id;\n\t}\n\t\n\tfunction cancelTransitionEnd(id) {\n\t if (transitions[id]) {\n\t transitions[id].element.removeEventListener(eventName, transitions[id].listener);\n\t transitions[id] = null;\n\t return true;\n\t }\n\t\n\t return false;\n\t}\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** shuffle.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 79383518e594c5572654\n **/","'use strict';\n\nimport 'custom-event-polyfill';\nimport matches from 'matches-selector';\nimport arrayUnique from 'array-uniq';\nimport xtend from 'xtend';\nimport throttle from 'throttleit';\nimport Point from './point';\nimport ShuffleItem from './shuffle-item';\nimport Classes from './classes';\nimport getNumberStyle from './get-number-style';\nimport sorter from './sorter';\nimport { onTransitionEnd, cancelTransitionEnd } from './on-transition-end';\n\nfunction toArray(arrayLike) {\n return Array.prototype.slice.call(arrayLike);\n}\n\nfunction arrayMax(array) {\n return Math.max.apply(Math, array);\n}\n\nfunction arrayMin(array) {\n return Math.min.apply(Math, array);\n}\n\nfunction arrayIncludes(array, obj) {\n if (arguments.length === 2) {\n return arrayIncludes(array)(obj);\n }\n\n return function (obj) {\n return array.indexOf(obj) > -1;\n };\n}\n\n// Used for unique instance variables\nlet id = 0;\n\nclass Shuffle {\n\n /**\n * Categorize, sort, and filter a responsive grid of items.\n *\n * @param {Element} element An element which is the parent container for the grid items.\n * @param {Object} [options=Shuffle.options] Options object.\n * @constructor\n */\n constructor(element, options = {}) {\n this.options = xtend(Shuffle.options, options);\n\n this.useSizer = false;\n this.lastSort = {};\n this.lastFilter = Shuffle.ALL_ITEMS;\n this.isEnabled = true;\n this.isDestroyed = false;\n this.isInitialized = false;\n this._transitions = [];\n this.isTransitioning = false;\n this._queue = [];\n\n element = this._getElementOption(element);\n\n if (!element) {\n throw new TypeError('Shuffle needs to be initialized with an element.');\n }\n\n this.element = element;\n this.id = 'shuffle_' + id++;\n\n this._init();\n this.isInitialized = true;\n }\n\n _init() {\n this.items = this._getItems();\n\n this.options.sizer = this._getElementOption(this.options.sizer);\n\n if (this.options.sizer) {\n this.useSizer = true;\n }\n\n // Add class and invalidate styles\n this.element.classList.add(Shuffle.Classes.BASE);\n\n // Set initial css for each item\n this._initItems();\n\n // Bind resize events\n this._onResize = this._getResizeFunction();\n window.addEventListener('resize', this._onResize);\n\n // Get container css all in one request. Causes reflow\n var containerCss = window.getComputedStyle(this.element, null);\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // Add styles to the container if it doesn't have them.\n this._validateStyles(containerCss);\n\n // We already got the container's width above, no need to cause another\n // reflow getting it again... Calculate the number of columns there will be\n this._setColumns(containerWidth);\n\n // Kick off!\n this.filter(this.options.group, this.options.initialSort);\n\n // The shuffle items haven't had transitions set on them yet so the user\n // doesn't see the first layout. Set them now that the first layout is done.\n // First, however, a synchronous layout must be caused for the previous\n // styles to be applied without transitions.\n this.element.offsetWidth; // jshint ignore: line\n this._setTransitions();\n this.element.style.transition = 'height ' + this.options.speed + 'ms ' + this.options.easing;\n }\n\n /**\n * Returns a throttled and proxied function for the resize handler.\n * @return {Function}\n * @private\n */\n _getResizeFunction() {\n var resizeFunction = this._handleResize.bind(this);\n return this.options.throttle ?\n this.options.throttle(resizeFunction, this.options.throttleTime) :\n resizeFunction;\n }\n\n /**\n * Retrieve an element from an option.\n * @param {string|jQuery|Element} option The option to check.\n * @return {?Element} The plain element or null.\n * @private\n */\n _getElementOption(option) {\n // If column width is a string, treat is as a selector and search for the\n // sizer element within the outermost container\n if (typeof option === 'string') {\n return this.element.querySelector(option);\n\n // Check for an element\n } else if (option && option.nodeType && option.nodeType === 1) {\n return option;\n\n // Check for jQuery object\n } else if (option && option.jquery) {\n return option[0];\n }\n\n return null;\n }\n\n /**\n * Ensures the shuffle container has the css styles it needs applied to it.\n * @param {Object} styles Key value pairs for position and overflow.\n * @private\n */\n _validateStyles(styles) {\n // Position cannot be static.\n if (styles.position === 'static') {\n this.element.style.position = 'relative';\n }\n\n // Overflow has to be hidden.\n if (styles.overflow !== 'hidden') {\n this.element.style.overflow = 'hidden';\n }\n }\n\n /**\n * Filter the elements by a category.\n * @param {string} [category] Category to filter by. If it's given, the last\n * category will be used to filter the items.\n * @param {Array} [collection] Optionally filter a collection. Defaults to\n * all the items.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _filter(category = this.lastFilter, collection = this.items) {\n var set = this._getFilteredSets(category, collection);\n\n // Individually add/remove hidden/visible classes\n this._toggleFilterClasses(set);\n\n // Save the last filter in case elements are appended.\n this.lastFilter = category;\n\n // This is saved mainly because providing a filter function (like searching)\n // will overwrite the `lastFilter` property every time its called.\n if (typeof category === 'string') {\n this.options.group = category;\n }\n\n return set;\n }\n\n /**\n * Returns an object containing the visible and hidden elements.\n * @param {string|Function} category Category or function to filter by.\n * @param {Array.} items A collection of items to filter.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _getFilteredSets(category, items) {\n let visible = [];\n let hidden = [];\n\n // category === 'all', add visible class to everything\n if (category === Shuffle.ALL_ITEMS) {\n visible = items;\n\n // Loop through each item and use provided function to determine\n // whether to hide it or not.\n } else {\n items.forEach((item) => {\n if (this._doesPassFilter(category, item.element)) {\n visible.push(item);\n } else {\n hidden.push(item);\n }\n });\n }\n\n return {\n visible,\n hidden,\n };\n }\n\n /**\n * Test an item to see if it passes a category.\n * @param {string|Function} category Category or function to filter by.\n * @param {Element} element An element to test.\n * @return {boolean} Whether it passes the category/filter.\n * @private\n */\n _doesPassFilter(category, element) {\n\n if (typeof category === 'function') {\n return category.call(element, element, this);\n\n // Check each element's data-groups attribute against the given category.\n } else {\n let attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);\n let groups = JSON.parse(attr);\n let keys = this.delimeter && !Array.isArray(groups) ?\n groups.split(this.delimeter) :\n groups;\n\n if (Array.isArray(category)) {\n return category.some(arrayIncludes(keys));\n }\n\n return arrayIncludes(keys, category);\n }\n }\n\n /**\n * Toggles the visible and hidden class names.\n * @param {{visible, hidden}} Object with visible and hidden arrays.\n * @private\n */\n _toggleFilterClasses({ visible, hidden }) {\n visible.forEach((item) => {\n item.show();\n });\n\n hidden.forEach((item) => {\n item.hide();\n });\n }\n\n /**\n * Set the initial css for each item\n * @param {Array.} [items] Optionally specifiy at set to initialize.\n * @private\n */\n _initItems(items = this.items) {\n items.forEach((item) => {\n item.init();\n });\n }\n\n /**\n * Remove element reference and styles.\n * @private\n */\n _disposeItems(items = this.items) {\n items.forEach((item) => {\n item.dispose();\n });\n }\n\n /**\n * Updates the visible item count.\n * @private\n */\n _updateItemCount() {\n this.visibleItems = this._getFilteredItems().length;\n }\n\n /**\n * Sets css transform transition on a group of elements. This is not executed\n * at the same time as `item.init` so that transitions don't occur upon\n * initialization of Shuffle.\n * @param {Array.} items Shuffle items to set transitions on.\n * @private\n */\n _setTransitions(items = this.items) {\n let speed = this.options.speed;\n let easing = this.options.easing;\n\n var str;\n if (this.options.useTransforms) {\n str = 'transform ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n } else {\n str = 'top ' + speed + 'ms ' + easing +\n ', left ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n }\n\n items.forEach((item) => {\n item.element.style.transition = str;\n });\n }\n\n _getItems() {\n return toArray(this.element.children)\n .filter(el => matches(el, this.options.itemSelector))\n .map(el => new ShuffleItem(el));\n }\n\n /**\n * When new elements are added to the shuffle container, update the array of\n * items because that is the order `_layout` calls them.\n */\n _updateItemsOrder() {\n let children = this.element.children;\n this.items = sorter(this.items, {\n by(element) {\n return Array.prototype.indexOf.call(children, element);\n },\n });\n }\n\n _getFilteredItems() {\n return this.items.filter(item => item.isVisible);\n }\n\n _getConcealedItems() {\n return this.items.filter(item => !item.isVisible);\n }\n\n /**\n * Returns the column size, based on column width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @param {number} gutterSize Size of the gutters.\n * @return {number}\n * @private\n */\n _getColumnSize(containerWidth, gutterSize) {\n var size;\n\n // If the columnWidth property is a function, then the grid is fluid\n if (typeof this.options.columnWidth === 'function') {\n size = this.options.columnWidth(containerWidth);\n\n // columnWidth option isn't a function, are they using a sizing element?\n } else if (this.useSizer) {\n size = Shuffle.getSize(this.options.sizer).width;\n\n // if not, how about the explicitly set option?\n } else if (this.options.columnWidth) {\n size = this.options.columnWidth;\n\n // or use the size of the first item\n } else if (this.items.length > 0) {\n size = Shuffle.getSize(this.items[0].element, true).width;\n\n // if there's no items, use size of container\n } else {\n size = containerWidth;\n }\n\n // Don't let them set a column width of zero.\n if (size === 0) {\n size = containerWidth;\n }\n\n return size + gutterSize;\n }\n\n /**\n * Returns the gutter size, based on gutter width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @return {number}\n * @private\n */\n _getGutterSize(containerWidth) {\n var size;\n if (typeof this.options.gutterWidth === 'function') {\n size = this.options.gutterWidth(containerWidth);\n } else if (this.useSizer) {\n size = getNumberStyle(this.options.sizer, 'marginLeft');\n } else {\n size = this.options.gutterWidth;\n }\n\n return size;\n }\n\n /**\n * Calculate the number of columns to be used. Gets css if using sizer element.\n * @param {number} [containerWidth] Optionally specify a container width if\n * it's already available.\n */\n _setColumns(containerWidth = Shuffle.getSize(this.element).width) {\n var gutter = this._getGutterSize(containerWidth);\n var columnWidth = this._getColumnSize(containerWidth, gutter);\n var calculatedColumns = (containerWidth + gutter) / columnWidth;\n\n // Widths given from getStyles are not precise enough...\n if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) <\n this.options.columnThreshold) {\n // e.g. calculatedColumns = 11.998876\n calculatedColumns = Math.round(calculatedColumns);\n }\n\n this.cols = Math.max(Math.floor(calculatedColumns), 1);\n this.containerWidth = containerWidth;\n this.colWidth = columnWidth;\n }\n\n /**\n * Adjust the height of the grid\n */\n _setContainerSize() {\n this.element.style.height = this._getContainerSize() + 'px';\n }\n\n /**\n * Based on the column heights, it returns the biggest one.\n * @return {number}\n * @private\n */\n _getContainerSize() {\n return arrayMax(this.positions);\n }\n\n /**\n * Get the clamped stagger amount.\n * @param {number} index Index of the item to be staggered.\n * @return {number}\n */\n _getStaggerAmount(index) {\n return Math.min(index * this.options.staggerAmount, this.options.staggerAmountMax);\n }\n\n /**\n * @return {boolean} Whether the event was prevented or not.\n */\n _dispatch(name, details = {}) {\n if (this.isDestroyed) {\n return;\n }\n\n details.shuffle = this;\n return !this.element.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: false,\n detail: details,\n }));\n }\n\n /**\n * Zeros out the y columns array, which is used to determine item placement.\n * @private\n */\n _resetCols() {\n var i = this.cols;\n this.positions = [];\n while (i--) {\n this.positions.push(0);\n }\n }\n\n /**\n * Loops through each item that should be shown and calculates the x, y position.\n * @param {Array.} items Array of items that will be shown/layed\n * out in order in their array.\n */\n _layout(items) {\n let count = 0;\n items.forEach((item) => {\n var currPos = item.point;\n var currScale = item.scale;\n var itemSize = Shuffle.getSize(item.element, true);\n var pos = this._getItemPosition(itemSize);\n\n function callback() {\n item.applyCss(ShuffleItem.Css.VISIBLE.after);\n }\n\n // If the item will not change its position, do not add it to the render\n // queue. Transitions don't fire when setting a property to the same value.\n if (Point.equals(currPos, pos) && currScale === ShuffleItem.Scale.VISIBLE) {\n callback();\n return;\n }\n\n item.point = pos;\n item.scale = ShuffleItem.Scale.VISIBLE;\n\n let styles = ShuffleItem.Css.VISIBLE.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Determine the location of the next item, based on its size.\n * @param {{width: number, height: number}} itemSize Object with width and height.\n * @return {Point}\n * @private\n */\n _getItemPosition(itemSize) {\n var columnSpan = this._getColumnSpan(itemSize.width, this.colWidth, this.cols);\n\n var setY = this._getColumnSet(columnSpan, this.cols);\n\n // Finds the index of the smallest number in the set.\n var shortColumnIndex = this._getShortColumn(setY, this.options.buffer);\n\n // Position the item\n var point = new Point(\n Math.round(this.colWidth * shortColumnIndex),\n Math.round(setY[shortColumnIndex]));\n\n // Update the columns array with the new values for each column.\n // e.g. before the update the columns could be [250, 0, 0, 0] for an item\n // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0].\n var setHeight = setY[shortColumnIndex] + itemSize.height;\n var setSpan = this.cols + 1 - setY.length;\n for (var i = 0; i < setSpan; i++) {\n this.positions[shortColumnIndex + i] = setHeight;\n }\n\n return point;\n }\n\n /**\n * Determine the number of columns an items spans.\n * @param {number} itemWidth Width of the item.\n * @param {number} columnWidth Width of the column (includes gutter).\n * @param {number} columns Total number of columns\n * @return {number}\n * @private\n */\n _getColumnSpan(itemWidth, columnWidth, columns) {\n var columnSpan = itemWidth / columnWidth;\n\n // If the difference between the rounded column span number and the\n // calculated column span number is really small, round the number to\n // make it fit.\n if (Math.abs(Math.round(columnSpan) - columnSpan) < this.options.columnThreshold) {\n // e.g. columnSpan = 4.0089945390298745\n columnSpan = Math.round(columnSpan);\n }\n\n // Ensure the column span is not more than the amount of columns in the whole layout.\n return Math.min(Math.ceil(columnSpan), columns);\n }\n\n /**\n * Retrieves the column set to use for placement.\n * @param {number} columnSpan The number of columns this current item spans.\n * @param {number} columns The total columns in the grid.\n * @return {Array.} An array of numbers represeting the column set.\n * @private\n */\n _getColumnSet(columnSpan, columns) {\n // The item spans only one column.\n if (columnSpan === 1) {\n return this.positions;\n\n // The item spans more than one column, figure out how many different\n // places it could fit horizontally.\n // The group count is the number of places within the positions this block\n // could fit, ignoring the current positions of items.\n // Imagine a 2 column brick as the second item in a 4 column grid with\n // 10px height each. Find the places it would fit:\n // [10, 0, 0, 0]\n // | | |\n // * * *\n //\n // Then take the places which fit and get the bigger of the two:\n // max([10, 0]), max([0, 0]), max([0, 0]) = [10, 0, 0]\n //\n // Next, find the first smallest number (the short column).\n // [10, 0, 0]\n // |\n // *\n //\n // And that's where it should be placed!\n } else {\n var groupCount = columns + 1 - columnSpan;\n var groupY = [];\n\n // For how many possible positions for this item there are.\n for (var i = 0; i < groupCount; i++) {\n // Find the bigger value for each place it could fit.\n groupY[i] = arrayMax(this.positions.slice(i, i + columnSpan));\n }\n\n return groupY;\n }\n }\n\n /**\n * Find index of short column, the first from the left where this item will go.\n *\n * @param {Array.} positions The array to search for the smallest number.\n * @param {number} buffer Optional buffer which is very useful when the height\n * is a percentage of the width.\n * @return {number} Index of the short column.\n * @private\n */\n _getShortColumn(positions, buffer) {\n var minPosition = arrayMin(positions);\n for (var i = 0, len = positions.length; i < len; i++) {\n if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) {\n return i;\n }\n }\n\n return 0;\n }\n\n /**\n * Hides the elements that don't match our filter.\n * @param {Array.} collection Collection to shrink.\n * @private\n */\n _shrink(collection = this._getConcealedItems()) {\n let count = 0;\n collection.forEach((item) => {\n function callback() {\n item.applyCss(ShuffleItem.Css.HIDDEN.after);\n }\n\n // Continuing would add a transitionend event listener to the element, but\n // that listener would not execute because the transform and opacity would\n // stay the same.\n // The callback is executed here because it is not guaranteed to be called\n // after the transitionend event because the transitionend could be\n // canceled if another animation starts.\n if (item.scale === ShuffleItem.Scale.HIDDEN) {\n callback();\n return;\n }\n\n item.scale = ShuffleItem.Scale.HIDDEN;\n\n let styles = ShuffleItem.Css.HIDDEN.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Resize handler.\n * @private\n */\n _handleResize() {\n // If shuffle is disabled, destroyed, don't do anything\n if (!this.isEnabled || this.isDestroyed) {\n return;\n }\n\n // Will need to check height in the future if it's layed out horizontaly\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // containerWidth hasn't changed, don't do anything\n if (containerWidth === this.containerWidth) {\n return;\n }\n\n this.update();\n }\n\n /**\n * Returns styles which will be applied to the an item for a transition.\n * @param {Object} obj Transition options.\n * @return {!Object} Transforms for transitions, left/top for animate.\n * @private\n */\n _getStylesForTransition({ item, styles }) {\n if (!styles.transitionDelay) {\n styles.transitionDelay = '0ms';\n }\n\n let x = item.point.x;\n let y = item.point.y;\n\n if (this.options.useTransforms) {\n styles.transform = `translate(${x}px, ${y}px) scale(${item.scale})`;\n } else {\n styles.left = x + 'px';\n styles.top = y + 'px';\n }\n\n return styles;\n }\n\n _whenTransitionDone(element, itemCallback) {\n // TODO what happens when the transition is canceled and the promise never resolves?\n return new Promise((resolve) => {\n let id = onTransitionEnd(element, (evt) => {\n evt.currentTarget.style.transitionDelay = '';\n itemCallback();\n resolve();\n });\n this._transitions.push(id);\n });\n }\n\n _transition(opts) {\n opts.item.applyCss(this._getStylesForTransition(opts));\n return this._whenTransitionDone(opts.item.element, opts.callback);\n }\n\n /**\n * Execute the styles gathered in the style queue. This applies styles to elements,\n * triggering transitions.\n * @private\n */\n _processQueue() {\n if (this.isTransitioning) {\n this._cancelMovement();\n }\n\n // Iterate over the queue and keep track of ones that use transitions.\n let immediates = [];\n let transitions = [];\n this._queue.forEach((obj) => {\n if (!this.isInitialized || this.options.speed === 0) {\n immediates.push(obj);\n } else {\n transitions.push(obj);\n }\n });\n\n this._styleImmediately(immediates);\n\n if (transitions.length > 0 && this.options.speed > 0) {\n this._startTransitions(transitions);\n\n // A call to layout happened, but none of the newly visible items will\n // change position. Asynchronously fire the callback here.\n } else {\n setTimeout(this._dispatchLayout.bind(this), 0);\n }\n\n // Remove everything in the style queue\n this._queue.length = 0;\n }\n\n /**\n * Create a promise for each transition and wait for all of them to complete,\n * then emit the layout event.\n * @param {Array.} transitions Array of transition objects.\n */\n _startTransitions(transitions) {\n // Set flag that shuffle is currently in motion.\n this.isTransitioning = true;\n\n let promises = transitions.map(obj => this._transition(obj));\n Promise.all(promises).then(this._movementFinished.bind(this));\n }\n\n _cancelMovement() {\n // Remove the transition end event for each listener.\n this._transitions.forEach(cancelTransitionEnd);\n\n // Reset the array.\n this._transitions.length = 0;\n\n // Show it's no longer active.\n this.isTransitioning = false;\n }\n\n /**\n * Apply styles without a transition.\n * @param {Array.} objects Array of transition objects.\n * @private\n */\n _styleImmediately(objects) {\n if (objects.length) {\n let elements = objects.map(obj => obj.item.element);\n\n Shuffle._skipTransitions(elements, () => {\n objects.forEach((obj) => {\n obj.item.applyCss(this._getStylesForTransition(obj));\n obj.callback();\n });\n });\n }\n }\n\n _movementFinished() {\n this._transitions.length = 0;\n this.isTransitioning = false;\n this._dispatchLayout();\n }\n\n _dispatchLayout() {\n this._dispatch(Shuffle.EventType.LAYOUT);\n }\n\n /**\n * The magic. This is what makes the plugin 'shuffle'\n * @param {string|Function|Array.} [category] Category to filter by.\n * Can be a function, string, or array of strings.\n * @param {Object} [sortObj] A sort object which can sort the visible set\n */\n filter(category, sortObj) {\n if (!this.isEnabled) {\n return;\n }\n\n if (!category || (category && category.length === 0)) {\n category = Shuffle.ALL_ITEMS;\n }\n\n this._filter(category);\n\n // Shrink each hidden item\n this._shrink();\n\n // How many visible elements?\n this._updateItemCount();\n\n // Update transforms on visible elements so they will animate to their new positions.\n this.sort(sortObj);\n }\n\n /**\n * Gets the visible elements, sorts them, and passes them to layout.\n * @param {Object} opts the options object for the sorted plugin\n */\n sort(opts = this.lastSort) {\n if (!this.isEnabled) {\n return;\n }\n\n this._resetCols();\n\n var items = this._getFilteredItems();\n items = sorter(items, opts);\n\n this._layout(items);\n\n // `_layout` always happens after `_shrink`, so it's safe to process the style\n // queue here with styles from the shrink method.\n this._processQueue();\n\n // Adjust the height of the container.\n this._setContainerSize();\n\n this.lastSort = opts;\n }\n\n /**\n * Reposition everything.\n * @param {boolean} isOnlyLayout If true, column and gutter widths won't be\n * recalculated.\n */\n update(isOnlyLayout) {\n if (this.isEnabled) {\n\n if (!isOnlyLayout) {\n // Get updated colCount\n this._setColumns();\n }\n\n // Layout items\n this.sort();\n }\n }\n\n /**\n * Use this instead of `update()` if you don't need the columns and gutters updated\n * Maybe an image inside `shuffle` loaded (and now has a height), which means calculations\n * could be off.\n */\n layout() {\n this.update(true);\n }\n\n /**\n * New items have been appended to shuffle. Mix them in with the current\n * filter or sort status.\n * @param {Array.} newItems Collection of new items.\n */\n add(newItems) {\n newItems = arrayUnique(newItems).map(el => new ShuffleItem(el));\n\n // Add classes and set initial positions.\n this._initItems(newItems);\n\n // Add transition to each item.\n this._setTransitions(newItems);\n\n // Update the list of items.\n this.items = this.items.concat(newItems);\n this._updateItemsOrder();\n this.filter(this.lastFilter);\n }\n\n /**\n * Disables shuffle from updating dimensions and layout on resize\n */\n disable() {\n this.isEnabled = false;\n }\n\n /**\n * Enables shuffle again\n * @param {boolean} [isUpdateLayout=true] if undefined, shuffle will update columns and gutters\n */\n enable(isUpdateLayout) {\n this.isEnabled = true;\n if (isUpdateLayout !== false) {\n this.update();\n }\n }\n\n /**\n * Remove 1 or more shuffle items\n * @param {Array.} collection An array containing one or more\n * elements in shuffle\n * @return {Shuffle} The shuffle object\n */\n remove(collection) {\n if (!collection.length) {\n return;\n }\n\n collection = arrayUnique(collection);\n\n let oldItems = collection\n .map(element => this.getItemByElement(element))\n .filter(item => !!item);\n\n let handleLayout = () => {\n this.element.removeEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n this._disposeItems(oldItems);\n\n // Remove the collection in the callback\n collection.forEach((element) => {\n element.parentNode.removeChild(element);\n });\n\n this._dispatch(Shuffle.EventType.REMOVED, { collection });\n\n // Let it get garbage collected\n collection = null;\n oldItems = null;\n };\n\n // Hide collection first.\n this._toggleFilterClasses({\n visible: [],\n hidden: oldItems,\n });\n\n this._shrink(oldItems);\n\n this.sort();\n\n // Update the list of items here because `remove` could be called again\n // with an item that is in the process of being removed.\n this.items = this.items.filter(item => !arrayIncludes(oldItems, item));\n this._updateItemCount();\n\n this.element.addEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n }\n\n /**\n * Retrieve a shuffle item by its element.\n * @param {Element} element Element to look for.\n * @return {?ShuffleItem} A shuffle item or null if it's not found.\n */\n getItemByElement(element) {\n for (var i = this.items.length - 1; i >= 0; i--) {\n if (this.items[i].element === element) {\n return this.items[i];\n }\n }\n\n return null;\n }\n\n /**\n * Destroys shuffle, removes events, styles, and classes\n */\n destroy() {\n this._cancelMovement();\n window.removeEventListener('resize', this._onResize);\n\n // Reset container styles\n this.element.classList.remove('shuffle');\n this.element.removeAttribute('style');\n\n // Reset individual item styles\n this._disposeItems();\n\n // Null DOM references\n this.items = null;\n this.options.sizer = null;\n this.element = null;\n this._transitions = null;\n\n // Set a flag so if a debounced resize has been triggered,\n // it can first check if it is actually isDestroyed and not doing anything\n this.isDestroyed = true;\n }\n\n /**\n * Returns the outer width of an element, optionally including its margins.\n *\n * There are a few different methods for getting the width of an element, none of\n * which work perfectly for all Shuffle's use cases.\n *\n * 1. getBoundingClientRect() `left` and `right` properties.\n * - Accounts for transform scaled elements, making it useless for Shuffle\n * elements which have shrunk.\n * 2. The `offsetWidth` property.\n * - This value stays the same regardless of the elements transform property,\n * however, it does not return subpixel values.\n * 3. getComputedStyle()\n * - This works great Chrome, Firefox, Safari, but IE<=11 does not include\n * padding and border when box-sizing: border-box is set, requiring a feature\n * test and extra work to add the padding back for IE and other browsers which\n * follow the W3C spec here.\n *\n * @param {Element} element The element.\n * @param {boolean} [includeMargins] Whether to include margins. Default is false.\n * @return {{width: number, height: number}} The width and height.\n */\n static getSize(element, includeMargins) {\n // Store the styles so that they can be used by others without asking for it again.\n var styles = window.getComputedStyle(element, null);\n var width = getNumberStyle(element, 'width', styles);\n var height = getNumberStyle(element, 'height', styles);\n\n if (includeMargins) {\n var marginLeft = getNumberStyle(element, 'marginLeft', styles);\n var marginRight = getNumberStyle(element, 'marginRight', styles);\n var marginTop = getNumberStyle(element, 'marginTop', styles);\n var marginBottom = getNumberStyle(element, 'marginBottom', styles);\n width += marginLeft + marginRight;\n height += marginTop + marginBottom;\n }\n\n return {\n width,\n height,\n };\n }\n\n /**\n * Change a property or execute a function which will not have a transition\n * @param {Array.} elements DOM elements that won't be transitioned.\n * @param {Function} callback A function which will be called while transition\n * is set to 0ms.\n * @private\n */\n static _skipTransitions(elements, callback) {\n let zero = '0ms';\n\n // Save current duration and delay.\n let data = elements.map((element) => {\n let style = element.style;\n let duration = style.transitionDuration;\n let delay = style.transitionDelay;\n\n // Set the duration to zero so it happens immediately\n style.transitionDuration = zero;\n style.transitionDelay = zero;\n\n return {\n duration,\n delay,\n };\n });\n\n callback();\n\n // Cause reflow.\n elements[0].offsetWidth; // jshint ignore:line\n\n // Put the duration back\n elements.forEach((element, i) => {\n element.style.transitionDuration = data[i].duration;\n element.style.transitionDelay = data[i].delay;\n });\n }\n}\n\nShuffle.ALL_ITEMS = 'all';\nShuffle.FILTER_ATTRIBUTE_KEY = 'groups';\n\n/**\n * @enum {string}\n */\nShuffle.EventType = {\n LAYOUT: 'shuffle:layout',\n REMOVED: 'shuffle:removed',\n};\n\n/** @enum {string} */\nShuffle.Classes = Classes;\n\n// Overrideable options\nShuffle.options = {\n // Initial filter group.\n group: Shuffle.ALL_ITEMS,\n\n // Transition/animation speed (milliseconds).\n speed: 250,\n\n // CSS easing function to use.\n easing: 'ease',\n\n // e.g. '.picture-item'.\n itemSelector: '*',\n\n // Element or selector string. Use an element to determine the size of columns\n // and gutters.\n sizer: null,\n\n // A static number or function that tells the plugin how wide the gutters\n // between columns are (in pixels).\n gutterWidth: 0,\n\n // A static number or function that returns a number which tells the plugin\n // how wide the columns are (in pixels).\n columnWidth: 0,\n\n // If your group is not json, and is comma delimeted, you could set delimeter\n // to ','.\n delimeter: null,\n\n // Useful for percentage based heights when they might not always be exactly\n // the same (in pixels).\n buffer: 0,\n\n // Reading the width of elements isn't precise enough and can cause columns to\n // jump between values.\n columnThreshold: 0.01,\n\n // Shuffle can be isInitialized with a sort object. It is the same object\n // given to the sort method.\n initialSort: null,\n\n // By default, shuffle will throttle resize events. This can be changed or\n // removed.\n throttle: throttle,\n\n // How often shuffle can be called on resize (in milliseconds).\n throttleTime: 300,\n\n // Transition delay offset for each item in milliseconds.\n staggerAmount: 15,\n\n // Maximum stagger delay in milliseconds.\n staggerAmountMax: 250,\n\n // Whether to use transforms or absolute positioning.\n useTransforms: true,\n};\n\n// Expose for testing.\nShuffle.Point = Point;\nShuffle.ShuffleItem = ShuffleItem;\nShuffle.sorter = sorter;\n\nmodule.exports = Shuffle;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle.js\n **/","// Polyfill for creating CustomEvents on IE9/10/11\n\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\ntry {\n new window.CustomEvent(\"test\");\n} catch(e) {\n var CustomEvent = function(event, params) {\n var evt;\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n\n evt = document.createEvent(\"CustomEvent\");\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/custom-event-polyfill/custom-event-polyfill.js\n ** module id = 1\n ** module chunks = 0\n **/","'use strict';\n\nvar proto = Element.prototype;\nvar vendor = proto.matches\n || proto.matchesSelector\n || proto.webkitMatchesSelector\n || proto.mozMatchesSelector\n || proto.msMatchesSelector\n || proto.oMatchesSelector;\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n if (vendor) return vendor.call(el, selector);\n var nodes = el.parentNode.querySelectorAll(selector);\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i] == el) return true;\n }\n return false;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/matches-selector/index.js\n ** module id = 2\n ** module chunks = 0\n **/","'use strict';\n\n// there's 3 implementations written in increasing order of efficiency\n\n// 1 - no Set type is defined\nfunction uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}\n\n// 2 - a simple Set type is defined\nfunction uniqSet(arr) {\n\tvar seen = new Set();\n\treturn arr.filter(function (el) {\n\t\tif (!seen.has(el)) {\n\t\t\tseen.add(el);\n\t\t\treturn true;\n\t\t}\n\t});\n}\n\n// 3 - a standard Set type is defined and it has a forEach method\nfunction uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}\n\n// V8 currently has a broken implementation\n// https://github.com/joyent/node/issues/8449\nfunction doesForEachActuallyWork() {\n\tvar ret = false;\n\n\t(new Set([true])).forEach(function (el) {\n\t\tret = el;\n\t});\n\n\treturn ret === true;\n}\n\nif ('Set' in global) {\n\tif (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {\n\t\tmodule.exports = uniqSetWithForEach;\n\t} else {\n\t\tmodule.exports = uniqSet;\n\t}\n} else {\n\tmodule.exports = uniqNoSet;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/array-uniq/index.js\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/xtend/immutable.js\n ** module id = 4\n ** module chunks = 0\n **/","module.exports = throttle;\n\n/**\n * Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.\n *\n * @param {Function} func Function to wrap.\n * @param {Number} wait Number of milliseconds that must elapse between `func` invocations.\n * @return {Function} A new function that wraps the `func` function passed in.\n */\n\nfunction throttle (func, wait) {\n var ctx, args, rtn, timeoutID; // caching\n var last = 0;\n\n return function throttled () {\n ctx = this;\n args = arguments;\n var delta = new Date() - last;\n if (!timeoutID)\n if (delta >= wait) call();\n else timeoutID = setTimeout(call, wait - delta);\n return rtn;\n };\n\n function call () {\n timeoutID = 0;\n last = +new Date();\n rtn = func.apply(ctx, args);\n ctx = null;\n args = null;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/throttleit/index.js\n ** module id = 5\n ** module chunks = 0\n **/","'use strict';\n\nimport getNumber from './get-number';\n\n/**\n * Represents a coordinate pair.\n * @param {number} [x=0] X.\n * @param {number} [y=0] Y.\n */\nconst Point = function (x, y) {\n this.x = getNumber(x);\n this.y = getNumber(y);\n};\n\n/**\n * Whether two points are equal.\n * @param {Point} a Point A.\n * @param {Point} b Point B.\n * @return {boolean}\n */\nPoint.equals = function (a, b) {\n return a.x === b.x && a.y === b.y;\n};\n\nexport default Point;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/point.js\n **/","'use strict';\n\n/**\n * Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.\n * @param {*} value Possibly numeric value.\n * @return {number} `value` or zero if `value` isn't numeric.\n */\nexport default function getNumber(value) {\n return parseFloat(value) || 0;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number.js\n **/","import Point from './point';\nimport Classes from './classes';\n\nlet id = 0;\n\nclass ShuffleItem {\n constructor(element) {\n this.id = id++;\n this.element = element;\n this.isVisible = true;\n }\n\n show() {\n this.isVisible = true;\n this.element.classList.remove(Classes.HIDDEN);\n this.element.classList.add(Classes.VISIBLE);\n }\n\n hide() {\n this.isVisible = false;\n this.element.classList.remove(Classes.VISIBLE);\n this.element.classList.add(Classes.HIDDEN);\n }\n\n init() {\n this.addClasses([Classes.SHUFFLE_ITEM, Classes.VISIBLE]);\n this.applyCss(ShuffleItem.Css.INITIAL);\n this.scale = ShuffleItem.Scale.VISIBLE;\n this.point = new Point();\n }\n\n addClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.add(className);\n });\n }\n\n removeClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.remove(className);\n });\n }\n\n applyCss(obj) {\n for (var key in obj) {\n this.element.style[key] = obj[key];\n }\n }\n\n dispose() {\n this.removeClasses([\n Classes.HIDDEN,\n Classes.VISIBLE,\n Classes.SHUFFLE_ITEM,\n ]);\n\n this.element.removeAttribute('style');\n this.element = null;\n }\n}\n\nShuffleItem.Css = {\n INITIAL: {\n position: 'absolute',\n top: 0,\n left: 0,\n visibility: 'visible',\n 'will-change': 'transform',\n },\n VISIBLE: {\n before: {\n opacity: 1,\n visibility: 'visible',\n },\n after: {},\n },\n HIDDEN: {\n before: {\n opacity: 0,\n },\n after: {\n visibility: 'hidden',\n },\n },\n};\n\nShuffleItem.Scale = {\n VISIBLE: 1,\n HIDDEN: 0.001,\n};\n\nexport default ShuffleItem;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle-item.js\n **/","module.exports = {\n BASE: 'shuffle',\n SHUFFLE_ITEM: 'shuffle-item',\n VISIBLE: 'shuffle-item--visible',\n HIDDEN: 'shuffle-item--hidden',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/classes.js\n **/","'use strict';\n\nimport getNumber from './get-number';\nimport COMPUTED_SIZE_INCLUDES_PADDING from './computed-size';\n\n/**\n * Retrieve the computed style for an element, parsed as a float.\n * @param {Element} element Element to get style for.\n * @param {string} style Style property.\n * @param {CSSStyleDeclaration} [styles] Optionally include clean styles to\n * use instead of asking for them again.\n * @return {number} The parsed computed value or zero if that fails because IE\n * will return 'auto' when the element doesn't have margins instead of\n * the computed style.\n */\nexport default function getNumberStyle(element, style,\n styles = window.getComputedStyle(element, null)) {\n var value = getNumber(styles[style]);\n\n // Support IE<=11 and W3C spec.\n if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'width') {\n value += getNumber(styles.paddingLeft) +\n getNumber(styles.paddingRight) +\n getNumber(styles.borderLeftWidth) +\n getNumber(styles.borderRightWidth);\n } else if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'height') {\n value += getNumber(styles.paddingTop) +\n getNumber(styles.paddingBottom) +\n getNumber(styles.borderTopWidth) +\n getNumber(styles.borderBottomWidth);\n }\n\n return value;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number-style.js\n **/","\nlet element = document.body || document.documentElement;\nlet e = document.createElement('div');\ne.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';\nelement.appendChild(e);\n\nlet width = window.getComputedStyle(e, null).width;\nlet ret = width === '10px';\n\nelement.removeChild(e);\n\nexport default ret;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/computed-size.js\n **/","'use strict';\n\nimport xtend from 'xtend';\n\n// http://stackoverflow.com/a/962890/373422\nfunction randomize(array) {\n var tmp;\n var current;\n let top = array.length;\n\n if (!top) {\n return array;\n }\n\n while (--top) {\n current = Math.floor(Math.random() * (top + 1));\n tmp = array[current];\n array[current] = array[top];\n array[top] = tmp;\n }\n\n return array;\n}\n\nlet defaults = {\n // Use array.reverse() to reverse the results\n reverse: false,\n\n // Sorting function\n by: null,\n\n // If true, this will skip the sorting and return a randomized order in the array\n randomize: false,\n\n // Determines which property of each item in the array is passed to the\n // sorting method.\n key: 'element',\n};\n\n// You can return `undefined` from the `by` function to revert to DOM order.\nexport default function sorter(arr, options) {\n let opts = xtend(defaults, options);\n let original = [].slice.call(arr);\n let revert = false;\n\n if (!arr.length) {\n return [];\n }\n\n if (opts.randomize) {\n return randomize(arr);\n }\n\n // Sort the elements by the opts.by function.\n // If we don't have opts.by, default to DOM order\n if (typeof opts.by === 'function') {\n arr.sort(function (a, b) {\n\n // Exit early if we already know we want to revert\n if (revert) {\n return 0;\n }\n\n let valA = opts.by(a[opts.key]);\n let valB = opts.by(b[opts.key]);\n\n // If both values are undefined, use the DOM order\n if (valA === undefined && valB === undefined) {\n revert = true;\n return 0;\n }\n\n if (valA < valB || valA === 'sortFirst' || valB === 'sortLast') {\n return -1;\n }\n\n if (valA > valB || valA === 'sortLast' || valB === 'sortFirst') {\n return 1;\n }\n\n return 0;\n });\n }\n\n // Revert to the original array if necessary\n if (revert) {\n return original;\n }\n\n if (opts.reverse) {\n arr.reverse();\n }\n\n return arr;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/sorter.js\n **/","'use strict';\n\nlet transitions = {};\nlet eventName = 'transitionend';\nlet count = 0;\n\nfunction uniqueId() {\n return eventName + count++;\n}\n\nexport function onTransitionEnd(element, callback) {\n let id = uniqueId();\n let listener = (evt) => {\n if (evt.currentTarget === evt.target) {\n cancelTransitionEnd(id);\n callback(evt);\n }\n };\n\n element.addEventListener(eventName, listener);\n\n transitions[id] = { element, listener };\n\n return id;\n}\n\nexport function cancelTransitionEnd(id) {\n if (transitions[id]) {\n transitions[id].element.removeEventListener(eventName, transitions[id].listener);\n transitions[id] = null;\n return true;\n }\n\n return false;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/on-transition-end.js\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///shuffle.min.js","webpack:///webpack/bootstrap f8ea2016469152328087","webpack:///./src/shuffle.js","webpack:///./~/custom-event-polyfill/custom-event-polyfill.js","webpack:///./~/matches-selector/index.js","webpack:///./~/array-uniq/index.js","webpack:///./~/xtend/immutable.js","webpack:///./~/throttleit/index.js","webpack:///./src/point.js","webpack:///./src/get-number.js","webpack:///./src/shuffle-item.js","webpack:///./src/classes.js","webpack:///./src/get-number-style.js","webpack:///./src/computed-size.js","webpack:///./src/sorter.js","webpack:///./src/on-transition-end.js","webpack:///./src/layout.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","toArray","arrayLike","Array","prototype","slice","arrayMax","array","Math","max","apply","arrayIncludes","arguments","length","indexOf","_createClass","defineProperties","target","props","i","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","_matchesSelector","_matchesSelector2","_arrayUniq","_arrayUniq2","_xtend","_xtend2","_throttleit","_throttleit2","_point","_point2","_shuffleItem","_shuffleItem2","_classes","_classes2","_getNumberStyle","_getNumberStyle2","_sorter","_sorter2","_onTransitionEnd","_layout2","Shuffle","element","options","undefined","useSizer","lastSort","lastFilter","ALL_ITEMS","isEnabled","isDestroyed","isInitialized","_transitions","isTransitioning","_queue","_getElementOption","_init","value","items","_getItems","sizer","classList","add","Classes","BASE","_initItems","_onResize","_getResizeFunction","window","addEventListener","containerCss","getComputedStyle","containerWidth","getSize","width","_validateStyles","_setColumns","filter","group","initialSort","offsetWidth","_setTransitions","style","transition","speed","easing","resizeFunction","_handleResize","bind","throttle","throttleTime","option","querySelector","nodeType","jquery","styles","position","overflow","category","collection","set","_getFilteredSets","_toggleFilterClasses","_this","visible","hidden","forEach","item","_doesPassFilter","push","attr","getAttribute","FILTER_ATTRIBUTE_KEY","groups","JSON","parse","keys","delimeter","isArray","split","some","_ref","show","hide","init","dispose","visibleItems","_getFilteredItems","str","useTransforms","_this2","children","el","itemSelector","map","by","isVisible","gutterSize","size","columnWidth","gutterWidth","gutter","_getGutterSize","_getColumnSize","calculatedColumns","abs","round","columnThreshold","cols","floor","colWidth","height","_getContainerSize","positions","index","min","staggerAmount","staggerAmountMax","name","details","shuffle","dispatchEvent","CustomEvent","bubbles","cancelable","detail","_this3","count","callback","applyCss","Css","VISIBLE","after","currPos","point","currScale","scale","itemSize","pos","_getItemPosition","equals","Scale","before","transitionDelay","_getStaggerAmount","getItemPosition","gridSize","total","threshold","buffer","_this4","_getConcealedItems","HIDDEN","update","_ref2","x","y","transform","left","top","itemCallback","_this5","Promise","resolve","onTransitionEnd","evt","currentTarget","opts","_getStylesForTransition","_whenTransitionDone","_this6","_cancelMovement","immediates","transitions","_styleImmediately","_startTransitions","setTimeout","_dispatchLayout","_this7","promises","_transition","all","then","_movementFinished","cancelTransitionEnd","objects","_this8","elements","_skipTransitions","_dispatch","EventType","LAYOUT","sortObj","_filter","_shrink","_updateItemCount","sort","_resetCols","_layout","_processQueue","_setContainerSize","isOnlyLayout","newItems","concat","_updateItemsOrder","isUpdateLayout","_this9","oldItems","getItemByElement","handleLayout","removeEventListener","_disposeItems","parentNode","removeChild","REMOVED","remove","removeAttribute","includeMargins","marginLeft","marginRight","marginTop","marginBottom","zero","data","duration","transitionDuration","delay","Point","ShuffleItem","sorter","e","event","params","document","createEvent","initCustomEvent","Event","match","selector","vendor","nodes","querySelectorAll","proto","Element","matches","matchesSelector","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","global","uniqNoSet","arr","ret","uniqSet","seen","Set","has","uniqSetWithForEach","doesForEachActuallyWork","extend","source","hasOwnProperty","func","wait","timeoutID","last","Date","rtn","ctx","args","delta","_getNumber","_getNumber2","a","b","getNumber","parseFloat","addClasses","SHUFFLE_ITEM","INITIAL","classes","className","removeClasses","visibility","will-change","opacity","getNumberStyle","_computedSize2","paddingTop","paddingBottom","borderTopWidth","borderBottomWidth","paddingLeft","paddingRight","borderLeftWidth","borderRightWidth","_computedSize","body","documentElement","createElement","cssText","appendChild","randomize","tmp","current","random","defaults","original","revert","valA","valB","reverse","uniqueId","eventName","listener","arrayMin","span","getColumnSpan","setY","getAvailablePositions","shortColumnIndex","getShortColumn","setHeight","itemWidth","columns","columnSpan","ceil","available","minPosition","len"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASL,EAAQD,EAASM,GEtDhC,YFsGC,SAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC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'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"shuffle\"] = factory();\n\telse\n\t\troot[\"shuffle\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"shuffle\"] = factory();\n\telse\n\t\troot[\"shuffle\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\t__webpack_require__(1);\n\t\n\tvar _matchesSelector = __webpack_require__(2);\n\t\n\tvar _matchesSelector2 = _interopRequireDefault(_matchesSelector);\n\t\n\tvar _arrayUniq = __webpack_require__(3);\n\t\n\tvar _arrayUniq2 = _interopRequireDefault(_arrayUniq);\n\t\n\tvar _xtend = __webpack_require__(4);\n\t\n\tvar _xtend2 = _interopRequireDefault(_xtend);\n\t\n\tvar _throttleit = __webpack_require__(5);\n\t\n\tvar _throttleit2 = _interopRequireDefault(_throttleit);\n\t\n\tvar _point = __webpack_require__(6);\n\t\n\tvar _point2 = _interopRequireDefault(_point);\n\t\n\tvar _shuffleItem = __webpack_require__(8);\n\t\n\tvar _shuffleItem2 = _interopRequireDefault(_shuffleItem);\n\t\n\tvar _classes = __webpack_require__(9);\n\t\n\tvar _classes2 = _interopRequireDefault(_classes);\n\t\n\tvar _getNumberStyle = __webpack_require__(10);\n\t\n\tvar _getNumberStyle2 = _interopRequireDefault(_getNumberStyle);\n\t\n\tvar _sorter = __webpack_require__(12);\n\t\n\tvar _sorter2 = _interopRequireDefault(_sorter);\n\t\n\tvar _onTransitionEnd = __webpack_require__(13);\n\t\n\tvar _layout2 = __webpack_require__(14);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction toArray(arrayLike) {\n\t return Array.prototype.slice.call(arrayLike);\n\t}\n\t\n\tfunction arrayMax(array) {\n\t return Math.max.apply(Math, array);\n\t}\n\t\n\tfunction arrayIncludes(array, obj) {\n\t if (arguments.length === 2) {\n\t return arrayIncludes(array)(obj);\n\t }\n\t\n\t return function (obj) {\n\t return array.indexOf(obj) > -1;\n\t };\n\t}\n\t\n\t// Used for unique instance variables\n\tvar id = 0;\n\t\n\tvar Shuffle = function () {\n\t\n\t /**\n\t * Categorize, sort, and filter a responsive grid of items.\n\t *\n\t * @param {Element} element An element which is the parent container for the grid items.\n\t * @param {Object} [options=Shuffle.options] Options object.\n\t * @constructor\n\t */\n\t\n\t function Shuffle(element) {\n\t var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\t\n\t _classCallCheck(this, Shuffle);\n\t\n\t this.options = (0, _xtend2.default)(Shuffle.options, options);\n\t\n\t this.useSizer = false;\n\t this.lastSort = {};\n\t this.lastFilter = Shuffle.ALL_ITEMS;\n\t this.isEnabled = true;\n\t this.isDestroyed = false;\n\t this.isInitialized = false;\n\t this._transitions = [];\n\t this.isTransitioning = false;\n\t this._queue = [];\n\t\n\t element = this._getElementOption(element);\n\t\n\t if (!element) {\n\t throw new TypeError('Shuffle needs to be initialized with an element.');\n\t }\n\t\n\t this.element = element;\n\t this.id = 'shuffle_' + id++;\n\t\n\t this._init();\n\t this.isInitialized = true;\n\t }\n\t\n\t _createClass(Shuffle, [{\n\t key: '_init',\n\t value: function _init() {\n\t this.items = this._getItems();\n\t\n\t this.options.sizer = this._getElementOption(this.options.sizer);\n\t\n\t if (this.options.sizer) {\n\t this.useSizer = true;\n\t }\n\t\n\t // Add class and invalidate styles\n\t this.element.classList.add(Shuffle.Classes.BASE);\n\t\n\t // Set initial css for each item\n\t this._initItems();\n\t\n\t // Bind resize events\n\t this._onResize = this._getResizeFunction();\n\t window.addEventListener('resize', this._onResize);\n\t\n\t // Get container css all in one request. Causes reflow\n\t var containerCss = window.getComputedStyle(this.element, null);\n\t var containerWidth = Shuffle.getSize(this.element).width;\n\t\n\t // Add styles to the container if it doesn't have them.\n\t this._validateStyles(containerCss);\n\t\n\t // We already got the container's width above, no need to cause another\n\t // reflow getting it again... Calculate the number of columns there will be\n\t this._setColumns(containerWidth);\n\t\n\t // Kick off!\n\t this.filter(this.options.group, this.options.initialSort);\n\t\n\t // The shuffle items haven't had transitions set on them yet so the user\n\t // doesn't see the first layout. Set them now that the first layout is done.\n\t // First, however, a synchronous layout must be caused for the previous\n\t // styles to be applied without transitions.\n\t this.element.offsetWidth; // jshint ignore: line\n\t this._setTransitions();\n\t this.element.style.transition = 'height ' + this.options.speed + 'ms ' + this.options.easing;\n\t }\n\t\n\t /**\n\t * Returns a throttled and proxied function for the resize handler.\n\t * @return {Function}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getResizeFunction',\n\t value: function _getResizeFunction() {\n\t var resizeFunction = this._handleResize.bind(this);\n\t return this.options.throttle ? this.options.throttle(resizeFunction, this.options.throttleTime) : resizeFunction;\n\t }\n\t\n\t /**\n\t * Retrieve an element from an option.\n\t * @param {string|jQuery|Element} option The option to check.\n\t * @return {?Element} The plain element or null.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getElementOption',\n\t value: function _getElementOption(option) {\n\t // If column width is a string, treat is as a selector and search for the\n\t // sizer element within the outermost container\n\t if (typeof option === 'string') {\n\t return this.element.querySelector(option);\n\t\n\t // Check for an element\n\t } else if (option && option.nodeType && option.nodeType === 1) {\n\t return option;\n\t\n\t // Check for jQuery object\n\t } else if (option && option.jquery) {\n\t return option[0];\n\t }\n\t\n\t return null;\n\t }\n\t\n\t /**\n\t * Ensures the shuffle container has the css styles it needs applied to it.\n\t * @param {Object} styles Key value pairs for position and overflow.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_validateStyles',\n\t value: function _validateStyles(styles) {\n\t // Position cannot be static.\n\t if (styles.position === 'static') {\n\t this.element.style.position = 'relative';\n\t }\n\t\n\t // Overflow has to be hidden.\n\t if (styles.overflow !== 'hidden') {\n\t this.element.style.overflow = 'hidden';\n\t }\n\t }\n\t\n\t /**\n\t * Filter the elements by a category.\n\t * @param {string} [category] Category to filter by. If it's given, the last\n\t * category will be used to filter the items.\n\t * @param {Array} [collection] Optionally filter a collection. Defaults to\n\t * all the items.\n\t * @return {!{visible: Array, hidden: Array}}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_filter',\n\t value: function _filter() {\n\t var category = arguments.length <= 0 || arguments[0] === undefined ? this.lastFilter : arguments[0];\n\t var collection = arguments.length <= 1 || arguments[1] === undefined ? this.items : arguments[1];\n\t\n\t var set = this._getFilteredSets(category, collection);\n\t\n\t // Individually add/remove hidden/visible classes\n\t this._toggleFilterClasses(set);\n\t\n\t // Save the last filter in case elements are appended.\n\t this.lastFilter = category;\n\t\n\t // This is saved mainly because providing a filter function (like searching)\n\t // will overwrite the `lastFilter` property every time its called.\n\t if (typeof category === 'string') {\n\t this.options.group = category;\n\t }\n\t\n\t return set;\n\t }\n\t\n\t /**\n\t * Returns an object containing the visible and hidden elements.\n\t * @param {string|Function} category Category or function to filter by.\n\t * @param {Array.} items A collection of items to filter.\n\t * @return {!{visible: Array, hidden: Array}}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getFilteredSets',\n\t value: function _getFilteredSets(category, items) {\n\t var _this = this;\n\t\n\t var visible = [];\n\t var hidden = [];\n\t\n\t // category === 'all', add visible class to everything\n\t if (category === Shuffle.ALL_ITEMS) {\n\t visible = items;\n\t\n\t // Loop through each item and use provided function to determine\n\t // whether to hide it or not.\n\t } else {\n\t items.forEach(function (item) {\n\t if (_this._doesPassFilter(category, item.element)) {\n\t visible.push(item);\n\t } else {\n\t hidden.push(item);\n\t }\n\t });\n\t }\n\t\n\t return {\n\t visible: visible,\n\t hidden: hidden\n\t };\n\t }\n\t\n\t /**\n\t * Test an item to see if it passes a category.\n\t * @param {string|Function} category Category or function to filter by.\n\t * @param {Element} element An element to test.\n\t * @return {boolean} Whether it passes the category/filter.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_doesPassFilter',\n\t value: function _doesPassFilter(category, element) {\n\t\n\t if (typeof category === 'function') {\n\t return category.call(element, element, this);\n\t\n\t // Check each element's data-groups attribute against the given category.\n\t } else {\n\t var attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);\n\t var groups = JSON.parse(attr);\n\t var keys = this.delimeter && !Array.isArray(groups) ? groups.split(this.delimeter) : groups;\n\t\n\t if (Array.isArray(category)) {\n\t return category.some(arrayIncludes(keys));\n\t }\n\t\n\t return arrayIncludes(keys, category);\n\t }\n\t }\n\t\n\t /**\n\t * Toggles the visible and hidden class names.\n\t * @param {{visible, hidden}} Object with visible and hidden arrays.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_toggleFilterClasses',\n\t value: function _toggleFilterClasses(_ref) {\n\t var visible = _ref.visible;\n\t var hidden = _ref.hidden;\n\t\n\t visible.forEach(function (item) {\n\t item.show();\n\t });\n\t\n\t hidden.forEach(function (item) {\n\t item.hide();\n\t });\n\t }\n\t\n\t /**\n\t * Set the initial css for each item\n\t * @param {Array.} [items] Optionally specifiy at set to initialize.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_initItems',\n\t value: function _initItems() {\n\t var items = arguments.length <= 0 || arguments[0] === undefined ? this.items : arguments[0];\n\t\n\t items.forEach(function (item) {\n\t item.init();\n\t });\n\t }\n\t\n\t /**\n\t * Remove element reference and styles.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_disposeItems',\n\t value: function _disposeItems() {\n\t var items = arguments.length <= 0 || arguments[0] === undefined ? this.items : arguments[0];\n\t\n\t items.forEach(function (item) {\n\t item.dispose();\n\t });\n\t }\n\t\n\t /**\n\t * Updates the visible item count.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_updateItemCount',\n\t value: function _updateItemCount() {\n\t this.visibleItems = this._getFilteredItems().length;\n\t }\n\t\n\t /**\n\t * Sets css transform transition on a group of elements. This is not executed\n\t * at the same time as `item.init` so that transitions don't occur upon\n\t * initialization of Shuffle.\n\t * @param {Array.} items Shuffle items to set transitions on.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_setTransitions',\n\t value: function _setTransitions() {\n\t var items = arguments.length <= 0 || arguments[0] === undefined ? this.items : arguments[0];\n\t\n\t var speed = this.options.speed;\n\t var easing = this.options.easing;\n\t\n\t var str;\n\t if (this.options.useTransforms) {\n\t str = 'transform ' + speed + 'ms ' + easing + ', opacity ' + speed + 'ms ' + easing;\n\t } else {\n\t str = 'top ' + speed + 'ms ' + easing + ', left ' + speed + 'ms ' + easing + ', opacity ' + speed + 'ms ' + easing;\n\t }\n\t\n\t items.forEach(function (item) {\n\t item.element.style.transition = str;\n\t });\n\t }\n\t }, {\n\t key: '_getItems',\n\t value: function _getItems() {\n\t var _this2 = this;\n\t\n\t return toArray(this.element.children).filter(function (el) {\n\t return (0, _matchesSelector2.default)(el, _this2.options.itemSelector);\n\t }).map(function (el) {\n\t return new _shuffleItem2.default(el);\n\t });\n\t }\n\t\n\t /**\n\t * When new elements are added to the shuffle container, update the array of\n\t * items because that is the order `_layout` calls them.\n\t */\n\t\n\t }, {\n\t key: '_updateItemsOrder',\n\t value: function _updateItemsOrder() {\n\t var children = this.element.children;\n\t this.items = (0, _sorter2.default)(this.items, {\n\t by: function by(element) {\n\t return Array.prototype.indexOf.call(children, element);\n\t }\n\t });\n\t }\n\t }, {\n\t key: '_getFilteredItems',\n\t value: function _getFilteredItems() {\n\t return this.items.filter(function (item) {\n\t return item.isVisible;\n\t });\n\t }\n\t }, {\n\t key: '_getConcealedItems',\n\t value: function _getConcealedItems() {\n\t return this.items.filter(function (item) {\n\t return !item.isVisible;\n\t });\n\t }\n\t\n\t /**\n\t * Returns the column size, based on column width and sizer options.\n\t * @param {number} containerWidth Size of the parent container.\n\t * @param {number} gutterSize Size of the gutters.\n\t * @return {number}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getColumnSize',\n\t value: function _getColumnSize(containerWidth, gutterSize) {\n\t var size;\n\t\n\t // If the columnWidth property is a function, then the grid is fluid\n\t if (typeof this.options.columnWidth === 'function') {\n\t size = this.options.columnWidth(containerWidth);\n\t\n\t // columnWidth option isn't a function, are they using a sizing element?\n\t } else if (this.useSizer) {\n\t size = Shuffle.getSize(this.options.sizer).width;\n\t\n\t // if not, how about the explicitly set option?\n\t } else if (this.options.columnWidth) {\n\t size = this.options.columnWidth;\n\t\n\t // or use the size of the first item\n\t } else if (this.items.length > 0) {\n\t size = Shuffle.getSize(this.items[0].element, true).width;\n\t\n\t // if there's no items, use size of container\n\t } else {\n\t size = containerWidth;\n\t }\n\t\n\t // Don't let them set a column width of zero.\n\t if (size === 0) {\n\t size = containerWidth;\n\t }\n\t\n\t return size + gutterSize;\n\t }\n\t\n\t /**\n\t * Returns the gutter size, based on gutter width and sizer options.\n\t * @param {number} containerWidth Size of the parent container.\n\t * @return {number}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getGutterSize',\n\t value: function _getGutterSize(containerWidth) {\n\t var size;\n\t if (typeof this.options.gutterWidth === 'function') {\n\t size = this.options.gutterWidth(containerWidth);\n\t } else if (this.useSizer) {\n\t size = (0, _getNumberStyle2.default)(this.options.sizer, 'marginLeft');\n\t } else {\n\t size = this.options.gutterWidth;\n\t }\n\t\n\t return size;\n\t }\n\t\n\t /**\n\t * Calculate the number of columns to be used. Gets css if using sizer element.\n\t * @param {number} [containerWidth] Optionally specify a container width if\n\t * it's already available.\n\t */\n\t\n\t }, {\n\t key: '_setColumns',\n\t value: function _setColumns() {\n\t var containerWidth = arguments.length <= 0 || arguments[0] === undefined ? Shuffle.getSize(this.element).width : arguments[0];\n\t\n\t var gutter = this._getGutterSize(containerWidth);\n\t var columnWidth = this._getColumnSize(containerWidth, gutter);\n\t var calculatedColumns = (containerWidth + gutter) / columnWidth;\n\t\n\t // Widths given from getStyles are not precise enough...\n\t if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) < this.options.columnThreshold) {\n\t // e.g. calculatedColumns = 11.998876\n\t calculatedColumns = Math.round(calculatedColumns);\n\t }\n\t\n\t this.cols = Math.max(Math.floor(calculatedColumns), 1);\n\t this.containerWidth = containerWidth;\n\t this.colWidth = columnWidth;\n\t }\n\t\n\t /**\n\t * Adjust the height of the grid\n\t */\n\t\n\t }, {\n\t key: '_setContainerSize',\n\t value: function _setContainerSize() {\n\t this.element.style.height = this._getContainerSize() + 'px';\n\t }\n\t\n\t /**\n\t * Based on the column heights, it returns the biggest one.\n\t * @return {number}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getContainerSize',\n\t value: function _getContainerSize() {\n\t return arrayMax(this.positions);\n\t }\n\t\n\t /**\n\t * Get the clamped stagger amount.\n\t * @param {number} index Index of the item to be staggered.\n\t * @return {number}\n\t */\n\t\n\t }, {\n\t key: '_getStaggerAmount',\n\t value: function _getStaggerAmount(index) {\n\t return Math.min(index * this.options.staggerAmount, this.options.staggerAmountMax);\n\t }\n\t\n\t /**\n\t * @return {boolean} Whether the event was prevented or not.\n\t */\n\t\n\t }, {\n\t key: '_dispatch',\n\t value: function _dispatch(name) {\n\t var details = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\t\n\t if (this.isDestroyed) {\n\t return;\n\t }\n\t\n\t details.shuffle = this;\n\t return !this.element.dispatchEvent(new CustomEvent(name, {\n\t bubbles: true,\n\t cancelable: false,\n\t detail: details\n\t }));\n\t }\n\t\n\t /**\n\t * Zeros out the y columns array, which is used to determine item placement.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_resetCols',\n\t value: function _resetCols() {\n\t var i = this.cols;\n\t this.positions = [];\n\t while (i--) {\n\t this.positions.push(0);\n\t }\n\t }\n\t\n\t /**\n\t * Loops through each item that should be shown and calculates the x, y position.\n\t * @param {Array.} items Array of items that will be shown/layed\n\t * out in order in their array.\n\t */\n\t\n\t }, {\n\t key: '_layout',\n\t value: function _layout(items) {\n\t var _this3 = this;\n\t\n\t var count = 0;\n\t items.forEach(function (item) {\n\t var currPos = item.point;\n\t var currScale = item.scale;\n\t var itemSize = Shuffle.getSize(item.element, true);\n\t var pos = _this3._getItemPosition(itemSize);\n\t\n\t function callback() {\n\t item.applyCss(_shuffleItem2.default.Css.VISIBLE.after);\n\t }\n\t\n\t // If the item will not change its position, do not add it to the render\n\t // queue. Transitions don't fire when setting a property to the same value.\n\t if (_point2.default.equals(currPos, pos) && currScale === _shuffleItem2.default.Scale.VISIBLE) {\n\t callback();\n\t return;\n\t }\n\t\n\t item.point = pos;\n\t item.scale = _shuffleItem2.default.Scale.VISIBLE;\n\t\n\t var styles = _shuffleItem2.default.Css.VISIBLE.before;\n\t styles.transitionDelay = _this3._getStaggerAmount(count);\n\t\n\t _this3._queue.push({\n\t item: item,\n\t styles: styles,\n\t callback: callback\n\t });\n\t\n\t count++;\n\t });\n\t }\n\t\n\t /**\n\t * Determine the location of the next item, based on its size.\n\t * @param {{width: number, height: number}} itemSize Object with width and height.\n\t * @return {Point}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getItemPosition',\n\t value: function _getItemPosition(itemSize) {\n\t return (0, _layout2.getItemPosition)({\n\t itemSize: itemSize,\n\t positions: this.positions,\n\t gridSize: this.colWidth,\n\t total: this.cols,\n\t threshold: this.options.columnThreshold,\n\t buffer: this.options.buffer\n\t });\n\t }\n\t\n\t /**\n\t * Hides the elements that don't match our filter.\n\t * @param {Array.} collection Collection to shrink.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_shrink',\n\t value: function _shrink() {\n\t var _this4 = this;\n\t\n\t var collection = arguments.length <= 0 || arguments[0] === undefined ? this._getConcealedItems() : arguments[0];\n\t\n\t var count = 0;\n\t collection.forEach(function (item) {\n\t function callback() {\n\t item.applyCss(_shuffleItem2.default.Css.HIDDEN.after);\n\t }\n\t\n\t // Continuing would add a transitionend event listener to the element, but\n\t // that listener would not execute because the transform and opacity would\n\t // stay the same.\n\t // The callback is executed here because it is not guaranteed to be called\n\t // after the transitionend event because the transitionend could be\n\t // canceled if another animation starts.\n\t if (item.scale === _shuffleItem2.default.Scale.HIDDEN) {\n\t callback();\n\t return;\n\t }\n\t\n\t item.scale = _shuffleItem2.default.Scale.HIDDEN;\n\t\n\t var styles = _shuffleItem2.default.Css.HIDDEN.before;\n\t styles.transitionDelay = _this4._getStaggerAmount(count);\n\t\n\t _this4._queue.push({\n\t item: item,\n\t styles: styles,\n\t callback: callback\n\t });\n\t\n\t count++;\n\t });\n\t }\n\t\n\t /**\n\t * Resize handler.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_handleResize',\n\t value: function _handleResize() {\n\t // If shuffle is disabled, destroyed, don't do anything\n\t if (!this.isEnabled || this.isDestroyed) {\n\t return;\n\t }\n\t\n\t // Will need to check height in the future if it's layed out horizontaly\n\t var containerWidth = Shuffle.getSize(this.element).width;\n\t\n\t // containerWidth hasn't changed, don't do anything\n\t if (containerWidth === this.containerWidth) {\n\t return;\n\t }\n\t\n\t this.update();\n\t }\n\t\n\t /**\n\t * Returns styles which will be applied to the an item for a transition.\n\t * @param {Object} obj Transition options.\n\t * @return {!Object} Transforms for transitions, left/top for animate.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_getStylesForTransition',\n\t value: function _getStylesForTransition(_ref2) {\n\t var item = _ref2.item;\n\t var styles = _ref2.styles;\n\t\n\t if (!styles.transitionDelay) {\n\t styles.transitionDelay = '0ms';\n\t }\n\t\n\t var x = item.point.x;\n\t var y = item.point.y;\n\t\n\t if (this.options.useTransforms) {\n\t styles.transform = 'translate(' + x + 'px, ' + y + 'px) scale(' + item.scale + ')';\n\t } else {\n\t styles.left = x + 'px';\n\t styles.top = y + 'px';\n\t }\n\t\n\t return styles;\n\t }\n\t }, {\n\t key: '_whenTransitionDone',\n\t value: function _whenTransitionDone(element, itemCallback) {\n\t var _this5 = this;\n\t\n\t // TODO what happens when the transition is canceled and the promise never resolves?\n\t return new Promise(function (resolve) {\n\t var id = (0, _onTransitionEnd.onTransitionEnd)(element, function (evt) {\n\t evt.currentTarget.style.transitionDelay = '';\n\t itemCallback();\n\t resolve();\n\t });\n\t _this5._transitions.push(id);\n\t });\n\t }\n\t }, {\n\t key: '_transition',\n\t value: function _transition(opts) {\n\t opts.item.applyCss(this._getStylesForTransition(opts));\n\t return this._whenTransitionDone(opts.item.element, opts.callback);\n\t }\n\t\n\t /**\n\t * Execute the styles gathered in the style queue. This applies styles to elements,\n\t * triggering transitions.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_processQueue',\n\t value: function _processQueue() {\n\t var _this6 = this;\n\t\n\t if (this.isTransitioning) {\n\t this._cancelMovement();\n\t }\n\t\n\t // Iterate over the queue and keep track of ones that use transitions.\n\t var immediates = [];\n\t var transitions = [];\n\t this._queue.forEach(function (obj) {\n\t if (!_this6.isInitialized || _this6.options.speed === 0) {\n\t immediates.push(obj);\n\t } else {\n\t transitions.push(obj);\n\t }\n\t });\n\t\n\t this._styleImmediately(immediates);\n\t\n\t if (transitions.length > 0 && this.options.speed > 0) {\n\t this._startTransitions(transitions);\n\t\n\t // A call to layout happened, but none of the newly visible items will\n\t // change position. Asynchronously fire the callback here.\n\t } else {\n\t setTimeout(this._dispatchLayout.bind(this), 0);\n\t }\n\t\n\t // Remove everything in the style queue\n\t this._queue.length = 0;\n\t }\n\t\n\t /**\n\t * Create a promise for each transition and wait for all of them to complete,\n\t * then emit the layout event.\n\t * @param {Array.} transitions Array of transition objects.\n\t */\n\t\n\t }, {\n\t key: '_startTransitions',\n\t value: function _startTransitions(transitions) {\n\t var _this7 = this;\n\t\n\t // Set flag that shuffle is currently in motion.\n\t this.isTransitioning = true;\n\t\n\t var promises = transitions.map(function (obj) {\n\t return _this7._transition(obj);\n\t });\n\t Promise.all(promises).then(this._movementFinished.bind(this));\n\t }\n\t }, {\n\t key: '_cancelMovement',\n\t value: function _cancelMovement() {\n\t // Remove the transition end event for each listener.\n\t this._transitions.forEach(_onTransitionEnd.cancelTransitionEnd);\n\t\n\t // Reset the array.\n\t this._transitions.length = 0;\n\t\n\t // Show it's no longer active.\n\t this.isTransitioning = false;\n\t }\n\t\n\t /**\n\t * Apply styles without a transition.\n\t * @param {Array.} objects Array of transition objects.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_styleImmediately',\n\t value: function _styleImmediately(objects) {\n\t var _this8 = this;\n\t\n\t if (objects.length) {\n\t var elements = objects.map(function (obj) {\n\t return obj.item.element;\n\t });\n\t\n\t Shuffle._skipTransitions(elements, function () {\n\t objects.forEach(function (obj) {\n\t obj.item.applyCss(_this8._getStylesForTransition(obj));\n\t obj.callback();\n\t });\n\t });\n\t }\n\t }\n\t }, {\n\t key: '_movementFinished',\n\t value: function _movementFinished() {\n\t this._transitions.length = 0;\n\t this.isTransitioning = false;\n\t this._dispatchLayout();\n\t }\n\t }, {\n\t key: '_dispatchLayout',\n\t value: function _dispatchLayout() {\n\t this._dispatch(Shuffle.EventType.LAYOUT);\n\t }\n\t\n\t /**\n\t * The magic. This is what makes the plugin 'shuffle'\n\t * @param {string|Function|Array.} [category] Category to filter by.\n\t * Can be a function, string, or array of strings.\n\t * @param {Object} [sortObj] A sort object which can sort the visible set\n\t */\n\t\n\t }, {\n\t key: 'filter',\n\t value: function filter(category, sortObj) {\n\t if (!this.isEnabled) {\n\t return;\n\t }\n\t\n\t if (!category || category && category.length === 0) {\n\t category = Shuffle.ALL_ITEMS;\n\t }\n\t\n\t this._filter(category);\n\t\n\t // Shrink each hidden item\n\t this._shrink();\n\t\n\t // How many visible elements?\n\t this._updateItemCount();\n\t\n\t // Update transforms on visible elements so they will animate to their new positions.\n\t this.sort(sortObj);\n\t }\n\t\n\t /**\n\t * Gets the visible elements, sorts them, and passes them to layout.\n\t * @param {Object} opts the options object for the sorted plugin\n\t */\n\t\n\t }, {\n\t key: 'sort',\n\t value: function sort() {\n\t var opts = arguments.length <= 0 || arguments[0] === undefined ? this.lastSort : arguments[0];\n\t\n\t if (!this.isEnabled) {\n\t return;\n\t }\n\t\n\t this._resetCols();\n\t\n\t var items = this._getFilteredItems();\n\t items = (0, _sorter2.default)(items, opts);\n\t\n\t this._layout(items);\n\t\n\t // `_layout` always happens after `_shrink`, so it's safe to process the style\n\t // queue here with styles from the shrink method.\n\t this._processQueue();\n\t\n\t // Adjust the height of the container.\n\t this._setContainerSize();\n\t\n\t this.lastSort = opts;\n\t }\n\t\n\t /**\n\t * Reposition everything.\n\t * @param {boolean} isOnlyLayout If true, column and gutter widths won't be\n\t * recalculated.\n\t */\n\t\n\t }, {\n\t key: 'update',\n\t value: function update(isOnlyLayout) {\n\t if (this.isEnabled) {\n\t\n\t if (!isOnlyLayout) {\n\t // Get updated colCount\n\t this._setColumns();\n\t }\n\t\n\t // Layout items\n\t this.sort();\n\t }\n\t }\n\t\n\t /**\n\t * Use this instead of `update()` if you don't need the columns and gutters updated\n\t * Maybe an image inside `shuffle` loaded (and now has a height), which means calculations\n\t * could be off.\n\t */\n\t\n\t }, {\n\t key: 'layout',\n\t value: function layout() {\n\t this.update(true);\n\t }\n\t\n\t /**\n\t * New items have been appended to shuffle. Mix them in with the current\n\t * filter or sort status.\n\t * @param {Array.} newItems Collection of new items.\n\t */\n\t\n\t }, {\n\t key: 'add',\n\t value: function add(newItems) {\n\t newItems = (0, _arrayUniq2.default)(newItems).map(function (el) {\n\t return new _shuffleItem2.default(el);\n\t });\n\t\n\t // Add classes and set initial positions.\n\t this._initItems(newItems);\n\t\n\t // Add transition to each item.\n\t this._setTransitions(newItems);\n\t\n\t // Update the list of items.\n\t this.items = this.items.concat(newItems);\n\t this._updateItemsOrder();\n\t this.filter(this.lastFilter);\n\t }\n\t\n\t /**\n\t * Disables shuffle from updating dimensions and layout on resize\n\t */\n\t\n\t }, {\n\t key: 'disable',\n\t value: function disable() {\n\t this.isEnabled = false;\n\t }\n\t\n\t /**\n\t * Enables shuffle again\n\t * @param {boolean} [isUpdateLayout=true] if undefined, shuffle will update columns and gutters\n\t */\n\t\n\t }, {\n\t key: 'enable',\n\t value: function enable(isUpdateLayout) {\n\t this.isEnabled = true;\n\t if (isUpdateLayout !== false) {\n\t this.update();\n\t }\n\t }\n\t\n\t /**\n\t * Remove 1 or more shuffle items\n\t * @param {Array.} collection An array containing one or more\n\t * elements in shuffle\n\t * @return {Shuffle} The shuffle object\n\t */\n\t\n\t }, {\n\t key: 'remove',\n\t value: function remove(collection) {\n\t var _this9 = this;\n\t\n\t if (!collection.length) {\n\t return;\n\t }\n\t\n\t collection = (0, _arrayUniq2.default)(collection);\n\t\n\t var oldItems = collection.map(function (element) {\n\t return _this9.getItemByElement(element);\n\t }).filter(function (item) {\n\t return !!item;\n\t });\n\t\n\t var handleLayout = function handleLayout() {\n\t _this9.element.removeEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n\t _this9._disposeItems(oldItems);\n\t\n\t // Remove the collection in the callback\n\t collection.forEach(function (element) {\n\t element.parentNode.removeChild(element);\n\t });\n\t\n\t _this9._dispatch(Shuffle.EventType.REMOVED, { collection: collection });\n\t\n\t // Let it get garbage collected\n\t collection = null;\n\t oldItems = null;\n\t };\n\t\n\t // Hide collection first.\n\t this._toggleFilterClasses({\n\t visible: [],\n\t hidden: oldItems\n\t });\n\t\n\t this._shrink(oldItems);\n\t\n\t this.sort();\n\t\n\t // Update the list of items here because `remove` could be called again\n\t // with an item that is in the process of being removed.\n\t this.items = this.items.filter(function (item) {\n\t return !arrayIncludes(oldItems, item);\n\t });\n\t this._updateItemCount();\n\t\n\t this.element.addEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n\t }\n\t\n\t /**\n\t * Retrieve a shuffle item by its element.\n\t * @param {Element} element Element to look for.\n\t * @return {?ShuffleItem} A shuffle item or null if it's not found.\n\t */\n\t\n\t }, {\n\t key: 'getItemByElement',\n\t value: function getItemByElement(element) {\n\t for (var i = this.items.length - 1; i >= 0; i--) {\n\t if (this.items[i].element === element) {\n\t return this.items[i];\n\t }\n\t }\n\t\n\t return null;\n\t }\n\t\n\t /**\n\t * Destroys shuffle, removes events, styles, and classes\n\t */\n\t\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._cancelMovement();\n\t window.removeEventListener('resize', this._onResize);\n\t\n\t // Reset container styles\n\t this.element.classList.remove('shuffle');\n\t this.element.removeAttribute('style');\n\t\n\t // Reset individual item styles\n\t this._disposeItems();\n\t\n\t // Null DOM references\n\t this.items = null;\n\t this.options.sizer = null;\n\t this.element = null;\n\t this._transitions = null;\n\t\n\t // Set a flag so if a debounced resize has been triggered,\n\t // it can first check if it is actually isDestroyed and not doing anything\n\t this.isDestroyed = true;\n\t }\n\t\n\t /**\n\t * Returns the outer width of an element, optionally including its margins.\n\t *\n\t * There are a few different methods for getting the width of an element, none of\n\t * which work perfectly for all Shuffle's use cases.\n\t *\n\t * 1. getBoundingClientRect() `left` and `right` properties.\n\t * - Accounts for transform scaled elements, making it useless for Shuffle\n\t * elements which have shrunk.\n\t * 2. The `offsetWidth` property.\n\t * - This value stays the same regardless of the elements transform property,\n\t * however, it does not return subpixel values.\n\t * 3. getComputedStyle()\n\t * - This works great Chrome, Firefox, Safari, but IE<=11 does not include\n\t * padding and border when box-sizing: border-box is set, requiring a feature\n\t * test and extra work to add the padding back for IE and other browsers which\n\t * follow the W3C spec here.\n\t *\n\t * @param {Element} element The element.\n\t * @param {boolean} [includeMargins] Whether to include margins. Default is false.\n\t * @return {{width: number, height: number}} The width and height.\n\t */\n\t\n\t }], [{\n\t key: 'getSize',\n\t value: function getSize(element, includeMargins) {\n\t // Store the styles so that they can be used by others without asking for it again.\n\t var styles = window.getComputedStyle(element, null);\n\t var width = (0, _getNumberStyle2.default)(element, 'width', styles);\n\t var height = (0, _getNumberStyle2.default)(element, 'height', styles);\n\t\n\t if (includeMargins) {\n\t var marginLeft = (0, _getNumberStyle2.default)(element, 'marginLeft', styles);\n\t var marginRight = (0, _getNumberStyle2.default)(element, 'marginRight', styles);\n\t var marginTop = (0, _getNumberStyle2.default)(element, 'marginTop', styles);\n\t var marginBottom = (0, _getNumberStyle2.default)(element, 'marginBottom', styles);\n\t width += marginLeft + marginRight;\n\t height += marginTop + marginBottom;\n\t }\n\t\n\t return {\n\t width: width,\n\t height: height\n\t };\n\t }\n\t\n\t /**\n\t * Change a property or execute a function which will not have a transition\n\t * @param {Array.} elements DOM elements that won't be transitioned.\n\t * @param {Function} callback A function which will be called while transition\n\t * is set to 0ms.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: '_skipTransitions',\n\t value: function _skipTransitions(elements, callback) {\n\t var zero = '0ms';\n\t\n\t // Save current duration and delay.\n\t var data = elements.map(function (element) {\n\t var style = element.style;\n\t var duration = style.transitionDuration;\n\t var delay = style.transitionDelay;\n\t\n\t // Set the duration to zero so it happens immediately\n\t style.transitionDuration = zero;\n\t style.transitionDelay = zero;\n\t\n\t return {\n\t duration: duration,\n\t delay: delay\n\t };\n\t });\n\t\n\t callback();\n\t\n\t // Cause reflow.\n\t elements[0].offsetWidth; // jshint ignore:line\n\t\n\t // Put the duration back\n\t elements.forEach(function (element, i) {\n\t element.style.transitionDuration = data[i].duration;\n\t element.style.transitionDelay = data[i].delay;\n\t });\n\t }\n\t }]);\n\t\n\t return Shuffle;\n\t}();\n\t\n\tShuffle.ALL_ITEMS = 'all';\n\tShuffle.FILTER_ATTRIBUTE_KEY = 'groups';\n\t\n\t/**\n\t * @enum {string}\n\t */\n\tShuffle.EventType = {\n\t LAYOUT: 'shuffle:layout',\n\t REMOVED: 'shuffle:removed'\n\t};\n\t\n\t/** @enum {string} */\n\tShuffle.Classes = _classes2.default;\n\t\n\t// Overrideable options\n\tShuffle.options = {\n\t // Initial filter group.\n\t group: Shuffle.ALL_ITEMS,\n\t\n\t // Transition/animation speed (milliseconds).\n\t speed: 250,\n\t\n\t // CSS easing function to use.\n\t easing: 'ease',\n\t\n\t // e.g. '.picture-item'.\n\t itemSelector: '*',\n\t\n\t // Element or selector string. Use an element to determine the size of columns\n\t // and gutters.\n\t sizer: null,\n\t\n\t // A static number or function that tells the plugin how wide the gutters\n\t // between columns are (in pixels).\n\t gutterWidth: 0,\n\t\n\t // A static number or function that returns a number which tells the plugin\n\t // how wide the columns are (in pixels).\n\t columnWidth: 0,\n\t\n\t // If your group is not json, and is comma delimeted, you could set delimeter\n\t // to ','.\n\t delimeter: null,\n\t\n\t // Useful for percentage based heights when they might not always be exactly\n\t // the same (in pixels).\n\t buffer: 0,\n\t\n\t // Reading the width of elements isn't precise enough and can cause columns to\n\t // jump between values.\n\t columnThreshold: 0.01,\n\t\n\t // Shuffle can be isInitialized with a sort object. It is the same object\n\t // given to the sort method.\n\t initialSort: null,\n\t\n\t // By default, shuffle will throttle resize events. This can be changed or\n\t // removed.\n\t throttle: _throttleit2.default,\n\t\n\t // How often shuffle can be called on resize (in milliseconds).\n\t throttleTime: 300,\n\t\n\t // Transition delay offset for each item in milliseconds.\n\t staggerAmount: 15,\n\t\n\t // Maximum stagger delay in milliseconds.\n\t staggerAmountMax: 250,\n\t\n\t // Whether to use transforms or absolute positioning.\n\t useTransforms: true\n\t};\n\t\n\t// Expose for testing.\n\tShuffle.Point = _point2.default;\n\tShuffle.ShuffleItem = _shuffleItem2.default;\n\tShuffle.sorter = _sorter2.default;\n\t\n\tmodule.exports = Shuffle;\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t// Polyfill for creating CustomEvents on IE9/10/11\n\t\n\t// code pulled from:\n\t// https://github.com/d4tocchini/customevent-polyfill\n\t// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\t\n\ttry {\n\t new window.CustomEvent(\"test\");\n\t} catch(e) {\n\t var CustomEvent = function(event, params) {\n\t var evt;\n\t params = params || {\n\t bubbles: false,\n\t cancelable: false,\n\t detail: undefined\n\t };\n\t\n\t evt = document.createEvent(\"CustomEvent\");\n\t evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t return evt;\n\t };\n\t\n\t CustomEvent.prototype = window.Event.prototype;\n\t window.CustomEvent = CustomEvent; // expose definition to window\n\t}\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tvar proto = Element.prototype;\n\tvar vendor = proto.matches\n\t || proto.matchesSelector\n\t || proto.webkitMatchesSelector\n\t || proto.mozMatchesSelector\n\t || proto.msMatchesSelector\n\t || proto.oMatchesSelector;\n\t\n\tmodule.exports = match;\n\t\n\t/**\n\t * Match `el` to `selector`.\n\t *\n\t * @param {Element} el\n\t * @param {String} selector\n\t * @return {Boolean}\n\t * @api public\n\t */\n\t\n\tfunction match(el, selector) {\n\t if (vendor) return vendor.call(el, selector);\n\t var nodes = el.parentNode.querySelectorAll(selector);\n\t for (var i = 0; i < nodes.length; i++) {\n\t if (nodes[i] == el) return true;\n\t }\n\t return false;\n\t}\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\t// there's 3 implementations written in increasing order of efficiency\n\t\n\t// 1 - no Set type is defined\n\tfunction uniqNoSet(arr) {\n\t\tvar ret = [];\n\t\n\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\t\tret.push(arr[i]);\n\t\t\t}\n\t\t}\n\t\n\t\treturn ret;\n\t}\n\t\n\t// 2 - a simple Set type is defined\n\tfunction uniqSet(arr) {\n\t\tvar seen = new Set();\n\t\treturn arr.filter(function (el) {\n\t\t\tif (!seen.has(el)) {\n\t\t\t\tseen.add(el);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t}\n\t\n\t// 3 - a standard Set type is defined and it has a forEach method\n\tfunction uniqSetWithForEach(arr) {\n\t\tvar ret = [];\n\t\n\t\t(new Set(arr)).forEach(function (el) {\n\t\t\tret.push(el);\n\t\t});\n\t\n\t\treturn ret;\n\t}\n\t\n\t// V8 currently has a broken implementation\n\t// https://github.com/joyent/node/issues/8449\n\tfunction doesForEachActuallyWork() {\n\t\tvar ret = false;\n\t\n\t\t(new Set([true])).forEach(function (el) {\n\t\t\tret = el;\n\t\t});\n\t\n\t\treturn ret === true;\n\t}\n\t\n\tif ('Set' in global) {\n\t\tif (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {\n\t\t\tmodule.exports = uniqSetWithForEach;\n\t\t} else {\n\t\t\tmodule.exports = uniqSet;\n\t\t}\n\t} else {\n\t\tmodule.exports = uniqNoSet;\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\tmodule.exports = extend\n\t\n\tvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\t\n\tfunction extend() {\n\t var target = {}\n\t\n\t for (var i = 0; i < arguments.length; i++) {\n\t var source = arguments[i]\n\t\n\t for (var key in source) {\n\t if (hasOwnProperty.call(source, key)) {\n\t target[key] = source[key]\n\t }\n\t }\n\t }\n\t\n\t return target\n\t}\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\tmodule.exports = throttle;\n\t\n\t/**\n\t * Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.\n\t *\n\t * @param {Function} func Function to wrap.\n\t * @param {Number} wait Number of milliseconds that must elapse between `func` invocations.\n\t * @return {Function} A new function that wraps the `func` function passed in.\n\t */\n\t\n\tfunction throttle (func, wait) {\n\t var ctx, args, rtn, timeoutID; // caching\n\t var last = 0;\n\t\n\t return function throttled () {\n\t ctx = this;\n\t args = arguments;\n\t var delta = new Date() - last;\n\t if (!timeoutID)\n\t if (delta >= wait) call();\n\t else timeoutID = setTimeout(call, wait - delta);\n\t return rtn;\n\t };\n\t\n\t function call () {\n\t timeoutID = 0;\n\t last = +new Date();\n\t rtn = func.apply(ctx, args);\n\t ctx = null;\n\t args = null;\n\t }\n\t}\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _getNumber = __webpack_require__(7);\n\t\n\tvar _getNumber2 = _interopRequireDefault(_getNumber);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t/**\n\t * Represents a coordinate pair.\n\t * @param {number} [x=0] X.\n\t * @param {number} [y=0] Y.\n\t */\n\tvar Point = function Point(x, y) {\n\t this.x = (0, _getNumber2.default)(x);\n\t this.y = (0, _getNumber2.default)(y);\n\t};\n\t\n\t/**\n\t * Whether two points are equal.\n\t * @param {Point} a Point A.\n\t * @param {Point} b Point B.\n\t * @return {boolean}\n\t */\n\tPoint.equals = function (a, b) {\n\t return a.x === b.x && a.y === b.y;\n\t};\n\t\n\texports.default = Point;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.\n\t * @param {*} value Possibly numeric value.\n\t * @return {number} `value` or zero if `value` isn't numeric.\n\t */\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = getNumber;\n\tfunction getNumber(value) {\n\t return parseFloat(value) || 0;\n\t}\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _point = __webpack_require__(6);\n\t\n\tvar _point2 = _interopRequireDefault(_point);\n\t\n\tvar _classes = __webpack_require__(9);\n\t\n\tvar _classes2 = _interopRequireDefault(_classes);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar id = 0;\n\t\n\tvar ShuffleItem = function () {\n\t function ShuffleItem(element) {\n\t _classCallCheck(this, ShuffleItem);\n\t\n\t this.id = id++;\n\t this.element = element;\n\t this.isVisible = true;\n\t }\n\t\n\t _createClass(ShuffleItem, [{\n\t key: 'show',\n\t value: function show() {\n\t this.isVisible = true;\n\t this.element.classList.remove(_classes2.default.HIDDEN);\n\t this.element.classList.add(_classes2.default.VISIBLE);\n\t }\n\t }, {\n\t key: 'hide',\n\t value: function hide() {\n\t this.isVisible = false;\n\t this.element.classList.remove(_classes2.default.VISIBLE);\n\t this.element.classList.add(_classes2.default.HIDDEN);\n\t }\n\t }, {\n\t key: 'init',\n\t value: function init() {\n\t this.addClasses([_classes2.default.SHUFFLE_ITEM, _classes2.default.VISIBLE]);\n\t this.applyCss(ShuffleItem.Css.INITIAL);\n\t this.scale = ShuffleItem.Scale.VISIBLE;\n\t this.point = new _point2.default();\n\t }\n\t }, {\n\t key: 'addClasses',\n\t value: function addClasses(classes) {\n\t var _this = this;\n\t\n\t classes.forEach(function (className) {\n\t _this.element.classList.add(className);\n\t });\n\t }\n\t }, {\n\t key: 'removeClasses',\n\t value: function removeClasses(classes) {\n\t var _this2 = this;\n\t\n\t classes.forEach(function (className) {\n\t _this2.element.classList.remove(className);\n\t });\n\t }\n\t }, {\n\t key: 'applyCss',\n\t value: function applyCss(obj) {\n\t for (var key in obj) {\n\t this.element.style[key] = obj[key];\n\t }\n\t }\n\t }, {\n\t key: 'dispose',\n\t value: function dispose() {\n\t this.removeClasses([_classes2.default.HIDDEN, _classes2.default.VISIBLE, _classes2.default.SHUFFLE_ITEM]);\n\t\n\t this.element.removeAttribute('style');\n\t this.element = null;\n\t }\n\t }]);\n\t\n\t return ShuffleItem;\n\t}();\n\t\n\tShuffleItem.Css = {\n\t INITIAL: {\n\t position: 'absolute',\n\t top: 0,\n\t left: 0,\n\t visibility: 'visible',\n\t 'will-change': 'transform'\n\t },\n\t VISIBLE: {\n\t before: {\n\t opacity: 1,\n\t visibility: 'visible'\n\t },\n\t after: {}\n\t },\n\t HIDDEN: {\n\t before: {\n\t opacity: 0\n\t },\n\t after: {\n\t visibility: 'hidden'\n\t }\n\t }\n\t};\n\t\n\tShuffleItem.Scale = {\n\t VISIBLE: 1,\n\t HIDDEN: 0.001\n\t};\n\t\n\texports.default = ShuffleItem;\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = {\n\t BASE: 'shuffle',\n\t SHUFFLE_ITEM: 'shuffle-item',\n\t VISIBLE: 'shuffle-item--visible',\n\t HIDDEN: 'shuffle-item--hidden'\n\t};\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = getNumberStyle;\n\t\n\tvar _getNumber = __webpack_require__(7);\n\t\n\tvar _getNumber2 = _interopRequireDefault(_getNumber);\n\t\n\tvar _computedSize = __webpack_require__(11);\n\t\n\tvar _computedSize2 = _interopRequireDefault(_computedSize);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t/**\n\t * Retrieve the computed style for an element, parsed as a float.\n\t * @param {Element} element Element to get style for.\n\t * @param {string} style Style property.\n\t * @param {CSSStyleDeclaration} [styles] Optionally include clean styles to\n\t * use instead of asking for them again.\n\t * @return {number} The parsed computed value or zero if that fails because IE\n\t * will return 'auto' when the element doesn't have margins instead of\n\t * the computed style.\n\t */\n\tfunction getNumberStyle(element, style) {\n\t var styles = arguments.length <= 2 || arguments[2] === undefined ? window.getComputedStyle(element, null) : arguments[2];\n\t\n\t var value = (0, _getNumber2.default)(styles[style]);\n\t\n\t // Support IE<=11 and W3C spec.\n\t if (!_computedSize2.default && style === 'width') {\n\t value += (0, _getNumber2.default)(styles.paddingLeft) + (0, _getNumber2.default)(styles.paddingRight) + (0, _getNumber2.default)(styles.borderLeftWidth) + (0, _getNumber2.default)(styles.borderRightWidth);\n\t } else if (!_computedSize2.default && style === 'height') {\n\t value += (0, _getNumber2.default)(styles.paddingTop) + (0, _getNumber2.default)(styles.paddingBottom) + (0, _getNumber2.default)(styles.borderTopWidth) + (0, _getNumber2.default)(styles.borderBottomWidth);\n\t }\n\t\n\t return value;\n\t}\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar element = document.body || document.documentElement;\n\tvar e = document.createElement('div');\n\te.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';\n\telement.appendChild(e);\n\t\n\tvar width = window.getComputedStyle(e, null).width;\n\tvar ret = width === '10px';\n\t\n\telement.removeChild(e);\n\t\n\texports.default = ret;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = sorter;\n\t\n\tvar _xtend = __webpack_require__(4);\n\t\n\tvar _xtend2 = _interopRequireDefault(_xtend);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t// http://stackoverflow.com/a/962890/373422\n\tfunction randomize(array) {\n\t var tmp;\n\t var current;\n\t var top = array.length;\n\t\n\t if (!top) {\n\t return array;\n\t }\n\t\n\t while (--top) {\n\t current = Math.floor(Math.random() * (top + 1));\n\t tmp = array[current];\n\t array[current] = array[top];\n\t array[top] = tmp;\n\t }\n\t\n\t return array;\n\t}\n\t\n\tvar defaults = {\n\t // Use array.reverse() to reverse the results\n\t reverse: false,\n\t\n\t // Sorting function\n\t by: null,\n\t\n\t // If true, this will skip the sorting and return a randomized order in the array\n\t randomize: false,\n\t\n\t // Determines which property of each item in the array is passed to the\n\t // sorting method.\n\t key: 'element'\n\t};\n\t\n\t// You can return `undefined` from the `by` function to revert to DOM order.\n\tfunction sorter(arr, options) {\n\t var opts = (0, _xtend2.default)(defaults, options);\n\t var original = [].slice.call(arr);\n\t var revert = false;\n\t\n\t if (!arr.length) {\n\t return [];\n\t }\n\t\n\t if (opts.randomize) {\n\t return randomize(arr);\n\t }\n\t\n\t // Sort the elements by the opts.by function.\n\t // If we don't have opts.by, default to DOM order\n\t if (typeof opts.by === 'function') {\n\t arr.sort(function (a, b) {\n\t\n\t // Exit early if we already know we want to revert\n\t if (revert) {\n\t return 0;\n\t }\n\t\n\t var valA = opts.by(a[opts.key]);\n\t var valB = opts.by(b[opts.key]);\n\t\n\t // If both values are undefined, use the DOM order\n\t if (valA === undefined && valB === undefined) {\n\t revert = true;\n\t return 0;\n\t }\n\t\n\t if (valA < valB || valA === 'sortFirst' || valB === 'sortLast') {\n\t return -1;\n\t }\n\t\n\t if (valA > valB || valA === 'sortLast' || valB === 'sortFirst') {\n\t return 1;\n\t }\n\t\n\t return 0;\n\t });\n\t }\n\t\n\t // Revert to the original array if necessary\n\t if (revert) {\n\t return original;\n\t }\n\t\n\t if (opts.reverse) {\n\t arr.reverse();\n\t }\n\t\n\t return arr;\n\t}\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.onTransitionEnd = onTransitionEnd;\n\texports.cancelTransitionEnd = cancelTransitionEnd;\n\tvar transitions = {};\n\tvar eventName = 'transitionend';\n\tvar count = 0;\n\t\n\tfunction uniqueId() {\n\t return eventName + count++;\n\t}\n\t\n\tfunction onTransitionEnd(element, callback) {\n\t var id = uniqueId();\n\t var listener = function listener(evt) {\n\t if (evt.currentTarget === evt.target) {\n\t cancelTransitionEnd(id);\n\t callback(evt);\n\t }\n\t };\n\t\n\t element.addEventListener(eventName, listener);\n\t\n\t transitions[id] = { element: element, listener: listener };\n\t\n\t return id;\n\t}\n\t\n\tfunction cancelTransitionEnd(id) {\n\t if (transitions[id]) {\n\t transitions[id].element.removeEventListener(eventName, transitions[id].listener);\n\t transitions[id] = null;\n\t return true;\n\t }\n\t\n\t return false;\n\t}\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.getItemPosition = getItemPosition;\n\t\n\tvar _point = __webpack_require__(6);\n\t\n\tvar _point2 = _interopRequireDefault(_point);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction arrayMax(array) {\n\t return Math.max.apply(Math, array);\n\t}\n\t\n\tfunction arrayMin(array) {\n\t return Math.min.apply(Math, array);\n\t}\n\t\n\t/**\n\t * Determine the location of the next item, based on its size.\n\t * @param {Object} itemSize Object with width and height.\n\t * @param {Array.} positions Positions of the other current items.\n\t * @param {number} gridSize The column width or row height.\n\t * @param {number} total The total number of columns or rows.\n\t * @param {number} threshold Buffer value for the column to fit.\n\t * @param {number} buffer Vertical buffer for the height of items.\n\t * @return {Point}\n\t */\n\tfunction getItemPosition(_ref) {\n\t var itemSize = _ref.itemSize;\n\t var positions = _ref.positions;\n\t var gridSize = _ref.gridSize;\n\t var total = _ref.total;\n\t var threshold = _ref.threshold;\n\t var buffer = _ref.buffer;\n\t\n\t var span = getColumnSpan(itemSize.width, gridSize, total, threshold);\n\t var setY = getAvailablePositions(positions, span, total);\n\t var shortColumnIndex = getShortColumn(setY, buffer);\n\t\n\t // Position the item\n\t var point = new _point2.default(Math.round(gridSize * shortColumnIndex), Math.round(setY[shortColumnIndex]));\n\t\n\t // Update the columns array with the new values for each column.\n\t // e.g. before the update the columns could be [250, 0, 0, 0] for an item\n\t // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0].\n\t var setHeight = setY[shortColumnIndex] + itemSize.height;\n\t for (var i = 0; i < span; i++) {\n\t positions[shortColumnIndex + i] = setHeight;\n\t }\n\t\n\t return point;\n\t}\n\t\n\t/**\n\t * Determine the number of columns an items spans.\n\t * @param {number} itemWidth Width of the item.\n\t * @param {number} columnWidth Width of the column (includes gutter).\n\t * @param {number} columns Total number of columns\n\t * @param {number} threshold A buffer value for the size of the column to fit.\n\t * @return {number}\n\t */\n\tfunction getColumnSpan(itemWidth, columnWidth, columns, threshold) {\n\t var columnSpan = itemWidth / columnWidth;\n\t\n\t // If the difference between the rounded column span number and the\n\t // calculated column span number is really small, round the number to\n\t // make it fit.\n\t if (Math.abs(Math.round(columnSpan) - columnSpan) < threshold) {\n\t // e.g. columnSpan = 4.0089945390298745\n\t columnSpan = Math.round(columnSpan);\n\t }\n\t\n\t // Ensure the column span is not more than the amount of columns in the whole layout.\n\t return Math.min(Math.ceil(columnSpan), columns);\n\t}\n\t\n\t/**\n\t * Retrieves the column set to use for placement.\n\t * @param {number} columnSpan The number of columns this current item spans.\n\t * @param {number} columns The total columns in the grid.\n\t * @return {Array.} An array of numbers represeting the column set.\n\t */\n\tfunction getAvailablePositions(positions, columnSpan, columns) {\n\t // The item spans only one column.\n\t if (columnSpan === 1) {\n\t return positions;\n\t }\n\t\n\t // The item spans more than one column, figure out how many different\n\t // places it could fit horizontally.\n\t // The group count is the number of places within the positions this block\n\t // could fit, ignoring the current positions of items.\n\t // Imagine a 2 column brick as the second item in a 4 column grid with\n\t // 10px height each. Find the places it would fit:\n\t // [20, 10, 10, 0]\n\t // | | |\n\t // * * *\n\t //\n\t // Then take the places which fit and get the bigger of the two:\n\t // max([20, 10]), max([10, 10]), max([10, 0]) = [20, 10, 0]\n\t //\n\t // Next, find the first smallest number (the short column).\n\t // [20, 10, 0]\n\t // |\n\t // *\n\t //\n\t // And that's where it should be placed!\n\t //\n\t // Another example where the second column's item extends past the first:\n\t // [10, 20, 10, 0] => [20, 20, 10] => 10\n\t var available = [];\n\t\n\t // For how many possible positions for this item there are.\n\t for (var i = 0; i <= columns - columnSpan; i++) {\n\t // Find the bigger value for each place it could fit.\n\t available.push(arrayMax(positions.slice(i, i + columnSpan)));\n\t }\n\t\n\t return available;\n\t}\n\t\n\t/**\n\t * Find index of short column, the first from the left where this item will go.\n\t *\n\t * @param {Array.} positions The array to search for the smallest number.\n\t * @param {number} buffer Optional buffer which is very useful when the height\n\t * is a percentage of the width.\n\t * @return {number} Index of the short column.\n\t */\n\tfunction getShortColumn(positions, buffer) {\n\t var minPosition = arrayMin(positions);\n\t for (var i = 0, len = positions.length; i < len; i++) {\n\t if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) {\n\t return i;\n\t }\n\t }\n\t\n\t return 0;\n\t}\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** shuffle.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap f8ea2016469152328087\n **/","'use strict';\n\nimport 'custom-event-polyfill';\nimport matches from 'matches-selector';\nimport arrayUnique from 'array-uniq';\nimport xtend from 'xtend';\nimport throttle from 'throttleit';\nimport Point from './point';\nimport ShuffleItem from './shuffle-item';\nimport Classes from './classes';\nimport getNumberStyle from './get-number-style';\nimport sorter from './sorter';\nimport { onTransitionEnd, cancelTransitionEnd } from './on-transition-end';\nimport { getItemPosition } from './layout';\n\nfunction toArray(arrayLike) {\n return Array.prototype.slice.call(arrayLike);\n}\n\nfunction arrayMax(array) {\n return Math.max.apply(Math, array);\n}\n\nfunction arrayIncludes(array, obj) {\n if (arguments.length === 2) {\n return arrayIncludes(array)(obj);\n }\n\n return function (obj) {\n return array.indexOf(obj) > -1;\n };\n}\n\n// Used for unique instance variables\nlet id = 0;\n\nclass Shuffle {\n\n /**\n * Categorize, sort, and filter a responsive grid of items.\n *\n * @param {Element} element An element which is the parent container for the grid items.\n * @param {Object} [options=Shuffle.options] Options object.\n * @constructor\n */\n constructor(element, options = {}) {\n this.options = xtend(Shuffle.options, options);\n\n this.useSizer = false;\n this.lastSort = {};\n this.lastFilter = Shuffle.ALL_ITEMS;\n this.isEnabled = true;\n this.isDestroyed = false;\n this.isInitialized = false;\n this._transitions = [];\n this.isTransitioning = false;\n this._queue = [];\n\n element = this._getElementOption(element);\n\n if (!element) {\n throw new TypeError('Shuffle needs to be initialized with an element.');\n }\n\n this.element = element;\n this.id = 'shuffle_' + id++;\n\n this._init();\n this.isInitialized = true;\n }\n\n _init() {\n this.items = this._getItems();\n\n this.options.sizer = this._getElementOption(this.options.sizer);\n\n if (this.options.sizer) {\n this.useSizer = true;\n }\n\n // Add class and invalidate styles\n this.element.classList.add(Shuffle.Classes.BASE);\n\n // Set initial css for each item\n this._initItems();\n\n // Bind resize events\n this._onResize = this._getResizeFunction();\n window.addEventListener('resize', this._onResize);\n\n // Get container css all in one request. Causes reflow\n var containerCss = window.getComputedStyle(this.element, null);\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // Add styles to the container if it doesn't have them.\n this._validateStyles(containerCss);\n\n // We already got the container's width above, no need to cause another\n // reflow getting it again... Calculate the number of columns there will be\n this._setColumns(containerWidth);\n\n // Kick off!\n this.filter(this.options.group, this.options.initialSort);\n\n // The shuffle items haven't had transitions set on them yet so the user\n // doesn't see the first layout. Set them now that the first layout is done.\n // First, however, a synchronous layout must be caused for the previous\n // styles to be applied without transitions.\n this.element.offsetWidth; // jshint ignore: line\n this._setTransitions();\n this.element.style.transition = 'height ' + this.options.speed + 'ms ' + this.options.easing;\n }\n\n /**\n * Returns a throttled and proxied function for the resize handler.\n * @return {Function}\n * @private\n */\n _getResizeFunction() {\n var resizeFunction = this._handleResize.bind(this);\n return this.options.throttle ?\n this.options.throttle(resizeFunction, this.options.throttleTime) :\n resizeFunction;\n }\n\n /**\n * Retrieve an element from an option.\n * @param {string|jQuery|Element} option The option to check.\n * @return {?Element} The plain element or null.\n * @private\n */\n _getElementOption(option) {\n // If column width is a string, treat is as a selector and search for the\n // sizer element within the outermost container\n if (typeof option === 'string') {\n return this.element.querySelector(option);\n\n // Check for an element\n } else if (option && option.nodeType && option.nodeType === 1) {\n return option;\n\n // Check for jQuery object\n } else if (option && option.jquery) {\n return option[0];\n }\n\n return null;\n }\n\n /**\n * Ensures the shuffle container has the css styles it needs applied to it.\n * @param {Object} styles Key value pairs for position and overflow.\n * @private\n */\n _validateStyles(styles) {\n // Position cannot be static.\n if (styles.position === 'static') {\n this.element.style.position = 'relative';\n }\n\n // Overflow has to be hidden.\n if (styles.overflow !== 'hidden') {\n this.element.style.overflow = 'hidden';\n }\n }\n\n /**\n * Filter the elements by a category.\n * @param {string} [category] Category to filter by. If it's given, the last\n * category will be used to filter the items.\n * @param {Array} [collection] Optionally filter a collection. Defaults to\n * all the items.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _filter(category = this.lastFilter, collection = this.items) {\n var set = this._getFilteredSets(category, collection);\n\n // Individually add/remove hidden/visible classes\n this._toggleFilterClasses(set);\n\n // Save the last filter in case elements are appended.\n this.lastFilter = category;\n\n // This is saved mainly because providing a filter function (like searching)\n // will overwrite the `lastFilter` property every time its called.\n if (typeof category === 'string') {\n this.options.group = category;\n }\n\n return set;\n }\n\n /**\n * Returns an object containing the visible and hidden elements.\n * @param {string|Function} category Category or function to filter by.\n * @param {Array.} items A collection of items to filter.\n * @return {!{visible: Array, hidden: Array}}\n * @private\n */\n _getFilteredSets(category, items) {\n let visible = [];\n let hidden = [];\n\n // category === 'all', add visible class to everything\n if (category === Shuffle.ALL_ITEMS) {\n visible = items;\n\n // Loop through each item and use provided function to determine\n // whether to hide it or not.\n } else {\n items.forEach((item) => {\n if (this._doesPassFilter(category, item.element)) {\n visible.push(item);\n } else {\n hidden.push(item);\n }\n });\n }\n\n return {\n visible,\n hidden,\n };\n }\n\n /**\n * Test an item to see if it passes a category.\n * @param {string|Function} category Category or function to filter by.\n * @param {Element} element An element to test.\n * @return {boolean} Whether it passes the category/filter.\n * @private\n */\n _doesPassFilter(category, element) {\n\n if (typeof category === 'function') {\n return category.call(element, element, this);\n\n // Check each element's data-groups attribute against the given category.\n } else {\n let attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);\n let groups = JSON.parse(attr);\n let keys = this.delimeter && !Array.isArray(groups) ?\n groups.split(this.delimeter) :\n groups;\n\n if (Array.isArray(category)) {\n return category.some(arrayIncludes(keys));\n }\n\n return arrayIncludes(keys, category);\n }\n }\n\n /**\n * Toggles the visible and hidden class names.\n * @param {{visible, hidden}} Object with visible and hidden arrays.\n * @private\n */\n _toggleFilterClasses({ visible, hidden }) {\n visible.forEach((item) => {\n item.show();\n });\n\n hidden.forEach((item) => {\n item.hide();\n });\n }\n\n /**\n * Set the initial css for each item\n * @param {Array.} [items] Optionally specifiy at set to initialize.\n * @private\n */\n _initItems(items = this.items) {\n items.forEach((item) => {\n item.init();\n });\n }\n\n /**\n * Remove element reference and styles.\n * @private\n */\n _disposeItems(items = this.items) {\n items.forEach((item) => {\n item.dispose();\n });\n }\n\n /**\n * Updates the visible item count.\n * @private\n */\n _updateItemCount() {\n this.visibleItems = this._getFilteredItems().length;\n }\n\n /**\n * Sets css transform transition on a group of elements. This is not executed\n * at the same time as `item.init` so that transitions don't occur upon\n * initialization of Shuffle.\n * @param {Array.} items Shuffle items to set transitions on.\n * @private\n */\n _setTransitions(items = this.items) {\n let speed = this.options.speed;\n let easing = this.options.easing;\n\n var str;\n if (this.options.useTransforms) {\n str = 'transform ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n } else {\n str = 'top ' + speed + 'ms ' + easing +\n ', left ' + speed + 'ms ' + easing +\n ', opacity ' + speed + 'ms ' + easing;\n }\n\n items.forEach((item) => {\n item.element.style.transition = str;\n });\n }\n\n _getItems() {\n return toArray(this.element.children)\n .filter(el => matches(el, this.options.itemSelector))\n .map(el => new ShuffleItem(el));\n }\n\n /**\n * When new elements are added to the shuffle container, update the array of\n * items because that is the order `_layout` calls them.\n */\n _updateItemsOrder() {\n let children = this.element.children;\n this.items = sorter(this.items, {\n by(element) {\n return Array.prototype.indexOf.call(children, element);\n },\n });\n }\n\n _getFilteredItems() {\n return this.items.filter(item => item.isVisible);\n }\n\n _getConcealedItems() {\n return this.items.filter(item => !item.isVisible);\n }\n\n /**\n * Returns the column size, based on column width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @param {number} gutterSize Size of the gutters.\n * @return {number}\n * @private\n */\n _getColumnSize(containerWidth, gutterSize) {\n var size;\n\n // If the columnWidth property is a function, then the grid is fluid\n if (typeof this.options.columnWidth === 'function') {\n size = this.options.columnWidth(containerWidth);\n\n // columnWidth option isn't a function, are they using a sizing element?\n } else if (this.useSizer) {\n size = Shuffle.getSize(this.options.sizer).width;\n\n // if not, how about the explicitly set option?\n } else if (this.options.columnWidth) {\n size = this.options.columnWidth;\n\n // or use the size of the first item\n } else if (this.items.length > 0) {\n size = Shuffle.getSize(this.items[0].element, true).width;\n\n // if there's no items, use size of container\n } else {\n size = containerWidth;\n }\n\n // Don't let them set a column width of zero.\n if (size === 0) {\n size = containerWidth;\n }\n\n return size + gutterSize;\n }\n\n /**\n * Returns the gutter size, based on gutter width and sizer options.\n * @param {number} containerWidth Size of the parent container.\n * @return {number}\n * @private\n */\n _getGutterSize(containerWidth) {\n var size;\n if (typeof this.options.gutterWidth === 'function') {\n size = this.options.gutterWidth(containerWidth);\n } else if (this.useSizer) {\n size = getNumberStyle(this.options.sizer, 'marginLeft');\n } else {\n size = this.options.gutterWidth;\n }\n\n return size;\n }\n\n /**\n * Calculate the number of columns to be used. Gets css if using sizer element.\n * @param {number} [containerWidth] Optionally specify a container width if\n * it's already available.\n */\n _setColumns(containerWidth = Shuffle.getSize(this.element).width) {\n var gutter = this._getGutterSize(containerWidth);\n var columnWidth = this._getColumnSize(containerWidth, gutter);\n var calculatedColumns = (containerWidth + gutter) / columnWidth;\n\n // Widths given from getStyles are not precise enough...\n if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) <\n this.options.columnThreshold) {\n // e.g. calculatedColumns = 11.998876\n calculatedColumns = Math.round(calculatedColumns);\n }\n\n this.cols = Math.max(Math.floor(calculatedColumns), 1);\n this.containerWidth = containerWidth;\n this.colWidth = columnWidth;\n }\n\n /**\n * Adjust the height of the grid\n */\n _setContainerSize() {\n this.element.style.height = this._getContainerSize() + 'px';\n }\n\n /**\n * Based on the column heights, it returns the biggest one.\n * @return {number}\n * @private\n */\n _getContainerSize() {\n return arrayMax(this.positions);\n }\n\n /**\n * Get the clamped stagger amount.\n * @param {number} index Index of the item to be staggered.\n * @return {number}\n */\n _getStaggerAmount(index) {\n return Math.min(index * this.options.staggerAmount, this.options.staggerAmountMax);\n }\n\n /**\n * @return {boolean} Whether the event was prevented or not.\n */\n _dispatch(name, details = {}) {\n if (this.isDestroyed) {\n return;\n }\n\n details.shuffle = this;\n return !this.element.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: false,\n detail: details,\n }));\n }\n\n /**\n * Zeros out the y columns array, which is used to determine item placement.\n * @private\n */\n _resetCols() {\n var i = this.cols;\n this.positions = [];\n while (i--) {\n this.positions.push(0);\n }\n }\n\n /**\n * Loops through each item that should be shown and calculates the x, y position.\n * @param {Array.} items Array of items that will be shown/layed\n * out in order in their array.\n */\n _layout(items) {\n let count = 0;\n items.forEach((item) => {\n var currPos = item.point;\n var currScale = item.scale;\n var itemSize = Shuffle.getSize(item.element, true);\n var pos = this._getItemPosition(itemSize);\n\n function callback() {\n item.applyCss(ShuffleItem.Css.VISIBLE.after);\n }\n\n // If the item will not change its position, do not add it to the render\n // queue. Transitions don't fire when setting a property to the same value.\n if (Point.equals(currPos, pos) && currScale === ShuffleItem.Scale.VISIBLE) {\n callback();\n return;\n }\n\n item.point = pos;\n item.scale = ShuffleItem.Scale.VISIBLE;\n\n let styles = ShuffleItem.Css.VISIBLE.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Determine the location of the next item, based on its size.\n * @param {{width: number, height: number}} itemSize Object with width and height.\n * @return {Point}\n * @private\n */\n _getItemPosition(itemSize) {\n return getItemPosition({\n itemSize,\n positions: this.positions,\n gridSize: this.colWidth,\n total: this.cols,\n threshold: this.options.columnThreshold,\n buffer: this.options.buffer,\n });\n }\n\n /**\n * Hides the elements that don't match our filter.\n * @param {Array.} collection Collection to shrink.\n * @private\n */\n _shrink(collection = this._getConcealedItems()) {\n let count = 0;\n collection.forEach((item) => {\n function callback() {\n item.applyCss(ShuffleItem.Css.HIDDEN.after);\n }\n\n // Continuing would add a transitionend event listener to the element, but\n // that listener would not execute because the transform and opacity would\n // stay the same.\n // The callback is executed here because it is not guaranteed to be called\n // after the transitionend event because the transitionend could be\n // canceled if another animation starts.\n if (item.scale === ShuffleItem.Scale.HIDDEN) {\n callback();\n return;\n }\n\n item.scale = ShuffleItem.Scale.HIDDEN;\n\n let styles = ShuffleItem.Css.HIDDEN.before;\n styles.transitionDelay = this._getStaggerAmount(count);\n\n this._queue.push({\n item,\n styles,\n callback,\n });\n\n count++;\n });\n }\n\n /**\n * Resize handler.\n * @private\n */\n _handleResize() {\n // If shuffle is disabled, destroyed, don't do anything\n if (!this.isEnabled || this.isDestroyed) {\n return;\n }\n\n // Will need to check height in the future if it's layed out horizontaly\n var containerWidth = Shuffle.getSize(this.element).width;\n\n // containerWidth hasn't changed, don't do anything\n if (containerWidth === this.containerWidth) {\n return;\n }\n\n this.update();\n }\n\n /**\n * Returns styles which will be applied to the an item for a transition.\n * @param {Object} obj Transition options.\n * @return {!Object} Transforms for transitions, left/top for animate.\n * @private\n */\n _getStylesForTransition({ item, styles }) {\n if (!styles.transitionDelay) {\n styles.transitionDelay = '0ms';\n }\n\n let x = item.point.x;\n let y = item.point.y;\n\n if (this.options.useTransforms) {\n styles.transform = `translate(${x}px, ${y}px) scale(${item.scale})`;\n } else {\n styles.left = x + 'px';\n styles.top = y + 'px';\n }\n\n return styles;\n }\n\n _whenTransitionDone(element, itemCallback) {\n // TODO what happens when the transition is canceled and the promise never resolves?\n return new Promise((resolve) => {\n let id = onTransitionEnd(element, (evt) => {\n evt.currentTarget.style.transitionDelay = '';\n itemCallback();\n resolve();\n });\n this._transitions.push(id);\n });\n }\n\n _transition(opts) {\n opts.item.applyCss(this._getStylesForTransition(opts));\n return this._whenTransitionDone(opts.item.element, opts.callback);\n }\n\n /**\n * Execute the styles gathered in the style queue. This applies styles to elements,\n * triggering transitions.\n * @private\n */\n _processQueue() {\n if (this.isTransitioning) {\n this._cancelMovement();\n }\n\n // Iterate over the queue and keep track of ones that use transitions.\n let immediates = [];\n let transitions = [];\n this._queue.forEach((obj) => {\n if (!this.isInitialized || this.options.speed === 0) {\n immediates.push(obj);\n } else {\n transitions.push(obj);\n }\n });\n\n this._styleImmediately(immediates);\n\n if (transitions.length > 0 && this.options.speed > 0) {\n this._startTransitions(transitions);\n\n // A call to layout happened, but none of the newly visible items will\n // change position. Asynchronously fire the callback here.\n } else {\n setTimeout(this._dispatchLayout.bind(this), 0);\n }\n\n // Remove everything in the style queue\n this._queue.length = 0;\n }\n\n /**\n * Create a promise for each transition and wait for all of them to complete,\n * then emit the layout event.\n * @param {Array.} transitions Array of transition objects.\n */\n _startTransitions(transitions) {\n // Set flag that shuffle is currently in motion.\n this.isTransitioning = true;\n\n let promises = transitions.map(obj => this._transition(obj));\n Promise.all(promises).then(this._movementFinished.bind(this));\n }\n\n _cancelMovement() {\n // Remove the transition end event for each listener.\n this._transitions.forEach(cancelTransitionEnd);\n\n // Reset the array.\n this._transitions.length = 0;\n\n // Show it's no longer active.\n this.isTransitioning = false;\n }\n\n /**\n * Apply styles without a transition.\n * @param {Array.} objects Array of transition objects.\n * @private\n */\n _styleImmediately(objects) {\n if (objects.length) {\n let elements = objects.map(obj => obj.item.element);\n\n Shuffle._skipTransitions(elements, () => {\n objects.forEach((obj) => {\n obj.item.applyCss(this._getStylesForTransition(obj));\n obj.callback();\n });\n });\n }\n }\n\n _movementFinished() {\n this._transitions.length = 0;\n this.isTransitioning = false;\n this._dispatchLayout();\n }\n\n _dispatchLayout() {\n this._dispatch(Shuffle.EventType.LAYOUT);\n }\n\n /**\n * The magic. This is what makes the plugin 'shuffle'\n * @param {string|Function|Array.} [category] Category to filter by.\n * Can be a function, string, or array of strings.\n * @param {Object} [sortObj] A sort object which can sort the visible set\n */\n filter(category, sortObj) {\n if (!this.isEnabled) {\n return;\n }\n\n if (!category || (category && category.length === 0)) {\n category = Shuffle.ALL_ITEMS;\n }\n\n this._filter(category);\n\n // Shrink each hidden item\n this._shrink();\n\n // How many visible elements?\n this._updateItemCount();\n\n // Update transforms on visible elements so they will animate to their new positions.\n this.sort(sortObj);\n }\n\n /**\n * Gets the visible elements, sorts them, and passes them to layout.\n * @param {Object} opts the options object for the sorted plugin\n */\n sort(opts = this.lastSort) {\n if (!this.isEnabled) {\n return;\n }\n\n this._resetCols();\n\n var items = this._getFilteredItems();\n items = sorter(items, opts);\n\n this._layout(items);\n\n // `_layout` always happens after `_shrink`, so it's safe to process the style\n // queue here with styles from the shrink method.\n this._processQueue();\n\n // Adjust the height of the container.\n this._setContainerSize();\n\n this.lastSort = opts;\n }\n\n /**\n * Reposition everything.\n * @param {boolean} isOnlyLayout If true, column and gutter widths won't be\n * recalculated.\n */\n update(isOnlyLayout) {\n if (this.isEnabled) {\n\n if (!isOnlyLayout) {\n // Get updated colCount\n this._setColumns();\n }\n\n // Layout items\n this.sort();\n }\n }\n\n /**\n * Use this instead of `update()` if you don't need the columns and gutters updated\n * Maybe an image inside `shuffle` loaded (and now has a height), which means calculations\n * could be off.\n */\n layout() {\n this.update(true);\n }\n\n /**\n * New items have been appended to shuffle. Mix them in with the current\n * filter or sort status.\n * @param {Array.} newItems Collection of new items.\n */\n add(newItems) {\n newItems = arrayUnique(newItems).map(el => new ShuffleItem(el));\n\n // Add classes and set initial positions.\n this._initItems(newItems);\n\n // Add transition to each item.\n this._setTransitions(newItems);\n\n // Update the list of items.\n this.items = this.items.concat(newItems);\n this._updateItemsOrder();\n this.filter(this.lastFilter);\n }\n\n /**\n * Disables shuffle from updating dimensions and layout on resize\n */\n disable() {\n this.isEnabled = false;\n }\n\n /**\n * Enables shuffle again\n * @param {boolean} [isUpdateLayout=true] if undefined, shuffle will update columns and gutters\n */\n enable(isUpdateLayout) {\n this.isEnabled = true;\n if (isUpdateLayout !== false) {\n this.update();\n }\n }\n\n /**\n * Remove 1 or more shuffle items\n * @param {Array.} collection An array containing one or more\n * elements in shuffle\n * @return {Shuffle} The shuffle object\n */\n remove(collection) {\n if (!collection.length) {\n return;\n }\n\n collection = arrayUnique(collection);\n\n let oldItems = collection\n .map(element => this.getItemByElement(element))\n .filter(item => !!item);\n\n let handleLayout = () => {\n this.element.removeEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n this._disposeItems(oldItems);\n\n // Remove the collection in the callback\n collection.forEach((element) => {\n element.parentNode.removeChild(element);\n });\n\n this._dispatch(Shuffle.EventType.REMOVED, { collection });\n\n // Let it get garbage collected\n collection = null;\n oldItems = null;\n };\n\n // Hide collection first.\n this._toggleFilterClasses({\n visible: [],\n hidden: oldItems,\n });\n\n this._shrink(oldItems);\n\n this.sort();\n\n // Update the list of items here because `remove` could be called again\n // with an item that is in the process of being removed.\n this.items = this.items.filter(item => !arrayIncludes(oldItems, item));\n this._updateItemCount();\n\n this.element.addEventListener(Shuffle.EventType.LAYOUT, handleLayout);\n }\n\n /**\n * Retrieve a shuffle item by its element.\n * @param {Element} element Element to look for.\n * @return {?ShuffleItem} A shuffle item or null if it's not found.\n */\n getItemByElement(element) {\n for (var i = this.items.length - 1; i >= 0; i--) {\n if (this.items[i].element === element) {\n return this.items[i];\n }\n }\n\n return null;\n }\n\n /**\n * Destroys shuffle, removes events, styles, and classes\n */\n destroy() {\n this._cancelMovement();\n window.removeEventListener('resize', this._onResize);\n\n // Reset container styles\n this.element.classList.remove('shuffle');\n this.element.removeAttribute('style');\n\n // Reset individual item styles\n this._disposeItems();\n\n // Null DOM references\n this.items = null;\n this.options.sizer = null;\n this.element = null;\n this._transitions = null;\n\n // Set a flag so if a debounced resize has been triggered,\n // it can first check if it is actually isDestroyed and not doing anything\n this.isDestroyed = true;\n }\n\n /**\n * Returns the outer width of an element, optionally including its margins.\n *\n * There are a few different methods for getting the width of an element, none of\n * which work perfectly for all Shuffle's use cases.\n *\n * 1. getBoundingClientRect() `left` and `right` properties.\n * - Accounts for transform scaled elements, making it useless for Shuffle\n * elements which have shrunk.\n * 2. The `offsetWidth` property.\n * - This value stays the same regardless of the elements transform property,\n * however, it does not return subpixel values.\n * 3. getComputedStyle()\n * - This works great Chrome, Firefox, Safari, but IE<=11 does not include\n * padding and border when box-sizing: border-box is set, requiring a feature\n * test and extra work to add the padding back for IE and other browsers which\n * follow the W3C spec here.\n *\n * @param {Element} element The element.\n * @param {boolean} [includeMargins] Whether to include margins. Default is false.\n * @return {{width: number, height: number}} The width and height.\n */\n static getSize(element, includeMargins) {\n // Store the styles so that they can be used by others without asking for it again.\n var styles = window.getComputedStyle(element, null);\n var width = getNumberStyle(element, 'width', styles);\n var height = getNumberStyle(element, 'height', styles);\n\n if (includeMargins) {\n var marginLeft = getNumberStyle(element, 'marginLeft', styles);\n var marginRight = getNumberStyle(element, 'marginRight', styles);\n var marginTop = getNumberStyle(element, 'marginTop', styles);\n var marginBottom = getNumberStyle(element, 'marginBottom', styles);\n width += marginLeft + marginRight;\n height += marginTop + marginBottom;\n }\n\n return {\n width,\n height,\n };\n }\n\n /**\n * Change a property or execute a function which will not have a transition\n * @param {Array.} elements DOM elements that won't be transitioned.\n * @param {Function} callback A function which will be called while transition\n * is set to 0ms.\n * @private\n */\n static _skipTransitions(elements, callback) {\n let zero = '0ms';\n\n // Save current duration and delay.\n let data = elements.map((element) => {\n let style = element.style;\n let duration = style.transitionDuration;\n let delay = style.transitionDelay;\n\n // Set the duration to zero so it happens immediately\n style.transitionDuration = zero;\n style.transitionDelay = zero;\n\n return {\n duration,\n delay,\n };\n });\n\n callback();\n\n // Cause reflow.\n elements[0].offsetWidth; // jshint ignore:line\n\n // Put the duration back\n elements.forEach((element, i) => {\n element.style.transitionDuration = data[i].duration;\n element.style.transitionDelay = data[i].delay;\n });\n }\n}\n\nShuffle.ALL_ITEMS = 'all';\nShuffle.FILTER_ATTRIBUTE_KEY = 'groups';\n\n/**\n * @enum {string}\n */\nShuffle.EventType = {\n LAYOUT: 'shuffle:layout',\n REMOVED: 'shuffle:removed',\n};\n\n/** @enum {string} */\nShuffle.Classes = Classes;\n\n// Overrideable options\nShuffle.options = {\n // Initial filter group.\n group: Shuffle.ALL_ITEMS,\n\n // Transition/animation speed (milliseconds).\n speed: 250,\n\n // CSS easing function to use.\n easing: 'ease',\n\n // e.g. '.picture-item'.\n itemSelector: '*',\n\n // Element or selector string. Use an element to determine the size of columns\n // and gutters.\n sizer: null,\n\n // A static number or function that tells the plugin how wide the gutters\n // between columns are (in pixels).\n gutterWidth: 0,\n\n // A static number or function that returns a number which tells the plugin\n // how wide the columns are (in pixels).\n columnWidth: 0,\n\n // If your group is not json, and is comma delimeted, you could set delimeter\n // to ','.\n delimeter: null,\n\n // Useful for percentage based heights when they might not always be exactly\n // the same (in pixels).\n buffer: 0,\n\n // Reading the width of elements isn't precise enough and can cause columns to\n // jump between values.\n columnThreshold: 0.01,\n\n // Shuffle can be isInitialized with a sort object. It is the same object\n // given to the sort method.\n initialSort: null,\n\n // By default, shuffle will throttle resize events. This can be changed or\n // removed.\n throttle: throttle,\n\n // How often shuffle can be called on resize (in milliseconds).\n throttleTime: 300,\n\n // Transition delay offset for each item in milliseconds.\n staggerAmount: 15,\n\n // Maximum stagger delay in milliseconds.\n staggerAmountMax: 250,\n\n // Whether to use transforms or absolute positioning.\n useTransforms: true,\n};\n\n// Expose for testing.\nShuffle.Point = Point;\nShuffle.ShuffleItem = ShuffleItem;\nShuffle.sorter = sorter;\n\nmodule.exports = Shuffle;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle.js\n **/","// Polyfill for creating CustomEvents on IE9/10/11\n\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\ntry {\n new window.CustomEvent(\"test\");\n} catch(e) {\n var CustomEvent = function(event, params) {\n var evt;\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n\n evt = document.createEvent(\"CustomEvent\");\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/custom-event-polyfill/custom-event-polyfill.js\n ** module id = 1\n ** module chunks = 0\n **/","'use strict';\n\nvar proto = Element.prototype;\nvar vendor = proto.matches\n || proto.matchesSelector\n || proto.webkitMatchesSelector\n || proto.mozMatchesSelector\n || proto.msMatchesSelector\n || proto.oMatchesSelector;\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n if (vendor) return vendor.call(el, selector);\n var nodes = el.parentNode.querySelectorAll(selector);\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i] == el) return true;\n }\n return false;\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/matches-selector/index.js\n ** module id = 2\n ** module chunks = 0\n **/","'use strict';\n\n// there's 3 implementations written in increasing order of efficiency\n\n// 1 - no Set type is defined\nfunction uniqNoSet(arr) {\n\tvar ret = [];\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (ret.indexOf(arr[i]) === -1) {\n\t\t\tret.push(arr[i]);\n\t\t}\n\t}\n\n\treturn ret;\n}\n\n// 2 - a simple Set type is defined\nfunction uniqSet(arr) {\n\tvar seen = new Set();\n\treturn arr.filter(function (el) {\n\t\tif (!seen.has(el)) {\n\t\t\tseen.add(el);\n\t\t\treturn true;\n\t\t}\n\t});\n}\n\n// 3 - a standard Set type is defined and it has a forEach method\nfunction uniqSetWithForEach(arr) {\n\tvar ret = [];\n\n\t(new Set(arr)).forEach(function (el) {\n\t\tret.push(el);\n\t});\n\n\treturn ret;\n}\n\n// V8 currently has a broken implementation\n// https://github.com/joyent/node/issues/8449\nfunction doesForEachActuallyWork() {\n\tvar ret = false;\n\n\t(new Set([true])).forEach(function (el) {\n\t\tret = el;\n\t});\n\n\treturn ret === true;\n}\n\nif ('Set' in global) {\n\tif (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {\n\t\tmodule.exports = uniqSetWithForEach;\n\t} else {\n\t\tmodule.exports = uniqSet;\n\t}\n} else {\n\tmodule.exports = uniqNoSet;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/array-uniq/index.js\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/xtend/immutable.js\n ** module id = 4\n ** module chunks = 0\n **/","module.exports = throttle;\n\n/**\n * Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.\n *\n * @param {Function} func Function to wrap.\n * @param {Number} wait Number of milliseconds that must elapse between `func` invocations.\n * @return {Function} A new function that wraps the `func` function passed in.\n */\n\nfunction throttle (func, wait) {\n var ctx, args, rtn, timeoutID; // caching\n var last = 0;\n\n return function throttled () {\n ctx = this;\n args = arguments;\n var delta = new Date() - last;\n if (!timeoutID)\n if (delta >= wait) call();\n else timeoutID = setTimeout(call, wait - delta);\n return rtn;\n };\n\n function call () {\n timeoutID = 0;\n last = +new Date();\n rtn = func.apply(ctx, args);\n ctx = null;\n args = null;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/throttleit/index.js\n ** module id = 5\n ** module chunks = 0\n **/","'use strict';\n\nimport getNumber from './get-number';\n\n/**\n * Represents a coordinate pair.\n * @param {number} [x=0] X.\n * @param {number} [y=0] Y.\n */\nconst Point = function (x, y) {\n this.x = getNumber(x);\n this.y = getNumber(y);\n};\n\n/**\n * Whether two points are equal.\n * @param {Point} a Point A.\n * @param {Point} b Point B.\n * @return {boolean}\n */\nPoint.equals = function (a, b) {\n return a.x === b.x && a.y === b.y;\n};\n\nexport default Point;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/point.js\n **/","'use strict';\n\n/**\n * Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.\n * @param {*} value Possibly numeric value.\n * @return {number} `value` or zero if `value` isn't numeric.\n */\nexport default function getNumber(value) {\n return parseFloat(value) || 0;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number.js\n **/","import Point from './point';\nimport Classes from './classes';\n\nlet id = 0;\n\nclass ShuffleItem {\n constructor(element) {\n this.id = id++;\n this.element = element;\n this.isVisible = true;\n }\n\n show() {\n this.isVisible = true;\n this.element.classList.remove(Classes.HIDDEN);\n this.element.classList.add(Classes.VISIBLE);\n }\n\n hide() {\n this.isVisible = false;\n this.element.classList.remove(Classes.VISIBLE);\n this.element.classList.add(Classes.HIDDEN);\n }\n\n init() {\n this.addClasses([Classes.SHUFFLE_ITEM, Classes.VISIBLE]);\n this.applyCss(ShuffleItem.Css.INITIAL);\n this.scale = ShuffleItem.Scale.VISIBLE;\n this.point = new Point();\n }\n\n addClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.add(className);\n });\n }\n\n removeClasses(classes) {\n classes.forEach((className) => {\n this.element.classList.remove(className);\n });\n }\n\n applyCss(obj) {\n for (var key in obj) {\n this.element.style[key] = obj[key];\n }\n }\n\n dispose() {\n this.removeClasses([\n Classes.HIDDEN,\n Classes.VISIBLE,\n Classes.SHUFFLE_ITEM,\n ]);\n\n this.element.removeAttribute('style');\n this.element = null;\n }\n}\n\nShuffleItem.Css = {\n INITIAL: {\n position: 'absolute',\n top: 0,\n left: 0,\n visibility: 'visible',\n 'will-change': 'transform',\n },\n VISIBLE: {\n before: {\n opacity: 1,\n visibility: 'visible',\n },\n after: {},\n },\n HIDDEN: {\n before: {\n opacity: 0,\n },\n after: {\n visibility: 'hidden',\n },\n },\n};\n\nShuffleItem.Scale = {\n VISIBLE: 1,\n HIDDEN: 0.001,\n};\n\nexport default ShuffleItem;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/shuffle-item.js\n **/","module.exports = {\n BASE: 'shuffle',\n SHUFFLE_ITEM: 'shuffle-item',\n VISIBLE: 'shuffle-item--visible',\n HIDDEN: 'shuffle-item--hidden',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/classes.js\n **/","'use strict';\n\nimport getNumber from './get-number';\nimport COMPUTED_SIZE_INCLUDES_PADDING from './computed-size';\n\n/**\n * Retrieve the computed style for an element, parsed as a float.\n * @param {Element} element Element to get style for.\n * @param {string} style Style property.\n * @param {CSSStyleDeclaration} [styles] Optionally include clean styles to\n * use instead of asking for them again.\n * @return {number} The parsed computed value or zero if that fails because IE\n * will return 'auto' when the element doesn't have margins instead of\n * the computed style.\n */\nexport default function getNumberStyle(element, style,\n styles = window.getComputedStyle(element, null)) {\n var value = getNumber(styles[style]);\n\n // Support IE<=11 and W3C spec.\n if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'width') {\n value += getNumber(styles.paddingLeft) +\n getNumber(styles.paddingRight) +\n getNumber(styles.borderLeftWidth) +\n getNumber(styles.borderRightWidth);\n } else if (!COMPUTED_SIZE_INCLUDES_PADDING && style === 'height') {\n value += getNumber(styles.paddingTop) +\n getNumber(styles.paddingBottom) +\n getNumber(styles.borderTopWidth) +\n getNumber(styles.borderBottomWidth);\n }\n\n return value;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/get-number-style.js\n **/","\nlet element = document.body || document.documentElement;\nlet e = document.createElement('div');\ne.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';\nelement.appendChild(e);\n\nlet width = window.getComputedStyle(e, null).width;\nlet ret = width === '10px';\n\nelement.removeChild(e);\n\nexport default ret;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/computed-size.js\n **/","'use strict';\n\nimport xtend from 'xtend';\n\n// http://stackoverflow.com/a/962890/373422\nfunction randomize(array) {\n var tmp;\n var current;\n let top = array.length;\n\n if (!top) {\n return array;\n }\n\n while (--top) {\n current = Math.floor(Math.random() * (top + 1));\n tmp = array[current];\n array[current] = array[top];\n array[top] = tmp;\n }\n\n return array;\n}\n\nlet defaults = {\n // Use array.reverse() to reverse the results\n reverse: false,\n\n // Sorting function\n by: null,\n\n // If true, this will skip the sorting and return a randomized order in the array\n randomize: false,\n\n // Determines which property of each item in the array is passed to the\n // sorting method.\n key: 'element',\n};\n\n// You can return `undefined` from the `by` function to revert to DOM order.\nexport default function sorter(arr, options) {\n let opts = xtend(defaults, options);\n let original = [].slice.call(arr);\n let revert = false;\n\n if (!arr.length) {\n return [];\n }\n\n if (opts.randomize) {\n return randomize(arr);\n }\n\n // Sort the elements by the opts.by function.\n // If we don't have opts.by, default to DOM order\n if (typeof opts.by === 'function') {\n arr.sort(function (a, b) {\n\n // Exit early if we already know we want to revert\n if (revert) {\n return 0;\n }\n\n let valA = opts.by(a[opts.key]);\n let valB = opts.by(b[opts.key]);\n\n // If both values are undefined, use the DOM order\n if (valA === undefined && valB === undefined) {\n revert = true;\n return 0;\n }\n\n if (valA < valB || valA === 'sortFirst' || valB === 'sortLast') {\n return -1;\n }\n\n if (valA > valB || valA === 'sortLast' || valB === 'sortFirst') {\n return 1;\n }\n\n return 0;\n });\n }\n\n // Revert to the original array if necessary\n if (revert) {\n return original;\n }\n\n if (opts.reverse) {\n arr.reverse();\n }\n\n return arr;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/sorter.js\n **/","'use strict';\n\nlet transitions = {};\nlet eventName = 'transitionend';\nlet count = 0;\n\nfunction uniqueId() {\n return eventName + count++;\n}\n\nexport function onTransitionEnd(element, callback) {\n let id = uniqueId();\n let listener = (evt) => {\n if (evt.currentTarget === evt.target) {\n cancelTransitionEnd(id);\n callback(evt);\n }\n };\n\n element.addEventListener(eventName, listener);\n\n transitions[id] = { element, listener };\n\n return id;\n}\n\nexport function cancelTransitionEnd(id) {\n if (transitions[id]) {\n transitions[id].element.removeEventListener(eventName, transitions[id].listener);\n transitions[id] = null;\n return true;\n }\n\n return false;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/on-transition-end.js\n **/","'use strict';\n\nimport Point from './point';\n\nfunction arrayMax(array) {\n return Math.max.apply(Math, array);\n}\n\nfunction arrayMin(array) {\n return Math.min.apply(Math, array);\n}\n\n/**\n * Determine the location of the next item, based on its size.\n * @param {Object} itemSize Object with width and height.\n * @param {Array.} positions Positions of the other current items.\n * @param {number} gridSize The column width or row height.\n * @param {number} total The total number of columns or rows.\n * @param {number} threshold Buffer value for the column to fit.\n * @param {number} buffer Vertical buffer for the height of items.\n * @return {Point}\n */\nexport function getItemPosition({ itemSize, positions, gridSize, total, threshold, buffer }) {\n var span = getColumnSpan(itemSize.width, gridSize, total, threshold);\n var setY = getAvailablePositions(positions, span, total);\n var shortColumnIndex = getShortColumn(setY, buffer);\n\n // Position the item\n var point = new Point(\n Math.round(gridSize * shortColumnIndex),\n Math.round(setY[shortColumnIndex]));\n\n // Update the columns array with the new values for each column.\n // e.g. before the update the columns could be [250, 0, 0, 0] for an item\n // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0].\n var setHeight = setY[shortColumnIndex] + itemSize.height;\n for (var i = 0; i < span; i++) {\n positions[shortColumnIndex + i] = setHeight;\n }\n\n return point;\n}\n\n/**\n * Determine the number of columns an items spans.\n * @param {number} itemWidth Width of the item.\n * @param {number} columnWidth Width of the column (includes gutter).\n * @param {number} columns Total number of columns\n * @param {number} threshold A buffer value for the size of the column to fit.\n * @return {number}\n */\nfunction getColumnSpan(itemWidth, columnWidth, columns, threshold) {\n var columnSpan = itemWidth / columnWidth;\n\n // If the difference between the rounded column span number and the\n // calculated column span number is really small, round the number to\n // make it fit.\n if (Math.abs(Math.round(columnSpan) - columnSpan) < threshold) {\n // e.g. columnSpan = 4.0089945390298745\n columnSpan = Math.round(columnSpan);\n }\n\n // Ensure the column span is not more than the amount of columns in the whole layout.\n return Math.min(Math.ceil(columnSpan), columns);\n}\n\n/**\n * Retrieves the column set to use for placement.\n * @param {number} columnSpan The number of columns this current item spans.\n * @param {number} columns The total columns in the grid.\n * @return {Array.} An array of numbers represeting the column set.\n */\nfunction getAvailablePositions(positions, columnSpan, columns) {\n // The item spans only one column.\n if (columnSpan === 1) {\n return positions;\n }\n\n // The item spans more than one column, figure out how many different\n // places it could fit horizontally.\n // The group count is the number of places within the positions this block\n // could fit, ignoring the current positions of items.\n // Imagine a 2 column brick as the second item in a 4 column grid with\n // 10px height each. Find the places it would fit:\n // [20, 10, 10, 0]\n // | | |\n // * * *\n //\n // Then take the places which fit and get the bigger of the two:\n // max([20, 10]), max([10, 10]), max([10, 0]) = [20, 10, 0]\n //\n // Next, find the first smallest number (the short column).\n // [20, 10, 0]\n // |\n // *\n //\n // And that's where it should be placed!\n //\n // Another example where the second column's item extends past the first:\n // [10, 20, 10, 0] => [20, 20, 10] => 10\n var available = [];\n\n // For how many possible positions for this item there are.\n for (var i = 0; i <= columns - columnSpan; i++) {\n // Find the bigger value for each place it could fit.\n available.push(arrayMax(positions.slice(i, i + columnSpan)));\n }\n\n return available;\n}\n\n/**\n * Find index of short column, the first from the left where this item will go.\n *\n * @param {Array.} positions The array to search for the smallest number.\n * @param {number} buffer Optional buffer which is very useful when the height\n * is a percentage of the width.\n * @return {number} Index of the short column.\n */\nfunction getShortColumn(positions, buffer) {\n var minPosition = arrayMin(positions);\n for (var i = 0, len = positions.length; i < len; i++) {\n if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) {\n return i;\n }\n }\n\n return 0;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layout.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/src/layout.js b/src/layout.js new file mode 100644 index 0000000..e93346b --- /dev/null +++ b/src/layout.js @@ -0,0 +1,129 @@ +'use strict'; + +import Point from './point'; + +function arrayMax(array) { + return Math.max.apply(Math, array); +} + +function arrayMin(array) { + return Math.min.apply(Math, array); +} + +/** + * Determine the location of the next item, based on its size. + * @param {Object} itemSize Object with width and height. + * @param {Array.} positions Positions of the other current items. + * @param {number} gridSize The column width or row height. + * @param {number} total The total number of columns or rows. + * @param {number} threshold Buffer value for the column to fit. + * @param {number} buffer Vertical buffer for the height of items. + * @return {Point} + */ +export function getItemPosition({ itemSize, positions, gridSize, total, threshold, buffer }) { + var span = getColumnSpan(itemSize.width, gridSize, total, threshold); + var setY = getAvailablePositions(positions, span, total); + var shortColumnIndex = getShortColumn(setY, buffer); + + // Position the item + var point = new Point( + Math.round(gridSize * shortColumnIndex), + Math.round(setY[shortColumnIndex])); + + // Update the columns array with the new values for each column. + // e.g. before the update the columns could be [250, 0, 0, 0] for an item + // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0]. + var setHeight = setY[shortColumnIndex] + itemSize.height; + for (var i = 0; i < span; i++) { + positions[shortColumnIndex + i] = setHeight; + } + + return point; +} + +/** + * Determine the number of columns an items spans. + * @param {number} itemWidth Width of the item. + * @param {number} columnWidth Width of the column (includes gutter). + * @param {number} columns Total number of columns + * @param {number} threshold A buffer value for the size of the column to fit. + * @return {number} + */ +function getColumnSpan(itemWidth, columnWidth, columns, threshold) { + var columnSpan = itemWidth / columnWidth; + + // If the difference between the rounded column span number and the + // calculated column span number is really small, round the number to + // make it fit. + if (Math.abs(Math.round(columnSpan) - columnSpan) < threshold) { + // e.g. columnSpan = 4.0089945390298745 + columnSpan = Math.round(columnSpan); + } + + // Ensure the column span is not more than the amount of columns in the whole layout. + return Math.min(Math.ceil(columnSpan), columns); +} + +/** + * Retrieves the column set to use for placement. + * @param {number} columnSpan The number of columns this current item spans. + * @param {number} columns The total columns in the grid. + * @return {Array.} An array of numbers represeting the column set. + */ +function getAvailablePositions(positions, columnSpan, columns) { + // The item spans only one column. + if (columnSpan === 1) { + return positions; + } + + // The item spans more than one column, figure out how many different + // places it could fit horizontally. + // The group count is the number of places within the positions this block + // could fit, ignoring the current positions of items. + // Imagine a 2 column brick as the second item in a 4 column grid with + // 10px height each. Find the places it would fit: + // [20, 10, 10, 0] + // | | | + // * * * + // + // Then take the places which fit and get the bigger of the two: + // max([20, 10]), max([10, 10]), max([10, 0]) = [20, 10, 0] + // + // Next, find the first smallest number (the short column). + // [20, 10, 0] + // | + // * + // + // And that's where it should be placed! + // + // Another example where the second column's item extends past the first: + // [10, 20, 10, 0] => [20, 20, 10] => 10 + var available = []; + + // For how many possible positions for this item there are. + for (var i = 0; i <= columns - columnSpan; i++) { + // Find the bigger value for each place it could fit. + available.push(arrayMax(positions.slice(i, i + columnSpan))); + } + + return available; +} + +/** + * Find index of short column, the first from the left where this item will go. + * + * @param {Array.} positions The array to search for the smallest number. + * @param {number} buffer Optional buffer which is very useful when the height + * is a percentage of the width. + * @return {number} Index of the short column. + */ +function getShortColumn(positions, buffer) { + var minPosition = arrayMin(positions); + for (var i = 0, len = positions.length; i < len; i++) { + if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) { + return i; + } + } + + return 0; +} diff --git a/src/shuffle.js b/src/shuffle.js index fae209e..7d48b23 100644 --- a/src/shuffle.js +++ b/src/shuffle.js @@ -11,6 +11,7 @@ import Classes from './classes'; import getNumberStyle from './get-number-style'; import sorter from './sorter'; import { onTransitionEnd, cancelTransitionEnd } from './on-transition-end'; +import { getItemPosition } from './layout'; function toArray(arrayLike) { return Array.prototype.slice.call(arrayLike); @@ -20,10 +21,6 @@ function arrayMax(array) { return Math.max.apply(Math, array); } -function arrayMin(array) { - return Math.min.apply(Math, array); -} - function arrayIncludes(array, obj) { if (arguments.length === 2) { return arrayIncludes(array)(obj); @@ -532,116 +529,14 @@ class Shuffle { * @private */ _getItemPosition(itemSize) { - var columnSpan = this._getColumnSpan(itemSize.width, this.colWidth, this.cols); - - var setY = this._getColumnSet(columnSpan, this.cols); - - // Finds the index of the smallest number in the set. - var shortColumnIndex = this._getShortColumn(setY, this.options.buffer); - - // Position the item - var point = new Point( - Math.round(this.colWidth * shortColumnIndex), - Math.round(setY[shortColumnIndex])); - - // Update the columns array with the new values for each column. - // e.g. before the update the columns could be [250, 0, 0, 0] for an item - // which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0]. - var setHeight = setY[shortColumnIndex] + itemSize.height; - var setSpan = this.cols + 1 - setY.length; - for (var i = 0; i < setSpan; i++) { - this.positions[shortColumnIndex + i] = setHeight; - } - - return point; - } - - /** - * Determine the number of columns an items spans. - * @param {number} itemWidth Width of the item. - * @param {number} columnWidth Width of the column (includes gutter). - * @param {number} columns Total number of columns - * @return {number} - * @private - */ - _getColumnSpan(itemWidth, columnWidth, columns) { - var columnSpan = itemWidth / columnWidth; - - // If the difference between the rounded column span number and the - // calculated column span number is really small, round the number to - // make it fit. - if (Math.abs(Math.round(columnSpan) - columnSpan) < this.options.columnThreshold) { - // e.g. columnSpan = 4.0089945390298745 - columnSpan = Math.round(columnSpan); - } - - // Ensure the column span is not more than the amount of columns in the whole layout. - return Math.min(Math.ceil(columnSpan), columns); - } - - /** - * Retrieves the column set to use for placement. - * @param {number} columnSpan The number of columns this current item spans. - * @param {number} columns The total columns in the grid. - * @return {Array.} An array of numbers represeting the column set. - * @private - */ - _getColumnSet(columnSpan, columns) { - // The item spans only one column. - if (columnSpan === 1) { - return this.positions; - - // The item spans more than one column, figure out how many different - // places it could fit horizontally. - // The group count is the number of places within the positions this block - // could fit, ignoring the current positions of items. - // Imagine a 2 column brick as the second item in a 4 column grid with - // 10px height each. Find the places it would fit: - // [10, 0, 0, 0] - // | | | - // * * * - // - // Then take the places which fit and get the bigger of the two: - // max([10, 0]), max([0, 0]), max([0, 0]) = [10, 0, 0] - // - // Next, find the first smallest number (the short column). - // [10, 0, 0] - // | - // * - // - // And that's where it should be placed! - } else { - var groupCount = columns + 1 - columnSpan; - var groupY = []; - - // For how many possible positions for this item there are. - for (var i = 0; i < groupCount; i++) { - // Find the bigger value for each place it could fit. - groupY[i] = arrayMax(this.positions.slice(i, i + columnSpan)); - } - - return groupY; - } - } - - /** - * Find index of short column, the first from the left where this item will go. - * - * @param {Array.} positions The array to search for the smallest number. - * @param {number} buffer Optional buffer which is very useful when the height - * is a percentage of the width. - * @return {number} Index of the short column. - * @private - */ - _getShortColumn(positions, buffer) { - var minPosition = arrayMin(positions); - for (var i = 0, len = positions.length; i < len; i++) { - if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) { - return i; - } - } - - return 0; + return getItemPosition({ + itemSize, + positions: this.positions, + gridSize: this.colWidth, + total: this.cols, + threshold: this.options.columnThreshold, + buffer: this.options.buffer, + }); } /**