@vuesimple/vs-alert 1.4.15 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,19 +31,13 @@ Code Sandbox: [Link](https://codesandbox.io/s/vs-alert-yhjce)
31
31
  npm i @vuesimple/vs-alert
32
32
  ```
33
33
 
34
- ```bash
35
- yarn add @vuesimple/vs-alert
36
- ```
37
-
38
34
  <br />
39
35
 
40
36
  ### 🚀 Usage
41
37
 
42
38
  ```html
43
39
  <template>
44
- <vs-alert variant="success">
45
- Success
46
- </vs-alert>
40
+ <vs-alert variant="success"> Success </vs-alert>
47
41
  </template>
48
42
 
49
43
  <script>
@@ -65,11 +59,14 @@ yarn add @vuesimple/vs-alert
65
59
  <script src="https://unpkg.com/@vuesimple/vs-alert@<version>/dist/vs-alert.min.js"></script>
66
60
  ```
67
61
 
62
+ ```javascript
63
+ // Main/Entry file
64
+ app.use(VsAlert);
65
+ ```
66
+
68
67
  ```html
69
68
  <template>
70
- <vs-alert variant="success">
71
- Success
72
- </vs-alert>
69
+ <vs-alert variant="success"> Success </vs-alert>
73
70
  </template>
74
71
  ```
75
72
 
@@ -106,9 +103,7 @@ After installation,
106
103
 
107
104
  ```html
108
105
  <template>
109
- <vs-alert variant="success">
110
- Success
111
- </vs-alert>
106
+ <vs-alert variant="success"> Success </vs-alert>
112
107
  </template>
113
108
  ```
114
109
 
@@ -3,6 +3,8 @@ import buble from '@rollup/plugin-buble';
3
3
  import image from '@rollup/plugin-image';
4
4
  import vue from 'rollup-plugin-vue';
5
5
  import minimist from 'minimist';
6
+ import peerDepsExternal from 'rollup-plugin-peer-deps-external';
7
+ import postcss from 'rollup-plugin-postcss';
6
8
 
7
9
  const argv = minimist(process.argv.slice(2));
8
10
 
@@ -14,12 +16,15 @@ const config = {
14
16
  },
15
17
  plugins: [
16
18
  vue({
17
- css: true,
19
+ css: false,
18
20
  compileTemplate: true,
19
21
  needMap: false,
22
+ preprocessStyles: true,
20
23
  }),
24
+ postcss(),
21
25
  buble(),
22
26
  image(),
27
+ peerDepsExternal(),
23
28
  ],
24
29
  };
25
30
 
@@ -0,0 +1,33 @@
1
+ import vue from '@vitejs/plugin-vue';
2
+ import VitePluginStyleInject from 'vite-plugin-style-inject';
3
+
4
+ export default {
5
+ plugins: [vue(), VitePluginStyleInject()],
6
+ build: {
7
+ // separate css file or not
8
+ cssCodeSplit: false,
9
+ lib: {
10
+ entry: './src/index.js',
11
+ formats: ['es', 'umd', 'iife'],
12
+ name: 'VsAlert',
13
+ fileName: format => {
14
+ if (format === 'es') {
15
+ return 'index.js';
16
+ }
17
+ if (format === 'umd') {
18
+ return 'index.umd.js';
19
+ }
20
+ return 'index.min.js';
21
+ },
22
+ },
23
+ rollupOptions: {
24
+ // Not to bundle vue core in this plugin
25
+ external: ['vue'],
26
+ output: {
27
+ globals: {
28
+ vue: 'Vue',
29
+ },
30
+ },
31
+ },
32
+ },
33
+ };
package/dist/index.js ADDED
@@ -0,0 +1,226 @@
1
+ (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-alert{--vs-alert-success-bc: #aecfc2;--vs-alert-success-bg: #edf8f4;--vs-alert-success-color: #186146;--vs-alert-success-icon: #038153;--vs-alert-warning-bc: #fed6a8;--vs-alert-warning-bg: #fff7ed;--vs-alert-warning-color: #ad5918;--vs-alert-warning-icon: #ad5918;--vs-alert-error-bc: #f5b5ba;--vs-alert-error-bg: #fff0f1;--vs-alert-error-color: #8c232c;--vs-alert-error-icon: #cc3340;--vs-alert-info-bc: #adcce4;--vs-alert-info-bg: #edf7ff;--vs-alert-info-color: #1f73b7;--vs-alert-info-icon: #337fbd;--vs-alert-secondary-bc: #d8dcde;--vs-alert-secondary-bg: #f8f9f9;--vs-alert-secondary-color: #68737d;--vs-alert-secondary-icon: #68737d;position:relative;border-radius:4px;padding:20px 20px 20px 40px;line-height:1.42857;font-size:14px}.vs-alert-icon__wrapper svg{position:absolute;left:15px;margin-top:1px}.vs-alert__heading{font-weight:600;filter:brightness(85%)}.vs-alert-button{display:block;position:absolute;top:15px;right:10px;transition:background-color .1s ease-in-out 0s,color .25s ease-in-out 0s;border:none;background-color:transparent;cursor:pointer;padding:0;width:28px;height:28px;overflow:hidden;color:#333;font-size:0px;user-select:none}.vs-alert-button.success{color:var(--vs-alert-success-color)}.vs-alert-button.warning{color:var(--vs-alert-warning-color)}.vs-alert-button.error{color:var(--vs-alert-error-color)}.vs-alert-button.info{color:var(--vs-alert-info-color)}.vs-alert-button.secondary{color:var(--vs-alert-secondary-color)}.vs-alert-success{border:1px solid var(--vs-alert-success-bc);background-color:var(--vs-alert-success-bg);color:var(--vs-alert-success-color)}.vs-alert-warning{border:1px solid var(--vs-alert-warning-bc);background-color:var(--vs-alert-warning-bg);color:var(--vs-alert-warning-color)}.vs-alert-error{border:1px solid var(--vs-alert-error-bc);background-color:var(--vs-alert-error-bg);color:var(--vs-alert-error-color)}.vs-alert-info{border:1px solid var(--vs-alert-info-bc);background-color:var(--vs-alert-info-bg);color:var(--vs-alert-info-color)}.vs-alert-secondary{border:1px solid var(--vs-alert-secondary-bc);background-color:var(--vs-alert-secondary-bg);color:var(--vs-alert-secondary-color)}.vs-alert.vs-alert--small:not(.vs-alert--is-close){padding:12px 20px 12px 40px}.vs-alert.vs-alert--is-close:not(.vs-alert--small){padding:20px 40px}.vs-alert.vs-alert--is-close.vs-alert--small{padding:12px 40px}.vs-alert.vs-alert--is-close.vs-alert--small .vs-alert-button{top:8px}.vs-alert--no-bg{background-color:transparent;border-color:transparent;padding:0 22px;font-size:13px}.vs-alert--no-bg .vs-alert-icon__wrapper svg{left:0;margin-top:0}.vs-alert--no-bg.vs-alert-warning{color:var(--vs-alert-warning-icon)}.vs-alert--no-bg.vs-alert-error{color:var(--vs-alert-error-icon)}.vs-alert--toast{background-color:transparent;border:solid 1px #d8dcde;color:#2f3941;box-shadow:#17494d26 0 20px 28px;padding:15px 40px}.vs-alert--toast .vs-alert__heading{filter:brightness(100%)}.vs-alert--toast.vs-alert-success .vs-alert__heading{color:var(--vs-alert-success-icon)}.vs-alert--toast.vs-alert-warning .vs-alert__heading{color:var(--vs-alert-warning-icon)}.vs-alert--toast.vs-alert-error .vs-alert__heading{color:var(--vs-alert-error-icon)}.vs-alert--toast.vs-alert-info .vs-alert__heading{color:var(--vs-alert-info-icon)}.vs-alert--toast.vs-alert-secondary .vs-alert__heading{color:var(--vs-alert-secondary-icon)}.vs-alert--toast .vs-alert-button{color:#68737d;top:10px}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import { openBlock as o, createElementBlock as l, normalizeClass as d, createElementVNode as e, renderSlot as a, createCommentVNode as n, Fragment as v, createTextVNode as _, toDisplayString as u } from "vue";
2
+ const w = (s, r) => {
3
+ const t = s.__vccOpts || s;
4
+ for (const [i, c] of r)
5
+ t[i] = c;
6
+ return t;
7
+ }, g = {
8
+ name: "VsAlert",
9
+ props: {
10
+ variant: {
11
+ type: String,
12
+ required: !0,
13
+ validator: (s) => ["success", "error", "info", "warning", "secondary"].includes(s.toLowerCase())
14
+ },
15
+ showClose: {
16
+ type: Boolean,
17
+ default: !1
18
+ },
19
+ title: {
20
+ type: String
21
+ },
22
+ noBg: {
23
+ type: Boolean,
24
+ default: !1
25
+ },
26
+ small: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ toast: {
31
+ type: Boolean,
32
+ default: !1
33
+ }
34
+ },
35
+ computed: {
36
+ classList() {
37
+ return [
38
+ `vs-alert-${this.variant}`,
39
+ { "vs-alert--no-bg": this.noBg },
40
+ { "vs-alert--small": this.small },
41
+ { "vs-alert--toast": this.toast },
42
+ { "vs-alert--is-close": this.showClose }
43
+ ];
44
+ }
45
+ }
46
+ }, f = { class: "vs-alert-icon__wrapper" }, p = {
47
+ key: 0,
48
+ xmlns: "http://www.w3.org/2000/svg",
49
+ width: "16",
50
+ height: "16",
51
+ viewBox: "0 0 16 16",
52
+ role: "presentation",
53
+ focussable: "false"
54
+ }, y = /* @__PURE__ */ e("g", {
55
+ fill: "none",
56
+ stroke: "var(--vs-alert-success-icon)"
57
+ }, [
58
+ /* @__PURE__ */ e("path", {
59
+ "stroke-linecap": "round",
60
+ "stroke-linejoin": "round",
61
+ d: "M4 9l2.5 2.5 5-5"
62
+ }),
63
+ /* @__PURE__ */ e("circle", {
64
+ cx: "7.5",
65
+ cy: "8.5",
66
+ r: "7"
67
+ })
68
+ ], -1), k = [
69
+ y
70
+ ], m = {
71
+ key: 1,
72
+ xmlns: "http://www.w3.org/2000/svg",
73
+ width: "16",
74
+ height: "16",
75
+ viewBox: "0 0 16 16",
76
+ role: "presentation",
77
+ focussable: "false"
78
+ }, x = /* @__PURE__ */ e("path", {
79
+ fill: "none",
80
+ stroke: "var(--vs-alert-warning-icon)",
81
+ "stroke-linecap": "round",
82
+ d: "M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"
83
+ }, null, -1), B = /* @__PURE__ */ e("circle", {
84
+ cx: "7.5",
85
+ cy: "12",
86
+ r: "1",
87
+ fill: "#ad5918"
88
+ }, null, -1), b = [
89
+ x,
90
+ B
91
+ ], C = {
92
+ key: 2,
93
+ xmlns: "http://www.w3.org/2000/svg",
94
+ width: "16",
95
+ height: "16",
96
+ viewBox: "0 0 16 16",
97
+ role: "presentation",
98
+ focussable: "false"
99
+ }, V = /* @__PURE__ */ e("g", {
100
+ fill: "none",
101
+ stroke: "var(--vs-alert-error-icon)"
102
+ }, [
103
+ /* @__PURE__ */ e("circle", {
104
+ cx: "7.5",
105
+ cy: "8.5",
106
+ r: "7"
107
+ }),
108
+ /* @__PURE__ */ e("path", {
109
+ "stroke-linecap": "round",
110
+ d: "M7.5 4.5V9"
111
+ })
112
+ ], -1), M = /* @__PURE__ */ e("circle", {
113
+ cx: "7.5",
114
+ cy: "12",
115
+ r: "1",
116
+ fill: "var(--vs-alert-error-icon)"
117
+ }, null, -1), L = [
118
+ V,
119
+ M
120
+ ], A = {
121
+ key: 3,
122
+ xmlns: "http://www.w3.org/2000/svg",
123
+ width: "16",
124
+ height: "16",
125
+ viewBox: "0 0 16 16",
126
+ role: "presentation",
127
+ focussable: "false"
128
+ }, S = /* @__PURE__ */ e("g", { stroke: "var(--vs-alert-info-icon)" }, [
129
+ /* @__PURE__ */ e("circle", {
130
+ cx: "7.5",
131
+ cy: "8.5",
132
+ r: "7",
133
+ fill: "none"
134
+ }),
135
+ /* @__PURE__ */ e("path", {
136
+ "stroke-linecap": "round",
137
+ d: "M7.5 12.5V8"
138
+ })
139
+ ], -1), N = /* @__PURE__ */ e("circle", {
140
+ cx: "7.5",
141
+ cy: "5",
142
+ r: "1",
143
+ fill: "var(--vs-alert-info-icon)"
144
+ }, null, -1), z = [
145
+ S,
146
+ N
147
+ ], E = {
148
+ key: 4,
149
+ xmlns: "http://www.w3.org/2000/svg",
150
+ width: "16",
151
+ height: "16",
152
+ viewBox: "0 0 16 16",
153
+ role: "presentation",
154
+ focussable: "false"
155
+ }, j = /* @__PURE__ */ e("g", { stroke: "var(--vs-alert-secondary-icon)" }, [
156
+ /* @__PURE__ */ e("circle", {
157
+ cx: "7.5",
158
+ cy: "8.5",
159
+ r: "7",
160
+ fill: "none"
161
+ }),
162
+ /* @__PURE__ */ e("path", {
163
+ "stroke-linecap": "round",
164
+ d: "M7.5 12.5V8"
165
+ })
166
+ ], -1), q = /* @__PURE__ */ e("circle", {
167
+ cx: "7.5",
168
+ cy: "5",
169
+ r: "1",
170
+ fill: "var(--vs-alert-secondary-icon)"
171
+ }, null, -1), D = [
172
+ j,
173
+ q
174
+ ], F = { class: "vs-alert__heading" }, H = /* @__PURE__ */ e("svg", {
175
+ xmlns: "http://www.w3.org/2000/svg",
176
+ width: "12",
177
+ height: "12",
178
+ viewBox: "0 0 12 12",
179
+ role: "presentation",
180
+ focusable: "false"
181
+ }, [
182
+ /* @__PURE__ */ e("path", {
183
+ stroke: "currentColor",
184
+ "stroke-linecap": "round",
185
+ d: "M3 9l6-6m0 6L3 3"
186
+ })
187
+ ], -1), O = [
188
+ H
189
+ ];
190
+ function T(s, r, t, i, c, h) {
191
+ return o(), l("div", {
192
+ class: d(["vs-alert", h.classList])
193
+ }, [
194
+ e("span", f, [
195
+ a(s.$slots, "icon", {}, () => [
196
+ t.variant === "success" ? (o(), l("svg", p, k)) : n("", !0),
197
+ t.variant === "warning" ? (o(), l("svg", m, b)) : n("", !0),
198
+ t.variant === "error" ? (o(), l("svg", C, L)) : n("", !0),
199
+ t.variant === "info" ? (o(), l("svg", A, z)) : n("", !0),
200
+ t.variant === "secondary" ? (o(), l("svg", E, D)) : n("", !0)
201
+ ])
202
+ ]),
203
+ e("div", F, [
204
+ a(s.$slots, "title", {}, () => [
205
+ t.title ? (o(), l(v, { key: 0 }, [
206
+ _(u(t.title), 1)
207
+ ], 64)) : n("", !0)
208
+ ])
209
+ ]),
210
+ a(s.$slots, "default"),
211
+ t.showClose ? (o(), l("button", {
212
+ key: 0,
213
+ class: d(["vs-alert-button", t.variant]),
214
+ onClick: r[0] || (r[0] = (I) => s.$emit("close", !0)),
215
+ "aria-label": "Close"
216
+ }, O, 2)) : n("", !0)
217
+ ], 2);
218
+ }
219
+ const G = /* @__PURE__ */ w(g, [["render", T]]), K = {
220
+ install(s) {
221
+ s.component("VsAlert", G);
222
+ }
223
+ };
224
+ export {
225
+ K as default
226
+ };
@@ -0,0 +1 @@
1
+ (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-alert{--vs-alert-success-bc: #aecfc2;--vs-alert-success-bg: #edf8f4;--vs-alert-success-color: #186146;--vs-alert-success-icon: #038153;--vs-alert-warning-bc: #fed6a8;--vs-alert-warning-bg: #fff7ed;--vs-alert-warning-color: #ad5918;--vs-alert-warning-icon: #ad5918;--vs-alert-error-bc: #f5b5ba;--vs-alert-error-bg: #fff0f1;--vs-alert-error-color: #8c232c;--vs-alert-error-icon: #cc3340;--vs-alert-info-bc: #adcce4;--vs-alert-info-bg: #edf7ff;--vs-alert-info-color: #1f73b7;--vs-alert-info-icon: #337fbd;--vs-alert-secondary-bc: #d8dcde;--vs-alert-secondary-bg: #f8f9f9;--vs-alert-secondary-color: #68737d;--vs-alert-secondary-icon: #68737d;position:relative;border-radius:4px;padding:20px 20px 20px 40px;line-height:1.42857;font-size:14px}.vs-alert-icon__wrapper svg{position:absolute;left:15px;margin-top:1px}.vs-alert__heading{font-weight:600;filter:brightness(85%)}.vs-alert-button{display:block;position:absolute;top:15px;right:10px;transition:background-color .1s ease-in-out 0s,color .25s ease-in-out 0s;border:none;background-color:transparent;cursor:pointer;padding:0;width:28px;height:28px;overflow:hidden;color:#333;font-size:0px;user-select:none}.vs-alert-button.success{color:var(--vs-alert-success-color)}.vs-alert-button.warning{color:var(--vs-alert-warning-color)}.vs-alert-button.error{color:var(--vs-alert-error-color)}.vs-alert-button.info{color:var(--vs-alert-info-color)}.vs-alert-button.secondary{color:var(--vs-alert-secondary-color)}.vs-alert-success{border:1px solid var(--vs-alert-success-bc);background-color:var(--vs-alert-success-bg);color:var(--vs-alert-success-color)}.vs-alert-warning{border:1px solid var(--vs-alert-warning-bc);background-color:var(--vs-alert-warning-bg);color:var(--vs-alert-warning-color)}.vs-alert-error{border:1px solid var(--vs-alert-error-bc);background-color:var(--vs-alert-error-bg);color:var(--vs-alert-error-color)}.vs-alert-info{border:1px solid var(--vs-alert-info-bc);background-color:var(--vs-alert-info-bg);color:var(--vs-alert-info-color)}.vs-alert-secondary{border:1px solid var(--vs-alert-secondary-bc);background-color:var(--vs-alert-secondary-bg);color:var(--vs-alert-secondary-color)}.vs-alert.vs-alert--small:not(.vs-alert--is-close){padding:12px 20px 12px 40px}.vs-alert.vs-alert--is-close:not(.vs-alert--small){padding:20px 40px}.vs-alert.vs-alert--is-close.vs-alert--small{padding:12px 40px}.vs-alert.vs-alert--is-close.vs-alert--small .vs-alert-button{top:8px}.vs-alert--no-bg{background-color:transparent;border-color:transparent;padding:0 22px;font-size:13px}.vs-alert--no-bg .vs-alert-icon__wrapper svg{left:0;margin-top:0}.vs-alert--no-bg.vs-alert-warning{color:var(--vs-alert-warning-icon)}.vs-alert--no-bg.vs-alert-error{color:var(--vs-alert-error-icon)}.vs-alert--toast{background-color:transparent;border:solid 1px #d8dcde;color:#2f3941;box-shadow:#17494d26 0 20px 28px;padding:15px 40px}.vs-alert--toast .vs-alert__heading{filter:brightness(100%)}.vs-alert--toast.vs-alert-success .vs-alert__heading{color:var(--vs-alert-success-icon)}.vs-alert--toast.vs-alert-warning .vs-alert__heading{color:var(--vs-alert-warning-icon)}.vs-alert--toast.vs-alert-error .vs-alert__heading{color:var(--vs-alert-error-icon)}.vs-alert--toast.vs-alert-info .vs-alert__heading{color:var(--vs-alert-info-icon)}.vs-alert--toast.vs-alert-secondary .vs-alert__heading{color:var(--vs-alert-secondary-icon)}.vs-alert--toast .vs-alert-button{color:#68737d;top:10px}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();var VsAlert=function(e){"use strict";const x="",r=(o,s)=>{const t=o.__vccOpts||o;for(const[n,l]of s)t[n]=l;return t},c={name:"VsAlert",props:{variant:{type:String,required:!0,validator:o=>["success","error","info","warning","secondary"].includes(o.toLowerCase())},showClose:{type:Boolean,default:!1},title:{type:String},noBg:{type:Boolean,default:!1},small:{type:Boolean,default:!1},toast:{type:Boolean,default:!1}},computed:{classList(){return[`vs-alert-${this.variant}`,{"vs-alert--no-bg":this.noBg},{"vs-alert--small":this.small},{"vs-alert--toast":this.toast},{"vs-alert--is-close":this.showClose}]}}},a={class:"vs-alert-icon__wrapper"},i={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},d=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-success-icon)"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 9l2.5 2.5 5-5"}),e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"})],-1)],_={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},h=[e.createElementVNode("path",{fill:"none",stroke:"var(--vs-alert-warning-icon)","stroke-linecap":"round",d:"M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"},null,-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"#ad5918"},null,-1)],m={key:2,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},w=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-error-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 4.5V9"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"var(--vs-alert-error-icon)"},null,-1)],g={key:3,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},f=[e.createElementVNode("g",{stroke:"var(--vs-alert-info-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-info-icon)"},null,-1)],k={key:4,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},V=[e.createElementVNode("g",{stroke:"var(--vs-alert-secondary-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-secondary-icon)"},null,-1)],p={class:"vs-alert__heading"},y=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",role:"presentation",focusable:"false"},[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round",d:"M3 9l6-6m0 6L3 3"})],-1)];function E(o,s,t,n,l,B){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-alert",B.classList])},[e.createElementVNode("span",a,[e.renderSlot(o.$slots,"icon",{},()=>[t.variant==="success"?(e.openBlock(),e.createElementBlock("svg",i,d)):e.createCommentVNode("",!0),t.variant==="warning"?(e.openBlock(),e.createElementBlock("svg",_,h)):e.createCommentVNode("",!0),t.variant==="error"?(e.openBlock(),e.createElementBlock("svg",m,w)):e.createCommentVNode("",!0),t.variant==="info"?(e.openBlock(),e.createElementBlock("svg",g,f)):e.createCommentVNode("",!0),t.variant==="secondary"?(e.openBlock(),e.createElementBlock("svg",k,V)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",p,[e.renderSlot(o.$slots,"title",{},()=>[t.title?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.title),1)],64)):e.createCommentVNode("",!0)])]),e.renderSlot(o.$slots,"default"),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-alert-button",t.variant]),onClick:s[0]||(s[0]=D=>o.$emit("close",!0)),"aria-label":"Close"},y,2)):e.createCommentVNode("",!0)],2)}const N=r(c,[["render",E]]);return{install(o){o.component("VsAlert",N)}}}(Vue);
@@ -0,0 +1 @@
1
+ (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-alert{--vs-alert-success-bc: #aecfc2;--vs-alert-success-bg: #edf8f4;--vs-alert-success-color: #186146;--vs-alert-success-icon: #038153;--vs-alert-warning-bc: #fed6a8;--vs-alert-warning-bg: #fff7ed;--vs-alert-warning-color: #ad5918;--vs-alert-warning-icon: #ad5918;--vs-alert-error-bc: #f5b5ba;--vs-alert-error-bg: #fff0f1;--vs-alert-error-color: #8c232c;--vs-alert-error-icon: #cc3340;--vs-alert-info-bc: #adcce4;--vs-alert-info-bg: #edf7ff;--vs-alert-info-color: #1f73b7;--vs-alert-info-icon: #337fbd;--vs-alert-secondary-bc: #d8dcde;--vs-alert-secondary-bg: #f8f9f9;--vs-alert-secondary-color: #68737d;--vs-alert-secondary-icon: #68737d;position:relative;border-radius:4px;padding:20px 20px 20px 40px;line-height:1.42857;font-size:14px}.vs-alert-icon__wrapper svg{position:absolute;left:15px;margin-top:1px}.vs-alert__heading{font-weight:600;filter:brightness(85%)}.vs-alert-button{display:block;position:absolute;top:15px;right:10px;transition:background-color .1s ease-in-out 0s,color .25s ease-in-out 0s;border:none;background-color:transparent;cursor:pointer;padding:0;width:28px;height:28px;overflow:hidden;color:#333;font-size:0px;user-select:none}.vs-alert-button.success{color:var(--vs-alert-success-color)}.vs-alert-button.warning{color:var(--vs-alert-warning-color)}.vs-alert-button.error{color:var(--vs-alert-error-color)}.vs-alert-button.info{color:var(--vs-alert-info-color)}.vs-alert-button.secondary{color:var(--vs-alert-secondary-color)}.vs-alert-success{border:1px solid var(--vs-alert-success-bc);background-color:var(--vs-alert-success-bg);color:var(--vs-alert-success-color)}.vs-alert-warning{border:1px solid var(--vs-alert-warning-bc);background-color:var(--vs-alert-warning-bg);color:var(--vs-alert-warning-color)}.vs-alert-error{border:1px solid var(--vs-alert-error-bc);background-color:var(--vs-alert-error-bg);color:var(--vs-alert-error-color)}.vs-alert-info{border:1px solid var(--vs-alert-info-bc);background-color:var(--vs-alert-info-bg);color:var(--vs-alert-info-color)}.vs-alert-secondary{border:1px solid var(--vs-alert-secondary-bc);background-color:var(--vs-alert-secondary-bg);color:var(--vs-alert-secondary-color)}.vs-alert.vs-alert--small:not(.vs-alert--is-close){padding:12px 20px 12px 40px}.vs-alert.vs-alert--is-close:not(.vs-alert--small){padding:20px 40px}.vs-alert.vs-alert--is-close.vs-alert--small{padding:12px 40px}.vs-alert.vs-alert--is-close.vs-alert--small .vs-alert-button{top:8px}.vs-alert--no-bg{background-color:transparent;border-color:transparent;padding:0 22px;font-size:13px}.vs-alert--no-bg .vs-alert-icon__wrapper svg{left:0;margin-top:0}.vs-alert--no-bg.vs-alert-warning{color:var(--vs-alert-warning-icon)}.vs-alert--no-bg.vs-alert-error{color:var(--vs-alert-error-icon)}.vs-alert--toast{background-color:transparent;border:solid 1px #d8dcde;color:#2f3941;box-shadow:#17494d26 0 20px 28px;padding:15px 40px}.vs-alert--toast .vs-alert__heading{filter:brightness(100%)}.vs-alert--toast.vs-alert-success .vs-alert__heading{color:var(--vs-alert-success-icon)}.vs-alert--toast.vs-alert-warning .vs-alert__heading{color:var(--vs-alert-warning-icon)}.vs-alert--toast.vs-alert-error .vs-alert__heading{color:var(--vs-alert-error-icon)}.vs-alert--toast.vs-alert-info .vs-alert__heading{color:var(--vs-alert-info-icon)}.vs-alert--toast.vs-alert-secondary .vs-alert__heading{color:var(--vs-alert-secondary-icon)}.vs-alert--toast .vs-alert-button{color:#68737d;top:10px}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();(function(e,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("vue")):typeof define=="function"&&define.amd?define(["vue"],s):(e=typeof globalThis<"u"?globalThis:e||self,e.VsAlert=s(e.Vue))})(this,function(e){"use strict";const s="",c=(o,n)=>{const t=o.__vccOpts||o;for(const[l,r]of n)t[l]=r;return t},a={name:"VsAlert",props:{variant:{type:String,required:!0,validator:o=>["success","error","info","warning","secondary"].includes(o.toLowerCase())},showClose:{type:Boolean,default:!1},title:{type:String},noBg:{type:Boolean,default:!1},small:{type:Boolean,default:!1},toast:{type:Boolean,default:!1}},computed:{classList(){return[`vs-alert-${this.variant}`,{"vs-alert--no-bg":this.noBg},{"vs-alert--small":this.small},{"vs-alert--toast":this.toast},{"vs-alert--is-close":this.showClose}]}}},i={class:"vs-alert-icon__wrapper"},d={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},_=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-success-icon)"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 9l2.5 2.5 5-5"}),e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"})],-1)],h={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},m=[e.createElementVNode("path",{fill:"none",stroke:"var(--vs-alert-warning-icon)","stroke-linecap":"round",d:"M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"},null,-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"#ad5918"},null,-1)],f={key:2,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},w=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-error-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 4.5V9"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"var(--vs-alert-error-icon)"},null,-1)],g={key:3,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},p=[e.createElementVNode("g",{stroke:"var(--vs-alert-info-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-info-icon)"},null,-1)],k={key:4,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},V=[e.createElementVNode("g",{stroke:"var(--vs-alert-secondary-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-secondary-icon)"},null,-1)],y={class:"vs-alert__heading"},E=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",role:"presentation",focusable:"false"},[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round",d:"M3 9l6-6m0 6L3 3"})],-1)];function N(o,n,t,l,r,x){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-alert",x.classList])},[e.createElementVNode("span",i,[e.renderSlot(o.$slots,"icon",{},()=>[t.variant==="success"?(e.openBlock(),e.createElementBlock("svg",d,_)):e.createCommentVNode("",!0),t.variant==="warning"?(e.openBlock(),e.createElementBlock("svg",h,m)):e.createCommentVNode("",!0),t.variant==="error"?(e.openBlock(),e.createElementBlock("svg",f,w)):e.createCommentVNode("",!0),t.variant==="info"?(e.openBlock(),e.createElementBlock("svg",g,p)):e.createCommentVNode("",!0),t.variant==="secondary"?(e.openBlock(),e.createElementBlock("svg",k,V)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",y,[e.renderSlot(o.$slots,"title",{},()=>[t.title?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.title),1)],64)):e.createCommentVNode("",!0)])]),e.renderSlot(o.$slots,"default"),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-alert-button",t.variant]),onClick:n[0]||(n[0]=q=>o.$emit("close",!0)),"aria-label":"Close"},E,2)):e.createCommentVNode("",!0)],2)}const B=c(a,[["render",N]]);return{install(o){o.component("VsAlert",B)}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuesimple/vs-alert",
3
- "version": "1.4.15",
3
+ "version": "3.0.0",
4
4
  "description": "A simple vue alert. Perfect for all your alert scenarios.",
5
5
  "main": "dist/vs-alert.umd.js",
6
6
  "module": "dist/vs-alert.esm.js",
@@ -9,20 +9,14 @@
9
9
  "./sfc": "src/vs-alert.vue"
10
10
  },
11
11
  "scripts": {
12
- "build": "rm -rfv dist && npm run build:umd & npm run build:es & npm run build:unpkg",
13
- "build:umd": "rollup --config build/rollup.config.js --format umd --file dist/vs-alert.umd.js",
14
- "build:es": "rollup --config build/rollup.config.js --format es --file dist/vs-alert.esm.js",
15
- "build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/vs-alert.min.js"
12
+ "build": "rm -rfv dist && vite build --config build/vite.config.js"
16
13
  },
17
14
  "devDependencies": {
18
- "@rollup/plugin-buble": "0.21.3",
19
- "@rollup/plugin-image": "2.0.5",
20
- "minimist": "1.2.5",
21
- "rollup": "1.32.0",
22
- "rollup-plugin-terser": "6.1.0",
23
- "rollup-plugin-vue": "5.1.9",
24
- "vue": "2.6.10",
25
- "vue-template-compiler": "2.6.10"
15
+ "@vitejs/plugin-vue": "^3.0.1",
16
+ "sass": "^1.54.4",
17
+ "vite": "^3.0.5",
18
+ "vite-plugin-style-inject": "0.0.1",
19
+ "vue": "^3.2.37"
26
20
  },
27
21
  "private": false,
28
22
  "repository": {
@@ -52,5 +46,5 @@
52
46
  "url": "https://github.com/ashwinkshenoy/vue-simple/issues"
53
47
  },
54
48
  "homepage": "https://github.com/ashwinkshenoy/vue-simple/tree/master/packages/vs-alert",
55
- "gitHead": "e3d2d8adc6417d73ef774c0321eaa1ae10f24589"
49
+ "gitHead": "c666ac905df7e5b10f9198cd056cdd3fa88e212e"
56
50
  }
package/src/index.js CHANGED
@@ -1,28 +1,9 @@
1
- // Import vue component
2
1
  import VsAlert from './vs-alert.vue';
3
2
 
4
- // Declare install function executed by Vue.use()
5
- export function install(Vue) {
6
- if (install.installed) return;
7
- install.installed = true;
8
- Vue.component('VsAlert', VsAlert);
9
- }
10
-
11
- // Create module definition for Vue.use()
12
3
  const plugin = {
13
- install,
4
+ install(Vue) {
5
+ Vue.component('VsAlert', VsAlert);
6
+ },
14
7
  };
15
8
 
16
- // Auto-install when vue is found (eg. in browser via <script> tag)
17
- let GlobalVue = null;
18
- if (typeof window !== 'undefined') {
19
- GlobalVue = window.Vue;
20
- } else if (typeof global !== 'undefined') {
21
- GlobalVue = global.Vue;
22
- }
23
- if (GlobalVue) {
24
- GlobalVue.use(plugin);
25
- }
26
-
27
- // To allow use as module (npm/webpack/etc.) export component
28
- export default VsAlert;
9
+ export default plugin;