├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── .travis.yml ├── LICENSE ├── README.md ├── build ├── dev.js └── prod.js ├── dist ├── build.js └── build.js.map ├── index.html ├── package.json ├── src ├── Notify.vue └── index.js ├── static └── .gitkeep ├── test └── unit │ ├── .eslintrc │ ├── jest.conf.js │ ├── setup.js │ └── specs │ ├── .gitkeep │ ├── Notify.spec.js │ └── __snapshots__ │ └── Notify.spec.js.snap ├── types └── vue2-notify.d.ts └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint' 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | extends: [ 12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 14 | 'plugin:vue/recommended', 15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 16 | 'standard' 17 | ], 18 | // required to lint *.vue files 19 | plugins: [ 20 | 'vue' 21 | ], 22 | // add your custom rules here 23 | rules: { 24 | // allow async-await 25 | 'generator-star-spacing': 'off', 26 | 'vue/max-attributes-per-line': 'off', 27 | // allow debugger during development 28 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | test/unit/coverage/ 4 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "8" 4 | - "9" 5 | sudo: false 6 | dist: trusty 7 | cache: 8 | yarn: true 9 | directories: 10 | - node_modules 11 | install: 12 | - yarn 13 | script: 14 | - yarn lint 15 | - jest --config test/unit/jest.conf.js --coverage --coverageReporters=text-lcov | coveralls 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Adam van Dongen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Notify 2 | 3 | [![Build Status](https://travis-ci.org/websmurf/vue2-notify.svg?branch=master)](https://travis-ci.org/websmurf/vue2-notify) 4 | [![Coverage Status](https://coveralls.io/repos/github/websmurf/vue2-notify/badge.svg?branch=master)](https://coveralls.io/github/websmurf/vue2-notify?branch=master) 5 | 6 | A simple bootstrap|bulma styled Vue component for notifications. Compatible with Vue 2.x 7 | 8 | ## Requirements 9 | 10 | Required packages: 11 | - vue 2+ 12 | - velocity-animate 1.5+ 13 | 14 | Optional packages: 15 | - bootstrap or bulma (only used for styling) 16 | 17 | ## Install 18 | 19 | ``` 20 | $ yarn add vue2-notify 21 | ``` 22 | 23 | Then in your main.js: 24 | 25 | ```js 26 | import Notify from 'vue2-notify' 27 | 28 | // Use Notify 29 | Vue.use(Notify) 30 | ``` 31 | 32 | ## Usage 33 | 34 | Inside your component: 35 | 36 | ```js 37 | this.$notify('A message that should be displayed', 'type') 38 | ``` 39 | 40 | or 41 | 42 | ```js 43 | Vue.$notify('A message that should be displayed', 'type') 44 | ``` 45 | 46 | You may use short type call: 47 | 48 | ```js 49 | this.$notify.success('This is success message'); 50 | ``` 51 | 52 | or 53 | 54 | ```js 55 | Vue.$notify('This is success message'); 56 | ``` 57 | 58 | **Bulma users** can call `this.$notify.danger('Error message');`, `this.$notify.danger()` is link to `this.$notify.error()` 59 | ## Configuration 60 | 61 | | Option | Type | Default | Description 62 | |-------------------|------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------- 63 | | itemClass | String | 'alert col-12' | The class that the notification is wrapped in, defaults to the default bootstrap style 64 | | duration | Integer | 500 | The amount of milliseconds that the animation should take (slideDown/slideUp, fadeIn/fadeOut) 65 | | visibility | Integer | 2000 | The amount of milliseconds that the notification should be visible (if notification __is not permanent__) 66 | | position | String | 'top-left' | The location of the notification, currently possible: `top-left`, `top-right`, `top-full`, `bottom-left`, `bottom-right` and `bottom-full` 67 | | enter | String | 'slideDown' | Entry animation type, currently possible: `slideDown`, `fadeIn` 68 | | leave | String | 'slideUp' | Exit animation type, currently possible: `slideUp`, `fadeOut` 69 | | permanent | Boolean | false | Disable notification auto close 70 | | mode | String | 'text' | Set `'html'` to output real html. Only use HTML interpolation on trusted content and never on user-provided content. 71 | | closeButtonClass | Boolean / String | false | Class name for close button. If false - close button will not be displayed. ( Example: set `'delete'` for bulma or `'close'` for bootstrap.) 72 | 73 | Configuration options can be provided as options in the Vue.use statement: 74 | 75 | ```js 76 | // Use Notify 77 | Vue.use(Notify, {visibility: 5000, permanent: true}) 78 | ``` 79 | 80 | ### Overriding configuration 81 | You can override the ___itemClass___, ___iconClass___, ___visibility___, ___mode___ or ___closeButtonClass___ options on a per usage basis: 82 | 83 | ```js 84 | this.$notify('A message that should be displayed', 'type', { itemClass: 'alert col-6 alert-info', iconClass: 'fa fa-lg fa-handshake-o', visibility: 10000 }) 85 | ``` 86 | 87 | Type should be one of the types defined in the configuration of the component. 88 | 89 | ## Types 90 | 91 | Defines the type of notifications that can be triggered 92 | 93 | | Type | ItemClass | IconClass 94 | |-----------|-------------------|-------------------------------------- 95 | | info | 'alert-info' | 'fa fa-lg fa-info-circle' 96 | | error | 'alert-danger' | 'fa fa-lg fa-exclamation-triangle' 97 | | warning | 'alert-warning' | 'fa fa-lg fa-exclamation-circle' 98 | | success | 'alert-success' | 'fa fa-lg fa-check-circle' 99 | 100 | You can override the default list of types in the following way, for example to use 101 | glyphicons instead of font awesome icons: 102 | 103 | ```js 104 | const types = { 105 | info: { itemClass: 'alert-info', iconClass: 'glyphicons glyphicons-info-sign'}, 106 | .. 107 | success: { itemClass: 'alert-success', iconClass: 'glyphicons glyphicons-ok'}, 108 | } 109 | 110 | Vue.$notify.setTypes(types) 111 | 112 | ``` 113 | 114 | ## Examples 115 | 116 | ### Using vue2-notify with Bulma 117 | 118 | In app.js: 119 | ```js 120 | import Notify from 'vue2-notify' 121 | Vue.use(Notify, { 122 | itemClass: 'notification' 123 | }) 124 | const types = { 125 | info: { itemClass: 'is-info', }, 126 | error: { itemClass: 'is-danger' }, 127 | warning: { itemClass: 'is-warning' }, 128 | success: { itemClass: 'is-success', iconClass: 'fa fa-lg fa-check-circle' } 129 | } 130 | 131 | Vue.$notify.setTypes(types); 132 | ``` 133 | And call `this.$notify` method as usual: 134 | ```js 135 | this.$notify('A message that should be displayed', 'info') 136 | ``` 137 | or 138 | ```js 139 | this.$notify.info('A message that should be displayed') 140 | ``` 141 | ### HTML in notification 142 | ```js 143 | this.$notify('

My HTML
message

', 'info', {mode: 'html'}) 144 | ``` 145 | or 146 | ```js 147 | this.$notify.error('

My HTML
message

', {mode: 'html'}) 148 | ``` 149 | ### Permanent notification 150 | ```js 151 | this.$notify('Permanent message', 'info', {permanent: true}) 152 | ``` 153 | -------------------------------------------------------------------------------- /build/dev.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Notify from '../src/index.js' 3 | 4 | // Use Notify 5 | Vue.use(Notify) 6 | 7 | /* eslint-disable no-new */ 8 | new Vue({ 9 | template: '

Trigger notification:

' + 10 | '' + 11 | '' + 12 | '' + 13 | '' + 14 | '' + 15 | '
', 16 | components: { 17 | Notify 18 | }, 19 | methods: { 20 | error () { 21 | this.$notify('This is an error message', 'error') 22 | }, 23 | info () { 24 | this.$notify('This is an informational message', 'info') 25 | }, 26 | warning () { 27 | this.$notify('This is a warning message', 'warning') 28 | }, 29 | success () { 30 | this.$notify('This is a success message', 'success') 31 | }, 32 | advanced () { 33 | this.$notify('This is an advanced message', 'info', { visibility: 10000, iconClass: 'fa fa-lg fa-handshake-o', closeButtonClass: 'btn btn-default pull-right' }) 34 | } 35 | } 36 | }).$mount('#app') 37 | -------------------------------------------------------------------------------- /build/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../src/index.js') 2 | -------------------------------------------------------------------------------- /dist/build.js: -------------------------------------------------------------------------------- 1 | module.exports=function(t){function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}var e={};return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="/dist/",n(n.s=12)}([function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,n){var e=t.exports={version:"2.5.6"};"number"==typeof __e&&(__e=e)},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){t.exports=!e(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,e){t.exports={default:e(14),__esModule:!0}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var o=e(8),r=e(9);t.exports=function(t){return o(r(t))}},function(t,n,e){var o=e(29);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==o(t)?t.split(""):Object(t)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n){var e=Math.ceil,o=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?o:e)(t)}},function(t,n,e){"use strict";var o=e(5),r=e.n(o),i=e(48),s=e.n(i),a=e(49),f=e.n(a);n.a={data:function(){return{types:{info:{itemClass:"alert-info",iconClass:"fa fa-lg fa-info-circle"},error:{itemClass:"alert-danger",iconClass:"fa fa-lg fa-exclamation-triangle"},warning:{itemClass:"alert-warning",iconClass:"fa fa-lg fa-exclamation-circle"},success:{itemClass:"alert-success",iconClass:"fa fa-lg fa-check-circle"}},options:{itemClass:"alert col-12",duration:500,visibility:2e3,position:"top-left",enter:"slideDown",leave:"slideUp",closeButtonClass:!1,width:"300px",mode:"text",permanent:!1},items:{},idx:0}},computed:{width:function(){return"top-full"===this.options.position||"bottom-full"===this.options.position?"auto":this.options.width}},methods:{setTypes:function(t){this.types=t},addItem:function(t,n,e){var o=this,i={iconClass:this.types[t].iconClass,itemClass:[this.options.itemClass,this.types[t].itemClass],visibility:this.options.visibility,mode:this.options.mode,closeButtonClass:this.options.closeButtonClass,permanent:this.options.permanent},a=r()({},i,e),f=this.idx;for(var u in this.items)if(this.items.hasOwnProperty(u)&&this.items[u].text===n)return;s.a.set(this.items,this.idx,{type:t,text:n,options:a}),this.idx++,!1===a.permanent&&setTimeout(function(){o.removeItem(f)},this.options.duration+a.visibility)},slideDown:function(t){f()(t,this.options.enter,{duration:this.options.duration})},slideUp:function(t,n){f()(t,this.options.leave,{duration:this.options.duration,complete:n})},removeItem:function(t){s.a.delete(this.items,t)},removeAll:function(){this.items={}}}}},function(t,n,e){t.exports=e(13)},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=e(5),r=e.n(o),i=e(41);n.default={install:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.extend(i.a),o=new e;o.options=r()(o.options,n);var s=o.$mount();document.querySelector("body").appendChild(s.$el),t.$notify=t.prototype.$notify=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};o.addItem(n,t,e)},t.$notify.info=t.prototype.$notify.info=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o.addItem("info",t,n)},t.$notify.success=t.prototype.$notify.success=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o.addItem("success",t,n)},t.$notify.error=t.prototype.$notify.error=t.$notify.danger=t.prototype.$notify.danger=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o.addItem("error",t,n)},t.$notify.warning=t.prototype.$notify.warning=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o.addItem("warning",t,n)},t.$notify.setTypes=t.prototype.$notify.setTypes=function(t){o.setTypes(t)},t.$notify.removeAll=t.prototype.$notify.removeAll=function(){o.removeAll()}}}},function(t,n,e){e(15),t.exports=e(1).Object.assign},function(t,n,e){var o=e(16);o(o.S+o.F,"Object",{assign:e(26)})},function(t,n,e){var o=e(0),r=e(1),i=e(17),s=e(19),a=e(6),f=function(t,n,e){var u,c,p,l=t&f.F,d=t&f.G,v=t&f.S,h=t&f.P,y=t&f.B,m=t&f.W,x=d?r:r[n]||(r[n]={}),g=x.prototype,b=d?o:v?o[n]:(o[n]||{}).prototype;d&&(e=n);for(u in e)(c=!l&&b&&void 0!==b[u])&&a(x,u)||(p=c?b[u]:e[u],x[u]=d&&"function"!=typeof b[u]?e[u]:y&&c?i(p,o):m&&b[u]==p?function(t){var n=function(n,e,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,o)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(p):h&&"function"==typeof p?i(Function.call,p):p,h&&((x.virtual||(x.virtual={}))[u]=p,t&f.R&&g&&!g[u]&&s(g,u,p)))};f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n,e){var o=e(18);t.exports=function(t,n,e){if(o(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,o){return t.call(n,e,o)};case 3:return function(e,o,r){return t.call(n,e,o,r)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,e){var o=e(20),r=e(25);t.exports=e(3)?function(t,n,e){return o.f(t,n,r(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var o=e(21),r=e(22),i=e(24),s=Object.defineProperty;n.f=e(3)?Object.defineProperty:function(t,n,e){if(o(t),n=i(n,!0),o(e),r)try{return s(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){var o=e(2);t.exports=function(t){if(!o(t))throw TypeError(t+" is not an object!");return t}},function(t,n,e){t.exports=!e(3)&&!e(4)(function(){return 7!=Object.defineProperty(e(23)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var o=e(2),r=e(0).document,i=o(r)&&o(r.createElement);t.exports=function(t){return i?r.createElement(t):{}}},function(t,n,e){var o=e(2);t.exports=function(t,n){if(!o(t))return t;var e,r;if(n&&"function"==typeof(e=t.toString)&&!o(r=e.call(t)))return r;if("function"==typeof(e=t.valueOf)&&!o(r=e.call(t)))return r;if(!n&&"function"==typeof(e=t.toString)&&!o(r=e.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,e){"use strict";var o=e(27),r=e(38),i=e(39),s=e(40),a=e(8),f=Object.assign;t.exports=!f||e(4)(function(){var t={},n={},e=Symbol(),o="abcdefghijklmnopqrst";return t[e]=7,o.split("").forEach(function(t){n[t]=t}),7!=f({},t)[e]||Object.keys(f({},n)).join("")!=o})?function(t,n){for(var e=s(t),f=arguments.length,u=1,c=r.f,p=i.f;f>u;)for(var l,d=a(arguments[u++]),v=c?o(d).concat(c(d)):o(d),h=v.length,y=0;h>y;)p.call(d,l=v[y++])&&(e[l]=d[l]);return e}:f},function(t,n,e){var o=e(28),r=e(37);t.exports=Object.keys||function(t){return o(t,r)}},function(t,n,e){var o=e(6),r=e(7),i=e(30)(!1),s=e(33)("IE_PROTO");t.exports=function(t,n){var e,a=r(t),f=0,u=[];for(e in a)e!=s&&o(a,e)&&u.push(e);for(;n.length>f;)o(a,e=n[f++])&&(~i(u,e)||u.push(e));return u}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n,e){var o=e(7),r=e(31),i=e(32);t.exports=function(t){return function(n,e,s){var a,f=o(n),u=r(f.length),c=i(s,u);if(t&&e!=e){for(;u>c;)if((a=f[c++])!=a)return!0}else for(;u>c;c++)if((t||c in f)&&f[c]===e)return t||c||0;return!t&&-1}}},function(t,n,e){var o=e(10),r=Math.min;t.exports=function(t){return t>0?r(o(t),9007199254740991):0}},function(t,n,e){var o=e(10),r=Math.max,i=Math.min;t.exports=function(t,n){return t=o(t),t<0?r(t+n,0):i(t,n)}},function(t,n,e){var o=e(34)("keys"),r=e(36);t.exports=function(t){return o[t]||(o[t]=r(t))}},function(t,n,e){var o=e(1),r=e(0),i=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:o.version,mode:e(35)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n){t.exports=!0},function(t,n){var e=0,o=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+o).toString(36))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,e){var o=e(9);t.exports=function(t){return Object(o(t))}},function(t,n,e){"use strict";function o(t){e(42)}var r=e(11),i=e(50),s=e(47),a=o,f=s(r.a,i.a,!1,a,"data-v-4e19f58f",null);n.a=f.exports},function(t,n,e){var o=e(43);"string"==typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);e(45)("17ebb296",o,!0,{})},function(t,n,e){n=t.exports=e(44)(!1),n.push([t.i,".notify-top-full[data-v-4e19f58f]{position:fixed;top:5px;left:15px;right:15px;z-index:9999}.notify-bottom-full[data-v-4e19f58f]{position:fixed;bottom:5px;left:15px;right:15px;z-index:9999}.notify-top-right[data-v-4e19f58f]{position:fixed;top:5px;right:15px}.notify-top-left[data-v-4e19f58f]{position:fixed;top:5px;left:15px}.notify-bottom-left[data-v-4e19f58f]{position:fixed;bottom:5px;width:300px;left:15px}.notify-bottom-right[data-v-4e19f58f]{position:fixed;bottom:5px;right:15px}.notify-top-full .notify-item[data-v-4e19f58f]:not(:last-child),.notify-top-left .notify-item[data-v-4e19f58f]:not(:last-child),.notify-top-right .notify-item[data-v-4e19f58f]:not(:last-child){margin-bottom:5px}.notify-bottom-full .notify-item[data-v-4e19f58f]:not(:first-child),.notify-bottom-left .notify-item[data-v-4e19f58f]:not(:first-child),.notify-bottom-right .notify-item[data-v-4e19f58f]:not(:first-child){margin-top:5px}.notify[data-v-4e19f58f]{z-index:100}",""])},function(t,n){function e(t,n){var e=t[1]||"",r=t[3];if(!r)return e;if(n&&"function"==typeof btoa){var i=o(r);return[e].concat(r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"})).concat([i]).join("\n")}return[e].join("\n")}function o(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var n=[];return n.toString=function(){return this.map(function(n){var o=e(n,t);return n[2]?"@media "+n[2]+"{"+o+"}":o}).join("")},n.i=function(t,e){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},r=0;re.parts.length&&(o.parts.length=e.parts.length)}else{for(var s=[],r=0;r 0 ? floor : ceil)(it);\n};\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vue__ = __webpack_require__(48);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_vue__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_velocity_animate__ = __webpack_require__(49);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_velocity_animate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_velocity_animate__);\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"a\"] = ({\n data: function data() {\n return {\n types: {\n info: { itemClass: 'alert-info', iconClass: 'fa fa-lg fa-info-circle' },\n error: { itemClass: 'alert-danger', iconClass: 'fa fa-lg fa-exclamation-triangle' },\n warning: { itemClass: 'alert-warning', iconClass: 'fa fa-lg fa-exclamation-circle' },\n success: { itemClass: 'alert-success', iconClass: 'fa fa-lg fa-check-circle' }\n },\n options: {\n itemClass: 'alert col-12',\n duration: 500,\n visibility: 2000,\n position: 'top-left',\n enter: 'slideDown',\n leave: 'slideUp',\n closeButtonClass: false,\n width: '300px',\n mode: 'text',\n permanent: false\n },\n items: {},\n idx: 0\n };\n },\n\n computed: {\n width: function width() {\n if (this.options.position === 'top-full' || this.options.position === 'bottom-full') {\n return 'auto';\n } else {\n return this.options.width;\n }\n }\n },\n methods: {\n setTypes: function setTypes(types) {\n this.types = types;\n },\n addItem: function addItem(type, msg, options) {\n var _this = this;\n\n var defaultOptions = {\n iconClass: this.types[type].iconClass,\n itemClass: [this.options.itemClass, this.types[type].itemClass],\n visibility: this.options.visibility,\n mode: this.options.mode,\n closeButtonClass: this.options.closeButtonClass,\n permanent: this.options.permanent\n };\n var itemOptions = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({}, defaultOptions, options);\n\n // get idx\n var idx = this.idx;\n\n // check if this message is already shown\n for (var key in this.items) {\n /* istanbul ignore else */\n if (this.items.hasOwnProperty(key)) {\n if (this.items[key].text === msg) {\n return;\n }\n }\n }\n\n // add it to the queue (if it's not already there)\n __WEBPACK_IMPORTED_MODULE_1_vue___default.a.set(this.items, this.idx, { type: type, text: msg, options: itemOptions });\n\n // increment key\n this.idx++;\n\n // remove item if not permanent\n if (itemOptions.permanent === false) {\n // remove item from array\n setTimeout(function () {\n _this.removeItem(idx);\n }, this.options.duration + itemOptions.visibility);\n }\n },\n slideDown: function slideDown(el) {\n __WEBPACK_IMPORTED_MODULE_2_velocity_animate___default()(el, this.options.enter, { duration: this.options.duration });\n },\n slideUp: function slideUp(el, done) {\n __WEBPACK_IMPORTED_MODULE_2_velocity_animate___default()(el, this.options.leave, { duration: this.options.duration, complete: done });\n },\n removeItem: function removeItem(index) {\n __WEBPACK_IMPORTED_MODULE_1_vue___default.a.delete(this.items, index);\n },\n removeAll: function removeAll() {\n this.items = {};\n }\n }\n});\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(13);\n\n/***/ }),\n/* 13 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Notify_vue__ = __webpack_require__(41);\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n install: function install(Vue) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n // Create component instance\n var Constr = Vue.extend(__WEBPACK_IMPORTED_MODULE_1__Notify_vue__[\"a\" /* default */]);\n var Notify = new Constr();\n\n // Apply configuration\n Notify.options = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()(Notify.options, options);\n\n // Mount it\n var vm = Notify.$mount();\n\n // Add it to the Vue application\n document.querySelector('body').appendChild(vm.$el);\n\n // Create generic method\n Vue.$notify = Vue.prototype.$notify = function (msg) {\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'info';\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n Notify.addItem(type, msg, options);\n };\n Vue.$notify.info = Vue.prototype.$notify.info = function (msg) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n Notify.addItem('info', msg, options);\n };\n Vue.$notify.success = Vue.prototype.$notify.success = function (msg) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n Notify.addItem('success', msg, options);\n };\n Vue.$notify.error = Vue.prototype.$notify.error = Vue.$notify.danger = Vue.prototype.$notify.danger = function (msg) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n Notify.addItem('error', msg, options);\n };\n Vue.$notify.warning = Vue.prototype.$notify.warning = function (msg) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n Notify.addItem('warning', msg, options);\n };\n // Create setTypes method\n Vue.$notify.setTypes = Vue.prototype.$notify.setTypes = function (types) {\n Notify.setTypes(types);\n };\n Vue.$notify.removeAll = Vue.prototype.$notify.removeAll = function () {\n Notify.removeAll();\n };\n }\n});\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(15);\nmodule.exports = __webpack_require__(1).Object.assign;\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.3.1 Object.assign(target, source)\nvar $export = __webpack_require__(16);\n\n$export($export.S + $export.F, 'Object', { assign: __webpack_require__(26) });\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar global = __webpack_require__(0);\nvar core = __webpack_require__(1);\nvar ctx = __webpack_require__(17);\nvar hide = __webpack_require__(19);\nvar has = __webpack_require__(6);\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var IS_WRAP = type & $export.W;\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE];\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];\n var key, own, out;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if (own && has(exports, key)) continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function (C) {\n var F = function (a, b, c) {\n if (this instanceof C) {\n switch (arguments.length) {\n case 0: return new C();\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if (IS_PROTO) {\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// optional / simple context binding\nvar aFunction = __webpack_require__(18);\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports) {\n\nmodule.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar dP = __webpack_require__(20);\nvar createDesc = __webpack_require__(25);\nmodule.exports = __webpack_require__(3) ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar anObject = __webpack_require__(21);\nvar IE8_DOM_DEFINE = __webpack_require__(22);\nvar toPrimitive = __webpack_require__(24);\nvar dP = Object.defineProperty;\n\nexports.f = __webpack_require__(3) ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar isObject = __webpack_require__(2);\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = !__webpack_require__(3) && !__webpack_require__(4)(function () {\n return Object.defineProperty(__webpack_require__(23)('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar isObject = __webpack_require__(2);\nvar document = __webpack_require__(0).document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = __webpack_require__(2);\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\nmodule.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = __webpack_require__(27);\nvar gOPS = __webpack_require__(38);\nvar pIE = __webpack_require__(39);\nvar toObject = __webpack_require__(40);\nvar IObject = __webpack_require__(8);\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || __webpack_require__(4)(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = gOPS.f;\n var isEnum = pIE.f;\n while (aLen > index) {\n var S = IObject(arguments[index++]);\n var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];\n } return T;\n} : $assign;\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = __webpack_require__(28);\nvar enumBugKeys = __webpack_require__(37);\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar has = __webpack_require__(6);\nvar toIObject = __webpack_require__(7);\nvar arrayIndexOf = __webpack_require__(30)(false);\nvar IE_PROTO = __webpack_require__(33)('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports) {\n\nvar toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = __webpack_require__(7);\nvar toLength = __webpack_require__(31);\nvar toAbsoluteIndex = __webpack_require__(32);\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 7.1.15 ToLength\nvar toInteger = __webpack_require__(10);\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar toInteger = __webpack_require__(10);\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar shared = __webpack_require__(34)('keys');\nvar uid = __webpack_require__(36);\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar core = __webpack_require__(1);\nvar global = __webpack_require__(0);\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: __webpack_require__(35) ? 'pure' : 'global',\n copyright: '© 2018 Denis Pushkarev (zloirock.ru)'\n});\n\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports) {\n\nmodule.exports = true;\n\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports) {\n\nvar id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports) {\n\n// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports) {\n\nexports.f = Object.getOwnPropertySymbols;\n\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports) {\n\nexports.f = {}.propertyIsEnumerable;\n\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// 7.1.13 ToObject(argument)\nvar defined = __webpack_require__(9);\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n\n\n/***/ }),\n/* 41 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_Notify_vue__ = __webpack_require__(11);\n/* unused harmony namespace reexport */\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_4e19f58f_hasScoped_true_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_Notify_vue__ = __webpack_require__(50);\nfunction injectStyle (ssrContext) {\n __webpack_require__(42)\n}\nvar normalizeComponent = __webpack_require__(47)\n/* script */\n\n\n/* template */\n\n/* template functional */\nvar __vue_template_functional__ = false\n/* styles */\nvar __vue_styles__ = injectStyle\n/* scopeId */\nvar __vue_scopeId__ = \"data-v-4e19f58f\"\n/* moduleIdentifier (server only) */\nvar __vue_module_identifier__ = null\nvar Component = normalizeComponent(\n __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_Notify_vue__[\"a\" /* default */],\n __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_4e19f58f_hasScoped_true_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_Notify_vue__[\"a\" /* default */],\n __vue_template_functional__,\n __vue_styles__,\n __vue_scopeId__,\n __vue_module_identifier__\n)\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (Component.exports);\n\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// style-loader: Adds some css to the DOM by adding a \n\n\n\n\n// WEBPACK FOOTER //\n// src/Notify.vue","module.exports = require('../src/index.js')\n\n\n\n// WEBPACK FOOTER //\n// ./build/prod.js","import VueNotify from './Notify.vue'\n\nexport default {\n install (Vue, options = {}) {\n // Create component instance\n let Constr = Vue.extend(VueNotify)\n let Notify = new Constr()\n\n // Apply configuration\n Notify.options = Object.assign(Notify.options, options)\n\n // Mount it\n let vm = Notify.$mount()\n\n // Add it to the Vue application\n document.querySelector('body').appendChild(vm.$el)\n\n // Create generic method\n Vue.$notify = Vue.prototype.$notify = (msg, type = 'info', options = {}) => {\n Notify.addItem(type, msg, options)\n }\n Vue.$notify.info = Vue.prototype.$notify.info = (msg, options = {}) => {\n Notify.addItem('info', msg, options)\n }\n Vue.$notify.success = Vue.prototype.$notify.success = (msg, options = {}) => {\n Notify.addItem('success', msg, options)\n }\n Vue.$notify.error =\n Vue.prototype.$notify.error =\n Vue.$notify.danger =\n Vue.prototype.$notify.danger = (msg, options = {}) => {\n Notify.addItem('error', msg, options)\n }\n Vue.$notify.warning = Vue.prototype.$notify.warning = (msg, options = {}) => {\n Notify.addItem('warning', msg, options)\n }\n // Create setTypes method\n Vue.$notify.setTypes = Vue.prototype.$notify.setTypes = (types) => {\n Notify.setTypes(types)\n }\n Vue.$notify.removeAll = Vue.prototype.$notify.removeAll = () => {\n Notify.removeAll()\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","require('../../modules/es6.object.assign');\nmodule.exports = require('../../modules/_core').Object.assign;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/fn/object/assign.js\n// module id = 14\n// module chunks = 0","// 19.1.3.1 Object.assign(target, source)\nvar $export = require('./_export');\n\n$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/es6.object.assign.js\n// module id = 15\n// module chunks = 0","var global = require('./_global');\nvar core = require('./_core');\nvar ctx = require('./_ctx');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var IS_WRAP = type & $export.W;\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE];\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];\n var key, own, out;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if (own && has(exports, key)) continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function (C) {\n var F = function (a, b, c) {\n if (this instanceof C) {\n switch (arguments.length) {\n case 0: return new C();\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if (IS_PROTO) {\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_export.js\n// module id = 16\n// module chunks = 0","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_ctx.js\n// module id = 17\n// module chunks = 0","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_a-function.js\n// module id = 18\n// module chunks = 0","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_hide.js\n// module id = 19\n// module chunks = 0","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_object-dp.js\n// module id = 20\n// module chunks = 0","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_an-object.js\n// module id = 21\n// module chunks = 0","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_ie8-dom-define.js\n// module id = 22\n// module chunks = 0","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_dom-create.js\n// module id = 23\n// module chunks = 0","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_to-primitive.js\n// module id = 24\n// module chunks = 0","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_property-desc.js\n// module id = 25\n// module chunks = 0","'use strict';\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nvar toObject = require('./_to-object');\nvar IObject = require('./_iobject');\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || require('./_fails')(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = gOPS.f;\n var isEnum = pIE.f;\n while (aLen > index) {\n var S = IObject(arguments[index++]);\n var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];\n } return T;\n} : $assign;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_object-assign.js\n// module id = 26\n// module chunks = 0","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_object-keys.js\n// module id = 27\n// module chunks = 0","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_object-keys-internal.js\n// module id = 28\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_cof.js\n// module id = 29\n// module chunks = 0","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_array-includes.js\n// module id = 30\n// module chunks = 0","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_to-length.js\n// module id = 31\n// module chunks = 0","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_to-absolute-index.js\n// module id = 32\n// module chunks = 0","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_shared-key.js\n// module id = 33\n// module chunks = 0","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2018 Denis Pushkarev (zloirock.ru)'\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_shared.js\n// module id = 34\n// module chunks = 0","module.exports = true;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_library.js\n// module id = 35\n// module chunks = 0","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_uid.js\n// module id = 36\n// module chunks = 0","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_enum-bug-keys.js\n// module id = 37\n// module chunks = 0","exports.f = Object.getOwnPropertySymbols;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_object-gops.js\n// module id = 38\n// module chunks = 0","exports.f = {}.propertyIsEnumerable;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_object-pie.js\n// module id = 39\n// module chunks = 0","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/library/modules/_to-object.js\n// module id = 40\n// module chunks = 0","function injectStyle (ssrContext) {\n require(\"!!vue-style-loader!css-loader!../node_modules/vue-loader/lib/style-compiler/index?{\\\"vue\\\":true,\\\"id\\\":\\\"data-v-4e19f58f\\\",\\\"scoped\\\":true,\\\"hasInlineConfig\\\":false}!sass-loader?indentedSyntax!../node_modules/vue-loader/lib/selector?type=styles&index=0!./Notify.vue\")\n}\nvar normalizeComponent = require(\"!../node_modules/vue-loader/lib/component-normalizer\")\n/* script */\nexport * from \"!!babel-loader!../node_modules/vue-loader/lib/selector?type=script&index=0!./Notify.vue\"\nimport __vue_script__ from \"!!babel-loader!../node_modules/vue-loader/lib/selector?type=script&index=0!./Notify.vue\"\n/* template */\nimport __vue_template__ from \"!!../node_modules/vue-loader/lib/template-compiler/index?{\\\"id\\\":\\\"data-v-4e19f58f\\\",\\\"hasScoped\\\":true,\\\"buble\\\":{\\\"transforms\\\":{}}}!../node_modules/vue-loader/lib/selector?type=template&index=0!./Notify.vue\"\n/* template functional */\nvar __vue_template_functional__ = false\n/* styles */\nvar __vue_styles__ = injectStyle\n/* scopeId */\nvar __vue_scopeId__ = \"data-v-4e19f58f\"\n/* moduleIdentifier (server only) */\nvar __vue_module_identifier__ = null\nvar Component = normalizeComponent(\n __vue_script__,\n __vue_template__,\n __vue_template_functional__,\n __vue_styles__,\n __vue_scopeId__,\n __vue_module_identifier__\n)\n\nexport default Component.exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/Notify.vue\n// module id = 41\n// module chunks = 0","// style-loader: Adds some css to the DOM by adding a 65 | 158 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import VueNotify from './Notify.vue' 2 | 3 | export default { 4 | install (Vue, options = {}) { 5 | // Create component instance 6 | let Constr = Vue.extend(VueNotify) 7 | let Notify = new Constr() 8 | 9 | // Apply configuration 10 | Notify.options = Object.assign(Notify.options, options) 11 | 12 | // Mount it 13 | let vm = Notify.$mount() 14 | 15 | // Add it to the Vue application 16 | document.querySelector('body').appendChild(vm.$el) 17 | 18 | // Create generic method 19 | Vue.$notify = Vue.prototype.$notify = (msg, type = 'info', options = {}) => { 20 | Notify.addItem(type, msg, options) 21 | } 22 | Vue.$notify.info = Vue.prototype.$notify.info = (msg, options = {}) => { 23 | Notify.addItem('info', msg, options) 24 | } 25 | Vue.$notify.success = Vue.prototype.$notify.success = (msg, options = {}) => { 26 | Notify.addItem('success', msg, options) 27 | } 28 | Vue.$notify.error = 29 | Vue.prototype.$notify.error = 30 | Vue.$notify.danger = 31 | Vue.prototype.$notify.danger = (msg, options = {}) => { 32 | Notify.addItem('error', msg, options) 33 | } 34 | Vue.$notify.warning = Vue.prototype.$notify.warning = (msg, options = {}) => { 35 | Notify.addItem('warning', msg, options) 36 | } 37 | // Create setTypes method 38 | Vue.$notify.setTypes = Vue.prototype.$notify.setTypes = (types) => { 39 | Notify.setTypes(types) 40 | } 41 | Vue.$notify.removeAll = Vue.prototype.$notify.removeAll = () => { 42 | Notify.removeAll() 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/websmurf/vue2-notify/6838d4932159011848f20809f774779f85bba4ee/static/.gitkeep -------------------------------------------------------------------------------- /test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue' 9 | ], 10 | moduleNameMapper: { 11 | '^src/(.*)$': '/src/$1' 12 | }, 13 | transform: { 14 | '^.+\\.js$': '/node_modules/babel-jest', 15 | '.*\\.(vue)$': '/node_modules/vue-jest' 16 | }, 17 | testPathIgnorePatterns: [ 18 | '/test/e2e' 19 | ], 20 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 21 | setupFiles: ['/test/unit/setup'], 22 | coverageReporters: ['html', 'text-summary'], 23 | coverageDirectory: '/test/unit/coverage', 24 | collectCoverageFrom: [ 25 | 'src/**/*.{js,vue}', 26 | '!src/index.js', 27 | '!**/node_modules/**' 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /test/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | -------------------------------------------------------------------------------- /test/unit/specs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/websmurf/vue2-notify/6838d4932159011848f20809f774779f85bba4ee/test/unit/specs/.gitkeep -------------------------------------------------------------------------------- /test/unit/specs/Notify.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import { shallow, mount } from '@vue/test-utils' 4 | import Notify from 'src/Notify' 5 | 6 | jest.useFakeTimers() 7 | 8 | describe('Notify.vue', () => { 9 | const defaultTypes = { 10 | info: { itemClass: 'alert-info', iconClass: 'fa fa-lg fa-info-circle' }, 11 | error: { itemClass: 'alert-danger', iconClass: 'fa fa-lg fa-exclamation-triangle' }, 12 | warning: { itemClass: 'alert-warning', iconClass: 'fa fa-lg fa-exclamation-circle' }, 13 | success: { itemClass: 'alert-success', iconClass: 'fa fa-lg fa-check-circle' } 14 | } 15 | 16 | it('should have a data function that defines default settings', () => { 17 | // Create component 18 | const wrapper = shallow(Notify) 19 | 20 | // Types should exist 21 | expect(wrapper.vm.types).toEqual(defaultTypes) 22 | 23 | // Options should exist and be set 24 | expect(wrapper.vm.options).toEqual({ 25 | itemClass: 'alert col-12', 26 | duration: 500, 27 | visibility: 2000, 28 | position: 'top-left', 29 | enter: 'slideDown', 30 | leave: 'slideUp', 31 | closeButtonClass: false, 32 | width: '300px', 33 | mode: 'text', 34 | permanent: false 35 | }) 36 | 37 | // Items should exist and be set 38 | expect(wrapper.vm.items).toEqual({}) 39 | }) 40 | 41 | it('has a width computed property that calculates the with based on the position', () => { 42 | // Create component 43 | const wrapper = shallow(Notify) 44 | 45 | // Check width 46 | expect(wrapper.vm.width).toBe('300px') 47 | 48 | // Set new value 49 | wrapper.setData({ 50 | options: { 51 | position: 'top-full' 52 | } 53 | }) 54 | 55 | // Check width 56 | expect(wrapper.vm.width).toBe('auto') 57 | 58 | // Set new value 59 | wrapper.setData({ 60 | options: { 61 | position: 'bottom-full' 62 | } 63 | }) 64 | 65 | // Check width 66 | expect(wrapper.vm.width).toBe('auto') 67 | }) 68 | 69 | it('has a setType method that overwrites the existing array', () => { 70 | // Create component 71 | const wrapper = shallow(Notify) 72 | 73 | // This should be the default set 74 | expect(wrapper.vm.types).toEqual(defaultTypes) 75 | 76 | const types = { 77 | info: { itemClass: 'is-info', }, 78 | error: { itemClass: 'is-danger' }, 79 | warning: { itemClass: 'is-warning' }, 80 | success: { itemClass: 'is-success', iconClass: 'fa fa-lg fa-check-circle' } 81 | } 82 | 83 | // Call function 84 | wrapper.vm.setTypes(types) 85 | 86 | expect(wrapper.vm.types).toEqual(types) 87 | }) 88 | 89 | it('should have an addItem method that adds an item with default settings to the items list', () => { 90 | // Create component 91 | const wrapper = shallow(Notify) 92 | 93 | // Call method logic 94 | wrapper.vm.addItem.call(Notify, 'error', 'This is an error message') 95 | wrapper.vm.addItem.call(Notify, 'info', 'This is an info message') 96 | 97 | expect(wrapper.vm.items).toEqual({ 98 | 0: { 99 | type: 'error', 100 | text: 'This is an error message', 101 | options: { 102 | iconClass: 'fa fa-lg fa-exclamation-triangle', 103 | itemClass: ['alert col-12', 'alert-danger'], 104 | visibility: 2000, 105 | mode: 'text', 106 | closeButtonClass: false, 107 | permanent: false 108 | } 109 | }, 110 | 1: { 111 | type: 'info', 112 | text: 'This is an info message', 113 | options: { 114 | iconClass: 'fa fa-lg fa-info-circle', 115 | itemClass: ['alert col-12', 'alert-info'], 116 | visibility: 2000, 117 | mode: 'text', 118 | closeButtonClass: false, 119 | permanent: false 120 | } 121 | } 122 | }) 123 | 124 | // Move timer forward 125 | jest.advanceTimersByTime(2500); 126 | 127 | // Should be empty now 128 | expect(wrapper.vm.items).toEqual({}) 129 | }) 130 | 131 | it('should have an addItem method that adds an item with custom settings to the items list', () => { 132 | // Create component 133 | const wrapper = shallow(Notify) 134 | 135 | // Stub out removeItem 136 | wrapper.vm.removeItem = jest.fn() 137 | 138 | // Call method logic 139 | wrapper.vm.addItem.call(Notify, 'error', 'This is an error message', { iconClass: 'icon', itemClass: 'item', visibility: 10000, mode: 'html', closeButtonClass: 'bulma', permanent: true }) 140 | 141 | expect(wrapper.vm.items).toEqual({ 142 | 0: { 143 | type: 'error', 144 | text: 'This is an error message', 145 | options: { 146 | iconClass: 'icon', 147 | itemClass: 'item', 148 | visibility: 10000, 149 | mode: 'html', 150 | closeButtonClass: 'bulma', 151 | permanent: true 152 | } 153 | } 154 | }) 155 | 156 | // Move timer forward 157 | jest.advanceTimersByTime(10500); 158 | 159 | // Remove should not be not be called on permanent items 160 | expect(wrapper.vm.items).toEqual({ 161 | 0: { 162 | type: 'error', 163 | text: 'This is an error message', 164 | options: { 165 | iconClass: 'icon', 166 | itemClass: 'item', 167 | visibility: 10000, 168 | mode: 'html', 169 | closeButtonClass: 'bulma', 170 | permanent: true 171 | } 172 | } 173 | }) 174 | }) 175 | 176 | it('should have an addItem method that doesn\'t add an item if the item already exists', () => { 177 | // Create component 178 | const wrapper = shallow(Notify) 179 | 180 | // Stub out removeItem 181 | wrapper.vm.removeItem = jest.fn() 182 | 183 | // Call method logic 184 | wrapper.vm.addItem.call(Notify, 'error', 'This is an error message') 185 | wrapper.vm.addItem.call(Notify, 'error', 'This is an error message') 186 | wrapper.vm.addItem.call(Notify, 'error', 'This is an error message') 187 | wrapper.vm.addItem.call(Notify, 'error', 'This is an error message') 188 | 189 | expect(wrapper.vm.items).toEqual({ 190 | 0: { 191 | type: 'error', 192 | text: 'This is an error message', 193 | options: { 194 | iconClass: 'fa fa-lg fa-exclamation-triangle', 195 | itemClass: ['alert col-12', 'alert-danger'], 196 | visibility: 2000, 197 | mode: 'text', 198 | closeButtonClass: false, 199 | permanent: false 200 | } 201 | } 202 | }) 203 | }) 204 | 205 | it('should have a removeAll method that clears the messages list', () => { 206 | // Create component 207 | const wrapper = shallow(Notify) 208 | 209 | // Create items list 210 | wrapper.setData({ 211 | items: { 212 | 0: { 213 | type: 'error', 214 | text: 'This is an error message', 215 | options: { 216 | iconClass: 'fa fa-lg fa-exclamation-triangle', 217 | itemClass: ['alert col-12', 'alert-danger'], 218 | visibility: 2000, 219 | mode: 'text', 220 | closeButtonClass: false, 221 | permanent: false 222 | } 223 | }, 224 | 1: { 225 | type: 'error', 226 | text: 'This is an error message', 227 | options: { 228 | iconClass: 'fa fa-lg fa-exclamation-triangle', 229 | itemClass: ['alert col-12', 'alert-danger'], 230 | visibility: 2000, 231 | mode: 'text', 232 | closeButtonClass: false, 233 | permanent: false 234 | } 235 | } 236 | } 237 | }) 238 | 239 | // Call method 240 | wrapper.vm.removeAll() 241 | 242 | // Items should be empty 243 | expect(wrapper.vm.items).toEqual({}) 244 | }) 245 | 246 | it('renders an empty notify element correctly', () => { 247 | // Create component 248 | const wrapper = mount(Notify) 249 | 250 | // Validations 251 | expect(wrapper.html()).toMatchSnapshot() 252 | }) 253 | 254 | it('renders a notification correctly', () => { 255 | // Create component 256 | const wrapper = mount(Notify) 257 | 258 | // Call method logic 259 | wrapper.vm.addItem.call(Notify, 'info', 'This is an info message') 260 | 261 | // Validations 262 | expect(wrapper.html()).toMatchSnapshot() 263 | }) 264 | }) 265 | -------------------------------------------------------------------------------- /test/unit/specs/__snapshots__/Notify.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Notify.vue renders a notification correctly 1`] = ` 4 |
This is an info message
5 |
6 |
7 |
8 | `; 9 | 10 | exports[`Notify.vue renders an empty notify element correctly 1`] = `
`; 11 | -------------------------------------------------------------------------------- /types/vue2-notify.d.ts: -------------------------------------------------------------------------------- 1 | declare module "vue2-notify" { 2 | import { PluginFunction } from "vue" 3 | 4 | export const install: PluginFunction<{}> 5 | 6 | type notifyOptions = { 7 | itemClass: string 8 | duration: number 9 | visibility: number 10 | position: string 11 | enter: string 12 | leave: string 13 | closeButtonClass: boolean 14 | width: string 15 | mode: string 16 | permanent: boolean 17 | } 18 | 19 | type notifyTypeOptions = { 20 | itemClass: string 21 | iconClass: string 22 | } 23 | 24 | type notifyTypes = { 25 | [key: string]: notifyTypeOptions 26 | } 27 | 28 | interface Notify { 29 | (msg: string, type: string, options: notifyOptions): void 30 | info(msg: string, options: notifyOptions): void 31 | error(msg: string, options: notifyOptions): void 32 | danger(msg: string, options: notifyOptions): void 33 | warning(msg: string, options: notifyOptions): void 34 | setTypes(types: notifyTypes): void 35 | removeAll(): void 36 | } 37 | 38 | module "vue/types/vue" { 39 | interface Vue { 40 | $notify: Notify 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var entry = process.env.NODE_ENV === 'production' ? './build/prod.js' : './build/dev.js' 3 | var externalsDep = require('externals-dependencies') 4 | var webpack = require('webpack') 5 | 6 | module.exports = { 7 | entry: entry, 8 | output: { 9 | path: path.resolve(__dirname, './dist'), 10 | publicPath: '/dist/', 11 | filename: 'build.js' 12 | }, 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.css$/, 17 | use: [ 18 | 'vue-style-loader', 19 | 'css-loader' 20 | ], 21 | }, 22 | { 23 | test: /\.scss$/, 24 | use: [ 25 | 'vue-style-loader', 26 | 'css-loader', 27 | 'sass-loader' 28 | ], 29 | }, 30 | { 31 | test: /\.sass$/, 32 | use: [ 33 | 'vue-style-loader', 34 | 'css-loader', 35 | 'sass-loader?indentedSyntax' 36 | ], 37 | }, 38 | { 39 | test: /\.vue$/, 40 | loader: 'vue-loader', 41 | options: { 42 | loaders: { 43 | // Since sass-loader (weirdly) has SCSS as its default parse mode, we map 44 | // the "scss" and "sass" values for the lang attribute to the right configs here. 45 | // other preprocessors should work out of the box, no loader config like this necessary. 46 | 'scss': [ 47 | 'vue-style-loader', 48 | 'css-loader', 49 | 'sass-loader' 50 | ], 51 | 'sass': [ 52 | 'vue-style-loader', 53 | 'css-loader', 54 | 'sass-loader?indentedSyntax' 55 | ] 56 | } 57 | // other vue-loader options go here 58 | } 59 | }, 60 | { 61 | test: /\.js$/, 62 | loader: 'babel-loader', 63 | exclude: /node_modules/ 64 | }, 65 | { 66 | test: /\.(png|jpg|gif|svg)$/, 67 | loader: 'file-loader', 68 | options: { 69 | name: '[name].[ext]?[hash]' 70 | } 71 | } 72 | ] 73 | }, 74 | resolve: { 75 | alias: { 76 | 'vue$': 'vue/dist/vue.esm.js' 77 | }, 78 | extensions: ['*', '.js', '.vue', '.json'] 79 | }, 80 | devServer: { 81 | historyApiFallback: true, 82 | noInfo: true, 83 | overlay: true 84 | }, 85 | performance: { 86 | hints: false 87 | }, 88 | devtool: '#eval-source-map' 89 | } 90 | 91 | if (process.env.NODE_ENV === 'production') { 92 | module.exports.output.libraryTarget = 'commonjs2' 93 | module.exports.externals = [externalsDep(['peerDependencies'])] 94 | module.exports.devtool = '#source-map' 95 | // http://vue-loader.vuejs.org/en/workflow/production.html 96 | module.exports.plugins = (module.exports.plugins || []).concat([ 97 | new webpack.DefinePlugin({ 98 | 'process.env': { 99 | NODE_ENV: '"production"' 100 | } 101 | }), 102 | new webpack.optimize.UglifyJsPlugin({ 103 | sourceMap: true, 104 | compress: { 105 | warnings: false 106 | } 107 | }), 108 | new webpack.LoaderOptionsPlugin({ 109 | minimize: true 110 | }) 111 | ]) 112 | } 113 | --------------------------------------------------------------------------------