UNPKG

45.4 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("jquery"));
4 else if(typeof define === 'function' && define.amd)
5 define(["jquery"], factory);
6 else if(typeof exports === 'object')
7 exports["foundation.core"] = factory(require("jquery"));
8 else
9 root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.core"] = factory(root["jQuery"]);
10})(window, function(__WEBPACK_EXTERNAL_MODULE_jquery__) {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50/******/ }
51/******/ };
52/******/
53/******/ // define __esModule on exports
54/******/ __webpack_require__.r = function(exports) {
55/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57/******/ }
58/******/ Object.defineProperty(exports, '__esModule', { value: true });
59/******/ };
60/******/
61/******/ // create a fake namespace object
62/******/ // mode & 1: value is a module id, require it
63/******/ // mode & 2: merge all properties of value into the ns
64/******/ // mode & 4: return value when already ns object
65/******/ // mode & 8|1: behave like require
66/******/ __webpack_require__.t = function(value, mode) {
67/******/ if(mode & 1) value = __webpack_require__(value);
68/******/ if(mode & 8) return value;
69/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70/******/ var ns = Object.create(null);
71/******/ __webpack_require__.r(ns);
72/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74/******/ return ns;
75/******/ };
76/******/
77/******/ // getDefaultExport function for compatibility with non-harmony modules
78/******/ __webpack_require__.n = function(module) {
79/******/ var getter = module && module.__esModule ?
80/******/ function getDefault() { return module['default']; } :
81/******/ function getModuleExports() { return module; };
82/******/ __webpack_require__.d(getter, 'a', getter);
83/******/ return getter;
84/******/ };
85/******/
86/******/ // Object.prototype.hasOwnProperty.call
87/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ // __webpack_public_path__
90/******/ __webpack_require__.p = "";
91/******/
92/******/
93/******/ // Load entry module and return exports
94/******/ return __webpack_require__(__webpack_require__.s = 0);
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ "./js/entries/plugins/foundation.core.js":
100/*!***********************************************!*\
101 !*** ./js/entries/plugins/foundation.core.js ***!
102 \***********************************************/
103/*! exports provided: Foundation, Plugin, rtl, GetYoDigits, RegExpEscape, transitionend, onLoad, ignoreMousedisappear */
104/***/ (function(module, __webpack_exports__, __webpack_require__) {
105
106"use strict";
107__webpack_require__.r(__webpack_exports__);
108/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
109/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
110/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.core */ "./js/foundation.core.js");
111/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"]; });
112
113/* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../foundation.core.plugin */ "./js/foundation.core.plugin.js");
114/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../foundation.core.utils */ "./js/foundation.core.utils.js");
115/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Plugin", function() { return _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__["Plugin"]; });
116
117/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "rtl", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["rtl"]; });
118
119/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GetYoDigits", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"]; });
120
121/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RegExpEscape", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["RegExpEscape"]; });
122
123/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "transitionend", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"]; });
124
125/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onLoad", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["onLoad"]; });
126
127/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreMousedisappear", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["ignoreMousedisappear"]; });
128
129// --- Foundation Core API ---
130// Initialize Foundation and add some utilities to its public API for backward compatibility.
131// Please note that every utility do not have to be added to the core API.
132
133
134
135
136_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].addToJquery(jquery__WEBPACK_IMPORTED_MODULE_0___default.a); // Every plugin depends on plugin now, we can include that on the core for the
137// script inclusion path.
138
139_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].Plugin = _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__["Plugin"]; // These are now separated out, but historically were a part of this module,
140// and since this is here for backwards compatibility we include them in
141// this entry.
142
143_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].rtl = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["rtl"];
144_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].GetYoDigits = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"];
145_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].transitionend = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"];
146_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].RegExpEscape = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["RegExpEscape"];
147_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].onLoad = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["onLoad"];
148window.Foundation = _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"]; // --- Foundation Core exports ---
149// Export "Plugin" and all core utilities, since the `foundation.core` entry plays the role of
150// all core source files.
151
152
153
154
155
156/***/ }),
157
158/***/ "./js/foundation.core.js":
159/*!*******************************!*\
160 !*** ./js/foundation.core.js ***!
161 \*******************************/
162/*! exports provided: Foundation */
163/***/ (function(module, __webpack_exports__, __webpack_require__) {
164
165"use strict";
166__webpack_require__.r(__webpack_exports__);
167/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return Foundation; });
168/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
169/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
170/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./js/foundation.core.utils.js");
171/* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.mediaQuery */ "./js/foundation.util.mediaQuery.js");
172
173
174function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
175
176
177
178
179var FOUNDATION_VERSION = '6.6.3'; // Global Foundation object
180// This is attached to the window, or used as a module for AMD/Browserify
181
182var Foundation = {
183 version: FOUNDATION_VERSION,
184
185 /**
186 * Stores initialized plugins.
187 */
188 _plugins: {},
189
190 /**
191 * Stores generated unique ids for plugin instances
192 */
193 _uuids: [],
194
195 /**
196 * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing.
197 * @param {Object} plugin - The constructor of the plugin.
198 */
199 plugin: function plugin(_plugin, name) {
200 // Object key to use when adding to global Foundation object
201 // Examples: Foundation.Reveal, Foundation.OffCanvas
202 var className = name || functionName(_plugin); // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin
203 // Examples: data-reveal, data-off-canvas
204
205 var attrName = hyphenate(className); // Add to the Foundation object and the plugins list (for reflowing)
206
207 this._plugins[attrName] = this[className] = _plugin;
208 },
209
210 /**
211 * @function
212 * Populates the _uuids array with pointers to each individual plugin instance.
213 * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls.
214 * Also fires the initialization event for each plugin, consolidating repetitive code.
215 * @param {Object} plugin - an instance of a plugin, usually `this` in context.
216 * @param {String} name - the name of the plugin, passed as a camelCased string.
217 * @fires Plugin#init
218 */
219 registerPlugin: function registerPlugin(plugin, name) {
220 var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase();
221 plugin.uuid = Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, pluginName);
222
223 if (!plugin.$element.attr("data-".concat(pluginName))) {
224 plugin.$element.attr("data-".concat(pluginName), plugin.uuid);
225 }
226
227 if (!plugin.$element.data('zfPlugin')) {
228 plugin.$element.data('zfPlugin', plugin);
229 }
230 /**
231 * Fires when the plugin has initialized.
232 * @event Plugin#init
233 */
234
235
236 plugin.$element.trigger("init.zf.".concat(pluginName));
237
238 this._uuids.push(plugin.uuid);
239
240 return;
241 },
242
243 /**
244 * @function
245 * Removes the plugins uuid from the _uuids array.
246 * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute.
247 * Also fires the destroyed event for the plugin, consolidating repetitive code.
248 * @param {Object} plugin - an instance of a plugin, usually `this` in context.
249 * @fires Plugin#destroyed
250 */
251 unregisterPlugin: function unregisterPlugin(plugin) {
252 var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor));
253
254 this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1);
255
256 plugin.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin')
257 /**
258 * Fires when the plugin has been destroyed.
259 * @event Plugin#destroyed
260 */
261 .trigger("destroyed.zf.".concat(pluginName));
262
263 for (var prop in plugin) {
264 plugin[prop] = null; //clean up script to prep for garbage collection.
265 }
266
267 return;
268 },
269
270 /**
271 * @function
272 * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc.
273 * @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'`
274 * @default If no argument is passed, reflow all currently active plugins.
275 */
276 reInit: function reInit(plugins) {
277 var isJQ = plugins instanceof jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
278
279 try {
280 if (isJQ) {
281 plugins.each(function () {
282 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('zfPlugin')._init();
283 });
284 } else {
285 var type = _typeof(plugins),
286 _this = this,
287 fns = {
288 'object': function object(plgs) {
289 plgs.forEach(function (p) {
290 p = hyphenate(p);
291 jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-' + p + ']').foundation('_init');
292 });
293 },
294 'string': function string() {
295 plugins = hyphenate(plugins);
296 jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-' + plugins + ']').foundation('_init');
297 },
298 'undefined': function undefined() {
299 this['object'](Object.keys(_this._plugins));
300 }
301 };
302
303 fns[type](plugins);
304 }
305 } catch (err) {
306 console.error(err);
307 } finally {
308 return plugins;
309 }
310 },
311
312 /**
313 * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized.
314 * @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object.
315 * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything.
316 */
317 reflow: function reflow(elem, plugins) {
318 // If plugins is undefined, just grab everything
319 if (typeof plugins === 'undefined') {
320 plugins = Object.keys(this._plugins);
321 } // If plugins is a string, convert it to an array with one item
322 else if (typeof plugins === 'string') {
323 plugins = [plugins];
324 }
325
326 var _this = this; // Iterate through each plugin
327
328
329 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each(plugins, function (i, name) {
330 // Get the current plugin
331 var plugin = _this._plugins[name]; // Localize the search to all elements inside elem, as well as elem itself, unless elem === document
332
333 var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(elem).find('[data-' + name + ']').addBack('[data-' + name + ']').filter(function () {
334 return typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data("zfPlugin") === 'undefined';
335 }); // For each plugin found, initialize it
336
337 $elem.each(function () {
338 var $el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
339 opts = {
340 reflow: true
341 };
342
343 if ($el.attr('data-options')) {
344 $el.attr('data-options').split(';').forEach(function (option, _index) {
345 var opt = option.split(':').map(function (el) {
346 return el.trim();
347 });
348 if (opt[0]) opts[opt[0]] = parseValue(opt[1]);
349 });
350 }
351
352 try {
353 $el.data('zfPlugin', new plugin(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), opts));
354 } catch (er) {
355 console.error(er);
356 } finally {
357 return;
358 }
359 });
360 });
361 },
362 getFnName: functionName,
363 addToJquery: function addToJquery($) {
364 // TODO: consider not making this a jQuery function
365 // TODO: need way to reflow vs. re-initialize
366
367 /**
368 * The Foundation jQuery method.
369 * @param {String|Array} method - An action to perform on the current jQuery object.
370 */
371 var foundation = function foundation(method) {
372 var type = _typeof(method),
373 $noJS = $('.no-js');
374
375 if ($noJS.length) {
376 $noJS.removeClass('no-js');
377 }
378
379 if (type === 'undefined') {
380 //needs to initialize the Foundation object, or an individual plugin.
381 _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__["MediaQuery"]._init();
382
383 Foundation.reflow(this);
384 } else if (type === 'string') {
385 //an individual method to invoke on a plugin or group of plugins
386 var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary
387
388 var plugClass = this.data('zfPlugin'); //determine the class of plugin
389
390 if (typeof plugClass !== 'undefined' && typeof plugClass[method] !== 'undefined') {
391 //make sure both the class and method exist
392 if (this.length === 1) {
393 //if there's only one, call it directly.
394 plugClass[method].apply(plugClass, args);
395 } else {
396 this.each(function (i, el) {
397 //otherwise loop through the jQuery collection and invoke the method on each
398 plugClass[method].apply($(el).data('zfPlugin'), args);
399 });
400 }
401 } else {
402 //error for no class or no method
403 throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.');
404 }
405 } else {
406 //error for invalid argument type
407 throw new TypeError("We're sorry, ".concat(type, " is not a valid parameter. You must use a string representing the method you wish to invoke."));
408 }
409
410 return this;
411 };
412
413 $.fn.foundation = foundation;
414 return $;
415 }
416};
417Foundation.util = {
418 /**
419 * Function for applying a debounce effect to a function call.
420 * @function
421 * @param {Function} func - Function to be called at end of timeout.
422 * @param {Number} delay - Time in ms to delay the call of `func`.
423 * @returns function
424 */
425 throttle: function throttle(func, delay) {
426 var timer = null;
427 return function () {
428 var context = this,
429 args = arguments;
430
431 if (timer === null) {
432 timer = setTimeout(function () {
433 func.apply(context, args);
434 timer = null;
435 }, delay);
436 }
437 };
438 }
439};
440window.Foundation = Foundation; // Polyfill for requestAnimationFrame
441
442(function () {
443 if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () {
444 return new Date().getTime();
445 };
446 var vendors = ['webkit', 'moz'];
447
448 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
449 var vp = vendors[i];
450 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
451 window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame'];
452 }
453
454 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
455 var lastTime = 0;
456
457 window.requestAnimationFrame = function (callback) {
458 var now = Date.now();
459 var nextTime = Math.max(lastTime + 16, now);
460 return setTimeout(function () {
461 callback(lastTime = nextTime);
462 }, nextTime - now);
463 };
464
465 window.cancelAnimationFrame = clearTimeout;
466 }
467 /**
468 * Polyfill for performance.now, required by rAF
469 */
470
471
472 if (!window.performance || !window.performance.now) {
473 window.performance = {
474 start: Date.now(),
475 now: function now() {
476 return Date.now() - this.start;
477 }
478 };
479 }
480})();
481
482if (!Function.prototype.bind) {
483 Function.prototype.bind = function (oThis) {
484 if (typeof this !== 'function') {
485 // closest thing possible to the ECMAScript 5
486 // internal IsCallable function
487 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
488 }
489
490 var aArgs = Array.prototype.slice.call(arguments, 1),
491 fToBind = this,
492 fNOP = function fNOP() {},
493 fBound = function fBound() {
494 return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
495 };
496
497 if (this.prototype) {
498 // native functions don't have a prototype
499 fNOP.prototype = this.prototype;
500 }
501
502 fBound.prototype = new fNOP();
503 return fBound;
504 };
505} // Polyfill to get the name of a function in IE9
506
507
508function functionName(fn) {
509 if (typeof Function.prototype.name === 'undefined') {
510 var funcNameRegex = /function\s([^(]{1,})\(/;
511 var results = funcNameRegex.exec(fn.toString());
512 return results && results.length > 1 ? results[1].trim() : "";
513 } else if (typeof fn.prototype === 'undefined') {
514 return fn.constructor.name;
515 } else {
516 return fn.prototype.constructor.name;
517 }
518}
519
520function parseValue(str) {
521 if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str);
522 return str;
523} // Convert PascalCase to kebab-case
524// Thank you: http://stackoverflow.com/a/8955580
525
526
527function hyphenate(str) {
528 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
529}
530
531
532
533/***/ }),
534
535/***/ "./js/foundation.core.plugin.js":
536/*!**************************************!*\
537 !*** ./js/foundation.core.plugin.js ***!
538 \**************************************/
539/*! exports provided: Plugin */
540/***/ (function(module, __webpack_exports__, __webpack_require__) {
541
542"use strict";
543__webpack_require__.r(__webpack_exports__);
544/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plugin", function() { return Plugin; });
545/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
546/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
547/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./js/foundation.core.utils.js");
548
549
550function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
551
552function _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); } }
553
554function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
555
556
557 // Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST
558// {function} _setup (replaces previous constructor),
559// {function} _destroy (replaces previous destroy)
560
561var Plugin =
562/*#__PURE__*/
563function () {
564 function Plugin(element, options) {
565 _classCallCheck(this, Plugin);
566
567 this._setup(element, options);
568
569 var pluginName = getPluginName(this);
570 this.uuid = Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, pluginName);
571
572 if (!this.$element.attr("data-".concat(pluginName))) {
573 this.$element.attr("data-".concat(pluginName), this.uuid);
574 }
575
576 if (!this.$element.data('zfPlugin')) {
577 this.$element.data('zfPlugin', this);
578 }
579 /**
580 * Fires when the plugin has initialized.
581 * @event Plugin#init
582 */
583
584
585 this.$element.trigger("init.zf.".concat(pluginName));
586 }
587
588 _createClass(Plugin, [{
589 key: "destroy",
590 value: function destroy() {
591 this._destroy();
592
593 var pluginName = getPluginName(this);
594 this.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin')
595 /**
596 * Fires when the plugin has been destroyed.
597 * @event Plugin#destroyed
598 */
599 .trigger("destroyed.zf.".concat(pluginName));
600
601 for (var prop in this) {
602 this[prop] = null; //clean up script to prep for garbage collection.
603 }
604 }
605 }]);
606
607 return Plugin;
608}(); // Convert PascalCase to kebab-case
609// Thank you: http://stackoverflow.com/a/8955580
610
611
612function hyphenate(str) {
613 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
614}
615
616function getPluginName(obj) {
617 return hyphenate(obj.className);
618}
619
620
621
622/***/ }),
623
624/***/ "./js/foundation.core.utils.js":
625/*!*************************************!*\
626 !*** ./js/foundation.core.utils.js ***!
627 \*************************************/
628/*! exports provided: rtl, GetYoDigits, RegExpEscape, transitionend, onLoad, ignoreMousedisappear */
629/***/ (function(module, __webpack_exports__, __webpack_require__) {
630
631"use strict";
632__webpack_require__.r(__webpack_exports__);
633/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rtl", function() { return rtl; });
634/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GetYoDigits", function() { return GetYoDigits; });
635/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegExpEscape", function() { return RegExpEscape; });
636/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transitionend", function() { return transitionend; });
637/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onLoad", function() { return onLoad; });
638/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ignoreMousedisappear", function() { return ignoreMousedisappear; });
639/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
640/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
641
642
643 // Core Foundation Utilities, utilized in a number of places.
644
645/**
646 * Returns a boolean for RTL support
647 */
648
649function rtl() {
650 return jquery__WEBPACK_IMPORTED_MODULE_0___default()('html').attr('dir') === 'rtl';
651}
652/**
653 * returns a random base-36 uid with namespacing
654 * @function
655 * @param {Number} length - number of random base-36 digits desired. Increase for more random strings.
656 * @param {String} namespace - name of plugin to be incorporated in uid, optional.
657 * @default {String} '' - if no plugin name is provided, nothing is appended to the uid.
658 * @returns {String} - unique id
659 */
660
661
662function GetYoDigits() {
663 var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
664 var namespace = arguments.length > 1 ? arguments[1] : undefined;
665 var str = '';
666 var chars = '0123456789abcdefghijklmnopqrstuvwxyz';
667 var charsLength = chars.length;
668
669 for (var i = 0; i < length; i++) {
670 str += chars[Math.floor(Math.random() * charsLength)];
671 }
672
673 return namespace ? "".concat(str, "-").concat(namespace) : str;
674}
675/**
676 * Escape a string so it can be used as a regexp pattern
677 * @function
678 * @see https://stackoverflow.com/a/9310752/4317384
679 *
680 * @param {String} str - string to escape.
681 * @returns {String} - escaped string
682 */
683
684
685function RegExpEscape(str) {
686 return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
687}
688
689function transitionend($elem) {
690 var transitions = {
691 'transition': 'transitionend',
692 'WebkitTransition': 'webkitTransitionEnd',
693 'MozTransition': 'transitionend',
694 'OTransition': 'otransitionend'
695 };
696 var elem = document.createElement('div'),
697 end;
698
699 for (var transition in transitions) {
700 if (typeof elem.style[transition] !== 'undefined') {
701 end = transitions[transition];
702 }
703 }
704
705 if (end) {
706 return end;
707 } else {
708 setTimeout(function () {
709 $elem.triggerHandler('transitionend', [$elem]);
710 }, 1);
711 return 'transitionend';
712 }
713}
714/**
715 * Return an event type to listen for window load.
716 *
717 * If `$elem` is passed, an event will be triggered on `$elem`. If window is already loaded, the event will still be triggered.
718 * If `handler` is passed, attach it to the event on `$elem`.
719 * Calling `onLoad` without handler allows you to get the event type that will be triggered before attaching the handler by yourself.
720 * @function
721 *
722 * @param {Object} [] $elem - jQuery element on which the event will be triggered if passed.
723 * @param {Function} [] handler - function to attach to the event.
724 * @returns {String} - event type that should or will be triggered.
725 */
726
727
728function onLoad($elem, handler) {
729 var didLoad = document.readyState === 'complete';
730 var eventType = (didLoad ? '_didLoad' : 'load') + '.zf.util.onLoad';
731
732 var cb = function cb() {
733 return $elem.triggerHandler(eventType);
734 };
735
736 if ($elem) {
737 if (handler) $elem.one(eventType, handler);
738 if (didLoad) setTimeout(cb);else jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).one('load', cb);
739 }
740
741 return eventType;
742}
743/**
744 * Retuns an handler for the `mouseleave` that ignore disappeared mouses.
745 *
746 * If the mouse "disappeared" from the document (like when going on a browser UI element, See https://git.io/zf-11410),
747 * the event is ignored.
748 * - If the `ignoreLeaveWindow` is `true`, the event is ignored when the user actually left the window
749 * (like by switching to an other window with [Alt]+[Tab]).
750 * - If the `ignoreReappear` is `true`, the event will be ignored when the mouse will reappear later on the document
751 * outside of the element it left.
752 *
753 * @function
754 *
755 * @param {Function} [] handler - handler for the filtered `mouseleave` event to watch.
756 * @param {Object} [] options - object of options:
757 * - {Boolean} [false] ignoreLeaveWindow - also ignore when the user switched windows.
758 * - {Boolean} [false] ignoreReappear - also ignore when the mouse reappeared outside of the element it left.
759 * @returns {Function} - filtered handler to use to listen on the `mouseleave` event.
760 */
761
762
763function ignoreMousedisappear(handler) {
764 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
765 _ref$ignoreLeaveWindo = _ref.ignoreLeaveWindow,
766 ignoreLeaveWindow = _ref$ignoreLeaveWindo === void 0 ? false : _ref$ignoreLeaveWindo,
767 _ref$ignoreReappear = _ref.ignoreReappear,
768 ignoreReappear = _ref$ignoreReappear === void 0 ? false : _ref$ignoreReappear;
769
770 return function leaveEventHandler(eLeave) {
771 for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
772 rest[_key - 1] = arguments[_key];
773 }
774
775 var callback = handler.bind.apply(handler, [this, eLeave].concat(rest)); // The mouse left: call the given callback if the mouse entered elsewhere
776
777 if (eLeave.relatedTarget !== null) {
778 return callback();
779 } // Otherwise, check if the mouse actually left the window.
780 // In firefox if the user switched between windows, the window sill have the focus by the time
781 // the event is triggered. We have to debounce the event to test this case.
782
783
784 setTimeout(function leaveEventDebouncer() {
785 if (!ignoreLeaveWindow && document.hasFocus && !document.hasFocus()) {
786 return callback();
787 } // Otherwise, wait for the mouse to reeapear outside of the element,
788
789
790 if (!ignoreReappear) {
791 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).one('mouseenter', function reenterEventHandler(eReenter) {
792 if (!jquery__WEBPACK_IMPORTED_MODULE_0___default()(eLeave.currentTarget).has(eReenter.target).length) {
793 // Fill where the mouse finally entered.
794 eLeave.relatedTarget = eReenter.target;
795 callback();
796 }
797 });
798 }
799 }, 0);
800 };
801}
802
803
804
805/***/ }),
806
807/***/ "./js/foundation.util.mediaQuery.js":
808/*!******************************************!*\
809 !*** ./js/foundation.util.mediaQuery.js ***!
810 \******************************************/
811/*! exports provided: MediaQuery */
812/***/ (function(module, __webpack_exports__, __webpack_require__) {
813
814"use strict";
815__webpack_require__.r(__webpack_exports__);
816/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return MediaQuery; });
817/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
818/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
819
820
821function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
822
823function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
824
825function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
826
827function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
828
829function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
830
831 // Default set of media queries
832
833var defaultQueries = {
834 'default': 'only screen',
835 landscape: 'only screen and (orientation: landscape)',
836 portrait: 'only screen and (orientation: portrait)',
837 retina: 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 'only screen and (min--moz-device-pixel-ratio: 2),' + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 'only screen and (min-device-pixel-ratio: 2),' + 'only screen and (min-resolution: 192dpi),' + 'only screen and (min-resolution: 2dppx)'
838}; // matchMedia() polyfill - Test a CSS media type/query in JS.
839// Authors & copyright © 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. MIT license
840
841/* eslint-disable */
842
843window.matchMedia || (window.matchMedia = function () {
844 "use strict"; // For browsers that support matchMedium api such as IE 9 and webkit
845
846 var styleMedia = window.styleMedia || window.media; // For those that don't support matchMedium
847
848 if (!styleMedia) {
849 var style = document.createElement('style'),
850 script = document.getElementsByTagName('script')[0],
851 info = null;
852 style.type = 'text/css';
853 style.id = 'matchmediajs-test';
854
855 if (!script) {
856 document.head.appendChild(style);
857 } else {
858 script.parentNode.insertBefore(style, script);
859 } // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
860
861
862 info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle;
863 styleMedia = {
864 matchMedium: function matchMedium(media) {
865 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
866
867 if (style.styleSheet) {
868 style.styleSheet.cssText = text;
869 } else {
870 style.textContent = text;
871 } // Test if media query is true or false
872
873
874 return info.width === '1px';
875 }
876 };
877 }
878
879 return function (media) {
880 return {
881 matches: styleMedia.matchMedium(media || 'all'),
882 media: media || 'all'
883 };
884 };
885}());
886/* eslint-enable */
887
888var MediaQuery = {
889 queries: [],
890 current: '',
891
892 /**
893 * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher.
894 * @function
895 * @private
896 */
897 _init: function _init() {
898 // make sure the initialization is only done once when calling _init() several times
899 if (this.isInitialized === true) {
900 return;
901 } else {
902 this.isInitialized = true;
903 }
904
905 var self = this;
906 var $meta = jquery__WEBPACK_IMPORTED_MODULE_0___default()('meta.foundation-mq');
907
908 if (!$meta.length) {
909 jquery__WEBPACK_IMPORTED_MODULE_0___default()('<meta class="foundation-mq">').appendTo(document.head);
910 }
911
912 var extractedStyles = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.foundation-mq').css('font-family');
913 var namedQueries;
914 namedQueries = parseStyleToObject(extractedStyles);
915 self.queries = []; // reset
916
917 for (var key in namedQueries) {
918 if (namedQueries.hasOwnProperty(key)) {
919 self.queries.push({
920 name: key,
921 value: "only screen and (min-width: ".concat(namedQueries[key], ")")
922 });
923 }
924 }
925
926 this.current = this._getCurrentSize();
927
928 this._watcher();
929 },
930
931 /**
932 * Reinitializes the media query helper.
933 * Useful if your CSS breakpoint configuration has just been loaded or has changed since the initialization.
934 * @function
935 * @private
936 */
937 _reInit: function _reInit() {
938 this.isInitialized = false;
939
940 this._init();
941 },
942
943 /**
944 * Checks if the screen is at least as wide as a breakpoint.
945 * @function
946 * @param {String} size - Name of the breakpoint to check.
947 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller.
948 */
949 atLeast: function atLeast(size) {
950 var query = this.get(size);
951
952 if (query) {
953 return window.matchMedia(query).matches;
954 }
955
956 return false;
957 },
958
959 /**
960 * Checks if the screen is within the given breakpoint.
961 * If smaller than the breakpoint of larger than its upper limit it returns false.
962 * @function
963 * @param {String} size - Name of the breakpoint to check.
964 * @returns {Boolean} `true` if the breakpoint matches, `false` otherwise.
965 */
966 only: function only(size) {
967 return size === this._getCurrentSize();
968 },
969
970 /**
971 * Checks if the screen is within a breakpoint or smaller.
972 * @function
973 * @param {String} size - Name of the breakpoint to check.
974 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's larger.
975 */
976 upTo: function upTo(size) {
977 var nextSize = this.next(size); // If the next breakpoint does not match, the screen is smaller than
978 // the upper limit of this breakpoint.
979
980 if (nextSize) {
981 return !this.atLeast(nextSize);
982 } // If there is no next breakpoint, the "size" breakpoint does not have
983 // an upper limit and the screen will always be within it or smaller.
984
985
986 return true;
987 },
988
989 /**
990 * Checks if the screen matches to a breakpoint.
991 * @function
992 * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method.
993 * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not.
994 */
995 is: function is(size) {
996 var parts = size.trim().split(' ').filter(function (p) {
997 return !!p.length;
998 });
999
1000 var _parts = _slicedToArray(parts, 2),
1001 bpSize = _parts[0],
1002 _parts$ = _parts[1],
1003 bpModifier = _parts$ === void 0 ? '' : _parts$; // Only the breakpont
1004
1005
1006 if (bpModifier === 'only') {
1007 return this.only(bpSize);
1008 } // At least the breakpoint (included)
1009
1010
1011 if (!bpModifier || bpModifier === 'up') {
1012 return this.atLeast(bpSize);
1013 } // Up to the breakpoint (included)
1014
1015
1016 if (bpModifier === 'down') {
1017 return this.upTo(bpSize);
1018 }
1019
1020 throw new Error("\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like \"<size> <modifier>\", got \"".concat(size, "\".\n "));
1021 },
1022
1023 /**
1024 * Gets the media query of a breakpoint.
1025 * @function
1026 * @param {String} size - Name of the breakpoint to get.
1027 * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist.
1028 */
1029 get: function get(size) {
1030 for (var i in this.queries) {
1031 if (this.queries.hasOwnProperty(i)) {
1032 var query = this.queries[i];
1033 if (size === query.name) return query.value;
1034 }
1035 }
1036
1037 return null;
1038 },
1039
1040 /**
1041 * Get the breakpoint following the given breakpoint.
1042 * @function
1043 * @param {String} size - Name of the breakpoint.
1044 * @returns {String|null} - The name of the following breakpoint, or `null` if the passed breakpoint was the last one.
1045 */
1046 next: function next(size) {
1047 var _this = this;
1048
1049 var queryIndex = this.queries.findIndex(function (q) {
1050 return _this._getQueryName(q) === size;
1051 });
1052
1053 if (queryIndex === -1) {
1054 throw new Error("\n Unknown breakpoint \"".concat(size, "\" passed to MediaQuery.next().\n Ensure it is present in your Sass \"$breakpoints\" setting.\n "));
1055 }
1056
1057 var nextQuery = this.queries[queryIndex + 1];
1058 return nextQuery ? nextQuery.name : null;
1059 },
1060
1061 /**
1062 * Returns the name of the breakpoint related to the given value.
1063 * @function
1064 * @private
1065 * @param {String|Object} value - Breakpoint name or query object.
1066 * @returns {String} Name of the breakpoint.
1067 */
1068 _getQueryName: function _getQueryName(value) {
1069 if (typeof value === 'string') return value;
1070 if (_typeof(value) === 'object') return value.name;
1071 throw new TypeError("\n Invalid value passed to MediaQuery._getQueryName().\n Expected a breakpoint name (String) or a breakpoint query (Object), got \"".concat(value, "\" (").concat(_typeof(value), ")\n "));
1072 },
1073
1074 /**
1075 * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one).
1076 * @function
1077 * @private
1078 * @returns {String} Name of the current breakpoint.
1079 */
1080 _getCurrentSize: function _getCurrentSize() {
1081 var matched;
1082
1083 for (var i = 0; i < this.queries.length; i++) {
1084 var query = this.queries[i];
1085
1086 if (window.matchMedia(query.value).matches) {
1087 matched = query;
1088 }
1089 }
1090
1091 return matched && this._getQueryName(matched);
1092 },
1093
1094 /**
1095 * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes.
1096 * @function
1097 * @private
1098 */
1099 _watcher: function _watcher() {
1100 var _this2 = this;
1101
1102 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () {
1103 var newSize = _this2._getCurrentSize(),
1104 currentSize = _this2.current;
1105
1106 if (newSize !== currentSize) {
1107 // Change the current media query
1108 _this2.current = newSize; // Broadcast the media query change on the window
1109
1110 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
1111 }
1112 });
1113 }
1114}; // Thank you: https://github.com/sindresorhus/query-string
1115
1116function parseStyleToObject(str) {
1117 var styleObject = {};
1118
1119 if (typeof str !== 'string') {
1120 return styleObject;
1121 }
1122
1123 str = str.trim().slice(1, -1); // browsers re-quote string style values
1124
1125 if (!str) {
1126 return styleObject;
1127 }
1128
1129 styleObject = str.split('&').reduce(function (ret, param) {
1130 var parts = param.replace(/\+/g, ' ').split('=');
1131 var key = parts[0];
1132 var val = parts[1];
1133 key = decodeURIComponent(key); // missing `=` should be `null`:
1134 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
1135
1136 val = typeof val === 'undefined' ? null : decodeURIComponent(val);
1137
1138 if (!ret.hasOwnProperty(key)) {
1139 ret[key] = val;
1140 } else if (Array.isArray(ret[key])) {
1141 ret[key].push(val);
1142 } else {
1143 ret[key] = [ret[key], val];
1144 }
1145
1146 return ret;
1147 }, {});
1148 return styleObject;
1149}
1150
1151
1152
1153/***/ }),
1154
1155/***/ 0:
1156/*!*****************************************************!*\
1157 !*** multi ./js/entries/plugins/foundation.core.js ***!
1158 \*****************************************************/
1159/*! no static exports found */
1160/***/ (function(module, exports, __webpack_require__) {
1161
1162module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.core.js */"./js/entries/plugins/foundation.core.js");
1163
1164
1165/***/ }),
1166
1167/***/ "jquery":
1168/*!********************************************************************************************!*\
1169 !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
1170 \********************************************************************************************/
1171/*! no static exports found */
1172/***/ (function(module, exports) {
1173
1174module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
1175
1176/***/ })
1177
1178/******/ });
1179});
1180//# sourceMappingURL=foundation.core.js.map
\No newline at end of file