(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("vue")); else if(typeof define === 'function' && define.amd) define(["vue"], factory); else if(typeof exports === 'object') exports["vue-notification"] = factory(require("vue")); else root["vue-notification"] = factory(root["vue"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_20__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 2); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { // this module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle module.exports = function normalizeComponent ( rawScriptExports, compiledTemplate, scopeId, cssModules ) { var esModule var scriptExports = rawScriptExports = rawScriptExports || {} // ES6 modules interop var type = typeof rawScriptExports.default if (type === 'object' || type === 'function') { esModule = rawScriptExports scriptExports = rawScriptExports.default } // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (compiledTemplate) { options.render = compiledTemplate.render options.staticRenderFns = compiledTemplate.staticRenderFns } // scopedId if (scopeId) { options._scopeId = scopeId } // inject cssModules if (cssModules) { var computed = Object.create(options.computed || null) Object.keys(cssModules).forEach(function (key) { var module = cssModules[key] computed[key] = function () { return module } }) options.computed = computed } return { esModule: esModule, exports: scriptExports, options: options } } /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return events; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(20); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__); var events = new __WEBPACK_IMPORTED_MODULE_0_vue___default.a({ name: 'vue-notification' }); /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Notifications_vue__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Notifications_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__Notifications_vue__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__events__ = __webpack_require__(1); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var Notify = { install: function install(Vue) { var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (this.installed) { return; } this.installed = true; this.params = args; Vue.component(args.componentName || 'notifications', __WEBPACK_IMPORTED_MODULE_0__Notifications_vue___default.a); var notify = function notify(params) { if (typeof params === 'string') { params = { title: '', text: params }; } if ((typeof params === 'undefined' ? 'undefined' : _typeof(params)) === 'object') { __WEBPACK_IMPORTED_MODULE_1__events__["a" /* events */].$emit('add', params); } }; notify.close = function (id) { __WEBPACK_IMPORTED_MODULE_1__events__["a" /* events */].$emit('close', id); }; var name = args.name || 'notify'; Vue.prototype['$' + name] = notify; Vue[name] = notify; } }; /* harmony default export */ __webpack_exports__["default"] = (Notify); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { /* styles */ __webpack_require__(17) var Component = __webpack_require__(0)( /* script */ __webpack_require__(5), /* template */ __webpack_require__(15), /* scopeId */ null, /* cssModules */ null ) module.exports = Component.exports /***/ }), /* 4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony default export */ __webpack_exports__["default"] = ({ name: 'CssGroup', props: ['name'] }); /***/ }), /* 5 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__events__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util__ = __webpack_require__(9); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__defaults__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue__ = __webpack_require__(13); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CssGroup_vue__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CssGroup_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__CssGroup_vue__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__parser__ = __webpack_require__(8); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var STATE = { IDLE: 0, DESTROYED: 2 }; var Component = { name: 'Notifications', components: { VelocityGroup: __WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue___default.a, CssGroup: __WEBPACK_IMPORTED_MODULE_5__CssGroup_vue___default.a }, props: { group: { type: String, default: '' }, width: { type: [Number, String], default: 300 }, reverse: { type: Boolean, default: false }, position: { type: [String, Array], default: function _default() { return __WEBPACK_IMPORTED_MODULE_3__defaults__["a" /* default */].position; } }, classes: { type: String, default: 'vue-notification' }, animationType: { type: String, default: 'css', validator: function validator(value) { return value === 'css' || value === 'velocity'; } }, animation: { type: Object, default: function _default() { return __WEBPACK_IMPORTED_MODULE_3__defaults__["a" /* default */].velocityAnimation; } }, animationName: { type: String, default: __WEBPACK_IMPORTED_MODULE_3__defaults__["a" /* default */].cssAnimation }, speed: { type: Number, default: 300 }, cooldown: { type: Number, default: 0 }, duration: { type: Number, default: 3000 }, delay: { type: Number, default: 0 }, max: { type: Number, default: Infinity }, ignoreDuplicates: { type: Boolean, default: false }, closeOnClick: { type: Boolean, default: true } }, data: function data() { return { list: [], velocity: __WEBPACK_IMPORTED_MODULE_0__index__["default"].params.velocity }; }, mounted: function mounted() { __WEBPACK_IMPORTED_MODULE_1__events__["a" /* events */].$on('add', this.addItem); __WEBPACK_IMPORTED_MODULE_1__events__["a" /* events */].$on('close', this.closeItem); }, computed: { actualWidth: function actualWidth() { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__parser__["a" /* default */])(this.width); }, isVA: function isVA() { return this.animationType === 'velocity'; }, componentName: function componentName() { return this.isVA ? 'VelocityGroup' : 'CssGroup'; }, styles: function styles() { var _listToDirection = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__util__["a" /* listToDirection */])(this.position), x = _listToDirection.x, y = _listToDirection.y; var width = this.actualWidth.value; var suffix = this.actualWidth.type; var styles = _defineProperty({ width: width + suffix }, y, '0px'); if (x === 'center') { styles['left'] = 'calc(50% - ' + width / 2 + suffix + ')'; } else { styles[x] = '0px'; } return styles; }, active: function active() { return this.list.filter(function (v) { return v.state !== STATE.DESTROYED; }); }, botToTop: function botToTop() { return this.styles.hasOwnProperty('bottom'); } }, methods: { destroyIfNecessary: function destroyIfNecessary(item) { if (this.closeOnClick) { this.destroy(item); } }, addItem: function addItem(event) { var _this = this; event.group = event.group || ''; if (this.group !== event.group) { return; } if (event.clean || event.clear) { this.destroyAll(); return; } var duration = typeof event.duration === 'number' ? event.duration : this.duration; var speed = typeof event.speed === 'number' ? event.speed : this.speed; var ignoreDuplicates = typeof event.ignoreDuplicates === 'boolean' ? event.ignoreDuplicates : this.ignoreDuplicates; var title = event.title, text = event.text, type = event.type, data = event.data, id = event.id; var item = { id: id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__util__["b" /* Id */])(), title: title, text: text, type: type, state: STATE.IDLE, speed: speed, length: duration + 2 * speed, data: data }; if (duration >= 0) { item.timer = setTimeout(function () { _this.destroy(item); }, item.length); } var direction = this.reverse ? !this.botToTop : this.botToTop; var indexToDestroy = -1; var isDuplicate = this.active.some(function (item) { return item.title === event.title && item.text === event.text; }); var canAdd = ignoreDuplicates ? !isDuplicate : true; if (!canAdd) return; if (direction) { this.list.push(item); if (this.active.length > this.max) { indexToDestroy = 0; } } else { this.list.unshift(item); if (this.active.length > this.max) { indexToDestroy = this.active.length - 1; } } if (indexToDestroy !== -1) { this.destroy(this.active[indexToDestroy]); } }, closeItem: function closeItem(id) { this.destroyById(id); }, notifyClass: function notifyClass(item) { return ['vue-notification-template', this.classes, item.type]; }, notifyWrapperStyle: function notifyWrapperStyle(item) { return this.isVA ? null : { transition: 'all ' + item.speed + 'ms' }; }, destroy: function destroy(item) { clearTimeout(item.timer); item.state = STATE.DESTROYED; if (!this.isVA) { this.clean(); } }, destroyById: function destroyById(id) { var item = this.list.find(function (v) { return v.id === id; }); if (item) { this.destroy(item); } }, destroyAll: function destroyAll() { this.active.forEach(this.destroy); }, getAnimation: function getAnimation(index, el) { var animation = this.animation[index]; return typeof animation === 'function' ? animation.call(this, el) : animation; }, enter: function enter(_ref) { var el = _ref.el, complete = _ref.complete; var animation = this.getAnimation('enter', el); this.velocity(el, animation, { duration: this.speed, complete: complete }); }, leave: function leave(_ref2) { var el = _ref2.el, complete = _ref2.complete; var animation = this.getAnimation('leave', el); this.velocity(el, animation, { duration: this.speed, complete: complete }); }, clean: function clean() { this.list = this.list.filter(function (v) { return v.state !== STATE.DESTROYED; }); } } }; /* harmony default export */ __webpack_exports__["default"] = (Component); /***/ }), /* 6 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony default export */ __webpack_exports__["default"] = ({ name: 'VelocityGroup', methods: { enter: function enter(el, complete) { this.$emit('enter', { el: el, complete: complete }); }, leave: function leave(el, complete) { this.$emit('leave', { el: el, complete: complete }); }, afterLeave: function afterLeave() { this.$emit('afterLeave'); } } }); /***/ }), /* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ({ position: ['top', 'right'], cssAnimation: 'vn-fade', velocityAnimation: { enter: function enter(el) { var height = el.clientHeight; return { height: [height, 0], opacity: [1, 0] }; }, leave: { height: 0, opacity: [0, 1] } } }); /***/ }), /* 8 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export parse */ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var floatRegexp = '[-+]?[0-9]*.?[0-9]+'; var types = [{ name: 'px', regexp: new RegExp('^' + floatRegexp + 'px$') }, { name: '%', regexp: new RegExp('^' + floatRegexp + '%$') }, { name: 'px', regexp: new RegExp('^' + floatRegexp + '$') }]; var getType = function getType(value) { if (value === 'auto') { return { type: value, value: 0 }; } for (var i = 0; i < types.length; i++) { var type = types[i]; if (type.regexp.test(value)) { return { type: type.name, value: parseFloat(value) }; } } return { type: '', value: value }; }; var parse = function parse(value) { switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { case 'number': return { type: 'px', value: value }; case 'string': return getType(value); default: return { type: '', value: value }; } }; /* harmony default export */ __webpack_exports__["a"] = (parse); /***/ }), /* 9 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Id; }); /* unused harmony export split */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return listToDirection; }); var directions = { x: ['left', 'center', 'right'], y: ['top', 'bottom'] }; var Id = function (i) { return function () { return i++; }; }(0); var split = function split(value) { if (typeof value !== 'string') { return []; } return value.split(/\s+/gi).filter(function (v) { return v; }); }; var listToDirection = function listToDirection(value) { if (typeof value === 'string') { value = split(value); } var x = null; var y = null; value.forEach(function (v) { if (directions.y.indexOf(v) !== -1) { y = v; } if (directions.x.indexOf(v) !== -1) { x = v; } }); return { x: x, y: y }; }; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(11)(); // imports // module exports.push([module.i, ".vue-notification-group{display:block;position:fixed;z-index:5000}.vue-notification-wrapper{display:block;overflow:hidden;width:100%;margin:0;padding:0}.notification-title{font-weight:600}.vue-notification-template{background:#fff}.vue-notification,.vue-notification-template{display:block;box-sizing:border-box;text-align:left}.vue-notification{font-size:12px;padding:10px;margin:0 5px 5px;color:#fff;background:#44a4fc;border-left:5px solid #187fe7}.vue-notification.warn{background:#ffb648;border-left-color:#f48a06}.vue-notification.error{background:#e54d42;border-left-color:#b82e24}.vue-notification.success{background:#68cd86;border-left-color:#42a85f}.vn-fade-enter-active,.vn-fade-leave-active,.vn-fade-move{transition:all .5s}.vn-fade-enter,.vn-fade-leave-to{opacity:0}", ""]); // exports /***/ }), /* 11 */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function() { var list = []; // return the list of modules as css string list.toString = function toString() { var result = []; for(var i = 0; i < this.length; i++) { var item = this[i]; if(item[2]) { result.push("@media " + item[2] + "{" + item[1] + "}"); } else { result.push(item[1]); } } return result.join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { var Component = __webpack_require__(0)( /* script */ __webpack_require__(4), /* template */ __webpack_require__(16), /* scopeId */ null, /* cssModules */ null ) module.exports = Component.exports /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { var Component = __webpack_require__(0)( /* script */ __webpack_require__(6), /* template */ __webpack_require__(14), /* scopeId */ null, /* cssModules */ null ) module.exports = Component.exports /***/ }), /* 14 */ /***/ (function(module, exports) { module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; return _c('transition-group', { attrs: { "css": false }, on: { "enter": _vm.enter, "leave": _vm.leave, "after-leave": _vm.afterLeave } }, [_vm._t("default")], 2) },staticRenderFns: []} /***/ }), /* 15 */ /***/ (function(module, exports) { module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; return _c('div', { staticClass: "vue-notification-group", style: (_vm.styles) }, [_c(_vm.componentName, { tag: "component", attrs: { "name": _vm.animationName }, on: { "enter": _vm.enter, "leave": _vm.leave, "after-leave": _vm.clean } }, _vm._l((_vm.active), function(item) { return _c('div', { key: item.id, staticClass: "vue-notification-wrapper", style: (_vm.notifyWrapperStyle(item)), attrs: { "data-id": item.id } }, [_vm._t("body", [_c('div', { class: _vm.notifyClass(item), on: { "click": function($event) { return _vm.destroyIfNecessary(item) } } }, [(item.title) ? _c('div', { staticClass: "notification-title", domProps: { "innerHTML": _vm._s(item.title) } }) : _vm._e(), _vm._v(" "), _c('div', { staticClass: "notification-content", domProps: { "innerHTML": _vm._s(item.text) } })])], { "item": item, "close": function () { return _vm.destroy(item); } })], 2) }), 0)], 1) },staticRenderFns: []} /***/ }), /* 16 */ /***/ (function(module, exports) { module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; return _c('transition-group', { attrs: { "name": _vm.name } }, [_vm._t("default")], 2) },staticRenderFns: []} /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a ' } return css } /***/ }), /* 19 */ /***/ (function(module, exports) { /** * Translates the list format produced by css-loader into something * easier to manipulate. */ module.exports = function listToStyles (parentId, list) { var styles = [] var newStyles = {} for (var i = 0; i < list.length; i++) { var item = list[i] var id = item[0] var css = item[1] var media = item[2] var sourceMap = item[3] var part = { id: parentId + ':' + i, css: css, media: media, sourceMap: sourceMap } if (!newStyles[id]) { styles.push(newStyles[id] = { id: id, parts: [part] }) } else { newStyles[id].parts.push(part) } } return styles } /***/ }), /* 20 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_20__; /***/ }) /******/ ]); }); //# sourceMappingURL=ssr.js.map